betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

Entries : Category [ digital ]
Things having to do with digital world items go in here.
[digital]  [language]  [life]  [security]  [media]  [zope]  [tourism]  [limnos]  [mac]  [athens]  [travel]  [montage]  [food]  [fire]  [zwiki]  [schnipsel]  [music]  [culture]  [shellfun]  [photography]  [hiking]  [pyramid]  [politics]  [bicycle]  [naxos]  [swim] 

26 November 2011

Installing psycopg2 on Mac OS X 10.6 with a 64bit Python

Balance Postgres, Python, and bits

While installing a Django application that uses Postgres on my MacBook with Mac OS X 10.6 (Snow Leopard), I ran into some problems that were all over the net. The symptom was that when I tried to pip install the app's requirements, I got a traceback with something like this for psycopg2:

ImportError:
dlopen([...]/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
...
Expected in: flat namespace

Searching the web for this found lots of things, but they didn't seem to work for me... because of some dead bodies in my Mac's basement. Basically this errors happens due to a mismatch of 32 or 64 bitness of Python, psycopg2, and Postgres. I had installed Postgres from the official installer (9.1.1), Python 2.7 was standard from the system (which is 64bit). First attempt to fix the mess, following a tipp from Anna Vester, I tried to recompile psycopg2:

pip uninstall psycopg2
...
env ARCHFLAGS="-arch x86_64" pip install psycopg2

I'm not using sudo, because I'm in a virtualenv and also I didn't dual install for i386 as suggested in the blog post. There were a lot of posts out there telling me simply to reinstall psycopg2, which didn't get me anywhere.

But... even with this it didn't work for me. I found some other hints out there that got me looking in the right direction. The second problem was that I had an old version of Postgres around, from when my MacBook was running 10.4. The pg_config from that old version didn't like the psycopg2, even in 64bit. Pointing my path to the new postgres bin directory instead of the old one solved that too.


Posted by betabug at 19:33 | Comments (2) | Trackbacks (0)
05 December 2011

Doing my own accounting

ledger and hledger to the rescue

Now that I am running my own business, there arises the question of accounting. Actually that question had been posed way before the business was there and I've thought a lot about it. There are three strategies:

  1. Do your own bookkeeping
  2. Do your own bookkeeping, get help from an accountant for closing the books and doing the tax papers
  3. Give it all to an accountant

So far I've chosen strategy 1, with an option to switch to strategy 2. I've had to learn a lot, despite having done double entry accounting in the past and despite having coded lots of business software in my life (hey, if you need anything like that, we're here to help!) But having to learn so much is exactly why I consider strategy 1 to be a major win for me. You see, the stuff that I'm learning about, often means that there are decisions made. You can do stuff one way or another. Or it means that you have to beware of things you might be doing "in real business life", which have an outcome on what happens in your books (and therefore in your taxes).

So if I go with option 1, it means that I have to learn a lot about stuff that I have to know anyway. If I give my receipts and all that to an accountant, then I have to have a lot of trust in that person. What's more, I need a very good communication with that person, because I will have to consult her on a lot of my business decisions. I might readily switch to option 2, because doing it all alone has risks too, but then I will be already on a base of knowledge that lets me work around some pitfalls. Even when my company gets so big (and I'll get so philthy rich) that doing my accounting is no longer an option, the knowledge will serve me well.

As for the software for accounting... you can spend a lot on that. Depending on where you (or your business) is located, you will have to spend a lot, because in some countries they allow only certain "certified" accounting programs. In my companie's case (Switzerland), any reliable software will do. Being a true geek, I found ledger and hledger, which are command line accounting programs. "ledger" (also called "ledger-cli" sometimes) is the original version, coded in C++ (so it's also called "c++ ledger" sometimes). I had some trouble getting it installed, but finally got version 2.6.3 up and running using "homebrew" on Mac OS X. As for "hledger", the "h" is an indication that it's writtin in Haskell. There is a (slightly older) binary on the site, which was enough to get me up and running fast. I've since managed to compile my own hledger too.

These CLI ledger programs basically work by entering "entries" into a "journal" file in a simple format. This approach was very welcome for me, since it allowed me to play around until I had reactived my memory about how double entry accounting works. While I was reading up I could try things out and check with various reports how it all worked together. For a while I had one category of entries "the wrong way around" and it was easy to correct once I figured it out. Even from the most flexible GUI accounting programs, I remember this kind of thing to be much more complicated.

