3.10.2012

Fixing minecraft with DWM and Arch Linux

In DWM minecraft doesn't work correctly, due to Java not recognizing DWM as a window manager, minecraft will appear something like this.


The fix is quite easy. Install the wname package using pacman and set the window manager name to something java will recognize.

# pacman -S wmname

# wmname LG3D

This is not a permanent change, so it is a good idea to add it to your .xinitrc file in your home directory

Geek Code

What is the geek code?

The geek code gives geeks a way to tell other geeks where their experiences and interests are. It's basically a programmatic way to sum yourself up by code. It is worth checking out.

For those of you who have never heard of the geek code, here is a link: http://www.geekcode.com/geek.html

My geek code.

For those of you who wish to see what my geek code looks like.

------BEGIN GEEK CODE BLOCK------
Version: 3.1
GCS/M/MU d- s++:-- a-- C+++(++++)$ UL+++ P+ L+++>$ E--- W++ N? o? K- w++ !O !M V? PS+++ PE+ Y+ PGP> t 5 x+ R+ tv+ b++ DI+ D++ G++ e++> h r+++ y+++
------END GEEK CODE BLOCK------

3.03.2012

Linux Dual Monitor Script

As some of you may know, I run am running Arch Linux on my Lenovo T420. Being a programmer, I often use a second monitor. It took me a little while to figure out how to get this auto-configured on boot in Arch, but I've come up with the following script.



This script will autodetect if you have a secondary monitor (in my case VGA1) connected to your laptop. And set it up your screens accordingly using xrandr.

To get it to run at boot, I simply include it in my .xinitrc file in my home directory.

Feel free to use the script, although you may have to change the screens accordingly.

12.20.2011

Top picks from the Ludum Dare game programming competition

If you don't know what the Ludum Dare game development competition is, you should definitely go check it out. It is free and anyone can join. You get 48 hours to create a game and then post it on their site. People can create accounts on the site and then vote for their favorite games.

I made a list of some of my favorites after paging through the submissions for a couple hours. (there are 891 entries currently)


Alone in the Gloom - hulahulahest

It is the dawn of the 20th century. A Cambridge scholar and explorer has led a team to the depths of the South American jungle to investigate a newly discovered temple complex claimed to predate the Olmec by several centuries, showing evidence of stonework thought beyond the capabilities of preclassical Mesoamerican masonry. As they begin to explore the strange temple, our professor accidentally falls into a pit and is separated from the group. All alone, he must find his way back to the surface, and maybe score some fascinating pieces of research data while he is at it...
This is a fun little game with some decent graphics.  You play as a gentleman with a monocle who is investigating a temple. There are keys and small puzzles that you have to solve your way through in order to get out. The graphics were very "SNES Zelda" - esque and were fairly pleasing. Overall it was a decent game with good gameplay. It actually has a story which is more than a lot of the submissions in this competition can say.


WEIRDLY ALONE. - xilefian
You work for Nicholas Snowwe, the most famous art collector in the country. He has purchased an old museum that has had no visitors for over ten years. Inside is a fresco by the painter Harld Forche. Find it for me.
This retro looking game looks like it came straight off one of the original gameboys. As you make your way through the museum, you run into different obstacles that require different items to get past them (logs can be burned with your lighter.) One tip: press z to sprint in the direction you are facing, otherwise it will take you ages to move anywhere.

A Gravekeeper - downsider
 ...a Gravekeeper who enters a crypt one night after hearing stories about a treasure inside
Although it doesn't have any sound, A Gravekeeper was a fun game to play through. It is a short platformer with good graphics and fairly solid game play. Basically you are dropped into a crypt and as you continue through you eventually find a gem and the cave starts collapsing. You eventually find you're way to the end of the cave and you win. Short and sweet. It doesn't offer much in terms of gameplay as the level is quite short, but it looks amazing and could really be expanded well.

Dungeons of Solitude - Knighty
Your only friend has wandered into the Dungeons of Solitude and has not returned. Can you survive the dangers of this place alone to find your friend?
This game was very well done. It is very reminiscent of a NES or SNES dungeon crawler. As you make your way through the dungeon, you find items (sword, throwing knives etc.)  that will be used to make it through to the next level. The sounds was a nice addition to the game, although there is no music the sound effects were well done.  The enemies who look like balls of goop were a nice addition. And generally just move towards you after they are aggroed. It was an enjoyable game to play that gets quite difficult as you progress through the levels.

Shaped - sendmorepeople

 A game from a two-man team about being alone, looking for others, and being shaped along the way.
