<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4330430783248485602</id><updated>2012-02-15T22:22:17.810-08:00</updated><category term='System Programming'/><category term='Algorithm'/><category term='Tomcat'/><category term='SWIG'/><category term='linux terminal command'/><category term='Dictionary'/><category term='Shadhinota'/><category term='MySQL'/><category term='JSP'/><category term='Cloud Computing'/><category term='Database'/><category term='Compiler Construction'/><category term='Syntax Analysis'/><category term='Web Desktop'/><category term='Qt4'/><category term='Java'/><category term='Ubuntu Command Line'/><category term='GUI Programming'/><category term='flex'/><category term='JDBC'/><category term='Gnokii'/><title type='text'>Blog of a linux savvy</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-4054722784871066361</id><published>2011-07-15T21:16:00.000-07:00</published><updated>2011-08-25T01:18:29.162-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux terminal command'/><title type='text'>Setting up sensors in linux</title><content type='html'>&lt;span style="font-size:85%;"&gt;Just install lm-sensors with this command:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;sudo apt-get install lm-sensors&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;after installation use this command to get the status of the cpu:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;sensors&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-4054722784871066361?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/4054722784871066361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=4054722784871066361' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4054722784871066361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4054722784871066361'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2011/07/setting-up-sensosrs-in-linux.html' title='Setting up sensors in linux'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-8801122282087165141</id><published>2011-07-08T01:23:00.000-07:00</published><updated>2011-07-08T01:27:57.355-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu Command Line'/><title type='text'>Changing brightness from ubuntu terminal</title><content type='html'>&lt;span style="color: rgb(255, 255, 255);"&gt;Try this command:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(255, 255, 255);"&gt;setpci -s 00:02.0 F4.B=10&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;value of F4.B can be changed (my limit is 99)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-8801122282087165141?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/8801122282087165141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=8801122282087165141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8801122282087165141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8801122282087165141'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2011/07/changing-brightness-from-ubuntu.html' title='Changing brightness from ubuntu terminal'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-4911885454468171167</id><published>2011-06-30T13:04:00.000-07:00</published><updated>2011-06-30T13:39:20.543-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Compiler Construction'/><category scheme='http://www.blogger.com/atom/ns#' term='Syntax Analysis'/><title type='text'>Easiest way to determine "Follow Set"</title><content type='html'>&lt;span style="font-size:100%;"&gt;Consider the following grammar:&lt;br /&gt;&lt;br /&gt;E = TE'&lt;br /&gt;E' = +TE' | e&lt;br /&gt;T = FT'&lt;br /&gt;T' = *FT' | e&lt;br /&gt;F = (E) | id&lt;br /&gt;&lt;br /&gt;Here,&lt;br /&gt;First( E ) = { ( , id }&lt;br /&gt;First( E' ) = { + , e }&lt;br /&gt;First( T ) = { ( , id }&lt;br /&gt;First( T' ) = { * , e }&lt;br /&gt;First( F ) = { ( , id }&lt;br /&gt;&lt;br /&gt;So, to get the value of Follow (E) we have to pick any one of Es from the right side of the equation. E is in the right side only here F = (E)|id , here right side of E is ')' which is a terminal. So Follow set of E would be ')'. And E is first one to get so $ sign would be in the follow set.&lt;br /&gt;So Follow(E) = { ) , $ }&lt;br /&gt;&lt;br /&gt;Now we have to get the value of Follow (E'). At first we have to take any one of the equations from the list where E' is in the right side. Lets take E = TE'&lt;br /&gt;Here right side of E' is empty. So the Follow set of E' would be the Follow set of E (left side of the equation)&lt;br /&gt;So, Follow(E') = { ), $ }&lt;br /&gt;&lt;br /&gt;Now it's time to get the value of Follow(T). We can take E = TE', where T is in the right ride of the equation. Here the right consecutive value of  T is E' which is a non terminal. So, we have to add it's first set's element to its follow set, adn if the first set has the value 'e' (empty set), follow set of the non terminal residing in the left side of the equation has to be added, Here the first set of E' is {+,e}, so the follow set of T would be {+, Follow set of E} that means {+,),$}&lt;br /&gt;&lt;br /&gt;To get the Follow set of T' We can take the equation T=FT' and T' has not any right consecutive value, so the follow set of T' would be the follow set of the left sided non terminal T. That is {+,),$}&lt;br /&gt;&lt;br /&gt;Follow set of F can be determined from the relation T = FT'&lt;br /&gt;Here right consecutive value of F is T' which is a nonterminal. So the follow set would be {first set of T', if First(T') contains e add follow set of T}&lt;br /&gt;Therefore, Follow(F) = {*,+,),$}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-4911885454468171167?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/4911885454468171167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=4911885454468171167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4911885454468171167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4911885454468171167'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2011/06/easiest-way-to-determine-follow-set.html' title='Easiest way to determine &quot;Follow Set&quot;'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-3050246660405248969</id><published>2010-11-26T10:36:00.000-08:00</published><updated>2010-12-17T07:06:24.210-08:00</updated><title type='text'>Ruby on Mint ;)</title><content type='html'>&lt;style type="text/css"&gt;#toc, .toc, .mw-warning { border: 1px solid rgb(170, 170, 170); background-color: rgb(249, 249, 249); padding: 5px; font-size: 95%; }#toc h2, .toc h2 { display: inline; border: medium none; padding: 0pt; font-size: 100%; font-weight: bold; }#toc #toctitle, .toc #toctitle, #toc .toctitle, .toc .toctitle { text-align: center; }#toc ul, .toc ul { list-style-type: none; list-style-image: none; margin-left: 0pt; padding-left: 0pt; text-align: left; }#toc ul ul, .toc ul ul { margin: 0pt 0pt 0pt 2em; }#toc .toctoggle, .toc .toctoggle { font-size: 94%; }body { font-size: 12pt; font-family: 'Liberation Serif'; }table {  }td { border-collapse: collapse; text-align: left; vertical-align: top; }p, h1, h2, h3, li { font-family: 'Liberation Serif'; font-size: 12pt; }.text_body { margin-bottom: 0.0835in; margin-top: 0in; }.emphasis_text { font-style: italic; }.teletype_text { font-family: 'DejaVu Sans Mono'; }.source_text_text { font-family: 'DejaVu Sans Mono'; }&lt;/style&gt;     &lt;div&gt;    &lt;p&gt;&lt;span style="font-size:78%;"&gt;Ruby develoment:&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;    &lt;p&gt;&lt;span style="font-size:78%;"&gt;To create new application , install ruby and gem and webrick from apt with this command&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;    &lt;/span&gt;    &lt;p style="font-style: italic;"&gt;&lt;span style="font-size:78%;"&gt;sudo gem install rails&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;    &lt;p&gt;&lt;span style="font-size:78%;"&gt;install sqlite3 and its dev file from apt.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;then create a sample application,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;    &lt;p style="font-style: italic;"&gt;&lt;span style="font-size:78%;"&gt;rails create blog&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;    &lt;p style="font-style: italic;"&gt;&lt;span style="font-size:78%;"&gt;cd blog&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;    &lt;/span&gt;        &lt;p style="font-style: italic;"&gt;&lt;span style="font-size:78%;"&gt;rails server&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:78%;" &gt;    &lt;/span&gt;        &lt;p&gt;&lt;span class="source_text_text"  style="font-size:78%;"&gt;Here rails generate controller home index &lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;        &lt;p&gt;&lt;span class="source_text_text"  style="font-size:78%;"&gt;To edit configuration go to&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;app/views/home/index.html.erb&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;        &lt;p&gt;&lt;span class="source_text_text"  style="font-size:78%;"&gt;give this command:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="source_text_text"  style="font-size:78%;"&gt;rm public/index.html &lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:78%;"&gt;    &lt;/span&gt;    &lt;p class="text_body"&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;Now, you have to tell Rails where your actual home page is located. Open the file config/routes.rb in your editor. This is your application’s &lt;/span&gt;&lt;span class="emphasis_text"  style="font-size:78%;"&gt;routing file&lt;/span&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt; which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with :root to, uncomment it and change it like the following:&lt;/span&gt;&lt;/p&gt;    &lt;p class="text_body"&gt;&lt;span class="source_text_text"  style="font-size:78%;"&gt;Blog::Application.routes.draw do #... # You can have the root of your site routed with "root" # just remember to delete public/index.html. root :to =&gt; "home#index" &lt;/span&gt;&lt;/p&gt;    &lt;p class="text_body"&gt;&lt;span style="font-size:78%;"&gt;The &lt;/span&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;root :to =&gt; "home#index"&lt;/span&gt;&lt;span style="font-size:78%;"&gt; tells Rails to map the root action to the home controller’s index action.&lt;/span&gt;&lt;/p&gt;    &lt;p class="text_body"&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;Now if you navigate to &lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;a href="http://localhost:3000/"&gt;&lt;span class="teletype_text" style=""&gt;http://localhost:3000&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt; in your browser, you’ll see Hello, Rails!.&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;For routing add get part&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;Blog::Application.routes.draw do &lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;  get "say/hello" &lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;  get "say/goodbye" &lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span class="teletype_text"  style="font-size:78%;"&gt;  get "home/index" receive &lt;/span&gt;&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-3050246660405248969?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/3050246660405248969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=3050246660405248969' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/3050246660405248969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/3050246660405248969'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2010/11/ruby-on-mint.html' title='Ruby on Mint ;)'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-4069807557433463129</id><published>2010-05-28T21:38:00.000-07:00</published><updated>2010-05-28T22:27:47.827-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='Cloud Computing'/><title type='text'>EyeOS !!!! cloud in your local machine</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XUNnqjZRQ8o/TAClaS_z2KI/AAAAAAAAAEQ/yd_XE2gNHfY/s1600/DSC02046.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 300px; height: 225px;" src="http://3.bp.blogspot.com/_XUNnqjZRQ8o/TAClaS_z2KI/AAAAAAAAAEQ/yd_XE2gNHfY/s400/DSC02046.JPG" alt="" id="BLOGGER_PHOTO_ID_5476559018077182114" border="0" /&gt;&lt;/a&gt;                                                          &lt;span style="font-size:78%;"&gt;My home cloud&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XUNnqjZRQ8o/TACjAiDONJI/AAAAAAAAAEA/TUucG4gZ9qo/s1600/eyeOS.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="cssButtonOuter"&gt;&lt;div class="cssButtonMiddle"&gt;&lt;span style="font-size:85%;"&gt;EyeOS is an Open Source web desktop operating system written in PHP and AJAX. The main problem of setting up EyeOS is running the sql queries, cause there are several fi&lt;/span&gt;les containing sql commands. To set up EyeOS, you've to edit the settings.php file in mail directory and edit this portion according to your configuration.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(153, 153, 255);font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;// STORAGE&lt;br /&gt;define('SQL_CONNECTIONSTRING', 'mysql:dbname=eyeos;host=127.0.0.1');&lt;br /&gt;define('SQL_USERNAME', 'user');&lt;br /&gt;define('SQL_PASSWORD', '123456');&lt;/span&gt;&lt;br /&gt;you have to write your user name instead of "user" and your desired password will replace "123456".&lt;br /&gt;&lt;br /&gt;Open mysql console and create a database named eyeos&lt;br /&gt;Then  go to /server directory/eyeos/eyeos/extras and open Calendar.sql from Calendar directory.&lt;br /&gt;Run the queries in mysql console. If error is poped, then its okay, we've to come back to this queries after finishing other queries. Then openEyeosEventsNotification.sql file from Eyeos&lt;/span&gt;&lt;span style="font-size:85%;"&gt;EventsNotification directory.Remember, if any query shows error, don't be nervous, we will run them after executing other queries. Silmilarly run the queries of EyeosPeopleSQL.sql, EyeosTags.sql, EyeosUMSQL.sql, languageAdmin.sql, MailApplicationSQL.sql from &lt;/span&gt;&lt;span style="font-size:85%;"&gt;EyeosPeopleSQL,&lt;/span&gt;&lt;span style="font-size:85%;"&gt; EyeosTags,&lt;/span&gt;&lt;span style="font-size:85%;"&gt; EyeosUMSQL,&lt;/span&gt;&lt;span style="font-size:85%;"&gt; LanguageAdmin, &lt;/span&gt;&lt;span style="font-size:85%;"&gt;MailApplicationSQL directories. Now it's time to get back to unexecuted queries of previous files.Run those queries and ready to use the cloud in your PC.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Run the eyeos from server and click on the New User link, register yourself and ready to take the taste of web desktop.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_XUNnqjZRQ8o/TACklO23BAI/AAAAAAAAAEI/q1BGBag6frA/s1600/Screenshot.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://2.bp.blogspot.com/_XUNnqjZRQ8o/TACklO23BAI/AAAAAAAAAEI/q1BGBag6frA/s400/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5476558106432832514" border="0" /&gt;&lt;/a&gt;                                                                                                                         &lt;span style="font-size:78%;"&gt;Screen shot of EyeOS&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-4069807557433463129?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/4069807557433463129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=4069807557433463129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4069807557433463129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/4069807557433463129'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2010/05/eyeos-cloud-in-your-local-machine.html' title='EyeOS !!!! cloud in your local machine'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_XUNnqjZRQ8o/TAClaS_z2KI/AAAAAAAAAEQ/yd_XE2gNHfY/s72-c/DSC02046.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-5672924686021557076</id><published>2010-05-14T11:02:00.000-07:00</published><updated>2010-05-14T11:36:15.414-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JDBC'/><title type='text'>JDBC MySQL snippet</title><content type='html'>&lt;span style="font-size:85%;"&gt;I'm working on my database project. Here is a tips to connect java with MySQL in Ubuntu. I downloaded MySQL Java connector with Synaptic. The downloaded file is mysql-connector-java-5.1.10.jar and located at /usr/share/java path. I copied that file to my java home's /jre/lib/ext directory, which is /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/ext&lt;br /&gt;&lt;br /&gt;I created a database with this command in mysql :&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;create database test;&lt;br /&gt;create table Name (FirstName char(10),LastName char(10));&lt;br /&gt;insert into Name values ("Md. Rezaur","Rahman");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now I used this code to test my connection:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;import java.sql.*;&lt;br /&gt;&lt;br /&gt;public class JdbcExample1 {&lt;br /&gt;&lt;br /&gt; public static void main(String args[]) {&lt;br /&gt; Connection con = null;&lt;br /&gt;&lt;br /&gt;   try {&lt;br /&gt;     Class.forName("com.mysql.jdbc.Driver").newInstance();&lt;br /&gt;     con = DriverManager.getConnection("jdbc:mysql:///test", "sajol", "123456");&lt;br /&gt;     if(!con.isClosed()){&lt;br /&gt;     System.out.println("Successfully connected to MySQL server...");&lt;br /&gt;     Statement s = con.createStatement ();&lt;br /&gt;     s.executeQuery("select FirstName,LastName from Name");&lt;br /&gt;     ResultSet rSet = s.getResultSet();&lt;br /&gt;     int count = 0;&lt;br /&gt;     while (rSet.next ())&lt;br /&gt;                                    {&lt;br /&gt;                                      String FirstName = rSet.getString ("FirstName");&lt;br /&gt;                                      String LastName = rSet.getString ("LastName");&lt;br /&gt;                                      System.out.println (" First Name = " + FirstName+ ", Last Name = " +         LastName);&lt;br /&gt;           ++count;&lt;br /&gt;       }&lt;br /&gt;       rSet.close ();&lt;br /&gt;       s.close ();&lt;br /&gt;       System.out.println (count + " rows were retrieved");&lt;br /&gt;         }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;     catch(Exception e) {&lt;br /&gt;     System.err.println("Exception: " + e.getMessage());&lt;br /&gt;   }&lt;br /&gt;     finally {&lt;br /&gt;     try {&lt;br /&gt;       if(con != null)&lt;br /&gt;         con.close();&lt;br /&gt;     } catch(SQLException e) {}&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-5672924686021557076?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/5672924686021557076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=5672924686021557076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5672924686021557076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5672924686021557076'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2010/05/jdbc-mysql-snippet.html' title='JDBC MySQL snippet'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-126685926001095680</id><published>2010-05-10T10:07:00.000-07:00</published><updated>2010-05-10T11:26:43.870-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Compiler Construction'/><title type='text'>Lexical Issues</title><content type='html'>I was given some sample source files and instructions to build a lexical analyzer. Though it is not a complete project but this flex file works pretty good job to identify the lexicon. Here is the lex file and the generated files:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_XUNnqjZRQ8o/S-hFqwKH6qI/AAAAAAAAAD4/FFELGfbFrAw/s1600/Screenshot_lexFile.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 240px;" src="http://1.bp.blogspot.com/_XUNnqjZRQ8o/S-hFqwKH6qI/AAAAAAAAAD4/FFELGfbFrAw/s400/Screenshot_lexFile.png" alt="" id="BLOGGER_PHOTO_ID_5469698348225653410" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-126685926001095680?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/126685926001095680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=126685926001095680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/126685926001095680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/126685926001095680'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2010/05/lexical-issues.html' title='Lexical Issues'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_XUNnqjZRQ8o/S-hFqwKH6qI/AAAAAAAAAD4/FFELGfbFrAw/s72-c/Screenshot_lexFile.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-2153295174311513428</id><published>2009-12-07T10:01:00.000-08:00</published><updated>2009-12-15T10:13:33.612-08:00</updated><title type='text'>Compiler Construction: Phase One (Backus–Naur Form)</title><content type='html'>I had a project of compiler construction a few days ago. It is more interesting than I imagined. There would be a language (suppose it is Simple Programming Language). I need to build the BNF,lexical analyzer and the parser. My friend Wasi built the BNF according to the specifications given to us.&lt;br /&gt;&lt;br /&gt;Here is the BNF file&lt;br /&gt;&lt;br /&gt;"Name"    = 'SPL' &lt;br /&gt;"Version" = '2009'&lt;br /&gt;"Author"  = ''Mir Sajal'&lt;br /&gt;"About"   = 'Simple SPL'&lt;br /&gt;"Case Sensitive" = False&lt;br /&gt;"Start Symbol" = &lt;Program&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Character&amp;gt;::= {letter}&lt;br /&gt;&amp;lt;Digit&amp;gt;::= {digit}&lt;br /&gt;&amp;lt;CharacterOrDigit&amp;gt;::= {alphanumeric}&lt;br /&gt;NewLine ::= {CR}{LF}|{CR}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Identifier&amp;gt;::= &amp;lt;Character&amp;gt;&amp;lt;CharacterOrDigit&amp;gt;*&lt;br /&gt;&amp;lt;Number&amp;gt;::= &amp;lt;Digit&amp;gt;*|&amp;lt;Digit&amp;gt;+"."&amp;lt;Digit&amp;gt;+&lt;br /&gt;&amp;lt;Negative;&amp;gt::= "-"&lt;br /&gt;&amp;lt;NumberConstant&amp;gt;::= &amp;lt;Negative&amp;gt;&amp;lt;Number&amp;gt;|&amp;lt;Number&amp;gt;&lt;br /&gt;&amp;lt;CharacterConstant&amp;gt;::= "'"&amp;lt;Character&amp;gt;"'"&lt;br /&gt;&amp;lt;Constant&amp;gt;::= &amp;lt;NumberConstant&amp;gt;|&amp;lt;CharacterConstant&amp;gt;&lt;br /&gt;&amp;lt;Value&amp;lt;::= &amp;lt;Identifier&amp;gt;|&amp;lt;Constant&amp;gt;|"("&amp;lt;Expression&amp;gt;")"&lt;br /&gt;&amp;lt;Term&amp;gt;::=^lt;Value&amp;gt;|&amp;lt;Value&gt;&amp;gt;"*"&amp;lt;Value&amp;gt;+|&amp;lt;Value&amp;gt;"/"&amp;lt;Value&amp;gt;+&lt;br /&gt;&amp;lt;Expression&amp;gt;::= &amp;lt;Term&amp;gt;|&amp;lt;Term&amp;gt;"+"&amp;lt;Term&amp;gt;+|&amp;lt;Term&amp;gt;"-"&amp;lt;Term&amp;gt;+&lt;br /&gt;&amp;lt;Comparator&amp;gt;::= "=" | "&amp;gt;&amp;lt;" | "&amp;lt;" | "&amp;gt;" | "&amp;lt;=" | "&amp;gt;="&lt;br /&gt;&amp;lt;AndOr&amp;gt;::= AND | OR&lt;br /&gt;&amp;lt;Check&amp;gt;::= [&amp;lt;Not&amp;gt;]&amp;lt;Expression&amp;gt;&amp;lt;Comparator&amp;gt;&amp;lt;Expression&amp;gt;&lt;br /&gt;&amp;lt;Conditional&amp;gt;::= &amp;lt;Check&amp;gt;|&amp;lt;Check&amp;gt;&amp;lt;AndOr&amp;gt;&amp;lt;Check&amp;gt;+&lt;br /&gt;&amp;lt;Program&amp;gt; ::= &amp;lt;Identifier&amp;gt;";"&amp;lt;Block&amp;gt;"ENDP"&amp;lt;Identifier&amp;gt;"."&lt;br /&gt;&amp;lt;Block&amp;gt;::= [DECLARATIONS&amp;lt;DeclarationBlock&amp;gt;]CODE&amp;lt;StatementList&amp;gt;&lt;br /&gt;&amp;lt;IdentifierList&amp;gt;::= &amp;lt;Identifier&amp;gt;|&amp;lt;Identifier&amp;gt;","&amp;lt;Identifier&amp;gt;+&lt;br /&gt;&amp;lt;DeclarationBlock&amp;gt;::= &amp;lt;IdentifierList&amp;gt; OF TYPE&amp;lt;Type&amp;gt;";"&lt;br /&gt;&amp;lt;Type&amp;gt;::= CHARACTER | INTEGER | REAL&lt;br /&gt;&amp;lt;StatementList&amp;gt;::= &amp;lt;Statement&amp;gt;|&amp;lt;Statement&amp;gt;";"&amp;lt;Statement&amp;gt;+";"&lt;br /&gt;&amp;lt;Statement&amp;gt;::= &amp;lt;Assignment&amp;gt; | &amp;lt;If&amp;gt; | &amp;lt;Do&amp;gt; | &amp;lt;While&amp;gt; | &amp;lt;Write&amp;gt; | &amp;lt;Read&amp;gt;&lt;br /&gt;&amp;lt;Assignment&amp;gt;::= &amp;lt;Expression&amp;gt; "-&amp;gt;" &amp;lt;Identifier&amp;gt;&lt;br /&gt;&amp;lt;If&amp;gt;::= IF &amp;lt;Conditional&amp;gt; THEN &amp;lt;StatementList&amp;gt; ["ELSE" &amp;lt;StatementList&amp;gt;] ENDIF&lt;br /&gt;&amp;lt;Do&amp;gt;::= DO&amp;lt;StatementList&amp;gt;WHILE&amp;lt;Conditional&amp;gt;ENDDO&lt;br /&gt;&amp;lt;While&amp;gt;::= WHILE&amp;lt;Conditional&amp;gt;DO&amp;lt;StatementList&amp;gt;ENDWHILE&lt;br /&gt;&amp;lt;For&amp;gt;::= FOR&amp;lt;Identifier&amp;gt;IS&amp;lt;Expression&amp;gt;BY&amp;lt;Expression&amp;gt;TO&amp;lt;Expression&amp;gt;DO&amp;lt;StatementList&amp;gt;ENDFOR&lt;br /&gt;&amp;lt;Write&amp;gt;::= WRITE&amp;lt;OutputList&amp;gt; | Newline&lt;br /&gt;&amp;lt;Read&amp;gt;::= READ&amp;lt;Identifier&amp;gt;&lt;br /&gt;&amp;lt;OutputList&amp;gt;::= &amp;lt;Value&amp;gt; |&amp;lt;Value&amp;gt;","&amp;lt;Value&amp;gt;+&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-2153295174311513428?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/2153295174311513428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=2153295174311513428' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/2153295174311513428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/2153295174311513428'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/12/compiler-construction-phase-one.html' title='Compiler Construction: Phase One (Backus–Naur Form)'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-7637101270955233779</id><published>2009-10-27T07:12:00.000-07:00</published><updated>2009-10-27T11:09:10.520-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><title type='text'>MySQL StartUp :))</title><content type='html'>Here are some useful commands of MySQL.&lt;br /&gt;In unix systems, mysql server startup command:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;/etc/init.d/mysql start&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;login to server:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;mysql -uUsername -hHostname -p&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To select an database:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;use database_name;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To show the properties of a table : &lt;br /&gt;&lt;span style="font-style:italic;"&gt;desc table_name;&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;show the table contents:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;select * from table_name;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Granting privileges to a user:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;grant all privileges on *.* to username@hostname identified by "password";&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-7637101270955233779?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/7637101270955233779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=7637101270955233779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7637101270955233779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7637101270955233779'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/10/mysql-startup.html' title='MySQL StartUp :))'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-630980501219092513</id><published>2009-08-03T13:03:00.000-07:00</published><updated>2011-06-30T23:28:39.585-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gnokii'/><category scheme='http://www.blogger.com/atom/ns#' term='System Programming'/><title type='text'>A Sample Process Calling Example</title><content type='html'>&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;I used gnokii to send sms. So I need to execute the command from my code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(255, 255, 255);"&gt;/usr/bin/gnokii --sendsms 8801712273933&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So at first, I installed gnokii in my Ubuntu 9.04. Then &lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;I copied the gnokiirc file from /etc to my home folder and renamed it to .gnokiirc&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;I opened the file and did some change to it. I was using my Siemens SK65 with a data cable.&lt;br /&gt;I did some tweaking to my .gnokiirc file. All # signs indicate comments. I removed hash sign from some lines. Those lines are:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;font-size:85%;" &gt;port = /dev/ttyUSB0&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;font-size:85%;" &gt;model = AT&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;font-size:85%;" &gt;initlength = default&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;font-size:85%;" &gt;&lt;span style="color: rgb(255, 255, 255);"&gt;connection = serial&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;As my model isn't supported officially by Gnokii so I added a hash sign before the "model = " line.&lt;br /&gt;Then&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt; I run this command in my console&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;gnokii --identify&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;The output is something like this:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;GNOKII Version 0.6.26&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;IMEI         : 354784000367194&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;Manufacturer : SIEMENS&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;Model        : Gipsy Soft Protocolstack&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;Product name : Gipsy Soft Protocolstack&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-style: italic;"&gt;Revision     : 50,"OFFICIAL","2005&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Then I wrothe C file sample.c&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" style="color: rgb(255, 255, 255);" href="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SndOYON_9QI/AAAAAAAAACg/KqjvWMm4SP4/s1600-h/Screenshot-2.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 178px;" src="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SndOYON_9QI/AAAAAAAAACg/KqjvWMm4SP4/s400/Screenshot-2.png" alt="" id="BLOGGER_PHOTO_ID_5365843659075876098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;When I run this file, a new process is opened and gnokii --sendsms command is executed.After sending the SMS the process gonna close. The phone number in the code is the receiver of the message.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;For more info, log into &lt;/span&gt;&lt;a style="color: rgb(255, 255, 255);" href="http://www.gnokii.org/"&gt;www.gnokii.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Courtesy  : Burhan Uddin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-630980501219092513?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/630980501219092513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=630980501219092513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/630980501219092513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/630980501219092513'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/08/sample-process-calling-example.html' title='A Sample Process Calling Example'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_XUNnqjZRQ8o/SndOYON_9QI/AAAAAAAAACg/KqjvWMm4SP4/s72-c/Screenshot-2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-8084918764083075380</id><published>2009-08-03T00:27:00.000-07:00</published><updated>2009-08-03T00:49:27.075-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Dictionary'/><title type='text'>Algorithmic Aspects of Shadhinota (English to Bengali Dictionary)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnaSy-JttOI/AAAAAAAAACQ/qMsBK8U5TeM/s1600-h/logo.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 154px; height: 154px;" src="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnaSy-JttOI/AAAAAAAAACQ/qMsBK8U5TeM/s400/logo.png" alt="" id="BLOGGER_PHOTO_ID_5365637410433381602" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;The most crucial part of building a dictionary is to make an efficient searching technology. There are several ways to keep the words ….May be SQL database, XML data or simple text file. I prefered the text files to keep my data. I want to build a simple desktop utility for general users. I don't expect a general user should install a database software in order to use my dictionary. I aint very good at XML stuffs. So one way is open for me, that is to use text files.&lt;br /&gt;&lt;br /&gt;But the main problem of using text file is to maintain the efficient algorithm. I used a simple concept for searching the desired words. Here we go now....&lt;br /&gt;&lt;br /&gt;At first I used 26 directories for 26 letters of English alphabet. Every directory has some text files...suppose ab.txt, ac.txt,a.txt......etc. Here ab.txt has the words a, absent,abstract.... every words having the prefix of “ab". Now when I enter a word in my dictionary, at first it goes to the corresponding directory according to the first letter and next it goes to the corresponding text file. Now the second problem arises. One word can be used more than one time in a text file. For example:&lt;br /&gt;&lt;br /&gt;The pattern of the text file may be like this&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Word &lt;span style="color: rgb(0, 0, 153);"&gt;Meanings&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;Country&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;&lt;span style="font-weight: bold;"&gt;Home&lt;/span&gt;land,Motherland,&lt;span style="font-weight: bold;"&gt;Home&lt;/span&gt;..........&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;…....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;…....&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;…....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;Home&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;House, Place of Accomodation ....&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;My dictionary searches the word and if it finds the word in the file then print the consecutive words and stop printing when it finds new line. But if same word is used more than once the total process get messed. So I need to distinguish the searched words from others. They need to be unique. I simply added a numeric character before every searched word. Now the text file will be like this&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;Word &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Meanings&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;2Country&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt; Homeland,Motherland,Home..........&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;…....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;…....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;…....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;2Home&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;House, Place of Accomodation ....&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now every searched word has a unique identity. There could be approximate 26*25 files in 26 directories. A tree like hierarchy will be made and searching the words will be done via the traversing the file hierarchy.&lt;/span&gt;   	&lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt; 	&lt;title&gt;&lt;/title&gt; 	&lt;meta name="GENERATOR" content="OpenOffice.org 3.0  (Linux)"&gt; 	&lt;style type="text/css"&gt; 	&lt;!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 	--&gt;&lt;/style&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-8084918764083075380?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/8084918764083075380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=8084918764083075380' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8084918764083075380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8084918764083075380'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/08/algorithmic-aspects-of-shadhinota.html' title='Algorithmic Aspects of Shadhinota (English to Bengali Dictionary)'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnaSy-JttOI/AAAAAAAAACQ/qMsBK8U5TeM/s72-c/logo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-5069681990395401195</id><published>2009-07-31T10:44:00.000-07:00</published><updated>2009-07-31T11:09:29.379-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shadhinota'/><category scheme='http://www.blogger.com/atom/ns#' term='Dictionary'/><category scheme='http://www.blogger.com/atom/ns#' term='Qt4'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI Programming'/><title type='text'>Little bit about my Dictionary (Part One)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnMvZMVT4JI/AAAAAAAAACI/1PBWEu2ACgk/s1600-h/Screenshot-Shadhinota.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 340px; height: 316px;" src="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnMvZMVT4JI/AAAAAAAAACI/1PBWEu2ACgk/s400/Screenshot-Shadhinota.png" alt="" id="BLOGGER_PHOTO_ID_5364683690982236306" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;I made a small English to Bengali dictionary based on Qt4. In this post I gonna describe the environment setup process for it. I was so excited cause it was my first opensource desktop project.&lt;br /&gt;&lt;br /&gt;Properties of the project:&lt;br /&gt;Primary language: C++&lt;br /&gt;Primary toolkit: QT4&lt;br /&gt;Primary IDE: CodeBlocks with MinGW,QDevelop&lt;br /&gt;Objective: Open Source cross platform English to Bengali Dictionary.&lt;br /&gt;Setting Up the Environment:&lt;br /&gt;OS: Windows XP&lt;br /&gt;        #install codeblocks-8.02mingw.I used C:\Program Files\CodeBlocks path&lt;br /&gt;        use gcc as default compiler&lt;br /&gt;        #install qt-win-opensource-4.4.3-mingw I used C:\Qt4 path&lt;br /&gt;        #install Qdevelop (optional)&lt;br /&gt;        Setting up environment variables:&lt;br /&gt;        Right click on My Computer and open properties box. Click on the advanced tab and go to&lt;br /&gt;Environment Variable option.On user variable area click on New button and set the following&lt;br /&gt;environment variables.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Variable name:           PATH&lt;br /&gt;Variable Values:         C:\Qt\4.4.3\bin;C:\Program Files\CodeBlocks\MinGW\bin;&lt;br /&gt;Variable name:           QMAKESPEC&lt;br /&gt;Variable Values:         win32-g++&lt;br /&gt;Variable name:           QTDIR&lt;br /&gt;Variable Values:         C:\Qt\4.4.3&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;You may need to restart windows.&lt;br /&gt;Go to Start menu..Run...cmd&lt;br /&gt;Give the command:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;qmake -v&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;make -v&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;gcc -v&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Go to C:\Program Files\CodeBlocks\mingw\bin and create a batch file named make.bat&lt;br /&gt;file:       make.bat&lt;br /&gt;contained text:&lt;br /&gt;&lt;br /&gt;                     &lt;span style="font-style: italic;"&gt;@echo off&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                        mingw32-make %*&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;run that batch file from cmd.&lt;br /&gt;then u will have to type make instead of mingw32-make&lt;br /&gt;***In Windows You must Enable Unicode based Bengali.You can use a Bangla Keyboard Utility&lt;br /&gt;which supports Unicode.***&lt;br /&gt;OS:         Linux&lt;br /&gt;Install g++,QT4 with your package manager or from source code.&lt;br /&gt;Compiling Shadhinota:&lt;br /&gt;        Command line compilation:&lt;br /&gt;        go to source folder from command line and give the following command:&lt;br /&gt;&lt;br /&gt;        &lt;span style="font-style: italic;"&gt;qmake -project&lt;br /&gt;        qmake&lt;br /&gt;        make&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;           Compiling using Qdevelop:&lt;br /&gt;        Open Qdevelop&lt;br /&gt;        Click on Project menu&lt;br /&gt;        select Open Project and open the *.pro file of Shadhinota's source directory.&lt;br /&gt;        Use Build or Rebuild option from Build menu.&lt;br /&gt;        Run the executable from the source folder.&lt;br /&gt;        Under Windows:&lt;br /&gt;        copy the mingwm10.dll,QtCore4.dll,QtCored4.dll,QtGuid4.dll from codeBlock/mingw/bin&lt;br /&gt;        and Qt4.4.3/bin directory to your executable's directory for portability.&lt;br /&gt;&lt;br /&gt;In the next post I will write about the GUI part of Shadhinota and the algorithm&lt;br /&gt;used in this software.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-5069681990395401195?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/5069681990395401195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=5069681990395401195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5069681990395401195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5069681990395401195'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/07/little-bit-about-my-dictionary-part-one.html' title='Little bit about my Dictionary (Part One)'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_XUNnqjZRQ8o/SnMvZMVT4JI/AAAAAAAAACI/1PBWEu2ACgk/s72-c/Screenshot-Shadhinota.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-7692148102934288077</id><published>2009-07-09T22:52:00.000-07:00</published><updated>2009-07-09T23:39:28.669-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>using Tomcat in Ubuntu 9.04</title><content type='html'>I'm debugging my University's result processing software. The total software is written in JSP. I had to install Tomcat6 for this.Then I installed the package libapache2-mod-jk.&lt;br /&gt;I gave the command in the terminal to confirm if the jk module is installed properly.&lt;br /&gt;&lt;span style="font-style:italic;"&gt; sudo ls /etc/apache2/mods-enabled/&lt;/span&gt;&lt;br /&gt;The output was the following:&lt;br /&gt;     alias.conf            autoindex.conf    &lt;span style="font-weight:bold;"&gt;   jk.load &lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;            php5.conf&lt;br /&gt;     alias.load            autoindex.load       log_sql.load            php5.load&lt;br /&gt;     auth_basic.load       cgi.load         log_sql_mysql.load         setenvif.conf&lt;br /&gt;     authn_file.load       deflate.conf         log_sql_ssl.load    setenvif.load&lt;br /&gt;     authz_default.load    deflate.load         mime.conf     status.conf&lt;br /&gt;     authz_groupfile.load  dir.conf         mime.load     status.load&lt;br /&gt;     authz_host.load       dir.load         negotiation.conf&lt;br /&gt;     authz_user.load       env.load         negotiation.load&lt;br /&gt;&lt;br /&gt;We can see that jk.load is showed and we assume everything reqired to configure the server is okay.&lt;br /&gt;Then I opened root window by pressing Alt+F2 with gksu nautilus command.I opened /etc/libapache2-mod-jk/workers.properties file and used these lines...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;workers.tomcat_home=/usr/share/tomcat6&lt;br /&gt;workers.java_home=/usr/lib/jvm/java-6-openjdk&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Then I opened  /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf&lt;br /&gt;copied the contents and paste it to the ending of /etc/apache2/apache2.conf&lt;br /&gt;Then opened /etc/rc.local and added these two lines:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;export JDK_HOME=/usr/lib/jvm/java-6-openjdk&lt;br /&gt;export JAVA_HOME=/usr/lib/jvm/java-6-openjdk&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then I restarted apache2 and tomcat &lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;sudo /etc/init.d/apache2 restart&lt;br /&gt;sudo /usr/share/tomcat6/bin/./shutdown.sh&lt;br /&gt;sudo /usr/share/tomcat6/bin/./startup.sh&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hosting place is /var/lib/tomcat6/webapps/ROOT/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-7692148102934288077?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/7692148102934288077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=7692148102934288077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7692148102934288077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7692148102934288077'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/07/using-tomcat-in-ubuntu-904.html' title='using Tomcat in Ubuntu 9.04'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-5195851222433207179</id><published>2009-07-04T06:40:00.000-07:00</published><updated>2009-07-17T03:56:11.275-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SWIG'/><title type='text'>My first project using SWIG</title><content type='html'>Problem Summary:&lt;br /&gt;&lt;br /&gt;We've a byte array in java which has 10000 elements. We have a shared library built with C , which contains some native functions who take char*,signed or unsigned char * parameters.&lt;br /&gt;Now the task is to pass the byte array into the native functions and get the desired result.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Solution Summary:&lt;br /&gt;&lt;br /&gt;We used SWIG to make a bridge between C and Java. There are two major tasks. One is to make the byte array acceptable as a char pointer in native functions and the other thing is to retrieve the array via pinning.&lt;br /&gt;&lt;br /&gt;To do the first task I need to use the typemapping feature of SWIG. To do the second task I call the getByteArrayElements method which is a JNI method depends on JRE implementation on the desired platform.&lt;br /&gt;&lt;br /&gt;Let we have a C file which contains the native functions and we have a Java file from which we call those functions. Here the sample files are given:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FILE: sample.c&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XUNnqjZRQ8o/SmBO-AIIUTI/AAAAAAAAABA/zSu5jZvPto8/s1600-h/Screenshot.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 257px; height: 320px;" src="http://3.bp.blogspot.com/_XUNnqjZRQ8o/SmBO-AIIUTI/AAAAAAAAABA/zSu5jZvPto8/s320/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5359370383663845682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FILE: Runner.java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SmBUFOcSVPI/AAAAAAAAABo/SrjDXfdWIzQ/s1600-h/Screenshot-5.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 227px;" src="http://1.bp.blogspot.com/_XUNnqjZRQ8o/SmBUFOcSVPI/AAAAAAAAABo/SrjDXfdWIzQ/s320/Screenshot-5.png" alt="" id="BLOGGER_PHOTO_ID_5359376005323707634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now the task is to pass the byte array into the native functions and get the desired results. So a SWIG input file is needed to do the task. The warapper files will be used to make the bridge between two languages. The main challenge is to make the typemapping in that file. Here is the file I wrote to create the wrappers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FILE: sample.i&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XUNnqjZRQ8o/SmBXw6KZWBI/AAAAAAAAACA/uaUQUAYSF68/s1600-h/Screenshot-8.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 232px;" src="http://3.bp.blogspot.com/_XUNnqjZRQ8o/SmBXw6KZWBI/AAAAAAAAACA/uaUQUAYSF68/s400/Screenshot-8.png" alt="" id="BLOGGER_PHOTO_ID_5359380054329088018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Generating the warapper files:&lt;br /&gt;&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Warning: This is a platform specific solution. Compilationa may vary from platform to platform. Here I used Ububtu 9.04 with openjdk implementation.&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;            I generated my first required files by this SWIG command:&lt;br /&gt;       &lt;i&gt;     swig  -java sample.i &lt;/i&gt;&lt;br /&gt;           &lt;br /&gt; Now I compiled demo1.cpp file with the following command&lt;br /&gt;            &lt;i&gt;gcc -c -fpic sample.c &lt;/i&gt;&lt;br /&gt;        &lt;br /&gt; Then I compiled the wrapper file generarted by SWIG with the help of following&lt;br /&gt; command which can be varied if the JDK header files location is different.&lt;br /&gt;           &lt;i&gt;&lt;span&gt;gcc -c -fpic sample_wrap.c -I/usr/lib/jvm/java-6-open&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;&lt;span&gt;jdk/include/ -I/usr/lib/jvm/java-6-open&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;jdk/include/linux&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;           &lt;br /&gt; Now its the time to make the library which will be used to access the array by native&lt;br /&gt; methods. I used Linux platform, So the library will be libsample.so. If you are using Windows OS, hen&lt;br /&gt; you should generate libsample.dll file.&lt;br /&gt;            &lt;i&gt;gcc -shared sample.o sample_wrap.o -o libsample.so&lt;br /&gt;          &lt;/i&gt;&lt;br /&gt; I should add my directory's address to my System's PATH variable to avoid library&lt;br /&gt; linking error with this command.&lt;br /&gt;&lt;i&gt;&lt;span&gt;            export LD_LIBRARY_PATH=.:$LD_LIBR&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;ARY_PATH&lt;br /&gt;     &lt;/i&gt;     &lt;br /&gt; It's the time to compile the source java file:&lt;br /&gt;           &lt;i&gt; javac Runner.java&lt;br /&gt; &lt;/i&gt;&lt;br /&gt; &lt;b&gt;Showing Output: &lt;/b&gt;&lt;br /&gt;         To view the output, I used this command.&lt;br /&gt;         &lt;i&gt;java Runner&lt;/i&gt;&lt;br /&gt; &lt;br /&gt; We shall see the output in the console.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Technical Details of sample.i File:&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the first portion of sample.i file we included sample.h file. Otherwise we need to manually declare the prototypes of the native functions.&lt;br /&gt;After that part I include the various.i file of SWIG's library which is needed to do the necessary typemapping from byte datatype to char ponter. Then I declared the first function's (add() function)prototype that doesn't require typemapping.&lt;br /&gt;The second function addIntArray also doesn't require typemapping. So I simply write its prototype. Now we proceed to the third native function testAddByteArray which returns int value and takes char pointer.Here we need to do little coding.&lt;br /&gt;At first we need to rewrite the prototype like this: extern int testAddByteArray(int n,char *BYTE);&lt;br /&gt;Look we use BYTE and INPUTkeyword here. This is must for making the typemaps of byte datatype.&lt;br /&gt;Then I write an in method which describes the parameters and also the way to receive the parameters.&lt;br /&gt;  &lt;i&gt;%typemap(in) (int INPUT,char *BYTE) {&lt;br /&gt;&lt;span&gt;    $1= JCALL2(GetArrayLength,jenv&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;,$input,0);  &lt;br /&gt;&lt;span&gt;    $2 = (char *) JCALL2(GetByteArrayElement&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;s, jenv, $input, 0);&lt;br /&gt;   //Pinning is occured here&lt;br /&gt;  } &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The local variable $1 receives the array size and $2 receives the byte array by using getByteArrayElements JNI method. If the JRE supports pinning then the array will be retrieved via pinning, that means no copying will be occurred when the array passed to the native functions. The garbage collector must support pinning. In many implementations, pinning is undesirable because it complicates garbage collection algorithms and leads to memory fragmentation. If the garbage collector supports pinning, and the layout of the array is the same as that of a native array of the same type, then no copying is needed. Otherwise, the array is copied to a nonmovable memory block (for example, in the C heap) and the necessary format conversion is performed. A pointer to the copy is returned.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Similarly I've to write code to release memory with this code.&lt;br /&gt;  &lt;i&gt;%typemap(argout) char *BYTE {&lt;br /&gt;&lt;span&gt;        JCALL3(ReleaseByteArrayEle&lt;/span&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;ments, jenv, $input, (jbyte *) $1, 0);&lt;br /&gt;  //Prevent default freearg typemap from being used&lt;br /&gt;  %typemap(freearg) char *BYTE "" &lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-5195851222433207179?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/5195851222433207179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=5195851222433207179' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5195851222433207179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/5195851222433207179'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/07/my-first-project-using-swig.html' title='My first project using SWIG'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_XUNnqjZRQ8o/SmBO-AIIUTI/AAAAAAAAABA/zSu5jZvPto8/s72-c/Screenshot.png' height='72' width='72'/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-7134731425184054438</id><published>2009-06-15T07:46:00.000-07:00</published><updated>2009-06-15T08:00:25.549-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SWIG'/><title type='text'>Using JNI method in SWIG's input file</title><content type='html'>&lt;span&gt;Sometimes we've to use JNI's built in methods in SWIG's input file. Though SWIG's proxy class can do everything possible for JNI,but I prefer to use JNI's method where SWIG gets complicated. For example, I have a byte Array in my java file.If I want to retrieve the array by pinning, we can use getArrayPrimitiveCritical(&lt;/span&gt;&lt;div&gt;&lt;wbr&gt;&lt;span class="word_break"&gt;&lt;/span&gt;) JNI method.Here I gonna give an example that will help you a lot about using JNI's built in method in SWIG.&lt;br /&gt;&lt;br /&gt;Let the java file is Runner.java and the code is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; public class Runner {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;        static {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                  try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    System.loadLibrary("sample&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                     }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;           catch (UnsatisfiedLinkError e) {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;       System.err.println("Native&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt; code library failed to load.\n" + e);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;System.exit(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;   public static void main(String argv[]) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;//declaration of the array&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      byte array[] = new byte [10000];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;          for (int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;array[i] =  (byte)((int)i%64);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; //call the native method&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  sample.point_accessPinArra&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;y(array);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now the input file can be like this(sample.i)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;/* File : sample.i */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; %module sample&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;%{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;#include "ByteArray.h"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;#include "/usr/lib/jvm/java-6-openj&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;dk/include/jni.h"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;JNIEXPORT void JNICALL Java_sampleJNI_point_1acce&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ssPinArray(JNIEnv *jenv, jclass jcls,jbyteArray array) {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;int i;int size;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;size = (*jenv)-&gt;GetArrayLength(je&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;nv, array);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;//pinning process is going to be started from here if your garbage collector supports //pinning. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  jbyte* body = (*jenv)-&gt;GetPrimitiveArray&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Critical(jenv, array, NULL); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(*jenv)-&gt;ReleasePrimitiveA&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;rrayCritical(jenv, array, body, 0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;%}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;%native(point_accessPinArr&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ay) void *point_accessPinArray(jbyt&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;eArray array);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commands to compile and run:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;$swig -java sample.i&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $gcc -c -fpic sample_wrap.cxx -I/usr/lib/jvm/java-6-open&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;jdk/include/ -I/usr/lib/jvm/java-6-open&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;jdk/include/linux/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $gcc -shared sample_wrap.o -o libexample.so&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $export LD_LIBRARY_PATH=.:$LD_LIBR&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ARY_PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $javac Runner.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $java Runner&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-7134731425184054438?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/7134731425184054438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=7134731425184054438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7134731425184054438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7134731425184054438'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/06/sometimes-weve-to-use-jnis-built-in.html' title='Using JNI method in SWIG&apos;s input file'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-8699410771169192313</id><published>2009-06-14T12:29:00.000-07:00</published><updated>2009-06-14T13:02:49.049-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SWIG'/><title type='text'>Using SWIG to cooperate Java with C++</title><content type='html'>Courtesy : SWIG Tutorial&lt;br /&gt;&lt;br /&gt;Let the main file where my functions and variables are located is example.cxx&lt;br /&gt;Write that source.&lt;br /&gt;&lt;br /&gt;Then create an interface file .let example.i&lt;br /&gt;where the previous module's variables and functions have to be declared.&lt;br /&gt;&lt;br /&gt;Sample:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; /* example.i */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  %module example&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  %{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  /* Put header files here or function declarations like below */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  extern type variableName;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  extern type functionName(parameters);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;   %}&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-style: italic;"&gt; extern type variableName;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; extern type functionName(parameters);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; //end of file&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then create main java file.Let Its name is main.java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; //main.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; public class main {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    public static void main(String argv[]) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      System.loadLibrary("exampl&lt;/span&gt;&lt;div&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;e");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      System.out.println(example&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;.getvariableName());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      System.out.println(example&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;.functionName(parameters))&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;;&lt;/span&gt;&lt;br /&gt;     &lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;commands:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;$swig -c++ -java example.i&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $g++ -c -fpic example.cxx&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $g++ -c -fpic example_wrap.cxx -I/usr/lib/jvm/java-6-sun-&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;1.6.0.06/include/ -I/usr/lib/jvm/java-6-sun-&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;1.6.0.06/include/linux&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $g++ -shared example.o example_wrap.o -o libexample.so&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $export LD_LIBRARY_PATH=.:$LD_LIBR&lt;/span&gt;&lt;wbr style="font-style: italic;"&gt;&lt;span style="font-style: italic;" class="word_break"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ARY_PATH&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $javac main.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; $java main&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can make a shell script to automate the commands.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-8699410771169192313?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/8699410771169192313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=8699410771169192313' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8699410771169192313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/8699410771169192313'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2009/06/using-swig-to-cooperate-java-with-c.html' title='Using SWIG to cooperate Java with C++'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4330430783248485602.post-7177850290063980122</id><published>2007-03-06T02:19:00.000-08:00</published><updated>2007-03-06T02:24:30.659-08:00</updated><title type='text'>One Day Closer to World Domination</title><content type='html'>It is a common question raised in many peoples mind in the present world- "Is Open Source Movement is right for us?"Even in our college campus I've to debate with some of my proprietary favored friends who think open source is not right choice.It's a common mistake among the general people who are not introduced with open source environment that they think open source or free softwares are not so flexible or, easy to control, and over all they wanna say it as a frightening matter to the IT world. We all know, it's a time consuming matter to develop a software. Why developers open its source? What is the benefit or what's the main purpose? It's common thought of them if the source code of software is available to everyone, why dose a programmer work so hard to build a quality application? Here is the fact, they analyze the incidents from their own perspective. But they should think over the other side of the coin. Some applicationslike system software (Linux, Windows, Mac and UNIX etc.), Database Management software (MySQL, SQLite, Oracle etc.), Internet tools (Netscape Navigator, Internet Explorer, Evolution, Kmail, Mozilla Firefox etc.) have a responsibility to ensure highest security for their users. Proprietary Software companies always try to give a very admirable supports to the customers. But it's also true they compel their users to take service only from them. Okay, I don't want to say that they don't have the right to serve better to their customers. But what we see in other perspectives. If you buy a car you can repair it from anyone. Similarly, if you have trouble to use any electronic or simple utensils, you are not bound to take facility from one and only one companies. So, why not a software customer can take advantage from many? I can give you an example, we all know about virus attacks and crackers movement against the Microsoft world. Now we can see Microsoft can't stop them in many perspectives with its lonely effort. Microsoft works with many software companies, but software based solutions are mainly provided from Microsoft among them. So, when Microsoft failed to solve a problem, their users don't have any opportunities to rescue themselves. Though many utilities are driven into the market to keep your Windows OS perfect, they can't give you the highest support because the core of windows is unknown to them.In the Linux world, people around the world are ready to help you.Click on net, make friends and take solutions. You are not bound to use one product or one service. Here developers want to share their ideas with others and give you various opportunities to use their products. "Commercialization is not present here"-it's a common thought (which is not right) among several people. In open source world, service is the main product. Open source technologies give chances to their users to think again &amp; ensure great service. I think the most interactive feature of using open source technology is the freedom to modify software as user needs. It's a remarkable matter that most of the open source technologies are more secured than proprietary alternatives. We can look back only a few times ago, Internet explorer defeated by Mozilla Web Browser in the battle of browser world. The hidden mystery is lying behind the source code opening strategy. You can think over the Apache server.At the primary stage of Apache web server, developers and users around the world tried to fix its security holes and built it as one of the most powerful web servers in the world. It was possible for spreading the source to mass. For this reason, Apache server could be the most popular web server in a few years. On the other hand, Microsoft 2000 and NT servers are being attacked by crackers day by day. Microsoft technology failed to prove success against millions of open minds. They can't satisfy their users with necessary security by preventing the continuous harmful approach of crackers.If you have a simple knowledge of Information Technology, I expect you have heard about SPYWARE. A user can't make him free from anxiety without ensuring that his PC free from spyware. It's greatly true for the government institutions. Proprietary software can't give you any guarantee that their products are not spyware without showing the source code. In the present situation governments of many countries like France, Germany, China, Malaysia, India use open source software for their administrative works. In U.S.A. it may be surprising information for you that White House, NASA use open source technology. In 2004, Munich migrated to Linux. The city dropped windows from 14000 desktop PCs, opting instead to go with an open source solution based on Linux. Now open world is ready to compete with the proprietary hell. Volunteers are working for hours and hours in order to spread our thought. We welcome you in the colorful area of Open World. You can find a huge number of Operating Systems, applications and development tools to welcome you. I'm sure you will grab this in a moment. At last, the main gift for you from the open source world is a large number of friends. You can share your ideas with us. We are beside you. Open Source is the other name of love for us. We are waiting for accepting your great contribution for the wellbeing of Information Technology world. Don't forget -"MILLONS OF OPEN MINDS CAN'T BE WRONG."                                                                                               &lt;br /&gt;&lt;br /&gt;M Rezaur rahman&lt;br /&gt;Linux Enthusiast&lt;br /&gt;&lt;a href="mailto:webweaver@dhaka.net"&gt;webweaver@dhaka.net&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4330430783248485602-7177850290063980122?l=prachcho.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prachcho.blogspot.com/feeds/7177850290063980122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4330430783248485602&amp;postID=7177850290063980122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7177850290063980122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4330430783248485602/posts/default/7177850290063980122'/><link rel='alternate' type='text/html' href='http://prachcho.blogspot.com/2007/03/one-day-closer-to-world-domination.html' title='One Day Closer to World Domination'/><author><name>Reza</name><uri>http://www.blogger.com/profile/12516929299913060654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_XUNnqjZRQ8o/TG2J8tiCaeI/AAAAAAAAAE4/Ak4GNt8uSFo/S220/me.jpg'/></author><thr:total>0</thr:total></entry></feed>
