Friday, July 10, 2009
Wednesday, July 08, 2009
Regular Expression Matching and Postfix notation
As the compiler scans the postfix expression, it maintains a stack of computed NFA fragments. Literals push new NFA fragments onto the stack, while operators pop fragments off the stack and then push a new fragment. For example, after compiling theabbinabb.+.a., the stack contains NFA fragments fora,b, andb. The compilation of the.that follows pops the twobNFA fragment from the stack and pushes an NFA fragment for the concatenationbb.. Each NFA fragment is defined by its start state and its outgoing arrows:
Monday, June 29, 2009
Nerd time issue 16
------------
Hey all,
It's that time again. I never get feedback about whether you guys read this or not. But apparently, some of you do, since my last trip back to MD. This is just a collection of things I found interesting since the last nerd time. Obviously, there are other trends I'm missing.
If you want off, just lemme know.
This is rather long since it's been a good 6 months since the last nerd time. Work has kept me busy, and I don't read as much as I use to. Since there's no theme, but lots of trends, they're in no particular order this time. Skim through it and see if there's anything that catches your eye.
If you have questions about stuff, feel free to ask me (don't reply all!)
First, some stuff I did on the side:
Senate Majroity vs National Debt
I was talking with Ian about graphing public data, and this was what he wanted to know. This sort of thing should be so much easier. If you find the process of getting this data to graph, lemme know. I imagine it goes in line with a lot of the net-centric buzzwording that does on in DoD projects.
http://iamwil.posterous.com/senate-majority-vs-national-debt-getting-at-p
Frock, a chicken flocking simulator
I wanted to get to know the Lua programming language, so I chose this as a project. I'm getting it to support more chickens still.
http://webjazz.blogspot.com/2009/02/introducing-frock-flocking-chicken.html
And now, the other stuff.
So I'm sure most of you by now have heard of twitter. Considering that Oprah did a show on it, it's crossed over to mainstream. A lot of you might not think of it as anything to pay attention to. However, it's one of those things where its value depends on whom you follow. Beyond the hype, it's mainly a messaging multicast system that has a dead-simple API, so that other people can build things on top of it. People have made things that twitter, such as plants that tell you when you need to water it, when bridges go up and down, when a meteor almost hits the earth, etc.
http://www.twitter.com
http://twollars.com/
http://www.botanicalls.com/kits/
http://twitter.com/riverthames
Wolfram Alpha and Google Squared and YQL
Wolfram Alpha and Google Squared had both been announced in the last month or so. Both are looking towards being able to query large amounts of structured data. However, wolfram curates this data with experts, and google squared attempts to make structured data from indexing tables of data on the web. In addition, Yahoo released YQL, which is a query you can use to scrap the web and treat it as just another database.
http://www.wolframalpha.com
http://www.google.com/squared/
http://tables.googlelabs.com/Home?pli=1
http://developer.yahoo.com/yql/
Real-time search
Real-time search seems to be the wrestling ground for the next generation of search right now. There are a number of competitors in this field, including giants and startups. It's evident with the death of Michael Jackson that news doesn't just travel through the old channels anymore.
http://venturebeat.com/2009/06/20/who-rules-real-time-search-a-look-at-9-contenders/
http://search.twitter.com
http://www.scoopler.com
Google Wave
If you haven't heard, google released a new communication tool called google wave. It's what email would be like if it was reinvented today. It's basically combining different aspects of our communication tools and merging them all together. It's best if you watch the video and play with the demo. If you want to play with wave yourself, you don't have to wait for an invite, but can sign up with a wave server that someone set up themselves. I recommend watching the video, as it breaks your presumptions of what's possible with HTML5 and the web.
http://wave.google.com/
http://wavety.com/pygo-wave-server/
Git and github
To me, this is really old news, but just in case you're still using SVN, you should checkout Git instead for your source control. It's ass-kicking good, though it has a slight learning curve. I won't say too much more about it, but you should really look into it. It'll expand your mind.
http://git-scm.com/
http://github.com/
Key-value stores
Lately, there's been a flurry of attention on key-value stores. I've mentioned one of them before, CouchDb. There are a bunch of others. Tokyo Cabinet (link #2) is used at Mixx.jp.co, a social network in Japan. Cassandra (link #3) is used at facebook. Amazon has SimpleDB and Dynamo. I've only played with tokyo cabinet and couchdb, so I can't really do a compare and contrast between them all. But to me, TC, couchdb, and redis seem to be the most interesting. This marks a shift away from relational dbs as the default data store. Not that they'll replace relational db, but we're finding there are a different class of constraints for the web not necessarily taken care of by relational dbs. In addition, they have properties not avail to relational dbs, such as being schema-less, an http server built in, replication, distributed, etc.
http://couchdb.apache.org/
http://tokyocabinet.sourceforge.net/index.html
http://incubator.apache.org/cassandra/
http://code.google.com/p/redis/
http://memcachedb.org/
http://github.com/cliffmoon/dynomite/tree/master
http://opensource.plurk.com/LightCloud/
http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
http://www.oracle.com/technology/products/berkeley-db/index.html
http://code.google.com/p/thrudb/
http://code.google.com/p/scalaris/
The internet of things
It's something further out, but these first two talks from TED got me thinking about where the web was heading. I don't think that the semantic web, as we imagine it will come to fruition. However, having the things we own talk to each other over the internet is not unfathomable. They'll be able to negotiate with each other to perform a task, or they'll be able to keep a history of what they're doing or how you're interacting with them.
http://siftables.com/
http://www.readwriteweb.com/archives/5_companies_building_the_internet_of_things.php
www.makerbot.com
http://siftables.com/
Cheap hardware boards
Hardware is already cheap, but building hardware yourself has still been somewhat of a pain. I remember having to use Rabbit boards before. There are better ones now. I've mentioned arduino before. Beagle board is a full board that you can run Ubuntu on. Teensy is a small USB microcontroller.
http://www.arduino.cc/
http://beagleboard.org/
http://www.pjrc.com/teensy/?not_a_duplicate
Quake online
Gaming often is looked on as child's play, when in fact, it's some of the hardest programming around, and often drives innovation and progress in graphical techniques, AI, and hardware. Carmack, the guy that wrote Quake, wants to put Quake on the browser. For the longest time, people derided the web, saying it'll never match the performance of desktop apps, and never give the same user experience. If Carmack can run quake on a native browser, then I believe desktop will lose. If he's delivering quake as a video stream, then that's another matter altogether.
http://www.gamasutra.com/view/feature/3946/building_quake_live_carmack_speaks.php?print=1
Reverse HTTP
HTTP is by design a pull model, where the client requests resources from a server. If you wanted to push data to a browser client, you had to rely on a bit of javascript finangling called Comet (cousin to AJAX), where you open an http connection to the client, and leave it open until you want to push stuff to the client. This certainly puts a load on servers because you have to keep connections open. Alternatively, you can have the client keep polling the server. That sucks too. Reverse HTTP doesn't need to keep the connection open. It basically takes advantage of the upgrade field in the HTTP header normally used to find a more appropriate protocol, and instead to turn the connection around from the server to the client. It's still experimental, but it makes a lot more things simple instead of messing with javascript on clients to push data to browsers.
http://www.reversehttp.net/
http://wiki.secondlife.com/wiki/Reverse_HTTP
http://www.ietf.org/internet-drafts/draft-lentczner-rhttp-00.txt
Whiteboarding in real time
Many collaboration tools have come out. We've discovered that the web is essentially a communications medium. Anyway, this set of collaboration tools lets you whiteboard, compose text, and revise docs in real time as other people are editing them. The last link shows you a re-play of paul graham writing one of his essays. This allows people to see how they edit their text over time, and shows others how other people think as they write. It'd be useful as an educational tool.
http://www.twiddla.com/
http://www.etherpad.com/
http://www.wikirage.com/
http://www.revizr.com/
http://etherpad.com/ep/pad/slider/13sentences
Facebook's walled garden
Facebook is the AOL of today. It's basically a walled garden of data, where users live. There's a bunch of effort to break them open. Facebook also wants to open itself out as a fast follower to twitter. I won't say much more here, but there's an ongoing battle about where data gets to go on this front.
http://www.wired.com/techbiz/it/magazine/17-07/ff_facebookwall?currentPage=all
http://googledataapis.blogspot.com/2008/03/3-2-1-contact-api-has-landed.html
http://www.complang.org/dsnp/
Data.gov and the sunlight foundation
Since Obama took office, there's been a big push and initiative to open up the government to its citizens in the name of transparency. One of the things they're doing is data.gov and opening raw public data up to developers or anyone that wants to use it. The sunlight foundation is doing the same for legistator and voting data. I expect that we'll have more apps that will be able to take advantage of this data in the near future, not just to help the people govern their govenment, but also to lead more informed lives.
http://services.sunlightlabs.com/api/
http://www.data.gov/catalog/raw/category/0/agency/0/filter//type//sort//page/1/count/10
DNA engineering
A front that I don't know too much about, but is probably a bigger revolution than the information age and the internet are things that have to do with genetic and bio engineering. 23andme lets you submit cell samples of yourself, and they'll do genetic testing to tell you if you have genetic diseases, among other things. You can now submit gene sequences and get them built for a modest amount of money--not super expensive, but still out of reach for hobbists) As the cost goes down, you'll soon see designer pets and bacteria. The last post is about a guy that theoretically hacks a more potent variant of swine flu.
http://23andme.com
http://mrgene.com/desktopdefault.aspx/tabid-2/
http://www.bunniestudios.com/blog/?p=353
GWT, sproutcore, and Cappucino
Javascript is the most widely used language in the world. And while it has its merits as a functional language, people are trying to develop frameworks that compile to javascript. Javascript is not bad when you're using jQuery. Scriptaculous 2 just got released also.
http://code.google.com/webtoolkit/
http://www.sproutcore.com/
http://cappuccino.org/
http://jquery.com
http://scripty2.com/
Chat on couchdb, standalone web apps, and taking your data with you
This was curious. Couchdb is a key-value document orientated database with an http server as its frontend. They were able to demonstrate that you can fit an entire web app just in the database. Data is code, and code is data. Not only that, you can use the database's replication to port your data and sync it where-ever you go. It's an interesting head turn, even if it's just a demo.
http://damienkatz.net/2009/05/realtime_chat_on_couchdb.html
http://www.jasondavies.com/blog/2009/05/08/couchdb-on-wheels/
http://devlindaley.com/2009/2/14/couchdb-bloom-filters
Mozilla Ubiquity again, but this time hooks into webapps
I've mentioned ubiquity before, which is like a commandline interface for your browser. I use it myself, but only in limited amounts. What's interesting about the direction is that they leverage web services to complete tasks it can't complete for itself. I think that high level languages will eventually adopt the idea of being able to easily hook into web services as a natural part of the language, without extra libraries.
http://www.readwriteweb.com/archives/firefoxs_ubiqity_starts_thinking_for_itself.php
Mozilla Jetpack lets you write Firefox addons with the web
Traditionally, web developers have stayed out of the realm of desktop developers. This is one of the many indications I have that a lot of programming--especially those with user interfaces or a social aspect--will move towards web programming constructs. https://jetpack.mozillalabs.com/
Clojure, Scala, Haskell, Erlang
I'm not going to say too much about these programming languages, since I've mentioned them before, but just as a reminder, there's more than Java out there. These four to me, represent the edge of programming languages that have potential in the future. With the advent of multicores, it's likely that functional programming will lead the way in giving us adequate programming constructs to deal with multicores. If you're a programmer, it'd probably serve you well to learn at least one of these in the coming 4 years.
http://clojure.org/
http://www.scala-lang.org/
http://www.haskell.org/
http://erlang.org/
ParrotVM and mod_parrot
Admittedly, I don't know much about Parrot. But the claims it makes is big. With the rise and popularity of dynamic programming languages like Python and Ruby, we're struggling for a fast virtual machine. And to have to build a new virtual machine every time we have a new language is a pain. ParrotVM is suppose to take care of easing that pain. If that's the case, it might be easier to make languages catered to our problem domain.
http://www.linux-mag.com/cache/7373/1.html
http://www.smashing.org/talks/mod_parrot.ppt
Augmented reality and zombies
We've moved closer to having augmented reality. This is a far cry from the geeky headcam helmets and laptop backpacks that dorky MIT profs wore a decade ago. It still relies on a 2D barcode, and has limited uses, but now with the iPhone3GS out (it has a compass), we might see more augmented reality apps (as well as on android phones)
http://singularityhub.com/2009/06/19/augmented-reality-is-full-of-zombies/
http://www.thinkartificial.org/machine-interfaces/augmented-reality-iphone/
http://news.cnet.com/8301-17938_105-10266380-1.html
Sysadmin tips
Here are some good sysadmin tips. I'd like to think I know my way around linux, when in fact, I've just started.
http://www.ibm.com/developerworks/linux/library/l-10sysadtips/
http://blog.transmit.net/2008/10/my-best-unix-tricks.html
Probabilistic chips
I don't know anymore than what's written in the article. So read about it.
http://www.chron.com/disp/story.mpl/metropolitan/6252697.html
Google Moderator
Voting on websites is old hat since about 2005 with the advent of Digg.com and reddit.com. I found it curious that google has a moderator app, to help facilitate the asking of questions. If you want your own, you can create a white label voting site at slinkset.
http://moderator.appspot.com/
http://www.slinkset.com
The rest of these are related to software, but not about code. If you can only watch/read one, I'd recommend the poisonous people one. That applies to more than open source projects. In it, SVN core devs talk about how someone came in and told them they were all wrong. I have a feeling that was Linus Torvalds, as he rails on the SVN guys in his talk.
The Business and Politics of Software
http://blog.cusec.net/2009/01/05/zed-shaw-the-acl-is-dead-cusec-2008/
Pivoting, or knowing when to stop.
http://startuplessonslearned.blogspot.com/2009/06/pivot-dont-jump-to-new-vision.html
How open source projects survive poisonous people.
Linus Torvalds on Git
Build or buy?
http://sitecanary.com/blog/5
Friday, June 26, 2009
Netflix Prize barrier of 10% has been broken
Well, looks like they did it. A bunch of teams came together and put their solutions together to do 10%. Congrats.
Wednesday, June 24, 2009
Army Exoskeleton Suit Gives Man Superhuman Strength | Singularity Hub
"it is impressive enough to hear somebody say that they gave up on lifting a 200-pound weight after 500 repetitions not because they were tired but because they were bored."
I've always wanted one of these. I wonder if having mechs is too far off. Perhaps there's no tactical advantage to having a large humanoid robot.
In any case, this makes me wonder what other things DARPA funds.
Saturday, May 30, 2009
Returning the keys of all documents in CouchDb
When you emit data from map, the examples show you emitting the document, but you can emit any data structure you care to dream up in the key and value portion of the emit. I needed a mapreduce view that returned all the keys that were present in the all the documents. So if I had documents in the db in the form:
{"year": 2008, "birth_rate": 20.0 }
{"year": 2009, "birth_rate": 21.0 }
{"year": 2008, "death_rate": 20.0 }
{"year": 2009, "death_rate": 20.0 }
I wanted something that returned: ["year", "birth_rate", "death_rate"]
Here's one way to do it:
Tip!
Wednesday, May 27, 2009
How to add helpers, controllers, models, and views of your plugin into the Rails loadpath
Sometimes, when you're writing a plugin, you end up writing models,
helpers, and controllers that the main app can use. However, you
don't want to copy it into the main app all the time. You'd like to
keep things separate between the plugin, but you'd like to be able to
include it in the path of the main app.
To do this, put the following in your init.rb file in the root
of your plugin. To add a new view path in your plugin that's at
PLUGIN_ROOT/lib/views (where PLUGIN_ROOT is the root directory of your
plugin):
ActionController::Base.append_view_path(File.join(PLUGIN_ROOT, "lib", "views"))
Any template files (like html.erb) that you put in that path will be
seen in your app.
To add new helper, model, or controller directories in the rails load path:
%w{ helpers model controller }.each do |dir|
path = File.join(PLUGIN_ROOT, 'lib', dir)
$LOAD_PATH << path
Dependencies.load_paths << path
Dependencies.load_once_paths.delete(path)
end
And now, any models you put in lib/model, lib/controller, and
lib/helpers will be in the rails load path.
Of course, this might all be moot with the reintroduction of Rails
engines in 2.3. I haven't gotten around to using them or figuring it
out yet, but for now, this is how you do it with plugins. tip!
Friday, May 22, 2009
Never mix package managers
Instead, I've spent the better part of the day messing around with
package problems on Mac OsX.
The problem? Mixing package managers. I had installed py-setuptools
from Mac Ports. Turns out it's still far behind, so it barfs when
easy_install uses it to install something like mysql-python.egg.
I should know better. On Ubuntu, I only use apt to get the language,
and the rest is managed in rubygems.
Wednesday, April 01, 2009
Senate majority vs. national debt - Getting at public data is a pain
One of things he wanted to fact-check was the national debt, and how it related to our politicians. I imagine he was incensed at the state of financial affairs and wanted to know who were the fools that did it. He wanted to know what the senate majority was plotted against the national debt.
After that, I took some time in the last couple of days to find the data, and then write a ruby script to scrape it and plot it on a javascript webpage. Here's the resulting graph:
The first surprising thing was how fast the national debt has grown in the last 30 years. It's been an exponential growth. I think that while increased spending have happened, the interest on the debt has a significant effect on that growth.
The second surprising thing was how much democrats dominated the era between 1930 and 1980, with a sliver of Republican majority in the 50's. And before that, it was dominated by the Republicans. Apparently, political ideology shifts back and forth.
One of the things I have to note about the graph is that the first set of Red in the early 1800's is not the modern Republican party we know today. It was another party of the same name, I think also called Jeffersonian-Republicans. The gaps before and after were times when there were no Democrats or Republicans. There were Pro-administration or Anti-administration, or Pro-Jackson, Anti-Jackson, or Whigs and others. In addition, there weren't 100 seats in the Senate at the very beginning, so we see some instances where Senate Majority wasn't more than 50 seats.
Oh, and because I'm lazy, I didn't label the axis. The left y-axis is the # of senate seats held by the majority party. The right y-axis is the national debt in dollars.
We can see from the graph that the explosive rise in national debt occurred in the last two or three decades. In addition, both parties had Senate majority at the time. Not only that, but the Senate Majority party only had a slight majority, which meant that it could tip in favor of the other party from congress to congress.
Seeing how it was exponential, I plotted it as a log-plot. Ian quipped that "it's terrifying that it makes sense to plot the national debt in log scale."
You can see more details here. Remember, a line in a log plot means exponential growth. We can see that there are times in history that the US debt dropped or rose at a significantly rapid rate. I was surprised to see that in the mid 1830's, it looked like the US cleared itself of its debt. I don't know enough about history to know whether the US just defaulted or it paid the debt back. The significant rises in debt seem to correlate with the major wars. 1860's for the US Civil War, the 1915's for WWI and 1940's for WWII.
Now the last graph is not for the faint of heart. It's a graph of the rate of change of the national debt on a log scale.
So all this has been interesting, but is this what falls under the "all that jazz" category? What does it have to do with the web and programming? I've been thinking about all the public the data that's out there, and how to get to it. The conclusion was that it was pretty damn hard. There were four steps to tell this story to you. I had to find the data, scrape it, clean it, and then graph it. Of the four steps, the hardest part was scraping and cleaning. It took a good 4+ hours to do it, and I'm a programmer. Most other people that were curious enough could use excel, but last I checked, excel didn't do data scraping on web pages. Hello cut and paste.
I think it should be much much easier for citizens in a country where we elect government officials to be informed and see this data for themselves. Before, we had relied on journalists to give me the straight dope on these facts. But, as I mentioned before, the newspapers have been in decline. As a result there's less budget to pay for good reporting watching the government and what it's doing. Beyond watching the government, I expect that people generally have questions that can be best answered by graphs of public data--and those answers aren't just yes or no.
As an example, another friend of mine, Matt, is single and looking for the ladies. However, living in Columbia, MD, it's a tough dating environment--everyone's under 18 or over 40. So if he could move, which counties in Maryland has the highest number of single females?
Do any of you find that you have similar questions that can be answered by public data in graphs?
Data Sources:
http://www.treasurydirect.gov/
http://www.senate.gov/
Thursday, March 19, 2009
Bastardized recursion
I stumbled on something, which I saw in the Rails source once. Thought I'd share.
Say I have a :blog that has_many :posts. But Posts are subclassed to have many different types. But I wanted that post_type information from Blog in different formats. Originally, it looked something like this
class Blog
has_many :posts
def post_types
Post.subclasses
end
def post_names
post_types.map { |pt| pt.name.gsub('Post::','') }
end
def post_string
post_names.map { |n| "'" + n + "'" }.join(",")
end
end
Since they progressively built off of each other, I figured I can use a bastardized recursion, like I saw in find() in ActiveRecord::Base.
class Blog
has_many :posts
def post_types(format = :classes)
case format
when :classes
Post.subclasses
when :names
post_types(:classes).map { |pt| pt.name.gsub('Post::','') }
when :string
post_types(:names).map { |n| "'" + n + "'" }.join(",")
end
end
end
Seems alright. Reduces the clutter of functions that are related to each other, so I'm on the lookout for being able to reduce related functions together like that. tip~!
Updated:
Found this reverse engineering brief on obfuscated code that recites the 12 days of Christmas. It uses the same technique that I described above. I suppose as always, case statements can be abused.
Friday, February 13, 2009
Reply comments to Frock
I was reading that some of the tree methods were mainly used for static collision culling, due to their expensive insertion and deletion properties. I don't know yet if Quadtrees have the desirable properties.
Thanks for the link on the Voronoi paper. I'll take a look at it.
@Wally thanks. I'll see what I can do.
@Hal Oddly enough I saw your simulation on youtube when I was browsing around the other day. Do you have source I can look at for that?
Thursday, February 12, 2009
Introducing Frock, a flocking chicken simulation written in Lua with Löve
- I've always wanted to make my own game. A lawnmowing game comes to mind.
- I wanted to see if I could create a large flocking simulation
I've been fascinated with decentralized systems since right after college--one of them being flocks. But how do they work? For a long time, ornithologist (bird scientists) had no clue how birds flocked. Birds seem to be able to move in unison, as a super-organism, swooping, expanding/contracting, splitting. When you see massive waves of these things (these are starlings), it's something to behold. Who is the leader? How do they coordinate these flocks?
We still don't exactly know, since we don't yet have the capabilities to tap into a bird's decision making mechanism in real time. However, in the 1990's, Craig Reynolds demonstrated that you can get very convincing flock-like behavior generated procedurally, using three simple rules. And it ends up that you don't need a leader to get flocking behavior. All interactions can be local, and each flock member (or boid, as he called it), just needed to follow three simple rules:
- Attraction: Move towards the perceived center of the flock according to your neighbors
- Repulsion: Avoid colliding with your neighbors
- Alignment: Move in the same direction and speed (velocity) as your neighbors.
So here it is. Introducing Frock, a flocking simulator in Lua Love.

I release it now, because while it's primitive, it works (release early, release often!). The screenshot doesn't really show it well, they fly about in a flock, hunting for plants to eat. It's rather mesmerizing, and I find I just stare at it, the same way I stare at fish tanks.
It was originally a port of the Ruby Shoe's hungry boids, but I used flying chickens lifted from Harvest Moon instead. I originally had cows flying about, but without flapping, it just wasn't the same. I also made the repulsion vector increase as a function of decreasing distance. Otherwise, the chickens didn't mind being right on top of each other if they were on the inside of the flock.
My immediate goal is to make it support more chickens, so I can get a whole swarm of them. Right now, I'm using an inefficient algorithm to calculate which chickens are neighbors (basically n^2 comparisons). So if any of you have good culling techniques applicable here, I'd love to hear it. I'm currently looking at R-trees.
There are different possibilities as to where it could go. I think while lots of people have written boid simulations, they haven't taken it much further than that. While I've seen ones with predators, I haven't seen anything where people try to evolve the flock parameters, or try to scale it up to a large number of chickens. One can also do experiments on whether different flock parameters have different coverage of the field, or which set of parameters minimizes the time a plant is alive.
If at the basic, it becomes a framework for me to write 'me and my neighbors' decentralized algorithms, that'd be useful too. And since Lua is suppose to be embeddable into other languages, that makes it an even more exciting possibility. Later on, I'll write a little something about Lua.
Well, if you decide to try it out yourself, get to the Frock github repo, and follow the readme. Patches are welcome, but note I haven't decided on a license yet--but it will be open source. If you have questions, feel free to contact me or comment. Have fun!
Tuesday, February 03, 2009
Can't comment
Thanks trevor. I've subscribed to your weekly digest. I've been reading Hacker News all this time. However, it wasn't so much that I didn't have time to read, as I didn't have time to synthesize them.
And oh, thanks for the Perforce slides. They've been really helpful.
Nerd time, issue 15
-----
Hi all.
Well, after starting work at Frogmetrics last May, I got really busy writing code, learning about business and startup related things, and absorbing sales and marketing stuff, that I simply read a lot less. There was also less tech news going on that I felt was significant. When there's no significant news, the echoes become pretty loud in the echo chamber. Since I didn't hear anyone say anything about it, I figured no one read nerd time. And since I was reading less, I became more intellectually lazy. Hence the 10 month silence on nerd time.
But about a month and a half ago, I got in-person complaints that nerd time was no longer being sent out, so here it is reinstated. Some of these might be old news, but it's what I collected and found was significant over the last couple of months. And what the hell, old news in the tech world takes a while to get to the research lab world, so hey, this might be new to you. This time is mostly about source control and languages. I have other things I'm playing with that might be of interest, but will reveal them as I mature them.
Git the decentralized version control
Decentralized version control isn't anything new, but its adoption is. Git is pretty powerful. I don't go into all the reasons why. You can read about it in my post here. But on a deeper level, git is essentially a versioned filesystem. In fact, what's most interesting about it is how general it is and how you can use it for things other than version control. You can use it to synchronize address books, remote deploy code, or even as a basic wiki or blog.
http://git-scm.com/
http://whygitisbetterthanx.
http://eagain.net/articles/
Github a social network for developers
Github is like sourceforge, but much better designed, and has a social component to it. I can follow the coders and projects that I admire or find useful, and I can also see what projects they are committing to or watching. Thus, it gives me a sort of leading indicator of what the alpha nerds and geeks find interesting. And what they find interesting is what you and I will be using in our jobs 5 to 8 years down the line. The generality of git, as mentioned in the previous entry is given as an example in the last link. It's of Raganwald, a well known Ruby coder and blogger who blogs on Github. Having a central place to commit and share code sorta defeats a mainstay of decentralized source control, but let's ignore that point for now, and drink the github kool-aid
http://www.github.com/
http://github.com/raganwald/
GitTorrent
Along the same lines, someone combined git with bittorrents. Whoot.
http://www.advogato.org/
SUP friendfeed
I'm personally not as excited about SUP as I don't mess around with feeds that much. But it claims to cut down on bandwidth for servicing feeds
http://blog.friendfeed.com/
Sinatra
If you thought Rails was lightweight, Sinatra blows it out of the water. While there have been other micro-frameworks for web apps, sinatra takes the cake in my opinion. It doesn't take very much at all to get something up and running with sinatra. So given the amount of prototyping work that the lab does, it helps to just get something demoable up. If you wanted to continue with it, sinatra runs on pretty solid web server, and you can optionally switch it out also. I'd recommend taking a good look at it, and brush up on your Ruby skills as well.
http://sinatra.rubyforge.org/
Clojure
Clojure is a lisp dialect in a JVM. I've heard some good things about it, but I haven't really tried it out myself, so I can't speak on the merits of Clojure. However, as the second link below wonders, could Clojure be to concurrency orientated programming as Java was to OOP? I've talked about Erlang in the past, and it defn has some amazing traits as a programming language, barring the syntax.
http://clojure.org/
http://bc.tech.coop/blog/
As for actual programming languages I've been messing with, there are three. Erlang, Javascript, and Lua. I'll only talk about the last one--and I only started messing with it because of LÖVE.
LÖVE is an "unquestionably awesome 2D game engine"
More akin to Pygame in Python than to Shoes in Ruby, Love lets you quickly build a game, but still stay within the realms of programming. The reason why I find it worth mentioning are the merits of Lua. It's a basic interpreted language, but it's embeddable into other languages, and its total size is pretty small ~200k or so. This make it ideal to be used in embedded systems. In addition, it's one of the faster interpreted languages out there, and with LuaJIT (on the JVM), it's even faster.
http://love2d.org/?teej
Mozilla Weave and Prism
Google Chrome
While I'm sure the lot of you have heard about Google Chrome, what's interesting to me is in relation to the direction that Mozilla, and also Adobe Air have been trying to move towards: treating web applications like desktop applications. Not only will they be easy to install, and easy to maintain, but they afford easy collaboration with others. And with the maturity of Google Gears, being offline is not a problem now either. While there are still a couple bastions where pure desktop applications reign, such as gaming, I think we'll find that the web app style development to be more pervasive for desktop apps.
http://labs.mozilla.com/2007/
http://labs.mozilla.com/2007/
http://www.google.com/chrome
SVG and application development
I don't know that SVG will be the future of application development or not, but I know that the current html and css constructs were meant for documents. Web developers are actually rebending those tools for application needs. While it's useful to think of the web as a collection of resources and document--it makes for a scaleable app--the actual page elements are still stuck in document-page speak. It would make it easier for app development to have their own app-specific constructs. SVG may or may not help in that regard
http://www.sitepoint.com/
Stackless Python, PyCUDA
There's lot of people trying to find suitable languages for our multicore future. I'm not so sure that Erlang will be it. However, functional programming concepts are going to make a comeback, if not already. Python is poised to be ready as being able to handle concurrency through stackless. Some people are experimenting with using Python to access the new Nvidia CUDA hardware architecture.
http://www.stackless.com/
http://mathema.tician.de/
Gnip Central
Gnip central acts as a data middle man. Often times, getting through the API sucks for various reasons, and having a middle man that either converts that data for you, makes it available, or converts it into a push model instead makes it convenient. It's an interesting niche, and I see this is as a perennial tar pit of data portability.
http://www.gnipcentral.com/
New York Times API
New York times is probably the more forward thinking out of all the newspapers when it comes to the web. Who else do you know that has released an API?
http://developer.nytimes.com/
Thursday, January 29, 2009
Figuring out a branching strategy
Until recently, I never contributed to an open source project either. Therefore, I really had no idea when to branch. So when we started working on the analytics, we really had no idea what a good branching strategy would be.
Googling didn't help, because either everyone else doesn't call it "branching strategy", or everyone already knew how to do it. I eventually figured something out though.
Last week, after talking to AJ of Scoopler about git, he ended up asking about branching strategy. It became apparent that branching strategy wasn't an obvious thing, so I decided to write something here. This is obviously not the only way to do it, so if you have other suggestions, by all means, comment.
At first, we didn't know what we were doing. We knew that we wanted to have a branch that had the same code on the production server, and another branch where we're working on the 'next' version. So we had a branching strategy that looked like this:

As you can see, we branched every time we deployed weekly. This gave us the option of doing bug fixes on the every deploy version, while keeping a working branch. However, this was a terrible way to do things. This branching strategy required you to keep merging back bug fixes that you had made earlier. In addition, we were using bug tracking software to track all the issues from week to week, which results in much ticket shuffling and overhead.

Now, we're doing this. Locally, we still branch for every feature that we're working on. And when there's a major set of features that need to be implemented by more than one developer, we create a remote branch for it that we push and pull to/from.
Thus, we're treating master as the golden copy of the code base. It is always deploy-able, passes all tests, and is perfect code as we know it. This allows us still the advantage of doing bug fixes and deploying independent of what features are currently on deck or in the hole, and yet we don't have to do merges every time are about to do a new version. We simply (and somewhat arbitrarily) tag versions as we go along, and only merge feature branches back. When we can, we rebase the branches to keep the history clean. In addition, we try to make our commits atomic and about one thing, rather than one feature set. That way, it makes it very helpful to remove a piece of code, cherry-pick a changeset to another branch, or find an offending commit that broke something.
So far, it's worked pretty well, but it might evolve as we go on.
Well, hope that helps. This post wasn't as fun to write, but it was something I hadn't see too much of out on the web, so I figured I'd contribute. Fun times.
Friday, January 23, 2009
Git allows my workflow to be "stateless" (or more advanced features of git)
Git has a bit of a learning curve, since their commands aren't exactly intuitive (deleting a remote repository anyone?, how about reverting is different from resetting?) you have to discard your notions of Svn, and learn how Git models a repository. But once you grasp that, it's pretty easy, not to mention pretty powerful. For me, Git had certain features that gave me a "wow", as I learned about and got use to using them. Here's in order as I discovered them.
Local branching
Branching is fast, and merging is relatively painless. When branching is fast, you end up treating branches are like tabs on your browser, but for source control. This lets you experiment with different code without affecting the main branch.
git checkout -b new_branch
Builtin Grep
I hated that grep would also search through the .svn files. Sure, I wrote an alias and script so that it wouldn't, but it would leak sometimes. Having git have a built-in grep was very nice.
git grep "some_regex"
Interactive staging of commits
Git has this idea of staging files, meaning marking them for a commit. Because you can commit different files, you can fix little things that might not have to do with your current ticket, but add them as separate commits.
But what if you edited one file but the edits had to do with two different tickets? With git, you can selectively stage parts of a file for committing.
git add -p
Rebasing branches
Rebase was a little confusing to me at first. The name didn't tell me anything. Rebase isa tool with multiple functions, with the same underlying principle, which is why it has just one name.
At the very basic, you can use rebase to move the root of the local branch if you want the changes made on the parent branch since then. This is important because it puts the burden of merging on the patch writer, and not on the merger. In addition, it makes for a cleaner commit history.
git checkout child_branch
git rebase parent_branch
Even better, you can reorder the commits as long as you haven't pushed it to a remote repository yet. The same task allows you to squash your commits together for a cleaner history.
git rebase -i HEAD~n
Stashing changes
Because you can stage files for commits and you can readily switch between branches, sometimes, you might be working on something, but they're not ready to be committed. The production code has a bug that needs to be fixed immediately. Git won't let you switch branches, but you don't want to commit unfinished code. What do you do?
Git lets you stash your changes to save your uncommitted changes, but not commit them anywhere. This is useful to switch to another branch to fix an emergency bug or perform other operations that require no uncommitted changes in the working directory (like rebase).
git stash
...fix bug on other branch...
git stash list
git stash apply
Bisection of commits
Sometimes, you're humming along with your commits, and you find that there was a part of the application that is broken, but your tests didn't catch it. You need to revert back to that version and make a branch. You can use git bisect to look for a particular commit. You give it a commit, and git will checkout that version, and ask you whether it works or not. Then it bisects the commits and half and then checks out the other half and asks you if it's correct. If not, it'll keep narrowing down the space of commits until you find the right one.
git bisect commit_hash other_commit_hash
Basically, a lot of what Git enables me to do is switch between tasks easily. I don't know if it's the right word, but it lets me work statelessly. At no time does git not let me do something because of a particular part of my workflow that I'm in. Outside of a few commands like rebase and merge (which can be fixed with stash), the commands I can run in git doesn't depend on the previous commands I've run. Really, git is a tabbed browser for me.
My biggest complaint is probably that the names of the commands aren't intuitive because it goes against the usual mental model of what a repo does. The names are actually make a lot more sense only after you understand how git models a repository. So take a look at the git book, and learn what you can.
tip!
Monday, January 12, 2009
iPhone jailbreaking resources because search has failed me.
Because google search fails in this regard, I will recount that Jailbreaking is when you break the iPhone free of the app store, and you can install software from other sources and app installers, like Cydia. Unlocking is making your phone work with any phone carrier.
Surprisingly, these links were hard to fine--of the actual iPhone Dev Team Portal and of their forum. Those are what I found to be most helpful, though they don't even have a download page, which makes me kinda mad as I hunted around for it. Checkout yellowsn0w, as well as their QuickPwn, also here (much better than Z-phone). If you're still confused, which rightfully, you are. Over at iClarified, there are very good and clear tutorials on how to use the applications.
IPhone unlocking is one of those searches that I think Google just fails at. I hadn't noticed because most of what I search for is usually academic, mathematic, or open source developer related. Those two have been rather blissfully free of intrusive ads of non-informational webpages. With such a system, people know they're being watched and indexed, and if it's an advantage to get a 'high score', they're going to try to game (or optimize) on it. It seems uncannily related to sexual selection. I'll talk about that in another post in the future. For now, enjoy the iPhone resources
Thursday, December 11, 2008
The Web and all that Jazz: Git remote branch notes
After trying out a couple things, I realized I could just create the remote branch from master, and just rebase the damn thing:
git push origin {new_remote_branch}
git branch --track {new_remote_branch} origin/{new_remote_branch}
git checkout {new_remote_branch}
git rebase {local_branch}
git push
Not super interesting, but enough and short enough to blog about. tip!
Friday, November 21, 2008
Augmenting Google's search results
Because of that, I think Google can encourage the behavior where people are sending links relevant to themselves up to the their front page in an honest way. If they click things up that have no relevance to themselves, they only screw up their own searches.
So if you have millions of people sending things relevant to themselves up the list, Google is basically gathering data about what the human 'gold standard' for a particular search query is (augmented by machine sorting first).
In information retrieval, one of the hard things is to know whether you've done a better job of returning search results or not, since a gold standard dataset is hard to come by and time consuming to produce.
Here, I think Google is simply using a mechanism where they're aligning people's self-interest to create accurate data they can use to compare their search algorithm tweaks.
All in all, a good thing. Even better if you can 'merge' search results from others that you trust..say your friends. I wouldn't mind merging my search results with _why's. More complexity that way, though.
Friday, October 24, 2008
Frogmetrics on techcrunch
I work on the server side of things, which means the analytics package which we call Mastermind. Working on the architecture over the summer was a little bit different than the typical rails app.
Mastermind allows users to view graphs of survey data for a particular region, location, or employee at a specific time period.
One of the comments that I saw on techcrunch was why didn't we use iPhones? That's a common question, and the answer is a mix of technical and business reasons. If we had iPhones to give to people, they would readily know that it was an iPhone and be more likely to run off with one. Sorry Nokia, but your tablets just aren't as sexy to run off with. Alternatively, telling people to go to a webpage on their iPhones would be another barrier to taking the survey. It wouldn't get the high response rates that we're seeing right now. The idea is to make it as easy and as painless as possible to take a survey. In our pilots, we found that older folks had a much tougher time reading the text. Nokias have bigger screens, and we could hence put bigger text on there, not to mention big beautiful buttons that affords pushing.
Well, if you or your company has interest in our product, feel free to let us know on the contact page. I dislike that we don't have our prices on the web page as of yet, but that'll be worked out soon.
Wish us luck (and hard work)!
As a side note, interesting things that I post on here don't always have to do with Frogmetrics. Like any good engineer, I play or think about interesting things whether they're related to work or not. So don't take it that whatever I'm playing with here is what's going into Frogmetrics. :)
Edited