Mar 06 2010

Finding out which version of Ubuntu you are running

Category: .opensourceAmit Bahree @ 10:17 pm

If you ever need to find out which version of Ubuntu you are running (if you have a few machines it is quite easy to forget what is running where), the easiest way is to run the following command in a terminal:

cat /etc/issue

For example here is the output from the machine I am on now:

amit@xps:~$ cat /etc/issue
Ubuntu 9.04 \n \l
Share

Tags:


Mar 01 2010

Printing code and making it look pretty

Category: .code,.opensourceAmit Bahree @ 10:51 pm

If you are on Linux and want to print some code and also make it look pretty then check out a2ps (Any to postscript filter). Of course if you can avoid printing in the first place and saving paper and trees and make it greener that is ideal – however there are times that is not possible. I tried printing from CDT, but the printing options from CDT just looks plain ugly and big fonts and can spread over 10 pages for a simple code file (spanning 293 lines). Sure I can tweak the font in CDT, but that is the only option available – enter a2ps. It seems to have more options, but I have not had a chance to play with those.

For example if I wanted a C++ code file called MOOSSniffer.cpp and “print it” out as PDF then use the command shown below. Here “-E” is the option to make the code look pretty and the “-P pdf” is the option for printing to PDF. Next comes the source file (you can also provide multiple files such as *.cpp) and finally the -o option is for the output filename. Of course you will need to install a2ps, which you can do via System -> Admin -> Synaptic Package Manager

a2ps -E -P pdf MOOSSniffer.cpp -o MOOSSniffer.pdf

Now, for some reason the resulting PDF could not be opened in Acrobat Reader, but on my Ubuntu machine, I could open it using the “Document Viewer” and print it using that. And in case you were curious, the pretty page option came to 3 pages instead of the original 10.

Also no trees were harmed in the making of this post – my printouts were all to PDF and not real paper – but in the end I did print out the 3 page version. :)

Share

Tags: ,


Feb 28 2010

Getting MOOS linking

Category: .opensourceAmit Bahree @ 4:02 pm

I started a brand new project in CDT where I was using MOOS and I could not get my simple program to link. While everything looked fine on the surface I just could not get the IDE to link to the MOOS libraries. I know the OS and MOOS itself was not a problem as I had other projects in the same workspace which did link correctly. The only difference between those and this was that I setup this project from scratch, whilst the others I had not. It took me a while to figure it out, but in the end I had to resort to explicitly add the locations for the libs in the C++ project properties in CDT as shown in the screenshot below.

To get this this, you right click on the Project name in Project Explorer in CDT. In the C++ Linker section then explicitly add the two paths shown in the screenshot. I of course had MOOS installed in the default location (binaries are in /usr/local/bin and libraries in /usr/local/lib). So even if you have added paths to CDT and still getting linking issues, I suggest you add it explicitly to the C++ properties.

C++ Project properties

Share

Tags:


Feb 28 2010

Host files on Ubuntu

Category: .opensourceAmit Bahree @ 3:12 pm

If you are newish to Linux (like me) from Windows, then some of the simple things which come quite naturally to you on Windows is a little embarrassing and challenging.

For example, I got a new WHS and wanted to mount the music drive and wanted to create a new host file entry to point to the new WHS. Now on Windows this is quite simple and can be found in YOUR-OS-DRIVE\Windows\system32\drivers\etc\hosts. But on Linux you will find this in \etc\hosts. If you want to edit it you will need to type something like this a shell:

sudo gedit /etc/hosts

sudo is required as you need admin privileges to modify the file. gedit is the graphical editor; you can replace that with another editor of your choice.

Share

Tags:


Jan 13 2010

Qt Eclipse Integration

Category: .opensourceAmit Bahree @ 5:14 pm

If you are working in CDT and Qt then the Qt Eclipse Integration is quite handy and in my opinion much better than using the standalone Qt designer. Installation is pretty straight forward as described here.

Share

Tags:


Dec 24 2009

Eclipse CDT Blues

