Simple C# OAuth implementation for Twitter API 1.1

Many web developers woke up June 12, 2013 to find that Twitter had retired their old API and thus broke much of the internet. The new API (1.1) requires OAuth integration for all methods and has removed XML output in many cases. Not merely a simple tweak, this actually requires substantial development to get working correctly.

I spent much of yesterday looking around the web for a simple, graceful solution that didn’t require external libraries or dependencies. I was not able to find one, so decided to come up with my own implementation. Most of the code here is stolen from TheCodeKing’s excellent tutorial on CodeProject although I’ve tailored it explicitly to the new API, and also allowed you to specify the number of tweets you want (harder than it seems).

First step is you need to register your website as an “app” with Twitter. Go to and create an application. This generates a bunch of keys you will need in the code.

Now, you can use the following code to retrieve a user’s tweets and display them on your site. I’ve kept this code as simple and basic as possible, so there is much room for additional features. The code below is for ASP.NET/C#, although you could probably port it fairly easily to other languages.

public class Tweet
    public string created_at { get; set; }
    public string id { get; set; }
    public string text { get; set; }
    // Add more fields in here if you need them
protected void Page_Load(object sender, EventArgs e)
    // OAuth keys generated at For security purposes would be better to put these in web.config.
    string OAuthToken = "your oauth token";
    string OAuthTokenSecret = "your oauth token secret";
    string OAuthConsumerKey = "your oauth consumer key";
    string OAuthConsumerSecret = "your oauth consumer secret";
    // Other OAuth connection/authentication variables
    string OAuthVersion = "1.0";
    string OAuthSignatureMethod = "HMAC-SHA1";
    string OAuthNonce = Convert.ToBase64String(new ASCIIEncoding().GetBytes(DateTime.Now.Ticks.ToString()));
    TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
    string OAuthTimestamp = Convert.ToInt64(timeSpan.TotalSeconds).ToString();
    string ResourceUrl = "";
    // Request arguments
    string TwitterUsername = "your twitter username";
    string TweetsCount = "5";
    // Generate OAuth signature. Note that Twitter is very particular about the format of this string. Even reordering the variables
    // will cause authentication errors.
    var baseFormat = "count={7}&oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" +
    var baseString = string.Format(baseFormat,
    baseString = string.Concat("GET&", Uri.EscapeDataString(ResourceUrl),"&", Uri.EscapeDataString(baseString));
    // Generate an OAuth signature using the baseString
    var compositeKey = string.Concat(Uri.EscapeDataString(OAuthConsumerSecret), "&", Uri.EscapeDataString(OAuthTokenSecret));
    string OAuthSignature;
    using (HMACSHA1 hasher = new HMACSHA1(ASCIIEncoding.ASCII.GetBytes(compositeKey)))
	OAuthSignature = Convert.ToBase64String(hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes(baseString)));
    // Now build the Authentication header. Again, Twitter is very particular about the format. Do not reorder variables.
    var HeaderFormat = "OAuth " +
	"oauth_consumer_key=\"{0}\", " +
	"oauth_nonce=\"{1}\", " +
	"oauth_signature=\"{2}\", " +
	"oauth_signatureMethod=\"{3}\", " +
	"oauth_timestamp=\"{4}\", " + 
	"oauth_token=\"{5}\", " + 
    var authHeader = string.Format(HeaderFormat,
    // Now build the actual request
    ServicePointManager.Expect100Continue = false;
    var postBody = string.Format("screen_name={0}&count={1}", Uri.EscapeDataString(TwitterUsername), Uri.EscapeDataString(TweetsCount));
    ResourceUrl += "?" + postBody;
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ResourceUrl);
    request.Headers.Add("Authorization", authHeader);
    request.Method = "GET";
    request.ContentType = "application/x-www-form-urlencoded";
    // Retrieve the response data and deserialize the JSON data to a list of Tweet objects
    WebResponse response = request.GetResponse();
    string responseData = new StreamReader(response.GetResponseStream()).ReadToEnd();
    List<Tweet> UserTweets = new JavaScriptSerializer().Deserialize<List<Tweet>>(responseData);
    // You can now access the data at UserTweets[1].text, UserTweets[1].created_at, etc.
Posted in Code | Leave a comment

Make Your Own E85 Biofuel

With gas prices all the rage these days I want to show some techniques for making your own fuel. In a previous post I showed how to make Homemade Biodiesel by processing vegetable oil with a small motor rig. In this post I’ll explore the other large scale commercial biofuel: Ethanol, and show why ethanol-based fuel is sadly inefficient and generally useless.

Ethanol fuel production is a two-step process. In Step 1 you produce a ~18% ABV alcohol mash from basic sugar. When this process is carried out on an industrial scale they typically use corn sugar (Canada, USA) or sugarcane (Brazil). In Step 2 you refine the mash into a high-strength ethanol base (generally 90%, or 180-proof) which you can then add to regular gasoline in flex-fuel vehicles. If you don’t have a flex-fuel vehicle you can even use it in a regular car engine, provided it is mixed with gasoline at a minimum 15:1 ratio. As of December 2010 the Canadian government has mandated that all fuel contain 5% ethanol by volume, so you’re actually already burning it.

