Keeping it Small and Simple

2008.03.28

Alfresco, business and community

Filed under: Open Source — Tags: , , — Lorenzo E. Danielsson @ 20:25

Thank you Russ for responding to my concerns regarding your previous post. Your reply fills in a lot of gaps and shows that our positions may not be quite as polar as my first response implies.

A few quick comments follow.

Is it good or bad for society when companies get this large? IMO, it depends — transparency matters at scale.

I understand that certain types of companies need to be large because of the massive investment required to even begin operations. And I agree the transparency is important. Whether or not businesses overall are transparent today is something that only time will tell. Enron, to take but one example, certainly was not.

First. I don’t work for Alfresco. I’m a community member. My opinions are my own.

Okay, cleared. Not that it would really have mattered much. I wouldn’t stop using Alfresco because of personal opinions. I would be afraid to use Alfresco if I felt that it belittled the community supporting it. More on that below.

I absolutely believe that open source has the potential to create both economic and vast social benefit.

Exactly what I hope and believe as well. I just happen to panic anytime I fear that community is being sidelined.

I like many have trepidation with large amounts of centralized power but this is because “absolute power corrupts absolutely. “ We can’t count of the benevolence of individuals or organizations because it is almost always temporal. In our industry IBM, Microsoft, Google have all struggled or continue to struggle to maintain the balance of scale and public perception. Be transparent, focus on the customer.

Well put. On an individual level I will claim that we can safely assume that within each and every one of us the ability to be both selfish and selfless, greedy and sharing, mean and kind. Often several urges exist within us simultaneously. That is why it is so flawed to divide people into good or bad, virtuous or immoral, etc.

We are also all moral agents. As human beings we can understand the consequences of our actions (if we reflect upon them). If I right about what I said in the previous paragraph, then there will be a constant struggle among different urges. In moral terms, we could say that there is an internal fight to do the “right” thing instead of the “wrong” thing. Sometimes one urge wins, at other times another in each individual, leading us all to have some degree of unpredictability.

With corporations things are very much different. Corporations, at least if we mean the modern business corporation, exists primarily to seek profit. It may have other functions as well, but the struggle for higher profits always take the upper hand.

Further, corporations are not moral agents. One could argue that the individuals behind the corporation are moral agents. But with a board of directors, CEO, stock holders, employees, etc., who decides? The shareholders ultimately want profits, which means that a business is forced to seek the path of profit, no matter what. IBM, Microsoft, Monsanto, Enron, Chevron, Exxon, Shell, Bechtel are just a few examples of businesses that have blood on their hands in the search for profits. Blackwater is an example of a company that is extremely disturbing because of the types of activities it involves itself in order to get more for its shareholders.

The System that is Open Source would not survive on community alone. “It’s not about community” is meant to say that open source is not a hierarchy of components but a network and that community alone does not make open source what it is.

It would be very easy for me to nitpick here and rip this apart, but I don’t think that will achieve anything, because I am sure that I understand what you mean, not what you wrote. Open source in some form could survive even without much business support. But that is not a form that neither you nor I would like to see. We want to see open source thrive and that will require a wide array of interests, including commercial ones.

I like Lorenzo believe that the community should be strong via its rights (example: right to fork, right to vote on direction) and diverse.

Obviously this is the core issue for me. It is what gives the open source community its anarchic nature.

When it comes to software development, I favor the model that is used by the Linux kernel hackers, among others. Each developer is essentially working on his or her own project, each of which happens to be a “fork” of Linux. Linus Torvalds studies each of these different forks and pulls in changes that he feels will benefit Linux itself. Very few people actually use Linux however. Most people use one or more of the “forks”.

This is a highly decentralized model. It ensures the liberty of each developer to work on exactly what they want to work on (obviously within the framework of the kernel). It could be validly argued that this can lead to inefficiencies as developers may be stepping on each others’ toes on some parts of the kernel, while parts are not worked on at all. But I would argue that liberty is more important than efficiency. We are human beings, not ants.

Also, assuming that the Linux kernel generates enough interest and thereby enough developers, in theory each part of the kernel should get worked on.

If my developers want to work on MySQL or other open source software (that is contextual to my business) on their own time – more power to them.

