After much procrastination, I finally had to write a dropdown menu for use on facebook using CSS/JS. I got most of the ideas and code from these two sites, though they didn’t support facebook. I modified the css/js to work for facebook.

https://www.servage.net/blog/2009/03/20/create-a-cool-css-based-drop-down-menu/ and
http://www.logon2.com.au/blog/archive/troubleshooting/accessible-valid-dropdown-menu-or-popup-menu-using-css-and-semantic-html/

The first site has an example of a very clean drop down menu using ul/li/a tags and the second site explains implements support for IE and other tricks.

Here is the css


#menu, ul#menu
{
font-family:Arial, Verdana;
font-size: 14px;
margin:0;
padding:0;
list-style:none;
z-index:1000;
}

ul#menu li
{
display:block;
position:relative;
float:left;
}

#menu li ul
{
display:none;
}

ul#menu li a
{
display:block;
text-decoration:none;
color: #ffffff;
border-top: 1px solid #ffffff;
padding: 5px 15px 5px 15px;
background: #2C5463;
margin-left: 1px;
white-space: nowrap;
}

ul#menu li a:hover
{
background: #617F8A;
}

#menu li.mhover ul
{
display: block;
margin:0 -1px;
}

#menu li.mhover li
{
float: none;
font-size: 11px;
}

#menu li.mhover a
{
background: #617F8A;
}

#menu li.mhover li a:hover
{
background: #95A9B1;
}

the FBJS code


function mout(obj)
{
obj.removeClassName('mhover');
}

function mover(obj)
{
obj.addClassName('mhover');
}

and the html


<ul id = "menu">
<li><a href = ""> Home </a></li>
<li onmouseover='mover(this);' onmouseout='mout(this);'><a href =""< About Us </a>
<ul>
<li><a href = ""> The Team </a></li>
<li><a href =""> History </a></li>
<li><a href = ""> Vision </a></li>
</ul>
</li>
<li onmouseover='mover(this);' onmouseout='mout(this);'><a href = ""> Products </a>
<ul>
<li><a href = ""> Cozy Couch </a></li>
<li><a href = ""> Great Table </a></li>
<li><a href = ""> Small Chair </a></li>
<li><a href = ""> Shiny Shelf </a></li>
<li><a href = ""> Invisible Nothing </a></li>
</ul>
</li>
<li onmouseover='mover(this);' onmouseout='mout(this);'><a href = ""> Contact </a>
<ul>
<li><a href = ""> Online </a></li>
<li><a href = ""> Right Here </a></li>
<li><a href = ""> Somewhere Else </a></li>
</ul>
</li>
</ul>

The ultimate device.

Facebook has released yet again something to opensource. This time it is a php source code transformation tool, that converts the php code to c++ which can then be compiled using the gnu compilers and is called hip-hop

According to their numbers, facebook has experienced a 50% and 30% reduction in CPU and IO usage which would have had huge cost benefits to them.

Below is the video where they introduce hip hop and is also available here

Today I wrote my first python program. I have heard about python it’s advantages and also attended conferences.

So I took a shot at it by writing some code. I started with reading A Byte of Python. After browsing through it, I dived into writing a python shell program.

ID3 Editing.

ID3 is information contained within mp3 files such as Album Name, Artist Name, Track Number etc.

I use rhythmbox to play music, but the information about them was wrong, so playing the right music sometimes wasn’t always easy. So I wrote a python script to alter the Album Name to the directory name in which the file name is present. The code is less than 50 lines. Modifying id3 information is done using the utility id3v2 and python is for recursing into directories.

My first impressions – I like it, I’ve written a lot of php and I like python. I like it’s syntax, so there is no need to have $ for variables, indentation is mandatory which makes the code clean and so curly braces aren’t needed which makes the code a lot readable.

Here is the code, I do want to add more functionality though :)

import os
def changeID3(dir,filename):
parts = dir.split(”/”)
length=len(parts)
album = parts[length-1].capitalize()
id3_cmd=”id3v2 –album ‘%s’ ‘%s’” % (album,filename)
os.system(id3_cmd)

def listFiles(dir):
basedir = dir
print “Files in “, dir, “: ”
subdirlist = []
for item in os.listdir(dir):
absfn = os.path.join(dir, item)
if os.path.isfile(absfn):
changeID3(dir,absfn)
else:
subdirlist.append(os.path.join(basedir, item))
for subdir in subdirlist:
listFiles(subdir)
source = “/my/music/directory/”
listFiles(source)

PS: Indentation is not being shown for some reason!

Today I saw(through twitter and multiple blogs) the unveiling of Apple’s next big product – the iPad which is a touchpad. This is just a summary of it’s features and functionality. It is a fullscreen touch device that lies between the iPhone and the macbook. The hardware specs are it runs an Apple G4 processor which is their own, 0.5 inches thick, weighs 1.5 pounds and the screen is 9.7 inches, is multitouch and has WiFi, GSM, bluetooth, accelerometer and such stuff. Also the flash size starts from 16GB.

It runs all the iPhone apps out of the box. The new SDK is also available to develop apps for the iPad. The iPad is being released within the next 2 months and is being priced starting at $499. I believe they are also opening a iBookStore to sell books. So in a way the iPad is Amazon Kindle’s competitor.

It doesn’t support Flash and doesn’t support multitasking and the memory does not seem expandable

And welll, this is the official page – http://www.apple.com/ipad/

I watched an interesting panel discussion on the social gaming predictions for 2010, joined by people from zynga, Three Rings, Rockyou, PlaySpan and others.

The interesting points were that people here agree

  1. The current games are viral and more social applications would come up in future.
  2. As facebook is making changes to it’s platform, it will lead to growth of games that are truly good and engaging rather than games that spread relying of viral features that existed like Invites and Notifications
  3. This will inturn lead to a lot of ad spend to keep up the numbers and which can only be done by bigger players with deep pockets
  4. Smaller players will be bought over by the bigger players
  5. Companies would see a increase in 50-250% in revenues and userbase. Rockyou was more aggressive in predicting that it might be actually be around 200-300%

Watch the hour long video below –

It will be really interesting to see how companies such as the upcoming CrowdStar would perform in the coming year.

I first saw this video here and really liked it. I didn’t realize there were so many sodas and people loved them. Watch it for yourself.

Not a bad concept to attract attention

  • Install the wvdial package. I found the package name doing a yum search wvdial
  • yum -y install wvdial.i686

    This would vary according to distribution

  • Add the following to /etc/wvdial.conf
  • sudo emacs /etc/wvdial.conf

    [Modem0]
    Modem = /dev/ttyUSB0
    Baud = 115200
    SetVolume = 0
    Dial Command = ATDT
    Init1 = ATZ
    FlowControl = Hardware (CRTSCTS)
    [Dialer cdma]
    Username = You Phone Number Here
    Password = Your Password ... usually same as your phone number
    Phone = #777
    Stupid Mode = 1
    Inherits = Modem0

  • Run wvdialconf
  • sudo wvdialconf

  • Run wvdial cdma
  • sudo wvdial cdma

  • Copy primary and secondary DNS addresses into /etc/resolv.conf
  • sudo emacs /etc/resolv.conf

    nameserver first_server
    nameserver second_server

  • Add ppp0 to routing table

  • route add default gw [dest_ip from ppp0 entry]

References
http://galacticosfan.blogspot.com/2009/09/configuring-reliance-netconnect.html
http://peeths-workspace.blogspot.com/2009/04/reliance-netconnect-usb-card-on-linux.html

I spent quite a deal compiling fbopen platform on my machine. It took about 3 days of compilation, and about a GB of space. I couldn’t edit the wiki to add whatever I found, so here it goes.

Operating System: Fedora 11, Kernel Version 2.6.30, GCC 4.4.1

I got most of the help from these two links and a quite a bit of googling.

I almost followed all the steps from the Fedora 8 setup above. In addition to them, I had to do the following

  • In dependencies/mozilla/toolkit/xre/nsAppRunner.cpp changed #elif to #else
  • add #include in js/fbjs.h
  • add #include , & cstdlib in test/test_base.h
  • removed -Werror from CXXFLAGS in rules.mk as test directory failed to compile


Happy Compilation !