Update php5 cli on mac / osx using Liip package

Run the following command in shell to get the current php version

php -v

If you are using Lion like me, and never update php, then you may get 5.3.10.
Unfortunately today I spent a few hours trying to make fuelphp 1.4 oil work normal like when I was using 1.3.

At the moment, the lastest php version is 5.3.19.

In order to update PHP5 CLI on OSX using LIIP package, use the following command.

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.3

# rename the old php
sudo mv /usr/bin/php /usr/bin/php_old

# copy the new package to /usr/bin
sudo cp /usr/local/php5-20121126-082829/bin/php /usr/bin/php

# test version
php -v

# get phpinfo, useful to locate php.ini file
php -i

# test fuel php oil
oil console

Now fuelphp oil should work normally, using 5.3.19 fixed the problem (at least for me) :D .

EDIT:
Rather than rename old php file, it is better to set PATH to new php location
Edit ~/.bashrc using nano or vim.
Add /usr/local/php5/bin, so you might have something like this:

PATH=/usr/local/php5/bin;$PATH:$HOME/.rvm/bin

5 Low Price Transactional Email Service Providers with SMTP

If you are looking for sending email newsletter, using services like aweber.com or mailchimp.com can be expensive if you have large subscribers. For me to have over 5,000 subscribers and over 12,000 forum members, spending $150 per month for mailing is not an option.

There is transactional email service provider. Basically it offer SMTP account and APIs. You configure your software or script to use this SMTP. Or if you develop your own software, you can also use the API call.

For newsletter script, I’d prefer to use this little script from codecanyon: Newsletter Mailer.

AWS Simple Email Service


Free account: 2000 emails per day
Price: $0.1 per 1,000 emails

sendgrid.com


Free account: 200 emails per day
Price: $0.1 per 1,000 emails

critsend.com


Free account: 50,000 emails
Price: $50 for 100,000 emails

mandrill.com


Free account: 12,000 emails per month
Price: $9.95 for 40,000 emails

mailjet.com


Free account: 200 emails per day
Price: $7.49 for 30,000 emails

Git command to create patch for distribution

I’d like to offer incremental update for our indexu users. So when user upgrading from indexu 7.4 to 7.5, they won’t need to re-upload all files again. I must provide only new and updated files and SQL update file.

With git, it will be an easy job.

git archive -o /tmp/indexu_incremental_7.4_7.5.zip HEAD $(git diff --name-only a40eeb6f6f76 HEAD)

Where a40eeb6f6f76 is the commit for previous release (7.4).

I learned this command from stackoverflow :D .

Since I’m using lion, now I got another issue. There is mac file that always bother all of us, .DS_Store. If you have this issue as well, my solution is to install small linux distro in virtual box for packaging purpose. Now I’m playing with TinyCore which is only 12MB. :D

Code Signing with XCode

Code signing is an important task in order to test your app on device and to distribute as an adhoc distribution or app store. Before that you must have created a provisioning profile. If you do not know how to create one, please refer to this post.

  1. Open your xcode project
  2. In left sidebar, click on project name
  3. Select target
  4. Select build setting tab
  5. Locate Code Signing section
  6. In Code Signing Identity, select provisioning profile only for Any iOS SDK
  7. For DEBUG, use development profile. For RELEASE use distribution profile

How to change icon and splash screen in Titanium

Locate the icon and splash screen files in Resources/iphone/ folder. Replace the files with the new one you have.

  • appicon.png : this is app icon file. Size: 57 x 57, 114 x 114 (retina), 72 x 72 (iPad).
  • Default-Landscape.png : splash screen for iPad landscape mode. Size: 1024 x 748.
  • Default-Portrait.png : splash screen for iPad portrait mode. Size: 768 x 1004.
  • Default.png : splash screen for iPhone and iPod Touch. Size: 320 x 480.
  • Default@2x.png : splash screen for iPhone and iPod Touch retina. Size: 640 x 960.

Reference: Custom Icon and Image Creation Guidelines

How to run Titanium iOS app on device

In order to test your app on device and distribute to App Store, you need to enroll iOS Developer Program. It cost USD $99 per year.

Once you have joined iOS Developer Program, you need to register your app and devices in iOS Provisioning Portal.

Before we begin, we need to prepare WWDR certificate, Develop certificate, register App ID, add devices and create Provisioning Profile. All of them we can do by using iOS Provisioning Portal.

  1. Get WWDR certificate and development certificate. Open iOS Provisioning Portal. Click Certificates. In Development tab, you will get the download links for them. Double click each of certificate file in order to add them into KeyChain.

  2. Register App ID. Click App IDs, then click New App ID.

  3. Add devices. Click Devices, then click Add Device. Here you will need to enter Apple Device ID (UUID). If you do not know the UUID number, connect your device to your mac. Open Xcode > Window > Organizer. In Organizer, click your device. There will be identifier value in the main screen. While in this main screen you can also add your device to iOS Provisioning Portal by clicking Add to Portal in the bottom screen.

  4. Create provisioning profile. Click Provisioning then click New Profile. Fill the profile name, developer certificate, App ID and select the devices. After it is created, download the profile file then double click it to update the KeyChain.

Ok. Now the preparation is completed. We are back to Titanium Studio.

  1. Click Run button in the project window. Select iOS Device.

  2. Click Upload provisioning profile. Select provisioning profile file you have downloaded.

  3. Make sure your device is connected via USB. Click Finish. It will start building the project. Wait until it is finished then iTunes will automatically synch the app. Your app will be run automatically on your device.