Archive

Archive for the ‘Python’ Category

Backup Issue

April 28th, 2010 Frank No comments

I needed a method to backup my web & database servers; while there are a ton of great options out there such as rsync and unison, I found it difficult and time consuming to get the Linux server to sync to Windows*. My main problem was actually more ssh than anything else. Either I don’t know enough about it or the software available on Windows isn’t as developed. (I’d love others’ perspectives on this…)

Anyway, for the time being I decided that the easiest thing for me to do is to write my own little (python) program to handle the backup and automatic retrieval of said backup archives. I don’t push or pull a lot of data between the computers, so pulling full archives though the network (as opposed to the changed bits that rsync or unison would do) doesn’t matter so much to me. The most important part is that the backup is current.

The programs are by no means complicated or unique; in fact, they might be the simplest backup programs ever. I’ve posted the source code at BitBucket.org and can be viewed at: http://bitbucket.org/frankv01/vpsbackup

If you either end up using it or deriving a new backup solution from it, please drop me a line. I’d love to know that.

* You might wonder why someone who writes-on (lives and breaths) open source would use windows…  The of matter of fact is my professional work (as of this writing, at least) is done on Windows — SQL Server and the .Net to be specific. I’ve never said anything bad about Microsoft nor will I. I believe that Open Source and traditional closed-source has their place. A software developer  can run their coded bases as desired. I, for one, prefer open source to closed-source — paid or otherwise.

Python Memory Performance

October 8th, 2009 Frank No comments

I’ve been studying Python because it is extensively used in open source projects to script certain types of work or actions. I think Mozilla uses it to verify build time requirements, for example.

But, python itself is a full fledged programming language — not really a scripting language. In fact, Mercurial is written in Python which at first amazed me.

So, anyway as part of my pursuit of studying Firefox, I thought I should (at least) learn the basics of Python so that I could read any relevant scripts. Python is quite different from other languages I’ve encountered.

One thing I started to notice about python is that it seems to use more memory. I’m not sure, nor am I suggesting that it uses more than other languages. I just noticed that memory consumption seemed to grow rapidly when running a python script.

The following article seems to explain why. Instantiating a class is expensive. According to the article, a class is 336 bytes. Since in general, a class will use multiple other classes, I can see why memory consumption was growing rapidly.

Ultimately, I don’t think it matters. You just need to be aware that it happens. A modern computer will run the script without any notice to this phenomenon. You’d need to create a lot of objects to cause a problem. But I do beleive it is worth acknowledge that it happens so that you can be aware of the memory usage. It’s mostly noticeable on my work computer (the company provided) which only has 1 GBs of RAM (it runs Windows XP).

http://www.valuedlessons.com/2008/10/blog-post.html

Categories: Python, Random, Tips Tags: