<?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>Rony&#039;s</title>
	<atom:link href="http://rony.creash.com.bd/feed/" rel="self" type="application/rss+xml" />
	<link>http://rony.creash.com.bd</link>
	<description>Blogor Blogor</description>
	<lastBuildDate>Tue, 15 Dec 2009 19:18:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<script type="text/javascript">

if (typeof Meebo == 'undefined') {

Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};
(function(q){

	var args = arguments;
	if (!document.body) { return setTimeout(function(){ args.callee.apply(this, args) }, 100); }
	var d=document, b=d.body, m=b.insertBefore(d.createElement('div'), b.firstChild); s=d.createElement('script');
	m.id='meebo'; m.style.display='none'; m.innerHTML='<iframe id="meebo-iframe"></iframe>';
	s.src='http'+(q.https?'s':'')+'://'+(q.stage?'stage-':'')+'cim.meebo.com/cim/cim.php?network='+q.network;
	b.insertBefore(s, b.firstChild);

})({network:'ronys_ru02ca'});	}</script>	<item>
		<title>Get image data from client side using javascript</title>
		<link>http://rony.creash.com.bd/get-image-data-using-javascript/</link>
		<comments>http://rony.creash.com.bd/get-image-data-using-javascript/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 19:02:17 +0000</pubDate>
		<dc:creator>Rony</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=151</guid>
		<description><![CDATA[Well, I had a requirement to show a preview of image, whenever client selects an image inside a form. First I thought it was just a easy task&#8230; But it really took about one hour of me to figure the way out&#8230;
As it was an input element with type=file, I simply tried to get the [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I had a requirement to show a preview of image, whenever client selects an image inside a form. First I thought it was just a easy task&#8230; But it really took about one hour of me to figure the way out&#8230;</p>
<p>As it was an input element with type=file, I simply tried to get the value and push it to an image element&#8217;s source attribute attaching &#8216;file://&#8217; at the beginning. But life&#8217;s not that easy! The value only returns the file name not the full path. How can I get the full path??!! I can see the path on the input box, but I can&#8217;t get it!!!</p>
<p>Next approach, go to our best friend, Google! Well, I guess she wasn&#8217;t very pleased with me and didn&#8217;t help me very much&#8230;</p>
<p>Now what?! Well, let&#8217;s try the DOM inspector of Firefox. There I found three functions for the file input element.</p>
<ul>
<li>getAsBinary()</li>
<li>getAsDataURL()</li>
<li>getAsText()</li>
</ul>
<p>They are all self explanatory&#8230; My head was already stuck at that moment. So I didn&#8217;t see the &#8216;Data URL&#8217; function first. Tried to parse binary for a while. But couldn&#8217;t find a way to push the binary data of an image inside the image tag. Then I noticed the next function. Well, it worked like a charm. I just pushed the function&#8217;s return value to the image tag&#8217;s source attribute. Done.</p>
<p>So, to get the file path, the call should be like:</p>
<p><code>file_input_element_id.files[0].getAsDataURL()</code></p>
<p>That&#8217;s all&#8230; <img src='http://rony.creash.com.bd/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>N.B. For IE, it works OK with adding the &#8216;file://&#8217; before the value of input element. You just need to have proper permission level.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Fget-image-data-using-javascript%2F';
  addthis_title  = 'Get+image+data+from+client+side+using+javascript';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-151-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/get-image-data-using-javascript/',title:'Get image data from client side using javascript',tweet:'Well, I had a requirement to show a preview of image, whenever client selects an image inside a form',description:'Well, I had a requirement to show a preview of image, whenever client selects an image inside a form'})"><script type='text/javascript'>document.getElementById("post-151-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/get-image-data-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>আবোল তাবোল</title>
		<link>http://rony.creash.com.bd/%e0%a6%86%e0%a6%ac%e0%a7%8b%e0%a6%b2-%e0%a6%a4%e0%a6%be%e0%a6%ac%e0%a7%8b%e0%a6%b2/</link>
		<comments>http://rony.creash.com.bd/%e0%a6%86%e0%a6%ac%e0%a7%8b%e0%a6%b2-%e0%a6%a4%e0%a6%be%e0%a6%ac%e0%a7%8b%e0%a6%b2/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 17:57:52 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[?? ????]]></category>
		<category><![CDATA[???? ?????]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=145</guid>
		<description><![CDATA[কিছুই লেখা হয় না বহুদিন হল। সারা দিনের কাজ কর্ম, ক্লান্তি সব কিছুর পরে আর ধৈর্য্য হয় না। আর বাঙ্গালীর তো আজকাল এমনেতেই ধৈর্য্য কমে যাচ্ছে। পরিবেশ দূষনের প্রভাব মনে হয়!! হা হা!! ব্যাপারটা নিয়ে গবেষনা হতে পারে&#8230; কি কারণে সব ধৈর্য্য, সহনশীলতা আর ভদ্রতা হারিয়ে যাচ্ছে সবার মধ্যে থেকে&#8230; যাকগে, এসব নিয়ে গবেষনা করে [...]]]></description>
			<content:encoded><![CDATA[<p>কিছুই লেখা হয় না বহুদিন হল। সারা দিনের কাজ কর্ম, ক্লান্তি সব কিছুর পরে আর ধৈর্য্য হয় না। আর বাঙ্গালীর তো আজকাল এমনেতেই ধৈর্য্য কমে যাচ্ছে। পরিবেশ দূষনের প্রভাব মনে হয়!! হা হা!! ব্যাপারটা নিয়ে গবেষনা হতে পারে&#8230; কি কারণে সব ধৈর্য্য, সহনশীলতা আর ভদ্রতা হারিয়ে যাচ্ছে সবার মধ্যে থেকে&#8230; যাকগে, এসব নিয়ে গবেষনা করে বনের মোষ তাড়ানোর লোকের অভাব নেই বাংলাদেশে। আমি আপাতত আমার চারপাশ থেকে মশা তাড়াই। মশার কামড়ে অতিষ্ট হয়ে গেলাম। আচ্ছা, এই যে গত ২৪ বছর ধরে মশার কামড় খেয়ে আসছি, এতদিনে তো এটাতে অভ্যস্ত হয়ে যাওয়ার কথা। Evolution তো তাই বলে নাকি? ডারউইন সাহেব কে পেলে জিঞ্জ্বেস করা যেত। তাঁকে আর পাব কোথায়? মশার কামড় খেয়েই লিখতে থাকি। অবশ্য মশারির ভিতরে ঢুকে যাওয়া যায়, কিন্তু ল্যাপটপ নিয়ে লিখতে গেলে পিঠে ব্যাথা হয়ে যাবে। আচ্ছা, লিখতেই যে হবে এমনও কোন কথা নেই। থাক, লিখি কিছুক্ষন। অনেক দিন ধরে ব্লগটা ফাকা পড়ে আছে।</p>
<p>দুদিন ধরে ঘোড়া রোগ বাস কম্পানি গুলোর। সোজা রাস্তা রেখে দুনিয়া ঘুরে যাওয়া আসা করবে। প্রতিদিন পাক্কা ৪ ঘন্টা করে রাস্তায় নষ্ট হয়। ৪ এর মধ্যে ৩ ঘন্টাকে যদি কর্ম ঘন্টা ধরি, তাহলে কত টাকার ক্ষতি হচ্ছে? আউটসোর্সিং এর ক্ষেত্রে বাংলাদেশের IT ডেভেলপারের গড় rate ২০ ডলার/ঘন্টা ধরলে, ৩ ঘন্টায় ৬০ ডলার। মাসে ২০ দিন এই ভাবে মোট খরচ ১২০০ ডলার!!! হায় আল্লাহ এতো দেখি আমার মাসের বেতনের চেয়ে বেশি হয়ে যাচ্ছে!! ভালই&#8230; দেশ এগিয়ে যাচ্ছে। আমরা এখন মেগা সিটির বাসিন্দা।</p>
<p>সবকিছুতেই আজকাল negative দিকটাই আগে দেখছি। কারণটা কি? না মানব হয়ে যাচ্ছি নাকি? &#8216;না মানব&#8217;! ভাল হয়েছে তো নামকরণ টা। মাঝে চেষ্টা নিয়েছিলাম জোর করে &#8216;হ্যাঁ মানব&#8217; হওয়ার। হয়ে গেলাম উল্টোটা। ভাবছি এবার জোর করে না মানব হওয়ার চেষ্টা করব। যদি অবস্থার কিছু উন্নতি হয়।</p>
<p>আচ্ছা, আমি তো আমার দেশটা কে অনেক বেশি ভালবাসি। তাহলে কেন সব খারাপ দিক গুলোই চোখে পড়ে? ভাল দিক যে পড়ে না তা নয়। আসলে দেশের খারাপ দিক না। মনে হয় দেশের মানুষ এর। আমার দেশটায় চুড়ান্ত রকমের দূষন দেখা দিয়েছে। মানব দূষন। আমিও বেচে নেই এই দূষন থেকে। মাঝে মাঝে পালাতে ইচ্ছে করে। কিন্তু আবার ভাবি, ধ্যাত, পালাব কেন? আসলে হয়ত পালানোর জায়গাও নেই। তাই একটু হিরোগিরি দেখানোর চেষ্টা।</p>
<p>আজকাল সারাক্ষনই মেজাজ খারাপ হয়ে থাকে। বাসায় থাকা চাচাতো ভাইটাকে গত ৩ বছরে কখনো বকিনি। কিন্তু কাল প্রথমবারের মত বকা দিলাম। কিন্তু সেটাও অকারণে। বাইরে বের হলেতো কথাই নেই। মনে হয় নিজে ছাড়া আর সবাই উলটো পথে চলছে। আসলে হয়ত আমি নিজেই সোজা পথটা দেখতে পাচ্ছি না।</p>
<p>মেজাজ খারাপের কোন কারণ খুঁজে পাই না। খুঁজতে যাইও না অবশ্য। সেটা খুঁজে বের করতে গেলে মনবিঞ্জানে PHDর থিসিস পেপার হয়ে যাবে।</p>
<p>কি সব আবোল তাবোল লিখে যাচ্ছি। এটা অবশ্য মজাই। যাই লেখো না কেন, কেউ কিছু বলবে না। অর্থহীন হলেতো আরও ভাল। সবার মাথার উপর দিয়ে যাবে। কেউ কিছু না বুঝে উলটো বাহবা দিয়ে যাবে! খাসা হয়েছে বৎস, চমৎকার লিখেছ। কিন্তু লিখেছি যে কাকের ঠ্যাং আর বকের ঠ্যাং তা তো শুধু আমিই জানি। যে বাহবা দিচ্ছে সে ও জানে। কিন্তু বলে না। হাজার হোক মেগা সিটির বাসিন্দা। নাগরিক সভ্যতা বলে একটা ব্যাপার আছে না?!</p>
<p>সকল সুনারগিকদের শুভেচ্ছা। আর যারা এইযে ৩০ মিনিট নষ্ট করে এই লেখা টা পরলেন তাদের অনেক ধন্যবাদ। এই ৩০ মিনিটের মূল্য উপরের সূত্র অনুসারে ১০ ডলার = প্রায় ৭০০ টাকা। হা হা&#8230; বেশ বেশ&#8230; ভাল একটা সূত্র আবিস্কার করে ফেলেছি। আগামী বছর নোবেলের জন্য মনোনয়ন পেয়ে যেতে পারে। কিন্তু কোন বিভাগে পাবে এই ব্যাপারে একটু confusion আছে। এই confusion টার জন্য নোবেলটা আবার মিস না হয়ে যায়!!</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2F%25e0%25a6%2586%25e0%25a6%25ac%25e0%25a7%258b%25e0%25a6%25b2-%25e0%25a6%25a4%25e0%25a6%25be%25e0%25a6%25ac%25e0%25a7%258b%25e0%25a6%25b2%2F';
  addthis_title  = '%E0%A6%86%E0%A6%AC%E0%A7%8B%E0%A6%B2+%E0%A6%A4%E0%A6%BE%E0%A6%AC%E0%A7%8B%E0%A6%B2';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-145-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/%e0%a6%86%e0%a6%ac%e0%a7%8b%e0%a6%b2-%e0%a6%a4%e0%a6%be%e0%a6%ac%e0%a7%8b%e0%a6%b2/',title:'আবোল তাবোল',tweet:'কিছুই লেখা হয় না বহুদিন হল। সারা দিনের',description:'কিছুই লেখা হয় না বহুদিন হল। সারা দিনের'})"><script type='text/javascript'>document.getElementById("post-145-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/%e0%a6%86%e0%a6%ac%e0%a7%8b%e0%a6%b2-%e0%a6%a4%e0%a6%be%e0%a6%ac%e0%a7%8b%e0%a6%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced object selection using Mootools</title>
		<link>http://rony.creash.com.bd/advanced-object-selection-using-mootools/</link>
		<comments>http://rony.creash.com.bd/advanced-object-selection-using-mootools/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 19:30:25 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[Selection]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=142</guid>
		<description><![CDATA[Mootools&#8217; &#8220;Selectors&#8221; utility has some really strong feature. It really saves a lot of time and sweat. Using this property, one can select a tag (any one can!), tag with specific name, id or any other attribute (huh!) and most amazingly part of a property value matching to some string&#8230;
Say you want to select all [...]]]></description>
			<content:encoded><![CDATA[<p>Mootools&#8217; &#8220;Selectors&#8221; utility has some really strong feature. It really saves a lot of time and sweat. Using this property, one can select a tag (any one can!), tag with specific name, id or any other attribute (huh!) and most amazingly part of a property value matching to some string&#8230;</p>
<p>Say you want to select all the div tags which has ID starting with &#8216;my&#8217;. How can you do that? <span id="more-142"></span>Select all the div in the document, parse everyone&#8217;s id? Well, here this is a one line code in Mootools using the <em>getElements</em> function. It actually uses the general RegEx symbols to match property values.</p>
<p>To select the div with id starting with &#8216;my&#8217; it would use <em>getElements(&#8216;div[id^=my]&#8216;)</em>;</p>
<p>Some other examples from Mootools documentation:</p>
<p><code>//Returns all anchors within myElement.<br />
$('myElement').getElements('a');</code></p>
<p><code>//Returns all input tags with name "dialog".<br />
$('myElement').getElements('input[name=dialog]');</code></p>
<p><code>//Returns all input tags with names ending with 'log'.<br />
$('myElement').getElements('input[name$=log]');<br />
</code><br />
<code>//Returns all email links (starting with "mailto:").<br />
$('myElement').getElements('a[href^=mailto:]');</code></p>
<p><code>//Adds events to all Elements with the class name 'email'.<br />
$(document.body).getElements('a.email').addEvents({<br />
'mouseenter': function(){<br />
this.href = 'real@email.com';<br />
},<br />
'mouseleave': function(){<br />
this.href = '#';<br />
}<br />
});</code></p>
<p>Mootools documentation on Selectors utility is here: <a href="http://mootools.net/docs/core/Utilities/Selectors" target="_blank" onclick="pageTracker._trackPageview('/outgoing/mootools.net/docs/core/Utilities/Selectors?referer=');">http://mootools.net/docs/core/Utilities/Selectors</a></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Fadvanced-object-selection-using-mootools%2F';
  addthis_title  = 'Advanced+object+selection+using+Mootools';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-142-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/advanced-object-selection-using-mootools/',title:'Advanced object selection using Mootools',tweet:'Mootools&#8217; &#8220;Selectors&#8221; utility has some really strong feature. It really saves a lo',description:'Mootools&#8217; &#8220;Selectors&#8221; utility has some really strong feature. It really saves a lo'})"><script type='text/javascript'>document.getElementById("post-142-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/advanced-object-selection-using-mootools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mootools Basics</title>
		<link>http://rony.creash.com.bd/mootools-basics/</link>
		<comments>http://rony.creash.com.bd/mootools-basics/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 17:54:21 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=140</guid>
		<description><![CDATA[Mootools is a great JavaScript library and I feel really comfortable using it. There are lot other libraries, like JQuery, DoJo, ExtJS. They have their own features, but I feel strong with Mootools. ExtJs is really good, but very much heavyweight. On the other hand Mootools is really lightweight. Including all the core features, it [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Mootools" href="http://www.mootools.net" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.mootools.net?referer=');">Mootools</a> is a great JavaScript library and I feel really comfortable using it. There are lot other libraries, like <a href="http://jquery.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/jquery.com/?referer=');">JQuery</a>, <a href="http://www.dojotoolkit.org/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.dojotoolkit.org/?referer=');">DoJo</a>, <a href="http://www.extjs.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.extjs.com?referer=');">ExtJS</a>. They have their own features, but I feel strong with Mootools. ExtJs is really good, but very much heavyweight. On the other hand Mootools is really lightweight. Including all the core features, it is only around 64KB. Special effects may weight around 100KB more.</p>
<p>Most used function of Mootools is the $ function. Its a bit confusing with JQuery and that&#8217;s why conflicts with JQuery, if used on the same page. $ selects a dom element from the document by its id. The syntax is <em>$(&#8216;element_id&#8217;)</em>. There is another pretty good function that I like is $$ function. It selects elements by class name or tag etc. More on this functions are available at <a href="http://mootools.net/docs/core/Element/Element" target="_blank" onclick="pageTracker._trackPageview('/outgoing/mootools.net/docs/core/Element/Element?referer=');">Mootools documentation</a>.</p>
<p>Mootools <a href="http://mootools.net/docs/core/Request/Request" target="_blank" onclick="pageTracker._trackPageview('/outgoing/mootools.net/docs/core/Request/Request?referer=');">Request</a> feature is another great thing to have. This AJAX calling function is capable of sending AJAX request either in GET or POST method.</p>
<p>These are the basic functions one may need to develop a regular web application. There are also other common helper functions for Array, String, Number, Cookie etc. For detail idea about Mootools it is suggested to visit Mootools Documentation at: <a href="http://docs.mootools.net/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/docs.mootools.net/?referer=');">http://docs.mootools.net/</a></p>
<p>One thing to keep in mind. Whenever you are adding some JavaScript code on your documents HEAD, make sure it is inside a document onReady or onLoad function. Otherwise you&#8217;ll get stuck with JS errors. Most of the cases, the common mistake is like using the JS code to get an element at the HEAD, but the body is still loading&#8230; So the script couldn&#8217;t find the element and through error.</p>
<p>For Mootools, this onLoad wrapping syntax is like this:</p>
<p><code>window.addEvent('domready', function(){<br />
//Your Code Here<br />
});</code></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Fmootools-basics%2F';
  addthis_title  = 'Mootools+Basics';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-140-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/mootools-basics/',title:'Mootools Basics',tweet:'Mootools is a great JavaScript library and I feel really comfortable using it. There are lot other l',description:'Mootools is a great JavaScript library and I feel really comfortable using it. There are lot other l'})"><script type='text/javascript'>document.getElementById("post-140-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/mootools-basics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>একটি মৃত আত্মা</title>
		<link>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%bf-%e0%a6%ae%e0%a7%83%e0%a6%a4-%e0%a6%86%e0%a6%a4%e0%a7%8d%e0%a6%ae%e0%a6%be/</link>
		<comments>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%bf-%e0%a6%ae%e0%a7%83%e0%a6%a4-%e0%a6%86%e0%a6%a4%e0%a7%8d%e0%a6%ae%e0%a6%be/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 15:33:54 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=137</guid>
		<description><![CDATA[অফিস থেকে ফিরছিলাম। রোজকার মতই চরম বিরক্তি আর ক্লান্তি নিয়ে। বাস থেকে নেমে কোন রিকশা পাওয়া যায় না। হেঁটেই বাসা পর্যন্ত আসছিলাম। অন্ধকার, ভাঙ্গা ফুটপাথ মাড়িয়ে। হাঁটার ক্লান্তি দূর করার জন্য নিজের মধ্যেই মগ্ন হয়ে ছিলাম। কিন্তু হঠাৎ করেই সামনে কি যেন পড়ায় থমকে দাঁড়াতে হল। সেই ভাঙ্গা ফুটপাথের অন্ধকারেই একটা মানুষ। প্রায় উলংগ। শুয়ে [...]]]></description>
			<content:encoded><![CDATA[<p>অফিস থেকে ফিরছিলাম। রোজকার মতই চরম বিরক্তি আর ক্লান্তি নিয়ে। বাস থেকে নেমে কোন রিকশা পাওয়া যায় না। হেঁটেই বাসা পর্যন্ত আসছিলাম। অন্ধকার, ভাঙ্গা ফুটপাথ মাড়িয়ে। হাঁটার ক্লান্তি দূর করার জন্য নিজের মধ্যেই মগ্ন হয়ে ছিলাম। কিন্তু হঠাৎ করেই সামনে কি যেন পড়ায় থমকে দাঁড়াতে হল। সেই ভাঙ্গা ফুটপাথের অন্ধকারেই একটা মানুষ। প্রায় উলংগ। শুয়ে আছে। ঘুমিয়ে আছে?</p>
<p>বাস গুলো রাস্তায় পার্ক করা শুরু করার পর থেকে এই ফুটপাথটা খারাপ হয়ে গেছে। নেশাখোরদের আখড়া হয়ে গেছে। নিশ্চয়ই তেমন কেউ। মাত্রাতিরিক্ত নেশা করে বেহুঁশ হয়ে আছে। আমাদের এই ঘুনে ধরা দেশে এইসব নিয়ে মাথা ঘামানোর কিছুই নেই। পড়ে আছে, সকালে উঠে চলে যাবে। পড়ে থাকা শরীরটা ডিঙ্গিয়ে চলে আসলাম। কিন্তু তবুও কেন যেন মনে হল, মরে গেছে মানুষটা।</p>
<p>একবার ভাবলাম পুলিশ কে একটা ফোন করে দিলেই তো হয়। ওরাই যা করার করবে। তবু কেন যেন করলাম না।</p>
<p>সকালে অফিসে যাওয়ার সময় একই অবস্থায় পড়ে থাকতে দেখলাম লোকটাকে। তখনও ফোন করলাম না। কেন করলাম না? দায়িত্ব থেকে পালিয়ে গেলাম??</p>
<p>সত্যিই কি পালিয়ে যেতে পেরেছিলাম? সারাদিনই মনের মধ্যে একটা কিসের যেন খোঁচা লাগছিল! সন্ধ্যায় ফেরার পথে আবারও বাঁধা। এবার তার পাশে কয়েকজন পুলিশও আছে। জিজ্ঞেশ করে জানতে পারলাম, বেওয়ারিশ লাশ, তাই আঞ্জুমানের গাড়ির জন্য অপেক্ষা করছে। কেমন যেন একটা কষ্টবোধ ভেতরে। কেন কালই কোন ব্যবস্থা নিলাম না? তাহলে হয়ত মৃত মানুষটাকে দুইটা দিন রাস্তায় পড়ে থাকতে হত না।</p>
<p>আচ্ছা, এই মানুষটার জন্মের সময় কেউ কি ভাবতে পেরেছিল তার এমন পরিণতি হবে? তার মা হয়ত কত আদরেই না আগলে রাখত ছোট্ট বাচ্চাটাকে। তার জীবনের এত গুলো বছরে সে নিজে কি কখনো ভেবেছিল? আচ্ছা, কার উপর তার এত অভিমান ছিল যে নেশার হাতে নিজেকে সপে দিয়ে জীবনের এমন পরিণতি টেনে আনল? কিসের এত অভিমান ছিল তার?</p>
<p>তাকে যদি ঈশ্বর জিজ্ঞেশ করে কার প্রতি তোমার এত অভিমান? সেই তালিকায় আমার নামটাও কি থাকবে না? হয়ত সর্বশেষ নামটা হবে আমার। সে হয়ত অভিমান করে বলবে, সেদিন সন্ধ্যায়ই যদি কোন ব্যবস্থা নিতাম, তাহলে তার মৃতদেহটা নর্দমার পাশে দুই দিন পরে থাকত না।</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2F%25e0%25a6%258f%25e0%25a6%2595%25e0%25a6%259f%25e0%25a6%25bf-%25e0%25a6%25ae%25e0%25a7%2583%25e0%25a6%25a4-%25e0%25a6%2586%25e0%25a6%25a4%25e0%25a7%258d%25e0%25a6%25ae%25e0%25a6%25be%2F';
  addthis_title  = '%E0%A6%8F%E0%A6%95%E0%A6%9F%E0%A6%BF+%E0%A6%AE%E0%A7%83%E0%A6%A4+%E0%A6%86%E0%A6%A4%E0%A7%8D%E0%A6%AE%E0%A6%BE';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-137-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%bf-%e0%a6%ae%e0%a7%83%e0%a6%a4-%e0%a6%86%e0%a6%a4%e0%a7%8d%e0%a6%ae%e0%a6%be/',title:'একটি মৃত আত্মা',tweet:'অফিস থেকে ফিরছিলাম। রোজকার মতই চরম বি',description:'অফিস থেকে ফিরছিলাম। রোজকার মতই চরম বি'})"><script type='text/javascript'>document.getElementById("post-137-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%bf-%e0%a6%ae%e0%a7%83%e0%a6%a4-%e0%a6%86%e0%a6%a4%e0%a7%8d%e0%a6%ae%e0%a6%be/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>একটা সন্ধ্যা</title>
		<link>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%be-%e0%a6%b8%e0%a6%a8%e0%a7%8d%e0%a6%a7%e0%a7%8d%e0%a6%af%e0%a6%be/</link>
		<comments>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%be-%e0%a6%b8%e0%a6%a8%e0%a7%8d%e0%a6%a7%e0%a7%8d%e0%a6%af%e0%a6%be/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:30:28 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[??????]]></category>
		<category><![CDATA[???????]]></category>
		<category><![CDATA[Rain]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=125</guid>
		<description><![CDATA[অনেক দিন পর আজ বৃষ্টির সাথে দেখা। হঠাৎ করেই এসে সামনে হাজির। তার এমন অপরূপ রূপ বহুদিন হল দেখি না। আজকাল তার সাথে দেখাই হয় না। খবরই রাখিনা কখন এসে সে ফিরে চলে যায়। আসলেই অনেক বদলে গেছি আমি। তাইতো এত নিষ্ঠুর হতে পারি! তোমায় বলেছিলাম না, বৃষ্টি আমার প্রথম প্রেম। আমি তোমাকে বলেছিলাম, সে [...]]]></description>
			<content:encoded><![CDATA[<p>অনেক দিন পর আজ বৃষ্টির সাথে দেখা। হঠাৎ করেই এসে সামনে হাজির। তার এমন অপরূপ রূপ বহুদিন হল দেখি না। আজকাল তার সাথে দেখাই হয় না। খবরই রাখিনা কখন এসে সে ফিরে চলে যায়। আসলেই অনেক বদলে গেছি আমি। তাইতো এত নিষ্ঠুর হতে পারি! তোমায় বলেছিলাম না, বৃষ্টি আমার প্রথম প্রেম। আমি তোমাকে বলেছিলাম, সে আমাকে সবার চেয়ে বেশি ভালোবাসে।</p>
<p>হতে পারে অনেক নিষ্ঠুর হয়ে গেছি আমি। ভেতরটা পাথর হয়ে গেছে। কিন্তু তারপরও আজ যখন ওকে দেখলাম মনটা কেমন যেন করে উঠল। কেন বলতো? আমার তো বিচলিত হবার কথা না!! কিন্তু ওকে দেখেই ভেতরের ঘুমিয়ে থাকা পাগলটা যেন লাফিয়ে উঠল! এতদিনের সাধনায় পাগলটাকে ঘুম পাড়িয়েছিলাম!! কিন্তু ওর একটা ডাকেই সে জেগে উঠল!</p>
<p>জান? আজ অফিস থেকে বের হবার সাথে সাথেই ধুলি মেশানো দমকা বাতাসটা যখন ধাক্কা দিল, তখনই মনটা কেমন যেন করে উঠেছিল। সবকিছুই যেন ছিল একদম গোছানো! আজ আমার সাথে তার দেখা হবার জন্য!! গুলশান নেমে যখন রিকশাওয়ালাকে ভাংতির অভাবে ভাড়া দিতে পারছিলাম না, তখন একটুও বিরক্ত লাগেনি। নিজে থেকেই দোকানে গেলাম ভাংতি করতে!!! তুমি ভাবতে পারো? আমি ফুরফুরে মনে রিকশাওয়ালার জন্য টাকা ভাংতি করতে জাচ্ছি? যখন দোকানীটা টাকা গুনে দেওয়ার সময় গল্প করে আমার দেরি করিয়ে দিচ্ছিল, তখনো বিরক্ত হইনি! মজা করে তার গল্প শুনছিলাম! যেন কোনই তাড়া নেই আজ আমার!</p>
<p>তখনও কি জানতাম তার সাথে দেখা করিয়ে দেওয়ার জন্য এটা প্রকৃতির একটা সাজানো খেলা!! আচ্ছা, যদি জানতাম, তাহলে কি আমি পালিয়ে চলে আসতাম? কি করতাম আমি বল তো? তুমি তো আমাকে বেশ চেন।</p>
<p>রাস্তাটা পার হয়ে গুলশান মার্কেটের সামনে দাঁড়িয়েছি আর বৃষ্টির ডাক শুনতে পেলাম। প্রথমে বিশ্বাসই হতে চাচ্ছিল না! বৃষ্টি আমাকে ডাকছে? আমি ওকে এত অবহেলা করার পরেও? আর জানো, আমি না এবার উপেক্ষা করতে পারলাম না! হঠাৎ করেই পাগলটা জেগে উঠল। সামান্যতম চিন্তা করার সুযোগও আমাকে দিল না! ছুটে চলে গেল ওর কাছে।</p>
<p>তারপর অনেকটা পথ আজ হেঁটেছি ওর সাথে। কিন্তু জানো কার কথা ভাবছিলাম তখন? অবিশ্বাস্য!! আমি তোমার কথাই ভাবছিলাম!! কি নিষ্ঠুর রকমের ধোঁকাবাজ আমি! বৃষ্টির সাথে হাঁটছি আর ভাবছি তোমার কথা! কিন্তু কি করব বলো? সারাক্ষন মনে হচ্ছিল, এমন একটা সন্ধ্যা তুমি আমার কাছে অনেক চেয়েছ। কিন্তু না না অজুহাতে আমি তোমায় দেইনি। কিন্তু আজ বৃষ্টি একবার ডাকতেই ওকে দিয়ে দিলাম?</p>
<p>এর ঘন্টা খানেক পরে যখন কাঁপতে কাঁপতে বাসায় ঢুকলাম, তখনো তুমি মাথার ভিতরে। বৃষ্টির স্নিগ্ধ ছোঁয়া সারা গায়ে। কিন্তু তবুও অস্বস্তি&#8230; স্যান্ডেলটা পুরোনো হয়ে গেছে। রাস্তার কাঁদা পানিতে চপচপ করছে। তোমার দেওয়া নীল টি-শার্ট টায় হয়ত দাগ পরে যাবে। তোমার দেওয়া ব্যাগটা চুঁইয়ে পানি ধুকেছে ভেতরে। মোবাইলটা ভিজে গেছে। মাথাটা ব্যাথা করছে খুবই।</p>
<p>আচ্ছা বলতো তোমাকে এমন একটা সন্ধ্যা দিলে কি এমন ক্ষতি হত? আসলে এটাই হয়ত ভালোবাসা।</p>
<p>আমি তোমাকে বলেছিলাম, সে আমাকে সবার চেয়ে বেশি ভালোবাসে। তুমি বলেছিলে, না হতেই পারে না। বৃষ্টি তোমাকে সবচে বেশি ভালবাসে। তোমার কথাই ঠিক জানো? নাহলে সে আসলে শুধু তোমারই কথা কেন মনে করিয়ে দেয়?</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2F%25e0%25a6%258f%25e0%25a6%2595%25e0%25a6%259f%25e0%25a6%25be-%25e0%25a6%25b8%25e0%25a6%25a8%25e0%25a7%258d%25e0%25a6%25a7%25e0%25a7%258d%25e0%25a6%25af%25e0%25a6%25be%2F';
  addthis_title  = '%E0%A6%8F%E0%A6%95%E0%A6%9F%E0%A6%BE+%E0%A6%B8%E0%A6%A8%E0%A7%8D%E0%A6%A7%E0%A7%8D%E0%A6%AF%E0%A6%BE';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-125-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%be-%e0%a6%b8%e0%a6%a8%e0%a7%8d%e0%a6%a7%e0%a7%8d%e0%a6%af%e0%a6%be/',title:'একটা সন্ধ্যা',tweet:'অনেক দিন পর আজ বৃষ্টির সাথে দেখা। হঠাৎ',description:'অনেক দিন পর আজ বৃষ্টির সাথে দেখা। হঠাৎ'})"><script type='text/javascript'>document.getElementById("post-125-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/%e0%a6%8f%e0%a6%95%e0%a6%9f%e0%a6%be-%e0%a6%b8%e0%a6%a8%e0%a7%8d%e0%a6%a7%e0%a7%8d%e0%a6%af%e0%a6%be/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load Mesh from External File and Operation on It</title>
		<link>http://rony.creash.com.bd/load-mesh-from-external-file-and-operation-on-it/</link>
		<comments>http://rony.creash.com.bd/load-mesh-from-external-file-and-operation-on-it/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 23:16:52 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Mesh]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=100</guid>
		<description><![CDATA[What I did in this project is quite simple but a little out of the track. In this project I have all those regular graphical tasks like rotation, lightning, projection etc. But the main thing I did is to build a communication between DirectX, the platform I’ve used, and other graphics libraries and 3D modeling [...]]]></description>
			<content:encoded><![CDATA[<p>What I did in this project is quite simple but a little out of the track. In this project I have all those regular graphical tasks like rotation, lightning, projection etc. But the main thing I did is to build a communication between DirectX, the platform I’ve used, and other graphics libraries and 3D modeling software.</p>
<p>This is a well discussed and pretty advanced way of DirectX. I’ve just studied on it and found some way to implement. Nothing new I’ve proposed here, but learned a lot.</p>
<p>I’ve worked on popular DirectX file format &#8211; .x and rendered the graphics information from .x to the screen.</p>
<p>I’ve used Microsoft Visual C# as programming language.<span id="more-100"></span></p>
<p>I’ve become interested about this .x file format while I was thinking of modeling my bedroom in 3D. That seemed to me like an amazing project, but it was a bit complex and large scale. Then I found this bridge between renowned 3D modeling software and DirectX. It’s possible to make a 3D model of almost anything using those software (e.g. 3D Studio Max, Maya, Poser etc.) and then I can export that model in DirectX format.</p>
<p>Most of the 3D modeling software supports this format. For 3D Studio Max I’ve used “<em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">PandaDXExport</span></em>” plug-in.</p>
<p>I’d like to leave the discussion about the modeling process of 3D Studio Max or Maya to their own tutorials or documents. When I’ve been able to export the model in .x format, it’s now my job to extract the information from the file and display on screen.</p>
<p>First we need to know the format of X File.</p>
<p>Well, it’s not as hard like the unsolved case of FBI in the TV serial – X Files. It’s not even related. The .x file format is pretty simple. Some tag based information storing system. It is template-driven file format and is used by Direct3D Retained Mode to describe geometry data, frame hierarchies, and animations. In short, we store all information of a Mesh in an .x file.</p>
<p>Each file is lead by a header which contains the file format (e.g. text or binary), float length etc.</p>
<p>Then the templates are defined. Templates define how the data stream is interpreted—the data is modulated by the template definition.</p>
<p>Then data is defined. Data objects contain the actual data or a reference to that data. Each has a corresponding template that specifies the data type.</p>
<p>For more detail about .x file format, following website can be a good resource:</p>
<ul>
<li><!--[if !supportLists]--><em></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/</span></em></li>
</ul>
<p>Mesh can hold all the Material and Texture information you need to draw an object. As an example, we could again put our whole 3D city into one mesh, have it optimized and displayed.<a name="_Toc221302974"></a></p>
<p>While loading a file that stores Mesh, it would be too complex to call individual function for individual type of object. So I’ve built a generic Mesh loading function where the file name is passed as argument.<br />
<code>LoadMesh(string file_path, string   file_name)</code><br />
Then I have loaded the Mesh file using the LoadMesh() function of Direct3D.<br />
<code>this.m_Mesh = Mesh.FromFile(file_name,   MeshFlags.Managed, m_Device, out exmaterials)</code><br />
Then I have extracted the material and texture information in separate arrays with the following code:</p>
<p><code>for (int i = 0; i &lt;   exmaterials.Length; i++)<br />
{<br />
string   texture_file = exmaterials[i].TextureFilename;<br />
if   (texture_file != null)<br />
{<br />
if   (texture_file.Length &gt; 0)<br />
{<br />
try<br />
{<br />
m_Textures[i]   = TextureLoader.FromFile(m_Device, file_path + texture_file);<br />
}<br />
catch<br />
{<br />
MessageBox.Show("Error   loading texture " + texture_file, "Error");<br />
}<br />
}<br />
}<br />
this.m_Materials[i]   = exmaterials[i].Material3D;<br />
this.m_Materials[i].Ambient   = m_Materials[i].Diffuse;<br />
}</code></p>
<p>After this point I have all the material and texture information.</p>
<p>Now I have to draw the 3D object with the information I have in my hand. For this purpose, I have initialized the graphics earlier with the <span class="MsoSubtleEmphasis">InitializeGraphics()</span> function.</p>
<p><code>public bool InitializeGraphics()<br />
{<br />
PresentParameters parms = new PresentParameters();<br />
parms.Windowed = true;<br />
parms.SwapEffect = SwapEffect.Discard;<br />
parms.EnableAutoDepthStencil = true; // Depth stencil on.<br />
parms.AutoDepthStencilFormat = DepthFormat.D16;<br />
try<br />
{<br />
this.m_Device = new Device(0, DeviceType.Hardware, this.viewPort,<br />
CreateFlags.SoftwareVertexProcessing, parms);<br />
}<br />
catch<br />
{<br />
MessageBox.Show("Hardware initialization failed", "Exception");<br />
}<br />
// Turn on D3D lighting.<br />
m_Device.RenderState.Lighting = true;<br />
// Turn on the Z-buffer.<br />
m_Device.RenderState.ZBufferEnable = true;<br />
// Cull triangles that are oriented counter clockwise.<br />
m_Device.RenderState.CullMode = Cull.CounterClockwise;<br />
// Make points bigger so they're easy to see.<br />
m_Device.RenderState.PointSize = 4;<br />
// Start in solid mode.<br />
m_Device.RenderState.FillMode = FillMode.Solid;<br />
// Make the lights.<br />
SetupLights();<br />
return true;<br />
}</code></p>
<p>Then in the paint function, first I have to setup the world and view matrixes, setup the camera and the lights. I have done this inside the function: <span class="MsoSubtleEmphasis">SetupMatrices()</span>.</p>
<p>Inside the function, I have checked the user’s input and determined the rotation axes, camera position etc. The function definition of <span class="MsoSubtleEmphasis">SetupMatrices()</span> is like this:</p>
<p><code>private void SetupMatrices()<br />
{<br />
// World Matrix:<br />
const int TICKS_PER_REV = 10000;<br />
double angle = Environment.TickCount * (2 * Math.PI) / TICKS_PER_REV;<br />
switch (this.rotationAxes)<br />
{<br />
case 1: //X Axes<br />
this.m_Device.Transform.World = Matrix.RotationX((float)angle);<br />
break;<br />
case 2: //Y Axes<br />
this.m_Device.Transform.World = Matrix.RotationY((float)angle);<br />
break;<br />
case 3: //Z Axes<br />
this.m_Device.Transform.World = Matrix.RotationZ((float)angle);<br />
break;<br />
}<br />
// View Matrix:<br />
Vector3 camera_position = new Vector3(this.camXPos, this.camYPos, -20);<br />
camera_position.Normalize();<br />
camera_position.Multiply(this.m_Range);<br />
this.m_Device.Transform.View = Matrix.LookAtLH(<br />
camera_position,<br />
new Vector3(0, 0, 0),<br />
new Vector3(0, 1, 0));<br />
// Projection Matrix:<br />
this.m_Device.Transform.Projection =<br />
Matrix.PerspectiveFovLH((float)(Math.PI / 4), 1, 1, 100);<br />
}</code></p>
<p>And finally when all the setups are done, I draw all the Mesh and subsets from the .x file.<br />
<code><br />
// Draw the mesh's subsets.<br />
for (int i = 0; i &lt; this.m_NumSubSets; i++)<br />
{<br />
this.m_Device.Material = m_Materials[i];<br />
this.m_Device.SetTexture(0, m_Textures[i]);<br />
this.m_Mesh.DrawSubset(i);<br />
}</code></p>
<p>That’s all except for the last line inside the <span class="MsoSubtleEmphasis">OnPaint()</span> function.</p>
<p><code>this.Invalidate();</code></p>
<p>This line refreshes the viewport on each tick and displays the new object position.</p>
<p>That described the flow of my work – how I have processed the .x file and printed the 3D Mesh on the screen.</p>
<p>Except the above codes, I have some user input handling methods. I have handled input for zoom in/out, moving the camera about X axes and Y axes, changing the .X File on the go etc.</p>
<p>The project loads .X file and renders it perfectly. Only has some problem with animation template. There has to be some more complex handling. I could not do it here but wish to. I had developed a sample animation in 3D Studio Max and added the exported .X file (Truck.x) in the project. But it does not load properly.</p>
<p>I had the plan to develop a 3D model of my bedroom and display it, but could not finish processing all those images to develop a 3D view. As a sample I have added a 3D view of a lobby which I found on the internet.</p>
<p>The .X files I have used here are from Microsoft’s ® sample file and from internet. Some are exported from 3D Studio Max.</p>
<p><strong>Methods Used</strong></p>
<table class="MsoTableGrid" style="border: medium none ; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">public displayX()</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">The constructor. This initializes the form.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">public bool InitializeGraphics()</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Initializes graphics variables.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">public void LoadMesh(string file_path,   string file_name)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Loads the Mesh from file (.x file).</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">protected override void   OnPaint(System.Windows.Forms.PaintEventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">The paint method. Renders the object on   viewport.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void SetupMatrices()</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Sets up the matrices required for 3D   rendering.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void SetupLights()</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Sets up the lights.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void InitializeComponent()</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Initializes the form components like buttons,   combo boxes etc.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void   FillMode_CheckedChanged(object sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Method handles the change of fill mode. Three   options are available – filled, wire frame and point.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void zoomIn_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Handles the zoom in operation.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void zoomOut_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Handles the zoom out operation.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void xPlusButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Moves camera to the positive X axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void xMinusButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Moves camera to the negative X axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void yPlusButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Moves camera to the positive Y axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void yMinusButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Moves camera to the negative Y axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void   XFile_SelectedIndexChanged(object sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Handles the change of selected .x file and   loads the new Mesh from file on the go.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void dispalyX_Load(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">This method is called on the form load. This   lists all the available .x files and populates the combo box.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void xButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Changes the rotation axes according to the X   axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void yButton_Click(object   sender, EventArgs e) </span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Changes the rotation axes according to the Y   axes.</span></em></p>
</td>
</tr>
<tr>
<td style="padding: 0in 5.4pt; background: #92cddc none repeat scroll 0% 0%; width: 18.9pt;" width="25" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;">
</td>
<td style="padding: 0in 5.4pt; width: 1.75in;" width="168" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><span class="MsoSubtleEmphasis">private void zButton_Click(object   sender, EventArgs e)</span></p>
</td>
<td style="padding: 0in 5.4pt; width: 333.9pt;" width="445" valign="top">
<p style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">Changes the rotation axes according to the Z   axes.</span></em></p>
</td>
</tr>
</tbody>
</table>
<p><strong>The Code</strong></p>
<p>There are several files and a lot of code in them. Most are for initializing the forms and UI development. All the codes and project files are available inside the download archive. The main code file required to render Mesh from external .X file is display.cs file. Code is commented for better understanding.</p>
<p><strong>External Resources Used</strong></p>
<p>Plug-in to export .x from 3D Studio Max</p>
<ul>
<li>PandaDXExport4.6.62.0</li>
</ul>
<ul>
<li>Downloaded from Pandasoft (http://www.andytather.co.uk/Panda/directxmax.aspx).</li>
</ul>
<p><strong>References</strong></p>
<ul>
<li><!--[if !supportLists]--><!--[endif]-->Riemer’s XMA Tutorial</li>
</ul>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://www.riemers.net/eng/Tutorials/XNA/Csharp/series1.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.riemers.net/eng/Tutorials/XNA/Csharp/series1.php?referer=');">http://www.riemers.net/eng/Tutorials/XNA/Csharp/series1.php</a></span></em></p>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series2/tut5.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.riemers.net/eng/Tutorials/DirectX/Csharp/Series2/tut5.php?referer=');">http://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series2/tut5.php</a></span></em></p>
<ul>
<li><!--[if !supportLists]--><!--[endif]-->DirectX Format</li>
</ul>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/local.wasp.uwa.edu.au/_pbourke/dataformats/directx/?referer=');">http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/</a></span></em></p>
<ul>
<li><!--[if !supportLists]--><!--[endif]-->MSDN Forum</li>
</ul>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://forums.msdn.microsoft.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/forums.msdn.microsoft.com?referer=');">http://forums.msdn.microsoft.com</a></span></em></p>
<ul>
<li><!--[if !supportLists]--><!--[endif]-->DirectX Resources and Documentation</li>
</ul>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://msdn.microsoft.com/en-us/directx/bb896684.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/msdn.microsoft.com/en-us/directx/bb896684.aspx?referer=');">http://msdn.microsoft.com/en-us/directx/bb896684.aspx</a></span></em></p>
<p style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><em><span style="font-style: normal; font-family: &quot;Courier New&quot;;"><span>o<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; font-family: &quot;Times New Roman&quot;;"> </span></span></span></em><!--[endif]--><em><span style="font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;"><a href="http://msdn.microsoft.com/en-us/library/aa139763.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/msdn.microsoft.com/en-us/library/aa139763.aspx?referer=');">http://msdn.microsoft.com/en-us/library/aa139763.aspx</a></span></em></p>
<p style="margin-left: 1in; text-indent: -0.25in;">
<p style="text-align: left;"><strong>Screen Shot</strong></p>
<p style="text-align: center;" align="center"><img class="aligncenter size-medium wp-image-98" title="Screenshot" src="http://rony.creash.com.bd/wp-content/uploads/2009/02/untitled1-300x252.jpg" alt="" width="300" height="252" /></p>
<p style="text-align: center;" align="center">Displaying the airplane model from .x file</p>
<p style="text-align: left;"><strong>Downloads</strong></p>
<p style="text-align: left;">Download code and project files <a href="http://www.ziddu.com/download/3490696/GraphicsProject.rar.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.ziddu.com/download/3490696/GraphicsProject.rar.html?referer=');">here</a>.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Fload-mesh-from-external-file-and-operation-on-it%2F';
  addthis_title  = 'Load+Mesh+from+External+File+and+Operation+on+It';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-100-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/load-mesh-from-external-file-and-operation-on-it/',title:'Load Mesh from External File and Operation on It',tweet:'What I did in this project is quite simple but a little out of the track. In this project I have all',description:'What I did in this project is quite simple but a little out of the track. In this project I have all'})"><script type='text/javascript'>document.getElementById("post-100-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/load-mesh-from-external-file-and-operation-on-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ঘুমকুমার</title>
		<link>http://rony.creash.com.bd/%e0%a6%98%e0%a7%81%e0%a6%ae%e0%a6%95%e0%a7%81%e0%a6%ae%e0%a6%be%e0%a6%b0/</link>
		<comments>http://rony.creash.com.bd/%e0%a6%98%e0%a7%81%e0%a6%ae%e0%a6%95%e0%a7%81%e0%a6%ae%e0%a6%be%e0%a6%b0/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 20:11:04 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[???]]></category>
		<category><![CDATA[????????]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=91</guid>
		<description><![CDATA[ঘুমের জন্য অপেক্ষা&#8230;
ঘুম পাড়ানী মাসি পিসি
মোদের বাড়ি এসো,
খাট নাই পালঙ্ক নাই,
চোখ পেতে বসো।
বাটা ভরা পান দেবো
গাল ভরে খেও,
খোকার চোখে ঘুম নাই
ঘুম দিয়ে যেও।
&#8212;
খোকা ঘুমালো, পাড়া জুড়ালো
বর্গী এলো দেশে,
বুলবুলিতে ধান খেয়েছে
খাজনা দেব কিসে?
ধান ফুরালো, পান ফুরালো
খাজনার উপায় কি,
আর কটা দিন সবুর করো
রসুন বুনেছি।
&#8212;
So, খোকা খুকুরা, ঘুম বন্ধ।।  

  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2F%25e0%25a6%2598%25e0%25a7%2581%25e0%25a6%25ae%25e0%25a6%2595%25e0%25a7%2581%25e0%25a6%25ae%25e0%25a6%25be%25e0%25a6%25b0%2F';
 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>ঘুমের জন্য অপেক্ষা&#8230;</strong></p>
<p>ঘুম পাড়ানী মাসি পিসি</p>
<p>মোদের বাড়ি এসো,</p>
<p>খাট নাই পালঙ্ক নাই,</p>
<p>চোখ পেতে বসো।<span id="more-91"></span></p>
<p>বাটা ভরা পান দেবো</p>
<p>গাল ভরে খেও,</p>
<p>খোকার চোখে ঘুম নাই</p>
<p>ঘুম দিয়ে যেও।</p>
<p>&#8212;</p>
<p>খোকা ঘুমালো, পাড়া জুড়ালো</p>
<p>বর্গী এলো দেশে,</p>
<p>বুলবুলিতে ধান খেয়েছে</p>
<p>খাজনা দেব কিসে?</p>
<p>ধান ফুরালো, পান ফুরালো</p>
<p>খাজনার উপায় কি,</p>
<p>আর কটা দিন সবুর করো</p>
<p>রসুন বুনেছি।</p>
<p>&#8212;</p>
<p>So, খোকা খুকুরা, ঘুম বন্ধ।। <img src='http://rony.creash.com.bd/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2F%25e0%25a6%2598%25e0%25a7%2581%25e0%25a6%25ae%25e0%25a6%2595%25e0%25a7%2581%25e0%25a6%25ae%25e0%25a6%25be%25e0%25a6%25b0%2F';
  addthis_title  = '%E0%A6%98%E0%A7%81%E0%A6%AE%E0%A6%95%E0%A7%81%E0%A6%AE%E0%A6%BE%E0%A6%B0';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-91-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/%e0%a6%98%e0%a7%81%e0%a6%ae%e0%a6%95%e0%a7%81%e0%a6%ae%e0%a6%be%e0%a6%b0/',title:'ঘুমকুমার',tweet:'ঘুমের জন্য অপেক্ষা&#8230; ঘুম পাড়ানী মাসি ',description:'ঘুমের জন্য অপেক্ষা&#8230; ঘুম পাড়ানী মাসি '})"><script type='text/javascript'>document.getElementById("post-91-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/%e0%a6%98%e0%a7%81%e0%a6%ae%e0%a6%95%e0%a7%81%e0%a6%ae%e0%a6%be%e0%a6%b0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File upload/download on MySQL database</title>
		<link>http://rony.creash.com.bd/file-uploaddownload-on-mysql-database/</link>
		<comments>http://rony.creash.com.bd/file-uploaddownload-on-mysql-database/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 14:35:39 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=48</guid>
		<description><![CDATA[Well&#8230; It is already a well discussed topic. But when I was first trying to find out how to do this, I really got stuck. Actully it took me a lot of time to find out the key code segment for the purpose.
So, here is what I&#8217;ve learned:
The table:
Suppose the structure of the MySQL table [...]]]></description>
			<content:encoded><![CDATA[<p>Well&#8230; It is already a well discussed topic. But when I was first trying to find out how to do this, I really got stuck. Actully it took me a lot of time to find out the key code segment for the purpose.</p>
<p>So, here is what I&#8217;ve learned:</p>
<p><strong>The table:</strong></p>
<p>Suppose the structure of the MySQL table (say &#8216;<em>file_table</em>&#8216;) is like this:</p>
<p>It has three fileds:</p>
<ul>
<li><code>id : the primary key, integer type with auto increment feature.</code></li>
<li><code>content: the content of file, blob type.</code></li>
<li><code>type: varchar type, the type of the file (e.g. doc, pdf etc.).<br />
</code></li>
</ul>
<p><strong>Upload:</strong></p>
<p>I think you can create a HTML form with a input with file type. Its pretty simple. Just use this code to make a input field be able to upload file:</p>
<p><code>&lt;input id="file_upload" name="file_upload" type="file" /&gt;</code></p>
<p>Now the backend coding. I&#8217;m using PHP for this.<span id="more-48"></span></p>
<p>You can get the temp file name (the name server assigned to your uploaded file) using this:</p>
<p><code>$tmpName = $_FILES['file_upload']['tmp_name'];</code></p>
<p>Now following code segment reads the content of the file to a variable:</p>
<p><code>$fp = fopen($tmpName, 'r');<br />
$file_size =  filesize($tmpName);<br />
$content = fread($fp, $file_size);<br />
$content = addslashes($content);<br />
fclose($fp);</code><br />
<code><br />
if(!get_magic_quotes_gpc())<br />
{<br />
$fileName = addslashes($fileName);<br />
}</code></p>
<p>To get the file type, we use this segment of code:</p>
<p><code>$type = get_file_extension($tmpName);</code></p>
<p><code>function get_file_extension($str)<br />
{<br />
$i = strrpos($str,".");<br />
if (!$i) { return ""; }<br />
$l = strlen($str) - $i;<br />
$ext = substr($str,$i+1,$l);<br />
return $ext;<br />
}</code></p>
<p>Now use this query to insert the file to database:</p>
<p><code>$query = 'INSERT INTO file_table VALUES (" ' . $content . ' ", " ' . $type . ' ")';<br />
$result = @mysql_query($query) or die(mysql_error());</code></p>
<p>That&#8217;s it. We&#8217;ve uploaded our file to the database.</p>
<p><strong>Download:</strong></p>
<p>We&#8217;ve uploaded the file. Now we need to download it sometime. Thats not that hard actually.</p>
<p>We&#8217;ll follow these stpes:</p>
<ul>
<li>Get the id of desired file</li>
<li>Fetch the file from database on the basis of the id</li>
<li>Make the file ready for download</li>
</ul>
<p>Say, we get the id from URL. Then following code will make the file available for download:</p>
<p><code>$id    = $_GET['id'];<br />
$query = "SELECT content, type FROM file_table WHERE id = '$id' ";</code></p>
<p><code>$result = mysql_query($query) or die(mysql_error());<br />
list($file, $ftype) = mysql_fetch_array($result);</code></p>
<p><code>header("Content-length: $filesize");<br />
header("Content-type: $ftype");<br />
header("Content-Disposition: attachment; filename = FILENAME.$ftype");<br />
echo $file;</code></p>
<p>Here we set the header with the file information. Make sure, nothing else is printed on the page before the <em>header()</em> call. Otherwise it will show an error and terminate. You can place your desired file name at the place of &#8216;<em>FILENAME</em>&#8216;. Another thing is, connection with the database server is to be made before any database operation. I think you know the function:</p>
<p><code>mysql_connect();</code></p>
<p>If not can check this post: <a href="http://rony.creash.com.bd/?p=42#top3" target="_blank">Basic PHP</a></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Ffile-uploaddownload-on-mysql-database%2F';
  addthis_title  = 'File+upload%2Fdownload+on+MySQL+database';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-48-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/file-uploaddownload-on-mysql-database/',title:'File upload/download on MySQL database',tweet:'Well&#8230; It is already a well discussed topic. But when I was first trying to find out how to do ',description:'Well&#8230; It is already a well discussed topic. But when I was first trying to find out how to do '})"><script type='text/javascript'>document.getElementById("post-48-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/file-uploaddownload-on-mysql-database/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Transformer</title>
		<link>http://rony.creash.com.bd/transformer/</link>
		<comments>http://rony.creash.com.bd/transformer/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 20:10:35 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Transformer]]></category>

		<guid isPermaLink="false">http://rony.creash.com.bd/?p=60</guid>
		<description><![CDATA[Robotics is developing real fast&#8230;


  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Ftransformer%2F';
  addthis_title  = 'Transformer';
  addthis_pub    = 'norybabu';

document.getElementById("post-60-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Robotics is developing real fast&#8230;</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/STQ3nhXuuEM&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;fs=1" /><embed wmode="transparent" type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/STQ3nhXuuEM&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;fs=1" allowfullscreen="true"></embed></object></p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Frony.creash.com.bd%2Ftransformer%2F';
  addthis_title  = 'Transformer';
  addthis_pub    = 'norybabu';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
<img style='display:none' id="post-60-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://rony.creash.com.bd/transformer/',title:'Transformer',tweet:'Robotics is developing real fast&#8230;     addthis_url    = \'http%3A%2F%2Frony.creash.com.bd%2Ftran',description:'Robotics is developing real fast&#8230;     addthis_url    = \'http%3A%2F%2Frony.creash.com.bd%2Ftran'})"><script type='text/javascript'>document.getElementById("post-60-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://rony.creash.com.bd/transformer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
