Archive for the ‘python’ tag

IDEs, Django and more

April 8th, 2008 1:27 pm

There’s a lot of talk lately on some of the blogs I read about code editors. I myself have been dealing with finding one that suits me (even if I don’t code all that often anymore), and so far, nothing seems to fit 100% yet. I’ve got a basic understanding of Vim, Emacs and Nano, which are all ok as far as command line utilities go. I think I fall into the IDE category when it comes to coding, so I’ve been playing around with jEdit, Eclipse and most recently OpenKomodo. OpenKomodo seems to work pretty well, and I really like the completion aspect of it, so I think I’m going to stick with it for coding for now. For configuration editing / remote work, I’ll stick with Vim.

My Django experiment is going relatively well. The database model is done, and now I’m at the point where I’m a bit stuck. I’m still learning my way around the framework, so I’m sure I’ll get it with time. What I’m currently dealing with right now is trying to figure out views. The way I understand it so far is that urls.py defines what happens when you go to a particular URL for the project, such as http://project/view/main_page, then in views.py there would be a main_page routine. Part of my hang up right now is the design aspect. In a nutshell, I’m trying to retrofit an old PHP application into Django while not altering it too much. I’m in no hurry to finish this, so I have time. As far as personal projects, I don’t really have any Django-related projects I could work on for personal things, so I’ve been thinking about some ideas I can do in just normal python. PyGame seems rather interesting, and of course I could always find some other project to get into as well. If you have any thoughts on projects looking for a semi-new Python guy, drop me a comment.

Category: programming  |  Tags: ,  |  no comments

Adventures in Python

March 31st, 2008 2:19 pm

I figured that I’m going to start yet another series on my blog entitled “Adventures in Python”. I figure it will motivate me to play around with Python/Django while sharing my experiences with everyone. Keep in mind I’m new when it comes to Python, so my code may not be so pretty.

Category: programming  |  Tags: ,  |  2 comments

Learning Python via Django

March 31st, 2008 9:29 am

I’ve been playing off and on with Python for a while now, but never really did anything too awfully useful. Of late, I’ve been working on maintaining some internal web applications at work, which are written in PHP. After reading about Django and checking out some documentation, I’ve set out to rewrite at least one of those applications into Django. Thus far I don’t have much other than the database layout, but from what I can see I’ll have something rather functional in a short amount of time. I wish I had a non work-related project to work on, since I find it hard to work on the rewrite outside of working hours. Even during working hours my time is limited as I have other responsibilities to deal with, this being the lowest priority.

At any rate, learning more Python via Django seems to be going well so far. I am branching out, though, trying some new things and playing with some libraries. I’ll share some of my things when I finish.

Category: tech  |  Tags: ,  |  1 comment

Coding in 2007

December 24th, 2007 8:11 am

I had a lot of ambition in 2007 to start coding things again, but as with every year, most of my thoughts came and went. I have learned enough Python to be dangerous, at least, and I’m still pretty OK with Perl, although I barely use it anymore. I’m still messing with a bit of PHP as well since I deal with it at work, but I’ve been thinking a lot about rewriting some of our internal webapps using Django. Problem is that it needs to be maintainable by others in my department, but I’m thinking if I code them right it shouldn’t be too horrible.

As far as personal projects go, there’s not really a whole lot I’ve found to code up. I’ve thought of a couple of things, but never really got into them. I should, though, so I can sharpen my skills. I’ll be working on the work projects at home mostly, but I want to have something I can do for myself, or if nothing else, something else to help out on. Hopefully in 2008 I’ll be a bit more inclined to write more code.

Category: programming  |  Tags: ,  |  no comments

PySync Redux

May 28th, 2007 12:02 am

After some comments by Patrick, I decided to play around with classes and came up with the latest iteration of my little sync script. I also added a rudimentary log file.

import socket, os

class Server:
    """ Server class used for checking and syncing """
    def __init__(self, srv):
        self.server = srv

    def is_up(self, port):
        """ Checks for server availability"""
        rmtsocket = socket.socket()
        rmtsocket.settimeout(0.25)
        try:
            rmtsocket.connect((self.server, port))
        except socket.error:
            return 0
        else:
            return 1

    def run_sync():
        """ Run Unison to perform the sync """
        try:
            status = os.system("unison -batch")
        except:
            print "Error running Unison... ", status

def write_log(entry):
    logfile.write(entry + "\n")

logfile = open("pysync.log", "a+")

server = Server("192.168.1.99")
if (server.is_up(22)):
    write_log("Server's up, syncing now")
    server.run_sync()
else:
    write_log("Server is down, no sync performed")

logfile.close()

Category: programming  |  Tags:  |  1 comment