My problem with networking

After my two parter on networking, IPv6 and wireless, I got a few questions on why I don just use a cable connection rather than dealing with wireless bridges. The answer is, unfortunately, that I don’t have a clean way to reach with a cable from the point where my ADSL is and where my office is, on the floor above.

This is mostly due to bad wiring in the house: too little space to get cables through, and too many cables already in there. One of the projects we have going on the house now (we’ve been working on a relatively long list of chores that has to be done since neither me nor my mother foresee leaving this house soon), is to rewire the burglar alarm system, in which case, I should get more space for my cables — modern burglar alarms do not require the equivalent of four Ethernet cables running throughout the house.

Unfortunately that is not going to be the end of the trouble. While I might be able to get the one cable running from my office to the basement (where the cable distribution ties up) and from there to the hallway (where the ADSL is), I’m not sure of how many metres of cables that would be. When I wired with cat5e cable between my office and bedroom (for the AppleTV to stream cleanly), I already had to sacrifice Gigabit speed. And I’m not even sure if passing the cable through there will allow the signal to pass cleanly, as it’ll be running together with the mains’ wires — the house is almost thirty years old, I don’t have a chance to get separate connection for the data cable and the power; I’m lucky enough that the satellite cable fits. And I should shorten that.

To be honest, I knew a way around my house if I wanted to pass a cable to reach here already. But the problem with that is that it would require me to go the widest route possible: while my office is stacked on top of the hallway (without a direct connection, that would have been too easy), to get from one to the other, without the alarm rewiring, I would have to get to the opposite side of the house, bring the cable upstairs and then back, using a mixture of passageways designed for telephone, power and aerial wiring; and crawling outside the wall for a few metres as well.

The problem with that solution, beside the huge amount of time that it would require me to invest in it, is that the total cable length is almost certainly over a hundred metres, which is the official physical limit of cat5e Ethernet cables. Of course many people would insist telling me that “it’s okay, there are high chance it would still work” .. sure, and what if it doesn’t? I mean I have to actually make a hole in the wall at one place, then spend more than a day (I’m sure I wouldn’t be able to do this in just a day, already had to deal with my wiring before), with the risk of not getting a clear enough signal for the connection to be established. No thanks.

I also considered the option of going fibre optic. I have no clue about the cabling itself, and I know it requires even more specific tools than the RJ45 plugs to be wired, but I have looked at the prices of the hardware capable of converting the signal between fibre and good old RJ45 cabling… and it’s way out of my range.

Anyway, back on topic of the current plan for getting the cable running. As I said the current “cable hub” is in the basement, which is mostly used as a storage room for my mother’s stuff. She’s also trying to clean that up, so in a (realistically, remote) future I might actually move most of my hardware down there rather than in the office — namely Yamato, the router itself (forwarding the ADSL connection rather than the whole network) and Archer, the NAS. Our basement is not prone to floods, and is generally cool in the summer, definitely cooler than my office is. Unfortunately for that to work out, I’ll probably need a real-life rack, and rackmount chassis, neither of which is really cheap.

Unfortunately with that being, as I said, in the future, if I were to pass the cable next month from there, and the signal wouldn’t be strong enough, the only option I’d have would be to add a repeater. Adding a repeater there, though, is troublesome. As I said in the other posts, and before as well, my area is plagued with a very bad power supply situation. To the point that I have four UPS units in the house, for a total of 3750 VA (which is, technically, probably more than the power provided by supplier). I don’t really like the idea of having to make room for yet another UPS unit just for a repeater; even less so considering that the cables would end up being over my head, on the stairs’ passage (yes it is a stupid position to add a control panel in the first place), and while most repeaters seem to be wall-mountable, UPS units are a different story.

So the only solution I can think for such a situation would be to add a PoE repeater there, if needed, and then relay its power through a switch, either in my office (unlikely) or in the hallway near the router (most likely), behind the UPS. Once again here, the factor is the cost.

