This started as a notepad file on my desktop wherein I put anything that helped in my daily office work.
- vi editor is by default not unicode i.e. it supports utf-8 and not utf-16. So if you have a file containing a unicode character (a 2 byte character) so when you open this file using vi, you will be seeing two funny looking characters instead of what you expected. The solution is to use vim, which is an enhanced version of vi.
- The following would round off a decimal number. This would always consider the last digit. So the algo involves calculating the decimal part of a number and then rounding off the number accordingly (Assuming that input contains the number to be rounded off): temp = inuput;
while(temp / 10 > 1)
++i
totalLen = input.ToString().length();
decPartlen = totalLen – i – 1;
float tenMult = pow(10, decPartLen);
double result = ((int) ((tenMult * input) + 0.5)) / tenMult;ORtemp = inuput;
int len = (temp % 1).ToString().length() – 2;
float tenMult = pow(10, len);
double result = ((int) ((tenMult * input) + 0.5)) / tenMult; - If you by chance give an extra space at console and unix takes you to the next line e.g. HOME:>ls -l | egrep `^d’
> t
> quit
> break
> exit
> :q
> q
>
>
>
> end
> exit
> esc
> fi
> finish
> end
> break
> exit
> ^C
you can come out of it by pressing Ctrl + C. I’ve been stuck here a lot of time. And as you can see tried everything except the obvious at first. - UNIX does not have an option of listing only directories so you can try this: ‘
ls -l | egrep `^d''and for listing files use this ‘ls -l | egrep -v `^d'‘ - Process Explorer is a wonderful nifty utility to check for what all dll’s have been loaded corresponding to your exe. This is freely available for download from Microsoft website. A similar utility on Linux is also available. For KDE, KSysguard:
http://docs.kde.org/development/en/kdebase/ksysguard/ and for GNOME there is an app called Gnome System Monitor:
http://freshmeat.net/projects/gnome-system-monitor/. On Linux console you can use the ‘top’ or ‘ps’ command. Or you can also use htop, http://htop.sourceforge.net. Also try looking if ‘ldd’ solves your purpose. - To run a shell script from C++, you can use the following syntax: ‘long sysret = system(testscript.ksh);’. In most of the environments the return value zero would mean the system command executed successfully. Similarly if you want to run an exe or bat file from within a C++ code use CreateProcess command.
- To output a parameter that has been passed to your script, to another file, use ‘echo $1 > $filename’. I was by mistake doing this instead ‘$1 > $filename’. $1 is essentially similar to giving the parameter $1 at the prompt. echo $1 would actually echo out the value and then that value can be redirected to your file.
- If TaskManager has been disabled: http://windowsxp.mvps.org/Taskmanager_error.htm

No comments yet
Comments feed for this article