Dec 23, 2008

Windows Shortcuts and Commands

Run Commands:

rsop.msc - Resultant set of policies
services.msc - Various Services
msconfig - System Configuration Utility
regedit - Registry Editor
msinfo32 - System Information
sysedit - System Edit
win.ini - windows loading information(also system.ini)
winver - Shows current version of windows
mailto: - Opens default email client
command - Opens command prompt

secpol.msc - Local security settings
compmgmt.msc
- Computer management
devmgmt.msc - Device manager
diskmgmt.msc - Disk management
dfrg.msc - Disk defrag
eventvwr.msc - Event viewer
fsmgmt.msc - Shared folders
gpedit.msc - Group policies
lusrmgr.msc - Local users and groups
perfmon.msc - Performance monitor

Run Commands to access the control panel:

Add/Remove Programs control appwiz.cpl

Date/Time Properties control timedate.cpl
Display Properties control desk.cpl
FindFast control findfast.cpl

Internet Properties control inetcpl.cpl
Keyboard Properties control main.cpl keyboard

Mouse Properties control main.cpl
Multimedia Properties control mmsys.cpl
Network Properties control netcpl.cpl
Password Properties control password.cpl
Printers Folder control printers
Sound Properties control mmsys.cpl sounds
System Properties control sysdm.cpl

Command Prompt:

ANSI.SYS Defines functions that change display graphics, control cursor movement, and reassign keys.
APPEND Causes MS-DOS to look in other directories when editing a file or running a command.
ARP Displays, adds, and removes arp information from network devices.
ASSIGN Assign a drive letter to an alternate letter.
ASSOC View the file associations.
AT Schedule a time to execute commands or programs.
ATMADM Lists connections and addresses seen by Windows ATM call manager.
ATTRIB Display and change file attributes.
BATCH Recovery console command that executes a series of commands in a file.
BOOTCFG Recovery console command that allows a user to view, modify, and rebuild the boot.ini
BREAK Enable / disable CTRL + C feature.
CACLS View and modify file ACL’s.
CALL Calls a batch file from another batch file.
CD Changes directories.
CHCP Supplement the International keyboard and character set information.
CHDIR Changes directories.
CHKDSK Check the hard disk drive running FAT for errors.
CHKNTFS Check the hard disk drive running NTFS for errors.
CHOICE Specify a listing of multiple options within a batch file.
CLS Clears the screen.
CMD Opens the command interpreter.
COLOR Easily change the foreground and background color of the MS-DOS window.
COMP Compares files.
COMPACT Compresses and uncompress files.
CONTROL Open control panel icons from the MS-DOS prompt.
CONVERT Convert FAT to NTFS.
COPY Copy one or more files to an alternate location.
CTTY Change the computers input/output devices.
DATE View or change the systems date.
DEBUG Debug utility to create assembly programs to modify hardware settings.
DEFRAG Re-arrange the hard disk drive to help with loading programs.
DEL Deletes one or more files.
DELETE Recovery console command that deletes a file.
DELTREE Deletes one or more files and/or directories.
DIR List the contents of one or more directory.
DISABLE Recovery console command that disables Windows system services or drivers.
DISKCOMP Compare a disk with another disk.
DISKCOPY Copy the contents of one disk and place them on another disk.
DOSKEY Command to view and execute commands that have been run in the past.
DOSSHELL A GUI to help with early MS-DOS users.
DRIVPARM Enables overwrite of original device drivers.
ECHO Displays messages and enables and disables echo.
EDIT View and edit files.
EDLIN View and edit files.
EMM386 Load extended Memory Manager.
ENABLE Recovery console command to enable a disable service or driver.
ENDLOCAL Stops the localization of the environment changes enabled by the setlocal command.
ERASE Erase files from computer.
EXIT Exit from the command interpreter.
EXPAND Expand a Microsoft Windows file back to it’s original format.
EXTRACT Extract files from the Microsoft Windows cabinets.
FASTHELP Displays a listing of MS-DOS commands and information about them.
FC Compare files.
FDISK Utility used to create partitions on the hard disk drive.
FIND Search for text within a file.
FINDSTR Searches for a string of text within a file.
FIXBOOT Writes a new boot sector.
FIXMBR Writes a new boot record to a disk drive.
FOR Boolean used in batch files.
FORMAT Command to erase and prepare a disk drive.
FTP Command to connect and operate on a FTP server.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Moves a batch file to a specific label or location.
GRAFTABL Show extended characters in graphics mode.
HELP Display a listing of commands and brief explanation.
IF Allows for batch files to perform conditional processing.
IFSHLP.SYS 32-bit file manager.
IPCONFIG Network command to view network adapter settings and assigned values.
KEYB Change layout of keyboard.
LABEL Change the label of a disk drive.
LH Load a device driver in to high memory.
LISTSVC Recovery console command that displays the services and drivers.
LOADFIX Load a program above the first 64k.
LOADHIGH Load a device driver in to high memory.
LOCK Lock the hard disk drive.
LOGON Recovery console command to list installations and enable administrator login.
MAP Displays the device name of a drive.
MD Command to create a new directory.
MEM Display memory on system.
MKDIR Command to create a new directory.
MODE Modify the port or display settings.
MORE Display one page at a time.
MOVE Move one or more files from one directory to another directory.
MSAV Early M*cros*ft Virus scanner.
MSD Diagnostics utility.
MSCDEX Utility used to load and provide access to the CD-ROM.
NBTSTAT Displays protocol statistics and current TCP/IP connections using NBT
NET Update, fix, or view the network or network settings
NETSH Configure dynamic and static network information from MS-DOS.
NETSTAT Display the TCP/IP network protocol statistics and information.
NLSFUNC Load country specific information.
NSLOOKUP Look up an IP address of a domain or host on a network.
PATH View and modify the computers path location.
PATHPING View and locate locations of network latency.
PAUSE Command used in batch files to stop the processing of a command.
PING Test / send information to another network computer or network device.
POPD Changes to the directory or network path stored by the pushd command.
POWER Conserve power with computer portables.
PRINT Prints data to a printer port.
PROMPT View and change the MS-DOS prompt.
PUSHD Stores a directory or network path in memory so it can be returned to at any time.
QBASIC Open the QBasic.
RD Removes an empty directory.
REN Renames a file or directory.
RENAME Renames a file or directory.
RMDIR Removes an empty directory.
ROUTE View and configure windows network route tables.
RUNAS Enables a user to execute a program on another computer.
SCANDISK Run the scandisk utility.
SCANREG Scan registry and recover registry from errors.
SET Change one variable or string to another.
SETLOCAL Enables local environments to be changed without affecting anything else.
SETVER Change MS-DOS version to trick older MS-DOS programs.
SHARE Installs support for file sharing and locking capabilities.
SHIFT Changes the position of replaceable parameters in a batch program.
SHUTDOWN Shutdown the computer from the MS-DOS prompt.
SMARTDRV Create a disk cache in conventional memory or extended memory.
SORT Sorts the input and displays the output to the screen.
START Start a separate window in Windows from the MS-DOS prompt.
SUBST Substitute a folder on your computer for another drive letter.
SWITCHES Remove add functions from MS-DOS.
SYS Transfer system files to disk drive.
TELNET Telnet to another computer / device from the prompt.
TIME View or modify the system time.
TITLE Change the title of their MS-DOS window.
TRACERT Visually view a network packets route across a network.
TREE View a visual tree of the hard disk drive.
TYPE Display the contents of a file.
UNDELETE Undelete a file that has been deleted.
UNFORMAT Unformat a hard disk drive.
UNLOCK Unlock a disk drive.
VER Display the version information.
VERIFY Enables or disables the feature to determine if files have been written properly.
VOL Displays the volume information about the designated drive.
XCOPY Copy multiple files, directories, and/or drives from one location to another.
TRUENAME When placed before a file, will display the whole directory in which it exists
TASKKILL It allows you to kill those unneeded or locked up applications

Windows XP Shortcuts:

