Symlink Mirror – A Useful Python Script

Just wanted to share a useful little python script I crafted. I creates symlinks from the top level directories in a specified source folder to a target folder. Its a neat little tool for linking between two distant directories under UNIX. Share and enjoy!

#! /usr/bin/env python
"""    Symlink Mirror -----------------------------------------------------------
       Author: Dorian Pula    Version: 0.1    Date: 2008 May 29
       --------------------------------------------------------------------------
       Creates symlinks in the current directory to the top level folders inside
       a specified directory.  Its a great utility for linking a user's home
       directory with a directory holding files shared between users on the same
       system.

       Usage: python symlink_mirror.py [source of links] [target for links]
      --------------------------------------------------------------------------
       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation, either version 3 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>"""

import re, os, sys, stat

verbose = "True"

def main():
    """ The main function of the program. """

    'Check if there are enough arguments supplied.'
    if checkNumberOfArgs():
         'Make the path directories.'
         sourceDir = os.path.abspath(sys.argv[1])
         targetDir = os.path.abspath(sys.argv[2])

         'Get all the names of the directories.
         sourceEntries = os.listdir(sourceDir)

         for toLink in sourceEntries:
             source = os.path.join(sourceDir, toLink)
             target = os.path.join(targetDir, toLink)
             dirCheck = os.path.isdir(source)

             if((os.path.isdir(source)) and not (os.path.islink(source)) and not (os.path.exists(target))):
                  os.symlink(source, target)
                  if(verbose == "True"):
                        print "Linking " + source + " to " + target + "."

def checkNumberOfArgs():
    """
    Checks if there are enough arguments to work on.  There should be two
    arguments, the directory from which we generate the links from, and
    the directory in which the links appear. """

    argNum = len(sys.argv)
    if argNum < 1:
        print("I need a source directory to mirror.")

    elif argNum < 2:
        print("I need the directory to store the created symlinks.")

    if argNum < 2:
        print("nUsage:")
        print("python symlink_mirror.py [source of links] [target for links]n")
        return False

    else:
        return True

if __name__ == "__main__": main()

Spreading Linux as a Scientific Endeavour

I just read Vlad Dolezal’s blog entry about why Linux doesn’t spread. The debate about the reasons why people don’t adopt Linux and a free open source desktop, has gone on for years. Vlad just dredged up the old its free therefore not useful argument. An easy counterexample are what mobile providers: get a free cellphone, pay for the service. Most Linux/open source companies make money from Saas (software as a service) too. In fact most large scale enterprise deployed software firms, do SaaS or SOA (service-oriented architecture). So while I wish Vlad luck with selling copies of Linux, a far more interesting comment turned up.

One commenter on Vlad’s site mentions their luck with “selling” the idea of a free open source Linux desktop as a scientific endeavour. Linux and software libre started off as ventures of interest only to computer scientists. Look here is a neat little OS I wrote on top of Minix (Linus Torvalds). And look here is a way we can run a UNIX system without NDAs, and restrictions of proprietary vendors (Richard Stallman). It was only until Eric S. Raymond started working on convincing developers and business decision people, that free software named as open source, that Linux started into its present course of wider adoption. A good chunk of open source projects are initiated by academics in computer science and communication fields.

The term open source was invented to defeat the argument which Vlad reiterates. Read Eric Raymond’s book, The Cathedral and the Bazaar for more about the idea behind “open source”. Removing the word “free” helps to lift the semantic confusion around the term free software. And treating the open source eco-system as part scientific community, part computer hobbyist club, and part client-oriented commercial paradigm, will all help remove the negative aura that sometimes surrounds Linux and the open source desktop.

The idea of getting involved in a grand experiment in science, appeals to some individuals. But probably only to those affiliated with academia, or in love with the romantic vision of science. Neither this idea of Linux a child of “computer science love” or any one thing will increase Linux adoption overnight. There will not be any mass exodus from Windows to Linux. However we can lower the cost of entering into the world of Linux.

Far more difficult issues face Linux and the open source desktop other than what Vlad mentions. The open source desktop lacks in ease of use, marketing and third party support. Dealing with these issues, will lower the cost of entry to the open source desktop for more computer users. More about this in future articles.

A Free Society Needs a Free Market and Free Software

