Samstag, 7. März 2009

How much energy does that steak have?

While studying for the second part of the LPIC 1 Certificate(LPI102), I started messing about with bash scripts. I still way prefer python, but bash is handy to whip together semi useful stuff quickly.
Anyhow, this script quite ineffeciently gets the kilocalorific (kcal) value of (some) foods:
#!/bin/bash
searchterm=$1
data=$(curl -# 'http://www.med-surfer.de/kalorientabelle/kalorientabelle.php3')
echo $data | egrep -i "
.*
" | sed -e "s/<\/td>/<\/td>\n/g" | egrep -i "value='.*kcal.*'>" | sed -e "s/.*value='//g" | sed -e "s/'><\/td>$//g" | sed -e "s/\.\+/ /g" | sed -e "s/kcal/kcal pro 100g hat/g" | iconv -f iso-8859-1 | grep -i $searchterm
Of course, you can see immediately that this is limited to the html formatting on the page above - which in turn means you have to enter your query auf deutsch. Furthermore, you could probably reduce the number of times that sed is called significantly. And you could grep more than just one foodstuff quite easily either. But this at least helped to get me up to speed for the 102.
By the way, everything after the echo $data above is on one single line - the blog format might split it up. Otherwise, do:
  1. wget http://www.foxhall.de/downloads/kal.sh
  2. chmod +x kal.sh
  3. ./kal.sh apfel
I'd be interested in hearing how I could improve it - not what the script does, but how it does it - e.g. reducing the numbers of grep and sed calls.

Montag, 2. März 2009

LPI 102 Objectives by weight

LPI 102 Objectives, sorted by weight

1
1.107.2 Manage printers and print queues
1.107.3 Print files
1.107.4 Install and configure local and remote printers
1.108.5 Notify users on system-related issues
1.114.3 Setup user level security

3
1.105.2 Reconfigure, build and install a custom kernel and kernel modules
1.106.1 Boot the system
1.106.2 Change runlevels and shutdown or reboot system
1.108.2 Find Linux documentation on the Internet
1.109.2 Customize or write simple scripts
1.111.3 Configure and use system log files to meet admin and security needs
1.111.5 Maintain an effective data backup strategy
1.112.4 Configure Linux as a PPP client
1.114.2 Setup host security

4
1.105.1 Manage/Query kernel and kernel modules at runtime
1.108.1 Use and manage local system documentation
1.111.1 Manage users and group accounts and related system files
1.111.2 Tune the user environment and system environment variables
1.111.4 Automate system admin tasks by scheduling jobs to run in the future
1.111.6 Maintain system time
1.112.1 Fundamentals of TCP/IP
1.113.1 Configure and manage xinetd, inetd and related services
1.113.2 Operate and perform basic configuration of Mail Tranfer Agent (MTA)
1.113.3 Operate and perform basic configuration of Apache
1.113.4 Properly manage the NFS and SAMBA daemons
1.113.5 Setup and configure basic DNS services
1.113.7 Set up secure shell (OpenSSH)
1.114.1 Perform security administration tasks

5
1.109.1 Customize and use the shell environment

7
1.112.3 TCP/IP configuration and troubleshooting

Sonntag, 18. Januar 2009

LPI 101 Objectives, sorted by weight

Weight 8

  • Use Debian package manager 101

  • Use RPM package manager 101


Weight 7

  • TCP/IP configuration and troubleshooting 102


Weight 6

  • Process text streams using filters 101


Weight 5

  • Design harddisk layout 101

  • Make and install programs from source 101

  • Work on the commandline 101

  • Use streams, pipes and redirects 101

  • Create, monitor and kill processes 101

  • Use file permissions to control access to files 101

  • Find system files and put them in their correct locations 101

  • Install and configure X 102

  • Install and customise window manager environment 102

  • Customise and use shell environment 102


Weight 4

  • Manage/query kernel and kernel modules at runtime 102

  • Use and manage local system documentation 102

  • Manage user/group accounts and associated files 102

  • Automate system administration by scheduling future jobs 102

  • Maintain system time 102

  • Fundamentals of TCP/IP 102

  • Configure and manage xinetd, inetd etc 102

  • Operate and perform basic configuration of Mail Transfer Agent 102

  • Operate and perform basic configuration of Apache 102

  • Properly manage NFS and SAMBA daemons 102

  • Setup and configure DNS services 102

  • Setup SSH (openSSH) 102

  • Perform security administration tasks 102


Weight 3

  • Setup different PC expansion cards 101

  • Manage shared libraries 101

  • Perform basic file management 101

  • Modify process execution priorities 101

  • Search files using regular expressions 101

  • Create partitions and file systems 101

  • Maintain integrity of file systems 101

  • Control mount/umount of file systems 101

  • Manage disk quotas 101

  • Setup a display manager 101

  • Reconfigure, build, install custom kernel and kernel modules 102

  • Boot the system 102

  • Change runlevels, shutdown, reboot 102

  • Find Linux documentation on the Internet 102

  • Customise or write simple scripts 102

  • Tune user environment and system environment variables 102

  • Configure and use system logs to meet admin and security needs 102

  • Maintain effective data backup strategy 102

  • Configure Linux as PPP client 102

  • Setup host security 102


Weight 1

  • Configure fundamental BIOS settings 101

  • Configure modem and soundcard 101

  • Setup non-IDE devices 101

  • Configure communication devices 101

  • Configure USB devices 101

  • Install boot manager 101

  • Basic file editing with vi 101

  • Manage file ownership 101

  • Create and change hard links and symbolic links 101

  • Manage printers and print queues 102

  • Print files 102

  • Install and configure local and remote printers 102

  • Notify users on system related issues 102

  • Setup user level security 102


Mittwoch, 31. Dezember 2008

FUD and intellectual property 2009

"FUD", short for "Fear, Uncertainty, Doubt", is an acronym which is used to describe the practice of instilling exactly those feelings in customers or potential customers, by convincing them that a competitor's marketplace offering has flaws, defects, shortcomings etc. Nowhere has the acronym been as widely used as in the market for computer software - a market which has only recently come to acknowledge that international standards for things such as file formats is actually a good thing and provides more benefits to customers than the arcane "vendor lock in" practiced hitherto.

If we examine the market for computer software more closely, we can also see that much of the FUD has concentrated not only on shortcomings and flaws of the competitor's software itself, but also on instilling fear in the customer that the rival's product infringes on "intellectual property rights" - or better still, "may not respect intellectual property rights of third parties". Now, that's a bit of a mouthful and it isn't immediately clear what is meant by this statement. Nor is it meant to be clear what is meant. Let me use a little anecdote to try to convey the nonsensical mashup of concepts which is "intellectual property".

Sport is a fairly broad concept - Wictionary defines sport as "[a]ny athletic activity that uses physical skills, often competitive." Anyone remotely familiar with sport will know of football, basketball, baseball, rugby and probably many more. All of these individual games are collectively referred to as "sport/s". I am now going to use an analogy which is probably flawed in many respects, but nonetheless should serve to illustrate why the concept of "intellectual property rights" simply does not make sense.

Imagine a local basketball team has the "exclusive right" to play basketball in a local sports hall. This local basketball team therefore has the right to determine who they play against and when - more importantly, this basketball team has the right to exclude other basketball teams from playing in their sports hall. This is a fairly logical application of the concept of "property" - the "owner" has the right to exclude others (and also to allow others access, as well as to determine the conditions of access). Currently, nobody is complaining. The basketball team is doing nothing out of the ordinary.

Now imagine that there are other sports club in the locality. There is a football club, a baseball club and a swimming club. Each of these games fits under the collective term "sport", yet nobody would compare swimming with football except to state that both involve a degree of physical activity.

On a certain day, a number of families with children move into the locality. Each local club would love the families to sign up for membership. The manager of the local basketball team sends a letter to each of the families in which he states that the basketball club has "sports rights" in the locality, which may be infringed upon by the other clubs. Each family should thus only obtain membership of the basketball club - as you never know when the basketball club would "feel forced to defend its sports rights". This might be enough to instill enough FUD in a family to actually only sign up for the basketball club. On the other hand, it might also be enough to enrage one of the other clubs to write to the basketball club manager to ask him to specify what exactly he means with "sports rights" and to please state how he believes the other clubs to be infringing upon them.

It is probably already obvious, that the tactics of the basketball club manager will only work as long as the family who receives the letter actually believes the FUD. As soon as the basketball club is asked to put cards on the table and actually state for once and for all what these so-called "sports rights" are, any family would be able to judge for themselves, whether or not the "sports rights" were of any substance. Thus, from an objective standpoint, once these "sports rights" are actually in plain view for everyone to see, the "U" and "D" evaporate from FUD. Maybe even the "F", depending on how the "sports rights" are viewed. This is why it may be more profitable for the basketball club to obscure what property rights it actually has to the greatest extent possible, in order to scare as many of the new families as possible into only joining the basketball club.

So what property rights could conceivably be masked by the phrase "sports rights"? To take the analogy a little further, imagine that the basketball club has applied for and received exclusive rights to
  • a new method of connecting an air valve to a rubber ball allowing for much higher interior air pressure and better longevity
  • scoring a point by passing a spherical object through a predefined space
It may be obvious that neither of the above rights is actually limited in scope to basketball - both claims have been deliberately broadened to apply to as many different fields as possible. It is easily conceivable that the first of the above rights would apply to any sport using an inflatable ball. The second is broad enough to encompass pretty much any ball game where a score is made by shooting a ball through a hoop or goal.

Now imagine the locality is called "The Shire" and the traditional colours of "The Shire" are red and white. The basketball team also claims the right to the name "The Shire" and to the traditional colours as its sporting attire. To do otherwise would only cause confusion, the basketball team maintains.

Thus, we can now see the potential property rights which are hidden behind the phrase "sports rights" - we have two claims which are in some way related to sports in general and one claim which is related to the "dress" of the basketball team. To come full circle, the initial two claims could be seen as patent claims and the latter "sporting attire" issue could be seen as a trademark/trade dress issue. Patent law and trademark law are two unique bodies of law which do not have many similarities. Patent law and trademark law are also often lumped together with copyright law and are referred to as "intellectual property rights" in the same manner as the rights in the analogy are lumped together by the basketball team to form "sports rights". The point behind all of this? The basketball team seeks to cause Fear, Uncertainty and Doubt ("FUD") and to gain a competitive advantage from this.

Many people have already made it quite clear that the phrase "intellectual property" is way too broad and shouldn't be used as it lumps together bodies of law which should not be lumped together. RMS is probably the most foremost of these. For 2009, I, for one, will certainly be reducing my use of the phrase - hopefully to zero. More importantly, I will also make an effort to try to explain to others why the phrase is problematic and try to get them to be more precise about what it is they are trying to convey when they use the phrase. Oh, and by the way, I have nothing against basketball!

Dienstag, 30. Dezember 2008

jexec is evil

For the last week I had a number of really, really annoying problems with openSUSE 11.1 - ones which had me wondering why there weren't more bug reports, blog postings, rants etc. The most prominent of these problems were:
  • jexec service causing boot process to hang every so often
  • NetworkManager not started automatically - rcnetwork start necessary
  • not possible to mount usb sticks (even mount hangs indefinitely)
  • unmounting fuse during shutdown takes way too long
After some reading on the issue, I stumbled on this post in the openSUSE forum. After a lot of talk about HAL rules etc, the suggestion was made to disable jexec in the YaST runlevel editor. Once I disabled jexec and java.binfmt_misc and rebooted the system, all of the above problems disappeared.

For anyone wondering what it is about jexec that makes it such a fundamental system component, check out this issue on Sun's website. I can definitely do without it.

Freitag, 19. Dezember 2008

Freitag, 12. Dezember 2008

openSUSE 11.1 coming on December 18th



Get ready for it! Click on the image above to go straight to the openSUSE 11.1 landing page and learn about the cool new features.

My favourite feature? I don't know if you can call it a single feature, but a properly working KDE4 desktop is definitely a big plus for openSUSE 11.1. Working with KDE4 is really easy and quite natural.

Now, I am by no means a big fan of OpenOffice, but the version being delivered with openSUSE 11.1 is easier to use than any of the predecessors.

So point your browser to http://download.opensuse.org on the 18th and get your copy from your local mirror. Or, splash out and buy the box.