ALT+- (ALT+hyphen) Displays the Multiple Document Interface (MDI) child window’s System menu
ALT+ENTER View properties for the selected item
ALT+ESC Cycle through items in the order they were opened
ALT+F4 Close the active item, or quit the active program
ALT+SPACEBAR Display the System menu for the active window
ALT+TAB Switch between open items
ALT+Underlined letter Display the corresponding menu
BACKSPACE View the folder one level up in My Computer or Windows Explorer
CTRL+A Select all
CTRL+B Bold
CTRL+C Copy
CTRL+I Italics
CTRL+O Open an item
CTRL+U Underline
CTRL+V Paste
CTRL+X Cut
CTRL+Z Undo
CTRL+F4 Close the active document
CTRL while dragging Copy selected item
CTRL+SHIFT while dragging Create shortcut to selected iteM
CTRL+RIGHT ARROW Move the insertion point to the beginning of the next word
CTRL+LEFT ARROW Move the insertion point to the beginning of the previous word
CTRL+DOWN ARROW Move the insertion point to the beginning of the next paragraph
CTRL+UP ARROW Move the insertion point to the beginning of the previous paragraph
SHIFT+DELETE Delete selected item permanently without placing the item in the Recycle Bin
ESC Cancel the current task
F1 Displays Help
F2 Rename selected item
F3 Search for a file or folder
F4 Display the Address bar list in My Computer or Windows Explorer
F5 Refresh the active window
F6 Cycle through screen elements in a window or on the desktop
F10 Activate the menu bar in the active program
SHIFT+F10 Display the shortcut menu for the selected item
CTRL+ESC Display the Start menu
SHIFT+CTRL+ESC Launches Task Manager
SHIFT when you insert a CD Prevent the CD from automatically playing
WIN Display or hide the Start menu
WIN+BREAK Display the System Properties dialog box
WIN+D Minimizes all Windows and shows the Desktop
WIN+E Open Windows Explorer
WIN+F Search for a file or folder
WIN+F+CTRL Search for computers
WIN+L Locks the desktop
WIN+M Minimize or restore all windows
WIN+R Open the Run dialog box
WIN+TAB Switch between open items

Windows Explorer Shortcuts:

ALT+SPACEBAR - Display the current window’s system menu
SHIFT+F10 - Display the item’s context menu
CTRL+ESC - Display the Start menu
ALT+TAB - Switch to the window you last used
ALT+F4 - Close the current window or quit
CTRL+A - Select all items
CTRL+X - Cut selected item(s)
CTRL+C - Copy selected item(s)
CTRL+V - Paste item(s)
CTRL+Z - Undo last action
CTRL+(+) - Automatically re size the columns in the right hand pane
TAB - Move forward through options
ALT+RIGHT ARROW - Move forward to a previous view
ALT+LEFT ARROW - Move backward to a previous view
SHIFT+DELETE - Delete an item immediately
BACKSPACE - View the folder one level up
ALT+ENTER - View an item’s properties
F10 - Activate the menu bar in programs
F6 - Switch between left and right panes
F5 - Refresh window contents
F3 - Display Find application
F2 - Rename selected item

Internet Explorer Shortcuts:

CTRL+A - Select all items on the current page
CTRL+D - Add the current page to your Favorites
CTRL+E - Open the Search bar
CTRL+F - Find on this page
CTRL+H - Open the History bar
CTRL+I - Open the Favorites bar
CTRL+N - Open a new window
CTRL+O - Go to a new location
CTRL+P - Print the current page or active frame
CTRL+S - Save the current page
CTRL+W - Close current browser window
CTRL+ENTER - Adds the http://www. (url) .com
SHIFT+CLICK - Open link in new window
BACKSPACE - Go to the previous page
ALT+HOME - Go to your Home page
HOME - Move to the beginning of a document
TAB - Move forward through items on a page
END - Move to the end of a document
ESC - Stop downloading a page
F11 - Toggle full-screen view
F5 - Refresh the current page
F4 - Display list of typed addresses
F6 - Change Address bar and page focus
ALT+RIGHT ARROW - Go to the next page
SHIFT+CTRL+TAB - Move back between frames
SHIFT+F10 - Display a shortcut menu for a link
SHIFT+TAB - Move back through the items on a page
CTRL+TAB - Move forward between frames
CTRL+C - Copy selected items to the clipboard
CTRL+V - Insert contents of the clipboard
ENTER - Activate a selected link
HOME - Move to the beginning of a document
END - Move to the end of a document
F1 - Display Internet Explorer Help

Dec 22, 2008

How to remove Bluetooth wireless device support in Windows XP Service Pack 2

By default, Windows XP SP2 installs Bluetooth wireless device support when you install Windows XP SP2 to a computer. After installation, if a Bluetooth wireless device or radio is detected, Device Manager will install the driver for the Bluetooth device. 

To remove Bluetooth wireless device support, follow these steps:
  1. Click Start, click Run, type sysdm.cpl, and then click OK.
  2. Click the Hardware tab.
  3. Click Device Manager.
  4. Expand Bluetooth Radios.
  5. Right-click each device listed under Bluetooth Radios, click Uninstall, and then clickOK.
  6. Close Device Manager, and then click OK.
  7. In Windows Explorer, open the C:\Windows\Inf folder.
  8. Rename the Bth.inf file to Bth.inf.old.
  9. Rename the Bth.pnf file to Bth.pnf.old.
  10. Restart Windows XP SP2.
This will prevent the Microsoft Bluetooth Stack from loading. However, this does not prevent third-party Bluetooth stacks from being installed or loaded.

Nov 13, 2008

Export/Import Putty Setting

How to export :
regedit /e putty.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions
How to import : 
regedit /s putty.reg or double click on putty.reg 

Oct 7, 2008

Have control over your Pnp & USB

DISABLE PLUG AND PLAY DEVICES
Disable UnPnP Discovery Service
Open your registry and find the key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SSDPSRV
Set the value of "Start" to "4" to disable the service, or "3" to enable it.


DISABLE USB PORTS OF COMPUTER
Disable Universal Plug and Play Device Host
Open your registry and find the key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\upnphost
Set the value of "Start" to "4" to disable the service, or "3" to enable it.

Aug 20, 2008

Virus problem - Virus removal. vbs

When you restart your computer, do u get an error message saying "VirusRemoval.vbs" missing. Wondering how can i remove this one.

Ok this is a solution suggested by phoenixrisefromtheash@yahoo.com use it and this works.....

First Open task manager and kill process wscript.exe.

Second Delete VirusRemoval.vbs and Autorun.inf files from all usb drives if u have the virus in them.

Third Go to c:\Windows\System32 and delete the file VirusRemoval.vbs. It is super hidden so first go to Folder Options and check show hidden and check boxes. Also required for the above files.

Forth go to start>run and type regedit and enter Go to HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon On the right side look for Shell which should have value of just explorer.exe. delete anything at right side of explorer.exe if there is anything.
Under same key Winlogon also look for Userinit which should have value of c:\WINDOWS\system32\userinit.exe, Delete all the crap after the comma.

Fifth Go to HKCU\Software\Microsoft\Internet Explorer\Main On the right side locate Window Title and delete its value i.e. Sujin.com.np
Under the same key locate Start Page and delete its value i.e.
http://sujin.com.np/
Use this five step process and I'm sure it will help. If not better to take backup and format the drive......

For second thoughts..
start > run > msconfig > startup tab > uncheck all .vbs files

Jul 24, 2008

Want to read Nth Line from the file

1. cat "filename"perl -ne 'print if($.==4)'
1. cat "filename" perl -ne 'print if($.==4)'
2. cat "filename" perl -ne '$.-4print'
3. cat "filename" awk '(NR==4){print}'
but if you want to have the line no. in variable then....
4. kk=5
head -$kk "filename" tail -1

May 30, 2008

Simple Words, Phrases and Sentences To Impress Your Chinese Friends Or When You Visit China/Taiwan.

Greetings: ni hao nee how
Thank you: Xie xie ni sheh sheh nee
your welcome: bu xie boo sheh
Hello, my name is Joe: Ni hao, wo shi joe or Ni hao, wo jaio joe nee how, wah shih joe OR nee how, wah jow joe ("jow" uses same "o" sound as "owl")
Where is the Water Closet (toliet): Ce suo zai nar chuh saw zie nar
Do you understand: Ni dong ma? or Ni dong bu dong? nee dong ma ("dong" uses a long "o" as in the word "owner") or nee dong boo dong
Questions are formulated with questions words like what, how or ends with the Ma or ba character Or choice type as in understand no understand like the sentence above dong by dong, the answer would be either understand or no understand.


I: Wo wah ("a" sound as in "wall")
You: Ni nee
He/She: ta tah
Us: Wo men wah mun
They: Ta men tah mun ("tah" as in the word "taught")
You guys: Ni men nee mun
Who: Shei shay
What: Shen me shun muh
when: shen me shi hao shun muh shih how
where: Nar or Na Li nar, or nah lee
why: wei shen me way shun muh
how: zen me yang zen muh yang (the "a" in "yang" sounds like the "a" in "water")
this: zhe juh
that: na nah
here: zhe li juh lee
there: na li nah lee
If: ru gou rue gah ("gah" uses same "a" sound as "father")
but: dan shi don shih
because: yin wei yin way
yes / is(to be: shi shih
no: bu boo
Please: Qing ching
What did you say: Ni shuo shen me nee shaw shun muh
Assist me for a sec: Bang wo yi xia bong wah ee shah
How much: Duo shao (how many) dah show ("show" rhymes with the word "ow")
I'll Buy it: wo yao mai wah yow mie ("yow" rhymes with "ow")
I wont buy it: Wo bu yao mai or bu xiang mai wah boo yow mie, or, boo shahng mie
Too expensive: tai gui le tie gway luh

II) Chatting
Whats your surname: Ni gui xing nee gway shing
Whats your name: Ni jiao shen me ming zi nee jow (rhymes with "ow") shun muh ming jih
How are you? also greetings: Ni hao ma? nee how mah
I'm fine: Wo hao wah how
I'm not good: Wo bu hao wah boo how
my chinese is bad: Wo de han yu bu hao or wo de zhong wen bu hao wah duh han ("a" as in "father") you boo how, or, wah duh joong ("oo" as in "foot") won boo how

