<?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>Webscriptz.be &#187; development</title>
	<atom:link href="http://webscriptz.be/tags/development/feed" rel="self" type="application/rss+xml" />
	<link>http://webscriptz.be</link>
	<description></description>
	<lastBuildDate>Thu, 13 Oct 2011 18:16:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Fedora Core &#8211; virtual hosts httpd</title>
		<link>http://webscriptz.be/2011/03/25/configuring-virtual-hosts-in-apache/382</link>
		<comments>http://webscriptz.be/2011/03/25/configuring-virtual-hosts-in-apache/382#comments</comments>
		<pubDate>Thu, 24 Mar 2011 23:06:20 +0000</pubDate>
		<dc:creator>webscriptz</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[127.0.0.1]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[bind9]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[local domain name]]></category>
		<category><![CDATA[name-based virtual host]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[virtual hosts]]></category>

		<guid isPermaLink="false">http://webscriptz.be/?p=382</guid>
		<description><![CDATA[I&#8217;ve reinstalled my pc with Fedora Core recently, because of the extended SELinux and more tools that are at my disposal. A problem I always had with ubuntu was the configuration of Apache virtual hosts. Once they where installed I needed to put them into the host file and each time I reconnected to a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve reinstalled my pc with Fedora Core recently, because of the extended SELinux and more tools that are at my disposal. A problem I always had with ubuntu was the configuration of Apache virtual hosts. Once they where installed I needed to put them into the host file and each time I reconnected to a network the NetworkManager rewrote the hosts file annoying me and the fact that if one was configured localhost would also begin pointing to it, a rather nasty thing.</p>
<p>First you need to open the console and login with your root user, type su and fedora will already know what to do.</p>
<p>You need to shutdown the httpd servic deamon with the command :<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="DOS"><div class="devcodeoverflow"><ol><li>/etc/init.d/httpd stop</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>You will have to open /etc/httpd/conf/httpd.conf, once opened you will have to locate the section on virtual hosts and you should see an example that is already commented out., I edited the files with nano in the console.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="DOS"><div class="devcodeoverflow"><ol><li>### Section 3: Virtual Hosts</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Instead of telling you which lines to uncomment, I&#8217;m going to show you below, the stanzas to add to the Virtual Host section to get companyABC.com and companyDEF.com websites running:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="DOS"><div class="devcodeoverflow"><ol><li>#</li><li># Virtual hosts</li><li>#</li><li>&nbsp;</li><li># Virtual host Default Virtual Host</li><li><span style="color: #33cc33;">&lt;</span>VirtualHost *<span style="color: #33cc33;">&gt;</span></li><li>DocumentRoot /var/www/html/</li><li>ErrorLog logs/error_log</li><li>ServerAdmin root<span style="color: #33cc33;">@</span>localhost</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li>ServerSignature email</li><li>TransferLog logs/access_log</li><li>DirectoryIndex index.php index.html index.htm index.shtml</li><li>&nbsp;</li><li>&nbsp;</li><li>SSLEngine off</li><li>SSLCertificateFile /etc/pki/tls/certs/localhost.crt</li><li>SSLCertificateKeyFile /etc/pki/tls/private/localhost.key</li><li>&nbsp;</li><li>SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt</li><li>&nbsp;</li><li>SSLOptions</li><li>LogFormat &quot;None&quot;</li><li>TransferLog logs/access_log</li><li>ErrorLog logs/error_log</li><li>LogLevel debug</li><li>HostNameLookups off</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>/VirtualHost<span style="color: #33cc33;">&gt;</span></li><li>&nbsp;</li><li># Virtual host resume.loc</li><li><span style="color: #33cc33;">&lt;</span>VirtualHost 127.0.0.1<span style="color: #33cc33;">&gt;</span></li><li>DocumentRoot /var/www/html/mdw/resume</li><li>ErrorLog logs/error_log</li><li>ServerAdmin root<span style="color: #33cc33;">@</span>localhost</li><li>ServerName resume.loc</li><li>&nbsp;</li><li>&nbsp;</li><li>ServerSignature email</li><li>TransferLog logs/access_log</li><li>DirectoryIndex index.html index.php index.shtml</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>Directory &quot;/var/www/html/mdw/resume/&quot;<span style="color: #33cc33;">&gt;</span></li><li>Options all</li><li>&nbsp;</li><li>AllowOverride all</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>/Directory<span style="color: #33cc33;">&gt;</span></li><li>&nbsp;</li><li>&nbsp;</li><li>SSLEngine off</li><li>SSLCertificateFile /etc/pki/tls/certs/localhost.crt</li><li>SSLCertificateKeyFile /etc/pki/tls/private/localhost.key</li><li>&nbsp;</li><li>SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt</li><li>&nbsp;</li><li>SSLOptions</li><li>LogFormat &quot;None&quot;</li><li>TransferLog logs/access_log</li><li>ErrorLog logs/error_log</li><li>LogLevel error</li><li>HostNameLookups on</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>/VirtualHost<span style="color: #33cc33;">&gt;</span></li><li>&nbsp;</li><li># Virtual host linker</li><li><span style="color: #33cc33;">&lt;</span>VirtualHost 127.0.0.1<span style="color: #33cc33;">&gt;</span></li><li>DocumentRoot /var/www/html/mdw/linkerv2/</li><li>ErrorLog logs/error_log</li><li>ServerAdmin root<span style="color: #33cc33;">@</span>localhost</li><li>ServerName linker.loc</li><li>&nbsp;</li><li>&nbsp;</li><li>ServerSignature email</li><li>TransferLog logs/access_log</li><li>DirectoryIndex index.html index.php index.shtml</li><li>&nbsp;</li><li>&nbsp;</li><li>SSLEngine off</li><li>SSLCertificateFile /etc/pki/tls/certs/localhost.crt</li><li>SSLCertificateKeyFile /etc/pki/tls/private/localhost.key</li><li>&nbsp;</li><li>SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt</li><li>&nbsp;</li><li>SSLOptions</li><li>LogFormat &quot;None&quot;</li><li>TransferLog logs/access_log</li><li>ErrorLog logs/error_log</li><li>LogLevel error</li><li>HostNameLookups on</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>/VirtualHost<span style="color: #33cc33;">&gt;</span></li><li>&nbsp;</li><li># Virtual host Virtual Host 1</li><li><span style="color: #33cc33;">&lt;</span>VirtualHost 127.0.0.1<span style="color: #33cc33;">&gt;</span></li><li>DocumentRoot /var/www/html/mdw/site</li><li>ErrorLog logs/error_log</li><li>ServerAdmin root<span style="color: #33cc33;">@</span>localhost</li><li>ServerName mdw.loc</li><li>&nbsp;</li><li>&nbsp;</li><li>ServerSignature email</li><li>TransferLog logs/access_log</li><li>DirectoryIndex index.html index.php index.shtml</li><li>&nbsp;</li><li>&nbsp;</li><li>SSLEngine off</li><li>SSLCertificateFile /etc/pki/tls/certs/localhost.crt</li><li>SSLCertificateKeyFile /etc/pki/tls/private/localhost.key</li><li>&nbsp;</li><li>SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt</li><li>&nbsp;</li><li>SSLOptions</li><li>&nbsp;</li><li>TransferLog logs/access_log</li><li>ErrorLog logs/error_log</li><li>LogLevel error</li><li>HostNameLookups on</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #33cc33;">&lt;</span>/VirtualHost<span style="color: #33cc33;">&gt;</span></li><li>&nbsp;</li><li> </li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>After you have added the host(s), save the file. At this point, you will need to add the appropriate records to your DNS server to make these domains reachable by anyone on the network. If you have no access to a DNS server (BIND9), or you just want to test the configuration, just edit your /etc/hosts file. Here is what my file looks like:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="DOS"><div class="devcodeoverflow"><ol><li># <span style="color: #00b100; font-weight: bold;">Do</span> <span style="color: #000000; font-weight: bold;">not</span> remove the following line, or various programs</li><li># that require network functionality will fail.</li><li>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localhost.localdomain localhost</li><li>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host1.loc</li><li>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host2.loc</li><li></li></ol></div></pre><!--END_DEVFMTCODE--><br />
Once hosts is saved you just restart your server and everything should work without a problem</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2011/03/25/configuring-virtual-hosts-in-apache/382" target="_blank"><img src="http://webscriptz.be/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2011/03/25/configuring-virtual-hosts-in-apache/382" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://webscriptz.be/2011/03/25/configuring-virtual-hosts-in-apache/382/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>YII framework configuration</title>
		<link>http://webscriptz.be/2009/12/20/yii-framework-configuration/253</link>
		<comments>http://webscriptz.be/2009/12/20/yii-framework-configuration/253#comments</comments>
		<pubDate>Sun, 20 Dec 2009 22:47:49 +0000</pubDate>
		<dc:creator>webscriptz</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[yii]]></category>
		<category><![CDATA[yii framework]]></category>

		<guid isPermaLink="false">http://webscriptz.be/?p=253</guid>
		<description><![CDATA[I&#8217;m toying with the Yii Framework for some time now and even if i cost me a lot of anger and frustration in the beginning I&#8217;m starting to like it more and more, alas I do have to say that the documentation isn&#8217;t always that clear and for someone who begins or who&#8217;ll write some [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m toying with the Yii Framework for some time now and even if i cost me a lot of anger and frustration in the beginning I&#8217;m starting to like it more and more, alas I do have to say that the documentation isn&#8217;t always that clear and for someone who begins or who&#8217;ll write some large applications the configuration file can be a hassle so here&#8217;s my solution:</p>
<blockquote><p>Brake down the configuration file in multiple files, this will give you some speed disadvantage and some will  saying that I&#8217;m raping Yii framework purpose for speed but at least to me it seems more clear</p></blockquote>
<p>This is the protected.config/main.php</p>
<p><pre class="brush:[php]">
dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=&gt;'WEBSITENAME',
'modules'=&gt;array(
'users'=&gt;array(
//sub modules in the module users
'modules'=&gt;array(
'messaging',
'profile',
'dashboard',
)
),
'about',
'forums',
),
// preloading 'log' component active loading
'preload'=&gt;array('log'),

// autoloading model and component classes lazy loading
// I make the difference between CformModel and CActiveRecord
'import'=&gt;array(
'application.models.*',
'application.models.forms.*',
'application.models.database.*',
),

// application components
'components'=&gt;array(
// enable cookie-based authentication
'user'=&gt;array('allowAutoLogin'=&gt;true),

// data relinquished to database.php
// for easy access and usability as also for the future
// installation procedure, it's less to write to a file
'db'=&gt;include(dirname(__FILE__).'/database.php'),

// for a better overview we exculded url routes to a seperate file
'urlManager'=&gt;include(dirname(__FILE__).'/routes.php'),

//authentication component needs data from db for CdbConnection
'authManager'=&gt;array(
'class'=&gt;'CDbAuthManager',
'connectionID'=&gt;'db',
'defaultRoles'=&gt;array('authenticated', 'guest'),
),

//security measures
'request'=&gt;array(
'enableCsrfValidation'=&gt;true,
'enableCookieValidation'=&gt;true,
),
),

// application-level parameters that can be accessed
// using Yii::app()-&gt;params['paramName']
// uncomment the following if you want static params in the application
//'params'=&gt;array(include(dirname(__FILE__).'/params.php'))
);</pre></p>
<p>database.php<br />
<pre class="brush:[php]">
'CDbConnection',
'connectionString'=&gt;'mysql:host=localhost;dbname=mysql',
//'connectionString'=&gt;'pgsql:host=localhost;port=5432;dbname=mysql',
'username' =&gt; 'root',
'password' =&gt; '',
);
?&gt;
</pre></p>
<p>routes.php<br />
<pre class="brush:[php]">
'path', // path or get
'urlSuffix' =&gt; '', //.html .whateverextentionyouwant
'showScriptName' =&gt; true,
'rules'=&gt;array(
'users/recovery/perimeterSecurity/'=&gt;'users/recovery/perimeterSecurity',
),
);
?&gt;
</pre></p>
<p>param.php<br />
<pre class="brush:[php]">//nothing in it at the moment</pre></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2009/12/20/yii-framework-configuration/253" target="_blank"><img src="http://webscriptz.be/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2009/12/20/yii-framework-configuration/253" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://webscriptz.be/2009/12/20/yii-framework-configuration/253/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A freepascal clock</title>
		<link>http://webscriptz.be/2008/08/30/a-freepascal-clock/114</link>
		<comments>http://webscriptz.be/2008/08/30/a-freepascal-clock/114#comments</comments>
		<pubDate>Fri, 29 Aug 2008 22:47:43 +0000</pubDate>
		<dc:creator>webscriptz</dc:creator>
				<category><![CDATA[source code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[fpc]]></category>
		<category><![CDATA[freepascal]]></category>

		<guid isPermaLink="false">http://webscriptz.be/?p=114</guid>
		<description><![CDATA[A basical console clock written in freepascal by me, even if it&#8217;s an old language, I have to practice on it for school. Here you got the code, I&#8217;ve added little comments but it isn&#8217;t a lot. hh = hour mm = minutes ss= seconds &#160;uses crt;&#160;var hh, mm, ss :integer;&#160;BEGINss:=0;mm:=0;hh:=0;&#160;writeln&#40;'Donne le heure: '&#41;;readln&#40;hh&#41;;writeln&#40;'donnez les [...]]]></description>
			<content:encoded><![CDATA[<p>A basical console clock written in freepascal by me, even if it&#8217;s an old language, I have to practice on it for school.</p>
<p>Here you got the code, I&#8217;ve added little comments but it isn&#8217;t a lot. hh = hour mm = minutes ss= seconds</p>
<p><span id="more-114"></span><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Pascal"><div class="devcodeoverflow"><ol><li></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">uses</span> crt;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">var</span> hh<span style="color: #339933;">,</span> mm<span style="color: #339933;">,</span> ss <span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">integer</span>;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">BEGIN</span></li><li>ss<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>mm<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>hh<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>&nbsp;</li><li><span style="color: #000066;">writeln</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Donne le heure: '</span><span style="color: #009900;">&#41;</span>;</li><li><span style="color: #000066;">readln</span><span style="color: #009900;">&#40;</span>hh<span style="color: #009900;">&#41;</span>;</li><li><span style="color: #000066;">writeln</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'donnez les minutes'</span><span style="color: #009900;">&#41;</span>;</li><li><span style="color: #000066;">readln</span><span style="color: #009900;">&#40;</span>mm<span style="color: #009900;">&#41;</span>;</li><li>clrscr;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">while</span> ss&amp;lt;<span style="color: #cc66cc;">60</span> <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #666666; font-style: italic;">//59 seconds because on 60 mm+1</span></li><li><span style="color: #000000; font-weight: bold;">begin</span></li><li>ss<span style="color: #339933;">:=</span> ss <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">//count the seconds</span></li><li>&nbsp;</li><li><span style="color: #000066;">writeln</span><span style="color: #009900;">&#40;</span>hh<span style="color: #339933;">,</span><span style="color: #ff0000;">' : '</span><span style="color: #339933;">,</span> mm<span style="color: #339933;">,</span><span style="color: #ff0000;">' : '</span><span style="color: #339933;">,</span> ss<span style="color: #009900;">&#41;</span>;</li><li>&nbsp;</li><li>delay<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;</li><li>clrscr;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">if</span> ss<span style="color: #339933;">=</span><span style="color: #cc66cc;">59</span> <span style="color: #000000; font-weight: bold;">then</span>&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">//if 59 then mm + 1</span></li><li><span style="color: #000000; font-weight: bold;">begin</span></li><li>mm<span style="color: #339933;">:=</span> mm <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>;</li><li>ss<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">if</span> mm<span style="color: #339933;">=</span><span style="color: #cc66cc;">59</span> <span style="color: #000000; font-weight: bold;">then</span>&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// 60 minutes but 59 minutes and 59 sec =&amp;gt; hh+1</span></li><li><span style="color: #000000; font-weight: bold;">begin</span></li><li>hh<span style="color: #339933;">:=</span>&nbsp;&nbsp;hh <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>;</li><li>mm<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>ss<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">if</span> hh<span style="color: #339933;">=</span><span style="color: #cc66cc;">23</span> <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #666666; font-style: italic;">//24 hr, i don't do days</span></li><li><span style="color: #000000; font-weight: bold;">begin</span></li><li>hh<span style="color: #339933;">:=</span><span style="color: #cc66cc;">0</span>;</li><li><span style="color: #000000; font-weight: bold;">end</span>;</li><li><span style="color: #000000; font-weight: bold;">end</span>;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">end</span>;</li><li><span style="color: #000000; font-weight: bold;">end</span></li><li><span style="color: #000000; font-weight: bold;">END</span>.</li></ol></div></pre><!--END_DEVFMTCODE--><br />
<ins datetime="2008-12-25T18:49:02+00:00"></ins></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2008/08/30/a-freepascal-clock/114" target="_blank"><img src="http://webscriptz.be/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2008/08/30/a-freepascal-clock/114" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://webscriptz.be/2008/08/30/a-freepascal-clock/114/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C &amp; FPC</title>
		<link>http://webscriptz.be/2008/08/29/c-fpc/108</link>
		<comments>http://webscriptz.be/2008/08/29/c-fpc/108#comments</comments>
		<pubDate>Fri, 29 Aug 2008 20:04:21 +0000</pubDate>
		<dc:creator>webscriptz</dc:creator>
				<category><![CDATA[source code]]></category>
		<category><![CDATA[Dev C]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[fpc]]></category>

		<guid isPermaLink="false">http://webscriptz.be/?p=108</guid>
		<description><![CDATA[C programming and pascal, that&#8217;s what I&#8217;m doing for the moment, I have an exam in 5 days, man I hate it. Just finished a clock in C: you give the time for tomorrow and he&#8217;ll count it down. But it&#8217;s basic: #include#include&#160;int main&#40;int argc, char *argv&#91;&#93;&#41;&#123;long hh, mm,th, tm, ts;&#160;printf&#40;&#34;Reveil a quelle heure(24) minutes? [...]]]></description>
			<content:encoded><![CDATA[<p>C programming and pascal, that&#8217;s what I&#8217;m doing for the moment, I have an exam in 5 days, man I hate it.</p>
<p>Just finished a clock in C: you give the time for tomorrow and he&#8217;ll count it down. But it&#8217;s basic:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #666666; font-style: italic;">#include</span></li><li><span style="color: #666666; font-style: italic;">#include</span></li><li>&nbsp;</li><li>int main<span style="color: #009900;">&#40;</span>int argc<span style="color: #339933;">,</span> char <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span></li><li><span style="color: #009900;">&#123;</span></li><li>long hh<span style="color: #339933;">,</span> mm<span style="color: #339933;">,</span>th<span style="color: #339933;">,</span> tm<span style="color: #339933;">,</span> ts<span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Reveil a quelle heure(24) minutes? <span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>scanf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%ld&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span>hh<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>scanf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%ld&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span>mm<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>th<span style="color: #339933;">=</span> hh<span style="color: #339933;">+</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//ceci pr une journee</span></li><li>tm <span style="color: #339933;">=</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">-</span> mm<span style="color: #339933;">;</span></li><li>ts<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>th<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span>hh<span style="color: #009900;">&#41;</span></li><li><span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ts<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ts<span style="color: #339933;">-=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #990000;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>tm<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ts<span style="color: #339933;">=</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span> tm<span style="color: #339933;">--;</span><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>th<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>hh<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ts<span style="color: #339933;">=</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span> tm<span style="color: #339933;">=</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span> th<span style="color: #339933;">--;</span><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>th<span style="color: #339933;">=</span>hh<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ts<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>ts<span style="color: #339933;">--;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span></li><li><span style="color: #990000;">system</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cls&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%ld : %ld : %ld&quot;</span><span style="color: #339933;">,</span> th<span style="color: #339933;">,</span> tm<span style="color: #339933;">,</span> ts<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #990000;">system</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PAUSE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #339933;">&lt;</span>span style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text-decoration: line-through;&quot;</span><span style="color: #339933;">&gt;</span>I<span style="color: #0000ff;">'m more or less pleased but still the infinite refreshments aren'</span>t what I wanted and sorry about the comment but in exercises I don<span style="color: #0000ff;">'t use them&lt;/span&gt;&lt;span id=&quot;more-108&quot;&gt;&lt;/span&gt;</span></li><li>&nbsp;</li><li><span style="color: #0000ff;">Here'</span>s the correction of the whole shebang<span style="color: #339933;">:</span></li><li>&nbsp;</li><li><span style="color: #339933;">&lt;</span>code lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;c&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #666666; font-style: italic;">#include</span></li><li><span style="color: #666666; font-style: italic;">#include </li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>int main(int argc, char *argv[])<br />
{<br />
long hh, mm,th, tm, ts;</p>
<p>printf(&#8220;Reveil a quelle heure(24) minutes? \t&#8221;);<br />
scanf(&#8220;%ld&#8221;, &amp;hh);<br />
scanf(&#8220;%ld&#8221;, &amp;mm);</p>
<p>th= hh+1; //ceci pr une journee<br />
tm = mm;<br />
ts=0;</p>
<p>while(th&gt;=hh)<br />
{<br />
if(th&gt;hh){<br />
if(ts&gt;0){ts-=1; sleep(1000);}<br />
else if(tm&gt;0){ts=60; tm&#8211;;}<br />
else if (th&gt;hh){ts=60; tm=60; th&#8211;;}<br />
}<br />
else if(th==hh){<br />
if(ts&gt;0){ts-=0; sleep(1000);}<br />
else if(tm&gt;mm){ts=60; tm&#8211;;}<br />
else {printf(&#8220;\n\n\n Reveille toi !!!!&#8221;); system(&#8220;PAUSE&#8221;); return 0;}<br />
}</p>
<p>system(&#8220;CLS&#8221;);</p>
<p>printf(&#8220;%ld : %ld : %ld&#8221;, th, tm, ts);</p>
<p>}</p>
<p>system(&#8220;PAUSE&#8221;);<br />
return 0;<br />
}</code></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2008/08/29/c-fpc/108" target="_blank"><img src="http://webscriptz.be/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://webscriptz.be/2008/08/29/c-fpc/108" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://webscriptz.be/2008/08/29/c-fpc/108/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

