..
It's you and me.. and billions of bugs.
I needed to have gcc 4.6+ on my laptop to compile some c++11 code, which my gcc 4.4.4 from synaptic wasn’t able to handle. Yes, yes ‘update your ubuntu’ is the default warcry in such situations, but I didn’t want that to happen, not yet. So I needed a second gcc in my system. This is a reminder post to myself, nothing spectacular, it’s a bit dirty as well, and it’s already thoroughly documented here http://gcc.gnu.org/faq.html#multiple
What I did was, checked out the latest gcc from svn. Configured it with ./configure –prefix=/usr/local/gcc-4.7.0 –program-suffix=-4.7.0 (btw that suffix is completely unnecessary because all files will anyway be dumped in a folder named gcc-4.7.0) and than called make -j10 (yes I went out, grabbed some food, a coffee, got back and it at that very second it was done). make install finally to install it into /usr/local/gcc-4.7.0/
Additionally I’ve overridden the existing symlinks to let me use the new gcc as default gcc:
ln -s /usr/local/gcc-4.7.0/bin/g++-4.7.0 /usr/bin/g++ -f
ln -s /usr/local/gcc-4.7.0/bin/gcc-4.7.0 /usr/bin/gcc -f
And one last thing, for programs compiled with 4.7.0 you need to tie in the new libstdc++ as well, otherwise you’ll get an expected error message when executing them. Each libstdc++ covers all previous versions, but cannot cover future versions. For example, with my gcc 4.4.4 from synaptic the libstdc++ version was: 6.0.7. The new gcc 4.7.0 comes with libstdc++ 6.0.14.
Just like the gcc and g++ a symlink for libstdc++ exists in /usr/lib. We need to override that one as well:
ln -s /usr/lib/libstdc++.so.6 libstdc++.so.6.0.14 -f
And that’s it. Of course, there are some other libs like the one for objective c etc. that need to be symlinked. OR you can make your own shell script that sets LD and exe paths accordingly, and while working in that context, you can use the selected gcc version. I will try this out, and add it to this post, one day .. soon?

