
<?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>/dev/profetes/</title>
	<atom:link href="http://profetes.pl/feed/" rel="self" type="application/rss+xml" />
	<link>http://profetes.pl</link>
	<description>Michał Pasieka aka profetes site</description>
	<lastBuildDate>Tue, 15 May 2012 23:14:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>

   <image>
    <title>/dev/profetes/</title>
    <url>http://0.gravatar.com/avatar/f9a1c601ad020c500e0f15ec55398d90.png?s=48</url>
    <link>http://profetes.pl</link>
   </image>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Convert national characters to ascii-based ones in Ruby and Rails</title>
		<link>http://profetes.pl/2012/05/16/convert-national-characters-to-ascii-based-ones-in-ruby-and-rails/</link>
		<comments>http://profetes.pl/2012/05/16/convert-national-characters-to-ascii-based-ones-in-ruby-and-rails/#comments</comments>
		<pubDate>Tue, 15 May 2012 23:12:41 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=341</guid>
		<description><![CDATA[Hello there, it&#8217;s been awfully long time since I&#8217;ve posted something in here. There are a few drafts of posts, though. I wanna finish and publish them very much! I&#8217;ve encountered a problem, or trouble, with Ruby, Rails, UTF and ASCII encoding. I wanted to generate url-safe name out of a few strings. I didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Hello there, it&#8217;s been awfully long time since I&#8217;ve posted something in here. There are a few drafts of posts, though. I wanna finish and publish them very much!</p>
<p>I&#8217;ve encountered a problem, or trouble, with Ruby, Rails, UTF and ASCII encoding. I wanted to generate url-safe name out of a few strings. I didn&#8217;t know how to ask Google about it, but finally I&#8217;ve found valuable resources.<br />
But let&#8217;s keep an order of the events.</p>
<h2><span id="more-341"></span>Issue: permalink</h2>
<p>The situation was like that &#8211; I needed to create unique, or nearly unique text out of web form&#8217;s data. Since I&#8217;m Pole &#8211; users of my site would be Poles as well. And they type characters as:</p>
<pre>ą ś ć ź Ą Ę ł Ł Ń Ó Ć</pre>
<p>And it&#8217;s simply impossible to use the concatenation of such strings as an URL, as a permalink.</p>
<p>I needed something to convert those characters to their base ASCII chars. Then I would be able to downcase it and eventually remove spaces or something like that.<br />
I think it may be important to mention, that</p>
<ul>
<li>Ruby 1.9.3 String method &#8220;downcase&#8221; is able to treat ASCII characters only. So any non-ASCII ones would remain unchanged.</li>
<li>Ruby 1.9.3 does not support Iconv library &#8211; it&#8217;s depreciated.</li>
</ul>
<p>Ok, after some googling I got a solution, brute force. I want you to see that: <a href="http://dzone.com/snippets/national-characters-ascii">http://dzone.com/snippets/national-characters-ascii</a></p>
<p>I even started doing something like that myself, but it was really imperfect. I knew someone has done it better. I tried Rails&#8217; <a href="http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html" target="_blank">transliterate</a> method, but it didn&#8217;t satisfy me.</p>
<h3>Solution: stringex</h3>
<p>Finally, I found this awesome, still  maintained gem called <strong>stringex</strong>: <a href="https://github.com/rsl/stringex">https://github.com/rsl/stringex</a> It provides a number of useful methods related to permalink and link creation. If one needs to do some complicated transcription, it&#8217;s possible to configure non-trivial transitions. Just awesome!</p>
<p>Then it worked like a charm:</p>
<pre>
<pre class="brush: ruby; ">

nice_name = nice_name.to_ascii
nice_name.downcase!
nice_name.gsub!(/\./,&#039;&#039;)
nice_name.gsub!(/\ +/,&#039;-&#039;)
self.nice_name = CGI.escape nice_name  #just in case
</pre>
</pre>
<h2>Encoding mess at unit testing</h2>
<p>Great, now all that is missing is a test for it:</p>
<pre class="brush: ruby; ">

def test_nice_name_generation
@s = Someone.new :first =&gt; &quot;Józef&quot;, :last =&gt; &quot;Piłsudski&quot;, :country =&gt; &quot;Polska&quot;
@s.gen_nice_name

assert_equal &quot;jozef_pilsudski_polska&quot;, @s.nice_name
end
</pre>
<p>After launching rake test:units I saw a nasty message:</p>
<pre>invalid multibyte char (US-ASCII) (SyntaxError)</pre>
<p>WTF? How should I test my national character changes and permalink generation if I cannot insert national characters into test? Everything I give to Rails app is UTF-8, everything I display is UTF-8 &#8211; why this cannot get compiled?</p>
<p>And then I remembered, that Ruby by default treats all the source code as ASCII. And the very solution was to specify the encoding in the first line of the test file:</p>
<pre class="brush: ruby; ">

# encoding: utf-8
</pre>
<p>And then- everything turns green, no errors or failures. Another feature was implemented! Hooray! Thanks to this super-gem everything was done. It took more time to find this gem or any other code snippet, that to implement the final solution&#8230; Life <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3> Post scriptum</h3>
<p>Huge thanks to <a href="https://github.com/rsl" target="_blank">Russell Norris</a> for his gem and gem&#8217;s maintenance. In Ruby world long-term support for libraries is not very popular, unfortunately&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2012/05/16/convert-national-characters-to-ascii-based-ones-in-ruby-and-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make your old laptop new again!</title>
		<link>http://profetes.pl/2011/06/21/make-your-old-laptop-new-again/</link>
		<comments>http://profetes.pl/2011/06/21/make-your-old-laptop-new-again/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 20:04:40 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssd]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=319</guid>
		<description><![CDATA[In this article I&#8217;ll try to cover laptop upgrades that will allow you to put new power into it. If you care about your notebook&#8217;s performance you can alter some parts instead buying a new one. In this article I&#8217;ll write about my current laptop &#8211; Asus U30JC/i5 520M/4GB RAM/ 500GB HDD and what can be [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I&#8217;ll try to cover laptop upgrades that will allow you to put new power into it. If you care about your notebook&#8217;s performance you can alter some parts instead buying a new one.</p>
<p>In this article I&#8217;ll write about my current laptop &#8211; Asus U30JC/i5 520M/4GB RAM/ 500GB HDD and what can be done to make it work faster.</p>
<p><span id="more-319"></span></p>
<h2>A problem</h2>
<p>Recently I was struck by low performance of my laptop. I thought it would be nice to give it to my sister and by a new one for myself. I did some research, but the result were totally unsatisfying.. It turned out that a new laptop with fair performance speed up, compared to my current one, would be approx. 2000$. A year ago i bought mine for 1300$. That gives 700$ for:</p>
<ul>
<li>better graphics card &#8211; better gaming experience</li>
<li>keyboard with backlight &#8211; I want it sooo much!</li>
<li>2nd generation i5 or i7 processor</li>
<li>2-4 GB more RAM</li>
<li>SSD disk</li>
<li>slightly worse on-battery work time</li>
</ul>
<p>I compared my Asus with some ThinkPads and Apple&#8217;s MacBooks. Even if I paid those 2000$ I would get only slightly better performance. And it&#8217;s hard to find all those features coming with 12 or 13 inches of screen. And 8 hours of on-battery life. Such an investment is a most poorly attractive.</p>
<p>So I got some ideas to solve above aspects.</p>
<h2>Minor solutions</h2>
<p>Gaming XP- I bought myself a PS3 <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s far better and there&#8217;s definitely more fun than I would get with laptop. Big fail &#8211; no <a href="http://en.thewitcher.com/" target="_blank">Witcher 2</a> for PS3&#8230; I gotta live with it&#8230;</p>
<p><img class="size-medium wp-image-320 alignleft" title="my workplace" src="http://profetes.pl/wp-content/uploads/2011/06/great-workplace-300x225.jpg" alt="" width="300" height="225" /></p>
<p>Backlight for keyboard &#8211; I got USB keyboard from Tracer. It&#8217;s awesomely blue and eases working late, as it can be seen on the left. 10$.</p>
<p>2nd generation i5 processor &#8211; my current socket is compatible with it, so it&#8217;s the matter of time I change the processor.</p>
<p>2-4 GB more RAM &#8211; As far as I know &#8211; my current chipset accepts up to 8GB/1333MHz &#8211; for 100$ I can get it. And I still have 600$ to spare!</p>
<h2>Major solution &#8211; SSD, welcome!</h2>
<p>SSD disk &#8211; it&#8217;s kinda problematic as long as I have one HDD in my laptop. Buying a 200-300G SSD drive would cost me too much. I have found alternate solution.</p>
<p>I haven&#8217;t heard about this much in Poland (a few threads on some forums), but according to the information from the US &#8211; it seems to be a great solution.  You can use the bay for CD/DVD drive! I assume you don&#8217;t use CDs often. I can&#8217;t remember what was the last situation I had to use CD or DVD.  The only thing I have to do now is to order a piece called <strong>2nd HDD caddy</strong> (15$, directly from Hong Kong) and a SSD drive &#8211; I like Intel&#8217;s 320 SSD, 120G, 250$. A more detailed article can be found <a href="http://www.tomshardware.com/reviews/ssd-notebook-portable,1913.html" target="_blank">here</a>. For some pictures use <a href="http://http://images.google.com/" target="_blank">images.google.com</a> and look for <em>2nd hdd caddy</em>.</p>
<p>These caddies are available in 3 versions, for Macs (some special editions or something), 12mm and 9mm tall. I&#8217;ve checked my CD drive &#8211; it&#8217;s 12mm tall.</p>
<p>A big advantage of such a solution is that I can still store large amount of data on 500G hdd and take an advantage of SSD&#8217;s speed and install OS on it. Or event 2 OSes. If I had just SSD &#8211; where would I put all my data?</p>
<p>A certain drawback is that I have to perform OS installation from USB stick. I&#8217;ve done this for Linux already some time ago and for Windows XP as well. I hope Windows 7 won&#8217;t be a problem.</p>
<h2>Getting things done</h2>
<p>A short recap &#8211; instead of buying a new notebook for 2000$ and being quite happy I will spend something like 350$ to make my current model as good as the new one would be, and still be happy within my 13.3&#8221; Asus. All I got to to is buy mentioned caddy on ebay.com (they are unavailable in Poland for reasonable prices), grab a nice SSD and 8GBs of RAM and put all that into my current laptop.</p>
<p>Stay tuned, I&#8217;ll keep you posted with the results!</p>
<p>PS. If anyone wants to buy such a caddy too &#8211; let me know, we can combine the purchase.</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/06/21/make-your-old-laptop-new-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASU &#8211; Administracja systemami unixowymi &#8211; projekt 2.7</title>
		<link>http://profetes.pl/2011/05/30/asu-administracja-systemami-unixowymi-projekt-2-7/</link>
		<comments>http://profetes.pl/2011/05/30/asu-administracja-systemami-unixowymi-projekt-2-7/#comments</comments>
		<pubDate>Mon, 30 May 2011 11:09:55 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[ja już zaliczyłem - czas na Ciebie]]></category>
		<category><![CDATA[uczelnia]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[elka]]></category>
		<category><![CDATA[pw]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=311</guid>
		<description><![CDATA[Kolejny semestr studiowania, kolejne projekty. Znów okazja, by podzielić się dobrami studenckimi w myśl &#8220;ja już zaliczyłem, czas na Ciebie&#8220;. Tym razem ASU i projekt nr 2, dwuczęściowy. Pierwsza obejmowała Perla + Tk przy zarządzaniu użytkownikami i grupami. Podobno 12h roboty, jak nic. Nie zrobiłem Druga część projektu była zróżnicowana, mi dostało się zadanie z [...]]]></description>
			<content:encoded><![CDATA[<p><code class="bash"> </code></p>
<p><img class="aligncenter size-full wp-image-73" title="pl" src="http://profetes.pl/wp-content/uploads/2009/09/pl2.png" alt="" width="500" height="40" /><img class="aligncenter size-full wp-image-88" title="bar_elka" src="http://profetes.pl/wp-content/uploads/2009/09/elka.png" alt="" width="500" height="40" /></p>
<p>Kolejny semestr studiowania, kolejne projekty. Znów okazja, by podzielić się dobrami studenckimi w myśl &#8220;<a href="http://profetes.pl/category/ja-juz-zaliczylem-czas-na-ciebie/">ja już zaliczyłem, czas na Ciebie</a>&#8220;. Tym razem ASU i projekt nr 2, dwuczęściowy. Pierwsza obejmowała Perla + Tk przy zarządzaniu użytkownikami i grupami. Podobno 12h roboty, jak nic. Nie zrobiłem <img src='http://profetes.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Druga część projektu była zróżnicowana, mi dostało się zadanie z transformowaniem tekstu. Proszę się częstować!</p>
<p><span id="more-311"></span></p>
<h2>Treść zadania</h2>
<p><span style="font-family: monospace;">Projekt 7</span></p>
<p><code class="bash">Konwerter plików tekstowych na HTML. Plik wejściowy przestrzego następujących konwencji:</code></p>
<ul>
<li><span style="font-family: monospace;">paragrafy oddzielone pustą linią,</span></li>
<li><span style="font-family: monospace;">obrazy są umieszczone w katalogu images, odwołania do nich pojawiają się w pliku tekstowym w nawiasach kwadratowych</span></li>
<li><span style="font-family: monospace;">tekst otoczony podkreśleniami (ze spacjami, czyli &#8221; _&#8221; i &#8220;_ &#8220;) powinien być wyświetlany czcionką pochyłą,</span></li>
<li><span style="font-family: monospace;">tekst otoczony gwiazdkami (ze spacjami, czyli &#8221; *&#8221; i &#8220;* &#8220;) powinien być wyświetlany czcionką wytłuszczoną,</span></li>
<li><span style="font-family: monospace;">tekst w nawiasach klamrowych jest łączem lub parą tekst|łącze (pionowa kreska), np.{http://example.com} lub {przykładowe łącze|http://example.com}.</span></li>
</ul>
<h2>Rozwiązanie</h2>
<pre class="brush: bash; ">

#!/bin/bash
# a scripthat transforms text file into html
# detailed rules are in attached pdf

# ASU 11L, Michal Pasieka aka profetes. http://profetes.pl/
# Some rights reserved, distributed under MIT Licence.

# checking the arguments

# there are 5 tags to be searched,
# &lt;p&gt; =&gt; beginning of the file till the end,
# &lt;/p&gt;&lt;p&gt; =&gt; on \n\n
# &lt;b&gt; on &quot; *&quot; and &lt;/b&gt; on &quot;* &quot;
# {lll} into link with link as a test
# {aaa|bbb} into link with alternated text

usage=&quot;Usage: $0 -f outfile|- [&lt;infile ]&quot;
outfile=&quot;&quot;

if [ $# -ne 2 ]; then
echo &quot;$usage&quot;
exit 1
fi

if [ $# -eq 2 ]; then
while getopts &quot;:f:h&quot; optname
do
case &quot;$optname&quot; in
&quot;h&quot;)
echo &quot;$usage&quot;
;;
&quot;f&quot;)
if [[ &quot;$optname&quot; == &quot;&quot; ]]; then
echo &quot;no output filename provided! Exit!&quot;
exit 2
fi
outfile=$OPTARG
;;
*)
echo &quot;Unknown error while processing options&quot;
echo &quot;$usage&quot;
;;
esac
done
fi

out=tmp

function subst {
echo $( cat $out | sed s/&quot;$1&quot;/&quot;$2&quot;/g ) &gt; tmp2
mv tmp2 $out
}

# main loop for input
echo &#039;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;&#039; &gt; $out
#IFS=$&#039;\n&#039;
while read line  # For as many lines as the input file has...
do
if [ &quot;$line&quot; == &quot;&quot; ]; then
echo &quot;&lt;/p&gt;\n&lt;p&gt;&quot; &gt;&gt; $out
else
echo &quot;$line&quot; &gt;&gt; $out
fi
done

echo &quot;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&quot; &gt;&gt; $out

subst &quot; _&quot; &quot; &lt;i&gt;&quot;
subst &quot;_ &quot; &quot;&lt; \/i&gt; &quot;
subst &quot; \*&quot; &quot; &lt;b&gt;&quot;
subst &quot;\* &quot; &quot;&lt; \/b&gt; &quot;
subst &quot; \[&quot; &quot;&lt;img src=\&quot;images\/&quot;
subst &quot;\] &quot; &quot;\&quot; \/&gt; &quot;

# convert {.*|.*} into a link:
echo $( grep {.*} $out | sed -e &#039;s/{\([^|}]*\)|\([^}]*\)}/&lt;a href=\&quot;\2\&quot;&gt;\1&lt; \/a&gt;/g&#039; ) &gt; tmp2
mv tmp2 $out

#convert {.*} into a link:
echo $( grep {.*} $out | sed -e &#039;s/{\([^}]*\)}/&lt;/a&gt;&lt;a href=\&quot;\1\&quot;&gt;\1&lt; \/a&gt;/g&#039; ) &gt; tmp2
mv tmp2 $out

if [[ &quot;$outfile&quot; == &quot;-&quot; ]]; then
cat $out
rm $out
else
mv $out $outfile
fi

#eof!
</pre>
<h3>Download</h3>
<p>Paczuszkę z kodem, testami i przykładowym plikiem tekstowym można pobrać o </a><a href="http://download.profetes.pl/asu-p2.tar" target="_blank">tu</a></b></i></infile></p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/05/30/asu-administracja-systemami-unixowymi-projekt-2-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Still a student, still learnig, again late at night</title>
		<link>http://profetes.pl/2011/05/23/still-a-student-still-learnig-again-late-at-night/</link>
		<comments>http://profetes.pl/2011/05/23/still-a-student-still-learnig-again-late-at-night/#comments</comments>
		<pubDate>Mon, 23 May 2011 01:21:05 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[ja już zaliczyłem - czas na Ciebie]]></category>
		<category><![CDATA[uczelnia]]></category>
		<category><![CDATA[elka]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=302</guid>
		<description><![CDATA[Since I&#8217;ve remebered I&#8217;d been avoiding sed. I&#8217;ve had preferred more intense  manual work to writing those magical phrases. But not any more! Since I&#8217;m still a student I&#8217;ve been given a project to write some converter, text 2 html. I have to cover b, i, img, p and a tags. Insanely amazing and ambitious [...]]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;ve remebered I&#8217;d been avoiding <a title="sed" href="http://ss64.com/bash/sed.html" target="_blank">sed</a>. I&#8217;ve had preferred more intense  manual work to writing those magical phrases. But not any more! Since I&#8217;m still a student I&#8217;ve been given a project to write some converter, text 2 html. I have to cover b, i, img, p and a tags. Insanely amazing and ambitious task&#8230;</p>
<p>Among the other problems, I had an issue, to convert</p>
<blockquote>
<pre>{www.google.com} into &lt;a href="www.google.com"&gt;www.google.com&lt;/a&gt;</pre>
</blockquote>
<pre>and</pre>
<blockquote>
<pre>{google!|www.google.com} into &lt;a href="www.google.com"&gt;google!&lt;/a&gt;</pre>
</blockquote>
<div id="attachment_303" class="wp-caption alignleft" style="width: 310px"><a href="http://profetes.pl/wp-content/uploads/2011/05/sed-fun.png"><img class="size-medium wp-image-303 " title="A part of my script" src="http://profetes.pl/wp-content/uploads/2011/05/sed-fun-300x241.png" alt="" width="300" height="241" /></a><p class="wp-caption-text">Final solution with sed</p></div>
<p>with linux tools only. I&#8217;ve tried ordinal Bash, grep, awk, but a problem occurred when there were links in both styles in one line.</p>
<p>Eventually I started doing that with sed. It took me some time to learn some fancy switches and syntax, but after some time &#8211; I did it! I can absolutely recommend Tim Robbins&#8217; tutorial about sed: <a href="http://docs.funtoo.org/wiki/Sed_by_Example,_Part_3">http://docs.funtoo.org/wiki/Sed_by_Example,_Part_3</a>, parts 1,2 and 3.</p>
<p>It&#8217;s late at night, there&#8217;s a mug with 2 sips of coffee left in front of me, music in my headphones and dim light in the room. Work for today is done. In the moments as this one &#8211; I feel so&#8230; student? It definitely means to feel alive!</p>
<p>Hey, I gotta go to work in a few hours! I&#8217;ll just tweet that post and I get lost <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/05/23/still-a-student-still-learnig-again-late-at-night/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Takich wykładowców jak najwięcej!</title>
		<link>http://profetes.pl/2011/04/17/takich-wykladowcow-jak-najwiecej/</link>
		<comments>http://profetes.pl/2011/04/17/takich-wykladowcow-jak-najwiecej/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 21:04:00 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[fun!]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[uczelnia]]></category>
		<category><![CDATA[elka]]></category>
		<category><![CDATA[[pl]]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=295</guid>
		<description><![CDATA[Wciąż mam na liście kontaktów na GG mojego wykładowcę z Algebry Liniowej &#8211; dra Junoszę-Szaniawskiego. Oto jaki dziś ma opis: Co zrobić ze studentami, którzy sciągali na kolokwium? Tym którzy sie przyznają &#8211; 0 pkt, tym co nie &#8211; minus to, co uzbierali. Kto chce sie przyznać? Szaleństwo Jeśli ktoś ma chwilkę czasu &#8211; pozwolę [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-73" title="pl" src="http://profetes.pl/wp-content/uploads/2009/09/pl2.png" alt="" width="500" height="40" /><img class="alignnone size-full wp-image-88" title="bar_elka" src="http://profetes.pl/wp-content/uploads/2009/09/elka.png" alt="" width="500" height="40" /></p>
<p>Wciąż mam na liście kontaktów na GG mojego wykładowcę z Algebry Liniowej &#8211; dra Junoszę-Szaniawskiego. Oto jaki dziś ma opis:</p>
<blockquote><p>Co zrobić ze studentami, którzy sciągali na kolokwium? Tym którzy sie przyznają &#8211; 0 pkt, tym co nie &#8211; minus to, co uzbierali. Kto chce sie przyznać?</p></blockquote>
<p>Szaleństwo <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Jeśli ktoś ma chwilkę czasu &#8211; pozwolę sobie zaprosić na stronę tegoż wykładowcy: <a href="http://www.mini.pw.edu.pl/~szaniaws/www/">http://www.mini.pw.edu.pl/~szaniaws/www/</a>. Polecane działy to humor (&#8220;na kolokwium&#8221; wymiata!) oraz zagadki świąteczne, o ile ktoś ma chwilkę czasu.</p>
<p>Twitnąłbym info o tym, ale był problem z bit.ly&#8217;m, nie chciał mi skrócić linka (<a href="http://www.mini.pw.edu.pl/~szaniaws/www/?Humor:%A6wi%B1teczne_%A3amig%B3%F3wki">http://www.mini.pw.edu.pl/~szaniaws/www/?Humor:%A6wi%B1teczne_%A3amig%B3%F3wki</a>). Poza tym opis dra ma ponad 160 znaków&#8230; Stąd potrzeba napisania aż posta na ten temat. A twitnę sobie link do artykułu <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/04/17/takich-wykladowcow-jak-najwiecej/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl and CGI demo application</title>
		<link>http://profetes.pl/2011/04/17/perl-and-cgi-demo-application/</link>
		<comments>http://profetes.pl/2011/04/17/perl-and-cgi-demo-application/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 12:14:08 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[ja już zaliczyłem - czas na Ciebie]]></category>
		<category><![CDATA[uczelnia]]></category>
		<category><![CDATA[elka]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=291</guid>
		<description><![CDATA[During this semester I&#8217;m attending ASU lectures (Administration of Unix Systems). One of my project tasks (excercise 12) was to write a CGI script in Perl that handles todo tasks. There&#8217;s description in Polish: ASU &#8211; Zadanie 12 Proszę napisać skrypt CGI organizujący listę zadań do zrobienia dla grupy roboczej jak w poprzednim zadaniu. Zadanie na [...]]]></description>
			<content:encoded><![CDATA[<p>During this semester I&#8217;m attending ASU lectures (Administration of Unix Systems). One of my project tasks (excercise 12) was to write a CGI script in Perl that handles todo tasks. There&#8217;s description in Polish:</p>
<blockquote>
<h2><span style="font-size: 13px; font-weight: normal;">ASU &#8211; Zadanie 12<br />
Proszę napisać skrypt CGI organizujący listę zadań do zrobienia dla grupy roboczej jak w poprzednim zadaniu. Zadanie na liście składa się z opisu i daty wykonania. Skrypt powinien każdemu z pracowników wyświetlać listę zadań jeszcze nie wykonanych, wyróżniając zadania o przekroczonym terminie realizacji. Na życzenie powinna istnieć możliwość wyświetlenia całej listy zadań dla danego pracownika &#8211; zarówno wykonanych, jak i oczekujących na realizację. Pracownik powinien mieć możliwość oznaczania zadań jako wykonane (powinna również zostać zapamiętana faktyczna data realizacji zadania) oraz dopisywania sobie nowych zadań do wykonania. Szef pownien móc również dopisywać zadania do wykonania innym pracownikom oraz przenosić zadania między pracownikami.</span></h2>
</blockquote>
<p><span style="font-size: 13px; font-weight: normal;"><span id="more-291"></span></span></p>
<p><span style="font-size: 13px; font-weight: normal;">It means the script has to allow add tasks for a certain group of users. Users are stored in a users.db file. There are leaders that can access users&#8217; tasks, modify them, reassign, add new ones. The whole package is available in <a href="http://download.profetes.pl/asu_p12_mpasieka.zip">here</a>.</span></p>
<p><span style="font-size: 13px; font-weight: normal;">Big thanks for Marian, a friend of mine, who helped me with this script!</span></p>
<p>And here&#8217;s the code of this application. There are some things to do, ie. locking dabase file on read. But the project got approved, I got max points for it and I&#8217;m just happy <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<pre style="color: #000000; background: #f1f0f0;"><span style="color: #c34e00;">#!/usr/bin/perl</span>
<span style="color: #c34e00;">#cgihello.cgi</span>

<span style="color: #c34e00;"># CGI script prepared by Michal Pasieka aka profetes</span>
<span style="color: #c34e00;"># some rights reserved. U can contact me at </span><span style="color: #7144c4;">ja@profetes.pl</span>
<span style="color: #c34e00;"># Warsaw Univesity of Technology, semetester: 11L</span>

<span style="color: #c34e00;"># for more info - see info.txt, Polish only</span>
<span style="color: #c34e00;"># script is really minimalistic one, if you want to - you can extend it an make it more secure.</span>

<span style="color: #400000; font-weight: bold;">use</span> <span style="color: #400000; font-weight: bold;">strict</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">use</span> warnings<span style="color: #806030;">;</span>

<span style="color: #400000; font-weight: bold;">use</span> CGI <span style="color: #400000; font-weight: bold;">qw</span><span style="color: #800000;">(</span><span style="color: #e60000;">:standard</span><span style="color: #800000;">)</span><span style="color: #806030;">;</span>    <span style="color: #c34e00;">#Importuj procedury HTML</span>
<span style="color: #400000; font-weight: bold;">use</span> <span style="color: #bb7977; font-weight: bold;">CGI::Carp</span> <span style="color: #400000; font-weight: bold;">qw</span><span style="color: #800000;">(</span><span style="color: #e60000;">fatalsToBrowser</span><span style="color: #800000;">)</span><span style="color: #806030;">;</span> <span style="color: #c34e00;">#Przesylaj bledy przegladarce</span>
<span style="color: #400000; font-weight: bold;">use</span> <span style="color: #bb7977; font-weight: bold;">Fcntl</span> <span style="color: #400000; font-weight: bold;">qw</span><span style="color: #800000;">(</span><span style="color: #e60000;">:flock :seek</span><span style="color: #800000;">)</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">use</span> <span style="color: #bb7977; font-weight: bold;">Digest::MD5</span> <span style="color: #400000; font-weight: bold;">qw</span><span style="color: #800000;">(</span><span style="color: #e60000;">md5_hex</span><span style="color: #800000;">)</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">use</span> <span style="color: #bb7977; font-weight: bold;">POSIX</span> <span style="color: #400000; font-weight: bold;">qw</span><span style="color: #800000;">(</span><span style="color: #e60000;">strftime</span><span style="color: #800000;">)</span><span style="color: #806030;">;</span>

<span style="color: #400000; font-weight: bold;">my</span> $cgi <span style="color: #806030;">=</span> new CGI<span style="color: #806030;">;</span>

<span style="color: #c34e00;"># some variables</span>
<span style="color: #400000; font-weight: bold;">my</span> $this <span style="color: #806030;">=</span> <span style="color: #e60000;">"http://</span><span style="color: #e60000;">$ENV</span><span style="color: #e60000;">{SERVER_NAME}</span><span style="color: #e60000;">$ENV</span><span style="color: #e60000;">{SCRIPT_NAME}"</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $userdb <span style="color: #806030;">=</span> <span style="color: #e60000;">"db/users.db"</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $leaddb <span style="color: #806030;">=</span> <span style="color: #e60000;">"db/leaders.db"</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $taskdb <span style="color: #806030;">=</span> <span style="color: #e60000;">"db/tasks.db"</span><span style="color: #806030;">;</span> <span style="color: #c34e00;">#a blank file must contain \n </span><span style="color: #ffffff; background: #808000;">char!!!</span>

<span style="color: #c34e00;"># for salting the session. to be more secure - use ENV{REMOTE_ADDR}</span>
<span style="color: #400000; font-weight: bold;">my</span> $secret_md5_phrase <span style="color: #806030;">=</span> <span style="color: #e60000;">'so-called-salt'</span><span style="color: #806030;">;</span>

<span style="color: #c34e00;">#gather params</span>
<span style="color: #400000; font-weight: bold;">my</span> $params <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>Vars<span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $action <span style="color: #806030;">=</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'a'</span><span style="color: #806030;">}</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $option <span style="color: #806030;">=</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'o'</span><span style="color: #806030;">}</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">my</span> $message <span style="color: #806030;">=</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'m'</span><span style="color: #806030;">}</span><span style="color: #806030;">;</span>

<span style="color: #c34e00;">#===== helpers</span>

<span style="color: #c34e00;"># currently logged user</span>
<span style="color: #400000; font-weight: bold;">sub </span>get_user <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> @cookie_data <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>cookie<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"username"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    $cookie_data<span style="color: #806030;">[</span><span style="color: #8c0000;">0</span><span style="color: #806030;">]</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #c34e00;"># return available users on the system</span>
<span style="color: #400000; font-weight: bold;">sub </span>get_users <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> @data<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $userdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$userdb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">my</span> <span style="color: #806030;">(</span>$u<span style="color: #806030;">,</span> $p<span style="color: #806030;">)</span> <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">unshift</span> @data<span style="color: #806030;">,</span> $u<span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>

    <span style="color: #806030;">\</span>@data
<span style="color: #806030;">}</span>

<span style="color: #c34e00;">#someone needs to be in leaders.db file</span>
<span style="color: #400000; font-weight: bold;">sub </span>is_root <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> @cookie_data <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>cookie<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"username"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">my</span> %data<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $leaddb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$leaddb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">my</span> <span style="color: #806030;">(</span>$u<span style="color: #806030;">,</span> $p<span style="color: #806030;">)</span> <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        $data<span style="color: #806030;">{</span>$u<span style="color: #806030;">}</span> <span style="color: #806030;">=</span> $p<span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>

    <span style="color: #400000; font-weight: bold;">if</span><span style="color: #806030;">(</span><span style="color: #400000; font-weight: bold;">exists</span> $data<span style="color: #806030;">{</span>$cookie_data<span style="color: #806030;">[</span><span style="color: #8c0000;">0</span><span style="color: #806030;">]</span><span style="color: #806030;">}</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #8c0000;">1</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
        <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>get_today <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $x <span style="color: #806030;">=</span> strftime <span style="color: #e60000;">"%Y%m</span><span style="color: #007997;">%d</span><span style="color: #e60000;">"</span><span style="color: #806030;">,</span> <span style="color: #400000; font-weight: bold;">localtime</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>
<span style="color: #c34e00;">#====== HTML</span>

<span style="color: #400000; font-weight: bold;">sub </span>logged_menu<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;h2&gt;Menu&lt;/h2&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;ul&gt;&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;home&lt;/a&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=show</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;existing tasks&lt;/a&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=new</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;add new task&lt;/a&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=logout</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;logout&lt;/a&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;/ul&gt;"</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>unlogged_menu<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;h2&gt;Menu&lt;/h2&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;ul&gt;&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;home&lt;/a&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=login</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;login&lt;/a&gt;&lt;/ul&gt;"</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>form_login<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h1<span style="color: #806030;">(</span><span style="color: #e60000;">":Not to to: - please login"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>start_form<span style="color: #806030;">(</span><span style="color: #806030;">-</span>action<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">"?a=authorize"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"login: "</span><span style="color: #806030;">,</span>textfield<span style="color: #806030;">(</span><span style="color: #e60000;">'login'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"passw: "</span><span style="color: #806030;">,</span>textfield<span style="color: #806030;">(</span><span style="color: #e60000;">'passwd'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>submit<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>end_form<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>form_new_task<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>start_form<span style="color: #806030;">(</span><span style="color: #806030;">-</span>action<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">"?a=tasks&amp;o=create"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"what needs to be done: "</span><span style="color: #806030;">,</span>textfield<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">'what'</span><span style="color: #806030;">,</span> <span style="color: #806030;">-</span>size<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #8c0000;">50</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"due date [YYYYMMDD]: "</span><span style="color: #806030;">,</span>textfield<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">'duedate'</span><span style="color: #806030;">,</span> <span style="color: #806030;">-</span>size<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #8c0000;">8</span><span style="color: #806030;">,</span> <span style="color: #806030;">-</span>default<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span>get_today<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>is_root<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"assign task to: "</span><span style="color: #806030;">,</span>scrolling_list<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">'assignee'</span><span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span><span style="color: #400000; font-weight: bold;">values</span><span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #806030;">&amp;</span>get_users<span style="color: #806030;">(</span><span style="color: #806030;">)</span><span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span>default<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> get_user<span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span>multiple<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">'false'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>

    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>submit<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>end_form<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>form_move_task<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>start_form<span style="color: #806030;">(</span><span style="color: #806030;">-</span>action<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">"?a=tasks&amp;o=movetask"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> hidden<span style="color: #806030;">(</span><span style="color: #e60000;">'ndx'</span><span style="color: #806030;">,</span>$params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'i'</span><span style="color: #806030;">}</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"assign task to: "</span><span style="color: #806030;">,</span>scrolling_list<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">'assignee'</span><span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span><span style="color: #400000; font-weight: bold;">values</span><span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #806030;">&amp;</span>get_users<span style="color: #806030;">(</span><span style="color: #806030;">)</span><span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span>default<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> get_user<span style="color: #806030;">,</span>
                <span style="color: #806030;">-</span>multiple<span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span><span style="color: #e60000;">'false'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>submit<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>end_form<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>handle_message <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $msg <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$msg <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #e60000;">'001'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"error: no such user!"</span><span style="color: #806030;">;</span> <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">elsif</span> <span style="color: #806030;">(</span>$msg <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #e60000;">'002'</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"error: bad passwd!"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">elsif</span> <span style="color: #806030;">(</span>$msg <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #e60000;">'003'</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"new task created"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">elsif</span> <span style="color: #806030;">(</span>$msg <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #e60000;">'004'</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"the task has been moved"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span>
    <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"unknown error code!"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>create_new_task <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $what <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $duedate <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $another_user <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span> <span style="color: #c34e00;">#root may assign sby else</span>

    <span style="color: #400000; font-weight: bold;">my</span> $u <span style="color: #806030;">=</span> <span style="color: #e60000;">''</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$another_user <span style="color: #806030;">eq</span> <span style="color: #e60000;">''</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        $u <span style="color: #806030;">=</span> get_user<span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
        $u <span style="color: #806030;">=</span> $another_user<span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">my</span> $today <span style="color: #806030;">=</span> strftime <span style="color: #e60000;">"%Y%m</span><span style="color: #007997;">%d</span><span style="color: #e60000;">"</span><span style="color: #806030;">,</span> <span style="color: #400000; font-weight: bold;">localtime</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span><span style="color: #e60000;">"&gt;&gt;</span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">"</span><span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span><span style="color: #806030;">(</span><span style="color: #e60000;">"Cannot Open File"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">flock</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> LOCK_EX<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">seek</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">,</span> SEEK_END<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> DAT <span style="color: #e60000;">"</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">$u</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">0</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$what</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$today</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$duedate</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">close</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>mark_the_task_done <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $ndx <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $today <span style="color: #806030;">=</span> get_today<span style="color: #806030;">;</span>

    <span style="color: #c34e00;">#read #ndx line and save this record</span>
    <span style="color: #400000; font-weight: bold;">my</span> @task<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $taskdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $i <span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$i <span style="color: #806030;">=</span><span style="color: #806030;">=</span> $ndx<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            @task <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        <span style="color: #806030;">}</span>
        $i<span style="color: #806030;">+</span><span style="color: #806030;">=</span><span style="color: #8c0000;">1</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #c34e00;">#delete old data and write remaining data</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> $taskdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span><span style="color: #806030;">(</span><span style="color: #e60000;">"Cannot Open File"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> @raw_data<span style="color: #806030;">=</span><span style="color: #40015a;">&lt;DAT&gt;</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">close</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">splice</span><span style="color: #806030;">(</span>@raw_data<span style="color: #806030;">,</span>$ndx<span style="color: #806030;">,</span><span style="color: #8c0000;">1</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span><span style="color: #e60000;">"&gt;</span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">"</span><span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span><span style="color: #806030;">(</span><span style="color: #e60000;">"Cannot Open File"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">flock</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> LOCK_EX<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">seek</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">,</span> SEEK_END<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> DAT @raw_data<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">seek</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">,</span> SEEK_END<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> DAT <span style="color: #e60000;">"</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">0</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">1</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">2</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">3</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">4</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$today</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">close</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">)</span><span style="color: #806030;">;</span>

<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>move_the_task <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $ndx <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $u <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>

    <span style="color: #c34e00;">#read #ndx line and save this record</span>
    <span style="color: #400000; font-weight: bold;">my</span> @task<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $taskdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $i <span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$i <span style="color: #806030;">=</span><span style="color: #806030;">=</span> $ndx<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            @task <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        <span style="color: #806030;">}</span>
        $i<span style="color: #806030;">+</span><span style="color: #806030;">=</span><span style="color: #8c0000;">1</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #c34e00;">#delete old data and write remaining data</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> $taskdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span><span style="color: #806030;">(</span><span style="color: #e60000;">"Cannot Open File"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> @raw_data<span style="color: #806030;">=</span><span style="color: #40015a;">&lt;DAT&gt;</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">close</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">splice</span><span style="color: #806030;">(</span>@raw_data<span style="color: #806030;">,</span>$ndx<span style="color: #806030;">,</span><span style="color: #8c0000;">1</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span><span style="color: #e60000;">"&gt;</span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">"</span><span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span><span style="color: #806030;">(</span><span style="color: #e60000;">"Cannot Open File"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">flock</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> LOCK_EX<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">seek</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">,</span> SEEK_END<span style="color: #806030;">)</span><span style="color: #806030;">;</span> 

    <span style="color: #400000; font-weight: bold;">print</span> DAT @raw_data<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">seek</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">,</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">,</span> SEEK_END<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $line <span style="color: #806030;">=</span> <span style="color: #e60000;">"</span><span style="color: #e60000;">$u</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">1</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">2</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">3</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">4</span><span style="color: #e60000;">]</span><span style="color: #0f6900;">\t</span><span style="color: #e60000;">$task</span><span style="color: #e60000;">[</span><span style="color: #c00000;">5</span><span style="color: #e60000;">]"</span><span style="color: #806030;">;</span>
    <span style="color: #c34e00;"># chomp $line;</span>
    <span style="color: #400000; font-weight: bold;">print</span> DAT <span style="color: #e60000;">"</span><span style="color: #e60000;">$line</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">close</span><span style="color: #806030;">(</span>DAT<span style="color: #806030;">)</span><span style="color: #806030;">;</span>

<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>authorize <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $user <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $pass <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>

    <span style="color: #c34e00;">#debug login:</span>
    <span style="color: #c34e00;"># print $user;</span>
    <span style="color: #c34e00;"># print $pass;</span>

    <span style="color: #400000; font-weight: bold;">my</span> %data<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $userdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$userdb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">my</span> <span style="color: #806030;">(</span>$u<span style="color: #806030;">,</span> $p<span style="color: #806030;">)</span> <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        $data<span style="color: #806030;">{</span>$u<span style="color: #806030;">}</span> <span style="color: #806030;">=</span> $p<span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>

    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span><span style="color: #806030;">(</span>$pass <span style="color: #806030;">eq</span> <span style="color: #e60000;">""</span><span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #806030;">(</span>$user <span style="color: #806030;">eq</span> <span style="color: #e60000;">""</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"no user nor password can be empty!"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>

    <span style="color: #400000; font-weight: bold;">if</span><span style="color: #806030;">(</span><span style="color: #400000; font-weight: bold;">exists</span> $data<span style="color: #806030;">{</span>$user<span style="color: #806030;">}</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #c34e00;">#sprawdzic hasla</span>
        <span style="color: #400000; font-weight: bold;">my</span> $dbpass <span style="color: #806030;">=</span> $data<span style="color: #806030;">{</span>$user<span style="color: #806030;">}</span><span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">chop</span> $dbpass<span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$dbpass <span style="color: #806030;">eq</span> md5_hex<span style="color: #806030;">(</span>$pass<span style="color: #806030;">)</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            <span style="color: #400000; font-weight: bold;">my</span> $secret_md5_phrase <span style="color: #806030;">=</span> <span style="color: #e60000;">'so-called-salt'</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">my</span> $usr_md5 <span style="color: #806030;">=</span> md5_hex<span style="color: #806030;">(</span>$user<span style="color: #806030;">,</span> $secret_md5_phrase<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
            <span style="color: #c34e00;">#usr_md5 is a salted and hashed login</span>
            <span style="color: #400000; font-weight: bold;">my</span> @cookie_data <span style="color: #806030;">=</span> <span style="color: #806030;">[</span>$user<span style="color: #806030;">,</span> $usr_md5<span style="color: #806030;">]</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">my</span> $cookie <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>cookie<span style="color: #806030;">(</span>    <span style="color: #806030;">-</span>name  <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"username"</span><span style="color: #806030;">,</span>
                            <span style="color: #806030;">-</span>value <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> @cookie_data<span style="color: #806030;">,</span>
                            <span style="color: #806030;">-</span>expires <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"+1d"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
            <span style="color: #c34e00;">#Goto tasks</span>
            <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>header<span style="color: #806030;">(</span><span style="color: #806030;">-</span>cookie <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> $cookie<span style="color: #806030;">)</span><span style="color: #806030;">;</span>

            <span style="color: #c34e00;"># now someone can be assumed as logged</span>
        <span style="color: #806030;">}</span>
        <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
            <span style="color: #c34e00;"># print md5_hex($pass)."|";</span>
            <span style="color: #c34e00;"># print $data{$user}."|";</span>
            <span style="color: #c34e00;"># print $data{$user} eq md5_hex($pass) ? "true" : "false" ;</span>
            <span style="color: #400000; font-weight: bold;">print</span> redirect<span style="color: #806030;">(</span>$this<span style="color: #806030;">.</span><span style="color: #e60000;">"?a=login&amp;m=</span><span style="color: #c00000;">002</span><span style="color: #e60000;">"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span> <span style="color: #c34e00;">#bad passw    </span>
        <span style="color: #806030;">}</span>
        <span style="color: #c34e00;">#ustawic cookies</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span>
    <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">print</span> redirect<span style="color: #806030;">(</span>$this<span style="color: #806030;">.</span><span style="color: #e60000;">"?a=login&amp;m=</span><span style="color: #c00000;">001</span><span style="color: #e60000;">"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span> <span style="color: #c34e00;">#no user</span>
    <span style="color: #806030;">}</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">sub </span>authenticate<span style="color: #806030;">(</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> @cookie_data <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>cookie<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"username"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $x <span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$cookie_data<span style="color: #806030;">[</span><span style="color: #8c0000;">1</span><span style="color: #806030;">]</span> <span style="color: #806030;">eq</span> md5_hex<span style="color: #806030;">(</span>$cookie_data<span style="color: #806030;">[</span><span style="color: #8c0000;">0</span><span style="color: #806030;">]</span><span style="color: #806030;">,</span> $secret_md5_phrase<span style="color: #806030;">)</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        $x <span style="color: #806030;">=</span> <span style="color: #8c0000;">1</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
        $x <span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    $x<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #c34e00;"># wyswietlic, kolorowac, edytowac</span>
<span style="color: #400000; font-weight: bold;">sub </span>print_list_element <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> @row <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;elemt: </span><span style="color: #e60000;">@row</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">2</span><span style="color: #e60000;">]"</span><span style="color: #806030;">;</span>

<span style="color: #806030;">}</span>

<span style="color: #c34e00;"># </span><span style="color: #5555dd;">http://www.suite101.com/article.cfm/perl/94552</span>
<span style="color: #c34e00;"># multidimensional arrays of data</span>
<span style="color: #c34e00;"># task: id; user; done; text; start; due; done</span>
<span style="color: #400000; font-weight: bold;">sub </span>get_user_tasks <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $user <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $cond <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">shift</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">my</span> @tasks<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">open</span><span style="color: #806030;">(</span>DATA<span style="color: #806030;">,</span> $taskdb<span style="color: #806030;">)</span> <span style="color: #806030;">|</span><span style="color: #806030;">|</span> <span style="color: #400000; font-weight: bold;">die</span> <span style="color: #e60000;">"Can't open </span><span style="color: #e60000;">$taskdb</span><span style="color: #e60000;">: $!</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $i <span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">while</span> <span style="color: #806030;">(</span><span style="color: #40015a;">&lt;DATA&gt;</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">my</span> @task <span style="color: #806030;">=</span> <span style="color: #400000; font-weight: bold;">split</span><span style="color: #806030;">(</span><span style="color: #800000;">/</span><span style="color: #0f6900;">\t</span><span style="color: #800000;">/</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">unshift</span> <span style="color: #806030;">(</span>@task<span style="color: #806030;">,</span> $i<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
        $i<span style="color: #806030;">+</span><span style="color: #806030;">=</span><span style="color: #8c0000;">1</span><span style="color: #806030;">;</span>

        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$task<span style="color: #806030;">[</span><span style="color: #8c0000;">1</span><span style="color: #806030;">]</span> <span style="color: #806030;">eq</span> $user <span style="color: #806030;">|</span><span style="color: #806030;">|</span> $cond <span style="color: #806030;">eq</span> <span style="color: #e60000;">'root'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$cond <span style="color: #806030;">eq</span> <span style="color: #e60000;">'undone'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$task<span style="color: #806030;">[</span><span style="color: #8c0000;">2</span><span style="color: #806030;">]</span> <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                    <span style="color: #400000; font-weight: bold;">unshift</span> <span style="color: #806030;">(</span>@tasks<span style="color: #806030;">,</span> <span style="color: #806030;">\</span>@task<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                <span style="color: #806030;">}</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
                <span style="color: #c34e00;"># all!</span>
                <span style="color: #400000; font-weight: bold;">unshift</span> <span style="color: #806030;">(</span>@tasks<span style="color: #806030;">,</span> <span style="color: #806030;">\</span>@task<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
        <span style="color: #806030;">}</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"base no of tasks: "</span><span style="color: #806030;">.</span> <span style="color: #806030;">(</span>$#tasks <span style="color: #806030;">+</span> <span style="color: #8c0000;">1</span><span style="color: #806030;">)</span><span style="color: #806030;">.</span> <span style="color: #e60000;">"&lt;/br&gt;</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;table border=</span><span style="color: #c00000;">1</span><span style="color: #e60000;">&gt;&lt;tr style=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">font-weight:bolder;</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;&lt;td&gt;task&lt;/td&gt;&lt;td&gt;owner&lt;/td&gt;&lt;td&gt;started&lt;/td&gt;&lt;td&gt;due date&lt;/td&gt;&lt;td&gt;finished&lt;/td&gt;&lt;td&gt;operations&lt;/td&gt;&lt;/tr&gt;"</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">my</span> $today <span style="color: #806030;">=</span> strftime <span style="color: #e60000;">"%Y%m</span><span style="color: #007997;">%d</span><span style="color: #e60000;">"</span><span style="color: #806030;">,</span> <span style="color: #400000; font-weight: bold;">localtime</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">foreach</span> <span style="color: #806030;">(</span>@tasks<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$today <span style="color: #806030;">&gt;</span> $_<span style="color: #806030;">-&gt;</span><span style="color: #806030;">[</span><span style="color: #8c0000;">5</span><span style="color: #806030;">]</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;tr BGCOLOR=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">#ffcccc</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;"</span><span style="color: #806030;">;</span>
        <span style="color: #806030;">}</span>
        <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;tr&gt;"</span><span style="color: #806030;">;</span>
        <span style="color: #806030;">}</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;td&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">3</span><span style="color: #e60000;">]&lt;/td&gt;&lt;td&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">1</span><span style="color: #e60000;">]&lt;/td&gt;&lt;td&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">4</span><span style="color: #e60000;">]&lt;/td&gt;&lt;td&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">5</span><span style="color: #e60000;">]&lt;/td&gt;&lt;td&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">-&gt;[</span><span style="color: #c00000;">6</span><span style="color: #e60000;">]&lt;/td&gt;"</span><span style="color: #806030;">;</span>
        <span style="color: #c34e00;"># advanced actions</span>
        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;td&gt;"</span><span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$_<span style="color: #806030;">-&gt;</span><span style="color: #806030;">[</span><span style="color: #8c0000;">2</span><span style="color: #806030;">]</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
            <span style="color: #c34e00;"># done already</span>
        <span style="color: #806030;">}</span>
        <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
            <span style="color: #400000; font-weight: bold;">my</span> $tmp <span style="color: #806030;">=</span> $_<span style="color: #806030;">-&gt;</span><span style="color: #806030;">[</span><span style="color: #8c0000;">0</span><span style="color: #806030;">]</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=done&amp;i=</span><span style="color: #e60000;">$tmp</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;[mark done]&lt;/a&gt; "</span><span style="color: #806030;">;</span>
            <span style="color: #c34e00;"># if root - moving the task</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>is_root<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=move&amp;i=</span><span style="color: #e60000;">$tmp</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;[move the task]&lt;/a&gt;"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
        <span style="color: #806030;">}</span>

        <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;/td&gt;&lt;/tr&gt;"</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;/table&gt;"</span><span style="color: #806030;">;</span>
    @tasks<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #c34e00;">#==============================================================================</span>
<span style="color: #c34e00;">#========== the very begin ====================================================</span>

<span style="color: #c34e00;"># print $params-&gt;{'login'};</span>
<span style="color: #c34e00;"># print $params-&gt;{'passwd'};</span>
<span style="color: #c34e00;"># print $cgi-&gt;url_param('a');</span>

<span style="color: #c34e00;">#logging in, the rest of the actions is below</span>

<span style="color: #c34e00;"># POST requests</span>
<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>url_param<span style="color: #806030;">(</span><span style="color: #e60000;">'a'</span><span style="color: #806030;">)</span> <span style="color: #806030;">eq</span> <span style="color: #e60000;">'authorize'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    authorize<span style="color: #806030;">(</span>$params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'login'</span><span style="color: #806030;">}</span><span style="color: #806030;">,</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'passwd'</span><span style="color: #806030;">}</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #c34e00;"># print $cgi-&gt;redirect($this."?a=tasks"); #tasks</span>
    $cgi<span style="color: #806030;">-&gt;</span>start_html<span style="color: #806030;">(</span><span style="color: #e60000;">"not to do"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    logged_menu<span style="color: #806030;">;</span>
    $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"logged in"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">exit</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span><span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>url_param<span style="color: #806030;">(</span><span style="color: #e60000;">'a'</span><span style="color: #806030;">)</span> <span style="color: #806030;">eq</span> <span style="color: #e60000;">'tasks'</span><span style="color: #806030;">)</span> <span style="color: #806030;">&amp;</span><span style="color: #806030;">&amp;</span> <span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>url_param<span style="color: #806030;">(</span><span style="color: #e60000;">'o'</span><span style="color: #806030;">)</span> <span style="color: #806030;">eq</span> <span style="color: #e60000;">'create'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>

    create_new_task<span style="color: #806030;">(</span>$params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'what'</span><span style="color: #806030;">}</span><span style="color: #806030;">,</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'duedate'</span><span style="color: #806030;">}</span><span style="color: #806030;">,</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'assignee'</span><span style="color: #806030;">}</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">print</span> redirect <span style="color: #e60000;">"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?m=</span><span style="color: #c00000;">003</span><span style="color: #e60000;">&amp;a=tasks&amp;o=show"</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span><span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>url_param<span style="color: #806030;">(</span><span style="color: #e60000;">'a'</span><span style="color: #806030;">)</span> <span style="color: #806030;">eq</span> <span style="color: #e60000;">'tasks'</span><span style="color: #806030;">)</span> <span style="color: #806030;">&amp;</span><span style="color: #806030;">&amp;</span> <span style="color: #806030;">(</span>$cgi<span style="color: #806030;">-&gt;</span>url_param<span style="color: #806030;">(</span><span style="color: #e60000;">'o'</span><span style="color: #806030;">)</span> <span style="color: #806030;">eq</span> <span style="color: #e60000;">'movetask'</span><span style="color: #806030;">)</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>

    move_the_task<span style="color: #806030;">(</span>$params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'ndx'</span><span style="color: #806030;">}</span><span style="color: #806030;">,</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'assignee'</span><span style="color: #806030;">}</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

    <span style="color: #400000; font-weight: bold;">print</span> redirect <span style="color: #e60000;">"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?m=</span><span style="color: #c00000;">004</span><span style="color: #e60000;">&amp;a=tasks&amp;o=show"</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>
<span style="color: #c34e00;"># header setting requests</span>
<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$action <span style="color: #806030;">eq</span> <span style="color: #e60000;">'logout'</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">my</span> $cookie <span style="color: #806030;">=</span> $cgi<span style="color: #806030;">-&gt;</span>cookie<span style="color: #806030;">(</span><span style="color: #806030;">-</span>name  <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"username"</span><span style="color: #806030;">,</span>
                            <span style="color: #806030;">-</span>value <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">""</span><span style="color: #806030;">,</span>
                            <span style="color: #806030;">-</span>expires <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> <span style="color: #e60000;">"+3s"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>header<span style="color: #806030;">(</span><span style="color: #806030;">-</span>cookie <span style="color: #806030;">=</span><span style="color: #806030;">&gt;</span> $cookie<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #c34e00;"># GET requests</span>

<span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>header<span style="color: #806030;">(</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>start_html<span style="color: #806030;">(</span><span style="color: #e60000;">"Not to do"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h1<span style="color: #806030;">(</span><span style="color: #e60000;">":Not to do: by profetes"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h2<span style="color: #806030;">(</span><span style="color: #e60000;">"Dont do CGI at home!"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$message<span style="color: #806030;">)</span><span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;p font-color=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">#f00</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;Message:&lt;/br&gt;"</span><span style="color: #806030;">;</span>
    handle_message<span style="color: #806030;">(</span>$message<span style="color: #806030;">)</span><span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>

<span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$action <span style="color: #806030;">eq</span> <span style="color: #e60000;">'login'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    form_login<span style="color: #806030;">;</span>
<span style="color: #806030;">}</span>
<span style="color: #400000; font-weight: bold;">elsif</span> <span style="color: #806030;">(</span>$action <span style="color: #806030;">eq</span> <span style="color: #e60000;">'logout'</span><span style="color: #806030;">)</span><span style="color: #806030;">{</span>
    unlogged_menu<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"logged out."</span>
<span style="color: #806030;">}</span>
<span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
    <span style="color: #c34e00;"># the rest of requests</span>
    <span style="color: #400000; font-weight: bold;">my</span> $logged <span style="color: #806030;">=</span> authenticate<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $root <span style="color: #806030;">=</span> is_root<span style="color: #806030;">;</span>
    <span style="color: #400000; font-weight: bold;">my</span> $user <span style="color: #806030;">=</span> get_user<span style="color: #806030;">;</span>

    <span style="color: #c34e00;"># print $logged;</span>
    <span style="color: #c34e00;"># print $root;</span>
    <span style="color: #c34e00;"># print $user;</span>

    <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$logged <span style="color: #806030;">=</span><span style="color: #806030;">=</span> <span style="color: #8c0000;">0</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
        unlogged_menu<span style="color: #806030;">;</span>
        <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>p<span style="color: #806030;">(</span><span style="color: #e60000;">"to explore further options you must login!"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
    <span style="color: #806030;">}</span>
    <span style="color: #400000; font-weight: bold;">else</span> <span style="color: #806030;">{</span>
        <span style="color: #c34e00;">#logged.</span>
        logged_menu<span style="color: #806030;">;</span>

        <span style="color: #c34e00;">#analyze the acrions and call subs</span>
        <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$action <span style="color: #806030;">eq</span> <span style="color: #e60000;">'tasks'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
            <span style="color: #c34e00;">#task menu:</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"Task view: &lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=show</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;to be done&lt;/a&gt; | "</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=showall</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;show all mine&lt;/a&gt; | "</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=new</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;create new&lt;/a&gt; | "</span><span style="color: #806030;">;</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$root<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?a=tasks&amp;o=other</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;show all users&lt;/a&gt;"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #806030;">;</span>
            <span style="color: #c34e00;"># print add-new, there root check</span>
            <span style="color: #c34e00;"># if root - show for the other user</span>

            <span style="color: #c34e00;"># print $cgi-&gt;h2("Tasks of the user: $user");</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'show'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"undone"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                <span style="color: #400000; font-weight: bold;">my</span> @taskz <span style="color: #806030;">=</span> get_user_tasks $user<span style="color: #806030;">,</span> <span style="color: #e60000;">"undone"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'showall'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"all"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                <span style="color: #400000; font-weight: bold;">my</span> @taskz <span style="color: #806030;">=</span> get_user_tasks $user<span style="color: #806030;">,</span> <span style="color: #e60000;">"all"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'other'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"all the employees"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                <span style="color: #400000; font-weight: bold;">my</span> @taskz <span style="color: #806030;">=</span> get_user_tasks $user<span style="color: #806030;">,</span> <span style="color: #e60000;">"root"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'new'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"new task form"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                form_new_task<span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'move'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"move a task to someone else"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                form_move_task<span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>
            <span style="color: #400000; font-weight: bold;">if</span> <span style="color: #806030;">(</span>$option <span style="color: #806030;">eq</span> <span style="color: #e60000;">'done'</span><span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
                <span style="color: #400000; font-weight: bold;">my</span> $ndx <span style="color: #806030;">=</span> $params<span style="color: #806030;">-&gt;</span><span style="color: #806030;">{</span><span style="color: #e60000;">'i'</span><span style="color: #806030;">}</span><span style="color: #806030;">;</span>
                mark_the_task_done $ndx<span style="color: #806030;">;</span>
                <span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>h3<span style="color: #806030;">(</span><span style="color: #e60000;">"marked as done"</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>
                <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"go to &lt;a href=</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">$this</span><span style="color: #e60000;">?m=</span><span style="color: #c00000;">003</span><span style="color: #e60000;">&amp;a=tasks&amp;o=show</span><span style="color: #0f6900;">\"</span><span style="color: #e60000;">&gt;your tasks&lt;/a&gt;"</span><span style="color: #806030;">;</span>
            <span style="color: #806030;">}</span>

        <span style="color: #806030;">}</span> <span style="color: #c34e00;">#tasks</span>
    <span style="color: #806030;">}</span>
<span style="color: #806030;">}</span>

<span style="color: #c34e00;"># print "&lt;h1&gt;test part&lt;/h1&gt;";</span>

<span style="color: #c34e00;">#     print strftime "%Y%m%d", localtime;</span>

<span style="color: #c34e00;"># print $action;</span>
<span style="color: #c34e00;"># print $option;</span>
<span style="color: #c34e00;"># print $message;</span>

<span style="color: #c34e00;"># print $this;</span>

<span style="color: #c34e00;"># logged_menu;</span>

<span style="color: #c34e00;"># unlogged_menu;</span>

<span style="color: #c34e00;"># form_login;</span>
<span style="color: #c34e00;"># form_new_task;</span>

<span style="color: #400000; font-weight: bold;">print</span> $cgi<span style="color: #806030;">-&gt;</span>end_html<span style="color: #806030;">(</span><span style="color: #806030;">)</span><span style="color: #806030;">;</span>

<span style="color: #c34e00;">#========= the very end ===========</span>
<span style="color: #c34e00;">#print "Content-type: text/plain\n\n";</span>
<span style="color: #c34e00;">#print "Hello world\n";</span>
<span style="color: #c34e00;"># print "your IP: $ENV{REMOTE_HOST}\n";</span>
<span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;hr&gt;&lt;ul&gt;"</span><span style="color: #806030;">;</span>
<span style="color: #400000; font-weight: bold;">foreach</span> <span style="color: #806030;">(</span><span style="color: #400000; font-weight: bold;">sort</span> <span style="color: #400000; font-weight: bold;">keys</span> %ENV<span style="color: #806030;">)</span> <span style="color: #806030;">{</span>
    <span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;li&gt;</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">: </span><span style="color: #e60000;">$ENV</span><span style="color: #e60000;">{</span><span style="color: #e60000;">$_</span><span style="color: #e60000;">}</span><span style="color: #0f6900;">\n</span><span style="color: #e60000;">"</span>
<span style="color: #806030;">}</span>
<span style="color: #400000; font-weight: bold;">print</span> <span style="color: #e60000;">"&lt;/ul&gt;"</span><span style="color: #806030;">;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/04/17/perl-and-cgi-demo-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SmartD wciąż żywy</title>
		<link>http://profetes.pl/2011/03/21/smartd-wciaz-zywy/</link>
		<comments>http://profetes.pl/2011/03/21/smartd-wciaz-zywy/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 20:42:40 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[smartd]]></category>
		<category><![CDATA[[pl]]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=285</guid>
		<description><![CDATA[[for English - scroll down]] Opublikowałem świeżutką wersję SmartDictionary, programu wspomagającego agregowanie i naukę słówek. Jest dostępna na dedykowanej stronie projektu &#8211; http://smartd.profetes.pl/ lub pod bezpośrednim linkiem do instalatora. W najnowszej wersji 0.100.32: tryb nauki w przeciwnym kierunku, tzn. z tłumaczeń na słowo podstawowe możliwość ignorowania polskich znaków przy sprawdzaniu poprawności słowa poprawka dla systemów [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-81" title="bar_c#" src="http://profetes.pl/wp-content/uploads/2009/09/c_sharp.png" alt="" width="500" height="40" /></p>
<p>[for English - scroll down]]</p>
<p>Opublikowałem świeżutką wersję SmartDictionary, programu wspomagającego agregowanie i naukę słówek. Jest dostępna na dedykowanej stronie projektu &#8211; <a title="http://smartd.profetes.pl/" href="http://smartd.profetes.pl/" target="_blank">http://smartd.profetes.pl/</a> lub pod bezpośrednim linkiem do <a title="pobierz!" href="http://smartd.profetes.pl/sd100.32.rar" target="_blank">instalatora</a>.</p>
<p>W najnowszej wersji <strong>0.100.32</strong>:<span id="more-285"></span></p>
<ul>
<li>tryb nauki w przeciwnym kierunku, tzn. z tłumaczeń na słowo podstawowe</li>
</ul>
<ul>
<li>możliwość ignorowania polskich znaków przy sprawdzaniu poprawności słowa</li>
<li>poprawka dla systemów Vista/7 dot. uprawnień do plików</li>
</ul>
<p>Historia wszystkich zmian dostępna w <a title="changelog" href="http://smartd.profetes.pl/changelog.htm" target="_blank">changelogu</a>.</p>
<p>W najbliższym czasie przewidziano reaktywację projektu.</p>
<h2>English</h2>
<p>In my free time I&#8217;ve been developing a dictionary-like application with possibility of learning the words that have been gathered.  The website is available <a title="smartd.profetes.pl" href="smartd.profetes.pl" target="_blank">here</a>, and <a title="translation" href="http://translate.google.com/translate?js=n&amp;prev=_t&amp;hl=pl&amp;ie=UTF-8&amp;layout=2&amp;eotf=1&amp;sl=pl&amp;tl=en&amp;u=http%3A%2F%2Fsmartd.profetes.pl%2F&amp;act=url" target="_blank">HERE</a> I believe is a translation. Unfortunately there&#8217;s no English language available for this app.</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2011/03/21/smartd-wciaz-zywy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About.me &#8211; contemporary business card</title>
		<link>http://profetes.pl/2010/12/16/about-me-contemporary-business-card/</link>
		<comments>http://profetes.pl/2010/12/16/about-me-contemporary-business-card/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 14:13:20 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[fun!]]></category>
		<category><![CDATA[bzdety]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=275</guid>
		<description><![CDATA[Dear All, I&#8217;ve just been created a profile on http://about.me/! I find it just amazing, because under such a nice domain name there&#8217;s some place for me. About.me project is currently in beta version, but for now it allows you to link your existing pages and profiles (blog, twitted, fb and so on). More, you [...]]]></description>
			<content:encoded><![CDATA[<p>Dear All,</p>
<p>I&#8217;ve just been created a profile on <a href="http://about.me/" target="_blank">http://about.me/</a>! I find it just amazing, because under such a nice domain name there&#8217;s some place for me.</p>
<p>About.me project is currently in beta version, but for now it allows you to link your existing pages and profiles (blog, twitted, fb and so on). More, you have very limited space to write some sentences about you. In the background there&#8217;s a BIG wallpaper chosen by you. Under the hood there works click tracking system to log your page&#8217;s displays and clicks. Awesome.</p>
<p>Thank to such a functionality it can be called a contemporary, modern version of business card. Instead of placing many links in you signature under the mail you can just drop this one link.</p>
<p>You can visit my profile at <a href="http://about.me/profetes/" target="_blank">http://about.me/profetes/</a>. I think you should also review some random profiles, because some of them are simply amazing!</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2010/12/16/about-me-contemporary-business-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wifi router for free at Windows!</title>
		<link>http://profetes.pl/2010/11/20/wifi-router-for-free-at-windows/</link>
		<comments>http://profetes.pl/2010/11/20/wifi-router-for-free-at-windows/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 20:57:52 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[fun!]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[friends]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=268</guid>
		<description><![CDATA[I got very enthusiastic, when a colleague of mine told me about his project. He made it possible to turn your Windows (Windows 7 and Server 2008R2) info wireless router to e.g. share internet connection!Of course, you may say, there already is such a functionality &#8211; one can create Adhoc Wifi network. But it&#8217;s so time consuming [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-85" title="bar_.net" src="http://profetes.pl/wp-content/uploads/2009/09/dotnet.png" alt="" width="500" height="40" /></p>
<p>I got very enthusiastic, when a colleague of mine told me about his project. He made it possible to turn your Windows (Windows 7 and Server 2008R2) info wireless router to e.g. share internet connection!<span id="more-268"></span>Of course, you may say, there already is such a functionality &#8211; one can create Adhoc Wifi network. But it&#8217;s so time consuming and it keeps disconnecting and it requires active connection each time&#8230; In my entire life I&#8217;ve used Adhoc wifi network twice.</p>
<p>But now out life is easier, because there&#8217;s SeventhGate: <a href="http://seventhgate.codeplex.com/" target="_blank">http://seventhgate.codeplex.com/</a> Let me quote Piotrek, the author, about example usage:</p>
<blockquote><p><em><strong>Use cases</strong></em></p>
<ul>
<li>Providing Internet access to all your wireless-capable devices</li>
<li>Creating private network for gaming, file sharing, multimedia, network development projects</li>
<li>No more need to lug your router to University in order to play network games with friends</li>
</ul>
</blockquote>
<p>I find this tool amazing, I&#8217;ve downloaded it and it&#8217;s ready to use! Whenever I need to connect my computer with another one &#8211; I just launch SevethGate <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks, Piotrek!</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2010/11/20/wifi-router-for-free-at-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Szukajo.net</title>
		<link>http://profetes.pl/2010/11/20/szukajo-net/</link>
		<comments>http://profetes.pl/2010/11/20/szukajo-net/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 20:38:23 +0000</pubDate>
		<dc:creator>profetes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[fones]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://profetes.pl/?p=265</guid>
		<description><![CDATA[Szukaj o .NET &#8211; szukajo.net to inicjatywa kolegi Fonesa - http://blog.fones.pl/post/2010-11-17/szukajo-net-start/ Świetny pomysł, który zasadza się na personalizowaniu zapytania do Google&#8217;a. Zamiast pytać na stronie głównej wyszukiwarki o informacje na temat związany z .NET, a potem dopasowywać wyniki, by odfiltrować wszystkie &#8220;śmieciowe&#8221; wyniki &#8211; możemy skorzystać z już odfiltrowanych wynikików na stronie szukajo.net! Przeszukiwane są najbardziej [...]]]></description>
			<content:encoded><![CDATA[<h2><img class="alignnone size-full wp-image-73" title="pl" src="http://profetes.pl/wp-content/uploads/2009/09/pl2.png" alt="" width="500" height="40" /><img class="alignnone size-full wp-image-85" title="bar_.net" src="http://profetes.pl/wp-content/uploads/2009/09/dotnet.png" alt="" width="500" height="40" /></h2>
<h2>Szukaj o .NET &#8211; <a href="szukajo.net" target="_blank">szukajo.net</a></h2>
<p>to inicjatywa kolegi Fonesa - <a href="http://blog.fones.pl/post/2010-11-17/szukajo-net-start/" target="_blank">http://blog.fones.pl/post/2010-11-17/szukajo-net-start/</a></p>
<p>Świetny pomysł, który zasadza się na <span id="more-265"></span>personalizowaniu zapytania do Google&#8217;a. Zamiast pytać na stronie głównej wyszukiwarki o informacje na temat związany z .NET, a potem dopasowywać wyniki, by odfiltrować wszystkie &#8220;śmieciowe&#8221; wyniki &#8211; możemy skorzystać z już odfiltrowanych wynikików na stronie szukajo.net! Przeszukiwane są najbardziej popularne i rzetelne polskie serwisy poświęcone tej technologii. (za: <a href="http://szukajo.net/Home/Sites" target="_blank">http://szukajo.net/Home/Sites</a>).</p>
<p>Sądząc po komentarzach na blogu Fonesa &#8211; pomysł został pozytywnie przyjęty. Ja również dodałem tę stronę do zakładek <img src='http://profetes.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  A w po zwiększeniu ilości artykułów o .NET na moim blogu &#8211; poproszę o dopisanie do indeksu!</p>
]]></content:encoded>
			<wfw:commentRss>http://profetes.pl/2010/11/20/szukajo-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

