Wednesday, November 18, 2009

Removing last character of a string in PHP

Simple :

$string = substr_replace($string ,"",-1);

That is the quickest I have found. Alternately I have done :

$string = substr($string,0,strlen($string)-1);
$string = substr($string,0,-1);

Thursday, November 5, 2009

Dvorak Programmer

Programming can take its toll on your hands. That is why I switched to Dvorak Programmer keyboard layout. It is hard to change something you have done your whole life.

I have ordered the layout stickers from eBay, as they were very inexpensive. This is the second major change, the first was switching to Linux as my primary work computer a month ago.

I may be a slow typer now, but I can already tell that Dvorak is superior in design.

Statistics on Dvorak :

  • Fingers are on home row 70% of the time, as qwerty is 30%.
  • Home row can spell 5,000 english words
  • Programmers Dvorak has brackets and operational characters easily accessable with out use of the shift key.

Many more statistics at

Thursday, October 29, 2009


Cola, like in Kola Nut, and Mel, as in Latin for Honey. More accurately its a methaglin (Spiced Honey Wine) that is spiced with various spices to archive a cocacola like flavor.

I know people have touched apon the subject of mixing cola flavors in beer/wine/ciders/meads, but I thought I would present my interest and experiments in the subject.

I found OpenColas recipe, however I am not excited about using oils or any premade flavorings in any recipe. So kept looking...

Then I found Tristan Stephensons article which in turn is a natrual ingredient adaptation of Cube Cola Recipe wich is an adaptation of the original Open Cola I found.

I went through the recipe and removed the kola (cola) nuts and citric acid. The citric acid would interfere with the target pH for the yeast, as we are dealing with a lot of acidity already, and Kola nuts are not needed for flavor (As per Tristans comments on his own recipe).

I'm left with :

500ml Water
Zest of 2 oranges
Zest of 2 limes
Zest of 1 lemon
2 pinches of ground cinnamon
2 pinches of ground nutmeg
1 points of a star anise (crushed)
1/2 teaspoon of dried lavender flowers
10g stem ginger
1/3 vanilla pod with the seeds scraped out and added as well

This makes 500ml of flavoring. The Ratio should be 1:4 of Flavoring:Drink. Basic calculations said I need to make 3800ml(1 gallon) of flavoring to flavor a 5 gallon batch. So we have to increase the quantities for this recipe... but by how much?

Target / Original = Multiplier
3800ml / 500ml = 7.6 times

But I don't want to make a Cola that tastes like Mead. I would rather have a Mead that tastes like cola.

So I'm going to drop that down a notch, so about 5 times the amount of spices from the original recipe. (Choose your own concentration on cola flavoring)

Get your zesting arm ready to zest 10 oranges, 10 limes, and 5 lemons, I suggest using a microplane zester. You can juice the zested fruits and mix it with ginger ale to make a super yummy drink while you brew up some colamel goodness :)

For scaling and bulk purchasing purposes here are some notes :

A large orange produces 2 tablesoons of wet zest.
A lemon or a lime produces 1 tablespoon of wet zest.
8 pinches = 1 tsp
3 tsp = 1 tblsp
16 tblsp = 1 cup

If you are going to order your ingredients bulk, then I would suggest, and if you are going to bulk order the zest then use

So here is the new scaled ingredients list :

2/3rds gallon
zest of 10 oranges
zest of 10 limes
zest of 5 lemons
1.25 tsp ground cinnamon
1.25 tsp ground nutmeg
5 points of a star anise (they ussually have 7 points)
2.5 tsp lavender flowers
50g stem of ginger
1 to 2 vanilla pods with the seeds scrapped out and added as well

Now to the mead side of things.

If I'm going to spend my time(and money) on this I might as well go all out... for this reason I wanted to go with a well aged mead.

I wanted to make a slightly sweet mead, as a dry cola doesn't not sound right to me; so I will infuse this recipe :

16lbs honey
4 gallons water
2tsp energizer
2tsp nutrient
Lalvin D-47

