Wednesday, December 23, 2009
Tuesday, December 22, 2009
OpenOffice 3.2 RC1 arrives
... and it brings PowerPoint slide shows with music ...
Labels:
OpenOffice
Friday, December 18, 2009
editing files with VI and enforcing certain editor settings
You do know, that you can request VI (or VIM) to make using the tab key equivalent to going e.g. 4 positions to the right (":set tabstop=4"). But what if your colleague opens that file and has a global setting like ":set tabstop=8"?
As long as you don't "globally" agree on this, it will at least help to add a setting with a "file-wide" scope. VI's feature supporting such options is called modeline. There are 2 related settings, that make the use of that feature possible resp. impossible: "[no]modeline", and "modelines=n". For further reading do a ":help modeline" in VIM! (I guess, there are not that many original UCB VI-s around nowadays any more) That shows you samples and the exact syntax for how to add modelines.
I saw Jürgen Gulbins using this feature like 25 years ago, found it useful then, but never applied it myself in the meantime. But now in my current project with mixed VIM and Eclipse usage it seems to make very good sense, but I wasn't able to recall the details. The article, that my Google enquiry pointed me to, was posted in December 2005 on the linux-il list: "vim inline :set". Thanks to Meir Kriheli for answering the question there!
As long as you don't "globally" agree on this, it will at least help to add a setting with a "file-wide" scope. VI's feature supporting such options is called modeline. There are 2 related settings, that make the use of that feature possible resp. impossible: "[no]modeline", and "modelines=n". For further reading do a ":help modeline" in VIM! (I guess, there are not that many original UCB VI-s around nowadays any more) That shows you samples and the exact syntax for how to add modelines.
I saw Jürgen Gulbins using this feature like 25 years ago, found it useful then, but never applied it myself in the meantime. But now in my current project with mixed VIM and Eclipse usage it seems to make very good sense, but I wasn't able to recall the details. The article, that my Google enquiry pointed me to, was posted in December 2005 on the linux-il list: "vim inline :set". Thanks to Meir Kriheli for answering the question there!
Labels:
initial settings,
Jürgen Gulbins,
VI
Tuesday, December 15, 2009
bash version 4 and associative arrays
The new builtin array variable BASH_ALIASES is a nice example for an associative array.
If you do an ''echo ${BASH_ALIASES[@]}" you see all the values, if you do a "set | fgrep BASH_ALIASES" you see, to what the indexes map.
Update:
In December, when I got aware of the new feature, I thought, there is no way to get the list of indexes.
But there is: ${!name[@]} and ${!name[*]} return the list of array keys. This gets explained in the section Parameter Expansion. I am sorry, if my former statements caused confusion.
If you do an ''echo ${BASH_ALIASES[@]}" you see all the values, if you do a "set | fgrep BASH_ALIASES" you see, to what the indexes map.
Update:
In December, when I got aware of the new feature, I thought, there is no way to get the list of indexes.
But there is: ${!name[@]} and ${!name[*]} return the list of array keys. This gets explained in the section Parameter Expansion. I am sorry, if my former statements caused confusion.
Labels:
associative array,
bash
Wednesday, December 9, 2009
my 1st steps in Java: extending a JasperReport sample program using Apache Commons CLI
iReports and JasperReports (and also JasperETL and much more) are open source software, that you can find on JasperForge.org.
I intended to extend jasperreports-3.6.2/demo/samples/text/TextApp.java, so that it would take "-Dname=value" style options. There was a need to make TextApp.java a little more flexible, and that was quite easily to achieve making use of getProperty calls.
A friend had given me the hint recently to have a look at "System.getProperty()", but it turned out to only provide the caller with properties like
I started my day googling for "getopt java", found that nice package "Apache Commons CLI", made use of it within that JasperForge utility, and started scripting a batch run around that utility's targets named "fill..." resp. "text..." in bash, resp. their new sisters, that I derived from them today. Next step is to rewrite that shell script as Windows batch script file resp. as python script to be used in a Windows environment. This work is almost "production ready", but I am facing quite some necessary paperwork, so that the software developed can get made serious use of.
Looks like the Jasper guys had not expected their software to be used like that. The ".jrxml" gets designed using iReport on a Windows box or whatever; after that it is being made use of on any kind of server executing Java classes with access to a database. (I wonder, whether that approach would also work with JasperETL.)
I am quite satisfied with my 1st steps in Java in that JasperReport environment.
I really had no idea and also no perspective of getting thrown into Java development during a commercial project, and even in the context of JasperReport. I do like this.
Update / 2010-03-05:
The atomar production steps described within TextApp.java's build.xml are rather nice and instructive, but they make use of those routines within TextApp.java, where target file names (incl. directory path) get strictly derived from source file names. I added resp. derived productions steps, that make use of thoses methods of the API, that allow you to name the destiny's name explictily. And I also added chains of productions steps into the java source file, so that the calling shell resp. "whatever" script wouldn't have to deal with calling the chained steps one by one itself. So far there are chains starting at .jrxml and at .jasper, and chains that end at .txt and also at .pdf. The idea is to place intermediate files on local disks within temp. directories instead of close to the source resp. final target file (maybe) somewhere on a network file system.
I intended to extend jasperreports-3.6.2/demo/samples/text/TextApp.java, so that it would take "-Dname=value" style options. There was a need to make TextApp.java a little more flexible, and that was quite easily to achieve making use of getProperty calls.
A friend had given me the hint recently to have a look at "System.getProperty()", but it turned out to only provide the caller with properties like
"os.name", according to http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html. So that wasn't quite the route to follow.I started my day googling for "getopt java", found that nice package "Apache Commons CLI", made use of it within that JasperForge utility, and started scripting a batch run around that utility's targets named "fill..." resp. "text..." in bash, resp. their new sisters, that I derived from them today. Next step is to rewrite that shell script as Windows batch script file resp. as python script to be used in a Windows environment. This work is almost "production ready", but I am facing quite some necessary paperwork, so that the software developed can get made serious use of.
Looks like the Jasper guys had not expected their software to be used like that. The ".jrxml" gets designed using iReport on a Windows box or whatever; after that it is being made use of on any kind of server executing Java classes with access to a database. (I wonder, whether that approach would also work with JasperETL.)
I am quite satisfied with my 1st steps in Java in that JasperReport environment.
I really had no idea and also no perspective of getting thrown into Java development during a commercial project, and even in the context of JasperReport. I do like this.
Update / 2010-03-05:
The atomar production steps described within TextApp.java's build.xml are rather nice and instructive, but they make use of those routines within TextApp.java, where target file names (incl. directory path) get strictly derived from source file names. I added resp. derived productions steps, that make use of thoses methods of the API, that allow you to name the destiny's name explictily. And I also added chains of productions steps into the java source file, so that the calling shell resp. "whatever" script wouldn't have to deal with calling the chained steps one by one itself. So far there are chains starting at .jrxml and at .jasper, and chains that end at .txt and also at .pdf. The idea is to place intermediate files on local disks within temp. directories instead of close to the source resp. final target file (maybe) somewhere on a network file system.
Tuesday, November 24, 2009
python and class methods
Yes, they are supported, but you have to use an extra magic function call:
classmethod = classmethod(classmethod)
Monday, November 23, 2009
my new book: Tarek Ziadé: Expert Python Programming
This book is a litte like like Pragmatic Project Automation for the python community. This book isn't really, what I was searching for, but actually it is much, much better. It provides me with a serious level of considering how to make a software project using python a success.
I think, it's a big marketing mistake, to print on the cover and certainly also elsewhere, that this book is targeted towards people with a "sound background in Python programming". I actually think, people with a serious background in computer science (maybe beyond the BSc/BA level) and some knowledge of the specifics of, how python implements the usual more or less "modernistic" (i.e. starting with Simula 67) progamming language features, certainly will gain good profit of enjoying this book. Do yourself a favour and get both, the paper book and the PDF! So maybe you can print one or the other page, and put it on your fellow project managers' desks.
(To be continued ...)
A note to my mates: yes, I got the PDF, and I also got the PDF of the PragProg book.
I think, it's a big marketing mistake, to print on the cover and certainly also elsewhere, that this book is targeted towards people with a "sound background in Python programming". I actually think, people with a serious background in computer science (maybe beyond the BSc/BA level) and some knowledge of the specifics of, how python implements the usual more or less "modernistic" (i.e. starting with Simula 67) progamming language features, certainly will gain good profit of enjoying this book. Do yourself a favour and get both, the paper book and the PDF! So maybe you can print one or the other page, and put it on your fellow project managers' desks.
(To be continued ...)
A note to my mates: yes, I got the PDF, and I also got the PDF of the PragProg book.
software documentation
From the book Expert Python Programming, "Documenting Your Project", "Use a Simple Style":
You are not writing fiction, so keep the style as simple as possible.And with a few more words:
(Another author) made an analysis [...] to try to understand, why his books sold so well. He made a list of all best sellers in the marketing area and compared the average number of words per sentence in each one of them. He realized, that his books had the lowest numbers of words per sentence (thirteen words). This simple fact [...] proved that readers prefer short and simple sentences, rather than long and stylish ones.
Labels:
software development
using associative arrays in your code
How many lines of code does it take for your new piece of code, before you introduce an associative array?
How many lines of code does it take for your new piece of code, before you introduce a class?
Yes, I know, Bourne shell doesn't come with the concept of associative arrays, of course it also doesn't know classes or object orientation. Right, a simple 20 or 30 lines shell script for copying and renaming files may not have the need for associative arrays or classes. But if your script gets longer, pls rethink, whether Bourne shell is the right choice for your task, or whether you make really good use of ruby, perl, or python!
Your next steps may be writing unit testing and using continuous integration. It's not your customer, who should request it, it should be your serious professional style, your way to deliver proper services. If you are not familiar with the terms, look them up -- I provided you with proper links to interesting and informative articles.
How many lines of code does it take for your new piece of code, before you introduce a class?
Yes, I know, Bourne shell doesn't come with the concept of associative arrays, of course it also doesn't know classes or object orientation. Right, a simple 20 or 30 lines shell script for copying and renaming files may not have the need for associative arrays or classes. But if your script gets longer, pls rethink, whether Bourne shell is the right choice for your task, or whether you make really good use of ruby, perl, or python!
Your next steps may be writing unit testing and using continuous integration. It's not your customer, who should request it, it should be your serious professional style, your way to deliver proper services. If you are not familiar with the terms, look them up -- I provided you with proper links to interesting and informative articles.
how to abbreviate the word Character and how German programmers pronounce it
We know, that in a few "modern" programming languages the word "character" as an IT term gets abbreaviated as "char". Do you have any idea, of how many coders pronounce it? They pronounce it like the "char-" as in "Charlie". Why would actually anybody pronounce the abbrevation so much different to the unabbreviated word?
Labels:
IT speak
Saturday, November 21, 2009
Thursday, November 12, 2009
google.com/health
I would like to recommend to you the usage of google.com/health . I think it helps you to fill out your profile and not leave it to the doctors to be the only ones, that know bits and pieces of you, that they don't usually tell you.
Conditions, Medications, Allergies; Medical Contacts.
Conditions, Medications, Allergies; Medical Contacts.
Labels:
Google Health
Wednesday, November 11, 2009
Tuesday, November 10, 2009
how to use UNIX tee to send output to more than one pipe?
I have a necessity for that usage, I googled for it, found an answer here on UNIX.com, but I thought, there might be something slicker. I got myself an account there in order to tell the initiator of that thread, what I am going to find out, but sadly enough, he got banned since. That doesn't happen too rarely.
I like UNIX man pages, and I thought, I should give "$ man 1 tee" a try. That pointed me to "$ info coreutils 'tee invocation'", and that instructed me to use "process substitution", a feature of modern shells. The notation is different, but it's still piping: ">( PROCESS_READING_FROM_A_PIPE )". And you can use it more than once on the process, that you want to read output from.
Now, that is seriously slick enough for me. Read the example there, it's really nice!
Added a note on en.wikipedia.org mentioning this insight.
It is rather tempting to think, that using process substitution you don't even need tee itself anymore at all, but just try yourself, it doesn't work!
I like UNIX man pages, and I thought, I should give "$ man 1 tee" a try. That pointed me to "$ info coreutils 'tee invocation'", and that instructed me to use "process substitution", a feature of modern shells. The notation is different, but it's still piping: ">( PROCESS_READING_FROM_A_PIPE )". And you can use it more than once on the process, that you want to read output from.
Now, that is seriously slick enough for me. Read the example there, it's really nice!
Added a note on en.wikipedia.org mentioning this insight.
It is rather tempting to think, that using process substitution you don't even need tee itself anymore at all, but just try yourself, it doesn't work!
Labels:
UNIX,
unix_utilities
development of a child
I made a new and interesting experience with my 3yr old son last
Sunday.
I was pretty strict and harsh and serious with him (o, how cruel can a father be?! (but self-critical as well!!!)), and he showed pretty good "taking qualities" (german: Nehmerqualitäten), but he still started to show, how much my appreciation means to him: he showed us, he is able to pronounce words with "R" properly now in German, "rot, rot, rot!" he shouted all of a sudden (that's the colour "red" in English), because until very recently he (as a Portuguese native speaker) used to pronounce it "bot", and it took me endless repetitions pronouncing it properly to him, that looked quite unsuccessful to me -- until last weekend. I am very, very touched. I am very proud of him.
P.S. Suggestions for better English always appreciated.
I was pretty strict and harsh and serious with him (o, how cruel can a father be?! (but self-critical as well!!!)), and he showed pretty good "taking qualities" (german: Nehmerqualitäten), but he still started to show, how much my appreciation means to him: he showed us, he is able to pronounce words with "R" properly now in German, "rot, rot, rot!" he shouted all of a sudden (that's the colour "red" in English), because until very recently he (as a Portuguese native speaker) used to pronounce it "bot", and it took me endless repetitions pronouncing it properly to him, that looked quite unsuccessful to me -- until last weekend. I am very, very touched. I am very proud of him.
P.S. Suggestions for better English always appreciated.
Labels:
childhood,
development
Friday, November 6, 2009
strangers contacting me on Live Messenger
On all of my MSN / Live Messenger accounts I disallowed, that people not on my contact list, can send me messages. Still I keep getting IMs from strangers. How come???
No, I didn't google for this phenomenon. Actually I'm not sure, how to express this with 3 to 5 words to be put in a Google search, so that I don't receive mostly irrelevant hits.
Actually I mostly don't use the Live Messenger client itself but pidgin. But of course: the client shouldn't make a difference there. (Actually it does, as I found out later during my research. See below!!)
Anybody any idea?
Update: now that I expressed this thing here, I was able to do a Google search (with the title of this story here), and found this. Didn't help me either, but maybe others will find it helpful.
Another update: looks like actually the client IM software needs to do the blocking, and I found the right settings in pidgin to do that. There is a privacy menu entry (Tools > Privacy), and you have to select "allow only the users on my buddy list" on every single account, if that's what you want -- and I certainly do.
No, I didn't google for this phenomenon. Actually I'm not sure, how to express this with 3 to 5 words to be put in a Google search, so that I don't receive mostly irrelevant hits.
Actually I mostly don't use the Live Messenger client itself but pidgin. But of course: the client shouldn't make a difference there. (Actually it does, as I found out later during my research. See below!!)
Anybody any idea?
Update: now that I expressed this thing here, I was able to do a Google search (with the title of this story here), and found this. Didn't help me either, but maybe others will find it helpful.
Another update: looks like actually the client IM software needs to do the blocking, and I found the right settings in pidgin to do that. There is a privacy menu entry (Tools > Privacy), and you have to select "allow only the users on my buddy list" on every single account, if that's what you want -- and I certainly do.
Labels:
IM clients,
Live Messenger,
pidgin
Wednesday, November 4, 2009
traveling on public transport using an iPhone
In Hamburg (Germany) you can use mobil.hvv.de, in Berlin (Germany) you can use mobil.bvg.de.
For Berlin there also exists a very nice iPhone app by the name of fahrinfo, which I really make use of a lot.
For Berlin there also exists a very nice iPhone app by the name of fahrinfo, which I really make use of a lot.
Labels:
iPhone,
public transport
how to log into your iPhone using the root resp. the mobile account with a well-known password
This article on h-online.com helped me to log into my iPhone via ssh for the very first time. Find the instructions especially here! I used it for changing those passwords immediately, and I also created a ~/.ssh/authorized_keys2 for user mobile. Creating one for user root did not work, even "$ man sshd_config" did not help me, I still have to log in using a password.
Labels:
iPhone
Sunday, November 1, 2009
sipgate's SIP client for the iPhone
sipgate.de re-announced their SIP client for the iPhone on the 2009-10-30.
Downloaded it, started it, nice.
It can of course make us of my address book on the iPhone.
I'm not sure, I would want to use SIP over UMTS (if they don't restrict that anyways as Skype does), but for telephone over WiFi, that's pretty nice.
Downloaded it, started it, nice.
It can of course make us of my address book on the iPhone.
I'm not sure, I would want to use SIP over UMTS (if they don't restrict that anyways as Skype does), but for telephone over WiFi, that's pretty nice.
Labels:
iPhone,
SIP,
sipgate.de,
UMTS
Saturday, October 31, 2009
getting familiar with a Mac keyboard
I was really afraid, it would take me a long, long time to seriously get familiar with my Mac keyboard, but finding the Keyboard Viewer and having a closer look at it wiped out all these fears.
Whatever I thought would be missing on the Mac keyboard, now I find it easily.
Whatever I thought would be missing on the Mac keyboard, now I find it easily.
Labels:
Mac OS X,
Mac OS X Snow Leopard
Thursday, October 29, 2009
creating phone book and diary entries from incoming calls on my router
If you read this title, how mad do you think I am? Honest!
Alright, "as you know" (so of course this article only applies to some sort of computer nerds), my router is a FRITZ!Box 7270, it's also the base station for my (wireless) phones, and a lot more ... -- certainly one of my most important toys or gadgets. And I have 2 of them, one for at home, one for anywhere outside, where I can only connect to the Internet through UMTS.
So alright, back to the title of this article!
Well, my router is running Linux as its operating system kernel, and BusyBox on top of it. On each incoming phone call it runs a shell script with a few parameters, of course the caller's phone# (if available) and also the callee's phone#. (I do have more than one phone#, and why not also record the called phone#, just for the record?) It tries to associate a name with the caller's phone#, if there is a matching entry in the phone book.
Quite a while ago I started implementing such a shell script, and obviously (as it is almost an ordinary (bash) shell script), I can develop and test it on any of my computers, that can run shell scripts, like any of my openSuSE computers, any WinXP computer running cygwin, a Mac running OS X, ... . Yes, I cannot create a full blown shell script, I will not pipe a lot through one-liner perl or ruby scripts on my router, but still: it's a handy and useful, not so tiny shell script.
So far it appears to me, as if no such executable gets called on the router for outgoing calls, but I can still mimic this behaviour by calling that script on my main development box.
Having said this, my script (fritz_box_calllog.sh) fulfills all the requirements, that I listed above in that bullet list.
For incoming calls without caller id and/or without a matching entry in the phone book it creates a piece of XML text, that I can paste into my FRITZ!Box XML phone book, and where I can fill in a phone# and a name or any descriptive text, so next time, I want to dial that phone# myself, I can select it from the phone book. And maybe another time that person will call you with caller id, and then you will be able to greet that person with her/his name. Wouldn't that be nice?
The implementation of this software also got inspired by Matthias Hühne's "Dial!Fritz", that I run on my iPhone. But of course his software is far completer and nicer, and it's well integrated.
Alright, "as you know" (so of course this article only applies to some sort of computer nerds), my router is a FRITZ!Box 7270, it's also the base station for my (wireless) phones, and a lot more ... -- certainly one of my most important toys or gadgets. And I have 2 of them, one for at home, one for anywhere outside, where I can only connect to the Internet through UMTS.
So alright, back to the title of this article!
- It's nice to record your incoming and outgoing calls in your diary, right? (my diary is emacs style)
- It's nice to get something descriptive displayed on your phone, when somebody calls, right?
- It's nice to extend your phone book through time as easily as possible, right?
Well, my router is running Linux as its operating system kernel, and BusyBox on top of it. On each incoming phone call it runs a shell script with a few parameters, of course the caller's phone# (if available) and also the callee's phone#. (I do have more than one phone#, and why not also record the called phone#, just for the record?) It tries to associate a name with the caller's phone#, if there is a matching entry in the phone book.
Quite a while ago I started implementing such a shell script, and obviously (as it is almost an ordinary (bash) shell script), I can develop and test it on any of my computers, that can run shell scripts, like any of my openSuSE computers, any WinXP computer running cygwin, a Mac running OS X, ... . Yes, I cannot create a full blown shell script, I will not pipe a lot through one-liner perl or ruby scripts on my router, but still: it's a handy and useful, not so tiny shell script.
So far it appears to me, as if no such executable gets called on the router for outgoing calls, but I can still mimic this behaviour by calling that script on my main development box.
Having said this, my script (fritz_box_calllog.sh) fulfills all the requirements, that I listed above in that bullet list.
For incoming calls without caller id and/or without a matching entry in the phone book it creates a piece of XML text, that I can paste into my FRITZ!Box XML phone book, and where I can fill in a phone# and a name or any descriptive text, so next time, I want to dial that phone# myself, I can select it from the phone book. And maybe another time that person will call you with caller id, and then you will be able to greet that person with her/his name. Wouldn't that be nice?
The implementation of this software also got inspired by Matthias Hühne's "Dial!Fritz", that I run on my iPhone. But of course his software is far completer and nicer, and it's well integrated.
Labels:
address books,
BusyBox,
diary,
FRITZ.Box,
FRITZ.Box 7270,
FRITZ.Box 7390,
iPhone,
shell scripts
Wednesday, October 28, 2009
a Mac keyboard is so different from a PC keyboard
It really takes me a while to accomodate with all that. Right now I just missed arrow key "accelerators" a lot, and I thought I give a few combinations a try. Guess what! The left and the right arrow key together with the cmd key work like Pos1 and End on a PC keyboard. Try yourself, what the alt key does! Isn't that amazing?!!
Labels:
Mac OS X
the pidgin Facebook plugin
The pidgin Facebook plugin does not work properly so far. A single Facebook user actually talks to me with yet another id, every single time he sends me a message. This does not look tested well enough.
I am using pidgin 2.6.2 (libpurple 2.6.2) from fink on Mac OS X, Snow Leopard.
Update / 2010-12-28:
For quite a while Facebook chat has now been reachable through Jabber / XMPP.
I am using pidgin 2.6.2 (libpurple 2.6.2) from fink on Mac OS X, Snow Leopard.
Update / 2010-12-28:
For quite a while Facebook chat has now been reachable through Jabber / XMPP.
Labels:
Facebook,
fink,
Mac OS X Snow Leopard,
pidgin
Subscribe to:
Posts (Atom)