Latest Entries »

Learning Python 3 – Where to start

I’ve been working on learning Python lately and there is a boatload of good information out there that is scattered all over the Internet.  Luckily in the spirit of open source software, most of the information is free.  Some of it can be had in more convenient packaging for a low price alternatively.  Personally, my primary focus is Python 3.0 since that is the future and I don’t expect to be working on any legacy Python code before I learn Python much, much better.  By the time I get to that point of confidence I’m sure I’ll be familiar with the nuances of Python 2.6-2.7 though.  Python 2.7 is the last major release of the Python 2.0 series as of this writing.  The developers intend to do bug fixes for 2-5 more years but there will be no new features added.  If you insist on using 2.7 or 3.x is not available, you are not totally S.O.L. though.  There is a library called “future” that has many features from the newer series so you’ll be able to use them in your 2.x code.  Anyways, on with some of the resources…

Podcasts:

I’m heavy into podcasts since it’s something constructive I can listen to while cooking dinner, driving, etc.  There happen to be three great Python podcasts out there that I know of(if you know of any other current ones, let me know). Most of the resources that I am going to share with you below were parsed by me from listening to these podcasts.

Python 411 – The first one I checked out was Python 411.  This one is a one-man show but he does a great job keeping it interesting by interviewing developers and other folks that use Python in their day to day jobs.  He branches off into scientific and sometimes philosophical realms but it’s all going to be interesting too the average nerd who is interested in learning Python anyhow.

From Python Import Podcast – This was the second Python podcast I discovered.  It’s relatively new to the scene and features 3 slightly jaded developers who are obviously good friends aside from coworkers.  They tend to rant on some higher level topics but I think it’s valuable to listen to anyhow if you are interested in taking Python further than just a hobby.

A Little Bit of Python – This podcast features several core pillars of the Python community and they discuss all kinds of topics from cons to newbie items.  There are a few good interviews as well with some other large names in the Python community.  If Guido were to come onto a podcast, this would probably be the one.  As a bonus, this podcast has a bit of European flair as well.

Reading Material:

Unfortunately, more than just podcasts will be required to learn Python. There are PLENTY of great books out there but most of them are still for Python 2.x.  Here are a few resources that I have managed to hunt down for Python 3.

Python Docs – The obvious place to go is the official Python docs and if you look in there, you will see the official Python Tutorial.  If you have an iPod Touch, iPhone or iPad, you can also purchase(from the app store for $.99) an offline version of the Python 2.6 docs.  Even though it’s for 2.6, it’s still worth having even if you are focused on Python 3.x.

Learning Python by Mark Lutz – I have seen good and bad reviews of this book but I personally think it’s a great place to start.  The bad is that there is a lot of repetition and he teaches you the wrong way to do things before teaching you the correct way but on the converse, it’s good to know that there are so many ways to do things in Python since it can spark your creativity if you are not a veteran developer.  If you are very experienced in some other language, perhaps you’ll find this book too slow.  For me, it’s been mostly a good read.  SOME of the examples in the book are the most clear cut ones I can find on there topics anywhere.  If you have an iOS device, you can purchase a standalone e-version of the book for under $5.

Instructional videos:

If you learn better by watching it done, this might be just the ticket.  There are several excellent Python specific video sites out there so it’s worth a bit of your time to check out some of the videos.

Showmedo – This site was started by a guy that was trying to put together some distance learning materials for a company.  The videos are all provided by individuals and are all rated and monitored for quality.  This site doesn’t have EVERYTHING that I’ve looked for but there is a lot of good info here.  Be aware that SOME(not many) of the videos cost money to watch.

Python Miro Community – This site has video archives of several pycons on top of several other categorized videos covering other Python-related subjects.  I just found this site as of today so I have not had time to make a quality assessment yet but the interface looks great and the some of the categories look quite promising.

Interactive Learning:

If you learn better by doing, this is something you should check out.

