Sun VirtualBox 2.2

I came across the Open Source Edition of virtual box a few days before and am thrilled at the experience of working with it. For more detailed info visit -> wiki page.

I have a Dell Vostro 1310 laptop with 2GB ram, 128MB NVidia GeForce 8 series card with 160GB hard disk and a 2.1 GHz Intel Centrino (Core2Duo).

The primary purpose to use Windows is for running softwares like FLUENT and CATIA and to play some games occasionally. Dual booting in such a case is a preferrable option but with the availability of the powerful hardware i decided to go in for Virtual Box.

The possible alternatives that pop up are WINE . WINE is an Open Source Software for running Windows applications on other OS’s is a good alternative if you lack the hardware to carry out virtualization. However , making larger programs like FLUENT and CATIA work with wine can be a hassle. In such cases virtualization comes in very handy.

Another problem I was facing with WINE was its lack of connectivity with the Local Network i.e. I could not connect to the LAN , probably coz WINE couldnt access the ports on the system. Hence , playing Age Of Empires on the LAN was impossible.

Working with VirtualBox and configuring it on LAN was easy and hassle free. Also , I managed to play AOE on LAN without any lag in the system.Read further to know more on going about the installation.

Virtual Box emulates hard disks in a special format known as the “Virtual Disk Images”. These files are normally stored in $HOME/.VirtualBox/HardDisks. It supports both  Intels VT-x and AMD-V.

To install VirtualBox download the deb/rpm package from here .

Further in the terminal cd to the location where you have downloaded the deb/rpm package. In my case it being $HOME/Desktop. The following commands will run in Ubuntu 8.10 .Then run the following commands to install the software.

sudo dpkg - i virtualboxversionname.deb

Follow the instructions in the dialog boxes. Make sure that you have gcc installed prior to it as it requires it to compile the kernel modules.If you wish to work your way around the installation with apt-get then do the following .

1. Open /etc/apt/sources.list and add this line deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
sudo gedit /etc/apt/sources.list

2. Import sun public-key and register it using apt-key (wget is for downloading, apt-key is for registering the key to your machine)

wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O - | sudo apt-key add -

3. Update your system’s package index file

sudo apt-get update

4. Install virtualbox 2.2

$ sudo apt-get install virtualbox-2.2

The installation wont proceed until the necessary kernel packages are compiled.

If you wish to do so later make sure that you run:

sudo /etc/init.d/vboxdrv setup

Restart your computer. A suitable icon would come in Applications -> System Tools.

Start the Application.

To create a new Virtual Machine click new and follow the instructions on the wizard.Make sure that you give suitable amount of RAM. My system without the VirtualBox uses 458 MB of RAM as shown by System->System Monitor. I alloted around 1.1GB for Windows XP on VirtualBox.On running FLUENT the system monitor showed usage of 1.5GB of RAM with a small amount of SWAP usage . Make sure that you do not give too much to VirtualBox as it will affect the performance of the system. For Vista , a minimum allocation of 1GB of RAM is necessary for smooth operation.

If you have a CD/DVD image for install load it in the CD/DVD ROM tab in the settings tab. If you want to install via a CD  in your drive make sure that you check the Host CD/DVD drive option.

cd

After the installation sharing files between the host (your computer) and the guest (virtual OS) can be done via adding the suitable share paths in Folders option. However , this didnt work for me that well and Windows XP on the VirtualBox did not recognize the network and the shared folders. I circumvented it for the time being by sharing the necessary files via ftp by copying suitable files in /home/ftp/ . For a permanent solution however I decided to share the files via the SAMBA server protocol. Install SAMBA and share the folders you want to over the network . Windows XP would recognize these and file sharing is easier.

To connect to the LAN via the ethernet controller on your system do the following :

Select the suitable OS and in the Settings -> Network Tab enable Adapter 1 and select the Bridged Network option in the Attached To drop down list.

bridgednetwork

