My practice Git Model

Thanks to this post. It get me more understand in Git.

Let’s have a try.

Read More

Enable display_errors in MAMP

As we all know that to enable display_errors was an easy task. Unfortunately I’ve made more than 10 attempts to configure this.

Initially I was edit /Applications/MAMP/conf/php5.4.4/php.ini, it doesn’t solve my problem. Then I’ve tried to edit all php.ini in each php version. Sadly, it failed again.

Read More

Unknown error when setting up virtual host in MAMP

I’m struggling for half day just to setup virtual host in MAMP.

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/path/to/project"
ServerName www-yourproject.com
<Directory "/path/to/project">
Options All
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Read More

iOS: Hide keyboard when the user tapped else where

In certain circumstances (i.e. The table row to edit.), we do want the keyboard to be hide in order to improve user experience

In YourViewController.m

Read More

UITableViewController doesn't show content with static cell

I’ve been struggle for some time just because of the tableView doesn’t show any content to me.

The situation is, I’m trying to create a tableView with some sections and static cells, and it served as a rootViewController of a navigationController.

Read More

RSA encryption in iOS and decrypt it using PHP

I’ve been suffer for few weeks on RSA encryption in iOS. Now I would like to share the way of doing this.

First, generate a key-pair using SSL.

Read More

Ajax change dropdown list value with jQuery

A typical example for this is Country and State/Province.

You may have seen some website that provide such a dropdown list. When you change the Country, the State will be reloaded.

Read More

Generate a random string with JavaScript

In order to generate a random string, we must first specify length of string and character set

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function generateRandom(lengthOfString, charset) {
// The scope of the character
if(charset == null) charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';

var rand = '';

while(lengthOfString > 0) {
/*
since the index of char is start from 0, so no need to +1 on the random number
we want the range from 0 - lengthOfString
*/
rand += charset.charAt(Math.floor(Math.random() * charset.length));
lengthOfString--;
}
return rand;
}

Read More

Remove Macbuntu from Ubuntu 12.10

About a month ago, I follow the instruction from here installed some components to make my desktop like OS X.

Read More

iOS: UITabelView - didSelectRowAtIndexPath is not called

I had come across a problem which didSelectRowAtIndexPath doesn’t execute when I tap the cell.

1
2
3
4
5
6
7
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Successfully tapped");
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

[tableView deselectRowAtIndexPath:indexPath animated:YES];
}

Read More