These two programs share a (more or less) common file format, so with a little care it's possible to use both of them in parallel. Which I do now, because there are some features that hledger doesn't have yet, while it feels more comfortable in other respects. The features I miss most (and for which I turn to "c++ ledger") are the --wide and --related options for showing a "register" of an account. Gotta really learn Haskell now, so I can contribute that stuff myself! :-)


Posted by betabug at 18:43 | Comments (0) | Trackbacks (0)
17 February 2012

Got a new ebook reader: Cybook Odyssey

Replacement due to breakage

My old ebook reader (Bookeen Cybook Opus) fell down some time ago, the screen cracked. It wasn't really an excellent product, but it did the job, so I don't think I would have replaced it anytime soon if I had had a choice. But with this turn of events, I had to look around. The "big" offerings from Amazon and the like were out of the question for "political" reasons, no way am I going to tie myself into those corporate orwellian worlds. Besides, I'm mostly reading the classics, which I get from Project Gutenberg.

In the end I decided to look for Bookeen's latest product, the "Odyssey". (Someone should examine my psychology for buying again from a company that I bought a rather shaky product from before.) To my defense, I must say that this time I checked some reviews through the mobileread forum, and those reviews looked satisfactory. So, how have I been faring?


I'm happy with the new device. It's a bit heavier (one big advantage of the Opus was that it was really incredibly light, totally made for one-hand reading). The software is much stabler, it hasn't crashed on me even once. The screen appears to be a bit better - I can't compare them side by side, since my Opus' screen is crashed. The screen is certainly much, much faster, page turns are not noticeable any more. In fact the screen is so fast that they waste time by animating opening a book, which becomes annoying quick. (Even more annoying when I tapped the wrong book on the touch screen and when that books is from Project Gutenberg, with no meaningful title page.)

The Odyssey has a touch screen, which is fancy in some respects, but then it also leads to a smudgy screen in need of cleaning all the time. I would have been fine with a couple of more buttons and the button interface of the Opus.

There are some extra software features, like the "Home" screen that allows access to the last 5 books opened ("Now Reading"). Also the last 25 added books - but since they are shown only with the "cover", and much too small, this is useless. On my friend Saad's "nook", they use a text list for these things, which is much more usefull. The "slide" on the touch screen for moving between "last read" books is a "hit and miss" business, for me it often opens the wrong book instead of showing me another choice.

There is also on the "Home" screen a huge link to the online shop of the company where I bought the reader, which I can't seem to get rid of. Well, I bought it for 130 EUR at the Virgin Megastore in Paris (including the cover, which would have cost 23 EUR or so normally), instead of paying 180 EUR for it here in Greece. So that "ad" on the Home screen is the price for my money saved.

The Odyssey lets you set bookmarks and annotate books. Some people may like this, for me it doesn't play a big role. This is one feature where they needed the touch screen, for the on screen keyboard. There's a french lexicon too - useful when I read Jules Vernes, and lexica in other languages are in the works apparently. More high tech is in wifi and a web browser. Now I can load books directly from gutenberg.org (works very well), look stuff up in wikipedia and read the news. The browser is a bit of a hack though, don't expect too much.

What's weirdly missing is a search feature. Can't search neither inside a book nor through all books. Not really in the class of features that I totally miss myself, but in the list of "kind of obvious features to put in an electronic reader device". The PDF support is still the same, not being able to "reflow" PDFs. So this works only for PDF documents made for the format - what I do is to converto PDFs to ePUB.

What else? Battery live seems to be much better than on the Opus, but the battery isn't replaceable any more. (The replaceable battery of the Opus was something that I was very fond of.) I never switch the device off totally, yet I haven't gotten stuck with an empty battery yet. The on/off/standby button is oddly placed and tricky to use.

In the end what matters for me is a good screen, because I really, really use the device to read books. I'm enjoying the faster page turn speed. Also the battery life and lack of crashes (the Opus often crashed when the battery reached 40%). Everything else is a bit of a game to me, nice to have to waste a bit of time sometimes.

Posted by betabug at 18:23 | Comments (2) | Trackbacks (0)
23 February 2012

Caecilia Font for ebook readers

Caeciiiiiiilia... !

