<?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>@dtinth&#039;s Blog</title>
	<atom:link href="http://blog.dt.in.th/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dt.in.th</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 08 Sep 2010 15:51:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>You Can Distort Time. At Least in JavaScript.</title>
		<link>http://blog.dt.in.th/2010/09/time-distortion/</link>
		<comments>http://blog.dt.in.th/2010/09/time-distortion/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 15:37:58 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/?p=398</guid>
		<description><![CDATA[Tested on Firefox. Untested on other browsers. Couple of hours ago something crazy came to my head. I want to control the flow of time by manipulating the Date() constructor and see what&#8217;s gonna happen. So I wrote this code. This JavaScript code makes the Date() constructor slow down 4 times. For example, if I [...]]]></description>
			<content:encoded><![CDATA[<p>Tested on Firefox. Untested on other browsers. <img src='http://blog.dt.in.th/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>

<p>Couple of hours ago something crazy came to my head. I want to control the flow of time by manipulating the Date() constructor and see what&#8217;s gonna happen.</p>

<script src="http://gist.github.com/570289.js"></script>

<p>So I wrote this code. This JavaScript code makes the Date() constructor slow down 4 times.</p>

<p>For example, if I inject the JavaScript at 12:00 PM, then wait 4 minutes, and check the current time, it will say 12:01 PM. You get the point.</p>

<p>The setInterval and setTimeout function is also modified to be slower.</p>

<p>As a live example, I have included the script on this page too. All animations on this page will be 4 times slower! Compare it with the home page!</p>

<div><script type="text/javascript">(function() {
    
    var factor = 0.25;

    var _Date = Date;
    var _setTimeout = setTimeout;
    var _setInterval = setInterval;
    var start = new _Date().getTime();
    Date = function(a,b,c,d,e,f,g) {
        if (arguments.length == 0) {
            return new _Date(start + (new _Date().getTime() - start) * factor);
        }
        return _Date(a,b,c,d,e,f,g);
    };
    setTimeout = function(x, y) {
        return _setTimeout.call(window, x, y / factor);
    };
    setInterval = function(x, y) {
        return _setInterval.call(window, x, y / factor);
    };

})();</script></div>

<p>You can also have the <a href="javascript:(function () {var factor = 0.25;var _Date = Date;var _setTimeout = setTimeout;var _setInterval = setInterval;var start = (new _Date).getTime();Date = function (a, b, c, d, e, f, g) {if (arguments.length == 0) {return new _Date(start + ((new _Date).getTime() - start) * factor);}return _Date(a, b, c, d, e, f, g);};setTimeout = function (x, y) {return _setTimeout.call(window, x, y / factor);};setInterval = function (x, y) {return _setInterval.call(window, x, y / factor);};})();">slow down</a> bookmarklet.</p>

<p>Try it! Drag the bookmarklet to the bookmarks bar, and then go to some site with animation effects (for example, <a href="http://jquery.com/">http://jquery.com/</a>) and activate it. You will see that all the animations in the page will be 4x slower.</p>

<p>The bookmarklet will not work with some websites or JavaScript frameworks that keeps the original Date constructor and use it, but as far as I know, jQuery always use the Date constructor currently present in <code>window</code>.</p>

<p>This bookmarklet will not work with CSS transitions.</p>

<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>

<p>I&#8217;ll see if I can do something fun with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/09/time-distortion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prism webapp.js scripting: Making load() fire every page load.</title>
		<link>http://blog.dt.in.th/2010/09/prism-load/</link>
		<comments>http://blog.dt.in.th/2010/09/prism-load/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:13:17 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[thaiWitter]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/?p=393</guid>
		<description><![CDATA[As a plan for thaiWitter&#8217;s new style client request, I have finally found a way to go, which is by using Prism&#8217;s &#8220;webapp.js&#8220;. It has convenient function load(), which is fired &#8220;after the main application windows has finished loading. The window object has been initialized and can be used.&#8221; So, when thaiWitter loads, the script [...]]]></description>
			<content:encoded><![CDATA[<p>As a plan for thaiWitter&#8217;s new style client request, I have finally found a way to go, which is by using Prism&#8217;s &#8220;<a href="https://developer.mozilla.org/en/Prism/Scripting">webapp.js</a>&#8220;.</p>

<p>It has convenient function load(), which is fired &#8220;after the main application windows has finished loading. The window object has been initialized and can be used.&#8221;</p>

<p>So, when thaiWitter loads, the script will inject a function that lets thaiWitter perform a request to Twitter&#8217;s API directly.</p>

<p>Now here&#8217;s the problem. The load() function fires for only one time, the first time it&#8217;s loaded. If the user has reloaded the page again (for example, via the clear button), then the load() function won&#8217;t fire and I can&#8217;t inject an function into the document.</p>

<p>Luckily I found a way around this, but this involves hacking the Prism window.</p>

<script src="http://gist.github.com/563916.js"></script>

<p>Because the host window is not exposed to the webapp script, we have to search for it manually. So, starting from Line 8, this script loops through each open window, and performs a simple check to see if it is the window we want.</p>

<p>Because content window is exposed to the webapp script, we can check the content frame of the current window and see if it&#8217;s &#8220;contentWindow&#8221; is the same as &#8220;window&#8221; that is exposed to the webapp script.</p>

<p>Then we set the _firstLoad flag to &#8220;true&#8221;. This tricks Prism into believing that the content is loaded for the first time in the next time the content is loaded, so Prism will fire load() every page load.</p>

<p><strong>Update:</strong> Too bad this one only works for the first and only first window opened in Prism application. Maybe I really need to write an extension to Prism and then release #thaiWitter with different packages for each platform. Did not sound like a good idea right? Other choices? Don&#8217;t think so. T_T</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/09/prism-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New way of making API requests in thaiWitter</title>
		<link>http://blog.dt.in.th/2010/08/thaiwitter-client-plan/</link>
		<comments>http://blog.dt.in.th/2010/08/thaiwitter-client-plan/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 10:33:26 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[thaiWitter]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/?p=389</guid>
		<description><![CDATA[Right now, the main thaiWitter server is making more than 10,000 API requests per day, which means the server requests to the API every 8 seconds. The workflow is like this: The client needs some information. The client requests that information from the server. The server creates a OAuth request based on client&#8217;s request and [...]]]></description>
			<content:encoded><![CDATA[<p>Right now, the main thaiWitter server is making more than 10,000 API requests per day, which means the server requests to the API every 8 seconds. The workflow is like this:</p>

<ol>
<li>The client needs some information.</li>
<li>The client requests that information from the server.</li>
<li>The server creates a OAuth request based on client&#8217;s request and signs it.</li>
<li>The server sends the signed OAuth request to Twitter API.</li>
<li>Twitter responds with the information.</li>
<li>The server passes that information back to the client.</li>
<li>The client process the information from the server.</li>
</ol>

<p>So, this happens every 8 seconds, which is so much work for the server. I am planning to change this a bit:</p>

<ol>
<li>The client needs some information.</li>
<li>The client requests that information from the server.</li>
<li>The server creates a OAuth request based on client&#8217;s request and signs it.</li>
<li>The server sends the signed OAuth request <strong>back to the client</strong>.</li>
<li>The <strong>client</strong> sends the signed OAuth request to Twitter API.</li>
<li>Twitter responds with the information.</li>
<li>The client process the information from the <strong>Twitter API</strong>.</li>
</ol>

<p>So as you see, the server&#8217;s work is done at step 4, then the client will contact Twitter&#8217;s API directly.
However, this is impossible without an extension, because this needs cross-domain XMLHttpRequest.</p>

<p>Right now I am researching on how to accomplish this. More on this later.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/08/thaiwitter-client-plan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Userscript: Drag and Drop Upload for upic.me, making of</title>
		<link>http://blog.dt.in.th/2010/08/upic-dragdrop-upload/</link>
		<comments>http://blog.dt.in.th/2010/08/upic-dragdrop-upload/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 03:45:59 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[I have just seen upic.me&#8217;s new style. It looks really nice. At the same moment, I feel that it would be nice to be able to drag and drop pictures from my computer to upload that picture. I knew it was possible because I have seen this. So I started coding and here&#8217;s the result: [...]]]></description>
			<content:encoded><![CDATA[<p>I have just seen upic.me&#8217;s new style. It looks really nice. At the same moment, I feel that it would be nice to be able to drag and drop pictures from my computer to upload that picture. I knew it was possible because <a href="http://hacks.mozilla.org/2010/02/an-html5-offline-image-editor-and-uploader-application/">I have seen this</a>. So I started coding and here&#8217;s the result:</p>

<p class="center"><a href="http://userscripts.org/scripts/show/83671"><strong>upic.me Drag and Drop Upload</strong></a></p>

<p>After installing this userscript, try going to <a href="http://upic.me/">http://upic.me/</a>. The box should say &#8220;drop here to upload picture&#8221; instead of &#8220;click there to upload picture.&#8221; Try draging some pictures from your computer and drop it on the website. The image you dragged should upload right away.</p>

<p>This best thing about this is it handles file uploading by itself. It does not require Flash at all.</p>

<p>If you want to implement this on your own userscript or your website, feel free to copy it from my code. You should also read this to learn how to setup drop boxes: <a href="https://developer.mozilla.org/en/using_files_from_web_applications#Selecting_files_using_drag_and_drop">Using files from web applications#Selecting files using drag and drop</a>.</p>

<p>The uploading part is the one of the hardest parts. That is because you need to create the POST request payload by yourself.</p>

<p>To do this, first, you can just set up XMLHttpRequest normally.</p>

<pre><code>    var xhr = new XMLHttpRequest();
    xhr.open ('POST', '/upload.php');
    xhr.onreadystatechange = function() {
        // ...
    };
</code></pre>

<p>Then make a progress listener if you want to keep track of the progress.</p>

<pre><code>    xhr.upload.addEventListener ('progress', function(e) {
        if (e.lengthComputable) {
            // e.loaded = amount of data sent
            // e.total = total amount of data
        }
    }, false);
</code></pre>

<p>Now we need to prepare the payload the boundaries.</p>

<pre><code>    var payload = '';
    var boundary = '---------------------------53748593789457348248012312';
</code></pre>

<p>So I made this 2 utility functions that will help you.</p>

<p>The first function adds a normal field data to the payload. You will use this for normal form input fields, such as hidden or text input.</p>

<p>The second function receives a <a href="https://developer.mozilla.org/en/DOM/File">HTML5 File</a> object and adds it to the payload.</p>

<pre><code>    function addFormField(name, value) {
        payload += '\r\nContent-Disposition: form-data; name="' + name + '"\r\n\r\n' + value + '\r\n--' + boundary;
    }
    function addFile(name, fileName, file) {
        payload += '\r\nContent-Disposition: form-data; name="' + name + '"; filename="' + fileName + '"\r\nContent-Type: ' + file.type + '\r\n\r\n' + file.getAsBinary() + '\r\n--' + boundary;
    }
</code></pre>

<p>So after you prepare the payload using these 2 functions, now we have a huge string of data waiting to be sent to the server, so now let&#8217;s upload it!</p>

<pre><code>    xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary);
    xhr.setRequestHeader("Content-Length", payload.length);
    xhr.sendAsBinary (payload);
</code></pre>

<p>If you want, you can also <a href="http://userscripts.org/scripts/review/83671">see the source code of my userscript</a>. That&#8217;s it for today&#8217;s blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/08/upic-dragdrop-upload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TNK Grid</title>
		<link>http://blog.dt.in.th/2010/08/tnkgrid/</link>
		<comments>http://blog.dt.in.th/2010/08/tnkgrid/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 04:32:06 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[DJMAX Technika]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[First of all, Browser support: Firefox Operating system support: Linux and Mac (I&#8217;m sorry Windows users) This is a little bookmarklet for DJMAX TECHNIKA players (who uses Linux or Mac). It displays a grid line overlaying the web page. It can help you time the notes, so that when you play, you know exactly when [...]]]></description>
			<content:encoded><![CDATA[<p>First of all,</p>

<ul>
<li><strong>Browser support:</strong> Firefox</li>
<li><strong>Operating system support:</strong> Linux and Mac (I&#8217;m sorry Windows users)</li>
</ul>

<p>This is a little bookmarklet for DJMAX TECHNIKA players (who uses Linux or Mac). It displays a grid line overlaying the web page. It can help you time the notes, so that when you play, you know exactly when to activate that note, because now you know where exactly the note is.</p>

<p class="center">Suppose you are watching a video of DJMAX TECHNIKA on YouTube.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 841px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-08/13-1106.png" style="border: 0; display: block; margin: 0 auto;" width="791" height="686" alt=""></span></span></span></span></span>
</div>

<p class="center">You just click on the bookmarklet, and you see a gridline in front of you. You drag the handles of the gridline to fit it on the YouTube video.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 841px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-08/13-1111.png" style="border: 0; display: block; margin: 0 auto;" width="791" height="686" alt=""></span></span></span></span></span>
</div>

<p class="center">You can then see how the notes are timed.</p>

<p>In the above picture, thick line represents a &#8220;beat&#8221; in the song, while thin line represents a &#8220;step&#8221; or &#8220;1/4 beat&#8221; in the song.</p>

<p>Note that in DJMAX TECHNIKA, the curvy dragging notes seems to be shifted slightly toward. It&#8217;s not really related to this, so see this <a href="http://www.sicomonline.com/forum/index.php?topic=7556.0">discussion on activation of different types of note in DJMAX Technika</a> for more information on it.</p>

<p><strong>Get TNK Grid:</strong> <a href="http://blog.dt.in.th/stuff/tnkgrid.html">Click here to install TNK grid</a>.</p>

<p>On that page, drag the blue link to your bookmarks toolbar. If you don&#8217;t see a link labelled &#8220;TNK Grid 2,&#8221; then you need a better browser.</p>

<p>To use, click on the &#8220;TNK Grid 2&#8243; item on your bookmarks toolbar, you will see a grid. Drag the handles (the borders) of it to size it according to the video.</p>

<p>You can click on the gridlines to switch the direction of that grid. This makes it possible to see the timing of videos with &#8220;left swipe&#8221;, &#8220;right swipe&#8221; or &#8220;reverse swipe&#8221; effect added.</p>

<p class="center">By the way, it also works with TECHNIKA 2!</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 621px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-08/13-1123.png" style="border: 0; display: block; margin: 0 auto;" width="571" height="324" alt=""></span></span></span></span></span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/08/tnkgrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Script: Share This Folder</title>
		<link>http://blog.dt.in.th/2010/07/sharethisfolder/</link>
		<comments>http://blog.dt.in.th/2010/07/sharethisfolder/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 15:34:36 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[I&#8217;m on my Ubuntu PC, and wants to send files to someone using Windows. That computer doesn&#8217;t have WinSCP or FTP client installed, so I thought of a way of sending them all files in a certain folder. I came up with this: sharethisfolder.py When you run this Python script, it will generate and give [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on my Ubuntu PC, and wants to send files to someone using Windows. That computer doesn&#8217;t have WinSCP or FTP client installed, so I thought of a way of sending them all files in a certain folder.</p>

<p>I came up with this: sharethisfolder.py</p>

<script src="http://gist.github.com/489633.js"></script>

<p>When you run this Python script, it will generate and give you a random code.</p>

<pre><code>dttvb@the-dttvb:~/Desktop/Samples$ python ~/sharethisfolder.py
:60506/754312
</code></pre>

<p>You have to prefix this code with <code>http://</code> and your IP. For example, I can give this to another person:</p>

<pre><code>http://124.120.114.110:60506/754312
</code></pre>

<p>When they open it, the python script will <strong><code>zip</code></strong> everything inside the <strong>current working directory</strong> and send it to another person on-the-fly.</p>

<p>And when that another person is finished downloading these files, then you can just press Ctrl+C to shut down the server.</p>

<p>Limitations:</p>

<ul>
<li>Because the zip file is generated on the fly, we don&#8217;t know how big will it be. The downloader will not see the file progress.</li>
<li>You can share only 1 folder at a time.</li>
</ul>

<p>Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/07/sharethisfolder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpQuery makes scraping a hell lot easier.</title>
		<link>http://blog.dt.in.th/2010/07/phpquery-scraping/</link>
		<comments>http://blog.dt.in.th/2010/07/phpquery-scraping/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 15:37:11 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[phpQuery is a PHP port of jQuery, so if you know how to use jQuery and PHP, you can easily use phpQuery. It&#8217;s really awesome. You just need to see it: http://code.google.com/p/phpquery/ I am using phpQuery for my DJMAX TECHNIKA Score Tracker&#8216;s backend code which fetchs the score from Platinum Crew&#8217;s website and puts it [...]]]></description>
			<content:encoded><![CDATA[<p>phpQuery is a PHP port of jQuery, so if you know how to use jQuery and PHP, you can easily use phpQuery. It&#8217;s really awesome.</p>

<p>You just need to see it: <strong><a href="http://code.google.com/p/phpquery/">http://code.google.com/p/phpquery/</a></strong></p>

<p>I am using phpQuery for my <a href="http://tnk.dt.in.th/">DJMAX TECHNIKA Score Tracker</a>&#8216;s backend code which fetchs the score from Platinum Crew&#8217;s website and puts it in MySQL table every 4 hours, which is then used by the frontend. It also uses the <a href="http://www.sicomonline.com/forum/index.php?topic=6143.0">DJMAX Technika API</a> (Thailand only <img src='http://blog.dt.in.th/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) to fetch some data instead of scraping in order to save bandwidth.</p>

<p>I made a simple utility function that makes scraping tabular data from web pages a lot easier.</p>

<script src="http://gist.github.com/480475.js?file=parsedoc.php"></script>

<p>All you need to do is throw in a selector for each column on that page. Just make sure that the selector for each column yields the same number of matching element, and then the function uses a parser function, which you define, to take that element and turn it into value.</p>

<p>You can find the selector for the column you want easily using <a href="http://www.selectorgadget.com/">SelectorGadget</a>.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <a href="http://tnk.dt.in.th/blog-data/2010-07/18-2231.png"><span class="corner1" style="width: 605px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/555x384/2010-07/18-2231.png" style="border: 0; display: block; margin: 0 auto;" width="555" height="384" alt=""></span></span></span></span></span></a>
</div>

<p>For example, the following code scans the <a href="http://www.djmax.in.th/technika/rankDJTitle.asp">DJ Title Rank</a> page from Platinum Crew (Thailand)&#8217;s website for top 15 DJs.</p>

<script src="http://gist.github.com/480475.js?file=test-phpquery.php"></script>

<p>Note that the callback function that I use is a class member of the PCParser class. That&#8217;s why you see the callback function in arrays. Now here&#8217;s the output.</p>

<script src="http://gist.github.com/480475.js?file=output.txt"></script>

<p>It works like a charm. Whenever the website&#8217;s design is updated or changed, I just update these selectors (using SelectorGadget gives me the selector in less than one minute) and everything works again.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/07/phpquery-scraping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Userscript: Yahoo! Answers Untruncate</title>
		<link>http://blog.dt.in.th/2010/06/yahoo-answers-untruncate/</link>
		<comments>http://blog.dt.in.th/2010/06/yahoo-answers-untruncate/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 14:13:40 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[If you usually answer programming questions in Yahoo! Answers, you will see that most of the time, the code is not unreadable. One reason is that indentations are not preserved, and sometimes very long text will be truncated. For example, here&#8217;s one programming question: As you see, some code is truncated. My userscript works by [...]]]></description>
			<content:encoded><![CDATA[<p>If you usually answer programming questions in Yahoo! Answers, you will see that most of the time, the code is not unreadable. One reason is that indentations are not preserved, and sometimes very long text will be truncated. For example, here&#8217;s one programming question:</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 679px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/30-2101.png" style="border: 0; display: block; margin: 0 auto;" width="629" height="606" alt=""></span></span></span></span></span>
</div>

<p>As you see, some code is truncated. My userscript works by contacting <a href="http://developer.yahoo.com/answers/">Yahoo! Answers&#8217; API</a> to fetch the original question text as inputted by user and displays it instead of the built in one. Because of this, the question text is shown without truncating. Also, multiple spaces, tabs, and indentations are preserved. Here&#8217;s how it will look like after you install my userscript:</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 679px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/30-2103.png" style="border: 0; display: block; margin: 0 auto;" width="629" height="606" alt=""></span></span></span></span></span>
</div>

<p>http://userscripts.org/scripts/show/80368</p>

<p>However, this userscript only works with the question text, and will not work with the answers text, because I can&#8217;t find a good way of determining the order of the answer that is shown in the page. Another reason is that I assume that you can use one of the paste bin sites to paste your code.</p>

<p><strong>Get this userscript: <a href="http://userscripts.org/scripts/show/80368">http://userscripts.org/scripts/show/80368</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/06/yahoo-answers-untruncate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Facebook Account Was Blocked</title>
		<link>http://blog.dt.in.th/2010/06/facebook-account-blocked/</link>
		<comments>http://blog.dt.in.th/2010/06/facebook-account-blocked/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 15:21:49 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[Random Stuff]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[I am at school and I want to sign in to Facebook chat from my mobile phone. It is a Nokia 5630. I downloaded eBuddy Mobile from the Ovi Store, but as soon as I sign in to Facebook, it says &#8220;wrong username/password.&#8221; So I opened up Opera Mobile to sign in to Facebook, but [...]]]></description>
			<content:encoded><![CDATA[<p>I am at school and I want to sign in to Facebook chat from my mobile phone. It is a Nokia 5630. I downloaded <strong>eBuddy Mobile</strong> from the Ovi Store, but as soon as I sign in to Facebook, it says &#8220;wrong username/password.&#8221;</p>

<p class="center">So I opened up Opera Mobile to sign in to Facebook, but it says:</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-1243.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p>So maybe it&#8217;s eBuddy&#8217;s server accessing my Facebook account, so I just continue. The next step is pretty easy: confirm using my mobile phone.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-1246.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p class="center">I waited for more than 10 minutes, and no single SMS, so I left the fields blank and confirm the code. I tried this several times, but no SMS sent. I kept retrying.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-1248.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p class="center">&#8230;until Facebook sends me to this screen:</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-1250.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p>That looks very fun and exciting. I mean, it is just like a game. If I can remember people&#8217;s face correctly then I can get my account back. So I pressed Start and then Facebook starts showing me pictures of my friends:</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-1252.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p>Well, A Technika screen? I never have a friend as a Technika screen. I have seen many Technika screens before and they all look the same. I don&#8217;t even know their name, so who could this be? I have no other choices. I need to skip this question to get my Facebook account back.</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-2010.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p class="center">Now a Facebook logo? Seriously what the fuck is this? I only have 2 skips, and again, I need to use it.</p>

<p class="center">Then I see a photo where I can recognize the face, but&#8230;</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <span class="corner1" style="width: 290px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/2010-06/18-2104.png" style="border: 0; display: block; margin: 0 auto;" width="240" height="320" alt=""></span></span></span></span></span>
</div>

<p class="center">&#8230;.but look at these names! How can I know which name to choose? I also run out of skips. So I failed the tests, however, it&#8217;s good that I have unlimited retries. Just sign out and sign in again.</p>

<p>I keep retrying until I can get pass through it. It appears that eBuddy&#8217;s server accessed my account and Facebook never see me using eBuddy, so Facebook locked my account.</p>

<p>Now that my account was unlocked, I tried again, and then access to my account is blocked again and I have to through all the steps again. I forgot that eBuddy have many servers around the world. When I sign in the second time, it is from another server. I will never try it again. I will just stick with Nimbuzz. <img src='http://blog.dt.in.th/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<p>Total time wasted: <strong>around 2 hours</strong>.</p>

<p>From my experience with Facebook, combined with what happened to me today, <strong>I see these things very annoying on Facebook</strong>:</p>

<h2>Tagging People Who Has Nothing To Do With A Photo</h2>

<p>I <strong>always</strong> remove my tag from photos that I am not in. I recommend that you do it too.</p>

<p>Usually when people want to share a photo with their friends, they tag their friends in this photo. To me it seems not right. I think that it&#8217;s best to tag people in a photo if he/she is <strong>actually in the photo.</strong></p>

<p>So how to share your photo with your friends? I think that the best way to use the share feature in Facebook. To share it with all your friends, just click &#8220;share&#8221; on the sidebar and post it to profile.</p>

<p>Want to share it with only a number of friends? Click &#8220;share&#8221; on the sidebar, and then click on &#8220;send as a message instead.&#8221; You can then choose who to send to.</p>

<h2>Using An Alias For Their Name On Facebook</h2>

<p>Most of the time I will <strong>never</strong> accept friend requests from people who don&#8217;t use a real name. This is just my personal opinion. I am just annoyed.</p>

<p>On Windows Live Messenger, I can assign a personal alias to their contacts on their contact list, so I will know who is who. However on Facebook I can&#8217;t.</p>

<p>To me, Facebook is different from other social networks. Unlike Twitter or Windows Live Messenger, I think that Facebook is where I can get in touch with people I already know and I will only be friends with people I already know. For Twitter and Windows Live Messenger that I use to chat and meet random people.</p>

<p>So&#8230; that&#8217;s all for this blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/06/facebook-account-blocked/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Poem Remembering WIN</title>
		<link>http://blog.dt.in.th/2010/06/poemwin/</link>
		<comments>http://blog.dt.in.th/2010/06/poemwin/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 14:09:09 +0000</pubDate>
		<dc:creator>the DtTvB</dc:creator>
				<category><![CDATA[Random Stuff]]></category>

		<guid isPermaLink="false">http://blog.dt.in.th/.html</guid>
		<description><![CDATA[&#160; Sometimes the most dangerous place is the safest place! บางที ที่ที่อันตรายที่สุดก็อาจจะเป็นที่ที่ปลอดภัยที่สุด&#8230; Explaination: The picture above is of Thai language class, where everyone needs to remember a 20-line poem, and say it aloud to the teacher without reading it (or let the teacher see that you are reading it).]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>

<p class="center">Sometimes the most dangerous place is the safest place!</p>

<div class="content-image" style="padding-bottom: 1em; text-align: center">
    <a href="http://tnk.dt.in.th/blog-data/2010-06/04-2102.jpg"><span class="corner1" style="width: 770px"><span class="corner2"><span class="corner3"><span class="corner4"><span class="corner5"><img src="http://tnk.dt.in.th/blog-data/720x540/2010-06/04-2102.jpg" style="border: 0; display: block; margin: 0 auto;" width="720" height="540" alt=""><span class="image-caption">บางที ที่ที่อันตรายที่สุดก็อาจจะเป็นที่ที่ปลอดภัยที่สุด&#8230;</span></span></span></span></span></span></a>
</div>

<p>Explaination: The picture above is of Thai language class, where everyone needs to remember a 20-line poem, and say it aloud to the teacher without reading it (or let the teacher see that you are reading it).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dt.in.th/2010/06/poemwin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
