Back in the ring, to take another swing!

So, I’ve been suuuper lazy to update my site. I had a bit of security problem. Ok, ok.. the lazy hacker got hacked. So…?? :P
Anyhow, I’ve had a greatly fruitful past few weeks with a great deal of interesting projects lined up. I’ve been learning a good deal of scala and getting down and dirty with the Lift framework to build this website trincollfml.com. I have had the luxury of having some awesome teachers who allow me to turn some of my most whimsical projects into class projects. Yay
Another thing I will very likely be posting is an experiment in building a language model based on markov chains. Interesting stuff, eh?
This week looks like it’s going to be intense though with exams, Real Analysis takehome (Yikes!) and Trinity College Firefighting Home Robot Contest.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Ruby vs Python Battle to Death

This is a pretty interesting talk by Gary Bernhardt about the good and bad things about Ruby and Python. Here’s the blog post

Python vs. Ruby: A Battle to The Death from Gary Bernhardt on Vimeo.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Userscript to remove read news

So, I’ve been dabbling with Javascript in a very serious way right now. For one, I’m taking the Advanced Web Programming class where we are officially learning the language. I have to admit, I am getting to learn new ways of doing things and realizing what a jarhead way of programming javascript I’d learned by myself. But, I digress. This is just a little userscript that I cooked up to test a few things:

1. Use jquery

Since I don’t do javascript in a sustained manner, I tend to forget jquery. Also, I tend to avoid using extra pieces of code whenever possible (even when they are as small as jquery lib) for small things. I had to learn to get more efficient with jquery.

2. Use Greasemonkey + jQuery

This part was harder than I thought. Naturally, I used the latest and greatest jQuery version (1.4.1 as of Feb 15,2010). There’s  a little browser snooping going on there that greasemonkey sandbox hates and stops. I eventually settled for 1.3 version.

3. The main reason: remove the news items I’ve read

I generally frequent slashdot, news.ycombinator.com (hacker news for the unenlightened ones :) ) and reddit. I just figured it makes no sense to look at news I read already. I kind of does if you want to look at the up votes. But I personally don’t care.

Now that I’m done with my little spiel.. Here’s the code. Cheers.. http://gist.github.com/raw/304474/49c64624da9f04e0698e65c30a5c30224bcbf265/hide_read_news.user.js

I love Gist on github. I’ll hopefully get more sites in the list.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Removing editor swap files before commits in git

I use git a lot. And I use just about any text editor in my system to edit files. And they tend to come with baggages of their own. Albeit useful, the swap files tend to linger on and eventually end up in my git repository. Here’s how to avoid that scenario.
Git (okay I remember this from doing the same thing in subversion, so nothing new) has something called pre-commit. Pre-commit is just a script/action you can perform on the repository before committing. So, here’s what you need to do
I’ll use vim here, but use whatever you like
$ vim .git/hooks/pre-commit
and put this:
#!/bin/sh
find . -name ‘*~’ -exec rm \;
find . -name ‘*.swp’ -exec rm \;

This removes two types of files, those generated by vim and gedit. There should be a much more elegant way to include more file types, I’ll update them as I refine my pre-commit hook more. :)

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Eclipse has block selection? Awesome! err.. finally

Just noticed this “block selection” feature in eclipse. What this lets you do is select a block of text instead of just lines. Suppose you wanted to copy

1 class Hello:
2        def __init__(self):
3                  print “hello”

If you wanted to copy this, I’d put in vim and run :%s/^\(\d\+\)\s //g [Double check this]
to remove the line numbers or depending on how much I’d like to tinker, perl.. Now I can just do it in eclipse. Something I’ve wanted to do since my pre-regexp days..

Notepad++ has had this feature since forever, but its nice to see this in eclipse finally.
http://www.vasanth.in/2009/03/31/eclipse-tip-block-selection-mode/

Granted, it doesn’t really really add much for me personally, I’ve heard a bunch of people ditching eclipse for Notepad++, so here you go!
Cheers!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Broken by Seether