Category: .opensourceAmit Bahree @ 2:24 pm

Sigh, why is Eclipse CDT to flaky? Well, there might be a slight exaggeration in that but nevertheless, I did not have so many issues with Visual Studio / VC++. :roll:

I have uploaded this particular log file here if anyone is interested.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb263d1f7, pid=20331, tid=3085625024
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode, sharing linux-x86 )
# Problematic frame:
# C  [libQtGuiCppIntegration.so.4+0x6531f7]  _ZN16QtCppIntegration12QLineControl18removeSelectedTextEv+0×27
#
# An error report file with more information is saved as:
# /home/amit/hs_err_pid20331.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb263d1f7, pid=20331, tid=3085625024
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode, sharing linux-x86 )
# Problematic frame:
# C  [libQtGuiCppIntegration.so.4+0x6531f7]  _ZN16QtCppIntegration12QLineControl18removeSelectedTextEv+0x27
#
# An error report file with more information is saved as:
# /home/amit/hs_err_pid20331.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Share

Tags:


Dec 13 2009

Opening File explorer from a terminal

Category: .opensourceAmit Bahree @ 5:10 pm

In Ubuntu if you want to open File Explorer from a terminal (especially as root) then you need to enter the following command: sudo nautilus

If you want this to run as a background process then just add an “&” in the end (without the quotes of course).

Share

Tags:


Dec 06 2009

Default QT4 path

Category: .opensourceAmit Bahree @ 10:53 pm

If you wanted to know the default path where QT4 is installed (on Ubuntu) then look in /usr/share/qt4/bin.

Share

Tags:


Dec 02 2009

Redirects setup

Category: .misc,.opensourceAmit Bahree @ 11:59 pm

After moving the blog to  WordPress, almost all my redirects should work now from the old blog posts to the new one. For example if you click on this old url http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx it should redirect you and you see the new and correct url.

Overall it was simple to setup via the .htaccess file and some simple regex. The only thing I found the hard way was that I should be using “RedirectMatch” when setting up the regex rule rather than the “Redirect” which is what I was using. You would use Redirect when trying to redirect without any variables.

So, as in my case I wanted to redirect from the old url (of community server) to the new one (of wordpress)

  • Old: http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx
  • New: http://desigeek.com/blog/amit/2009/10/25/installing-openscenegraph-on-ubuntu/

So I need to make the following changes:

  • Change the “/weblog” to “/blog”
  • Get rid of “/archive”
  • Get red of the “.aspx” extension

The following rule helped me achieve this:

RedirectMatch 301 /weblog/amit/archive/([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9])/(.*)\.aspx$ http://desigeek.com/blog/amit/$1/$2/$3/$4

Of course there are a few more rules I have which I cannot go into details.

Along the way i also discovered a few interesting tools which can help you view the results – one is LiveHTTPHeaders; another good one is http://web-sniffer.net/.

If you are new to this, then a few very good tools online. I would suggest start with this post from Zo and this tutorial on regex.

i still have one outstanding issue where if I want to redirect part of the URL and not the complete thing, I am not sure how to do it. For example if I want to redirect the old url above to just the year/month of the post instead if the actual post, not sure how to go about doing it. So I want the url below to map to the the one below that.

  • URL to Map: http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx
  • Should map to: http://desigeek.com/weblog/amit/archive/2009/10/
Share

Tags: ,


Nov 26 2009

Linux Hater blog

Category: .misc,.opensourceAmit Bahree @ 10:49 pm

I was looking for something else and came across the Linux Hater Blog. I am not a Linux hater (am writing this on Ubuntu). Some people might think this is funny, but there is a dark undercurrent running in the posts. I honestly stopped reading after a couple of posts. I don’t know why is there so much hate against Linux in this blog.

Am surprised by the negativity on the blog. I am no Linux expert and am more comfortable in Windows, but having used more of Ubuntu (9.04 and 9.10) over the last few weeks for my studies has made be appreciate some aspects even more. Is it perfect? Of course not, and nor is Windows or OS X or insert-your-favourite-OS-here. Maybe I should try and start a blog hater blog.