Python Koans – The Python Koans are based on the Ruby Koans.  What’s a Koan?  According to the wiki, “It consists of a story, dialogue, question, or statement, the meaning of which cannot be understood by rational thinking but may be accessible through intuition“.  That describes the theme of the koans but in practice, it’s a series of tests build upon each other.  So when you run the Koan, it will fail.  You will then need to jump into the code and figure out what is wrong with it to make it pass the test.  There are MANY MANY tests here.  Even if you are a cracker jack Python wiz, it would probably still take you 2-3 hours to plow through the Koans.  They are available for Python 2 and Python 3.  When you download the package, you get both.  The Python Koans are probably the quickest way to jump into coding some Python.  The tests start out at a very basic, beginner level and if you pay attention to HOW the tests fail, you will see clues to help you succeed.

O’Reilly 3-part Python certificate course – This is a 4-part course(at $400 per part) that is offered remotely and somewhat interactively by the O’Reilly School of Technology.  When you complete the third part of the course, you will receive a certification in Python from the University of Illinois.  I cannot vouch for this course since I have not taken it but I am certainly considering it.  The price is a little steep but still MUCH cheaper than the one offered locally to me by the University of Washington.  The course is brand new so it focuses on Python 3.  I looked around online for some reviews and the O’Reilly School has had some mixed reviews.  Most of them stated the the material was outdated(won’t be a problem here) or that the course was not challenging enough(ymmv).  Whatever the case, at the end, you will receive a certification for what it’s worth.

Python Meetups – There are 95 groups in 60 cities in 12 countries.  Surely you are near one of these.  I have not gone to one yet but I do look forward to it.  There are 3 groups in the Seattle area alone!

This project was started roughly 8 years ago when the large Boroughs B-7971 nixie tubes were still reasonably priced.  My friend scored these six tubes on eBay for $10/ea.  These particular tubes were salvaged from the ticker boards of the New York stock exchange. The clock uses an older Atmel AVR 90S2331 microcontroller as a CPU.  The code was written in bascom also by my friend after a two-year setback where my wife moved the clock while it was only half assembled and fried the first Atmel chip.  I originally modified my friend’s code in RVK but he decided to gut the code and rewrite it by the time we got around to revisiting this project.  I built the case out of 1/4″ oak that is obviously stained black.  There are no nails in it.  It was done entirely with wood glue and clamps since that’s what I had at the time I started the project.

My friend James painstakingly built the entire circuit on perf board for me.  The tubes are driven directly from 12 TD62084AP 8 channel high voltage driver ICs which are in turn driven by an array of 12 cascaded 74HC595N shift registers.  Other than that, there is a beefy power supply that puts out the 170v and some lower voltages for the logic circuitry.  It uses the 60Hz of the A/C line for a sync source.

I’m very pleased with how the final clock turned out.  It seems to keep the time very well.

More ipod activities for 2-5 year olds

My son has been using his iPod Touch now since he was about two.  It was mine but then we ended up both wanting to use it at the same time so I ended up having to get me own.  I have no regrets about this and he has been using it for almost 5 months now without incident thanks to an excellent case.  Tends to like coming back to the same apps for a long period of time so even though most of these apps I’ve listed here cost a couple of bucks each, they have been well worth the money.  He likes games such as Katamari Damacy and Plants vs. Zombies but still he often comes back to these educational titles and will spend hours with them at a time if we let him.

Clifford game – If your kid likes Clifford already then that’s just a bonus.  In this game, you are given 3 blank spaces to fill in with letters.  At first you are presented with a pool of letters.  Once you drag the first letter to the blanks, the pool of letters changes.  Then it changes again on the third go around.  The idea is that no matter what letters are chosen out of the pool, they will spell a three-lettered word.  After the final letter is chosen, a picture is shown of what the letters spell and the word is said.

Shape Builder – This game is a basic puzzle builder.  You are given an outline to drag puzzle pieces into and when you solve the puzzle, the pieces morph into a picture and then the object is written and spoken.  Then you get another puzzle.  There are a few different levels of game play.  They will turn on or off guidelines in the outline, use larger or smaller pieces, etc.  This is a great game to start with since it will show your child how to use the touch screen.