This game is easily one of my favorites. The kind of like one of those match the shape games for kids except on steroids. In Shaped you start as the shape in the picture, your goal is to find the shape that matches you. You aren't left to searching though, as you can press E to send out a sort of tracer that will find your friend. Once you find your friend you simply bump into him and are tasked with finding the next one. Carefully make your way to the next shape without bumping into the others!

An all around great game that is simple and easy to play. The music in the background is superb and the gameplay is unique and relaxing.

Minicraft - Notch
 The goal of the game is to kill the only other sentient being in the world, making sure you'll be alone forever.
Game:
Although Notch created a great game, it would have been nice to see something branching away from Minecraft.Overall Minicraft is a fun little adventure with much the same feel as Minecraft. You can cut down trees to get wood and craft things at your crafting table. It is enjoyable to play and very similar to minecraft. Watch out for the zombies!

Source:
The real plus to minicraft is the code that Notch wrote. The source code is freely available on the Ludum Dare website.
The code for Minicraft is very well done. You can tell that Notch is a brilliant programmer. I had the opportunity to watch his live feed on twitch.tv during the competition. As a Java programmer, it was amazing to see the amount of skill and focus he was able to conjure up during the event. Notch's code is a great example of Java game code. If you are a Java programmer looking to get into game development but don't know where to start. I would suggest using Notch's code as a starting point.

12.17.2011

T420 - Remap Back / Forward Keys

My Lenovo T420 has two keys above the arrow keys that I almost never use. By default they are forward and backward keys for browsing the internet. I decided to remap them to End and Home. This isn't too difficult.

To do this simply use the following terminal commands:
use xev to find the keycode for the key you would like to change the mapping of
use this link to find what you want the key to actually do
Use xmodmap to map the two together.

xmodmap -e 'keycode 167=End KP_1 KP_1 End'
xmodmap -e 'keycode 166=Home KP_7 KP_7 Home'

LWJGL Setup with Eclipse

I recently decided to try my hand at some game programming and decided to try and use the Light Weight Java Game Library (LWJGL)

It took me a little while to figure out how to get it set up in eclipse. Here is how.
Download lwjgl.zip from here

One you've created a new project in eclipse, add the .jar files like you normally would by right clicking on the project -> properties. Click on the Java Build Path tab and then Libraries. Add the jar files by clicking on the "Add Jars..." button.
The next step is what through me off. Make sure you click on the arrow next to lwjgl.jar and fill in the native library location to point you toward the native files that came with lwjgl (.so files in linux and .dll files for windows)

Hopefully this helps!

Building the Linux Kernel on Debian Based Systems

So you want to build the Linux kernel from scratch, but don't know where to start?
Wikipedia describes the Linux kernel as
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software.

If you are using a debian based system like Ubuntu or Linux Mint, building your own kernel isn't very difficult. I put together a short tutorial to that is fairly easy to follow and should make the process less painful.

Prerequisites:
In order to download, build, and install a custom kernel you will need the following packages installed.
1. Git - a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations and
full access to internals.
2. kernel-package - a package used to make kernel compilation more automated and less painful.
3. fakeroot - runs in a command environment at pretends to have root privileges for file manipulation. Useful for creating archives with files inside that have root permissions.
4. buid-essential - contains an informational list of packages which are considered essential for building Debian packages. This package also depends on the packages on that list, to make it easy to have the build-essential packages installed.
5. ncurses-dev

sudo apt-get install git-core kernel-package fakeroot build-essential ncurses-dev

1. Change to the home directory
cd ~

2. Clone the mainline kernel git tree
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

3. CD to the linux directory
cd linux

4. Copy the kernel config from your existing kernel using uname -r for your currently loaded kernel
cp /boot/config-'uname -r' .config

5. Update the config file. The default answer to these questions will suffice.
make oldconfig
yes "" | make oldconfig to accept the defaults

6. Clean the kernel source directory
make-kpkg clean

7. Build the linux-image and linux-header .deb files. This is where the actual work takes place. It could take some time. On my machine with an i5 processor it took 15 - 30 minutes.
The concurrency level of this piece can be set manually. Basically it lets you allocate how many processors you would like to utilize in making the kernel image
CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

8. Change the directory level one up and install the two .deb packeges created<blockquote>
sudo dpkg -i linux-image-<insert custom kernel name here>.deb
sudo dpkg -i linux-headers-<insert custom headers name here>.deb

9. Make the kernel bootable
cd /lib/modules
sudo update-initramfs -c -k <insert kernel module name here>

10. Make sure grub recognizes your custom kernel when you reboot.
sudo update-grub

You're done! Reboot and see if it worked.

Links:
Summary of Linus's Kernel on Git