Tuesday, July 24, 2007

Making testing enjoyable with parsers

A lot of people can find writing autotests to be tedious. But once you have a parser for your code there are a number of very interesting projects that you can write to help test your code and improve your auto tests.

The faster you can find errors the less time you will spend later on fixing bugs. The more I can automate things, the more tests I will get and the better the chance that I will find bugs sooner while I am still familiar with the code.

Generate autotests

The first things you should do with the parser is write a tool that will generate a stub auto test for you. Once you have an autotest adding new ones are not that hard, but creating that first one can be hard. Don't stop at just a stub, basic tests that just call every function (to make sure they don't crash) and more are very useful to generate. After that when writing the stub that will test function X the parser should walk inside of X and automatically add comment to the test for each control flow statement. Then all that has to be done is go through and implement each comment. This should remove a lot of the guesswork about what to test.

Mutation testing

Once you have autotests you can run your parser over your code only this time have it modify the code. There are plenty of simple things such as changing if(foo) to if (!foo) that can be done with very little work. After the modification run the auto tests and see if the test still passes, in which case the auto test coverage isn't very good. Record those changes that don't cause any failures in the tests.


When adding a feature or fixing a bug one thing you want to do it to make sure that your changes didn't accidently change something that it wasn't meant to. Generate a known set of known things about your object. To start this database use your parser to call every function and record what happens. It doesn't need know if what it does is right or wrong just what it does. After making a change you can compare any differences to make sure you didn't break something you didn't mean to. The more data you can add to the database the more secure you can be in knowing that your changes didn't cause unintended regressions.

Test failure finder

I have previously written about this method here: Test failure finder.


A simpler version of the previous, test failure finder, using the parser to determine what can be called and just call the inputs with random data (from a seed) until it crashes. This is a way to test your code without having to write any code at all and can be run starting from day one.

I don't like to fix bugs, I like to code.

Saturday, July 21, 2007

Photo booth with a comment field

In OS X there is an application Photo booth. It would be nice if your was a very easy way to add comments to the image that would be saved into the images exif data. Then you could add comments about who was in the photo, thoughts etc.

Make an application as simple as Photo Booth (for images or video), but with the ability to add comments and then upload it to flicker or youtube.

Thursday, July 19, 2007

Valgrind memory measuring done better

Create a memory tool similar to KCacheGrind.

Valgrind is a fantastic application with several built in tools. One of the tools is massif, a heap profiler. While nice this tool was quickly put together and leaves you wanting more. It generates two output formats. The first is a pdf file. The data is squished to fit onto the pdf size, colors are reused and in general it is just hard to read. The second format is txt/html. The txt is near worthless, but the hmtl is at least a little bit usefull. With enough time and effort you can get some good information out of it. At the end of the day massif only touches the tip of the iceberg as far as features go.

Change massif to generate a data file similar to callgrind where you get a complete stack trace every time memory is allocated or deallocated. Then a rich tool can be created that can graph the data, you can select the any allocation and get details on what it is and where it was allocated.

Another tool could be run as the data is generating showing a graph of memory usage so when you do something in your application and the graph spikes up you would immediately see it.

A tool like this is missing in open source.

git in a word processor

Combine git with a word processor transparently to provide a editor that is leaps and bounds beyond what any word processor provides today as far as versioning and branching goes. Be able to share docs and actually merge them.

Wednesday, July 18, 2007

Make your own social bookmarking site

Combine reddit.com and blogger.com to get a site where you can create forum/social bookmark sites about any topic you want in two minutes.

reddit.com is a good site. A bit of a forum site, a bit of a social network site. Unfortunately it has grown in size the as it has grown the content that is found on reddit is more general and there is a lot of group think. Overnight there are dozens of articles about impeaching the president or electing Ron Paul or some random big news story of the week. The more users that sign onto redit the more general the topics become. Breaking news is much more likely to survive then a link to a published science paper no matter how good it is. About a year ago reddit started getting kitten pictures and today many programming articles don't make it to the front page anymore.

