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.
I don’t write documents very often, but as any mortal sometimes I just have to. And when I do, I usually try to do it with LaTeX. I’m not a master user but still it saves me a lot from dealing with the layout. I just learned that there is a proper way of avoiding widow and orphan lines(the last line of a paragraph in a page beginning and the first line of a paragraph in the page bottom). With these lines you can set how hard LaTeX should try to avoid those:
\widowpenalty=300 \clubpenalty=300
You can try with bigger numbers to tighten but it might also make your document look worse.
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.