Archive

Posts Tagged ‘programming’

NerdTree: Vim Plugin For IDE Style File Editing

April 23rd, 2010

I’ve always been a big fan of VSTreeExplorer since I started using Vim. Recently, I came across NerdTree, which is a much better alternative. It really makes it much easier to manage multiple tabs and sessions and has many more keybindings and mouse interactions making it the closest to the Visual Studios experience in Vim. Here’s a really good animated gif with a basic tutorial on its use:

linux, programming, technology , , , , , ,

Recursions in the Sky

December 13th, 2008

The most fascinating concept in computer science has to be recursion. Even when it’s not its pure form, recursion is just a beautiful concept:

A programming technique in which a program or routine calls itself to perform successive steps in an operation, with each step using the output of the preceding step.

It might not be the most efficient or the fastest way to do things, but it’s just damn cool. Some cool uses for them are quines, computing Fibonacci numbers and fractals.

Fractals and Fibonnaci numbers, along with the golden ratio, can be found in numerous places in nature. Tree branches and roots grow in a vary fractal nature. The spiral of a sea shell is dominated by the golden ratio. If you look closesly, recursive properties are found all over the universe.

I’ve known this link between recursion and nature for a while but this past summer, a co-worker at Grooveshark, Chris, and I have had many discussions about math and science. He revealed to me an idea of his that the universe is made of many self-similar structures: sub-atomic particles, atoms, solar systems, galaxies and even the mega structures of the universe. His goal is to describe the basic laws of physics using a fractal model. While this idea seems really crazy, I really like it because fractals have shown that very simple equations can describe very complex behavior (see Chaos theory).

A while back, I read an article describing evidence that the universe appears to be fractal at certain scales. Currently, there is no theory to describe why this occurs and due to the limitations of modern technology, scientists cannot prove this observation at larger scales. Despite these limitations, I really do believe there might be something “fractal” behind the basic structures of the universe. Here’s a really uncanny picture proving this point. While there are many theories trying to bridge the gap between quantum theory and relativity, only string theory and its variations have come close. While I wait for Chris to finish his fractal model of physics, here’s some cool recursive and fractal music to check out:

math, science , , , , , , , ,

Memcached Pool Bash Start Script

November 14th, 2008

If you installed Memcached using Yum under the RedHat flavor of Linux, they have this really nice init.d scripts for starting and stopping Memcache. I modified it in order to support creating a bunch memcache instances using contiguous ports. What’s great is that only the “start” script has to be modified since the “stop” script uses a special RedHat function, killproc, which can accept a program name or path and kill all instances of that program. I’m still a noob at bash scripts but here is my only changes:

NUMBUCKETS=3 #only new value needed
start() {
    for ((i=1;i<=$NUMBUCKETS;i+=1)); do
        FULLPORT=${PORT}${i}
        echo -n $"Starting $FULLPORT ($prog): \n"
        daemon $prog -d -p $FULLPORT -u $USER -c $MAXCONN -m $CACHESIZE $OPTIONS
        RETVAL=$?
    done
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}

linux, programming , , , , , , , , , ,

Coding Tip: Programming as a Game

August 12th, 2008

I recently read a Wired article where people achieved success losing weight because Weight Watchers is basically an RPG. One game/exercise that I often do is to see how many lines of code or components I can write without any errors. It’s hard to quantify but my record so far as about 200 lines of Javascript/AJAX code. It was kind of cheating because I was basically re-using Javascript and backend PHP code that had been thoroughly tested. Overall, this is a pretty good method to increase the amount of code you can hold in your head and attempts to reduce the relying of debugging tools in favor of self/mental debugging.

life, programming , , , , , , , , ,

jQuery: I thought I knew you so well

July 25th, 2008

I just recently found out that jQuery’s “get” method actually returns the DOM objects within the jQuery object. For the longest time, I’ve been using my own “dom” method to do the same thing. For some reason, I never use their documentation site. The search isn’t that great, and something about the site itself just makes me not want to use. Maybe its because I loved the old Visual jQuery site so much. Only if someone would update it for jQuery 1.2.

