Posts
Natural Sort
Why doesn’t every programming language have “Natural Sorting” built in, out of the box? Natural sorting is the way humans sort, where number substrings are sorted numerically, everything else alphabetically:
Dave Koelle’s Alphanum Algorithm sorts naturally, but instead of analyzing each array element O(log(N)) times, I present a modified Perl version that allows for Schwartzian transforms, yielding huge performance improvements.
Improvements to Alphanum The problem is that the sorting algorithm in many languages sorts by calling a user-provided comparison function taking two parameters, a and b.
Posts
Refresh your browser automatically during web development
Did you ever find that while editing files for the web (e.g. HTML, Javascript, Java/Flash/Ruby, whatever) that it would be cool to have your browser reflect any changes as soon as you hit Save in your IDE without having to Alt-Tab to the browser and hit refresh (Ctrl-R)? That way, you could stay entirely in your browser and just move your eyes to the browser as it refreshes automatically showing you the results of your newest changes.
Posts
Forwarding SNMP ports over SSH using socat
Here is an example of the problem we need to solve: We have SSH access to a network, but want to access an SNMP agent in that network from a local client. We use SNMP here in this example, but it could be any other protocol that uses UDP, such as DNS or TFTP.
We’ll forward the SNMP traffic in a TCP port like this, with “socat” doing the UDP-in-TCP tunneling:
Posts
Subversion: Setting the repository path for svn+ssh://server/repos
For some reason, it doesn’t seem to be possible to set up a path for your repository when using subversion as: svn+ssh://server/repos out of the box. So you end up having to specify svn+ssh://server/some/path/repos.
But it really isn’t that hard to do. Here is how I do it. Beware that you’re going to be making system-wide changes to how svnserve operates. The basic idea is to replace svnserve with our own version, that calls the original one with a -r parameter.
Posts
Classical Mechanics: Why does Power depend on frame of reference?
Imagine we’re in a rocket.
We have an imaginary engine, that provides a constant amount of thrust. How much power does such an engine provide? In essence the power depends linearly on the velocity:
\[ \begin{align*} P &= \frac{dW}{dt} \wedge W = \int F \cdot ds \Leftrightarrow \\[10 pt] P &= F \cdot \frac{ds}{dt} \Leftrightarrow \\[10 pt] P &= F \cdot v \end{align*} \] And the velocity depends (by definition) on the frame of reference.
Posts
Deep Packet Inspection? Yup, bring it on!
Deep packet inspection could be useful to ISPs who oversell limited bandwidth to (too) many customers. With Deep Packet Inspection, my ISP could inspect the contents and details of the high-bandwith traffic going to and from my neighbor:
Our ISP could then determine most of it to be peer-2-peer traffic, and then limit exactly that peer-2-peer traffic so that my neighbor ( :-) ) doesn’t hog all the bandwidth that we all have to share.
Posts
Documentation, Git and MediaWiki
I have a dream. I want to write structured documentation and source code together in my text editor and version control both together with git, just like the source code. But have it be searchable, viewable and ideally editable within MediaWiki. Is this possible?Requirements Several contributors each write or edit documentation and check it in to git. So git holds the original documentation, along side code for the project or other project files.
Posts
Xen?
Now, do I want to run Xen? Hmm… I’m using it to host morch.com itself, and I think its great.
Compared to VMware workstation, which is my other favorite, I love that it is open source, and I love that it is detachable. That is, I can start it and don’t have any GUI artifacts hanging around. What I do with VMware workstation is start it under a VNC server, so I don’t have to worry about the GUI, but this isn’t about VMware but about Xen.
Posts
Church and State
Isn’t this great?
If you define “church” as an organization that teaches a specific doctrine in a very specific way, and “state” as the institution which is empowered to create and implement the laws which govern your people, it is of benefit for these elements to be separated.
If you define “spirituality” as the sum total of your cultural values and your most sacred beliefs, and “politics” as the process by which you select the people who will write and pass laws, as well as the method by which laws are adopted, then it is not of benefit for these elements to be separated.