<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Log File</title>
	<atom:link href="http://www.thelogfile.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.thelogfile.com/blog</link>
	<description>Linux, Software development, Technology news,...</description>
	<lastBuildDate>Sat, 21 Aug 2010 08:17:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Xubuntu &#8211; Time Synchronization</title>
		<link>http://www.thelogfile.com/blog/?p=1431#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1431#comments</comments>
		<pubDate>Sat, 21 Aug 2010 08:15:55 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Xubuntu]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1431</guid>
		<description><![CDATA[In xubuntu (XFCE) you can run the following command to synchronize your system clock with time servers: sudo ntpdate pool.ntp.org After running this command you would get a response similar to the following: 21 Aug 04:08:20 ntpdate[4824]: adjust time server 209.167.68.100 offset 0.017300 sec]]></description>
			<content:encoded><![CDATA[<p>In xubuntu (XFCE) you can run the following command to synchronize your system clock with time servers:</p>
<pre class="brush: bash;">
sudo ntpdate pool.ntp.org
</pre>
<p>After running this command you would get a response similar to the following:</p>
<pre class="brush: bash;">
21 Aug 04:08:20 ntpdate[4824]: adjust time server 209.167.68.100 offset 0.017300 sec
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1431</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Struts2 Iterating through a List of List</title>
		<link>http://www.thelogfile.com/blog/?p=1420#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1420#comments</comments>
		<pubDate>Thu, 22 Jul 2010 16:42:49 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Struts2]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1420</guid>
		<description><![CDATA[This is a simple example demonstrating how to use the iterator tag in struts2 to iterate through a list of objects which contains another list of objects. Assume that we have a class called City which contains a list of phone numbers: public class City { private String name; private List&#60;PhoneNumber&#62; phoneNumbers; public String getName() [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple example demonstrating how to use the iterator tag in struts2 to iterate through a list of objects which contains another list of objects.<br />
Assume that we have a class called City which contains a list of phone numbers:</p>
<pre class="brush: java;">
public class City {
	private String name;
	private List&lt;PhoneNumber&gt; phoneNumbers;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List&lt;PhoneNumber&gt; getPhoneNumbers() {
		return phoneNumbers;
	}

	public void setPhoneNumbers(List&lt;PhoneNumber&gt; phoneNumbers) {
		this.phoneNumbers = phoneNumbers;
	}
}
</pre>
<p><span id="more-1420"></span><br />
So every city can have many phone numbers. Inside the PhoneNumber class we have</p>
<pre class="brush: java;">
public class PhoneNumber {

	private String prefix;
	private double rate;

	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	public double getRate() {
		return rate;
	}

	public void setRate(double rate) {
		this.rate = rate;
	}

}
</pre>
<p>lets assume that we have an action that returns a list of all cities available. Something like the following:</p>
<pre class="brush: java;">
public class AllRatesAction extends ActionSupport {
	private static final long serialVersionUID = 1L;
	private List&lt;City&gt; allCities;

	//This is the List of cities passed to the JSP page
	public List&lt;City&gt; getAllCities() {
		return allCities;
	}

	public void setAllCities(List&lt;City&gt; allCities) {
		this.allCities = allCities;
	}

	public String execute() {
		//the content of what is happening inside getAllCallRates
		// is not related to this tutrial
		setAllCities(CallRatesDS.getAllCallRates());
		return SUCCESS;
	}

}
</pre>
<p>The following is how the iterator tags should be used to access the list of City objects and how to access the list of phone numbers inside every city. As you can see we basically create an object of every list and access them through the newly created objects.</p>
<pre class="brush: xml;">
&lt;table&gt;
&lt;s:iterator value=&quot;allCities&quot; id=&quot;cities&quot;&gt;
	&lt;s:iterator value=&quot;#city.phoneNumbers&quot; id=&quot;number&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;
		&lt;!-- Accessing the city name through the city variable --&gt;
			&lt;s:property value=&quot;#city.name&quot; /&gt;
		&lt;/td&gt;
		&lt;td&gt;
			&lt;!-- Accessing the objects inside the phone number object through the number variable --&gt;
			&lt;s:property value=&quot;#number.prefix&quot; /&gt;
		&lt;/td&gt;
		&lt;td&gt;
			&lt;s:property value=&quot;#number.rate&quot; /&gt;
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;/s:iterator&gt;
&lt;/s:iterator&gt;
&lt;/table&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1420</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plain-text encryption/decryption in Java</title>
		<link>http://www.thelogfile.com/blog/?p=1415#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1415#comments</comments>
		<pubDate>Mon, 19 Jul 2010 17:53:30 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1415</guid>
		<description><![CDATA[There could be cases in which you are planning to keep some sensitive data in your database but you do not wish to have this information available to anyone (not even the DBA should be able to see the content) except the specific user. To do this you can encrypt the sensitive plan-text provided by [...]]]></description>
			<content:encoded><![CDATA[<p>There could be cases in which you are planning to keep some sensitive data in your database but you do not wish to have this information available to anyone (not even the DBA should be able to see the content) except the specific user. To do this you can encrypt the sensitive plan-text provided by the user. Save the encrypted message in the database and decrypt it anytime the user would like to view/edit the data. Doing this is quite easy with java. You would just need to add a few jar files to your project and a few lines of code to encrypt and decrypt the data.</p>
<p>The libraries you need to download are available at: <a href="http://www.jasypt.org/">http://www.jasypt.org/</a><br />
The following sample code encrypts and decrypts a String. Please not that I have created an object of BasicTextEncryptor twice the reason for that is to show that you would need to set the correct password used in the encryption process to decrypt the plain-text message.</p>
<pre class="brush: java;">
import org.jasypt.util.text.BasicTextEncryptor;

public class Secret {

	public static void main(String[] args) {

		String userPassword=&quot;PassWord&quot;;
		String message = &quot;Some text which is to be encrypted by the user password. Later it is decrypted to the original plain-text using the same password.&quot;;

		//Encrypt
		BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
		textEncryptor.setPassword(userPassword);
		String myEncryptedText = textEncryptor.encrypt(message);
		System.out.println(&quot;Encrypted text:\n&quot;+myEncryptedText);

		//Decrypt
		BasicTextEncryptor textDecryptor = new BasicTextEncryptor();
		textDecryptor.setPassword(userPassword);
		String plainText = textDecryptor.decrypt(myEncryptedText);

		System.out.println(&quot;Decrypted text:\n&quot;+plainText);
	}

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1415</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting/Update a long String into a CLOB in Oracle database</title>
		<link>http://www.thelogfile.com/blog/?p=1407#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1407#comments</comments>
		<pubDate>Wed, 26 May 2010 16:54:46 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1407</guid>
		<description><![CDATA[Inserting a long String into a CLOB field in Oracle database using SQL queries is quite simple, but at the same time can be confusing. Mainly because personally couldn&#8217;t find good tutorials on the web when I was trying to do this. Here is a simple way to do it: To insert a ClOB field [...]]]></description>
			<content:encoded><![CDATA[<p>Inserting a long String into a CLOB field in Oracle database using SQL queries is quite simple, but at the same time can be confusing. Mainly because personally couldn&#8217;t find good tutorials on the web when I was trying to do this. Here is a simple way to do it:<br />
To insert a ClOB field you need to have a good query browser. The reason is that I will be using variables to do this, I was not able to do this using DbVisualizer but it works perfectly fine in TOAD.<br />
Here is how to do it:</p>
<pre class="brush: sql;">
-- First: you need to declare a variable to hold the long CLOB value.
declare
clobVariable varchar2(32767) :='YOUR LONG CLOB VALUE GOES HERE';

begin
-- ALL the queries you need to run as to be inside the begin tag.
-- As you can see I'm using the variable 'clobVariable' in the insert statement to insert into the table.
-- You can use this variable in any combination of SQL statements.

insert into sometbale(id,clob_column) values(1,clobVariable);
end;
/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1407</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XFCE &#8211; XUBUNTU</title>
		<link>http://www.thelogfile.com/blog/?p=1401#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1401#comments</comments>
		<pubDate>Wed, 26 May 2010 14:32:47 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1401</guid>
		<description><![CDATA[First time I installed xfce on my laptop I was surprised with how light and stable it was. I have been using XFCE for more than 2 years now I would have to say that its great. I would strongly recommend it specially if you don&#8217;t have a really powerful machine like me. To customize [...]]]></description>
			<content:encoded><![CDATA[<p>First time I installed xfce on my laptop I was surprised with how light and stable it was. I have been using XFCE for more than 2 years now I would have to say that its great. I would strongly recommend it specially if you don&#8217;t have a really powerful machine like me. To customize it the way you like its obviously a little different from Gnome but once you can used to it you would see how easy it is. Here is a screen-shot of my desktop:<br />
<a href='http://kohantech.com/Blog-pics/xubuntu_linux_desktop.png'><img src='http://kohantech.com/Blog-pics/xubuntu_linux_desktop.png' width='500'></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1401</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu change computer name</title>
		<link>http://www.thelogfile.com/blog/?p=1398#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1398#comments</comments>
		<pubDate>Sun, 18 Apr 2010 03:51:16 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1398</guid>
		<description><![CDATA[If you would like to change your computer name in Ubuntu Linux you would need to modify two files: First you would need to change hostname file: sudo vi /etc/hostname This file contains your existing computer name. You can change it to anything you like. The next step is to modify the hosts file: sudo [...]]]></description>
			<content:encoded><![CDATA[<p>If you would like to change your computer name in Ubuntu Linux you would need to modify two files:<br />
First you would need to change hostname file:</p>
<pre class="brush: bash;">
sudo vi /etc/hostname
</pre>
<p>This file contains your existing computer name. You can change it to anything you like.<br />
The next step is to modify the hosts file:</p>
<pre class="brush: bash;">
sudo vi /etc/hosts
</pre>
<p>Inside this file look for the entry starting with:<br />
127.0.1.1<br />
You would need to change the name in this line to whatever you change to in the first file name.<br />
If you don&#8217;t do the second step your computer name would still be changed but you would get the error message &#8220;unable to resolve host&#8221; everything you login to your account.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1398</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQL insert row if doesn&#8217;t exist</title>
		<link>http://www.thelogfile.com/blog/?p=1384#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1384#comments</comments>
		<pubDate>Fri, 16 Apr 2010 13:37:14 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1384</guid>
		<description><![CDATA[There are cases in which you like to insert rows into the database only if it doesn&#8217;t exist. There are databases that allow you to insert conditions into the SQL to test the number of rows in the table and insert the new row only of there are no rows currently in the table. But [...]]]></description>
			<content:encoded><![CDATA[<p>There are cases in which you like to insert rows into the database only if it doesn&#8217;t exist. There are databases that allow you to insert conditions into the SQL to test the number of rows in the table and insert the new row only of there are no rows currently in the table. But unfortunately you cant do that with many other databases.<br />
Here is a simple way to use regular SQL notations to insert rows into the database table only if it doesn&#8217;t exit.<br />
lets assume you have a table called <b>users</b> with the following schema:</p>
<table>
<tr>
<td>name(varchar)</td>
</tr>
<tr>
<td>family(varchar)</td>
</tr>
<tr>
<td>email(varchar)</td>
</tr>
</table>
<p>lets assume we are interested in inserting a row with the following values only if it doesn&#8217;t exist in the database table:<br />
name: Pourya<br />
family: Shahroudi<br />
email: something@something.com</p>
<pre class="brush: java;">
INSERT INTO USERS(name,family,email)
SELECT 'Pourya', 'Shahroudi','something@something.com' FROM USERS
WHERE NOT EXISTS(
    SELECT name,family,emial FROM USERS
    WHERE name='Pourya'
    AND family='Shahroudi' and email='something@something.com'
) and ROWNUM = 1;
</pre>
<p>As you can see this query does a SELECT on the database table with the values we want to insert if this row doesn&#8217;t exist then they are inserted into the database table.<br />
NOTE: &#8220;<b>ROWNUM = 1</b>&#8221; is extremely important in this query if you don&#8217;t have this included the query will try to insert as many records as you currently have in the table into the table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1384</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Removing ^M character GVIM windows</title>
		<link>http://www.thelogfile.com/blog/?p=1380#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1380#comments</comments>
		<pubDate>Wed, 14 Apr 2010 18:55:09 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1380</guid>
		<description><![CDATA[&#8216;^M&#8217; is end of line character in Linux, when you edit files created in Linux in other environments you might see the &#8216;^M&#8217; character. To remove ^M character in GVIM windows you should do: :%s/^M//g &#8216;^M&#8217; is CONTROL-V. Once you enter it will search your document and it removes all instances of ^M character from [...]]]></description>
			<content:encoded><![CDATA[<p>&#8216;^M&#8217; is end of line character in Linux, when you edit files created in Linux in other environments you might see the &#8216;^M&#8217; character.<br />
To remove ^M character in GVIM windows you should do:</p>
<pre class="brush: bash;">
:%s/^M//g
</pre>
<p>&#8216;^M&#8217; is CONTROL-V. Once you enter it will search your document and it removes all instances of ^M character from the file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1380</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VI tips</title>
		<link>http://www.thelogfile.com/blog/?p=1373#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1373#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:17:58 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1373</guid>
		<description><![CDATA[Here are some beginners tips to VI editor: To change the color scheme in vi just do: colorscheme torte which changes your color shema to torte. To see the available color schemes you could use key. To change the font in vi editor you would have to do: set guifont=Lucida\ Console:h10 Please note that &#8216;\&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some beginners tips to VI editor:</p>
<p>To change the color scheme in vi just do:</p>
<pre class="brush: bash;">
colorscheme torte
</pre>
<p>which changes your color shema to torte. To see the available color schemes you could use <tab> key.</p>
<p>To change the font in vi editor you would have to do:</p>
<pre class="brush: bash;">
set guifont=Lucida\ Console:h10
</pre>
<p>Please note that &#8216;\&#8217; is being used before every space character in the font name.<br />
setting the line numbers:</p>
<pre class="brush: bash;">
set number
</pre>
<p>To highlight the search result in the current doument:</p>
<pre class="brush: bash;">
set hlsearch
</pre>
<p>To have this change made every time you start vi you would need to add it anywhere in vimrc file. In Linux its under /etc/vim/ and in windows its inside the installation folder in &#8220;program files&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1373</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PySDM &#8211; Storage Device Manager</title>
		<link>http://www.thelogfile.com/blog/?p=1367#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.thelogfile.com/blog/?p=1367#comments</comments>
		<pubDate>Sun, 28 Mar 2010 16:11:43 +0000</pubDate>
		<dc:creator>Pourya Shahroudi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Fstab]]></category>

		<guid isPermaLink="false">http://kohantech.com/blog/?p=1367</guid>
		<description><![CDATA[To auto-mount storage devices in Linux normally you would need to edit /etc/fstab file, which sometimes can be quite difficult specially if you are a Linux newbie. To make things easier you can look into using a software called PySDM which does exactly what you need to do with a nice user interface. Using this [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://pysdm.sourceforge.net/screenshots/fstab_04.png' alt='PySDM' width='550'><br/><br />
To auto-mount storage devices in Linux normally you would need to edit /etc/fstab file, which sometimes can be quite difficult specially if you are a Linux newbie. To make things easier you can look into using a software called <a href='http://pysdm.sourceforge.net/' taget='_blank'>PySDM</a> which does exactly what you need to do with a nice user interface. Using this tool you can easily manage your mount points.<br />
to Install PySDM:</p>
<pre class="brush: bash;">
sudo apt-get install pysdm
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thelogfile.com/blog/?feed=rss2&amp;p=1367</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
