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…??
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.
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.
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.
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!
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
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 ) 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…
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.