A boiler plate template for unittest in Python should import unittest, have a setUp and tearDown method and all the test methods should begin with keyword “test_”. The rest will be handled by the unittest itself. Here is an example … Continue reading
The First Plastic Computer Processor
This gallery contains 1 photo.
Silicon may underpin the computers that surround us, but the rigid inflexibility of the semiconductor means it cannot reach everywhere. The first computer processor and memory chips made out of plastic semiconductors suggest that, someday, nowhere will be out of … Continue reading
String manipulations in BASH script
I have been working on deployment cloud for past few days on our project code name “Labo864″. There are plenty of configurations to setup and install xen, nfs, no machine tools and eucalyptus and when I started automating it in the bash script ; very soon i found my self in a situation to do string manipulations.
Bash has really some powerful tools to do this, and to do it quick. For example you have a string “food-for-thought” and you want to do various string operations on $VAR (your variable). Here are few tricks:
Let strip all characters in front of ”fo” in the string $VAR
$answer= ${VAR#*fo}
This will remove the string in the beginning of the $VAR from the first instance it finds “fo” and results in “odforthought”. It will leave the second “fo” instance in place (food-for-thought). If we wish to remove all that is in between “fo”, then this will remove the longest match:
$answer = ${VAR##*foo}
I definitely recommend reading the Bash tutorial on IBM Network website; i got my inspiration from there