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

<channel>
	<title>Samet Kilictas's Blog &#187; Programming</title>
	<atom:link href="http://samet.kilictas.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://samet.kilictas.com</link>
	<description>Personal E-Notebook</description>
	<lastBuildDate>Fri, 30 Apr 2010 07:29:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>if exists syntax in sybase</title>
		<link>http://samet.kilictas.com/if-exists-syntax-in-sybase/</link>
		<comments>http://samet.kilictas.com/if-exists-syntax-in-sybase/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 11:47:00 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[exists]]></category>
		<category><![CDATA[sybase]]></category>
		<category><![CDATA[table exists]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=415</guid>
		<description><![CDATA[Below shows the if exists usage with examples in sybase If exists (select record) begin sql statement 1 sql statement 2 end else begin sql statement 3 sql statement 4 end Example Scripts that include constructs like the following may produce errors if the table described in the script does not include the specified column: [...]]]></description>
			<content:encoded><![CDATA[<p>Below shows the if exists usage with examples in sybase</p>
<blockquote><p>If exists (select record)<br />
begin<br />
sql statement 1<br />
sql statement 2<br />
end<br />
else<br />
begin<br />
sql statement 3<br />
sql statement 4<br />
end</p></blockquote>
<p>Example</p>
<p>Scripts that include constructs like the following may produce errors if the table described in the script does not include the specified column:</p>
<pre class="brush: sql">
if exists (select 1 from syscolumns
where id = object_id(&quot;some_table&quot;)
and name = &quot;some_column&quot;)
begin
alter table some_table drop some_column
end
</pre>
<p>In this example, some_column must exist in some_table for the batch to succeed.</p>
<p>If some_column exists in some_table, the first time you run the batch, alter table drops the column. On subsequent executions, the batch does not compile.</p>
<p>Adaptive Server raises these errors while preprocessing this batch, which are similar to those that are raised when a normal select tries to access a nonexistent column. These errors are raised when you modify a table’s schema using clauses that require a data copy. If you add a null column, and use the above construct, Adaptive Server does not raise these errors.</p>
<p>To avoid such errors when you modify a table’s schema, include alter table in an execute immediate command:</p>
<pre class="brush: sql">
if exists (select 1 from syscolumns
where id = object_id(&quot;some_table&quot;)
and name = &quot;some_column&quot;)
begin
exec (&quot;alter table some_table drop
some_column&quot;)
end
</pre>
<p>Because the execute immediate statement is run only if the if exists() function succeeds, Adaptive Server does not raise any errors when it compiles this script.</p>
<p>You must also use the execute immediate construct for other uses of alter table, for example, to change the locking scheme, and for any other cases when the command does not require data copy.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/if-exists-syntax-in-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A common error with GROUP BY Clause</title>
		<link>http://samet.kilictas.com/a-common-error-with-group-by-clause/</link>
		<comments>http://samet.kilictas.com/a-common-error-with-group-by-clause/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 12:46:40 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[clause]]></category>
		<category><![CDATA[common error]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[min]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=410</guid>
		<description><![CDATA[A common error with groups is to try to get information which cannot properly be put in a group. For example, SELECT sales_rep, emp_lname, count( * ) FROM sales_order KEY JOIN employee GROUP BY sales_rep gives the error column &#8216;emp_lname&#8217; cannot be used unless it is in a GROUP BY. SQL does not realize that [...]]]></description>
			<content:encoded><![CDATA[<p>A common error with groups is to try to get information which cannot properly be put in a group. For example,</p>
<pre class="brush: sql">

SELECT sales_rep, emp_lname, count( * )
FROM sales_order
KEY JOIN employee
GROUP BY sales_rep
</pre>
<p>gives the error</p>
<p>column &#8216;emp_lname&#8217; cannot be used unless it is in a GROUP BY.</p>
<p>SQL does not realize that each of the rows for an employee with a given ID have the same value of emp_lname. An error is reported since SQL does not know which of the names to display.</p>
<p>However, the following is valid:</p>
<pre class="brush: sql">

SELECT sales_rep, max( emp_lname ), count( * )
FROM sales_order
KEY JOIN employee
GROUP BY sales_rep
</pre>
<p>The max function chooses the maximum (last alphabetically) surname from the detail rows for each group. The surname is the same on every detail row within a group so the max is just a trick to bypass a limitation of SQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/a-common-error-with-group-by-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot load mysqli extension. Please check your PHP configuration</title>
		<link>http://samet.kilictas.com/cannot-load-mysqli-extension-please-check-your-php-configuration/</link>
		<comments>http://samet.kilictas.com/cannot-load-mysqli-extension-please-check-your-php-configuration/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 14:01:28 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WAMP]]></category>
		<category><![CDATA[WampServer]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=364</guid>
		<description><![CDATA[Probably you are trying to access your phpmyadmin. You will get this error  if you have more then one &#8220;php.ini&#8221; file in your system. It is kinda conflicting. For instance i have wampserver2.0 and IIS7 together in my current system. I have activated IIS7 FastCgı method to use php on it. So it has one [...]]]></description>
			<content:encoded><![CDATA[<p>Probably you are trying to access your phpmyadmin. You will get this error  if you have more then one &#8220;php.ini&#8221; file in your system. It is kinda conflicting. For instance i have wampserver2.0 and IIS7 together in my current system. I have activated IIS7 FastCgı method to use php on it. So it has one php.ini file at path of  &#8220;c:\wamp\&#8230;.&#8221; and another one in &#8220;c:\Program Files\Php&#8221; . You can get a temporary solution if you rename your php.ini file which is in your &#8220;program files&#8221; path.</p>
<p>That is it.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/cannot-load-mysqli-extension-please-check-your-php-configuration/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Gedit Modifications for PHP</title>
		<link>http://samet.kilictas.com/gedit-modifications-for-php/</link>
		<comments>http://samet.kilictas.com/gedit-modifications-for-php/#comments</comments>
		<pubDate>Sun, 17 May 2009 11:37:06 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[gedit]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=314</guid>
		<description><![CDATA[Since i am coding with codeigniter framework on gedit, i was looking for snippets for codeigniter on gedit download gedit snippet for codeigniter By the way if you want to make your gedit more useful for programming surely you may add some third party plugins as many as you want or simply just active default [...]]]></description>
			<content:encoded><![CDATA[<p>Since i am coding with codeigniter framework on gedit, i was looking for snippets for codeigniter on gedit</p>
<p><a href="http://samet.kilictas.com/wp-content/uploads/2009/05/php.xml">download gedit snippet for codeigniter</a></p>
<p>By the way if you want to make your gedit more useful for programming surely you may add some third party plugins as many as you want or simply just active default plugins.  Idea is that firstly download a plugin then extract its content to ‘~/.gnome2/gedit/plugins/’  directory. Once you have installed the plugin you want, you need to enable it via Edit&gt;Preferences and then the Plugins Tab. Such as;</p>
<blockquote><p>- Snippets<br />
- Class Browser<br />
- Bracket Completation<br />
- Character Map<br />
- Embedded Terminal<br />
etc..</p></blockquote>
<p>You can basicly find out third-party plugins by clicking on <a href="http://live.gnome.org/Gedit/Plugins#third_party">this link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/gedit-modifications-for-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is MVC Architecture? (Model &#8211; View &#8211; Controller)</title>
		<link>http://samet.kilictas.com/what-is-mvc-architecture-model-view-controller/</link>
		<comments>http://samet.kilictas.com/what-is-mvc-architecture-model-view-controller/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 13:27:02 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=283</guid>
		<description><![CDATA[MVC Architecture has implemented by Trygve Reenskaug at 1979 for the first time. It was implemented on Smalltalk at Xerox labs. Then benefits and advantages of this architecture has been accepted by most of the coders and software engineers. It was an information about MVC&#8217;s history above. Now lets talk about what really MVC is. [...]]]></description>
			<content:encoded><![CDATA[<p>MVC Architecture has implemented by Trygve Reenskaug at 1979 for the first time. It was implemented on Smalltalk at Xerox labs. Then benefits and advantages of this architecture has been accepted by most of the coders and software engineers.</p>
<p>It was an information about MVC&#8217;s history above. Now lets talk about what really MVC is. What do you understand from MVC. The word M stands for Model, V stands for View and C stands for Controller. I am going to mention about each item.</p>
<p style="text-align: center;"><a href="http://samet.kilictas.com/wp-content/uploads/2009/04/mvc_.jpg"><img class="size-full wp-image-285 aligncenter" title="mvc_architechture" src="http://samet.kilictas.com/wp-content/uploads/2009/04/mvc_.jpg" alt="" width="432" height="67" /></a></p>
<p>The figure above may help you while thinking what structure it might have. Let&#8217;s start with Model.</p>
<p><strong>Model:<br />
</strong>It handles data processing and database works part. Model processes events sent by controller. After processing these events then it sends processed data to controller (thus, controller may reprocess it) or directly to view side.</p>
<p><strong>View:<br />
</strong>View prepares an interface to show to the user. Controller or model tells view what to show to the user. Also view handles requests from user and informs controller.</p>
<p><span id="more-283"></span></p>
<p><strong>Controller:<br />
</strong>Let&#8217;s say controller is like brain of the system. That is right. Because it processes every request, prepares other parts of the system like model and view. Then the system determines what to do by controller&#8217;s commands.</p>
<p>Even if you are junior developer you probably faced with a problem called &#8220;Complexity of Project&#8221;. There MVC comes. MVC helps you to decrease complexity of project. For instance, there is a team with 5 people. If they are working on same project after sometime project reaches a point which no one cannot understand what is project going to be. What i mean is MVC splits project to (by default) three different parts. Like Model, View, Controller.You can say;</p>
<p style="text-align: center;"><a href="http://samet.kilictas.com/wp-content/uploads/2009/04/mvc_2.jpg"><img class="size-full wp-image-286 aligncenter" title="mvc_2" src="http://samet.kilictas.com/wp-content/uploads/2009/04/mvc_2.jpg" alt="" width="500" height="289" /></a></p>
<p>As you see above if you split your project three part like Application Development, Database and Data processing and Interface development then of course you project will be more understandable and developers can work more efficiently.</p>
<p><strong>What are the advantages of MVC?<br />
</strong>MVC is perfect for team work. As i mention before this architecture splits your project into some parts so, team members can work and their parts without any dependency. Then you will realize that MVC makes your project more systematic.<br />
It is really easy to edit or change some part of your project that makes less development cost and maintenance cost.<br />
MVC doesn&#8217;t repeats itself. If you wrote some script for your project. Because of non-dependancy property of MVC then you may use this script for another project of yours. And of course it helps you to finish your project by spending less time then others.<br />
And developers doesn&#8217;t fight after 5pm <img src='http://samet.kilictas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Why MVC is non-standard?</strong><br />
Still waits for developers to discover itself. <img src='http://samet.kilictas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I know some developers who think that they have to write even every semicolon, letter. you don&#8217;t have to do that. However, MVC tries to help you to don&#8217;t repeat yourself.<br />
<strong><br />
Why MVC is too important for Companies?</strong><br />
Well it is not!. Yes that is true. A company only looks for if a project is done on time or not. Most of the companies doesn&#8217;t interested what structure you are using while developing.<br />
Probably you know this formula : P=W/T  (P:Power &#8211; W:Work &#8211; T:Time) As you see here if you descrease the time so you may done with more Work. That means money! So, you see how MVC helps you.</p>
<p><strong>Example:</strong><br />
As an example you can think like eyes of a human stands for view, brain stands for controller and neutral system of a body stands for model. You can imagine like when a person sees his friend eyes (view) tells this to the brain (controller). Brain wants to show smile to his friend. To make it possible brain tells your face&#8217;s neutral network that make the face smile. Then his face smiles <img src='http://samet.kilictas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Hope it helped.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/what-is-mvc-architecture-model-view-controller/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What is PHP?</title>
		<link>http://samet.kilictas.com/what-is-php/</link>
		<comments>http://samet.kilictas.com/what-is-php/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 09:24:37 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[what is php]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=273</guid>
		<description><![CDATA[First of all i need to say that PHP is a language which you are going to in love with. (That is of course if you are a developer ) PHP stands for PHP: Hypertext Processsor. To start with it you should have knowledge about basic scripting and HTML language. PHP is totaly free to [...]]]></description>
			<content:encoded><![CDATA[<p>First of all i need to say that PHP is a language which you are going to in love with. (That is of course if you are a developer ) <strong>PHP </strong>stands for <strong>P</strong>HP: <strong>H</strong>ypertext <strong>P</strong>rocesssor.</p>
<p>To start with it you should have knowledge about basic scripting and HTML language.</p>
<p>PHP is totaly free to use and download that is because it is an open source. Well there are many scripting languages on the earth. PHP is server-side scripting language. It means codes are executing on the server-side not in the client-side.</p>
<p style="text-align: center;"><a href="http://samet.kilictas.com/wp-content/uploads/2009/04/server-side-php.gif"><img class="alignnone size-medium wp-image-274" title="server-side-php" src="http://samet.kilictas.com/wp-content/uploads/2009/04/server-side-php-276x300.gif" alt="" width="276" height="300" /></a></p>
<p>Thus, clients cannot see your php script, a client can only see pure html content. Now i can say PHP is secure langauge since user cannot see your PHP code. How it works? For instance, a client (user) requests a webpage from your server. Then your server executes php code and returns pure html content to the user. And user have no chance to see what is going on at the server-side.</p>
<p><em>Extensions : .php, .php3, .phtml</em></p>
<p><span id="more-273"></span></p>
<p><strong>Why PHP?</strong></p>
<p>It works efficiently on server-side. PHP language supports many database programs such as MySQL, ISS, Informix, Oracle, Sybase, Solid,   PostgreSQL, Generic ODBC, etc. And yes it is cross-platform. It runs on many-platforms MacOS, Windows, Linux, Unix, etc. and compatible with almost all servers.</p>
<p>I will keep writing on PHP topic with more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/what-is-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s get started with jQuery</title>
		<link>http://samet.kilictas.com/lets-get-started-with-jquery/</link>
		<comments>http://samet.kilictas.com/lets-get-started-with-jquery/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 11:37:24 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=247</guid>
		<description><![CDATA[Nowadays you may see tons of Javascript frameworks coming up. The truth is that it makes your code efficient if a framework used instead of pure javascript code. Most of the javascript frameworks helps you to solve crossbrowser difficulties. Probably you heard about Prototype and MooTools. You may see some people are trying to decide [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://samet.kilictas.com/wp-content/uploads/2009/02/logo_jquery_215x53.gif"><img class="alignleft size-full wp-image-248" title="Jquery" src="http://samet.kilictas.com/wp-content/uploads/2009/02/logo_jquery_215x53.gif" alt="" width="215" height="53" /></a> Nowadays you may see tons of Javascript frameworks coming up. The truth is that it makes your code efficient if a framework used instead of pure javascript code. Most of the javascript frameworks helps you to solve crossbrowser difficulties. Probably you heard about Prototype and MooTools. You may see some people are trying to decide between these frameworks. I should say i am fan of jQuery. jQuery comes with tons of futures and flexibility and you can do a big work with less effort and it is not just a regular library however jQuery is even ajax and effect library. It does evertything i need with piece of code.</p>
<blockquote><p>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.</p></blockquote>
<p>Let&#8217;s say you are using some other libraries as well, there it goes, jQuery is such a good friend with other libraries. API designed with conciseness and convenience as the driving factors.</p>
<p>Before start with jQuery i want you to know some basics about it. You can download the framework basically from www.jquery.com then download it on your desktop. This is how jQuery places in html code.</p>
<pre class="brush: html">&lt;html&gt;
&lt;head&gt;
&lt;strong&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;&lt;/strong&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;strong&gt;// Your code goes here&lt;/strong&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>You can start with placing your core *.js file which is jquery.js for this example.</p>
<p><span id="more-247"></span></p>
<p><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;</code></p>
<p>You may change src attribute to point your js files in your server path. Once you done with it then you can start with jquery. Now all you should do is place your code in &#8220;// Your code goes here&#8221; part.</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/lets-get-started-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embed php into Javascript</title>
		<link>http://samet.kilictas.com/embed-php-into-javascript/</link>
		<comments>http://samet.kilictas.com/embed-php-into-javascript/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 23:43:49 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[$(document)]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=236</guid>
		<description><![CDATA[In javascript you cannot read variables from a server instanly however if you embed your php code you may pass variables into javascript code. So php can pass its variables when page loads. Here is an example using jquery &#60;?php $variable = &#039;Here is value&#039;; ?&#62; &#60;script type= &#34;text/javascript&#34;&#62; $(document).ready(function(){ var button = &#60;?php echo [...]]]></description>
			<content:encoded><![CDATA[<p>In javascript you cannot read variables from a server instanly however if you embed your php code you may pass variables into javascript code.</p>
<p>So php can pass its variables when page loads. Here is an example using jquery</p>
<pre class="brush: php">&lt;?php $variable = &#039;Here is value&#039;; ?&gt;
&lt;script type= &quot;text/javascript&quot;&gt;
$(document).ready(function(){
var button = &lt;?php echo $variable; ?&gt; ;
});
&lt;/script&gt;
</pre>
<p><span id="more-236"></span>Keep Coding</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/embed-php-into-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example Code #4 &#8211; Intersect and Write in Prolog</title>
		<link>http://samet.kilictas.com/example-code-4-intersect-and-write-in-prolog/</link>
		<comments>http://samet.kilictas.com/example-code-4-intersect-and-write-in-prolog/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 12:13:38 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prolog]]></category>
		<category><![CDATA[append]]></category>
		<category><![CDATA[intersect]]></category>
		<category><![CDATA[member]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=221</guid>
		<description><![CDATA[1- &#8220;!&#8221; character stops the query when it is false and &#8220;;&#8221; runs as &#8220;or&#8221; so it skips the false part then moves next part smaller(X,Y):- X X&#62;Y,write(Y),write(' is bigger then '),write(X),!; write('They are equal'). Query -&#62; ?smaller(3,5) : 3 is smaller then 5 Query -&#62; ?smaller(8,5) : 8 is bigger then 5 Query -&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1- &#8220;!&#8221; character stops the query when it is false and &#8220;;&#8221; runs as &#8220;or&#8221; so it skips the false part then moves next part</strong></p>
<p><code>smaller(X,Y):- X<br />
X&gt;Y,write(Y),write(' is bigger then '),write(X),!;<br />
write('They are equal').</code></p>
<p>Query -&gt; <code>?smaller(3,5)  : 3 is smaller then 5</code><br />
Query -&gt; <code>?smaller(8,5)  : 8 is bigger then 5</code><br />
Query -&gt; <code>?smaller(5,5)  : They are equal</code></p>
<p><strong>2- Intersect relation</strong></p>
<p>Intersect function uses an external function inside. Member function checks whether the first parameter is member of the given list or not.</p>
<p>Query -&gt; <code>member(3,[3,4,5]).</code></p>
<p><code>member(HM,[HM|TM]).<br />
member(XM,[HM|TM]):- member(XM,TM).</code></p>
<p>and the intersect function gives you the result on LI variable. Try it.</p>
<p>intersect([ ],LI,[ ]).<br />
intersect([HI|TI],LI,LI2):- member(HI,LI),intersect(TI,LI,LI3),LI2=[HI|LI3],!;intersect(TI,LI,LI2).</p>
<p>Query -&gt; <code>intersect([3,4],LI,[4,5]) : [4]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/example-code-4-intersect-and-write-in-prolog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example Code #3 &#8211; Basics in Prolog</title>
		<link>http://samet.kilictas.com/example-code-3-basics-in-prolog/</link>
		<comments>http://samet.kilictas.com/example-code-3-basics-in-prolog/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 13:16:35 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prolog]]></category>
		<category><![CDATA[factorial]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[parent]]></category>
		<category><![CDATA[Sister]]></category>
		<category><![CDATA[swi prolog]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=207</guid>
		<description><![CDATA[1- Parent relation between rex, doggie and goldie dog(rex). dog(X):-parent(X,Y). parent(goldie,rex). parent(jack,rex). Query -> ?dog(goldie) : YES Query -> ?dog(jack) : YES 2- Sister relation sister(X,Y):-girl(X),girl(Y),parent(X,Z),parent(Y,Z). parent(sara,Maria). parent(lili,Maria). girl(lili). girl(maria). Query -> ?sister(lili,maria) : NO 3- Finds factorial of numbers 1!: 1 , 2!: 2&#215;1, 3!: 3x2x1 Here you can see that we are able [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1- Parent relation between rex, doggie and goldie</strong></p>
<p><code>dog(rex).<br />
dog(X):-parent(X,Y).<br />
parent(goldie,rex).<br />
parent(jack,rex).</code></p>
<p>Query -> <code>?dog(goldie)  : YES</code><br />
Query -> <code>?dog(jack)  : YES</code></p>
<p><strong>2- Sister relation</strong></p>
<p><code>sister(X,Y):-girl(X),girl(Y),parent(X,Z),parent(Y,Z).<br />
parent(sara,Maria).<br />
parent(lili,Maria).<br />
girl(lili).<br />
girl(maria).</code></p>
<p>Query -> <code>?sister(lili,maria) : NO</code></p>
<p><strong>3- Finds factorial of numbers</strong></p>
<p>1!: 1 , 2!: 2&#215;1, 3!: 3x2x1<br />
Here you can see that we are able to say 3!: 3&#215;2!  instead of 3!:3x2x1 . Since i know what is 1! and 0! therefore i have limitation points for my program.</p>
<p><code>fact(0,1):-!.<br />
fact(1,1):-!.<br />
fact(N,F,F1) :- N1 is N-1, fact(N1,F1), F is N * F1.</code></p>
<p><span id="more-207"></span></p>
<p><strong>4- Finds Fibonacci numbers</strong></p>
<p>1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,&#8230; </p>
<p><code>fib(0,0):-!.<br />
fib(1,1):-!.<br />
fib(X,L) :- X > 1, 	Y1 is X-1, Y2 is X-2, fib(Y1,F1), fib(Y2,F2), L is F1+F2.</code></p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/example-code-3-basics-in-prolog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