Thanks for a good response to something that became a bit of an unnecessary rant from my side. Part of my comments were not really fair, now that I look at them again. I do have a question about the that is contextual to my business. I hope that does not imply that you would be unhappy if they worked on, say, Battle for Wesnoth on their own time. After all, their own time is their own time.

I believe Alfresco should look for community partnership in core development, but I also believe that it will be rare that they find it. Development is expensive business and both sides must find ways to leverage each other in a fashion, which is symbiotic.

I think you are hitting on something here. The are relatively new relationships, at least on a larger scale. Sure companies like Red Hat have been around for quite some time now, but I think it will take a while before community and business in general learn to coordinate activities, to accept and take advantage of each others’ existence.

I remember a few years ago there was a lot of talk about “bounties” where developers solve specific problems for a company, present their solution and get paid. I kind of liked the idea, since I am a notoriously bad employee. It has since got quiet. I am not sure why. Does the model itself not work? Is it not being done right? Did Google Summer of Code kill it?

Open Source and in general the ideas put forward in Clue Train bring balance to the system by empowering the members of the market with a voice and a recognized lion share of the power. It rightly positions the companies in a position of service rather than in a position of supreme power with the potential for the kind of abuse that is associated there.

I have to admit, I didn’t read Clue Train yet. I will do so. Limiting corporate power, as well as any other form of power that cannot demonstrate itself to be legitimate, is very important to me.

Should people be compensated for their work? Yes, without a doubt in my mind. Should we have a social conscious? Yes Absolutely. I think that open source is capable of accomplishing both.

Difficult not agree with that. Note, however, my comments earlier, about the inability of organizations to be moral agents.

I believe in strong leaders who see social interests as commercial interests hence the Peter Drucker quote.

That one will take a bit of pondering. As you would expect, I ultimately do not believe in leaders at all, strong or weak. Or at least, only a few leaders in very specific circumstances who are forced to be accountable for every action they take.

I think that it would be a very good thing if we could get businesses to be socially aware at the same time as the seek profit. We probably differ on priorities. I would say that social responsibility should always take priority. You are probably of a different mind. At least I guess that you would want to get rid of the word “always”. Today, the general idea in most of the business community is the opposite: commercial interests should always take priority, for reasons I have already mentioned. I am very much opposed to that as I see it to be destructive on several different levels: environmentally, socially etc.

At the foundation, we differ in political beliefs. Not necessarily all. I believe that government and the legal system should be totally or largely eradicated, as I think they do far more harm than good. I believe we humans form societies naturally and that within a society there need to be rules. But I think communitarian forms of deciding an maintaining its own rules are better than laws that are dictated by elites (who also have the power to bypass those very laws).

I also believe that capitalism must be smashed. You will disagree here, no doubt, but I cannot find any way to justify a system that is founded on the principle of “individual greed leads to the common good”. History has shown that individual greed leads mostly to individual wealth. A system that does not put up any limits will by necessity migrate into more and more areas in search for more profits. Hence the assault on labor unions, the attempts to destroy any form of social welfare, the rise of large-scale corporate capitalism, global capitalism, war capitalism and disaster capitalism. New areas where profits can be found, while the individual is trampled upon.

In short, the capitalist system will destroy us all if we don’t dismantle it. I have given relatively little thought to how economic life would be organized. I would not want a situation where everything gets collectively owned (especially not if that collective owner is the state). It must be something that guarantees the freedom from working under anybody, individual, organization or the state.

This was hastily put together. Some of your comments deserve more thought. I am also not certain about exactly how open source can aid and promote social change by itself. I have a bunch of loose ideas, but there is nothing even resembling coherence among those ideas. I will touch upon this more at a later date.

Advertisements

2008.03.27

Open source as social change

Filed under: Open Source — Tags: , , , , , — Lorenzo E. Danielsson @ 14:43

On alfresco blogs, Russ Danner writes a rather disturbing post. Russ is interested in what the open source community can learn from big business. This is of course very important, at least if we begin with an assumption that we as humans exist to serve big business. Needless to say, this is the prevailing belief among the ruling elites. And, needless to say, the victims of this system, the vast majority of the world’s population, do not agree.

