Jul 16, 2009

How to enable colour when running autotest

This will be just a quick reminder.

After migrating my user account from the MacBook Pro 15" to 13", my ZenTest autotest lost its color in its output. To re-enable it, just put following line in the .bashrc:

export AUTOTEST=true

Not sure why my old system can run without this line. Anyway, it is working now. Back on road...

Jul 8, 2009

Restore from time machine

Just got my new Mac Book Pro 13". It is REALLY pretty.

I was hoping the migration would be a breeze. But it turns out there is a catch.

Here is the little background. I have a Mac Book Pro 15" which was purchased in April 2008 ( 4GB, 2.6GHZ, 250GB ). I loved it, the only thing it missing is the multi-touch track pad, of course, it is not a uni-body. But I want the new 13", you know it would be nice to have if you have to carry it for some business trip.

First, I made a full backup of the 15" to the time machine. Then put in the installation DVD on 13", after reboot, I wipe the SSD drive and then from the menu bar selected Utilities > Restore System from Backup...


This brought up a dialog to let me select the Time Machine


Once you've selected your Time Machine volume, you can select which snapshot to restore from. I followed steps, and after 2 hours, it was done. Once it rebooted, every thing works fine, there is only one catch - no sound. You can hear the chim when starting the machine, but no sound devices found when you go to "system preferences". After googling for about another hour, tried several solutions. None of them worked for me. I guess that just is the driver's problem, but I have no idea which library to put onto my new machine. So I gave up searching, and re-do the installation. It turns out it is quite simple, the lesson I've learned is "Do not migrate a whole system, just the user account if you have different machines". Here is the steps:

Do are regular installation, once reboot, choose to migrate a user account from your time machine. After that, every thing works great!

A little thought about the better way to do it. The way that I did which migrated all the iWork08 to my new machine, although I can reinstall the iWork09. I was thinking maybe I can create a dummy user, login, do all the update and install all the new programs, then delete the dummy account, reboot, then migrate the user account. That would save me a lot of time. Maybe when snow leopard out...

Jun 24, 2009

DM hook before :save

I've been using DM's hooks a lot to do the customized validation. Today I was trying to set a property before save,

It won't work.

Finally, I figured it out, use attribute_set

Jun 2, 2009

What kind of parents we want to be

Just read a blog article this morning, it really made me thinking. As a new father, I am not doing anything like that now, but I think I have the tendency :-). Following is the shamelessly copy and paste from the blog:

Helicopter parents

A colloquial, early 21st-century term for a parent who pays extremely close attention to his or her child’s or children’s experiences and problems, particularly at educational institutions. These parents rush to prevent any harm or failure from befalling them and will not let them learn from their own mistakes, sometimes even contrary to the children’s wishes. They are so named because, like helicopters, they hover closely overhead, rarely out of reach, whether their children need them or not.

Blackhawk parents

…those who cross the line from a mere excess of zeal to unethical behavior, such as writing their children’s college admission essays.

Lawnmower parents

…[used] to describe mothers and fathers who attempt to smooth out and mow down all obstacles, to the extent that they may even attempt to interfere at their children’s workplaces, regarding salaries and promotions, after they have graduated from college and are supposedly living on their own.

I have a ten-month old baby girl, she is so lovable, me and my wife cherish her like a princess, sometimes we even think that we might be spoiling her. This article just in time, I will discuss with my wife, what parents we want to be?

May 27, 2009

How to use GMail’s SMTP Server with Merb

I switched our email service provider to Google last week. So I have to figure out how to send out emails with GMail. I started with the default Net::SMTP settings, but it failed miserable:

    ~ 530 5.7.0 Must issue a STARTTLS command first. 7sm1765038qwf.45

After playing a while and googled a bit, here is the solution:

1. In your dependencies.rb, add following line:
    dependency "tlsmail"
2. Install the gem
    bin/thor merb:gem:install
3. Modify your init.rb
   
4. Over write the mailer
   
    Note: the "Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)"
5. Sending email
   
    Note: use :text instead of :body

Now, you are good to go.


May 5, 2009

How to add a third-party framework in your iphone project

I was working on an iPhone project, which needs some other third-party frameworks which is developed in c++. Since I am new to XCode, it really took me a while to get it straight.

1. Hard copy the third-party's src code fold into your iPhone project.
2. In your iPhone project, create a new taget
3. Unfold your target, right click(or control click) on the new target, choose "add existing files", then find the src you just copied. Do NOT check "Copy items into destination group's folder", because you've already copied it.
4. Compile your new target, if every thing goes well you should be able to get the .a file.
5. Drag the .a file to your project target -> link binary with libraries folder.
6. This step is optional, it depends on what type the third party src is. If it is c++ src, you have to rename your file which make directly calls to the third-party from .m to .mm.

I am hoping this could save you sometime to get your iPhone project up and running.