There are certain issues with allocation of IP via the DHCP method with version 2.2 with XP as the Guest . It seems SUN has fixed the problem as mentioned here and would make the patch available in the forthcoming releases . Configuring a static IP works fine.

Run all the required programs as usual. You do not have to install the drivers if you are working on a Laptop. All the best with the virtualization .

Also keep visiting the official VirtualBox website for updates and the discussion forums.

Complaints:

i) Sharing Folders was cumbersome in my case though its worked for many as per the internet.

ii) Network speeds are fairly low.

A pic showing FLUENT running in the Guest OS with the System load.

fluent1

Bye,

Jai Gurudev.

Fedora 10

f10launch1

Fedora 10 was released a few days ago and since Fedora 9 for me was a  bit of a dissapointment ,I hoped things would smoothen out in F10 .

The installation was smooth .A nice interface welcomes you at installation . I usually create 3 partitions alloting around 700MB for /boot , 1024MB for swap  and remaining (around 40GB) for / .

Fedora 10 got widespread publicity and a number of market reviewers praised it for its server stability , faster boot loading  ,etc. New users may be attracted to the distro and might be ready to give it a try without knowing Fedora’s and Red Hat’s aversion to proprietary formats like mp3,avi,flv,etc. That means when one first installs Fedora 10 none of ur mp3,avi,flv files will play.PackageKit will simply ignore these files and not bother to direct you to the suitable codec.

The solution for this is to install the necessary software from dedicated repositories which host these restricted drivers. RPM Fusion hosts a huge repository containing all these packages. To include RPM fusion packages in the software sources do the following.


su
Password: --- Your root password
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

The rpm will install in a few seconds and will be added to your software source.

Now if the necessary codecs to run a file are not installed PackageKit will direct you to the appropriate source.

I use a Dell Vostro 1310 with a 2.1GHz Pentium core 2 duo processor , NVidia GeForce 8400 graphics card. For graphics on the system I downloaded the necessary drivers from here .

For installing these drivers you have to :
Kill the X server and then run the package.

For killing the X server boot into runlevel 3 .
To do so :

su
Password: -- Your root password
/*Open inittab in your favourite editor*/
emacs -nw /etc/inittab
/*and change the runlevel to 3 */

Reboot your system and as root run the package and your drivers will be installed.

GNOMEs latest version features nautilus with tabs a very handy hack.OpenOffice supports .docx ,etc formats (a huge sigh of relief).

Things I did not like:
KDE appearance sucks. GNOME rocks . However since I am a big fan of VLC and Amarok I was dissapointed with the window appearance for both their GUIs since both are coded in QT .

Mplayer and Rhythmbox might work out as good replacements.

Came across a nice site which serve as personal guides to fedora 9&10 .

Also tried Gnome Do . More on it later

Bye ,

Jai Gurudev.

Downloading using wget via a proxy server

Sadly i am unable to update fedora 9 via the proxy server in our college and hence am still stuck using Firefox 3 Beta 5. I had some problems saving the pdf files once they opened in evince in the web browser and hence decided to use wget for the downloads.

Downloading using wget :

//First set the http_proxy variable to the necessary address

export http_proxy=’http://ur.proxy.server:port’

//and then in the wget command line execute with an option –proxy=on

wget –proxy=on http://whatuwant

u can use other options as –proxy-user and –proxy-password for password protected proxies

u can switch of the proxy with –proxy=off

Jai Gurudev

EDIT: Once this proxy variable is set all your apps which require proxy server settings can run from the CLI. After this i was able to update my system via yum after doing a bit moving…. Theres a GUI too for this .

In Fedora : Places => Preferences => Network .

Blackle !!

Vinay sent me a really interesting email which pointed to this site.

Blackle is the black version of Google. And since the amount to usage of Google is bound to increase it makes sense using blackle.Another fact is that it doesnt save much energy from LCD displays which are very popular today but does save a chunk from CRT displays

Facts:

Blackle was created by Heap Media to remind us all of the need to take small steps in our everyday lives to save energy. Blackle searches are powered by Google Custom Search.

