So far, the best I have used is: http://www.sitesucker.us/mac/mac.html
Saturday, June 28, 2014
Friday, June 27, 2014
Unable to use Fontawesome because of library PIL
Was trying to use fontawesome library to generate PNG files. However, met many errors along the way. In simple steps:
1. downloaded and installed brew
2. sudo brew install freetype
3. sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pillow
4. python fontawesome.py --size 128 play
Wednesday, May 7, 2014
Warning: mysql_connect(): No such file or directory in but file exists in terminal
This will fix the issue:
sudo su
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock
mkdir /var/mysql
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
sudo su
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock
mkdir /var/mysql
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
Sunday, May 4, 2014
Custom files redirection error on wordpress
Even though the permissions for the folders and files are correct, a 404 error kept showing on the wordpress site. This can be resolved by modifying the .htaccess file and modifying the headers to something like this (the highlighted section is what is new):
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/rest/(.*)$ [OR]
RewriteRule ^.*$ - [L]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/rest/(.*)$ [OR]
RewriteRule ^.*$ - [L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Wednesday, April 30, 2014
Sunday, April 27, 2014
SimpleXML error - unterminated entity reference.
While repurposing a blog today into XML doc, ran into the usual ampersand error. Warning
: SimpleXMLElement::addChild(): unterminated entity reference.
The error is a result of addchild inside SimpleXML, which does not automatically escapes ampersand. The best way to fix this problem is to simply not use the addchild method but instead of going direct:
// change the following:
// $childnode = $xml->addChild( $key, $value, 'url' );
// into this:
$xml->addChild( $key );
$xml->$key = $value;
Weird characters in PHP crawler/curl such as รข€™s...
Solution is to convert the doctype to UTF with the following line of code at the header:
header('Content-Type: text/html; charset=utf-8');
Tuesday, August 27, 2013
Sinaporean getting a california (US) drivers license
This guide probably doesn't apply exactly if you are trying to get a license in other states of the USA. It is heavily skewed towards that of California.
This is what I did in my initial days here in California:
Getting a license in California is fairly easy here in San Francisco and actually a lot less hassle than in Pennsylvenia. There is no medical examination required, no proof of residence required. So essentially, you can get your permit/driving license on the 1st day you are here if need be.
Here are the steps in general (for learners permit/driving license):
1. Print your I-94 for registration of learners permit. The federal government done away with the white slip of paper call I-94 which was handed to you when you first enter the country and taken back each time you leave. But they have since do away with that and you basically need to go http://www.cbp.gov/i94 to print it out. And you need this in case you get pulled over by the police.
2. Get your SSN from an SSN office in the USA. This will take a few weeks and probably proof of residence etc.
3. Find the nearest DMV (you can do so by googling for DMV San Mateo, DMV Daly City, DMV Santa Clara). I did this on google maps.
3. Study for your Written Test. Trust me, you really need to read this. Do you know if you can actually cross the bicycle lane while driving/turning? Which freezes faster? Intersection or bridges? Better start studying if you want that learners permit on first try.
http://www.dmv.ca.gov/pubs/
Common Questions
1. I have a driving license in Singapore and have been driving for ten years, do I need to take the drivers test all over again (including written + behind the wheel?)
- Sadly, this is not recognised. So yes, you have to take the test all over again - as if you do not know how to drive.
2. I have an out of state license (e.g. PA, NY etc) which has expire, do I actually need to sit for the test all over again?
- California state allows non out of State Drivers License (eventhough they have expired) to be exchanged for a California license. However, you are expected to take the written test before the license will be issued to you.
3. Do I need an IDP (International Drivers Permit) to drive in the USA?
No you do not. Not for the USA.
4. So what should I get a california driver's license?
If you are interested to buy a car, or get insurance for your car (its cheaper if you have a california license).
5. What proof of identity do I need to buy a car in California?
All you need is your checkbook and a valid california drivers license. Was told that you could actually register a car even if its just a drivers permit.
This is what I did in my initial days here in California:
Getting a license in California is fairly easy here in San Francisco and actually a lot less hassle than in Pennsylvenia. There is no medical examination required, no proof of residence required. So essentially, you can get your permit/driving license on the 1st day you are here if need be.
Here are the steps in general (for learners permit/driving license):
1. Print your I-94 for registration of learners permit. The federal government done away with the white slip of paper call I-94 which was handed to you when you first enter the country and taken back each time you leave. But they have since do away with that and you basically need to go http://www.cbp.gov/i94 to print it out. And you need this in case you get pulled over by the police.
2. Get your SSN from an SSN office in the USA. This will take a few weeks and probably proof of residence etc.
3. Find the nearest DMV (you can do so by googling for DMV San Mateo, DMV Daly City, DMV Santa Clara). I did this on google maps.
3. Study for your Written Test. Trust me, you really need to read this. Do you know if you can actually cross the bicycle lane while driving/turning? Which freezes faster? Intersection or bridges? Better start studying if you want that learners permit on first try.
http://www.dmv.ca.gov/pubs/
Common Questions
1. I have a driving license in Singapore and have been driving for ten years, do I need to take the drivers test all over again (including written + behind the wheel?)
- Sadly, this is not recognised. So yes, you have to take the test all over again - as if you do not know how to drive.
2. I have an out of state license (e.g. PA, NY etc) which has expire, do I actually need to sit for the test all over again?
- California state allows non out of State Drivers License (eventhough they have expired) to be exchanged for a California license. However, you are expected to take the written test before the license will be issued to you.
3. Do I need an IDP (International Drivers Permit) to drive in the USA?
No you do not. Not for the USA.
4. So what should I get a california driver's license?
If you are interested to buy a car, or get insurance for your car (its cheaper if you have a california license).
5. What proof of identity do I need to buy a car in California?
All you need is your checkbook and a valid california drivers license. Was told that you could actually register a car even if its just a drivers permit.
Monday, June 10, 2013
Buying Brake Pads and Disc Rotors
Been buying brake pads and brake disc (rotors) lately for my Lexus and my wife's BMW - learnt quite a bit and thought I should note this down for future reference. Here are some random things I learnt from this rather 'painful ordeal':
1. Do you have to change disc rotors often?
From past experience, you probably only change the disc rotors after changing the brake pads 3-4 times. Generally, disc rotors lasts for a while. Of course, entirely dependent on how you drive but you generally do not need to change the disc rotor each time you change your brake pads
2. How much does a Disc Rotor cost? Brake Pads?
Depending on cars, for mercedes, a Disc Rotor cost about $85 (from Golden Link Auto - Stockists for Mercedes) per side. And about $130 for a pair of brake pads (front pads are typically more expensive than rear pads). Plus a sensor ($6), you are looking at a cost of about S$438 (as of Jun 2013) just for the parts.
3. What about manpower cost?
It depends on the place you change. It can range from as low as $60 to as high as about $120. Have seen both extremes. If you are willing to bring your car across the border, you can probably get away with getting it done for about MYR$120 (~S$50). However, if you want to save time, you can pretty much get it done in Singapore for a very reasonable price.
SPC Balestier for instance, can get it done for $60. The important thing is to call them during their lull period i.e. they are free anyhow, so they will be more than glad to get it done for you rather than staying idle. If they refuse to give you $60, just call the next SPC Speedycare.
I got mine done (front and rear brake pads) + front disc rotors for about $90 at Zen Auto (30 Kaki Bukit Ave 3). Highly recommended. The team is rather professional and the cars (mostly mercedes and BMWs) gave me quite a bit of comfort too.
4. Tips on how you should go about the entire changing of disc rotors:
1. Do you have to change disc rotors often?
From past experience, you probably only change the disc rotors after changing the brake pads 3-4 times. Generally, disc rotors lasts for a while. Of course, entirely dependent on how you drive but you generally do not need to change the disc rotor each time you change your brake pads
2. How much does a Disc Rotor cost? Brake Pads?
Depending on cars, for mercedes, a Disc Rotor cost about $85 (from Golden Link Auto - Stockists for Mercedes) per side. And about $130 for a pair of brake pads (front pads are typically more expensive than rear pads). Plus a sensor ($6), you are looking at a cost of about S$438 (as of Jun 2013) just for the parts.
3. What about manpower cost?
It depends on the place you change. It can range from as low as $60 to as high as about $120. Have seen both extremes. If you are willing to bring your car across the border, you can probably get away with getting it done for about MYR$120 (~S$50). However, if you want to save time, you can pretty much get it done in Singapore for a very reasonable price.
SPC Balestier for instance, can get it done for $60. The important thing is to call them during their lull period i.e. they are free anyhow, so they will be more than glad to get it done for you rather than staying idle. If they refuse to give you $60, just call the next SPC Speedycare.
I got mine done (front and rear brake pads) + front disc rotors for about $90 at Zen Auto (30 Kaki Bukit Ave 3). Highly recommended. The team is rather professional and the cars (mostly mercedes and BMWs) gave me quite a bit of comfort too.
4. Tips on how you should go about the entire changing of disc rotors:
- Find out if your disc rotor is single wall, or double wall. The thickness of the disc rotor matters i.e. the size. And the least you can do at least visually, without taking the disc rotor out, is to visually check the wall of your disc rotor. A rotor that is too thick will not fit into the calliper of the car
- Get hold of your chasis number, forget about number plate, that is entirely inaccurate. The chasis number will give the stockist a better idea of which parts you really need
- Agree on a price before allowing the mechanic to touch the car. They tend to work on the car before the price is even negotiated. Remember, if the price is not correct, just walk!
- After getting your parts, bring it to a mechanic of your choice. One thing to note is that most brand new disc rotors come 'waxed' i.e. a thin layer of gray paint light material will cover the entire disc rotor. But some mechanics will tend to shave that wax off before even taking the wheel down to test if the disc rotors can fit the car! Take note, this is extremely wrong, because:
- The wax doesn't need to be removed, the brake bad will get rid of the wax after some driving
- In the event that the wax is worn/shaved off, it can't be exchanged/refund with the stockist - which means you would have wasted monies buying the disc rotors!
- In short summary do this;
- Buy the parts from the stockist
- Find a good mechanic online (after reading reviews)
- Agree on a price before allowing them to jack the car
- If they attempt to take the wax off, tell them not to politely
- If the part doesn't fit, take note of the number on the Disc rotor (on Mercedes, it will be something like W169 412 00 12) and go back to the stockist with the part in its original condition
- Test the brakes by driving and stopping around.
- Drive back home happily :)
Saturday, May 18, 2013
Adding a windows (networked) printer on a Mac
1. Share the printer from Windows. Take note of the IP address and the name of the printer that is being shared.
2. Go to the mac, go to System Preference > Printers
3. Right click on the topbar and click 'customize toolbar' and drag 'Advance Options' to the toolbar
4. Click on Advance Options
5. Select "windows"
6. In the SMB path put the following:
smb://Aaron%20Tan:@/
Where Aaron%20Tan - is basically your windows username (replace space with %20 if there is space)
- is your password on windows
- as described e.g. 192.168.0.105
- as described in your shared settings on WINDOWS, e.g. Deskjet
7. Save. and try to print.. probably should also install the driver on the mac so that you can select the right type of device.
2. Go to the mac, go to System Preference > Printers
3. Right click on the topbar and click 'customize toolbar' and drag 'Advance Options' to the toolbar
4. Click on Advance Options
5. Select "windows"
6. In the SMB path put the following:
smb://Aaron%20Tan:
Where Aaron%20Tan - is basically your windows username (replace space with %20 if there is space)
7. Save. and try to print.. probably should also install the driver on the mac so that you can select the right type of device.
Tuesday, March 12, 2013
Saturday, February 2, 2013
Running Crontab
/usr/bin/php /Applications/XAMPP/xamppfiles/htdocs/XXXX/crawl.php
Example :
cd /etc
crontab -e
Inside the crontab document:
48 * * * * /usr/bin/php /Applications/XAMPP/xamppfiles/htdocs/carmart/crawl-delta.php
Monday, December 24, 2012
Installing watch on mac
Download the “watch” command from Terminal.app
We are using “curl” a command line “broswer”
We are using “curl” a command line “broswer”
curl -O http://ktwit.net/code/watch-0.2-macosx/watch
Make “watch” executable
By doing this we tell Mac OS that this is a program that can run
By doing this we tell Mac OS that this is a program that can run
chmod +x watch
Test the program
Let’s make sure everything is in working order.
Let’s make sure everything is in working order.
./watch
Install “watch”
Optional: By following this next step we are placing watch into a system location that will allow you to run it from any location in the Terminal (You will be prompted for your password)
Optional: By following this next step we are placing watch into a system location that will allow you to run it from any location in the Terminal (You will be prompted for your password)
sudo mv watch /usr/bin/Trying to run pconnect via terminal on MAC
Warning: mysql_pconnect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)
can be fixed with:
can be fixed with:
sudo su
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock
mkdir /var/mysql
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
Saturday, October 20, 2012
Forex Exchange
Planning on a trip overseas and trying to understand the forex table that is on the back of all these money changers. But this is a cheat sheet to try to understand them:
Examples:
1. You are from Singapore going to Malaysia.
a. If you are changing money in Singapore, you will look at the 'sell rate' say it is 0.4013
b. You will then 'divide' by the amount you want to change say $100
c. So you will net: $100/0.4013 = $249.19 MYR
2. You are from Malaysia going to Singapore.
a. If you are changing money in Singapore, you will look at the 'buy rate' say it is 0.3987
b. You will then 'multiply' $100 * 0.3987 = $39.87 SGD
| Remember, buy and sell is always from the money exchanger point of view | ||
| Hence in Singapore, | ||
| Buy Rate: | The bank buying TWD (multiply) | |
| Sell Rate: | The bank selling TWD (divide) | |
| Hence in Taiwan | ||
| Buy Rate: | The bank buying SGD (multiply) | |
| Sell Rate: | The bank selling SGD (divide) | |
| At home, look for selling rate. Overseas look at buying rate. | ||
Examples:
1. You are from Singapore going to Malaysia.
a. If you are changing money in Singapore, you will look at the 'sell rate' say it is 0.4013
b. You will then 'divide' by the amount you want to change say $100
c. So you will net: $100/0.4013 = $249.19 MYR
2. You are from Malaysia going to Singapore.
a. If you are changing money in Singapore, you will look at the 'buy rate' say it is 0.3987
b. You will then 'multiply' $100 * 0.3987 = $39.87 SGD
Singapore Credit Cards for Miles
The two best cards are the DBS VISA Altitude Card and the UOB PRIV Miles Card
DBS Visa Altitude
- 1.6mies if you spend $2k per month
- What i like most about the card is that it is a VISA. i.e. more generally accepted and I can use this one card for literally everything
- What i dislike most about this card is the travel insurance, take note their travel insurance may cover your LIFE for $1million but it does not cover anything else e.g. late baggage, medical (which is the main reason why one should buy travel insurance anyway)
UOB PRIV Miles Card
- 1.6 miles without a minimum spend
- 2.5 miles for purchases overseas
- Partnership with AMEX and quite a lot of the shops I go to do not accept AMEX
- Apart from good miles, the travel insurance is fairly comprehensive (it includes medical)
- Free limo trip to the airport if you charge the airfare.
These two are certainly the top two. The other cards (that are within reach of normal/slightly affluent Singaporeans) are really shitty, the worst being Krisflyer gold, Citi Premier Miles etc.
DBS Visa Altitude
- 1.6mies if you spend $2k per month
- What i like most about the card is that it is a VISA. i.e. more generally accepted and I can use this one card for literally everything
- What i dislike most about this card is the travel insurance, take note their travel insurance may cover your LIFE for $1million but it does not cover anything else e.g. late baggage, medical (which is the main reason why one should buy travel insurance anyway)
UOB PRIV Miles Card
- 1.6 miles without a minimum spend
- 2.5 miles for purchases overseas
- Partnership with AMEX and quite a lot of the shops I go to do not accept AMEX
- Apart from good miles, the travel insurance is fairly comprehensive (it includes medical)
- Free limo trip to the airport if you charge the airfare.
These two are certainly the top two. The other cards (that are within reach of normal/slightly affluent Singaporeans) are really shitty, the worst being Krisflyer gold, Citi Premier Miles etc.
Sunday, August 19, 2012
Managing photos on iPhone/iPad iEtc
Syncing photos on the mac for iPhone can be such a pain because syncing and managing it is two separate function. And since I was too cheap to buy appeture or iPhotos, I have to find other ways to manage photos on my macbook.
To manage photos (i.e. download them to your macbook) and not sync and find that your photos is inside a "Photo Database" file which is a 4KB unix file - which actually redirects to the iPhone backup folder. Truth be told, whenever you sync, the files are actually on your computer inside the following path: but you can't use them. its giberish. You need to organise them and this is how:
http://www.maclife.com/article/howtos/how_manage_photos_pain_free
In short:
1. Connect your iphone
2. Create a folder on your Pictures main folder, I call mine "Aaron's Iphone"
3. Start Image Capture (can be found under applications)
4. Select to import to "Aaron's Iphone" folder and import all.
5. Manage the pictures and the next time you can sync accordingly
To manage photos (i.e. download them to your macbook) and not sync and find that your photos is inside a "Photo Database" file which is a 4KB unix file - which actually redirects to the iPhone backup folder. Truth be told, whenever you sync, the files are actually on your computer inside the following path: but you can't use them. its giberish. You need to organise them and this is how:
http://www.maclife.com/article/howtos/how_manage_photos_pain_free
In short:
1. Connect your iphone
2. Create a folder on your Pictures main folder, I call mine "Aaron's Iphone"
3. Start Image Capture (can be found under applications)
4. Select to import to "Aaron's Iphone" folder and import all.
5. Manage the pictures and the next time you can sync accordingly
Friday, March 30, 2012
hdd recovery
1. try this:
diskutil list
sudo gpt recover /dev/disk3
2. if that fails, try recovery:
- easeu data recovery is pretty good and fast
- disk drill is also pretty good but doesn't remember the file names
diskutil list
sudo gpt recover /dev/disk3
2. if that fails, try recovery:
- easeu data recovery is pretty good and fast
- disk drill is also pretty good but doesn't remember the file names
Tuesday, June 21, 2011
Full 100% height container
html {
height: 100%;
}
body {
height: 100%;
}
main-body {
height: 100%;
}
inner {
min-height: 100%;
}
height: 100%;
}
body {
height: 100%;
}
main-body {
height: 100%;
}
inner {
min-height: 100%;
}
Subscribe to:
Posts (Atom)

