Nov
15
xmllib2 and python
Filed Under Linux, Programming | Leave a Comment
I have been working with Python and libxml2 for a bit now and have found out there is little documentation out there on how to get everything working together. Also as I have very little permissions on some of the machine I work on, I need to be able to have my own installation of Python without affecting the entire system. I have put together the following steps to follow for installing your own installation of Python using least privileges (without root access) for both Windows and Linux.
One quick note about Linux, a lot of GNU Linux distributions out there might already have Python2.5, but I have not had the luck of dealing with any of these. You should check to make sure you need to install a custom installation.
Typically I would like the latest and greatest of a package, however; the libxml2 Windows package does not seem to acknowledge Python2.6 or above, so to keep everything on the same page I use Python2.5 on Linux as to match up with a Windows version also. It goes without saying, but if platform independence doesn’t matter to you then choose whichever way you would like, for myself I like to have my scripts be able to run on Linux and Windows.
Download and extract Python-2.5.2.tar.bz2 from http://www.python.org/ftp/python/2.5.2/. I typically just work out of my home directory, but to each their own.
wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2
Now just a simple extraction:
tar xjf Python-2.5.2.tar.bz2 cd Python-2.5.2
Now we need to configure the python setup. The key part is the –prefix portion, as many people out there are not too familiar with building a source distribution by hand. This basically is the location where all the binaries, libraries, and man pages will be stored. The layout under this directory will be something similar to (I kept this brief, you will have more than this):
$HOME/utils
+- include/
|- python2.5
+- lib/
|- python2.5
+- share/
|- man
+- bin/
|- python
|- pydoc
|- python2.5export LDFLAGS="-R$HOME/utils/lib" ./configure --prefix=$HOME/utils make
I use the LDFLAGS variable to keep from dealing with LD_LIBRARY_PATH, please these links for more information.
Note: On some hosts, such as Site5, you will need to ask IT Support to be put into a compiler group in order to obtain access to gcc.
Now we will install all the built binaries and libraries into the prefix directory we specified earlier.
make install
I will not get into it here, but it is possible to install multiple versions of Python side-by-side. If this is something you would like, then look into using make altinstall instead. The README file details this in the Installing section (around 75% into the file).
If all goes well, then $PREFIX/bin/python should work. I typically adjust my PATH environment variable to accommodate this:
export PATH=$HOME/utils/bin:$PATH
Installing libxml2 on Linux
As these steps follow extremely close to the preceding steps, I will make this a little more brief.
Download libxml2-2.7.2.tar.gz from ftp://xmlsoft.org/libxml2/ (a newer version might be available).
Extract the package in to a working directory.
tar xzf libxml2-2.7.2.tar.gz cd libxml2-2.7.2
Then execute the following:
./configure --prefix=$HOME/utils --with-python=$HOME/utils/bin/python make make install
Installing libxml2 on Windows
To get libxml2 working on Windows, it is as trivial as downloading a package from http://users.skynet.be/sbi/libxml-python/, it automatically detects an installation of python and installs itself.
In some future posts, I’ll go over using libxml2 with python.
Oct
31
We Need Their Money
Filed Under General | Leave a Comment
During a recent lunch outing a discussion came up about one of our clients who doesn’t have enough money for a particular technology related item, but other renovations are happening and people within the group are getting mad. Of course the discussion turned to what all was set forth in the budget and how the IT division was hurting. The typical response is all too common, “There is a pot full of money over there, but we can’t touch it.”
We as programmers need to understand the business side of things, one of which is budgeting. I have made the mistake of assuming everybody is familiar with budget; not only just what they are in general but truly how to use one. Most people understand a budget is used to assign a name for a certain amount of monies, but some of the key ideas behind using a budget is you track throughout a specified time what you actually spend and most important of all the ability to adjust the budget the next time around.
I would like to touch lightly on the first point. If I were to put myself on a diet, I would start out with two things: to write down what I plan on eating, and then to write down what I actually eat. This makes it easier to see if I am really following what I had originally set out to do. Living by a budget is very similar. You absolutely must keep track of what you actually spend, otherwise assigning categories does not do any good. With this said there are key instances where adjusting the budget is crucial.
My wife and I have staunchly lived off of a budget for almost two years. At the end of every month we come together as a couple and decide how we will spend our money for the following month as well as to review the current month’s budget to see how well we did (see which categories we were either short or long on). There are few cases where we have to go over a category in our budget. We have identified a few categories which we deem critical, this means we will (and have) moved money from a noncritical category to the critical category. To get back on topic, in the business world few categories, IT included, are not a critical category and as such it will be difficult to get money moved over to the IT budget.
I view this as a good thing to have in place, I would definitely be in a bad mood to learn some of the IT monies which are needed and instead to be used to make a new awning or some other basically useless item. Developers need to appreciate this particular ‘red tape’ as it is a protection put in place for the company.
With all that said, it is also something we must learn to negotiate with. I do feel most of our needs (note: I did not say wants) are legitimate and came before others. How to battle this bureaucracy is subjective which I will not get into, and this differs dramatically from organization to organization, but is something we must learn to accomplish.
Sep
26
Almost on a weekly basis I get frustrated at other technical people because they do not see value in the things I see value in, or the miss the point. I am quick to judge them and point my finger at them for the blame. Through my recreational reading I have come to believe it is none other than my own doing.
Mark Cuban points out that you do not deserve his time if you are quick to respond with “you just don’t get it”. As he explains it, you are the one at fault if find yourself using this phrase. You must completely understand a subject in order to explain it to other people, then if still feel yourself falling back to the aforementioned phrase that is a tell-tale sign you do not completely grasped the subject you are explaining.
Reginald Braithwaite says the single most important thing to improve your programming career is to give presentations. This is something just recently I have truly enjoyed attending (within the last year). I completely agree with this and feel most presentations I have seen, the presenter either does not completely understand the problem at hand nor do they feel motivated by the topic. My understanding and appreciation of these individuals and what they go through has had a major turn around. I have had the fortunate opportunity of knowing on a personal level a few people who have presented items at my local JUG.
I would like to encourage others to present topics as well. So many people feel as though they do not fully understand a topic as well as others; and this is true. There are few, if any, topics I know better than anybody else, however; this is about improving yourself as a developer and I know first hand your local SIG (special interest group) would be excited to have more people provide presentations.
Aug
29
Comparing Maven Repository Managers
Filed Under Programming | Leave a Comment
This seems to do a pretty good job at comparing, as far as a feature matrix, three of the top repository managers for Maven.
I know for sure developers from Nexus and Archiva have made sure this is up-to-date.
Jul
26
Meet the Design Team
Filed Under Programming | Leave a Comment
The following link is a video I genuinely enjoyed watching and I felt I would share it as well. It is pertaining to the C# 4.0 Design Team, and I try to watch most of Anders Hejlsberg videos if I am able.
They do not get into an in depth/technical discussion concerning C# 4.0, they touch more on architectural items. They mention a few languages but happen to leave Java out of it. Another thing I thought was interesting is how they have met many times to discuss a feature. This might drag on for multiple meetings (they mention 10 hours), but they end up not implementing it. I felt as thought this was really neat how they put forth a lot of time and thinking into aspects of the language and are not afraid to say no.
Jul
20
Maven Profiles
Filed Under General | Leave a Comment
I just wanted to make a quick post relating to Maven profiles. I was trying some new things about with Maven the other day and decided to put these into a profile as to not disturb the normal build process. Upon performing some trial and error tests, I was getting some strange results. I wasted to much time on figuring out what the problem was, but for Maven it expects multiple profiles to be specified such as the following:
mvn -Pprofile1,profile2
I made the mistake of specifying them as multiple -P arguments. Such as the following … this is the wrong way:
mvn -Pprofile1 -Pprofile2
Maven 2.0.8 (I haven’t check on 2.0.9) does not give any indication of an error or warning from what I can tell.
Do not make the same mistake :)
Update - It looks as though Maven 2.0.10 will correct this issue.
Jul
15
WordPress 2.6
Filed Under General | Leave a Comment
I have upgraded to WordPress 2.6 which was recently released. Looks like there are quite a few new bells and whistles to check out.
See the following video from the WordPress team:
Jun
29
Browsers Supporting EV SSL
Filed Under General | Leave a Comment
The latest versions of Firefox, IE, and Opera support EV SSL, but still there is no sign of Safari … and this has been pointed out for quite some time. What in the world is Apple up to?
I have googled twice to be sure I wasn’t missing anything, currently I cannot find anything pointing to an Apple article stating it is being developed or status.
I have mentioned this to other people who seem to care less. My only point is that I enjoy having the choice of four browsers instead of one or two. I am hoping that with the introduction of more stable and safe browsers that friendly competition will ensue, and we the users will win out.
Jun
28
Comming Up With Topics
Filed Under General | Leave a Comment
I always find it extremely difficult to come up with things to blog about. I have the privilege of working with some very intelligent people whom I genuinely enjoy talking with. A lot of times I point out how they should make a post about particular conversation. I have been told on more than one occasion that they are more of a verbal person than a writer. My nature is usually the same but I see that as a weakness of myself and I will be trying to rectify it as there is tremendous value in being able to communicate effectively in the written format as well. I will be using posts made by people I hold in high regard and give my own thoughts and spin on it.
The other thing I plan on doing, and have done in the past, is to blog about a particular tool and how I find it useful. As you may very well tell, I enjoy using vim and from time to time I blog about a certain command. I do know the help files document these items well and that there are probably countless other tutorials on the web, but this is mainly for myself and honing my skills as a blogger.
In doing so, I hope to encourage the few people who read my blog to do the same.
Jun
28
What Are You Afraid Of?
Filed Under Programming | Leave a Comment
Jeff Atwood has a really good post titled Don’t Go Dark. I myself sometimes get caught up in things like this. With the exception of code reviews (which I really do enjoy), I have a tendency to clam up when posting my code out for public viewing for things such as open source projects.
Just last night I happened to post a python class I had been working on, it was (and is) nowhere close to being complete. But I did feel as though it had value in it and could be used by other people. I had hopes others would pick it up and improve upon it as well. I reflected on why I believe people would behave this way, and my only insight was to how I felt. My biggest hesitation was not being able to clarify any misunderstandings or to justify why I had written it the way I did and my name would be attached to the code as it stood.
I thought back to a blog post I read over a year ago, I can’t for the life of me remember who posted it. But one of the reason why was to give you a chance to defend yourself on how lousy the code might have been. It might be because of a bug or some user requirement, but since the code will always be there, it is best to document it with explanations on why you did things a certain way (or do not do things).
Performing code reviews, I feel, are extremely important in a developers life. If developers are using the agile principle of pair programming then code reviews are taken place on a daily basis. But all too often developers do not implement pair programming. I have witnessed teams, which even though they profess to use agile principles, are quick to cut out pair programming from their software development.
Maybe this should be a code kata, in that a developer should write up a snippet of code and send out for review amongst their peers.
As I was about to ‘publish’ this post, another similar fear hit me. As I put out my thoughts and opinions on this blog, I am sure that I will get something wrong. But I will always have a way to correct it and publish it out again … hey, that sounds awfully familiar to writing code doesn’t it?