<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>rahmetli.info | eminbugrasaral</title>
	
	<link>http://rahmetli.info/en</link>
	<description>Emin Buğra Saral</description>
	<lastBuildDate>Sat, 29 Dec 2012 19:03:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rahmetli" /><feedburner:info uri="rahmetli" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to access KU NetStorage via an FTP client?</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/ZzwX0jy7uQI/</link>
		<comments>http://rahmetli.info/en/how-to-access-ku-netstorage-via-an-ftp-client/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 10:45:07 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[macosx]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[cit]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ftp client]]></category>
		<category><![CDATA[koç university]]></category>
		<category><![CDATA[koc university netstorage]]></category>
		<category><![CDATA[ku]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[net storage]]></category>
		<category><![CDATA[net storage ftp client]]></category>
		<category><![CDATA[netstorage ftp]]></category>
		<category><![CDATA[netstorage ftp client]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=793</guid>
		<description><![CDATA[To upload any file to the F folder, the students of Koç University are required to connect NetStorage by using &#8220;File Access&#8221; section under My.KU as CIT informs. For other purposes such as downloading files, FileZilla is given as an option. This is unnecessary&#8230;
NetStorage is built on an extension of HTTP which is called WebDav. Most [...]]]></description>
			<content:encoded><![CDATA[<p>To upload any file to the F folder, the students of <a title="KU" href="http://www.ku.edu.tr" target="_blank">Koç University</a> are required to connect <a title="NetStorage" href="https://netstorage.ku.edu.tr/netstorage/" target="_blank">NetStorage</a> by using &#8220;File Access&#8221; section under <a title="My.KU" href="http://my.ku.edu.tr" target="_blank">My.KU</a> as <a title="CIT" href="http://cit.ku.edu.tr" target="_blank">CIT</a> informs. For other purposes such as downloading files, <a title="FileZilla" href="http://filezilla-project.org/" target="_blank">FileZilla</a> is given as an option. This is unnecessary&#8230;</p>
<p>NetStorage is built on an extension of HTTP which is called <a title="WebDav Wiki" href="http://en.wikipedia.org/wiki/WebDAV" target="_blank">WebDav</a>. Most of the FTP clients are able to create WebDav connections but FileZilla.</p>
<p><a title="Cyberduck" href="http://cyberduck.ch/" target="_blank">Cyberduck</a> is a &#8220;FTP, SFTP, WebDAV &amp; cloud storage browser for Mac &amp; Windows&#8221; that you can use to connect NetStorage and upload your files and homeworks. For those whom would like to know the steps:</p>
<p>1) Click on &#8220;<strong>Open Connection</strong>&#8221; and select <strong>WebDAV (HTTP/SSL)</strong> as the preferred option:</p>
<p><a href="http://rahmetli.info/en/wp-content/uploads/2012/03/Screen-Shot-2012-03-18-at-12.02.40-PM.png" rel="lightbox[793]" title="Cyberduck - WebDAV - Step 1"><img class="aligncenter size-full wp-image-794" title="Cyberduck - WebDAV - Step 1" src="http://rahmetli.info/en/wp-content/uploads/2012/03/Screen-Shot-2012-03-18-at-12.02.40-PM.png" alt="" width="736" height="535" /></a></p>
<p>&nbsp;</p>
<p>2) Fill in the settings:</p>
<p><a href="http://rahmetli.info/en/wp-content/uploads/2012/03/Screen-Shot-2012-03-18-at-12.03.06-PM.png" rel="lightbox[793]" title="Cyberduck WebDAV - Step 2"><img class="aligncenter size-full wp-image-795" title="Cyberduck WebDAV - Step 2" src="http://rahmetli.info/en/wp-content/uploads/2012/03/Screen-Shot-2012-03-18-at-12.03.06-PM.png" alt="" width="455" height="388" /></a></p>
<p><strong>Server:</strong> netstorage.ku.edu.tr , <strong>Port:</strong> 443 (Default)<br />
<strong>Username</strong>: <em>school username (ex: esaral)<br />
</em><strong>Password: </strong><em>school password (ex: 123456abc)<br />
</em><strong>Path: </strong>/oneNet/NetStorage (<span style="color: #ff0000;">THIS IS REQUIRED! But you can add any desired path after the root</span>)<br />
<strong>Example Path: </strong>/oneNet/NetStorage/DriveF@VOL/COURSES/UGRADS (to go directly under UGRADS folder)</p>
<p><strong>ADDITIONAL INFO</strong>:<br />
- You don&#8217;t have to use Cyberduck, this is only one of the most popular ones. There are bunch of FTP clients you can rely on. <a title="BitKinex Download" href="http://www.bitkinex.com/download" target="_blank">BitKinex</a> (Windows-only) is also one of them.  On the other hand, you can try &#8220;mapping network drive&#8221; to WebDAV in Windows 7 (and Vista) by reading <a title="http://help.wildapricot.com/display/DOC/Setting+Up+WebDAV+in+Windows+7" href="http://help.wildapricot.com/display/DOC/Setting+Up+WebDAV+in+Windows+7" target="_blank">this article</a>.<br />
- If you are a Mac user, you should be probably using <a title="Panic - Transmit" href="http://panic.com/transmit/" target="_blank">Transmit</a> because it&#8217;s magnificent, but you may use &#8220;Go -&gt; Connect to Server&#8221; in Finder as well.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/ZzwX0jy7uQI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/how-to-access-ku-netstorage-via-an-ftp-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/how-to-access-ku-netstorage-via-an-ftp-client/</feedburner:origLink></item>
		<item>
		<title>A simple thread example (session control) in C</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/fmDu6eGtUOg/</link>
		<comments>http://rahmetli.info/en/a-simple-thread-example-session-control-in-c/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 15:45:00 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[c]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[c example]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[multi-thread]]></category>
		<category><![CDATA[multithread]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[session check]]></category>
		<category><![CDATA[session control]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=786</guid>
		<description><![CDATA[I&#8217;m experienced at multi-thread programming in Java but never used this method in C. One of our homeworks required a session management for a program that ends the execution if the user stays inactive for 60 seconds; therefore using a thread to handle session expiration sounds very useful. Here&#8217;s a simple example of implementing this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m experienced at multi-thread programming in Java but never used this method in C. One of our homeworks required a session management for a program that ends the execution if the user stays inactive for 60 seconds; therefore using a thread to handle session expiration sounds very useful. Here&#8217;s a simple example of implementing this method which I wrote:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
<span style="color: #339933;">#include &lt;time.h&gt; </span>
<span style="color: #339933;">#include &lt;pthread.h&gt; // necessary</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Session limit in seconds</span>
<span style="color: #339933;">#define SESSION_TIME 60</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Global last interaction variable</span>
time_t lastInteraction<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Thread function that will control session time</span>
<span style="color: #993333;">void</span> <span style="color: #339933;">*</span> session<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span> arg<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Session will constantly check if the session is expired or not</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// In each loop, get current time</span>
		time_t c<span style="color: #339933;">;</span>
		time<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Then compare it with the lastInteraction time</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>c <span style="color: #339933;">-</span> lastInteraction <span style="color: #339933;">&gt;=</span> SESSION_TIME<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Session expired<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #993333;">const</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Set the initial interaction time</span>
	time<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>lastInteraction<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Create session</span>
	<span style="color: #808080; font-style: italic;">/*
	* Note: if pthread_create executes successfuly, tid gets the return id of session. 
	* First NULL indicates we will use default attributes for our thread
	* session is the name of the method which will handle thread's execution
	* last NULL is the argument will be used inside session but I preferred using it globally
	*/</span>
	pthread_t tid<span style="color: #339933;">;</span>
	pthread_create<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>tid<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> session<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Create input string</span>
	<span style="color: #993333;">char</span> input<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">30</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Program starts</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Ask user for inputs with scanf (or fgets depending on your program)</span>
		<span style="color: #666666; font-style: italic;">// Assume that user waits and does not enter any thing for 60 seconds,</span>
		<span style="color: #666666; font-style: italic;">// during this time thread gets executed and checks whether the limit is reached or not</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Enter something: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		input<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// optional: empty the string</span>
		scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Update the last activation time after user gives an input</span>
		time<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>lastInteraction<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/fmDu6eGtUOg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/a-simple-thread-example-session-control-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/a-simple-thread-example-session-control-in-c/</feedburner:origLink></item>
		<item>
		<title>Bus Timetable application for iPhone</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/43FtZNr4iho/</link>
		<comments>http://rahmetli.info/en/bus-timetable-application-for-iphone/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 22:51:18 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[announcement]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[iett]]></category>
		<category><![CDATA[iett otobüs saatleri]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphone için iett]]></category>
		<category><![CDATA[iphone için iett uygulaması]]></category>
		<category><![CDATA[iphone uygulaması]]></category>
		<category><![CDATA[iphone web application]]></category>
		<category><![CDATA[iwebkit]]></category>
		<category><![CDATA[otobüs saatleri]]></category>
		<category><![CDATA[web uygulaması]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=778</guid>
		<description><![CDATA[There is no application that can truly inform you about bus hours in Istanbul. Therefore I thought I should build mine. I simply get the data from IETT&#8216;s content (I wish they had API) by using regular expression methods. This is sure a web application and I used iWebKit for the interface and PHP for [...]]]></description>
			<content:encoded><![CDATA[<p>There is no application that can truly inform you about bus hours in Istanbul. Therefore I thought I should build mine. I simply get the data from <a title="Istanbul Electricity, Tramway and Tunnel General Management" href="http://www.iett.gov.tr/en/">IETT</a>&#8216;s content (I wish they had API) by using regular expression methods. This is sure a web application and I used iWebKit for the interface and PHP for the background.</p>
<p>The application&#8217;s interface is currently in Turkish. Simply you write the code of the bus line into the box and optionally select arrival/departure options. Then the application gets the list of whole bus stops and timetables for you. The information is always up to date and it&#8217;s always free.</p>
<p>You can try the application here: <a title="İETT Otobüs Saatleri" href="http://www.rahmetli.info/iett/">http://www.rahmetli.info/iett/</a></p>

<a href='http://rahmetli.info/en/bus-timetable-application-for-iphone/iett-1/' title='iett-1'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2012/02/iett-1-150x150.png" class="attachment-thumbnail" alt="iett-1" title="iett-1" /></a>
<a href='http://rahmetli.info/en/bus-timetable-application-for-iphone/iett-2/' title='iett-2'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2012/02/iett-2-150x150.png" class="attachment-thumbnail" alt="iett-2" title="iett-2" /></a>
<a href='http://rahmetli.info/en/bus-timetable-application-for-iphone/iett-3/' title='iett-3'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2012/02/iett-3-150x150.png" class="attachment-thumbnail" alt="iett-3" title="iett-3" /></a>

<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/43FtZNr4iho" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/bus-timetable-application-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/bus-timetable-application-for-iphone/</feedburner:origLink></item>
		<item>
		<title>GPA Recorder (Java application)</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/6irn78tOHKg/</link>
		<comments>http://rahmetli.info/en/gpa-recorder-java-application/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 23:40:27 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[gpa]]></category>
		<category><![CDATA[GPA calculator]]></category>
		<category><![CDATA[gpa calculator application]]></category>
		<category><![CDATA[GPA recorder]]></category>
		<category><![CDATA[java applet]]></category>
		<category><![CDATA[save courses with gpa]]></category>
		<category><![CDATA[save GPA]]></category>
		<category><![CDATA[save gpa data]]></category>
		<category><![CDATA[save gpa results]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=756</guid>
		<description><![CDATA[GPA Recorder is a simple GPA calculator with additional features such as keeping records of the courses. You can calculate your GPA of a selected semester along with your total GPA and see the change on action.
+ Why people would need this application?
- I&#8217;m not sure but I made this because I wanted to see [...]]]></description>
			<content:encoded><![CDATA[<p>GPA Recorder is a simple <strong>GPA calculator</strong> with additional features such as keeping records of the courses. You can calculate your GPA of a selected semester along with your total GPA and see the change on action.</p>
<p>+ Why people would need this application?<br />
- I&#8217;m not sure but I made this because I wanted to see my final GPA with expected grades.</p>
<p>Here is the download link: <a href="http://www.rahmetli.info/files/GPA%20Recorder.jar" target="_blank">http://www.rahmetli.info/files/GPA%20Recorder.jar</a></p>
<p><img class="aligncenter" title="GPA Recorder v1.1" src="http://rahmetli.info/en/wp-content/uploads/2012/02/GPA-Recorder-v1.1.png" alt="" width="597" height="600" /></p>
<p><strong><span style="color: #800000;">ATTENTION:</span></strong><br />
Please try to keep the application in a folder because it creates a hidden database file in its same directory. If you try to move the application, its database remains in old directory as a folder named &#8220;.gpa_data&#8221;.</p>
<p><strong>Current features:<br />
</strong>- GPA is calculated over 4.00<br />
- Maximum credit hours value is 6<br />
- Values of an added course can be replaced by clicking on its table values<br />
- Ability to sort each table column<br />
- Cross platform application which requires Java 1.6+<br />
- No limit at adding courses<br />
- No need of the internet connection (except sending suggestions)<br />
- Enable/disable course in the table (<strong>added in v1.1</strong>)</p>
<p><strong>In future releases:</strong><br />
- Online access to the course database with user registration will be added<br />
- Auto-complete in course name will be added<br />
- Undo the last action will be added<br />
- Multiple selection in the course table will be added</p>
<p><strong>NOTE:<br />
</strong>The main purpose of creating this application is experiencing Java RDBMS, SQL (sqlite, mysql), Java Applets and JSP.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/6irn78tOHKg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/gpa-recorder-java-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<enclosure url="http://www.rahmetli.info/files/GPA%20Recorder.jar" length="3168803" type="application/java-archive" /><media:content url="http://www.rahmetli.info/files/GPA%20Recorder.jar" fileSize="3168803" type="application/java-archive" /><feedburner:origLink>http://rahmetli.info/en/gpa-recorder-java-application/</feedburner:origLink></item>
		<item>
		<title>Java algorithms used in RSA decryption</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/uxd5m9Apzo8/</link>
		<comments>http://rahmetli.info/en/java-algorithms-used-in-rsa-decryption/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 20:14:49 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[extended Euclidian algorithm]]></category>
		<category><![CDATA[find exponent]]></category>
		<category><![CDATA[greatest common divisor]]></category>
		<category><![CDATA[java algorithms]]></category>
		<category><![CDATA[modular exponentiation]]></category>
		<category><![CDATA[modular inverse]]></category>
		<category><![CDATA[prime factorization]]></category>
		<category><![CDATA[prime number validation]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[rsa algorithm java]]></category>
		<category><![CDATA[rsa algorithms in java]]></category>
		<category><![CDATA[rsa decryption]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=737</guid>
		<description><![CDATA[You can see the details of RSA algorithm here.
Shortly: For a given prime number n, we must take its prime factorization to find p and q that n = p*q. Then we need to find the exponent e which is between 1 and (p-1)*(q-1), and the number d which is the modular inverse of e [...]]]></description>
			<content:encoded><![CDATA[<p>You can see the details of RSA algorithm <a href="http://en.wikipedia.org/wiki/RSA_(algorithm)"><strong>here</strong></a>.</p>
<p><strong>Shortly:</strong> For a given prime number <strong>n</strong>, we must take its prime factorization to find <strong>p</strong> and <strong>q</strong> that <em>n = p*q</em>. Then we need to find the exponent <strong>e</strong> which is between <em>1 and (p-1)*(q-1)</em>, and the number <strong>d</strong> which is the <em>modular inverse of e in modulo (p-1)*(q-1)</em> so that we will be using <strong>extended Euclidian algorithm</strong>.</p>
<p><strong>Algorithms which will be used</strong>:</p>
<p>- Prime validation:<br />
<em>boolean isPrime(n: Integer)</em></p>
<p>- Finding factors of a prime number:<br />
<em>ArrayList&lt;Integer&gt; findFactors(n: Integer)</em></p>
<p>- Finding greatest common divisor:<br />
<em>int gcd(num1: Integer, num2: Integer)</em></p>
<p>- Getting p and q from n:<br />
<em>int[] getFactorizationPair(n: Integer)</em></p>
<p>- Calculating modular exponentiation:<br />
<em>int modularExpo(b: Integer, e: Integer, m: Integer)</em></p>
<p>- Calculating extended Euclidian:<br />
<em>int[] extendedEuclidian(f: Integer, a: Integer)</em></p>
<p>- Calculating modular inverse:<br />
<em>int modularInverse(n: Integer, m: Integer)</em></p>
<p>- Finding e (exponent):<br />
<em>int findExponent(p: Integer, q: Integer)</em></p>
<p>- Decryption:<br />
<em>ArrayList<em>&lt;Integer&gt;</em> decrypt(blocks: ArrayList<em>&lt;Integer&gt;</em>, d: Integer, m: Integer)</em></p>
<p><span style="color: #800000;"><strong>Prime validation:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isPrime<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;=</span> input<span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>input <span style="color: #339933;">%</span> i <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Finding greatest common divisor:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> gcd<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> num1, <span style="color: #000066; font-weight: bold;">int</span> num2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">int</span> x<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> y<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>num1 <span style="color: #339933;">%</span> num2 <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		x <span style="color: #339933;">=</span> num2<span style="color: #339933;">;</span>
		y <span style="color: #339933;">=</span> num1<span style="color: #339933;">%</span>num2<span style="color: #339933;">;</span>
		num1 <span style="color: #339933;">=</span> x<span style="color: #339933;">;</span>
		num2 <span style="color: #339933;">=</span> y<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> num2<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Finding factors of a prime number:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">ArrayList</span> findFactors<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">ArrayList</span> factors <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> temp <span style="color: #339933;">=</span> input<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> input<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// try prime numbers to divide input, if it divides add it to factors</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isPrime<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>temp <span style="color: #339933;">%</span> i <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				factors.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				temp <span style="color: #339933;">=</span> temp <span style="color: #339933;">/</span> i<span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> factors<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Getting p and q from n:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getFactorizationPair<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">int</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> pair <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">ArrayList</span> f <span style="color: #339933;">=</span> findFactors<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>f <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> f.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> f.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> f.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> n <span style="color: #339933;">/</span> pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">// p = pair[0], q = pair[1]</span>
	<span style="color: #000000; font-weight: bold;">return</span> pair<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Calculating modular exponentiation:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> modularExpo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> e, <span style="color: #000066; font-weight: bold;">int</span> m<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">String</span> eBinary <span style="color: #339933;">=</span> <span style="color: #003399;">Integer</span>.<span style="color: #006633;">toBinaryString</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> power <span style="color: #339933;">=</span> b <span style="color: #339933;">%</span> m<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// because of binary representation, loop goes in opposite direction</span>
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> eBinary.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Character</span>.<span style="color: #006633;">digit</span><span style="color: #009900;">&#40;</span>eBinary.<span style="color: #006633;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			x <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">*</span> power<span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> m<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		power <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>power<span style="color: #339933;">*</span>power<span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> m<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> x<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Calculating extended Euclidian:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> extendedEuclidian<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> f, <span style="color: #000066; font-weight: bold;">int</span> a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">int</span> s0 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> s1 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> t0 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> t1 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">int</span> dividend <span style="color: #339933;">=</span> f<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> divisor <span style="color: #339933;">=</span> a<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">int</span> r <span style="color: #339933;">=</span> dividend <span style="color: #339933;">%</span> divisor<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// remainder</span>
	<span style="color: #000066; font-weight: bold;">int</span> q <span style="color: #339933;">=</span> dividend <span style="color: #339933;">/</span> divisor<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// quotient</span>
	dividend <span style="color: #339933;">=</span> divisor<span style="color: #339933;">;</span>
	divisor <span style="color: #339933;">=</span> r<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>r <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> stemp <span style="color: #339933;">=</span> s0 <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>q <span style="color: #339933;">*</span> s1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		s0 <span style="color: #339933;">=</span> s1<span style="color: #339933;">;</span>
		s1 <span style="color: #339933;">=</span> stemp<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> ttemp <span style="color: #339933;">=</span> t0 <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>q <span style="color: #339933;">*</span> t1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		t0 <span style="color: #339933;">=</span> t1<span style="color: #339933;">;</span>
		t1 <span style="color: #339933;">=</span> ttemp<span style="color: #339933;">;</span>
&nbsp;
		r <span style="color: #339933;">=</span> dividend <span style="color: #339933;">%</span> divisor<span style="color: #339933;">;</span>
		q <span style="color: #339933;">=</span> dividend <span style="color: #339933;">/</span> divisor<span style="color: #339933;">;</span>
		dividend <span style="color: #339933;">=</span> divisor<span style="color: #339933;">;</span>
		divisor <span style="color: #339933;">=</span> r<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">int</span> array<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>s1,t1<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">return</span> array<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Calculating modular inverse:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> modularInverse<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> n, <span style="color: #000066; font-weight: bold;">int</span> m<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// in the equation of f*s + a*t of ExtendedEuclidian, t represents the inverse of a in modulo f</span>
	<span style="color: #000066; font-weight: bold;">int</span> pair<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> extendedEuclidian<span style="color: #009900;">&#40;</span>m, n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">return</span> pair<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Finding e (exponent):</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> findExponent<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> p, <span style="color: #000066; font-weight: bold;">int</span> q<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// if p is smaller than q, swap them</span>
	<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>p <span style="color: #339933;">&lt;</span> q<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> t <span style="color: #339933;">=</span> p<span style="color: #339933;">;</span>
		p <span style="color: #339933;">=</span> q<span style="color: #339933;">;</span>
		q <span style="color: #339933;">=</span> t<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>q <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">&gt;=</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>gcd<span style="color: #009900;">&#40;</span>i, <span style="color: #009900;">&#40;</span>p<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>q<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> i<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// in case of the condition does not hold</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: #800000;"><strong>Decryption:</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> ArrayList<span style="color: #339933;">&lt;</span>Integer<span style="color: #339933;">&gt;</span> decrypt<span style="color: #009900;">&#40;</span>ArrayList<span style="color: #339933;">&lt;</span>Integer<span style="color: #339933;">&gt;</span> block, <span style="color: #000066; font-weight: bold;">int</span> d, <span style="color: #000066; font-weight: bold;">int</span> m<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	ArrayList<span style="color: #339933;">&lt;</span>Integer<span style="color: #339933;">&gt;</span> newBlock <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> i <span style="color: #339933;">:</span> block<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		i <span style="color: #339933;">=</span> modularExpo<span style="color: #009900;">&#40;</span>i, d, m<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		newBlock.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// i refers to each decrypted message: c^d = i (mod m)</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> newBlock<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em><span style="color: #800000;"><strong>Source(s):</strong></span></em><br />
<strong>&#8220;Discrete Mathematics and Its Applications&#8221;</strong> 6th Edition by <em>Kenneth H. Rosen</em> from McGraw-Hill;<br />
Extended Euclidian algorithm in page 246,<br />
Modular Exponentiation algoritm in page 226.</p>
<p><a title="RSA Descryption" href="http://home.ku.edu.tr/~yyemez/comp106/prg_assg1.pdf">RSA Decryption assignment</a> by <a title="Yücel Yemez - Koç University" href="http://home.ku.edu.tr/~yyemez/">Yücel Yemez</a>.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/uxd5m9Apzo8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/java-algorithms-used-in-rsa-decryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<enclosure url="http://home.ku.edu.tr/~yyemez/comp106/prg_assg1.pdf" length="118809" type="application/pdf" /><media:content url="http://home.ku.edu.tr/~yyemez/comp106/prg_assg1.pdf" fileSize="118809" type="application/pdf" /><feedburner:origLink>http://rahmetli.info/en/java-algorithms-used-in-rsa-decryption/</feedburner:origLink></item>
		<item>
		<title>How to open Word documents in Pages (Mac OS X)</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/eHn6Y0Pgb8A/</link>
		<comments>http://rahmetli.info/en/how-to-open-word-documents-in-pages-mac-os-x/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 14:49:15 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[macosx]]></category>
		<category><![CDATA[edit .doc file in pages]]></category>
		<category><![CDATA[edit word documents in pages]]></category>
		<category><![CDATA[how to edit word document in pages]]></category>
		<category><![CDATA[make pages default application for word documents]]></category>
		<category><![CDATA[open .doc file in Pages]]></category>
		<category><![CDATA[open word documents in mac os x]]></category>
		<category><![CDATA[open word documents in pages]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=722</guid>
		<description><![CDATA[If you are a Mac user, probably you don&#8217;t want to see any trademark of Microsoft on your computer. Therefore you may want to open or edit your .doc/.docx files in Pages. By default, you are able to view those files in Pages. The only thing you have to do is changing default application for [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">If you are a Mac user, probably you don&#8217;t want to see any trademark of Microsoft on your computer. Therefore you may want to open or edit your .doc/.docx files in <a title="Buy the application" href="http://itunes.apple.com/us/app/pages/id361309726?mt=8" target="_blank">Pages</a>. By default, you are able to view those files in Pages. The only thing you have to do is changing default application for those extensions. Just click right to the file and select &#8220;Get Info&#8221;:</p>
<p style="text-align: justify;"><img class="alignleft size-full wp-image-723" title="Example doc file" src="http://rahmetli.info/en/wp-content/uploads/2011/10/example-doc-file-1.png" alt="" width="701" height="316" /></p>
<p style="text-align: justify;">Here is the tricky part. Some good people at Apple decided to build Pages as a viewer of Word documents. It may be because of market strategies. Anyway, you can only open the document and view it, you can&#8217;t directly change itself. To be able to edit your document when you are simultaneously viewing it, you have to change the configurations of Pages.</p>
<p style="text-align: justify;">Go to your applications folder, click right to Pages and open &#8220;Show Content Packages&#8221; and later &#8220;Contents&#8221;. You will see a file named &#8220;Info.plist&#8221;. You have to edit this file manually and replace the attribute &#8220;Viewer&#8221; with &#8220;Editor&#8221; for the type of Word documents:</p>
<p style="text-align: justify;"><img class="alignleft size-full wp-image-724" title="Xcode" src="http://rahmetli.info/en/wp-content/uploads/2011/10/Xcode.png" alt="" width="701" height="311" /></p>
<p style="text-align: justify;">If you can&#8217;t edit &#8220;Info.plist&#8221; because of permission denial, you can try using <a href="http://en.wikipedia.org/wiki/Apple_Terminal" title="Terminal" target="_blank">Terminal</a>. Type this line in your console and hit enter:<br />
&#8220;sudo nano /Applications/Pages.app/Contents/Info.plist&#8221;</p>
<p>Last, change those lines from &#8220;Viewer&#8221; to &#8220;Editor&#8221;:</p>
<p style="text-align: justify;"><img class="size-full wp-image-725" title="TextMate" src="http://rahmetli.info/en/wp-content/uploads/2011/10/plist-editor-from-viewer.png" alt="" width="701" height="574" /></p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/eHn6Y0Pgb8A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/how-to-open-word-documents-in-pages-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/how-to-open-word-documents-in-pages-mac-os-x/</feedburner:origLink></item>
		<item>
		<title>A long road trip to Bodrum with friends</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/2uhLNJULnLQ/</link>
		<comments>http://rahmetli.info/en/a-long-road-trip-to-bodrum-with-friends/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 08:32:51 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[diary]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=707</guid>
		<description><![CDATA[
For a long time I haven&#8217;t gone for a vacation, and this was the first time visiting the south of Turkey especially with a bunch of friends in a car. My lieutenant cousin, his brother and two friends from the military academy, and me. As you can guess, our road trip was fun but also [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/the_beginning_of_trip.jpg" alt="" title="The Beginning Of Trip" width="700" height="525" class="alignleft size-full wp-image-709" /></p>
<p>For a long time I haven&#8217;t gone for a vacation, and this was the first time visiting the south of Turkey especially with a bunch of friends in a car. My lieutenant cousin, his brother and two friends from the military academy, and me. As you can guess, our road trip was fun but also tiring. Thanks that I didn&#8217;t get my driver license yet, I was out of the drivers&#8217; list, but I might call myself the guide because my iPhone knew the way all the time.</p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/the_road.jpg" alt="" title="The Road" width="700" height="523" class="alignleft size-full wp-image-710" /></p>
<p>The route was starting from Ankara and ending in <a href="http://en.wikipedia.org/wiki/Bodrum,_Muğla" target="_blank" title="about Bodrum">Bodrum, Muğla</a> on 4th September, but I was in <a href="http://en.wikipedia.org/wiki/Trabzon" title="about Trabzon" target="_blank">Trabzon</a> (Northeast of Turkey) at this time. I flied over <a href="http://en.wikipedia.org/wiki/Ankara" title="about Ankara" target="_blank">Ankara</a> and joined the guys, and the trip started around 11 am. We didn&#8217;t know it was going to be too late in the end. We didn&#8217;t also know it would be too boring in the car because there was no cd player, and the music we had wasn&#8217;t enjoying us. I barely remember what we talked about until arriving <a href="http://en.wikipedia.org/wiki/Söke" title="about Soke" target="_blank">Soke</a>, <a href="http://en.wikipedia.org/wiki/Aydın" title="about Aydin" target="_blank">Aydin</a>. In this small town, there was a huge house of the family of my cousin&#8217;s friend (Mehmet Ali) in a village, and they nicely welcomed us. Even they gave gifts after a lovely dinner before we continue our way. At least we were full, and I can&#8217;t describe the happiness we had. I must say that I didn&#8217;t expect that hospitality, but even Mehmet&#8217;s father served us on the dinner table. I&#8217;m still very thankful for that night.</p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/google_maps.png" alt="" title="Google Maps" width="700" height="520" class="alignleft size-full wp-image-711" /></p>
<p>We arrived home at 1 am on 5th September. The summer house of my cousin was a total mess or garbage I must say, and he and his friends didn&#8217;t become uncomfortable as I did so I went to neighbors to ask for some cleaning materials. Surprising that neighbors invited us to drink some tea along with deserts. After a chit chat, we went back home and started cleaning. It was not going to finish if we didn&#8217;t just clean the surface. We slept without planning our holiday because we were exhausted.</p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/turkbuku.jpg" alt="" title="Turkbuku" width="700" height="523" class="alignleft size-full wp-image-713" /></p>
<p>First day was started at the beach of summer house. The water was not as we expected so we spent only a few house then we decided to visit Turkbuku (<a href="http://www.golturkbuku.com/" title="Türkbükü" target="_blank">Golturkbuku</a>). Because it was a bit late, the beach was almost empty so we couldn&#8217;t get fun as much as we did back at home. Therefore my friends went back to the city center, but I preferred staying to see one of my friends from Istanbul. After spending a few hours with her by eating and &#8220;more&#8221;, I joined the guys at Bodrum. I must say that the driver of minibus (dolmuş) was totally a local guy and his accent made me laugh a lot.</p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/the_boat.jpg" alt="" title="The Boat" width="700" height="467" class="alignleft size-full wp-image-714" /></p>
<p>After one day with doing nothing and going out only at nights, we decided to spend our one of last days with a boat tour from 11 am to 6 pm. The coves of Bodrum were magnificent and I never experienced swimming that relaxing before. The water was so clear and still that I didn&#8217;t want to go out. Eventually the day was over and we got exhausted, again. Sleeping was a good choice. </p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/ephesus.jpg" alt="" title="Ephesus" width="700" height="467" class="alignleft size-full wp-image-715" /></p>
<p>On the last day we visited <a href="http://en.wikipedia.org/wiki/Ephesus" title="about Ephesus" target="_blank">Ephesus</a>, <a href="http://en.wikipedia.org/wiki/Izmir" title="about Izmir" target="_blank">Izmir</a> for a few hours and my friends continued without me because I gave a friend promise to meet her in Aydin. My mistake that I guessed Tire was one of Aydin&#8217;s towns. The fact that it was Izmir&#8217;s. So I went back from Tire to <a href="http://en.wikipedia.org/wiki/Selçuk" title="about Selcuk" target="_blank">Selcuk</a> but according to her she had other plans with her girlfriends. That made me so fucking angry because I covered almost 100 kms to see her and I had a flight to Istanbul one day later. Anyway, later I went back to Bodrum with bus and spent my last day alone. Staying in summer house by my own didn&#8217;t seem like a good idea so I looked for a friend and visited him. It was the first time I met him but he was so kind and had an intellectual mind that blew me out. Drinking white wine and watching an amazing view at midnight is the best memory I have from my trip. Ah, by the way his french bulldog was the cutest dog I&#8217;ve ever seen.</p>
<p><img src="http://rahmetli.info/en/wp-content/uploads/2011/09/bodrum_castle.jpg" alt="" title="Bodrum Castle" width="700" height="523" class="alignleft size-full wp-image-718" /></p>
<p>In the morning, he dropped me to bus terminal with his scooter after showing cute and lovely streets of Bodrum. I had 6 hours left until flight so I decided to visit a few museums in Bodrum. The first one was Mausoleum museum and the other one was Bodrum castle along with Museum of Underwater Archaeology. Then I tried delicious meals at different restaurants of Bodrum. I wish I hadn&#8217;t my backpack that heavy. Moreover I lost my last money and I was totally broke while I was going to the airport. I think the bad luck comes with good one because my parents were on their way to Istanbul on that time. I love happy endings.</p>
<p><a href="http://www.facebook.com/media/set/?set=a.10150374455172667.407591.716847666&#038;type=1" title="album in Facebook" target="_blank">Photos?</a></p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/2uhLNJULnLQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/a-long-road-trip-to-bodrum-with-friends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/a-long-road-trip-to-bodrum-with-friends/</feedburner:origLink></item>
		<item>
		<title>to-do script example with php</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/BN-ElFDS8Xo/</link>
		<comments>http://rahmetli.info/en/to-do-script-example-with-php/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 14:41:15 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=694</guid>
		<description><![CDATA[I was trying to make my own simple to-do list and wanted to share it with you guys.
What it&#8217;s capable of:
- Authorization feature (admin).
- Add, edit, remove, move tasks.
- Done and undone (css representation).
First of all, you may want to take a look at demo, or download it.

PHP / HTML CODE:

&#60;?php
/*
* Author: Emin Bugra Saral
* [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to make my own <strong>simple</strong> <u>to-do list</u> and wanted to share it with you guys.<br />
What it&#8217;s capable of:<br />
- Authorization feature (admin).<br />
- Add, edit, remove, move tasks.<br />
- Done and undone (css representation).</p>
<p>First of all, you may want to take a look at <a href="http://www.rahmetli.info/todo" title="To-Do List demo" target="_blank"><strong>demo</strong></a>, or <a href="http://www.rahmetli.info/todo/todo.zip" title="To-Do List archieve"><strong>download</strong></a> it.<br />
<span id="more-694"></span><br />
<strong>PHP / HTML CODE:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
* Author: Emin Bugra Saral
* Website: http://www.rahmetli.info
* Purpose: How to make a to-do list with php
* 
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// SESSION</span>
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// DATABASE</span>
<span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// TASK FORM</span>
<span style="color: #000088;">$form</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;form id=&quot;taskform&quot; method=&quot;post&quot;&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;label for=&quot;task&quot;&gt;Task&lt;/label&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;input id=&quot;task&quot; type=&quot;text&quot; name=&quot;task&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;input name=&quot;add&quot; type=&quot;submit&quot; value=&quot;add&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/form&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// CREATE ID VARIABLE IF IT IS VALID</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM todo WHERE id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ERROR: id is not valid.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// USE ID VARIABLE IF IT EXISTS</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// ADMIN CHECK</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// MOVE IN THE LIST (YOU MAY PREFER USING SWITCH)</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'down'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'up'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// QUERY TO CHANGE IDs OF TASKS</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'down'</span><span style="color: #009900;">&#41;</span>
				<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT id FROM todo WHERE id &gt;= &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; LIMIT 2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'up'</span><span style="color: #009900;">&#41;</span>
				<span style="color: #666666; font-style: italic;">// CHANGE DIRECTION</span>
				<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT id FROM todo WHERE id &lt;= &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; ORDER BY id DESC LIMIT 2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// IF THERE ARE TWO ROWS, GO FOR IT</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// GET POSITIONS</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">++</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
						<span style="color: #000088;">$first</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">else</span>
						<span style="color: #000088;">$second</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #666666; font-style: italic;">// CHANGE POSITIONS (IDs)</span>
				<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE todo SET id = &quot;0&quot; WHERE id =&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$first</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE todo SET id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$first</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; WHERE id =&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$second</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE todo SET id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$second</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; WHERE id =&quot;0&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// DONE - UNDONE</span>
		<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'mark'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$mark</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'status'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE todo SET status = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mark</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; WHERE id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span>
				<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">else</span>
				<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: database issue'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// DELETE</span>
		<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'delete'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DELETE FROM todo WHERE id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// EDIT ALSO CHANGES FORM</span>
		<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'edit'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;form id=&quot;taskform&quot; method=&quot;post&quot;&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;label for=&quot;task&quot;&gt;Task&lt;/label&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;input id=&quot;task&quot; type=&quot;text&quot; name=&quot;task&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;input name=&quot;edit&quot; type=&quot;submit&quot; value=&quot;edit&quot; /&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$form</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/form&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">// ADMIN CHECK FAILS</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ERROR: You don't have permission&quot;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ADD NEW TASK</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'add'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// REMOVE SPACES</span>
	<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// IF IT IS EMPTY</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: fill in the blank'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'INSERT INTO todo(task) VALUES (&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span>
			<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: database issue'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// EDIT TASK</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'edit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: fill in the blank'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE todo SET task = &quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; WHERE id = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// LOGIN USER</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pw</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$pw</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: fill in all blanks'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT user FROM todo_admin WHERE user = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$user</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; AND password = &quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pw</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// IF USER EXISTS</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
			<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ERROR: wrong information, try again.'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// LOGOUT USER</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'logout'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// EMPTY SESSION</span>
	<span style="color: #000088;">$_SESSION</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: ./index.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt; 
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;To-Do List&lt;/title&gt;
	&lt;style&gt;
	body {font:14px Arial,Verdana,sans-serif; text-align:center;}
	a {color:#000;}
	a:hover{color:#666;}
	label {padding:5px;}
	#message {text-align:center;border:solid 5px #666;margin-top:10px;margin-bottom:10px; padding:10px;}
	#container {width:800px;margin:0 auto; text-align:left;}
	#taskform input[type=text] {width:400px;height:20px;font-size:14px;}
	#taskform input[type=submit] {margin-left:5px;width:50px;font-size:14px;}
	#list {border:none;padding:0;margin:0;}
	#list tbody tr:hover {background:#b2b2b2;}
	#list tr td {padding:5px;}
	#list tr td img {margin-right:10px;}
	.check {background: #F5A9A9;}
&nbsp;
	&lt;/style&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&nbsp;
&lt;div id=&quot;container&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div id=&quot;message&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$msg</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;form method=&quot;post&quot;&gt;
	&lt;a href=&quot;./index.php&quot; title=&quot;refresh&quot;&gt;home&lt;/a&gt;
	&lt;input id=&quot;logout&quot; name=&quot;logout&quot; type=&quot;submit&quot; value=&quot;logout&quot; /&gt;
&lt;/form&gt;
&lt;hr/&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;hr/&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;form method=&quot;post&quot;&gt;
	&lt;label for=&quot;username&quot;&gt;username&lt;/label&gt;
	&lt;input id=&quot;username&quot; type=&quot;text&quot; name=&quot;username&quot; value=&quot;admin&quot; /&gt;
	&lt;label for=&quot;password&quot;&gt;password&lt;/label&gt;
	&lt;input id=&quot;password&quot; type=&quot;password&quot; name=&quot;password&quot; value=&quot;1234&quot; /&gt;
	&lt;input name=&quot;login&quot; type=&quot;submit&quot; value=&quot;login&quot; /&gt; &amp;raquo; admin 1234
&lt;/form&gt;
&lt;hr/&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM todo ORDER BY id ASC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table id=&quot;list&quot;&gt;
	&lt;thead&gt;
		&lt;tr&gt;
		&lt;th valign = &quot;top&quot; width=&quot;20&quot;&gt;#&lt;/th&gt;
		&lt;th valign = &quot;top&quot; width=&quot;400&quot;&gt;Task&lt;/th&gt;
		&lt;th valign = &quot;top&quot; width=&quot;150&quot;&gt;Date&lt;/th&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;th valign = &quot;top&quot; width=&quot;200&quot;&gt;Action&lt;/th&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span>
		<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$status</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'status'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;tr'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$status</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">' class=&quot;check&quot;'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;td valign = &quot;top&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #339933;">++.</span><span style="color: #0000ff;">'&lt;/td&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;td valign = &quot;top&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/td&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;td valign = &quot;top&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'date'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/td&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;td valign = &quot;top&quot;&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// done - undone</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;a '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$status</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'title=&quot;undone&quot;'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'title=&quot;done&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'href=&quot;./index.php?action=mark&amp;id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$status</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'&lt;img src=&quot;./buttons/done.gif&quot; alt=&quot;done&quot; /&gt;'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'&lt;img src=&quot;./buttons/undone.gif&quot; alt=&quot;undone&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// edit</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;a title=&quot;edit&quot; href=&quot;./index.php?action=edit&amp;id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img src=&quot;./buttons/edit.gif&quot; alt=&quot;edit&quot; /&gt;&lt;/a&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// delete</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;a OnClick=&quot;return confirm(\'Are you sure?\');&quot; title=&quot;delete&quot; href=&quot;./index.php?action=delete&amp;id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img src=&quot;./buttons/delete.gif&quot; alt=&quot;delete&quot; /&gt;&lt;/a&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// up- down</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;a title=&quot;move up&quot; href=&quot;./index.php?action=up&amp;id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img src=&quot;./buttons/up.gif&quot; alt=&quot;move up&quot; /&gt;&lt;/a&gt;&lt;a title=&quot;move down&quot; href=&quot;./index.php?action=down&amp;id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img src=&quot;./buttons/down.gif&quot; alt=&quot;move down&quot; /&gt;&lt;/a&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/td&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/tr&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$out</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/tbody&gt;
&lt;/table&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;p&gt;There is nothing to do :(&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p><strong>SQL CODE:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SET</span> SQL_MODE<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;NO_AUTO_VALUE_ON_ZERO&quot;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`todo`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`task`</span> longtext <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`status`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`date`</span> <span style="color: #993333; font-weight: bold;">TIMESTAMP</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">CURRENT_TIMESTAMP</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8 <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> ;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`todo_admin`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`user`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">CHARACTER</span> <span style="color: #993333; font-weight: bold;">SET</span> utf8 <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`password`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">CHARACTER</span> <span style="color: #993333; font-weight: bold;">SET</span> utf8 <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1 <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> ;</pre></div></div>

<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/BN-ElFDS8Xo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/to-do-script-example-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<enclosure url="http://www.rahmetli.info/todo/todo.zip" length="6276" type="application/zip" /><media:content url="http://www.rahmetli.info/todo/todo.zip" fileSize="6276" type="application/zip" /><feedburner:origLink>http://rahmetli.info/en/to-do-script-example-with-php/</feedburner:origLink></item>
		<item>
		<title>Creating subdomains with .htaccess</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/corXYQvQ_og/</link>
		<comments>http://rahmetli.info/en/creating-subdomains-with-htaccess/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 18:52:12 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[creating subdomain for users]]></category>
		<category><![CDATA[not operator]]></category>
		<category><![CDATA[RewriteCond]]></category>
		<category><![CDATA[RewriteRule]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=690</guid>
		<description><![CDATA[http://bar.rahmetli.info will redirect to http://www.rahmetli.info/index.php?username=bar
Here is the code to write into .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.rahmetli.info [NC]
RewriteCond %{HTTP_HOST} !^(www)\.rahmetli.info [NC]
RewriteRule (.*) index.php?username=%1

Fourth line will prevent &#8216;www&#8217; to be redirected.
]]></description>
			<content:encoded><![CDATA[<p><strong>http://bar.rahmetli.info</strong> will redirect to <strong>http://www.rahmetli.info/index.php?username=bar</strong></p>
<p>Here is the code to write into .htaccess file:<br />
<code><br />
Options +FollowSymLinks<br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} ^(.*)\.rahmetli.info [NC]<br />
RewriteCond %{HTTP_HOST} !^(www)\.rahmetli.info [NC]<br />
RewriteRule (.*) index.php?username=%1<br />
</code></p>
<p>Fourth line will prevent &#8216;www&#8217; to be redirected.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/corXYQvQ_og" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/creating-subdomains-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/creating-subdomains-with-htaccess/</feedburner:origLink></item>
		<item>
		<title>Making the default first in WPML’s language switcher</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/PZP-g5h7k6k/</link>
		<comments>http://rahmetli.info/en/making-the-default-first-in-wpmls-language-switcher/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 10:50:43 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[custom language switcher]]></category>
		<category><![CDATA[icl_get_languages]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[language order]]></category>
		<category><![CDATA[language switcher]]></category>
		<category><![CDATA[making default first]]></category>
		<category><![CDATA[wmpl]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=672</guid>
		<description><![CDATA[By using Custom Language Switcher of WPML, you can easily create your language list for your theme in WordPress. Sometimes ordering by types such as id, code and name can&#8217;t help you to get your default language to the top of list (array). 
Making your default language&#8217;s position first in WPML&#8217;s language switcher requires an [...]]]></description>
			<content:encoded><![CDATA[<p>By using <a href="http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/" title="Custom Language Switcher">Custom Language Switcher</a> of <a href="http://wpml.org/" title="WPML">WPML</a>, you can easily create your language list for your theme in WordPress. Sometimes ordering by types such as id, code and name can&#8217;t help you to get your default language to the top of list (array). </p>
<p>Making your default language&#8217;s position first in WPML&#8217;s language switcher requires an easy trick as shown below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Get language array</span>
<span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> icl_get_languages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'skip_missing=1&amp;orderby=id&amp;order=asc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Getting default language to first position</span>
<span style="color: #666666; font-style: italic;">// Create a temporary array and hold its first position</span>
<span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'language_code'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'tr'</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Turkish is default</span>
		<span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$l</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// assign default language to first position of temp array</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// push other languages to temp</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// change original with temp, then remove temp</span>
<span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// print links (you can use your own style)</span>
<span style="color: #000088;">$print</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;ul class=&quot;myLanguageSwitcher&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// count languages</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// if the language is active, insert the class &quot;active&quot;</span>
	<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li class=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'active'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// if it's the last language in array, insert the class 'noBackground'</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' noBackground'</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// create link of language with native name</span>
	<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;&gt;&lt;a title=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'native_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'native_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$print</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$print</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Example Output:<br />
<img src="http://rahmetli.info/en/wp-content/uploads/2011/08/language-switcher.png" alt="" title="Language Switcher" width="321" height="23" class="alignleft size-full wp-image-675" /></p>
<div style="clear:both;"></div>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/PZP-g5h7k6k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/making-the-default-first-in-wpmls-language-switcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/making-the-default-first-in-wpmls-language-switcher/</feedburner:origLink></item>
		<item>
		<title>Solving PHP memory size issue in CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/lPRiNo_Dw3w/</link>
		<comments>http://rahmetli.info/en/solving-php-memory-size-issue-in-codeigniter/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 20:45:25 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[codeigniter documentation]]></category>
		<category><![CDATA[codeigniter sql error]]></category>
		<category><![CDATA[database copy]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Fatal error: Allowed memory size]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php memory size]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[table insert with php]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=665</guid>
		<description><![CDATA[While working with a huge database I encountered a memory size error that saying &#8220;Fatal error: Allowed memory size of x bytes exhausted&#8220;. I tried to chance memory size limit in php.ini file but it didn&#8217;t help at all. Using CodeIgniter might cause that the issue because I was using it&#8217;s own database functions to [...]]]></description>
			<content:encoded><![CDATA[<p>While working with a huge database I encountered a memory size error that saying &#8220;<strong>Fatal error: Allowed memory size of x bytes exhausted</strong>&#8220;. I tried to chance memory size limit in php.ini file but it didn&#8217;t help at all. Using <a title="CodeIgniter" href="http://codeigniter.com/">CodeIgniter</a> might cause that the issue because I was using it&#8217;s own database functions to insert data. So, by <strong>also</strong> using <a title="CodeIgniter" href="http://codeigniter.com/">CodeIgniter</a> I found a <strong>simple solution</strong> to copy the table&#8217;s fields to another one: <strong>redirecting url by header function</strong>. This is very easy but I preferred to detail it. Lets go.</p>
<p><strong>Note</strong>: Assuming that both tables are in the same database. You can also read <a href="http://codeigniter.com/user_guide/database/connecting.html">this documentation</a> to connect another database at the same time.</p>
<p>First I created a class to control (copy) table inserting:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> copyTable <span style="color: #000000; font-weight: bold;">extends</span> MG_Controller
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// this is main method, you don't need to use it</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Assuming that your url is <span style="color: #800000;">http://www.rahmetli.info/codeigniter</span> and you uploaded copyTable.php to that directory. You will write <span style="color: #800000;">http://www.rahmetli.info/codeigniter/copyTable</span> to run this class.</p>
<p>Anyway, I added a specific function to copy the table <strong>movies</strong> to the table <strong>films</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> copyTable <span style="color: #000000; font-weight: bold;">extends</span> MG_Controller
<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> moviesToFilms<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.rahmetli.info/codeigniter/copyTable/moviesToFilms'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$offset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">segment</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">segment</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$stop</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">segment</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$offset</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$stop</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM movies LIMIT '</span><span style="color: #339933;">.</span><span style="color: #000088;">$offset</span><span style="color: #339933;">.</span><span style="color: #0000ff;">','</span><span style="color: #339933;">.</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'films_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'films_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'films_duration'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">duration</span>
			<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'films'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// two optional lines:</span>
		<span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free_result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$offset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$offset</span><span style="color: #339933;">+</span><span style="color: #000088;">$limit</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: <span style="color: #006699; font-weight: bold;">$url</span>/<span style="color: #006699; font-weight: bold;">$off</span>/<span style="color: #006699; font-weight: bold;">$limit</span>/<span style="color: #006699; font-weight: bold;">$stop</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Now, to start copying fields from movies to films you will write the initial url into your browser:<br />
<span style="color: #800000;">http://www.rahmetli.info/codeigniter/copyTable/moviesToFilms</span>/<strong>OFFSET_VALUE</strong>/<strong>LIMIT_VALUE</strong>/<strong>STOP_VALUE</strong></p>
<p><strong>For example:</strong><br />
<span style="color: #800000;">http://www.rahmetli.info/codeigniter/copyTable/moviesToFilms</span>/<strong>0</strong>/<strong>100</strong>/<strong>6000</strong></p>
<p>Means that start getting fields from 0th row and continue until 6000th row by 100 rows each time. So the script will run (6000/100 =) 6 times and stop at:<br />
<span style="color: #800000;">http://www.rahmetli.info/codeigniter/copyTable/moviesToFilms</span>/<strong>6000</strong>/<strong>100</strong>/<strong>6000</strong></p>
<p>That&#8217;s it.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/lPRiNo_Dw3w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/solving-php-memory-size-issue-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/solving-php-memory-size-issue-in-codeigniter/</feedburner:origLink></item>
		<item>
		<title>The Living History of Istanbul: HAYDARPAŞA</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/kvScLuE-J54/</link>
		<comments>http://rahmetli.info/en/the-living-history-of-istanbul-haydarpasa/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 09:54:17 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[haydarpaşa]]></category>
		<category><![CDATA[haydarpasa train station]]></category>
		<category><![CDATA[haydarpasa tren istasyonu]]></category>
		<category><![CDATA[historical]]></category>
		<category><![CDATA[historical places in Istanbul]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[istanbul]]></category>
		<category><![CDATA[istanbuldaki tarihi yerler]]></category>
		<category><![CDATA[tarihi binalar]]></category>
		<category><![CDATA[tren]]></category>
		<category><![CDATA[turkey]]></category>
		<category><![CDATA[türkiye]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=655</guid>
		<description><![CDATA[Haydarpaşa is one of the major stations in Istanbul, Turkey because of its location and mission. Being a transportation hub makes it the busiest station of Istanbul so that it provides both domestic and international transportation options. It is also being used for both public transportation and active trading (Turgut 192). It is not only [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Haydarpaşa is one of the major stations in Istanbul, Turkey because of its location and mission. Being a transportation hub makes it the busiest station of Istanbul so that it provides both domestic and international transportation options. It is also being used for both public transportation and active trading (Turgut 192). It is not only a railway station but also a seaport. Before Haydarpaşa met its magnificent building it was just the center of trading during the Ottoman Empire (Quataert 147). After a while Haydarpaşa became one of historical places in Turkey. Its history, value and importance will be detailed in further paragraphs of this article.</p>
<p style="text-align: justify;">Before Haydarpaşa terminus was built in Istanbul, there was not any trading going on (Quataert 141). In a manner, there was not any railway too. During that period when the Ottoman Empire had a bad economic condition because of wars, Deutsche Bank and the government of the Ottoman Empire decided to sign an agreement to construct Anatolian Railway in 1888 (Quataert 139). That starting progress also took the attention of European investors that was meaning a huge amount of profit for the government (Quataert 139). Addition to this, the Ottoman Empire expanded the agreement to build railways to Konya after connecting Istanbul to Ankara (Quataert 147). That construction started a new era of trading and transporting for Turkey because Istanbul would be a good incoming source for the economics.</p>
<p style="text-align: justify;"><a href="http://rahmetli.info/en/wp-content/uploads/2011/07/haydarpasa.jpg" rel="lightbox[655]" title="Haydarpaşa Train Station"><img class="size-medium wp-image-656 alignright" title="Haydarpaşa Train Station" src="http://rahmetli.info/en/wp-content/uploads/2011/07/haydarpasa-225x300.jpg" alt="" width="225" height="300" /></a>Railroads had an important place in the economic development of many countries throughout Europe and America. Behind economics, the help of railroads also improved social and cultural interactions (Quataert 141). The Ottoman Empire had same plans to engage with those improvements but underdevelopment of the Ottoman government lead to dilemma (Quataert 142). The other problem of the Ottoman Empire was also being in wars; therefore Turkey needed to benefit the railroad for strategic purposes such as transporting supply for the army and transferring soldiers to the field (Quataert 159). The government dedicated to the railroad to agriculture and mining sectors when the railroad was ready for public use (Quataert 142).</p>
<p style="text-align: justify;">Not only German companies took advantage of the railroad, but also Americans with The Chester Project tried to construct further railways to reach east of the Ottoman Empire. The project’s name comes from Admiral Colby M. Chester. During his visit to Turkey, Young Turks were the actors of the revolution in 1908 and their promise was to modernize Turkey starting from economic development by extending railroad constructions and developing ports (DeNovo 302). This seemed like an advantage in the eye of Chester but in the end he and his team are defeated by German imperialism and the lack of business support from America (DeNovo 300). His main purpose to build railroads was to control mining ventures and that was not only his idea but also all of investors’.</p>
<p style="text-align: justify;">After completing the web of railroad through Anatolia, Sultan Abdulhamid II made a speech that “I built all those railroads and buildings for the port, but it is not still enough. We shall build such a building that it will prove the grandiosity of what we did” (“Haydarpaşa”). On the demand of Sultan, the construction of Haydarpaşa building was started by two German architectures Otto Ritter and Helmuth Conu in 1906. During the construction, skillful Italian and German sculptors worked together and Haydarpaşa building was completed after two years, in August 1908. The architectural style of Haydarpaşa has Neo Classic German figures as expected. Whole building was constructed on 1100 wooden units which each of them is 21 meters and it has two magnificent towers at the front side. The building was constructed on the area of 2525 square meters but it is spread to 3836 with closed sections.</p>
<p style="text-align: justify;">The name of building is coming from Sultan Selim III who was named “Haydar Paşa”. He had spent most of his time to achieve constructing Selimiye military headquarters and some section of Haydarpaşa took his name in response to his struggle. After a while, authorities decided to give his name to whole building.</p>
<p style="text-align: justify;">Haydarpaşa is still alive after more than one hundred year but it could not remain being fully original because of disasters it faced. First one was an explosion on September 6, 1917 that sounded like a sabotage to destroy main transportation building of Turkey. After that explosion, the roof of Haydarpaşa burnt down and also other sections were damaged. This is not the only disaster it faced in the past; there was a sea accident occurred by a striking tanker in 1979. The stained glasses of Haydarpaşa were damaged in that event but they were replaced with the copies of originals.</p>
<p style="text-align: justify;">Today, Haydarpaşa station is trying to leave all disasters in the past with the help of restorations and have a bright future, but it seems impossible while the government “unofficially” tries to fish on troubled waters. What the government tries to imply is turning Haydarpaşa station into World Trade Center that covers approximately 1.000.000 square meters. Those buildings of five star hotels, skyscrapers, sports and recreation facilities that are planning to be built around Haydarpaşa station would definitely kill the perfect view of Haydarpaşa (Turgut 192). Throwing everything to wind, along a coastal city like Istanbul that has a huge earthquake risk cannot handle that kind of project and it is also violating the Coastal Code of Turkey (Turgut 193).</p>
<p style="text-align: justify;">While the storm is brewing, Haydarpaşa station faced another disaster on November 29, 2010. Was it coincidence? Maybe or maybe not but watching that magnificent building sweeping up the ashes deeply broke the hearts. Sadly, the roof of Haydarpaşa station burnt down for the second time, but its towers were still standing with all of their powers. “Time has stopped at 3.17” said the newspaper Hürriyet, and continued: “For Istanbul’s historical Haydarpaşa train station, the exact minute the building’s roof caught fire Sunday evening (Şenerdem par. 1). But it is not just the clock on the building’s front façade that has stopped: Life has also halted at Haydarpaşa” (Şenerdem par. 1). The key word of that new was “life” because hundreds of passengers uses that station to meet with their lovers, to catch up their works, to travel across the cities. Haydarpaşa has a special place in Turkish people’s hearts, and Sadiye Çoplan who was the witness of that event proved this by saying “I burst into tears when I saw Haydarpaşa burning, it carries value that cannot be bought with money” (Şenerdem par. 2). It is not a building anymore but a breathing creature of Istanbul; therefore seeing Haydarpaşa as a rent-making target as Mehmet Zazan also agrees is a big threat for Istanbul. Then he adds, “It is a shame they did not extinguish the fire from the air” (Şenerdem par. 3).</p>
<p style="text-align: justify;"><a href="http://rahmetli.info/en/wp-content/uploads/2011/07/haydarpasa-2.jpg" rel="lightbox[655]" title="Haydarpaşa Train Station"><img class="alignleft size-medium wp-image-659" title="Haydarpaşa Train Station" src="http://rahmetli.info/en/wp-content/uploads/2011/07/haydarpasa-2-300x225.jpg" alt="" width="300" height="225" /></a>If the government’s or some people’s secret plan on converting Haydarpaşa into a tourist or a commercial center becomes successful, a lot of people will become unemployed. The workers of Haydarpaşa do not work only for money as Mrs. Çoplan emphasized on above, they are also proud of being the part of this dear station (Şenerdem par. 2). In the documentary of Haydarpaşa station, named “Haydarpaşa”, made by TRT (Turkish Radio and Television) one of the machinists tried to explain his feeling while driving a train: “My current mission is bring people together, with their lovers. I serve to the community. When I am off, I go to the coast side of Haydarpaşa and watch the beauty of sea, its waves, and flying seagulls. Watching the passengers coming from ferries and going to the trains we drive is a unique pleasure I cannot describe. I think it is peaceful.”</p>
<p style="text-align: justify;">The distant memories, which Haydarpaşa has, cannot be described. You should spend one day there to understand what the words you are reading mean: A passenger carrying a sleeping baby, the crowd trying to catch trains, magnificent historical pieces of the building, people who could not see their relatives for years or who will not see for years. You can even see a couple getting married in the backyard of Haydarpaşa. Before you leave, because travelling with trains costs less than other transportations, you can see a poor family trying to manage with 6 members. Different lives are getting combined in one place, Haydarpaşa, and it is the last place people hold something; maybe a hand or a body (“Haydarpaşa”).</p>
<p style="text-align: justify;">In the documentary, Adnan Başaran who is the founder of Turkish Union of Railwaymen cried while he is trying to “describe” the meaning of Haydarpaşa for himself but he could not: “I love Haydarpaşa workers (family) as my own son. Haydarpaşa is very beautiful, but it cannot be described”. Muhtar Erol, the current president of TCDD (Turkish State Railways), is better than Başaran on describing the importance of Haydarpaşa by saying “It was in the themes of books and movies, the inspirer for painters and composers. That kind of magic Haydarpaşa has.” Why cannot people easily describe Haydarpaşa is that its value in every person’s life differs. It depends on the time you met with Haydarpaşa and it depends also on the reason why you met with Haydarpaşa. Some people are fascinated by its historical beauty; some has unforgettable memories like I do.</p>
<p style="text-align: justify;">Haydarpaşa station is a remarkable historical building of Turkey that is connected to the web of railways mostly built by Germans. It carries a lot of memories of war, love and nostalgia. Despite of those memories, it is also an important source of economics for Turkey because of being a connection between the land and sea, and having a seaport. Unless the government tries to build a commercial thing such as a hotel instead of keeping Haydarpaşa as a train station, it will remain being that meaningful historical building</p>
<p style="text-align: justify;">&nbsp;</p>
<hr />
<p>&nbsp;</p>
<p><strong>Bibliography</strong>:</p>
<p>DeNovo, John A. “A Railroad for Turkey: The Chester Project, 1908-1913” <em>The Business History Review</em> 33 (1959): 300-329. Print.</p>
<p>Haydarpaşa. Prod. Şükran Bircan Özmen, Dir. Ömer Özmen. TRT, 2008. DVD.</p>
<p>Quataert, Donald. “Limited Revolution: The Impact of the Anatolian Railway on Turkish Transportation and the Provisioning of Istanbul, 1980-1908” <em>The Business History Review</em> 51 (1977): 139-160. Print.</p>
<p>Şenerdem, Erisa Dautaj. “Istanbul&#8217;s Haydarpaşa train station sweeps up the ashes.” <em>Hürriyet Daily News</em> 29 Nov. 2010. Web. 22 March 2011.</p>
<p>Turgut, S. “What the new Istanbul shaped by capital makes one think…” <em>The Sustainable city IV: urban regeneration and sustainability</em> 93 (2006): 189-197. Print.</p>
<p>Unur, A. Sinan. <em>Plaques installed on the façade. </em>[c. 1970].<em> </em>Haydarpaşa Station. <em>Unur</em>. Web. 18 March 2011.</p>
<p><strong><em>The collected links of sources to check:</em></strong></p>
<p>Written sources and photos (figure 3): <a href="http://goo.gl/yg23n">http://goo.gl/yg23n</a> and <a href="http://goo.gl/hLOry">http://goo.gl/hLOry</a><strong> </strong></p>
<p>Hürriyet source: <a href="http://goo.gl/drYmU">http://goo.gl/drYmU</a></p>
<p>Documentary source of TRT (DVD) YouTube links:<a href="http://www.youtube.com/watch?v=6lLZQGA7HZI"></p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/vNmJUF2nqt4?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vNmJUF2nqt4?version=3" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/PansNuqoG0I?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/PansNuqoG0I?version=3" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>http://www.youtube.com/watch?v=6lLZQGA7HZI</a></p>
<p><strong>Photos</strong>: <a href="http://prospektus.tumblr.com">http://prospektus.tumblr.com</a></p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/kvScLuE-J54" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/the-living-history-of-istanbul-haydarpasa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<enclosure url="http://goo.gl/yg23n" length="7017777" type="application/zip" /><media:content url="http://goo.gl/yg23n" fileSize="7017777" type="application/zip" /><feedburner:origLink>http://rahmetli.info/en/the-living-history-of-istanbul-haydarpasa/</feedburner:origLink></item>
		<item>
		<title>Hangman with Visual Basic 2010 Express</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/YjZ1sBnxsDc/</link>
		<comments>http://rahmetli.info/en/hangman-with-visual-basic-2010-express/#comments</comments>
		<pubDate>Wed, 04 May 2011 13:15:52 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[adam asmaca]]></category>
		<category><![CDATA[adam asmaca 4.0]]></category>
		<category><![CDATA[adam asmaca visual basic]]></category>
		<category><![CDATA[adam asmaca visual basic 2010]]></category>
		<category><![CDATA[adam asmaca visual studio]]></category>
		<category><![CDATA[adam asmaca visual studio 2010]]></category>
		<category><![CDATA[hangman]]></category>
		<category><![CDATA[hangman visual basic]]></category>
		<category><![CDATA[hangman visual basic 2010]]></category>
		<category><![CDATA[hangman visual basic 2010 express]]></category>
		<category><![CDATA[visual basic 2010 express]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=604</guid>
		<description><![CDATA[To gain a bit of knowledge about Visual Basic, I tried to code a simple Hangman game. Before learning something about Visual Basic, I had to install Vindovs XP on Mac to set up Visual Basic 2010 Express (requires Service Pack 3). As you all know I hate Vindovs, so I thought I would never [...]]]></description>
			<content:encoded><![CDATA[<p>To gain a bit of knowledge about Visual Basic, I tried to code a simple Hangman game. Before learning something about <a title="Googled it." href="http://www.google.com.tr/search?q=visual+basic">Visual Basic</a>, I had to install Vindovs XP on Mac to set up <a href="http://www.microsoft.com/express/Downloads/#2010-Visual-Basic">Visual Basic 2010 Express</a> (requires Service Pack 3). As you all know I hate Vindovs, so I thought I would never come across it again.</p>
<p>Coding in Visual Basic is quite simple. My preference was &#8220;Form Application&#8221; (Windows Forms) so what I learned addition to my knowledge:</p>
<p>Use Dim to declare a variable, array, anything:<br />
<code>Dim myNumber As Integer</code> or <code>Dim myName</code> or <code>Dim myArray() As Button</code></p>
<p>Use ReDim to re-define an array:<br />
<code>ReDim myArray(13)</code></p>
<p>Use Sub to declare names, parameters and codes:<br />
<code>Private Sub calculateSquare(ByVal value As Integer)<br />
' square is a variable defined in class<br />
square = value * value<br />
End Sub</code></p>
<p>Functions cannot return void, using Sum is an option for void functions as shown above:<br />
<code>Function calculateSquare(ByVal value As Integer) As Integer<br />
Dim output = value * value<br />
return output<br />
End Function</code></p>
<p>Other than that event handlings are quite same like other languages such as<br />
<code>Private Sub Button1.Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.click</code></p>
<p><a title="Hangman playing" href="http://screencast.com/t/vaLDaSVRfsv"><strong>WATCH DEMO</strong></a></p>
<p><strong>Design Previews</strong><br />

<a href='http://rahmetli.info/en/hangman-with-visual-basic-2010-express/screen-shot-2011-05-04-at-2-51-56-pm/' title='Hangman General View'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2011/05/Screen-shot-2011-05-04-at-2.51.56-PM-150x150.png" class="attachment-thumbnail" alt="Hangman General View" title="Hangman General View" /></a>
<a href='http://rahmetli.info/en/hangman-with-visual-basic-2010-express/screen-shot-2011-05-04-at-3-27-36-pm/' title='Hangman in Design'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2011/05/Screen-shot-2011-05-04-at-3.27.36-PM-150x150.png" class="attachment-thumbnail" alt="Hangman in Design" title="Hangman in Design" /></a>
<a href='http://rahmetli.info/en/hangman-with-visual-basic-2010-express/screen-shot-2011-05-04-at-2-52-26-pm/' title='Hangman Lose Screen'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2011/05/Screen-shot-2011-05-04-at-2.52.26-PM-150x150.png" class="attachment-thumbnail" alt="Hangman Lose Screen" title="Hangman Lose Screen" /></a>
<a href='http://rahmetli.info/en/hangman-with-visual-basic-2010-express/screen-shot-2011-05-04-at-2-52-15-pm/' title='Hangman Playing'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2011/05/Screen-shot-2011-05-04-at-2.52.15-PM-150x150.png" class="attachment-thumbnail" alt="Hangman Playing" title="Hangman Playing" /></a>
<a href='http://rahmetli.info/en/hangman-with-visual-basic-2010-express/screen-shot-2011-05-04-at-2-52-46-pm/' title='Hangman Win Screen'><img width="150" height="150" src="http://rahmetli.info/en/wp-content/uploads/2011/05/Screen-shot-2011-05-04-at-2.52.46-PM-150x150.png" class="attachment-thumbnail" alt="Hangman Win Screen" title="Hangman Win Screen" /></a>
</p>
<p><strong>Design Objects</strong><br />
Hangman shape:<br />
LineShape1 (|), LineShape2 (-), LineShape3 (|), LineShape4 (OvalShape), LineShape5 (|), LineShape6 (\), LineShape7 (/), LineShape8 (\), LineShape9 (/)</p>
<p>Output labels and panel:<br />
Label1 (output), result (RESULT), errorPanel (covering buttons to prevent clicking), puanLabel (Score:), puan (000), Label2 (signature)</p>
<p>Buttons (letters):<br />
Button1 (A), Button2 (B), Button3 (C), &#8230; , Button29 (Z)</p>
<p>Control Buttons<br />
NewGame (New Game), ExitGame (Exit Game)</p>
<p><strong>Form Code with comments<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Public</span> Class Form1
    <span style="color: #008000;">' author: emin buğra saral
</span>    <span style="color: #008000;">' version: 1.0 date: May 3, 2011
</span>    <span style="color: #008000;">' .NET version: 4.0
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> wrongLetter <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span> = 0 <span style="color: #008000;">'the number of how many times the man was hanged
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> word <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> <span style="color: #008000;">' the word taken from wordlist (listbox)
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> screen() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> <span style="color: #008000;">' the screen array (kind of list) 
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> <span style="color: #151B8D; font-weight: bold;">output</span> <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>  <span style="color: #008000;">' output which will be printed as _ _ _ A _ but it will get its value from screen array
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> known = 0 <span style="color: #008000;">' how many letters known
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> length = 0 <span style="color: #008000;">' how many letters there are in total
</span>    <span style="color: #151B8D; font-weight: bold;">Dim</span> score = 0 <span style="color: #008000;">' score
</span>    
    <span style="color: #008000;">' when the program run, this Load method will be called initially (main method)
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Form1_Load(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles MyBase.Load
        <span style="color: #008000;">' call initial methods and hide the list (methods are below, check them for descriptions)
</span>        createList()
        resetMan()
&nbsp;
        <span style="color: #008000;">' at first, hide list, the alert text (WIN, LOSE ETC) and the panel covering the buttons
</span>        wordList.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        result.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        errorPanel.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
&nbsp;
        Randomize() <span style="color: #008000;">' needed to get different random numbers at each new run (closing and openings, not new games)
</span>        word = generateRandomWord() <span style="color: #008000;">' get first word and delete it from list, attach it to word
</span>        length = Len(word) <span style="color: #008000;">' Len() method gets the length of arrays or strings
</span>        <span style="color: #151B8D; font-weight: bold;">ReDim</span> screen(length) <span style="color: #008000;">' each time when ReDim is being used, it changes them in length with given value which is Length 
</span>
        resetScreen() <span style="color: #008000;">' reset the output according to screen array
</span>        puan.Text = score <span style="color: #008000;">' puan is the label on the left bottom corner which shows score
</span>    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #008000;">' we will handle all of the buttons as you see here after Handles. when one of them gets used, sender Object will refer to that clicked one
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Button1_Click(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button10.Click, Button11.Click, Button12.Click, Button13.Click, Button14.Click, Button15.Click, Button16.Click, Button17.Click, Button18.Click, Button19.Click, Button20.Click, Button21.Click, Button22.Click, Button23.Click, Button24.Click, Button25.Click, Button26.Click, Button27.Click, Button28.Click, Button29.Click
        sender.Enabled = <span style="color: #00C2FF; font-weight: bold;">False</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> found = <span style="color: #00C2FF; font-weight: bold;">False</span> <span style="color: #008000;">' that one will show if the word includes that button (letter)
</span>
        <span style="color: #8D38C9; font-weight: bold;">For</span> i <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span> = 0 <span style="color: #8D38C9; font-weight: bold;">To</span> Len(word) - 1 <span style="color: #008000;">' look over all of the letters in word
</span>            <span style="color: #8D38C9; font-weight: bold;">If</span> word(i) = sender.Text <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #008000;">' when ith letter of word equals to the clicked one (sender.text)
</span>                found = <span style="color: #00C2FF; font-weight: bold;">True</span> <span style="color: #008000;">' change found to true
</span>                known = known + 1 <span style="color: #008000;">' increse the number of known letters
</span>                screen(i) = word(i) + <span style="color: #800000;">&quot; &quot;</span> <span style="color: #008000;">' change ith _ (line) with that letter in screen array
</span>            <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        <span style="color: #8D38C9; font-weight: bold;">Next</span>
&nbsp;
        <span style="color: #8D38C9; font-weight: bold;">If</span> (found = <span style="color: #00C2FF; font-weight: bold;">True</span>) <span style="color: #8D38C9; font-weight: bold;">Then</span>
            <span style="color: #8D38C9; font-weight: bold;">If</span> (known = length) <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #008000;">' if all the letters are known
</span>                winInfo() <span style="color: #008000;">' show win
</span>            <span style="color: #8D38C9; font-weight: bold;">Else</span>
                <span style="color: #008000;">' other wise create output again by using screen which is changed above, same procedure like in load method
</span>                resetScreen()
            <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        <span style="color: #8D38C9; font-weight: bold;">Else</span>
            <span style="color: #008000;">'if the user couldnt find the letter, increase the number of wrongLetter and use hangMan method. check this method for detail because it uses wrongLetter
</span>            wrongLetter = wrongLetter + 1
            hangMan()
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #008000;">' make all buttons enabled : you can create an array too
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> refreshButtons()
        Button1.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button2.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button3.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button4.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button5.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button6.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button7.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button8.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button9.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button10.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button11.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button12.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button13.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button14.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button15.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button16.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button17.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button18.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button19.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button20.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button21.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button22.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button23.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button24.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button25.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button26.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button27.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button28.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
        Button29.Enabled = <span style="color: #00C2FF; font-weight: bold;">True</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #008000;">' generate new word from list randomly and delete it from list
</span>    <span style="color: #E56717; font-weight: bold;">Function</span> generateRandomWord() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        <span style="color: #008000;">' if there is enough word left
</span>        <span style="color: #8D38C9; font-weight: bold;">If</span> (wordList.Items.Count &gt; 0) <span style="color: #8D38C9; font-weight: bold;">Then</span>
            <span style="color: #151B8D; font-weight: bold;">Dim</span> r = Int(Rnd() * (wordList.Items.Count - 1)) <span style="color: #008000;">' generate random number between 0 and total number of list minus 1
</span>            <span style="color: #151B8D; font-weight: bold;">Dim</span> word = wordList.Items.Item(r) <span style="color: #008000;">' set the word at &quot;random&quot; position
</span>            wordList.Items.RemoveAt(r) <span style="color: #008000;">' delete it from list
</span>            Return word <span style="color: #008000;">' send the word outside
</span>        <span style="color: #8D38C9; font-weight: bold;">Else</span>
            <span style="color: #008000;">' CStr changes any value from double , int, or char to String.
</span>            <span style="color: #008000;">' vbCrLf : new line 
</span>            MsgBox(CStr(<span style="color: #800000;">&quot;No More Words. Goodbye&quot;</span>) + vbCrLf + CStr(<span style="color: #800000;">&quot;Score: &quot;</span>) + CStr(score))
            <span style="color: #8D38C9; font-weight: bold;">End</span>
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
    <span style="color: #008000;">' hide the man
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> resetMan()
        LineShape1.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape2.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape3.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape4.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape5.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape6.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape7.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape8.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        LineShape9.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #008000;">' if the man is hanged 9th time, it means loseInfo needs to be called
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> hangMan()
        <span style="color: #8D38C9; font-weight: bold;">Select</span> <span style="color: #8D38C9; font-weight: bold;">Case</span> wrongLetter
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 1
                LineShape1.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 2
                LineShape2.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 3
                LineShape3.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 4
                LineShape4.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 5
                LineShape5.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 6
                LineShape6.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 7
                LineShape7.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 8
                LineShape8.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
            <span style="color: #8D38C9; font-weight: bold;">Case</span> 9
                LineShape9.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
                loseInfo()
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">Select</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #008000;">' adds each word to wordList (listbox) by using its own methods, you can also get words from a text file
</span>    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> createList()
        wordList.Items.Add(<span style="color: #800000;">&quot;WORDONE&quot;</span>)
        wordList.Items.Add(<span style="color: #800000;">&quot;WORDTWO&quot;</span>)
        wordList.Items.Add(<span style="color: #800000;">&quot;WORDTHREE&quot;</span>)
        wordList.Items.Add(<span style="color: #800000;">&quot;...&quot;</span>)
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> winInfo()
        errorPanel.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
        result.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
        result.ForeColor = Color.Green
        result.Text = <span style="color: #800000;">&quot;WIN! :)&quot;</span>
        resetScreen()
        score = score + 10
        puan.Text = score
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> loseInfo()
        errorPanel.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
        result.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
        result.Visible = <span style="color: #00C2FF; font-weight: bold;">True</span>
        result.ForeColor = Color.Red
        result.Text = <span style="color: #800000;">&quot;LOSE! :(&quot;</span>
        resetScreen()
        score = score - 10
        puan.Text = score
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> ExitGame_Click(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles ExitGame.Click
        <span style="color: #8D38C9; font-weight: bold;">End</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> NewGame_Click(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles NewGame.Click
       <span style="color: #008000;">' reset everything
</span>        wrongLetter = 0
        known = 0
        length = 0
        word = generateRandomWord()
        length = Len(word)
        errorPanel.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        result.Visible = <span style="color: #00C2FF; font-weight: bold;">False</span>
        resetMan()
        refreshButtons()
        resetScreen()
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> resetScreen()
         <span style="color: #151B8D; font-weight: bold;">output</span> = <span style="color: #800000;">&quot;&quot;</span>
         <span style="color: #8D38C9; font-weight: bold;">For</span> i <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span> = 0 <span style="color: #8D38C9; font-weight: bold;">To</span> length - 1
              screen(i) = <span style="color: #800000;">&quot;_ &quot;</span> <span style="color: #008000;">' screen(i) means i'th element of screen array
</span>              <span style="color: #151B8D; font-weight: bold;">output</span> = <span style="color: #151B8D; font-weight: bold;">output</span> + screen(i) <span style="color: #008000;">' attach that element to output with output's current value. initial value of output is &quot;&quot; which means empty
</span>          <span style="color: #8D38C9; font-weight: bold;">Next</span>
          Label1.Text = <span style="color: #151B8D; font-weight: bold;">output</span> <span style="color: #008000;">' send it to form    
</span>     <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> Class</pre></div></div>

<p><strong>Note</strong>: You can create your own design file according to design objects I shared above, so I won&#8217;t share it here.<br />
<strong>Another Note</strong>: You can use VB 6.0 to use <a href="http://msdn.microsoft.com/en-us/library/kxt4418a%28v=vs.80%29.aspx">Control Arrays</a> efficiently which would reduce the amount of code.<br />
<strong>Most important note:</strong> Never use Vinvods.</p>
<p>Adam Asmaca Visual Basic 2010 Express.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/YjZ1sBnxsDc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/hangman-with-visual-basic-2010-express/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/hangman-with-visual-basic-2010-express/</feedburner:origLink></item>
		<item>
		<title>bbPress 1.0.3 Turkish</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/St0wG00YK34/</link>
		<comments>http://rahmetli.info/en/bbpress-1-0-3-turkish/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 23:27:33 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[translation]]></category>
		<category><![CDATA[bbpress]]></category>
		<category><![CDATA[çeviri]]></category>
		<category><![CDATA[dil]]></category>
		<category><![CDATA[dil dosyası]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[turkce]]></category>
		<category><![CDATA[turkish]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=599</guid>
		<description><![CDATA[
The author
Matt Mullenweg
Purpose
bbPress is plain and simple forum software, plain and simple.
Translation Date
May 2011
Underwork
Using bbPress&#8217; own .pot file, translated with P0edit from English to Turkish.
Site URL
http://rahmetli.info/forum/topic/bbpress-103-turkish-turkce
]]></description>
			<content:encoded><![CDATA[<p><a class="thumb" href="http://rahmetli.info/en/wp-content/uploads/2010/02/bbpress.png" rel="lightbox[599]" title="bbPress"><img class="alignnone size-thumbnail wp-image-148" title="bbPress" src="http://rahmetli.info/en/wp-content/uploads/2010/02/bbpress-150x150.png" alt="" width="150" height="150" /></a></p>
<p><strong>The author</strong><br />
Matt Mullenweg</p>
<p><strong>Purpose</strong><br />
bbPress is plain and simple forum software, plain and simple.</p>
<p><strong>Translation Date</strong><br />
May 2011</p>
<p><strong>Underwork</strong><br />
Using bbPress&#8217; own .pot file, translated with <a href="http://www.poedit.net/" target="_blank">P0edit</a> from English to Turkish.</p>
<p><strong>Site URL</strong><br />
<a title="Forum" href="http://rahmetli.info/forum/topic/bbpress-103-turkish-turkce" target="_blank">http://rahmetli.info/forum/topic/bbpress-103-turkish-turkce</a></p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/St0wG00YK34" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/bbpress-1-0-3-turkish/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/bbpress-1-0-3-turkish/</feedburner:origLink></item>
		<item>
		<title>Firefox 4 Extension Request: Play/Stop Feature on Tabs</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/vlsOL0bimLM/</link>
		<comments>http://rahmetli.info/en/firefox-4-extension-request-playstop-feature-on-tabs/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 12:43:51 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[idea]]></category>
		<category><![CDATA[add-on]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox 4]]></category>
		<category><![CDATA[firefox add-on request]]></category>
		<category><![CDATA[imdb]]></category>
		<category><![CDATA[mouse over]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[onhover]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[switching tab]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[thesixtyone]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=578</guid>
		<description><![CDATA[Doing the same things over and over is not an option for lazy web users like me. Switching between tabs is easy by using &#8220;control + tab&#8221; or &#8220;control + shift + tab&#8221; combinations but most of you would prefer using the mouse in practice.
Firefox 4 will be the most popular browser in a few [...]]]></description>
			<content:encoded><![CDATA[<p>Doing the same things over and over is not an option for lazy web users like me. Switching between tabs is easy by using &#8220;<strong>control + tab</strong>&#8221; or &#8220;<strong>control + shift + tab</strong>&#8221; combinations but most of you would prefer using the mouse in practice.</p>
<p>Firefox 4 will be the most popular browser in a few months (as I hope) and I&#8217;d like to see my request in its future add-ons (or extensions).<a title="Add-ons for Firefox" href="https://addons.mozilla.org/en-US/firefox/"><em> Or is there already one?</em></a></p>
<p><strong>Situation</strong>:<br />
Lets assume you are listening music in one tab (<a title="The Sixty One" href="http://www.thesixtyone.com">thesixtyone.com</a>) and on the other hand you are looking for your favorite movies in other tab (<a href="http://www.imdb.com">imdb.com</a>). You wanted to watch a movie (trailer) but the music is playing so you wouldn&#8217;t hear anything. What you would do is either closing other tab or switch to it to pause and come back to the movie. It seems quite easy but repeating that action every time you want to watch something becomes annoying.</p>
<p><img class="alignnone size-full wp-image-582" title="Firefox Add-on Requst - Play/Pause on tabs" src="http://rahmetli.info/en/wp-content/uploads/2011/03/firefox-plugin-request.png" alt="" width="700" height="280" /></p>
<p><strong>My request in idea:</strong><br />
I don&#8217;t want to switch to another tab to play/pause the music. Tabs should have play/pause buttons on them so I would spend <strong>only one click</strong> (kind of an <strong>onHover</strong> event). Here is the example:</p>
<p style="text-align: center;"><img class="size-full wp-image-581 aligncenter" title="Firefox Add-on Request - Play/Pause buttons" src="http://rahmetli.info/en/wp-content/uploads/2011/03/firefox-plugin-request2.png" alt="" width="589" height="182" /></p>
<p><strong>First thing came to my mind:</strong><br />
By using javascript (or anything else), keyboard shortcuts can be manipulated to take actions on webpages. For example most of the music websites using &#8220;space&#8221; as a play/pause trigger. That play/pause button which tabs will have would trigger &#8220;space&#8221;. The websites using a specific html meta tag would have that feature. Of course there may be more useful ways to achieve that.</p>
<p>Hope someone comes out with that add-on, I&#8217;m looking forward to use it. :)</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/vlsOL0bimLM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/firefox-4-extension-request-playstop-feature-on-tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/firefox-4-extension-request-playstop-feature-on-tabs/</feedburner:origLink></item>
		<item>
		<title>Mean it.</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/0tIYgNci8Xg/</link>
		<comments>http://rahmetli.info/en/mean-it/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 19:45:53 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[poem]]></category>
		<category><![CDATA[feeling]]></category>
		<category><![CDATA[fuck]]></category>
		<category><![CDATA[gender]]></category>
		<category><![CDATA[happy]]></category>
		<category><![CDATA[hate]]></category>
		<category><![CDATA[kiss]]></category>
		<category><![CDATA[lesbian]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[love]]></category>
		<category><![CDATA[sad]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=570</guid>
		<description><![CDATA[
Born.
Learn the rules.
Follow them.
Love.
Get hurt.
Fool yourself.
Love again.
And again.
Quit.
Just fuck them.
Name it something else.
Fool yourself again.
Be happy.
Live it.
Then fake it.
Look for new words.
Describe it.
Name it love again.
The end.
Hate it both.
Then kick it.
Face it in the morning.
Cry.
Kick yourself.
Into another world.
Use the words you found.
Create if you did not.
Love the same gender.
Try.
See what is wrong.
Damn, describe it again.
Tell [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-572" title="tea" src="http://rahmetli.info/en/wp-content/uploads/2011/03/tea1.jpg" alt="" width="700" height="279" /></p>
<p>Born.<br />
Learn the rules.<br />
Follow them.<br />
Love.<br />
Get hurt.<br />
Fool yourself.<br />
Love again.<br />
And again.<br />
Quit.<br />
Just fuck them.<br />
Name it something else.<br />
Fool yourself again.<br />
Be happy.<br />
Live it.<br />
Then fake it.<br />
Look for new words.<br />
Describe it.<br />
Name it love again.</p>
<p>The end.<br />
Hate it both.<br />
Then kick it.<br />
Face it in the morning.<br />
Cry.<br />
Kick yourself.<br />
Into another world.<br />
Use the words you found.<br />
Create if you did not.<br />
Love the same gender.<br />
Try.<br />
See what is wrong.<br />
Damn, describe it again.<br />
Tell the truth.<br />
Love a lesbian.<br />
Watch her fucking somebody.<br />
Forget the jealousy.<br />
Pure reality.</p>
<p>Kiss the feeling.<br />
Fuck the believing.<br />
Forget everything.<br />
Name it nothing.<br />
And obey nothing.<br />
But her body.<br />
Adore it.<br />
Just her existence.<br />
Worship it.<br />
Close your eyes.<br />
Wear your blinkers.<br />
Open your chest.<br />
Or let her do.<br />
Breathe her and sleep.<br />
Wake up.<br />
Tell me what you see.<br />
Nothing?<br />
Don&#8217;t, go back to sleep.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/0tIYgNci8Xg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/mean-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/mean-it/</feedburner:origLink></item>
		<item>
		<title>Tripping to Sarp</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/3-DiCmvHPZI/</link>
		<comments>http://rahmetli.info/en/tripping-to-sarp/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 07:50:51 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[diary]]></category>
		<category><![CDATA[arhavi]]></category>
		<category><![CDATA[artvin]]></category>
		<category><![CDATA[of]]></category>
		<category><![CDATA[rize]]></category>
		<category><![CDATA[sarp]]></category>
		<category><![CDATA[trabzon]]></category>
		<category><![CDATA[trip]]></category>
		<category><![CDATA[yolculuk]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=562</guid>
		<description><![CDATA[Me, and my family decided to visit one sweet couple of our relatives living in Sarp, Artvin. While the trip took so long, I enjoyed most of it by taking that short movie:

]]></description>
			<content:encoded><![CDATA[<p>Me, and my family decided to visit one sweet couple of our relatives living in Sarp, Artvin. While the trip took so long, I enjoyed most of it by taking that short movie:</p>
<p><iframe src="http://player.vimeo.com/video/19678109?portrait=0" width="700" height="394" frameborder="0"></iframe></p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/3-DiCmvHPZI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/tripping-to-sarp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://rahmetli.info/en/tripping-to-sarp/</feedburner:origLink></item>
		<item>
		<title>Brightness and Contrast adjustment in InDesign CS4 [MAC]</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/DkqunlgET94/</link>
		<comments>http://rahmetli.info/en/brightness-and-contrast-adjustment-in-indesign-cs4-mac/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 20:18:18 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[adjustment]]></category>
		<category><![CDATA[apple script]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[applescript indesign brightness]]></category>
		<category><![CDATA[applescript indesign contrast]]></category>
		<category><![CDATA[brightness and contrast]]></category>
		<category><![CDATA[brightness and contrast settings]]></category>
		<category><![CDATA[indesign cs4]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[photoshop cs4]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=532</guid>
		<description><![CDATA[
This AppleScript code asks user for brightness and contrast values for the selected image in Adobe InDesign CS4 and then apply the adjustment values to that image by using Adobe Photoshop CS4.
Script Download link: http://www.rahmetli.info/docs/AdjustBrightnessContrast.zip
Example video: http://screencast.com/t/tt1zTydBSJ
Here is the open source code:

-- Author : Emin Bugra Saral
-- Author Website : http://www.rahmetli.info
-- Sources : http://www.adobe.com/products/indesign/scripting/pdfs/InDesignCS4_ScriptingGuide_AS.pdf
-- Purpose [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-542" title="Adjust Brightness and Contrast script" src="http://rahmetli.info/en/wp-content/uploads/2010/12/adjustbrightness1.png" alt="" width="700" height="248" /></p>
<p>This <strong>AppleScript </strong>code asks user for brightness and contrast values for the selected image in Adobe InDesign CS4 and then apply the adjustment values to that image by using Adobe Photoshop CS4.</p>
<p><strong>Script Download link:</strong> <a href="http://www.rahmetli.info/docs/AdjustBrightnessContrast.zip" target="_blank">http://www.rahmetli.info/docs/AdjustBrightnessContrast.zip</a></p>
<p><strong>Example video:</strong> <a href="http://screencast.com/t/tt1zTydBSJ" target="_blank">http://screencast.com/t/tt1zTydBSJ</a></p>
<p><strong>Here is the open source code:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Author : Emin Bugra Saral</span>
<span style="color: #808080; font-style: italic;">-- Author Website : http://www.rahmetli.info</span>
<span style="color: #808080; font-style: italic;">-- Sources : http://www.adobe.com/products/indesign/scripting/pdfs/InDesignCS4_ScriptingGuide_AS.pdf</span>
<span style="color: #808080; font-style: italic;">-- Purpose : Changing brightness and contrast of an image in InDesign CS4 by using Photoshop CS4</span>
<span style="color: #808080; font-style: italic;">-- Warning: Please be sure you read &quot;readme.txt&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe InDesign CS4&quot;</span>
	<span style="color: #0066ff;">activate</span>
	<span style="color: #808080; font-style: italic;">-- default values :</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> defaultBValue <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">80</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> defaultCValue <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> defaultSaveValue <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">-- create dialog</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> adjuster <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> dialog
	<span style="color: #ff0033; font-weight: bold;">tell</span> adjuster
&nbsp;
		<span style="color: #808080; font-style: italic;">-- title</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #0066ff;">name</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Brightness and Contrast settings for Photoshop CS4&quot;</span>
&nbsp;
		<span style="color: #ff0033; font-weight: bold;">set</span> myColumn <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> dialog column
		<span style="color: #ff0033; font-weight: bold;">tell</span> myColumn
&nbsp;
			<span style="color: #808080; font-style: italic;">-- bordered area, asking for values</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> myBorder <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> border panel
			<span style="color: #ff0033; font-weight: bold;">tell</span> myBorder
				<span style="color: #0066ff;">make</span> static <span style="color: #0066ff;">text</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;Brightness Level % &quot;</span><span style="color: #000000;">&#125;</span>
				<span style="color: #ff0033; font-weight: bold;">set</span> brightnessLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">integer</span> editbox <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>edit value:defaultBValue<span style="color: #000000;">&#125;</span>
				<span style="color: #0066ff;">make</span> static <span style="color: #0066ff;">text</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;Contrast Level % &quot;</span><span style="color: #000000;">&#125;</span>
				<span style="color: #ff0033; font-weight: bold;">set</span> contrastLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">integer</span> editbox <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>edit value:defaultCValue<span style="color: #000000;">&#125;</span>
			<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">-- unbordered area, asking before saving</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #0066ff;">saving</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> checkbox control <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;Ask me before saving&quot;</span>, checked state:defaultSaveValue<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">-- showing limits</span>
			<span style="color: #0066ff;">make</span> static <span style="color: #0066ff;">text</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;&quot;</span><span style="color: #000000;">&#125;</span>
			<span style="color: #0066ff;">make</span> static <span style="color: #0066ff;">text</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;Brightness must be between -150 and 150&quot;</span><span style="color: #000000;">&#125;</span>
			<span style="color: #0066ff;">make</span> static <span style="color: #0066ff;">text</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span>static label:<span style="color: #009900;">&quot;Contrast must be between -50 and 100&quot;</span><span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">-- InDesign - Photoshop controlling</span>
	<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #0066ff;">selection</span> <span style="color: #000000;">=</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #808080; font-style: italic;">-- if nothing is selected</span>
		<span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;You did NOT select anything!&quot;</span> <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">0</span>
	<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>rectangle, oval, polygon<span style="color: #000000;">&#125;</span> <span style="color: #ff0033;">or</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>image, PDF, EPS<span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">-- checking if the image is directly selected or not</span>
		<span style="color: #ff0033; font-weight: bold;">if</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>rectangle, oval, polygon<span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #808080; font-style: italic;">-- frame</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> imageLink <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> graphic <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> imagePath <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> path <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> graphic <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
		<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>image, PDF, EPS<span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #808080; font-style: italic;">-- directly</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> imageLink <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> imagePath <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> path <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">-- myStatus holds for controlling input errors, to continue the while loop</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> myStatus <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span>
		<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">while</span> myStatus <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> showAdjuster <span style="color: #ff0033; font-weight: bold;">to</span> show adjuster
&nbsp;
			<span style="color: #808080; font-style: italic;">-- if user pressed OK</span>
			<span style="color: #ff0033; font-weight: bold;">if</span> showAdjuster <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span> <span style="color: #ff0033; font-weight: bold;">then</span>
&nbsp;
				<span style="color: #808080; font-style: italic;">-- saving result check to define parameter will be used in PS CS4</span>
				<span style="color: #ff0033; font-weight: bold;">if</span> checked state <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">saving</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> savingParam <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">ask</span>
				<span style="color: #ff0033; font-weight: bold;">else</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> savingParam <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">yes</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
&nbsp;
				<span style="color: #808080; font-style: italic;">-- initialize error message</span>
				<span style="color: #ff0033; font-weight: bold;">set</span> errorMsg <span style="color: #ff0033; font-weight: bold;">to</span> null
&nbsp;
				<span style="color: #808080; font-style: italic;">-- define variables from inputs which will be used in PS CS4</span>
				<span style="color: #ff0033; font-weight: bold;">set</span> theBrightness <span style="color: #ff0033; font-weight: bold;">to</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> brightnessLevel
				<span style="color: #ff0033; font-weight: bold;">set</span> theContrast <span style="color: #ff0033; font-weight: bold;">to</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> contrastLevel
&nbsp;
				<span style="color: #808080; font-style: italic;">-- some logic statements</span>
				<span style="color: #ff0033; font-weight: bold;">if</span> theBrightness <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #000000;">0</span> <span style="color: #ff0033;">and</span> theContrast <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #000000;">0</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> myStatus <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
					destroy adjuster
				<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> theBrightness <span style="color: #000000;">&amp;</span>gt; <span style="color: #000000;">150</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> errorMsg <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Brightness Level cannot be greater than 150&quot;</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> brightnessLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">150</span>
				<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> theBrightness <span style="color: #000000;">&amp;</span>lt; <span style="color: #000000;">-</span><span style="color: #000000;">150</span> <span style="color: #ff0033; font-weight: bold;">then</span> 					<span style="color: #ff0033; font-weight: bold;">set</span> errorMsg <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Brightness Level cannot be less than -150&quot;</span> 					<span style="color: #ff0033; font-weight: bold;">set</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> brightnessLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">-</span><span style="color: #000000;">150</span> 				<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> theContrast <span style="color: #000000;">&amp;</span>gt; <span style="color: #000000;">100</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> errorMsg <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Contrast Level cannot be greater than 100&quot;</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> contrastLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">100</span>
				<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> theContrast <span style="color: #000000;">&amp;</span>lt; <span style="color: #000000;">-</span><span style="color: #000000;">50</span> <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> errorMsg <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Contrast Level cannot be less than -50&quot;</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> edit value <span style="color: #ff0033; font-weight: bold;">of</span> contrastLevel <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">-</span><span style="color: #000000;">50</span>
				<span style="color: #ff0033; font-weight: bold;">else</span>
					<span style="color: #808080; font-style: italic;">-- stop while loop and open PS CS4</span>
					<span style="color: #ff0033; font-weight: bold;">set</span> myStatus <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
					destroy adjuster
&nbsp;
					<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe Photoshop CS4&quot;</span>
						<span style="color: #0066ff;">activate</span>
						<span style="color: #0066ff;">open</span> <span style="color: #0066ff;">file</span> imagePath
						<span style="color: #808080; font-style: italic;">-- adjustment function with parameters taken above</span>
						adjust current layer <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">the</span> current <span style="color: #0066ff;">document</span> using brightness <span style="color: #ff0033;">and</span> contrast <span style="color: #ff0033; font-weight: bold;">with</span> options <span style="color: #000000;">&#123;</span>class:brightness <span style="color: #ff0033;">and</span> contrast, brightness level:theBrightness, contrast level:theContrast<span style="color: #000000;">&#125;</span>
						<span style="color: #808080; font-style: italic;">-- saving with the parameter taken above</span>
						<span style="color: #0066ff;">close</span> <span style="color: #0066ff;">document</span> <span style="color: #000000;">1</span> <span style="color: #0066ff;">saving</span> savingParam
					<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
					<span style="color: #808080; font-style: italic;">-- time to pass on InDesign CS4</span>
					<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe InDesign CS4&quot;</span>
						<span style="color: #0066ff;">activate</span>
						<span style="color: #808080; font-style: italic;">-- refresh the image</span>
						relink imageLink <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> imagePath
					<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
&nbsp;
				<span style="color: #808080; font-style: italic;">-- if there was any error in logic, show it to the user</span>
				<span style="color: #ff0033; font-weight: bold;">if</span> errorMsg <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> null <span style="color: #ff0033; font-weight: bold;">then</span>
					<span style="color: #0066ff;">display dialog</span> errorMsg <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">0</span>
				<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
			<span style="color: #ff0033; font-weight: bold;">else</span>
				<span style="color: #808080; font-style: italic;">-- if the user pressed CANCEL, destroy everything and stop while loop</span>
				destroy adjuster
				<span style="color: #ff0033; font-weight: bold;">set</span> myStatus <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
			<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
	<span style="color: #ff0033; font-weight: bold;">else</span>
		<span style="color: #808080; font-style: italic;">-- if the selected thing is neither an image's frame nor image</span>
		<span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;Please select an image frame!&quot;</span> <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">0</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p><strong><span style="color: #ff0000;">WARNING</span></strong>: PLEASE SAVE YOUR WORKSPACE/DOCUMENT BEFORE USING THE SCRIPT!</p>
<p><span style="color: #ff0000;"><strong>NOTE:</strong> <span style="color: #000000;">Because InDesign CS4 can not update modified links with AppleScript, you must manually update the links (<a href="http://help.adobe.com/en_US/InDesign/6.0/WSD7C5E0A4-75C4-4660-9FAB-5E5726765407a.html" target="_blank">how to?</a>).</span></span></p>
<p><strong>REMINDER</strong>: First of all, you must be using Photoshop CS4 and InDesign CS4 for &#8220;MACINTOSH&#8221; to run this script. If you use any other version than those applications, change the version of applications in script file (For example: tell application &#8220;Adobe Photoshop CS3&#8243;) If this also does not work, then you must change whole code after reading script guidelines of Adobe.</p>
<p style="text-align: left;"><strong>Installing and using the script in steps:</strong><br />
- Copy the script file under &#8220;/Users/user/Library/Preferences/Adobe InDesign/Version 6.0/en_GB/Scripts/Scripts Panel&#8221;<br />
- To use script, follow &#8220;Window-&gt;Automation-&gt;Scripts&#8221; menu in InDesign<br />
- Then, double-click on the script to apply it.</p>
<p><strong><span style="color: #ff0000;">PLEASE</span></strong> share your idea, add something, improve the code by writing a comment.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/DkqunlgET94" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/brightness-and-contrast-adjustment-in-indesign-cs4-mac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<enclosure url="http://www.rahmetli.info/docs/AdjustBrightnessContrast.zip" length="14334" type="application/zip" /><media:content url="http://www.rahmetli.info/docs/AdjustBrightnessContrast.zip" fileSize="14334" type="application/zip" /><feedburner:origLink>http://rahmetli.info/en/brightness-and-contrast-adjustment-in-indesign-cs4-mac/</feedburner:origLink></item>
		<item>
		<title>Categorized Desktop with GeekTool</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/o_McJ6XN_GA/</link>
		<comments>http://rahmetli.info/en/categorized-desktop-with-geektool/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 22:14:23 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[idea]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[categorized]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[geektool]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[organize]]></category>
		<category><![CDATA[organized]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[wallpaper]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=516</guid>
		<description><![CDATA[
After seeing this post, I decided to organize my desktop too. But instead of using a wallpaper, I tried GeekTool which is a desktop organizer tool. By using that pretty System Preferences Module, you can add shell commands, text files, or images to your desktop. What I did is creating a few titles and placing [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://rahmetli.info/en/wp-content/uploads/2010/12/ebsdesktop.png" target="_blank" rel="lightbox[516]" title="ebsdesktopsmall"><img class="alignnone size-full wp-image-519" title="ebsdesktopsmall" src="http://rahmetli.info/en/wp-content/uploads/2010/12/ebsdesktopsmall.png" alt="" width="700" height="437" /></a></p>
<p style="text-align: justify;">After seeing <a href="http://www.josefrichter.com/blog/dynamic-gtd-wallpaper-with-things-to-dos/" target="_blank">this post</a>, I decided to organize my desktop too. But instead of using a wallpaper, I tried <a href="http://projects.tynsoe.org/en/geektool/" target="_blank">GeekTool</a> which is a desktop organizer tool. By using that pretty System Preferences Module, you can add shell commands, text files, or images to your desktop. What I did is creating a few titles and placing them on different places of my desktop; more like I categorized my desktop. And later, I added date on right bottom corner. Then at last, I added an image to right top corner which it will point the last file created on desktop. It is actually not necessary, but it&#8217;s a concentration mark to remind you organizing your folders always :)</p>
<p style="text-align: justify;">If you would like to download Geek Tool files which I used, here&#8217;s the <a href="http://www.rahmetli.info/docs/GeekToolDesktopArchieve.zip">download link</a>.</p>
<p style="text-align: justify;">Note: Display resolution is 1440 x 900.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/o_McJ6XN_GA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/categorized-desktop-with-geektool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<enclosure url="http://www.rahmetli.info/docs/GeekToolDesktopArchieve.zip" length="46889" type="application/zip" /><media:content url="http://www.rahmetli.info/docs/GeekToolDesktopArchieve.zip" fileSize="46889" type="application/zip" /><feedburner:origLink>http://rahmetli.info/en/categorized-desktop-with-geektool/</feedburner:origLink></item>
		<item>
		<title>“Edit with Adobe Photoshop CS4″ script for InDesign CS4 [MAC]</title>
		<link>http://feedproxy.google.com/~r/rahmetli/~3/ZTsYxAe0KRw/</link>
		<comments>http://rahmetli.info/en/edit-with-adobe-photoshop-cs4-script-for-indesign-cs4-mac/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 17:30:30 +0000</pubDate>
		<dc:creator>Emin Bugra Saral</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[adobe indesign]]></category>
		<category><![CDATA[adobe indesign cs4]]></category>
		<category><![CDATA[default application]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[edit original]]></category>
		<category><![CDATA[edit with]]></category>
		<category><![CDATA[edit with adobe photoshop cs4 indesign cs4]]></category>
		<category><![CDATA[edit with indesign]]></category>
		<category><![CDATA[edit with photoshop]]></category>
		<category><![CDATA[edit with photoshop cs4]]></category>
		<category><![CDATA[editing with indesign cs4]]></category>
		<category><![CDATA[indesign]]></category>
		<category><![CDATA[indesign cs4]]></category>

		<guid isPermaLink="false">http://rahmetli.info/en/?p=504</guid>
		<description><![CDATA[
After reading this post I decided to write a script to edit an image of InDesign with Photoshop. So this script saves me from &#8220;right click -&#62; edit with -&#62; Adobe Photoshop CS4&#8221; path, and directly opens the image in Photoshop.
Script Download link: http://www.rahmetli.info/docs/editWithPhotoshop.zip
Example video: http://screencast.com/t/BBYqjXai
Here is the open source code:

-- Author : Emin Bugra [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-512" title="editWithPhotoshop" src="http://rahmetli.info/en/wp-content/uploads/2010/11/editWithPhotoshop.png" alt="" width="700" height="250" /></p>
<p>After reading <a href="http://indesignsecrets.com/customize-indesigns-edit-original.php">this post</a> I decided to write a script to edit an image of InDesign with Photoshop. So this script saves me from &#8220;r<em>ight click -&gt; edit with -&gt; Adobe Photoshop CS4</em>&#8221; path, and directly opens the image in Photoshop.</p>
<p><strong>Script Download link:</strong> <a href="http://www.rahmetli.info/docs/editWithPhotoshop.zip" target="_blank">http://www.rahmetli.info/docs/editWithPhotoshop.zip</a></p>
<p><strong>Example video: </strong><a href="http://screencast.com/t/BBYqjXai" target="_blank">http://screencast.com/t/BBYqjXai</a></p>
<p><strong>Here is the open source code:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Author : Emin Bugra Saral</span>
<span style="color: #808080; font-style: italic;">-- Author Website : http://www.rahmetli.info</span>
<span style="color: #808080; font-style: italic;">-- Sources : http://macscripter.net/viewtopic.php?id=31867</span>
<span style="color: #808080; font-style: italic;">-- Purpose : Automatically open with Photoshop CS4 in InDesign CS4 script</span>
<span style="color: #808080; font-style: italic;">-- Warning: Please be sure you read &quot;readme.txt&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe InDesign CS4&quot;</span>
	<span style="color: #0066ff;">activate</span>
	<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #0066ff;">selection</span> <span style="color: #000000;">=</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #808080; font-style: italic;">-- if nothing is selected</span>
		<span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;You did NOT select anything!&quot;</span> <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">0</span>
	<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>rectangle, oval, polygon<span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #808080; font-style: italic;">-- if the image's frame is selected</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> imagePath <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> path <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> graphic <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe Photoshop CS4&quot;</span>
			<span style="color: #0066ff;">activate</span>
			<span style="color: #0066ff;">open</span> <span style="color: #0066ff;">file</span> imagePath
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> class <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033; font-weight: bold;">in</span> <span style="color: #000000;">&#123;</span>image, PDF, EPS<span style="color: #000000;">&#125;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #808080; font-style: italic;">-- if the image is selected</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> imagePath <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> path <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> link <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">selection</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Adobe Photoshop CS4&quot;</span>
			<span style="color: #0066ff;">activate</span>
			<span style="color: #0066ff;">open</span> <span style="color: #0066ff;">file</span> imagePath
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">else</span>
		<span style="color: #808080; font-style: italic;">-- if the selected thing is neither an image's frame nor image</span>
		<span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;Please select an image frame!&quot;</span> <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">0</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p><strong><span style="color: #ff0000;">WARNING</span></strong>: PLEASE SAVE YOUR WORKSPACE/DOCUMENT BEFORE USING THE SCRIPT!</p>
<p><strong>REMINDER</strong>: First of all, you must be using Photoshop CS4 and InDesign CS4 for &#8220;MACINTOSH&#8221; to run this script. If you use any other version than those applications, change the version of applications in script file (For example: tell application &#8220;Adobe Photoshop CS3&#8243;) If this also does not work, then you must change whole code after reading script guidelines of Adobe.</p>
<p style="text-align: left;"><strong>Installing and using the script in steps:</strong><br />
- Copy the script file under &#8220;/Users/user/Library/Preferences/Adobe InDesign/Version 6.0/en_GB/Scripts/Scripts Panel&#8221;<br />
- To use script, follow &#8220;Window-&gt;Automation-&gt;Scripts&#8221; menu in InDesign<br />
- Then, double-click on the script to apply it.</p>
<p><strong><span style="color: #ff0000;">PLEASE</span></strong> share your idea, add something, improve the code by writing a comment.</p>
<!-- PHP 5.x --><img src="http://feeds.feedburner.com/~r/rahmetli/~4/ZTsYxAe0KRw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://rahmetli.info/en/edit-with-adobe-photoshop-cs4-script-for-indesign-cs4-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<enclosure url="http://www.rahmetli.info/docs/editWithPhotoshop.zip" length="4544" type="application/zip" /><media:content url="http://www.rahmetli.info/docs/editWithPhotoshop.zip" fileSize="4544" type="application/zip" /><feedburner:origLink>http://rahmetli.info/en/edit-with-adobe-photoshop-cs4-script-for-indesign-cs4-mac/</feedburner:origLink></item>
	<media:credit role="author">Emin Bugra Saral</media:credit><media:rating>nonadult</media:rating></channel>
</rss>
