No solution stacks listed in elastic beanstalk configuration

It is how you do the elastic beanstalk configurations. eb init You would be very frustrated when you can select no available solution stacks… Select a solution stack. Available solution stacks are: Select (1 to 0): It is because the credentials you use don’t have administrator rights. Go to Identity and Access Management (IAM) and add…

Read more...

Unable to install Homebrew

Unable to install Homebrew with this? ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)” What’s happened -e:70: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 ==> This script will install: /usr/local/bin/brew /usr/local/Library/… /usr/local/share/man/man1/brew.1 Press RETURN to continue or any other key to abort ==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew Password: ==> Downloading and installing Homebrew… remote: Counting objects:…

Read more...

Save Terminal from Process Completed in Mac OSX

What’s happening One day, when I opened up terminal as usual, it showed [Process completed] and just terminated. I could not type any thing, run any scripts and work on my project. Even worse, this made me unable to install programs into my computer because many installations need to run shell scripts. Okay, I searched…

Read more...

External directory in Xampp (Apache)

For both server and website developing, I usually use Xampp’s Apache to create a localhost server. However, I hate to put my important files in the htdocs inside Apache. Instead I would rather put the folder inside Documents, and make a link to htdocs. First, create a symbolic link from your actual folder to htdocs….

Read more...

Capitalizing Words in Javascript

This is a very old draft stuck at the bottom of my draft list. lol [sourcecode language=”javascript”] var str = "hello world"; str = str.toLowerCase().replace(/b[a-z]/g, function(letter) { return letter.toUpperCase(); }); alert(str); //Displays "Hello World" [/sourcecode] Making it as a function, we can do this. [sourcecode language=”javascript”] function capitalize(str) { return str.toLowerCase().replace(/b[a-z]/g, function(letter) { return letter.toUpperCase();…

Read more...

PHP編碼轉換方法

[sourcecode language=”php”] $url = "http://j-jis.com/"; $html = file_get_contents($url); $html = preg_replace("/rn|n|t/", "", $html); //remove unwanted characters $html = iconv("Shift_JIS","UTF-8",$html); //convert encoding echo $html; [/sourcecode]

Read more...

Convert character encoding in PHP

Usually while we extract information from other websites, character encoding might not correct. For example, j-jis.com is encoded with Shift-JIS. Therefore if your MySQL charset is UTF-8, it causes incorrect information. To handle the changing of character encoding, we can use iconv in PHP. [sourcecode language=”php”] $url = "http://j-jis.com/"; $html = file_get_contents($url); $html = preg_replace("/rn|n|t/",…

Read more...

PHP使用Json中文/Unicode亂碼解决方法

[sourcecode language=”php”] $string = ‘你好嗎’; echo json_encode($string); //Output "u4f60u597du55ce" echo preg_replace("#u([0-9a-f]+)#ie", "iconv(‘UCS-2’, ‘UTF-8’, pack(‘H4’, ‘1’))", json_encode($string)); // Output "你好嗎" [/sourcecode]

Read more...