//

Command line productivity

There is nothing more rewarding than creating shortcuts for your daily work routines, and what better than when using the command line.

Problem:

You have to create a directory and then cd to it after creation.

Solution:

Open your blash_profile for editing, in my case I will use nano

$ nano ~/bash_profile

once open, now I can add the following function to it.

function mkcd()
{
mkdir -p $1 && eval cd $1
}

Almost there... now do control-x + enter + control-c, finally source blash_profile

$ source ~/.bash_profile

You are now set. next time you need to create a new directory and cd to it all you have to do is:

$ mkcd name_of_directory

//

Check one file from repository in SVN with a specific revision number

Problem

You have to edit one file from a repository but there are hundreds of files in that repository with possible hundreds of MB or GB worth of information. Not only that but you might need the file on a specific revision number.

You have tried

PHP:
    svn checkout http://svn.source/directory/file.fil

But this doesn't work.

Solution

You need to check out an empty directory from repository and then apply an update to the file you need.

PHP:
    svn checkout --depth=empty htt://svn.source/directory[php]

    Now you submit the update command for the file you need checked out

    [php]svn update file.fil

note, before running the svn update make sure you "cd" to the directory that you just checked out from svn "cd /directory".

finally if you want the file to a specific revision number all you have to do is run an update again with the revision number.

PHP:
    svn update -r### file.fil
//

Pattie Maes and Pranav Mistry demo SixthSense

This demo -- from Pattie Maes' lab at MIT, spearheaded by Pranav Mistry -- was the buzz of TED. It's a wearable device with a projector that paves the way for profound interaction with our environment. Imagine "Minority Report" and then some.

//

AS3 Convert function name on the fly

Why would you want to do this? Not sure but a sample here:

ActionScript:
    var _x = 100;

    function a() : void
    {
       trace("\t\tCalled from A = _x" + _x + "\n");
       
    }

    var b = function (): void
    {
       trace("\t\tCalled from B \n");
    }

    trace("Do a regular B call\n");
    b();

    trace("Convert B to A\n");
    b = a;

    trace("B Converted\n");
    b();
    trace("Do a regular A call\n");
    a();

Result

ActionScript:
    Do a regular B call

          Called from B

    Convert B to A

    B Converted

          Called from A = _x100

    Do a regular A call

          Called from A = _x100

//

ZendFramework FollowSymLinks or SymLinksIfOwnerMatch error in XAMPP

Problem:
You may be getting a 403 error and if you look at the logs you should find something similar to the following:

[error] [client 127.0.0.1] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /Applications/xampp/xamppfiles/htdocs/project/public/index.php

Solution:

In your .htaccess file add the following line to the begining of the file:

PHP:
    Options +FollowSymLinks

ZendFramework .htaccess ships with the following as default:

PHP:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]

Adding the two lines above fixes the problem. So the file should look like this:

PHP:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
//

Flash Builder: Changing BorderContainer color during runtime.

I got myself in a mess trying to change the background color of the component during runtime and after different trial and error finally I figured out that it had to do with this declaration:

ActionScript:
    <s :backgroundFill>
       
       </s><s :SolidColor color="#000000" id="defaultColor"></s>
       

Once removed I was able to use

ActionScript:
    this.setStyle("backgroundColor",0x00afe1);

I don't really understand why having the backgroundFill declaration within the body of the component, it would affect the behavior to the point that I wasn't able to change the color of the object but when I find the explanation I will for sure post it here.

//

The Art of Innovation from the Hacker’s Perspective

The Art of Innovation from the Hacker's Perspective
World Entrepreneurship Day

Excellent presentation with wealth of information as well as it spins your mind and makes you wonder what are the limits of your imagination and what you can accomplish.

//

Splat Video Reference

I just had to work on some "Splat" animation and this was great as reference. Too bad my animation had to be limited but good for future refence.

//

WordPress Custom Type loop

With the upcoming version of WordPress 3 (available in beta as of today) here is a tip of how to pull the custom types in the loop once you have created them.

PHP:
    <h3>Recent News</h3>
    <ul>
    < ?php
        $recentPosts = new WP_Query();
        $recentPosts->query($query_string . '&post_type=news');
    ?>
    < ?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
        <li><a href="<?php the_permalink() ?>" rel="bookmark">< ?php the_title(); ?></a></li>
    < ?php endwhile; ?>
    </ul>

In the example above I have created a "News" custom type and now I am adding them to the page with a custom loop.

//

Advertising Age on YouTube