UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-#Author#
[所有文章分類]
所有文章分類
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • Newtonsoft.Json.JsonConvert.DeserializeObject 失敗的情況
    test...more
  • dotnet ef dbcontext scaffold
    ...more
  • [ASP.NET] 利用 aspnet_regiis 加密 web.config
    ...more
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • [錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
    ...more
  • 用 Javascript 跨網頁讀取 cookie (Cookie cross page, path of cookie)
    ...more
  • 線上客服 - MSN
    本人信箱被盜用以致資料外洩,是否可以請貴平台予以協助刪除該信箱之使用謝謝囉...more
  • 插入文字到游標或選取處
    aaaaa...more
  • IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
    太感謝你了~~~你救了我被windows 認證卡了好幾天QQ...more
  • PostgreSQL 的 monitor trigger
    FOR EACH ROW 可能要改為 FOR EACH STATEMENT ...more
標籤
  • ef
  • sp_
  • ad
  • 60
  • CS
  • [U2]
  • if
  • iisre
  • ASCII
  • 瘦身
  • WU
  • .
  • 8951
  • 難
  • ef ORDER B
  • 1
  • s3
  • visual stu
  • 無法載入檔案或組件
  • 15
  • 0
  • C#
  • message
  • IIS
  • i1wkRTnK
  • GDI
  • mathutil
  • print
  • contains
  • a
  • google
  • 手機版網頁
  • 54
  • HTML5
  • 8855-8767
  • 貼
  • 10
  • HTML
  • Rf
  • 8x4vDQYm
  • web.config
  • SSl
  • 5040
  • mvc
  • monitor
  • -8082
  • 706
  • 5324
  • end
  • 208
頁數 2 / 4 上一頁 下一頁
搜尋 replace 結果:
把 yyyymmdd 轉換成 yyyy-mm-dd 的神奇 javascript
試試這個:
"20190101".replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3')

取得 yyyyMMdd 的方法
var D = new Date();
D.toISOString().slice(0,10).replace(/-/g,"");
More...
Bike, 2019/8/21 下午 04:47:55
UW.ExcelPOI.DTToExcel2007 時 發生 GDI+ 中發生泛型錯誤。
轉換文章內容成為excel 檔案的時候
發生的錯誤
網路上查都好像是跟圖片有關的錯誤
後來才確認是 emoji 的問題
文章裡有出現

🙋‍♀️🙋‍♀️🙋‍♀️

這種東西 

SQL:
SQL 好像也沒辦法完美的取代 ( 如果有辦法對準是哪個字元就可以 但如果是一個字串好像會無法取代)
只有剛好對到那個字元開頭時才能換
NCHAR(65039)  NCHAR(8205)

Select TOP 10 
Replace(SUBSTRING(content,10,15),NCHAR(65039) ,'XX') ,                                    ---HongKong‍️‍️‍️🙋‍♀️怎
REPLACE(SUBSTRING(content,17,8),NCHAR(65039),'OO')                                        ---OO怎 
FROM [Table] 


C#
最後回到C#來處理
首先用 把string  .ToArray() 變成char
找出字元後 轉成 int 來確認要怎麼表達這個 char
最後結果就變成>>
Convert.ToInt32(Table.Rows[0]["Content"].ToString().ToArray());
之後直接變成 char去取代
row["mycolumn"].ToString().Replace((char)65039, ' ').Replace((char)8205, ' ');
然後就暫時 沒錯誤了
只是這網站一直再更新
https://emojipedia.org/unicode-12.0/

所以未來可能還會有新的問題
目前還不知道甚麼快速的解法







 
More...
sean, 2018/3/22 下午 03:21:41
字串擴充
先留個言, 有空來補內容.

VB
Public Module SqlStringExtention

    <Extension()>
    Function SQLStr(ByVal Original As String) As String
        Return Original.Replace("'", "''")
    End Function

    <Extension()>
    Function SQLTrim(ByVal Original As String) As String
        Return Original.Trim.Replace("'", "''")
    End Function

End Module

C#
//Extension methods must be defined in a static class
    public static class StringExtension
    {
        /// <summary>
        /// 把 ' 取代成 ''
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string sqlStr(this string value)
        {
            return value.Replace("'", "''");
        }

        /// <summary>
        /// 假設欄位名稱中不會有 [ 或 ] 的符號
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string sqlField(this string value)
        {
            return "[" + value.Replace("[", "").Replace("]", "") + "]";
        }
    }
More...
Bike, 2017/9/30 下午 04:51:18
in篩選欄位中被逗點分隔的資料
由於從欄位抓出的值 雖然是由逗點分隔 但整體資料容易被當成一組單一字串
例如
Table
#SomeTable
欄位 :
Id  MemberIds
值
1 12,30,58
2 45,68,88

想要篩選  where member_Id in (select MemberIds from SomeTable  where Id = 2)
會被當成  Id in ('45,68,88')  文字跟整數無法被篩選

解決方法之一

  create table #SomeTable (Id int,MemberIds nvarchar(30))
  insert into #SomeTable (Id,MemberIds) values (1,'12,30,58')
  insert into #SomeTable (Id,MemberIds) values (2,'45,68,88')
  select * from #SomeTable

  create table #TargetTable (Id int,member_Id  nvarchar(30))
  insert into #TargetTable (Id,member_Id ) values (1,12)
  insert into #TargetTable (Id,member_Id ) values (2,30)
  insert into #TargetTable (Id,member_Id ) values (3,45)
  insert into #TargetTable (Id,member_Id ) values (4,58)      
  insert into #TargetTable (Id,member_Id ) values (5,68)
  insert into #TargetTable (Id,member_Id ) values (6,88)
  select * from #TargetTable

DECLARE @MemberIds nvarchar(200);DECLARE @SQLString nvarchar(200);
select  @MemberIds =MemberIds  from #SomeTable(nolocK) where Id = 2
SET @SQLString = N' select * from #TargetTable   where member_Id in (' + @MemberIds  + ')' ;  
EXECUTE sp_executesql @SQLString

將整體都當成字串   就可以執行了

如果用逗點隔開如果用逗點隔開的是字串
如:
Hi,Im,String
可以先把它加上單引號
select '''' + Replace(MemberIds ,',','''' +',' + '''') + '''' from #SomeTable 






 
More...
sean, 2017/6/12 下午 12:09:48
中文難字的繁簡轉換處理
看到黑暗有一個關於中文難字的繁簡轉換處理的文章, 先記錄部份在這裡.

http://blog.darkthread.net/post-2015-03-06-strconv-half-full-width-notes.aspx

      var ncrString = toNCR("黑暗執行緒犇ABC123");
      Debug.WriteLine(ncrString); //黑暗執行緒&#29319;ABC123
      var convString = Microsoft.VisualBasic.Strings.StrConv(
        ncrString, Microsoft.VisualBasic.VbStrConv.Narrow, 1028);
      Debug.WriteLine(convString); //黑暗执行绪&#29319;ABC123
      var resultString = fromNCR(convString);
      Debug.WriteLine(resultString); //黑暗执行绪犇ABC123


    static string toNCR(string input)
    {  
      StringBuilder sb = new StringBuilder();
      Encoding big5 = Encoding.GetEncoding("big5");
      foreach (char c in input)
      {
        //強迫轉碼成Big5,看會不會變成問號
        string cInBig5 = big5.GetString(big5.GetBytes(new char[] {c}));
        //原來不是問號,轉碼後變問號,判定為難字
        if (c!='?' && cInBig5=="?")
          sb.AppendFormat("&#{0};", Convert.ToInt32(c));
        else
          sb.Append(c);
      }
      return sb.ToString();
    }
 
    static string fromNCR(string input)
    {
      return Regex.Replace(input, "&#(?<ncr>\\d+?);", (m) =>
      {
        return Convert.ToChar(int.Parse(m.Groups["ncr"].Value)).ToString();
      });
    }
More...
Bike, 2016/11/21 下午 12:40:54
在 PDF 加浮水印, 用 iTextSharp
找了兩三篇文章再加一點修正才組出來的,  記錄一下, 要用 iTextSharp 哦.

using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;

---
 
            string oldFile = Server.MapPath("/Content/PDF/300000419_20160929162658862.pdf"); //"oldFile.pdf";
            string newFile = oldFile.Replace(".pdf", "_New11.pdf");

            // open the reader
            PdfReader reader = new PdfReader(oldFile);
            Rectangle size = reader.GetPageSizeWithRotation(1);
            Document document = new Document(size);
            int NumberOfPages = reader.NumberOfPages;

            // open the writer
            FileStream fs = new FileStream(newFile, FileMode.Create, FileAccess.Write);
            PdfWriter writer = PdfWriter.GetInstance(document, fs);
            document.Open();

            // the pdf content
            PdfContentByte cb = writer.DirectContent;

            string text = "Watermark...";

            string windir = Environment.GetEnvironmentVariable("windir");
            Chunk textAsChunk = new Chunk(text, new Font(BaseFont.CreateFont(windir + "\\Fonts\\mingliu.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED), 20, Font.NORMAL, new BaseColor(255,0,0)));

            // create the new page and add it to the pdf
            for (int i = 1; i<= NumberOfPages; i++)
            {
                if(i > 1)
                {
                    document.NewPage();
                }

                ColumnText.ShowTextAligned(cb, Element.ALIGN_LEFT, new Phrase(textAsChunk), 0, 0, 0);

                PdfImportedPage page = writer.GetImportedPage(reader, i);
                cb.AddTemplate(page, 0, 0);
            }

            // close the streams and voilá the file should be changed :)
            document.Close();
            fs.Close();
            writer.Close();
            reader.Close();

            Response.Write(newFile + "<br>");
            Response.Write(NumberOfPages + "<br>");
More...
Bike, 2016/9/29 下午 06:23:59
IE11無法套用CKEditor
慧守CKEditor編輯器版本更新(目前版本IE11無法使用),更新至4.4.7後,大部份IE11皆正常,但有台電腦無法正常運作。
該電腦:




原套用方法:
<textarea style="width:675px; height:60px" name="Description" id="Description">#Description#</textarea>
                                            <script type="text/javascript">
                                                CKEDITOR.replace('Description');
                                            </script>


更改為下面方法即可:
​
<textarea style="width:675px; height:60px" name="Description" id="Description">#Description#</textarea>
                                            <script type="text/javascript">
                                                $('#Description').ckeditor();
                                            </script>
More...
Reiko, 2015/6/30 下午 05:13:01
SQL Linked Server 的錯誤訊息: 不允許遠端資料表值函數呼叫
當我們在本地的SQL以 Linked Server方式存取遠端的資料庫,有時會出現這樣的訊息
不允許遠端資料表值函數呼叫
通常是使用 stored procedure 或是 自定義的function 會出現這樣的錯誤
這時候可以有個變通方法,就是使用 OPENQUERY 方法

原寫法 (UNTDB 是 Linked Server的 Name)
mySQL = "Select count(*) as Cnt from [UNTDB].[ShopUNT]..[V_Order_Main] ....

新寫法
mySQL = "Select count(*) as Cnt from [ShopUNT]..[V_Order_Main] ....
mySQL = "Select * from Openquery([UNTDB],'" + mySQL.Replace("'", "''") + "')";

 
More...
darren, 2015/1/26 下午 02:37:25
history 操作 (pushState, replaceState, popstate, onpopstate)
1. 不要用 location.href 來重新定位,在 Chromwe 中,History 會增加一筆記錄。若此時再 pushState,History 中會有重覆的記錄。

2. "上一頁"的目標若是同一頁,document.ready 不會被觸發,但若是不同頁面,document.ready 會被觸發。

3. 上一頁時,Select 的內容會被複原,但 textbox 的內容會保留。
More...
Bike, 2015/1/6 下午 02:51:43
資料前後端傳遞回顧
在做地址的時候用了一個套件(TWZIPCODE)
可以幫你產生下拉霸的郵遞區號選項
很方便(jQuery)
但是在控制他的資料及回傳
又不知道怎樣比較方便直觀了

首先目前也是文字控制的方式是
UWForUNT.WU.ReplaceStringInControl(Me.Page, "#Post_Code#", Post_Code)
直接用 #Post_Code#
再把她取代

直接讓前端讀到值

回傳時 若是用後端控制 不用再傳ajax 或是 塞到別的後端控制項
回傳的方式
UW.WU.GetValueFromQueryStringOrForm("Post_Code")

但是因為之後不讓 Page Load 再次改成預設值
可以加
If Not Me.IsPostBack Then
   UW.WU.GetValueFromQueryStringOrForm("Post_Code")
End If
才不會永遠是預設值
(            $('#twzipcode').twzipcode({
            zipcodeSel: '#Post_Code#', // 此參數會優先於 countySel, districtSel
            countySel: '台北市',
            districtSel: '大安區',
            zipcodeName: 'Post_Code'
            })
)

他如果有包在裡可以直接讀取

另外若是 有一些後端要傳給前端的資料 用response.Write("<script>XXX</script>")
可以直接寫入前端
More...
sean, 2014/11/27 下午 04:20:42
|< 1234 >|
頁數 2 / 4 上一頁 下一頁
~ Uwinfo ~