Tuesday, December 14, 2010

How to tell CVS to ignore files?

*** CVS will ignore files if they are in:
1) CVS built-in patterns          : #tempfiles# and emacs backup~ files
2) Per-Repository based patterns  : 'CVSROOT/cvsignore' file
3) Per-User based patterns        : ${HOME}/.cvsignore
4) Per-Group based patterns       : ${CVSIGNORE}
5) Per-Command based patterns     : Patterns defined after cvs '-I' command

Config cvsignore or .cvsignore files if you don't want to .old or .bak files to be put into cvs repository.

*** Per-Repository Based Ignore List:

hsual@psgltpe014 $ 
hsual@psgltpe014 $ echo $CVS_RSH
/bin/ssh
hsual@psgltpe014 $ echo $CVSROOT
:ext:hsual@localhost:/opt/cvs
hsual@psgltpe014 $              
hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/Temp
hsual@psgltpe014 $ cvs checkout CVSROOT
U CVSROOT/checkoutlist
U CVSROOT/commitinfo
U CVSROOT/config
U CVSROOT/cvswrappers
U CVSROOT/editinfo
U CVSROOT/loginfo
U CVSROOT/modules
U CVSROOT/notify
U CVSROOT/rcsinfo
U CVSROOT/taginfo
U CVSROOT/verifymsg
hsual@psgltpe014 
hsual@psgltpe014 $ echo *.old > cvsignore
hsual@psgltpe014 
hsual@psgltpe014 $ chmod 770 cvsignore
hsual@psgltpe014  
hsual@psgltpe014 $ cvs add cvsignore
cvs server: use 'cvs commit' to add this file permanently
hsual@psgltpe014 
hsual@psgltpe014 $ cvs commit -m "added per-repository based ignore file list" cvsignore
RCS file: /opt/cvs/CVSROOT/cvsignore,v
done
Checking in cvsignore;
/opt/cvs/CVSROOT/cvsignore,v  <--  cvsignore
initial revision: 1.1
done
cvs server: Rebuilding administrative file database
hsual@psgltpe014 $ 
hsual@psgltpe014 $ cd /home/hsual/alhsu/AlHome/WebSite/HowTo
hsual@psgltpe014 $ ls
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.txt*
hsual@psgltpe014 $ 
hsual@psgltpe014 $ echo Testing > readme.old
hsual@psgltpe014 $ ls
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.old  readme.txt*
hsual@psgltpe014 $ 
hsual@psgltpe014 $ cvs -n update
? readme.AL
? CVSAdmin/HowToCVSIgnore.txt
? CVSAdmin/IgnoringFilesFromRelease.txt
hsual@psgltpe014 $ 

*** Per-User Based Ignore List:  create ~/.cvsignore file.
The readme.AL is a new file careted under the HowTo directory.  Because of the patten of *.AL is defined in ~/.cvsignore file, you won't see it when doing "cvs -n update".  Therefore, the new file, readme.AL, will not be handled by CVS.
hsual@psgltpe014 $ 
hsual@psgltpe014 $ more ~/.cvsignore
*.alhsu *.AL
*.bak *.BAK *.backup *.b
*~* .*~* 
build

hsual@psgltpe014 $ pwd
/home/hsual/alhsu/AlHome/WebSite/HowTo
hsual@psgltpe014 $ ls      
CVS/  CVSAdmin/  Database/  J2EEServer/  Win2000/  readme.AL  readme.old  readme.txt*
hsual@psgltpe014 $ cvs -n update
? CVSAdmin/HowToCVSIgnore.txt
? CVSAdmin/IgnoringFilesFromRelease.txt
hsual@psgltpe014 $ 

Creation of .cvsignore file

This is a typical sort of .cvsignore file for the directory ~/src/xyz, for instance.
.backup .bkp .????*
*.tar *.tar.Z *.tgz *.zip *.asc
*~* .*~*
0.1.0 0.1.1
doc tests1 tests2 xyz-0.1.2