Blackle saves energy because the screen is predominantly black. “Image displayed is primarily a function of the user’s color settings and desktop graphics, as well as the color and size of open application windows; a given monitor requires more power to display a white (or light) screen than a black (or dark) screen.” Roberson et al, 2002

In January 2007 a blog post titled Black Google Would Save 750 Megawatt-hours a Year proposed the theory that a black version of the Google search engine would save a fair bit of energy due to the popularity of the search engine. Since then there has been skepticism about the significance of the energy savings that can be achieved and the cost in terms of readability of black web pages.

We believe that there is value in the concept because even if the energy savings are small, they all add up. Secondly we feel that seeing Blackle every time we load our web browser reminds us that we need to keep taking small steps to save energy.

MGL – Cont…

MGL part one has come to an end..(part one stands for the first batch). Thanks to all those who made it possible…. On the second and third day a lot of  techy stuff was taught in the class , which probably was not appreciated by everyone (Considering the amount of walling going on…. 😉 )Anyways it was a lot of hard work put in by Abhilash ,Balki and Surya for their C programming and Shell Scripting lectures respectively.Installing and repo config was handled by Arun and Harini.Networking was handled by Akhil,Sanket and me. We did not enjoy taking it that much coz with the lack of root permissions to everyone no one could practice something really worthwhile….(like setting up web pages…basic ones…or starting the services one was interested in.)Last times pengufest was really nice even though there were a handful of them there. Anyways kudos to everyone…. Next batch starts from Monday and looking forward to teach in them and improve on our mistakes …..

Bye gtg…have to mail prof the soln and also complete mechatronics assignment….. Bye,cya….

Jai Gurudev!!

MGL

Finally MGL is underway and its nice to see a good turnover for these classes.We had 140 paid registrations in just two days of putting up of the poster.A big contrast to what happens for Art Of Living courses….. you get 140 paid registrations in about a month if you have a good enough dedicated volunteer base…..Suprising isnt it ….. people are reluctant to do something as wonderful as the AOL courses….(For anyone who hasnt done it ……. its a ‘breathtaking’ course…… 😉 (pun intended)).

Anyways coming back to the topic…..Yesterday was the first day of the MGL classes with topics like Introduction to Linux , Basics of OS, The Linux Equivalent Project and file hierarchy being taught. Sathya did a nice job with the introduction and JC was really good with his short and energetic intro to “What is an OS”. This was followed by Shantanu,Uday who spoke on a few more topics like whats a shell etc.The Linux Equivalent Project intro was taken up by Nikhil and Vivek.And finally file hierarchy was taught by Tirth(He kept it short and sweet…… 🙂 ).

Abhilash did a wonderful job with maintaining the site.

Thanks to everyone who has contributed for a really nice opening to the classes…… 🙂 ….You guys rock…… :).

Today:

Akhil will be teaching Vim basics ,Kra .. File Permissions and Balki and Surya .. Shell Scripting……. The enjoyable grind begins……. 😉

Jai Gurudev!

The Evolution of a Programmer

Read this on: Ariel.com.

High School/Jr.High

  10 PRINT "HELLO WORLD"
  20 END

First year in College

  program Hello(input, output)
    begin
      writeln('Hello World')
    end.

Senior year in College

  (defun hello
    (print
      (cons 'Hello (list 'World))))

New professional

  #include <stdio.h>
  void main(void)
  {
    char *message[] = {"Hello ", "World"};
    int i;

    for(i = 0; i < 2; ++i)
      printf("%s", message[i]);
    printf("\n");
  }

