Posted by Diego "Flameeyes" Pettenò
Thu, 29 May 2008 20:57:00 GMT
In the last two weeks I didn’t have much time to write, and in the past week I really didn’t have time. Till today.
In theory today I should have been offline so that my ISP could switch my connection from a 2.5Mbit ADSL to a 20Mbit ADSL2. Unfortunately they did some mess, and instead of disconnecting the network connection while that was switched, they disconnected my phone line.
Luckily my “office” number is a VoIP number, and I use it through a Siemens S450IP cordless that actually continued working. My VoIP provider is also quite cheap when it comes to calls, even though they cost more to Italy than to UK (“uh?” don’t ask…), so I’m not isolated.
If all goes well, tomorrow I’ll be really offline, and then I’ll be back up with ADSL2+. In the worst case, I’ll be offline a few months while I fight against my ISP and I’ll connect from the UMTS phone in the mean time.
Also, it’s the second week in a row that I can spare some time for electrical chore. Last week I modified an halogen lamp (500W!) so that it now has an E27 screw, which in turn allows me to use a standard fluorescent lightbulb, removed the dimmer and replaced it with a foot-controlled switch. Quite a nice thing as we can get to use again the lamp without consuming so much. It’s actually the second lamp I cable back in less than a month, the one by my bed is a very old glass and ceramic lamp, quite nice, but had a very bad cable, I didn’t like touching the plug because it wasn’t properly insulated, so I bought some new cable, a new switch, and cabled it back…
This week instead I was able to put back one of the three lights I removed on the stairs and the corridor because the cable was incorrectly connected. I decided to split the two on the stairs (that were cabled together before), so that the one upstairs is only switched on and off right outside my room, while the one in the middle is connected where it was before downstairs, and on a new, external, plastic box upstairs. This way I can avoid mixing the two phases like they did before, I don’t have to let cable pass through the whole house, and I can still turn them on and off both downstairs and upstairs.
I’ll also avoid adding a switch for the third light outside my room, as it’s basically only used when coming outside either my home office or my mother’s room, which are on the far end of the corridor (which is quite small anyway).
I think this is nice because it means I need less cables. I also was able to pass a new satellite cable in my mother’s room so i don’t need to have it running around the whole room (I just recently found how to pass underneath the floor to get to my room).
Unfortunately, I don’t have all the things I need to complete the cabling, I need some a couple more sockets, and a few more switches, I’ll get those next week hopefully. Piece by piece I’m being able to review the whole electric system.
Oh well, tomorrow I’ll probably be doing some woodwork, maybe I’ll get some photos of what I’m going to do…
Posted in Personal, English | Tags ADSL, Cabling, Electric, Infostrada, ISP, UMTS | no comments
Posted by Diego "Flameeyes" Pettenò
Wed, 28 May 2008 11:30:00 GMT
I wrote last year already about the importance of documenting everything as much as possible, in relation to Gentoo and Free Software in general. In hindsight, that was a good idea considering what happened to me last summer.
Today I wish to write to remember that this applies quite easily also to work places.
Without going into specifics, because I can’t, as I’m under NDA, I’m having trouble with my current job because the specifics I have are incomplete, the code is only half commented, and there is no “e-trail” (the electronic equivalent of a paper trail) of changes (the people who worked on this before me are not working in this company anymore).
I’m wasting more time trying to find the people who might know what I need to know than to write the code…
Posted in English | Tags Documentation, Job, Specs | 1 comment
Posted by Diego "Flameeyes" Pettenò
Mon, 26 May 2008 19:52:00 GMT
Ho letto l’articolo di Repubblica (sì lo so..) riguardo allo spot tedesco . Mi vergogno di aver mai votato una persona del genere.
Fassino pare offendersi di una caricatura che, riporto da Repubblica:
La macchietta dell’italiano inciucione e donnaiolo, baffuto, vestito con la maglia della Nazionale e con una pesante collana d’oro al collo, […]
Posso capire che non sia la più bella immagine del mondo, ma non aiutiamo certo a migliorarla prendendocela per questo.
Poi sinceramente, è sempre meglio dell’immagine del’italiano mafioso che si vede in qualsiasi telefilm o film americano.
Invece di preoccuparsi di una pubblicità tedesca, perché non se la prende per la gestione della televisione italiana?
Tanti hanno cercato di capire le ragioni del fallimento del centro-sinistra alle scorse elezioni. Ecco perché! Perché gente come Fassino, Veltroni, si fanno problemi su cose che non hanno nessuna importanza, e ignorano, o favoriscono, la censura, le leggi ad personam, contra personam, e le “emergenze” create ad arte dai mezzi di (dis)informazione.
Non sono di destra e non lo sarò mai, ma questa “sinistra” che di sinistra ormai ha poco mi fa veramente schifo.
Posted in Italian | Tags Politica, Pubblicita | 2 comments
Posted by Diego "Flameeyes" Pettenò
Thu, 22 May 2008 23:30:00 GMT
If you didn’t play on MS-DOS (or should we say DoS? ;) ) or on Commodore 64, you probably can’t answer my question. If you did, please follow reading as I’m looking for as much help as I can.
I don’t remember the name, and thus I can’t get any screenshot, I have to base myself entirely on my memory. The game was available for sure on both MS-DOS and Commodore 64. For the Italian readers, it was in either the first or third issue of “PC Facile” (I think this was the title) by Jackson Libri.
It was a totally 2d (no pseudo-3d), tile-based game, game area was delimited by “wall” tiles, it had a gravity toward the bottom of the screen, although there were “elevator” solid tiles moving through the area, going around obstacles, mostly.
The focus point of the game were other tiles though, with shapes and icons on them. The objective of the game was to put two or more of those together to destroy them. The tricky part was that often the tiles were odd in the game area, so you had to put three together. And most of the time in a given sequence otherwise you couldn’t get other tiles together.
To move tiles together you could “lock on” them (they took a red border) and then you could move them either left or right.
I’d very much like to find it to see if it’s possible at all to implement a version of it on modern systems, although I’m sure there would be copyright problems on trying to reverse engineer it… at least I could make sure how the gameplay was.
Sometimes I find myself wondering what I could possibly let my nephew play when he’s a bit older… I’m not going to let him play hack’n’slash games like Devil May Cry 4 (even though it’s an exceptional game). Puzzles are what I was playing between 4 and 10 (then I switched to RTS with Dune 2), but most of the puzzle I liked to play don’t seem to be available for anything I can let him play with (like my mother’s iBook).
Posted in Personal, English | Tags Abadonware, C64, Commodore, Commodore64, DOS, Games, MSDOS | 7 comments
Posted by Diego "Flameeyes" Pettenò
Thu, 22 May 2008 15:37:00 GMT
Don’t get the title wrong, I like GCC, but there are a few things that don’t trigger a warning in GCC, but do on Borland’s, which are quite useful and important.
The main thing I miss is the warning that Borland gives you when a variable is given a value that is never used. As I wrote more than a week ago GCC does not warn you about unused variables if they are assigned a value after they are declared. Which in xine tends to happen quite some times.
This is pretty important because, even if GCC is good enough not to emit the variable if it’s not used, if the assigned value is the return value of a function, the function call is unlikely to be optimised away. Pure and constant functions should be optimised away, but for functions the compiler has no clue about (which is the common status for non-static functions unless you tell it otherwise) the call is still executed, as it might change the global state variables. If the call is expensive, it would be a waste of CPU.
So I first tried ICC, remembering it used to have nicer and stricter warnings than GCC. Unfortunately even after installing it, getting a license key and opening a new shell with the environment set up, I get this:
/usr/include/stdlib.h(140): error: identifier "size_t" is undefined
extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
As you can guess, it’s not very nice that size_t results undefined, and indeed it can’t even complete the ./configure run.
Then I decided to try Sun’s compiler. I remembered Donnie having an ebuild for sunstudio on his overlay, so I downloaded that and installed sunstudio. I had to fix a bit the build system of xine because Sun’s compiler was detected only under Solaris for PThread support, while of course you can use Sun’s compiler under Linux too.
After completing the ./configure run properly, I’ve started seeing issues with xine’s code.. well I expected that. Mostly, the short form of the ternary operation (foo ? : bar, which is equivalent to foo ? foo : bar but with a single evaluation of foo) is not supported – I suppose it’s a GNU extension – but that’s not difficult to fix by avoiding that form…
The problems started the moment it compiled the first source file for xine-lib itself (rather than its tools):
c99: Warning: illegal option -fvisibility=hidden
"../../../src/xine-engine/xine.c", line 83: internal compiler error: Wasted space
c99: acomp failed for ../../../src/xine-engine/xine.c
Now with all the good will I have, what should “Wasted space” mean to me‽
The illegal option is also a nice thing to see, considering that I test that during the ./configure phase, and Sun’s compiler answers me a lot like it works:
configure:49543: checking if compiler supports -fvisibility=hidden
configure:49560: sunc99 -c -features=extensions -errwarn=%all -fvisibility=hidden conftest.c >&5
c99: Warning: illegal option -fvisibility=hidden
configure:49567: $? = 0
configure:49584: result: yes
Sincerely, I start to think a lot lately when I read about Sun wanting the good of Free Software. I had a few people telling me that xine lacks support for Solaris, Sun Studio compiler, UltraSPARC architecture, … well it’s not like it’s easy to support those, considering that Solaris for x86 is quite slow, and wasn’t working under VirtualBox for a while – it should work now but I haven’t had time to look at it yet, SunStudio for Linux fails, as I just noted, and the only way to get a decent Sun system for a standalone developer is looking and hoping at second hand offers on eBay and similar (a T2 basic server costs about $15K, a bit out of my league, for optimising xine, and as far as I can see all their workstation are now AMD64-based—or x64 as they call it, but I hate that market name as it really means nothing).
Maybe they are just interested in enterprise Free Software, but still… I sincerely think they have the right cards to make some difference, but I can’t see much Free Software development, beside the usual enterprise one, going on with Sun systems in the next future. Which is a bit sad considering I’ve seen my Ultra5 outpowering an Athlon almost twice its frequency…
Posted in Technical, English | Tags C, Compilers, GCC, ICC, Solaris, Sun, SunStudio, UltraSPARC, xine | 4 comments
Posted by Diego "Flameeyes" Pettenò
Tue, 20 May 2008 17:55:00 GMT
I’m still wandering through xine’s sources to apply my own style to them, hoping that I can spot problematic areas before they become a problem. It’s quite interesting what I’ve seen, as the code is really suboptimal in some cases: functions could be factored out so that they are shared between plugins, in some we have leaks because we allocate stuff and then return without the object, in others we could reduce the size of a code section protected by a mutex.
I haven’t committed and pushed these changes yet because I’m sure it will be a mess to merge them into 1.2, so I’ll first try that when I’m willing to spend time to merge them back into 1.2.
In general, what I’ve been following for xine’s source changes are a few simple rules:
- whenever possible, use constants instead of variables;
- whenever possible, declare constants and variables only when you can give them a meaningful value;
- whenever possible, reduce the scope of variables and constant by adding blocks;
- in each function, test first all the prerequisites, before any allocation or constant calculation;
- in each function, when a condition has to be checked and no code has to be executed if it’s not true, return from the function rather than increasing the indentation level with a new
if block;
- if the same exact calculation has to be done on different values, create a function, even if it’s a single return or little more; constant functions will most likely be optimised by the compiler;
- when a function require using mutexes, make sure that allocations and freeing of memory areas happen outside the mutex-protected code, even if that means keeping memory allocated for a while longer than necessary.
Unfortunately xine, while depending on a C99-compliant compiler already – for FFmpeg – does not require enabling all the C99 features yet. Which means I can’t use C99-style for loops, which I found quite useful to make code clean.
My reasoning for these rules are quite easy actually.
Assigning the value to a variable when it’s declared makes unused variable warnings from GCC more useful (assignment is considered use, which means that a variable declared and then assigned is never considered unused – which by the way is wrong, GCC should warn in that case too, but I’m no good with compilers so I can’t patch it for this), and makes it less likely that a quick change makes use of the variable before a value is assigned.
Marking data constant whenever possible makes it less likely that the meaning of a variable is changed. I find it nicer to have ten constants than one variable with ten different meanings. It also often forces to get more meaningful names for the data instead of relying on variables called tmp, n, i, j, k…
Reducing the scope of variables combine the two objectives above: you cannot abuse a variable if its scope is limited, and you cannot use the variable before it gets an useful value if it’s not in your scope.
Checking conditions beforehand makes it possible to avoid allocations before prerequisites are checked, which in turn makes it possible to avoid allocation and freeing cycles. It also makes it possible to avoid locking an unlocking mutexes for no good reason.
Returning earlier from a function is instead useful to avoid multiple indentation levels in case multiple prerequisites are checked in series. It’s just readability that gets improved, but still it’s a lot.
Splitting a calculation makes it less likely to make a copy-paste mistake in the code, and it makes it easier to change it if it needs fixes.
And mutex-protected code should be as limited as possible as it’s code that doesn’t make good use of multicore systems, and in today’s computers world that’s bad.
I think I’ll complete this cleanup soon enough, and then move to 1.2 to change the paradigm a bit more. Mostly I’m tempted to see where we can replace some mutexes with R/W locks (which should make xine work better in parallel, as thread would block each other only while writing).
I also start thinking of a few things we could try to use for 1.3 or 2.0, namely glib’s lists and thread supports to replace xine’s own implementations. My reason for this is that it makes very little sense to reinvent the wheel for these things when they are already well developed and available.
Anyway, I sincerely hope to make some difference in the not-so-distant future, but I don’t count on it just yet. I would really like to see how my changes applies to multicore system, and non-x86 systems. Too bad Sun boxes cost so much, or I’d be glad to work with an 8-way UltraSPARC CPU (and Solaris maybe) and optimise xine for it. If somebody from Sun is reading, a developer discount program would be appreciated ;)
Posted in Technical, English | Tags C, CodeStyle, Declarations, xine | 1 comment
Posted by Diego "Flameeyes" Pettenò
Sun, 18 May 2008 16:32:00 GMT
As I wrote in a previous entry (XML misuses), my current job entails working with XML files. Badly designed XML files, but that’s not the main issue here, although it does make the task a bit more complex than it would be.
I have two XML files, both big around 1.5MiB; I have to find what differs between them, one is the original, the other is the one generated by the software I’m writing.
A simple diff run between the two can’t work for me because it shows a HUGE lot of information I don’t care about, as it tells me whenever a whole line differs, while I need to know which attributes in these very long lines change.
I though that it was quite a common task working with XML files actually, so after asking a bit around for suggestions, I just ran a search to find a software that would do what I need.
The first option was to use Microsoft’s XML Notepad (which I’m using already since I’m working under Windows and I didn’t want to look for KXML Editor for Windows), and its Compare option. Actually, that was in theory exactly what I needed. Unfortunately there is a bug, a huge one: whenever an attribute of a variable changes, instead of showing me the attribute name it outputs the element’s name. Quite a simple bug to fix if you had the sources around, but this is Microsoft.
Then I was suggested to try another proprietary commercial tool called oxygen. The way it compares XML files have multiple algorithms, I tried first the “XML accurate” one as that seemed the most appropriate, I needed an accurate comparison indeed. It excepted out of memory, suggesting me to increase its limit. So I did, and still excepted, twice. The “fast” algorithm instead just gave me a line by line diff with XML syntax highlight. Pretty much useless. Luckily it was a demo.
Time to Google around, and I’ve found a few tools that seemed to be what I needed. Unfortunately I’ve found stuff that was written originally under GCC 2.95, then ported to GCC 3, and obviously fails with GCC 4, like XyDiff, which also had a pretty idiotic build system; I’ve found Java code written for Java 1.4 and not working on 1.6 (with no source available of course) – many thanks for the “Write once run everywhere” idea – and much more sophisticated stuff (like Nokia’s xmlpatch which is probably something I could use for other stuff, but not for this). The only option that seemed at least near what I needed was xmldiff, which is in portage already. Too bad the thing, left 20 minutes working on the two files, was still crunching numbers with 80% cpu, and not outputting a single line of difference.
Is it this difficult to find a tool doing what I need here? I suppose I could spend some time writing my own tool, either for just this particular case or generic, but I’m not really sure I want to start this yet. Especially since I wouldn’t have time to polish it and I’m tired of starting projects I never complete in a decent way.
And I’m not sure which language I should use either. I could use Ruby but I’m afraid of the memory usage. I’m not good enough with Java to use that. Standard C could be an option but would probably be a bit overcomplex. The probably “better” choice for this would be C# so that I could use it directly on the computer I’m generating the file on, but then I’d like something usable on Linux too, so I would probably be forced to look into Mono for that…
If somebody has a suggesting, it’s very welcome.
Posted in Technical, English | Tags Differences, Nokia, XML, XMLNotepad | 8 comments
Posted by Diego "Flameeyes" Pettenò
Sat, 17 May 2008 13:26:00 GMT
As an experiment, I’m trying to write a blog entry directly from the browser of the PlayStation3. Unfortunately, I’m not used to this keyboard anymore, it’s also quite noisy compared with the ultra-silent Apple keyboards I’ ve been using for the pat months. Additionally, it seems to lose quite a bit of keystrokes, so I suppose this entry will be full of grammatical errors. Sorry for that, it’ s just a test anyway.
Unfotunately, my idea of trying Timeshift’s demo with keyboard and mouse to see whether I’ll be ready to play UT3 and C&C RA3 (when it comes out) on the PS3 was ruined by the fact that the game ignores keyboard and mouse input. The suck!
Ryan, do you have any comment about UT3 with keyboard on the PS3? I don’t think I’ ll be ever able to play FPS with a joypad…
Posted in English | Tags Games, keyboard, Mouse, PlayStation3, PS3 | 1 comment
Posted by Diego "Flameeyes" Pettenò
Fri, 16 May 2008 22:04:00 GMT
This is not really Gentoo-related, just a service notice for those who wonders, as I was asked in private about this. I do moderate comments, and I don’t accept all of them. In particular, since a few months I automatically delete some people’s posts from the queue without even looking at the comment.
This blacklist (which is actually just a pgsql command, I do it the hard way because typo does not support a proper blacklist) does not include Ciaran, as you can guess if you read my comments. He sometimes have valid technical points, so I usually moderate him by hand – he also seems to have high consideration of either me or the people who actually follow my blog, as he does comment so much. I tend to limit the possible recursiveness of his arguments though, so you’ll usually find just one post from him unless he makes a new point I find valid.
Yes this is not a democratic forum, I never said it was. But unless you contributed just pointless talk for enough time to drive me off, I usually tend to allow people to disagree with me.
As for what Ferdy said, my post wasn’t as much as a rebuttal to him than it was to others, I think who I wanted to understand did so already. But as I said I admit my mistake: I didn’t check the logs. I know now it was a bad idea, but I didn’t. Although this is indeed a mistake, I don’t consider ever having voted for the meeting on the 15th of May, I voted to reschedule, that’s right, but I didn’t even read any date.
So my point still stands: the meeting wasn’t agreed upon. If the majority of the council will agree that the rule still applies, that’s fine by me, but again I’ll propose the next council will, first task on their list, clarify the rules on meetings (as Paul said): when they can be considered agreed upon and when the rule should apply.
Posted in English | Tags Blog, Comments | no comments
Posted by Diego "Flameeyes" Pettenò
Fri, 16 May 2008 17:20:00 GMT
Well, shit happens people, and it seems like the extraordinary meeting that was supposedly scheduled yesterday night found Donnie and Wernfried (amne) alone in the channel.
As people seems to either look at this as a sign of the council misbehaviour, or just as an escape route from an hostile council, I’d like to let people know how it is possible at all that this happens.
Let me start saying that yeah this was a bad mistake and that it’s all the council members faults. Although this counts in both Donnie and Wernfried as well as us five missing the meeting. This does not mean, though, that this was done intentionally or that the council doesn’t care.
During March meeting we already seen that it’s sometimes difficult for all of us to remember the exact day of the meeting. Myself, I find it particularly easier to remember an appointment when it happens the same day every month (like my credit’s card bill due the 5th), rather than the same day of the week of the given week every month, which is the schedule that Gentoo Council meetings always had since it was enacted almost three years ago.
For this reason we activated ourselves in two direction: first, the council members exchanged contact information (mostly phone numbers) and second a calendar on Google Calendar was created for us to be able to get reminders of meetings and other stuff like that. Although many people may dislike the choice of using Google – I also dislike it as it doesn’t work with Konqueror – it’s the only easy thing we have available at the moment, so that will be it.
Now back to last week’s meeting: with the long list of topics to discuss, we reached two hours and a half after the meeting started. On the timezone me, Luca, Wernfried and Markus are, that would have been midnight. I think Petteri is even further along the timezone line, so that would be 1 or 2 AM for him. I was quite sleepy already, and I sincerely expected the meeting to end sooner. I took off basically at the time you can read my last line in the log (22:32 < FlameBook+> [reschedule to special I mean]), I got to the bathroom, then came back, checked if somebody called me, I seen Donnie saying I was okay with the reschedule, I didn’t pay much attention, closed the laptop and gone to sleep. Wernfried gone to sleep earlier, Luca I suppose went about at the same time as me. Nobody else from the council but Betelgeuse and Donnie seems to be around in the log.
Did I read summary or log the day after? Sincerely, no. I did think I was there till the end, as we were already late, and I don’t tend to read them usually anyway, I’m there during the meeting why should I read the summary? I usually read the replies but not the summaries themselves; I can tell you that Duncan on -dev made the point of the log being missing, so that I surely read. I didn’t even remember to ask what we had to do for the special meeting, and that’s entirely my fault, I should have asked. But I barely remembered saying I was okay with rescheduling, considering the lateness of the whole thing.
Now of course the problem is that life goes on, and if you don’t do something right away you most likely will never do it. That particular thing to do would have been writing the meeting up in the calendar. I’ve made an habit of writing down appointments, meetings, calls, everything in a calendar, even if it means having many calendars to keep synchronised. But as I said, it was late, and I didn’t really get up to that point that the meeting was already appointed to yesterday. Nobody else added the meeting to the calendar.
This should have been a task for the council of course, but the calender is set up in such a way that anybody can add it and invite other people to it. At any rate, nobody did this, but it’s still the council’s fault for none of the seven members to write it down.
Ordinary meetings are announced by Mike’s mailer, but this didn’t happen this time as it wasn’t an ordinary meeting. There was no traffic on the council alias or on the mailing list reminding us of the meeting. Life goes on, the time of the extraordinary meeting arrives, and Donnie and Wernfried are the only ones to show up.
I received exactly one reminder of the meeting, by Sput (quassel’s author), who sent me a message on Jabber. Unfortunately I’m working on a deadline and I’m working almost all day long – I’m taking time to write this while I have dinner. When I’m working on a deadline I tend to keep IMs on a different desktop, and limit myself to be disturbed by filtered email messages and SMS. Neither arrived so I kept going till late, and then I decided to sleep.
Now of course technically the fault is entirely of the council members. I still argue this does not trigger the rule of the 50% attendance, as we did held a meeting this month anyway, and the date of the new meeting wasn’t agreed upon by all the members at the end of last week’s.
But still, am I the only one who thinks that it sounds tremendously like a last exit to get rid of the council when people point everybody at the rules, asking a new election, without having tried a thing to get the meeting actually happening? It reminds me of somebody watching from a window while someone else gets beaten, and after the fact screaming that police should have been there to save the victim. It’s true that police should have been there, but are you sure you couldn’t have done something about that?
Now that I explained how it is possible that the meeting was missed by almost everybody, let me reiterate that my official position here (and I repeat mine, not the council as a whole, I’m writing as a single developer here), is that the 50% attendance rule does not apply to this case as the meeting wasn’t officially scheduled through a voting process. As some people like to call in governments legislation and other law terms, I’d say there was no meeting of the minds on this meeting at all – sorry, pun almost certainly intended :)
And, Donnie, Wernfried, I’m not blaming you, hope you understand. As I said we all screwed up, and I’m probably to blame extra as I was the one who started the idea of the calendar, and should have at least remembered to ask. I wanted to document the whole happening also because the next council, which will be elected anyway this summer, will know what not to do to make sure that people get in the meeting.
Posted in Gentoo, English | Tags Calendar, Council, Flickr, Meetings, ShitHappens | 6 comments