Wednesday, February 02, 2011

Downgrade iPhone from 4.3 beta back to 4.2.1

Well, I am traveling tomorrow and unfortunately Skype still doesn't work on iOS 4.3 Beta 3, so I needed to downgrade. I previously thought it was not possible but it actually was very easy. There are many ways to do it, but I am just explaining the easiest way possible on a Mac, which was my situation.

First of you need the following:
  • The 4.2.1 ipsw which you can find in the following folder
    • ~/Library/iTunes/iPhone Software Updates/
      In here you should see a file called iPhone3,1_4.2.1_8C148_Restore.ipsw (iPhone 4). If you had another iPhone like the 3GS you would see something similar but it would start with iPhone2,1
  • If you want to restore your phone from a backup, that is easy too as long as you haven't deleted old backups. I saw a post that was explaining what to edit in the latest backup (in case you did it while in 4.3) which consisted of editing the backup's info.plist file. This consist of editing 2 strings to state the version and build so you don't get the can't restore from back up message. Even though I tried this I then received a message stating the back up was corrupt so I just chose an earlier backup I had that was a 4.2 backup. You can also just choose to set up as a new iPhone. If you want to try editing the latest backup you can find the file in the following directory and edit the 2 string listed below.
    • ~/Library/Application Support/MobileSync/Backup/
    • <key>Build Version</key><string>8C148</string>
    • <key>Product Version</key><string>4.2</string>
So how can you do this, simple. Use the following steps.
  1. Turn off the iPhone (you can hold down the Sleep button, or use Sleep + Home, and release as soon as the screen shuts off).
  2. Hold down the Home button while connecting to your computer with iTunes already open and ready for a connection.
  3. iTunes will prompt you to perform a software restore.
    Your iPhone will obviously be wiped new and be reset as a result and you wil have a working iPhone again.
  4. Click the "Restore" button while holding down the option "alt" key and select the ipsw file.
That is it, let it go through the entire process and you are done.


Real Time Website Analytics and more

Today, I found out about this cool service from a 37Signals post regarding who is using their latest Basecamp release for mobile phones.

http://getclicky.com/

You can test it with one domain for free and then they have very flexible upgrade options which range from 3 set types and a custom type that you can build based on how many domains and page hits you get.

Sunday, January 30, 2011

Error Installing Phusion Passenger on OSX Leopard - Ruby 1.9.2

As I began to play more and more with RoR on my mac today I decided to do a few things.

  • Install Ruby 1.9.2
  • Install Phusion Passenger

By default Snow Leopard has Ruby 1.8.7 installed but I wanted to begin using the latest 1.9.2, so with a little help from Pragmatic Studio I got it done. For more read - http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac.

Shortly after that I decided to install passenger so I can deploy apps on Apache an by using their instructions I kept getting the following error:

/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

Basically the steps where as follows:

  • sudo gem install passenger
  • sudo passenger-install-apache2-module

The problem was due to me trying to install on the 1.9.2 build which I installed and manage using rvm and for that you need to do the following:

  • rvmsudo passenger-install-apache2-module

I can't take full credit as I found the answer here: Article on stackoverflow

Up next - applying changes to my httpd.conf and seeing if it works :-)

Wednesday, January 26, 2011

SSL on Apache

Today I needed to install an SSL certificate on my local test machine (Mac/Apache) and it was my first time ever. I've been an IIS guy way too long and I love to develop on my Mac without having to bring up a Virtual Machine and little by little pulling away from my local dev server (the only windows box in my house after the switch back in 2003). BTW, the box will soon be a Mac Mini server as I am tired of that Dell Jet Engine in my living room.

Anyways, with a little help from Google I came up with this entry at O'Reilly's onLamp.com.

http://onlamp.com/pub/a/onlamp/2008/03/04/step-by-step-configuring-ssl-under-apache.html

With that and comparing my local httpd-ssl.conf to my user.conf file I was able to do effortlessly.

The reason I had to do a compare was because I didn't read the comments and the first comment spoke about the error I had which I figured out myself by copying over the local config.


Coldbox Plugin - FormatUtils - useful UDF's by me and others (some inspired by RoR)

Over the years, I have used and created many UDF's in my applications. So when I decided to start using ColdBox, I wanted to start grouping them into plugins. One of the first ones, is my FormatUtils Plugin that has several functions that allow you to work with strings. Below is a list of functions included, credits and what they return.

Before we begin let's assume we assigned the Plugin to rc.FormatUtils in our handler as follows:

  • brFormat(theString)
    Converts every carriage return and/or line feed into a compliant line break <br />

    Example
    Will return:
    Hello World<br />How Are You?
  • pFormat(theString)
    Creates compliant paragraphs and line breaks from carriage returns and/or line feeds, I created this because ColdFusion's built-in paragraphFormat() does not close out paragraphs.

    Example
    Will return:
    <p>Hello World</p></p>How Are You?<br />I am good</p>
  • formatPhone(phone,mask)
    Original Author: Derrick Rapley
    This I grabbed from cflib.org and it has come pretty handy. Basically you can pass a string and a mask and it will return it back in the format you requested.

    Example
    Will return:
    Line 1: (305) 555-1234
    Line 2: 3055551234
  • abbreviate(string,len,append)
    Original Author: Gyrus
    Also from cflib.org and it has come pretty handy. Basically you can pass a string a length and it will truncated to your specified lenght without breaking a word.

    Example
    Will return:
    Line 1: A string like this can go ...
    Line 2: A string like this can go fo
  • urlCrypt(mode,string,closer,key)
    This one I actually have to thank my local CFUG for. In one of our little quizes we use to do before the meeting, a question was asked how to encrypt a string that can be safely passed as a URL and the answer was 2 undocummented functions cfusion_encrypt and cfusion_decrypt. I also saw another way using a mixture of toBase64() and toBinary() in case these functions would no longer work (the alternate method is commented out).

    Example
    Will return:
    Line 1: 1911204E0D130415540F001C6B081C4D10364E241B081E17081D0224453E02142014CB3
    Line 2: the name for me is Giancarlo Gomez
  • pluralize() - singularize() and $singularizeOrPluralize
    The credit to this one goes to 2 other frameworks. The first is of course Ruby on Rails. I went to a presentation to learn more about this language and I fell in love. A simple function called pluralize was introduced to me and I though it was great. Basically pass it a word and a number and get back the plural version of it. So at first I wanted to create it from scratch but I decided to do a little bith of research and found out CF Wheels already had almost the equivalent, so I started from there. The only thing I added which they did not have is for an alternate plural or singular word if one was not found in the predefined rules.

    Example
    Will return:
    20 houses

To close out you should know that it is not necessary to have Coldbox to use this, simply use the CFC as any other and you can take advantage of all these functions.

I created a new git repo where I will begin to add all my code to share. Click on the following link to see this CFC on gitHub:
FormatUtils.cfc on gitHub