Sunday 11 March 2012

Thinkpad W520 x64 install USB3.0

Summary: Steps to ThinkPad Windows7 clean install through USB3.0 port.

I decided to upgrade laptops, and since I want to run a few VMs and I also want to see what all the SSD craze is all about, I ended up getting a ThinkPad W520. Quad core hyperthreaded to eight virtual cores with an Intel i7, capable of holding 32GB of RAM in 4 slots, and also able to hold an mSATA SSD drive to run your OS. Geek heaven, I'm sold. I upgrade the networking card, add bluetooth, and decide to forego the optical drive so I can have RAID 1 data protection (that's two mirrored hard drives, with one in a caddy where the DVD drive usually goes).

I make the backup recovery disks with the ThinkVantage tool, and then I decide to test the backup, figuring I have no data to lose. Good thing, since the recovery utility seems to work but after using it I boot into a black screen. Re-attempts to use the recovery disk all end in black screen. My brand new ThinkPad is dead.

No big deal, I think, I'll just do a clean install and forget about the Lenovo recovery partitions, since I'll dual boot this with Linux anyhow. So I burn Windows7 to a bootable USB, and during Windows install get "a CD/DVD drive device driver is missing" error. Most people who get this recreate their install DVD or USB, and it works the second time, so I think it must be a corrupted install disk. But every time I attempt to reinstall Windows7 from a fresh bootable USB key, I get the "CD/DVD drive device driver is missing" error. There is some talk of creating an x64 boot drive on a 32-bit machine. I download bootsect.exe and put it in the Windows bootable USB tool directory as advised, but still no luck.

Others say to switch the USB port around if this fails until it works. See, most people have a combination of USB2.0 and USB3.0 ports on their machines. So if they get this error, they move the USB plug around until they hit a USB2.0 port, and the install proceeds swimmingly. Not the W520. All ports are USB3.0. And it turns out that the Windows7 installation disk does not have USB3.0 drivers.

So after many hours of fiddling, I had to make a custom Windows install disk. Here's what worked for me:

  • download the beta of RT Seven Lite for your architecture. I am on x86 so 32-bit, although I am making x64 boot disk.
  • install RT7Lite
  • Lenovo has a USB3.0 driver you'll need, and a WLAN driver (or maybe Ethernet if you're going to hard-wire your network connection) that are the minimums you'll need. Run the .exe files, and accept the default folders of just put them into the same folder you used just above. It will extract the files, and then say done, with an option to install the drivers. Uncheck the checkbox and click finish.
  • start up RT7Lite from your desktop. Click the "browse" button, point it to your Win7 ISO (if you only have an IMG file, rename it's extension to .iso), and then point it to a folder to store some temporary files in. Let it do it's stuff for a while. Then select the "Integration" checkbox. Click on the "Integration" button on the left, then select "Add" and add drivers. Now navigate to the folders that the two drivers you just downloaded and uncompressed are in. There should be two .inf files in the USB3.0 driver folder (\x64\), and two .inf files in the WLAN driver folder (\Win7\S64\Drivers\). "Add" the four files to RT7Lite.
  • click on the Apply button, then on Commit. Let the app do its magic. This takes a long time, and the progress hangs. Once it's done there will be a green checkmark next to the "Finished" stage.
  • at the end, click on the ISO-Bootable button on the left, and then burn it to a medium. At this point, if you are on a 32-bit system, you will have to burn a DVD image, then hook up the DVD with some external wires which you can get for $20 from the computer shoppe. (This is what I did) A 32-bit system with the USB option fails at this point with an x64 warning. If you can do all this stuff on a 64-bit system, you can make the USB. 64-bit machiens can select Mode "USB Bootable", and select your connected USB Device. Click on USB button. 
  • whichever option you choose, this will take a while.
  • meanwhile, download the ThinkVantage System Update. It will install all the driver updates you'll need. Just install and run this app once installation is complete, it is much easier than downloading drivers one at a time.

Now that I'm done, my boot time to home screen went from 1:10 to 0:45. This is a crude measurement since it includes login credentials time. 

Hope this helps.

Still lost? This blog helped me.

Tuesday 6 March 2012

yii mobile - Part 1

I'm working on a new project, Pressimus, which is built on the yii framework.

As a relatively young framework, yii documentation is a bit sparse, so I'm publishing this in hopes of helping others, and hopefully eliciting commentary to improve my design. So if you know better than me, please tell me!

Without further ado...

yii mobile strategy

There is a fair bit of planning and consideration in creating a mobile strategy for your site. I have done this for a mature website, which is a whole different ball of wax. Here we're going to start fresh, and if the question is "What should my mobile strategy be?", the answer is "it depends". Saying all websites are the same is like saying all houses are the same. They aren't.

The main consideration is: mobile web, or native app? I'm going to concentrate on building a web version of a site now, but this is the biggest question you'll face. Google it to find reams of discussion.

Taking a linear approach into the web app, you'll first want to know if your users are using a mobile device or not. A very simple regex-based approach is used by the yii extension detectmobilebrowser.

Simply add the following into the components array in public_html/protected/config/main.php file:

'detectMobileBrowser' => array(
'class' => 'application.extensions.yii-detectmobilebrowser.XDetectMobileBrowser',
),

Since I put the extension file XDetectMobileBrowser.php into the public_html/protected/extensions/ folder under its own folder, yii-detectmobilebrowser, I changed the classpath from the one listed on the extension's tutorial to application.extensions.yii-detectmobilebrowser.XDetectMobileBrowser.

Then, in controllers/SiteController.php, I have added the detection call in the init() method:

public function init(){
if (Yii::app()->detectMobileBrowser->showMobile) {
//$this->layout='//layouts/mobile';
Yii::app()->session['isMobile'] = 1;
} else {
Yii::app()->session['isMobile'] = 0;
}
}


Now, you can draw this from your session variable.    

Considerations at this point: 
  1. If you need to know more than a browser type (like screen size, resolution, camera support, etc.) then you can consider the WURFL library, which has recently and controversially become commercial. The incredible Apache Software Foundation (A has recently accepted an incubator called DeviceMap that will be a mobile browser capability detection library that will remain open source, and is probably the one you'll want to use and contribute to going forward, if you want to avoid the commercial licencing and associated fees. This one'll be done right, knowing the big brains behind the ASF.
  2. What should you do when a browser is mobile? Immediately connect to the mobile site? Go to a "choose preferred site version" screen? There are many permutations here: for example, what if a mobile site is a stripped-down version of the main site, and the user wants full-site functionality and you've forced them into the mobile site?  I won't go one here but each site will have to carefully consider it's use cases here.

Next time: we'll create a yii mobile theme!

Sunday 4 March 2012

Hello World!

I work as a software developer. I have been educated as a computer scientist at UBC.

I often find myself going to the web for information, and hope this will do a bit to give back to the fantastic online developer community. When I think about Computer Science, I often think of an old REM lyric: "Standing on the shoulders of giants, leaves me tall". (Yes, I changed the last word.)

So here goes, my first blog...