I, on the other hand, am interested in open source as a model for social change. That is not to say that open source “belongs” to one or the other side. Open source is a method for developing software the focuses on the universal right to view, modify and redistribute the source code underlying the software. I won’t go into the details here. Enough has been written on that already.

Open source didn’t exist in the beginning. What did exist was a nameless form of sharing of code and ideas which was probably very healthy for the software development community. Just like the academic community, where researchers share what they write so that it can be analyzed and improved upon, the early software developers shared their code. The code got looked at and improved upon. The original developer also benefited as she or he got access to those improvements. In short, knowledge in the early software development community was accumulated through sharing.

Eventually, business put its dirty hands into the bowl, and all of a sudden the fruit of people’s labor turned into the property of corporations. Programmers came to be seen, not as creators of software, but as labor. Users no longer had access to the source code itself, only the final compiled version of the software. As a reaction to that, the open source movement (or as some prefer, the free software movement) was born as a reaction to the attempts of business to restrict the rights of computer users to freely share software.

It is important to recognize where the open source movement originated. It didn’t start off with companies all off a sudden deciding to share their source code and allow others to modify it for their own and others needs. No. It started as a grassroots movement that was opposed to losing the right to view, modify and share source code. Business only got involved when it realized that it could make big profits.

I think that the world of open source will be yet another battleground between the haves and the have nots. The elites will use the methods that they are historically noted for, fear, intimidation, threats and the legal system (which they control). The masses have resisted in a number of ways: strikes, boycotts, sabotage etc. All justified methods of response to the intimidation by the bosses. Much can also be achieved by forming alternative communities that by-pass the rigid hierarchical structures of the capitalist system, still working within that system, a form of “societies within a society”. A friend of mine once remarked that these could act as cancers that destroy the capitalist system from within. I cannot comment as I have not given much thought to the possibility of that happening.

I am not opposed to the ability for individuals and organizations to be able to earn an income out of their software skills. I myself, do not survive on air. We live in a system where the majority of us, against our will, are forced to become wage slaves in order to survive. What I am against is big business, that thing that ensures that the vast majority of the worlds wealth remains in the hands of a very small group of families. Of course, those families are overwhelmingly white, Christian and have a special set of values that they feel the whole world should accept.

History teaches us that the elites groups have few, if any, inhibitions when it comes to what is allowed in order to get the dumb masses to understand the God-given right of the elites to rule. Bombing Vietnam to bits, causing death a devastation was considered legitimate. Destroying the American labor movement is seen as a good thing. Privatizing water, a foundation of life itself, is considered fully legitimate. (Obviously the market potential for something that none of us can survive without is staggering.) I could mention so many examples, but it will take me off-course.

Russ Danner is a self-proclaimed capitalist (although he never states exactly what capital he owns) and thus sees the elitist system as good, and who can argue. After all, it has helped 0.1% of the world’s population to amass an enormous amount of wealth, at the expense of the rest, the insignificant have-nots that make up the vast majority. They exist merely to serve the rich. The working classes are themselves to blame, for not picking the right parents, as the liberal theory goes.

So what is Russ Danner’s take on open source? He states:

Open Source is not about the bits, it’s not about the community, and it’s not about licenses. It’s about a better way to do business (read: make money via serving customers.)

It’s not about community, because community implies those ungrateful masses who are supposed to serve the elites. The elites have built up a system called wage slavery which is how things are supposed to be done. Community is the start of dangerous dissent against the ruling order. Never mind that those communities wrote the software. Once the labor is done, business can take over.

Licenses are equally insignificant since the elites control the legal system. If these open source licenses cause the masses to actually believe that they can form egalitarian communities without bosses and without being controlled by those who rule, the legal system can be changed. Imaginative lawyers can invent just about anything they want. Like intellectual property. Never mind how mind-bogglingly ridiculous the whole idea is. Once you control the legal system, you decide. The dumb masses, the “uncontrollable herd” have just to obey. That is their lot in life.

It is about a better way to do business. Business is good, because most people are practically barred from entering that field. Very few have the financial means to start a business, especially in a sector like IT. The liberal propaganda system of course tells us differently. It can safely do so since in practical terms the ability for anybody to set up a business is like the “rags to riches” myth: not a practical possibility.

So, in summary, Russ Danner sees in open source the possibility for big business to take the work of various open source communities and use it to make huge profits. The communities themselves are, as we have seen, irrelevant. Any claims they make equally so (remember, licenses are irrelevant). So Russ sees open source as yet another way for the rich to bleed to poor. And that is good.

He goes on to say:

I would be sorely upset if I found my development staff was hacking MySql code.

I guess development staff means “wage slaves”. What does sorely upset mean? That you deny your developers the freedom to work on what they want to work on? Does it mean that the right to choose only exists for the capitalist class, the bosses? If one of your developers worked on MySQL code on his free time, would you punish him or her for that? What if the changes the developer made to MySQL was beneficial to Alfresco in some way, would that developer be credited for that? Or still punished for their insubordination against the elite way?

But could the open source movement work for social change? Well, not in isolation. But it can play a part. One must be careful not to see all open source users or open source developers as a part of a coherent whole. The only thing that connects us all is the fact that we work on or with software that fits the criteria of being called open source or free software. Otherwise you have the full spectrum of political beliefs, including Russ Danner’s capitalist ones, or the outright racist viewpoints of Eric S. Raymond.

A computer is a wonderful machine. It doesn’t do much. But it does have one particular feature: it can be programmed to do a large variety of things. Big business wants to control the programming part. They want a situation where the computer becomes like a television set. You don’t program that. Business gives you a set of channels to choose from. Business wants to give you a set of software applications to choose from. You should not be developing anything by yourself, let alone share your creations with anybody else. That would be bad. That would be evil. Then you become an enemy of the powerful people you are to serve.

But open source communities can revolt against these injustices. Individual groups of loosely-knit developers and users, without any hierarchical structure, that just develop software for themselves and others to enjoy, can challenge the system. Imagine the joy of working on something that you are interested in, without a boss breathing down your neck all the time, issuing threats and intimidation. Imagine the joy of giving freely, not because it gives you “do-goody” points, but because you are a part of a system of gift-giving. Wouldn’t that be so much better than being constrained by a narrow conception of humans as being “dogs in a jungle, locked up in a fight to death over a single bone”?

The fact is that we the people, have the ultimate power. If you oppose the system in any way you can, we can bring it to its knees. Gain and share knowledge. Share the creations of your mind. Build communities based on equality rather than inequality. Read and gain wisdom. Don’t limit yourself. Learn how to program, learn your history, learn about the political system and how it is used to oppress us all. Learn about why we as human beings are divided, see for yourself who’s interests it serves. And against who.

Don’t apply arbitrary barriers to community membership. The other should be equally welcome regardless of color, gender, educational background, language etc. He or she still laughs like you do, cries like you do, has hopes, dreams and fears like you do. They are being controlled, just like you are being controlled. They are taught to fear you and despise you, just like you are taught to fear them, to despise them. They are being fucked in the ass, just like you are being fucked in the ass.

I wonder if these are Russ Danner’s personal opinions or the opinions of the Alfresco team as well. I have been using Alfresco for some time (not the enterprise version, and I never will). I would not mind being able to sell Alfresco and make some money off that. I would of course then want to donate a part of the proceeds to Alfresco, not because there is a contract that states that I must do so, but because it is the right thing to do. That seems a much better foundation for mutual understanding than the implied threat of the legal system.

Of course, there are alternatives to Alfresco in the open source arena. If Alfresco wants to unleash the destructive force of big business on the movement then I will have to look into alternatives. Or start something new. Re-inventing the wheel isn’t necessarily a bad thing, especially if the current wheel is trying to run you over.

2008.03.08

Back from Takoradi

Filed under: Ghana, Open Source — Tags: , , , — Lorenzo E. Danielsson @ 22:16

Just got back from Takoradi. Henry and I had both been invited to speak at a two-day seminar on open source. I gave a hour-long introduction to open source, and Henry one on CMSes. It went well. I got some new friends and hopefully enough of a group to set up a local community in Takoradi. We want open source communities in every corner of Ghana!

The only bad thing was I had to survive for almost four days without Internet connectivity. 😦

2008.01.28

Intro to hacking on open source: wmymail

Filed under: Open Source — Tags: , , , — Lorenzo E. Danielsson @ 13:34