Spin Art – This isn’t really a game as much as an activity.  You are presented with a blank canvas and a bunch of paints and brushed.  With a flick of your finger you can send the canvas spinning and then let the fun begin.  This is like the carnival game where you put a frisbee or other object on a spinning platter and dribble paint on it.

Teach Me Toddler/Kindergarten – These are a pair of programs sold separately that run your child through different sorts of learning exercises.  A little mouse with a cold, robotic voice guides the user to complete each task and an overall score is kept.  As the user gets better at the activities, they graduate to a higher difficulty.  On the Teach Me Kindergarten program, you do things such as completing words by dragging letters into blanks, simple math and counting exercises.  On the Teach Me Toddler program, the user is asked to identify colors, numbers and letters.  To keep it interesting for the child, there are virtual rewards given along the way.  They allow you to decorate a personal space.  I find the mouse a little creepy but my son doesn’t seem to mind.

CatPaint – This program allows anyone to superimpose cats onto any picture.  My son gets a kick out of this but he needs my assistance to put pictures on the device of course.  I suppose if he had an ipod touch with a camera, he could probably figure out that part too.  You can scale the cats up and down, rotate them and chose from several.  When you place cats on the picture, they make random cat noises.  Some of them more pleasant than others.

These are just a few of my son’s current favorites.  If you have an app appropriate for this age group, please mention it in the comments and I’ll try it out.

GoodFET

I received my GoodFET PCB in the mail the other day and ordered up the parts from Digikey to build it out.  The parts(not including the PCB) were about $15.  My friend James actually built it for me on his hotplate since this was all surface mounted soldering and I didn’t feel like doing it with my iron.  That part went fairly easily and when I put it in the USB the lights flashed so everything seems to be working as far as I can tell.  When I brought it back home, I plugged it into my Gentoo system and worked through the next steps.

First off, I needed to install some prereqs:

emerge pyserial

emerge pysqlite

I also ended up having to add “sqlite” as a USE flag in the /etc/make.conf and then rebuilding python for that library to be available:

emerge python

Then I installed the firmware with:

./goodfet.bsl –fromweb

After that, I was able to perform the self test which took about a minute and a half:

./goodfet.monitor test

Everything went pretty smoothly as promised.  Next challenge is that I am going to attempt is to use the goodfet to unbrick a wrt54g.

It was recently my birthday and my folks consulted my Amazon wish list for gift ideas.  I have a pile of books, movies and other tech goodies on there but out of it all, they chose these two movies as part of the package.  Not wanting to bore my wife with these, I had to wait until she was out of town to watch them.  She humored me with Pirates of Silicon Valley.  But I didn’t expect these to be nearly as entertaining for someone not grossly obsessed with the tech industry.  I would still stick with my original call.  These movies are not likely wife-friendly.

I started out with Triumph of the Nerds.  I have to say that I found this movie thoroughly enjoyable from the start to finish.  At this point, it’s a little dated but still very relevant.  Bill Gates was only worth around $11B at the time of this movie for instance so it was probably much easier to capture the great interviews with him at that point in time.  Steve Jobs still looks pretty young and lively in this movie as well.  Some of these founding fathers of the tech industry are just as outrageous as ever.  Steve Ballmer for instance spewed out a few lines that were just hilarious.

This movie also has an interesting and just plain bizarre host, Bob Cringely.  Bob claims that he was Apple employee number 12 and was offered stock back in those days because the company was short on cash.  Unfortunately for him, he held out for the cash and apparently his mother has never let him live it down.  🙂  The movie is broken up into three parts but you’ll probably just want to plow through it all at once if you are anything like me.  I would consider this movie as the perfect follow up to Pirates of Silicon Valley.  If you want a much more accurate portrayal of what actually happened, this is your movie.  That being said, I certainlywould not skip Pirates of Silicon Valley.  It’s also an excellent movie and not HORRIBLY inaccurate.  Just a little dolled up for Hollywood.