Please speak english: Qing jiang ying wen ching jahng ying wun
Please speak slower: Qing jiang man yi diar ching jahng mahn ee dee are
What do you do (job: Ni zuo shen me gong zuo nee zau (as in "author") shun muh goong (as in "foot") zau
Whats your age: Ni ji sui? nee gee (as in "gee whiz") sway
Whats your hobby: Ni you shen me ai hao? nee yow shun muh I how

NOTE: Phonetics are in red

May 5, 2008

How to create Personal File Folders (.PST)



This guide will help you successfully create a .PST file which will contain Emails you wish to backup



  • You need to create the file first. To do this, go to File --->New ---> Outlook Data File.



  • Select Office Outlook Personal Folders File (.pst) and click OK



  • Select a name for this folder. The default name is Personal Folders.pst, but you can use any name you want. For example, if you were trying to back up all your emails from December 2005, you could name the folder DEC2005.pst
  • To make finding the file easier, you can save the file in your My Documents. The screenshot below shows this, but you can save it wherever you want.



  • Type in the name of the folder in the Name field and click OK



  • After completing the last step, it should have created a new folder in your "All Mail Folders" where your current mail folders are located.
  • Locate this folder, it will be named whatever name you gave it in the last step. (We used "Personal Folders" )



  • If you would like to rename the Personal Folder, you can simply right click the personal folder and select Properties. Here you will see the "Personal Folder Properties", click the "Advanced..." button on the bottom right. You should see a window that looks remarkably similar to the "Create Microsoft Personal Folder" image. Select the Name: field and change it to whatever name you would like.



  • To save messages in this folder, simply drag emails into this folder.
  • When you have completed moving messages into this folder, and would like to hide the folder, right click on the folder and select "Close..."
  • If you would like to reopen a closed folder, click on File --->Open --->Outlook Data File



  • Locate the file and click OK


 



  • It should have put the folder back in your "All Mail Folders"

Mar 3, 2008

Using variables in sed

Question:How to use a variable from the OS in sed?
Example:
$VAR=`Smart keshav`
sed -e 's/keshav/$VAR/g' > filename
Solution:Use double quotes around the sed script rather than single quotes
Example:
sed -e "s/keshav/$VAR/g" > filename

Mar 1, 2008

Matching Patterns


pattern: example: matches: not matched:
------------------------------------------------------------------
* boo* boot,boo,booth

? boo? boot booth
[...] [aeiou]* ark bark
[!...] boo[!st] boor boot
*(cccc) boo*(zer) boo,boor,booze,boozer boot
+(cccc) boo+(zer) boor,booze,boozer boo
?(cccc) boo?(zer) boo,boor,booze boozer
@(cccc) boo@(zer) booze,booth boo
!(cccc) boo!(zer) booth,boo,boot booze,boor
{c,c,c} a{b,c,d}e abe,ace,ade axe


Conditional Statements


format                           "true" if:
---------------------------------------------------
(( _num1_ == _num2_ )) numbers equal
(( _num1_ != _num2_ )) numbers not equal
(( _num1_ <> _num2_ )) num1 > num2
(( _num1_ <= _num2_ )) num1 <= num2
(( _num1_ >= _num2_ ))           num1 >= num2

[[ _str1_ == _str2_ ]] strings equal
[[ _str1_ != _str2_ ]] strings not equal
[[ _str1_ <> _str2_ ]] str1 follow str2
[[ _str1_ = _pattern_ ]] str1 = pattern
[[ _str1_ != _pattern_ ]] str1 != pattern
[[ -z _str_ ]] str is null
[[ -n _str_ ]] str is not null

[ x=y -o k=j ] or in expression
[ x=y -a k=j ] and in expression

Test Objects (Files, Directories, etc.)


test "true" if: ksh
-----------------------------------
object exist -a
readable -r
writable -w
executable -x
non-zero length -s
zero length


directory -d
plain file -f
symbolic link -h
named pipe -p
block special file -b
character special file -c
soft link -L
socket -S

owned by me -O
owned by my group not

"sticky" bit set -k
set-group-ID bit set -g
set-user-id bit set -u

opened on a terminal not


Format of flow control functions


"if-then" if _expr_ then
_cmd(s)_
elif _expr_
_cmd(s)_
else
_cmd(s)_
fi

"case" case _word_ in
_pattern1_) _cmd(s)_
_pattern2_) _cmd(s)_
*) break ;;
esac