One of the benefits of open source is that you can modify an existing application to work the way you want it or to fix a bug. Yet, many people don’t do this but rather just accept that their application doesn’t behave “right”. If you look at the Linux community, it used to be very different, before the name “Linux” became a marketing managers wet dream. Linux users were programmers (not in the slimy sense of business types in suit and tie who earn $$$ by writing commercial garbage software, but in the real sense of somebody who writes code to fix things) at the same time and modified tools to suit themselves.

I will use a very simple example to show you that this doesn’t have to be hard at all. I’m going to modify a dockapp called wmymail. Now this example is very trivial, but the principles are the same even with larger programs. Since it is so trivial, there should be no problem following along even if you don’t have much programming experience. You’ll be amazed at just how simple this is.

Some of you will already know that there are dockapps that check your gmail account. But I wanted to use wmymail.

You might not be a dockapp user. Maybe you don’t use a window manager like fluxbox, WindowMaker or blackbox. That’s okay. You can still follow along here, even if you don’t intend to use wmymail. Hopefully you will learn something along the way.

Just to remind you, I am nobody in particular. It’s likely that you haven’t heard of me before. I have spent the last 20 or so years being a really lousy programmer, but keep doing it because I love it. If I am able to do this, then so can you. Now let’s get started.

Background

Last night I just couldn’t resist the temptation to get wmymail working in my fluxbox slit. This is a little mail checker that notifies you when you have new mail. By default it checks you mail spool, but with the help of a command-line option and fetchmail, it can check the status of an IMAP account as well.

Getting and compiling the source

I started off by downloading wmymail-0.3, which is the latest version I could find. I extracted it with tar zxf ~/dl/wmymail-0.3.tar.gz. I compiled, which went find, apart from a few warnings. Compiling is very simple. There is a Makefile in the project directory. To compile you just type ‘make’.

You will need to make sure you have a few things. You need gcc to compile, but that comes by default on Linux. You also need to have libdockapp installed. If you are on a brain-dead distro that separates a package into tiny sub-atomic particles, you will also need libdockapp-dev. Make sure you check the names. On my Debian system, the packages are libdockapp2 and libdockapp-dev. There may be some other dependencies. This is a good time to learn how to read your make/gcc output and use it to figure out what is wrong.

Problems with wmymail

I launched wmymail with the following (in fbrun):

% wmymail -F -i

Before that I had set up ~/.fetchmailrc to connect to my gmail account. The file looks as follows (the names have been changed to protect the innocent).


poll imap.gmail.com
proto IMAP
user 'your.user.name@gmail.com'
pass 'your super secret password'
ssl

In a split second wmymail was up and running. But something was not right. It didn’t appear to check my gmail account at all. Moreover, it pooed temp files into my home directory. The normally go away, as long as wmymail dies naturally, but I cannot stand when application put files into my home directory.

I had two problems, that needed to be fixed.

  1. Write temporary files into a directory designated for them
  2. Figure out why the heck wmymail claims I have 0/0 emails.

Stop polluting my $HOME!

I opened up the file wmymail.c in vim and did a search for “tmp”. The very first hit came on line 285 and looks like this:

char tmpfile[20] = "wmymail.XXXXXX";

As you can see, problem one is solved already. All we have to do is prepend the path to the string. Eh.. you may also want to count characters and size the array up just a little. Your generic, re-usable solution would probably involve checking if the user has set $TMPDIR, checking if the directory exists and all those things. At this stage I just needed it to work for me (always solve one problem at a time), so I simply did:

char tmpfile[40] = "/home/lorenzod/tmp/wmymail.XXXXXX";

See how simple that was. You’ve made your first little modification, and your brain could be left in standby while you did it. That is exactly what I mean. These things are not as difficult as you may think.

Why is it not updating my mail status?

When you launch wmymail with fbrun you won’t be able to see any output, which makes it hard to debug. So kill mymail and start it from rxvt instead. Doing this quickly revealed:

% ./wmymail -F -i 5
wmymail: error when using system() to run fetchmail -c: No child processes

Okay, I had no clue what caused this but now we have some form of a lead. I went back to vim, found the checkfetchmail() function, looking for an error message that looked similar to what I had just got. Lines 305-308 looked interesting