Somewhere on the MobileRead forum (where I'm only lurking), I found a recommendation for the Caecilia font for use on ebook readers. The poster said that the font has thicker serifs, which would work better on e-ink displays. You can download the font on the FontYükle site. I got the "Roman" version, tried it out on my Bookeen Cybook Odyssey, and I think it's working fine - I still use it since I loaded it.

I don't think that it's a matter of "thicker serifs" though - I think the font just draws a bit "fatter" and wider, which works better on the display if there is lower ambient light. It's not as fat as the "Emboldened Text" setting of the reader, just slightly fatter. On the downside, the text looks less like in a book now to me. So from an aesthetic point of view, I don't like the font so much - while from an utilistic point of view it works well for reading.


Posted by betabug at 20:03 | Comments (0) | Trackbacks (0)
07 March 2012

Service Announcements: Currently No Commenting

Gotta fix things

A short service announcement: Due to a persistent SPAMmer who managed to get by my first line of defenses, commenting is for the moment turned off. Sorry for the inconvenience. This spammer doesn't manage to actually post comments, but I get a lot of notifications (and moderated comments are in the system). I'll fix things soon.


Posted by betabug at 11:58 | Comments (0) | Trackbacks (0)
20 March 2012

An Evening at the Hackerspace

Learning lots of stuff

I spent this evening at the hackerspace.gr, in the company of my friends graffic and tralala and a few other good people there. The time spent there was not only fun, but very productive for me:

In difference to the last 2 times I was there, it was a quiet evening, but totally worth it, for fun and profit!


Posted by betabug at 23:41 | Comments (0) | Trackbacks (0)
25 May 2012

Back to Bookeen

Got my ebook readers back

The screen on my first ebook reader (Bookeen Cybook Opus) broke a long time ago. Some months ago I also broke the screen on the ebook reader I bought as a replacement (Bookeen Cybook Odyssey). So I calculated about sending them in for a repair. Now this kind of thing isn't covered by the warranty, even though some people complain that these screens break way too easily (not just Bookeen's, but all current ebook readers). The repair isn't cheap, getting them both repaired costed almost as much as buying one new one. In the end I went with the repair because a.) this way I have two readers for the money and b.) I don't like the "throwaway culture" that is all too abundant these days.

I got my readers back this Wednesday. There were some delays in sending out the devices (on my side). Also the confirmation mail that told me where to pay for the repair got stuck in my spam folder (something that hasn't happened for more than a year). I paid for the repair in the online shop on Monday and on Tuesday FedEx was knocking on the door for the first time... impressive.

My first impression was that these readers weren't repaired but replaced. So much for avoiding the "throwaway culture", but fine with me. Especially on the Odyssey, there are some changes to the hardware: There is a different on/off switch and USB connector.

So I'm back to reading on the ebook reader. Of all things, I picked up Moby Dick again. Then I switched to some short stories I had found online, then to some technical manuals. Business as usual on the ebook reader. I'm a bit over cautious with the screen though, but I guess I'll relax soon enough.


Posted by betabug at 10:00 | Comments (0) | Trackbacks (0)

Convert CHM to epub with Open Source Software

Command line information

Speaking of ebooks and technical manuals in my last post: I had some stuff that was in "CHM" format. Now in theory calibre can convert from CHM to epub, but it never worked for me. All I ever got was the contents and maybe the first page. Given a bit of command line use, there was an easy solution for me.

I used chmlib (in my case the OpenBSD chmlib-0.40p0 package) and htmldoc (the htmldoc-1.8.27p6 package). First with extract_chmLib the chm file was converted to a directory full of html files. In the next step I ran htmldoc with the --continuous option to make one big html file out of all the chapters and parts. In this case the parts were named so that they went in proper order, I don't know if that is usually so. I only had to do some minimal cleanup in the html.

This big html file would already have worked in the ebook reader, but I went one step further and converted it with calibre to epub format.


Posted by betabug at 10:20 | Comments (0) | Trackbacks (0)
27 May 2012

One Year of hackerspace.gr Party

Good times in these times

Saturday evening I was at the "one year of hackerspace.gr" party... at the hackerspace. Besides the good people I know through the hackerspace itself, I met there also Panos and Javier. I haven't been at the hackerspace from day one (as I was busy with other stuff in those times, see previous post), but I still felt entitled to show up for the party!

The evening started with the last two talks of the hackfest 11 that was right before the party. Then it just went over to party mode, which means that small groups of people were having interesting discussions on all kind of technical or non-technical stuff.

One thing that comes to mind right now was the story of the guy who had rigged a chainsaw motor to his bicycle. No, I didn't saw the guy, neither the bike, but someone there described the encounter. The "cutting parts" were removed from the chainsaw.

Then there was the (very tasty) birthday cake, with one electronic candle on top... which was blown out by Pierros.


Posted by betabug at 23:03 | Comments (0) | Trackbacks (0)
31 May 2012

SSH Mastery: OpenSSH, PuTTY, Tunnels and Keys

Book review: An introduction to using SSH

Some weeks ago, undeadly.org published an announcement for the book "SSH Mastery" by Michael W. Lucas. The book isn't expensive and I was in the mood, so I bought it at smashwords. (At smashwords I was able to get it both in PDF for reading on the 'puter and in epub for the ebook reader. No DRM either, very reasonable.)

