Monday, December 12, 2011

Soln: pDC->TextOut() error Visual Studio 2010 or Visual C++: cannot convert parameter3 from const char to const string

Ans: In pDC->TextOut(0,0,L"Hi");

Sunday, October 2, 2011

Eucalyptus: ssh cannot connect to host port 22

Solution
1.if u think u are using static setting in /etc/eucalyptus/eucalyptus.conf
2. if u have already used command: euca-authorize
3. start second instance and try to ping the second instance it will work

Thursday, September 1, 2011

Timezone incorrect ubuntu

In case the time zone value shown by ubuntu is incorrect, for example Aisa/Calcutta the correct value is UTC + 5.30 but if your system shows only UTC time then follow the step to correct the time of the timezone.

ln -sf /usr/share/zoneinfo/UTC /etc/localtime

here instead of UTC type the zone that is required.

Wednesday, August 17, 2011

How to have multiple versions of gcc and switch from one version to other

First download the gcc packages
for example: cpp-3.4_3.4.4-6ubuntu8_i386.deb (1707096 bytes)
gcc-3.4_3.4.4-6ubuntu8_i386.deb (484408 bytes)
gcc-3.4-base_3.4.4-6ubuntu8_i386.deb (163028 bytes)

mkdir ~/gcc-3.4

cd ~/gcc-3.4

sudo apt-get install build-essential

dpkg-scanpackages   .   /dev/null | gzip -9c > Packages.gz

sudo gedit /etc/apt/sources.list

add the following code to the file:
deb file:///home/username/gcc-3.4 ./

replace the username with your user name

sudo apt-get update
sudo apt-get install gcc-3.4


Now you have 2 versions of gcc

Now list all the gcc that is available
$ls /usr/bin/gcc* -l

Now type

$ sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.2 40
$ sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-3.4 30


this will set both the gcc versions

now to switch from one gcc version to another perform

sudo update-alternatives --config



 
Now enter the number of whichever gcc you want.

I believe this will work for other packages also.

Sunday, August 14, 2011

How to login to linux/windows without grub

grub> rootnoverify (hd0,0)
grub> chainloader +1
grub> boot


In case you want the grub screen from the grub command line
grub> configfile(hd0,7) /boot/grub/menu.lst

In case of grub 2.0 then
set root='(hd0, msdos1)'
chainloader +1
boot

Tuesday, July 12, 2011

Setting up a samba server

Used for sharing files from linux (ubuntu) to windows
1. sudo apt-get install samba

2. sudo gedit /etc/samba/smb.conf
in smb.conf
security = user
usernamemap = /etc/samba/smbusers

3. now it will take the username from the file mentioned
4. first create a password for the username in the file
sudo smbpasswd -a
Now add the username to the file using the commands
sudo gedit /etc/samba/smbusers
  = “

Now we have to create samba shares and give access (i.e) create some directory in the server and give access to the file so that the windows user can read the shared document


 1. open sudo gedit /etc/samba/smb.conf
[global]
 security = share
       client lanman auth = Yes
       lanman auth = Yes

[tmp]
 comment = Temporary file space
 path = /tmp
        read only = n
public = yes
(or)
in the smb.conf (default file)
#======================= Share Definitions =======================
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user’s home directory as \\server\username
[homes]
comment = Home Directories
browseable = yes
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only “username” can connect to \\server\username
valid users = %S
# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
writable = yes
 If you are using the first method then
create a directory named /tmp in ubuntu

Finally
In windows machine
go to run and type
//machinename/hostname
here machine name is the hostname of the ubuntu server

You can find the hostname by typing the command
hostname in terminal.


Once the server and client are setup find out if the directory is shared
1. smbclient -L localhost
 
This will display the name of the folder that is shared
2. How to check whether the folder sharing works properly
mount.cifs //192.168.0.2/tmp /mnt/smb
This command will mount the folder on the location /mnt/smb. If it gets mounted properly then the setup is working properly.

Saturday, May 28, 2011

How to install M5sim

M5 sim installation

1. nrs@nrs-OptiPlex-745:~$ sudo apt-get install g++ python-dev scons swig zlib1g-dev m4 mercurial patch subversion


