Quiet for a while

I've not kept up with the idea of posting twice each month, and as much as I would like to say that's because I've been too busy to write it would be more accurate to say that I've been too busy to pursue interesting projects on which I could write. I've mostly been readjusting to life back in Tucson after a summer away and settling back into old routines. I did take the time to make a 2.5 lb batch of jerky which received positive reviews, the recipe can was found here and only the amount of liquid smoke was altered (1 cup sounded insane, used 1/8th instead). I'm going to make a renewed effort to update this blog as projects come along.

Seeking organization

Since about January I've been moving between several methods of keeping track of everything I need to do. First I tried Google Tasks (through Gmail) but found it was difficult to remember to use it, though it was easy to add/edit task while away from my desk. Next I tried a more basic approach, use Tomboy Notes on Ubuntu, which stores and syncs your notes as well as supporting cross-references within notes. I held onto this for about a month, and I ended up with a decent body of information spread across many notes.

The solution I settled on recently has been much simpler than all that. I noticed in my notes (and previously tasks) that they were bunched into several categories (e.g. Work, Health, Hobbies, etc), and while I could group the notes into folders, but further than that I had my work notes in a separate lab notebook file, and all my fitness data in a physical notebook (that had been replaced a few times due to loss). I decided to use a single file and journal each day, with areas broken down as paragraphs. The only thing that makes this useful though is having specific information presented always with consistent formatting, making regular expressions an easy way to scrape data from it.

As each day starts with how much I slept, and ends with a few data regarding food intake and such, it's trivially easy to parse any given set of days into graphical format.

Parsed nutrition data. Note the so-called "Calzone Peak".
Parsed nutrition data. Note the so-called "Calzone Peak". I know that  I'm under my required calories; it's only for the short term. 
Parsed sleep data, with obvious jetlag.
Parsed sleep data, with obvious jetlag.

While the system isn't perfect, it does make it easier to review my days and orient myself on a local time line. This is especially valuable when work seems to make all the days blur together save for the weekend. I've noticed even just re-reading the entry for a single day before bed reminds me how long a day actually is.

I'll likely have to split each month into its own file to prevent compilation time from growing too long, but tweaking the code to parse multiple tex files is easy enough. I'll stick with this system until something else comes along, and post updates if it continues to prove useful. If anyone would like the scraping code, just ask in the comments; though writing it is good regex practice.

How do I get home? Reliably getting the external IP in python

I recently had some help setting up an IP camera in my apartment from some friends and we collectively discovered that DynDNS's static IP service was no longer free. As a cheap student, that was terrible news. Once everything was set up (some port forwarding and a free version install of VitaminD) I went ahead and got down to writing up a barebones python script that would make sure I never lost track of the camera while away. The first step was figuring out what my external IP was at any time, which proved to be a little more roundabout than I'd hoped. Services like whatismyip.org tend to either reject bots or present the result as an image, ostensibly because they don't want to become an API for the exact task I had in mind. It hit me that I have a remote host that can identify a client, this site. So I whipped up a very simple one-line PHP file:

<?PHP print $_SERVER['REMOTE_ADDR'] ; ?>

I tossed this on my server and had python grab it. Sure enough, it contained exactly my external IP address. The next step was to get that information back out to myself. I would say this is where it gets hackity, but I'm 90% sure there's a much better way to do the above as well. I had python build an html file with a redirect and push it up via FTP. The code then checks the external IP once an hour, if it changes it updates the redirect page. I'll stop shy of pointing out where I've stored the files, but the camera itself is password protected.

This was a very short term fix, as I've got a trip in the very near future

Stained Glass: First Attempt

On a recent visit to Berkeley I was given the chance to take a stab at assembling a stained glass piece. To be clear, I wasn't staining/coloring the glass myself, though I have done that back when I had access to the materials science glass blowing shop. The first step was to choose a design, and given my background I chose a rather suspect flower. Next the glass was picked out at a local stained glass craft shop near the bay; a bright blue, a purple, a green, and a reddish-purple provided all the colors I'd need. All said and done, about $20 worth of glass. Next we printed the design and outlined and numbered the obvious segments, and with a pair of three-bladed scissors (designed to remove a narrow strip of paper from between the segments to allow for solder and copper tape) cut out all the segments.

The edge has been trimmed off, the segments outlined and numbered.
The edge has been trimmed off, the segments outlined and numbered.

 

The resulting pile of segments.
The resulting pile of segments.