Honestly, even though I decided not to get an office after seeing costs jumping higher and higher – having an office would increase my deductibles of course, but between renting the office, daily transportation, twice the power bill, and so on so forth, it’s not the taxes that worry me – I wonder if it is really as cheap as I prospected it to be, to keep working at home.

Sigh. I guess it’s more paid work, less free time next year as well.

Health, accounting and backups

For those who said that I have anger management issues regarding my last week’s post I’d like to point out that it’s actually a nervous breakdown that I got, not strictly (but partly) related to Gentoo.

Since work, personal life, Gentoo and (the last straw) taxes all merged this week, I ended up having to take a break from a lot of stuff; this included putting on hold for the week all kind of work, and actually spend most of my time making sure I have proper accounting, both for what concerns my freelancer activity, and home expenses (this is getting particularly important because I’m almost living alone – even if I technically am not – and thus I have to make sure that everything fits into the budget). Thankfully, GnuCash provides almost all the features I need. I ended up entering all the accounting information I had available, dating back to January 1st 2009 (my credit card company’s customer service site hasn’t worked in the past two weeks — since it’s the subsidiary of my own bank, I was able to get the most recent statements through them, but not the full archive of statements since issuing of the cards, which is a problem to me), and trying to get some data out of it.

Unfortunately, it seems like while GnuCash already provides a number of reports, it does not have the kind of reports I have, such as “How much money did the invoices from 2009 consists of?” (which is important for me to make sure I don’t go over the limit I’m given), or “How much money did I waste in credit card interests?”… I’ll have to check out the documentation and learn whether I can make some customised reports that produce the kind of data I need. And maybe there’s a way to set the term of payments that I have with a client of mine (30 days from the end of the month the invoice was issued in… which means if I issue the invoice tomorrow, I’ll be paid on May 1st).

On a different note, picking up from Klausman’s post I decided to also fix up my backup system, which was, before, based on single snapshots of the system on external disks and USB sticks; and moved to use a single rsnapshot system to back everything up in a single external disk, from the local system, the router, the iMac, the two remote servers, and so on. This worked out fine when I tried again the previous eSATA controller I had, but unfortunately it again failed (d’oh!) so I fell back to Firewire 400 but that’s way too slow for rsnapshot to do a full backup hourly. I’m thus trying to find a new setup for the external disk. I’m unsure whether to look up a FireWire 800 card or a new eSATA controller. I’m not sure about Linux’s support for the former though; I know that FireWire used to be not too well maintained, so I’m afraid it might just go down to FireWire 400, which is pointless. I’m not sure about eSATA because I’m afraid it might not be the controller’s fault but rather a problem with (three different kind of) disks or the cables; and if the problem is in the controller, I’m afraid about the chip on it; the one I have here is a JMicron-based controller, but with a memory chip that is not flashable with the JMicron-provided ROM (and I think there might be a fix in there for my problem) nor with flashrom as it is now.

So if you have to suggest an idea about this I’d be happy to hear of it; right now I only found a possibly interesting (price/features) card from Alternate (Business-to-business) “HighPoint RocketRAID 1742” which is PCI-based (I have a free PCI slot right now, and in case I can move it to a different box that has no PCI-E), and costs around €100. I’m not sure about driver support for that though, so if somebody have experience about it, please let me know. Interestingly enough my two main suppliers in Italy seem to not have any eSATA card, and of course high-grade, dependable controllers aren’t found at the nearest Saturn or Mediamarkt (actually, Mediaworld here, but it’s the very same thing).

Anyway, after this post I’m finally back to work on my job.

Remote debugging with GDB; part 2: GDB

When I first wrote the original part 1 of the tutorial I was working on a job project for a customer of mine; time passed without me writing the second part, and this actually went this way for over an year. Talk about long-term commitment. On the other hand, since this is going to be used almost literally for documentation for the same customer (different project, though), I’m resuming the work writing this.

On the bright side, at least one of the Gentoo changes that I have described as desired in the previous post is now solved: we have a dev-util/gdbserver ebuild in the tree (maintained by me, written because of the current project, so can be said to be contributed by the current customer of mine). So from the device side, you only need to install that to have it ready for debugging.

