Digitalocean vs Linode vs Vultr vs Upcloud

February 14, 2020

I have been using vps for years, and I think it is time to share my experiences with them, the pros and cons, as of February 2020.

DigitalOcean

Pros: One of the pioneer of new Products. Digital Ocean offers monthly network transfer pool. All network transfer quota are added up as a pool.

Cons:

Linode

Pros:

Cons:

Vultr

Pros:

Cons:

Upcloud

I have been with upcloud for production only for several months. Previously they have high latency with the VPS even within same region (> 100ms. Other companies vps latency is around 1ms). Fortunately they are able to solve it after.

Pros:

Cons:

Renew APNS certificate after expiry

August 7, 2014

Recap:

  1. Regenerate expired certificate at Apple Developer website, iOS provisioning profiles. You need to upload the certSigningRequest file created before.
    https://developer.apple.com/account/ios/profile/profileList.action
  2. Download the certificate generated and save as aps_production2014.cer .
  3. In Mac OS, open “Keychain Access”.
  4. Remove the expired certificate.
  5. Double click the aps_production2014.cer to add into Keychain.
  6. Right click to export the imported Keys and save as Certificates2014.p12, with a password.
  7. Now, we need to combine certificate and private key into PEM file.
    openssl x509 -in aps_production2014.cer -inform der -out myAppCert2014.pem
    openssl pkcs12 -nocerts -out myAppKey2014.pem -in Certificates2014.p12
    Enter Import Password: 
    MAC verified OK
    Enter PEM pass phrase: 
    Verifying - Enter PEM pass phrase:
    cat myAppCert2014.pem myAppKey2014.pem > myAppCertKey2014.pem
  8. Now you may re-use you newly generated PEM file for APNS.

Tags

Monitor CPU Usage and send E-mail alerts

July 5, 2014

Sometimes the server is having CPU load more than 100, and SSH is virtually not accessible. I am unable to execute “TOP” command to check the misbehaving processes.

Here is my first Shell Script, tested on CentOS. It checks the threshold for last 5 minutes, and send email with TOP log to designated E-mail.

[code]
#!/bin/bash

THRESHOLD=10.0
EMAIL="example@gmail.com"

#grab usage of last 5 minutes.
USAGE5=$(uptime | grep -ohe ‘load average[s:][: ].*’ | awk ‘{ print $4 }’ | tr -d ‘,’)
echo "Current usage:" $USAGE5

if (( $(echo "$USAGE5 > $THRESHOLD" | bc -l ) )); then
echo "Dangerous"
echo "Subject: vps.example.com CPU HIGH ($USAGE5)" > /tmp/top-output.txt
echo "" >> /tmp/top-output.txt ; top -n1 -b >> /tmp/top-output.txt
sendmail $EMAIL < /tmp/top-output.txt
else
echo "Safe"
fi
[/code]

To make this script work, remember to add the cronjob /etc/crontab, and chmod +x to allow execution of Shell Script via cron job.

Slow QVod (Kuaibo) on Mac OSX

January 31, 2014

To date, I am using QVod 1.1.26. It has been a great video player with a lot of sources across the internet.

However, I have been experienced a slow download. The download speed is around 80kB/s with a 4M broadband. Supposely it should run 300kB – 400kB without any trouble.

Fortunately, I am able to find out the issue. It happens once your MacBook is offline ( sleeping to save battery) and then awake / online again.

The only thing you need to do to gain back the download speed, is to kill the process “QvodTerminal”.

If you are unsure how to do this, here are the steps:

How to kill QvodTerminal process to speed up downloads

How to kill QvodTerminal process to speed up downloads

  1. Use spotlight to look for “Activity Monitor” and open it.
  2. In Activity Monitor window, switch to “Network” tab.
  3. Look for the “QvodTerminal” terminal in the long list. Select it, and hit the “Force a process to quit” button (x) on the left side.
  4. Wait for a few seconds, QvodTerminal will be restarted again. All downloads are stopped and restarted too. Observe your Qvod Application if the download speed has been gradually increased.

This is it. I wish you enjoy your Kuaibo!

Tags

A more productive Windows 8

December 2, 2013

Make your Windows 8 more productive in desktop! Get back how your Start Menu should look like. Finally, I don’t feel like dumb and lost in Windows 8.