The next step was to take each segment, keeping track of the color it was supposed to be, and gluing it down to the appropriate glass using an middle-school style glue stick. Each bit of glass was then broken out into the approximate shape of the segment using a glass scorer and pliers. Then came the grinding. The grinder sported a metal grinding post with a constant feed of water to keep the dust and heat down, and proved to be the most fun part of the entire process as there was little to no risk of breaking the pieces. After each piece had been ground to a more-or-less perfect shape, the segments were re-assembled into the original shape to check their fit. A few places had to be re-ground, but overall it came together nicely.

All the ground segments fit together.
All the ground segments fit together.

Now that we were convinced that the pieces all fit well, we were able to wash away the paper and finally see the design in the colors we picked out earlier in the day. The challenge here was to keep everything in order, as the pieces now had no identifying features and could easily be confused for similarly shaped pieces.

The shards were then washed, removing the now mushy paper and glue.
The shards were then washed, removing the now mushy paper and glue.

A bit of materials science wisdom comes into play here. Glass and metal rarely play well together, and soda-lime glass and solder are no exception. In order to get the solder to effectively glue the segments together an intermediate metal has to be applied to the edges of the segments. Copper tape, being a strip of copper with adhesive on one side, serves this purpose beautifully. Each piece of glass had a stripe of tape straddling it's edge such that the edge and a few millimeters on both sides were covered. You'll notice in the photo below that two of the petals on the left had to be broken into two parts as they broke during cutting, but the visual impact of this is quite minimal. I attribute this to my poor choice of shapes during the initial drawing process, as I didn't think about how easily the shapes could be realized.

Glass shards with copper tape applied.
Glass shards with copper tape applied, laid over the original image.

With everything taped, the remaining steps were to solder the pieces together, patina the solder to a darker color, and protect the whole thing with wax. Having soldered before this was an easy process, the only non-intuitive part of which was tapping. Tapping refers to dropping little blobs of solder around at key points to lock the pieces in a single orientation before trying to fill the gaps in a continuous manner.

The soldered pieces
The soldered pieces

A quick rinse with flux remover left the surface clean. The patina, with plenty of labels reminding us that it is very toxic, was quick acting and gave the solder a nice pewter look. Lastly the liquid wax was rubbed onto both sides, and the whole thing was washed in soap and water to remove any excess flux, patina, and wax to make it safe the handle.

An early flight left me without a good source of packing materials the morning I flew back to Tucson, so I trusted that my portfolio was sturdy enough to protect the piece for a few hours. When I got home I discovered that it apparently wasn't good enough; several cracks had formed in the central pieces. They were not enough to compromise the piece, and it should hold together for some time while looking awesome in my window.

 

The finished piece in the sun.
The finished piece in the sun.

 

Results of Coffee Experiments

I wanted to follow up on the previous post before the end of the month, so I went ahead and ran the extractions yesterday evening. The results were just about what one would expect, with one difference: agitation did not have an appreciable effect on caffeine extraction. An additional concern was the efficiency of the extraction, so I added an additional sample to as a pseudo-standard, namely standard brewed coffee from the office Mr.Coffee machine. With this I was able to determine that the extraction was roughly 33% complete, but there is some margin of error there.

