Retro - It’s all about the donuts

Kids are amazing little buggers, especially when they are your amazing little buggers. One of the most amazing things about having kids is that you can actually learn from them. Yeah, imagine that. Something I have learned from our boys is that it really is the little things in life that make it all worth while. Take for example, donuts. Last summer, we flew from our humble little home in northwest Arkansas to Seattle to visit the wife’s sister and boyfriend, and we took the boys. We stayed in this crappy little motel downtown right near the Space Needle (location, location, location). It was cheap, and we figured “Hey, all we’re going to do is sleep there, right. How bad can it be?” When we got there, the little one was asleep in the car so the wife and the big one went in to “check it out”. Upon return, the wife said that “…it’s not that bad”. I later realized that it was one room barely large enough to hold the king size bed all four of us were to sleep in for a week. Oh, and the bathroom only had a shower, no tub to give the boys a bath in (although they found showers to be quite a novelty that week). Now, if I was going to go back to Seattle, I probably would choose another place to stay. Granted, it wasn’t that bad; it was clean, the staff was friendly and helpful, and did I mention the donuts? No? Well, if you asked our boys if they wanted to go to Seattle tomorrow, they would INSIST on staying in that hotel. Why, you ask? Well, the donuts, of course. Every morning the staff would put out this huge spread of donuts, pastries, muffins, and bagels, and once the boys found out about this, they would shoot out of bed every, yes every morning and want to go get donuts. At 6 AM. So we would go to the lobby, my wife or myself barely awake, the boys still in their pajamas, and get donuts. Lots of donuts. Way too many donuts. About an hour later, our room looked like a donut factory where some sort of explosion had taken place. Sprinkles here, frosting there, donut detritus everywhere (hey, that rhymed). Yeah, if we go back to Seattle with the boys, I think we all know where we will be staying.

Mapping point locations with Python and Microsoft Live Search Maps

This article was first published in the February 2008 issue of Python Magazine . It is being reproduced here with the permission of Marco Tabini and Associates .

Requirements

