Wednesday, December 14, 2011

Copy and paste content from one file to another file in VI

Here are steps:

  1. Open the file you need to edit
  2. :sp /path/to/the/file/... and open the file that you need to copy from (this will split the window and open the other file in top section)
  3. Locate the lines you want to copy. If it 10 lines type 10yy
  4. Move to the other file using CTRL+ws
  5. Figure out where you need to paste the yanked lines type p
That's it :)


Tuesday, November 22, 2011

Syntax Highlighting & Word Counter

Syntax highlighting and word count are much needed tools when doing articles/tutorials to wso2.org.

Following are useful links.
syntax highlighting - http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html

Word counter - http://www.wordcounttool.com/









Sunday, November 20, 2011

s in sed

I was doing an article where I was copying code snippets from a my editor to the article's editor. When switched on to the HTMl view I noticed that there are <p></p> tags added in my source. I was to delete these away to make my code look neater. sed was my time savor.

sed s command is used like this; say I need to replace cool with crap, the command is;
sed -e 's/cool/crap/g'

So for my task, I copied the code snippet to a temp file and ran folliwing shell script to get my source code cleaned up. Nice and cool, love it :)
sed -e 's/<p>/ /g' temp.txt > temp1.txt
cp temp1.txt temp.txt
sed -e 's/<\/p>/ /g' temp.txt > temp1.txt

'/' is a delimiter in sed, so when you use a regular expression with '/' in it you will need to quote it using a backslash (\).

In above I've said to change <p>in temp.txt to a space and copy the updated code in temp1.txt. Then I copy the updated temp1 content to temp.txt and remove </p>s from it.

Sunday, September 18, 2011

Monday, November 1, 2010

Backing up and restoring a mySql database

1. Create backup

$ mysqldump -u root -proot regdb > /home/yumani/Documents/regdb_back.sql


2. Restore

Create a database in mysql and the grant user access
mysql >  create database regdb;
mysql >  grant all on regdb.* to wso2bam@'%' identified by 'wso2bam';

$ mysql -u root -proot regdb < /home/yumani/Documents/regdb_back.sql

Tuesday, October 12, 2010

Removing mySQL

sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get --purge remove mysql-server

same for mysql-client.

Thursday, July 1, 2010

Setting-up and accessing Derby DB in Ubuntu

1. Download Derby bin distribution from here.

2. Extract it.

3. Set DERBY_HOME and add it to the path.
vi ~/.bashrc

Add as below;
export DERBY_HOME=/opt/software/db-derby-10.3.1.4-bin
export PATH=$PATH:$DERBY_HOME/bin

Then source bashrc
source ~/.bashrc


4. Run $DERBY_HOME/bin/startNetworkServer.sh
sh startNetworkServer

5. To use ij tool;
set DERBY_OPTS=-Dij.protocol=jdbc:derby://localhost/

Then type ij on the prompt to get the ij tool, where u can type in commands.


Monday, June 14, 2010

Notes on Cloud!

Did a little lazy work.. Below is some notes I directly copied from an IBM white paper (soucre is given below).

Source :
Dispelling the vapor around cloud computing Drivers, barriers and considerations for public andnprivate cloud adoption                             
IBM Smart Business
Thought Leadership White Paper
January 2010


What is cloud computing?

Cloud delivery models:


Features:
Cloud based service management capabilities that are essential:

Main elements in cloud architecture:

Sunday, June 13, 2010

How-to-make-awesome-tag-cloud

Excellent guide with simple steps - http://blog.frivolousmotion.com/2007/05/how-to-make-awesome-tag-cloud.html

Day 03 Gala Dinner Highlight Video