Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Category: programming

Floating point stuff in Bash

Shell scripting is powerful, but unfortunatelly it gets less easy if you want to perform floating point calculations in it. There’s expr, but it only handles integers: [todsah@jib]~$ echo `expr 0.1 + 0.1` expr: non-numeric argument If you wish to perform floating point calculations in shell scripts, you can use the bc tool: “bc – […]

Learn your language’s basic features

Sometimes I’d really like to bash in my own head with a 2×4. I just spent at least 20 minutes figuring out why the boolean expression ($options & PW_SORT_DATE == PW_SORT_DATE) didn’t evaluate to true, even though $options had a value of 2 and so did PW_SORT_DATE. Then I suddenly realised that PHP’s == operator […]

Information harvested by NSA larger than acknowledged

From Slashdot: The New York Times is reporting that the “volume of information harvested from telecommunication data and voice networks, without court-approved warrants, is much larger than the White House has acknowledged.” The NSA gained the cooperation of many American telecommunication companies after 9/11 to access streams of communication, both domestic and international, as a […]

MySQL storage engine woes

Are you suffering from mysteriously failing insert queries due to foreign key constraints errors in MySQL? Have you noticed spontaneous table storage engine changes from InnoDB to MyISAM, but can’t figure out why they’re happening? You may be coming under the influence of the MySQL Command Center which, when altering a table via the Edit […]

A DO and a DON’T for OO programming

Here’s a little DON’T hint for OO programming: Don’t use classes to cut up your program. Here’s a little DO hint for OO programming: DO use classes to create small libraries which are all seperate entities that your program uses (and, in essence, consists of) When writing a program, ask yourself this: “Can I seperate […]

More XML Commandline unix tools

A little while ago I reported on a little XML toolset called XMLStarlet. XMLStartlet provided a bunch of commandline tools for reading and converting XML files from the commandline. Usefull in scripts. However, it uses a pretty complex interfacing. For instance, you’ll have to know XPath to easily select a particular piece of XML to […]

RSS2MySQL v0.1

For a colleague of mine: RSS2MySQL v0.1. A Small script which reads in an RSS feed, takes the news items and then puts them in a MySQL database.

floc; something I’ve been working on.

[user@jib]~/dev/PERS/floc$ ./floc.py –stats Statistics on the index: Known files: 0 Known words: 0 Known dirs : 0 [user@jib]~/dev/PERS/floc$ ./floc.py –check-index /home/user/notes/ [user@jib]~/dev/PERS/floc$ ./floc.py –update-index [user@jib]~/dev/PERS/floc$ ./floc.py –stats Statistics on the index: Known files: 108 Known words: 5103 Known dirs : 31 [user@jib]~/dev/PERS/floc$ ./floc.py –query “vakantie” /home/user/notes/personal/vakantie/research.txt /home/user/notes/work/organisatorisch/todo.otl /home/user/notes/work/development/zx/wiki/pmwiki_status [user@jib]~/dev/PERS/floc$ cat /home/user/notes/personal/software/laptop_stats HP Compaq NC6120 P740 […]

gExec v0.3

Version 0.3 of gExec released. Changes: Bugfixes Addition of the –keepopen option which will keep gExec open after running a command. Project page Download

Python documentation drawback solved: DOH

One of my main issues with Python was the terrible documentation. The module reference manual often omitted various methods and other details. It’s even completely down right now. Turns out though that this problem is quite easily solved by the ‘pydoc’ utility. I’d already used pydoc to generate documentation for my own programs, kind of […]

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.