The second movie I got was Revolution OS.  If you are not a Microsoft hater, I might consider skipping this one.  There is an undertone throughout the whole movie that Linux can do no wrong.  That being said, there are several great interviews in there that are worth seeing.  Interviews with Richard Stallman of FSF, Linus Torvalds(creator of the kernel) and Larry Augustin of VA Linux.  They touch on the wild Linux IPO’s, open source vs free software camps, pivotal decisions by Netscape and the Apache web server.

If you have been into Linux for a while, you might not learn or gain much from this movie but if you are new to Linux and want to learn about it’s roots, it’s not a bad place to start.  Just a word of advice though, don’t drink all the kool aid this movie is spitting out.  Pay close attention and you will see some of the ways that clever video editing is being used to put new context into what the interviewees are actually trying to say.  Also, pay close attention when they are talking about the IPO’s.  You’ll notice that they BRIEFLY flash onto the screen the post earnings announcement stock prices.  You can barely even read the message, let alone comprehend it and see that the stocks when from the mid $200’s to less than $5 overnight.

This movie brought back some not so pleasant memories.  I was there myself, right in the thick of it.  I worked for a start up company that was producing a Linux-based product.  We were trying to raise funding for ourselves and had tangible network appliances that we were ready to release.  After Redhat and VA Linux tanked, no one would touch our company with a 10-foot pole.  This eventually led to us shutting the doors and we weren’t the only ones that suffered.  I personally believe that the tech crash was catalyzed by those two specific companies.  Having that footnote glossed over annoys me a bit and reminds me why I didn’t touch Linux for a good 3-4 years after that period of time.

My first Linux install

I was reminiscing with uglyman of The Airlock last night thinking back to the first time I tried Linux. It’s been nearly 20 years since I tried Linux for the first time. I was just a kid so I didn’t really understand Unix concepts or what I was playing with but my dad and I had stopped by a shareware store in Bellevue. Back in those days, there were actually brick and mortal stores in this area that near exclusively thrived off of putting shareware on 5.25″ floppies and selling it.

I saw this expensive piece of “shareware” (little did I know). I was on a CD and was $29 if memory serves me.  At the time, we didn’t have a bunch of old computer hardware laying around.  I had a computer and my dad had one.  At the time I was running a Pentium 60Mhz engineer sample that I scored from our local monthly computer swap meet that rotated between Kent Commons, Everett Holiday Inn and Bremerton.  We paid $1000 for that motherboard, cpu and the 16mb of ram on it but at the time it was cutting edge.  I had a full height 5.25″ 1GB scsi hard drive(that we bought USED for $1,000) and of course a cd-rom drive.

The CD we bought was Yggdrasil Plug’n’Play Linux.  I’m not sure what intrigued me about it.  Maybe that it was an alternative operating system to Mac and Windows which were the only two systems I knew.  Maybe the words plug’n’play which even predated the new term coined by experienced MS users, “plug’n’pray”.  Whatever the case, we bought it.  The minimum system requirements were a 386 with 8mb of ram and a CD-ROM.  I figured I had this beat so why not?  I didn’t know what it meant at the time but Yggdrasil was based on a .99 kernel.

The most remarkable thing about Yggdrasil was that it was the first Linux live cd.  Pretty sure the cd wasn’t bootable because this was before the days of bootable IDE CD-ROM’s supported in bios.  Instead, included with Yggdrasil was a boot disk that would load the cd drivers and eventually you would be presented with a boot menu giving you the option to install it or run it live.

I chose to run it live.  It was pretty slow.  It probably took 5 minutes to get to an X windows screen but I remember being blown away that I could run a full gui OS without even installing it.  Ultimately, I played with it once or twice but eventually didn’t have much need for it since I didn’t understand how to use any of the applications(such as vi, latex, etc) and I wasn’t really savvy or motivated enough at the time to get my modem working in Yggdrasil to connect to the internet (through my shell account provider).

