June 2008 Archives
As part of my job, I work with a huge source tree structure. In last count, the tree has more than twenty five thousand directories and subdirectories. To get from one part to another in the tree, I use a set of aliases and bash functions. One of them is the following "goto" function.
The idea here is, there are a set of source directories that I normally go to, or work under directly. Then there are some directories that are more then one level deeper but are under these same source directories. Then there is the rest of the tree where I need to go from time to time.
So when I run "goto xyzd", I want it to run the search in three phases:
1. Check if xyzd is there as the first level subdirectory under any of the common directories I work on. This should be the most common scenario.
2. If not found, do a "find" based search on the specific commonly used source directories only.
3. If pass 2 also fails, do a complete search from root of the tree.
4. In any of the passes, if a directory is found, cd to it.
This works out well for me. There are enhancements that can be done (like, if more than one name is found, giving options), but so far I didn't find any need for it.
The script looks like the following. You will need to change the DEV_ROOT and SDIRS variables to match your tree.
The idea here is, there are a set of source directories that I normally go to, or work under directly. Then there are some directories that are more then one level deeper but are under these same source directories. Then there is the rest of the tree where I need to go from time to time.
So when I run "goto xyzd", I want it to run the search in three phases:
1. Check if xyzd is there as the first level subdirectory under any of the common directories I work on. This should be the most common scenario.
2. If not found, do a "find" based search on the specific commonly used source directories only.
3. If pass 2 also fails, do a complete search from root of the tree.
4. In any of the passes, if a directory is found, cd to it.
This works out well for me. There are enhancements that can be done (like, if more than one name is found, giving options), but so far I didn't find any need for it.
The script looks like the following. You will need to change the DEV_ROOT and SDIRS variables to match your tree.
function goto() {\
echo "Searching for $1 ...";
DEV_ROOT="root/dir/for/tree"
SDIRS="src/xxxx/usr.bin:src/xxxx/usr.sbin:src/xxxx/yyyy/common:src/xxxx/sbin";
# Pass 1
for i in `echo $SDIRS|sed 's/:/ /g'` ;
do
if [ -d $DEV_ROOT/$i/$1 ];
then
cd $DEV_ROOT/$i/$1;
return;
fi;
done;
echo "Couldn't find $1 in first pass... Trying second pass...";
# Pass 2
for i in `echo $SDIRS|sed 's/:/ /g'` ;
do
echo "Searching in $DEV_ROOT/$i..."
DIRPATH=`find $DEV_ROOT/$i -type d -name $1`
if [ "$DIRPATH" != '' ];
then
echo $DIRPATH
cd $DIRPATH
return;
fi
done;
echo "Couldn't find $1 in second pass... Trying full search ...";
# Pass 3
DIRPATH=`find $DEV_ROOT/src -type d -name $1`
if [ "$DIRPATH" != '' ];
then
cd $DIRPATH
return;
fi
echo "Failed to find directory $1."
}
One of the applications that I find lacking in Linux is a full featured blogging client. There are a few like BloGTK, blokkal etc. but they are far from being fully featured. There are some plug-in based variants, like Scribus, but I'm not much of a fan of it. The online native posting is still more fully featured than any of these.
Here comes an easy trick for quickly posting to your blog from within firefox (or any other browser), without leaving the current page. You can create a bookmark in firefox with the following link (remember to change your blog's mt.cgi path)
http://<path to mt.cgi>?__mode=view&qp=1&_type=entry&blog_id=1
In the "Properties" for the bookmark, remember to select "Load this bookmark in the sidebar" checkbox. Now, if you remain logged in to the blog, you can just start blogging by clicking on this bookmar. Here is how it looks in Firefox while I'm writing this post.

Here comes an easy trick for quickly posting to your blog from within firefox (or any other browser), without leaving the current page. You can create a bookmark in firefox with the following link (remember to change your blog's mt.cgi path)
http://<path to mt.cgi>?__mode=view&qp=1&_type=entry&blog_id=1
In the "Properties" for the bookmark, remember to select "Load this bookmark in the sidebar" checkbox. Now, if you remain logged in to the blog, you can just start blogging by clicking on this bookmar. Here is how it looks in Firefox while I'm writing this post.

Netflix now has a set-top box named "Netflix Player" with the coveted "Watch Now" in collaboration with Roku. The idea is good, the price, at 99$, is right, but the problem is, the home entertainment real estate is very limited, and it's just not feasible to add one box for each specialized application. Let's look at it. A normal home theater setup will have a DVD/B-Ray player, a Cable/Sat settop-box, a Game console, an Audio receiver and possibly a DVR like Tivo.That's four to five boxes already. Who wants to add another box to the mix, especially if it looks so ugly:


The best thing for Netflix would be to get in collaboration with one or more of the set top boxes/game consoles. I'd love if they provide a "Watch Now" client for XBOX 360, and use it more often.
There is, however, a flip side to Roku's player. This player runs a variant of Linux. However, the "Watch Now" feature of Netflix is completely unavailable for Linux based PCs. I wonder how long before someone will reverse engineer Roku to write a client for Linux. Especially, because of GPL, it'd be perfectly legal to ask Roku to give out the source code for its player. I'd love to see that happen too.
There is, however, a flip side to Roku's player. This player runs a variant of Linux. However, the "Watch Now" feature of Netflix is completely unavailable for Linux based PCs. I wonder how long before someone will reverse engineer Roku to write a client for Linux. Especially, because of GPL, it'd be perfectly legal to ask Roku to give out the source code for its player. I'd love to see that happen too.