Sorting Version Numbers in PHP

What’s the problem? Say you have a version number such as 1.2.3 stored in a MySql database as a varchar, and you want to sort this version number. Without any decimals, here is the sorting descending:
+———+
| version |
+———+
| 9960 |
| 9952 |
| 9765 |
| 9764 [...]

Tags: , , , , ,

Carburetor Tuning with DIY Manometer

My motorcycle wasn’t running very well. There was an intermittent miss fire at varying throttle positions, and it wasn’t idling very well. I checked the spark plugs, which looked fine, and decided that the ignition system was probably all right. That isolated the problem to the carburettors.
My motorcycle has 4 inline carburettors, with a shared [...]

Tags: , , , , , ,

Force PHP function to return instead of echo

Have you ever working on some PHP software that had functions that echo’ed and you want them to return so you can echo later or pass the data to something else? I found a nice way of presenting the solution. All of the php functions that start with ob_ such as ob_start() allow you to [...]

Tags: , , , , ,

Text File Paragraph Formatting with Vim

I recently had to fix 50 files of plain text user content to be more readable. Line breaks needed to be added to make the paragraphs look more coherent. Here is my solution to fixing a file quickly.
Add the following to your .vimrc Set 100 to the max number of characters that you want in [...]

Tags: , , , ,

Disabling the Wordpress Flash Uploader

Sometimes it can be finnigy — the wordpress flash uploader. When it works, it works nicely, but when it doesn't work it can be frustrating to troubleshoot and fix. If you ever decide that you don't want it anymore, there is a very simple snippet that will make it look like wordpress never had a [...]

Tags: , , ,

Euler’s Formula and Trig Identities

Electrical Engineers tend to use imaginary numbers quite often for various reasons. The term ‘imaginary’ can be misleading. In algebra II, when I heard that term, I was skeptical about the usefulness of an imaginary quantity. But if you can get over the name, they can be used as a powerful tool in many math, [...]

Tags: , , , , , , , , , , ,

US Bank – Funny Ad

If you get this Credit Card, We will hit you in the face with a golf club. – US Bank
Iowa State has a high dollar deal with U.S. Bank that allows students to use their university id as a debit card. They have it set up such that, if you come to ISU, during [...]

Tags: , , , , , , , , , ,

Freebording – Snowboarding in the Summer

Skateboarding, a sport I enjoy, originated from surfers who wanted to "surf the streets". A new sport, freebording, that some friends of mine at ISU are pioneering in the ISU Freebord Club, is allowing them to "snowboard the streets". A Freebord is like a long skateboard with two wheels placed along the center axis [...]

Tags: , , ,

Convolution of Two Uniform Probability Distributions

The Problem
Two friends A and B meet every morning at the Grand Central Station around 7 am. Suppose the actual times they arrive are independent and uniformly distributed between 6:55 am and 7:05am. Let Z denote the time between arrivals, i.e. Z = time B arrives – time A arrives (can be negative!).
(a) What is [...]

Tags: , , , , , , ,

Integrating Zenphoto and Wordpress

Update: I am now using google picasa with the kpicasa plugin. I've determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this [...]

Tags: , , , ,