Thursday, March 17, 2011

creating a ubuntu 10.04 server image for KVM

KVM a hypervisor.

on ubuntu machine, follow these steps

0-download ubuntu 10.04 or other releases
lets call this file ubuntu-10.04-server-i386.iso

1- install kvm using
aptitude install kvm

2- create a disk image using dd. let say 5GB disk image
dd if=/dev/zero of=ubuntu-server.img bs=1G count=5

3-assuming that iso and ubuntu-server.img files are in the same directory.
create kvm vm using the following command. This vm will have 512 MB memory.

kvm -m 512 -cdrom ubuntu-10.04.iso -boot d ubuntu-server.img

to test it, run the vm using

kvm -m 512 -cdrom ./ubuntu-10.04-server-i386.iso ubuntu_server.img

done

Friday, February 18, 2011

increase hard disk for your xen vm

Yesterday, when I was running my simulations, I came across a problem with available hard disk space. My simulations were generating tremendously amounts of logs and soon my hard disk was full and I could not complete other runs in my simulations. Fortunately, the issue was solved with few commands.

1- create an empty image using dd command
dd if=/dev/zero of=disk2.img count=5 bs=1G

this will create a file named disk2.img of size 5GB.

2- append this img to the existing img file of your xen vm. For instance, the name of my img file was disk.img
cat disk2.img >> disk.img

3- now you need to recreate the format
e2fsck -f disk.img

4-last step is to resize the img file using resize2fs. this will scan the img and looks for some changes happened and updates the filesystem table accordingly.
resize2fs disk.img

reboot your xen vm and use the command to get the available harddisk space. In ubuntu, use df -H to see the increased hard disk space.

Tuesday, August 31, 2010

python twitter

This post focuses on providing very basic information about twitter client API for python. I have written a python application that retrieves my tweets and submits my tweet after authentication.

you can use normal http python library 'urllib' to achieve this task. for example

conn_string = "http://%s:%s@twitter.com/statuses/update.json" % (usr,pwd)
tweet = urllib.urlencode({"status":tweet})
f = urllib.urlopen(constring, tweet)

or you can use 'twitter' python package provided here http://code.google.com/p/python-twitter/

Following is a very simple code that demostrate my initial use case.

import twitter
import sys


def getTwitterClient(option, args={}):
if ( option == 'simple' ):
return twitter.Api()
else:
return twitter.Api(username=args['username'], password=args['password'])

if ( sys.argv[1]=='simple' ):
username = sys.argv[2]
client = getTwitterClient('simple');
latest_posts = client.GetUserTimeline( username )
#prints your latest posts on twitter
print [x.text for x in latest_posts]

elif ( sys.argv[1] == 'upd' ):
username = sys.argv[2]
passwd = sys.argv[3]
client = getTwitterClient('auth', {'username': username, 'password': passwd})
update = client.PostUpdate('Today, neuGrid first demo went fine.  Our services performed well as expected')
print update


after saving this code in a anyname.py file. you can call it by using following sample commands.
#to retrieve only the posts
python anyname.py simple <USERNAME>

change <USERNAME> with your twitter username.

#to update your twitter status
python anyname.py upd YOUR_USERNAME YOUR_PASSWORD

Saturday, February 23, 2008

Saturday, February 9, 2008

Current Work

Working on Java implementation n testing of dcap, library used for FDT (fast data transfer). Our task is to remove the bugs which are present in current implementation and establish testbed in NIIT (NUST institute of Information Technology, Pakistan).

FDT Client.... (dcapJ)..... ProtocolDoor.... Pool

iCMS - CERN

iCMS, the CMS information Web system which handles the notes, news, agendas and data analysis produced in a collaboration of about 6000 physicists, engineers and technicians. The system is based on modern technologies like web services, RDF, Hibernate etc. It provides automated workflow for CMS notes submitted by physicists or other scientists working in CERN.
visit this following link to explore iCMS.
http://cms.cern.ch/iCMS