2. hg clone http://repo.m5sim.org/m5

3. nrs@nrs-OptiPlex-745:~/m5$ scons build_opts/X86_SE/m5.opt
scons: Reading SConscript files ...

You're missing the M5 style hook.
Please install the hook so we can ensure that all code fits a common style.

All you'd need to do is add the following lines to your repository .hg/hgrc
or your personal .hgrc
----------------

[extensions]
style = ./util/style.py

[hooks]
pretxncommit.style = python:style.check_style
pre-qrefresh.style = python:style.check_style

4. The program 'style' is currently not installed.  You can install it by typing:
sudo apt-get install diction

during compilation  don't use sudo. Simply compile using scons in the given directory.

5. sudo apt-get install diction

6. scons build/ALPHA_FS/m5.debug

7. scons build/X86_FS/m5.debug

8. download the vmlinux files for the respective ISA

9. mkdir /dist/m5/system and extract the files there.

10. now for running the program use
cd ~/m5
sudo ./build/ALPHA_FS/m5.opt configs/example/fs.py

Monday, February 21, 2011

How to install R plot

Add the following line to /etc/sources.lst

deb http://cran.opensourceresources.org/bin/linux/ubuntu feisty/

or find the appropriate mirror from http://cran.r-project.org/mirrors.html and add replace the word cran.opensources.org




Wednesday, May 19, 2010

Command for varying RTT

tc qdisc add dev eth0 root netem delay 100

100 is in milli seconds

Friday, April 30, 2010

Finding the location of TCP variants in Linux kernel

nightfall:~# echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control 
nightfall:~# cat /proc/sys/net/ipv4/tcp_congestion_control 
westwood
nightfall:~# 
A list of available modules can be found here:
nightfall:~# ls /lib/modules/`uname -r`/kernel/net/ipv4/
ip_gre.ko  netfilter   tcp_cubic.ko      tcp_htcp.ko   tcp_lp.ko        tcp_vegas.ko
ipip.ko    tcp_bic.ko  tcp_highspeed.ko  tcp_hybla.ko  tcp_scalable.ko  tcp_veno.ko
nightfall:~# 

Thursday, February 11, 2010

How to solve undefined reference to `__umoddi3'

Problem faced:

kernel/built-in.o: In function `getnstimeofday':
(.text+0xee36): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0xeee1): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0xeefe): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_timer':
(.text+0xfd88): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_timer':
(.text+0xfda5): undefined reference to `__umoddi3'
make: *** [.tmp_vmlinux1] Error 1

Solution:


---
 include/linux/time.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/linux/time.h b/include/linux/time.h
index 2091a19..d32ef0a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -174,6 +174,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns)
 {
  ns += a->tv_nsec;
  while(unlikely(ns >= NSEC_PER_SEC)) {
+  /* The following asm() prevents the compiler from
+   * optimising this loop into a modulo operation.  */
+  asm("" : "+r"(ns));       // Include this line in the file /include/linux/time.h
+
   ns -= NSEC_PER_SEC;
   a->tv_sec++;
  }
-- 
This patch prevents gcc form "optimizing" the while loop into a costly modulo.
operation

Thursday, February 4, 2010

Setting and Removing http_proxy in linux

1. For setting http_proxy
                export http_proxy="http://proxy:port/"

2. For unsetting
                  unset http_proxy=""

Removing http_proxy [ 407 proxy authentication required ] when using synaptic package manager:

Do the following:
1. Remove proxy from Preferences -> Network proxy [ use direct connection ]
2. Remove proxy from synaptic package manager -> preferences -> Network
3. use unset http_proxy
4. export http_proxy=""
           check if proxy is set or not by using: echo $http_proxy
Repeat steps (3) and (4) for ftp proxy also.


5. immediately do apt-get update once or twice
6. If still you get error [407 proxy authentication required]

    goto ~/.bashrc check if http_proxy is set if so remove it.

Please also check if you have changed the file sources.list in /etc/apt folder. If so reverse it back to the old version.
Powered By Blogger