On the build-machine side, you need the cross-debugger for the target architecture and system; you can install it with crossdev like you do for the cross-linker and cross-compiler, but with a twist: for GDB 7.0 or later you need to install with expat support (because it seems like they now use XML as a protocol to talk between the client/master and the server/slave). So for instance you run this command: USE=expat crossdev -t $CHOST --ex-gdb.

If you’re not using Gentoo on either side, then you’re going to have to deal with both builds by hand… tough luck. On the other hand, the gdbserver executable is very small in size, on the latest version it’s just a bit over 100KiB, so building it takes very little time and takes up very little space even on embedded Linux systems.

On the remote system, there are three modes of operation: single program, attach to running process, and multi-execution daemon; the latter is my favourite mode of operations, as you just need to start gdbserver like a standard Unix daemon, waiting for incoming requests and handling them one by one as long as it’s needed (yes, I guess it would make sense to have an init script for gdbserver when used on not-too-embedded systems). In all three cases, it needs a communication media to work; on modern, and less embedded, systems that media is almost always a TCP/IP connection (just give it a ip:port address format), but the software supports using serial ports for that task as well.

The executable for gdbserver in my system is just 72KiB, so it’s very quick to upload it to the target, even if it’s an embedded Linux system. After uploading, you have to start it on the target; you can either start a program directly, attach to a process already running or, my favourite, use it for multiple debugging at once. In this latter mode, gdbserver acts a lot like a standard Unix daemon, waiting for incoming requests and handling them one by one for as long as it’s needed. This actually makes me consider the idea of setting up an init script to use for debug and test systems.

To start the daemon-like instance, just use the --multi option:

arm # gdbserver --multi

Now you can connect to the server through the cross-debugger built earlier:

% arm-linux-gnu-gdb
(gdb) target extended-remote

This drops us inside the server, or rather inside the target board, ready to debug. So let’s upload this crashy program:

% cat crash.c