Share

Tags: ,


Jan 02 2007

Installing VMWare Tools in Ubuntu

Category: .opensourceAmit Bahree @ 11:28 pm

I am now running the new Beta of VMWare Workstation 6, and it seems to be working fine in Vista x64 (RTM incase you are curious). The installation of Ubuntu which I am also running natively at home is supported as one of the OS’s in this new version of VMWare and installs without a hitch. However to install VMWare tools after VMWare automatically mounted that was a little more of an issue (especially for a newbie).

Since the two options are either a RPM file or a TAR file (nothing but a zip file) – those are no good for Ubuntu. Essentially you had to “unzip” the tar file and then install that. If you want to do this here are the steps (after the CD has been auto-mounted for you).

  1. Open a Console
    • In Ubuntu, to do this goto Applications => Accessories => Terminal.
  2. Type in the following two commands in the console as one after the other. This essentially sets up the tools needed to compile the code.
    • sudo apt-get install build-essential
    • sudo apt-get install linux-headers-`uname -r`
  3. Change to the directory where you extracted the tar file.
  4. Type in the following command to get this running.
    • sudo ./vmware-install.pl
  5. Just follow the prompts then and voila you are all set.

More Information:

Share

Tags:


Jan 02 2007

Running Ubuntu

Category: .opensourceAmit Bahree @ 11:10 pm

It might seem like a surprise to some of you, but then many others who are reading this probably won’t be surprised to read that I am now running a native instance of Linux on one of my machines are home.

I had an old machine (dual-proc PIII 1 GHz procs with 512 mb RAM) which was running Windows 2003 Server – and it had not been switched on for a while. I had many issues trying to get a working set of Linux. I started with Suse 10.2 and it seems like my blank CD’s were getting corrupt (was at the bottom of the 100 disc set and as you may have read, the bottom few discs are a hit or a miss – seems like the weight on top is not good). Anyway’s, eventually I was able to burn all the ISO’s successfully.

Another irritating situation was the bootable rom was a CD drive and the slave (which was not bootable) was a DVD drive meant I had to first burn all CD’s instead of a DVD for Suse 10.2. After a lot of frustration and misses I finally used the bootable internet installation CD and then install from the DVD (which is in the other drive), this itself was a bit quirky, but I was able to get around it. Eventually when it was up and running the first impressions were good and the resolution was good to and all the hardware was detected and installed.

After running it for a couple of days, I started hitting my knowledge of Linux (i.e. lack of it). It seemed if I wanted to use it as an end user then it was not as as simple as I thought it would be. There were many ways to do the same thing and many programs installed which did the same thing. The initial look and feel which was a lot like Windows (and the Start Menu somewhat like Vista) soon fell apart when I started using it for a couple of days and I started seeing how clunky the interface was!

It was then Karan suggested I should check out Ubuntu instead. As per him the problem with Suse is they change so many things in non-standard ways, unless you have been using it for a while and are familiar with it – definitely not for someone like me who had used Unix (including Microsoft’s flavor called Xenix) but never Unix – never seriously atleast. Can’t say I had heard of Ubuntu till then, but after a bit of research it seemed like the logical choice.

The installation went of smooth (the partitioner was much better than Suse), and it seemed like it was a much better experience from an enduser point of view. The only issue was that the screen resolution was at 1024×768 even though I had Suse running at 1280×1024. I searched online for a resolution and could not find anything that will fix this. As this resolution was “too big”, I formatted and switched back to Suse, but in the end decided that the higher resolution was a lower priority than a more usable Linux distro. Also since this was not going to be my primary machine, I was not that fussed about the resolution. I was in for a pleasant surprise though when I installed Ubuntu again, as this time (for some weird reason) the resolution it identified was 1280×1024!

I will be posting more of my Linux findings here over the next few weeks, however this would be lower priority than some of the other stuff I have been doing. Big Smile

Share

Tags:


« Previous PageNext Page »
Get Adobe Flash player