misc , , ,

New Version of jQuery UI

June 9th, 2008

The good folks at jQuery just released a new version of UI library. For the uninitiated, jQuery UI is mostly a visual effects library that allows one to create AJAX-style user interfaces and interactions really quickly and easily.

I’ve used the older versions and they were pretty buggy and unstable. Since then, the jQuery team has received corporate backing and really improved the core jQuery library. If the new jQuery UI lives up to its billing, it might push Mootools out of being my favorite Javascript library

jquery, programming, web , , , , ,

Memcached Equals Time Saver

May 12th, 2008

Memcached is a wonderful tool to offload database calls by storing the needed information in cache. One trick I’ve been using to increase productivity is that whenever I know I will be using complex or long running queries, I use a local instance of Memcached to cache the initial database calls. As I debug the output or tweak the logic, the average runtime of the script stays almost constant because the bulk of the processing, database calls, has been cached.

programming , , , , , , , , , , ,

Music Information Retrieval

March 18th, 2008

Over the weekend, I really got into music information retrieval (MIR). Its basically grabbing meta-information of an audio file by analyzing its waveform. This type of information is really valuable, especially for a music company (ie: Grooveshark). If I ever have time, this would be a really fun side project. A really good source of information about this topic is this bibiography page (too bad it hasn’t been updated since August, 2007). A list of up and running MIR systems can be found here.

What makes MIR systems so important is that for music sites, they can generate a lot of useful data without anyone having to enter it by hand. For iTunes, this is not a problem because labels give them all the information they need, but for sites where song files can come from anywhere and anyone, there’s no way you can handle the variability in data quality and availability. By having a system that could automatically fetch the required info, within certain bounds of error, you create a vast collection of information that you can use to generate recommendations, provide more accurate searches, and create better categorization of all that music.

The problem with MIR systems is that they require large amounts of storage space and processing power. The cost of both storage and processing are dropping everyday which is great for the future of MIR systems. Processing power is the largest inhibiting factor, especially when you try to analyze millions of songs. The only companies that could probably do a project like this on a large scale would be Google, Amazon and their ilk. Currently, I’m very hopeful that a startup with the right mix of programmers, hardware, and music can compete with the big boys ;)

Grooveshark, music, programming , , , , , , , , ,

OpenLaszlo

March 15th, 2008

I just discovered this really cool application called OpenLaszlo. They are an “open-source platform for the development and delivery of rich Internet applications on the World Wide Web.” One of their claims is “write once, run anywhere” (I think we’ve heard this before – Java).

To me, their syntax and coding style is very similar to Flex. What’s most impressive is that when you “compile” your page/site, you have the option of compiling to flash or DHTML. Working with HTML/CSS all day, they must have a pretty impressive algorithm to ensure browser compatibility, especially on the CSS side.

OpenLaszlo has a lot of promise and is really neat technology. If they really take off and become popular, they will effectively put me out of a job. In the end, they automated the entire process of building a Web2.0 AJAX-powered website and provides another way to produce flash applications in a way that makes sense to traditional web developers.

internet, programming , , , , , , , , ,

Sharkbyte Team Hard at Work

March 5th, 2008

At Grooveshark, in order to play music you need our helper application we call Sharkbyte that handles all of the p2p functionality and music playback. Recently there was a post by a friend of mine Jay, also an employee of Grooveshark, describing some faults in how Sharkbyte handles new updates. His main caveat is that an installed software shouldn’t fail silently and that updates should be installed automatically and actively prompt users to restart.

Today I woke up and decided to play some music while I got ready. Well when I tried playing a song, a box pops up telling me that new updates were available for Sharkbyte. It seems that the Sharkbyte team did a good job fixing those usability problems very quickly. Good job Team!

Grooveshark, music , , , ,