<?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>Jiramot.info</title>
	<atom:link href="http://www.jiramot.info/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jiramot.info</link>
	<description>me?.note.each{ println it }</description>
	<lastBuildDate>Wed, 10 Mar 2010 11:25:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Determining if a Date is a Weekday in T-SQL</title>
		<link>http://www.jiramot.info/determining-if-a-date-is-a-weekday-in-t-sql</link>
		<comments>http://www.jiramot.info/determining-if-a-date-is-a-weekday-in-t-sql#comments</comments>
		<pubDate>Wed, 10 Mar 2010 11:25:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=508</guid>
		<description><![CDATA[
create function fn_IsWeekDay
(
    @date datetime
)
returns bit
as
begin 

    declare @dtfirst int
    declare @dtweek int
    declare @iswkday bit 

    set @dtfirst = @@datefirst - 1
    set @dtweek = datepart(weekday, @date) - 1

    if (@dtfirst + @dtweek) [...]]]></description>
			<content:encoded><![CDATA[<pre>
create function fn_IsWeekDay
(
    @date datetime
)
returns bit
as
begin 

    declare @dtfirst int
    declare @dtweek int
    declare @iswkday bit 

    set @dtfirst = @@datefirst - 1
    set @dtweek = datepart(weekday, @date) - 1

    if (@dtfirst + @dtweek) % 7 not in (5, 6)
        set @iswkday = 1 --business day
    else
        set @iswkday = 0 --weekend

    return @iswkday
end
</pre>
<p>source <a href="http://ryanfarley.com/blog/archive/2005/02/14/1685.aspx">http://ryanfarley.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/determining-if-a-date-is-a-weekday-in-t-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking Java ClassLoader</title>
		<link>http://www.jiramot.info/hacking-java-classloader</link>
		<comments>http://www.jiramot.info/hacking-java-classloader#comments</comments>
		<pubDate>Wed, 10 Feb 2010 04:15:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=505</guid>
		<description><![CDATA[เนื่องจากว่าการทำงานส่วนมาก ต้องเขียน Business Logic ที่ Store Procedure ใน MS-SQL ทำให้เกิดความลำบากกับการทำ version ของโค๊ดเป็นอย่างมาก เลยอยากจะเขียน Script สั่นๆสักตัวเพื่อดูด Store Procedure มาเก็บเป้นไฟล์ให้ แล้วเราจะได้ดูสิ่งที่ต่างกัน (Diff) และเก็บลง SVN Server ส่วนตัว (ที่ทำงานใช้ CVS ซึ่งไม่ชอบเอาซะเลย)
ก็เลยกะว่างานนี้เขียนสั่นๆ เอา Groovy ดีกว่า ก็เลยเริ่มจาก start groovy console (run&#62;cmd&#62;groovyConsole ) จากนั้นก็เริ่มเขียน code
ทันใดนั้นนึงขึ้นมาได้ว่า กูจะ add jar ยังไงว่ะ ไม่ได้ start เป็น project เอ้ หรือว่า จะไปสร้าง classpath ยังไงละเนี่ย ก็เลยลองไปหาว่าเจ้า Groovy Console มันจะ [...]]]></description>
			<content:encoded><![CDATA[<p>เนื่องจากว่าการทำงานส่วนมาก ต้องเขียน Business Logic ที่ Store Procedure ใน MS-SQL ทำให้เกิดความลำบากกับการทำ version ของโค๊ดเป็นอย่างมาก เลยอยากจะเขียน Script สั่นๆสักตัวเพื่อดูด Store Procedure มาเก็บเป้นไฟล์ให้ แล้วเราจะได้ดูสิ่งที่ต่างกัน (Diff) และเก็บลง SVN Server ส่วนตัว (ที่ทำงานใช้ CVS ซึ่งไม่ชอบเอาซะเลย)</p>
<p>ก็เลยกะว่างานนี้เขียนสั่นๆ เอา Groovy ดีกว่า ก็เลยเริ่มจาก start groovy console (run&gt;cmd&gt;groovyConsole ) จากนั้นก็เริ่มเขียน code</p>
<p>ทันใดนั้นนึงขึ้นมาได้ว่า กูจะ add jar ยังไงว่ะ ไม่ได้ start เป็น project เอ้ หรือว่า จะไปสร้าง classpath ยังไงละเนี่ย ก็เลยลองไปหาว่าเจ้า Groovy Console มันจะ add classpath ได้ไงบ้าง</p>
<p>ไปเจอที่บอกว่าให้แก groovy start แต่เอ้ มันไม่เท่อ่ะ ไหน groovy บอกว่าตัวเองเป็น dynamic ก็นึกว่ามันจะเอา env ข้างๆมาให้ด้วย เลยเอา jar ไปวางใน Folder ที่ทำการสั่ง groovyConsole (ในใจนึงว่ามันจะเหมือน grails console) เอ๋ ไม่ได้นี่นา</p>
<p>ไม่ไหวแระ ไหนๆก็ไหนๆ เลยลองเขียน ให้ JAVA มันโหลด JAR แบบ on the fly เลยละกัน ไม่อยากเขียน cmd ไป เรียก class</p>
<p><span id="more-505"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> dynmicLoadJar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">File</span> libFolder <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;libs&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;folder: &quot;</span> <span style="color: #339933;">+</span>libFolder.<span style="color: #006633;">getAbsolutePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">File</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> jars <span style="color: #339933;">=</span> libFolder.<span style="color: #006633;">listFiles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jar: &quot;</span> <span style="color: #339933;">+</span> jars<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	List<span style="color: #339933;">&lt;</span>URL<span style="color: #339933;">&gt;</span> urls <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>URL<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> jars.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>jars<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.jar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
				urls.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>jars<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">toURL</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">MalformedURLException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">URL</span> url <span style="color: #339933;">:</span> urls<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Dynamic add &quot;</span> <span style="color: #339933;">+</span> url.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; to class path&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">URLClassLoader</span> classLoader <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">URLClassLoader</span><span style="color: #009900;">&#41;</span> <span style="color: #003399;">ClassLoader</span>.<span style="color: #006633;">getSystemClassLoader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">Class</span> clazz <span style="color: #339933;">=</span> <span style="color: #003399;">URLClassLoader</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">Method</span> method <span style="color: #339933;">=</span> clazz.<span style="color: #006633;">getDeclaredMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;addURL&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">Class</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #003399;">URL</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			method.<span style="color: #006633;">setAccessible</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			method.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span>classLoader, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>url<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">Thread</span>.<span style="color: #006633;">currentThread</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getContextClassLoader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getResourceAsStream</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;context.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error when dynamic load jar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			ex.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>ซึ่งจะทำการโหลด JAR ที่อยู่ใน folder libs มาให้เอง โดยใช้ reflection ยัดเข้าไปใน URLClassLoader ของ Java</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/hacking-java-classloader/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[TSQL]How to get list of Table in MS-SQL</title>
		<link>http://www.jiramot.info/tsqlhow-to-get-list-of-table-in-ms-sql</link>
		<comments>http://www.jiramot.info/tsqlhow-to-get-list-of-table-in-ms-sql#comments</comments>
		<pubDate>Fri, 05 Feb 2010 07:52:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=503</guid>
		<description><![CDATA[
USE [TABLE_NAME]
SELECT *
FROM sys.Tables
ORDER BY NAME

]]></description>
			<content:encoded><![CDATA[<blockquote><p>
USE [TABLE_NAME]<br />
SELECT *<br />
FROM sys.Tables<br />
ORDER BY NAME
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/tsqlhow-to-get-list-of-table-in-ms-sql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List all the Stored Procedures of a Database and their Definitions using T-SQL in SQL Server 2005/2008</title>
		<link>http://www.jiramot.info/list-all-the-stored-procedures-of-a-database-and-their-definitions-using-t-sql-in-sql-server-20052008</link>
		<comments>http://www.jiramot.info/list-all-the-stored-procedures-of-a-database-and-their-definitions-using-t-sql-in-sql-server-20052008#comments</comments>
		<pubDate>Thu, 04 Feb 2010 11:56:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=501</guid>
		<description><![CDATA[
SELECT obj.Name as SPName,
modu.definition as SPDefinition,
obj.create_date as SPCreationDate
FROM sys.sql_modules modu
INNER JOIN sys.objects obj
ON modu.object_id = obj.object_id
WHERE obj.type = &#8216;P&#8217;

]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>SELECT obj.Name as SPName,</p>
<p>modu.definition as SPDefinition,</p>
<p>obj.create_date as SPCreationDate</p>
<p>FROM sys.sql_modules modu</p>
<p>INNER JOIN sys.objects obj</p>
<p>ON modu.object_id = obj.object_id</p>
<p>WHERE obj.type = &#8216;P&#8217;
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/list-all-the-stored-procedures-of-a-database-and-their-definitions-using-t-sql-in-sql-server-20052008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Audio Recording Tutorial</title>
		<link>http://www.jiramot.info/android-audio-recording-tutorial</link>
		<comments>http://www.jiramot.info/android-audio-recording-tutorial#comments</comments>
		<pubDate>Mon, 01 Feb 2010 09:22:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=499</guid>
		<description><![CDATA[package com.benmccann.android.hello;

import java.io.File;
import java.io.IOException;

import android.media.MediaRecorder;
import android.os.Environment;

/**
 * @author &#60;a href="http://www.benmccann.com"&#62;Ben McCann&#60;/a&#62;
 */
public class AudioRecorder {

  final MediaRecorder recorder = new MediaRecorder();
  final String path;

  /**
   * Creates a new audio recording at the given path (relative to root of SD card).
   */
  public AudioRecorder(String path) {
  [...]]]></description>
			<content:encoded><![CDATA[<pre><code>package com.benmccann.android.hello;

import java.io.File;
import java.io.IOException;

import android.media.MediaRecorder;
import android.os.Environment;

/**
 * @author &lt;a href="http://www.benmccann.com"&gt;Ben McCann&lt;/a&gt;
 */
public class AudioRecorder {

  final MediaRecorder recorder = new MediaRecorder();
  final String path;

  /**
   * Creates a new audio recording at the given path (relative to root of SD card).
   */
  public AudioRecorder(String path) {
    this.path = sanitizePath(path);
  }

  private String sanitizePath(String path) {
    if (!path.startsWith("/")) {
      path = "/" + path;
    }
    if (!path.contains(".")) {
      path += ".3gp";
    }
    return Environment.getExternalStorageDirectory().getAbsolutePath() + path;
  }

  /**
   * Starts a new recording.
   */
  public void start() throws IOException {
    String state = android.os.Environment.getExternalStorageState();
    if(!state.equals(android.os.Environment.MEDIA_MOUNTED))  {
        throw new IOException("SD Card is not mounted.  It is " + state + ".");
    }

    // make sure the directory we plan to store the recording in exists
    File directory = new File(path).getParentFile();
    if (!directory.exists() &amp;&amp; !directory.mkdirs()) {
      throw new IOException("Path to file could not be created.");
    }

    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(path);
    recorder.prepare();
    recorder.start();
  }

  /**
   * Stops a recording that has been previously started.
   */
  public void stop() throws IOException {
    recorder.stop();
    recorder.release();
  }

}
</code></pre>
<p>source <a href="http://www.benmccann.com/dev-blog/android-audio-recording-tutorial/">http://www.benmccann.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/android-audio-recording-tutorial/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a Subversion Server on Ubuntu Gutsy Gibbon server</title>
		<link>http://www.jiramot.info/setting-up-a-subversion-server-on-ubuntu-gutsy-gibbon-server</link>
		<comments>http://www.jiramot.info/setting-up-a-subversion-server-on-ubuntu-gutsy-gibbon-server#comments</comments>
		<pubDate>Sun, 31 Jan 2010 09:11:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=496</guid>
		<description><![CDATA[Setting up a Subversion Server on Ubuntu Gutsy Gibbon server
 All the required packages are available in the Ubuntu repositories.
Installing Subversion
Use apt-get:
sudo apt-get update
sudo apt-get install subversion

Creating a Repository
Let&#8217;s say you want your repository to be in /var/svn/repos, type in these commands:
cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/repos

In order to control who has access to [...]]]></description>
			<content:encoded><![CDATA[<h2>Setting up a Subversion Server on Ubuntu Gutsy Gibbon server</h2>
<p><!-- start main content --> <!-- google_ad_section_start -->All the required packages are available in the Ubuntu repositories.</p>
<h3>Installing Subversion</h3>
<p>Use <tt>apt-get</tt>:</p>
<pre>sudo apt-get update
sudo apt-get install subversion
</pre>
<h3>Creating a Repository</h3>
<p>Let&#8217;s say you want your repository to be in <tt>/var/svn/repos</tt>, type in these commands:</p>
<pre>cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/repos
</pre>
<p>In order to control who has access to the repository we will now add a user who will own the repository files. Adding a user also adds a group with the same name.</p>
<pre>sudo adduser svn
</pre>
<p>Now make it impossible for anyone to log in as this user by editing <tt>/etc/passwd</tt> to set the <tt>svn</tt> user shell to <tt>/bin/false</tt>. Do this using the <tt>vipw</tt> command.  Find the line which starts <tt>svn</tt> (it should be the last line in the file) and change <tt>/bin/bash</tt> to <tt>/bin/false</tt>.</p>
<p>Now change the ownership of the repository files.</p>
<pre>sudo chown -R svn.svn svn
</pre>
<p>In order for someone to be permitted to use the repository they must be added to the <tt>svn</tt> group. My user name is <tt>martin</tt> so I am going to add myself to the <tt>svn</tt> group.</p>
<pre>sudo vigr
</pre>
<p>Go to the end of the file and add your user name to the end of the line which starts <tt>svn</tt>.  The end of the file should look similar to this:</p>
<pre>admin:x:110:martin
svn:x:1001:martin
</pre>
<p>Now set up an <tt>ssh</tt> server, clients will connect to this machine using <tt>ssh</tt>:</p>
<pre>sudo apt-get install openssh-server
</pre>
<p>The repository can now be accessed using the <tt>svn+ssh</tt> protocol. Test this as follows:</p>
<pre>svn co svn+ssh://<em>username</em>@<em>machinename</em>/var/svn/repos
</pre>
<p>You will be prompted about the RSA fingerprint of the server and asked for your password. You should end up with a directory called <tt>repos</tt> which is a working copy of your new repository.</p>
<p>As things stand you will be asked for your password every time you connect to the machine which is rather tedious. You can also authenticate with <tt>ssh</tt> by using a public/private key pair. If you are using a Windows client then install PuTTY and use PuTTYgen to create a key. Don&#8217;t forget to save the public and private key files. There is a text box at the top of the PuTTYgen window labeled &#8220;Public key for pasting into OpenSSH authorized_keys file&#8221;, you need to put the line of text in that box into a file called <tt>.ssh/authorized_keys2</tt> in your home directory on the server. Set the permissions on the files like this:</p>
<pre>chmod 0700 .ssh
chmod 0600 .ssh/authorized_keys2
</pre>
<p>On the Windows machine fire up pageant (another program which comes with PuTTY) and load your private key. You should now be able to connect to the server without being asked for a password. I prefer to disable password based access to the server by editing <tt>/etc/ssh/sshd_config</tt> and adding the line <tt>PasswordAuthentication no</tt>.</p>
<p>On a Linux client use <tt>ssh-keygen</tt> to create the key pair.</p>
<h3>Apache</h3>
<p>Subversion also supports the WebDAV protocol, to set this up Apache is needed. I am assuming that you installed Ubuntu as a LAMP server.</p>
<pre>sudo apt-get install libapache2-svn
</pre>
<p>The following isn&#8217;t recommended for a real implementation as we are going to add to the default web files. It would be far better to create a new virtual host, but that is a subject itself.</p>
<p>Ubuntu has a file for each active virtual host in <tt>/etc/apache2/sites-enabled</tt>, after installing Ubuntu server there will be a file called <tt>000-default</tt> in the <tt>sites-enabled</tt> directory and this is the file we are going to edit.</p>
<pre>cd /etc/apache2/sites-enabled
sudo vi 000-default
</pre>
<p>In the  directive add:</p>
<pre>    &lt;Location /svn/repos&gt;
      DAV svn
      SVNPath /var/svn/repos
    &lt;/Location&gt;
</pre>
<p>Then execute this command:</p>
<pre>sudo /etc/init.d/apache2 force-reload
</pre>
<p>You should now be able to see the repository at the URL <tt>http://<em>machinename</em>/svn/repos</tt>.</p>
<h3>Securing Web Access</h3>
<p>Add this to the location directive:</p>
<pre>      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user
</pre>
<p>Now add a user name and password to the Apache password file:</p>
<pre>sudo htpasswd -cb /etc/apache2/passwords martin dgjan08
</pre>
<p>And another forced reload:</p>
<pre>sudo /etc/init.d/apache2 force-reload
</pre>
<p>Now if you visit the repository URL you will have to enter a valid user name and password.</p>
<h3>Trac</h3>
<p>Trac is a ticketing system and Wiki which integrates very well with Subversion. Start by installing Trac:</p>
<pre>sudo apt-get install trac python-setuptools libapache2-mod-python enscript
</pre>
<p>Now create a Trac database:</p>
<pre>sudo mkdir /var/www/trac
sudo trac-admin /var/www/trac/repos initenv</pre>
<p>Then answer its questions, take the defaults, our Subversion repository is in <tt>/var/svn/repos</tt>.</p>
<p>Now to get Apache to run Trac.</p>
<pre>cd /var/www
sudo chown -R www-data.svn trac
</pre>
<p>Head back to <tt>/etc/apache2/sites-enabled</tt> and edit <tt>000-default</tt> again, adding this:</p>
<pre>    &lt;Location /trac/[[:alnum]]+/login"&gt;
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user
    &lt;/Location&gt;

    &lt;Location /trac&gt;
      SetHandler mod_python
      PythonInterpreter main_interpreter
      PythonHandler trac.web.modpython_frontend
      PythonOption TracEnvParentDir /var/www/trac
      PythonOption TracUriRoot /trac
    &lt;/Location&gt;
</pre>
<p>And then run this again:</p>
<pre>sudo /etc/init.d/apache2 force-reload
</pre>
<h3>Building Trac from source</h3>
<p>If you want the most recent version of Trac (0.10.4) then you will have to build and install it. Do the following:</p>
<pre>sudo apt-get remove trac
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
tar zxf trac-0.10.4.tar.gz
cd trac-0.10.4/
sudo mkdir /usr/local/trac
sudo python setup.py install --prefix=/usr
</pre>
<p>The rest of the instructions are the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/setting-up-a-subversion-server-on-ubuntu-gutsy-gibbon-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Expose and Spaces for the Magic Mouse</title>
		<link>http://www.jiramot.info/enable-expose-and-spaces-for-the-magic-mouse</link>
		<comments>http://www.jiramot.info/enable-expose-and-spaces-for-the-magic-mouse#comments</comments>
		<pubDate>Sun, 17 Jan 2010 08:25:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=494</guid>
		<description><![CDATA[download BetterTouchTool
]]></description>
			<content:encoded><![CDATA[<p>download <a href="http://blog.boastr.net/?page_id=195">BetterTouchTool</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/enable-expose-and-spaces-for-the-magic-mouse/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex printing using FlexPrintJob</title>
		<link>http://www.jiramot.info/flex-printing-using-flexprintjob</link>
		<comments>http://www.jiramot.info/flex-printing-using-flexprintjob#comments</comments>
		<pubDate>Sat, 16 Jan 2010 03:49:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=482</guid>
		<description><![CDATA[วันนี้ว่างๆ ก็เลยนั่งลองหาดูว่า Flex มันติดต่อเครื่องพิมพ์ได้อย่างไร ก็เลยไปเจอเข้าว่ามันใช้ FlexPrintJob ในการทำงาน คล้ายๆกับ Java เลยที่ใช้ PrintJop แล้วก็ Draw Graphic ลงไปเอา
ส่วน FlexPrintJob ก็คล้ายๆกัน แต่เอา Component ยัดลงไปได้เลย

 Create an instance of the FlexPrintJob class

var printJob:FlexPrintJob = new FlexPrintJob();

Start the print job:

printJob.start();

Add one or more objects to the print job and specify how to scale them:

printJob.addObject(myObject, FlexPrintJobScaleType.MATCH_WIDTH);

Send the print job to the printer:

printJob.send();

Free [...]]]></description>
			<content:encoded><![CDATA[<p>วันนี้ว่างๆ ก็เลยนั่งลองหาดูว่า Flex มันติดต่อเครื่องพิมพ์ได้อย่างไร ก็เลยไปเจอเข้าว่ามันใช้ FlexPrintJob ในการทำงาน คล้ายๆกับ Java เลยที่ใช้ PrintJop แล้วก็ Draw Graphic ลงไปเอา</p>
<p>ส่วน FlexPrintJob ก็คล้ายๆกัน แต่เอา Component ยัดลงไปได้เลย</p>
<ol>
<li> Create an instance of the FlexPrintJob class</li>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">var printJob:FlexPrintJob = new FlexPrintJob();</pre></div></div>

<li>Start the print job:</li>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">printJob.start();</pre></div></div>

<li>Add one or more objects to the print job and specify how to scale them:</li>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">printJob.addObject(myObject, FlexPrintJobScaleType.MATCH_WIDTH);</pre></div></div>

<li>Send the print job to the printer:</li>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">printJob.send();</pre></div></div>

<li>Free up any unneeded objects.</li>
</ol>
<p><span id="more-482"></span><br />
ตัวอย่างคับ</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- printing\DGPrint.mxml --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Application</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">            import mx.printing.*;</span>
&nbsp;
<span style="color: #339933;">            // Create a PrintJob instance.</span>
<span style="color: #339933;">            private function doPrint():void {</span>
<span style="color: #339933;">                // Create an instance of the FlexPrintJob class.</span>
<span style="color: #339933;">                var printJob:FlexPrintJob = new FlexPrintJob();</span>
&nbsp;
<span style="color: #339933;">                // Start the print job.</span>
<span style="color: #339933;">                if (printJob.start() != true) return;</span>
&nbsp;
<span style="color: #339933;">                // Add the object to print. Do not scale it.</span>
<span style="color: #339933;">                printJob.addObject(myDataGrid, FlexPrintJobScaleType.NONE);</span>
&nbsp;
<span style="color: #339933;">                // Send the job to the printer.</span>
<span style="color: #339933;">                printJob.send();</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:VBox</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;myVBox&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DataGrid</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;myDataGrid&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;300&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:dataProvider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Object</span> <span style="color: #000066;">Product</span>=<span style="color: #ff0000;">&quot;Flash&quot;</span> <span style="color: #000066;">Code</span>=<span style="color: #ff0000;">&quot;1000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Object</span> <span style="color: #000066;">Product</span>=<span style="color: #ff0000;">&quot;Flex&quot;</span> <span style="color: #000066;">Code</span>=<span style="color: #ff0000;">&quot;2000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Object</span> <span style="color: #000066;">Product</span>=<span style="color: #ff0000;">&quot;ColdFusion&quot;</span> <span style="color: #000066;">Code</span>=<span style="color: #ff0000;">&quot;3000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Object</span> <span style="color: #000066;">Product</span>=<span style="color: #ff0000;">&quot;JRun&quot;</span> <span style="color: #000066;">Code</span>=<span style="color: #ff0000;">&quot;4000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:dataProvider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:DataGrid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Button</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;myButton&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Print&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">click</span>=<span style="color: #ff0000;">&quot;doPrint();&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:VBox<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>source <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=printing_3.html">http://livedocs.adobe.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/flex-printing-using-flexprintjob/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Callback Function</title>
		<link>http://www.jiramot.info/flex-callback-function</link>
		<comments>http://www.jiramot.info/flex-callback-function#comments</comments>
		<pubDate>Thu, 14 Jan 2010 11:31:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=480</guid>
		<description><![CDATA[
  public function firstFunction():void{
    trace(&#34;call first function&#34;)
  }
  public function secondFunction(callbackFunction:Function):void{
    trace(&#34;call second function&#34;)
    callbackFunction()
  }
  public function thirdFunction():void{
    trace(&#34;call third function&#34;)
  }

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  public function firstFunction():void{
    trace(&quot;call first function&quot;)
  }
  public function secondFunction(callbackFunction:Function):void{
    trace(&quot;call second function&quot;)
    callbackFunction()
  }
  public function thirdFunction():void{
    trace(&quot;call third function&quot;)
  }</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/flex-callback-function/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate Data in DataGrid</title>
		<link>http://www.jiramot.info/validate-data-in-datagrid</link>
		<comments>http://www.jiramot.info/validate-data-in-datagrid#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:34:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://www.jiramot.info/?p=477</guid>
		<description><![CDATA[
itemEditBegin – Fired when you click on an editable cell of the datagrid (also when the editedItemPosition is set on an editable DataGrid)
itemEditBeginning &#8211; Fired when the mouse is released
itemEditEnd &#8211; Fired when the edit is committed / editor is destroyed there by terminating the edit session.


1
2
3
4
5
6
7
8
9
    &#60;mx:DataGrid editable=”true” id=”datagrid” x=”105″ y=”85″ [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
itemEditBegin – Fired when you click on an editable cell of the datagrid (also when the editedItemPosition is set on an editable DataGrid)</p>
<p>itemEditBeginning &#8211; Fired when the mouse is released</p>
<p>itemEditEnd &#8211; Fired when the edit is committed / editor is destroyed there by terminating the edit session.
</p></blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DataGrid</span> <span style="color: #000066;">editable</span>=”true” <span style="color: #000066;">id</span>=”datagrid” <span style="color: #000066;">x</span>=”105″ <span style="color: #000066;">y</span>=”85″ <span style="color: #000066;">height</span>=”176″ <span style="color: #000066;">width</span>=”317″ <span style="color: #000066;">dataProvider</span>=”<span style="color: #66cc66;">&#123;</span>arr<span style="color: #66cc66;">&#125;</span>” <span style="color: #000066;">itemEditEnd</span>=”doValidation<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>”<span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:columns<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DataGridColumn</span> <span style="color: #000066;">headerText</span>=”Data” <span style="color: #000066;">dataField</span>=”disp” <span style="color: #000066;">editable</span>=”false”<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DataGridColumn</span> <span style="color: #000066;">headerText</span>=”Available” <span style="color: #000066;">dataField</span>=”value” <span style="color: #000066;">editable</span>=”false”<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;">&lt;!– itemEditor is set to our class CustomNumericStepper. Always remember to set the editorDataField to the dataField on which the operation is performed–<span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DataGridColumn</span> <span style="color: #000066;">headerText</span>=”Order Qty” <span style="color: #000066;">dataField</span>=”order” <span style="color: #000066;">itemEditor</span>=”CustomNumericStepper” <span style="color: #000066;">editorDataField</span>=”value”<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:columns<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:DataGrid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>source <a href="http://blog.flexgeek.in/2007/05/tips-tricks-itemeditors-ii/">http://blog.flexgeek.in</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/validate-data-in-datagrid/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