It started snowing, it’s christmas, and I am a great fan of 2d games. And that’s particularly true when they are made of pixels. Ok, all games are made of pixels, but what I meant is – real pixel art, sprites and bobs, limited number of colors, blocky esthetics, everything that smells like amiga.
Enjoy this wonderful trailer, I can’t wait for the game to come out – Owlboy, we welcome you!
Several ways found so far, the suggested ‘through the nautilus’ webdav connection approach never worked for me on both 10.10 and 10.04. Maybe it works with a later version, I don’t know.
But here is an easy way to set it up.
* Open terminal
* sudo vim /etc/fstab
* append this line to the bottom:
https://www.box.com/dav /home/youruser/box.com davfs rw,user,noauto 0 0
Naturally change youruser to match your actual user.
* Save and exit vim
* cd ~
* mkdir box.com
* mount box.com/
* type your full user name, don’t forget the email part! (ie. name@email.com)
* enter password
That’s it.
After that you can use rsync, cp, mc or any other tool to copy data back and forth.
What a wonderful, inspiring weekend, spent writing some C in Cygnus Editor. Few months ago a coder from my demo group from the nineties found his Amiga 1200 with a fully functional and kicking hard disk. In one of its deeply nested, completely deprived of any systematical approach, ‘drawers’ (that’s how folders were called on amiga), I’ve bumped into the contents of one of the rarest books for amiga, low profile, cheaply done, published only in Germany, never translated to english, called: Grafik In C. But it has tons of hints (quite valuable today) on how to do some advanced gfx coding in C (copper, blitter, viewports, pixel manipulation, basic 3d etc.).
SO, I decided to share it with anyone who might be in need of good tutorials:
http://almagest.modmancer.com/data/grafik_in_c.zip
Ok, here is the story. The amiga demoscene group i was coding for back in the nineties has called for reunion, so here we are, with our first public appearance after 15 years, since the age of BBS’s :)
Protozoa, by Almagest, 2011
Music: BLAME, “convergent fields” album.
Credits: akiko (code), BLAME (music), blue imp (closing words)
Readme file: agt-protozoa.txt
Youtube:
I’ve chosen html5/js as the platform for this demo (ok, technically it’s a trackmo), because it’s a simple and easy way to do it, and it’s online.. well, times have changed, people got accustomed to different ways of thinking, downloading and installing files seems to have become quite an effort for a common user, so here we go – one click away from it – everything online, just click and watch.. or at least that’s what you can do if you have HTML5 capable browser, and I actually suggest: Firefox 4 (version 3 is too slow), Chrome or IE9 (official). I think Opera would do as well, they used to have quite a fast js engine, and html5 (especially canvas pixel pushing) was pleasingly fast, last time I tested it.
Firefox has it. Chrome has it too. You cannot do some funky things with the files coming from different domains than the script you are running. I was just trying to load image from http://www.modmancer.com, and then to do some simple image manipulation code starting with:
var data = context.getImageData(0,0,100,100);
and both Firefox and Chrome choked on that snippet.
Discussion about this issue is too long and boring, if you want, you can follow it from this link, it’s your funeral: http://code.google.com/p/chromium/issues/detail?id=40787&q=ajax%20local&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner%20Mstone%20OS
Anyway – how to avoid this ANNOYING issue while doing local development? Simply start chrome with ‘–allow-file-access-from-files’ argument, and you are done. Don’t forget to clear this argument when finished, it could eventually become a threat to your browser’ safety.
Didn’t figure out how to disable this idiocy in firefox yet.
Usually I look after this over and over again, each time I set up ubutntu 10.04 or 10.10. So, this time I will post the link to the quick solution:
http://ubuntuforums.org/showpost.php?p=10324779&postcount=8
Just in case the link is unavailable, here is what it says:
Re: Disable nouveau Quote: Originally Posted by bmeakings View Post You can edit the modprobe blacklist file (terminal: gksu gedit /etc/modprobe.d/blacklist.conf) and add these entries at the bottom: blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv Then reboot and they shouldn't be loaded. I had to do the same with my system. You also have to type "sudo update-initramfs -u" to create a new image and reboot before nouveau is actually removed.
When using qmake as your build system, if you have a project which depends on a, e.g. external_library.a, you will need to set it up so that it can rebuild the library automatically, whenever the external library changes. In Visual studio this is easily done via its GUI, project properties, dependencies section, but when it comes to qmake, it requires a bit of extra effort to set things properly up. But it’s easy, once you know how.
HEARD OF TARGETS?
Qmake uses ‘targets’, thet’re like modules which you define, and insert into the main build chain, telling the resulting Makefile when to build what. Targets can be auto-executed, or simply residing in your make file, so that you can build them on demand.
Here is a simple example, covering the external_library.a story above.
In your main .pro file, add these lines: Read the rest of Qmake and targets (pre-building dependencies) »
Looking for a printf replacement when coding NDS homebrew?
Okay, (i)printf is nice, most of the time, but sometimes (actually quite often) you just can’t use it, be it for reasons like you’ve exhausted all video memory locations, or you need both screens, if you are coding something more complex than a simple effect, or you just can’t fit the complete debug output onto 256×192 pixels. There are several solutions to this problem (log to file using fatlib, send debug via Wifi, setup complete DeSmuMe debugging environment with eclipse), but here I will add one more.
Warning – this one is dirty like hell, and there is absolutely no guarantee that it will work (unless you write your own absolute mem manager).
So, here is the plan – DeSmuMe comes as CLI, gtk and glade. We need the DeSmuMe-glade, you’ll automatically get it if you install DeSmuMe from synaptic. This glade verision features a very handy tool, namely the hex memory viewer. This means, your code can write something let say at location 0×00000000 – 0×00001000 and you will clearly see it in the hex dump. Here’s an example :
Here is a simple way to get high precision timer on both Linux and Windows (can’t remember where I saw parts of this code, but I hope wrapping it up and spreading it won’t make the author angry) :
cross_platform_timer.h
cross_platform_timer.cpp
I added few helper wrappers to make the life easier, you can get current time in microseconds or milliseconds by calling:
//! Returns current time in milisecs or microsecs. //! \param micro Returns micro seconds if set to true. double timer_get(bool micro = false);
Or you can get elapsed time by calling:
timer_start(); // Your code here.. // Get elapsed time in milliseconds. double dt = timer_stop();