"while" while _expr_ do
_cmd(s)_
done

"for" for _variable_ in _list_
_cmd(s)_
done

"until" until _expr_
do
_cmd(s)_
done

POSITIONAL PARAMETER

program, function or shell                         $0
argument 1 through 9 $1 .. $9
nth argument ${n}
number of positional parameters $#
every positional parameter $@, $*
decimal value returned by last executed cmd $?
pid of shell $$
pid of last backgrounded command $!

REDIRECTIONS


0             stdin
1 stdout
2 stderr

<&- close stdin
>&-           close stdout
<>filename open filename for read-write
2>&1 open 2 for write and dup as 1

Examples:
cmd 2>/dev/null
cmd >/dev/null 2>&1
exec 1<&- # close descriptor 1 exec 2<&-
             # close descriptor 2   exec 1< /dev/null
      # open descriptor 1   exec 2< /dev/null
      # open descriptor 2   

OTHER FUNCTIONALITIES

cmd1  cmd2    exec cmd2 if cmd1 fail
cmd1 && cmd2 exec cmd2 if cmd1 is OK

V1=${V2:=V3} Set V1 with the value of V2 if this is set else set the
variable V1 with value of V3 (V3 could be a number).
sh replacement: if [ $V2 ] ; then
V1=$V2
else
V1=$V3
Example: DisplaySize=${LINES:24} ; Command=${Command:"cat"}


