Entries Tagged 'Software Development' ↓
December 13th, 2006 — Linux, Software Development
My jaw hit the floor today when I read this: OpenOffice gets pre-load, update notification . I’m all for applications running/loading faster, but not pre-loading apps is one of the main things I like about about non-Windows operating systems. It looks like the bloating of Linux continues, which is a shame. (Yes, there are distro’s that are fighting this, but they don’t get enough press like the big guys do.)
Repeat after me: small, light, tight.
November 12th, 2006 — Programming, Software Development
I saw this really great article about how Starbucks is a good model of asynchronous activities.
Its a really good correlation between programing and a “real-life” activity that I’ve seen recently. A lot of topics in computer science and programming are difficult to talk about with people outside of the industry (i.e. my wife gets bored if I talk shop). But at the same time, there’s a lot of parallels between real life and programming, it just finding the good examples that is hard to do.
Parallel processing is another one of those topics. Its one of those things that if you understand the principals of it, you will see examples of it in day-to-day life all the time. When doing laundry, you don’t wait for one load to completely dry before starting the next, you start the next load in the wash as soon as the first one is out! When making a lot of sandwiches, it is better to work in an assembly line fashion where one person puts on the mayo, another adds the meat, someone does the mustard, and someone puts the cheese on. In some cases, splitting up the job up lets you get it done faster. Its interesting that these real world events can be be modeled/explained with the mathematics of programming.
November 6th, 2006 — Java, Programming, Software Development
I’m taking a class in programming languages and recently we had a home work assignment that involved writing a C++ program (to deal with multi-dimensional arrays, pointers, etc.). It has been a while since I’ve written any C++ code, so this was quite an experience.
I managed to more-or-less get the program done, and at the end of it all, I had an overwhelming thought: I’m glad I work in Java.
C++ is fun in its own way, but the whole time I was coding I kept feeling like I was doing something wrong with all of the jumping around in memory locations, and playing with pointers. In Java, you just don’t do those types of things. Also, every time I ran into an error, it seemed to be pointer related. I haven’t had to use the debugger to look at memory locations in a loooooong time.
I really like the secure feeling that Java gives me when I’m working in it. I also feel like I’m more productive, but that could be a result of being more “current” with Java’s libraries, vs. C++’s libraries.
Also, as an odd note: I never understood why all the Mac developers talk up TextMate so much and how it works great with Xcode. After spending this last homework working with the default editor in Xcode, I totally see why. Any editor that asks me “Are you sure you want to undo?” when I press Ctrl-Z (or Cmd-Z in the case of Macs) instantly looses about 50 points in my book. Add on to that there seemed to be no auto-completion for classes built in (or at least turned on) and it makes the IDE pretty poor in my view. The rest of Xcode seems pretty good, but that editor sucks and has got to go. It looks like I will need to search for a decent editor that can work with Xcode. (I tried TextMate, and its missing some feature I feel I need.)
October 22nd, 2006 — Programming, Python, Software Development
Before it slips my mind (again), I wanted to drop this link to this awesome example of using python and threads to do interesting work. The article discusses using the threads to go out on the internet and gather data (i.e. RSS feeds), parse them, and store the results in a database.
The “pattern” that is shown in the article is really good for any language that uses threads. I personally haven’t had a chance/need to use python’s thread capability, but I do use them in Java occasionally. Using a the work queues is a great way of making sure that the worker threads are fed (say that three times fast), and the idea of having the output work of the threads feed into a database thread (to help make sure that the database doesn’t get slammed, but the workers can keep going) is really great. I haven’t run into that situation yet, but this is one of those cool ideas to take note of and keep in your back pocket. You never know when you are going to need that ace in the hole.
October 19th, 2006 — Blogging, Programming, Python, Software Development, Web
I’m a big fan of O’Reilly books. They are a great reference when tackling pretty much any programming topic. I own a ton of their books.
A few weeks ago I was searching for something (I can’t even remember what it was) and I stumbled across a new feature on their site. They are now selling short (around 50 pages) PDF’s called “Short Cuts” that are basically short papers on some topic that they don’t have a book for yet. Its a pretty neat idea, the PDFs range in price from around $5 to around $10 or so.
And the coolest thing is that there is a promotion going on where you “Buy 3 books for the price of 2″. With the short cuts I was hooked because there were a couple that looked interesting and the price was hard to beat. The whole process was pretty painless and within minutes I had my new PDFs.
Fast forward to today: Again I’m searching for something (RTF documentation to be exact) and a hit turns up on O’Reilly’s site. This time its for one of their pocket reference guides. I was bummed because it looked like the book had the answers I was looking for, but I knew the odds of finding it locally were low, and I didn’t feel like waiting for it to show up in the mail…
And right around then I noticed the book was available as a PDF for *half* price. It turns out that O’Reilly is now offering a lot of the pocket guides as PDFs for immediate download, and they are pretty much half the price of the dead tree book. Isn’t that awesome? the best part is the 3 for the price of 2 sale is still going on.
So, I wound up spending $10 and now I’ve got 3 more PDF of pocket guides.
Go check it out if you are in the market for any of the pocket guides. Also, several of their newer books are available in PDF form also. Sadly, their older books aren’t in PDF form yet, which bummed me out because there’s a couple that look really interesting. This is the long tail at work.
September 22nd, 2006 — Programming, Python, Software Development
Yesterday I was raving about wxPython and how it was letting me do “cool” things. Today I discovered it was letting me do a lot of things, some of which aren’t so cool…
It turns out that my call to wx.Window() wasn’t 100% correct. As in I was passing bad/incorrect data to the constructor. Yet, the hardy little wx.Window() class kept on a rollin‘. I don’t like that.
Python is pretty loose when it comes to variables and data types, that’s one of it strengths. In this case it is a problem. In my call to the class I was passing in a wx.Frame object, a int, and a string. And it took this, and everything seemed to run.
Calls to getClientSize() kept returning (20,20) which is kinda odd, I was specifying 1024×768. But after running a method the called a bunch of dc related methods, the getClientSize() method began returning (1024,768). Odd, no?
Perusing though the documentation told me that the default window size is (-1,-1). If the code detects this, it will set it to (20, 20) as sort of a “indicator” that something is not right. As opposed to say printing something out to standard error, or something useful like that.
Anyways, I had a flash that IÂ might be passing in bad data. In any other strongly typed language passing data this bad would wreak all kinds of havoc. In this library it just keeps on trucking. I changed my call to the class to match what the API says it should be, and lo-and-behold getClientSize() began returning the correct size every time.
So, the lesson here is if you pass bad/incorrect data in python/wxpython, that is no guarantee that you will be warned. It seems like it will try its best to keep on going. I get run time errors in python all the time for things like this, but this is the first time I’ve seen it let something that seems so wrong just slip by.
Which can make debugging such a pain.
September 21st, 2006 — Apple, Programming, Python, Software Development
…Or, I love it when a plan comes together. 
A while ago I wrote a small GUI app in python using Tk (Tkinter to be specific). It worked pretty good on Windows machines, which is where I was running it at the time. About a year later I tried to run it on a Mac, and the results were a little surprising. It did not look good. It seems that there are some differences between the Tk stuff on different platforms.
Every since then I’ve been wondering if there was a more platform independent way of making Python GUI apps. I’d heard a lot about wxPython, so I decided to give it a shot. The documentation is pretty good and the demos that come with it helped me get up to speed pretty quickly. (Plus the API reminded me of some work I did in the Win32 world a few years ago, and surprisingly, that helped me get things “working” faster than I think I would have otherwise.)
Anyways, I built a little app to visualize an idea I’ve been having for a few weeks ago. Again, on Windows machines it looks great. Today I remembered that I hadn’t run it on a Mac yet. With a little bit of trepidation, I grabbed the code and hit run. Lo-and-behold it runs great on the Mac. A little bit slow on the re-draw, which probably has more to do with how I wrote the event handlers, but it ran and looked just like it does on the Windows machines.
Thus I have concluded: wxPython rocks.
August 6th, 2006 — Programming, Python, Software Development
In yesterday’s post I was “contemplating” the experience of coding up something to work with XML. Specifically, I was kinda stuck because the results I was getting weren’t really helping me move forward on creating something to translate XML into Python objects.
As is usually the case I made the whole situation harder than it needed to be. I was trying to write a solution that involved a recursive function and it wasn’t working the way I expected it too. The neat thing about recursive functions is that they can be re-written as a form of a loop, so I used that approach to help debug the errors I was getting.
Having a good debugger was essential also. Without the pydev plugin for eclipse, it would have taken forever to figure out what DOM objects I was looking at. Being able to set a breakpoint and look at a live object was priceless. It turns out that the DOM object had more things in it in different places than what I was expecting. Having to guess and do a million print’s would have taken what little bit of sanity I have left. 
Your tip for the day is that Python’s setattr() and getattr() functions rock. They allow you to inspect and modify member attributes of a class. After reading though Dave Mertz’s articles (here and here), it became very clear how I could use these functions in my own code to build objects from XML. Now I can move forward and start using that loaded data to actually do something interesting…
August 5th, 2006 — Programming, Python, Software Development
I have a real love/hate relationship with XML.
On one hand I think it is really great format for the transmission of data especially if there are different systems involved. XML compresses well in most cases, and it is easy to “read” and pretty easy to parse.
…and on the other hand XML can be a bitch and a half to work with.
A debate I have with myself on a regular basis is: “Which is better, storing data in native structures or XML?”. Python is my weapon of choice these days and it has the wonderful functions pickle() and __dict__.update(). Both of these easy-to-use methods combined with the simple (easy to edit manually) format that Python writes out makes it so that you will want to write out python objects. However, complex data structures lead to complex looking files when they get written out. Plus if you want to load that data in another language (like lets say you write an editor to manage your data files), then you have to figure out what the written format is, and be careful that you don’t break the format.
XML seems like an ideal solution, platform neutral, easy to look at (most of the time). Yet every time I try to process XML in a program (Python or Java) I feel like I have just slammed my head into a wall repeatedly. Right now I’m trying to create Python objects from XML, and just a little bit of effort in this direction has completely sapped my will to work on it.
Don’t get me wrong, there’s some good resources out there on the net about this (in particular check out David Mertz’s page, he has written a ton on Python and they are all good as gold). Its just that getting hung up on XML problems depresses the hell out of me. (It probably has something to do with a job I was at a few years ago where I did a ton of XSLT. XSLT will drive you nuts in a hurry for some reason….)
Anyways, I should quit my griping and just get back to work. It won’t fix itself…
May 29th, 2006 — Programming, Python, Software Development
The other day I posted about problem I was having while refactoring some python code while using the Pydev plugin for Eclipse. Fabio Zadrozny (one of the developers for Pydev) saw my post and asked for some more details on my problem. After a few emails he had a work around for the issue. Thanks Fabio!
The basic work around is to make sure that you have the “Auto-Refresh” option turned on. I never had that turned on so that’s why I had the pyc files laying around even though the source files were moved. (The auto refresh option is located under window > preferences > general > workspace > refresh automatically.) Fabio also asked me to submit a bug and hopefully this issue will be resolved in the next release.
This whole experience has been very cool. I found something, one of the developers noticed my posting, we talked through the problem, and a solution was found. All in the space of a day or so. That is just so cool, it is one of the benefits of open source software. A great piece of software with great support! Rock on Fabio and Pydev team!