I started reading this book, Artificial Intelligence for Games, but the the example code was not compiling under Mac OS X. It seems like I fixed it.
Here’s the authors’ repository, and this is my fork with fixes.
I started reading this book, Artificial Intelligence for Games, but the the example code was not compiling under Mac OS X. It seems like I fixed it.
Here’s the authors’ repository, and this is my fork with fixes.
Just to make some little noise after not pushing anything to this blog, I will share this nice trick I learned today. If you want to see what macros gcc define on your platform:
gcc -E -dM -xc /dev/null
does the job for you.
This week I bought myself a network attached storage device, Western Digial My Book World Edition II. The device runs BusyBox Linux distribution under the hood. It has an Arm926T series ~200Mhz processor and 128 megabyte system memory.
As far as I could see from various forums, in the previous firmware versions it already had the necessary gcc toolchain inside the device but it is no longer present in the current versions. I have bumped into some tutorials on cross-compiling software for the device but as a regular scratchbox user I wanted to create a scratchbox target for the device so cross-compiling stuff(especially with autotools and similar stuff) would be less painful.
First, I created a target with the cs2005q3.2-glibc2.5-arm toolchain that comes with scratchbox 1.0, and managed to compile and run some software successfully(e.g. gnu screen and transmission 2.03). But then later on with some other stuff that I tried to compile started spitting out runtime errors about missing symbols.
Then I downloaded the archive file from Western Digital’s web site which included all the source code of the software used in the distribution and also the gcc toolchain that was used to compile the system. After struggling for some hours and following the instructions on scratchbox website for importing foreign toolchains, now I can cross-compile for the device without problems. The only problem I encountered while importing the toolchain was a compile error while compiling gdbserver application. The solutions to the problem seemed a bit complicated and as I do not urgently need the gdb server I made some changes in the Makefiles and removed it from the build. For those who don’t want to go through importing the toolchain I created the tarball and deb package for the firmware version I have, feel free to download. After installing the package just select the mybook-arm toolchain and qemu-arm-cvs as the cpu transparency method, things should work fine.
Besides the gdb server error, while trying to build glib library it failed with errors of undefined reference to some inotify_* calls. I saw that the inotify related headers are present in the toolchain but the libc that comes along does not have the methods. I have no idea why it is like that, but then I managed to compile glib after I removed the headers.
The linux distro in the device has no package management system, so I was a bit afraid to mess stuff up with libraries. Currently I am compiling all the applications with statically linked libraries. Seems to work fine so far.
Today I needed to pick some specific changes from a local git branch and merge them to another. git cherry-pick does the job.
Usage:
git log source_local_branch #check the sha1 hash of the commit we want git checkout destination_local_branch #switch to the branch we want to merge the commit. git cherry-pick -x <commit_id>
the -x parameter adds the original commit id to the commit message.
Git has been warning me for leaving trailing whitespace in code files every now and then. So I decided to put this in my .vimrc:
Source: here
Found this useful piece of code to put into .bashrc, which shows the current branch when the current working directory is versioned by git.
This was the most useful thing I’ve found today.
found it here.
I used to carry all my vim settings in a .tar.gz file wherever I would go. Sometimes it would get messy because I would forget to get something from somewhere so I would need to create it from scratch. Now I’ve got everything in a public git repository, and I hope it could be useful for other vim beginners too.
The repository can be found here.
As I mentioned previously, I kind of liked the ack-grep tool. I made a small patch for it so that it ignores moc_*.cpp files generated by Qt’s moc tool, which I think makes not much of sense to include in the search as they are automatically generated files.
For a while I have been trying to convince myself to write a script for filtering grep output when searching code trees, especially ones versioned with Subversion or so. Then I made some googling around to see if anybody made it already. I was lucky, someone already written a tool called ack. It searches recursively filtering almost anything that will not make sense; such as binaries, backup files of editors, version control system files and so on. It also has very nicely formatted colorful output.
Here it can be found: