2017年5月8日 星期一

Unable to start debugging on the web server. Logon failure: unknown user name or bad password...

Here is an even better solution than using locolhost with some bugus port.  There was a security change in SP1 for Windows 2003 that prevents debugging on anything but localhost.  There's an obscure KB article about it here:
The fix is simple:
1.Click Start, click Run, type regedit, and then click OK.
2.In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
3.Right-click Lsa, point to New, and then click DWORD Value.
4.Type DisableLoopbackCheck, and then press ENTER.
5.Right-click DisableLoopbackCheck, and then click Modify.
6.In the Value data box, type 1, and then click OK.
7.Quit Registry Editor, and then restart your computer.


from : https://forums.asp.net/t/927517.aspx?Unable+to+start+debugging+on+the+web+server+Logon+failure+unknown+user+name+or+bad+password+

2017年5月1日 星期一

Email Template

  1. Use table for layout
  2. Set width in every cell, 把寬度設在table cell裡,避免使用百分比
  3. 使用table nesting的方式來取代float,也有一說,儘量避免nesting table
  4. Cellpadding 和 Padding選擇一個用
  5. 使用bgcolor及width:100%代替,wrap the email in a 100% width table
  6. Avoiding unnecessary whitespace in table cell, 不要有空白在td裡
  7. inline css
  8. Avoild shorthand for fonts and hex notation : 儘量不要用縮寫
  9. link: inline寫入color, 在link裡再加 xxx
  10. Avoid spacer imags
  11. [另]user a spacer.gif 部份的browser無法接受空白的cell, 哪怕有設定寬高,所以可以用空白圖片代入。
  12. 圖片要加alt 
  13. 圖片都要有長寬
  14. alt和圖片長寬這件事可能要選擇性,如果選片很嚴重的佔格,就要有長寬。這裡各家說法不一
  15. 如果要用圖片作底圖,最好也設定background-color以避兔圖片出不來的狀況,某些client沒有支援background
  16. window live hotmail and gmail add a few pixels of additional padding below images, so img{display:block;}
  17. [mobile] : width less than 600px
  18. [mobile] : webkit-text-size-adjust:none
  19. 避免使用border 而是用td width="1"
  20. Encode all characters "SOME" -> "SOME&quto;
  21. 不要加入javascript

設計email tempalte幾件要注意的事
  1. keep the design simple
  2. Testing in mail browser
  3. Sign up for all the major email clients (google /  hotmail / yahoo /  AOL)
  4. Give the user a way out

mailchimp inline-css 可以轉css成inline
nodeJS Nodemailer 可以發信

Email Testing

Email Template Resource
  1. AntWork http://internations.github.com/antwort/
  2. http://leemunroe.github.io/html-email-template/email.html

2017年4月10日 星期一

Target="_blank" - the most underestimated vulnerability ever

People using target='_blank' links usually have no idea about this curious fact:
The page we're linking to gains partial access to the linking page via the window.opener object.
The newly opened tab can, say, change the window.opener.location to some phishing page. Or execute some JavaScript on the opener-page on your behalf... Users trust the page that is already opened, they won't get suspicious.
Example attack: create a fake "viral" page with cute cat pictures, jokes or whatever, get it shared on Facebook (which is known for opening links via _blank) and every time someone clicks the link - execute
window.opener.location = 'https://fakewebsite/facebook.com/PHISHING-PAGE.html';
…redirecting to a page that asks the user to re-enter her Facebook password.

How to fix

Add this to your outgoing links.
rel="noopener"
Update: FF does not support "noopener" so add this.
rel="noopener noreferrer"
Remember, that every time you open a new window via window.open(); you're also "vulnerable" to this, so always reset the "opener" property
var newWnd = window.open();
newWnd.opener = null;
PS. Interestingly, Google doesn't seem to care.

from : https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/

2017年3月20日 星期一

Selenium - How to wait for a css attribute to change?

webdriver.wait().until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='some_input'][contains(@style, 'display: block')]")));

from : http://stackoverflow.com/questions/21714977/how-to-wait-for-a-css-attribute-to-change

2017年3月2日 星期四

How to determine the memory footprint (size) of a variable?

// return bytes
function getVariableSize ( $foo ) 
{
    $tmpfile = "temp-" . microtime(true) . ".txt";
    file_put_contents($tmpfile, $foo);
    $size = filesize($tmpfile);
    unlink($tmpfile);
    return $size;
}

from : http://stackoverflow.com/questions/2192657/how-to-determine-the-memory-footprint-size-of-a-variable

2017年2月13日 星期一

Xcopy & Robocopy usage

1. robocopy transfer file
Usage : ROBOCOPY source destination [file [file]...] [options]
robocopy c:\folder d:\folder transfer_this.txt

2. xcopy parameters
指令詳解:

XCOPY source [destination] [/A | /M] [/D[:date] [/P] [/S [/E] [/V] [/W] 
             [/C] [/Q] [/F] [/L] [/H] [/R] [/T] 
             [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]\r\r 
             [/EXCLUDE:file1[+file2][+file3]...] 

source       指定要複製的檔案。 
destination 指定位置或者/以及新檔案的名稱。 
/A            只複製設定成保存屬性的檔案,不要改變屬性的設定。 
/M            只複製設定成保存屬性的檔案,並清除保存屬性。 
/D:m-d-y   複製在指定日期當天或之後發生變更的檔案。如果沒有給日期,只複製那些來源檔案日期比目的檔案日期為新的檔案。 
/EXCLUDE:file1[+file2][+file3]... 
             指定檔案清單字串。如果有字串對應到要進行複製的檔案絕對路徑的任何部分,這個檔案會被排除複製。
         例如,指定字串obj 或 .obj 的話,會排除所有在 obj 目錄下副檔名是.obj 的檔案複製。 
/P          在建立每個目的檔案時顯示提示。 
/S          複製每個目錄及其包含的子目錄,不複製空目錄。 
/E          複製每個目錄及其包含的子目錄,也複製空目錄。/S 與 /E相同,能夠用來修改 /T。 
/V          驗證每個新檔案。 
/W          在複製之前提示您按鍵繼續。 
/C          如果錯誤發生時也繼續複製。 
/I          如果目的不存在且複製一個以上的檔案的話,就假設指定的目的一定是目錄。 
/Q          在複製時不要顯示檔名。 
/F          在複製時顯示來源及目的檔案的全部檔名。 
/L          顯示要複製的檔案。 
/H          時複製隱藏檔和系統檔。 
/R          覆蓋唯讀檔案。 
/T          建立目錄結構,但不複製其中的檔案。不包括空目錄及子目錄。/T /E 會包括空目錄及子目錄。 
/U          只複製已經存在目的位置的檔案。 
/K          複製檔案屬性。通常 Xcopy 會重設唯讀的屬性。 
/N          用所產生的短檔名來進行複製。 
/O          複製檔案所有權及 ACL 資訊。 
/X          複製檔案審查設定 (包含 /O)。 
/Y          不要提示您確認是否要覆蓋一個已經存在的檔案。 
/-Y         示您確認是否要覆蓋一個已經存在的檔案。 
/Z          在可重新開始的模式中複製網路檔案。 

參數 /Y 可以在 COPYCMD 環境變數中預先設定。但可以在指令行中用/-Y 參數來覆蓋原有設定。

3. robocopy usage
robocopy c:\source  d:\destination /e





2016年12月25日 星期日

從實例學設計模式 by jaceju



from : http://slides.com/jaceju/design-patterns-by-examples#/

wibiya widget