In my case, I don't want the ``cvs'' commands to go looking for sources in directories such as ``doc'', ``test1'', ``tests2'' etc. I also don't want checks performed on editor-created backup files which follow patterns like ``*~*''.
Here's a typical example that I use for document directories like ~/tex/xyz.

.bkp .backup
*.akb *.dvi *.akc *.log *.xrf
*.ps *.eps *.pdf
*.zip
*~* ps/*~*

How to fix CVS permission denied problem when checking in files?

Problem:

hsual@psgltpe014 $ cvs commit -m "updated HowToCVS.doc and .htm 
files" HowToCVS.doc Checking in HowToCVS.doc;
/opt/cvs/WebSite/Project/Environment/CVSControl/HowToCVS.doc,v  <--  HowToCVS.doc
new revision: 1.2; previous revision: 1.1
cvs [server aborted]: cannot rename file 
/opt/cvs/WebSite/Project/Environment/CVSControl/,HowToCVS.doc, to 
/opt/cvs/WebSite/Project/Environment/CVSControl/HowToCVS.doc,v: 
Permission denied
hsual@psgltpe014 $

Solution:

Right Click on /opt folder --> Properties --> Security --> 
Add Administrator, AlHsu and hsual users --> 
Remove everyone user --> Check Full Control for Administrator,
AlHsu and hsual --> Uncheck "Allow inheritable permissions
from parent to propagate to this object". --> Click OK.

Right Click on /opt/cvs folder --> Properties --> Security --> Remove everyone user --> Add Administrator, AlHsu and hsual users --> Check "Allow inheritable permissions from parent to propagate to this object". --> Click Advanced... --> Check "Reset permissions on all child objects and enable propagation of inheritable" --> Click OK --> Click OK

hsual@psgltpe014 $ 
hsual@psgltpe014 $ cvs commit -m "updated HowToCVS.doc and .htm files"             

Checking in HowToCVS.doc;

/opt/cvs/WebSite/Project/Environment/CVSControl/HowToCVS.doc,v  <--  HowToCVS.doc

new revision: 1.2; previous revision: 1.1

done

Checking in HowToCVS.htm;

/opt/cvs/WebSite/Project/Environment/CVSControl/HowToCVS.htm,v  <--  HowToCVS.htm

new revision: 1.2; previous revision: 1.1

done

hsual@psgltpe014 $ 

Cygwin SSHD + Cron

Cygwin SSHD errors with RSA hostkey been changed:
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. Click here for details.

Install cygwin cron
Get cron package from Admin group. Download cron from http://mirror.mcs.anl.gov and store it to your local drive. And then run /usr/bin/cron-config to setup cron daemon. Click here for details.

crontab -a filename  Install filename as your crontab file.
                    On many systems, this command is
                    executed simply as crontab filename
                   (i.e., without the  -a  option). 
crontab -e  Edit your crontab file, or create one if it
           doesn't already exist. 
crontab -l  Display your crontab file. 
crontab -r  Remove your crontab file. 
crontab -v  Display the last time you edited your crontab file.
          (This option is available on only a few systems.) 
crontab -u user  Used in conjunction with other options, this
                option allows you to modify or view the crontab
                file of user. When available, only administrators
                can use this option. 



Cygwin path to Windows path
$ cygpath -wp /home/oneuser/testdir
c:\cygwin\home\oneuser\testdir

Executing Java Program from Cygwin (bash shell script)
$ java -classpath `cygpath -wp $CLASSPATH` [classname] [arguments]

Uninstall Cygwin
source
# Restart your computer.
# Backup anything you may added to the c:\cygwin\ directory which will
not be replaced by the re-installation.
# Delete the c:/cygwin subdirectory (where Cygwin was installed).
# Remove registry entries: Any time you change the registry, do so with
great care..
  * Under HKEY_CURRENT_USER, Software, delete "Cygnus Solutions"
  * Under HKEY_LOCAL_MACHINE, Software, delete "Cygnus Solutions"
# Use Start, Run, cmd, chkdsk /F. This will run chkdsk, check and repair
any file system problems on the next bootup.
# Restart your computer.



How to put code into blog?

How to put code into blog?
Use <PRE> tag. Sample here:

myClassPath=".;"
for i in `ls ./lib/*`; do
   case $environment in
        FIX) myClassPath="$myClassPath"":$i"
             ;;
          *) myClassPath="$myClassPath"";$i"
             ;;
   esac
done
Table examples
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
     <td width="60%" align="left" valign="top">TestMe</td>
     <td width="40%" align="right" valign="top">&#160;</td>
  </tr>
  <tr colspan="2">
     <td>COLSPAN</td>
  </tr>
</table>

Scroll Box Sample

<div style="border: 1px solid rgb(170, 170, 170); overflow: auto; width: 350px; height: 100px; color: rgb(0, 0, 0);"><p>
your html code here.
</p>
</div>

CVS Admin

Check out a project
/usr/local/bin/cvs -d :pserver:hsual@home.com:/usr/local/cvsroot checkout <prj>

Export a project
cvs -d :pserver:hsual@home.com:/usr/local/cvsroot login
cvs -d :pserver:hsual@home.com:/usr/local/cvsroot export -r <tag> <prj>

Adding files to a directory
$ mkdir -p foo/bar
$ cp ~/backend.c foo/bar/backend.c
$ cvs add foo
$ cvs add foo/bar
$ cvs add foo/bar/backend.c
$ cvs add backend.c
$ cvs commit -m "Early version. Not yet compilable." backend.c

Removing files
$ cd test
$ rm *.c
$ cvs remove
cvs remove: Removing .
cvs remove: scheduling a.c for removal
cvs remove: scheduling b.c for removal
cvs remove: use 'cvs commit' to remove these files permanently
$ cvs ci -m "Removed unneeded files"
cvs commit: Examining .
cvs commit: Committing .

Remove directories
Removing directory equals to removing files under the directory you want it to be removed. When you checkout the source with a -P option, cvs will remove the empty directory automatically.

Rename a file
$ mv old new
$ cvs remove old
$ cvs add new
$ cvs commit -m "Renamed old to new" old new

Move tag to current revision
cvs tag -c -F R240 myLogo.gif

Add comment to a file on version 1.3
cvs admin -m 1.3:"Comments for version 1.3" myLogo.gif

Add a new Group in WinXP

Add a new Group in WinXP

Local Users and Groups manages users and groups of users for your computer. You can create new users and groups, add users to groups, remove users from groups, disable user and group accounts, and reset passwords.
Start Menu -> Programs -> Administrative Tools -> Computer Management -> System Tools -> Local Users and Groups -> Groups
Or
Right click on My Computer -> Manage -> System Tools -> Local Users and Groups -> Groups

New Example
Here

Installation of nnCron

hsual@psgltpe014$ pwd
/cygdrive/c/Program Files/cron
hsual@psgltpe014$ ls
cron.exe*  cron.out*  doc/  install_svc.bat*  startcron.bat*  uninstall.exe*
cron.ini*  cron.tab*  etc/  log/              stopcron.bat*   uninstall_svc.bat*
hsual@psgltpe014$

Crontab file cron.tab

The "heart" of Cron is a crontab file where all the data required to start an application is stored: starting time, frequency of its execution, application's name and parameters with with it should be run. Immediately after Cron is installed, a crontab file named cron.tab will be created in nnCron's installation directory. cron.tab is an ordinary text file. It can be created and/or edited in any available text editor.

Each minute, Cron checks time of last modification of cron.tab; if it notices that file was changed, it automatically "rereads" it. If you have manually changed some data in a crontab file and you don't want to wait while Cron reloads it automatically, you can hasten the process of crontab reloading by typing in command line:

cron.exe -reload

Syntax that is used in crontab files is very simple: in order to start an application, one only has to specify a desired time of startup in cron format and (after a blank space) the command that should be executed:

time_in_cron_format command
Comments in crontab files begin with character '#' and continue until the end of line. Crontab file may contain any number of empty lines, which are ignored by the parser. Leading spaces and tab characters are also ignored.

Example:

·application 'chime.exe' is started at 12:15 every week day 1-5 (Mon-Fri)

15 12 * * 1-5 d:\tools\chime.exe

·the pdf file named in the task is opened daily at 12:00 ad at 17:00

0 12,17 * * * e:\mydocuments\perl\re\re.pdf

·the command file named in the task is executed every 5 minutes

*/5 * * * * d:\fido\bat\blstbbs.cmd