${V1:?word} if V1 set & V1!=null ret $V1 else print word and exit
: ${V1:?"variable V1 not set on null"}
${V1:=word} if V1 !set V1==null set V1=$word
${V1:-word} if V1 set & V1!=null ret $V1 else ret word
${V1:+word} if V1 set & V1!=null ret word else ret nothing
${V1##patt}
${V1#patt} if patt are found at the begin of V1 return V1 whitout the patt
else return V1
V1="lspwd" ; ${V1#"ls"} # exec pwd
${V1%%patt}
${V1%patt} if patt are found at the end of V1 return V1 whitout the patt
else return V1
V1="lspwd" ; ${V1%"pwd"} # exec ls

COPROCESS


La ksh permette di lanciare uno o piu' comandi come processi in background.
Questi processi sono chiamati coprocesses e sono utilizzati per comunicare
con un programma.
Un coprocess si crea mettendo l'operatore & (pipe, ampersand) dopo un commando.
Entrambi stdin e stdout del commando sono piped verso il tuo script.
Un coprocess deve incontrare le seguenti restrizioni:
· Includi un new-line alla fine di ogni messaggio
· Manda ogni messaggio di output allo standard output
· Pulisce il suo stdout dopo ogni messaggio

L' esempio dimostra come l'input e' passato verso e ritornato da un coprocess:
echo "Initial process"
./FileB.sh &
read -p a b c d
echo "Read from coprocess: $a $b $c $d"
print -p "Passed to the coprocess"
read -p a b c d
echo "Passed back from coprocess: $a $b $c $d"
FileB.sh
echo "The coprocess is running"
read a b c d
echo $a $b $c $d
L'output risultante e' il seguente:
Initial process
Read from coprocess: The coprocess is running
Passed back from coprocess: Passed to the coprocess

Il comando 'print -p' ti permette discrivere verso il coprocess.
Per leggere dal coprocess, lancia il comando 'read -p'.

EXAMPLES

- Explode a command for use parameters counter
set `who -r` ; [ "$8" != "0" ] && exit

- declare a variable for only uppercase/lovercase chars
typeset -u VAR ; VAR="lower" ; echo $VAR -> LOWER
typeset -l VAR ; VAR="UPPER" ; echo $VAR -> upper

- exec

- eval - esegue il comando dato come argomento

- let - esegue le operazioni matematiche che passate come argomento
let "x = x * 5"
((x = x * 5)) .. altra forma di let

REGULAR EXPRESSION


- ritorna la prima lettera dopo il segno - all'inizio di una stringa
VAR="-ciao"
RESULT=`expr "$VAR" : "-\(.\)"`
echo $RESULT .. -c
- toglie il '-' iniziale
VAR="-ciao"
VAR=`expr "$VAR" : "-*\(.*\)"`
echo $VAR .. ciao
- ritorna la lunghezza di una stringa
VAR="ciao"
echo `expr length $SHELL` .. 4
- ritorna l'indice di dove incontra una substringa
echo `expr index abcdef de` .. 4
- ritorna 6 caratteri a partire dall'11
expr substr "Goodnight Ladies" 11 6 .. Ladies

ARRAY

- definisce un array
set -A Week Sat Sun Mon Tue Wed Thu Fri
- ritorna un elemento dell'array
echo ${Week[3]} .. Tue
id=3 ; echo ${Week[id]} .. Tue
- stampa tutti gli elemti di un array
echo ${Week[@]} .. Sat Sun Mon Tue Wed Thu Fri
- scandisce un array
for day in ${Week[@]}
do
echo $day
done
- ritorna il numero di elementi in un array
nelem=${#Week[@]} ; echo $nelem .. 7

Feb 7, 2008

Insert headers and footers in Word Documents

Create the same header or footer for each page
On the View menu, click Header and Footer to open the header or footer (header and footer: A header, which can consist of text or graphics, appears at the top of every page in a section. A footer appears at the bottom of every page. Headers and footers often contain page numbers, chapter titles, dates, and author names.) area on a page.
To create a header, enter text or graphics in the header area.
To create a footer, click Switch Between Header and Footer on the Header and Footer toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.) to move to the footer area, and then enter text or graphics.
If necessary, format text by using buttons on the Formatting toolbar.
When you finish, click Close on the Header and Footer toolbar.
Tips
The text or graphic you enter in a header or footer is automatically left aligned. You may want to center the item instead or include multiple items (for example, a left-aligned date and a right-aligned page number). To center an item, press TAB; to right align an item, press TAB twice.
You can also use buttons on the Header and Footer toolbar to enter text into the header and footer area.

Create a different first page header or footer
You can leave the header or footer (header and footer: A header, which can consist of text or graphics, appears at the top of every page in a section. A footer appears at the bottom of every page. Headers and footers often contain page numbers, chapter titles, dates, and author names.) off the first page or create a unique first page header or footer for the first page in a document or the first page of each section within a document.
If your document is divided into sections (section: A portion of a document in which you set certain page formatting options. You create a new section when you want to change such properties as line numbering, number of columns, or headers and footers.), click in a section or select multiple sections you want to change. Click anywhere if your document is not divided into sections.
On the View menu, click Header and Footer.
On the Header and Footer toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.), click Page Setup .
Click the Layout tab.
Select the Different first page check box, and then click OK.
If necessary, click Show Previous or Show Next on the Header and Footer toolbar to move into the First Page Header area or First Page Footer area.
Create the header or footer for the first page of the document or section.
If you don't want a header or footer on the first page, leave the header and footer areas blank.
To move to the header or footer for the rest of the document or section, click Show Next on the Header and Footer toolbar. Then create the header or footer you want.

Create different headers or footers for odd and even pages
On the View menu, click Header and Footer.
On the Header and Footer toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.), click Page Setup .
Click the Layout tab.
Select the Different odd and even check box, and then click OK.
If necessary, click Show Previous or Show Next on the Header and Footer toolbar to move into the odd or even header or footer (header and footer: A header, which can consist of text or graphics, appears at the top of every page in a section. A footer appears at the bottom of every page. Headers and footers often contain page numbers, chapter titles, dates, and author names.) areas.
Create the header or footer for odd-numbered pages in the Odd Page Header or Odd Page Footer area and create the header or footer for even-numbered pages in the Even Page Header or Even Page Footer area.

Create a different header or footer for part of a document
A document must first be divided into sections (section: A portion of a document in which you set certain page formatting options. You create a new section when you want to change such properties as line numbering, number of columns, or headers and footers.) in order to create a different header or footer (header and footer: A header, which can consist of text or graphics, appears at the top of every page in a section. A footer appears at the bottom of every page. Headers and footers often contain page numbers, chapter titles, dates, and author names.) for part of a document.
If you haven't done so already, insert a section break (section break: A mark you insert to show the end of a section. A section break stores the section formatting elements, such as the margins, page orientation, headers and footers, and sequence of page numbers.) where you want to start a new section that contains a different header or footer.
How?
Click where you want to insert a section break (section break: A mark you insert to show the end of a section. A section break stores the section formatting elements, such as the margins, page orientation, headers and footers, and sequence of page numbers.).
On the Insert menu, click Break.
Under Section break types, click the option that describes where you want the new section (section: A portion of a document in which you set certain page formatting options. You create a new section when you want to change such properties as line numbering, number of columns, or headers and footers.) to begin.
Click in the section for which you want to create a different header or footer.
On the View menu, click Header and Footer.
On the Header and Footer toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.), click Link to Previous to break the connection between the header and footer in the current section and the previous section.
Microsoft Word no longer displays "Same as Previous" in the upper-right corner of the header or footer.
Change the existing header or footer, or create a new one for this section.