Now, this book came probably a few years too late for me. If you aren't using the ins and outs of ssh yet, if you feel confused by all this stuff ssh does, this is the book for you. It covers OpenSSH and Putty. There's a lot of practical info in there. But then the author clearly says what the book is not:

This book is not intended to be a comprehensive SSH tome.

Too bad, since that would be really nice to have! So for myself I haven't found much new stuff in there. Well, there were some details that I tended to forget and got a good reminder. Also I had never really played much with X Forwarding. I'd like to play around more with X Forwarding just for the cool factor, but right now I don't have any setup where I could use it.

The description of how to do an ssh based VPN gave me much more confidence to try it myself one day... if opening an ssh login for root wouldn't freak me out (even with all the restrictions that you are dutifully guided to set up).

I found one big mistake in the book, it says:

Also note that all IP address bindings must be chosen before opening
your SSH session. You cannot add port forwarding to a live SSH
session, or change the IP addresses bound during a session.

Indeed we can: We use ssh escapes to do exactly this, at least for sessions with a pty. Type newline + ~C and you'll get a prompt where you can add and remove port forwardings.

In general, escape sentences are missing from the book. This is a pity, since even a beginner might find ~. useful to kick out a stuck ssh session. Apart from these few points I can really recommend the book!


Posted by betabug at 23:25 | Comments (0) | Trackbacks (0)
09 June 2012

A Simulated Network with Qemu and Sockets

Set it up fast and simple

I was trying to test some networking stuff with various operating systems. I have neither the patience nor the hardware to set up a bunch of real machines with those systems to try out things. So qemu came to my mind to simulate these things - which would be good enough for my problem case.

According to my study of the various parts of documentation on qemu, the fastest way to get this going was to set up a "socket" based network. That way, a couple of virtual machines can share a virtual network. They don't have access to the host's network connection - and therefore to the Internet though - unless you set up one of the guest OS systems as a router and set up some routing. I wasn't going to do that, as in my problem case a bit of isolation is a good thing.


My first machine is running some oldish variant of Linux. There isn't much special about it in that sense. This machine is the one that is set up as a "socket listener" in the command line:

#!/bin/sh

qemu-system-x86_64 -nographic -no-acpi \
-m 1024 -clock unix \
-net nic,model=rtl8139,macaddr=52:55:01:4e:79:28 \
-net socket,listen=:1234 \
-hda lunix_hda.img

Basically it's a normal qemu command, the only thing different from usual is that we're not specifying the default "user" type of network, we're using "socket". This means that the vm will listen on port 1234 on the host operating system (127.0.0.1 is implied here).

The second machine is running good ol' Windows 2000 - guess why a bit of isolation is a good thing. Here too, the setup is pretty much standard. Note that I'm specifying MAC addresses - apparently if I don't do that, all virtual systems will get the same MAC address, which is not a good thing in a network. The socket network setup is there too:

#!/bin/sh

qemu-system-i386 -m 512 \
-net nic,vlan=0,model=ne2k_pci,macaddr=52:54:00:12:34:58 \
-net socket,connect=127.0.0.1:1234 \
-monitor stdio w2kdisk.qcow2

I'm not sure it's necessary to specify 127.0.0.1 here, but it was like that in the docs. We do not set it to "listen", we set it to "connect" on this machine.

Now these two virtual machines will live in the same network, it's as if they were connected with ethernet cables. They do not have any IP addresses yet though - when using the "socket" networking in qemu, the built-in DHCP server from the "user" network is not activated. No problem though, on Windows just go to the control panel and set up an IP address and netmask (no router, name server or anything else required). Set up a different IP in the same network range and netmask on the other machine (on Linux with ifconfig). Now they can ping each other and as a test the windows machine can telnet to port 22 of the Linux system.

More machines could be set up to this system and you could even set up more virtual ethernet cards and hook them to more virtual networks, or route them through the host system to the Internet.

Posted by betabug at 22:10 | Comments (0) | Trackbacks (0)
19 June 2012

Airplanes now with "integrated literature consoles"

ebook on plane
Bookeen ebook reader on plane

On my flight to Switzerland I was reading with the ebook reader. After a while I got bored holding it in my right hand, then my left hand, then back to the right hand... The table was too low to place it comfortably, so I had to find another solution.

