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

<channel>
	<title>Mukto Blog</title>
	<atom:link href="http://www.muktosoft.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.muktosoft.com/blog</link>
	<description>Independence,  Imagination, Invention</description>
	<lastBuildDate>Mon, 08 Feb 2010 05:21:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fetching data from multiple tables in one MySQL query &#8211; Part 2</title>
		<link>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query-part-2/</link>
		<comments>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query-part-2/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 13:52:32 +0000</pubDate>
		<dc:creator>Sanny</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[INNER JOIN]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=191</guid>
		<description><![CDATA[A few days back, I mentioned in a post how to fetch data from multiple tables in one MySQL query using multiple and nested SELECT statements. Today I&#8217;m going to present a more elegant way to do that using INNER JOIN.
Let&#8217;s reiterate the problem first &#8211; 
We have 2 tables &#8211; tableA and tableB. The [...]]]></description>
			<content:encoded><![CDATA[<p>A few days back, I mentioned in a <a href="http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query/">post</a> how to fetch data from multiple tables in one MySQL query using multiple and nested SELECT statements. Today I&#8217;m going to present a more elegant way to do that using INNER JOIN.</p>
<p>Let&#8217;s reiterate the problem first &#8211; </p>
<p>We have 2 tables &#8211; <em>tableA</em> and <em>tableB</em>. The structure of these 2 tables are like -</p>
<p><strong>tableA</strong></p>
<pre>
`id` int<strong>(</strong>11) <strong>NOT</strong> <strong>NULL</strong> AUTO_INCREMENT,
`home_id` int<strong>(</strong>11) DEFAULT <strong>NULL</strong>,
`away_id` int<strong>(</strong>11) DEFAULT <strong>NULL</strong>,
`datetime` datetime DEFAULT <strong>NULL</strong>,
`status` int<strong>(</strong>4) DEFAULT <strong>NULL</strong>,
<strong>PRIMARY</strong> <strong>KEY</strong> (`id`)
</pre>
<p><strong>tableB</strong></p>
<pre>
`id` int<strong>(</strong>11) <strong>NOT</strong> <strong>NULL</strong> AUTO_INCREMENT,
`team_name` <font color="#2040a0"><strong>varchar</strong></font><strong>(</strong>50) <font color="#2040a0"><strong>CHARACTER</strong></font> <strong>SET</strong> utf8 DEFAULT <strong>NULL</strong>,
<strong>PRIMARY</strong> <strong>KEY</strong> (`id`)
</pre>
<p>Here <strong>home_id</strong> and <strong>away_id</strong> in <em>tableA</em> are foreign keys that references to <strong>id</strong> in <em>tableB</em>. We want to pick data from <em>tableA</em> according to some condition &#8211; for example, <strong>status</strong> is less than 4. But we want team names instead of ids. That means we need to pick team names from <em>tableB</em>.</p>
<p>Now if we needed just home team or away team, that would have been easy as we can use an INNER JOIN straightway -</p>
<pre>
<strong>SELECT</strong> tableA.id,
tableB.team_name <strong>AS</strong> home_team,
tableA.datetime
<strong>FROM</strong> tableA
INNER JOIN tableB
<strong>ON</strong> tableA.home_id = tableB.id
<strong>WHERE</strong> tableA.status &lt; 4;
</pre>
<p>But we need both home and away team and they refer to 2 different rows on <em>tableB</em>. So, it is not possible to pick both the names using one INNER JOIN. Difficult situation, huh? Aliases come to the rescue! We can use an alias for <em>tableB</em> and inner join that to the first 2 tables. Here&#8217;s the full query &#8211; </p>
<pre>
<strong>SELECT</strong> tableA.id,
tableB.team_name <strong>AS</strong> home_team,
tableB_Alias.team_name <strong>AS</strong> away_team,
tableA.datetime
<strong>FROM</strong> tableA
INNER JOIN tableB
<strong>ON</strong> tableA.home_id = tableB.id
INNER JOIN tableB <strong>AS</strong> tableB_Alias
<strong>ON</strong> tableA.away_id = tableB_Alias.id
<strong>WHERE</strong> tableA.status &lt; 4;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fetching data from multiple tables in one MySQL query</title>
		<link>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query/</link>
		<comments>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 06:06:40 +0000</pubDate>
		<dc:creator>Sanny</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[multiple SELECT]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=183</guid>
		<description><![CDATA[Often we need to use SELECT queries that will fetch data from multiple tables. One option is to use INNER JOIN, LEFT JOIN etc. But in this case described below I couldn&#8217;t find a way to use those. Lets say we have 2 tables &#8211; tableA and tableB. The structure of these 2 tables are [...]]]></description>
			<content:encoded><![CDATA[<p>Often we need to use SELECT queries that will fetch data from multiple tables. One option is to use INNER JOIN, LEFT JOIN etc. But in this case described below I couldn&#8217;t find a way to use those. Lets say we have 2 tables &#8211; <em>tableA</em> and <em>tableB</em>. The structure of these 2 tables are like -</p>
<p><strong>tableA</strong></p>
<pre>
`id` int<strong>(</strong>11) <strong>NOT</strong> <strong>NULL</strong> AUTO_INCREMENT,
`home_id` int<strong>(</strong>11) DEFAULT <strong>NULL</strong>,
`away_id` int<strong>(</strong>11) DEFAULT <strong>NULL</strong>,
`datetime` datetime DEFAULT <strong>NULL</strong>,
`status` int<strong>(</strong>4) DEFAULT <strong>NULL</strong>,
<strong>PRIMARY</strong> <strong>KEY</strong> (`id`)
</pre>
<p><strong>tableB</strong></p>
<pre>
`id` int<strong>(</strong>11) <strong>NOT</strong> <strong>NULL</strong> AUTO_INCREMENT,
`team_name` <font color="#2040a0"><strong>varchar</strong></font><strong>(</strong>50) <font color="#2040a0"><strong>CHARACTER</strong></font> <strong>SET</strong> utf8 DEFAULT <strong>NULL</strong>,
<strong>PRIMARY</strong> <strong>KEY</strong> (`id`)
</pre>
<p>Here <strong>home_id</strong> and <strong>away_id</strong> in <em>tableA</em> are foreign keys that references to <strong>id</strong> in <em>tableB</em>. We want to pick data from <em>tableA</em> according to some condition &#8211; for example, <strong>status</strong> is less than 4. But we want team names instead of ids. That means we need to pick team names from <em>tableB</em>.</p>
<p>Here&#8217;s a simple way to do it &#8211; </p>
<pre>
<strong>SELECT</strong> tableA.id,
<strong>(</strong><strong>SELECT</strong> tableB.team_name <strong>FROM</strong> tableB <strong>WHERE</strong> tableA.home_id = tableB.id) <strong>AS</strong> home_team,
<strong>(</strong><strong>SELECT</strong> tableB.team_name <strong>FROM</strong> tableB <strong>WHERE</strong> tableA.away_id = tableB.id) <strong>AS</strong> away_team,
tableA.datetime
<strong>FROM</strong> tableA
<strong>WHERE</strong> tableA.status &lt; 4;
</pre>
<p>It is important to use aliases here. You have to specify &#8216;AS home_team&#8217; or &#8216;AS away_team&#8217; etc in the inner SELECT commands.</p>
<p>There may be more efficient and elegant methods than this &#8211; using multiple selects in one query. Can anybody suggest some?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/fetching-data-from-multiple-tables-in-one-mysql-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make them all glow, can you ?</title>
		<link>http://www.muktosoft.com/blog/make-them-all-glow-can-you/</link>
		<comments>http://www.muktosoft.com/blog/make-them-all-glow-can-you/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 06:35:23 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[ShowCase]]></category>
		<category><![CDATA[flash game]]></category>
		<category><![CDATA[iphone game]]></category>
		<category><![CDATA[luminr]]></category>
		<category><![CDATA[online game]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=175</guid>
		<description><![CDATA[Here is Luminr, a simple puzzle game with an interesting user interface. A result of my recent experimentation with UI. You can also play the game on your iPhone, download it form the appstore.
You are to click on orbs arranged in a grid to make them all glow. Clicking on an orb changes its state [...]]]></description>
			<content:encoded><![CDATA[<p>Here is <a href="http://www.mochimedia.com/games/luminr_v1/">Luminr</a>, a simple puzzle game with an interesting user interface. A result of my recent experimentation with UI. You can also play the game on your iPhone, download it form the <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=348843765&#038;mt=8">appstore</a>.</p>

<a href='http://www.muktosoft.com/blog/make-them-all-glow-can-you/screen-shot-1-2/' title='screen-shot-1'><img width="150" height="150" src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/screen-shot-1-150x150.png" class="attachment-thumbnail" alt="" title="screen-shot-1" /></a>
<a href='http://www.muktosoft.com/blog/make-them-all-glow-can-you/screen-shot-3-2/' title='screen-shot-3'><img width="150" height="150" src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/screen-shot-3-150x150.png" class="attachment-thumbnail" alt="" title="screen-shot-3" /></a>
<a href='http://www.muktosoft.com/blog/make-them-all-glow-can-you/screen-shot-2-2/' title='screen-shot-2'><img width="150" height="150" src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/screen-shot-2-150x150.png" class="attachment-thumbnail" alt="" title="screen-shot-2" /></a>

<p>You are to click on orbs arranged in a grid to make them all glow. Clicking on an orb changes its state from unlit to lit or lit to unlit along with the neighboring orbs. Turn on all the orbs to pass a level with as few moves as you can.</p>
<p>There are 9 levels, each with more orbs than the previous one. Two difficulty modes. In the easy mode, all orbs are unlit in the beginning and in the hard mode, some orbs are already lit to make things difficult for the player.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/make-them-all-glow-can-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s Go A Hunting</title>
		<link>http://www.muktosoft.com/blog/lets-go-a-hunting/</link>
		<comments>http://www.muktosoft.com/blog/lets-go-a-hunting/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 09:51:59 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[Graphics & Design]]></category>
		<category><![CDATA[banner]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Photoshop scripting]]></category>
		<category><![CDATA[stick figure]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=160</guid>
		<description><![CDATA[I wanted to draw a bunch of stick figure men carrying spears, going on a grand hunting event. There will be at least 15 men in the group. Of course I could draw them all by hand, but I decided to put my Photoshop Scripting abilities to good use.

I started with a drawing of three [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to draw a bunch of stick figure men carrying spears, going on a grand hunting event. There will be at least 15 men in the group. Of course I could draw them all by hand, but I decided to put my Photoshop Scripting abilities to good use.</p>
<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/people.png" alt="people" title="people" width="550" height="400" class="alignnone size-full wp-image-163" /></p>
<p>I started with a drawing of three stick figure hunters. This drawing was made in Adoble Flash CS3 using a Wacom Bamboo tablet. Separating the legs from upper body gives me a set of 3 upper bodies and 3 pairs of legs. We can make 3X3=9 different hunters using these. The idea is very simple, match upper body with legs to form a member of the hunting group. I decided to randomly pick an upper body and a pair of legs to form each member of the group and keep looping until there isn&#8217;t space left on the image.</p>
<p>This is the script I wrote:</p>
<pre>
<strong>var</strong> defaultRulerUnits <font color="4444FF">=</font> preferences.rulerUnits
preferences.rulerUnits <font color="4444FF">=</font> Units.PIXELS

<strong>var</strong> imageWidth <font color="4444FF">=</font> <font color="#FF0000">965</font> <font color="4444FF">;</font>
<strong>var</strong> imageHeight <font color="4444FF">=</font> <font color="#FF0000">150</font> <font color="4444FF">;</font>

<strong>var</strong> legWidth <font color="4444FF">=</font> <font color="#FF0000">60</font> <font color="4444FF">;</font>
<strong>var</strong> legHeight <font color="4444FF">=</font> <font color="#FF0000">75</font> <font color="4444FF">;</font>

<strong>var</strong> torsoWidth <font color="4444FF">=</font> <font color="#FF0000">75</font> <font color="4444FF">;</font>
<strong>var</strong> torsoHeight <font color="4444FF">=</font> <font color="#FF0000">150</font> <font color="4444FF">;</font>

<strong>var</strong> nLeg <font color="4444FF">=</font> <font color="#FF0000">3</font> <font color="4444FF">;</font>
<strong>var</strong> nTorso <font color="4444FF">=</font> <font color="#FF0000">3</font> <font color="4444FF">;</font>

<font color="#444444">//open leg images</font>
<strong>for</strong>(i<font color="4444FF">=</font><font color="#FF0000">1</font><font color="4444FF">;</font>i<font color="4444FF">&lt;</font><font color="4444FF">=</font>nLeg<font color="4444FF">;</font>i++) <font color="4444FF"><strong>{</strong></font>
	<strong>var</strong> fileRef <font color="4444FF">=</font> <strong>new</strong> File(<font color="#008000">&quot;C://hunt//leg&quot;</font>+i+<font color="#008000">&quot;.png&quot;</font>)<font color="4444FF">;</font>

	<strong>var</strong> docRef <font color="4444FF">=</font> app.<font color="a52a2a"><strong>open</strong></font>(fileRef)<font color="4444FF">;</font>
	fileRef<font color="4444FF">=</font>null<font color="4444FF">;</font>

	docRef<font color="4444FF">=</font>null<font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>

<font color="#444444">//open upper body images</font>
<strong>for</strong>(i<font color="4444FF">=</font><font color="#FF0000">1</font><font color="4444FF">;</font>i<font color="4444FF">&lt;</font><font color="4444FF">=</font>nTorso<font color="4444FF">;</font>i++) <font color="4444FF"><strong>{</strong></font>

	<strong>var</strong> fileRef <font color="4444FF">=</font> <strong>new</strong> File(<font color="#008000">&quot;C://hunt//torso&quot;</font>+i+<font color="#008000">&quot;.png&quot;</font>)<font color="4444FF">;</font>
	<strong>var</strong> docRef <font color="4444FF">=</font> app.<font color="a52a2a"><strong>open</strong></font>(fileRef)<font color="4444FF">;</font>

	fileRef<font color="4444FF">=</font>null<font color="4444FF">;</font>
	docRef<font color="4444FF">=</font>null<font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>

<strong>var</strong> newDocument <font color="4444FF">=</font> documents.add(imageWidth,imageHeight)<font color="4444FF">;</font>

<font color="#444444">//make some random hunters</font>
<strong>for</strong>(j<font color="4444FF">=</font><font color="#FF0000">0</font><font color="4444FF">;</font>j<font color="4444FF">&lt;</font><font color="#FF0000">17</font><font color="4444FF">;</font>j++) <font color="4444FF"><strong>{</strong></font>

		app.activeDocument <font color="4444FF">=</font> app.documents[<font color="#2040a0"><strong>Math</strong></font>.<font color="a52a2a"><strong>floor</strong></font>(<font color="#2040a0"><strong>Math</strong></font>.<font color="a52a2a"><strong>random</strong></font>()*nLeg)]<font color="4444FF">;</font>

		<strong>var</strong> AD <font color="4444FF">=</font> app.activeDocument<font color="4444FF">;</font>
		AD.artLayers[<font color="#FF0000">0</font>].copy()<font color="4444FF">;</font>
		app.activeDocument <font color="4444FF">=</font> newDocument<font color="4444FF">;</font>

		<strong>var</strong> layer <font color="4444FF">=</font> newDocument.paste()<font color="4444FF">;</font>
		layer.translate(j*legWidth-imageWidth<font color="4444FF">/</font><font color="#FF0000">2</font>,legHeight)<font color="4444FF">;</font>

		app.activeDocument <font color="4444FF">=</font> app.documents[<font color="#FF0000">3</font>+<font color="#2040a0"><strong>Math</strong></font>.<font color="a52a2a"><strong>floor</strong></font>(<font color="#2040a0"><strong>Math</strong></font>.<font color="a52a2a"><strong>random</strong></font>()*nTorso)]<font color="4444FF">;</font>

		AD <font color="4444FF">=</font> app.activeDocument<font color="4444FF">;</font>
		AD.artLayers[<font color="#FF0000">0</font>].copy()<font color="4444FF">;</font>
		app.activeDocument <font color="4444FF">=</font> newDocument<font color="4444FF">;</font>

		<strong>var</strong> layer <font color="4444FF">=</font> newDocument.paste()<font color="4444FF">;</font>
		layer.translate(j*legWidth-imageWidth<font color="4444FF">/</font><font color="#FF0000">2</font>,legHeight<font color="4444FF">/</font><font color="#FF0000">2</font>+<font color="#FF0000">2</font>)<font color="4444FF">;</font>		

		layer.merge()

<font color="4444FF"><strong>}</strong></font>

<font color="#444444">//close all files except for the final result</font>
<strong>for</strong>(i<font color="4444FF">=</font>app.documents.<font color="#2040a0"><strong>length</strong></font>-<font color="#FF0000">2</font><font color="4444FF">;</font>i<font color="4444FF">&gt;</font><font color="4444FF">=</font><font color="#FF0000">0</font><font color="4444FF">;</font>i--) <font color="4444FF"><strong>{</strong></font>

	<strong>var</strong> AD <font color="4444FF">=</font> app.documents[i]
	AD.<font color="a52a2a"><strong>close</strong></font>(SaveOptions.DONOTSAVECHANGES)<font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>

preferences.rulerUnits <font color="4444FF">=</font> defaultRulerUnits<font color="4444FF">;</font> 
</pre>
<p>And here is the result.</p>
<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/hunt.png" alt="hunt" title="hunt" width="965" height="150" class="alignnone size-full wp-image-162" /></p>
<p>Since the hard part was already done, I decide to play around a little more and came up with this for a banner <a href="http://www.sachalayatan.com">here</a>. Hopefully It will stay there for a day <img src='http://www.muktosoft.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2010/01/shikar1.png" alt="shikar1" title="shikar1" width="965" height="150" class="aligncenter size-full wp-image-169" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/lets-go-a-hunting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java Applet and Javascript message passing</title>
		<link>http://www.muktosoft.com/blog/java-applet-and-javascript-message-passing/</link>
		<comments>http://www.muktosoft.com/blog/java-applet-and-javascript-message-passing/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 06:37:35 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[applet]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[message passing]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=149</guid>
		<description><![CDATA[I did this quite a while a ago, thought I should share this.
To call a js function foo from java applet :

String [] stringArgs = new String[2];

stringArgs[0] = &#34;first arg from Java&#34;;
stringArgs[1] = &#34;second arg from Java&#34;;

mainWindow.call(&#34;foo&#34;, stringArgs);

To call a function foo() in a java applet named bar, do the following in javascript:

document.bar.foo(param1, param2, ....) [...]]]></description>
			<content:encoded><![CDATA[<p>I did this quite a while a ago, thought I should share this.</p>
<p>To call a js function foo from java applet :</p>
<pre>
<font color="#2040a0">String</font> <font color="4444FF"><strong>[</strong></font><font color="4444FF"><strong>]</strong></font> <font color="#2040a0">stringArgs</font> <font color="4444FF">=</font> <strong>new</strong> <font color="#2040a0">String</font><font color="4444FF"><strong>[</strong></font><font color="#FF0000">2</font><font color="4444FF"><strong>]</strong></font><font color="4444FF">;</font>

<font color="#2040a0">stringArgs</font><font color="4444FF"><strong>[</strong></font><font color="#FF0000">0</font><font color="4444FF"><strong>]</strong></font> <font color="4444FF">=</font> <font color="#008000">&quot;first arg from Java&quot;</font><font color="4444FF">;</font>
<font color="#2040a0">stringArgs</font><font color="4444FF"><strong>[</strong></font><font color="#FF0000">1</font><font color="4444FF"><strong>]</strong></font> <font color="4444FF">=</font> <font color="#008000">&quot;second arg from Java&quot;</font><font color="4444FF">;</font>

<font color="#2040a0">mainWindow</font>.<font color="#2040a0">call</font><font color="4444FF"><strong>(</strong></font><font color="#008000">&quot;foo&quot;</font>, <font color="#2040a0">stringArgs</font><font color="4444FF"><strong>)</strong></font><font color="4444FF">;</font>
</pre>
<p>To call a function foo() in a java applet named bar, do the following in javascript:</p>
<pre>
<font color="#2040a0"><strong>document</strong></font>.bar.foo(param1, param2, ....) ;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/java-applet-and-javascript-message-passing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connext : the next generation of &#8216;Connect the Dots&#8217;</title>
		<link>http://www.muktosoft.com/blog/connext/</link>
		<comments>http://www.muktosoft.com/blog/connext/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 10:49:49 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[ShowCase]]></category>
		<category><![CDATA[Connext]]></category>
		<category><![CDATA[flash game]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=126</guid>
		<description><![CDATA[
Connext is a puzzle game based on the simple concept of &#8216;Connecting the Dots&#8217;. Connect dots to form whatever shape you can. Make loops to gain score, bigger loops are better. Gain bonus points for making interesting shapes. Trap bonus items inside your loops to claim advantage.
You can play the game here at mochimedia&#8217;s site. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2009/08/screen-shot-1-150x150.png" alt="screen-shot-1" title="screen-shot-1" width="150" height="150" class="alignnone size-thumbnail wp-image-130" /><img src="http://www.muktosoft.com/blog/wp-content/uploads/2009/08/screen-shot-2-150x150.png" alt="screen-shot-2" title="screen-shot-2" width="150" height="150" class="alignnone size-thumbnail wp-image-131" /><img src="http://www.muktosoft.com/blog/wp-content/uploads/2009/08/screen-shot-3-150x150.png" alt="screen-shot-3" title="screen-shot-3" width="150" height="150" class="alignnone size-thumbnail wp-image-127" /></p>
<p>Connext is a puzzle game based on the simple concept of &#8216;Connecting the Dots&#8217;. Connect dots to form whatever shape you can. Make loops to gain score, bigger loops are better. Gain bonus points for making interesting shapes. Trap bonus items inside your loops to claim advantage.</p>
<p>You can play the game <a href="https://www.mochimedia.com/games/connext">here</a> at mochimedia&#8217;s site. Thanks to mochi leaderboards, You can also invite and challenge your Facebook friends to play the game.</p>
<p>Hope you&#8217;ll like it as much as Jeff at <a href="http://www.8bitrocket.com/newsdisplay.aspx?newspage=31748">8bitrocket</a>, who likes this game &#8220;A LOT&#8221; and calls it a gem. And if you really do, please do let us know by dropping a line here or at the <a href="http://www.newgrounds.com/portal/view/506974">newgrounds</a> page. Suggestions on how we can improve this, a bug report or any sort of feedback is welcomed.</p>
<p>That&#8217;s all for now. Time to go connexting <img src='http://www.muktosoft.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/connext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Right-Click Menu in Flash</title>
		<link>http://www.muktosoft.com/blog/context-menu-in-flash/</link>
		<comments>http://www.muktosoft.com/blog/context-menu-in-flash/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 17:26:05 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[context menu]]></category>
		<category><![CDATA[disabling]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[right click]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=117</guid>
		<description><![CDATA[The right click menu is actually called the context menu. I did not know that. I had to go through several forums and blogs on the net before stumbling upon this piece of information.
Usually one does not need to bother about this menu. But if you are working on a game, you might want to [...]]]></description>
			<content:encoded><![CDATA[<p>The right click menu is actually called the context menu. I did not know that. I had to go through several forums and blogs on the net before stumbling upon this piece of information.</p>
<p>Usually one does not need to bother about this menu. But if you are working on a game, you might want to disable this menu. Because the &#8216;play&#8217; option in the context menu gives your user the ability to play the movie when you would rather have it to stopped. I leave it up to your imagination figuring out how one can cheat or mess things up from here.</p>
<p>To disable the context menu, put this line of code on the first frame, or in any other frame from where you want the context menu to be disabled.</p>
<pre>
stage.showMenu <font color="4444FF">=</font>  false <font color="4444FF">;</font>
</pre>
<p>This will not actually disable the context menu, but hide most parts of it.</p>
<p>Disabling the context menu would help those would be cheaters from cheating their way through your game. But that&#8217;s not all we can do with this menu. We can also add some customized menu options as well. To do so, one has to follow these simple steps.</p>
<ul>
<li>Make a new context menu</li>
<li>Create customized menu item</li>
<li>Attach event listener with the custom menu item</li>
<li>Insert the custom item into the new menu</li>
<li>Set the new menu as the current context menu</li>
</ul>
<p>For example, in our games we usually put a customized menu item linking back to our homepage. To do this, we use the following piece of code.</p>
<pre>
<strong>function<font color="ff0000"> initMenu</font><font color="2040a0">()</font> {</strong>
	<strong>var</strong> m:String<font color="4444FF">=</font><font color="#008000">'© muktosoft'</font><font color="4444FF">;</font>

	<strong>var</strong> cm:ContextMenu<font color="4444FF">=</font><strong>new</strong> ContextMenu()<font color="4444FF">;</font>
	<strong>var</strong> item:ContextMenuItem<font color="4444FF">=</font><strong>new</strong> ContextMenuItem(m)<font color="4444FF">;</font>

	item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,gotoMukto_)<font color="4444FF">;</font>
	cm.hideBuiltInItems()<font color="4444FF">;</font>
	cm.customItems.push(item)<font color="4444FF">;</font>
	<strong>this</strong>.contextMenu <font color="4444FF">=</font> cm <font color="4444FF">;</font>

<font color="4444FF"><strong>}</strong></font>

<strong>function<font color="ff0000"> gotoMukto_</font><font color="2040a0">(evt:ContextMenuEvent)</font>:void {</strong>
	navigateToURL(<strong>new</strong> URLRequest(<font color="#008000">&quot;http://www.muktosoft.com&quot;</font>), <font color="#008000">&quot;_blank&quot;</font>)<font color="4444FF">;</font>
<strong>}</strong>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/context-menu-in-flash/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Stroke hinting</title>
		<link>http://www.muktosoft.com/blog/stroke-hinting/</link>
		<comments>http://www.muktosoft.com/blog/stroke-hinting/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 00:58:02 +0000</pubDate>
		<dc:creator>Raiyan</dc:creator>
				<category><![CDATA[Graphics & Design]]></category>
		<category><![CDATA[anti aliasing]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[hinting]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=103</guid>
		<description><![CDATA[Anyone who have tried making rectangles with rounded corner must have noticed how odd those corners look as they tend to get pixelated and stick out from the body of the rectangle. See the image bellow if you still don&#8217;t get what I mean. Notice how odd those pixalted corners look. The same thing can [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who have tried making rectangles with rounded corner must have noticed how odd those corners look as they tend to get pixelated and stick out from the body of the rectangle. See the image bellow if you still don&#8217;t get what I mean. Notice how odd those pixalted corners look. The same thing can happen with a curved line as well.</p>
<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2009/07/stroke_hinting_pixelated.png" alt="stroke_hinting_pixelated" width="251" height="168" class="alignnone size-full wp-image-105" /></p>
<p>This is due to the anti-aliasing performed on the curved lines by flash. This looks worst when the rounded part is small. The problem is still present when the curved part is large, but it becomes less noticeable. Anti-aliasing is generally a very helpful feature. This case is one of the rare exceptions when anti-aliasing is better not performed.</p>
<p>To let flash know that you don&#8217;t want anti-aliasing to be performed on your curved lines, you have to enable stroke hinting. When stroke hinting is used, flash colors the whole pixels only during rendering. Skips the fractional pixels. Thus anti-aliasing is avoided. See result after enabling stroke-hinting in the image bellow.</p>
<p><img src="http://www.muktosoft.com/blog/wp-content/uploads/2009/07/stroke_hinting_hinted.png" alt="stroke_hinting_hinted" width="230" height="165" class="alignnone size-full wp-image-106" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/stroke-hinting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: C++ style cin, cout in Python</title>
		<link>http://www.muktosoft.com/blog/python-c-style-cin-cout-in-python/</link>
		<comments>http://www.muktosoft.com/blog/python-c-style-cin-cout-in-python/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 07:05:53 +0000</pubDate>
		<dc:creator>darthxaher</dc:creator>
				<category><![CDATA[Coding & Scripting]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/python-c-style-cin-cout-in-python/</guid>
		<description><![CDATA[Ready to bring some flavor of C++ into python? If you like cout, cin in C++ and also a python programmer, you&#8217;d definitely like this snippet.
import sys
class ostream:
    def __init__(self, file):
        self.file = file

    def __lshift__(self, obj):
      [...]]]></description>
			<content:encoded><![CDATA[<p>Ready to bring some flavor of C++ into python? If you like cout, cin in C++ and also a python programmer, you&#8217;d definitely like this snippet.
<pre>import sys
class ostream:
    def __init__(self, file):
        self.file = file

    def __lshift__(self, obj):
        self.file.write(str(obj));
        return self
cout = ostream(sys.stdout)
cerr = ostream(sys.stderr)
endl = '\n'

x, y = 'Printing', 'like C++'
cout &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl
</pre>
<p>I found this and a lot of other cool stuffs from <a href="http://www.norvig.com/">Peter Norvig</a>&#8217;s blog. I highly recommended subscribing to this blog. </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/python-c-style-cin-cout-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python: Working in Unicode</title>
		<link>http://www.muktosoft.com/blog/python-working-in-unicode/</link>
		<comments>http://www.muktosoft.com/blog/python-working-in-unicode/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 00:30:42 +0000</pubDate>
		<dc:creator>darthxaher</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.muktosoft.com/blog/?p=92</guid>
		<description><![CDATA[While working on unicode based characters in python, you&#8217;ll often come across this type error message (this cost me a while to fix).
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
This will happen if you do not set your character encoding in your python file to UTF-8. First you need to [...]]]></description>
			<content:encoded><![CDATA[<p>While working on unicode based characters in python, you&#8217;ll often come across this type error message (this cost me a while to fix).</p>
<p><code><br />UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)<br /></code></p>
<p>This will happen if you do not set your character encoding in your python file to <code>UTF-8</code>. First you need to make sure the first few lines of your programm looks like this.</p>
<p><code><br />#!/usr/bin/python<br /># coding=utf-8<br /># -*- encoding: utf-8 -*-<br /></code></p>
<p>This enables you to write unicode characters in your source code. But this does not enable you to print them in  console and you&#8217;ll still keep getting the same error I previously mentioned.</p>
<p>To solve this you need to add the following code in your <code>/usr/lib/python2.5/sitecustomize.py</code> file (This might change depending your installed python version)</p>
<p><code><br />import sys;<br />sys.setdefaultencoding('utf-8')<br /></code></p>
<p>The interesting part is, if you try to do that in your source file, it won&#8217;t work, I kept getting this error<br /><code><br />AttributeError: 'module' object has no attribute 'setdefaultencoding'<br /></code></p>
<p>I&#8217;m not sure why python does this, but a reasonable explanation would be not to change the character encoding in runtime, that could pose vulnerability to the system.</p>
<p><code>utf-8</code> isn&#8217;t default in python, maybe they&#8217;ll fix this in python 3.0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.muktosoft.com/blog/python-working-in-unicode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
