Back Up To Speed

February 09, 2013

I'm happy to report that my cable modem was replaced this morning. Running a speed test on the old one produced numbers like this:

The new one is considerably better and actually provides the bandwidth I'm paying for. Which is nice.

It took the service tech an hour or so of other troubleshooting before he replaced the modem. Everything I've heard indicates these cable modems being flaky and often need to be replaced. Cable companies could probably cut a fair chunk of time out of their service call time by switching out the cable modems earlier in the process. Especially when the customer (me in this case) is a techie and has already checked everything else.


This is not 15Mbps

February 06, 2013

Everyone in my community gets basic cable and internet through the home owners association. The internet provider offers upgrades to boost your speed from the base 1.5 Mbps to 10, 15 or 20, depending on how much you're willing to pay. I'm trying the 15 Mpbs level, but it does not work as advertised. Here's some typical results from speedtest.net.

That 2.89 number in the middle is the one that's supposed to be ~15. After spending a fruitless hour on the phone with the support guy, a technician is now scheduled to come out later in the week. I would have dealt with this earlier, but I knew I'd have to burn time getting through the first level of support. Sadly, we don't yet live in a world where techies can utter the word "Shibboleet" and immediately get past the entry level support team.

(Other techies will enjoy the fact that I also did a little prep work by jacking directly into the cable modem with a Cat 6 cable. It still took four or five times to confirm to the support guy that I was, in fast, sure that I wasn't going through a router.)


Nice Code Formatting Conversion On Python Site

January 28, 2013

The documentation on the official Python site site has a nice little design feature in its code examples. Each one starts out formatted for Python's "interactive interpreter" and show the expected results. For example, this snippet from the Output Formatting section:

If you click the little "ยป>" symbol in the upper left corner, the code instantly jumps to a format suitable for being run in a file. The expected out also disappears making the snippet ready to copy and paste directly into a file.

That's an incredibly useful feature. Very nicely done, Python doc crew.


Partially Picking Up Python with Head First Python

January 27, 2013

After a long run with BBEdit and then TextMate, I have switched to using Sublime Text as my primary text editor and development tool. Like any good geek, the first thing I want to do is to customize the app to my liking. Sublime Text lets you do this with plugins. A huge array are available along with the option to write your own. I, of course, want to write my own.

The programming language Sublime Text uses for plugins is called "Python". Named not after the snake, but the British comedy troupe Monty Python. I've never used the language before, but any language the encourages making demos referencing Dead Parrots and Silly Walks gets automatic bonus points.

There's a tremendous number of online resources available to learn any programming language you can imagine. Python is no exception. After a brief survey, I didn't find a stand out recommendation. So, I decided to give "Head First Python" a try. The book's stated audience is people who already know how to program in another language. This fits the type of book I was looking for. No need to cover the most basic of basics that are the same across languages.

The first half of the book is pretty good, doing a nice job of gently introducing the various concepts. The biggest criticism of this portion is that the book spends a lot of time on examples for the command line interpreter. That is, pieces of code that disappear as soon as you close the window. That's fine for single lines of code, but when larger blocks are called for that doesn't make sense. Also, assuming that the reader really does know how to program in another language, they will be wanting to write actual applications. Spending a lot of time in the interpreter is a waste.

I can't speak to the second half of the book. I bailed out in chapter 8 (of 11) when the book prompts for the installation of the Android Phone Software Development Kit. While I can appreciate teaching a language in a way that includes real life examples, this is a bridge too far. My goal is to get up to speed with Python as quick as possible. Not to spend time installing and messing around with an entirely new device and development platform.

My next step was to read through the Official Python Tutorial. I had taken a look at this before picking up Head First Python, but it's more of a reference than a tutorial. With the first half of the Head First book freshly in my head, the official tutorial made an excellent follow up. I wish the Head First book had stuck to its main topic, but the combination of its first half and the official tutorial has gotten me started.


Capturing Python Log Output In A Variable

January 27, 2013

While working on a Sublime Text plugin, I needed to capture logging output in a variable so I could display it easily. For once, Stack Overflow1 didn't have an immediate solution. After a couple hours of hacking around, I came up with the following which I hope saves others the hassle of having to build it themselves.

import logging
import io

### Create the logger
logger = logging.getLogger('basic_logger')
logger.setLevel(logging.DEBUG)

### Setup the console handler with a StringIO object
log_capture_string = io.StringIO()
ch = logging.StreamHandler(log_capture_string)
ch.setLevel(logging.DEBUG)

### Optionally add a formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)

### Add the console handler to the logger
logger.addHandler(ch)


### Send log messages. 
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')


### Pull the contents back into a string and close the stream
log_contents = log_capture_string.getvalue()
log_capture_string.close()

### Output as lower case to prove it worked. 
print(log_contents.lower())

Note that once you call '.close()', it's possible to run into problems if the same running process tries to call the function again.

This approach will work with external files too. If you assign the same logger (in this case 'basic_logger') it will output properly. For example, if you have an module in an external file called 'external_logger_test.py' with the content:

import logging

def log_test():

	logger = logging.getLogger('basic_logger')

	logger.warning('Log note from external file')

All you have to do is import it as usual in your main file (e.g. import external_logger_test) and then call the function:

external_logger_test.log_test()

Of course, you have to do this before you call the log_contents = log_capture_string.getvalue(). That's where the log data stops flowing.


Links and Notes

  1. Stack Overflow - Friend to developers around the world. Far and away the most useful development research site there is.

New Year's Sunrise

January 01, 2013

I woke up early this morning for no good reason, but decided to use the time productively. Since it's New Year's day, I figured a nice way to start things off would be to head to the beach for sunrise. So, I did just that and took some photos.

Personal comfort must often be sacrificed in the service of getting a shot. That proved to be the case today. In order to get the nice reflection off the wet sand, I had to position myself below the tide line. It wasn't too cold this morning, but it certainly wasn't what I would normally consider "beach weather".

I was shooting off a tripod which itself presented another photo opportunity. Here's the meta photo of a camera taking a photo.

The water only ever got up to my shins. I could have gone deeper without much problem. My tripod wouldn't have faired so well. Much farther and I'd have had to disassemble the thing to clean it. I wasn't quite up for that today. Incidentally, if you want to buy me a present, the Gitzo Ocean Traveler would be nice. It's designed for working on beaches and can be submerged. Of course, at two grand, it cost more than most peoples' cameras.


Trading Fours With Jaime

Posted: August 29, 2012 - Updated: December 31, 2012

I've known Dr. Jaime Wright since we were in the third grade. We both love music, but have different titles in our respective collections. We've decided to send each other four tracks each month that we think the other should have. This page will track the history of our exchanges. (You'll need Spotify if you want to listen in.)

Alan -> Jaime Jaime -> Alan
December 2012
The History

Jaime also picked "Sugarking" by Bob Schneider but it's not currently available in Spotify.


Gridlock - Photo for October 31, 2012

October 31, 2012

Work on Southbound 95 around Jacksonville will last beyond the heat death of the universe.


Go To Index Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106


© Alan W. Smith
RSS Feed