Please note two things:

·when a filename contains blank spaces, there is no need to encase it in quotation

·in order to run command and batch files and open documents, there is no need to call the command interpreter

Of course, that doesn't mean that you cannotenclose file names with blank spaces between quotation marks orthat you cannot call the command interpreter explicitly. Use the way which is more convenient to you:

0 12 * * * "e:\mydocuments\forth\index.html"

0 8-18 * * 1-5 cmd /cd:\tools\cleanup.bat

Cron can define local environment variables right in a crontab file. Local environment variables (i. e. variables available only to application started by Cron) are defined with word SET. See Working with Environment Variables for
a more detailed description of the subject.

In command field and in SET constructs you can use the predefined variables of Cron.

Example:
30 9 * * * %COMSPEC% /cd:\tools\my_bat.bat
0 12 * * 1-5 d:\tools\maintain.bat%DD%-%MMM%-%YYYY%.log

There also exist a special type of syntax allowing to execute any Forth word as a command; this allows to execute scripts of any desired complexity, written in Forth
programming language (SP-Forth). This is discussed in greater detail in chapter Cron and Forth Programing Language.

Cron Format


Cron format is a simple, yet powerful and flexible way to describe time and frequency of various actions. Cron format is extensively used in nnCron LITE.

Traditional (inherited from Unix) cron format consists of five fields separated by blank spaces:
Minute , Hour , Day_of_the_Month ,
Month_of_the_Year , Day_of_the_Week
nnCron LITE can use both traditional and "enhanced" version of cron format, which has an additional (6th) field: :
Minute , Hour , Day_of_the_Month , Month_of_the_Year , Day_of_the_Week , Year

