I had been using my own ad-hoc system for years but recently started using CVS to maintain a history of my file and document changes. I was quite happy with CVS but everyone told me I should be using Git instead. Git seems to be simpler and more intuitive. I can set up git for a folder or project very quickly. You just need the following 5 commands to get going
git init (set up git for the current directory)
git add *.php (add all your php files or whatever)
git commit -m “first version” (also need to commit all your existing php files)
vi index.php (make a few changes)
git commit -a -m “Added new date feature” (do this periodically to maintain version control)
gitk is a simple TK Gui which allows you to review you versions etc. I am delighted to have version control, all I have to do is remember to do a > git commit -a -m “Added new date feature” every now and again (eg daily)
Coding Tips
Coding Tips, cvs, gitk, version control
You know the frustration of being able to log into a website because your browser has
remembered the password but you have forgotten it and so cannot login from another pc.
Well FireFox will show them to you
options->security->Saved Passwords then click Show Passwords
You may want to consider the security implications as well, to disable this feature while
retaining the ability of the browser to remember passwords
go to
options->security-set master password
I personally never let a browser remember say my PayPal password
Uncategorized
firefox, password, security
The sed does the filtering, you should be able to see how to adapt this to your own requirements
So I want to duplicate init.php while changing the value of a flag inside it for each copy
cat init.php | sed s/flag=2/flag=3/ > dir3/init.php
cat init.php | sed s/flag=2/flag=4/ > dir4/init.php
If you see the first comment Bawdo suggests rightly that this is a UUOC
sed “s/flag=2/flag=4/” init.php > dir4/init.php
I’ve always underused sed unfortunately
which then can written (zsh)
for i in {3,4}; sed s/flag=2/flag=$i/ init.php > dir$i/init.php
sed stands for stream editor and therefore cannot do an in place edit this is where perl thrives
perl -p -i -e ‘s/\surname\b/form_surname/g’ *.php
or safer
perl -p -i.bak -e ‘s/\b23\b/34/g’ fred.php (creates a backup of each file eg fred.bak)
Uncategorized
Today I had to update a 12 year old Higgledy-piggledy Microsoft Access Database application to work with the year 2010 instead of 2009 amongst other things . The original designer had needlessly hard-coded the current year’s and previous year’s date anyway I had some notes from when I did it 12 months ago which described what values need changing, but could I find where those values were defined? My notes were not specific enough. The REAL PROBLEM was that last year I must have altered these values without too much of a sweat and so not taken much trouble to note down exactly.
Fortunately I remembered the wonderful stackoverflow.com website. I posed my question and got several useful pointers in a few minutes and these helped me find the solution which was to set the option search whole project.
This is actually a generic problem in life when we realize that we’ve been doing something automatically and been unconscious of how we did it.
Uncategorized