2017年6月30日 星期五

brew php mcrypt

For Mac users you can install it via Homebrew
brew install mcrypt
and also
brew install homebrew/php/php70-mcrypt
for other versions of php try searching brew first
brew search mcrypt

from : https://laracasts.com/discuss/channels/general-discussion/use-of-undefined-constant-mcrypt-rijndael-128-assumed-mcrypt-rijndael-128?page=1

2017年6月29日 星期四

MacOSX homebrew reset mysql root password

If brew installed MySQL 5.7, the process is a bit different than for previous versions. In order to reset the root password, proceed as follows:
sudo rm -rf /usr/local/var/mysql
mysqld --initialize
A temporary password will be printed to the console and it can only be used for updating the root password:
mysql.server start
mysql -uroot -pTEMPORARY_PASSWORD
mysql> SET PASSWORD FOR '目標使用者'@'主機' = PASSWORD('密碼');
mysql> flush privileges;


from :
1)https://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os/33924648#33924648
2)http://emn178.pixnet.net/blog/post/87659567-mysql%E4%BF%AE%E6%94%B9%E5%AF%86%E7%A2%BC%E8%88%87%E5%BF%98%E8%A8%98%E5%AF%86%E7%A2%BC%E9%87%8D%E8%A8%AD

Homebrew ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

When you got the server running via
mysql.server start
you should see the socket in /tmp/mysql.sock. However, the system seems to expect it in /var/mysql/mysql.sock. To fix this, you have to create a symlink in /var/mysql:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock


from : https://stackoverflow.com/questions/15016376/cant-connect-to-local-mysql-server-through-socket-homebrew

After MySQL install via Brew, I get the error - The server quit without updating PID file

I found that it was a permissions issue with the mysql folder.
chmod -R 777 /usr/local/var/mysql/ 

from : https://stackoverflow.com/questions/9624774/after-mysql-install-via-brew-i-get-the-error-the-server-quit-without-updating

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/

wibiya widget