A few days ago I finished reading Richard Stallman’s “Free Software, Free Society”. The book consists of a number of interesting, well-written essays on the philosophy and history of the free software movement.

Most people heard of open source as a practical development paradigm and distribution method. Eric Raymond’s “The Cathedral and the Bazaar” describes that in more detail so I will not delve much into that topic. Besides I get the impression that many people understand the goals of open source. But not so many understand the reasoning behind free software, which made open source possible.

As Richard Stallman says, free software is “free as in speech not as free beer”. The goal of free software is to bring freedom to software. The freedom of letting users and developer do whatever they want with the software, within limits. The limits being not to take away the freedoms associated with a program and its source code. Richard Stallman explains the cultural heritage benefits and freedom benefits in his book very well.

Many critics of the free software movement voice their concerns over “ownership” of and “marketability” of free software. Some even go so far to call the entire movement “communist” utopia. Me thinks these critics don’t (or don’t want to) understand either how free software works or free markets for that matter.

I will not go into details why a free market is desirable. These ideas are well documented by theorists from Adam Smith to Ludwig von Mises to Milton Friedman. For sake of argument lets assume a free market is desirable. Free markets depend on people owning “capital”. These owners exchange their “capital” with a customer for greater material wealth, which becomes more “capital”.

Free software unlike proprietary closed source software, gives “ownership” to a user. You can only own a piece of software if you have its source code, be able to modify it for a task, and distribute it to whoever you please. The only restriction is that you must not take away those freedoms. The price of freedom is eternal vigilance, Abraham Lincoln once said. The free software with its “give back others freedom” clause, maintains the software’s freedom in perpetuity. Interestingly, this “give back” clause meets the most opposition.

In proprietary software, you get a license to run the program. Usually only one program on one computer by one person, and you are not allowed to give out copies of that program. And you can’t change the program because you don’t have the software. You don’t own the software.

Lets compare this to what happens in real life. You go to the store, and buy a drill. Now you own that drill. You can do whatever you want to with it. You can sell it. You can use it. You can disassemble it. You can use it to power your motorboat if you choose to. It might void your warranty. But you can be sure whatever you do with that drill, and you don’t break a law while using it; you will not have the police coming to your door.

If anything free software is far from being communistic. It gives you more ownership than the closed source software does. Free software encourages a free market, but also asks you to do so ethically. It asks for you to respect the freedoms of another person. Respecting the freedoms of another person is what a free society is about. Respecting the freedoms of a customer is what an ethical seller in a free market does. Furthermore free software with its “give back” clause promotes the idea of giving away “capital” in the form of ideas, work, code, documentation and the software itself; which gives the giver more capital. In fact it gives back more capital for everyone. Everyone wins, and everyone keeps their liberties.

Communism tramples on the freedoms of individual ownership. Free software promotes the freedoms of individual ownership.

Free software promotes ethical behaviour in programmers, cause your code is for all to see. Free software promotes ethical, sustainable entrepreneurs, who know they benefit if everyone benefits. Also often free software ability to be given away, increases a software’s exposure to potential client, better than any sale force can. Free software is also probably the only thing that lets the software market have any chance of become free of interference from corporations and governments. Only a few greedy monopolies and individuals will suffer from free software, but these people don’t care about hurting others to make a bit of cash.
A few days ago I finished reading Richard Stallman’s “Free Software, Free Society”. The book consists of a number of interesting, well-written essays on the philosophy and history of the free software movement.

Most people heard of open source as a practical development paradigm and distribution method. Eric Raymond’s “The Cathedral and the Bazaar” describes that in more detail so I will not delve much into that topic. Besides I get the impression that many people understand the goals of open source. But not so many understand the reasoning behind free software, which made open source possible.

As Richard Stallman says, free software is “free as in speech not as free beer”. The goal of free software is to bring freedom to software. The freedom of letting users and developer do whatever they want with the software, within limits. The limits being not to take away the freedoms associated with a program and its source code. Richard Stallman explains the cultural heritage benefits and freedom benefits in his book very well.

Many critics of the free software movement voice their concerns over “ownership” of and “marketability” of free software. Some even go so far to call the entire movement “communist” utopia. Me thinks these critics don’t (or don’t want to) understand either how free software works or free markets for that matter.