OG : 1.120
FG: 1.025

I do not like using coloring or anything else not natural to the processes. I infact like looking through what I drink. Optionally, I thought of burning a small amount of honey to add natrual colors and complexities. For my first attempt I will not add any more complications than I'm already encountering.

Final Ingredient List :

16lbs Honey (kind doesn't matter as long as its not too dark/light , but try to get it from an apiary, not the over filtered watery commercial crap)
5 Gallons spring water
Lalvin D-47
2tsp energizer
2tsp nutrient
zest of 10 oranges (1 1/4 cups)
zest of 10 limes (2/3rd cup)
zest of 5 lemons (1/3rd cup)
1.25 tsp ground cinnamon
1.25 tsp ground nutmeg
5 points of a star anise (snap off two points of a full star and throw it in)
2.5 tsp lavender flowers (Hidcote or Super Blues if available)
50g stem of ginger (fresh root)
1 to 2 vanilla pods with the seeds scrapped out and added as well (please no extract, check out and google for their coupons, had great success)

The Processes (I foresee):
Zest your fool head off. Crush the anise and lavender. Slice the ginger into thin pieces. Mix zest, anise, lavender, ginger, cinnamon, and nutmeg into 2/3rds gallon of water. Boil for 30 minutes. Then let cool slightly, then filter though a fine screen/coffee filter/large tea bag. Then add to the end of your normal mead brewing procedures. I do the no-heat method myself so I just simply throw the flavoring, water, and honey into a carboy, balance the pH (target is 3.7), and shook the crap out of it then I add nutrient, energizer, and yeast.

Since this was experimental I did a 1 gallon batch. Here was the results :

Thursday, October 22, 2009

Linux Mint Sound and Video Woes

I have a PCI Soundblaster card I use with my machine. When I installed Linux Mint it seems some apps wanted to use the onboard sound while others went for the sound blaster. Seeing how I only have one sound system I needed to consolidate this mess. I went into BIOS and disabled the onboard (the lesser of the two) sound.

Everything worked great but for what ever reason Pigdin would crash when it tried to play any sounds (which was very annoying.. cause you would get the first word of someones message and boom, crashed). This stumped me to the point I almost stopped using pigdin.

It was obvious that ALSA was trying to use my old sound card, but how to I change its configuration?

I later found that if I delete all the hidden ALSA configuration files in my home dir and rebooted that the problem would be resolved( ls ~/.a* ). Rebooted and sound worked... but video was broken.

After more research I found that I updated my kernel trying to get the sound working (through the immense amount of linux sound fixing tutorials on the internet). It seems that my video drivers are connected directly to the Kernel.

NVidia Drivers Not Found; Was the basic error. I tried quite a few different things, but I was confused to the point I had to jump on IRC.

My problem was I was trying to install drivers ontop of drivers. I forget the basic methodolgy of Linux is that you must remove before you can replace (keeps things clean). So a simple sudo envyng -t would provide me option to remove the current drivers, reboot, and install the new drivers.

So if your NVidia drivers die after a kernal update, then just use the envyng tool to replace them.

A Propolis Recipe

Propolis is wonderful, but what is it?

I keep bees and I'm always amazed on what can be produced from a hive. One thing the general public doesn't know much about is propolis. This substance is produced by the bees by using local tree/bud saps, and other biological material. It creates an antibiotic glue that the bees use to seal their hives. Its extremely sticky, but it also is amazing for its antibiotic properties. If they kill a mouse in the hive, and they can not moev it, then they can actually mummify its corpse with propolis where the corpse.

Here is a quick recipe for how to kick the flu I've gathered from the Bee Forums :

The drink :
Disolve 2 parts cognac to 1 part propolis

The chaser :
Disolve lemon juice and honey into a small amount of warm water (quantities depend on your tastes)

Shoot that shot and quickly take the chaser. Don't over do this, or you will steralize your GI tract, which can lead to other problems.

I hope to have more recipes and interesting information to come. And welcome to my blog