This is currently my (okay, one of my) favorite song(s).

I think the chorus is great :)

I wanted you to know I love the way you laugh
I wanna hold you high and steal your pain away
I keep your photograph and I know it serves me well
I wanna hold you high and steal your pain

‘Cause I’m broken when I’m lonesome
And I don’t feel right when you’re gone away

You’ve gone away, you don’t feel me, here anymore

The worst is over now and we can breathe again
I wanna hold you high, you steal my pain away
There’s so much left to learn, and no one left to fight
I wanna hold you high and steal your pain

[x2]
‘Cause I’m broken when I’m open
And I don’t feel like I am strong enough
‘Cause I’m broken when I’m lonesome
And I don’t feel right when you’re gone away

‘Cause I’m broken when I’m lonesome
And I don’t feel right when you’re gone away

You’ve gone away
You don’t feel me here anymore

Source for lyrics: http://www.azlyrics.com/lyrics/seether/brokenfeatamylee.html
Edit: Changed the video.. the jerks decided it was a good idea to suddenly make the video private..

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

How to use Ant to build Android applications

I was trying to add (re-add) the feature to let users generate their very own POSIT versions. It used to be there when I was working on it initially and I’d completed it reasonably last summer. The idea was chucked away as we moved on. But, now we wanted it back.
The first thing to do in a case like this, is to figure how to compile an apk. One of the criterias I’ve put for myself is, this program absolutely must work (in 1.0 I mean :P ) without internet connection also as POSIT is supposed to be used for disaster recovery.
Ok. Let’s get down to business, the first time I’d implemented this, I had a django webapp (we have php now, 3rd rewrite) that would exec ‘ant build’ to generate a custom POSIT app.
Thanks to subversion, I was able to grab that build.xml from the old code. As naive as we programmers can sometimes be, I really did think this would work.. somewhat, maybe 20 mins tops.. lol

But, with new versions, things have changed a lot, we don’t have R.java in src folder and a lot of the tools aren’t in same place or accept the same arguments, notably aapt tool.

After fumbling for an hour or so trying to created a build.xml that worked, I felt.. hey, this is Google, I bet they thought of this and have a tool. ( I did try to search for activitycreator.py that was used to generate a generic build.xml file)

And lo and behold…

I read the Manual…. http://developer.android.com/sdk/1.5_r1/upgrading.html

It said that the new tool ‘android’ can be used to create the build.xml automatically…

android update project --path /path/to/my-project --target 1

As easy as that! Of course, the target needs to be >3 if you want your precious Google Maps to work.

Moral: Read the Manual… really really read it… ASAP

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Are e-books soulless?

Before we get into a philosophical discussion, here’s what I mean.

Produced by the New Zealand Book Council, this ad kinda makes me feel good about cancelling that Kindle order I made a while back :)

Here’s the quote from gizmodo article

This stop-motion ad by the New Zealand Book Council makes me glad I don’t own a Kindle or a Nook, and it makes me want to go grab a book immediately. Preferably a gritty New Zealand western.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

Distances between planets

Bill Nye demonstates the distances between planets. This is nice for two reasons:

1. Shows the actual astounding scale of the solar system

2. Shows what modeling really is.

I feel like this should be used in of the Society of Physics Student meetings.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati

My ssh/.config file

So, I have been having to look this up almost every time I need to update ssh stuff on new machines that I’m just going to put it here now.

Host gprasanna
 User xxx
 HostName gprasanna.com.np

Host mycomputer.cs.trincoll.edu
 User test
 Port 30045

Host ubuntunp
 User xxx
 HostName ubuntu.org.np

Host *.cs.trincoll.edu
 ForwardX11 yes

Host *
 Compression yes
 CompressionLevel 9
 FallBackToRsh yes
 KeepAlive no

What this file lets you do is, remember just the aliases and not be bothered by the low level details like what weird port number is open for ssh. :)

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Reddit
  • Slashdot
  • description
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
←Older