Seasoned professional

  #include <iostream.h>
  #include <string.h>

  class string
  {
  private:
    int size;
    char *ptr;

  string() : size(0), ptr(new char[1]) { ptr[0] = 0; }

    string(const string &s) : size(s.size)
    {
      ptr = new char[size + 1];
      strcpy(ptr, s.ptr);
    }

    ~string()
    {
      delete [] ptr;
    }

    friend ostream &operator <<(ostream &, const string &);
    string &operator=(const char *);
  };

  ostream &operator<<(ostream &stream, const string &s)
  {
    return(stream << s.ptr);
  }

  string &string::operator=(const char *chrs)
  {
    if (this != &chrs)
    {
      delete [] ptr;
     size = strlen(chrs);
      ptr = new char[size + 1];
      strcpy(ptr, chrs);
    }
    return(*this);
  }

  int main()
  {
    string str;

    str = "Hello World";
    cout << str << endl;

    return(0);
  }

Master Programmer

  [
  uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
  ]
  library LHello
  {
      // bring in the master library
      importlib("actimp.tlb");
      importlib("actexp.tlb");

      // bring in my interfaces
      #include "pshlo.idl"

      [
      uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
      ]
      cotype THello
   {
   interface IHello;
   interface IPersistFile;
   };
  };

  [
  exe,
  uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
  ]
  module CHelloLib
  {

      // some code related header files
      importheader(<windows.h>);
      importheader(<ole2.h>);
      importheader(<except.hxx>);
      importheader("pshlo.h");
      importheader("shlo.hxx");
      importheader("mycls.hxx");

      // needed typelibs
      importlib("actimp.tlb");
      importlib("actexp.tlb");
      importlib("thlo.tlb");

      [
      uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
      aggregatable
      ]
      coclass CHello
   {
   cotype THello;
   };
  };

  #include "ipfix.hxx"

  extern HANDLE hEvent;

  class CHello : public CHelloBase
  {
  public:
      IPFIX(CLSID_CHello);

      CHello(IUnknown *pUnk);
      ~CHello();

      HRESULT  __stdcall PrintSz(LPWSTR pwszString);

  private:
      static int cObjRef;
  };

  #include <windows.h>
  #include <ole2.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include "thlo.h"
  #include "pshlo.h"
  #include "shlo.hxx"
  #include "mycls.hxx"

  int CHello::cObjRef = 0;

  CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
  {
      cObjRef++;
      return;
  }

  HRESULT  __stdcall  CHello::PrintSz(LPWSTR pwszString)
  {
      printf("%ws
", pwszString);
      return(ResultFromScode(S_OK));
  }

  CHello::~CHello(void)
  {

  // when the object count goes to zero, stop the server
  cObjRef--;
  if( cObjRef == 0 )
      PulseEvent(hEvent);

  return;
  }

  #include <windows.h>
  #include <ole2.h>
  #include "pshlo.h"
  #include "shlo.hxx"
  #include "mycls.hxx"

  HANDLE hEvent;

   int _cdecl main(
  int argc,
  char * argv[]
  ) {
  ULONG ulRef;
  DWORD dwRegistration;
  CHelloCF *pCF = new CHelloCF();

  hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

  // Initialize the OLE libraries
  CoInitializeEx(NULL, COINIT_MULTITHREADED);

  CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE, &dwRegistration);

  // wait on an event to stop
  WaitForSingleObject(hEvent, INFINITE);

  // revoke and release the class object
  CoRevokeClassObject(dwRegistration);
  ulRef = pCF->Release();

  // Tell OLE we are going away.
  CoUninitialize();

  return(0); }

  extern CLSID CLSID_CHello;
  extern UUID LIBID_CHelloLib;

  CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
      0x2573F891,
      0xCFEE,
      0x101A,
      { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  };

  UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
      0x2573F890,
      0xCFEE,
      0x101A,
      { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  };

  #include <windows.h>
  #include <ole2.h>
  #include <stdlib.h>
  #include <string.h>
  #include <stdio.h>
  #include "pshlo.h"
  #include "shlo.hxx"
  #include "clsid.h"

  int _cdecl main(
  int argc,
  char * argv[]
  ) {
  HRESULT  hRslt;
  IHello        *pHello;
  ULONG  ulCnt;
  IMoniker * pmk;
  WCHAR  wcsT[_MAX_PATH];
  WCHAR  wcsPath[2 * _MAX_PATH];

  // get object path
  wcsPath[0] = '';
  wcsT[0] = '';
  if( argc > 1) {
      mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
      wcsupr(wcsPath);
      }
  else {
      fprintf(stderr, "Object path must be specified\n");
      return(1);
      }

  // get print string
  if(argc > 2)
      mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
  else
      wcscpy(wcsT, L"Hello World");

  printf("Linking to object %ws\n", wcsPath);
  printf("Text String %ws\n", wcsT);

  // Initialize the OLE libraries
  hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

  if(SUCCEEDED(hRslt)) {

      hRslt = CreateFileMoniker(wcsPath, &pmk);
      if(SUCCEEDED(hRslt))
   hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

      if(SUCCEEDED(hRslt)) {

   // print a string out
   pHello->PrintSz(wcsT);

   Sleep(2000);
   ulCnt = pHello->Release();
   }
      else
   printf("Failure to connect, status: %lx", hRslt);

      // Tell OLE we are going away.
      CoUninitialize();
      }

  return(0);
  }