if (system(syscmd) < 0) {
perror("wmymail: error when using system() to run fetchmail -c");
return;
}

The variable syscmd just holds the command-line to be executed. So something is prevent the dockapp from proceeding beyond this point. What could that be? To find out we can do like this: declare an integer called ret in the variable decleration secion of the checkfetchmail() function and add the following:

ret = system(syscmd);
printf("%d\n", ret);
if (ret < 0) {
perror("wmymail: error when using system() to run fetchmail -c");
return;
}

Note that I like to outdent temporary code that I add for testing purposes. If we compile and run again, we get:

% ./wmymail -F -i 5
-1
wmymail: error when using system() to run fetchmail -c: No child processes

So the fetchmail process is returning -1 and wmymail is saying that a return less than 0 indicates an error. The reason for that is available in the system man page (look for the section RETURN VALUE). So we’ve read the section, blindly accepted everything that we read, but we still feel that we want to try something. Looking at the temp file (something like ~/tmp/wmymail.DALuun) we see that fetchmail seems to have run fine, at least if it looks something like this:

% cat ~/tmp/wmymail.DALuun
4243 messages (4236 seen) for some_user@gmail.com at imap.gmail.com.

This lead me comment out the part where we check for the return statement.

ret = system(syscmd);
printf("%d\n", ret);
/*
if (ret < 0) {
perror("wmymail: error when using system() to run fetchmail -c");
return;
}
*/

Compile and run again. Now it should work. So we’ve solved our two problems and haven’t even broken a sweat yet. Now since you are a good program (or at least, aspiring to be one) and not a useless waste product of society like myself, you will add a small comment that you need to look into *why* the commented out code wasn’t working. Take that as an exercise for yourself.

But wait..

If you have a lot of mail you will notice that the largest number of mails that wmymail can handle is 999. This means your total mails will constantly say 999, and if you’re lazy like me, your unread mails will also read 999. 😉

This is simple to fix. We will let wmymail display four-digit numbers. First of all look into the xpm directory. You will find a file called main.xpm. If you cat this file you will see that it would parse as a C file. Yes, XPM (X pixamp) is a graphics format made in heaven. It works well with revision control, diff and all the other every-day tools. XPM files can also be open in Gimp, which is what we will do now.

I suck at Gimp, but was still able to do the following without any difficulty. If you are on the artistic side, you can take the opportunity to improve the look. Below you can see the original image and modified one. (Note: I had to convert this to PNG because stupid WordPress can’t handle the *standard* image format.)

mainorig.png mainnew.png
Original XPM Modified XPM

As you can see I’ve added an image to the end of the left digit box and one at the beginning of the right input box. We still have a small gap between the two boxes as well. Now, we just have to figure out how to code this as well. Actually, before you do that compile and run. That way you will better see why you need to modify the code. In general, you should always make a single atomic change, compile, run and test before moving on. Trust me, it will make you life much simpler.

