Useful SVN Commands
I use subversion as my source code repository. I hear git is better but I’ve yet to move in that direction. Anyway, I’ve compiled a list of useful (to me) svn commands that I use often in my workflow. Hopefully they will be just as useful to you!
** Copy files from one server to another (*nixs via scp)
scp [user@server:]file [user@server:]file
** SVN Big Book of Knowledge
http://svnbook.red-bean.com/en/1.0/
** Create a backup of svn repositories
svnadmin dump //path/to/repo > repo.dump
** Create repository
** location: carter:/var/lib/svn
** NOW YOU CAN USE /var/lib/svn/scripts/mkrepo {repo name} **This is a script that I created to take care of the following steps automatically.
1. make directory
sudo mkdir /var/lib/svn/{repository}
2. change owner to the web server for WebDAV access via Apache
sudo chown -R www-data:www-data /var/lib/svn/{repository}
3. tell svn to create a repository in the new location
sudo svnadmin create /var/lib/svn/{repository}
At this point you can add to the repos as necessary or use the load command below to load or restore a dumped repo
** Load a backup into a repository
svnadmin load //path/to/repo < repo.dump
** Import directory or file into a repository (can be a brand new repo to which you are importing an existing project
svn import -m “something meaningful about the import” //path/to/local/{file(s) or dir(s)} http://server/repo/dir (http://svn.mdh.org/{repo}
** Checkout a repository
svn co http://server/repo/dir/ //path/to/place/working/copy
** Update working copy
svn update
** Export repository to a new location, not tied to SVN
svn export –force http://server/repo/dir/ //path/to/export/dir/.
** Checkin changes
svn ci [{file[s] [files]}] -m “some meaningful message about the check-in”
** Add file to version control
svn add {file[s] [files]}
** Ignore files listed in .ignore file
svn ps svn:ignore -F .ignore
** Show ignored files/directories
svn pg svn:ignore
** Remove stale locks and general locks on a working copy
svn cleanup
** Show repo status
svn st
** Create a branch or tag or a repository
svn cp http://server/repo/dir http://server/repo/copydir -m “something meaningful about the copy”
** delete a file/directory from working copy (unless repo url is provided at which point it updates the repo)
** if working on the repository a message must be provided
svn rm file
svn rm -m “something meaningful about the deletion” http://server/repo/dir/file
** Display commit log messages
svn log [file or http://server/repo/dir/file]
** Make directory in repo or working copy
svn mkdir newdir
svn mkdir -m “something meaningful about the mkdir” http://server/repo/newdir
** Rename/Move a file
svn mv sourcefile destinationfile
svn mv -m “something meaningful about the move” http://server/repo/sourcefile http://server/repo/destinationfile
** Remove “conflicted” state on working copy directories and files
** !!THIS DOES NOT FIX THE PROBLEM, IT MERELY REMOVES THE “CONFLICT” FLAG!!
svn resolved /path/to/working/copy
** Remove all local edits
svn revert file[s]
** Browse Repository
svn list http://server/repo/dir
** get sourceforge repo files
https://PROJECTNAME.svn.sourceforge.net/svnroot/PROJECTNAME
Programming Dilemma!
So, I love to code. I love it. I can’t get enough of it. My problem, though, is ADHD tendencies. I get ideas and start to work on ‘em. I spend a fair amount of time planning, designing and making sure it would be useful beyond my humble needs. Then, shiny things.
The issue arises when you have way too many ideas and not enough (something) to record those ideas and implement them. What should I/we do? What should be the magic bullet to slay this focus beast?
More Christian Bullshit!
The American Cancer Society is turning down $500,000 in donations from a secular, atheist organization…no reason, no explanation. This is complete bullshit. They are denying money to research and assistance simply due to their perception of appearance. They’ve even begun altering their program to make it appear that they have always had this stance. The group then asked to file under a corporate sponsor since they are a non-profit corporation. Again, no joy. When pressed for further reasoning, the response was simply, “that’s how it is.”
Why must the “moral” members of our society deny those that are willing to help.
What a joke!
Isn’t technology grand!
Today I got my Mom on Skype. I’ve never used the service before but I managed to get her set up in a matter of minutes. Now we can chat face to face which is funny since I work with her and she only lives six miles away.
What will be cool, though, is that my brother, mother, and potentially other family can chat, all while being in different locations. Then, throw in the camera and we have a long distance family reunion!
Isn’t technology grand!
BASH Shortcuts
I found a site that has some great links to BASH shortcuts here!
Here’s the canibalized gist of it…
Command Editing Shortcuts
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + u – make uppercase from cursor to end of word
Alt + l – make lowercase from cursor to end of word
Alt + t – swap current word with previous
Ctrl + f – move forward one character
Ctrl + b – move backward one character
Ctrl + d – delete character under the cursor
Ctrl + h – delete character before the cursor
Ctrl + t – swap character under cursor with the previous one
Command Recall Shortcuts
Ctrl + r – search the history backwards
Ctrl + g – escape from history searching mode
Ctrl + p – previous command in history (i.e. walk back through the command history)
Ctrl + n – next command in history (i.e. walk forward through the command history)
Alt + . – use the last word of the previous command
Command Control Shortcuts
Ctrl + l – clear the screen
Ctrl + s – stops the output to the screen (for long running verbose command)
Ctrl + q – allow output to the screen (if previously stopped using command above)
Ctrl + c – terminate the command
Ctrl + z – suspend/stop the command
Bash Bang (!) Commands
Bash also has some handy features that use the ! (bang) to allow you to do some funky stuff with bash commands.
!! – run last command
!blah – run the most recent command that starts with ‘blah’ (e.g. !ls)
!blah:p – print out the command that !blah would run (also adds it as the latest command in the command history)
!$ – the last word of the previous command (same as Alt + .)
!$:p – print out the word that !$ would substitute
!* – the previous command except for the last word (e.g. if you type ‘find some_file.txt /‘, then !* would give you ‘find some_file.txt‘)
!*:p – print out what !* would substitute
There is one more handy thing you can do. This involves using the ^^ ‘command’. If you type a command and run it, you can re-run the same command but substitute a piece of text for another piece of text using ^^ e.g.:
$ ls -al
total 12
drwxrwxrwx+ 3 Administrator None 0 Jul 21 23:38 .
drwxrwxrwx+ 3 Administrator None 0 Jul 21 23:34 ..
-rwxr-xr-x 1 Administrator None 1150 Jul 21 23:34 .bash_profile
-rwxr-xr-x 1 Administrator None 3116 Jul 21 23:34 .bashrc
drwxr-xr-x+ 4 Administrator None 0 Jul 21 23:39 .gem
-rwxr-xr-x 1 Administrator None 1461 Jul 21 23:34 .inputrc
$ ^-al^-lash
ls -lash
total 12K
0 drwxrwxrwx+ 3 Administrator None 0 Jul 21 23:38 .
0 drwxrwxrwx+ 3 Administrator None 0 Jul 21 23:34 ..
4.0K -rwxr-xr-x 1 Administrator None 1.2K Jul 21 23:34 .bash_profile
4.0K -rwxr-xr-x 1 Administrator None 3.1K Jul 21 23:34 .bashrc
0 drwxr-xr-x+ 4 Administrator None 0 Jul 21 23:39 .gem
4.0K -rwxr-xr-x 1 Administrator None 1.5K Jul 21 23:34 .inputrc
Here, the command was the ^-al^-lash which replaced the –al with –lash in our previous ls command and re-ran the command again.
HTML5 compliant tables
Moving to HTML5 can be frustrating, especially when you use an editor that alerts you of your deficiencies!
One such frustration is inline CSS (deprecated years ago but REALLY deprecated with HTML5). I used to use:
<table border="0" cellpadding="0" cellspacing="0">
<thead>
<tr><th>some header</th></tr>
</thead>
<tbody>
<tr><td>some content</td></tr>
</tbody>
</table>
and be done with it! Now, though, HTML5 wouldn’t be happy! The proper method to style the above table is:
<style≫
table {
/* cellspacing */
border-spacing: 0;
/* border = "0" */
border: 0 none;
}
th, td {
/* cellpadding */
padding: 0;
}
</style≫
Now, any table will lack a border and have zero cellspacing and padding.
Happy coding!