Good for me that airlines these days have "integrated literature consoles" in the backside of your front seat. These integrated consoles are of the "bring your own ebook reader" variety, but apart from that they work fine. How do they work?

The result is a very relaxed and healthy reading posture, due to the ergonomics of having the reader nearly at eye level and having your hands free.


Posted by betabug at 16:27 | Comments (2) | Trackbacks (0)
02 July 2012

Make Your JavaScript Behave

Installing jsLint into vim

Like most programmers, I'm using JavaScript, because that's the way it is these days. Given the minefield of that language, I really want a tool like jsLint to watch my code behave. So what I did was to integrate jsLint into vim. Which wasn't so difficult at all.

First step Is to get a JavaScript engine. For JavaScript unit tests I already use rhino, but it's a bit slow, especially to start up. The jslint.vim plugin recommends SpiderMonkey, so I gave it a try. There is an OpenBSD port for it, so that was no sweat. It took me a bit of looking up to discover that this will install a JavaScript prompt in /usr/local/bin/js -- neat. The jslint.vim plugin knew that already, so no configuration needed there.

Second step was to install the jslint.vim plugin itself. Here the main necessary hint was to add the command filetype plugin on to my ~/.vimrc file. In ~/.vimrc I also added these lines to be able to switch the highlighting of "complaints" off and on:

" jslint display errors off & on again
map %0 :let g:JSLintHighlightErrorLine = 0<CR>
map %1 :let g:JSLintHighlightErrorLine = 1<CR>

Instead of %1 and %0 you might want to choose some command that suits you better, I'm always at pains finding good command keys in vim that are not used for something else yet.

Now jslint was complaining about too much. The next step is to create a configuration file in ~/.jslintrc to give it some standard settings. Currently for me that's:

/*jslint browser: true, nomen: true, sloppy: true, vars: true, maxerr: 250 */
/*global jQuery, $ */

Any of these settings and any others can be configured on a per-file basis, by adding a comment like that to a JavaScript file.


Posted by betabug at 08:28 | Comments (0) | Trackbacks (0)
11 July 2012

darcs https/SSL repos on OpenBSD

Complaining, complaining, always complaining

Trying to access a repo on a https URL (using SSL) using darcs on OpenBSD, I got the error:

"Peer certificate cannot be authenticated with known CA certificates"

Even though there is a "real", "verified" certificate on the SSL web host. The problem appears to be that darcs goes through curl for these http accesses and curl does not find the proper CA root certificates.

Solution: Download the root certificates from the curl caextract page and install them in /etc/ssl/cert.pem. Seems like there was some root CA missing in the cert.pem bundle that I had there.


Posted by betabug at 10:28 | Comments (0) | Trackbacks (0)
13 July 2012

tmux book at the beach

Useful Information and a horse

We went for a late afternoon swim today after work (ok, before work too, I'll soon continue a bit). While there I was reading the tmux book I had bought a weeks or so ago.

I hadn't expected too much in that book, since I'm already using tmux, have mastered the first bit of confusion, and after all, all the info is in the man page. But then, on the first 15 or so pages, I already found a bunch of interesting information and things to try out too.

For example it made me think about organizing different projects in separate sessions and more consistently name some windows.

While I was reading these things in the last half an hour before sunset, the beach was pretty much emptied. Then there arrives a guy on a horse, riding without saddle. They go straight for the water, right in the sea. At this beach, the beach falls down pretty fast, a few steps and you are in swimming depth. The horse goes in probably till it lost step, swam a bit and they came back and leave. Impressive.


Posted by betabug at 20:16 | Comments (0) | Trackbacks (0)
06 October 2012

Queimada-Sprint

Hacking till the drinks are on fire

So, here I am, on the other corner of Europe. Together with graffic we flew via Madrid to La Coruna and then drove with Wu to his place in Lugo. Yesterday we started "sprinting" on our customer's pyramid app. Sprinting, what's that? It means that for some days we work really concentrated on programming this thing. It also means that for once we're working in the same room instead of cooperating over the net.

It's really great to work with these guys. Yesterday r0sk was working with us too. We got tons of things done already, despite "wasting" some hours at the start having a meeting about what to work on first. Now the sprint will continue till Tuesday and then we'll have our queimada and we'll be relaxing in the countryside of Galicia for a while.


Posted by betabug at 11:40 | Comments (1) | Trackbacks (0)
Prev  ...  4   5   6   7   8   9   10   11   [12]   13   14   15   Next