24 hour with agitation (#1) 24 hour still (#2) Office coffee (#3) Diet Coke*
Crude Caffeine Isolated (mg) 14.30 16.74 3.10 -
Total Caffeine (mg/cup)  451  550  100 29

* Literature value via the Mayo Clinic. Chosen due to how frequently my friends consume it.


The second interesting result was simply how much stronger the toddy (24 hour cold brew) was compared to standard hot drip coffee and soda; more than 5 times as much caffeine as the office brew, and 19 times as much as a cup of diet coke. To be fair, people typically drink coffee in smaller volumes. I worry that these numbers may be too high, as I'm not sure what share of the measured mass is impurities. If the numbers are close, that'd solve the riddle of why I've been so susceptible to caffeine headaches when I miss my morning coffee, I used to drink almost a cup of toddy a day.

I want to emphasize that I am not a chemist, I've not been trained as such, and having a background in materials science is not "pretty much the same thing". As such the experimental procedure was just as interesting to me as the result. I will not reproduce all the details here, as there are many many write-ups for this exact extraction out there. Several of the more frustrating bits I will, however, elaborate on. Namely the problem of emulsions. If you've ever seen oil and water, you know they separate into layers, but if you shake it enough you'll get a layer made of bubbles of one in the other that persists; That's the emulsion. Through the three trials I tried a number of methods for getting rid of the emulsion after agitating the coffee with dichloromethane.

Cleanly separated layers of coffee and dicholormethane.
Cleanly separated layers of coffee and dichloromethane before agitation.

As I couldn't get my hands on a sepratory funnel, I ended up using a column with a loose glass top stopper. This prevented me from mixing the liquids by simply inverting it slowly, so instead I swirled it such that the liquid at the top got pulled to the bottom and vice versa. This produced varying levels of emulsion across the three samples.

The resulting emulsion.
The resulting emulsion.

I tried stirring with a glass rod, and that helped some. A write up I found online suggested sonicating, which only served to worsen the problem. Waiting produced the most consistent improvement. The clear answer was to decant the whole mess and centrifuge it, but due to time constraints I opted to stop decanting right at the emulsion's edge (hence the 33% extraction, which should have been much better). The final result contained at least some contaminants, as caffeine ought to be a white solid and what was yielded was yellow to brownish red.

Resulting solids
Resulting solids

The take-away from this experiment is two-fold: agitation has no significant effect on the extraction of cold-brewed coffee, and cold-brewed coffee is ridiculously strong even given a large margin of error. Were I to repeat these experiments again I would filter after the introducing the calcium carbonate rather than allowing it to settle and pipetting off the top, and I would agitate in a sealed container (venting occasionally) and centrifuge the result to sidestep the whole emulsion issue. I've read that a sublimation purification can also reduce the apparent color, but some of the results I've seen are not promising.

Making and Installing a Bibtex style for Journal of Applied Physics

It seems the Journal of Applied Physics only officially supports REVTeX, but not BibTex. After looking around for a bit hoping to find a .bst file out there, I gave up and generated one using makebst. I had to drop in a few commands to Suppress the titles, but otherwise it was very easy. Installing it consisted of dropping it in ~/textmf/bibtex/bst/ and running sudo texhash. For the interested, and for my own sake later on, the file can be found here.

What do you put on a blog anyways?

It's been a while since I've put time into maintaining a website, and now that I've got all my hosting and DNS managed through nearlyfreespeech.net I feel I can start paying attention again. This is despite the fact that I should be pouring more time into research; I can rationalize that having a place to actively write can only help me when it comes time to pen papers and the like. In the previous incarnation of my site, I used it as an area for playing around with CSS and tossing up write-ups (generated in the same spirit of keeping myself relatively sharp on the material) on various semi-technical topics. In addition when I hit problematic spots with Ubuntu on my old Dell Mini 9 I usually wrote up the solutions when I'd pieced them together, hopefully saving others the hassle. For the curious, that mini is currently employed as the interface of an all-optical switch deep in the CIAN testbed, still trucking on years later.

I've put together a poll on the sidebar to see what people would like to see show up here. If there is an option missing, feel free to drop it in the comments. I don't anticipate an enormous number of responses, so any feedback is appreciated.

First Coffee Experiments

I've been in the habit of making weekly batches of 24 hour cold brewed coffee. Taking the name literally, this meant tossing one cup of medium grind into my french press, topping it up with water, stirring a bit, and tossing it in the fridge until the next morning. I'd noticed that every time it came time to take the coffee out, a semi-solid puck of coffee ground has floated to the top. An independent island where no extraction could occur. I decided to make an experiment of it, seeing what happens when the grounds are constantly agitated and this agglomeration wasn't allowed to happen.

The first step was figuring out how I would manage to agitate it. Stir plates are relatively expensive, but seemed like the right way to go about it. I found a few tutorials on putting together one for cheap using a computer fan, some super magnets, glue and a power supply. Save for the magnets which I was able to get for about $7 from amazon, and the fan (which was  donated by an awesome friend) I had everything on hand. It came together in just about an hour, and is still without a housing. Still, it does the job.

For the first real experiment I kept constant everything I could (being time, water/coffee ratio), though the temperature was higher than previously as I haven't found a good way to squirrel the whole setup into my fridge. After the full 24 hours of agitation (making plenty of noise) the resultant liquid was what could best be described as "muddy".

 IMG_20130511_175409_183_small

 

After being french-pressed to remove the larger particles, the resulting liquid passed freely through a coffee filter, but rapidly clogged a #1 United standard filter paper (11 micron pore size). The solid left behind had the consistency of clay, indicating that the agitation may well have been crushing the grounds into fine dust. This was further suggested by the fact that even in the flask I was filtering into, a sedimentation became apparent. I decided to allow the liquid to settle (in the fridge) for four hours before carefully removing all but the bottom-most liquid. Eight hours later there was no sediment apparent, so I decided that I'd gotten out what was going to settle out.

Shortly here I should be able to isolate the caffeine from this batch as well as a similar batch prepared under identical conditions excepting agitation, and will toss my results up then.