Our old Gel Documentation System runs Windows 98, and the hard drive sounds like an abused Yugo. So, we're replacing it. Instead of going with custom hardware and software, we're running with a COTS DSLR. Today I got the camera. Soon I should get the charger. Once I prove that I can take the shots I want in Windows 7 with the Canon software, I'll order the correct filter and we'll rock the new stuff.
My reasoned, well-considered thoughts on gadgets, computing, quantified self, health, open source and whatever else gets my dander up.
Cookie Notice
As far as I know, and as far as I remember, nothing in this page does anything with Cookies.
2012/12/18
Unboxing Day - Canon EOS Rebel T3
Our old Gel Documentation System runs Windows 98, and the hard drive sounds like an abused Yugo. So, we're replacing it. Instead of going with custom hardware and software, we're running with a COTS DSLR. Today I got the camera. Soon I should get the charger. Once I prove that I can take the shots I want in Windows 7 with the Canon software, I'll order the correct filter and we'll rock the new stuff.
2012/12/13
Thinking Through An Idea - Caffeine Tracker
I tend to get horrible headaches on Saturday. I believe it is in part because I've started to drink coffee only on weekdays, only on workdays and only during work hours (9am-5pm) and Saturday is when the caffeine withdrawal hits. At least, that's my theory.
So, I'm considering making an Android app where I store each caffeinated beverage I drink. At first pass, I can get the number of cups and when. Second pass, I should be able to extrapolate caffeine amounts and start to figure out when it's in my system and when it isn't. I can work out when I tend to drink lots and when I tend to drink little.
I could write this as an HTML5 thing. There's certainly a case to be made for that, but I wouldn't be learning a vastly different skill set on that one.
I could write this as an HTML5 thing. There's certainly a case to be made for that, but I wouldn't be learning a vastly different skill set on that one.
What I want to do is make an Android app. It would be vaguely cooler to write the Java itself, but the first step might be to write it in HTML5, do it in PhoneGap, then push it to Android. Moving to iOS and Windows Phone and others (OpenWebOS?) should be easy. But then, I'm not learning Java. I'm not adding another skill to my resume.
So, this'll be an Android native app. More as I get to it.
So, this'll be an Android native app. More as I get to it.
2012/12/03
Pinokio, or, Oh my goodness I have to make this
My friend Mark sent me this, and he was right. It's right up my alley. It is the next step from webcam-on-a-swing-arm idea. I really need to start learning how to add servomotors to a lamp and start making this myself.
I love how it's also a call-back to the World's Most Useless Device, except, instead of always turning itself off, it turns itself back on.
2012/11/28
LED Light Bars
I love this idea. I drive a Toyota Yaris, which isn't cool enough for Eagle Eye LED Light mods.
So, I need to do something with the idea. I don't know what I'd want to do with it, but I want to.
You know, I might just start with a straight one, make it a light stick, and work on the use at a later time.
Randy did suggest that this might be useful toward the sunrise lamp idea, and there is something to that.
2012/11/25
Radical Change in Higher Education - CS for Everyone!
I was pointed to a blog post titled Radical Change in Higher Education: Money, Sports and Computers. The author presents a distrust in Massive Open Online Courses (MOOCs) like Udacity, then goes on to present her ideas for deeper, more radical change.
There are things I kinda agree with but don't forsee happening, such as the ending of college sports in the way they exist now and the creation of minor leagues in their stead. I never really thought it made sense to associate institutes built upon intellect to associate so tightly with teams built on physical prowess. The minor leagues of baseball exist because the baseball is a summer sport and college students are generally off over the summer, so collegiate sports cannot attract the same audiences. Summer break exists because summer is when people were needed back at home, and the low number of people involved in agriculture makes that no longer a design requirement, so the fundamental change I would make, trimesters, would tend to make collegiate baseball more viable and minor league baseball less viable. Ah well.
Unless I misunderstood something, I believe that my school's sports program is self-supporting. I think that, if a university's program is not self-supporting, or if there isn't something else that the school gets from it that justifies it (and for the life of me, I can't think of anything, but I've never been a team sports guy), it would be better if it got rid of it.
I see the point of "replacing" collegiate sports with fitness and wellness programs, but honestly, every personal improvement in wellness I have ever experienced has come from working with myself, not with a group. I think the group dynamic messes it up, but that might just be me.
The last point, the one I'll quote, is one I strongly agree with and disagree with.
I'd throw in the idea that this goes down to the level of skilled labor. Adam Davidson writes in the New York Times magazine about the "Skills Gap", saying that machinist training starts with using tools to cut metal but quickly move on to computer-aided methods.
So, yes, I'm big in agreeing that there's value in a great many fields in embracing the computer revolution. I'm all for teaching programming to all. I'm just not sure that Computer Science is really where you want that.
Computer Science is different. Computer Science, properly considered, is a branch of mathematics built around complexity. Yes, students go into Computer Science as a step toward becoming programmers, but this means there's a great deal of knowledge they gain and never use, and a great deal of knowledge they don't gain until they get on the job and find they need it. I still feel undertrained in the use of version control, for example. Those would be better served with a program built around Software Engineering, and that term is problematic, as there is no mechanism for becoming a licensed software engineer, but are required to call yourself an engineer in other fields, and many of the greatest advances in computing come from people who have the most tenuous claim to that title. Linus Torvalds was a college student when he started developing Linux.
Consider the case of databases. I would consider that there is one set of skills where users (be they artists, historians, scientists, programmers, machinists...) might use to collect what they need, another set of skills that programmers use to effectively create the tables and data structures to be used by others, and another set of skills which programmers use to create the database engines themselves. The first set of skills are things I would wholeheartedly endorse encouraging everyone to know. The second set is a little less useful unless you're stepping up to start collecting your own data. I'm learning it a little at a time, and finding holes in my knowledge every time I create a set of tables. The third set, the skills that those at Oracle or in Microsoft's SQL Server team or involved in PostgreSQL develop, are ... I don't know enough about them to really describe. But it's more about how to make these things fast at the hardware level, so you can have several thousand transactions a second go through when under load.
Thing is, while the last category is closest, none of it is really Computer Science. I think forcing this association between computer use and Computer Science doesn't help any party involved.
There are things I kinda agree with but don't forsee happening, such as the ending of college sports in the way they exist now and the creation of minor leagues in their stead. I never really thought it made sense to associate institutes built upon intellect to associate so tightly with teams built on physical prowess. The minor leagues of baseball exist because the baseball is a summer sport and college students are generally off over the summer, so collegiate sports cannot attract the same audiences. Summer break exists because summer is when people were needed back at home, and the low number of people involved in agriculture makes that no longer a design requirement, so the fundamental change I would make, trimesters, would tend to make collegiate baseball more viable and minor league baseball less viable. Ah well.
Unless I misunderstood something, I believe that my school's sports program is self-supporting. I think that, if a university's program is not self-supporting, or if there isn't something else that the school gets from it that justifies it (and for the life of me, I can't think of anything, but I've never been a team sports guy), it would be better if it got rid of it.
I see the point of "replacing" collegiate sports with fitness and wellness programs, but honestly, every personal improvement in wellness I have ever experienced has come from working with myself, not with a group. I think the group dynamic messes it up, but that might just be me.
The last point, the one I'll quote, is one I strongly agree with and disagree with.
Computer Science: CS should be required. For everyone. Can you be a historian today without using a computer? An artist? A salesperson? Anything? Shouldn’t we aspire to turn out a new generation of educated men and women who have more than a surface knowledge of how the blasted things work, since their success in no small part will depend on that knowledge?I hold a CS degree. I work with computers in the day and play with them at night. My day work with computers involves the use of computers in science, and I've been saying this for years: Today, all science is computer science, because the research that could've been done without computers has been done without them already. I think that the same is becoming true in other fields. Between Processing, Tod Machover's work and work with genetic algorithms in composing, there's precedent for the use of computational tools in the arts. I think you can still be a historian without using a computer much more than using it for email and word processing, but I've heard of historians making more interesting use of it. First, there's the wider dissemination of contemporaneous source material, but beyond that, many are beginning to see digitized libraries as a Big Data source, where you can graph the rise and fall of ideas and people by the number of occurrences of them in the text.
I'd throw in the idea that this goes down to the level of skilled labor. Adam Davidson writes in the New York Times magazine about the "Skills Gap", saying that machinist training starts with using tools to cut metal but quickly move on to computer-aided methods.
So, yes, I'm big in agreeing that there's value in a great many fields in embracing the computer revolution. I'm all for teaching programming to all. I'm just not sure that Computer Science is really where you want that.
Computer Science is different. Computer Science, properly considered, is a branch of mathematics built around complexity. Yes, students go into Computer Science as a step toward becoming programmers, but this means there's a great deal of knowledge they gain and never use, and a great deal of knowledge they don't gain until they get on the job and find they need it. I still feel undertrained in the use of version control, for example. Those would be better served with a program built around Software Engineering, and that term is problematic, as there is no mechanism for becoming a licensed software engineer, but are required to call yourself an engineer in other fields, and many of the greatest advances in computing come from people who have the most tenuous claim to that title. Linus Torvalds was a college student when he started developing Linux.
Consider the case of databases. I would consider that there is one set of skills where users (be they artists, historians, scientists, programmers, machinists...) might use to collect what they need, another set of skills that programmers use to effectively create the tables and data structures to be used by others, and another set of skills which programmers use to create the database engines themselves. The first set of skills are things I would wholeheartedly endorse encouraging everyone to know. The second set is a little less useful unless you're stepping up to start collecting your own data. I'm learning it a little at a time, and finding holes in my knowledge every time I create a set of tables. The third set, the skills that those at Oracle or in Microsoft's SQL Server team or involved in PostgreSQL develop, are ... I don't know enough about them to really describe. But it's more about how to make these things fast at the hardware level, so you can have several thousand transactions a second go through when under load.
Thing is, while the last category is closest, none of it is really Computer Science. I think forcing this association between computer use and Computer Science doesn't help any party involved.
Labels:
computer science,
higher education,
rants
2012/11/19
Social Media and Me
Facebook: I tend to keep that friends-and-family, which means, if you're one of my Facebook friends, you are more than likely someone I have met face-to-face. Because of this, things that I post there, I am unlikely to post elsewhere, and vice versa. My friends and family have very little interest in the totality of my interests.
Google Plus: By and large, this is where I post my geekery, and where I follow my geekery. My go-to groups are:
Google Plus: By and large, this is where I post my geekery, and where I follow my geekery. My go-to groups are:
- Purdue, which is filled with IT/programming people in the Purdue area
- Android, which is filled with people developing or reviewing apps written for Android
- Arduino, which is filled with people developing things based around Arduino
- Lafayette Tech Labs, which is filled with people who go to Lafayette Tech Labs, which is an attempt to create a hackerspace in Greater Lafayette, and has much overlap with the above
I use a script I wrote called Plus2RSS to export my public posts (which is most of my posts) to ...
Twitter: The core. For just about anything I post, anywhere but Facebook, it ends up on Twitter. I could use Buffer to focus it all in Twitter "Prime Time" (10am-4pm local time) but I won't. I'm vaguely open to having a real-me feed and an automated, copy-from-blogs and such feed.
2012/11/16
Restarting the Big Three
I finally have some things to throw into the Big Three, which has been left vacant for too long.
- Product Research - I have an idea. On the technical side, it's pretty much "a small matter of programming", which is to say that it might take some time, but nothing that too involved in any specific step. The trick is that you have to get buy-in from a bunch of people, and you have to know the size of the market, etc. I don't know how to do this. I'm much more excited about the R&D than the marketing, which means it is the marketing I need to force myself into.
And, yes, there's the knowledge I have to develop to be a member of the R&D team. - Old Business - With TEDx, we've broken it up into "Old and Busted" and "New Hotness", a la Men In Black II. I'm on the Old and Busted team and there's a little bit of administrivia that needs to be done with it. Soon, it'll all be done and I'll be able to dive into the New Hotness.
Plus, I've agreed to make an HTML5 frontend to someone's backend, and agreed to help someone with parts of another web tool. I need to spend time with those. - Me - I did an act that might be mistakable for crunches this morning. I made an argument this weekend that my window for exercise is after I wake up but before I go to work, and I have to start using that window. I will start slow, like I did with Couch to 5K, but I will start.
So, that's my top three points of focus. What's yours?
2012/11/15
Mood and Quantified Self
From what little I've done with Quantified Self, I know that the more it takes from you, the less likely that it'll get done.
- FitBit: I wear it, it keeps track. I've worn it most days since I got it, and have numbers to go along
- Run tracking software on my phone: I start it up after I start my music but before I run, and I have maps and times and per-mile lap times for each one. I use the free version of endomondo.
- Weight: I roll my own, where I weigh myself on the way to the shower and enter the weight after. I get most days, but don't get all.
- Weight training: A while ago, I was a member of a local gym, where I would do some cardio (treadmill, elliptical) and some weights. We had a piece of paper on a clipboard to write down what we're doing. I never digitized the data, never tracked progress, eventually stopped tracking and soon after stopped going.
Interaxon does "Thought Controlled Computing" and specifically goes to the Muse, which monitors your brain waves like a FitBit monitors your steps. Like most things, you don't know if this works until you unbox it yourself, but I am excited at the thought of this, as are the folks at KurzweilAI.
2012/11/05
Hacking NTP into an Alarm Clock - Talking Through A Problem
Photo by Douglas Heriot. Thanks. |
In my life, there are very few clocks I rely on, and few of them need me to manually set them. The ones in my computers are connected to the network and use NTP to stay correct. My phone syncs to the phone network, which isn't quite as accurate as NTP, which can cause problems for flashmobs but is within tolerances for my daily life. The clocks with my cable boxes similarly connect outside of themselves to keep correct time.
There are three that I can think of that need manual maintenance: my watch, my car and my alarm clock.
There are three that I can think of that need manual maintenance: my watch, my car and my alarm clock.
My watch is an analog self-winding Seiko watch and I really don't think it is hackable. I have never really trusted in-car timepieces, so while driving, I'll check my watch or my phone. This leaves my alarm clock.
For me, I don't set the alarm, so that's almost a wash. But I might want to set it up for one. So, an alarm clock has
- An LED display
- A speaker
- A snooze button
- Other buttons for different purposes
- Stuff to be cleared out to make room for my stuff.
It strikes me that, if there was something that could do NTP within the case, the only issue is knowing where it is, and you could use IP Location lookup (like IPLocation.net ) to figure out where you are, and determine time zones from there. That is, if all the smarts are within your alarm clock, which doesn't have to be true.
The snooze button is a switch like any other, so you could easily connect them to whatever electronics project you put together, and we're talking just a few LEDs and four seven-segment displays, so driving the display itself should be easy enough. One alarm clock hack I saw went to 24-hour time rather than learning how to drive the AM/PM light, which is fair enough.
If this ends up being an Arduino project, you could write your alarm to the speaker output yourself, but if you use an MP3 shield or go Raspberry Pi, it would be just as easy to use an audio file for your alarm. And, once you factor in the $80 for a WIFI shield vs the $10-20 or so for one that plugs into your Raspberry Pi, the Pi solution seems less and less overkill.
If this ends up being an Arduino project, you could write your alarm to the speaker output yourself, but if you use an MP3 shield or go Raspberry Pi, it would be just as easy to use an audio file for your alarm. And, once you factor in the $80 for a WIFI shield vs the $10-20 or so for one that plugs into your Raspberry Pi, the Pi solution seems less and less overkill.
So, this seems like a doable thing. Is there anything I'm missing?
2012/10/31
What to do with this?
It's pretty simple. There's a magnet and a sensor. If the magnet is away from a sensor, it trips the circuit, turning on the LED. There's three button batteries up in there to light the LED with 3.5 volts or so. All that for a buck from the discount store.
So, let's think.
You can get the 3.5 volt current from the power pin of an Arduino, and sending the signal back to the Arduino rather than to an LED, you now get an "Is it closed?" sensor.
So what? What can we do with that?
I don't really care about what happens with the drawers in my office and I really don't care what happens with the drawers in my bedroom. Same, pretty much, with the doors. I never close my closet door, and really, hooking something to the bathroom door has nothing but creepy uses.
So, what can I do with this? I'm failing at ideas.
So, let's think.
You can get the 3.5 volt current from the power pin of an Arduino, and sending the signal back to the Arduino rather than to an LED, you now get an "Is it closed?" sensor.
So what? What can we do with that?
I don't really care about what happens with the drawers in my office and I really don't care what happens with the drawers in my bedroom. Same, pretty much, with the doors. I never close my closet door, and really, hooking something to the bathroom door has nothing but creepy uses.
So, what can I do with this? I'm failing at ideas.
2012/09/20
That Was Dumb, or the Dangers of Not Packratting
So, there's this instrument. We have a bunch of samples going into the instrument, and we pull data out which tells us whether it is worth it to run the samples on the next, more expensive instrument. So, it's for quality assurance.
I do several things with this thing. I have an interface that collects all the information about group of samples (what goes in which lane, etc.) which we import after the sample is run to connect name, ID numbers and all sorts of metadata with each sample. Right now, there's a comment section, and I put together a CSV table of the metadata in there. The database table I created is set to be all the data fields that the instrument software takes, which means I create the comment on Submit. And it means I don't save all the metadata independently.
This, I am finding out, is stupid.
Because I also code stuff handling the output. Before, I simply used Sikuli to automate the export of the XML, but now I'm handling exported graphs and putting them into our lab notebook, and I'm looking at having to deconstruct the comments in order to get the information I need.
Knuth was right. Premature optimization is the root of all evil.
I do several things with this thing. I have an interface that collects all the information about group of samples (what goes in which lane, etc.) which we import after the sample is run to connect name, ID numbers and all sorts of metadata with each sample. Right now, there's a comment section, and I put together a CSV table of the metadata in there. The database table I created is set to be all the data fields that the instrument software takes, which means I create the comment on Submit. And it means I don't save all the metadata independently.
This, I am finding out, is stupid.
Because I also code stuff handling the output. Before, I simply used Sikuli to automate the export of the XML, but now I'm handling exported graphs and putting them into our lab notebook, and I'm looking at having to deconstruct the comments in order to get the information I need.
Knuth was right. Premature optimization is the root of all evil.
2012/09/12
Oh, That Was Clever! (WebDev)
I write this in Blogger, and there's a helpful icon I can press to upload an image.
I run a wiki for the lab. That wiki does not have a helpful "upload an image" button. I've long seen that as a failing.
Turns out, my users found a work-around.
We use CKEditor as our interface because it would be cruel to force others to understand wiki markup, and because you can copy rows and columns from Excel and it turns them into tables.
Guess what else you can do?
You can create things in Word, copy them, and paste them into CKEditor, which saves them as data URLs.
On the good side, you can get your images onto the wiki.
On the bad side, it blows the top off the page size limits, which are put there for your protection.
I'm seriously going to have to find a solution to this, because this is seriously causing problems. But, honestly, once I got what was going on, I laughed out loud.
I run a wiki for the lab. That wiki does not have a helpful "upload an image" button. I've long seen that as a failing.
Turns out, my users found a work-around.
We use CKEditor as our interface because it would be cruel to force others to understand wiki markup, and because you can copy rows and columns from Excel and it turns them into tables.
Guess what else you can do?
You can create things in Word, copy them, and paste them into CKEditor, which saves them as data URLs.
On the good side, you can get your images onto the wiki.
On the bad side, it blows the top off the page size limits, which are put there for your protection.
I'm seriously going to have to find a solution to this, because this is seriously causing problems. But, honestly, once I got what was going on, I laughed out loud.
2012/09/10
Making the RCA Media Player Usable
ElectronicHouse.com |
I have two comments on that purchase:
The remote for this RCA player is utter crap. And two HDMI ports will not be enough.
Tekzilla has pointed me to the solution to the second problem. You can now get HDMI switches that auto-switch, which means, for example, you have the cable box on port 1, the Blu-Ray player on 2 and the RCA Faux-ku on 3. You generally keep the DVR-having cable box on and the other two off, so, when you turn on the Blu-Ray, it auto-switches to that, and switches back when done. I need one. But that's not the point today.
The point today is that the remote for the RCA Streaming Media Player is crap. And the button battery it comes with is weak. But, thankfully for me, I can program my Logitech Harmony 200 remote to talk to it. And, while it is not the best of the Harmony line — I got the low-powered one as a test and preview for the bedroom before I got a better one for the living room — it is quite a lot better than the one that came with.
Honestly, I wish I had gone with a Roku, but I didn't. I'm reasonably happy with the unit (Pandora and Netflix work fine, Hulu less so). But the first issue with this device is now rectified.
Big Three for Sept 10-15
- TEDx - I have an idea for replacing the scroller images (which make Purdue look like a concentration camp) with images (and links to the associated videos) from last year's event. Also, seeing if we can do PHP on the server.
- FFH, or Just For Me - develop a small web app using something like Google Places and the HTML5 Location API to tell me what restaurants are close.
- Self - When I found that my tendons are weird, leading to flat feet and bunions and foot pain, I stopped running (except for a 5K, which I mostly walked). I half-heartedly decided that I would do five push-ups and five sit-ups every day. The push-ups stopped after the first day -- low upper-body strength meets 240+ weight -- and after doing MWF last week, I could feel the muscles aching for days after. So, I think I'll go with MWF. Which means I have to remember to do some sit-ups when I get home today.
Additional to-do: Remember to get this done on Friday. I was in a weird mood for no good reason that day.
2012/08/31
Big Three for September 3-7
Here we are, at it again. I'm writing down my Big Three tasks for the coming week. I think I'll admit the progress on the previous Big Three.
- Main Work: This one is actually pretty good. I've had some feature requests and I'll get some more, but I have it in good condition.
- TEDx Web Development: Institutionally, we're starting to get together, which is good for the team. We're starting to recruit people to take on pieces. This is good. And I have tried to put a basic hello_world.cgi onto the Dev server, and it failed. This is ... well, at least I know. There's a code review process, so I have to start looking into the "who do I ask to get this going" problem to try to get server-side code on this project.
- Food For The Heart: The group has made progress. There is a meeting with a possible funding source. There was a great meeting a week ago where our "Angels" told us what they need from us before they'll cut checks. In terms of institutional setup, I'm happy. But in terms of programmer work, we're not at a point where I can start doing anything.
So, that's my progress. So, what's my next set of goals?
- Main Work: I had been planning on taking a PC and turning it into my Linux desktop, then taking my old Linux desktop and turning it into a Git server. On Thursday, I finally hit the point where I had time, and I made a bootable thumbdrive and everything. And today I find that something on my desktop is kicking out spam. So, this is the justification I needed to move forward. And, I need to look up firewalls and cfengine.
- TEDx Web Development: There will of course be the process of finding the team. My #1 goal, though, is to think through the desired look and functionality.
- Food For The Heart: I need to keep part of the business-building process, because that's the part I most need to learn. But, so I can keep my interest up, I'll probably try to make a location-based app of some sort, just to jump-start my skills on the subject.
2012/08/28
What do I do with my weather stuff now?
It started with me wanting to know how to code with R. R is about handling and graphing data, and I didn't really have data of my own. So, what I did was find a source I liked for weather and started putting it into a MySQL database.
That source was Google, specifically the XML used for weather in the soon-to-be-closed iGoogle.
Here's that code.
That source was Google, specifically the XML used for weather in the soon-to-be-closed iGoogle.
Here's that code.
#!/usr/bin/perl # $Id: hpsetdisp.pl 11 2006-03-22 01:21:03Z yaakov $ # hpsetdisp.pl # Connects to a JetDirect equipped HP printer and uses # HP's control language to set the ready message on the # LCD display. Takes an IP address and message on the # command line. My favorite message is "INSERT COIN". # Keep in mind the limitations of the display when composing # your clever verbiage. # # THIS PROGRAM IS PROVIDED WITH NO WARRANTY OF ANY KIND EXPRESSED OR IMPLIED # THE AUTHOR CANNOT BE RESPONSIBLE FOR THE EFFECTS OF THIS PROGRAM # IF YOU ARE UNCERTAIN ABOUT THE ADVISABILITY OF USING IT, DO NOT! # # Yaakov (http://kovaya.com/ ) # # Modified by Garrett Hoofman # 10/18/2007 # http://www.visionsofafar.com # Modified by David Jacoby # 12/10/2008 # http://varlogrant.blogspot.com/ # Modified by David Jacoby, using notify-send and tweaking Unicode # 09/08/2008 # http://varlogrant.blogspot.com/ # Modified by David Jacoby, moving from Google to NOAA # 08/28/2012 # http://varlogrant.blogspot.com/ use strict ; use warnings ; use Modern::Perl ; use DBI ; use Getopt::Long ; use IO::Interactive qw{ interactive } ; use IO::Socket ; use XML::DOM ; use Data::Dumper ; use lib '/home/jacoby/lib' ; use MyDB 'db_connect' ; use subs qw{ get_weather notify db_upload } ; my $zip = '' ; my $interactive = '' ; my $degree = '°' ; #the unicode, straight $degree = "\x{00b0}" ; #the unicode, specified my $rdymsg = "Ready" ; my $curr_cond ; GetOptions( 'zipcode=s' => \$zip , ) ; $zip !~ /\d/ and exit 0 ; my %weather = get_weather ; db_upload %weather ; exit ; ########## ########## ########## ########## ########## ########## ########## sub get_weather { my %output ; my $parser = XML::DOM::Parser->new() ; my $file = 'http://www.google.com/ig/api?weather=XXXXX&hl=en' ; #my $zip = shift ; $zip =~ s{(\d{5})}{}mx ; $zip = $1 ; $file =~ s/XXXXX/$zip/mx ; my $doc = $parser->parsefile( $file ) ; exit if ! defined $doc ; $output{zip} = $zip ; $output{city} = $doc->getElementsByTagName( 'city' )->item( 0 ) ->getAttribute('data'); $output{temp_c} = $doc->getElementsByTagName( 'temp_c' )->item( 0 ) ->getAttribute('data'); $output{temp_f} = $doc->getElementsByTagName( 'temp_f' )->item( 0 ) ->getAttribute('data'); $output{humidity} = $doc->getElementsByTagName( 'humidity' )->item( 0 ) ->getAttribute('data'); $output{wind} = $doc->getElementsByTagName( 'wind_condition' )->item( 0 ) ->getAttribute('data'); $output{conditions} = $doc->getElementsByTagName( 'condition' )->item( 0 ) ->getAttribute('data') ; return %output ; } ########## ########## ########## ########## ########## ########## ########## ########## ########## ########## ########## ########## ########## ########## sub db_upload { my %cond = @_ ; my $dbh = db_connect() ; for my $k ( sort keys %cond ) { $cond{$k} = $dbh->quote( $cond{$k} ) ; } my $fields = join ',' , qw{ city conditions humidity temp_c temp_f wind zip } ; my $sql ; my $rows ; $sql = qq{ INSERT INTO weather_data ( $fields ) VALUES ( $cond{ city } , $cond{ conditions } , $cond{ humidity } , $cond{ temp_c } , $cond{ temp_f } , $cond{ wind } , $cond{ zip } ) } ; #$rows = $dbh->do( $sql ) or croak $dbh->errstr; $sql = qq{ INSERT INTO weather ( $fields ) VALUES ( $cond{ city } , $cond{ conditions } , $cond{ humidity } , $cond{ temp_c } , $cond{ temp_f } , $cond{ wind } , $cond{ zip } ) } ; $rows = $dbh->do( $sql ) or croak $dbh->errstr; return ; } ########## ########## ########## ########## ########## ########## ##########Problem is, Google knows I've been grabbing weather data every 10 minutes and has blocked me.
While I fill in all these, I am not pulling in weather data from multiple cities, so I can hardcode city and zip, and I couldjust drop conditions and wind. All I'm really watching is temp_f, and it's a simple conversion to get temp_c if I wanted it.
I have code that pulls from NOAA. Think I'll try to bring that in here.
2012/08/27
Weight Graphs
These are a series of generated graphs. The jagged blue line is the raw data of my more-or-less daily weight measures, and the red line is an average of the previous days' measurements.
I don't measure every day, because I am human and therefore fallible. I take an average of the measurements of the n previous days, which means if I'm trying to get 20 and I skipped twice, I get 18. I would like to have that number graphed here, but I don't know R that well yet. Here, I'm increasing n by five, going from 5 to 30. My goal is to get to the trend line, to show I'm losing weight in total without getting caught up in the day-to-day jagged differences. After some poking, I decided to go with 20 days. Here, I've run the graph several times with different levels so I can see if there's anything better.
Clearly, the first few weeks will look similar, because a five day average will look like a 30 day average if you only have five days to work with. The trend line approximates 1 lb a week, I think. I should add that as a third line.
Clearly, the first few weeks will look similar, because a five day average will look like a 30 day average if you only have five days to work with. The trend line approximates 1 lb a week, I think. I should add that as a third line.
2012/08/24
Big Three for August 27-31
- TEDx Web Development: I do web for TEDxPurdueU and so far, that has meant maintenance work. I need to get in front of it, come up with an alternate look, and go from there, so we can toss the old and embrace the new. So, specifically, I want to have a front page that demonstrates my desired look. Plus, clear out backlog, and know to what extent we can run dynamic pages on the server.
- Food For The Heart: This is the "Do that work" mentioned in the previous. I have taken the visual plan from whiteboard to static HTML prototype. I need to look up and use an icon set, sprite or font, set it up for Bootstrap, and add some features.
- Main Work: I am convinced that my API design is stupid and needs redesign. I have moved the application code for APR into libraries, so I can change config in the main page and easily move between test and production. I need to move all the output from several pages to one, where the caller object says "operator_list" to the API core to get data rather than looking to ajax_operator_list.cgi
If you see me, feel free to ask me how I'm doing on my Big Three.
2012/08/21
My Next Personal Project
I don't like distractions. They're distracting.
I also don't like missing a mail from my boss. They're rare, so when they come, they're often important.
So, I shut down alerts in Thunderbird and wrote a tool called jBiff.
jBiff connects to your mail server via IMAP and finds the new mail (thus biff) that meets the standards you want to watch for, then sends an alert via XMPP, aka Jabber (thus j). As is, I'm mostly searching on sender, and I'm not sure, but that might be all that works.
I suppose I should put this on Github. I'm pretty sure that step's overdue. But there's a problem.
jBiff uses IMAP. There are certain mail servers that don't offer IMAP. This obliges me to start working in POP.
And, there's another possiblity. There are many places I receive mail but never check. There are two primary places I check mail, and if you know me, you know what they are. But having a tool to check the status of the others and notify me weekly or so, that would be good.
I also don't like missing a mail from my boss. They're rare, so when they come, they're often important.
So, I shut down alerts in Thunderbird and wrote a tool called jBiff.
jBiff connects to your mail server via IMAP and finds the new mail (thus biff) that meets the standards you want to watch for, then sends an alert via XMPP, aka Jabber (thus j). As is, I'm mostly searching on sender, and I'm not sure, but that might be all that works.
I suppose I should put this on Github. I'm pretty sure that step's overdue. But there's a problem.
jBiff uses IMAP. There are certain mail servers that don't offer IMAP. This obliges me to start working in POP.
And, there's another possiblity. There are many places I receive mail but never check. There are two primary places I check mail, and if you know me, you know what they are. But having a tool to check the status of the others and notify me weekly or so, that would be good.
Easy Does It!
As previously blogged, my Stapes Easy button has been turned into a switch and connected to a Teensy. The last issue was getting the code worked out. I now have that code worked out.
And released to Github.
And released to Github.
// ========= ========= ========= ========= void setup() { // make pin 10 an input and turn on the // pullup resistor so it goes high unless // connected to ground: pinMode(10, INPUT_PULLUP); delay(2000); Keyboard.begin() ; } // ========= ========= ========= ========= void loop() { if ( digitalRead( 10 ) == LOW ) { Keyboard.press( KEY_SCROLL_LOCK ) ; Keyboard.releaseAll() ; delay(300); Keyboard.press( KEY_SCROLL_LOCK ) ; Keyboard.releaseAll() ; delay(600); // Delay of 6/10 second to keep from repeating. } delay(10); }
This was my first serious use of Github for Windows, too. Far easier to handle than the previous stuff I did.
2012/08/20
Easy Like Sunday Morning
Remember my intention to reimplement the Button?
I have my Easy Button torn down, with the speaker out and the circuit bent. You press the button and there is definitely signal going through. I scratched away at the green and soldered in. It works.
On the other side, I have my Teensy, and man, is it teensy. I'm now 93% sure that the micro-B USB cable I've been carrying arround is charge-only, because I couldn't get it to update the code. The code it has on it right now simply kicks out "Hello World" every 5 seconds. The next step, obviously, is to get the Teensy and the easy together, to code it up so that when I hit the button, it kicks out two scroll-lock characters, and to put that code up on Github.
And, to get a nice long micro-B cable.
I have my Easy Button torn down, with the speaker out and the circuit bent. You press the button and there is definitely signal going through. I scratched away at the green and soldered in. It works.
On the other side, I have my Teensy, and man, is it teensy. I'm now 93% sure that the micro-B USB cable I've been carrying arround is charge-only, because I couldn't get it to update the code. The code it has on it right now simply kicks out "Hello World" every 5 seconds. The next step, obviously, is to get the Teensy and the easy together, to code it up so that when I hit the button, it kicks out two scroll-lock characters, and to put that code up on Github.
And, to get a nice long micro-B cable.
My Big Three for August 20-25
Matt Hunckler of VergeIndy sent out a challenge:
He went on to go through is goals. They are good goals. But I'm about my goals. Which are:What’s big for you this week?
One of my closest friends asks me that question each Monday. The first time she posed the question, it caught me off guard. I can still remember my response.
“Um, my to-do list.”
It took about 2 seconds to identify that my snarky response was a lame attempt dodge the question. I hadn’t defined what was truly BIG for me that week. And I didn’t yet understand how powerful this simple question could be.
My friend and I worked together to identify the 3 biggest things for that week and I wrote them on a post-it. It took less than five minute, but it created a clarity that propelled me through the rest of my workweek. And the best part was that, at the end of the week, the list was complete—a welcomed supplement to the ever-growing list of things that need to get done.
I want to pay it forward. So, here’s the question for you:
What are your 3 Big goals for your business this week?
Write your Big 3 down on a post-it. Tell a friend, a mentor, a random person at a coffee shop—anyone. Heck, if you can’t find someone, email me.
Go ahead and reply with your Big 3 directly to this email. I can’t promise that I can reply to all of them, but I will certainly read each and every one. If there’s some way that I can help, I will.
Sharing this stuff can be scary. Trust me, I get it.
- Get My Work Status Worked Out: there's a thing I want to get into, startup-wise, but it is essentially working for the U, and I can't work twice for the U. Or something. Need to talk to some people who know, and to HR, about this.
- Do That Work: This involves a location-connected app, and I want to turn the whiteboard work into something we can put in a proposal.
- Get APR Stuff Done: This is my non-moonlighting project, for the people who currently pay me. I have it feature-complete, but now they want new features. I want to knock 'em out quickly.
I like this idea, and I will try to keep doing this. I might put outlining Monday's Big Three as Friday's last task. And, as I've stated mine, I should turn it around.
What Are Your Three Big Goals?
What Are Your Three Big Goals?
2012/08/14
"I am deeply shamed by what it looks like"
"Why don't you open source your code?" "I am deeply ashamed of what it looks like" (typical result of formal CS education?)
-- Ehud Lamm (@ehud)
If that's you, raise your hand.
It's kinda me, too.
Programming is like a brain dump, a distilled essence of your skills and knowledge at the time you wrote it, and once you have written something, you learn more and know how wrong your initial understanding of the problem and the language really were. Sometimes, your failings are such that you're not even wrong, that blowing it completely is something you have to aspire to.
I have code in my GitHub account. I think I have to be more explicit on licenses, and I know I have to put more of my stuff up there. But, if you want to know how to make a phone call with Twilio and Perl, or dump your Google Plus account to RSS, take a look.
And if you think it's ugly, by all means, submit a fix full of pretty and elegant code.
It's kinda me, too.
Programming is like a brain dump, a distilled essence of your skills and knowledge at the time you wrote it, and once you have written something, you learn more and know how wrong your initial understanding of the problem and the language really were. Sometimes, your failings are such that you're not even wrong, that blowing it completely is something you have to aspire to.
I have code in my GitHub account. I think I have to be more explicit on licenses, and I know I have to put more of my stuff up there. But, if you want to know how to make a phone call with Twilio and Perl, or dump your Google Plus account to RSS, take a look.
And if you think it's ugly, by all means, submit a fix full of pretty and elegant code.
2012/08/13
How To Wake Up: Am I In The Right?
You might've noticed that I am a reader and fan of Lifehacker. I read the site. I listen to the podcast. I follow many of the writers on Twitter and on Google+.
Yeah, it might be getting to that creepy level.
A recent post covered the subject of getting up in the morning. For a good long time in my life, Morning was a point in my life I dreaded and feared. There was a semester in my life when I'd go to sleep after SNL on Saturdays and not wake up until 5pm Sunday evening, so sleep is a known issue to me. Their suggestions are finding an alarm clock that works for you, putting it in a place where you have to get up to shut it off, and resetting your internal clock. All of these are good techniques. The thing I'm mentally playing with is (by several possible means) setting a light to be on at the time I schedule to be up, so that I'm not met with a dark room and thus more inclined to fall back asleep.
The killer app for me has been Smart Alarm Clock, which finds the point in the sleep cycle where you are sleeping the lightest, then wakes you then. This and seriously backing off on caffeine have
I have been vocal on the G+ list on this subject. Some of the others have been saying "stop being a lazy bastard" and "go to bed earlier". I'm generally against shut up and nut up advice, because it really doesn't give you a mechanism for change. If there is ever a point in the day where it is difficult to exercise your will, it is right when you are supposed to wake up. As for getting to bed earlier, that's all well and good, I guess, but there is a point where you can have too much sleep, which leads to being groggy and tired, which are two reasons you'd want to reach over and slap the snooze button.
I think I have kept my responses at a reasonable and respectful level, but I'm not sure how I'm coming off. If you read this and think I'm either factually wrong or brought out the nasty side of the argument, please respond.
Yeah, it might be getting to that creepy level.
A recent post covered the subject of getting up in the morning. For a good long time in my life, Morning was a point in my life I dreaded and feared. There was a semester in my life when I'd go to sleep after SNL on Saturdays and not wake up until 5pm Sunday evening, so sleep is a known issue to me. Their suggestions are finding an alarm clock that works for you, putting it in a place where you have to get up to shut it off, and resetting your internal clock. All of these are good techniques. The thing I'm mentally playing with is (by several possible means) setting a light to be on at the time I schedule to be up, so that I'm not met with a dark room and thus more inclined to fall back asleep.
The killer app for me has been Smart Alarm Clock, which finds the point in the sleep cycle where you are sleeping the lightest, then wakes you then. This and seriously backing off on caffeine have
I have been vocal on the G+ list on this subject. Some of the others have been saying "stop being a lazy bastard" and "go to bed earlier". I'm generally against shut up and nut up advice, because it really doesn't give you a mechanism for change. If there is ever a point in the day where it is difficult to exercise your will, it is right when you are supposed to wake up. As for getting to bed earlier, that's all well and good, I guess, but there is a point where you can have too much sleep, which leads to being groggy and tired, which are two reasons you'd want to reach over and slap the snooze button.
I think I have kept my responses at a reasonable and respectful level, but I'm not sure how I'm coming off. If you read this and think I'm either factually wrong or brought out the nasty side of the argument, please respond.
2012/08/10
Code I Am Not Proud Of
I have a shell script that uses espeak to tell me the time and temperature, which I crontab to run at the top of every hour. I had been using the Google Weather shadow API, the one that's connected to the doomed iGoogle, but it stopped working on me this week.
This broke my code.
So, I've moved to using XML files from NOAA, which I probably should have used from the first.
This broke my code.
So, I've moved to using XML files from NOAA, which I probably should have used from the first.
sub temperature { my $parser = XML::DOM::Parser->new() ; my $file = 'http://w1.weather.gov/xml/current_obs/KLAF.xml' ; my $doc = $parser->parsefile( $file ) ; my $nodes = $doc->getElementsByTagName( "temp_f" ) ; my $n = $nodes->getLength ; my $temp ; for ( my $i = 0 ; $i < $n ; $i++ ) { my $node = $nodes->item ($i) ; my $str = $node->toString; $temp = sprintf '%d' , ( split /[<>]/ , $str )[2] ; } return $temp ; }
I am fine with most of this. I get a parser. I use it to download the file, and get a document. I get an object full of nodes from that document, and I go through each one. Going through each one is where I hit the goofy.
I can get a node that gives me what I want. What I cannot seem to find is the way to get the value from the object. So, I go to regular expressions. There must be a way to get XML::DOM to do the right thing, but I couldn't find it. From there on, that's OK.
It makes me wish, though, that NOAA exported JSON.
2012/08/09
Best Advice I've Ever Received
Lifehacker has a series called How I Work where they detail the apps and tools and environment of how various people do what they do. For two of them, one of the questions is this:
What's the best advice you've ever received?
In about 1996 or so, I was a CS student and was working for Purdue's Engineering Computer Network, and my primary responsibility was keeping track of the documentation library. It was a very paper system, and I decided what we needed was an electronic system. At that point, the World Wide Web was relatively new, as was programming with the Common Gateway Interface (CGI), and about all I knew about programming is what I gained from CS 180. But, I figured that I could do this and it would make my life easier, plus I could use it as an excuse to learn Perl.
At the time, the web lead for our group was Kyler Laird. He showed some interest, gave me some encouragement, and told me the following advice:
"Don't fear flat-file databases."
I know, it doesn't sound like much. But, at the time, I had no access to big database systems on campus nor knowledge of them. Eventually, I used a database that tied to a hash (I think I have some code that still uses this, running via crontab somewhere), but on first pass, I could read a file, separate on pipes (because commas tabs are too common within text, while pipes only show up if you're talking about the UNIX command line) , and write a file, then go on to the next thing. Yes, the right thing is using SQL or, now, NoSQL databases (I still don't get them, but okay), but I could get something going now, then get onto the part where my interest lies and my enthusiasm calls.
So, yes, don't fear flat-file databases. Don't fear not using the "right thing" at some step along the way. Go with what you understand, get something going, and fill in your knowledge later.
What's the best advice you've ever received?
In about 1996 or so, I was a CS student and was working for Purdue's Engineering Computer Network, and my primary responsibility was keeping track of the documentation library. It was a very paper system, and I decided what we needed was an electronic system. At that point, the World Wide Web was relatively new, as was programming with the Common Gateway Interface (CGI), and about all I knew about programming is what I gained from CS 180. But, I figured that I could do this and it would make my life easier, plus I could use it as an excuse to learn Perl.
At the time, the web lead for our group was Kyler Laird. He showed some interest, gave me some encouragement, and told me the following advice:
"Don't fear flat-file databases."
I know, it doesn't sound like much. But, at the time, I had no access to big database systems on campus nor knowledge of them. Eventually, I used a database that tied to a hash (I think I have some code that still uses this, running via crontab somewhere), but on first pass, I could read a file, separate on pipes (because commas tabs are too common within text, while pipes only show up if you're talking about the UNIX command line) , and write a file, then go on to the next thing. Yes, the right thing is using SQL or, now, NoSQL databases (I still don't get them, but okay), but I could get something going now, then get onto the part where my interest lies and my enthusiasm calls.
So, yes, don't fear flat-file databases. Don't fear not using the "right thing" at some step along the way. Go with what you understand, get something going, and fill in your knowledge later.
2012/08/07
I Confess, My APIs Suck
I do web development from SQL to CSS, and I confess that all too often, when I want to interact with the server with AJAX, I create another application.
I confess, I hadn't thought about this, but the more I think about it, the more I know this is the right thing.
Instead of this:
I confess, I hadn't thought about this, but the more I think about it, the more I know this is the right thing.
Instead of this:
{ data:{abc:123} }
I should have
{ action:"upload_keys",data:{abc:123} }
or whatever I'm doing, and then have my
I will endeavor. to do better in the future.
ajax_handler.cgi
look for action
and handle depending on that value.
I will endeavor. to do better in the future.
2012/08/06
So, I taught Javascript on Saturday
I taught Javascript to a class of three young adults and four adults on Saturday, as part of a hackathon for Lafayette Tech. Food was provided in the afternoon by Bruno's Pizza, and it was tasty.
I'd show you my slides, but the value is somewhat slight, because of two issues. First, I get more nervous the more tightly I prepare a presentation, which means that, for me, it is best if I just have a few slides to remind me where I am. Second, I used impress.js and abused the awesome power of 3D visualization. I will use it again, and next presentation will be better thought out.
I found out about jsBin, which I will use again if I ever have a class on Javascript again. Jack Stuckey pointed me to it, and to some code which created a box and moved a ball around it. I made the ball into a ball object and made a ball object maker, pushed the objects into an array, and moved the balls around. I really think I'm not far from turning this into a Javascript implementation of Asteroids.
I think the cool move would be to port this to Processing.js.
Anyway, thanks to all who attended, and I hope you learned much.
I'd show you my slides, but the value is somewhat slight, because of two issues. First, I get more nervous the more tightly I prepare a presentation, which means that, for me, it is best if I just have a few slides to remind me where I am. Second, I used impress.js and abused the awesome power of 3D visualization. I will use it again, and next presentation will be better thought out.
I found out about jsBin, which I will use again if I ever have a class on Javascript again. Jack Stuckey pointed me to it, and to some code which created a box and moved a ball around it. I made the ball into a ball object and made a ball object maker, pushed the objects into an array, and moved the balls around. I really think I'm not far from turning this into a Javascript implementation of Asteroids.
I think the cool move would be to port this to Processing.js.
Anyway, thanks to all who attended, and I hope you learned much.
2012/08/03
I like mustache.js but don't know if it works with jQuery-ui
As I have mentioned, I am currently looking for a templating engine in Javascript which will allow me to create great gobs of HTML things without the bulk of assembling them in jQuery. I couldn't get pure.js to work for me, but from the first with mustache.js, it was working close to how I was thinking.
Here is the specific function I want to generalize and make smoother. It uses jQuery-UI to make a pop-up.
Here is the specific function I want to generalize and make smoother. It uses jQuery-UI to make a pop-up.
// ========= ========= ========= ========= ========= ========= ========= // creates popup where you enter the accessions desired // --------- --------- --------- --------- --------- --------- --------- apr.accession_popup = function () { // I do this enough that I should make a specific library to handle // this style of popup // must investigate reformatting $( '#paste_from_spreadsheet' ).remove() ; $( '<div id="paste_from_spreadsheet" />' ) .attr( 'title' , 'Add Accessions' ) .dialog() ; $('.ui-dialog-titlebar-close') .click( function () { $( '#paste_from_spreadsheet' ).remove() } ) ; $( '<div/>' ) .text( 'Add one or more valid Accession IDs. ' + 'When done, click "Go" or hit "Enter". ' ) .appendTo( '#paste_from_spreadsheet' ) ; $( '<textarea/>' ) .attr( 'id' , 'spreadsheet' ) .attr( 'name' , 'spreadsheet' ) .appendTo( '#paste_from_spreadsheet' ) ; $( '<div/>' ) .attr( 'id' , 'spreadsheet_go' ) .text( 'Go' ) .appendTo( '#paste_from_spreadsheet' ) ; $('.ui-icon-closethick') .text( 'X' ) ; $( '#spreadsheet_go' ).click( function () { apr.add_accession( $( '#spreadsheet' ).val() ) ; $( '#paste_from_spreadsheet' ).remove() } ) ; $( '#spreadsheet' ).focus() ; } ;
And here is the version using mustache.js.
function my_popup () { $( '#paste_from_spreadsheet' ).remove() ; $( '<div id="paste_from_spreadsheet" />' ) .attr( 'title' , 'Add Accessions' ) .dialog() ; $('.ui-icon-closethick') .text( 'X' ) ; $('.ui-dialog-titlebar-close') .click( function () { $( '#paste_from_spreadsheet' ).remove() } ) ; var template = '\ <div>\ Add one or more valid Accession IDs.\ When done, click "Go" or hit "Enter". \ </div>\ <textarea id="spreadsheet" name="spreadsheet" ></textarea>\ <div id="spreadsheet_go"> Go </div>\ ' ; var html = Mustache.to_html( template,'' ) ; $( '#paste_from_spreadsheet' ).append( html ); $( '#spreadsheet_go' ).click( function () { apr.add_accession( $( '#spreadsheet' ).val() ) ; $( '#paste_from_spreadsheet' ).remove() } ) ; $( '#spreadsheet' ).focus() ; }
Notice that there isn't a lot of filling here. I can do filling, but half the time, I'll want to replace that textarea with an input type="text", which means that, if I dive in on this one, I'll have to use the awesome power of mustache.js in some way.
Right now, though, I'm not sure there's enough win there to make it worth my while, or if I could write my jQuery stuff better and make it work like I want it to.
Right now, though, I'm not sure there's enough win there to make it worth my while, or if I could write my jQuery stuff better and make it work like I want it to.
Labels:
javascript,
jquery,
mustache.js,
programming
2012/08/02
I think Pure.js is out of the running
I have been on the lookout for a templating engine for Javascript. Thanks to the great outpouring of suggestions, I have a number of suggested libraries to test.
And first in the running was Pure.js. There is something to it, and it sounds like the author of the library, BeeBole, is a good programmer with an active user base, and he did try to be helpful to me, sending me this link to where he pulled templates from other pages.
If I could rewrite
I'm thankful for his help, but I'm off to try moustache.js.
And first in the running was Pure.js. There is something to it, and it sounds like the author of the library, BeeBole, is a good programmer with an active user base, and he did try to be helpful to me, sending me this link to where he pulled templates from other pages.
If I could rewrite
prompt()
such that used a textarea equivalent rather than a popup with input type="text", I'd probably toss the whole thing. But, as this is what I'm looking for, my desire is for a solution that could work on a page that looked like <body></body>
and what I see of pure.js is that it is much more aligned with replacing values it finds within existing structures. I'm thankful for his help, but I'm off to try moustache.js.
Free Outdoor WiFi in Downtown Lafayette
City of Lafayette |
"Want to live in a progressive city with 21st century technology?"
That's Lafayette mayor Tony Roswarski's question, and if you live in Lafayette, "Now you do", as the City of Lafayette and Wintek announced the opening of "Free Wi-Fi on Main Street."
I haven't tried it yet, but I expect to do so today. There's a bunch of places I go downtown that are in that map, so I am sure that I'll have a great chance to do so.
As a reminder, though, if you are using free Wi-Fi, there are few controls to keep potential bad guys away from your system. Lifehacker has writeup on how to keep your system safe on free Wi-Fi networks.
That's Lafayette mayor Tony Roswarski's question, and if you live in Lafayette, "Now you do", as the City of Lafayette and Wintek announced the opening of "Free Wi-Fi on Main Street."
I haven't tried it yet, but I expect to do so today. There's a bunch of places I go downtown that are in that map, so I am sure that I'll have a great chance to do so.
As a reminder, though, if you are using free Wi-Fi, there are few controls to keep potential bad guys away from your system. Lifehacker has writeup on how to keep your system safe on free Wi-Fi networks.
2012/07/25
Low Wattage Lighting from LumenCache
I've been thinking about the subject of lighting recently, looking to make myself a computer-controlled fading lamp. I've gone from thinking "I'll wire up a bank of modern LEDs" to "I'll figure out how to hook a digital potentiometer to replace the slider in a CF dimmer switch". I hadn't really given great thought about the future of how lights work.
Thinking about the future of lighting is what LumenCache is there for, and that's not at the lamp level, but at the building level. Let's hit a few ideas.
Thinking about the future of lighting is what LumenCache is there for, and that's not at the lamp level, but at the building level. Let's hit a few ideas.
- LED lights have a life of 100,000 hours, but the drivers burn out more like 25,000 hours. (I'm reciting from a presentation where I didn't take notes, so I could have it wrong, but I believe I have the jist of it right.) So, we're talking about a quarter of the life of the bulb thrown away.
- So, we get better drivers, kicking out DC power, which does not have to be high wattage, and we put 'em in a central location.
- Lower wattage means lower costs for lighting (and LEDs are getting brigher for less all the time) and lower heat. It also means that putting a battery with the system means you can keep the lights on and the system going through small power interruptions.
- The wiring doesn't have to be the high-wattage wiring we use to push standard electrical power. It can even be kicked over CAT5. It isn't Power Over Ethernettm but it is power over ethernet cable. CAT5 has four pairs, and the standard only uses the outer pairs, so they're putting power over the center while keeping bits on the outside. (It has been a decade since I last crimped an ethernet cable, so I might have some of those details mixed up, please see your cabling professional.) So, you can use some of your runs to go to your WiFi access points.
- Control is also at the center, but definable to the switches (and they can be standard switches) and also (presumably) via computer controls, web applications and smartphone apps. Or at least in the future.
- And, it isn't just on/off. You can fade lights, too.
I don't expect that sort of wiring setup any time soon, but I hope it is clear that I love this idea.
Labels:
hardware,
lighting,
we live in the future
2012/07/23
The Quest For Javascript Templating
I first heard about templating several years ago at YAPC::NA 2006, when Ingy döt Net talked about Template Toolkit. I honestly did not get it then. I was putting my HTML in my code at the time, and I just didn't get it.
Soon after, I started working at the Lab, and Lab standard was to
use CGI
, so I started to do that, and my code went from:
print qq{ <a href="http://draft.blogger.com/$link">Link</a> } ;
to something more like.
print $cgi->a( { href=> $link } , 'Link' ) ;
That example is simple enough, but it gets complicated when you're putting together a large table of tabular data. (I feel I must explain that I'm tables for their proper purpose.) The Lab is now moving toward using Dancer as our framework (we don't have it fully implemented yet, but I have some things very close) and thus use Template Toolkit fairly regularly, and I foresee a day in which I won't need to have massive bricks of code to put together my HTML. At least in Perl.
Javascript, that's another matter.
$.get( apr.chip_url , function ( data ) { $( '<fieldset id="chip_field">') .addClass( 'narrow_fieldset' ) .appendTo( chip_div ) ; $( '<legend>') .text( "Chips" ) .appendTo( chip_field ) ; $( '<div id="select_div" />' ) .appendTo( chip_field ) ; $( '<select name="chip_sel" id="chip_sel">') .appendTo( select_div ) ; $( '<div id="control_div" />' ) .text( ' Include Control?: ' ) .appendTo( chip_field ) ; $( '<input type="checkbox" />' ) .attr('id',"control") .attr('name',"control") .val("control") .prependTo( control_div ) ; $( '<div id="submit_div" />' ) .appendTo( chip_field ) ; $( '<div class="button" />' ) .text( 'Choose Chip' ) .appendTo( submit_div ) .click( function () { apr.write_chip() ; } ) ; // Fill the Select var d_list = [] ; for ( var i in data ) { d_list.push( i ) } d_list = d_list.sort() ; for ( var d in d_list ) { var i = d_list[ d ] ; $( '<option/>') .text( data[i].name ) .val( i ) .appendTo( chip_sel ) ; } } , 'jsonp' ) ;
This is some live Javascript I wrote. It uses jQuery, because if you don't use a framework of some sort to handle then differences between browsers, you are asking for trouble, and I've since discovered some ways to do
append
s better, but this is exactly the big block of ugly stuff that I hated with CGI and made me pledge my babies to Template Toolkit.
So, what I'm in desperate need for is Template.js to go with Template.pm. Or the like. I am sure that this is not just my problem. I am sure that other people have hit this problem and created a solution. Can anybody point to a good solution?
2012/07/19
We can Shoot Mosquitos OUT OF THE AIR with Lasers!
The laser here was pulled from a DVD player, if I remember right.
It is aimed by an older PC, using NVIDIA's CUDA technology, which turns the GPU you're using to get lots of frames of 3D acceleration in your FPS games into a gob of massively parallel processors. This technology is being looked at for places where mosquitoes contribute to the problem with Malaria.
We're solving Malaria by blasting insects out of the sky with lasers aimed by video-game technology. We live in the future.
Labels:
lasers,
parallel computing,
we live in the future
2012/07/09
Planning My Lamp Project, with Pictures
Have I gone on about my lighting plan? No?
It connects a few of my interests and plans.
It connects a few of my interests and plans.
- I'm starting to become a morning person, which gets a bit hard during the winter, when sunrise is several hours away when I get up. Darkness is important for serotonin is important for sleep, but lightness is important for waking up. But sunlight alarm clocks are both expensive and a single-tasker in my mind. Multitasking might be bad for people's heads, but to my mind (and Alton Brown's) our tools should be multitaskers.
- The Android@Home talk at Google I/O 2011 really inspires me, too.
- The key to the sunlight lamp is the fade of it. It strikes me that jarring changes from dark to light would not be as good for waking up well as a gentle increase of light. Like sunrise.
- I'm learning about the Arduino and electronics in general and want to develop those skills more. I'm also a programmer, so these things I build, I'd ultimately want to be able to control via web interface and/or crontab.
- I like torchiere lamps, the kind that bounce light off the ceiling, but the one I still have is a halogen lamp, and the problem with halogen lamps is that they get crazy crazy hot, and my current one is either broken or has a burned-out bulb. I'd rather replace it.
- The means I know so far to control the dimming of lights is phase width multiplexing, which means turning on the LED for a number of milliseconds and then turning it off for another number of milliseconds to make it seem like it's dim, but you know? There exists an entire industry which involves itself with creating of light from electricity, and I'd rather work with that and involve the greatest amount of industry standard and the smallest possible amount of individual invention.
So, I went searching in Menards on Sunday, and I found a few things. There's a torchiere lamp that's $21 and a wall switch that'll dim CF bulbs for $17. (I'm going to have to live with a lamp with a hacked wall switch on it. I'll live.) The CF is $7, but it'll pay for itself over time. The one-gang outlet box will be < $1. Somehow, I'll have to mount it, but I can dream about that later. I'll need to get two switches, I think. One to make work and one to tear down and connect the Arduino to. That makes it $21 + $17 + $17 + 7, which brings us to ~$60. Before the cost of an Arduino. And I'll have to get a shield
Thing is, I get something like this $7 switch and I won't get the graceful increase or the control, but I get something I know works. Maybe I should think this through some.
Petdance says if you have SELECT * in your code, you have a bug
Or, he retweeted it. I think. He knows where to yell at me if I got that wrong.
I don't really agree, except maybe the memory hit when you get tons more data than you expected or need, but the case I'm talking about here is a structured database dump. I'm proud of this query, and I'll expand on it.
I don't really agree, except maybe the memory hit when you get tons more data than you expected or need, but the case I'm talking about here is a structured database dump. I'm proud of this query, and I'll expand on it.
SELECT * FROM sequence_sample LEFT JOIN accessions ON sequence_sample.accession_id = accessions.accession_id LEFT JOIN requests ON accessions.request_id = requests.request_id WHERE run_id = ?
A sample is an accession, except that a sample is an accession associated with a run, and that accession can be associated with many runs but only one request. I could see adding several joins to bring in controlled vocabularies, where, for example, the library types come in.
I've worked with SQL for a while, but only now am I integrating the joy of joins. I can thank Coding Horror for his excellent explanation on what the different joins mean, and Learning SQL for the use of ON to specify the JOIN joins to distinguish it from WHERE which brings in the unique constraints.
2012/06/22
Everything Is Preceeding As Planned. Excellent! (Webcam hack)
I was just given this swing-arm desk lamp/magnifying glass.
You might ask yourself, "Why does Dave need a desk lamp/magnifying glass?"
In all honesty, I don't. Part of the requirements of this gift is that I return the magnifying glass when done.
What I need is the long arm.
What I want to do is replace the lamp part with a webcam, so I can move it around, set it up in a good angle if I'm doing a Google+ Hangout, or set up software to take a shot every few minutes when I'm doing a project, so I might blog it or make it an Instructable or whatever. (If I could do it over again, I'd blog the heck out of rewiring my Tele.)
I was inspired by this Instructable (linked from this Lifehacker post) but I'm thinking I have to do something better with the mount than a ball of Sugru (not that Sugru isn't magic). Thing is, I'm not sure what. A big part of it will have to rely on what sort of webcam I get to stick on the end of this. I have two cameras on eBay I'm following, but I don't know if I'll go for one or the other.
In other hacking news, I have an Easy button. I now need two things to create my one-button keyboard to handle my Unifying-vs-KVM issue: a Teensy microcontroller and the knowledge of how to send a Scroll Lock character in Arduino. One of those is only $16 away. The other? Dunno.
In barely-related hacking news, I've recently found a great thing. Ever heard of X10 home automation modules? At the most atomic, they're boxes you can plug a thing into and turn it on and off by your whim, being either via computer or via a remote. Their problem, by my experience, was that they talk over power, and this meant that you had to segment your stuff all over. I never got it working to the point I was happy with it. Imagine the same sort of thing, communicating over your WiFi network. Belkin calls it WeMo. I call it magic. There's also a motion-sensor module. Even better, they are connected to the magic of IFTTT, which makes scripting things so easy! Setting triggers on motion to do things like tweet or log to Evernote or even turn on a light with WeMo are such a good idea. I don't know if I can get conditionals, like
But, ultimately, I'm more interested in shades of gray than black and white. Or rather, variations of brightness over on and off. I have just found that there are dimmable compact fluorescent bulbs and dimmer switches for use with compact fluorescents. Now, if I could replace/augment the actual switch in that with a Netduino or something, I could make a lamp that's entirely controllable online. CF dimmer switches are $20, so I'd roll up my lamp first, have the non-networked dimmer implementation going, then work on tearing apart a second dimmer switch to Arduino-connect it. But that strikes me as the future.
You might ask yourself, "Why does Dave need a desk lamp/magnifying glass?"
In all honesty, I don't. Part of the requirements of this gift is that I return the magnifying glass when done.
What I need is the long arm.
What I want to do is replace the lamp part with a webcam, so I can move it around, set it up in a good angle if I'm doing a Google+ Hangout, or set up software to take a shot every few minutes when I'm doing a project, so I might blog it or make it an Instructable or whatever. (If I could do it over again, I'd blog the heck out of rewiring my Tele.)
I was inspired by this Instructable (linked from this Lifehacker post) but I'm thinking I have to do something better with the mount than a ball of Sugru (not that Sugru isn't magic). Thing is, I'm not sure what. A big part of it will have to rely on what sort of webcam I get to stick on the end of this. I have two cameras on eBay I'm following, but I don't know if I'll go for one or the other.
In other hacking news, I have an Easy button. I now need two things to create my one-button keyboard to handle my Unifying-vs-KVM issue: a Teensy microcontroller and the knowledge of how to send a Scroll Lock character in Arduino. One of those is only $16 away. The other? Dunno.
In barely-related hacking news, I've recently found a great thing. Ever heard of X10 home automation modules? At the most atomic, they're boxes you can plug a thing into and turn it on and off by your whim, being either via computer or via a remote. Their problem, by my experience, was that they talk over power, and this meant that you had to segment your stuff all over. I never got it working to the point I was happy with it. Imagine the same sort of thing, communicating over your WiFi network. Belkin calls it WeMo. I call it magic. There's also a motion-sensor module. Even better, they are connected to the magic of IFTTT, which makes scripting things so easy! Setting triggers on motion to do things like tweet or log to Evernote or even turn on a light with WeMo are such a good idea. I don't know if I can get conditionals, like
if (motion && time > 6 && time < 23 ) { turn_on( light ) }
, but I'd like to give that a try.But, ultimately, I'm more interested in shades of gray than black and white. Or rather, variations of brightness over on and off. I have just found that there are dimmable compact fluorescent bulbs and dimmer switches for use with compact fluorescents. Now, if I could replace/augment the actual switch in that with a Netduino or something, I could make a lamp that's entirely controllable online. CF dimmer switches are $20, so I'd roll up my lamp first, have the non-networked dimmer implementation going, then work on tearing apart a second dimmer switch to Arduino-connect it. But that strikes me as the future.
Labels:
hacks,
hardware,
mad science,
we live in the future,
webcam
2012/06/21
Addition to my EDC: FitBit Ultra
Yesterday, I received a FitBit Ultra as a gift, and today, I've taken a walk and a run with it. I let it charge overnight, so I don't have any of the sleep data yet.
There is an API. I expect to write up my experiences with that API here, put my code on Github, and publish the results on Posterous.
There is an API. I expect to write up my experiences with that API here, put my code on Github, and publish the results on Posterous.
2012/06/18
Gotta Ask: Javascript Library Development
By High Performance Web Sites, you should be putting all your Javascript into one file so there's one download, then minifying it and gzipping it to make that download as small as possible.
Does anyone actually do this? And if so, what tools do you use to manage your workflow? How do you test? Is there already prior art here?
Does anyone actually do this? And if so, what tools do you use to manage your workflow? How do you test? Is there already prior art here?
I Like What I Did Here
I'm writing some Javascript to work this user interface I'm making. By one suggestion, you're supposed to work out the UI, set up the backend DB, and once both are as you like 'em, work on connecting them./
I am not quite there yet, but I'm close. I have n similar select boxes and n entries for each, and I would like each one to be unique, so, select box i has option i selected by default. The user can override if necessary, but in most cases, that should not be necessary.
I'm pulling each of the options from the database, so this is fairly dynamic. This is what I came up with.
// --------- --------- --------- --------- --------- --------- --------- // fill the "i5" select boxes, and fit in order // --------- --------- --------- --------- --------- --------- --------- pr.fill_i5s = function ( assay ) { $.get( pr.url , function( data ) { var assay_barcodes = data.assay_barcodes ; var assay_data = assay_barcodes[assay].data ; var i5_list = assay_data.i5 ; $( 'select.i5' ).each( function () { var id = $( this ).attr( "id" ) ; var id_array = id.split("") ; var id_letter = id_array[3] ; $( '#' + id ).html( '' ) ; for ( i in i5_list ) { var i5 = i5_list[i] ; var i5_name = i5.name ; var i5_bases = i5.bases ; var i5_array = i5_name.split("") ; var i5_num = i5_array[3] ; if ( pr.check_i5( id_letter, i5_num ) ) { $( '<option/>' ) .text( i5_name ) .val( i5_name ) .attr( 'selected' , 'selected' ) .appendTo( '#' + id ) ; } else { $( '<option/>' ) .text( i5_name ) .val( i5_name ) .appendTo( '#' + id ) ; } } } ) ; } , 'json' ) ; } ; // --------- --------- --------- --------- --------- --------- --------- // function to move checking into a subroutine, so that i5s flow // automatically // --------- --------- --------- --------- --------- --------- --------- pr.check_i5 = function ( position , barcode ) { if ( position == 'a' && barcode == '1' ) { return true ; } if ( position == 'b' && barcode == '2' ) { return true ; } if ( position == 'c' && barcode == '3' ) { return true ; } if ( position == 'd' && barcode == '4' ) { return true ; } if ( position == 'e' && barcode == '5' ) { return true ; } if ( position == 'f' && barcode == '6' ) { return true ; } if ( position == 'g' && barcode == '7' ) { return true ; } if ( position == 'h' && barcode == '8' ) { return true ; } return( false ) ; } ;
I perhaps should use a case statement, but honestly, I haven't used one of those in production code in years, and I'm not sure that you can case off two variables. I suspect I should use === for strong typing, but I can always change that. I know that, if I had ands and ors like this in the center of the first subroutine, it would be ugly. As is, I like this.
2012/06/06
What I want in Google Voice
I found a post in my Google Reader where a person listed his wish list, pointing to a Pocketables post called "Here's my Google Voice wishlist".
I honestly just have one point, and if I didn't work in a place with no cellphone access, I wouldn't have that one.
I want my Android phone to be able to make and receive Google Voice calls over WiFi. I can do that on my laptop. I could do it with Skype, but I don't have a Skype-In number and if I did, that still wouldn't be the number I give out everywhere. This would be the real lifesaver for me.
I get "Integration beyond Sprint" but as I use Sprint, it isn't a crucial issue for me. I barely use SMS and MMS, as it's hamstrung email, but I get why some would want GVoice to do MMS as well, but it isn't a seller to me.
I scratch that. Being able to upload my voicemail greeting would be wonderful, too.
I honestly just have one point, and if I didn't work in a place with no cellphone access, I wouldn't have that one.
I want my Android phone to be able to make and receive Google Voice calls over WiFi. I can do that on my laptop. I could do it with Skype, but I don't have a Skype-In number and if I did, that still wouldn't be the number I give out everywhere. This would be the real lifesaver for me.
I get "Integration beyond Sprint" but as I use Sprint, it isn't a crucial issue for me. I barely use SMS and MMS, as it's hamstrung email, but I get why some would want GVoice to do MMS as well, but it isn't a seller to me.
I scratch that. Being able to upload my voicemail greeting would be wonderful, too.
2012/06/05
Addendum to Yak Shaving and such
First, let it be known that my issue with minification seemed to be a bug in the code being run through it, and making my code more JSLint-compliant (not yet compliant, but more so) solved that issue.
But it was suggested that I should use JavaScript::Minifier::XS, and that works, too. Plus, this is a library that's on CPAN, which is somewhat a stamp of quality and portability, so I'm sure I'll work with that. I suppose I should head-to-head the compression and JSLint of both minifiers, but that can happen later.
But it was suggested that I should use JavaScript::Minifier::XS, and that works, too. Plus, this is a library that's on CPAN, which is somewhat a stamp of quality and portability, so I'm sure I'll work with that. I suppose I should head-to-head the compression and JSLint of both minifiers, but that can happen later.
Do I Get This? (A Rant on Nutrition)
This blog is about ranting, not technology. Since I work in technology, most of my rants are tech rants, so it is easily mistaken for a tech blog, but I reserve the right to rant about my health, as I have done recently.
I have lost a fair amount of weight, to the point that I'm a four-year-old's weight* away from my college (first time) weight. People ask me what I have done to lose the weight. First and foremost, I've started to eat more.
Specifically, I have started to eat breakfast, lunch and dinner. Before, my tendency was to wake up, go to work or school, do that through the day, go home, and have my first meal at the day at dinner. Sometimes, this was after 10pm. Of course, when I was there, I was famished and would eat everything, quickly. Of course, I'm exhausted, so soon after I ate, I slept. From what I understand, this is about as close to shutting down your metabolism as you can get.
Recently, I've started to keep oatmeal in my desk and frozen meals in the office freezer. I get to the office and pour my coffee while I nuke my oatmeal, and eat while I start my day. Since this is after I get to the office at 9am, this is usually about 3 hours after Tim Ferriss would suggest I do it (and much less protein), but I've been running on exhaustion, using caffeine to keep me moving, for long enough that moves I can take that keep me from feeling groggy are fine, and right now, being awake in my bed for an hour or more before my feet touch the floor is fine. I'll have a protein-rich breakfast in the office before I'll jump up at 6 am to cook eggs or something, but I could see both happening.
I have lost a fair amount of weight, to the point that I'm a four-year-old's weight* away from my college (first time) weight. People ask me what I have done to lose the weight. First and foremost, I've started to eat more.
Specifically, I have started to eat breakfast, lunch and dinner. Before, my tendency was to wake up, go to work or school, do that through the day, go home, and have my first meal at the day at dinner. Sometimes, this was after 10pm. Of course, when I was there, I was famished and would eat everything, quickly. Of course, I'm exhausted, so soon after I ate, I slept. From what I understand, this is about as close to shutting down your metabolism as you can get.
Recently, I've started to keep oatmeal in my desk and frozen meals in the office freezer. I get to the office and pour my coffee while I nuke my oatmeal, and eat while I start my day. Since this is after I get to the office at 9am, this is usually about 3 hours after Tim Ferriss would suggest I do it (and much less protein), but I've been running on exhaustion, using caffeine to keep me moving, for long enough that moves I can take that keep me from feeling groggy are fine, and right now, being awake in my bed for an hour or more before my feet touch the floor is fine. I'll have a protein-rich breakfast in the office before I'll jump up at 6 am to cook eggs or something, but I could see both happening.
Today's purchase is two boxes at my local supermarket. One is the 10-to-a-box apples and cinnamon oatmeal I normally get, and one is "Active Lifestyle" Chai Apple, promising to support "weight control", at 8-to-a box for the same price. The packages are bigger, and they suck up more water than my normal breakfast, but they are comparable.
Aren't they? There's a few percentage points here and there, but by and large, they are similar. I guess the bit thing is that the Active Lifestyle oatmeal has more fiber.
The other on-the-box claim is no cholesterol, and that's shared by both boxes of oatmeal.
My take on it is that, beyond the fiber, it's pretty much a wash between these two, but as long as I like the taste of apple oatmeal (and, in case it isn't clear, I love the taste of apple oatmeal) I'm fine to choose between these two. Is my analysis of this correct?
* I recall from my children's youth that they believe children should weigh 40 lbs and be 40" tall at 4 years. That was referred to as being "square". So, I'm within a square child of the weight where I thought I was fat in college. Strange how the metrics change over time.
2012/06/04
My Current Project
Image by LiminaMike |
I'm working on developing something in an MVC, and the specifics of it involve Javascript to handle the UI of it. As I'm expecting to have lots of unrelated Javascript libraries, I'd rather have one call for my stuff than several, so I'm working on a tool that
- Allows me to write and test code both in individual library context and related to the whole code base
- Automates the steps to get to combined, minified and gzipped code, as suggested in Steve Souders' High Performance Web Sites.
I have ugly code that I want to refactor — specifically, I have to programs (one for the minification and one for the test generation) when they could be easily and preferably turned into one — but it is functional. Except maybe not.
I think I'll have to get the admin to change the website config to announce gzipped files before I can get the test code going. I'm content to have that wait.
The bigger problem is minification. I found a Perl implementation of a Javascript packer called Packer, and my thought was "Yay! No more worrying about getting YUI-Compressor to work!" But, so far, it seems to be introducing errors. A working combined Javascript library fails to work when minified. So, I either look at Packer's internals or YUI-Compressor's internals.
Or, as I'm going to do, figure that combining is good enough for now, back burner the rest, and stop shaving this yak.
I think I'll have to get the admin to change the website config to announce gzipped files before I can get the test code going. I'm content to have that wait.
The bigger problem is minification. I found a Perl implementation of a Javascript packer called Packer, and my thought was "Yay! No more worrying about getting YUI-Compressor to work!" But, so far, it seems to be introducing errors. A working combined Javascript library fails to work when minified. So, I either look at Packer's internals or YUI-Compressor's internals.
Or, as I'm going to do, figure that combining is good enough for now, back burner the rest, and stop shaving this yak.
2012/06/01
My Caffeine Addiction
To the right is a picture of me in my office in 2009. I took it and like it because it has me with my preferred drink, Diet Coke.
In the 80s, I drank Mountain Dew and Mello Yello on occasion, and in the years since, I've put energy drinks and the like to my lips, but more often than not, when given a choice, I would go for the old standard.
Of all the addictive substances out there, caffeine addiction is the least harmful and the most socially accepted. You wouldn't expect a bar or a bong or a communal crack-pipe to be at the center of an office, but there is a coffeemaker. For some workplaces, an always-full cola fridge is one of the perks. Here's the Oatmeal on how coffee works in historical, economical and physical senses, here's C.G.P Grey's video on "the Greatest Addiction Ever", and here's Cracked on how caffeine gives you super-powers. Everybody loves caffeine.
Geeks especially love caffeine. Jolt was the geek drink with the phrase "All the sugar and twice the caffeine". Drinks have been judged by relative levels of caffeine. ThinkGeek has a category of Caffeine and Edibles which includes energy drinks, caffeinated mints and gum, and even caffeinated body wash. I don't know that caffeine is absorbed through the skin, but I understand the attraction. I wondered often when I was a Comp Sci student why more geeks take the next step from caffeine worship and just become speed freaks.
Last year, I decided that I've heard enough about caffeine to think, "Hey, I don't believe any of the scurrilous things they're saying about the magic bean, but I can't really say anything about it without trying to live without." Also, I was noticing headaches on Sunday, which seemed to come from not drinking any coffee or soda on Saturdays. So, I decided that I would have a month-long caffeine fast during the month of May.
May 1 was a Sunday, and I play guitar at church, and we talk in the church cafe during first service, and I always get a cappuccino, and I didn't think "no caffeine" until I was half done.
May 2 was the day we returned a rental car we got because of a car accident, and before I dropped it off, I stopped by McDonalds for breakfast, and what do I always get with my egg-burger every time I go to McDonalds for breakfast? A large Diet Coke. And I was again half done with the beverage before I said "Hey, wait."
This really put in mind what we mean by a habit. An addiction is when you mentally or physically need something to function, but a habit is an indication of behavior, what you do without thinking about it. I clearly did not think about what my beverage of choice was. Any thought about what I should be drinking came halfway into the process of drinking the beverage.
May 3, I remembered. I started the fast in earnest. I drank no caffeine. I felt okay.
May 4, in the midst of the horror, when I turned off my office lights and turned down the brightness of my monitors so my eyes would stop screaming, and filled my trash box with tissues filled with mucus and tears while breathing deeply in hopes that the cold air will still my nausea, my co-worker looked over and said "If you have the flu, you should just go home."
This is where it struck me.
This is where it struck me that regular doses of caffeine had left me reliant on caffeine, and when I don't imbibe it, my brain explodes.
This is the point where I decided to cut it out when I could. And I discovered that, to some extent, I can't get going with programming — my work, my hobby, my love — without juicing it up first. I wasn't sure and I'm still not whether this should be considered addiction or habit, but I recognized it as something, so, I decided to go by the rules of coffee at work but nothing after 5pm, and when I took vacation over Christmas, I went cold turkey again, but with few ill effects because I wasn't riding on a near-constant cloud of stimulation.
I'm not saying that everyone should clean up like I did. But you should consider. At the very least, you should keep some headroom so you can jolt up if you need to.
In the 80s, I drank Mountain Dew and Mello Yello on occasion, and in the years since, I've put energy drinks and the like to my lips, but more often than not, when given a choice, I would go for the old standard.
Of all the addictive substances out there, caffeine addiction is the least harmful and the most socially accepted. You wouldn't expect a bar or a bong or a communal crack-pipe to be at the center of an office, but there is a coffeemaker. For some workplaces, an always-full cola fridge is one of the perks. Here's the Oatmeal on how coffee works in historical, economical and physical senses, here's C.G.P Grey's video on "the Greatest Addiction Ever", and here's Cracked on how caffeine gives you super-powers. Everybody loves caffeine.
Geeks especially love caffeine. Jolt was the geek drink with the phrase "All the sugar and twice the caffeine". Drinks have been judged by relative levels of caffeine. ThinkGeek has a category of Caffeine and Edibles which includes energy drinks, caffeinated mints and gum, and even caffeinated body wash. I don't know that caffeine is absorbed through the skin, but I understand the attraction. I wondered often when I was a Comp Sci student why more geeks take the next step from caffeine worship and just become speed freaks.
Last year, I decided that I've heard enough about caffeine to think, "Hey, I don't believe any of the scurrilous things they're saying about the magic bean, but I can't really say anything about it without trying to live without." Also, I was noticing headaches on Sunday, which seemed to come from not drinking any coffee or soda on Saturdays. So, I decided that I would have a month-long caffeine fast during the month of May.
May 1 was a Sunday, and I play guitar at church, and we talk in the church cafe during first service, and I always get a cappuccino, and I didn't think "no caffeine" until I was half done.
May 2 was the day we returned a rental car we got because of a car accident, and before I dropped it off, I stopped by McDonalds for breakfast, and what do I always get with my egg-burger every time I go to McDonalds for breakfast? A large Diet Coke. And I was again half done with the beverage before I said "Hey, wait."
This really put in mind what we mean by a habit. An addiction is when you mentally or physically need something to function, but a habit is an indication of behavior, what you do without thinking about it. I clearly did not think about what my beverage of choice was. Any thought about what I should be drinking came halfway into the process of drinking the beverage.
May 3, I remembered. I started the fast in earnest. I drank no caffeine. I felt okay.
May 4, in the midst of the horror, when I turned off my office lights and turned down the brightness of my monitors so my eyes would stop screaming, and filled my trash box with tissues filled with mucus and tears while breathing deeply in hopes that the cold air will still my nausea, my co-worker looked over and said "If you have the flu, you should just go home."
This is where it struck me.
This is where it struck me that regular doses of caffeine had left me reliant on caffeine, and when I don't imbibe it, my brain explodes.
This is the point where I decided to cut it out when I could. And I discovered that, to some extent, I can't get going with programming — my work, my hobby, my love — without juicing it up first. I wasn't sure and I'm still not whether this should be considered addiction or habit, but I recognized it as something, so, I decided to go by the rules of coffee at work but nothing after 5pm, and when I took vacation over Christmas, I went cold turkey again, but with few ill effects because I wasn't riding on a near-constant cloud of stimulation.
I'm not saying that everyone should clean up like I did. But you should consider. At the very least, you should keep some headroom so you can jolt up if you need to.
Subscribe to:
Posts (Atom)