A user can choose the format he would like to use by changing the value of YearField? variable in cron.ini. By default, nnCron LITE uses the traditional format, which we are going to use in our examples.
The following graph shows what it consists
of:
* * * * *
| | | | |
| | | | +----- Day of the Week (range: 1-7, where 1 is Monday)
| | | +------- Month of the Year (range: 1-12)
| | +--------- Day of the Month (range: 1-31)
| +----------- Hour (range: 0-23)
+------------- Minute (range: 0-59)
Any of these 5 fields may contain an asterisk (*) as their value. An asterisk would mean the entire range of possible values, i.e. each minute, each hour, etc. In
the first four fields, nnCron LITE users can also use "nonstandard" character ? (question mark). A description of its functions can be found here.

Any field may contain a list of values separated by commas, (e.g. 1,3,7) or a range of values (two integers separated by a hyphen, e.g. 1-5).

After an asterisk (*) or a range of values, you can use character / to specify that values are repeated with a certain interval between them. For example, you can write
"0-23/2" in Hour field to specify that some action should be performed every two hours (it will have the same effect as "0,2,4,6,8,10,12,14,16,18,20,22"); value "*/4" in Minute field means that the action should be performed every 4 minutes,
"1-30/3" means the same as "1,4,7,10,13,16,19,22,25,28".

In Month and Day of Week fields, you can use names of months or days of weeks abbreviated to first three letters ("Jan,Feb,...,Dec" or "Mon,Tue,...,Sun") instead of their numeric values.

Examples:

* * * * *        : Each minute

59 23 31 12 5    : One minute before the end of year 
                   if the last day of the year is Friday

59 23 31 Dec Fri : Same as above (different notation)

45 17 7 6 *      : Every year, on June 7th at 17:45