Please note that homemade ethanol fuel production is illegal in Canada, the United States and most other countries. It requires the use of a distillation column which is prohibited by law almost everywhere. If you choose to follow these instructions the you do so at your own risk. Also it is important to point out that a) I do not own a distillation unit; all inferences herein to my ownership or use of a distillation column are entirely theoretical b) all pictures in this article are fake, they were digitally produced in Photoshop.

Part 1: The Mash

The ingredients are pretty simple. First we need a sugar to convert to alcohol. If we were making booze to drink we’d use something good like apple juice or honey or barley malt; however we’re making fuel, so we use the cheapest, strongest stuff possible. 4 Kg of table sugar. Buy this at Bulk Barn if you want to save $$$. Also, to maximize my yield I’m using Swedish Black Label 14-17% Turbo Yeast. You can buy this online, or just use EC-1118.

Mix the sugar in a stockpot with about a gallon of water. Boil this until all the sugar dissolves.

Pour this wretched mix into a sanitized carboy and add water until it reaches ~10L. Now use a hydrometer to measure the starting gravity. In my case the SG is 1.136, so potential alcohol somewhere around 18%.

The mash should be a sickly pale green color. Once it has cooled down to room temperature, pitch the turboyeast.

Over the next 7-10 days this mash will ferment into a wretched alcohol base. Use an airlock to seal the carboy and watch the activity, once the mash is ready it will stop bubbling.

During the fermentation process you’ll notice all kinds of strange activity in the carboy. For a couple of days in the middle it goes completely ghost white:

Once the mash is ready about 10 days later, it should be a translucent pale green color with a big pile of sediment at the bottom.

Using a hydrometer, measure the final gravity of the batch. In my case the FG is 1.092, the alcohol content of the mash is roughly 20% ABV.

Part 2: Reduction

Now it is time to use a distillation unit to reduce this mash into high-strength ethanol. Typically ethanol needs to be >90% ABV in order to burn in a car engine, as too much water in the mix can oxidize and cause engine trouble. 95% ABV is ideal.

Start by transferring the mash into a large cooking pot which forms the boiler for the distillation unit.

Clamp the lid onto the pot. Make sure that no vapor can escape.

Now attach the distillation column and hose onto the boiler.

Fill the condenser with ice and water such that it creates a cold pressure zone at the top of the column. This cold zone will push water vapor back down, such that we can extract almost pure ethanol in a single pass.

Now that the unit is set up and ready to go, fire up the stove! It will take some time for the mash to heat up to the desired temperature, but you will soon see distillate coming out the bottom of the worm tube.

The first 50 mL or so will contain highly toxic impurities (principally methanol) which very poisonous and also a poor fuel to burn in your vehicle engine. Best to pour this all away so that we are only burning pure fuel-grade ethanol.

Once you’ve poured away the methanol, start capturing fuel!

This particular batch yielded ~1.5L of 184-proof ethanol, which is pure enough to burn in a vehicle engine when blended with gasoline.

At some point here it will probably occur to you that you just spent ~$10 on groceries, several hundred dollars on equipment, one hour preparing the mash and another six hours running the distillation process. All this to produce one litre of fuel, which at current (October 2011) gas prices costs roughly $1.30 at the pump.

It may occur to you that you can obtain far better value from this fuel by simply consuming it and saving $60 on your next trip to the LCBO. Be advised that consumption of homemade spirits — however amazingly badass — is illegal and may potentially cause blindness or death due to methanol poisoning. If you decide to follow these instructions for purposes of moonshine consumption, you do so at your own risk. Note that you can greatly reduce this risk by ordering your equipment locally and shipping Canada Post (no couriers), keep a fire extinguisher nearby and be ruthless in pouring off those 50 mLs.

Posted in Homebrew | 5 Responses

Booze Hacking: Three Fun and Easy Processes for Homemade Hooch

Back in November 2010, I made a presentation at Nerd Nite Toronto on alcohol fermentation and I demonstrated three fun and simple processes for brewing a 7% homemade apple cider. Almost a year later, I’m returning to Nerd Nite — this time to demonstrate how to process your homemade hooch into fuel for your car. The presentation is at 8 PM on September 8, 2011 (sorry for the short notice!) at the Tranzac Club, 292 Brunswick Ave, in downtown Toronto.

I figured this would be an appropriate time to write up a blog entry for Booze Hacking and shed some light onto the magic of alcohol fermentation.


Humans were brewing booze before we had writing or agriculture. Alcohol fermentation is a fundamental process that occurs in nature and can be easily reproduced — a chemical conversion of sugars (carbohydrates) interacting with yeast to produce ethanol (ethyl alcohol) and carbon dioxide. Early humans used to party by eating rotten fruit and getting drunk off the fermenting juices. As agriculture and food production have evolved over the last 10,000 years, we’ve developed much more controlled, sophisticated and delicious ways to produce hoochy beverages.

Alcohol also occurs naturally in space. I can’t make this stuff up!