Source: http://office.microsoft.com/en-us/word/HP051863231033.aspx

Jan 4, 2008

How to Add Items to the "Send To" Menu in Windows XP

1. Click Start, and then click Run.
2. In the Open box, type sendto, and then click OK.
3. Add a destination by doing one of the following:

Use the drag-and-drop operation to move the item that you want to the SendTo folder; to do so, right-click, and then click Create Shortcuts Here.

-or-

Point to New on the File menu, and then click Shortcut. Follow the instructions in the Create Shortcut Wizard. A new shortcut is created in the SendTo folder, and it is displayed on the Send To menu.

Oct 29, 2007

Find Complete line NOT matched by the regular expression

Some times it’s required get all the instances which are not in the match string.
For example consider the following string.

I think that Michel Smith
is a fictional character. His real name
might be Michel Jackson, Michel Westling,
or Michel Liu for all we know.

If we are interested to get all lines which does not consist of word “Michel”, we can use Regex in .net and create a regular expression as follows

“^(?:(?!(.*Michel.*)).)*$\r?\n?”

i.e. ResultString = Regex.Match(strTest, "^(?:(?!Michel).)*$\r?\n?",RegexOptions.Multiline).Value

strTest contains the Test string.

and the job is done.

Happy coding…

Oct 3, 2007

TRY! MAGIC

#1 *An Indian discovered that nobody can create a FOLDER anywhere on the Computer which can be named as "CON". This is something pretty Cool...and Unbelievable. ... At Microsoft the whole Team, couldn't answer why this happened ! TRY IT NOW ,IT WILL NOT CREATE " CON " FOLDER **MAGIC

#2 * *For those of you using Windows, do the following: *1.) Open an empty notepad file 2.) Type "Bush hid the facts" (without the quotes) *3 *.) Save it as whatever you want. 4.) Close it, and re-open it. *MAGIC

#3 *Open Microsoft Word and type =rand (200, 99) And then press ENTER Then see the magic...

This can help to understand why

1.Device names such as COM1, CON or LPT1 are reserved words, and they can't be used as folder or file names.

2. The reasons why notepad is not able to display any combination of string if the text contains the words with 4 3 3 5 number of letters..
Finally found out that its not a bug with notepad..
What happens is..
Whenever we open a text file in notepad, it determines whether the text is ASCII or Unicode.. But actually there is no way in the world to exactly determine whether the text is ASCII or Unicode.. There is a function called IsTextUnicode in windows API.. The function does some tests on the text based on statistical data.. This is what MSDN says about the function.."The function uses various statistical and deterministic methods to make its determination.. These tests are not foolproof. The statistical tests assume certain amounts of variation between low and high bytes in a string, and some ASCII strings can slip through. For example, if lpBuffer points to the ASCII string 0x41, 0x0A, 0x0D, 0x1D (A\n\r^Z), the string passes the IS_TEXT_UNICODE_STATISTICS test, though failure would be preferable."
And the book "Programming application for microsoft windows by Jeffrey Ritcher" says that this function does not give accurate results if the text is too small to do the tests..
If u open the file explicitly in ASCII mode in notepad, you can see the text correctly..
There can be only 2 reasons why notepad shows the file correctly through wine.. One is there may be no unicode support in wine.. or wine has a much better statistical and deterministic methods than microsoft to determine the text is ASCII or Unicode..
But the possibility of second is very remote.

test with typing these strings for your self...
aaaa aaa aaa aaaaa
hows are you mammu

3. When you need to type some text into a Word document for test purposes, don't waste your time--let Word do the job for you. Let's say that you would like to type in a single four-sentence paragraph. Just click at a blank line in your document, type =rand(1,4) and press Enter. Word will automatically type: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The first number inside the parentheses is the number of paragraphs and the second number is the number of sentences in each paragraph. So, for 22 paragraphs of 22 sentences, you'd enter =rand(22,22).