Ubunto – Installing Django

December 8, 2005 at 4:49 am | Posted in django, python, ubuntu, Uncategorized | Leave a comment

So I’ve decided to go with Django as my 1st python web framework.  The documentation is basically spot on but I hit a typically bizarre setup error about not being able to find make files under the python directory so I loaded up Synaptic Package manager and selected Autoconf and then did a search for python and basically selected close to everything and clicked update and it just plain worked.  Outstanding!

Python Link of the Day: EZT

December 4, 2005 at 5:01 am | Posted in php, python | Leave a comment

Interesting. I just finished a long IM chat with my buddy Greg and he pointed me towards EZT as a templating library. He wrote and, well, $geek_fu is no stronger than Greg’s. He and I tossed it around for a while and, without having coded with it, it feels very, very similar to my beloved SmartTemplate from SmartPhp. Every web page I’ve written for 3 years now has relied on SmartTemplate so finding an analog on Python increases my happy quotient dramatically.

We also shot the breeze on OR mappers and object dbs and that was interesting. Good to know that I’m not the only one who thinks the way I do. Its what I call me “Codd and Date” manifesto:

Data shall be stored in tables. Period. As Codd and Date handed it down from the heavens so shall it be.

Wikipedia on Codd and Date (well Codd at least)

I could also describe this in a way familiar to any Highlander freak:

There shall be only Tables.

Good stuff. Thanks Greg!

Python Link of the Day

December 3, 2005 at 10:05 am | Posted in python, Software Engineering | 6 Comments

Ok I have my 1st gui Python app up thanks to this. Its nothing more than a cross platform text box but just that is cool. Quite cool actually.

Now conceptually I really do like the idea that Python is brace i.e. { and } free. Having managed literally departments of programmers through different programming standards and the “indentation wars” I can see the desire to call “A Pox Upon their Houses; there shall be no braces”. Guido was absolutely brilliant when he made this decision and $guido_geek_fu++; as we would say in PHP syntax.

That said one of the more infuriating things I find about learning Python is that when you paste code in from the web, the indentation gets munged and then things don’t compile. Given that indentation is basically invisible and that any newbie will paste code in from things like O’Reilly’s Safari (i.e. an online version of the Python Cookbook), you can see the problem.

Am I the only person who’s ever noted this? I can’t be but I’ve never seen it discussed.  Niall I know you do Python as do you Simon (and, yes, I’m looking intently at Django).  Am I on crack here ?  Did I fall off the turnip truck somewhere in the basics of the learning curve?  Now bear in mind that I’ve spent the last several years steeped in brace centric languages and, at least for me, I find that the getting past the initial hump of a new language is the hard part.  After that its all the same stuff but that initial hump, the adaptation to a very new way, is the hard part.

Why Python?

December 1, 2005 at 7:21 am | Posted in python, Uncategorized | 3 Comments

Oh my. A comment from Dewayne who has, if my memory is correct, been reading me since my days of Radio Blogging. Here it is:

Scott –

Would you mind letting us in on your thought process for learning Python as opposed to something else? Is this a new part of feedster or just a personal goal? I am asking because I too am seeking the next step in my personal education and right now I am leaning towards learning Ruby on Rails.
Thanks,

Dewayne Mikkelson

