CJK characters identify sample

/// Ref:
/// http://en.wikipedia.org/wiki/CJK_Unified_Ideographs
/// http://blog.oasisfeng.com/2006/10/19/full-cjk-unicode-range/
/// http://www.unicode.org/ucd/filemoved.html

static public string CommontCJKIdentify(string text)
if (text.Any(c => c >= 0x3040 && c <= 0x309F))
{ return "J"; }
else if (text.Any(c => c >= 0X30A0 && c <= 0x30FF))
{ return "J"; }
else if (text.Any(c => c >= 0X31F0 && c <= 0x31FF))
{ return "J"; }
else if (text.Any(c => c >= 0XAC00 && c <= 0xD7AF))
{ return "K"; }
else if (text.Any(c => c >= 0X1100 && c <= 0x11FF))
{ return "K"; }
else if (text.Any(c => c >= 0X3130 && c <= 0x318F))
{ return "K"; }
else if (text.Any(c => c >= 20000 && c <= 0xFA2D))
return "C";
{ return "Others"; }

IE11(Preview) User-Agent causes ASP.Net do not send back Set-Cookie


  1. Waiting for MS hotfix. (http://support.microsoft.com/kb/2600088 for IE10)
  2. Add cookieless=”UserCookies”
<authentication mode="Forms">
  <forms name="yourAuthCookie" cookieless="UseCookies" loginUrl="login.aspx" protection="All" path="/" />

Generate SHA-1 by BinaryString or ArrayBuffer

Used readAsBinaryString() {Deprecated} , Work on Chrome,Firefox
Used readAsArrayBuffer() , Work on IE10,Chrome,Firefox,

Overlay Icons disappear– (TortoiseSVN,Dropbox,SkyDrive,Google Drive…)

  1. Regedit > KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\ShellIconOverlayIdentifiers)
  2. Rename the entries under ShellIconOverlayIdentifiers to reorder the Icons.
  3. End task explorer.exe and restart it. (As same as restart computer.)

Reference: http://stackoverflow.com/questions/1057734/tortoisesvn-icons-not-showing-up-under-windows-7

SSIS package using SQL Authentication on SQL Server Agent

  1. SQL Server Business Intelligence Development Studio > SSIS tab > Package Configurations Organizer > Enable Package Configurations > Click Add > Type : XML configuration file >  Set up file path and name > Next > Select Connection manager >  Select Connection and pick Password.
  2. Open configuration feil from you store path. > Add Password in <ConfiguredValue> element :
  3. Add configuration file in you SQL Server agent.

Reference : SSIS package using SQL Authentication and DontSaveSensitive as ProtectionLevel

Run sqlcmd.exe without having SQL Server installed on Windows Server 2008

  1. Go to www.microsoft.com/en-us/download/details.aspx?id=26728
  2. Install Microsoft® SQL Server® 2008 R2 Native Client
    (1033\x86\sqlncli.msi  or 1033\x64\sqlncli.msi)
  3. Install Microsoft® SQL Server® 2008 R2 Command Line Utilities
    (1033\x64\SqlCmdLnUtils.msi or 1033\x86\SqlCmdLnUtils.msi)
  4. sqlcmd in C:\Program Files\Microsoft SQL Server\100\Tools\Binn\

Visual Studio 2012 open MCV4 project has error message - 'Optimization' does not exist in the namespace 'System.Web'


Error message:

The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)   



Install Microsoft ASP.NET Web Optimization Framework 1.0.0 ( http://nuget.org/packages/Microsoft.AspNet.Web.Optimization/1.0.0)

From the Tools menu, select Library Package Manager and then click Package Manager Console.>

Install-Package Microsoft.AspNet.Web.Optimization -Version 1.0.0

CSS attribute selectors

Attribute selectors let you target an element based on its attributes. You can specify the element’s attribute only, so all the elements that have that attribute — whatever the value — within the HTML will be targeted, or be more specific and target elements that have particular values on their attributes — and this is where attribute selectors show their power.

There are 6 different types of attribute selectors:

  • [att=value]
    The attribute has to have the exact value specified.
  • [att~=value]
    The attribute’s value needs to be a whitespace separated list of words (for example, class=”title featured home”), and one of the words is exactly the specified value.
  • [att|=value]
    The attribute’s value is exactly “value” or starts with the word “value” and is immediately followed by “-”, so it would be “value-”.
  • [att^=value]
    The attribute’s value starts with the specified value.
  • [att$=value]
    The attribute’s value ends with the specified value.
  • [att*=value]
    The attribute’s value contains the specified value.

CSS calculate the specificity

How do you calculate the specificity of a particular selector? It’s fairly straightforward if you take into account that specificity will be represented as four numbers separated by commas, like: 1, 1, 1, 1 or 0, 2, 0, 1

  1. The first digit (a) is always zero, unless there is a style attribute applied to that element within the markup itself
  2. The second digit (b) is the sum of the number of IDs in that selector
  3. The third digit (c) is the sum of other attribute selectors and pseudo-classes in that selector. Classes (.example) and attribute selectors (eg. li[id=red]) are included here.
  4. The fourth digit (d) counts the elements (like table, p, div, etc.) and pseudo-elements (like :first-line)
  5. The universal selector (*) has a specificity of zero
  6. If two selectors have the same specificity, the one that comes last on the stylesheet will be applied

Let’s take a look at a few examples, to make it easier to understand:

  • #sidebar h2 — 0, 1, 0, 1
  • h2.title — 0, 0, 1, 1
  • h2 + p — 0, 0, 0, 2
  • #sidebar p:first-line — 0, 1, 0, 2

From the following selectors, the first one is the one who will be applied to the element, because it has the higher specificity:

  • #sidebar p#first { color: red; } — 0, 2, 0, 1
  • #sidebar p:first-line { color: blue; } — 0, 1, 0, 2


#sidebar p:first-line the priority will be higher than #sidebar p#first 

Reference: http://coding.smashingmagazine.com/2009/08/17/taming-advanced-css-selectors/

Enable IIS Failed Request Tracing

Step 1: Enable windows feature :  Internet Information Services >  World Wide Web Services  > Health and Diagnostic > Tracing

Step 2: Open IIS Manage > Go to your site >  click 'Failed Request Tracing...’ on actions pane > Click 'enable'.

Step 3: In the features view, click 'Failed request tracing rules'.  Click add and choose your purpose like below :

a : Selected ‘All Content (*)’ , Status Code(s) : 200 

b:  Selected ‘ASP.NET (*.aspx) , Staus Code(s) : 401-999 , Event severity : Error

c:  Selected ‘Custome : *.js’ , Status Code(s) : 200

Step 4 : Look in c:\inetpub\logs\FailedReqLogFiles\w3svcX\

Enable USB debugging on android 4.2.X

1. Settings -> About Phone and scroll to the end

2. Tap on “Build Number” for 7 times.

3. Settings ->  Developer Option appear on your setting list now.

Check USB debugging > Ok