Python 2.4+
pyExcelerator module (http://sourceforge.net/projects/pyexcelerator/ )
Anthony Tuininga’s ceODBC module (http://sourceforge.net/html/ceODBC.html )
John Machin’s xlrd module (http://www.lexicon.net/sjmachin/xlrd.htm )
Michael Foord’s cgiutils module (http://www.voidspace.org.uk/python/cgiutils.html )

Lets face it, using Python, we can pull data from virtually anywhere in the corporate enterprise - databases, text files, or other documents. But how can we easily visualize data that has place associated with it? Well, we turn to Python and the API of a popular web-mapping application, that’s how.

Read more »

Codeviewer plugin test

Back a few years ago, I used a code syntax highlighter called Code Viewer that was created by Aaron Schaefer at Elastic Dog. That has since been taken over by Håkan Carlström. I spent too many hours this weekend getting this plugin setup to parse Python source code. It uses GeSHi to highlight the code syntax, and I had to hack up the GeSHi CSS and my own CSS to get the Python source code to look like I wanted, but it’s about there. I highly recommend this plugin if you are looking to highlight source code of virtually any modern language. The coolest part of it is that it links to a source code file and you just point to that file, you don’t have to include the code in the post. Below is a sampling of the output, with my own CSS styling applied.

  1. def grabNewImages( self ):
  2. """ Recurses thru directories and looks for images to upload. I only want to upload my ‘5-star’ images, so we scan the IPTC tags for ‘r5′, my way of tagging my pics I really like (usually get prints of r5s) """
  3. images = []
  4. for dirpath, dirnames, filenames in os.walk(IMAGE_DIR):
  5. for f in filenames :
  6. # Grab IPTC keywords
  7. info = IPTCInfo(os.path.join(dirpath, f))
  8. # Is it a 5-star photo?
  9. if ‘r5′ in info.keywords:
  10. print ‘File to upload:’,os.path.join(dirpath, f)
  11. ext = f.lower().split(‘.’)[-1]
  12. if ( ext == ‘jpg’ or ext == ‘gif’ or ext == ‘png’ ):
  13. images.append( os.path.normpath( dirpath + ‘/’ + f ) )
  14. images.sort()
  15. return images

Windows on my Mac with VMWare Fusion

Windows on my MacI’ve been running Windows XP Pro on my MacBook Pro for a few weeks now, and I have to say, I’m quite pleased. I have XP installed as a BootCamp partition, and at first, I booted into XP to do any GIS work. Lately, however, I’ve been working strictly in the VM, and ArcGIS works like a champ, a little bit slower, sure; but still quite reliable and stable. For the VM, I have allocated 1GB of RAM (I’m maxed out at 2GB, I have a first generation MBP) and both processors. I installed a Ubuntu Gutsy VM the other night, and that is one sweet little package. I’ll definitely be playing around with that some more soon.

Apple support rocks; wait, maybe not; OK they do

My battery on my almost 2-year old Macbook Pro finally crapped out, as pretty much all Apple batteries do I’m finding out. So I did some research and found out there was a battery recall for Macbook Pro batteries, but mine didn’t qualify according to the serial number, oh well. I then went for the advice of my local Apple retailer, who informed me that I might be able to talk Apple into giving me a new battery, based on some of the poor statistics I had gleaned from the System Analyzer about the battery - basically it was a bad battery. Sunday night I called Apple support (for the first time ever), answered a few simple questions to the automated voice recognition thing, and within about 3 minutes, was on the phone with an actual human being in the United States. Holy crap - Apple support rocks. I plead my case, she tells me that it sounds like I have a bad battery, but then tells me that my battery, based on the serial number, does not qualify for the battery replacement program. Sorry, a battery is considered a consumable item after one year. I say no way, its charge capacity is too low, it has only had one-half of its lifetime charge cycles, and you admit it’s bad. I want a new one (maybe they don’t rock after all). I hold (while she presumably goes and talks to an engineer about the matter) and then I’m told that they will replace it. They do rock! Monday I try to get a replacement from my local retailer, but they are out of stock, so I call Apple back, wait for ZERO minutes, only to get the same tech that helped me the day before - cool! She says they will have a battery out for me in no more than 2 business days; this was at noon yesterday. I come home for lunch today and find the battery waiting for me - about 24 hours after the order was put in. Not bad, eh? Apple support rocks.

I’m back!

After a two-plus year hiatus, I’m back on the Web. I decided it was time to start playing around on the Web again, and there are some Web-mapping things I’d like to toy around with, so I figured, what the hell, why not go with another WordPress install? So far so good; I was even able to hack up the MySQL dump file from my last blog (greasyvalley.com) and load those posts into this database (although there is ALOT of cleanup that needs to be done on those old posts). WordPress is better than ever.

IPython - first thoughts

After I got back from the ESRI PUG a few weeks ago, I installed and started playing around with IPython. I gave a talk at the PUG, and afterwards met a guy who told me I had to try it. Boy was he right. IPython is worth its weight in gold just on the surface for its color-coding of text and history access (hit the up arrow key to get the previous commands, like at the DOS prompt). Another gem is that you can CTRL-C code from your editor and CTRL-V it into the IPython prompt - nice. I plan on playing around with this some more, and need to install it on my Mac as well - after the impending Leopard upgrade I need to do.

Concatenation and logic in SQL calls

I’ve been doing alot of database design lately, although nothing too fancy, just some personal Access databases. However, I have run across some cool stuff that really got me excited (as pathetic as that may seem): concatenating fields and using logic in SQL calls. The only thing that aggravates me is that I’ve went this long without knowing of these little jewels. The concatenation is pretty straightforward; take field A and concatenate field B to it, then alias it as field C, like so:

SELECT tableA.fieldA & " " & tableB.fieldB AS fieldC

which gives you the data in fieldA concatenated to fieldB, separated by a space, as field C.

The logic is even better. I was importing the data from Access to Excel, so I could insert the Excel sheets into a map, all prettied up with lots of formatting. It worked great, except one field in my database contains null values, and when I imported that field from Access, Excel put zeros in place of the null values. This was unacceptable. So I figured that with the IIf function in my SQL call, I could get only the records from the field that were not null. Problem solved. In the end, the call looked something like this:

SELECT tblWell.Well_Name & ' ' & tblWell.Well_No AS ShortWellName, tblWell.SpudDate, tblWell.Status, tblCompletion.Frac, tblGeology.RHOB_Pay_T, tblGeology.Shale_Thick, tblProduction.Online_Date, IIf(tblProduction.Rate<>‘ ‘,tblProduction.Rate & ” on ” & (Format(tblProduction.Rate_Date,”m/d/yyyy”))) AS CurrProd
FROM (((tblWell LEFT JOIN tblCompletion ON tblWell.ID = tblCompletion.ID) LEFT JOIN tblGeology ON tblWell.ID = tblGeology.ID) INNER JOIN tblProduction ON tblWell.ID = tblProduction.ID) INNER JOIN tblFieldNames ON tblWell.FieldNo = tblFieldNames.ID
WHERE (((twlWell.Status)<>‘Proposed’)) AND (((tblFieldNames.FieldName)=’Whatever Field’))
ORDER BY SpudDate ASC;

Whew.

Conditional SQL

Conditional SQL?? How have I went this long with out knowing about this? The power of SQL amazes me every day.

WordPress plugin: Conversation Viewer

First off, I have to say that I can really only take credit for about 10% of the code in this plugin, if that. I really can’t even take credit for the idea. And let me also come out and say that I am in no way any sort of PHP genius. I’m sure there are things that could be done better in this plugin, but this works for me. So, with all that out of the way, the idea for this came from Dunstan, and the majority of the code came from Aaron Schaefer’s Code Viewer plugin.
Read more »

« Previous PageNext Page »