By looking around a bit we realize that numMessages and numUnread look like interesting variables. More digging leads us to the function updatePixmap() (line 400 +/- a few lines depending on how you formatted the previous edits. Find the block that looks like this:

if (numMessages > 998) {
putnumber(999, outPixmap, numbersPixmap, 40, 49);
} else {
putnumber(numMessages, outPixmap, numbersPixmap, 40, 49);
}

And change 998 to 9998 and 999 to 9999. Do the same in the next block (the one relating to unread mails). If you compile and run you will realize that this doesn’t do much to improve the situation. It rather makes it worse. But don’t abandon all hope quite yet.

In the blocks that we just modified, did you notice how there are calls to a function called putnumber()? That just gives me a gut feeling that we might find something interesting there. That function is the one following the one we are currently positioned in so you can just jump down a little and you will find it.

The very first statement of the function putnumber() gives us much information. Three integers are declared: digit1, digit2 and digit3. I bet adding a digit4 would be a step in the right direction!

But, we are not done quite yet. Right underneath we initialize the digit variables. Modify this to look like this:

digit1 = number / 1000;
digit2 = (number % 1000) / 100;
digit3 = (number % 100) / 10;
digit4 = number % 10;

Before you move on, make sure you understand why this works. Take a few numbers, for instance 6481, 5077, 4000, 231 and 4 and work through them. In each case what values will digit1, digit2, digit3 and digit4 hold?

We’re almost done now. Just one last thing. We need to update the next block of code to look as follows:

if (digit1) XCopyArea(DADisplay, numbers, pixmap, defaultGC,
digit1 * 5, 0, 5, 9, destx, desty);

if (digit2 || digit1) XCopyArea(DADisplay, numbers, pixmap, defaultGC,
digit2 * 5, 0, 5, 9, destx + 6, desty);

if (digit3 || digit2 || digit1)
XCopyArea(DADisplay, numbers, pixmap, defaultGC,
digit3 * 5, 0, 5, 9, destx + 12, desty);

XCopyArea(DADisplay, numbers, pixmap, defaultGC,
digit4 * 5, 0, 5, 9, destx + 18, desty);

Again, make sure you understand why the code looks as it does (make sure you have the man pages for Xlib installed). Notice that we’ve added one XCopyArea for digit4. Each digit takes up 6 pixels, so we have to add a multiplier value to destx for each consecutive digit.

Okay, so we are done, right? Good. Compile and run and… oh!!! Now what is wrong?? Why is the total number of messages miss-aligned? If you think about it for 2 seconds it’s obvious. When we edited the XPM we added a digit to the end of the number of unread messages, but the beginning of the total mails box. In other words we need to shift the position where the total number of mails get printed to the left. We already know that the width of a digit is six pixels, but if we didn’t we could open the file in Gimp again, move the mouse over the left-most part of the first digit and read off the coordinates. Simple!

Go back to the updatePixmap() function. More specifically, find the block that (now) starts if (numMessages > 9998) { and change the fourth parameter in each of the putnumber() calls to read 34 instead of 40. You should make a total of two changes.

Now recompile, run and Vittoria!!! You have done it. Good on you. A triple shot of Vodka is a good idea at this stage, especially if you have a grumpy boss looking over your shoulder.

Wasn’t that just so much fun? From now on, any time the behavior of some software application annoys you, download the source and start playing around with it. Er.. you might not want to start with openoffice.org. There are loads and loads of little applications that you can play around with, just to get your feet wet.

Conclusion

So is that it? Is it really that simple? Well, of course, larger projects are more complex. If you want to start hacking on device drivers you have to have (or build up) a solid understanding of the hardware and the kernel. But, you start off by solving simple things in small projects and gradually work your way up. Many of the people you admire started off doing things like this.

Of course, “professional” programmers don’t work like this. They hate programming, only learned it to earn money. They spend the whole day drinking coffee and having sex in corporate toilets. They earn hundreds of $ a day doing so.

2007.12.16

Torvalds on git

Filed under: Open Source, Revision Control — Tags: , , , , , — Lorenzo E. Danielsson @ 02:26

Yesterday, Henry told me to watch this video where Linus Torvalds gives a tech talk at Google about “his” revision control system, git.

I agree fully with some of Linus’ points. I don’t care much for Subversion either. I also like the idea of distributed revision control. However, I haven’t been able to get into git. Just looking at the tutorials reminds me too much of GNU Arch/tla. I prefer mercurial and bazaar myself.

But to call all Subversion users “stupid and ugly”? Sure it was (partially) a joke, but still. After all, we are talking about somebody who has stated that Theo de Raadt is “difficult”. It’s a bit interesting, Linus and Theo are both good programmers, both are opionated. One of them is worshipped and the other one hated. Oh, well..

2007.12.14

On the OOXML debate

Filed under: Open Source — Tags: , , — Lorenzo E. Danielsson @ 01:18

A few years ago, there was a lot of excitement about the fact that you could import and export Microsoft office documents in OpenOffice. It was considered a relly important feature because it meant that you could use an open source office package and still be able to exchange documents with people who still used MS Office. It also meant that people who wanted to migrate from MS Office to OpenOffice could do so without much hassle.

So why is it that now people are complaining about the fact that some open source office applications have announced that they plan to support OOXML? I think it would be cool if everybody were to use ODF instead, but the fact is that is not going to happen any time soon. Both ODF and OOXML are going to exist side by side. Wouldn’t it be to the advantage of open source tools that they support both?

Not that all this matters much to me. I use Latex.

Blog at WordPress.com.