Sorting Blocks of Text

Sorting lines of text is easy. Many text editors include that functionality built in. But, what if you need to sort blocks of text, e.g. a PHP classes. Here are some ways to do it.

1. Convert each block of text to a single line by replacing each line break with a unique identifier. Run your built-in line sorting function. Replace each unique identifier with a line break again.

2. Write a regular expression that will match each block of text and sort using a regular expression.

Show Line Numbers in Vi/Vim

Recently, I needed to edit a php file in Vi and although I need the line of the error, I didn’t see line numbers like I normally do in my Sublime Text 2 editor. It turns out that if you’re in Vi/Vim, you can type

:set numbers

or

:set nu

and line numbers will show up. Much better! But, that only works for the current Vi session. If you want Vi to always show line numbers, edit the .vimrc file in your home folder

vi ~/.vimrc

and append “set number” to it.

Common SVN Operations Using SmartSVN

SVN is a version control system often used by programmers to keep track of versions or changes of code. It makes it easy collaborate on code projects and keep a backup of every change you’ve made. Following are some common tasks you may need to perform.

Checking out trunk 

This copies files from your trunk folder in SVN to a folder on your local computer. The folder on your local computer is your “working copy” where  you make changes.

Continue reading Common SVN Operations Using SmartSVN

Creating a branch in SmartSVN

Creating a branch in SVN is like creating a copy of a folder. The command line command is

$ svn copy svn+ssh://host.example.com/repos/project/trunk 
svn+ssh://host.example.com/repos/project/branches/NAME_OF_BRANCH 
-m "Creating a branch of project"

but if you do it in SmartSVN, it’s shown below.

Just make sure you don’t create a folder in your branches folder and then copy the contents of your origin folder into your newly-created branch folder. That would result in a separate branch for each folder within your origin folder as opposed to one branch of your entire origin folder.

Linking to a page’s HTML source

When you create a link in a website, you normally do something like

<a href=”somepage.html”>

This will take the user to somepage.html and download all assets on that page (images, css, javascript, etc) resulting in multiple requests. But, what if you only what to view a page’s HTML source. Well, you can create a link like

<a href=”view-source:somepage.html”>

and this will result in only ONE request and display the page’s HTML source code in your browser.

List of FlowCharts

I’m probably going to have to use one of these at some point.

http://www.lovelycharts.com
http://www.smartdraw.com/
https://www.lucidchart.com
http://www.gliffy.com
http://www.conceptdraw.com/
http://grapholite.com
http://creately.com/