Wednesday, June 10, 2009

now reading


It's surprising how much fun it is getting free stuff!

I received my free copy of "Best Kept Secrets of Peer Code Reivew" and it has been fun reading so far. I would recommend getting yourself a free copy.

On a related note, I was recently discussing the topic of how computer science and specifically programming courses are taught in schools/colleges/universities. Too little emphasis is placed on reading code and more is placed on writing code. I think realistically it should be the other way around. In the years of software engineering I have been doing, I have probably spent more time reading or understanding or reusing or modifying or removing code than writing. And that is a skill I had to unfortunately pick up once I started working.

Tuesday, June 9, 2009

useful link for crossplatform c++ development

Found this link in one of the replies on a StackOverflow question.

http://predef.sourceforge.net/index.php

It has a lot of useful information and links if you need write code to run on multiple platforms.

Monday, June 8, 2009

mcelog

At work, I have to decode kernel panics on 64-bit systems occasionally.

`mcelog´ it seems could be a useful tool.

mcelog decodes machine check events (hardware errors) on x86-64 machines running a 64-bit Linux kernel. It should be run regularly as a cron job on any x86-64 Linux system (if it is not in the default packages on your x86-64 distribution, please complain to your distributor). It can also decode machine check panic messages from console logs.
I don't have a good example on it´s usage, but on one of my systems, I noticed this in /var/log/mcelog (the cron script is setup to write to /var/log/mcelog in Fedora distributions).


MCE 0
HARDWARE ERROR. This is *NOT* a software problem!
Please contact your hardware vendor
CPU 2 BANK 3 TSC c82ff2586f6b0
ADDR 219540
STATUS 942000470001010a MCGSTATUS 0

Tuesday, June 2, 2009

ss - clear TCP and UDP socket information

The ss command gives very detailed TCP and UDP sockets information and can be useful when breaking down the information that netstat provides.

Most useful options are:
-m, --memory
Show socket memory usage.
-p, --processes
Show process using socket.
-i, --info
Show internal TCP information.

Tuesday, May 26, 2009

neat link trick

I wonder why more web pages that have instructions on how to install/configure/setup stuff in Ubuntu don´t use this trick. Apparently, you can use Firefox to install applications.

For example this: apt:compizconfig-settings-manager

I might be wrong, but it seems all you need is to setup the hyper-link to ¨apt://¨. Neat.

c++filt

Every now and then when debugging some source code in c++, I come across mangled function names.

You can use c++filt to demangle the junk you see into recognizable user-level function names.

The theory is that the function names get mangled due to overloading. From the man page - ¨All C++ and Java function names are encoded into a low-level assembly label (this process is known as mangling). The c++filt program does the inverse mapping: it decodes (demangles) low-level names into user-level names so that the linker can keep the overloaded functions from clashing.¨

mouting a cifs server that you can access

ItÅ› troubling that I had to do a lot of searching do be able to do something as simple as this:
a) On my Ubuntu desktop, mount a cifs server where I have an account as a user ¨xyz¨.
b) Access the mount with my Ubuntu desktop user account ¨abc¨.

I suppose I don´t clearly understand the problem. The issue as I see it is that you can only mount using sudo. And once mounted, the local Ubuntu account cannot access it without having hte right permissions on the mount point.

I had to do the following:
a) The local mount point/directory needs to have the permissions for ¨abc¨.
b) ¨sudo mount -t cifs /cifs_server/xyz_account /mnt/local_mount_point -o rw,nosuid,nodev,noatime,uid=1000,umask=077¨