<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Scrap Book</title>
	<atom:link href="http://inthegarage.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://inthegarage.wordpress.com</link>
	<description>What's the deal with my brain? Why am I so obviously insane?</description>
	<lastBuildDate>Fri, 08 Jul 2011 22:24:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='inthegarage.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Scrap Book</title>
		<link>http://inthegarage.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://inthegarage.wordpress.com/osd.xml" title="Scrap Book" />
	<atom:link rel='hub' href='http://inthegarage.wordpress.com/?pushpress=hub'/>
		<item>
		<title>theduke hari 1</title>
		<link>http://inthegarage.wordpress.com/2008/08/21/theduke-hari-1/</link>
		<comments>http://inthegarage.wordpress.com/2008/08/21/theduke-hari-1/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 08:00:22 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[theduke]]></category>
		<category><![CDATA[wsgi]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/?p=40</guid>
		<description><![CDATA[Apakah ada cara untuk belajar pemrograman selain dengan membuat sebuah project? oleh karena itu setelah membaca specifikasi wsgi, maka saya memutuskan untuk membuat sebuah blog engine project dengan menggunakan python dan wsgi. blog engine ini akan saya namankan project &#8216;theduke&#8217;, bukan duke maskot Java, akan tetapi theduke, diilhami oleh nama anak buah Jet dari film [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=40&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Apakah ada cara untuk belajar pemrograman selain dengan membuat sebuah<br />
project? oleh karena itu setelah membaca specifikasi wsgi, maka saya<br />
memutuskan untuk membuat sebuah blog engine project dengan menggunakan<br />
python dan wsgi.</p>
<p>blog engine ini akan saya namankan project &#8216;theduke&#8217;, bukan <em>duke</em><br />
maskot Java, akan tetapi <em>theduke</em>, diilhami oleh nama anak buah Jet<br />
dari film animasi Avatar.</p>
<p>Senjata yang digunakan:</p>
<ol>
<li><a href="http://werkzeug.pocoo.org">werkzeug</a>
<p>Kenapa harus werkzeug?, tidak ada alasn khusus, saya hanya<br />
tertarik dengan namanya saja.Tentu saja, ada calon kuat yang lain<br />
diantaranya adalah webob, akan tetapi saya melihat werkzeug lebih<br />
sederhana daripada webob/paste.</li>
<li><a href="http://sqlalchemy.org">sqlalchemy</a></p>
<p>Kalo yang ini tidak harus ditanyakan.</li>
<li><a href="http://jinja.pocoo.org">jinja</a></p>
<p>Tutorial werkzeug banyak menggunakan Jinja, jadi saya pilih Jinja<br />
saja.</p>
</li>
</ol>
<p>Ada pertanyaan, kenapa tidak menggunakan framework yang sudah jadi<br />
saja, seperti django? hmm, django adalah framework yang bagus, tapi<br />
untuk project ini saya cenderung lebih ke antiframework. <em>werkzueg</em><br />
sendiri berfungsi seperti glue (lem) yang menghubungkan antara model<br />
dan view. Dan juga sepertinya untuk newbie seperti saya, lebih baik<br />
belajar dari bawah (dalam hal ini lebih ke wsgi).</p>
<p>Untuk project <em>theduke</em>, paling tidak ada beberapa model dasar, yaitu:</p>
<ul>
<li>post</li>
<li>author</li>
<li>tag</li>
<li>comment</li>
</ul>
<p>dimana hubungan antara model-model tersebut antara lain:</p>
<ul>
<li>one-to-many : author -&gt; post</li>
<li>one-to-many : post -&gt;comment</li>
<li>many-to-many: post -&gt;tag</li>
</ul>
<p>berikut ini adalah module database yang menggambarkan table, object,<br />
dan mapper antara table dan object.</p>
<pre class="src">
#table author
author_table = Table('authors',metadata,
                     Column('id',Integer,primary_key=True),
                     Column('username',String(255),nullable=False,unique=True),
                     Column('password',String(255)),
                     Column('email',String(255),nullable=False,unique=True))

#table post
post_table = Table('posts',metadata,
                   Column('id',Integer,primary_key=True),
                   Column('author_id',Integer,ForeignKey('authors.id')),
                   Column('content',Text),
                   Column('title',String(255)),
                   Column('slugs',String(255),unique=True),
                   Column('excerpt',Text),
                   Column('status',Integer),
                   Column('comment_status',Integer(3)),
                   Column('created',DateTime,default=datetime.datetime.now()),
                   Column('updated',DateTime,default=datetime.datetime.now(),onupdate=datetime.datetime.now()))

#table comment
comment_table = Table('comments',metadata,
                      Column('id',Integer,primary_key=True),
                      Column('author_name',String(255),nullable=False),
                      Column('author_email',String(255),nullable=False),
                      Column('author_url',String(255),nullable=False),
                      Column('author_content',Text),
                      Column('post_id',Integer,ForeignKey('posts.id')))

#table tag
tag_table = Table('tags',metadata,
                  Column('id',Integer,primary_key=True),
                  Column('tag_string',String(255),nullable=False),
                  Column('slugs',String(255),nullable=False))

#table for many to many post and tag
post_tag_table = Table('post_tag',metadata,
                       Column('post_id',Integer,ForeignKey('posts.id')),
                       Column('tag_id',Integer,ForeignKey('tags.id')))

class Author(object):
    pass

class Post(object):
    def __init__(self,title,content,excerpt=<span style="color:#cd8162;">""</span>,status=0,comment_status=0):
        self.title = title
        self.content = content
        self.excerpt = excerpt
        self.status = status
        self.comment_statut = comment_status
        self.slug_title()

    def slug_title(self):
        self.slugs = self.title.replace(<span style="color:#cd8162;">" "</span>,<span style="color:#cd8162;">"-"</span>)

class Comment(object):
    pass

class Tag(object):
    def __init__(self,tag_string):
        self.tag_string = tag_string
        self.create_slugs()

    def create_slugs(self):
        if not self.tag_string:
            raise Exception

        self.slugs = self.tag_string.replace(' ','-')

mapper(Author,author_table,
       properties={'posts':relation( Post, backref='author' )})

#one to many with comments
#many to many with tags
mapper(Post,post_table,
       properties={'comments':relation(Comment, backref='post'),
                   'tags':relation(Tag,secondary=post_tag_table,backref='posts')})

mapper(Comment,comment_table)
mapper(Tag,tag_table)
</pre>
<p>saya juga membuat sebuah fungsi test</p>
<pre class="src">
<span style="color:#00ffff;">def</span> <span style="color:#63b8ff;">test</span>(db_uri=<span style="color:#cd8162;">'sqlite:///test.db'</span>):
    <span style="color:#cd8162;">"""
    This is just for testing
    """</span>
    engine = create_engine(db_uri)
    metadata.drop_all(bind=engine)
    metadata.create_all(bind=engine)
    Session = sessionmaker(bind=engine)

    <span style="color:#cd4f39;">#</span><span style="color:#cd4f39;">create post
</span>    p = Post(<span style="color:#cd8162;">"this is a hello world"</span>,<span style="color:#cd8162;">"Hello world"</span>)

    t = Tag(<span style="color:#cd8162;">"tag"</span>)
    t1 = Tag(<span style="color:#cd8162;">"tag2"</span>)

    p.tags.append(t)
    p.tags.append(t1)

    session = Session()
    session.save(p)
    session.commit()

    <span style="color:#cd4f39;">#</span><span style="color:#cd4f39;">qtag = session.query(Tag)
</span>    <span style="color:#cd4f39;">#</span><span style="color:#cd4f39;">qtag = session.query(Post)
</span>    <span style="color:#00ffff;">return</span> session
</pre>
<p>dan test langsung dari python console</p>
<pre class="src">
 c = theduke.database.test()
 d = c.query(theduke.database.Tag)
</pre>
<p>langkah selanjutnya? <strong>Routing</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=40&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2008/08/21/theduke-hari-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>mengenal WSGI</title>
		<link>http://inthegarage.wordpress.com/2008/08/20/mengenal-wsgi/</link>
		<comments>http://inthegarage.wordpress.com/2008/08/20/mengenal-wsgi/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 04:47:51 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[wsgi]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/?p=38</guid>
		<description><![CDATA[Tentang WSGI Apa itu WSGI wsgi:: Web Server Gateway Interface untuk membuat standard interface antara web aplikasi yang dibuat dengan python dengan web server. WSGI mempunyai dua sisi: sisi server aplikasi / framework WSGI pada dasarnya hanya sebuah referensi interface yang harus diimplementasi baik oleh server maupun oleh applikasi, sehingga sebuah applikasi yang mengimplementasi wsgi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=38&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Tentang WSGI</h2>
<h3>Apa itu WSGI</h3>
<dl>
<dd>  wsgi::<br />
<em>Web Server Gateway Interface</em></dd>
</dl>
<p class="quoted">untuk membuat standard interface antara web aplikasi yang dibuat<br />
dengan python dengan web server.<br />
WSGI mempunyai dua sisi:</p>
<ol>
<li>sisi server</li>
<li>aplikasi / framework</li>
<p>WSGI pada dasarnya hanya sebuah referensi interface yang harus<br />
diimplementasi baik oleh server maupun oleh applikasi, sehingga<br />
sebuah applikasi yang mengimplementasi wsgi dapat di-<em>deploy</em>,<br />
diserver mana saja asalkan server itu juga mengimplementasi WSGI<br />
interface.</p>
<p>Ini dapat dibandingkan dengan dunia java, dimana banyak terdapat web<br />
framework, akan tetapi web framework itu bisa diapplikasikan di java<br />
web server mana saja, karena baik web framework maupun java web<br />
server mengimplentasi JavaEE interface yang salah satunya adalah<br />
servlet.</p>
<h3>Cara Kerja WSGI</h3>
<p class="quoted">Server berhubungan dengan applikasi dengan memanggil sebuah callable<br />
(baik itu fungsi maupun object) yang disediakan oleh<br />
applikasi. callable itu mempunyai dua buah argumen yaitu environ dan<br />
start_response. <em>Environ</em> berupa python dictionary sedangkan<br />
start_response berupa fungsi.</p>
<p class="quoted">Sedangkan applikasi berhubungan dengan server, dengan mengirimkan<br />
header (dapat diartikan sebagai http header), dan memanggil<br />
start_response dan memberi argumen http response dan http header,<br />
kemudian mengembalikan list python yang berisi response. Agak<br />
membingunkan bila cuma membaca spesikasi, akan lebih mudah bila kita<br />
melihat contohnya</p>
<p class="quoted">
<pre class="src">
 <span style="color:#00ffff;">def</span> <span style="color:#63b8ff;">application</span>(environ, start_response):
    <span style="color:#cd8162;">"Contoh Sederhana dari WSGI Application"</span>
    status = <span style="color:#cd8162;">"200 OK"</span>
    headers = [(<span style="color:#cd8162;">"Content-type"</span>,<span style="color:#cd8162;">"plain/text"</span>)]
    start_response(status,headers)
    <span style="color:#00ffff;">return</span> [<span style="color:#cd8162;">'Hello world !\n'</span>]
</pre>
<p class="quoted">dari contoh diatas, bisa kita lihat bagaimana applikasi berhubungan<br />
dengan server, dimana applikasi mengirimkan status dan header dengan<br />
menggunakan fungsi start_response, dan mengembalikan body response<br />
kepada server.</p>
<h3>Middleware</h3>
<p class="quoted">Yang dimaksud dengan middleware, adalah sebuah komponen python, yang<br />
mempunyai dua fungsi sebagai server, sekaligus sebagai<br />
applikasi. Pada awalnya memang membuat bingung, bagaimana bisa<br />
sebuah component dapat berfungsi sebagai server sekaligus sebagai<br />
aplikasi?.<br />
Jadi bila sebuah komponen berfungsi sebagai middleware, maka dia<br />
bertindak sebagai penengah/buffer/pembungkus  dari applikasi<br />
lain. Jadi server tidak akan memanggil fungsi dari wsgi dari<br />
aplikasi,akan tetapi memanggil fungsi wsgi dari komponen middleware,<br />
yang nantinya akan memanggil fungsi wsgi dari applikasi.<br />
Middleware itu sendiri bisa merubah keluaran dari applikasi,<br />
melakukan routing dan berbagai macam hal lainnya.<br />
Contoh code dari Middleware</p>
<pre class="src">
<span style="color:#00ffff;">class</span> <span style="color:#7ccd7c;">Upperware</span>:
   <span style="color:#00ffff;">def</span> <span style="color:#63b8ff;">__init__</span>(<span style="color:#00ffff;">self</span>, app):
      <span style="color:#00ffff;">self</span>.wrapped_app = app

   <span style="color:#00ffff;">def</span> <span style="color:#63b8ff;">__call__</span>(<span style="color:#00ffff;">self</span>, environ, start_response):
      <span style="color:#00ffff;">for</span> data <span style="color:#00ffff;">in</span> <span style="color:#00ffff;">self</span>.wrapped_app(environ, start_response):
         <span style="color:#00ffff;">return</span> data.upper()
</pre>
<p class="quoted">contoh diatas , akan merubah keluaran dari aplikasi yang dibungkus<br />
middleware, menjadi huruf besar semua.</p>
<p class="quoted">contoh penggunaan:</p>
<pre class="src">
  wrapped_app = Upperware(simple_app)
  serve(wrapped_app)
</pre>
<h3>Isi dari Environ</h3>
<p class="quoted">Environ sendiri adalah sebuah dictionary yang berisi key dan value<br />
yang berasal dari CGI environment.</p>
<p class="quoted">berikut ini beberapa key yang terdapat pada environ:</p>
<p>REQUEST_METHOD</p>
<p class="quoted">HTTP method, dapat berupa post atau get ataupun HTTP method lainya.<br />
SCRIPT_NAME</p>
<p>PATH_INFO</p>
<p>QUERY_STRING</p>
<p class="quoted">Query String</p>
<p>CONTENT_TYPE</p>
<p>CONTENT_LENGTH</p>
<p>SERVER_NAME, SERVER_PORT</p>
<p>SERVER_PROTOCOL</p>
<p>HTTP_ Variables</p>
<p>referensi<br />
- <a href="http://python.org/dev/peps/pep-0333/">http://python.org/dev/peps/pep-0333/</a><br />
- <a href="http://osdcpapers.cgpublisher.com/product/pub.84/prod.21">WSGI Gateway or Glue</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=38&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2008/08/20/mengenal-wsgi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>Emacs,GTD dan OrgMode</title>
		<link>http://inthegarage.wordpress.com/2008/08/13/emacsgtd-dan-orgmode/</link>
		<comments>http://inthegarage.wordpress.com/2008/08/13/emacsgtd-dan-orgmode/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 10:27:10 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gtd]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/?p=35</guid>
		<description><![CDATA[Hari ini sebenarnya ingin memperdalam masalah python dan cgi, dengan mengulik lebih lanjut module cookie. Tapi entah kenapa ketika emacs dibuka untuk membuat script python, sepertinya hari ini lebih tertarik untuk mengoprek emacs saja daripada mengoprek python. Sebenarnya awal dari ini adalah keinginan untuk mengganti todo list harian saya dari buku saku ke komputer, dan [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=35&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hari ini sebenarnya ingin memperdalam masalah python dan cgi, dengan<br />
mengulik lebih lanjut module cookie. Tapi entah kenapa ketika emacs<br />
dibuka untuk membuat script python, sepertinya hari ini lebih tertarik<br />
untuk mengoprek emacs saja daripada mengoprek python.</p>
<p>Sebenarnya awal dari ini adalah keinginan untuk mengganti <span style="text-decoration:underline;">todo<br />
list</span> harian saya dari buku saku ke komputer, dan karena setiap<br />
hari yang paling sering software yang dibuka adalah emacs, maka jadi<br />
penasaran , untuk membuat <span style="text-decoration:underline;">todo list</span> yang bisa diatur dan dicustomize<br />
pada emacs.</p>
<p>Yang saya cari sebenernya bukan <span style="text-decoration:underline;">todo list</span> yang sederhana, tetapi<br />
pendekatan <span style="text-decoration:underline;">todo list</span> dengan <span style="text-decoration:underline;">get things done</span> (GTD).</p>
<p>Setelah browsing2 dan <span style="text-decoration:underline;">googling</span> Ada beberapa alternatif:<br />
- Membuat file plain text biasa <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
- menggunakan <a href="http://www.emacswiki.org/cgi-bin/wiki/PlannerMode">PlannerMode</a><br />
- menggunakan <a href="http://orgmode.org/">orgmode</a></p>
<p>Akhirnya diputuskan untuk pake <span style="text-decoration:underline;">orgmode</span> saja, karena lebih sederhana<br />
dibanding memakai  planner, akan tetapi jauh lebih <span style="text-decoration:underline;">powerfull</span> dibanding<br />
plain text biasa.</p>
<p>ini ada beberapa references yang dipakai waktu menginstall dan<br />
mengkustumisasi orgmode<br />
<a href="http://members.optusnet.com.au/~charles57/GTD/orgmode.html">http://members.optusnet.com.au/~charles57/GTD/orgmode.html</a><br />
<a href="http://dto.mamalala.org/notebook/orgtutorial.html">http://dto.mamalala.org/notebook/orgtutorial.html</a><br />
<a href="http://www.lifehack.org/articles/lifehack/using-emacs-org-mode-for-gtd.html">http://www.lifehack.org/articles/lifehack/using-emacs-org-mode-for-gtd.html</a><br />
<a href="http://sachachua.com/wp/2007/12/28/emacs-getting-things-done-with-org-basic/">http://sachachua.com/wp/2007/12/28/emacs-getting-things-done-with-org-basic/</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=35&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2008/08/13/emacsgtd-dan-orgmode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>sekilas python dan cgi</title>
		<link>http://inthegarage.wordpress.com/2008/08/12/sekilas-python-dan-cgi/</link>
		<comments>http://inthegarage.wordpress.com/2008/08/12/sekilas-python-dan-cgi/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 09:58:06 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/?p=32</guid>
		<description><![CDATA[Untuk membuat web applikasi, kita dapat menggunakan bahasa pemrograman apa saja, kita dapat menggunakan bahasa perl, php, java, atau python. Yang akan kita bicarakan kali ini adalah membuat web applikasi dengan menggunakan python. Untuk membuat web applikasi dengan menggunakan python ada beberapa jalur/pilihan yand diambil: cgi mod-python (bila menggunakan apache) wsgi python application server pada [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=32&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
Untuk membuat web applikasi, kita dapat menggunakan bahasa pemrograman apa saja, kita dapat menggunakan bahasa perl, php, java, atau python. Yang akan kita bicarakan kali ini adalah membuat web applikasi dengan menggunakan python.
</p>
<div>
Untuk membuat web applikasi dengan menggunakan python ada beberapa jalur/pilihan yand diambil:</p>
<ul>
<li>cgi</li>
<li>mod-python (bila menggunakan apache)</li>
<li>wsgi</li>
<li>python application server</li>
</ul>
<p>pada posting kali ini, yang akan dibahas lebih lanjut adalah cgi, karena cgi adalah metode yang paling tua dan paling sederhana ( meskipun bisa dikatakan pling merepotkan).</p>
<p>CGI ::<br />
cgi merupakan singkatan dari <em>common gateway interface</em>. cgi merupakan protokol untuk menghubungkan antara server dan client. Kita bisa menggunakan bahasa apapun selama bahasa pemrograman itu sudah terdapat di server.
</div>
<div>
contoh sebuah script cgi dengan menggunakan python<br />
<br />
<code class="code" style="background:black:font-color:#ffff00;"><br />
#!/usr/bin/python</p>
<p>print "Content-Type:plain/text\r\n"<br />
print "Hello World"<br />
</code><br />
<br />
disave di folder cgi-bin anda (bila menggunakan ubuntu+apache terdapat di folder /usr/lib/cgi-bin/). dan beri mode eksekusi.<br />
mari kita bahas baris perbaris.<br />
<br />
baris 1: merupakan perintah <em>shebang</em> pada linux, yang menyatakan program yang digunakan untuk mengeksekusi script.<br />
baris 3: perintah menulis header<br />
baris 4: perintah untuk menulis content.
</div>
<div>
<h3>Form</h3>
<div>
Untuk menghandle form, yang kita butuhkan hanya class FieldStorage<br />
dari module cgi.</p>
<pre>
form = cgi.FieldStorage()
</pre>
<p>misal ada sebuah halaman form:<br />
<code></p>
<p>Name: </p>
<p></code><br />
maka untuk process script adalah sebagai berikut<br />
<code class="code" style="background-color:black:font:#ffff00;"><br />
import cgi<br />
form = cgi.FieldStorage() # instantiate only once!<br />
nama = form.getfirst('nama', 'empty')</p>
<p># Avoid script injection escaping the user input<br />
nama = cgi.escape(nama)</p>
<p>print """\<br />
Content-Type: text/html\n</p>
<p>Nama anda adalah "%s"</p>
<p>""" % nama<br />
</code><br />
method <em>getFirst</em> akan mengembalikan nilai pertama dari forms,<br />
bila terdapat lebih dari satu form, maka nilai pengembalian adalah<br />
nilai pertama. Dan sebalikanya bila tidak terdapat form dengan nama<br />
yang dicari, maka nilai dari kembalian adalah <em>None</em><br />
<br />
Bila dalam satu forms, terdapat form dengan nama yang sama (misalnya<br />
check box) maka kita dapat mengetahui nilainya dengan menggunakan<br />
method <em>getList</em>
</div>
</div>
<div>
<h3>Cookie</h3>
<p>Cookie berperan sangat penting dalam pengembangan aplikasi web, karena<br />
cookie dapat membantu dalam menyimpan <em>State</em> dari web<br />
aplikasi. <br />
Untuk pengolahan cookie, dapat secara manual, dalam arti membaca<br />
header dari HTTP, atau juga kita dapat menggunakan module Cookie, yang<br />
merupakan wrapper dari pembacaan cookie secara manual.<br />
Paling tidak ada 2 hal yang harus dimengerti ketika akan<br />
menggunakan cookie di python-cgi.</p>
<h4>Menyimpan/Mengirim Cookie</h4>
<p>Mari kita lihat langsung contoh script untuk menyimpan cookie, secara manual..<br />
<code class="code" style="background-color:black:font:#ffff00;"><br />
#!/usr/bin/python</p>
<p>import time</p>
<p>print "Set-Cookie:last-visit="+str(time.time())<br />
print "Content-Type:plain/html \r\n"</p>
<p>#print the content<br />
print ""<br />
print "Hello World"<br />
print ""<br />
</code><br />
dan apabila kita menggunakan module Cookie.<br />
<code class="code" style="background-color:black:font:#ffff00;"><br />
#!/usr/bin/python</p>
<p>import time<br />
import Cookie</p>
<p>cookie = Cookie.SimpleCookie()<br />
cookie['last-visit'] = str(time.time())<br />
print cookie<br />
print "Content-Type:plain/html \r\n"</p>
<p>#print the content<br />
print ""<br />
print "Hello World"<br />
print ""<br />
</code><br />
Gampang dan mudah <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<h4>Membaca Cookie</h4>
<p>Berikut ini adalah contoh untuk membaca cookie dengan Module Cookie.<br />
<code class="code" style="background-color:black:font:#ffff00;"><br />
import Cookie<br />
import cgi</p>
<p>cookie_string = cgi.os.environ.get('HTTP_COOKIE')<br />
if not cookie_string:<br />
   print "Belum ada Cookie atau Cookie tidak didukung"<br />
else:<br />
   cookie = Cookie.SimpleCookie()<br />
   cookie.load(cookie_string)<br />
   value = cookie['lastvisit'].value<br />
</code>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=32&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2008/08/12/sekilas-python-dan-cgi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>python dan glob</title>
		<link>http://inthegarage.wordpress.com/2008/08/07/python-dan-glob/</link>
		<comments>http://inthegarage.wordpress.com/2008/08/07/python-dan-glob/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 09:50:30 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Software Dev]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/?p=29</guid>
		<description><![CDATA[Hari ini saya mencari cara mudah untuk melakukan iterasi terhadap file-file yang ada di folder. O ya, karena sedang belajar python, maka saya mencari cara untuk hal diatas dengan menggunakan python style setelah membaca manual, maka kita dapat menggunakan modul os. Yang kita butuhkan terdapat dalam perintah listdir. import os listfile = os.listdir(&#8216;.&#8217;) Akan tetapi, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=29&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hari ini saya mencari cara mudah untuk melakukan <em>iterasi</em> terhadap file-file yang ada di folder.</p>
<p>O ya, karena sedang belajar python, maka saya mencari cara untuk hal diatas dengan menggunakan <em>python style</em></p>
<p>setelah membaca manual, maka kita dapat menggunakan modul os. Yang kita butuhkan terdapat dalam perintah listdir.</p>
<div style="background:black;color:#ffff90;">
import os</p>
<p>listfile = os.listdir(&#8216;.&#8217;)
</p></div>
<p>Akan tetapi, bila kita ingin membuat list yang hanya berisi file jpg, paling tidak harus melakukan langkah kedua</p>
<div style="background:black;color:#ffff90;">
import os</p>
<p>listfile = os.listdir(&#8216;.&#8217;)<br />
listjpg = [x  for x in listfile if x.endswith('jpg')]
</p></div>
<p>Ternyata terdapat cara(module) lain yang dapat melakukan hal diatas dengan cara yang lebih mudah, module tersebut adalah glob.</p>
<div style="background:black;color:#ffff90;">
import glob</p>
<p>glob.glob(&#8216;*.jpg&#8217;)
</p></div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=29&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2008/08/07/python-dan-glob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>tcl and print</title>
		<link>http://inthegarage.wordpress.com/2007/08/16/tcl-and-print/</link>
		<comments>http://inthegarage.wordpress.com/2007/08/16/tcl-and-print/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 11:02:54 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[tcl/tk]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/2007/08/16/tcl-and-print/</guid>
		<description><![CDATA[Quick post, I got a lot of image file that has to be printed, of course I could fire my gimp and print it one by one, but since (again) I am in lazy mood, and beside that I am in linux, so I could use my command line power rigght? rigggght. so I open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=28&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quick post,<br />
<br />
I got a lot of image file that has to be printed, of course I could fire my gimp and print it one by one, but since (again) I am in lazy mood, and beside that I am in linux, so I could use my command line power rigght? rigggght.<br />
<br />
so I open my tcl (don&#8217;t ask why I choose tcl <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )<br />
and do this</p>
<pre>
% set filelist [exec ls]
% foreach file $filelist { lpr $file }
</pre>
<p>
sweet, no I just go browsing and wait for my file .<br />
<br />
<strong>NOTE</strong><br />
only use if you in linux, and already installed cups, and tcl heheh</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=28&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2007/08/16/tcl-and-print/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>me and BeanShell</title>
		<link>http://inthegarage.wordpress.com/2007/08/03/me-and-beanshell/</link>
		<comments>http://inthegarage.wordpress.com/2007/08/03/me-and-beanshell/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 10:43:31 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[dive into java]]></category>
		<category><![CDATA[Software Dev]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/2007/08/03/me-and-beanshell/</guid>
		<description><![CDATA[Recently I got an assignment to fool around with a java library, Since I kind in bad mood, I was thinking a way to fool around with an easy way, not using code, compile, see because it&#8217;s just too much work. So I remember about java scripting, there are lot of scripting in java today, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=27&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I got an assignment to fool around with a java library, Since I<br />
kind in bad mood, I was thinking a way to fool around with an easy<br />
way, not using code, compile, see because it&#8217;s just too much work. So<br />
I remember about java scripting, there are lot of scripting in java<br />
today, here some of it <a href="http://www.beanshell.org">bsh</a>, groovy, jacl, jython, rhino and others.</p>
<p>So I&#8217;ve to pick up one from many, I started with bsh, since the<br />
syntax resembling java syntax with some improvement (pre java 5.0). So<br />
I started to download it [ in ubuntu  bsh already in synaptix ], and<br />
start to playing around with it.</p>
<p>my first problem is how to add a jar to bsh classpath, luckily in bsh<br />
documentation, there is a command to add jar into classpath,<br />
here&#8217;s my snippet</p>
<p><code></p>
<p>BeanShell 2.0b4 - by Pat Niemeyer (pat@pat.net)<br />
bsh % addClassPath(&quot;lib/my.jar&quot;);<br />
addClassPath(&quot;lib/my.jar&quot;);<br />
bsh %<br />
</code></p>
<p>after that, I smoothly played around with the API. so bsh can be a<br />
tool for black-box testing, and I quite satisfied using it. I know<br />
that the other scripting can be use for it, but for now I keep with<br />
bsh for black box testing.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=27&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2007/08/03/me-and-beanshell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>doLearn(&#8220;Generics&#8221;,2)</title>
		<link>http://inthegarage.wordpress.com/2007/07/30/dolearngenerics2/</link>
		<comments>http://inthegarage.wordpress.com/2007/07/30/dolearngenerics2/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 11:09:56 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[dive into java]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/2007/07/30/dolearngenerics2/</guid>
		<description><![CDATA[Generic juga bisa diterapkan pada deklarasi sebuah kelas. contoh klasiknya adalah sebagai berikut: public class Pair&#60;T,V&#62;{ T key = null; V value = null; public Pair(T t, V v){ this.key = t; this.value =v; } public V get(T t){ return value; } @Override public String toString(){ return &#34;key = &#34;+key+&#34; value =&#34;+value; } public static [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=26&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Generic juga bisa diterapkan pada deklarasi sebuah kelas. contoh<br />
klasiknya adalah sebagai berikut:</p>
<pre>
public class Pair&lt;T,V&gt;{
	T key = null;
	V value = null;
	public Pair(T t, V v){
		this.key = t;
		this.value =v;
	}

	public V get(T t){
		return value;
	}

	@Override
	public String toString(){
		return &quot;key = &quot;+key+&quot; value =&quot;+value;
	}

	public static void main(String[] args){
		Pair&lt;String,String&gt; pString = new Pair&lt;String,String&gt;(&quot;Hello&quot;,&quot;world&quot;);
		System.out.println(pString);

		Pair&lt;String,Integer&gt;pStrInt = new Pair&lt;String, Integer&gt;(&quot;This&quot;,1);
		System.out.println(pStrInt);
	}
}
</pre>
<p>hasil dari eksekusi program diatas adalah</p>
<pre>
key = Hello value =world
key = This value =1
</pre>
<p>tentu saja generic diatas, hanya salah satu contoh penerapan generic<br />
pada sebuah kelas.</p>
<p>nah bagaimana cara mengartikan generic diatas?<br />
seperti telah kita ketahui, bahwa generic tidak merubah bytecode hasil<br />
dari kompilasi kelas pada java, sehingga untuk lebih mudahnya kita<br />
dapat mengasumsikan bahwa sebelum proses kompilasi java merubah dari<br />
kode java ke bytekode, terjadi perubahan dimana (contoh 1 dari<br />
Pair) character generic &#8216;V&#8217; diubah menjadi<br />
String,sedangkan &#8216;T&#8217; menjadi String. dan pada begitu juga pada code<br />
Pair dimana &#8216;T&#8217; menjadi String, dan &#8216;V&#8217; menjadi<br />
Integer.</p>
<p>dari sini bisa menimbulkan pertanyaan apakah</p>
<pre>
Pair&lt;String,String&gt;
</pre>
<p>dan</p>
<pre>
Pair&lt;String,Integer&gt;
</pre>
<p>adalah 2 kelas yang sama?, yap dua contoh itu adalah 2 kelas yang<br />
sama, hal ini bisa dibuktikan dengan</p>
<pre>

Pair&lt;String,String&gt; pString = new Pair&lt;String,String&gt;(&quot;Hello&quot;,&quot;world&quot;);
Pair&lt;String,Integer&gt;pStrInt = new Pair&lt;String, Integer&gt;(&quot;This&quot;,1);
assert pString.getClass() == pStrInt.getClass();
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=26&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2007/07/30/dolearngenerics2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>Thread dan java</title>
		<link>http://inthegarage.wordpress.com/2007/07/25/thread-dan-java/</link>
		<comments>http://inthegarage.wordpress.com/2007/07/25/thread-dan-java/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 11:36:09 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[dive into java]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/2007/07/25/thread-dan-java/</guid>
		<description><![CDATA[Apa itu Thread? Kalo ditanya apakah itu thread? susah untuk menjawab, yang jelas thread itu adalah sebuah konsep abstrak untuk proses yang dilakukan oleh komputer untuk menyelesaikan sebuah tugas. Apa perbedaan antara Thread dan Process Didalam konsep OS, ada 2 buah istilah yang digunakan untuk sebuah proses menyelesaikan tugas, Thread dan Process. Thread adalah Lightweight [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=25&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Apa itu Thread?</h3>
<p>Kalo ditanya apakah itu thread? susah untuk menjawab, yang jelas<br />
thread itu adalah sebuah konsep abstrak untuk proses yang dilakukan<br />
oleh komputer untuk menyelesaikan sebuah tugas.</p>
<h3>Apa perbedaan antara <em>Thread</em> dan <em>Process</em></h3>
<p>Didalam konsep OS, ada 2 buah istilah yang digunakan untuk sebuah<br />
proses menyelesaikan tugas, Thread dan Process.</p>
<p><em>Thread</em> adalah <em>Lightweight</em> sedangkan <em>Process</em> adalah <em>HeavyWeight</em>, Satu<br />
atau lebih thread bisa dipunyai oleh process. antara 1 Thread dan<br />
thread lainya sama2 menggunakan Heap yang sama, sedangkan 1 Process<br />
dan process yang lain menggunakan Heap yang berbeda. Bisa dianalogikan<br />
process itu dengan applikasi, dalam sebuah OS satu aplikasi dan<br />
aplikasi yang lain akan mempunyai heap yang berbeda, sedangkan dalam 1<br />
applikasi dapat mempunyai 1 atau lebih thread.</p>
<h3>Kenapa harus menggunakan Thread?</h3>
<p>Paling tidak ada 2 hal yang membuat sebuah program untuk menggunakan<br />
Thread (dalam hal ini java):</p>
<ul>
<li>Membuat GUI lebih responsive</li>
<li>Menggunakan resources menjadi lebih efektif.</li>
</ul>
<h3>Bagaimana cara membuat <em>Thread</em> pada <em>Java</em></h3>
<ol>
<li><em>Extending Thread</em> <br />
<code><br />
Thread t = new Thread(){<br />
public void run(){<br />
System.out.println(&quot;Thread started&quot;);<br />
}<br />
}<br />
</code></li>
<li><em>Implementing Runnable</em> <br />
<code><br />
Thread t = new Thread(new Runnable(){<br />
public void run(){<br />
System.out.println(&quot;Thread started&quot;);<br />
}<br />
})</p>
<p></code></li>
</ol>
<p>cara diatas hanya untuk menyingkat pengetikan saja, mungkin cara yang<br />
lain adalah<br />
<code><br />
class NewThread extends Thread{...<br />
</code><br />
dan<br />
<code><br />
class NewThread implements Runnable{...<br />
</code></p>
<p>Setelah membuat object dari thread, maka untuk menjalan thread, harus<br />
dengan perintah <code>t.start()</code>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=25&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2007/07/25/thread-dan-java/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
		<item>
		<title>TCL &amp; uplevel</title>
		<link>http://inthegarage.wordpress.com/2007/06/14/tcl-uplevel/</link>
		<comments>http://inthegarage.wordpress.com/2007/06/14/tcl-uplevel/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 08:50:48 +0000</pubDate>
		<dc:creator>bayuadji</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[tcl/tk]]></category>

		<guid isPermaLink="false">http://inthegarage.wordpress.com/2007/06/14/tcl-uplevel/</guid>
		<description><![CDATA[perintah uplevel digunakan untuk menjalankan perintah2 yang berada di stack frame yang berbeda, stack frame telah dijelaskan di http://inthegarage.wordpress.com/2007/06/13/tcl-upvar/, Mungkin lebih baik langsung pada contoh proc a {} { set x 10 set y 20 b } proc b {} { uplevel 1 {set x 20; puts &#34;nilai dari x : $x&#34;} uplevel 1 {incr [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=24&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>perintah <em>uplevel</em> digunakan untuk menjalankan perintah2 yang berada di<br />
<em>stack frame</em> yang berbeda, <em>stack frame</em> telah dijelaskan di<br />
<a href="http://inthegarage.wordpress.com/2007/06/13/tcl-upvar/">http://inthegarage.wordpress.com/2007/06/13/tcl-upvar/</a>,</p>
<p>Mungkin lebih baik langsung pada contoh</p>
<pre>
proc a {} {
    set x 10
    set y 20

    b
}

proc b {} {
    uplevel 1 {set x 20; puts &quot;nilai dari x : $x&quot;}
    uplevel 1 {incr x 20}
    uplevel 1 {puts $x}
}
</pre>
<p>dan hasilnya adalah sebagai berikut</p>
<pre>
%a
nilai dari x : 20
40
% 3
</pre>
<p>contoh lain dari penggunaan uplevel adalah untuk mengkustomisasi<br />
struktur, misalnya adalah perintah loop yang tidak terdapat pada tcl,<br />
misalnya syntax dari loop adalah <code>loop 1 0 {..}</code>, maka implementasinya<br />
adalah</p>
<pre>
proc loop {from to body} {
    for {set var $from} {$var &lt; $to} {incr var} {uplevel 1 $body}
}
</pre>
<p>perintah uplevel pada loop untuk menjalankan perintah pada body, yang<br />
mempunyai 1 level lebih tinggi daripada perintah loop.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/inthegarage.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/inthegarage.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/inthegarage.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/inthegarage.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/inthegarage.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=inthegarage.wordpress.com&amp;blog=428111&amp;post=24&amp;subd=inthegarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://inthegarage.wordpress.com/2007/06/14/tcl-uplevel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b5e98a03a00bc975e05d1faa2d28617e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sherl0ck</media:title>
		</media:content>
	</item>
	</channel>
</rss>