int main() {
        char *str = NULL;
        return strcmp(str, "foo");
% arm-linux-gnu-gcc -ggdb crash.c -o crash
% arm-linux-gnu-strip crash -o crash_s
% wput crash_s ...

At this point you can note one very important point: we’re building the the program with the -ggdb option to produce the debug information for the program, so that GDB can tell which variable is which and which address correspond to which function; this is very important to have meaningful backtrace and is even more important if you plan on using further features including, for instance, break- and watch-points. You could technically even use -g3 to embed the source files into the final executable, which is particularly useful if you plan on having multiple firmwares around, but that’s not always working correctly so leave it as that for now.

But even if we need the debug information in the compiled executable object, we don’t need the (bigger) binary to be present on our target system; the reason is that the debug information is only composed of extra sections, and does not add or subtract any code or information to the runtime-executable code. This is why -ggdb does not make your system slower, and why stripping an executable of its debug information is enough to make it slimmer. At the same time, the extra sections added by -ggdb and stripped by strip are never going to be mapped from disk into memory anyway, at least when executing them with, so there is no extra memory usage caused by having non-stripped binaries. The only difference is in the size of the file, which might still be something if you’re parsing it for some reason, and might fragment it into multiple pieces.

Anyway, since the debug information, as just stated, is not needed, nor used at all, at runtime, there is no reason why the information has to stay on the target: the gdbserver program is just going to execute whatever the master GDB instance will ask it to, and has no reason to have a clue about the executable file or its debugging information. So you can just copy a stripped version of the file and upload it on the target; you can then use it normally, or run it through gdbserver.

After uploading the file you need to set up GDB to run the correct executable, and to load the symbols from the local copy of it:

(gdb) symbol-file crash
(gdb) set remote exec-file /uploaded/to/crash_s

and you’re completely set. You can now use the standard GDB commands (break, run, handle, x, kill, …) like you were running the debugger on the target itself! The gdbserver program will take the action, and the main GDB instance will direct it as per your instructions.

Have fun remote debugging your code!

So I went on vacation and…

And now I got to work 18 hours a day. I wanted to write a bit about my one week in London but the time, since the start of the week, have been more than entirely spent on two main work projects. I even had to give up one project entirely because I didn’t have much time after an urgent consultancy started this week.

I have also very limited time for Gentoo as you might have noticed; I’m trying to do some of the standard maintenance operation on my packages and on Gentoo as a whole, but it really doesn’t have the same speed as I used to have. So please bear with me if the next weeks will be very slow on my Gentoo side.

On the bright note, I’ve been able to update PulseAudio to the latest test version, so you might want to try that out. And I’ll be working on a few more notes here and there, included autotools mythbuster .

On Free Software and Motivation (again)

You can skip this post; seriously; it’s one of those depression-related post, this time combined with some things I discussed about with a friend of mine the other day. It won’t tell you anything new about Gentoo or any project I’m working on. It might tell you something you don’t know about me, but I can’t tell if you really want to know that. The time spent reading this post might be better spent fixing some bugs; while the converse is not true: the time I’m spending writing this post cannot be employed any other way.

So I was thinking about why am I still doing so much Free Software work, considering that with a very few exception, not even my colleagues thank me any longer. Today I went through almost all the --as-needed bugs, and committed straight to portage fixes for all the trivial ones and those with an attached patch I could recognize as good (thanks again to Kevin Pyle for submitting so many good patches!). This resulted in about twenty packages fixed in tree, a few calls to treecleaners to see whether to get rid of some software, and a few considerations about the state of the software in the tree.

I also restarted the tinderbox, adding a few more packages, in particular, KDE packages, after syncing with a copy of the tree with most of these issues taken care of. The list consists of 11K ebuilds, and this is after a few that are known broken have been masked, and including old versions of Python, Qt, and other stuff. This is a lot of work for my box, even if it’s quite powerful by itself. Add to this that I’ve also enabled tests, and from the old 10 days run of the tinderbox, I’m probably now over a month of work that has to be taken care of by the scripts; and I’ll probably have to change it to rebuild stuff once every 10 instead of 6 weeks.

It’s a massive kind of work for a box that is, after all, at my home, consuming power on the standard line and so on. Although I try to avoid energy waste with lights and all the rest, Yamato is probably consuming more I could save in a lifetime at this point. I do spend that money out of my own wallet: I’m not paid to do that, I do that for … yes what do I do that for?

I know that most people that do work on Free Software are pushed both because of their ideology and because they get a net gain out of it; being paid to work on Free Software is one of the gains, but there are other, like being paid to support people and it’s much easier to support people with Free Software than with proprietaryware. On the other hand, I’m not a support kind of person, and even if I were, I’m afraid that most of the people I support do have to work on Windows for various constraints. Which means that my Free Software involvement on that side is ridiculously low.

While I am paid to work one particular project this does not involve me working on so many things in Gentoo especially not on the tinderbox; other proprietary projects I work on push me to work on ruby support but even that is extra: I’m explicitly not paid to work on that, and my own lead told me not to waste time on it if I’m doing it for that project.

What remains? I guess I’m mostly doing this work “for the glory”; but which glory? I wish I knew. Usually when one does work “for the glory”, it’s actually with a second hope. Not even the heroes of novels and games do stuff for the pure hope of glory. It might be for necessity, it might be just to learn (and why you’d like to learn that’s another topic altogether) it might be for some privileges coming from being famous, it might be for the women (or the men if that’s what you like). Given that Free Software does not look like anything useful to find women (and if it is, then I missed something and please do tell me what did I miss here!), and that my will to learn is fading away because I lack the time to enact this kind of things, I guess I have to find some other excuse.

Why did I start working on Free Software; and why did I start working on Gentoo in particular? Well, I actually didn’t start working on Free Software out of the blue; my first experience was related to Ultima OnLine since it was on a server emulator software that was released, at the time, under the equivalent of an Affero GPL, that me and a few friends wanted to use to set up an unofficial shard. From there, I just bounced around to whatever provided me the options to continue working and toying with things.

But while gratifying this alone would never have cut it for me on the long term; when I started working on Gentoo/FreeBSD in particular it was both will to learn and the idea that, if I were to learn and show that I could do stuff , I would have found a job that would have been as gratifying and would have let me put away some money. This didn’t really work out as well as I hoped; while I did get a few job offers, a few weren’t really my cup of tea (got better jobs here, or required me to move when my health didn’t allow me to), and those offers that did interest me, well, ended up never actually going beyond the first contact.

I’m still doing this, I’m still devoting most of my time for Free Software, I still am spending money out of my wallet for Gentoo and I’ll do that even if all the other devs turn against me or if users stop liking me, I’m sure of it. Why? I don’t know yet, I hope I will know one day and not feel miserable because of it. Nothing motivates me right now but if I were to take this out of my life, like many people have suggested me, I’d be left as an empty shell. For good or bad, Free Software is what defines my life.

And sorry if sometimes I link my wishlist on the posts; I don’t feel particularly good about doing that, but sometimes it helps to get motivation; even though, to be entirely honest, I doubt that all the donations up to now sum up to anywhere near the money I continue to spend on Gentoo. This is not to reduce the gifts; I’m very grateful to everybody who contributed and contributes; they are the best way to show your thanks to me, but please don’t read my rants or my whining about having to spend money on hardware as avarice or me trying to spill money out of someone else. It’s just that I really am not swimming in gold…

Productivity improvement weekend

This weekend I’m going to try my best to improve my own productivity. Why do I say that? Well there are quite a few reasons for it. The first is that I spent the last week working full time on feng, rewriting the older code to replace it with simpler, more tested and especially well documented code. This is not an easy task especially because you often end up rewriting other parts to play nicely with the new parts; indeed to replace bufferpool, between me and Luca we rewrote almost entirely the networking code.

Then there is the fact that I finally got a possible price to replace the logic board of my MacBook Pro that broke a couple of weeks ago: €1K! That’s almost as much as a new laptop; sure not the same class, but still. In the mean time I bought an iMac; I needed access to QuickTime, even more than I knew before, because we currently don’t have a proper RTSP client; MPlayer does not support seeking, FFplay is broken for a few problems, and VLC also does not behave in a very standard compliant way. QuickTime is, instead, quite well mannered. But this means I have spent money to go on with the job, which is, well, not exactly the nicest thing you can do if you need to pay some older debts too.

So it means I have to work more; not only I have to continue my work on lscube at full time, but I’m going to have to get more jobs to the side; I got asked for a few projects already, but most seem to require me to learn new frameworks or even new programming languages, which means they require a quite big effort. I need the money so I’ll probably pick them but it’s far from optimal. I’ve also put on nearly-permanent hold the idea of writing an autotools guide, either as an open book or a real book; the former has shown no interest among readers of my blog, the latter has shown no interest among publisher. I start to feel like an endangered species regarding autotools, alas.

But since at least for lscube I need to have access to the FFmpeg mailing list, and I need access to the PulseAudio mailing list for another project and so on so forth, I need to solve one problem I already wrote about, purging GMail labels out of older messages. I really have a need for this to be solved, but I’m still not totally in luck. Thanks to, I was able to get the name of a script that is designed to solve the same problem: imap-purge . Unfortunately there is a problem with one GMail quirk: deleting a message from a “folder” (actually a GMail label) does not delete the message from the server, it only detach the label from that message; to delete a message from the server you’ve got to move it to the Trash folder (and either empty it or wait for 30 days so that it gets deleted). I tried modifying imap-purge to do that, but my Perl is nearly non-existent and I couldn’t even grok the documentation of Mail-IMAPClient regarding the move function.

So this weekend either I find someone to patch imap-purge for me or I’ll have to write my own script based on its ideas in Ruby or something like that. Waste of time from one side, but should allow me to save time further on.

I also need to get synergy up to speed in Gentoo, there have been a few bugs opened regarding crashes and other problems and requests for startup scripts and SVN snapshots; I’ll do my best to work on that so that I can actually use a single keyboard and mouse pair between Yamato and the iMac (which I called, with a little pun, USS Merrimac (okay I’m a geek). Last time I tried this, I had sme problems with synergy deciding to map/unmap keys to compensate the keyboard difference between X11 and OSX; I hope I can get this solved this time because one thing I hate is having different key layout between the two.

I also have to find a decent way to have my documents available on both OS X and Linux at the same time, either by rsyncing them in the background or sharing them on NFS. It’s easier if I got them available everywhere at once.

The tinderbox is currently not running, because I wouldn’t have time to review the build logs, in the past eight days I turned on the PlayStation 3 exactly twice, one earlier today to try relaxing with Street Fighter IV (I wasn’t able to), and the other time just to try one thing about UPnP and HD content. I was barely able to watch last week’s Bill Maher episode, and not much more. I seriously lack the precious resource that time is. And this is after I show the thing called “real life” almost entirely out of the door.

I sincerely feel absolutely energy-deprived; I guess it’s also because I didn’t have my after-lunch coffee, but there are currently two salesman boring my mother with some vacuum cleaner downstairs and I’d rather not go meet them. Sigh. I wish life were easy, at least once an year.

Working late

It’s three in the morning in my time zone and I’ve just stopped working, not on any Free Software project at the moment, but rather on my job’s work.

My job at the moment consists of developing a .NET application using C#. I have to admit, the language itself ain’t as bad as I expected it to be. It has a lot of the good sides of C++, decent switch and foreach statements (funny that two features most C-like languages implement for sure when extending it are switches accepting strings and foreach statements), and it doesn’t have the burden of STL or anything else template-greedy, even though templates exist.

The IDE isn’t bad either, it does really show a lot of Delphiness, if you know what I mean. The form designer, the source tree view and the rest of the things are pretty much Delphish, the code completion though is as usual one of the good points of Microsoft IDEs, sometimes it makes me want to have it on Emacs, would turn out useful with xine-lib most likely. The debugger ain’t entirely bad, it seems to to its job in a decent fashion, although it does miss one feature: being able to stop at a breakpoint only if a given condition is true.

I have to admit that my liking of C# might be related to the fact that when I was given the code to base myself upon I seen such horrible code that anything else would look nice. The code looked to me like it was a Visual Basic conversion, but I’ve been told it was written directly in C#. It had tons of objects that weren’t used as objects, different functions given the same 10 parameters, OLE connections created and closed without ever reusing them, accessors to properties that made them pretty much like a public attribute, and so on. I’ve been rewriting the code to be actually object oriented and the results on the parts I’ve rewritten satisfy me well enough. I’m still doing rewriting though, as there are parts that are still a lot VB-looking.

The linq library is quite a timesaver for some things, as it allows me to find the data I need without the loops in loops the previous code had.

Anyway, I’m good to know I can come to my bed, and watch some Buffy, relaxing and then sleeping. Also, although it might sound strange, sleeping late and till late seems to make me feel better than going to sleep early and wake up early, even if I sleep more in the latter case.

Credit’s given where credit’s due

You can proably find me mumble about not having a stable job from time to time. Indeed, I’m one of the so-called “precariouses” (Precari): I have a job now but I might not have one in June (my contract expires on end of May).

This is quite a bit of a problem for people who need to think of the future, people with a family and son on. Strangely enough, it seems to adapt quite well to my new way of thinking after the hospital: I don’t know if I’ll be alive in June, why should I care if I have a job or not? But this does not make it very good on its own.

On the other hand, there is one thing that is pretty nice with being a freelancer, and I was reflecting on this Friday night with a friend of mine.

On an usual stable job, at least in Italy, you’re paid per hour. This means that the more complex the job, the more you get paid, but sometimes even if you could do something quickly, you end up dilating the timing so that you can actually get a decent pay, sorta like when using Scotty’s Law.

When you’re a freelancer, you can easily increase the price if it’s something urgent that has to be completed in shorter time. This let’s you avoid having to buffer the work, so you can better employ your time, and allows you to work at full potential.

On this note, I think I’m almost fine to work freelance, I’ll probably see to stay this way for quite a while :)