Apprentice Hacker

  #!/usr/local/bin/perl
  $msg="Hello, world.\n";
  if ($#ARGV >= 0) {
    while(defined($arg=shift(@ARGV))) {
      $outfilename = $arg;
      open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
      print (FILE $msg);
      close(FILE) || die "Can't close $arg: $!\n";
    }
  } else {
    print ($msg);
  }
  1;

Experienced Hacker

  #include <stdio.h>
  #define S "Hello, World\n"
  main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker

  % cc -o a.out ~/src/misc/hw/hw.c
  % a.out

Guru Hacker

  % echo "Hello, world."

New Manager

  10 PRINT "HELLO WORLD"
  20 END

Middle Manager

  mail -s "Hello, world." bob@b12
  Bob, could you please write me a program that prints "Hello, world."?
  I need it by tomorrow.
  ^D

Senior Manager

  % zmail jim
  I need a "Hello, world." program by this afternoon.

Chief Executive

  % letter
  letter: Command not found.
  % mail
  To: ^X ^F ^C
  % help mail
  help: Command not found.
  % damn!
  !: Event unrecognized
  % logout

Screenlets

Screenlets are screen applets.They look good and provide great functionality.They are small owner drawn applications written in Python.They are a really good alternative to gDesklets too.

Heres how you go about installing them:
For Fedora:
You need gnome-keyring and python devel packages installed. Also you need the rsvg libraries.
Switch to the super user in the terminal.Then

yum install python-devel gnome-python2-keyring

Also install the rsvg libraries.

yum install gnome-python2-rsvg.i386 librsvg2.i386 librsvg2-devel.i386

Download screenlets-version number .tar from launchpad
and extract it to a folder. Navigate to the folder and run

python setup.py install

Screenlets daemon and manager is installed.
To run the screenlets manager goto Applications=>Accessories=>Screenlets
or
in the terminal

screenlets-manager

You can customize their startup properties ,etc. from here.

Creating a mirror of a website in Linux.

GNUs wget command line program is a very popular for downloading single files from a server. It is much more powerful than that and offers some really cool features.One of them is the mirror feature. Suppose you want to mirror a website say: http://www.abc.com . In its very basic form you can use it as follows

$ wget -m http://www.abc.com

However , this can be troublesome as the links on the mirrored website will be pointing to the actual links and not on the relative links. to fix this add the option -k to the command to fix this as follows:

$ wget -mk http://www.abc.com

Another issue is of bandwidth. You are going to put some strain on the remote server if your planning to mirror a website directly.Hence one of the ways in which you can purposefully slow down your download is by using -w option as follows:

$ wget -mk -w 20 http://www.abc.com

This will delay the requests to the server by 20 seconds.add the suffix m for delay in minutes,d for delay in days.

Rsync is equally good in mirroring websites … but you need ssh access on the remote server. By using wget u can mirror the public files on the remote server.