Friday, April 24, 2009

Let's get Jaunty



I am currently upgrading one of my desktops to Jaunty. It is a system I use at work and for the longest time it was running 8.04 which I was happy with.

Then I read about GNOME Do in 8.10, and was tempted to upgrade so that I stop using katapult. However, my experience with 8.10 wasn't very satisfactory. There were a couple of X Windows crashes which I did not have time to look into.

Anyways, I decided to give 9.04 a shot.

On a related note, I came across this article on how Jaunty Jackalope (9.04) is "as slick as Windows 7 and Mac OS X". Not sure if that is the experience that I am looking for.

Tuesday, April 14, 2009

Free Ubuntu eBooks

This link has a list free (as in speech) Ubuntu eBooks.

I have never read or even flipped through a Linux distribution book, so I am not sure how useful these are. I suppose one of these days I have to stop relying on google search to give me answers and actually pick up/print a book.

Monday, April 13, 2009

stacktrace


One of the quickest ways to debug code is to be able to tell how you got to a certain point in your code. So it is useful to be able to dump a backtrace/stacktrace at any point in your code.

I think you can find really good resources elsewhere to understand what a program stack is (for example this or this), so I won´t get into it. As a side note, those two links are some of the best ones I have found to understanding program memory and the difference between program heap and stack.

In C/C++:

This article gives really good information.
In summary, glibc provides backtrace() and backtrace_symbols() to do this quickly.

In JAVA:

Use the very useful Throwable class with your logging.

Example:
Throwable t = new Throwable();
Log.getStackTraceString(t));

ld-linux.so.2

When running your application, the shared libraries will be searched in wherever the LD_LIBRARY_PATH environment variable is pointing to.

However, sometimes when running applications that your receive with a specific library, you could use another way to indicate just that. ld-linux.so.2 is the Linux ELF program loader. It has a few options, but for our use, we need the --library-path option.

--list list all dependencies and how they are resolved
--verify verify that given object really is a dynamically linked
object we can handle
--library-path PATH use given PATH instead of content of the environment
variable LD_LIBRARY_PATH
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names
in LIST

Example:
# /lib/ld-linux.so.2 --library-path my/shared/libs my_app

Friday, March 6, 2009

write in C

Nerdy and funny.....he is right, 'Write in C'

Tuesday, March 3, 2009

wordpress - disable/enable comments on all posts

Since I finally got a chance to enable CAPTCHA on my personal blog which uses wordpress, I needed a quick to way to turn on comments that I had disabled for my posts.

This tutorial was good, but I do not have myPhpAdmin.

So, my steps were:

mysql -u -p
mysql> show tables;
+--------------------+
tables in ....
+--------------------+

....
mysql> UPDATE wp_posts p SET comment_status = 'open' ping_status = 'open' where comment_status = 'closed';

Of course, to reverse this:

mysql> UPDATE wp_posts p SET comment_status = 'closed' ping_status = 'closed' where comment_status = 'open';

worked like a charm.

--- Addition

Enabling comments was fine, but the SpamBots are now abusing the trackbacks option. So, I need to disable trackbacks too.

mysql> UPDATE wp_options SET option_value = 'closed' WHERE wp_options.option_id =20 AND wp_options.blog_id =0;

Tuesday, February 24, 2009

Ubuntu and Eclipse and svn

In the last two months, I have been spending some time developing phone applications in JAVA and using Eclipse as the IDE. Not having ever written in JAVA before, I cannot even imagine how long the whole development process would have taken was it not for the IDE.

So far in my development life, all my C/C++ code writing has required:
- a Linux system (i.e 'grep')
- ssh access to the build server (with right kernel, glibc, gcc version)
- vim + ctags for source code
- valgrind for finding memory leaks
- gdb for deugging

So the whole Eclipse+JAVA experience got me thinking if I could get any benefit from using a Eclipse for a large C++ project that I am involved with at work. Maybe it will at least help prevent carpal-tunnel from having to grep the life out of the project.

It seems the default Eclipse install for Ubuntu 8.04 is version 3.2 which is fairly old. So, it is best to download the newest version rather than use apt-get.

Next challenge was to get Subversion plugin.

Apparently, trying to add the svn plugin kept giving me an error
"
An error occured during provisioning.
Cannot connect to keystore.
JKS
"

Fortunately, some google searching pointed me to the fix. The plugin install needs Java 1.6 or newer. Also, the Java 1.6 has to be the default JRE which most likely it wont' be even after doing:

sudo apt-get install sun-java6-bin sun-java6-jdk

The Ubuntu Java Installation documentation explains how to select the default Java version on your system.

You could use
update-java-alternatives -l
or
manually pick the java-6-sun using sudo update-alternatives --config java

Oh well, I now finally have the C++ project under Eclipse pulled in from svn, I can at least browse the code.

Also, if anybody is looking for suggestions on what other developers perfer when doing C++ coding, check out this stackoverflow link.