Monday, December 3, 2007

The power of scripts


Today, i've got a strange(???) problem, like i have to make a new repository in our backup server, which should looks exactly like another folder tree in same machine, but my requirement is more specific, i don't want to copy the entire folder structure including its sub folders, i.e i need only the top level folders. At first i thought to write a C program for that, but it may take a few hours to write and test. so i decided to experiment with some VBscript. as i am using it for first time, i felt an odd feeling by seeing its syntax. but truly said, its the most powerful stuff for doing such kind of tasks. see my first ever script - to copy the top level folder structure of a repository.


' Get the source folder, subfolders

'create the folder structure in destination as in the src folder
'No subfolders support
'Authour : renjith.sreeATgmail.com
'

Set objFSO = CreateObject("Scripting.FileSystemObject")
set objShell = CreateObject("Shell.Application")

srcFolderPath = InputBox("Enter the source folder","Select a folder","", 100, 100)

If srcFolderPath = "" Then
WScript.Echo "Invalid source folder, quiting..."
WScript.Quit()
End If

destFolderPath = InputBox("Enter the destination folder","Select a folder","", 100, 100)

If destFolderPath = "" Then
WScript.Echo "Invalid destination folder, quiting..."
WScript.Quit()
End If

' dest folder

set destFolder = objShell.NameSpace(destFolderPath)

Set srcFolder = objFSO.GetFolder(srcFolderPath)
Set colSubfolders = srcFolder.Subfolders

For Each objSubfolder in colSubfolders
destFolder.NewFolder (objSubfolder.Name)
Next

WScript.Echo "Folder creation completed."



undefined reference to `__gxx_personality_v0' !!!!


Stunned by this error message when i tried to compile a simple c++ test program under UNIX.
> gcc -o out atol.cpp
/tmp/cci91B6Q.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

actually i spend a half an hour to rectify this, but later only i found it as a programmers blooper ( shame on me ! )

Even if the gcc and g++ are from the GNU's compiler collection, there is a significant difference between them, at least for the context for using them.

The mistake was i tried to compile and link the a .cpp file by using the 'gcc' compiler. but the programs using the c++ object files should always be linked with g++ in order to supply the c++ libraries. My mistake was i tried to link the c++ object files to be linked with c libraries, and thus it showed 'Undefined reference'.

These undefined reference to the internal library functions like - __gxx_personality_v0.
when you see such an error, it is because you tried to link the C++ object files with gcc.

But there is another question, why the gcc worked in the first place?
It is like that - actually gcc will compile the c++ file, when it found a .cpp extension. but it cannot successfully link the generated object file(s)

These are very small things, but its enough to take away a good chunk of our time.

Friday, November 30, 2007

Mobile banking is on the way?


Mobile based banking services is not a big thing today. All major banks providing mobile facilities to check their account, pay bills and transfer the money from one account in to other.

But the question is about the credibility of such applications. usually the software vendors are providing such mobile softwares to the banks and its customers. and a few banks having their own development team for doing such tasks.

There is a huge market in such mobile based banking software today. if a provider can deliver quality programs with a fool proof security can win the race. but a country like India, is still far behind in using such online applications other than the direct banking.

Millions of mobile users are adding up in every year. and thus the potential for this segment too. but i am doubted about whether we are successful in tapping such an opportunity in a right way.

Once mobile banking catches on,we can make purchases at department stores, supermarkets etc.. To take that next step, phone makers must embed a chip capable of near-field communication (NFC) that will work with special readers in stores, exactly like the contact-less credit and debit cards that are now available.

Vista Sucks ???



When Vista Falls...

I'm a hardcore fan of Microsoft, but they disappointed me with their brand new operating system - Vista!

I tried my best to stick with vista, but every time i have to pay my time and patience for that. many applications are not compatible with vista. and they tried to imitate the GUI functionalities of Linux in to vista, that made it more worse..

My experience with Vista is too horrible! Most popular applications like FileZilla, Y! Messenger and VM Ware workstation is not compatible with Vista. ( Then what the hell they are doing in this great resource consuming monster like vista?, still it remains as a question) . I am getting many such feedbacks from many vista users.


Another comedy is some of the hardware vendors also playing cheap games to support this product. like Compaq laptop series, they are not providing any of the drivers for XP or other Operating systems. but finally i managed to get drivers for my Compaq v3000 series laptop

So Vista & Vista SUCKS !!!









See this wall paper, i got it as a Fwd today, looks very funny...

Thursday, November 22, 2007

What differes in Bourne -Korn and CShell ???

shkshcshMeaning/Action
$$%Prompt.


>!Force redirection.


>>!Force append.
> file 2>&1> file 2>&1>& fileCombine stdout and stderr.


{ }Expand elements in list.
` `$( )` `Substitute output of enclosed command.
$HOME$HOME $home Home directory.

~~Home directory symbol.
var=valuevar=valueset var=valueVariable assignment.
export varexport var=valsetenv var valSet environment variable.

${nn}
More than 9 args can be referenced.
"$@""$@"
All args as separate words.
$#$#$#argvNumber of arguments.
$?$?$statusExit status.
$!$!
Background exit status.
$-$-
Current options.
. file. filesource fileRead commands in file.

alias x=yalias x yName x stands for y.
casecaseswitch/caseChoose alternatives.

cd ~-popd/pushdSwitch directories.
donedoneendEnd a loop statement.
esacesacendswEnd case or switch.
exit [n]exit [n]exit [(expr)]Exit with a status.
for/dofor/doforeachLoop through variables.

print -rglobIgnore echo escapes.
hashalias -thashstatDisplay hashed commands (tracked aliases).
hash cmdsalias -t cmdsrehashRemember command locations.
hash -r
unhashForget command locations.

historyhistoryList previous commands.

r!!Redo previous command.

r str!strRedo command that starts with str.

r x=y cmd !cmd:s/x/y/Edit command, then execute.
if [ $i -eq 5 ]if ((i==5))if ($i==5)Sample if statement.
fifiendifEnd if statement.
ulimitulimitlimitSet resource limits.
pwdpwddirsPrint working directory.
readread$<Read from terminal.
trap 2trap 2onintrIgnore interrupts.

unaliasunaliasRemove aliases.
untiluntil
Begin until loop.
while/dowhile/dowhileBegin while loop.