Math Tidbit: Percent Change Formula

Problem: You have two numbers – X and Y – and you want to figure out what percentage of increase or decrease there is from X to Y.

Solution: I’ve had to do this a bunch of times in my life and while I always come up with the correct answer, it always takes me longer than I think it should.

If X = 2.3125 and Y = 2.3750, you could do this:

(Y – X) / X * 100 = Z

(2.3750 – 2.3125) / 2.3125 * 100 = 2.70270270

That means that if I change the gear ratio on my motorcycle from 2.3125 to 2.3750, that would be a 2.7 percent increase.

Percent Change Calculator

The difference between X and Y is a Z

Lubuntu on Asus EEE PC 900

I have an Asus EEE PC900, but the bastardized version of Debian that came with the computer was wildly out-of-date. No sane person should put an un-patched computer on the Internet without patching it. Unfortunately there isn’t apparently any way to update the hacked Debian install that came with the computer.

Fortunately, I was able to simply install the latest version of Lubuntu. Now rather than that lame window manager that came with the computer, I can run whatever I want.

Here’s how I did it.

  1. First I downloaded Lubuntu and put it on USB stick. I downloaded the 32-bit version.
  2. Plug the USB stick in and figure out where it’s mounted.
    sudo fdisk -l
  3. Mine was located at /dev/sdb1, adjust for your setup and unmount your stick.
    umount /dev/sdb1
  4. According to my research, FAT32 is the more reliable format, so I formatted with this command.
    sudo mkdosfs -n 'MYSTICK' -I /dev/sdb -F 32
  5. Copied the .iso to the USB stick partition copying to the partition, sdb1, not the device, sdb.
    sudo dd if=lubuntu.iso of=/dev/sdb1 bs=4k
  6. Force the completion of any disk writes and eject the stick
    sudo eject /dev/sdb
  7. Now my Asus EEE PC was booting, I pressed ESC and selected the USB stick as the boot device. Don’t try and set the boot order in the BIOS, it’s ignored, you have to hit ESC and select the boot device.
  8. Once I booted Lubuntu from the USB stick and it seemed to work, I installed Lubuntu. While installing, I also repartitioned the drive to include 256MB swap space.

Debian Wheezy mod_perl apreq_handle_apache2 undefined symbol issue

While installing mod_perl on Debian Wheezy I ran into this issue and log message.

/usr/sbin/apache2: symbol lookup error: /usr/lib/perl5/auto/APR/Request/Apache2/ undefined symbol: apreq_handle_apache2

To fix it, I had to load the apreq.load module. On Debian, just symlink to the /etc/apache2/mods-available/apreq.load in /etc/apache2/mods-enabled and it is fixed.

Upgrading MySQL on Debian Wheezy Fails

I just did an update to one of my Debian Wheezy servers. After the upgrade Mysql failed to start. That sucked, but fortunately I was able to fix it.

All I needed to do was comment out a line from /etc/mysql/my.cnf.dpkg-dist.

If you run into the issue, the problem is related to this line in my.cnf.dpkg-dist file.

lc-messages-dir        = /usr/share/mysql

I commented that line out and the Mysql server fired right up.


Where to put assets like CSS and Javascript in Symfony

I just solved a fairly simple problem, but for my own record and if it could possibly save someone some time, here you go.

In Symfony, you want to put your assets (CSS, Javascript, images) in the right location, which is src/BUNDLE_NAME/Resources/public.

To use your assets in your web application, run this command.

php app/console assets:install --symlink

This command creates a symbolic link with the bundle name in your web/bundles directory and voila, the assets are now available via the Twig/Symfony asset command.

New to Symfony? Check out my getting started tutorial here.

How to resurrect a dead cell phone

Recently my Samsung S3 locked up. It was basically dead. I pushed the power button a bunch of times. I pulled the battery, but what I needed to do was combine those two actions.

I found the answer to my dilemma in this helpful troubleshooting guide.

What I needed to do was pull the battery and then push the power button. Pushing the power button while the battery out drains any residual electricity in the phone.

I popped the battery back in and voila, it works again.

Upgrading Debian Squeeze to Wheezy

I’ve recently done a few upgrades of Debian from Squeeze to Wheezy and it’s a pretty uneventful process.

I recommend following these instructions at HowtoForge.

The only major issue was that Mysql was removed after the upgrade. My data was still there but I had to install mysql-server.

apt-get mysql-server

Also you might get an annoying messaging when running PHP that looks something like this.

Unable to load dynamic library '/usr/lib/php5/20100525/'

To fix this run

dpkg -P php5-suhosin

Because I run some stuff using mod_perl, I had to reinstall a bunch of modules, but no big deal.

Other than these issues, it went pretty smooth.

Kudos to the Debian team for releasing another solid Debian version. That’s been my go-to Linux distro for at least 10 years and I’ve never been disappointed.

Tip Jar

If you think what I’m publishing here is worth more than nothing and you want to see me keep publishing, leave a tip.

When I bartend, I get a buck for pouring someone a beer, the shit I’m doing here is worth at least a dollar.

And no, I don’t want to sell ads.

Symfony 2 Getting Started Guide Now Available

It is here folks. The moment you have all been waiting for.

My new Symfony 2 Getting Started tutorial is here.

This is a simple and powerful tutorial that will get your through many of the core components of building applications using open source Symfony.

I love Symfony, and I think you will too, so check out my tutorial and get building.


Plug Your Tach Hole

This is what my '78 Honda CB400 looked like when I bought it for $650 in 2013.

This is what my ’78 Honda CB400 looked like when I bought it for $650 in 2013.

I’m about to make my first customizations to my ’78 CB400 for this season. I purchased the bike last year for $650. I didn’t do anything to the bike but change the oil and check the tire pressure. I just wanted to ride it for a year and see if it’s something I want to invest time and money into.

The bike has held up well. The suspension is a bit jacked up, the bike rides too low in the rear-end, but the engine is strong and reliable.

While I’m still not convinced I want to dump a grand into this bike, I do need to clean it up a bit. These old Hondas are actually decent little bikes at their core, but the clunky speedos, seats, turn signals, handlebars and fenders need to go.

So on its way from Dime City Cycles are a fresh set of satin black euro bars. I also have a new tiny black speedometer, also from Dime City, to replace my current stock speedo and tach setup.

One of the issues with removing the tach is that I have to plug that hole in the engine where the tach cable used to go.

Rather than tossing the old cable into the garbage, I’m going to chop it up to manufacture a plug for my tach hole.

Using my Dremel or hacksaw or something, I plan to cut off the threaded part of the cable that screws into the engine. It will have a hole in it where the cable used to go, I’ll cut a small piece of tin to pop in the hole and then screw in the threaded part from the cable.

It’s a lot easier and cheaper than tracking down and purchasing a plug that fits in that hole. The cheapest I found was like $13 including shipping. It’s basically a $5 part with $8 shipping, it seems silly.

I’ll post when I’m done to see if this works and how it looks.

Tip Jar

If you think what I’m publishing here is worth more than nothing and you want to see me keep publishing, leave a tip.

When I bartend, I get a buck for pouring someone a beer, the shit I’m doing here is worth at least a dollar.

And no, I don’t want to sell ads.