Filter: hardware,software, code, computer science, tech, life, robotics

SVN Global Ignore

Are you annoyed by setting svn:prop on all your repositories and subdirectories with the same redundant ignore lists? There is actually a handy configuration setting called global-ignores which will let you ignore specific files client-side in a global fashion. All you have to do is edit your SVN client config file at ~/.subversion/config with something like the following:

global-ignores = *.o *.lo *.la *.al .*

Tags: computer science

64 Bits

64-bit processors and operating systems have been available to general consumers for just about ten years now. It's astonishing how hard it has been for software developers and vendors to fully make the transition to 32-bit architectures. Even when we install a 64-bit version of OS X or Windows, if we look closely there is still a lot of software running in 32-bit mode. Most rude are some of Adobes Create Suit products, such as In-Design CS5, which still runs in 32-bit on OS X.

I finally made the complete transition to 64-bit on my Linux machines. I don't have a single bit of code in 32-bit running anymore. Everything is compiled for my 64-bit wide registers and to take advantages of the 64-bit architecture.

The upside: Theoretically some software might run faster, but basically it's just progressive and cool.

The downside: Some software might be harder to find (and not available). Thank God I use Linux and open source software.

Tags: computer science

My Very Own Soft-Bodied Robot

Everybody that knows me knows my fascination for robotics. Recently, I have been fixated by the idea of a soft-bodied mobile robot - more precisely, a teddy bear stuffed with electronics and a small brain. You see, I believe that simplicity is key to jump starting the robotic revolution. Instead of mimicking every human joint using mechanical devices to build a humanoid, I find it much more effective and efficient to look into design techniques which yield similar results but by a heavily reduced complexity factor. This is why I am stuffing a teddy bear with a simple skeleton made up of six moving parts. For the last few nights I have spent some time realizing my design for a robotic teddy bear. After a few hours of work the teddy is already stuffed with all the necessary electronics and I have created my first prototype.

Below some impressions:

Empty Teddy Bear without its Stuffings

The Mechanical Skeleton

Robotic Skeleton and Its Soft Body

Stuffed Teddy with Electronics Skeleton

Front View of the Teddy Bear Robot

Tags: computer science, tech, robotics

Introduction to Robotics

For all those interested, below is a copy of the introduction in my Bachelor Thesis...

What happened to the robotic revolution? Looking back at old technology and mechanics magazines from the 1950's, one cannot help but muse at the wild expectations people had regarding the future of robots. Often portrayed was a bizarre mix of people and machines, living together in a society with the robot as man's new best friend. Some went to the extent to predict a new race of slaves which would serve mankind by the 1960’s – as did the 1957 Mechanix Illustrated article You’ll own Slaves by 1965 (Binder, 1957). The predictions from last century are far from reality. Not only has the progression of the robot been much slower than expected, traversing a very subtle path, but also its role in society has been completely redefined from the original conceptions. Instead of serving us breakfast in the morning, cleaning our living space during the day, and taking our hat and coat from us when we return in the evening, as depicted in the 1940 film Leave It To Roll-Oh (Handy, 1940), robots have found their birthplace in the factory. There they toil away all day, and sometimes night, performing mundane routine tasks over and over. Looking at such a machine, with its precise movements and repetitive activities, its hard edges and vacuous appearance; it has little resemblance of ourselves. Is not the robot supposed to be mankind’s birth-child?

Illustration in Mechanix Illustrated, 1957

The robotic revolution has not yet undergone in the scale and realm so many thought it would. What then has kept it? Does the robot just need more time to develop and grow, or is our concept of the robot fundamentally flawed? A long standing problem in the field of robotics is the perception of the environment. To us humans, this is a trivial task. We see, hear, and touch our environment around us, combining these senses to form a somewhat indescribable organic perception of the world (Thorpe, Clatz, Duggins, Gowdy, MacLachlan, & Ryan, 2001). It is here, at one of the most essential parts of our defining quality, where the robot has stumbled. The ability to perceive the environment and comprehend its implications is the first step in actively being a part of it. Only then can a robot take it’s prematurely crowned role of being mankind’s helper. For thousands of years we have tried to understand our perceptions, starting with primitive cave drawings and slowly mastering perception with realistic paintings. However, teaching robots to understand perception has proven very difficult, even though a robot can easily imitate its environment through the form of radar, sonar, lidar, or visual images.