Heh.  That’s like the best question anyone’s asked me in weeks.  There are several answers:

  1. Personal. Yes it can be used for Feedster but I can’t blog about how so I can’t talk about *censored* where we might use *snakelanguage*.  So if I’m going to blog the learning process, which I’ve found is the best way to force myself to actually do something, then I’ve got to have a personal project.
  2. Support System.  Whenever you learn a new language, the support system you have around you makes a huge difference.  I know one person doing Ruby and he’s busy as all heck so his ability to answer dumb ass questions is limited.  I know 3 Python programmers, one superb / world class, one damn good if not superb and one learning.  So I view my chance of “dumb question” help as 3x greater than with Ruby.
  3. I need some local tools.  PHP is a wonderful server side tool and its outstanding at what it does.  When you develop in PHP the way I do at Feedster many of the traditional scalibility issues go away.  But, what PHP isn’t good at, is local apps.  Yes there’s php-gtk but that feels like a hack to me.  Python is damn good even at Gui apps.  I’m astonished beyond measure that iPodder / Juice was developed in Python.  Given that my pre-web background was in traditional software development, I know just how hard cross platform GUI apps are and here’s this little Open Source effort doing absolutely rocking work.  I want to understand better how the heck they do it.
  4. Its a More Advanced Language.  In Paul Graham’s Hackers and Painters, he argues fiercely for the language’s inherent “advancedness” (for lack of a better word) as being a more efficient problem solving tool.  I.e. you’re more efficient (at least for some tasks) in VB over straight C and Perl over Fortran and so on.  Its a damn interesting argument and having read over the 1st part of a Python reference book, I’d have to agree that syntactically Python is more advanced than PHP. I’m curious to see if my immersion in PHP for 3 plus years either helps me learn Python or prevents me entirely.  I did a line count on the number of lines of code I’ve written to date in Feedster and its shockingly high.  If you assume that LOC measures are inaccurate even by 50% its shockingly high.
  5. It May Be Better Suited to Certain Types of Computing.  As I read through the Python stuff so far, I’m easily seeing that its a powerful language and I can see that its good for GUI programming and server side programming.  At least to me it appears to be less well suited to PHP’s forte — web apps.  Now this is interesting to me since most of 2005 I spent using PHP to do things it really wasn’t meant to do — back end data processing and job crunching.  Yes it worked and I was fine with it but I wonder if a better language might have done the job a little better.  This is a good opportunity to investigate it.
    Note: Simon will no doubt disagree with me.  I’m still learning and I could very well be wrong here..
  6. The Rails Question.  Ah yes.  Ruby.  I find Ruby very, very interesting and the advent of 37signals is clear that Ruby has powerful Geek Fu.  That said I feel a little bit like “Well I know how to develop web apps and Feedster has lots and lots of powerful libraries and constructs for it.  Do I really want to start from scratch?”.  Not to mention the concerns you have with a large scale site regarding security, coexistence with other apps, etc.  I actually asked our lead admin to install Ruby on Rails on our dev box a few weeks ago and he’s still making sure that he’s comfortable with it being on there.  And I wonder if the lesson for all of us from 37 Signals isn’t “use ruby” but “do what we do”?  We can develop crappy web apps in Ruby just like we can in PHP.  That said I did just order the new 37 Signals book.

So that’s my thinking Dewayne.  If I was purely doing Web Apps then it would be different but I’m not just thinking that way.

Scott

First Python Project: Gaim + GMail Integration

December 1, 2005 at 2:16 am | Posted in python, Uncategorized | 17 Comments

I thought a lot about 1st projects to learn Python and, well, my first idea was overly ambitious.  So I thought more about computing problems I have every single day and one came to me: Gaim IM Logs, well, suck.  I mean the log format is fine but the search is deadly slow I often need access to them when I’m not at the machine where the log was created.  So why not write a Python app that:

  1. Runs as a service in the background.
  2. Monitors the Gaim log directory structure
  3. When it finds a new log file upload it to gmail adding whatever metadata it can find to make it better searchable
  4. Extract all embedded urls from the IM logs (hey I’m processing them anyway) to a local “IM Catalog”, time sorted newest at the top — how often do you need a url someone sent you and you can’t remember exactly who or which account you had but you’d know it if you saw it.  This is a feature I had in my late, lamented only by me, Inbox Buddy product and it rocked.

If you think about it, this project covers:

  1. Overall application structure
  2. Application configuration since you need to know where to look to find the user’s specific IM logs, their gmail account name, mail server, etc
  3. Data parsing
  4. Network IO in the form of mail sending
  5. HTML generation

That’s a lot of the basic primitives I use every single day in PHP.  It’ll be interesting to see how Python compares.

Step 1 – a basic recursive directory scanner looking for log files.

Becoming P^3

November 30, 2005 at 7:09 pm | Posted in python, Uncategorized | 14 Comments

Its time to become a P^3 person. I mean I know Perl, I know PHP. Why not *drum roll* Python?

  1. Download Python 2.4. Done.
  2. Ask knowledgeable Python Person “What Gui Framework?”. “WxWindows”. Download. Done.
  3. Open obligatory 2 year old Python book that my wonderful wife gave me as a present back in 2003. Read first chapter. Done.
  4. Type “Hello World” into Idle. Done.
  5. Plan first project. Make it something I need. Ah yes. Got it. Need to research if its viable in Python. Requires a tree control, launching external apps under Windows, getting a process ID and an edit control. Should be viable.
  6. Write first blog entry about Learning Python to force myself to follow through on it. Done.

Heh. Feels good to be geeky again. P^3 is the goal I say, P^3. Hm… Given that in another age I did prolog can that make me already P^3 or does code you last wrote in 1987 not count anymore ?

Blog at WordPress.com.
Entries and comments feeds.