I will not go into details why a free market is desirable. These ideas are well documented by theorists from Adam Smith to Ludwig von Mises to Milton Friedman. For sake of argument lets assume a free market is desirable. Free markets depend on people owning “capital”. These owners exchange their “capital” with a customer for greater material wealth, which becomes more “capital”.

Free software unlike proprietary closed source software, gives “ownership” to a user. You can only own a piece of software if you have its source code, be able to modify it for a task, and distribute it to whoever you please. The only restriction is that you must not take away those freedoms. The price of freedom is eternal vigilance, Abraham Lincoln once said. The free software with its “give back others freedom” clause, maintains the software’s freedom in perpetuity. Interestingly, this “give back” clause meets the most opposition.

In proprietary software, you get a license to run the program. Usually only one program on one computer by one person, and you are not allowed to give out copies of that program. And you can’t change the program because you don’t have the software. You don’t own the software.

Lets compare this to what happens in real life. You go to the store, and buy a drill. Now you own that drill. You can do whatever you want to with it. You can sell it. You can use it. You can disassemble it. You can use it to power your motorboat if you choose to. It might void your warranty. But you can be sure whatever you do with that drill, and you don’t break a law while using it; you will not have the police coming to your door.

If anything free software is far from being communistic. It gives you more ownership than the closed source software does. Free software encourages a free market, but also asks you to do so ethically. It asks for you to respect the freedoms of another person. Respecting the freedoms of another person is what a free society is about. Respecting the freedoms of a customer is what an ethical seller in a free market does. Furthermore free software with its “give back” clause promotes the idea of giving away “capital” in the form of ideas, work, code, documentation and the software itself; which gives the giver more capital. In fact it gives back more capital for everyone. Everyone wins, and everyone keeps their liberties.

Communism tramples on the freedoms of individual ownership. Free software promotes the freedoms of individual ownership.

Free software promotes ethical behaviour in programmers, cause your code is for all to see. Free software promotes ethical, sustainable entrepreneurs, who know they benefit if everyone benefits. Also often free software ability to be given away, increases a software’s exposure to potential client, better than any sale force can. Free software is also probably the only thing that lets the software market have any chance of become free of interference from corporations and governments. Only a few greedy monopolies and individuals will suffer from free software, but these people don’t care about hurting others to make a bit of cash.

Free software is good for society. Its good for business. Its good for customers. Its good for developers and the future of software.

You can download a copy of Richard Stallman’s “Free Software, Free Society” here:
http://www.gnu.org/doc/book13.html

Why Open Source Projects Make Sense Career Wise

Greetings Earthlings! (OK enough silliness for one day, back into the pocket you go Martian.) Once again I have to bring up the sort of lame excuse of being too busy to blog earlier. Well yes, it was lame too much work. Actually I killed my “1337” Gentoo box doing an update. So I basically installed the new Ubuntu 6.06, and I am in the process of setting things up. More on the new Ubuntu tomorrow.

Today’s rant is why open source projects make sense. At least from a university student’s point of view. Undergrad in CS to be exact. All other information from me will have to be extracted via torture, slyness or greasing of palm. 😉

Back to the topic, I am in the process of finding an internship position for the next 12-16 months. So far my own personal experience has mostly unsuccessful. The interesting part is that for the two interviews I have received, my interviewers were most interested in my open source projects. They glossed over my “work” experience, if you can call it that in my case. University courses were not even mentioned. Nope, the thing that stood out were the two projects I am currently actively involved in. For those in the unawares, I actually have 3 open source projects in the works. While initially I thought that working on these projects would be fun and simply educational, it turns out that they mean more than that.

There are three main reasons why I believe employers are interested. These being experience, portfolio and marketing. When you work on a project you have to not only have a grasp on the technology but also on the subtilties of team relationships, and organization. Any open source project will showcase your performance as a developer and/or project leader. The final product is interesting in itself. A look into your source code will reveal your work ethic, organization, knowledge, talent and creativity. Finally comes marketing, which applies mostly to the employer and sometimes to yourself. The words “open source” currently flow with the hype and buzzwords of the business world. By hiring an open source developer, the company gains a zen and almost messanic reputation of by part of what the business world sees as the future. Personally I think open source means plain old fashioned politeness and embraces the ethics of old (the “new” standard of “Western” ethics is quite dissettling). In some rare cases if the project is successful enough, the product becomes a brand onto itself. Any developer of said project also gains a certain amount of worth and can use this to his or her advantage when looking for work.

