Search My Techie Guy

Thursday, December 13, 2012

Installing Google Chrome on linux - OpenSUSE 11.3 - Sharing my experience

I set out to install Google Chrome (Google's web browser) on my PC running OpenSUSE 11.3, i had just finished doing a fresh installation of openSUSE and the default browser (firefox) was outdated! so i either had to update firefox or install a new browser, i went for the latter option.

1. Download the rpm from:  Google make sure to select the appropriate package depending on your processor hardware (32 bit or 64 bit) and operating system (linux).
Installing Google Chrome on OpenSuSe 11.3
2. My downloads save in:

marco@linux-cgqg:~/Downloads> pwd
/home/marco/Downloads

3. Change to the directory that contains your downloaded file:

marco@linux-cgqg:~/Downloads> cd /home/marco/Downloads/
marco@linux-cgqg:~/Downloads> ls -ltr
total 43124
-rw-r--r-- 1 marco users    33964 2012-12-11 13:30 sony_tv_tagsale.jpeg
-rw-r--r-- 1 marco users     6298 2012-12-11 13:32 bb-curve-8900.jpg
-rw-r--r-- 1 marco users   218639 2012-12-11 13:48 sony_tv_tagsaleuganda.jpg
-rw-r--r-- 1 marco users 43892050 2012-12-11 14:20 google-chrome-stable_current_i386.rpm
marco@linux-cgqg:~/Downloads>

4.  Install the rpm (but as you can see below, i ran into some small trouble, let us see how i get over this challenge!):

marco@linux-cgqg:~/Downloads> rpm -ivh google-chrome-stable_current_i386.rpm
warning: google-chrome-stable_current_i386.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
    lsb >= 4.0 is needed by google-chrome-stable-23.0.1271.95-169798.i386

5. I suspect the installation media i used to install openSUSE could be the source of all these issues, no wonder i saw some error messages during the installation but decided to skip them. i also performed a media check (to check the dvd) before installation but it failed! but yet again i went ahead and used the same DVD to install openSUSE. so i ended up with a working operating system but with a lot of software modules missing! (so, my advise to you if you are installing a fresh copy of linux is to run a media check so you don't end up with a broken system and then you have to patch it up like am doing now. but let us see how i managed to go around the above issue and get google chrome working on my openSUSE 11.3).

Note you can download Open Suse 12.2 DVD Image Here: Open Suse 12.2
Open SuSe - Linux
6. So i decided to add the Google Chrome repo to my software repositories and then install with yast2


Using the zypper command to add the google-chrome repository:
#zypper ar http://dl.google.com/linux/rpm/stable/`uname -i` google-chrome
#
Checking to make sure your repo has been updated successfully:
linux-cgqg:/home/marco # zypper lr -d

7. Installing Google Chrome using yast2

Using yast2 to install google chrome:
linux-cgqg:/home/marco # yast2 --install google-chrome-stable_current_i386.rpm
linux-cgqg:/home/marco #

8. The rest was simple, i just followed the prompts (the usual ones; ok, accept, finish) and in a couple of minutes i was enjoying google chrome on my half broken system! still patching it up though.

Thursday, December 6, 2012

Why use the volatile Keyword in C Programming?


A volatile keyword as used in C Programming or C++ is used to to define a variable and to tell the C Compiler NOT to optimize the section or block of code where that variable is used.


take for example the following variable definition:


int age = 100;
while(age == 100)
{
  //execute this code
}


When the compiler looks at the above code, it may be tempted to optimize it to:


while(true){   //execute this code}

And the compiler is justified to do so because the variable "int age = 100;" doesn’t seem to ever change, Instead of the compiler always loading this variable from memory (if it’s not in the register) and comparing it to 100 before running that block of code, it chooses to optimize it and save on processing time.

why use volatile keywords in c-programming?
But what if that variable changes when the compiler has already modified the code (optimized the code)? may be because of an interrupt or some user input? then we would have runtime issues!!!

This is where we need a volatile keyword, to tell the compiler not to touch that piece of code because that variable which the compiler thinks that it never changes! can actually change.
And this is how we would define the variable with a volatile keyword:


volatile int age = 100;

And this would stop the compiler from optimizing the block of code where the variable “age” is present.

Working with Perl & Tk to create GUIs - Setting up the environment

Today I set out on a mission to spice up my Perl scripting skills by adding GUIs in my scripts and the best way to archive this, is by using perl’s Tk module. Here is how my story unfolded before i finally got it to work.

Operating System: Ubuntu 10.10 - the Maverick Meerkat

Checking if perl is in my environment PATH: 


root@marc# which perl
/usr/bin/perl

The above output tells me that i have perl running on my machine otherwise it would return something like “command not found” or an empty string!

Checking the version of perl am running:


root@marc# perl -v

This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
(with 40 registered patches, see perl -V for more detail)

Then I tried a test script to check if my default perl installation already has a Tk module but no luck! which means I had to install the perl Tk module, there are two ways:

1. Download the archive and manually install perl-Tk:

   Download Link: CPAN

Perl scripting with Tk to add Graphical User Interfaces
change to the dir where you saved your download.    Extract the archive: #gunzip Tk-804.028.tar.gz
                # tar -xvf Tk-804.028.tar
   
change to the Tk dir: #cd Tk-804.028

   #perl Makefile.PL
   #make
   #make test
   #make install


2. Use cpan to install Tk (this is the easier and recommended option)
   Make sure you are root otherwise the installation script will have permission issues!


#sudo su
#cpan
cpan[1]> 


// if you are on a direct internet connection, cpan will automatically download the required modules and the dependencies from CPAN using ftp.
//if you computer is behind a proxy that requires authentication, then you have to modify the cpan config. this is how you add the proxy configuration in cpan.


cpan[1]> o conf init /proxy/
<ftp_proxy>
Your ftp_proxy? [ftp://10.192.1.101:3128/]
//cpan tries to automatically detect the proxy as show above, enter
<http_proxy>
Your http_proxy? [http://10.192.1.101:3128/]
//enter
<no_proxy>
Your no_proxy? []

//for IPs that you want excluded from the proxy config, you can leave this blank and enter


If your proxy is an authenticating proxy, you can store your username
permanently. If you do not want that, just press RETURN. You will then
be asked for your username in every future session.

Your proxy user id? [joshua]
//enter


Your password for the authenticating proxy can also be stored
permanently on disk. If this violates your security policy, just press
RETURN. You will then be asked for the password in every future
session.

CPAN: Term::ReadKey loaded ok (v2.30)
Your proxy password?

//enter


Please remember to call 'o conf commit' to make the config permanent!

cpan[2]>install Tk

//cpan will download and install TK
//during the installation test phase, you will see a lot of pop ups, that means that your Tk library is being built and it’s an exciting moment :-)

Test your installation, try to run a script that calls the Tk module (
use Tk; ). if the script runs without errors then you are good to go. Your environment it set to run perl with Tk.

In the next posts, i will be sharing my experience with perl + Tk GUIs, this was basically about setting up the development environment and i hope you did the same.

for windows, you don’t have to go through this hustle, just go to ActiveState and download perl for your Windows OS, it comes with all the libraries including Tk.


Download Link: ActiveState
Active State Perl

Saturday, December 1, 2012

How to change your NIC MAC address - Ubuntu 10.10?

If you find yourself in a situation where you need to manipulate your NIC's MAC address (for example if your MAC address has been flagged at the switch! or if you want to hide your PC's physical identity!), Just follow these simple steps:
My Techie Guy

1. #sudo su (yes, you have to be root to change system settings, i hope you have the root password!)
2. #ifconfig -a (Note the interface you wish to manipulate, e.g. "eth0")
3. #ifconfig eth0 down (first bring the interface down)
4. ifconfig eth0 hw ether 00:BA:12:00:FE:00 (give it a new MAC address)
5. ifconfig eth0 up (Bring the interface back up)
6. ifconfig -a (check to make sure that your changes have been accepted)
7. Please note that these changes are temporary and they don't persist after a reboot!
8. Have fun hiding your ID :-)

How to change your IP address on command line - Ubuntu ?

If you find yourself in a situation where by you have to manually configure your IP address using command line on Ubuntu. just follow these simple steps (Am using Ubuntu 10.10):
My Techie Guy
1. Make sure you know the IP address you want to assign to your computer and also the subnet mask, for example; IP = 10.192.1.190 and Subnet Mask = 255.255.255.0
2. #ifconfig -a  (This command displays the current interface configuration, use it to note the interface name, for example "eth0")
3. #sudo su  (yes! you have to be root to modify system settings, this will ask you for the root password, punch it in and hit enter)
4. #ifconfig eth0 down  (first bring the interface down)
5. #ifconfig eth0 inet 10.192.1.190 netmask 255.255.255.0 (assigns eth0 that IP address and subnet mask)
6. #ifconfig eth0 down up (bring the interface back up)
7. #ifconfig -a (verify that your configurations have been effected)
8. Have fun!