Posts tagged as: python
Feeling the urge to code
Posted on Monday, April 17, 2006
at 4:20 PM (permalink)
I haven't been blogging much lately, because I've been spending my time reading Python books. That's one thing that separates Python from Ruby that people don't seem to mention when comparing the languages. There are tons of Python books, while there is basically just one good Ruby book. I'm going to spend a day or two more of just reading, and then I'll start doing some basic RSS coding to test out the Python libraries. Once I feel comfortable with the language, I'll get back to exploring the various forms of microcontent and their potential relationship to OPML. Don't expect much blogging here for a week or so, but I will report on my initial RSS library experiments on my code blog.
What problems are RSS libraries trying to solve?
Posted on Saturday, April 15, 2006
at 8:18 PM (permalink)
I spent the day reading Python books, and now I'm starting to look at the many libraries that are available for reading and writing RSS in Python. There are certainly more libraries available than in Ruby, and that makes Python seem like a place I should spend some time, but all of the libraries seem to have the same perspective, which is to treat RSS as a specific variety of XML. What if I don't care about DOM and SAX and stepping through a tree of XML? I keep thinking about what happened when dBASE first appeared in 1981. At that time the standard way to do database programming was to use CBasic or Microsoft Basic to construct a record in memory using string variables. It was up to the programmer to do what was called record blocking, where the strings were padded out to fixed lengths and then written out to a text file. If you wanted an index as well, you had to find a separate library and manage insertion and management of nodes in a B-tree. Then dBASE came along, and all you had to do was say APPEND or EDIT in a program. dBASE wasn't about database details, it was about application building. If you wanted an index, you just said "INDEX ON <field>," and the index was created and automatically maintained. Instead of being a database programmer, you could be an inventory programmer, or a doctor's office programmer. In fact, doctors could become programmers and create their own applications. That is what I want with RSS and OPML. I don't care whether a feed is RSS or RDF, or what the specific XML tags are. I want to be able to say "Give me the posts from this list of feeds that are less than 1 week old. Now combine them all into a new feed." That should be 3 or 4 lines of code. There has to be a reason that RSS programming is still about creating generic aggregators instead of RSS applications. It is a combination of tools and coders who are thinking about RSS as streams of XML data, and not application specific data that should be represented as vertical applications that have nothing to do with reading blogs.
Moving on to Python
Posted on Friday, April 14, 2006
at 10:20 AM (permalink)
I hesitate to say that I've decided to move to Python from PHP. I got plenty of emails from people telling me that PHP would surely solve my XML programming problems, but it doesn't seem to be able to do it for me. There are lots of great tools written in PHP, so it must be a personal issue. I'll know when I've found the right language, because I'll be able to do XML programming without repeatedly getting random errors. I plan on working my way through the "Hacking RSS and Atom" by Les Orchard, and "Beginning RSS and Atom Programming" by Danny Ayers and Andrew Watt. Both books use Python for their examples, so that should give me the background I need to see how the pros do it. After Python comes XSLT, which I also get lots of emails about. The funny thing is that I can get everything I need done with each language I try, except for XML parsing. Reading and writing files from the Web, parsing for hyperlinks, etc. are no problem. This blog is generated with my own FoxPro code and it seems to be working fine. I may be rusty when it comes to serious coding, but I still think there is something missing in the area of XML that isn't my fault.
Rethinking my programming strategy
Posted on Saturday, March 11, 2006
at 3:28 PM (permalink)
Ever since I did my last burst of Ruby programming a week ago, I've been trying to figure out where I want to go with Ruby and Web programming in general. The truth is that I'm hitting a few roadblocks that are rather frustrating. I still find the Ruby syntax cleaner than any language I've used since dBASE. On the other hand, the available Ruby libraries are not as robust or mature as Python or Perl. This is a particular problem with XML parsing. I didn't expect this when I started programming again last fall, but since almost all of my programming has been with RSS, OPML, API calls, I'm extremely dependent on REXML, the XML parser built into Ruby. I've been hitting bugs and weirdnesses with REXML, and after emailing the author 3 times over the last 2 months, I've still not been able to get a response. On the other hand, I'm now getting to know a lot of Python programmers. There is even a Python programmer in Seattle who keeps emailing me, offering to build RSS and OPML libraries to do whatever I want.
I knew Ruby had fewer libraries than older languages when I started using it, but I assumed I would just write my own libraries to do whatever I wanted. That's what I've always done in the past. The other thing I've discovered in the last few months is that I'm going to have less time to code than I originally expected, so building libraries for things like XML parsing are not likely to happen. Actually my whole approach to programming is going to be different than I had expected. Instead of getting more and more proficient in one language and tackling all kinds of tasks, I now see that I will be focusing on RSS, OPML and API calls for possibly a few years. It might make more sense to see how this is done with many of the available languages, such as Perl, Python, PHP, and Javascript. Instead of becoming a language expert, I'd now rather become a domain expert.
This decision is also dependent on ideas I might have for writing books. I really enjoy that process, and know that a good book can be a valuable aid to developing my new career as a tech blogger. Instead of writing a Ruby book someday, it now seems more likely that I'll want to write an RSS and OPML book, which means I may want to be able to discuss techniques in multiple languages.
I haven't made up my mind yet. I'm going to spend a few days playing with Python and looking at other XML solutions for Ruby. Who knows, maybe someone will tell the author of REXML to answer my email and tell me how to keep it from choking on ampersands.
Which programming language will get you a job?
Posted on Sunday, January 15, 2006
at 9:57 PM (permalink)
The Indeed.com job site now allows you to graph the percentage of online want ads that contain specific key words. There are many uses for this, but I thought it would be interesting to compare the relative demand for specific programming skills. It looks like they rank as follows: .Net, Java, Perl, PHP, Python, Ajax, and Ruby. Despite the recent hype, Ajax and Ruby are barely visible compared to the better known languages.
 But that isn't the whole story. All of the leading languages show fairly steady levels of demand. Ajax and Ruby, on the other hand, show strong growth over the last year. Want ads for Ruby doubled, and Ajax increased six-fold.  These last two graphs also suggest a potential growth market in Ruby and Ajax training. (Via Steve Rubel)
Plans for using Ruby
Posted on Saturday, October 29, 2005
at 5:48 PM (permalink)
I guess I should explain what I want to do with Ruby. A major motivation for learning it is the amount of buzz surrounding it and the application framework Ruby on Rails. Language popularity comes in waves that usually last 3-4 years. In the 10 years I've been involved with the Internet I've seen Java, Perl, Javascript, PHP, Python and now Ruby each have their turn as the hot language.
Ultimately I want to write web 2.0 style mashups, but my first Ruby app will be the content management system that runs this blog. I know it sounds crazy to build yet another CMS, but that is the type of application I know best, so it makes a good testbed for new tools.Of course, I have no plans of creating a CMS that others can use, just something with enough functionality to serve my purposes. Right now I've written a system with Visual FoxPro, because I've been an xBASE programmer for 25 years and can do it in my sleep. I want to gradually rewrite it in Ruby and then rewrite it again with Rails.
One issue will be database access. Eventually I will use MySQL as the back-end, but at first I'll want to use Ruby with the .DBF files I am already using in the FoxPro version. Since Ruby has a much weaker set of available libraries than Python, I haven't been able to find a native Ruby module for DBF access. The path I'll probably go down will be to use a Python DBF library and a library that lets me call Python code from Ruby. It sounds like a horrible kludge, but it will let me learn Ruby while doing some practical work. I'll write the database routines so that they can easily be converted to MySQL later.
Book Note: Teach Yourself Ruby in 21 Days
Posted on Wednesday, October 26, 2005
at 1:07 PM (permalink)
I started learning the Ruby programming language today. Ruby and the associated framework product, Ruby on Rails, seem to be all the rage among web 2.0 developers, so I thought I'd give it a try. It seems to be a "real" object oriented language, so I'm looking forward to it. I've programmed in Perl, which can be forced to use OO techniques, and Python, which is much more OOish, but I've mostly used them in a procedural manner. This time I'm going to try and really work with classes as well as objects. Back in the early 90s, when OOP first appeared in popular use, Borland hired me to write a book about their future dBASE for Windows product. I spent a year doing nothing but studying OO ideas and really fell in love with the approach. Sadly, the product was a bust, and the book never saw the light of day.
I have a stack of Ruby books on my desk, and I'm going to start with this one from Sams. You can find the details at Amazon if you want to read along with me.
|