Let’s make some booze! You don’t need a large industrial operation to brew alcohol — you can very easily ferment President’s Choice apple juice in your kitchen. For this experiment, I’m going to purchase three bottles of low grade Loblaws juice and show three simple ways to ferment them into a boozy, delicious cider.

  • Process #1 uses standard brewing equipment that I obtained at a homebrew supply store. It’s very simple but does require some extra legwork to get the specialty equipment.
  • Process #2 uses only common groceries available at Loblaws.
  • Process #3 ferments apple juice only by exposing it to wild yeast in the air.

Process 1: Standard Process

This process starts with a quick trip to your local homebrew supply store to obtain a few basic bits of equipment and brewing yeast (Torontoians can find everything at Macedo). You’ll also need a 2L jug of grocery store juice.

Here’s what you’ll need:

  • 1 gallon (3.78L) glass jug
  • Airlock
  • Lalvin EC-1118 yeast
  • 2L President’s Choice apple juice
  • Hydrometer (not strictly necessary but allows you the measure alcohol content

The process is fairly simple. Start by sanitizing the gallon jug with a bleach solution, then clean it out thoroughly with hot water. Once the jug is clean, pour in the apple juice. Make sure the juice is roughly room temperature, then pitch the yeast. Seal with jug with the airlock and wait for the show to start.

Within a few hours of pitching the yeast you should notice some activity within the bottle. This will get quite violent after a day, and then within 3-4 days should calm down completely. All done! Your cider is ready to drink.

Process 2: Loblaws Process

This technique builds on the things we learned in Process 1, but simplifies things to point where we can make cider with only Loblaws groceries. Instead of using brewing-specific yeast, we’ll just use basic bread yeast.

Here’s what you’ll need:

  • Fleischmann’s Active Dry bread yeast
  • 2L President’s Choice apple juice

This process is even simpler: add 1 tsp of bread yeast to bottle of apple juice, then seal the bottle tightly. Within a few hours you’ll notice activity, and within 12-24 hours the plastic bottle will expand considerably as it gets pressurized with carbon dioxide gas.

Every 4-6 hours you’ll need to “burp” the bottle — remove the cap and let all the carbon gas escape. If you don’t do this you risk the bottle exploding. Another option is leave the bottle cap slightly loose, so that carbon gas is able to escape during fermentation.

Within 3-4 days you’ll notice the fermentation will calm down completely. At this point it’s finished and ready to drink!

Process 3: Wild Yeast Process

The air around us is full of wild yeast. This is much less powerful than brewing or bread yeast, but on a hot summer day, it’s enough to kick off fermentation. Ever forgot to put a bottle of fruit juice back into the fridge, only to find it bubbling away several days later?

Here’s what you’ll need:

  • 2L President’s Choice apple juice

This process is the easiest — just open the bottle, expose it to the open air, and then seal it tightly. Shake it vigorously. Let it sit. Within 2-3 days, fermentation will kick off, and 3-4 days after that it should calm down.

It’s important to note this process only really works in the summer heat. Wild airborne yeast is much more sensitive to temperature than store-bought yeast. You should aim for a week of 25C+ weather for optimum results. Alternatively, fermenting it next to a furnace usually works too.


Within one week, all three bottles had fermented completely and stopped bubbling. Every day during the fermentation process I measured the specific gravity of each bottle, and hence stipulated the alcohol content. Results as shown below:

As you can see, the processes that used proper yeast kicked off right away and completed within 3 days. The wild yeast process was slower to start and a bit more erratic, but within seven days it had also fermented into a delicious 7.1% cider.

So you’re probably wondering, how did it taste? Let me tell you — each bottle tasted DELICIOUS. #3 was my personal favourite. Unfortunately however I can’t post free drinks on my website, so you’ll just have to try this for yourself to find out!

Posted in Homebrew | 3 Responses

Homemade Biodiesel

Sorry for another long brutal delay in posting here! I’ve been up to no good, although my recent projects have not been technically legal (thanks to some antiquated Prohibition-era bylaws) so I’m a little thin for content.

Back in December I met up with my friend Lee for an experiment in homemade biodiesel production. I never got around to posting about this so here is my photoblog of the process.

Biodiesel is a vegetable oil based diesel fuel that can typically run in an vehicle with a diesel engine. It can be mixed 50/50 with petrodiesel (B50) and run in any vehicle without modifications, or you can run it straight (B100) with simple mods. Biodiesel can be produced from a variety of waste oils and is becoming increasingly mainstream and petro-fuel gets more and more expensive.

Old ceiling fan motor that I bought at Active Surplus for $12. This will become the processor for the fuel mix.

This is all the gear used in this project. Unico vegetable oil, methanol, potassium hydroxide, ~3L glass vase, 600 mL beaker, 1L mason jar, 250 mL measuring cup, digital scale accurate to 0.01g, thermometer ranged -10C to +200C, motor processor.

Obviously you can use waste vegetable oil to make biodiesel, but this adds some complications to the process. For our first attempt I wanted to keep things simple. Store bought oil is clean and has no water content.

Two sketchy chemicals! 99.9% methanol (available at Canadian Tire) and 99% pure KOH potassium hydroxide (available online at Both are highly toxic. The former will cause optic nerve damage and make you blind. Be careful

This is our biodiesel processor rig. Cleaning it under hot water here. We need to maintain a temperature of 55C as we’re mixing the fuel; easiest way to do this is mix it in a stockpot on the stove.

Hockey pucks at the bottom of the stock pot, which shield the glass vase from heat blast from the stove burners.

Safety first! Wear a lab coat, eye protection and rubber gloves. Designate all containers that come into contact with KOH or methanol (we used a biohazard sticker) and never use them for food products again.

Measure 200 mL methanol in beaker. Transfer this to 1L mason jar.

Based on 99% purity (or so we’re told) measure out 4.91 g of KOH potassium hydroxide. In hindsight we should’ve been a series of titration tests to determine the exact mass of KOH needed. Also I’m not convinced it was 99% pure.

4.90g, close enough!

You could pay $300 for a professional lab scale… or you could pay $30 for a drug dealer scale. Try to get one accurate to 0.01g.

Add the KOH into the masor jar with the methanol. I used the cutting board here to shield myself from possible explosions, but sadly it was pretty boring.

Seal the mason jar tightly. Then shake it a bunch and let it rest 10-20 minutes. Wait until all the KOH dissolves. This creates a new solution called methoxide.

Measure out 1L of vegetable oil.

Pour vegetable oil into a pot and heat it to 55C.

Mix the 55C oil and the methoxide.

Lee is rigging up the motor to the top of the vase.

This is the biodiesel processor. We used chopsticks as the support system for the motor (it’s ghetto but it works). Hockey pucks to shield the vase from the flame. Kept the water heated at 55C to maintain temperature in the vase.

Hockey tape is perfect for securing the chopstick supports. Secure the supports together, then seal them to the vase.

Firing up the motor.

Motor running.

Trying to maintain 55C in the water. Obviously this is difficult but I figure it’s close enough.

Just a few minutes after we started. The mix is still very cloudy.

Still cloudy after about 20 minutes.

After 30-40 minutes the mixture started clearing.

More clearing.

After 1 hour it was mostly translucent.

This is the final mix after coming out of the processor. Let it sit overnight.

After waiting a while a red layer of glycerin formed at the bottom. This means it worked!

We ran some quality tests later which showed the fuel is pretty poor quality, and probably would not burn in a motor. Not surprising for a first attempt. There are several ways we could improve this process, most notably:

  • Build a closed processor unit that is not exposed to open air.
  • Titration tests on the oil to determine proper amount of KOH needed.
  • Make sure we know exact purity of KOH.
  • Better system to maintain 55C temperature in processor.

Moreover I need a vehicle or some sort of engine to actually use the fuel in. Once I have such a vehicle I will look into ways of improving this process, and will post whatever I come up with here.

Posted in Homebrew | 1 Response

Scalable backup solutions with Rackspace Cloud Files

It’s been a while since I’ve blogged about code as recently I’ve been learning the joys of running a business. However, I recently had to come up with a backup solution for all our code. This turned into quite a project and I’m really happy with the result!


I don’t like doing backups but obviously you gotta have them! My tech company Built By Giants has several gigs of code and several MySQL and MSSQL databases on different Rackspace Cloud servers. We need to keep this stuff backed up.

In particular we need a backup solution that is:

  • Painless
  • Infinitely scalable
  • Unix + Windows
  • Affordable
  • No physical media
  • On-demand access to files
  • Can be rescheduled at lower frequencies once a project moves from development to support + maintenance
  • Painless!!!


Our codebase is running off SVN (this solution could be easily modified for Git or Mercurial). The server is a Fedora based cloud server. We need to backup several different repositories, at different schedule intervals.

I chose Rackspace Cloud Files for online storage. Amazon S3 actually seems like a better service, however we’re already on Rackspace Cloud and Files still suits our purposes brilliantly. At $0.15/Gb/month you can’t go wrong for the price!

To back up a repository, we first need to export the whole codebase (including revision history) into a dump file. Then we need to push this file up to Cloud Files. (incremental backups would be far more efficient but I haven’t come up with a solution for this, yet…)

Backing up MySQL or MSSQL is pretty much the same thing. Dump the database, then push to Cloud Files.


Our SVN codebase is running on Unix so we’ll use cron for the scheduling.

We’ll write a simple bash script to export the SVN repository to a dump file.

We also need a method to push the dump file to Rackspace Cloud Files. There is already a good solution online for pushing files with Duplicity however I just want to push the raw files. Fortunately Rackspace Cloud Files provides APIs so I’ll write a simple python script for this.

SVN Backup

Let’s get started! First, install the Cloud Files Python API.

git clone
cd python-cloudfiles
python install

Create the backup script. I usually place this file in my /etc/cron.daily folder for daily backups. Make a different backup script for each repo. Let’s say we’re working with a repo called “myproject”:



# Script Variables
export DATE=$(date "+%Y%m%d")
export SVNREPO='myproject'

# Create temp folder for dump files
mkdir /backup
cd /backup
mkdir ${SVNREPO}

# Dump SVN repo
svnadmin dump /var/www/svn/${SVNREPO} > /backup/${SVNREPO}/${SVNREPO}_${DATE}.dump

# Now call python script to upload to Cloud Files
/backup/ --path=/backup/${SVNREPO}/ --file=${SVNREPO}_${DATE}.dump

# Finally delete the old file
rm -rf /backup/${SVNREPO}/${SVNREPO}_${DATE}.dump

Now, create the python script that handles the file upload.



import cloudfiles
import sys

# Connection variables

rsc_username = '' # your rackspace cloud username
rsc_apikey = '' # your rackspace cloud password
rsc_container = '' # your rackspace cloud files container

# Get filename

for arg in sys.argv:
	if(arg.find('--file') != -1):
		filename = arg[7:]
	if(arg.find('--path') != -1):
		path = arg[7:]

# Open Rackspace Cloud connection and access the container

conn = cloudfiles.get_connection(rsc_username, rsc_apikey)
cont = conn.get_container(rsc_container)

# Upload the file

obj  = cont.create_object(filename)
obj.load_from_filename(path + filename)
print "File Uploaded!"
if cont.is_public == False:

And of course, set permissions on both these files to full executable:

chmod 777 /etc/cron.daily/ /backup/

MySQL Backup

Now we need to export and backup our MySQL databases. Fortunately this is very similar to the process above, except that we need a new cron script.

I’ll make a new cron script for each MySQL database backup. That way we can schedule each one differently. Following the above example, let’s say we’re working with the ‘myproject’ database:



# Script variables
export DATE=$(date "+%Y%m%d")
export MYSQLDB='myproject'
export MYSQLUSER='your mysql user goes here'
export MYSQLPASS='your mysql pass goes here'

# Create temp folder for dump files
mkdir /backup
cd /backup
mkdir ${MYSQLDB}

# Export MySQL database
mysqldump --user=${MYSQLUSER} --password=${MYSQLPASS} ${MYSQLDB} > /backup/${MYSQLDB}/${MYSQLDB}_${DATE}.sql

# Now call python script to upload to Cloud Files
/backup/ --path=/backup/${MYSQLDB}/ --file=${MYSQLDB}_${DATE}.sql

# Finally delete the dump file
rm -rf /backup/${MYSQLDB}/${MYSQLDB}_${DATE}.sql

That’s all folks!

This solution isn’t perfect for everyone, but I’m hoping you can use it as a starting point. It should be fairly simple to tinker with these scripts to customize them to your needs.

I still need to include Powershell scripts for pushing MSSQL backups. This is an entirely different can of worms and I’ll add these scripts later.

If you can suggest any ways to improve this process (ie. incremental backups) please leave comments below!

Posted in Code | Leave a comment

Defeating potassium sorbate, pt 1

It’s fall season here in Toronto and grocery stores are carrying delicious, high grade apple cider that is seasonally pressed at local Ontario farms. I wait every year for the stuff and this time I was determined to brew some delicious hard cider.

So I was extremely distraught to find out they use my nemisis, potassium sorbate, to keep the stuff fresh.

Potassium sorbate is yeast killer. It stops fermentation dead in its tracks. It is a most powerful foe. There’s no way you can ferment around it.

Or is there?

After reading around online I came up with two possible approaches to defeating potassium sorbate (and similarly, sorbic acid). Both approaches are only proof of concept and my experiments are not scientific, however this is a good starting point to figure out which process I want to explore further.

Approach #1 was to overcome the potassium sorbate by bombing it with yeast. I poured one gallon of apple cider into an airlocked jug. Every eight hours I added 1 tsp of bread yeast (Lalvin 1118 too expensive, and unnecessary) over the course of two days, for a total six different doses of yeast.

The first three or four doses of yeast did nothing. The cider absorbed them completely. The last two doses, however, did kick off a gentle fermentation. Over the course of one week I observed a decrease in specific gravity from 1.050 to roughly 1.025. So conceptually this approach could work although it would require more yeast.

This is however a significant problem. There’s already 30g of yeast floating around in one gallon of cider, the liquid is cloudy, distinctly yellow and tastes horribly of yeast. Ultimately I wasn’t even able to drink through a small glass of the stuff. So I will consider this approach not useable.

Approach #2 was to kick off fermentation in a starter solution that does not contain any potassium sorbate, then add this to the main batch once the yeast is highly active. This was a technique I read about on fermentarium in a wonderful article titled Everything You Know About Potassium Sorbate Is Wrong. I decided to attempt this myself, with modifications.

First thing I tried was to ferment the batch with sediment from a previous batch of apple cider. Usually this works just fine. In this case, no dice. The potassium sorbate swallowed the sediment and killed it instantly.

So next I tried a process similar to the article. In a separate container, I pitched 5g of bread yeast into 250 mL of cheap apple juice. I waited 12 hours until the fermentation kicked into high gear. Then I poured this solution back into the main batch of cider.

This was enough to kick off a gentle, but consistent fermentation. Within four days the specific gravity had dropped from 1.050 to 1.030, which is not as fast as I’d like but still fast enough.

The next step in this project is to run a different experiment, with more controlled variables, to measure the effect of starter time, temperature and yeast concentration. I’d like to see if doubling the yeast dosage + allowing the starter 24 hours to kick off will result in stronger fermentation. More soon!

Posted in Homebrew | 4 Responses


In tribute to my favourite supervillain of all time I set out to brew a mighty batch of booze. MEADBEERWINE is the terrifying frankenbrau that resulted: one half mead, one half beer, and one half wine.

In order to achieve a five gallon batch of this stuff I obtained enough honey to produce a half-batch of mead, enough malt extract for a half-batch of beer, and enough grape juice for a half-batch of wine. I had no idea how the stuff would taste, so I used milder ingredients (white wine, pilsner beer extract) to keep the flavour mellow. I was also worried this would turn out disgustingly sweet, so on Mandy’s recommendation I added in a gallon of cranberry juice.

MEADBEERWINE (recipe for 18.9L batch):

  • 9.45L Macedo Winemaking Palomino grape juice (available at Macedo Wine Grape Juice, 30 Ossington Ave, Toronto, Canada)
  • 3 Kg Meadowview Canada #1 Golden honey
  • 1.7 Kg can Morgan’s Canadian Pilsnermalt extract
  • 3.78L President’s Choice Cranberry juice
  • Distilled water to fill the batch
  • Danstar Nottingham yeast

Starting gravity: 1.105

I had no idea how violently this would ferment so I did the primary in a wine bucket — in fact I fermented it in the same bucket provided by Macedo. The 5 US Gal. bucket was completely full however, so I started the process by siphoning half the grape juice out into another carboy.

In hindsight I wish I hadn’t chosen Palomino grapes. I didn’t do my homework and didn’t realize these were generally used for low-grade wine and sherry… wish I’d spent a few extra bucks on Cab Sauvignon or Chardonnay grapes. It’s a lesson learned but at least wine won’t be the dominant flavour in this.

Next I brought a couple litres of water to a boil on the stovetop. Once it started bubbling I turned off the heat, then poured in the bucket of honey. You can probably get away without boiling the water but this helps dissolve the honey into the mix a little better. No need to continue boiling once the honey has been added.

Next I added the beer extract. This was pretty easy, just open the can and dump it in. In my kettle I brought a couple more litres to a boil, and I used this to gather leftover honey and beer extract at the bottom of the containers. Once I’d soaked up most of the residual I poured this into the stovetop mix.

From this point on it was all pretty easy. I dumped the stovetop mix into the bucket which contained the 2.5 US Gal of white wine. Added the gallon of cranberry juice. There was still room in the bucket so I poured a some water in too. Once the stuff had cooled sufficiently I pitched the yeast. I used Danstar Nottingham yeast which I’m using increasingly in wines and meads… it has high alcohol tolerance and a nice crisp flavour which works great in winey beverages.

I was expecting an explosive fermentation but it ended up being rather tame — I also fermented the other half of the grape juice in a separate carboy and this burned slowly too. Apparently the Palomino grape juice is a slow starter. Nonetheless it moved consistently and within two weeks a large amount of sediment was visible at the bottom, so I transfered it to a carboy. The specific gravity was now about 1.020. The must tasted like part mead, part beer and part wine. I’ll bottle it in another month or so.

I have no idea what to expect from the final product. Do you drink it chilled or at room temperature? Do you sip it from wine glasses or swig it by the pint? Final ABV should be somewhere around 14-15% so this is definitely a beverage to celebrate glorious victory on the battlefields. I’ll post updates once it’s finished!

Posted in Homebrew | 1 Response

DIY Cockroach Control

It’s been a long time since my last post but with damn good reason. I’ve spent the last two months on the greatest DIY experiment of my life — eliminating nature’s most resilient critter from my living space.

I live in a row house attached to Bloor Street in downtown Toronto. My home is directly connected to a variety of Korean restaurants, fruit markets and other residences. The building is probably a hundred years old, the plumbing is ancient, there are tons of holes, cracks, gaps in the wall and shoddy renovation work. Basically this place is a bug’s wet dream. The first roach showed up sometime in April 2010 and quickly invited all its friends.

My goal was to remove the little bastards from my apartment. Given the complexity of this experiment I decided to apply standard scientific method.


The roaches likely originated from the restaurants along Bloor Street; it’s equally possible one of my neighbours brought them in. Either way these old row buildings make it easy for bugs to spread, and they’ve likely covered the entire block by now.

As such, traditional roach control methods (traps, poisons) will likely have no effect. I can probably take out a few, but if they’ve taken over all the other buildings then there are far more bugs than I can possibly control. Moreover modern roaches are increasingly resistant to poisons.


  • Eliminating the entire bug population is probably not realistic.
  • Roaches do not strictly live in your apartment — they live in the walls.
  • Roaches are governed by the laws of physics and thermodynamics: they cannot teleport or pass through solid objects.
  • Instead of killing them, I will simply barricade them out of my home.

I was inspired by an excellent article I found online: How to Get Rid of Roaches by Caulking. I decided to apply the same strategy.


When the roaches first showed up, I performed some quick tests to see if they’d have any effect.

Several people suggested using diatomaceous earth to kill them off. I laid the stuff down everywhere but to no effect. No surprise… if the bugs are spawning from my walls, then killing a few odd specimens won’t matter.

I laid down a variety of traps, mainly glue pads. In nearly three months the glue pads trapped two bugs. I’ve actually watched the bugs dodge around these traps while fleeing my wrath.

I also tried leaving roach snacks: a mixture of Borax (boric acid), sugar and cocoa. They ignored these completely.

Clearly population reduction methods were ineffective. So I decided my best approach was to determine the bugs’ access point(s) to my apartment, then cut them off at the source.

Data Mining

Thus began a six week period of data gathering: observing the roaches, tracking their movements, noting areas of high concentration and trying to determine their point(s) of entry.

My particular flavour of bug was the Oriental Cockroach. They’re bigger bugs (~3 cm), very fast runners but not good climbers. They were not able to access high places like cupboards or shelves — once I caught one in my cutlery drawer, but otherwise they were all bound to the floor. They only came out at night and preferred dark areas, but did not run away from light either. When I wasn’t chasing them, they hung around in the same place and didn’t move much.

First priority was to determine where they were getting into the apartment. It was important to observe the bugs as quickly as possible after they got in. To accomplish this I waited around at night, turned down my lights, then every 30-45 minutes performed “sweeps” of the apartment. This way I was able to catch them at relative proximity to their points of entry.

For example, let’s say I check my bathroom at 12:30 AM and there are no bugs. Then I check the bathroom again at 1:00 AM and this time I spot one. Clearly there is a strong possibility the bug came through an access point in the bathroom. But maybe it came in through the kitchen and traveled to the bathroom? This is why I checked so frequently. I’d spent lots of time stalking the little bastards, and they didn’t travel too quickly — it’s unlikely one would move that far in thirty minutes. After catching several roaches in my bathroom at short time intervals, it’s reasonable to deduce there is a bug run here.

Obviously this method is not perfect and there are anomalies. But after several weeks of observation, several distinct trends emerged.

I noted a particularly high concentration in my kitchen: in and around the cupboards at the base of my sink, under/behind the fridge, under the oven and in the pantry. A few bugs in my bathroom. On rare occasions I’d find a bug in my bedroom. However the vast majority were in the kitchen, around the sink and fridge.

Last important point in data gathering: DO NOT KILL THE ROACHES. Dead roaches tell no tales. Unfortunately the live ones cannot be tortured for information… so instead I took a hockey stick and poked the bugs, forcing them to run back from whence they came. Many ran behind the fridge. Some ran under the oven. One ran into a hole in the wall under my kitchen sink (big mistake asshole!!!). Often they just ran around aimlessly in circles, fleeing for dear life.


This was some excellent data… now it was time to get to business. I made a trip to Home Hardware and bought a couple cans of expanding foam sealant. I already had lots of duct tape, diatomaceous earth and steel wool.

I then spent most of a three day weekend scientifically sealing up every crack, gap, and hole in the walls/cupboards/floors/baseboards of my kitchen. Naturally I paid special attention to the high-concentration areas. There were several cracks and holes in the cupboards beneath my sink (including the hole i chased a bug into). There were four significant holes at the base of the wall behind my fridge — this was a clear bug run. I blasted all these holes with foam sealant. My pantry was sealed up pretty tight but I plugged whatever gaps I could find anyway.

Basically I sealed up every hole I could stick a fingernail into, regardless if it was big enough to accommodate a roach. In fact, I sealed everywhere I even THOUGHT there was a gap. In the tight spots where I couldn’t see (like behind the radiator) I bombed the area with foam sealant anyway.

There were some gaps that were too big to seal with foam, especially around the plumbing — in these cases I stuffed the gaps with steel wool, then hit them with some foam for good measure. The walls behind my radiators were in poor shape, and these were nearly impossible to access. I taped over these sections of wall with duct tape.

Next I moved to the bathroom and sealed up gaps with the same degree of scientific precision. There were a few large gaps around the plumbing and under the sink, also behind the toilet. I even sealed a few gaps between the floorboards. I wanted to have absolutely no doubt there wasn’t even the slightest possibility of a bug getting through. After all given how fast cockroaches spread in these buildings, heaven forbid my neighbors ever get bedbugs…

Finally it was reasonable to assume that even if I’d stopped more bugs from getting into my apartment, there were still a few lingering about. So I bombed the critical areas with diatomaceous earth and Borax. From this point on it was a war of attrition — I would wear down and eliminate the survivors, then if they ever found a new way in, I would repeat this process until they were all gone.


Once I’d sealed off my kitchen and bathroom there was an instant, dramatic effect on the bug population. I didn’t spot a roach for several days. Obviously there were still a few kicking around, but when I found them they were in distant, unusual corners of my apartment and seemed really disoriented. One roach had been hiding under a tank of homemade liquor and was drunk as shit when I found it… I tried chasing it back to its source, but it just drunkenly stumbled around in circles until I got bored and killed it.

In the 2-3 weeks following my sealing bender, the number dropped off almost to zero.

Since June 22 (over four weeks ago!) I’ve seen one adult roach. It was slow and confused and had probably been hiding away for some time. I’ve also seen two baby roaches, who were probably small enough to crawl through some tiny access point I missed. If these visits continue then I’ll stalk them and cut them off, but they haven’t been frequent enough to worry about.


Needless to say this building is still crawling with bugs. I expect there are more access points in my apartment, and I expect to see more roaches in the future. If and when this happens I will apply the same method to push them out.

For the time being, I’m feeling pretty satisfied. It was a cheap and simple solution that only involved a lot of time and patience. I don’t think an exterminator would work here, and I love my apartment too much to move out. So I’m really glad I have it all to myself again!

Posted in DIY | 3 Responses

Apple Mead

I swear at some point soon I’ll get back to blogging about code and computer programming! At the moment however I’m still finalizing some contracts, so I’ve been killing time by running more crazy homebrew experiments in my kitchen.

Fiesta Farms has a sale on gallon jugs of 100% pure apple cider, with zero additives or preservatives. I bought two of these (largely for the jugs themselves) but decided I had to do something interesting with the cider. It measured an initial gravity of 1.050 so I briefly considered making a simple alcoholic cider, but then got a much better idea…

I remembered reading the Washington Winemaker recipe for Apple Wine who used honey to push the specific gravity up to a wine level. Instead of making a wine, I wanted to add a bunch of water and honey and make a full apple mead.

APPLE MEAD (recipe for 18.9L batch):

The brew process was pretty simple — just a matter of combining all the above ingredients into a carboy. I started by pouring the apple cider directly into the carboy. Next I dumped all the honey into a pot with some water, and heated it up until the honey thinned out a bit… then added it to the carboy. Added the yeast nutrient, then shook up the carboy a bunch to make sure everything was mixed up nicely.

The mix was conveniently just about the right temperature, so I pitched the yeast and it came to life barely an hour later.

One very unusual thing was that I couldn’t get a proper gravity reading. My hydrometer measured somewhere around 1.035 which is far lower than it should have been. I was targeting a starting gravity of 1.100, so unless I got duped with bogus honey, I’ll just assume this is the real starting gravity.

It’ll be winter before this stuff is ready, so I’ll post an update once I’ve had a chance to taste it!

Posted in Homebrew | Leave a comment

Black Cherry Wine

My local supermarket, Fiesta Farms, specializes in organic and natural food and they often have good deals on high grade fruit juice. One day I stumbled on an amazing sale for pure black cherry juice ($2.99/L!) and I couldn’t pass it up…

I’ve never made wine from cherry juice before so I wasn’t sure how to approach this. Most online recipes suggest watering down the juice and then adding sugar — but I wanted to try fermenting the juice straight up. I bought one bottle and measured the original gravity at 1.084, which was basically enough to brew without additional sugar. The juice was extremely thick and sweet and I considered watering it down for a smoother flavour… in the end however I just fermented the juice in its original state.

BLACK CHERRY WINE (recipe for 18.9L batch):

Starting gravity: 1.102

The process for this wine is extremely simple. Basically, dump all the cherry juice into your primary fermenter. On your stove, bring a small amount of water to a boil and dissolve the sugar to it. Dump the sugar water into your fermenter along with the cherry juice. Activate the yeast in a small cup with warm water and the yeast nutrient. Let this cool until it’s roughly the same temperature as the juice in your fermenter, then dump it in.

I made the grievous mistake of using a carboy for my primary fermenter. some fruit wines don’t ferment that quickly so the carboy is fine… in this case however, five gallons of thicky sugary cherry juice practically exploded with fermenting bubbly goodness. Less than a day after starting I dumped the batch into a wine bucket, which did only a slightly better job of containing the erupting mass of soon-to-be delicious booze.

A week later I siphoned this back into a carboy. There was an enormous layer of sediment in the bucket — I siphoned part of this, but there was so damn much I just dumped a lot of it. Back in the 18.9L carboy, there was a bit of extra room at the top, so I grabbed a couple more jars of juice and filled it right up.

Within two weeks the gravity had dropped dramatically, right down to 1.012. I don’t really know how to approach this since most cherry wine recipes do not call for pure juice. So I’ll take a similar approach to previous homemade wine… one month in primary, 1-2 months in secondary and then 3+ months in bottles.

In hindsight there are many things I’d change with this recipe. The original cherry juice was thick, heavy and disgustingly sweet — I can only assume the final product will be the same. Next time I’ll water it down and make up the difference with sugar. Also the back-and-forth between carboy and bucket can’t have been good. Racking it after a week might not have been the best. Regardless the final product will likely be a 14% fruit wine that I can water down into a cooler-style beverage. Just wait for the 2011 edition!

Posted in Homebrew | 2 Responses