Friday, October 18, 2013

Octopress Setup

As the first post of this blog, I’d like to start with how to setup the blog system - Jekyll, a blog aware static site generator, and Octopress, a framework based on it.

Steps

1. Install Git

sudo apt-get install git

2. Install Ruby

At the time of writing, Octopress requires Ruby 1.9.3+.
sudo apt-get install ruby

3. Get Octopress and its dependencies

git clone git://github.com/imathis/octopress.git octopress
cd octopress
gem install bundler
bundle install
On Ubuntu 13.10, the following error occurred at bundle install.
Using rake (0.9.2.2) 
Installing RedCloth (4.2.9) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
The following line fix it for me.
    sudo apt-get install ruby1.9.1-dev

4. Install default theme

The following command will install the default Octopress theme.
    rake install

5. Config you blog

The configuration is quite easy, edit octopress/_config.yml and change some values.
Basically for a Hello World blog, you could just change the following lines.
    url: http://yourdomain.name
    title: Your Blog's Title

6. Write a post

The following command will create a new markdown file in source/_post folder.
It’s file name will be like 2013-10-18-hello-world.markdown. Add some test content and
then you are almost ready to see your new blog.
    rake new_post["Hello World"]

7. Generate and preview

Run the following command and visit http://localhost:4000 and enjoy your new blog system.
    rake genreate
    rake preview

Flash Stock ROM to HTC One V

Once I unlocked and rooted my HTC One V mobile phone. After while a weired problem occured. Google Map can’t access network while all other apps can. I tried all kind of tweaks but all failed until I flashed HTC’s stock ROM to it and finally fixed it. Here are the steps to do that in case it can help some one who met with the same problem.

Preparation

Before you can start with flashing, the following preparation work need to be done.

0. !!! Backup your data !!!

Copy all your important data out of the phone.

1. Find your the main version the software on your phone

You can find the number at Settings -> About -> Software information -> Software number.
In my case, the number is 2.24.708.1.

2. Find and download the right RUU for your main version

Normally the following two sites may help. If you can’t find a RUU that matches your main version, then you probably need someone else’s Nandroid Backup to restore your phone.
http://forum.xda-developers.com/
http://www.htcdev.com/DevCenter/downloads/
NOTE: If you downloaded a RUU, please CHECK IT’S DIGITAL SIGNATURE, for security reason.
In my case the RUU file is RUU_PRIMO_U_ICS_40A_hTC_Asia_HK_2.24.708.1_Radio_20.76.30.0835U_3831.19.00.120_release_276653_signed.exe

3. Extract required images from the RUU.

We need boot_signed.img and recovery_signed.img image files. We can extract theme from the RUU by following the steps below.
  • Run the RUU program, but don’t click any button.
  • Go to your %temp% folder, search for a file named rom.zip, which is usually several hundreds of mega bytes in size.
  • Open the rom.zip using 7-zip, and extract the two files out.
  • Exit the running RUU program.

4. Install HTC drivers

The simplest way to install HTC drivers is install HTC Sync Manager software.

5. Get Fastboot executables

To find fastboot.exe, install Android SDK and look in \android-sdk-windows\tools.
Note: fastboot.exe may be unavailable in the latest Windows Android Tools release. You can extract it from a previous release available here: android-sdk_r13-windows.zip You could find fastboot.exe in Android SDK.

Flashing ROM

To flash stock ROM, please follow the steps below.

1. Think again, since it can potentially BRICK YOUR PHONE.

2. Make sure your phone is over half changed.

3. On the Settings -> Developer options screen of your phone, enable USB debugging.

4. Restart your phone with the “Volume Down” button hold down to boot to boot loader screen.

5. Use “Volume Up/Down” buttons to focus the “Fast boot” menu item and press the “Power” button.

6. Connect your phone to your PC via USB, make sure you can see “Fastboot USB” on your phone’s screen.

7. Run the following command on your PC to test if your phone has been detected.

fastboot devices

8. Run the following commands on your PC to flash the boot and recovery images.

fastboot flash boot boot_signed.img
fastboot flash recovery recovery_signed.img

9. Relock the bootloader

fastboot oem lock

10. Run the RUU program and follow the steps.

That’s it. If all the steps succeeds, you phone’s software should be then fresh new.