0,15,30,45 0,6,12,18 1,15,31 * *  : At 00:00, 00:15, 00:30, 
                                    00:45, 06:00, 06:15, 
                                    06:30, 06:45, 12:00, 
                                    12:15, 12:30, 12:45, 
                                    18:00, 18:15, 18:30, 
                                    18:45, on 1st, 15th 
                                    or 31st of each month, 
                                    but not on weekends

*/15 */6 1,15,31 * *   :  Same as above (different notation)

0 12 * * 1-5 (0 12 * * Mon-Fri) : At midday on weekdays

* * * 1,3,5,7,9,11 *   : Each minute in January, March, May, 
                         July, September, and November

1,2,3,5,20-25,30-35,59 23 31 12 * : On the last day of year, 
                                    at 23:01, 23:02, 23:03, 
                                    23:05, 23:20, 23:21, 23:22, 
                                    23:23, 23:24, 23:25, 23:30,
                                    23:31, 23:32, 23:33, 23:34, 
                                    23:35, 23:59

0 9 1-7 * 1 : First Monday of each month, at 9 a.m.

0 0 1 * * : At midnight, on the first day of each month

* 0-11 * * : Each minute before midday

* * * 1,2,3 * : Each minute in January, February or March

* * * Jan,Feb,Mar *  : Same as above (different notation)

0 0 * * * : Daily at midnight

0 0 * * 3 : Each Wednesday at midnight
nnCron LITE users can use an nonstandard character "?" in the first four fields of cron format. It stands for time of nnCron LITE startup, i. e. when a field is processed, startup time will be substituted for the question mark: minutes
for Minute field, hour for Hour field, day of the month for Day of month field and month for Month field.

For example, if you write the following:
? ? * * *

the application will be started on nnCron LITE startup and then will be executed daily at the same time (unless the user doesn't restart nnCron LITE, of course):
question marks will be "replaced" by nnCron LITE startup time. For example, if nnCron LITE was started at 8:25, question marks will be substituted in the following way:
25 8 * * *
Some more examples:
# application will be startedonly on nnCron LITE startup
? ? ? ? *

# application will be started on nnCron LITE startup (e.g. at 10:15)

# and then will be executed again each hour:

# at 11:15, 12:15, 13:15 etc.

? * * * *

# will be executed each minute after nnCron LITE startup until the next hour starts.
# The next day, if nnCron LITE has not been restarted in the meanwhile,
# it will be executed again each minute during the same hour.
* ? * * *

# will be executed daily, every five minutes,

# during the hour when nnCron LITE was started

*/5 ? * * *

Starting and Stopping nnCron LITE


If nnCron LITE is installed under Windows 9*/ME, it starts as a regular application. In Windows NT/2000/XP, nnCron LITE is started by default as a system service.
nnCron LITE home directory contains a batch file named startcron.bat, which checks the version of operation system and automatically start nnCron LITE in an appropriate way:
either as a service or as a regular application.

By default, nnCron LITE service is started on system startup using built-in System account, but it can be run "in the name of" any registered user who has sufficient
rights (see Note), in other words, nnCron LITE service will use this user account to log in. To do this, select nnCron LITE service in the the Services window (Control panel - Aministrative Tools - Services - cron), open Properties dialogue, select This Account on LogOn? tab and enter the user name and password of the
required user.

If a user wants to run nnCron LITE as a regular application under Windows NT/2000/XP, he can do this by starting nnCron LITE from command line with key -ns:

cron.exe -ns

In order to stop nnCron LITE and unload it from memory, you can use either of these two methods:

·run batch file stopcron.bat
in the program's home directory

·run the following command
from command line: cron.exe -stop (if nnCron LITE was started as
a regular application rather then as a service)


Note: in order to run nnCron LITE not as System, but as ? particular user, this user must have the following rights (see Control Panel - Administrative Tools -
Local Security Settings - User Rights Assignment):

·Replace a process level
token

·Act as part of the
operating system

·Bypass traverse
checking

(user System has these rights by
default).