Ask YC: Your Favorite Hack
14 comments
A conductor I know, when asked what his favourite piece of music is, always answers with the name of a piece of music from the next concert he's conducting -- and then goes on to point out that as soon as the concert is over and he starts rehearsals for the next concert, he will have a new favourite piece of music. As he points out, if what you're working on isn't currently your favourite piece of music (or software), you're not giving it the attention it deserves.
In that vein, my favourite piece of software is my (not finished yet, but still very useful as it currently exists) "tarsnap" backup software (http://www.tarsnap.com).
In that vein, my favourite piece of software is my (not finished yet, but still very useful as it currently exists) "tarsnap" backup software (http://www.tarsnap.com).
Good post. This is an interesting story by Tolstoy along the same lines:
http://ebooks.adelaide.edu.au/t/tolstoy/leo/t65wm/chapter2.h...
A great king would make his "favorite man" the man right next to him. A worker would make his "favorite job" the one at hand. Now that is an extraordinary feat.
A great king would make his "favorite man" the man right next to him. A worker would make his "favorite job" the one at hand. Now that is an extraordinary feat.
Backup is such an easy/hard problem (easy to do, hard to do right), that I'd probably be afraid to tackle it. I'll have to check out tarsnap. Sounds neat.
Looks hot. I worked with a startup when I was consulting for the Federal Reserve that did something like this. I think their name was CyberArk?
I think there's going to be a huge need for secure backup with all of the home servers that are popping up. Storage has been exploding for years, and there's no end in sight.
I think there's going to be a huge need for secure backup with all of the home servers that are popping up. Storage has been exploding for years, and there's no end in sight.
Hum, good one. I have a cool non-hack, actually.
In college, I worked for a while in the applied physics department. It was an undergrad research project, where I was supposed to work with parallel systems and cluster architectures. They use software that calculates "density functional theory total-energy". Part of my project was to make this piece of software run in multiple machines and speed up the simulations. That used to take days to complete, sometimes weeks, and they wanted to reduce the period of the cycle.
I never got to know the whole theory behind the software (I am a Computer Engineer) but I did get to take a look at the manual explaining some of the algorithms, while I was learning more about parallel systems using message passing libraries.
I was just getting started on the whole "implement map, reduce, filter, barrier" using MPI (in Fortran!) when I found a description of the software where it showed how each atom in the strutcture, IIRC, needed to have its plane-wave basis-set calculated. This calculation required a long list of functions and was called for _every_ atom in the structure. Also, the software consisted of long runs of this call, getting more approximate results at each run.
Basically, I found an unbelievably parallelizable (is that a word?) piece of code in a application that was mostly serial.
Let's just say this: it took me more time to find the place in the code that have the call and even more time to make changes in the Makefile in order to use Intel Fortran Compiler than the time it took me to add 5 lines of MPI code and get the problem solved.
When we saw the speedup was directly proportional to the size of the cluster (if we wanted double of the performance, just add the double of computers), I realized that the feat (changing significantly the behavior of an program with so little modification) would be hard to repeat.
It was no "major hack", but it made me value (a) proper documentation and (b) getting a complete view of the system that I am supposed to work on and modify.
In college, I worked for a while in the applied physics department. It was an undergrad research project, where I was supposed to work with parallel systems and cluster architectures. They use software that calculates "density functional theory total-energy". Part of my project was to make this piece of software run in multiple machines and speed up the simulations. That used to take days to complete, sometimes weeks, and they wanted to reduce the period of the cycle.
I never got to know the whole theory behind the software (I am a Computer Engineer) but I did get to take a look at the manual explaining some of the algorithms, while I was learning more about parallel systems using message passing libraries.
I was just getting started on the whole "implement map, reduce, filter, barrier" using MPI (in Fortran!) when I found a description of the software where it showed how each atom in the strutcture, IIRC, needed to have its plane-wave basis-set calculated. This calculation required a long list of functions and was called for _every_ atom in the structure. Also, the software consisted of long runs of this call, getting more approximate results at each run.
Basically, I found an unbelievably parallelizable (is that a word?) piece of code in a application that was mostly serial.
Let's just say this: it took me more time to find the place in the code that have the call and even more time to make changes in the Makefile in order to use Intel Fortran Compiler than the time it took me to add 5 lines of MPI code and get the problem solved.
When we saw the speedup was directly proportional to the size of the cluster (if we wanted double of the performance, just add the double of computers), I realized that the feat (changing significantly the behavior of an program with so little modification) would be hard to repeat.
It was no "major hack", but it made me value (a) proper documentation and (b) getting a complete view of the system that I am supposed to work on and modify.
A metasearch engine, written in Javascript, that executed entirely on the browser. How? The page was hosted at d.o.w.s.e.r.bueno.org. o.w.s.e.r.bueno.org pointed to Google, w.s.e.r.bueno.org pointed to Yahoo, etc.
The XmlHttpRequests always appear to go to a root domain of the page, so it worked.
That one still makes me grin.
The XmlHttpRequests always appear to go to a root domain of the page, so it worked.
That one still makes me grin.
The easiest way I've found so far is to dynamically create a script object on the page and set its .src to some dynamic page (which can, by the nature of script src be on any server). You have to have your remote script serve back Javascript, but that's about it. Google uses something like it to do their content ad RPC's when you opt for the Javascript method rather than the IFrame.
I like that a lot! Use the DNS system to outwit the stupid XMLHttpRequest sandbox. Way cool.
Thanks, but while the restrictions on XHR are heavy, they aren't stupid. An unnamed party used the same idea to implement a LAN sniffer: each successive root domain pointed to the IP addresses of well-known routers, like 192.168.15.1. The script ran down the chain and attempted to log in to the admin page of the router, using default passwords.
The real point is that with enough smarts, you can get around the restrictions, so you might as well eliminate them altogether so that there's no false sense of security.
I feel that way sometimes when I can't do something cool. But it passes. No restrictions on user processes is a major reason why "Windows security" is a contradiction, for example. It doesn't work in an adversarial networked environment.
Nice.
Not that I approve. But nice.
I'm a JSON person myself. Ran into too many problems with domains and XMLHttpRequest. From a security standpoint, the entire browser is broken, but that's probably a discussion for another day. Neat how you re-routed.
Not that I approve. But nice.
I'm a JSON person myself. Ran into too many problems with domains and XMLHttpRequest. From a security standpoint, the entire browser is broken, but that's probably a discussion for another day. Neat how you re-routed.
Since 3 years I keep under my bed a hardprinted copy of the Solaris dynamic linker source code, and another of the AIX kernel machine-dependent (esp. the boot phase).
the Solaris RealTime Dynamic Linker code is available at: http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/sr...
and the AIX kernel is available on your favourite peer-to-peer network. This is my bible. Look at the files under aix/bos/kernel/ml/, you will learn a lot about kernel-land and Power(PC) architecture.
I enjoy it as a real piece of poetry, each function as an unique verse. You can even appreciate some erotic pieces (especially if you try to compare your reverse IDA analyse with the source).
If you are more openminded you can read the Linux kernel bootcode files (under linux/arch/$ARCH/kernel/). The first time is still the harder one, and you'll always remember it. But it worst it.
the Solaris RealTime Dynamic Linker code is available at: http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/sr...
and the AIX kernel is available on your favourite peer-to-peer network. This is my bible. Look at the files under aix/bos/kernel/ml/, you will learn a lot about kernel-land and Power(PC) architecture.
I enjoy it as a real piece of poetry, each function as an unique verse. You can even appreciate some erotic pieces (especially if you try to compare your reverse IDA analyse with the source).
If you are more openminded you can read the Linux kernel bootcode files (under linux/arch/$ARCH/kernel/). The first time is still the harder one, and you'll always remember it. But it worst it.
That's kinda creeping me out.
Did you write the dynamic linker and kernel, or are you, er, just enjoying them in your private time?
Did you write the dynamic linker and kernel, or are you, er, just enjoying them in your private time?
Back in the mists of time I wrote code in BASIC and assembly for the Research Machines 380Z/480Z computers. When they came out with their Z-NET network I reverse engineered (with a friend) the packet send/receive APIs and we built on top of it a reliable transport protocol that would enable us to guarantee delivery of about 128 bytes of data to a machine on the network.
The entire code was stuffed into an unused block of data within the operating system and when a packet was received the receiving code would get an interrupt and would promptly CALL the code in the packet. We were able to reliably deliver 128 bytes of machine code and have it execute on any machine.
This turned out to be very cool because it enabled us to build a complete package for network management and monitoring (we could do stuff like mirror the screen on any machine to another one).
John.
The entire code was stuffed into an unused block of data within the operating system and when a packet was received the receiving code would get an interrupt and would promptly CALL the code in the packet. We were able to reliably deliver 128 bytes of machine code and have it execute on any machine.
This turned out to be very cool because it enabled us to build a complete package for network management and monitoring (we could do stuff like mirror the screen on any machine to another one).
John.
a couple of years ago I was working as a lab assistant in a university computer lab. Part of my job was to check the printers hourly (in labs on 5 different floors) and see if they needed more paper. Being extremly lazy I wrote a program that would log into the printers web based panel. This panel displayed a paper level indicator as an image. I discovered tgat the image filenames contained the percent full as a number (0, 25, 50, 75, 100). I had my program regularly check all the printers, parse the paper level and alert me if any printer was at 25 or empty.
A couple of years ago I took a course in Marine Ecology, for our final exam we have to do a lot of calculations using the Shannon-Weiner index (http://en.wikipedia.org/wiki/Shannon_index)
I wrote a program in my HP 48 calculator to solve it putting all the variables in a list, it's my favorite hack because I was the only one in the class who knew programming, so I finished the 2 hour exam in 30 minutes =)
I wrote a program in my HP 48 calculator to solve it putting all the variables in a list, it's my favorite hack because I was the only one in the class who knew programming, so I finished the 2 hour exam in 30 minutes =)
A tiny Win32 C program that would simply trigger print, then wait, then killed the app - used to call a "mission critical" app that always hung after print and thus couldnt be scripted, to automate the printing of hundreds of reports.
Fave b/c my manager insisted it could not be done, and it saved countless hours of babysitting. Showing up at the office next morning to see the huge pile of completed reports sitting there waiting was gratifying.
Fave b/c my manager insisted it could not be done, and it saved countless hours of babysitting. Showing up at the office next morning to see the huge pile of completed reports sitting there waiting was gratifying.
My favorite hack was achieving the drop-down functionality seen in menus like those on Digg and Facebook in about 5 lines of jQuery. It was particularly satisfying because the jQuery plugin to emulate the effect is more than a couple hundred lines long. It also works in all browsers :)
A few years ago I wrote a blackjack game for iPods. Since the iPod can't execute third party programs (without alternative firmware), However, they can display interlinked text documents, so I wrote a program in c to generate a document for each possible state of the game. Blackjack made this possible, since there are only 5 or 6 states in any game.
I don't think I ever actually used it except for testing, it was more of a "just because I can" project. To my amazement some people actually used it for fun. I think it got into MAKE blog and a few other cool places.
I don't think I ever actually used it except for testing, it was more of a "just because I can" project. To my amazement some people actually used it for fun. I think it got into MAKE blog and a few other cool places.
I have to list three: DataVision (http://datavision.sourceforge.net) because it's in use in fifty countries, a version of Objective-C I called Subjective-C (1996) because it taught me about parsing and runtime stack manipulation, and a Java applet-based image manipulation package that let you apply makeup (eye shades and lip shades, with added gloss) to your own photo on the Web back in 1999, because it was ahead of its time.
A heads-down flight display I built in the off-moments of a business trip. Surprisingly enough the most satisfying code handled text display (remember the text is constantly moving). Also, a python script to automate our build and unit tests; whenever something broke or failed a test it would look up the latest check-in and mail the error to the offending developer.
What was your favorite and why?