<?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>Sriunplugged</title>
	<atom:link href="http://blog.sriunplugged.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sriunplugged.com</link>
	<description>The place where I share my experiments on my computer</description>
	<lastBuildDate>Wed, 20 Feb 2013 05:03:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Download PHD Comics,XKCD and DogHouseDiaries for Offline Viewing (E-book Reader)</title>
		<link>http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/</link>
		<comments>http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/#comments</comments>
		<pubDate>Wed, 20 Feb 2013 05:03:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[comics]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[kindle]]></category>
		<category><![CDATA[offline]]></category>
		<category><![CDATA[paperwhite]]></category>
		<category><![CDATA[pdf covert]]></category>
		<category><![CDATA[reading]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=427</guid>
		<description><![CDATA[If you are like me who wants to read comics on kindle then this is the script for you. You can download all the comics to read it in a kindle. So here is how you do you do it. Download all the comics into 3 different folder s for each comic set by running [...]]]></description>
				<content:encoded><![CDATA[<p>If you are like me who wants to read comics on kindle then this is the script for you. You can download all the  comics to read it in a kindle. So here is how you do you do it. Download all the comics into 3 different folder s for each comic set by running the following scripts.</p>
<p><span id="more-427"></span></p>
<p><strong>PHD Comics</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
for i in {1..1557} # Or whichever is the current biggest comic number
do
	curl -s http://www.phdcomics.com/comics/archive.php?comicid=$i|grep &quot;&lt;td bgcolor=#FFFFFF align=center&gt;&lt;img src=http://www.phdcomics.com/comics/archive/&quot;|sed s'/[ ]*&lt;td bgcolor=#FFFFFF align=center&gt;&lt;img src=//'|sed 's/ align=top&gt;.*//'|xargs wget -O $i.gif
done
</pre>
<p><strong>XKCD</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
for i in {1..1170}
do
curl http://xkcd.com/$i/|grep &quot;&lt;img src=&quot;http://imgs.xkcd.com/comics/&quot;|sed 's/&lt;img src=&quot;//'|sed 's/&quot; title=.*//'|xargs wget -O $i.png
done
</pre>
<p><strong>The Doghouse Diaries</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
for i in `curl http://thedoghousediaries.com/archive| grep &quot;rel=&quot;bookmark&quot;&quot;|sed 's/.*&lt;a href=&quot;([^&quot;]*)&quot;.*/1/'`
do
curl $i|grep &quot;class=&quot;comic-item&quot;|sed 's/.*&lt;img src=&quot;([^&quot;]*)&quot;.*/1/'|xargs wget
done
</pre>
<p>And now run the following command to create a HTML page which has all the images.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
echo &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;The Dog House Diaries&lt;/title&gt;&lt;body&gt;&quot;
for i in `ls`
do
echo &quot;&lt;div&gt;&lt;img src=&quot;$i&quot; /&gt;&lt;/div&gt;&quot;
done
echo &quot;&lt;/body&gt;&lt;html&gt;&quot;
</pre>
<p>Pipe the output to a file say <em>comic.html</em>. You can send this comic file to kindle using send to kindle option in your browser or use Calibre which accepts html page and converts into your e-book reader format</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Java</div><div  class="related">
<a Href="http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/" >Batch Insert/Update For Mysql In Java</a><br>
</div><script type="text/javascript"><!--
			google_ad_client = "pub-1617770119804105";
			/* Sriunplugged blog related link */
			google_ad_slot = "6433780751";
			google_ad_width = 200;
			google_ad_height = 90;
			//-->
			</script>
			<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
			</script><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Mysql-Remove-Decimal' >Mysql Remove Decimal</a><br>
<a href='http://blog.sriunplugged.com/post/Sort-By-Nth-Column-Then-N-1th-Column-Using-Shell' >Sort By Nth Column Then N-1th Column Using Shell</a><br>
<a href='http://blog.sriunplugged.com/post/Trim-Zeros-After-Decimal-Point-With-Php' >Trim Zeros After Decimal Point With Php</a><br>
<a href='http://blog.sriunplugged.com/post/Is-There-A-Way-To-See-If-A-Gmail-User-Has-Talk' >Is There A Way To See If A Gmail User Has Talk</a><br>
<a href='http://blog.sriunplugged.com/post/Gmail-Invisible-Check' >Gmail Invisible Check</a><br>
</div><div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/" >More Than 100% CPU In Top In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Google</div><div  class="related">
<a Href="http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/" >Enable Multiple Login In Same Account In Gmail</a><br>
</div><div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/" >Auto Backup Using Dropbox In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/" >User Level Threads</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batch Insert/Update for Mysql in Java</title>
		<link>http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/</link>
		<comments>http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/#comments</comments>
		<pubDate>Wed, 06 Feb 2013 22:09:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[batch update]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=422</guid>
		<description><![CDATA[Large inserts/Updates are a costly operation. One foolish way that I used to do is to run each update or insert query one at a time. Its incredibly slow. With most of the systems currently the latency is what is killing the performance not the CPU. Hence latency per query is really really slow. One [...]]]></description>
				<content:encoded><![CDATA[<p>Large inserts/Updates are a costly operation. One foolish way that I used to do is to run each update or insert query one at a time. Its incredibly slow. With most of the systems currently the latency is what is killing the performance not the CPU. Hence latency per query is really really slow. One way to speed it up is to use the Batch query in Java. It gives you the advantages of prepared statements and more over sends batch of query to mysql and there by making it incredibly fast. How fast? One by one query insert takes around 3 hours for a 8 million inserts, while batch inserts with a batch of 1000 gets done in less than 5mins. Here is the a sample code to it.</p>
<p><span id="more-422"></span></p>
<pre class="brush: java; title: ; notranslate">

Connection con = null;
String db = &quot;testDB&quot;;
String url = &quot;jdbc:mysql://localhost:3306/&quot;;
String driver = &quot;com.mysql.jdbc.Driver&quot;;
try{
	  Class.forName(driver);
	  con = DriverManager.getConnection(url+db+&quot;?autoReconnect=true&quot;,&quot;root&quot;,&quot;&quot;);
	  String sql =&quot;INSERT INTO Table VALUES ( ? )&quot;;
	  PreparedStatement stmt = con.prepareStatement( sql );
	  Iterator&lt;String&gt; nameItr = nameList.iterator();
	  while(nameItr.hasnext()){
	  	stmt.setString( 1, name );
	  	stmt.addBatch();
		if((i+1) % 1000 == 0){
			stmt.executeBatch();
			con.commit();
		}
	  }
 	 stmt.executeBatch();
	 con.commit();
}catch (Exception e){
  e.printStackTrace();
}

</pre>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/important-mysql-dba-interview-questions/">Important MySQL DBA Interview Questions</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Gnome-Reminder-Popup' >Gnome Reminder Popup</a><br>
<a href='http://blog.sriunplugged.com/post/Mysql-Search-For-2nd-Word' >Mysql Search For 2nd Word</a><br>
<a href='http://blog.sriunplugged.com/post/Redhat-Change-Timezone-Command-Line' >Redhat Change Timezone Command Line</a><br>
<a href='http://blog.sriunplugged.com/post/Redhat-Repo-Add' >Redhat Repo Add</a><br>
<a href='http://blog.sriunplugged.com/post/Yum-Repo-Dvd' >Yum Repo Dvd</a><br>
</div><div id="related-heading">Posts on Mysql</div><div  class="related">
<a Href="http://blog.sriunplugged.com/mysql/nth-word-text-field-mysql/">Get The Nth Word From A Text Field In Mysql</a><br>
<a Href="http://blog.sriunplugged.com/mysql/display-row-number-mysql-select-query/">Display Row Number In Mysql Select Query</a><br>
<a Href="http://blog.sriunplugged.com/mysql/create-table-table-select-query/">Create A Table Like Another Table Or From A Select Query</a><br>
<a Href="http://blog.sriunplugged.com/mysql/customizing-mysql-prompt-for-multiple-servers/">Customizing Mysql Prompt For Multiple Servers</a><br>
<a Href="http://blog.sriunplugged.com/mysql/generate-date-range/">Generate Date From A Range In Mysql And Pad The Results Where No Date Is Present</a><br>
<a Href="http://blog.sriunplugged.com/mysql/1-1000-mysql/">Generate 1 To 1000 In Mysql</a><br>
<a Href="http://blog.sriunplugged.com/mysql/check-port-mysql-running/">Check The Port In Which The Mysql Is Running On</a><br>
<a Href="http://blog.sriunplugged.com/mysql/group-date-stored-mysql-database-date-time/">Group By Date When Stored In Mysql DataBase As Date Time</a><br>
<a Href="http://blog.sriunplugged.com/mysql/check-table-exists-mysql-php/">Check If A Table Exists In MySQL From PHP</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More than 100% CPU in top in Linux/Mac</title>
		<link>http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/</link>
		<comments>http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 23:20:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[interview]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[threads]]></category>
		<category><![CDATA[top]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=415</guid>
		<description><![CDATA[If you are power linux/mac user you should have noticed at least once that top shows more than 100% CPU for a process. I also have seen this multiple times but always wondered how it can be. Here is an example of how my top looked when I started my java and was doing some [...]]]></description>
				<content:encoded><![CDATA[<p>If you are power linux/mac user you should have noticed at least once that top shows more than 100% CPU for a process. I also have seen this multiple times but always wondered how it can be. Here is an example of how my top looked when I started my java and was doing some number crunching.</p>
<p><span id="more-415"></span></p>
<p><a href="http://blog.sriunplugged.com/wp-content/uploads/2011/11/Screen-Shot-2011-11-19-at-4.04.41-PM.png"><img class="aligncenter size-medium wp-image-416" title="System Statistics of Top" src="http://blog.sriunplugged.com/wp-content/uploads/2011/11/Screen-Shot-2011-11-19-at-4.04.41-PM-147x300.png" alt="" width="147" height="300" /></a>Recently I did a bit of research and got to the bottom of this. So here is the reason for it. A process is said to be using 100% CPU if it uses a processor to the limit that processor goes ie it completely uses that CPU without giving any idle/free time for that CPU. Now consider the situation that we have a multi core CPU. What if the process has more than one thread ? Well if so there is a chance that the threads can be split between two cores. So if 100% is one CPU running at maximum power, then what is one CPU at maximum power and other using 10% of its computing power? Its 100% + 10% = 110%. That&#8217;s how the magical more than 100% CPU value comes in.</p>
<p>It need not be the case that one CPU should be at 100% and another should be doing some other thread of the same process. It can be that two processes can be working 50% and 60% power which again would add up to 110%. The above image shows the 4 cores of my machine and it is clear that none of the processor is in 100%.  But if all  four cores execute a thread each the sum adds up to 104.3%</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/">Auto Backup Using Dropbox In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/linux/automatic-command-archive/">Automatic Command Archive</a><br>
<a Href="http://blog.sriunplugged.com/linux/how-to-save-file-in-vi-not-opened-with-sudo/">How To Save File In Vi Not Opened With Sudo</a><br>
<a Href="http://blog.sriunplugged.com/linux/auto-copy-cd/">Script For Auto Copying Of Cds/Dvds</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Rhel-Add-Dvd-Repositories' >Rhel Add Dvd Repositories</a><br>
<a href='http://blog.sriunplugged.com/post/Dvd-Repositorio-Redhat' >Dvd Repositorio Redhat</a><br>
<a href='http://blog.sriunplugged.com/post/Access-Database-Group-By-Day-Date' >Access Database Group By Day Date</a><br>
<a href='http://blog.sriunplugged.com/post/Find-Gmail-Blocked-User' >Find Gmail Blocked User</a><br>
<a href='http://blog.sriunplugged.com/post/People-Search-Gmail' >People Search Gmail</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/">User Level Threads</a><br>
</div><div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/">Service Engineer/System Administrator Interview Questions</a><br>
<a Href="http://blog.sriunplugged.com/interview/operator-preference-grouping-order/">Operator Preference Grouping Order In C</a><br>
<a Href="http://blog.sriunplugged.com/interview/important-mysql-dba-interview-questions/">Important MySQL DBA Interview Questions</a><br>
</div><div id="related-heading">Posts on Acpi</div><div  class="related">
<a Href="http://blog.sriunplugged.com/acpi/auto-away-notifier-for-pidgin-in-perl/">Auto Away Notifier For Pidgin In Perl</a><br>
<a Href="http://blog.sriunplugged.com/acpi/bsnl-dataone-auto-downloader/">BSNL Dataone Auto Downloader</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Multiple Login in Same Account in Gmail</title>
		<link>http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/</link>
		<comments>http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 19:43:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[muti user]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=406</guid>
		<description><![CDATA[Gmail recently started merging its App accounts to Gmail. Hence you wont be able to login into both the accounts in the same browser now. Here is a way on which you can still do it. This can be done for people who have multiple gmail accounts and want to be able to switch between [...]]]></description>
				<content:encoded><![CDATA[<p>Gmail recently started merging its App accounts to Gmail. Hence you wont be able to login into both the accounts in the same browser now. Here is a way on which you can still do it. This can be done for people who have multiple gmail accounts and want to be able to switch between each of that in same browser.</p>
<p><span id="more-406"></span></p>
<p>First login with the gmail account you want to merge with the primary gmail account(ie login into the secondary gmail account). Go to account settings from the menu on top.</p>
<p><a href="http://blog.sriunplugged.com/wp-content/uploads/2011/11/account-settings.jpg"><img src="http://blog.sriunplugged.com/wp-content/uploads/2011/11/account-settings.jpg" alt="" title="account settings" width="198" height="124" class="aligncenter size-full wp-image-408" /></a></p>
<p>In the Account Settings Edit the multiple sign in option and on it by enabling all the check boxes below it. Now sign out from this account and follow the same procedure in the primary gmail account.</p>
<p>Once done you should get a switch account option in the Mail Menu on the top.<br />
<a href="http://blog.sriunplugged.com/wp-content/uploads/2011/11/Switch-Account.jpg"><img src="http://blog.sriunplugged.com/wp-content/uploads/2011/11/Switch-Account.jpg" alt="" title="Switch Account" width="200" height="159" class="aligncenter size-full wp-image-407" /></a><br />
Click on Switch account and select the option sign into another account. This should take you to the gmail login page. Sign into your secondary account. Once you did that the accounts are linked and you should be able to able to select either from the switch account option. </p>
<p><a href="http://blog.sriunplugged.com/wp-content/uploads/2011/11/switch.jpg"><img src="http://blog.sriunplugged.com/wp-content/uploads/2011/11/switch-300x181.jpg" alt="" title="switch" width="300" height="181" class="aligncenter size-medium wp-image-410" /></a><br />
If you need both of them open on the same browser, just right click on the account you want to open in the switch account option and open in a new tab. This allows you to open both of the account in the same browser at a time.</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Bash</div><div  class="related">
<a Href="http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/" >Download PHD Comics,XKCD And DogHouseDiaries For Offline Viewing (E-book Reader)</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Mysql-Search-For-2nd-Word' >Mysql Search For 2nd Word</a><br>
<a href='http://blog.sriunplugged.com/post/Rhel-Add-Dvd-Repositories' >Rhel Add Dvd Repositories</a><br>
<a href='http://blog.sriunplugged.com/post/Google-Chat-Invisible' >Google Chat Invisible</a><br>
<a href='http://blog.sriunplugged.com/post/Remove-The-Trailing-Decimals-Inquantity-Field-In-Salesforce' >Remove The Trailing Decimals Inquantity Field In Salesforce</a><br>
<a href='http://blog.sriunplugged.com/post/Redhat-Add-Cd-As-Repository' >Redhat Add Cd As Repository</a><br>
</div><div id="related-heading">Posts on Java</div><div  class="related">
<a Href="http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/" >Batch Insert/Update For Mysql In Java</a><br>
</div><div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/" >More Than 100% CPU In Top In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/" >Auto Backup Using Dropbox In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/" >User Level Threads</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto Backup using Dropbox in Linux/Mac</title>
		<link>http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/</link>
		<comments>http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 19:17:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dropbox]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=398</guid>
		<description><![CDATA[I had some folders on my disk which I wanted to keep a copy online as a backup and for viewing from other places. Its not always possible to save all the essentials in the drop box folder itself to be auto backed up. Thus I wrote a very small script which does this for [...]]]></description>
				<content:encoded><![CDATA[<p>I had some folders on my disk which I wanted to keep a copy online as a backup and for viewing from other places. Its not always possible to save all the essentials in the drop box folder itself to be auto backed up. Thus I wrote a very small script which does this for me. All it does is read all the folders which needs to be backed up from the text file &#8220;dropboxFolders.txt&#8221; and copy them to dropbox folder. The rest is done by dropbox scripts. Hence I expect the dropbox program to be running always in the background. So here is the script:</p>
<p><span id="more-398"></span></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
foldersInfo=&quot;dropboxFolders.txt&quot;
dropboxFolder=&quot;/home/&lt;user&gt;/Dropbox/&quot;
while read line
do
from=`echo &quot;$line&quot; | cut -d&quot;:&quot; -f1`
to=`echo &quot;$line&quot; | cut  -d&quot;:&quot; -f2`
echo $from&quot; to &quot;$to
mkdir -p &quot;$dropboxFolder$to&quot;
cp -R &quot;$from&quot; &quot;$dropboxFolder$to&quot;
done &lt;$foldersInfo
</pre>
<p>The file dropboxFolders.txt should be in the format <Full Path of From Folder>:<To folder inside dropbox folder>. Here is an example of the file:</p>
<pre class="brush: bash; title: ; notranslate">
/home/&lt;user&gt;/WorkingCode:WorkingCode
</pre>
<p>And now all you need to do is cron the shell script file as in the blog post on <a href="blog.sriunplugged.com/shell-scripting/automatic-command-archive/" title="Automatic Command Archive">Automatic Command Archive</a></p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/">More Than 100% CPU In Top In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/">Service Engineer/System Administrator Interview Questions</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Php-How-To-Remove-Teh-Zero-After-Decimal' >Php How To Remove Teh Zero After Decimal</a><br>
<a href='http://blog.sriunplugged.com/post/Redhat-Repositories-In-Dvd' >Redhat Repositories In Dvd</a><br>
<a href='http://blog.sriunplugged.com/post/Mount-Dvd-In-Redhat' >Mount Dvd In Redhat</a><br>
<a href='http://blog.sriunplugged.com/post/Remove-Trailing-Zeros-In-Decimal-Field-Ssrs' >Remove Trailing Zeros In Decimal Field Ssrs</a><br>
<a href='http://blog.sriunplugged.com/post/Remove-Decimal-And-Trailing-Zero-Column-Perl' >Remove Decimal And Trailing Zero Column Perl</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/">User Level Threads</a><br>
</div><div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/automatic-command-archive/">Automatic Command Archive</a><br>
<a Href="http://blog.sriunplugged.com/linux/how-to-save-file-in-vi-not-opened-with-sudo/">How To Save File In Vi Not Opened With Sudo</a><br>
<a Href="http://blog.sriunplugged.com/linux/auto-copy-cd/">Script For Auto Copying Of Cds/Dvds</a><br>
<a Href="http://blog.sriunplugged.com/linux/copy-linux-ui/">Copy In Linux With Ui</a><br>
</div><div id="related-heading">Posts on Acpi</div><div  class="related">
<a Href="http://blog.sriunplugged.com/acpi/auto-away-notifier-for-pidgin-in-perl/">Auto Away Notifier For Pidgin In Perl</a><br>
<a Href="http://blog.sriunplugged.com/acpi/bsnl-dataone-auto-downloader/">BSNL Dataone Auto Downloader</a><br>
</div><div id="related-heading">Posts on Gnome</div><div  class="related">
<a Href="http://blog.sriunplugged.com/gnome/display-reminders-in-gnome-panel/">Display Reminders In Gnome Panel</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Level Threads</title>
		<link>http://blog.sriunplugged.com/assginment/user-level-threads/</link>
		<comments>http://blog.sriunplugged.com/assginment/user-level-threads/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 07:57:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Assginment]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[light weight]]></category>
		<category><![CDATA[swapcontext]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=392</guid>
		<description><![CDATA[User level threads is created for light weight threads. It needs to be controlled, context switched and swapped by the process. To the Operating System it is only one process without any threads. Here is one implementation of it: q.h tcb.h threads.h &#160; thread_test.c &#160; Related Posts: Posts on Interview More Than 100% CPU In [...]]]></description>
				<content:encoded><![CDATA[<p>User level threads is created for light weight threads. It needs to be controlled, context switched and swapped by the process. To the Operating System it is only one process without any threads. Here is one implementation of it:</p>
<p><span id="more-392"></span></p>
<p><strong>q.h</strong></p>
<pre class="brush: cpp; title: ; notranslate">

#include &quot;TCB.h&quot;



TCB_t *initQ () {
TCB_t *Q = NULL;
return Q;
}

void AddQ(TCB_t *tcb,TCB_t **Q) {

TCB_t *first,*last;
if(*Q == NULL ) {
tcb -&gt; prev = tcb;
tcb -&gt; next = tcb;
*Q = tcb;
return;
}
else {
first = *Q; // 1st node from the head
last = first -&gt; prev; // last node as its prev of 1st

// completeing the Circular Queue
tcb -&gt; next = first;
tcb -&gt; prev = last;

first -&gt; prev = tcb;
last -&gt; next = tcb;
}
}

TCB_t *DelQ(TCB_t **Q) {
if(*Q == NULL) {
printf(&quot;Queue Emptyn&quot;);
return NULL;
}
TCB_t *curr,*last,*first;
curr = *Q ;
first = curr; // the element to be removed
last = curr -&gt; prev; // last element
curr = curr-&gt; next; // 2nd element whihc will be 1st
last -&gt; next = curr; // remove last's link from 1st to 2nd
curr -&gt; prev = last; // remove 2nd's link from first to last
first -&gt; next = first -&gt; prev = NULL; // remove all links of 1st to remove dangling pointer
if(first == last)
*Q = NULL; // removing last element so Q empty
else
*Q = curr; //Change starting point of the Q to 2nd value from 1st
return first;
}

TCB_t *RotateQ(TCB_t **Q) {
TCB_t *curr = *Q;
curr = curr -&gt; next;
*Q = curr;
return curr;
}

void printQ(TCB_t *Q) {
printf(&quot;Queue Contains the Functions:&quot;);
TCB_t *curr;
int i = 1;
curr = Q;
if(curr == NULL) {
printf(&quot;Queue Emptyn&quot;);
return;
}
do{
printf(&quot;%d &quot;,curr -&gt; i);
curr = curr -&gt; next;
}while(curr != Q);
printf(&quot;n&quot;);
}
</pre>
<p><strong>tcb.h</strong></p>
<pre class="brush: cpp; title: ; notranslate">

#include &lt;ucontext.h&gt;
#include &lt;string.h&gt;

struct TCB {
ucontext_t context;
int i;
struct TCB *next, *prev;
};
typedef struct TCB TCB_t;


void init_TCB (TCB_t *tcb, void *function, void *stackP, int stack_size)
// arguments to init_TCB are
//   1. pointer to the function, to be executed
//   2. pointer to the thread stack
//   3. size of the stack
{
memset(tcb, '&#92;&#48;', sizeof(TCB_t));       // wash, rinse
getcontext(&amp;tcb-&gt;context);              // have to get parent context, else snow forms on hell
tcb-&gt;context.uc_stack.ss_sp = stackP;
tcb-&gt;context.uc_stack.ss_size = (size_t) stack_size;
makecontext(&amp;tcb-&gt;context, function, 0);// context is now cooked
}

</pre>
<p><strong>threads.h</strong></p>
<pre class="brush: cpp; title: ; notranslate">

#include &quot;q.h&quot;
TCB_t *Q;
int count_threads = 0;
void start_thread(void (*function)(void))
{ // begin pseudo code
//allocate a stack (via malloc) of a certain size (choose 8192)
void *stackP = malloc(8192);
//allocate a TCB (via malloc)
TCB_t *tcb = (TCB_t *) malloc(sizeof(TCB_t));
//call init_TCB with appropriate arguments
init_TCB (tcb,function, stackP, 8192);
tcb -&gt; i = ++count_threads;
//call addQ to add this TCB into the “RunQ” which is a global header pointer
AddQ(tcb,&amp;Q);
printQ(Q);
printf(&quot;Thread %d Initialisedn&quot;,count_threads);
//end pseudo code
}

void run()
{
ucontext_t parent;     // get a place to store the main context, for faking
getcontext(&amp;parent);   // magic sauce
swapcontext(&amp;parent, &amp;(Q-&gt;context));  // start the first thread
}

void yield() // similar to run
{
printQ(Q);
//rotate the run Q;
TCB_t *curr = Q;
TCB_t *RunQ = RotateQ(&amp;Q);
//swap the context, from previous thread to the thread pointed to by runQ
printf(&quot;Switching from Thread %d to Thread %dn&quot;,curr-&gt;i,RunQ-&gt;i);
swapcontext(&amp;(curr -&gt; context), &amp;(RunQ-&gt;context));
}

void exitFunction() {
//rotate the run Q;
TCB_t *curr = Q;
DelQ(&amp;Q);
if(Q == NULL) return;
printQ(Q);
TCB_t *RunQ = Q;
//swap the context, from previous thread to the thread pointed to by runQ
printf(&quot;Exiting Thread %d to Thread %dn&quot;,curr-&gt;i,RunQ-&gt;i);
printQ(Q);
swapcontext(&amp;(curr -&gt; context), &amp;(RunQ-&gt;context));
}
</pre>
<p>&nbsp;</p>
<p><strong>thread_test.c</strong></p>
<pre class="brush: cpp; title: ; notranslate">

#include&lt;stdlib.h&gt;
#include &lt;stdio.h&gt;


#include &quot;threads.h&quot;
#define SLEEP_TIME 1

int global = 0;
int ID = 1;


void function() {
printf(&quot;Function Started 1st Timen&quot;);
fflush(stdout);
int local = 0;
int lID = ID++;
while(1)
{
printf(&quot;Function %d Runningn&quot;,lID);
sleep(SLEEP_TIME);
yield();
printf(&quot;Function %d Incrementing Local=%d,Global=%dn&quot;,lID,local++,global++);
sleep(SLEEP_TIME);
printf(&quot;Function %d Yieldsn&quot;,lID);
yield();
}
printf(&quot;Function %d Exitsn&quot;,lID);
exitFunction(&amp;Q);
}

void main(){
Q = initQ();
start_thread(function);
start_thread(function);
start_thread(function);
printQ(Q);
run();
}
</pre>
<p>&nbsp;</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/">More Than 100% CPU In Top In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/">Service Engineer/System Administrator Interview Questions</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Rhel-Yum-Repo-On-Cd' >Rhel Yum Repo On Cd</a><br>
<a href='http://blog.sriunplugged.com/post/Installing-Yum-From-Dvd-Redhat' >Installing Yum From Dvd Redhat</a><br>
<a href='http://blog.sriunplugged.com/post/Gmail-Chat-Invisible-Check' >Gmail Chat Invisible Check</a><br>
<a href='http://blog.sriunplugged.com/post/Eliminate-Trailing-Zero' >Eliminate Trailing Zero</a><br>
<a href='http://blog.sriunplugged.com/post/Slackware-Linux-Change-Timezone' >Slackware Linux Change Timezone</a><br>
</div><div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/">Auto Backup Using Dropbox In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/linux/automatic-command-archive/">Automatic Command Archive</a><br>
<a Href="http://blog.sriunplugged.com/linux/how-to-save-file-in-vi-not-opened-with-sudo/">How To Save File In Vi Not Opened With Sudo</a><br>
<a Href="http://blog.sriunplugged.com/linux/auto-copy-cd/">Script For Auto Copying Of Cds/Dvds</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/ontology-linked-data/">Ontology Linked Data</a><br>
</div><div id="related-heading">Posts on Acpi</div><div  class="related">
<a Href="http://blog.sriunplugged.com/acpi/auto-away-notifier-for-pidgin-in-perl/">Auto Away Notifier For Pidgin In Perl</a><br>
<a Href="http://blog.sriunplugged.com/acpi/bsnl-dataone-auto-downloader/">BSNL Dataone Auto Downloader</a><br>
</div><div id="related-heading">Posts on Gnome</div><div  class="related">
<a Href="http://blog.sriunplugged.com/gnome/display-reminders-in-gnome-panel/">Display Reminders In Gnome Panel</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/assginment/user-level-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cron a Django Program</title>
		<link>http://blog.sriunplugged.com/python/cron-django-program/</link>
		<comments>http://blog.sriunplugged.com/python/cron-django-program/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 21:48:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[import]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=383</guid>
		<description><![CDATA[One of the issue I faced while developing a website in Django was I always had a script which collects or data which is to be in the cron. But Django usually needs a lot of configurations and settings for the environment to run. So after some searches I got that django has an undocumented API [...]]]></description>
				<content:encoded><![CDATA[<p>One of the issue I faced while developing a website in Django was I always had a script which collects or data which is to be in the cron. But Django usually needs a lot of configurations and settings for the environment to run. So after some searches I got that django has an undocumented API of settings which we would use of the same. So here is a file which you could include for any file you would like to run as cron and this file would do the rest.</p>
<p><span id="more-383"></span></p>
<pre class="brush: python; title: ; notranslate">

import os, sys, re

top_level_rx = re.compile(r'^(/|[a-zA-Z]:\)$')
def is_top_level(path):
return top_level_rx.match(path) is not None

def prepare_environment():
# we'll need this script's directory for searching purposess
curdir, curfile = os.path.split(os.path.abspath(__file__))

# move up one directory at a time from this script's
# path, searching for settings.py
settings_module = None
while not settings_module:
try:
sys.path.append(curdir)
settings_module = __import__('settings', {}, {}, [''])
sys.path.pop()
break
except ImportError:
settings_module = None

# have we reached the top-level directory?
if is_top_level(curdir):
raise Exception(&quot;settings.py was not found in the script's directory or any of its parent directories.&quot;)

# move up a directory
curdir = os.path.normpath(os.path.join(curdir, '..'))

# set up the environment using the settings module
from django.core.management import setup_environ
setup_environ(settings_module)

prepare_environment()

</pre>
<p>Lets name this file as cron_settings.py . So each script which is to be inserted in cron can include this file as</p>
<pre class="brush: python; title: ; notranslate">

import cron_settings

</pre>
<p>And they should be good to run as cron.</p>
<p>There is also another method which I used to use. I moved from this method as it used to have the paths hard coded so it wasn&#8217;t portable but here it is:</p>
<pre class="brush: python; title: ; notranslate">

import django
import os
import sys

sys.path += ['/usr/bin/python']
sys.path += ['&lt;Django  Folder&gt;']
sys.path += ['&lt;Django Project Path&gt;']
os.environ['DJANGO_SETTINGS_MODULE'] = '&lt;DjangoProject&gt;.settings'

</pre>
<p>Well both works. So you could use the one which suits you more.</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Python</div><div  class="related">
<a Href="http://blog.sriunplugged.com/python/installing-django-dreamhost/">Installing Django On Dreamhost</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/ImportError:-No-Module-Named-Ssl-Xmpp2' >ImportError: No Module Named Ssl Xmpp2</a><br>
<a href='http://blog.sriunplugged.com/post/How-To-Create-A-Table-As-Like-Another-Table' >How To Create A Table As Like Another Table</a><br>
<a href='http://blog.sriunplugged.com/post/Repo-File-Dvd' >Repo File Dvd</a><br>
<a href='http://blog.sriunplugged.com/post/Show-When-Gchat-Users-Are-Invisible' >Show When Gchat Users Are Invisible</a><br>
<a href='http://blog.sriunplugged.com/post/Shell-Sorting-4th-Column' >Shell Sorting 4th Column</a><br>
</div><div id="related-heading">Posts on Bash</div><div  class="related">
<a Href="http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/" >Download PHD Comics,XKCD And DogHouseDiaries For Offline Viewing (E-book Reader)</a><br>
</div><div id="related-heading">Posts on Java</div><div  class="related">
<a Href="http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/" >Batch Insert/Update For Mysql In Java</a><br>
</div><div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/" >More Than 100% CPU In Top In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Google</div><div  class="related">
<a Href="http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/" >Enable Multiple Login In Same Account In Gmail</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/python/cron-django-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Service Engineer/System Administrator Interview Questions</title>
		<link>http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/</link>
		<comments>http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 21:48:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[interview]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell scripting]]></category>
		<category><![CDATA[administrator]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=377</guid>
		<description><![CDATA[This is not my code alone.  It was the group effort of Vivek Ram, Cijo George, Sandeep Unni and mine during our epic preparation for Yahoo!. I am just putting it open for others who would be looking for this information. Convert all lower case to upper and vice versa. tr &#8220;[a-z] [A-Z]&#8221; &#8220;[A-Z] [a-z]&#8221; [...]]]></description>
				<content:encoded><![CDATA[<p>This is not my code alone.  It was the group effort of <a title="Vivek Experiments" href="http://vivtech.blogspot.com/" target="_blank">Vivek Ram</a>, Cijo George, Sandeep Unni and mine during our epic preparation for Yahoo!. I am just putting it open for others who would be looking for this information.<span id="more-377"></span></p>
<ol>
<li>Convert all lower case to upper and vice versa.<br />
<strong>tr &#8220;[a-z] [A-Z]&#8221; &#8220;[A-Z] [a-z]&#8221; &lt; file</strong></li>
<li>print those lines with PRINT in it.On printing remove all small a.<br />
<strong>grep &#8216;PRINT&#8217; &lt; file | sed &#8216;s/a//g&#8217;</strong></li>
<li>Print only those lines starting with a number and end with a character.<br />
<strong>grep &#8220;^[0-9].*[A-Za-z]$&#8221; temp</strong></li>
<li>remove all double occurences of a character like aa-&gt;a<br />
<strong>sed &#8216;s/(.)1*/1/g&#8217; &lt; file</strong></li>
<li>Remove all double occurences of a word with single. eg: ABS ABS-&gt;ABS<br />
<strong>sed &#8216;s/([A-Za-z]* )1*/1/g&#8217; &lt; file</strong></li>
<li>Replace third occurence of word ABS with XYZ<br />
<strong>cat 6|tr &#8216;n&#8217; &#8216;$&#8217;|sed s/abs/xyz/3|tr &#8216;$&#8217; &#8216;n&#8217;</strong></li>
<li>Replace ABC-&gt;CED RTY-&gt;WWW<br />
<strong>sed &#8216;{s/ABC/CED/g;s/RTY/WWW/g;}</strong></li>
<li>If there are 3 lines such tat first line have &#8216;A&#8217;,second &#8216;B&#8217; and third &#8216;C&#8217; remove the lines.<br />
<strong>cat 5|tr &#8216;n&#8217; &#8216;$&#8217;|sed &#8216;s/[^$]*A[^$]*$[^$]*B[^$]*$[^$]*C[^$]*//&#8217;|tr &#8216;$&#8217; &#8216;n&#8217;</strong><br />
or<br />
<strong>sed &#8216;/A/ {N; /nn.*B/ { N;/n.*C/{s/.*//}}}&#8217; file |grep -v &#8220;^$&#8221;</strong></li>
<li>Print all lines except those from 20 to 30<br />
<strong>awk &#8216;NR&lt;20 {print $0} NR&gt;30 {print $0}&#8217; file</strong></li>
<li>Remove all C comments from a C file.<br />
<strong>sed &#8216;s///.*//&#8217; 4|tr &#8216;n&#8217; &#8216;$&#8217;|sed &#8216;s_/*[^*]**/_g&#8217;|tr &#8216;$&#8217; &#8216;n&#8217;</strong></li>
<li>Remove all blank lines from a file.<br />
<strong>grep -v &#8220;^$&#8221; file &gt; file</strong></li>
<li>Print total number of lines.<br />
<strong>cat filename | wc -l</strong></li>
<li>Print all lines from the line having MACS to 26th line<br />
<strong>awk &#8216;/MACS/,(NR==26) {print $0}&#8217; &lt; file</strong></li>
<li>If a line contain MEC enter &#8216;DATA&#8217; at the end of the line else enter &#8216;SATA&#8217; at the beginning.<br />
<strong>awk &#8216;/MEC/ {print $0,&#8221;DATA&#8221;;} !/MEC/ {print &#8220;SATA&#8221;,$0;}&#8217; filename</strong></li>
<li>If the line contain HI replace all a-&gt;b ad b-&gt;c and c-&gt;d<br />
<strong>sed &#8216;/HI/ {y/abc/bcd/;}&#8217; filename</strong></li>
<li>If a file contain word &#8216;XYZ&#8217; anywhere in it no matter how many times,print &#8216;Success&#8217; once.<br />
<strong>awk &#8216;/XYZ/ {print &#8220;SUCCESS&#8221;; exit 0;}&#8217; filename</strong></li>
<li>If a file has the word &#8216;ABC&#8217; first and somewhere else it has the word XYZ; print success only once.<br />
<strong>awk &#8216;/.*ABC.*XYZ.*/ {print &#8220;SUCCESS&#8221;; exit 0;}&#8217; filename</strong></li>
<li>Remove all n from the file<br />
<strong>tr -d &#8220;/n&#8221; &lt; file &gt; file</strong></li>
<li>Reverse all lines in a file.<br />
<strong>tac file</strong></li>
<li>Here&#8217;s a simple encryption algorithm that you can use to encode secret messages: shift every letter in the message 13 characters towards the end of the alphabet. (&#8220;a&#8221; becomes &#8220;n&#8221;; &#8220;b&#8221; becomes &#8220;o&#8221;; &#8220;x&#8221; loops around and becomes &#8220;k&#8221;; etc.) The beauty of this algorithm is that since the alphabet has 26 letters, you can also decrypt a message by repeating the process and shifting every letter in the message 13 characters towards the end of the alphabet. It&#8217;s often called &#8220;ROT 13&#8243; because the algorithm &#8220;rotates&#8221; each letter 13 places. Write a ROT 13 program that will accept a line of text, print the encrypted message, then decrypt the message and print the result. [Test: does your program work for uppercase and lowercase letters?]Ans:<br />
<strong>#!/usr/bin/perl -w</strong><br />
<strong>@in=&lt;&gt;;</strong><br />
<strong>foreach $var (@in)</strong><br />
<strong>{</strong><br />
<strong>@array=split(//,$var);</strong><br />
<strong>for($i=0;$i&lt;=$#array;$i++)</strong><br />
<strong>{</strong><br />
<strong>if($array[$i]=~/[A-Z]/)</strong><br />
<strong>{$d=ord($array[$i])+13-ord(&#8220;Z&#8221;);</strong><br />
<strong> if($d&gt;0){$w=ord(&#8220;A&#8221;)-1+$d;}</strong><br />
<strong> else    {$w=ord($array[$i])+13;}</strong><br />
<strong>}</strong><strong>elsif($array[$i]=~/[a-z]/) </strong><br />
<strong>{$d=ord($array[$i])+13-ord(&#8220;z&#8221;);</strong><br />
<strong> if($d&gt;0){$w=ord(&#8220;a&#8221;)-1+$d;}</strong><br />
<strong> else    {$w=ord($array[$i])+13;}</strong><br />
<strong>}</strong><br />
<strong>else {$w=ord($array[$i]);}</strong><br />
<strong> $w=chr($w);</strong><br />
<strong> print $w;</strong><br />
<strong>}</strong><br />
<strong>}</strong></li>
<li>User provides a date in command line.Print all files that have been modified before that date.Use perl.Assume the script is run in the native folder itself.Ans:<br />
<strong>#!/usr/bin/perl </strong><br />
<strong>@array=`ls -l`;</strong><br />
<strong>my $m;my $d;my $y;</strong><br />
<strong>$date=&lt;STDIN&gt;;</strong><br />
<strong>($y,$m,$d)=split(/-/,$date);</strong><br />
<strong>$date=$d+31*$m+365*$y;</strong><br />
<strong>foreach $line(@array)</strong><br />
<strong>{</strong><br />
<strong> @p=split(/s+/,$line);</strong><br />
<strong> ($y,$m,$d)=split(/-/,$p[5]);</strong><br />
<strong> $d2=$d+31*$m+365*$y;</strong><br />
<strong> if($d2&lt;$date)</strong><br />
<strong> {print $p[7],&#8221;n&#8221;;}</strong><br />
<strong>  @p=(); </strong><br />
<strong>}</strong></li>
</ol>
<p>Well there is lot more from this came from but those will be another blog post.</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/">More Than 100% CPU In Top In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/interview/operator-preference-grouping-order/">Operator Preference Grouping Order In C</a><br>
<a Href="http://blog.sriunplugged.com/interview/important-mysql-dba-interview-questions/">Important MySQL DBA Interview Questions</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Mysql-Dropping-Trailing-Zeros' >Mysql Dropping Trailing Zeros</a><br>
<a href='http://blog.sriunplugged.com/post/Gmail-Online-Check-Constantly' >Gmail Online Check Constantly</a><br>
<a href='http://blog.sriunplugged.com/post/Mysql-Group-By-Date-Most-Recent' >Mysql Group By Date Most Recent</a><br>
<a href='http://blog.sriunplugged.com/post/Find-Invisible-Users-On-Gchat' >Find Invisible Users On Gchat</a><br>
<a href='http://blog.sriunplugged.com/post/Sort-By-4th-Column' >Sort By 4th Column</a><br>
</div><div id="related-heading">Posts on Linux</div><div  class="related">
<a Href="http://blog.sriunplugged.com/linux/auto-backup-dropbox-linux-mac/">Auto Backup Using Dropbox In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/linux/automatic-command-archive/">Automatic Command Archive</a><br>
<a Href="http://blog.sriunplugged.com/linux/how-to-save-file-in-vi-not-opened-with-sudo/">How To Save File In Vi Not Opened With Sudo</a><br>
<a Href="http://blog.sriunplugged.com/linux/auto-copy-cd/">Script For Auto Copying Of Cds/Dvds</a><br>
</div><div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/">User Level Threads</a><br>
</div><div id="related-heading">Posts on Acpi</div><div  class="related">
<a Href="http://blog.sriunplugged.com/acpi/auto-away-notifier-for-pidgin-in-perl/">Auto Away Notifier For Pidgin In Perl</a><br>
<a Href="http://blog.sriunplugged.com/acpi/bsnl-dataone-auto-downloader/">BSNL Dataone Auto Downloader</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Operator Preference Grouping Order in C</title>
		<link>http://blog.sriunplugged.com/interview/operator-preference-grouping-order/</link>
		<comments>http://blog.sriunplugged.com/interview/operator-preference-grouping-order/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 20:22:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[interview]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[grouping]]></category>
		<category><![CDATA[operator]]></category>
		<category><![CDATA[ORDER]]></category>
		<category><![CDATA[preference]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=371</guid>
		<description><![CDATA[Here is a compilation of how the preference of operators are Left to Right grouping or Right to Left grouping in C. Level Operator Description Grouping 1 :: scope Left-to-right 2 () [] . -&#62; ++ -- dynamic_cast static_cast reinterpret_cast const_cast typeid postfix Left-to-right 3 ++ -- ~ ! sizeof new delete unary (prefix) Right-to-left [...]]]></description>
				<content:encoded><![CDATA[<p>Here is a compilation of how the preference of operators are Left to Right grouping or Right to Left grouping in C.<span id="more-371"></span></p>
<table>
<tbody>
<tr>
<th>Level</th>
<th>Operator</th>
<th>Description</th>
<th>Grouping</th>
</tr>
<tr>
<td>1</td>
<td><tt>::</tt></td>
<td>scope</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>2</td>
<td><tt>() [] . -&gt; ++ -- dynamic_cast static_cast reinterpret_cast const_cast typeid</tt></td>
<td>postfix</td>
<td>Left-to-right</td>
</tr>
<tr>
<td rowspan="3">3</td>
<td><tt>++ -- ~ ! sizeof new delete</tt></td>
<td>unary (prefix)</td>
<td rowspan="3">Right-to-left</td>
</tr>
<tr>
<td><tt>* &amp;</tt></td>
<td>indirection and reference (pointers)</td>
</tr>
<tr>
<td><tt>+ -</tt></td>
<td>unary sign operator</td>
</tr>
<tr>
<td>4</td>
<td><tt>(type)</tt></td>
<td>type casting</td>
<td>Right-to-left</td>
</tr>
<tr>
<td>5</td>
<td><tt>.* -&gt;*</tt></td>
<td>pointer-to-member</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>6</td>
<td><tt>* / %</tt></td>
<td>multiplicative</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>7</td>
<td><tt>+ -</tt></td>
<td>additive</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>8</td>
<td><tt>&lt;&lt; &gt;&gt;</tt></td>
<td>shift</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>9</td>
<td><tt>&lt; &gt; &lt;= &gt;=</tt></td>
<td>relational</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>10</td>
<td><tt>== !=</tt></td>
<td>equality</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>11</td>
<td><tt>&amp;</tt></td>
<td>bitwise AND</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>12</td>
<td><tt>^</tt></td>
<td>bitwise XOR</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>13</td>
<td><tt>|</tt></td>
<td>bitwise OR</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>14</td>
<td><tt>&amp;&amp;</tt></td>
<td>logical AND</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>15</td>
<td><tt>||</tt></td>
<td>logical OR</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>16</td>
<td><tt>?:</tt></td>
<td>conditional</td>
<td>Right-to-left</td>
</tr>
<tr>
<td>17</td>
<td><tt>= *= /= %= += -= &gt;&gt;= &lt;&lt;= &amp;= ^= |=</tt></td>
<td>assignment</td>
<td>Right-to-left</td>
</tr>
<tr>
<td>18</td>
<td><tt>,</tt></td>
<td>comma</td>
<td>Left-to-right</td>
</tr>
</tbody>
</table>
<p>The grouping comes in handy during C interview questions  which tries to manipulate the same variable in multiple ways in the same line. Its then good to know in what order they are executed.</p>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/">More Than 100% CPU In Top In Linux/Mac</a><br>
<a Href="http://blog.sriunplugged.com/interview/service-engineersystem-administrator-interview-questions/">Service Engineer/System Administrator Interview Questions</a><br>
<a Href="http://blog.sriunplugged.com/interview/important-mysql-dba-interview-questions/">Important MySQL DBA Interview Questions</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Red-Hat-Disk-Repo' >Red Hat Disk Repo</a><br>
<a href='http://blog.sriunplugged.com/post/Row-Number-In-Select-Query' >Row Number In Select Query</a><br>
<a href='http://blog.sriunplugged.com/post/Php-Strip-Trailing-Zeros-Decimal' >Php Strip Trailing Zeros Decimal</a><br>
<a href='http://blog.sriunplugged.com/post/Mysql-Nth-Occurrence-String' >Mysql Nth Occurrence String</a><br>
<a href='http://blog.sriunplugged.com/post/Mysql-Increment-Row-Number-With-Query' >Mysql Increment Row Number With Query</a><br>
</div><div id="related-heading">Posts on Bash</div><div  class="related">
<a Href="http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/" >Download PHD Comics,XKCD And DogHouseDiaries For Offline Viewing (E-book Reader)</a><br>
</div><div id="related-heading">Posts on Java</div><div  class="related">
<a Href="http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/" >Batch Insert/Update For Mysql In Java</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/interview/operator-preference-grouping-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ontology Linked Data</title>
		<link>http://blog.sriunplugged.com/assginment/ontology-linked-data/</link>
		<comments>http://blog.sriunplugged.com/assginment/ontology-linked-data/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 19:43:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Assginment]]></category>
		<category><![CDATA[assignment]]></category>
		<category><![CDATA[linked data]]></category>
		<category><![CDATA[ontology]]></category>

		<guid isPermaLink="false">http://blog.sriunplugged.com/?p=349</guid>
		<description><![CDATA[The following is a Assignment on Ontology and Linked Data and the evolution of data which lead to the use of ontology in web. Thanks to my teammates Bharath Gowda and Sravani Thota for working on the same. Ontology And Linked Data An ontology formally represents knowledge as a set of concepts within a domain, [...]]]></description>
				<content:encoded><![CDATA[<p>The following is a Assignment on Ontology and Linked Data and the evolution of data which lead to the use of ontology in web. Thanks to my teammates Bharath Gowda and Sravani Thota for working on the same.<span id="more-349"></span></p>
<h1 id="toc0">Ontology And Linked Data</h1>
<hr />
<p>An ontology formally represents knowledge as a set of concepts within a domain, and the relationships between those concepts. It can be used to reason about the entities within that domain, and may be used to describe the domain.<br />
In theory, an ontology is a &#8220;formal, explicit specification of a shared conceptualization&#8221;. An ontology renders shared vocabulary and taxonomy, which models a domain – that is, the definition of objects and/or concepts, and their properties and relations.<br />
Ontologies are the structural frameworks for organizing information and are used in artificial intelligence, the Semantic Web, systems engineering, software engineering, biomedical informatics, library science, enterprise bookmarking, and information architecture as a form of knowledge representation about the world or some part of it. The creation of domain ontologies is also fundamental to the definition and use of an enterprise architecture framework. The method of publishing structured data so that it can be interlinked and become more useful is known as Linked Data.<br />
Linked Data builds upon standard Web technologies such as HTTP and URIs, but rather than using them to serve web pages for human readers, it extends them to share information in a way that can be read automatically by computers. This enables data from different sources to be connected and queried.<br />
Example of Linked Data are DBpedia and New York Times Linked Data. They extract structured information from Wikipedia and The New York Times to allow the user to ask sophisticated queries against the information available, and to link other data sets on the Web.</p>
<h1 id="toc1"><a name="History"></a>History</h1>
<hr />
<h2 id="toc2"><a name="History-Growth of Information on the Web"></a>Growth of Information on the Web</h2>
<p>The Internet starts in the 1950s with the development of computers. This began with point-to-point communication between mainframe computers and terminals, expanded to point-to-point connections between computers. Packet switched networks such as ARPANET and Telnet, were developed in the late 1960s which lead to the development of TCP/IP.<br />
As the Internet grew through the 1980s and early 1990s, many people realized the increasing need to be able to find and organize files and information. Projects such as Gopher, WAIS, and the FTP Archive list attempted to create ways to organize distributed data. Unfortunately, these projects fell short in being able to accommodate all the existing data types and in being able to grow without bottlenecks. One of the most promising user interface paradigms during this period was hypertext. Gopher became the first commonly-used hypertext interface to the Internet. While Gopher menu items were examples of hypertext, they were not commonly perceived in that way.<br />
The need for presentation of data in a more illustrative method lead to the development of web browsers and HTML and thus began the 1st web as we know it or as we call it now,Web 1.0. The Web consisted of only information which was present in the FTP Archive in a more presentable method. The data was very limited and it consisted of mostly research papers and news articles. The data was stored as HTML. There was no need for a database or a data storage mechanism as the data was fairly static and was very limited.<br />
Users of the web needed a way to interact with the website and share more content and views to the article. This lead the web to evolve itself to focus itself more on the community, sharing content or user-generated content, and an interchange of data. This lead to an explosion of information on the web. The shift from Web 1.0 to Web 2.0 is a direct result of the change in the behavior of those who use the World Wide Web, Web 1.0 trends included worries over privacy concerns resulting in a one-way flow of information, through websites which contained &#8220;read-only&#8221; material. Now, during Web 2.0, the use of the Web can be characterized as the decentralization of website content, which is now generated from the &#8220;bottom-up&#8221;, with many users being contributors and producers of information, as well as the traditional consumers. Web 2.0 websites allow users to do more than just retrieve information. Web 2.0 websites allow users to do more than just retrieve information. By increasing what was already possible in &#8220;Web 1.0&#8243;, they provide the user with more user-interface, software and storage facilities. This has been called &#8220;Network as platform&#8221; computing.Users can provide the data that is on a Web 2.0 site and exercise some control over that data. These sites may have an &#8220;Architecture of participation&#8221; that encourages users to add value to the application as they use it.<br />
The need for dynamic data on webpages lead to the use of databases. The webpages used databases for storing the dynamic content and user interactions. The articles along with the tags and user comments are stored in a database for enabling dynamic updates of the webpages. Blogspot, WordPress are examples of this type of webpages.<br />
Some webpages tried to focus on providing more information online. This lead to the evolution of web databases. Web Databases are online data bases which can be queried using forms. They usually contain information which can be searched on specific keywords. Examples of this is Yahoo! Autos, Google Base etc. They mostly contains huge collection of data which can be used by queried and retrieved by the users.<br />
As more and more users, companies and governments started making their data public though the web we started to consider web as database. As the data is not centralized, each source has partial data of the topic. We hence needed to integrate or bring together the related information. Thus the information available was tried to be linked between each other. This linking can be used to by other webpages for providing more information on the same topic. This lead to the idea of linked data or the concept of ontology.</p>
<h2 id="toc3"><a name="History-Evolution of Web"></a>Evolution of Web</h2>
<hr />
<h3 id="toc4"><a name="History-Evolution of Web-Web 1.0"></a>Web 1.0</h3>
<p>Web 1.0 consisted of mostly webpages linked between each other using hyperlinks. Web 1.0 is a platform of information that is read only. It consists of static and non-interactive web pages that at most allow for an interchange of documents. In 1996 for were 45 million global users. The focus of Web 1.0 was on companies and owning content. The data was mostly stored in traditional databases which had content inserted and edited by only the web-page owners. The data was limited to the view of the webpage owner. The data was usually very minimal and was used only as a publishing tool.</p>
<h3 id="toc5"><a name="History-Evolution of Web-Web 2.0"></a>Web 2.0</h3>
<p>Web 2.0 features such as containing data; linking to multiple areas such as books, reviews, users, and catalogs; has services for individual recommendations; supports tagging and traditional subject headings; and supports the needs of the community. The Characteristics of Web 2.0 are: rich user experience, user participation, dynamic content, metadata, web standards and scalability. Further characteristics, such as openness, freedom and collective intelligence by way of user participation, can also be viewed as essential attributes of Web 2.0.<br />
Wikipedia is a fine example of Web 2.0 website. Wikipedia is a multilingual, web-based, free-content encyclopedia project based on an openly editable model. Wikipedia is written collaboratively by largely anonymous Internet volunteers who write without pay. Anyone with Internet access can write and make changes to Wikipedia articles. Thus it used the power of each user of the webpage rather than a single employee or a group of employees. Hence the information is more precise, better quality and up to date compared to the one sided version of a single employee.<br />
A Important part of Web 2.0 is the social Web, which is a fundamental shift in the way people communicate. The social web consists of a number of online tools and platforms where people share their perspectives, opinions, thoughts and experiences. Web 2.0 applications tend to interact much more with the end user. As such, the end user is not only a user of the application but also a participant by:</p>
<ul>
<li>Podcasting</li>
<li>Blogging</li>
<li>Tagging</li>
<li>Contributing to RSS</li>
<li>Social bookmarking</li>
<li>Social networking</li>
</ul>
<p>One of the issue with web 2.0 is information is represented as text. Its difficult to seek an information in the text. Thus, the web evolved into Web 3.0 or the Semantic Web</p>
<h1 id="toc6"><a name="Fundamental concept and Features"></a>Fundamental concept and Features</h1>
<hr />
<p>Ontology is developed to solve many issues that exist today. Sharing information and common knowledge is one of the key goals for the development of ontology. For example there are lots of map applications available today. If there is a new landmark which needs to be identified and labeled, then user has to update the landmark in all the map applications. If these Web sites share and publish the same underlying ontology of the terms they all use, then computer agents can extract and aggregate information from these different sites and label the landmark in all the applications. Separating domain knowledge from the operational knowledge is another use of ontologies. We can describe the emergency recovery procedure during engine failure according to the specification and implement a program that does this independent of the type of engine. We can then develop ontology for automobile engine and apply the algorithm for recovery. We can also use the same algorithm for power generator if we feed power generator component ontology to it.</p>
<h1 id="toc7"><a name="Ontology Components"></a>Ontology Components</h1>
<hr />
<p>Ontology can consists of different components of which the important ones include</p>
<ol>
<li>Classes</li>
<li>Individuals</li>
<li>Relations</li>
</ol>
<p><a href="http://blog.sriunplugged.com/wp-content/uploads/2011/09/class_representation1.jpg"><img class="aligncenter size-medium wp-image-351" title="class_representation1" src="http://blog.sriunplugged.com/wp-content/uploads/2011/09/class_representation1-300x220.jpg" alt="" width="300" height="220" /></a></p>
<p><em>Classes</em> which describe the concept in are the focus of most ontology. Classes are also referred to as type, sort, universal and kind. Classes represent a group of individuals that share common characteristics. For example both 2-wheele and 4-wheel vehicles share common characteristics like they are used for travelling, they use engines to function etc. 4-wheel can again be classified into car and truck. A class can have subclasses that are more specific than the super class. Classes can also share relationship with each other.</p>
<p><em>Individuals</em> also known as instances are the basic unit of ontology. They are the things that ontology describes; individuals can be persons, automobiles, machines as well as model abstract objects like person’s job or a function.</p>
<p><em>Relations</em> or relationship in ontology is describing the way in which individuals are related. Relations normally are expressed between individuals or also between the classes. The power of ontology comes from the ability to describe relations. Important types of relations are is-a-superclass-of and is-a-subclass-of. From the above example we can say that car is a subclass of 4-wheel and 4-wheel itself is a subclass of vehicle.</p>
<p>Other components of ontology are Attributes, Restrictions, Rules, Axioms and Events.</p>
<h1 id="toc8"><a name="Ontology Engineering"></a>Ontology Engineering</h1>
<hr />
<p>It is a set of activities that concern with the ontology development process, lifecycle, the methods and methodologies for building ontologies, the tool kits and languages that support them. Ontology reflects the structure of the world. It is often about the structure of concepts. The actual physical representation is not an issue in ontology. Whereas an Object oriented class structure reflects the structure of data and code. It is usually about behavior (methods). OO class structure describes the physical representation of data (long int, char etc.)</p>
<h1 id="toc9"><a name="Domain Ontology"></a>Domain Ontology</h1>
<hr />
<p>Domain ontologies are descriptions of particular subjects or domain areas. Domain ontologies are the “world views” by which organizations, communities or enterprises describe the concepts in their domain, the relationships between those concepts, and the instances or individuals that are the actual things that populate that structure. Thus, domain ontologies are the basic bread-and-butter descriptive structures for real-world applications of ontologies. They provide a common conceptual vocabulary to members of a virtual community of users who need to share their information in a particular domain such as in medical, banking, tourism etc. The identiﬁcation and deﬁnition of concepts that describe the domain knowledge requires a certain consensus. Generally, each member or sub community holds some knowledge, he has its own view on the domain, and he describes it with his own vocabulary. Thus, to reach a consensus allowing to reﬂect a common view of the domain can be a diﬃcult task and even more harder if members are geographically dispersed. One way very widely used is to start from pre-existent elements in the domain: text corpus, taxonomies, ontology fragments, and to exploit them as a basis for gradually deﬁning the domain ontology. For example the word ‘mouse’ may be modeled differently in Animals ontology but it will be modeled differently in Computers ontology. As the ontology world expands there may arise need to merge the domain ontology to general representation, since domain ontologies represent concepts in very specific and eclectic ways and are often incompatible. There can be different ontologies in same domain also due to different perceptions of the domain based on ideology, cultural background or because of representing in different languages.</p>
<h2 id="toc10"><a name="Domain Ontology-Examples"></a>Examples</h2>
<hr />
<h3 id="toc11"><a name="Domain Ontology-Examples-Gene Ontology"></a>Gene Ontology</h3>
<p>Gene Ontology (GO)is a collaborative effort to address the issue of consistent descriptions of gene products in different databases. The project aims to maintain and develop vocabulary of gene and gene product, annotate genes and gene product and provide tools to access for easy access of all aspects of data provided by the project. The GO project has developed three structured controlled vocabularies (ontologies) that describe gene products in terms of their associated biological processes in a species-independent manner</p>
<ol>
<li>The cellular component ontology describes locations, at the levels of subcellular structures and macromolecular complexes. Examples of cellular components include nuclear inner membrane, with the synonym inner envelope, and the ubiquitin ligase complex, with several subtypes of these complexes represented.</li>
<li>A biological process is series of events accomplished by one or more ordered assemblies of molecular functions. The biological process ontology includes terms that represent collections of processes as well as terms that represent a specific, entire process. Generally, the former will have mainly is_a children, and the latter will have part_of children that represent sub processes. Also see &#8220;is_a or part_of&#8221; below</li>
<li>Molecular function describes activities, such as catalytic or binding activities, that occur at the molecular level. GO molecular function terms represent activities rather than the entities (molecules or complexes) that perform the actions, and do not specify where or when, or in what context, the action takes place. Molecular functions generally correspond to activities that can be performed by individual gene products, but some activities are performed by assembled complexes of gene products. Examples of broad functional terms are catalytic activity, transporter activity</li>
</ol>
<h1 id="toc12"></h1>
<h1 id="toc13"><a name="XML: Extensible Markup Language"></a>XML: Extensible Markup Language</h1>
<hr />
<p>XML is a meta language that allows users to define their own markup languages by defining data, data types, syntax. It is a general purpose markup language for documents containing structured information. A XML document contains elements that can be nested and that may have attributes and content. XML namespaces allow specifying different markup vocabularies in one XML document. XML schema serves for expressing schema of a particular set of XML documents.</p>
<h1 id="toc14"></h1>
<h1 id="toc15"><a name="RDF: Resource Description Framework"></a>RDF: Resource Description Framework</h1>
<hr />
<p>XML describes the syntax but doesn’t provide the semantics. Thus it should be extensible for the semantics of the web. An RDF is a framework for representing information about resources in a graph form. It was primarily intended for representing metadata about WWW resources, such as the title, author, and modification date of a Web page, but it can be used for storing any other data. It is based on triples subject-predicate-object that form graph of data. All data in the semantic web use RDF as the primary representation language. RDF document consists of a collection of statements in XML format. The root node of the XML document is “RDF,” followed by a list of elements, each of which corresponds to a statement.<br />
RDF Syntax:<br />
Information is represented by triples subject-predicate-object in RDF.</p>
<ul>
<li><strong>Subject:</strong> The resources being described by RDF are anything that can be named via a URI.</li>
<li><strong>Predicate</strong>: A property is also a resource that has a name, for instance Author or Title.</li>
<li><strong>Object</strong>: A statement consists of the combination of a Resource, a Property, and an associated value</li>
</ul>
<p>A combination of them is said to be a Statement (or a rule).RDF itself serves as a description of a graph formed by triples. Anyone can define vocabulary of terms used for more detailed description. To allow standardized descrip tion of taxonomies and other ontological constructs, a RDF Schema (RDFS) was created together with its formal semantics within RDF. RDFS can be used to describe taxonomies of classes and properties and use them to create lightweight ontologies.</p>
<h2 id="toc16"></h2>
<h2 id="toc17"><a name="RDF: Resource Description Framework-RDF Schema"></a>RDF Schema</h2>
<p>RDF Schema (RDFS)is extending RDF vocabulary to allow describing taxonomies of classes and properties. RDF is an ontology language with a basic set of resources, properties, and statements.<br />
RDF Schema provides a higher level of abstraction than RDF.</p>
<ul>
<li><em>specific classes of resources ,</em></li>
<li><em>specific properties,</em></li>
<li><em>and the relationships between these properties and other resources can be described.</em></li>
</ul>
<p>All resources can be divided into groups called <strong>classes</strong>. Classes are also resources, so they are identified by URIs and can be described using properties. The members of a class are instances of classes, which are stated using the rdf: type property. Note that class and a set of instances does not have to be the same. The set of instances is the extension of the class, and two different classes may contain the same set of instances.In RDFS a class may be an instance of a class. All resources are instances of the class rdfs: Resource. All classes are instances of rdfs: Class and subclasses of rdfs: Resource. All literals are instances of rdfs: Literal. All properties are instances of rdf: Property.Properties in RDFS are relations between subjects and objects in RDF triples, i.e., predicates. All properties are defined domain and range.</p>
<h2 id="toc18"><a name="RDF: Resource Description Framework-OWL: Web Ontology Language"></a>OWL: Web Ontology Language</h2>
<hr />
<p>The OWL is a language derived from description logics, and offers more constructs over RDFS. It is syntactically embedded into RDF, so like RDFS, it provides additional standardized vocabulary. RDFS and OWL have semantics defined and this semantics can be used for reasoning within ontologies and knowledge bases described using these languages. To provide rules beyond the constructs available from these languages, rule languages are being standardized for the semantic web as well. Two standards are emerging &#8211; RIF and SWRL. OWL comes in three species &#8211; OWL Lite for taxonomies and simple constrains, OWL DL for full description logic support, and OWL full for maximum expressiveness and syntactic freedom of RDF. Since OWL is based on description logic, it is not surprising that a formal semantics is defined for this language.OWL is divided following sub languages.</p>
<ul>
<ul>
<ul>
<li><em>OWL Lite</em></li>
<li><em>OWL (Description Logics) DL</em></li>
<li><em>OWL Full</em></li>
</ul>
</ul>
</ul>
<p>OWL Full and OWL DL support the same set of OWL language constructs. Their difference lies in restrictions on the use of some of those features and on the use of RDF features. <strong>OWL Full</strong> allows free mixing of OWL with RDF Schema and, like RDF Schema, does not enforce a strict separation of classes, properties, individuals and data values. <strong>OWL DL</strong> puts constraints on the mixing with RDF and requires disjoint-ness of classes, properties, individuals and data values. The main reason for having the OWL DL sublanguage is that tool builders have developed powerful reasoning systems which support ontologies constrained by the restrictions required for OWL DL. <strong>OWL Lite</strong> is a sublanguage of OWL DL that supports only a subset of the OWL language constructs. OWL Lite is particularly targeted at tool builders, who want to support OWL, but want to start with a relatively simple basic set of language features. OWL Lite abides by the same semantic restrictions as OWL DL, allowing reasoning engines to guarantee certain desirable properties.</p>
<h1 id="toc19"><a name="Semantic Web"></a>Semantic Web</h1>
<hr />
<p>Semantic web is an extension to current World Wide Web. In this the information stored contains a well-defined meaning, enabling people and computers to work in cooperation. The Semantic Web is a web that is able to describe things in a way that computers can understand. Consider below lines</p>
<ul>
<li>California is the most populated state in US.</li>
<li>Sacramento is the capital of California.</li>
<li>Silicon Valley is located in the bay area of California.</li>
</ul>
<p>Sentences like the ones above can be understood by people. But how can they be understood by computers? Statements are built with syntax rules. The syntax of a language defines the rules for building the language statements. But how can syntax become semantic? This is what the Semantic Web is all about. Describing things in a way that computers applications can understand it. The Semantic Web is not about links between web pages. The Semantic Web describes the relationships between things (like A is a part of B and Y is a member of Z) and the properties of things (like size, weight, age, and price).<br />
It is important to have the huge amount of data on the Web available in a standard format, reachable and manageable by Semantic Web tools. Furthermore, not only does the Semantic Web need access to data, but relationships among data should be made available, too, to create a Web of Data (as opposed to a sheer collection of datasets). This collection of interrelated datasets on the Web can is nothing but Linked Data.</p>
<h2 id="toc20"><a name="Semantic Web-Web 3.0"></a>Web 3.0</h2>
<p>The evolution of the current Web of &#8220;linked documents&#8221; (hyperlinks) to a Web of &#8220;linked data&#8221; is steadily gaining importance. Semantic web is termed as synonym for Web3.0. There are some who claim that Web 3.0 will be more application based and center its efforts towards more graphically capable environments, &#8220;non-browser applications and non-computer based devices&#8230;geographic or location-based information retrieval&#8221; and even more applicable use and growth of Artificial Intelligence. For example, Conrad Wolfram, has argued that Web 3.0 is where &#8220;the computer is generating new information&#8221;, rather than humans.</p>
<p>Ontology LanguagesOntology Languages are formal languages used to construct ontologies. They allow the encoding of knowledge about specific domains and often include reasoning rules that support the processing of that knowledge. Ontology languages are usually declarative languages, are almost always generalizations of frame languages, and are commonly based on either first-order logic or on description logic.</p>
<h1 id="toc21"></h1>
<h1 id="toc22"><a name="Advantages of Ontology in SOA"></a>Advantages of Ontology in SOA</h1>
<hr />
<p>Ontology is used for classification, navigation, concept identification, query, and reasoning. As SOA software have various kinds of structures such as application architecture, collaborations, services and workflows, it is advantageous to divide an ontology system into different kinds of ontology systems, one for each kind of software artifacts, that is, <em>software-oriented ontology</em>. Each ontology system focuses on one aspect of SOA software development, and they can cross reference. For example, we can have the following ontology systems:</p>
<ul>
<li>Application ontology (AO): This defines concepts and relationships related to applications;</li>
<li>Collaboration ontology (CO): This defines various collaboration templates with associated workflows and services, and the CO cross references to AO, WO and SO for easy service and workflow identification;</li>
<li>Workflow ontology (WO): This defines concepts and relations of workflows. In WO, specific workflows from different domains are classified and relations are also specified facilitating collaboration;</li>
<li>Service ontology (SO): This defines concepts and relationships of services.</li>
</ul>
<h2 id="toc23"></h2>
<h2 id="toc24"><a name="Advantages of Ontology in SOA-Ontology enabled SOA"></a>Ontology enabled SOA</h2>
<p>Ontology enabled SOA is derivation of SOA that assumes a direct exchange of semantically rich messages between processing components. Ontology enabled SOA can be combined with any SOA-compatible architecture (WSDL/SOAP) and with any ontology language. The style can be gradually refined into derivative styles to support additional service related activities. <em>An ontology language must be used to express a schema underlying messages</em>. This constraint explicitly addresses the semantic interoperability of messages.In most of the modern applications of SOA, XML and XML Schema provide a unified syntax and vocabulary definition mechanism to messages. However, the XML Schema language addresses structural aspects only, leaving semantics of a defined vocabulary implicit. This leaves the problem of semantic interoperability among processing components unsolved but, on the other hand, does not restrict the flexibility in defining domain-specific vocabularies. Ontology can provide a domain vocabulary, semantics of which is precisely defined in terms of ontological primitives of the underlying language.LimitationThe ontology languages such as RDFS and OWL are designed to have fixed semantics and, therefore, cannot fulfill the extensibility requirement with respect to the schema semantics. The user is limited to model an application domain in terms provided by an ontology language. This means that the more restrictive an ontology language is the less flexible an Ontology enabled SOA based on this language becomes and, therefore, the more it diverges from the general requirements to SOA. In order to achieve the level of flexibility required by SOA, semantics of an ontology language must be extensible. However, at present, such languages are not available and it is difficult to foresee whether they will appear in future. If an extensible ontology language is unavailable then the least restrictive one (e.g. RDFS) might be good enough candidate.</p>
<h1 id="toc25"><a name="References"></a>References</h1>
<hr />
<ol>
<li id="cite_note-1">The Gene Ontology Consortium (Jan 2008). &#8220;The Gene Ontology project in 2008.&#8221;. <em>Nucleic acids research</em> <strong>36</strong> (Database issue): D440–4. <a href="http://en.wikipedia.org/wiki/Digital_object_identifier" rel="nofollow">doi</a>:<a href="http://dx.doi.org/10.1093%2Fnar%2Fgkm883" rel="nofollow">10.1093/nar/gkm883</a>. <a href="http://en.wikipedia.org/wiki/PubMed_Central" rel="nofollow">PMC</a> <a href="http://www.pubmedcentral.gov/articlerender.fcgi?tool=pmcentrez&amp;artid=2238979" rel="nofollow">2238979</a>. <a href="http://en.wikipedia.org/wiki/PubMed_Identifier" rel="nofollow">PMID</a> <a href="http://www.ncbi.nlm.nih.gov/pubmed/17984083" rel="nofollow">17984083</a>.</li>
<li id="cite_note-2"><a href="http://www.obitko.com/tutorials/ontologies-semantic-web/rdf-schema-rdfs.html" rel="nofollow">http://www.obitko.com/tutorials/ontologies-semantic-web/rdf-schema-rdfs.html</a></li>
<li id="cite_note-3"><a href="http://www.w3.org/TR/owl-ref/#Sublanguages" rel="nofollow">http://www.w3.org/TR/owl-ref/#Sublanguages</a></li>
<li id="cite_note-4"><a href="http://www.w3.org/standards/semanticweb/data" rel="nofollow">http://www.w3.org/standards/semanticweb/data</a></li>
</ol>

<p id="related-title"><strong>Related Posts:</strong></p>
<div id="related-heading">Posts on Assginment</div><div  class="related">
<a Href="http://blog.sriunplugged.com/assginment/user-level-threads/">User Level Threads</a><br>
</div><div id="related-heading">Recent Searches</div>
<div class='related'  style = 'padding: 0 7px'><a href='http://blog.sriunplugged.com/post/Ubuntu@ubuntu:~$-Sudo-Grub-Sudo:-Grub:-Command-Not-Found' >Ubuntu@ubuntu:~$ Sudo Grub Sudo: Grub: Command Not Found</a><br>
<a href='http://blog.sriunplugged.com/post/Create-Table-Like' >Create Table Like</a><br>
<a href='http://blog.sriunplugged.com/post/Dba-Written-Interview-Questions' >Dba Written Interview Questions</a><br>
<a href='http://blog.sriunplugged.com/post/Add-The-Installation-Dvd-As-A-Repository' >Add The Installation Dvd As A Repository</a><br>
<a href='http://blog.sriunplugged.com/post/Php-Print-Arraz' >Php Print Arraz</a><br>
</div><div id="related-heading">Posts on Bash</div><div  class="related">
<a Href="http://blog.sriunplugged.com/bash-2/download-phd-comicsxkcd-and-doghousediaries-for-offline-viewing-e-book-reader/" >Download PHD Comics,XKCD And DogHouseDiaries For Offline Viewing (E-book Reader)</a><br>
</div><div id="related-heading">Posts on Java</div><div  class="related">
<a Href="http://blog.sriunplugged.com/java/batch-insertupdate-for-mysql-in-java/" >Batch Insert/Update For Mysql In Java</a><br>
</div><div id="related-heading">Posts on Interview</div><div  class="related">
<a Href="http://blog.sriunplugged.com/interview/100-cpu-top-linuxmac/" >More Than 100% CPU In Top In Linux/Mac</a><br>
</div><div id="related-heading">Posts on Google</div><div  class="related">
<a Href="http://blog.sriunplugged.com/google/enable-multiple-login-account-gmail/" >Enable Multiple Login In Same Account In Gmail</a><br>
</div><br />
]]></content:encoded>
			<wfw:commentRss>http://blog.sriunplugged.com/assginment/ontology-linked-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
