About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Thursday, 30 April 2009

Setup YUM installer repo

To use the YUM installer you need to register the repo.

Create a file "/etc/yum.repos.d/centos.repo" and paste the below content.

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirror.centos.org/centos/5/os/i386/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=1

Thursday, 23 April 2009

Linux maximum processes per user

Recently I came to know there is a max count of processes allocated for each user. Below is the command to find the find that.

ulimit -u

Reference:
http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/x4733.html

Friday, 17 April 2009

Removing invalid xml characters

Recently I came across oneof the good way to remove InvalidXmlCharacters. Below is the snippet.

/**
* Returns the input stripped of invalid XML characters.
*
* see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char for valid XML
* character list.
*/

public String removeInvalidXmlCharacters(String input)
{
if (input == null) {
return input;
}
char c;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < input.length(); i++)
{
c = input.charAt(i);
//remove ZeroWidthSpace
if (c == '\u200b') {
continue;
}
if ((c == 0x9) || (c == 0xA) || (c == 0xD)
|| ((c >= 0x20) && (c <= 0xD7FF))
|| ((c >= 0xE000) && (c <= 0xFFFD))
|| ((c >= 0x10000) && (c <= 0x10FFFF))
) {
sb.append(c);
}
}
return sb.toString();
}

Thursday, 16 April 2009

AWK to take last previous column

You can use the below command to print last previous column.

awk '{print $(NF-1)}' access.log | sort | uniq | wc -l

Wednesday, 8 April 2009

Ubuntu youtube no sound in firefox

I was continuously facing problem with sound while playing youtube using firefox. The youtube inturn uses gstreamer library to render the sound.

Finally got sound working after installing restricted packages!

Run "sudo apt-get install ubuntu-restricted-extras"

Paly and check your youtube for sound.

Friday, 3 April 2009

Subversion stress testing.

Today for one of my friend I've explored a new tool, which was used for stress testing on subversion.

You can find the script here.

Basically the script is for performing multiple operations on the repository to test the load.