“New” subversion structure using svn:externals

Me and the boss deviced a new structure for the project during the last few weeks, and it’s been slowly refining in our heads until yesterday when we finally implemented it. I think we made a rather refined and complex structure, but once we got it into place physically and once we get the general idea into the developers heads (including me), I think it will prove very powerful.

That being said, I don’t think this is a new structure, I just think people are very quiet about how they use subversion, and it’s a problem. Newcomers do the same old errors over and over again. So, let’s get on to try and explain it all.

Most projects uses a single BTT root, where BTT stands for Branches, Tags and Trunk. Ie, they start a project, and then straight in the root put the BTT, and then inside that, they create the project structure. For example:

  • project-root/
    • Branches
    • Tags
    • Trunk
      • admin
      • src
      • out
      • test

This is a good basic structure for very small projects, containing perhaps 10’ish files, or where the actual implementation is perfectly homogenous and has no need for separated versioning. Every time we want to make a release, we cheap copy the content to Tags as a new tag (called perhaps /Tags/Milestone1-RC1). We now have a release that we can provide to people.

The problem comes if it isn’t so homogenous. For example, let’s say you are developing a calculator. It has two objects, a numpad and a display. What if you want to make a new version just of the display? You need to make a completely new version, including for the numpad.
Or how about wanting to branch just a small part of the project? Ie, I want to use a branch for the numpad, and then use the trunk for the display. You’d then have to make a cheap copy for the entire tree. Admittedly, it isn’t costing too much.

Our “new” structure deals with this on a different level. Basically, the idea is to have multiple BTT roots, and then use svn:externals to connect the correct tags to create
1) a complete releasable project and
2) a complete workarea project.

For the calculator example, you get the following structure:

  • calculator/
    • Calculator_Modules/
      • Display/
        • Branches/
        • Tags/
        • Trunk/
      • Numpad/
        • Branches/
        • Tags/
        • Trunk/
    • Calculator/
      • Branches/
      • Tags/
      • Trunk/

As you can see, it looks much more complex, and it is, but the possibilities are infinitely much better.

The Calculator/Trunk/ directory contains a svn:externals property linking in the Calculator_Modules/Display/Trunk as Display and Calculator_Modules/Numpad/Trunk as Numpad. This works by linking external resources into the current directory structure, so basically I would get the trunks into my Calculator trunk, but properly renamed, without them actually being there in the repository. This also works on “real externals” by the way, such as linking in a specific version of a library from some repository on the Internet.

To create a Calculator/Tags/MS1 we could either just set a -rXX to the correct subversion revision, or we would create svn:externals to the correct Display and Numpad Tags, not their trunk. This way, we can say that “Calculator 1.0 contains Display 2.0 and Numpad 2.1”, not “Calculator 1.0 contains Display revision 439 and Numpad revision 587”, or even worse “Calculator 1.0 is revision 587” which completely lacks granularity.

I’m not completely sure it’s perfect, and others have probably already tested it, but I think it will be pretty sweet :-).

Mednafen configuration for Logitech Precision

October 29, 2008 by · Leave a Comment
Filed under: Linux, Ubuntu 

As I’ve already stated partially, I got an HTPC at home running MythTV on ubuntu. One of the things I’ve wanted to do for a long time was to get some games running on it. Supertuxkart was simple and was installed in less than 3-4 minutes once I understood the basics of the MythGames plugin (typing with a on-screen keyboard and a remote control is slow).

Anyways, I did have some problems getting a NES emulator, or any emulator at all as a matter of fact, running on it, and I also had some problems getting input from the right devices to them properly. I finally decided on mednafen as it seemed the easiest to understand.

Let’s understand the structure. NES and other games are usually downloaded in some image file. Mednafen is installed as a binary. MythGames needs to know about the binary used to launch a NES image, and where the NES images are located. I downloaded mednafen using apt-get install mednafen. Secondly, MythGames needs to know where you will put the images, personally I put them in /var/games/nes/. This is entered into the mythtv configuration using the Setup -> Game Settings -> Game Players. Choose New Game Player and enter

Player name: mednafen (for example)
Type: Other
command: mednafen -nes.stretch 1 -fs 1 -vdriver 0 %s
Rom Path: /var/games/nes

Having a keyboard around when doing this is prefered, using the on-screen keyboard takes ages.

Once this is done, go to Setup -> Game Settings -> Scan for games. This will scan the /var/games/nes directory for all images and add them to the list. To start a game, go to Games. Then get into the “All Games” -> “mednafen” and you should find all the games from /var/games/nes there.

Click one, and the game should hopefully start. The first time mednafen is run, it creates a directory ~/.mednafen/ containing a basic configuration. The following is an example to get my Logitech Precision gamepad running with it:

nes.input.port1.gamepad.a joystick 42190af389429475 00000002
nes.input.port1.gamepad.rapid_a joystick 42190af389429475 00000003
nes.input.port1.gamepad.b joystick 42190af389429475 00000000
nes.input.port1.gamepad.rapid_b joystick 42190af389429475 00000001
nes.input.port1.gamepad.select joystick 42190af389429475 00000008
nes.input.port1.gamepad.start joystick 42190af389429475 00000009
nes.input.port1.gamepad.up joystick 42190af389429475 0000c001
nes.input.port1.gamepad.down joystick 42190af389429475 00008001
nes.input.port1.gamepad.left joystick 42190af389429475 0000c000
nes.input.port1.gamepad.right joystick 42190af389429475 00008000

nes.input.port2.gamepad.a joystick 42190af389429476 00000002
nes.input.port2.gamepad.rapid_a joystick 42190af389429476 00000003
nes.input.port2.gamepad.b joystick 42190af389429476 00000000
nes.input.port2.gamepad.rapid_b joystick 42190af389429476 00000001
nes.input.port2.gamepad.select joystick 42190af389429476 00000008
nes.input.port2.gamepad.start joystick 42190af389429476 00000009
nes.input.port2.gamepad.up joystick 42190af389429476 0000c001
nes.input.port2.gamepad.down joystick 42190af389429476 00008001
nes.input.port2.gamepad.left joystick 42190af389429476 0000c000
nes.input.port2.gamepad.right joystick 42190af389429476 00008000

command.exit joystick 42190af389429475 00000006&joystick 42190af389429475 00000007
command.exit joystick 42190af389429476 00000006&joystick 42190af389429476 00000007

Unfortunately, the above changes around a bit from device to device and atm i’m not even sure the i’d will survive from disconnect/connect of the gamepads.

The proper way of doing this is to:

1. Start a game.
2. Press Alt+Shift+1
3. Push the correct buttons asked for on screen to do specified command. (First time you push a button adds it to the command, second time you push the same button marks it “final” for the command sequence. Peculiar, I know. So, to make the game use button 2 and 3 in conjunction to be button A, you’d first press button 2 once, then button 3 twice.
4. hit esc on the keyboard to leave mednafen. The config should now be saved.

I haven’t found a way to create the “command.exit” commands yet. I’ll have to work some more on that.

Stoneage efficiency measurements

October 20, 2008 by · Leave a Comment
Filed under: Management 

Once again I react to the inefficiency of corporate bureaucracy. A very common way of measuring efficiency is to use statistics. How do you use statistics to measure efficiency, and especially in cases such as helpdesk and support functions in a corporation?

A common way of doing this is to just measure closed tickets, and how long time is spent per ticket. I’m not sure how many companies still do this, but I’ve run into it more than once (actually, more times than I can count on my own hands) in the last year.

The problem is that any given person with the sole efficiency measurement being quantitative applied knowingly on him will react by trying to increase his efficiency, and how better to do that than to just cut and paste answers and close any tickets as soon as that’s done.

My response to this, is it quality or quantity that is most interesting? I believe the answer is quite simple in this case, I’m all for quality. Unfortunately, the entire economic system seems to be leaning towards quantity rather than quality these days. I think a half decent compromise however is how CCP in eve-online is handling user support, and it’s the same way I’ve done it when I did user support.

Once you get a problem report (aka ticket), skim through the message, see if you can find a common denominator with some of the most known 6-7 problems (or more if you’re unlucky). Send a cut and paste response (with either an explanation, or a detailed step by step fix), but keep the ticket alive until the person responds. If no response has been received in a given time, say a week, try to contact them again and see if the problem was solved before closing it. If the problem hasn’t been solved by this simple round, it’s either time to send it to 2nd line support, or if there is no 2nd line support start asking for information that can be used to debug the problem, and delve deeper into the problem.

I’m not claiming this is a holy grail of any kind, but it does hopefully keep more customers happy. It requires happy and motivated support personel, and that can at least try to keep face up for a while with customers. To do that, it requires proper motivators, and definitely not some stoneage efficiency measures. Get customer satisfaction index into the game, even if it’s an internal function in your company, or an external function fronting towards your customers.

Switching GNU toolchains in eclipse — the easy way

October 13, 2008 by · Leave a Comment
Filed under: Development 

This is a method of switching to a different toolchain that I found in eclipse. Basically, my goal was to get eclipse to use a secondary toolchain. Primarily in my first step, I tried making eclipse use a crosscompiling gnu toolchain.

Doing this the “right” way seems to entail writing plugins eclipse, and to write lots of XML configurations and so forth. Not having the luxury of infinite time and money (yet wanting a managed build), but rather being result driven, I finally managed to solve it partially with a hack.

My secondary goal now is to make the build work with a completely “non-gnu toolchain” (renesas sh compiler), I will try to hack together this in the upcoming days. I’ll get back to this topic again, once I know if it works or not. In the meantime, this is how I got it to compile with “non-standard” toolchain, and “standard” cygwin toolchain at the same time.

  1. Install the toolchain somewhere.
  2. Setup your PATH with the /bin/ directory in it.
    1. Start -> Control Panel -> System.
    2. Enter the Advanced tab.
    3. Click Environment Variables.
    4. Find the PATH variable in System variables.
    5. Edit and add ;c:pathtoyourtoolchain at the end of it.
    6. OK
    7. OK
  3. Create a new Build Configuration (Target for example).
    1. Right click the project in the Project Explorer.
    2. Build Configurations -> Manage…
    3. New…
    4. Write name “Target” and a description.
    5. Copy settings from another target that might contain decent default values.
    6. Ok
    7. Ok
  4. Edit the Settings for the “Target” Build Configuration.
    1. Right click the project in the Project Explorer.
    2. Choose Properties.
    3. Go to C/C++ Build -> Settings.
    4. Choose the right Configuration at the top (Target in our case).
    5. For each heading in Tool Settings (GCC Assembler, Cygwin C Compiler, Cygwin C Linker)
      1. Click the heading.
      2. Edit the Command field (for example, instead of using gcc, you might be using arm-elf-gcc or m68k-uclinux-gcc).
      3. Apply.
    6. OK.
  5. Try to build the new “Target” Build.

Hint: A problem I ran into was that my new toolchain couldnt understand/interpret unix style paths properly and not hinting very openly about it. Ie, I got “missing header files” all over the build. Turning on verbose (-v flag) in the C/C++ Builds -> Settings, and then under Cygwin C Compiler -> Miscellaneous gave me an error like “ignoring nonexistent directory”, which turned out that instead of using “../inc/” I had to use “..inc”.

Removing U3 from a SanDisk cruzer micro 1gb memory

October 9, 2008 by · Leave a Comment
Filed under: Hardware, Windows 

Girlfriend has had a USB memory stick for a long long time now, and every time I plugged it into the computer, I’ve gotten completely raving mad at how retarded it is. The story is this, it has 2 separate partitions. 1 partition where you save files etc, and a “system” partition containing something called U3. U3 is closest described as a virus imho.

The system partition is read only and I found no way of easily making it read/write/formattable. Every time you plug in the USB stick, it will autorun a junk program called U3 launchpad with a lot of popups showing up to let you know about it, and it has a bad notion of trying to be a second “start” menu or something.

Anyways, I decided for the 3rd time to try and remove this crap from the USB stick, both times before I got about 10 minutes into the process, at which time the computer had locked up hard on me 2-3 times, and almost had me stomping on the memory stick out of sheer annoyance. Same thing happened this time. But, I had some more perseverance, and actually access to the internet this time, and started searching for others with the same kind of problem.

I found this: http://www.u3.com/uninstall/ . The sheer idiocy of this amazes me. Let’s assume that here I am buying a memory stick to help me “when I have no access to the internet”, and I get some junk with me on the usb drive. The only way of getting rid of the junk, is to download an application off of the “thing I will likely not have access to”.

So, I download the application, and run it. It asked me if I wanted to backup the data on the memory stick. I did, so I choose to backup data on it, and continued. It downloaded the data properly to the harddrive it looked like, and continued to reformat the drive. At this point, it crashed, trying to replug the USB drive didn’t work — apparently the driver for the drive was already installed. So, reboot the computer, and it finally recognizes the drive again. It’s empty, no more U3, but the application never got around to actually formatting the new drive and reinsert the backed up data. No worries I think, I format the drive, and manage to search down the backup to C:Documents and SettingsApplication DataU3tempU3BkUpDir. Guess what, the application only copied the directory structure, no data is actually in the directories.

And they have the audacity to _really really_ try to talk me into “nooo, you want to keep this application, it will save your life” more or less. It’s a freaking virus. It’s actually harder to get rid of than quite a lot of viruses, and caused more of a havoc imho. Anyways, check out the above link to get rid of U3. And be prepared to backup data on your own

The dead horse rebeaten to life – How governments keeps banks alive

October 6, 2008 by · 2 Comments
Filed under: Economy 

So, once again it happens, local governments jumps the bandwagons to save big time banks who have done a crap job at making sound and good business. Once again we have people completely misbehaving, and in general doing bad business, getting their wallets lined with more money from the governments to save them.

Personally, I don’t have a belief in either [political] direction really, but I think that if we are going to make a sustainable planetarian (as opposed to the wordinternational, which always tend to exclude countries) economic system, we need to stop promoting the current scenario with promoted competition and then giving our friends (the loosers) prizes for doing bad choices. This is contra-productive in my humble opinion, and stagnates the market and the players in a bad circle.

We have two diametrically opposite choices planetarian economical systems — in reality, no we don’t have these choices, but to make what I believe is a sustainable planetarian system. I refuse to talk about global economy as we’ve already seen where that leads.

The problem
The world willingly entered (yes yes, I’m beating a dead horse as well) a global economic system during the 1990’s, the leaderships and right wing politicos of countries jumped the possibilities, while citizens and left wing politicos where slightly defiant and backwards, something normally attributed to right wing people. Either way, we entered the system, but only partially. Banks (swedbank, hypo real estate, fannie mae, et al) and global mega corporations (ibm, dell, coca cola company, disney, ford, nestle, et al) are using the possibilities to its fullest, they are no longer national entities, they are everywhere and anywhere and noone except themself has a decent window into the ins and outs of their economical structures. And no, no, no — Nasdaq, SEC, NYSEC, and none of the so called third parties have a decent looking glass into these kind of megacorps. In actuality — the ones who where in some part supposed to be our warrants against misbehaviour, where the ones misbehaving the worst in this round.

National governments and local governments are still living in the local economic system, they know part of what is happening, not even close to everything. They are still regarding banks and other megacorps as local entities, which does good for the locals, and which needs local support in bad times. For examples, look at Lehman brothers, Hypo Real Estate or SE-banken back in the days.

Are they really worthy of our [local] support? As it currently stands, the economical machinery doesn’t work. It’s out of sync with reality, fantasy sums of money are passing around every day in the forms of loans and 1’s and 0’s.

I will pull a weird example from a game I’ve played for quite some time, eve-online (It has it’s own problems, admittedly), to show how numbers can be misguiding. Recently, there’s been a gigantic war between two different factions — GBC and NC. Normally all “kills” are gathered on specific webpages for each alliance, GBC has several alliances, and NC has several alliances as well. Now looking at any one of those alliances killboards for a big battle, you always have the “local“, ie the alliance who owns the killboard, looking as if they came out as the winner of the battle. Now, go over to an alliance on the other side, it looks the same way, the “locals” where winning. In this case, you only get a partial overview of the fight — you get the losses of that specific alliance but none of the others, but since everyone from all alliances on one side are sharing the kills, all the kills are showing up on any one of the respective alliances killboard.

This [eve fights] alone is hard to get accurate numbers on unless you do some serious data aggregation and acquisition, now let’s try to get accurate numbers for a real life company operating in 50+ countries, especially if anyone at any level in that company has something to hide? And if the one who has something to hide, is the one who is supposed to be supervising the market?

Choices
The situation as it looks is untenable, we are currently fighting a fire with fire, and most likely moving problems from one place to another.

There are of course, several different choices imho, but to be perfectly logical, there are a few different changes that must be made.

Choice number one, go liberal. Do not engage in saving the different banks in financial crisis, let them be devoured by bad choices and the strong ones survive. The problem is, how do you make this work on a planetary level? Ie, if the banks in your region are not saved, they get a disadvantage in comparison to banks from regions which have regional support in bad times, hence putting darwinian rules out of the calculation. In other words, a planetary agreement must be reached for this to happen.

Choice number two, go all out socialistic, save the banks, but in return all the banks should either be run in such a way that their own proceeds will pay for either their own demise (Ie., make them pay for some kind of government run insurance, which must reach a zero result over a defined timeline), and also make the figureheads and CEO’s of financial institutions and banks personally responsible for what happens inside their organisation. Make it personally hurt whoever is responsible. This also requires quite a lot of unison between countries as to not provide too much leeway for any one of the banks around.

In summary, something needs to be done about this. Every 15-20 years or so we have another financial crisis due to more and more greed, and mostly it’s about the same type of people doing the same type of mistake over and over again.

Moving interface from Enterprise Architect to C include file

October 1, 2008 by · Leave a Comment
Filed under: Development, Editors 

After writing this, i realized the output after this is almost 100% the same as I got from exporting the original class as a C header from Enterprise Architect, still putting this out there as it’s a nice regex. Cut n paste each function line from EA to the header file. format will be a bit screwed up, for example:

functionname(varname: vartype, varname2: vartype2): void

Begin with moving trailing return type to beginning:

:%s/^\(.*)\): \(\w\+\)$/\2 \1;/g

Get all varnames and vartypes into correct positions:

:%s/\(\w\+\): \(\w\+\)/\2 \1/g

All function declarations should now be fixed.