My first taste of Linux was brief but it certainly planted the seed for delving into it later with both feet around 1998 when Redhat was maturing.  I’d love to see some comments from anyone who had more experience with Yggdrasil or an even older distro.

SecuraBit podcast review

I’ve been meaning to review the SecuraBit podcast for a long time but the most recent episode(Episode 67: We’re all gonna get HAX!) pushed me to do it.  Their format is fairly informal and that has sometimes led to what they refer to as a “SecuraBeer” episode where everyone talks over each other and the topics drift into the gutter but SecuraBit has been REALLY stepping up their game lately and delivering some excellent content.  I would said pretty much everything in 2010 has been great.  They focus on malware forensics, reversing and several other topics along those lines.  I’m glad that I stuck it out with them and kept listening because an earlier review would have been unfair.

That being said, EVERYONE needs to listen to episode 67.  Everyone who uses a computer at all for anything at home, at work, or wherever should hear what there guest, Roger Grimes, has to say about antivirus software, patching, embedded systems and all of the fortune 10,50, 100 & 500 companies of the world.  The message is fairly grim but it boils down to antivirus NOT being a magic bullet.  Roger also mentions how fake antivirus is the number one source of infection that he encounters.  He goes on further to talk about Mac OS X and people’s blind ignorance when it comes to OS X security. He refers to Charlie Miller winning the “Pwn to Own” contest at CanSecWest:

Roger takes a minute towards the end to plug his own favorite operating system, OpenBSD.  Even if you don’t understand some of the things Roger is talking about at the start of the interview, stick it out.  He starts speaking in very plain English towards the middle and the message is something that everyone needs to hear and anyone should understand.

I’m looking forward to many more well-picked interviews on SecuraBit.  It seems that they have finally found their niche.

Python in 5 minutes

I will start out by saying this title is a little misleading but I’ve been trying to learn some Python lately and I have figured out some things that will help you get well on your way to learning Python in about 5 minutes. I won’t say that I know Python well at this point but what I DO know is how to figure a lot of things out without cracking open the manual. For starters, get Python installed. I’ll leave that part up to you. After that, you’ll want to open the Python interpreter by typing python at the command line in your particular operating system. You can’t save your code while you are in the interpreter but you can safely play around in your own personal sandbox.

First lesson – Strings: At the prompt, type in something like:

>>> s=’Spam!’

That will put a value into memory that you can play with.

Second lesson – dir() & help(): Not only is “s” a string, it’s also an object.  This lends itself to all kinds of neat things that I will let you figure out on your own but one of the coolest features is that you can tack string attributes on it very easily.  How do you know which attributes will work?  This is where dir() comes in.  At the interpreter prompt, type:

>>> dir(s)

This will show you a huge list of attributes that can perform operations on your string.  For instance, you can use:

>>> s.swapcase()

This will print something like ‘sPAM!’ at on your screen.  If you want to change the variable, you can use:

>>> s=s.swapcase()

Now what if you see another attribute in the list who’s function isn’t self explanatory?  This is where help() comes in.  Say that you don’t know what the “zfill” attribute of a string means…  Type:

>>> help(s.zfill)

You’ll get the exact explanation of what the attribute does right at your prompt.  You can also simply do a help(s) but you’ll get pages of help that will scroll off your screen.

There is a LOT more to python than this of course but these couple of bits of knowledge will help you learn a lot of python’s tricks just by playing around with code at the interpreter prompt.  Of course you can’t go wrong reading the python documentation either.  It’s pretty good and thorough.  I wouldn’t suggest buying a book until you give that a shot.  If you do still need a book, I like Learning Python: Powerful Object-Oriented Programming.

Review: CODE by Charles Petzold

Code: The Hidden Language of Computer Hardware and Software

The cover of CODE does not leave you much to judge it by.  It looks plain and minimalist at best but the reviews on the back cover peaked my interests:

“[A] gem that will appeal to anyone who wants to understand computer technology at it’s essence.”  –David Wall, Amazon.com

” You can tell writing CODE was a labor of love for Perzold and reading it is, too.”  –Bill Camarda, barnesandnoble.com

I agree 100% with both of these reviews of the book but there is much more here.  The author took painstaking care to present topics in a way that makes sense but never dumbs them down into abstracts that are plainly inaccurate like many other books/papers of this nature that overuse poor analogies.  The best way to explain the book is to walk through the chapters a bit:

Chapters 1-6 gently introduce basic principles using a pair of childhood friends who wish to communicate with each other silently after dark when their parents have said “lights out”.  Petzold talks about using a flashlight, morse code and eventually moving up to building a simplistic telegraph system.

Chapters 7-9 builds upon the earlier chapters by explaining different numbering systems and relating them to fingers, toes and bits.

Chapters 10-14 starts to get REALLY interesting where he introduces logic circuits built entirely from telegraph relays.  In earlier chapters, he explains the concepts of telegraph relays and puts them to amazing uses in these chapters.  He brings it as far as building a binary adding machine (conceptually, using your imagination).  As far fetched as it may sound to build a computer entirely from simplistic devices such as relays, it is possible and has been done.  The whole point of this book is to show how simplistic(and simultaneously complex) a computer actually is.

Chapters 15-18 gives an AMAZINGLY gentle introduction to machine code and assembly language which is at the heart of every computer program.  Petzold’s explanation of machine code is by far the best explained version I have seen thus far.  If you want to follow up this book with something useful that will teach you even more about machine language, check out A Short Course In Computer Programming and if you run a Mac, grab the TinyELF 1802 emulator.

Chapters 19-22 work up to slightly higher-leveled details such as handling keyboard input, video output and an interactive console.  The explanations in these chapters are VERY easy to understand.

Chapters 23-25 close out the book with the significance and methods of processing floating point numbers(any number with a decimal point in it).  Higher level languages such as BASIC, C and some others that even I had not heard of.  Finally he closes out the book with the shift into graphical user interfaces, object oriented programming and API’s.  Even if those things sound mind boggling, by the time you read to this point in the book, you will easily be able to grasp these concepts.

Petzold does an amazing job of putting all of the concepts he is trying to convey into a palatable order.  Furthermore, when the reading has gotten REALLY thick in certain chapters, he promptly brings things back into perspective and switches gears into lighter topics like history which gives you a chance to absorb what he has just said and connect the dots.  Petzold also keeps it interesting by referencing later chapters in the book, this is probably one of the reasons that I absolutely could not put this book down.  I managed to plow through it in 3 days.  For anyone interested in computers, this book is a must because it gives you and excellent foundation to learn higher level concepts off of.  Yes, the book was written in 1999 so some of the examples he gives are dated and amusing such as when he quotes system specs of “modern” systems but NOTHING in this book is any less valid today than it was when he wrote it.

3D drawings with Google Sketchup

If you have ever played with 3D modeling/drafting software, you’ll know that most of it is non-intuitive and is riddled with bugs.  It involves refreshing the screen a lot because of artifacts that occur when deleting lines and your CPU fan ramping up to full speed.  None of this describes Google Sketchup.  It’s the easiest and best 3D modeling package I’ve ever used.  Today I spent some time drawing a 3D model of my house in order to chose some landscaping for the front yard.  It took me a couple of hours to draw but most of that was spent running back and forth between the computer and the tape measure.  If I had an assistant, I could have hacked it out in about 30 minutes I think.  I haven’t decided on the landscaping yet but I’m fairly pleased with the result.  Here is another house that I designed from the ground up for a piece of property I’m trying to market.

I would say it took roughly 4 hours but that was the first model I made so I had a lot of undo’s and other learning mistakes.  On both of the houses, I drew every line by hand besides the trees but I was easily able to import pictures.  For instance, the siding on both drawings is actually just a picture of siding that I rescaled to work as a texture map.  There are several video tutorials available and I think you can watch them all and be proficient in less than 30 minutes.  Google Sketchup is totally free for download so no excuses.

Powered by WordPress. Theme: Motion by 85ideas.