http://www.classicshell.net/

MySQL: Update table record base on record from another table

Useful MYSQL code snippet. It update certain table column value base on value from another table.

[sql]
UPDATE updatefrom p, updateto pp
SET pp.last_name = p.last_name
WHERE pp.visid = p.id
[/sql]

Tags

Importance of Header Response Content-type

June 20, 2013

Does header response content-type a matter?

There is a problem bugging me for a few months: a small bunch of users using my Android app are unable to view the content when they turn on their 3G. The content data is fetched as web services, either in XML or JSON format.

Pretty weird. First of all I suspect the problem could be due to routing problem, from my web services to the users. Few months later, I changed my web hosting and with different server and IP address, the problem still persist.

Further investigation found out that:

  1. They are from the same telco M.
  2. And it comes from the same range x.x.x.* .

Then I suspect that is there something wrong with the backbone ISP, or with the domain registrar.

Until two users told me the same thing: they managed to visit my website via browser, but were unable to see the drop down menu (my dropdown menu is base on JSON response).

Until then, I re-check my services, and put header response for each of the output.

For XML:

[php]

header("Content-type:application/xml");

[/php]

For JSON:

[php]

header("Content-type:application/json");

[/php]

And finally, users reported that they are able to view the contents.

Though the problems seem to be solved, but the mystery still remain: why is it only with Telco M, with that kind of IP range, is having problem viewing the JSON/XML format when the header content-type is not set?

PHP Snippet: read files info and contents without extracting

March 19, 2013

A very useful PHP code snippet. It read the contents and info of the files in zip file without actually extracting them.

[php]

$zip = zip_open("D:tests".$outFile);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "Name: " . zip_entry_name($zip_entry) . "n";
echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "n";
echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "n";
echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "n";
if (zip_entry_open($zip, $zip_entry, "r")) {
echo "File Contents:n";
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
echo "$bufn";
zip_entry_close($zip_entry);
}
echo "n";
}
zip_close($zip);
}

[/php]

For performance wise, I didn’t really test it, as I did not feel any performance hit with a zip file of 20MB and 100MB+ uncompressed file.

Referrel link: http://www.whileifblog.com/2012/03/24/php-read-filescontentfile-details-from-a-zip-archive-without-extracting-them/

iOS development notes

February 8, 2013

Locating iOS Simulator folder location in Finder:

  1. from spotlight, open Activity Monitor
  2. Look for “your app name”
  3. Double click, and click on the tab “Open Files and Ports”
  4. Copy the first path
  5. Open finder window, press “Command + Shift + G”, paste in the path and open.
    * Note that Users/username/Library folder is hidden.

Checking line number and filename from crash reports

  1. Need to locate file “.app.dSYM” of the release
    1. From XCode > Organizer > Archives
    2. Select the correct version that match the crash reports downloaded from itunes Connect
    3. Right click > Show in Finder
    4. On archive file, right click > Show package content
    5. folder dSYMs > copy the file to new folder of your convenient
  2. Open terminal
  3. Use the command below:
    dwarfdump –lookup 0x00107fef -arch armv7 yourappname.app.dSYM
  4. Command above might be different (might be armv6)

Google Analytics: the Gone by Hours

January 26, 2013

Google Analytics had one of my favourite report before: the 00 to 24 hourly reports option in the past.

Google Analytics Hourly in old time

However, overtime when GA has changed and change, the option is now longer there. It’s frustrating.

Though not as good as before, I am able to get the average views by hours over defined periods by using Custom Reports. Here is how:

  1. Click on Customization
  2. Fill in Title of your report
  3. Under Report Content, choose “Visits” (or PageViews, Unique Vistors, etc of your preference) for Metric, and choose “Hour” for Dimension Drilldown.
  4. Scroll to the bottom and click “Save”

Google Analytics Custom Report

Google Analytics Custom Report

Now you will able to see the report as follow:

Analytics by Table

Analytics by Plain Table

Analytics bar graph

Analytics bar graph

Unfortunately, one of the problem now is that, when you view by Graph, you can’t sort the hour value. It can be sorted by the number of visits only. I have sent this report to GA team and lets hope they can fix this in near future. In the meantime, you may export the report as CSV and do the charting at Microsoft Excel.