Well that is all great and everything but how can one gain these advantages. Simply put start a project for something that you need or want. Treat if it were a real life product to sell not just a “pet” project. This is how many open source companies themselves started out. Show your professionalism throughout the process. Try new things, and over time maybe that project will pay off in hard, cold cash.

Till tomorrow,
Dorian

Stepping Mania

Life has been pretty hectic recently. I guess basically it always was but I was too busy gaming to notice it. Talking about gaming I bought my first new game recently, HL2 Episode 1. Excellent game and loads of fun. Strangely very re-playable and Valve has worked hard on making the game believable with good AI and HDR. Without spoiling the plot too much, the best parts of the game were: a new enemy, HDR (kept on blinding myself with a flashlight against a white wall) and the story.

As I mentioned in my previous post, I am busy working on a new project recently. Basically a minimalistic web framework that you can drop into a website or extend to your heart’s desire. The only real problem recently was getting the Subversion repository working, and finding a new name for the project. It seems that at least two other open source projects have the names simplesite. I choose a new and original one. I am not going to release it yet until I get the SourceForge admins to change everything around properly.

I have been searching for jobs recently for PEY (UofT’s version of an internship). I need the money and the experience is welcome. Besides I want to decide upon my career path before I finish university. Might be a dev, tester, admin or a researcher. Right now I applied to two different places. We will see how it goes. Also I can’t get the courses I want either (might need to ruffle some feathers in that department).

Other than that nothing much else to say. I might say some nasty comments about one crazy nation doing “preemptive” invasions of another country. Looking for terrorists they say. What a pity most of their kills are civilians. Meh that what you get when you have one state-sponsored terrorist group going out to defeat another private one. Idiots.

On a brighter note, might go clubbing sometime soon. Continuations in writing, coding and other mad activities will also follow. Stay tuned for more.

Delay/Hiatus… Sorry

Its been a while. And the excuses are myriad. But I am back.

A lot of things have happened since my last post. I was sick most of May and mid-June. I have been working on a summer job since May too, and felt too tired to do much of anything. I seem to have balanced most things out recently though. Anyways, I will keep my blogs shorter and more frequent. Today I have been busy setting up a site for a new project of interest of mine: SimpleSite. Its in the premature stage but its a start.

Anyways gotta run and do a few more things.

Lurking in the Shadows…

Well its a new year, but I have been lurking mostly in the shadows. Nothing much happening, other than the start of classes. Life is the same as always. Chaotic. And my house is divided up into territories (rooms) held various factions (members). 😉 So far, I think the year is alright. Too early to tell naturally. But I hope that this year will be the year I really break out into the open.

Having said that, I started working intensely on a the new news and gallery pages for my two projects, justCheckers and Insomia. Seeing that I could join my work together in a simple cohesive whole, and the potential that it might be useful for more people than just me; I started a new project. This project, Simple Site, plans to create a simple, bare bones content management engine that will allow for developers to add news, and image gallery functionality into their sites. This engine will be so simple, that it will easily be modded into any custom website that uses PHP and MySQL. Now all I need to see if SourceForge will accept my proposal.

Well I am off, to play a short round of VegaStrike and work on Datasphere work.

Framebuffer Fracked but System Up and Running

Live in the inside of a particle accelerator is quite fast. You hardly get time to look around, but still things happen. So you are never too bored. Buts its no fun… especially if you are about to have a head-on collision with your opposite-spin counterpart at 0.99999C. Enough about high energy physics research, more about me.

Recently, I have concentrated almost exclusively for next week, and especially with building my Gentoo system. The Synaptics touchpad on my laptop gave a lot of trouble, and even worse was the framebuffer. Everything is now working, except for the blasted framebuffer. Naturally, it took nearly ten recompiles of different kernels to get it right. And a lot of searching. As of right now, I have a working X, with a minimal KDE install, Abiword, and Firefox. Its still a long ways away from the hard core developer production system I need. Fortunately most of the hard work is done.

Truth be told I have been slacking a bit. My room is still a mess, things are misplaced, and I have not touched my notes (let alone the assignments) yet. The resume still needs to be done, OSAP picked up, rides, scheduling, et cetera, et cetera, ad nauseum. Better get cracking. Night.