With tags and filters one would be able to ignore the latest reddit fad, but there is something that tags could never fix. If you submit an article about an interview with a comic artist there is probably more people on reddit who will mod it down then up. Now if you were to go to a comic forum/social site that same article might be the top article and debated in depth. Topics that are not in the mainstream, but nitch don't work too well on social bookmarking sites like reddit. Many people have taken the approach of created there own reddit/digg clone specifically for a nitch. http://truemors.com/ lets you submit rumors and http://www.huffingtonpost.com/ lets users vote on pre-identified blogs (including themselves) are just two such clones and there are many more. Some of these sites have been coded from the ground up, but there is starting to be programs you can download and in install to get a digg clone. This is just the next generation of the bulletin boards from ten years ago. You still have to own the domain, hosting and perform all the maintenance on the site.

blogger.com provides a nice service, before blogger.com typically you really had to setup your own domain and have your own blog, but after that in five minutes flat you could have a blog. Heck you could have ten blogs about ten topics if you wanted just as easy. Now if you were to have a site like blogger.com, but rather then making blogs, it would let you create reddit clones. Create a social bookmark site around any nitch you want. If there is a community then it survives and if not, well it was only a few minutes of work to set up.

Slashdot, K5, digg, reddit, one by one they have risen and then what was once so nice, fills up with junk. The community moves on to a new social site. Well they don't move overnight, first someone has to make a new site for them to move to. With this social site overnight a new community could be created. A community can fracture in a nice way. When Ron Paul became big anyone could have overnight made a Ron Paul social bookmarking site where every single link could be posted and appreciated rather then the slow death on reddit where eventually everyone was voting down Ron Paul articles, not because they were bad, but simply because they were about Ron Paul.

The idea that reddit brings is good, good enough to be bought, but bigger then them would be a site that lets you make sites, thats a site that Google would buy.

Update: I have informed of one such site that is trying to do just this (and looks quite reddity): dailyhub.com

Update: And another site http://slinkset.com/ and a site that just for comments: http://disqus.com/

Web browser on a canvas

Take the browser window and slap it in a canvas. By default it could look like Firefox/Safari etc, but unlike them you can zoom out to find a graph showing your history. If I started out at page A and then click on B and then opened a new tab AA when I zoomed out to the graph view I would see the following:

[B] [AA]

Scrolling up and down there could be lines highlighting the hour/day change making it easy to find where you were. All pages that you visit in your history will be indexed and be searchable. Typing in searching will hide nodes that don't apply leaving the remaining ones that are left easy to browse around.

Because the browser is built on top of the canvas animations and transitions will be very easy to implement. Features that you have seen on the iPhone and in the newer 3d window managers can be done with ease. Going back could have the page scroll off the bottom of the screen and the previous site scroll down and subtly "bounce" into the window.

Developers could add all sorts of features, hit and key and like OS X's dashboard you can flip around a webpage and dissect it, information nodes/boxes could pop off all sides and with zooming in and out of the canvas there is plenty of room for all sorts of addons and details about the site without having to sacrifice because of space.

Or when a webpage is flipped over there would be all the user addons such as the ability to list what filters apply to that site, if cookies should be allowed, etc

Update: Check out what Zack has done with wekit on a canvas.

Wednesday, July 11, 2007

Transformers stock graph

With eBay publishing its auctions via rss, you could create "stock" graph of Transformers toys. It would be interesting to see the price of items rise or fall over time, spiking at Christmas perhaps etc. Of course Transformers are just the tip of the iceberg, it would be interesting to see the graphs of many hot items.

Scale with a memory card

How about a weight scale that you could put a CF or SD card into. Every time it measures the weight it records the time and amount. Then you will get a nice easy and simple method of keeping track of what you weight that can very easily be turned into graphs etc.

Update: Scale with bluetooth! http://www.google.com/products/catalog?client=safari&rls=en&oe=UTF-8&q=bluetooth+scale&um=1&ie=UTF-8&cid=8355700080147424377&sa=X&ei=X-GHTbPgPKyM0QH1o7SDCQ&ved=0CCAQ8wIwAQ#ps-sellers

Update #2 cheaper wifi model: http://www.withings.com/en/bodyscale