After forty years of dedicated efforts on a global scale, robots still have trouble recognizing our face, they move carefully through our world with a slow pace, and are shy to interact. They just barely have learned how to walk (Webb, 2001). In many ways, the robot is still a toddler – unable but eager to explore the world. However, they are growing faster and faster. Each year we are introduced to new robots that are superior in perception and mobility. Each year new robots join our daily lives in some fashion or another. Our question remains; when will we be able to christen this century as the Century of Robotics?

Tags: computer science, tech, robotics

Compiling/Building a Static version of Qt 4.5

God Bless Qt/Trolltech/Nokia for their very excellent cross-platform framework, but sometimes, even I admit it can be a pain (despite my deep love and passion for it). My latest pain is with the static builds of Qt version 4.5.0/4.5.1. I have spent a considerable amount of time getting this build environment to work on a fresh Ubuntu installation. Below you will find the instructions to make yourself your very own static build...

Step 1: Download and install Qt:

Download Qt from Trolltech (http://www.qtsoftware.com/downloads). Choose the "Complete Development Environment". Once downloaded, install it using sudo.

chmod chmod u+x qt-sdk-linux-x86-opensource-2009.02.bin
sudo ./qt-sdk-linux-x86-opensource-2009.02.bin

Step 3: Get all the required libs:

sudo apt-get install g++
sudo apt-get install libx11-dev
sudo apt-get install libxinerama-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libxrender-dev
sudo apt-get install libxcursor-dev
sudo apt-get install libfontconfig-dev
sudo apt-get install libsm-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install xorg-dev

Of course, you could also do "sudo apt-get install libqt4-dev", which would get you version 4.4.3 (as of 29.05.2009), but I prefer not to install this version alongside...

Step 2: Configure and compile Qt:

cd /opt/qtsdk-2009.02-static/qt
sudo ./configure -release -static -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -fast
sudo make sub-src
sudo make install

Tags: computer science

Complex Numbers

To better understand complex numbers and how their various functions work, I implemented a templated operator-overloaded C++ class which represents a complex number (complex.h, see below).

typedef ComplexT<double> Complex;

Complex c1(1.0,-1.5); // real=1, imag.=-1.5
Complex c2(M_PI,0);
Complex c3 = (c1 + c2)*2.0;
Complex c4 = (c3 / c2) * c1;
Complex c5 = sqrt(exp(c3)); // sqrt( e^c3 )
Complex c6 = pow(c1,4); // c1^4
double abs = c6.abs(); // radius polar notation
double arg = c6.arg(); // angle polar notation

To test my class, I also implemented a GUI which features an input plane on the left with the output on the right, and various functions to apply to the output. The input can also be changed from the classical colored grid lines, to other inputs such as a radial grid or an image.

Complex Numbers Input/Output Graph

Complex Transformation of an Image

Download Binaries for Windows, Linux, OSX and Full Sorce Code: ComplexNumbers-1.1-win-linux-osx-source.tar.gz

Tags: code, computer science

Cisco Group Password Stupidity

What is the point?! I am annoyed by the Cisco group passwords every time when I want to create a VPN tunnel to my University's network. Everyone knows how to decrypt these things so why even bother include them encrypted in the profiles? Everytime I have to digup my piece of C-code, edit the line pwd="xxxxxx", compile, and run. I think the ubuntu network manager should include the decrypter in a future release (seriously, who would complain? Cisco?).

To spite this all and make my life easier in the future, I will post the passwords for the HSR network below (I especially like the remote password):

GroupName=wireless
GroupPwd=luft1#buss
enc_GroupPwd=F026D73ACF95F63F8AB33BCDFF21F266DBF2FDCE409C9AC9210022D1ADC7FB12F845E51FB5C46F7C9D21A59F8E7B7E2072EF7EA9CC03CD12

GroupName=hsrremote
GroupPwd=hsrremote
enc_GroupPwd=28B87A7F9A37772E3F2C44EBBC8051DBF1A8A2B24212DB2AB4A729323E7BB74909D31E3A6BF887BC02C4A7EF6D6007A17E8467E3A68FCB48

If you are interested, this excellent algo (using libgcrypt) by Maurice Massar (HAL-9000) will decrypt the Cisco group passwords:

// ct is binary, resp is ascii
int c_decrypt(char *ct, int len, char **resp, char *reslenp)
{
const char *h1 = ct;
const char *h4 = ct + 20;
const char *enc = ct + 40;

char ht[20], h2[20], h3[20], key[24];
const char *iv = h1;
char *res;
gcry_cipher_hd_t ctx;
int reslen;

if (len < 48)
return 0;
len -= 40;

memcpy(ht, h1, 20);

ht[19]++;
gcry_md_hash_buffer(GCRY_MD_SHA1, h2, ht, 20);

ht[19] += 2;
gcry_md_hash_buffer(GCRY_MD_SHA1, h3, ht, 20);

memcpy(key, h2, 20);
memcpy(key+20, h3, 4);
/* who cares about parity anyway? */

gcry_md_hash_buffer(GCRY_MD_SHA1, ht, enc, len);

if (memcmp(h4, ht, 20) != 0)
return -1;

res = malloc(len);
if (res == NULL)
return -1;

gcry_cipher_open(&ctx, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
gcry_cipher_setkey(ctx, key, 24);
gcry_cipher_setiv(ctx, iv, 8);
gcry_cipher_decrypt(ctx, (unsigned char *)res, len, (unsigned char *)enc, len);
gcry_cipher_close(ctx);

reslen = len - res[len-1];
res[reslen] = '\0';

if (resp)
*resp = res;
if (reslenp)
*reslenp = reslen;
return 0;
}

Tags: computer science

Using Twitter Underneath a Protocol Stack

Protocol Messages via Twitter

If you are interested in what this exactly is: its the GSM Protocol for sending a SMS/TXT message.

Tags: computer science

Make Any C# Control Class Mutable

It's not always trivial to make any C# Control Class mutable - meaning the user can move and resize the control using the mouse.

My code snippet below shows how you can do this by just copy and pasting the snippet into any class which extends the Control class (or of course any sub-class of Control). Even better, it doesn't mess with any events of the parent container. Pretty neat huh.

/// <summary>
/// Allows simple mutation of any control without intefering with
/// parent container events.
///
/// Just copy the following to any class extending the Control class:
///
/// enum Mutation
/// private Mutation mutation
/// private Point lastLocation
/// private Point originalLocation
/// private const int handleSize
/// protected override void OnMouseDown(MouseEventArgs e)
/// protected override void OnMouseUp(MouseEventArgs e)
/// protected override void OnMouseMove(MouseEventArgs e)
///
/// That's all - you're set!
/// Plug: www.dankrusi.com
/// </summary>
enum Mutation {
None, Move, ResizeE, ResizeW, ResizeN, ResizeS, ResizeNE, ResizeNW, ResizeSE, ResizeSW
}
private Mutation mutation;
private Point lastLocation;
private Point originalLocation;
private const int handleSize = 8;
protected override void OnMouseDown(MouseEventArgs e) {
lastLocation = e.Location;
originalLocation = e.Location;
if (e.X > this.Width - handleSize && e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNWSE;
this.mutation = Mutation.ResizeSE;
} else if (e.X < handleSize && e.Y < handleSize) {
this.Cursor = Cursors.SizeNWSE;
this.mutation = Mutation.ResizeNW;
} else if (e.X > this.Width - handleSize && e.Y < handleSize) {
this.Cursor = Cursors.SizeNESW;
this.mutation = Mutation.ResizeNE;
} else if (e.X < handleSize && e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNESW;
this.mutation = Mutation.ResizeSW;
} else if (e.X > this.Width - handleSize) {
this.Cursor = Cursors.SizeWE;
this.mutation = Mutation.ResizeE;
} else if (e.X < handleSize) {
this.Cursor = Cursors.SizeWE;
this.mutation = Mutation.ResizeW;
} else if (e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNS;
this.mutation = Mutation.ResizeS;
} else if (e.Y < handleSize) {
this.Cursor = Cursors.SizeNS;
this.mutation = Mutation.ResizeN;
} else {
this.Cursor = Cursors.Hand;
this.mutation = Mutation.Move;
}
}
protected override void OnMouseUp(MouseEventArgs e) {
this.mutation = Mutation.None;
this.Cursor = Cursors.Default;
}
protected override void OnMouseMove(MouseEventArgs e) {
if (this.mutation == Mutation.Move) {
int offsetX = this.lastLocation.X + e.Location.X - originalLocation.X - this.Width / 2;
int offsetY = this.lastLocation.Y + e.Location.Y - originalLocation.Y - this.Height / 2;
if (this.Left + offsetX > 0) this.Left += offsetX;
if (this.Top + offsetY > 0) this.Top += offsetY;
Parent.Refresh();
} else if (this.mutation == Mutation.ResizeNE) {
this.Top += e.Y;
this.Height += -e.Y;
this.Width = e.X;
} else if (this.mutation == Mutation.ResizeNW) {
this.Top += e.Y;
this.Height += -e.Y;
this.Left += e.X;
this.Width += -e.X;
} else if (this.mutation == Mutation.ResizeSE) {
this.Height = e.Y;
this.Width = e.X;
} else if (this.mutation == Mutation.ResizeSW) {
this.Height = e.Y;
this.Left += e.X;
this.Width += -e.X;
} else if (this.mutation == Mutation.ResizeE) {
this.Width = e.X;
} else if (this.mutation == Mutation.ResizeW) {
this.Left += e.X;
this.Width += -e.X;
} else if (this.mutation == Mutation.ResizeS) {
this.Height = e.Y;
} else if (this.mutation == Mutation.ResizeN) {
this.Top += e.Y;
this.Height += -e.Y;
} else {
if (e.X > this.Width - handleSize && e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNWSE;
} else if (e.X < handleSize && e.Y < handleSize) {
this.Cursor = Cursors.SizeNWSE;
} else if (e.X > this.Width - handleSize && e.Y < handleSize) {
this.Cursor = Cursors.SizeNESW;
} else if (e.X < handleSize && e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNESW;
} else if (e.X > this.Width - handleSize) {
this.Cursor = Cursors.SizeWE;
} else if (e.X < handleSize) {
this.Cursor = Cursors.SizeWE;
} else if (e.Y > this.Height - handleSize) {
this.Cursor = Cursors.SizeNS;
} else if (e.Y < handleSize) {
this.Cursor = Cursors.SizeNS;
} else {
this.Cursor = Cursors.Hand;
}
}
}

Tags: computer science, code

Minesweeper in a Couple Hours

Inspired by a talk on how one can use the Minesweepers game to perform any given calculation, I started playing minesweeper during the following lectures at school.

I quickly grew tired of the standard windows verison, so I started playing a version by Astatix Software called Crazy Minesweeper. This version features a mode were a mine can have different strengths, making the overal gameplay much more interesting - and challenging.

Crazy Minesweeper by Astatix Software

However, for some obsurd reason Astatix Software requires payment for a full version if you want to play on larger grids with more mines: common - it's minesweeper! I wanted to download a crack to keep playing, but really, its probably easier to implement a version yourself then install a virus infested crack.

After spending a couple hours I came up with my own version, which works really nice. It is implemented in C++ using the Qt framework. Over the past year this combination has definately become my favorite language/framework combination.

Below are some screen shots as well as the source code and Windows binary...

Small Grid

Small Grid

Menu

Custom Game Settings

Elongated Grid

Large Grid

Source Code: CrazyMinesweeper_v1_src.zip

Binary: CrazyMinesweeper_v1_bin_win.zip

If you do not have the Qt Runtime Environment installed, download the following: Binary + Libs: CrazyMinesweeper_v1_bin_win_qt.zip

Tags: computer science, code

Page 1 of 4 Next »