<?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>Fri, 30 Jul 2010 19:57:08 +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>Oracle Naming Conventions</title>
		<link>http://www.jiramot.info/oracle-naming-conventions</link>
		<comments>http://www.jiramot.info/oracle-naming-conventions#comments</comments>
		<pubDate>Wed, 21 Jul 2010 12:24:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[plsql]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=531</guid>
		<description><![CDATA[When designing a database it&#8217;s a good idea to follow some sort of naming convention. This will involve a little thought in the early design stages but will save significant time when maintaining the finished system.
It&#8217;s less important which exact conventions you choose to follow &#8211; but this page has a few suggestions.
The benefits of [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="font-weight: normal; font-size: 13px;">When designing a database it&#8217;s a good idea to follow some sort of naming convention. This will involve a little thought in the early design stages but will save significant time when maintaining the finished system.</span></h1>
<p>It&#8217;s less important which exact conventions you choose to follow &#8211; but this page has a few suggestions.</p>
<p>The benefits of using a naming convention are more to do with human factors than any system limitations &#8211; but this does not make them any less important.</p>
<p><span id="more-531"></span></p>
<p><strong>Table Names</strong></p>
<blockquote>
<blockquote><p>Table names are <em>plural</em>, field name is <em>singular</em></p>
<p>Table names should not contain spaces, words should be split_up_with_underscores.</p>
<p>The table name is limited to 30 bytes which should equal a 30 character name (try a DESC ALL_TABLES and note the size of the Table_Name column)</p>
<p>If the table name contains serveral words, only the last one should be plural:<br />
APPLICATIONS<br />
APPLICATION_FUNCTIONS<br />
APPLICATION_FUNCTION_ROLES</p>
<p>There are pros and cons to adding a prefix or suffix to identify tables-</p>
<p>Pros: If most access will be made via VIEWS then prefixing all the tables with T_ and all the views with V_ keeps things organised neatly, you will never accidentally query the wrong one.</p>
<p>Cons: Suppose, your naming convention is to have the &#8216;_TAB&#8217; suffix for all tables. According to that naming convention, the APPLICATIONS table would be called APPLICATIONS_TAB. If as time goes by, your application gets a second login, perhaps for auditing, or for security reasons. To avoid code changes, you will then have to create a View or Synonym that points at the original tables and is confusingly called APPLICATIONS_TAB.</p>
<p>Of course if all your code was written against Views in the first place then you skirt right around that issue.</p></blockquote>
</blockquote>
<p><strong>Field Names</strong></p>
<blockquote>
<blockquote><p>Ideally each field name should be unique within the database schema. This makes it easy to search through a large set of code (or documentation) and find all occurences of the field name.</p>
<p>The convention is to prefix the fieldname with a 2 or 3 character contraction of the table name e.g.</p>
<blockquote><p>PATIENT_OPTIONS would have a field called po_patient_option</p>
<p>PATIENT_RELATIVES would have a field called pr_relative_name</p>
<p>ABSENCES would have a field called ab_start_date</p></blockquote>
<p>In a large schema you will often find two tables having similar names which could result in the same prefix. You can avoid this by thinking carefully about the name you give each table &#8211; and documenting the prefixes to be used.</p>
<p>For very complex systems (thousands of tables) consider alternatives e.g. a prefix/suffix to identify the Application module.</p>
<p>Keeping names short: Oracle places no limit on the number of columns in a GROUP BY clause or the number of sort specifications in an ORDER BY clause. However, the sum of the sizes of all such expressions is limited to the size of an Oracle data block (specified by the initialization parameter DB_BLOCK_SIZE) minus some overhead.</p></blockquote>
</blockquote>
<p><strong>Primary Key Fields </strong>- indicate by appending <strong>_pk</strong></p>
<blockquote>
<blockquote><p>e.g.</p>
<p>PATIENTS would have a primary key called pa_patient_id_pk</p>
<p>REGIONS would have a primary key called re_region_id_pk</p>
<p>And so on&#8230;the name of the primary key field being a singular version of the table name. Other tables containing this as a foreign key would omit the _PK</p>
<p>so<br />
CLINIC_ATTENDANCE might then have a foreign key called ca_patient_id<br />
or alternatively: ca_patient_id_fk</p>
<p>Tables with Compound PK&#8217;s, use <strong>_ck</strong> in place of _pk</p>
<p>Notice that where several tables use the same PK as part of a compound foreign key then the only unique part of the FK fieldname will be the table prefix.</p></blockquote>
</blockquote>
<p><strong>View Names</strong></p>
<blockquote>
<blockquote><p>View names are <em>plural</em>, field name is <em>singular</em></p>
<p>View names should not contain spaces, words should be split_up_with_underscores.</p>
<p>While it is common to prefix (or suffix) all views with V_ or VW_, a strong argument can be made that neither are really needed.</p>
<p>One of the easiest ways to boost the performance of an application is to provide, at an early stage in the design, a carefully tuned set of views, then write all the application code against those Views.<br />
Giving your Views friendly easy names will promote their use by developers and end-users, this in turn will mean fewer badly written queries and more use of &#8217;shared SQL&#8217; which will improve the cache hit ratio.</p>
<p>For very large systems, it can make sense to prefix tables/views with the application module name, so a database holding data for both Widget Production and Human Resources data might prefix everything with either HR_ or WP_</p></blockquote>
</blockquote>
<p><strong>Index names</strong></p>
<blockquote>
<blockquote><p>Name the Primary Key index as <strong>idx_</strong>&lt;TableName&gt;<strong>_pk</strong></p>
<blockquote><p>e.g.<br />
PATIENTS would have a primary key index called idx_patients_pk</p></blockquote>
<p>Name a Unique Index as <strong>idx_</strong>&lt;TableName&gt;<strong>_uk</strong></p>
<blockquote><p>e.g.<br />
PATIENTS would have a unique index called idx_patients_uk</p></blockquote>
<p>Where more indexes are added to the same table, simply append a numeric:</p>
<blockquote>
<blockquote><p><strong>idx_</strong>&lt;TableName&gt;<strong>_##</strong></p>
<p>Where ## is a simple number</p></blockquote>
<p>e.g.<br />
PATIENTS would have additional indexes called idx_patients_01, idx_patients_02,&#8230;</p></blockquote>
<p><em>Note &#8211; Conventions that attempt to use the column name as part of the index name become unmanageable as soon as you have multiple columns appearing in multiple indexes.</em></p></blockquote>
</blockquote>
<p><strong>Constraints</strong></p>
<blockquote>
<blockquote><p>Primary and Unique constraints will be explicitly named.</p>
<p>Name the Primary Key Constraint as <strong>pk_</strong>&lt;TableName&gt;<strong></strong></p>
<blockquote><p>e.g.<br />
PATIENTS would have a primary key index called pk_patients</p></blockquote>
<p>Name a Foreign Key Constraint as <strong>fk_</strong>&lt;TableName&gt;</p>
<blockquote><p>e.g.<br />
PATIENTS would have a Foreign Key constraint called fk_patients</p></blockquote>
<p>Note &#8211; in general each constraint should have a similar name to the index used to support the constraint.</p></blockquote>
</blockquote>
<p><strong>Other Fields</strong></p>
<blockquote>
<blockquote><p>Without getting carried away, you can also apply a suffix to non key fields where this is helpful in describing the type of data being stored.<br />
e.g.<br />
A column used to store boolean (Yes/No) values can be given a _yn suffix: retired<strong>_yn</strong>, superuser <strong>_yn</strong>, driver<strong><strong>_yn</strong></strong></p>
<p>In lookup tables an easy way to identify the main text field is to name it as a singular version of the tablename<br />
e.g.</p>
<pre>asset_types.at_asset_type_id_pk   (Primary Key)
asset_types.at_asset_type         (Text field)
asset_types.at_network_yn         (boolean)</pre>
</blockquote>
</blockquote>
<p><strong>SQL</strong></p>
<blockquote>
<blockquote><p>Type all SQL statements in lowercase, being consistent with capitalisation improves the caching of SQL statements. A common variant is to put only SQL keywords in capitals.</p>
<pre>SELECT
   em_employee_id_pk,
   em_employee,
   ab_start_date
FROM
   employees em,
   absences ab
WHERE
   absences.ab_employee_id=employees.em_employee_id_pk;</pre>
<p>You already have a unique prefix worked out for every table, so use the same thing when an ALIAS is required &#8211; this makes the SQL much easier to read.</p>
<p>Always list tables in the FROM / WHERE clause in desired join order &#8211; even with CBO you are giving the Query Optimiser less work to do.</p></blockquote>
</blockquote>
<p><strong>PL/SQL</strong></p>
<blockquote>
<blockquote><p>Prefix scalar variable names with <strong>v_ </strong><br />
Prefix global variables (including host or bind variables) with <strong>g_ </strong><br />
Prefix constants with<strong> c_</strong><br />
Prefix procedure or function call parameters (including sql*plus substitution parameters) with <strong>p_</strong></p>
<p>Prefix record collections with <strong>r_</strong> (alternatively suffix with <strong>_record</strong>)<br />
Prefix %rowtype% collections with <strong>rt_</strong> (alternatively suffix with <strong>_record_type</strong>)</p>
<p>Prefix pl/sql tables with <strong>t_ </strong>(alternatively suffix with <strong>_table</strong>)<br />
Prefix table types with <strong>tt_ </strong>(alternatively suffix with <strong>_table_type</strong>)</p>
<p>Suffix cursors with <strong>_cursor</strong><br />
Prefix exceptions with <strong>e_</strong></p>
<p>If a pl/sql variable is identical to the name of a column in the table Oracle will interpret the name as a column name.</p>
<p><strong>Packages</strong><br />
Prefix package names with PKG_</p>
<p>Write one package for each table &#8211; named PKG_TABLENAME, put all other code that logically belongs to the schema, but not to any particular table in a single Schema package PKG_SCHEMANAME.<br />
If, as is likely, more complex grants are required for different groups of users then create an additional package for each workgroup &#8211; these should contain no code just wrappers that call procedures/functions in the other packages.<br />
This gives a level of separation between the basic code and the user security/grants and makes it easier to change one without breaking the other.</p>
<p>A pl/sql function name like PAYROLL.TAX_RATE the word PAYROLL could refer to either a schema or a package name.</p></blockquote>
</blockquote>
<p><strong>Edit Replace</strong></p>
<blockquote>
<blockquote><p>If you apply a naming convention and then decide to rename something it may be possible to use Edit-Replace to update the associated code. But consider these two fieldnames:</p>
<pre>area_codes.<strong>ac_code</strong>
region_area_codes.r<strong>ac_code</strong></pre>
<p>The columns may be unique but one is a substring of the other!</p></blockquote>
</blockquote>
<p><strong>Instance</strong></p>
<blockquote>
<blockquote><p>Oracle database instance names are limited to eight characters. The first two or three characters of the name should reflect the Application, with the remainder indicating the nature of the instance.<br />
e.g.</p>
<pre>Live instance   SSLive
Test instance   SSTest
Train instance  SSTrain
Data Warehouse  SSdw
Staging Area    SSsa</pre>
</blockquote>
</blockquote>
<p><strong>Data Files</strong></p>
<blockquote>
<blockquote><p>Name Data files so that they identify the instance and the tablespace.</p>
<p>Each filename should end with a two digit numeric value starting with 01, that is incremented by 1 for each new datafile added to the tablespace.<br />
Use the extension &#8220;.dbf&#8221;<br />
e.g.</p>
<pre>SSLive_temp01.dbf
SSLive_rbs01.dbf
SSLive_clinical01.dbf
SSLive_clinical02.dbf</pre>
</blockquote>
</blockquote>
<p><strong>Tablespaces</strong></p>
<blockquote>
<blockquote><p>Avoid naming tablespaces according to time periods.<br />
(Oracle never forgets a tablespace and SMON will scan the list of tablespaces in TS$ every 5 minutes) For a partitioned datawarehouse, try to adopt a strategy of recycling the tablespace names.</p></blockquote>
</blockquote>
<p><strong>Redo Logs</strong></p>
<blockquote>
<blockquote><p>The redo log is a separate file (not in the tablespace)<br />
Name Redo Logs so that they identify the instance, group and member number of the log. Use the extension &#8220;.log&#8221;<br />
e.g.<br />
SSLive_redo_01.log</p>
<p>For more detail on the physical placement of files see Oracle <a href="syntax-ofa.html">Optimal Flexible Architecture</a> (OFA)</p></blockquote>
</blockquote>
<p><strong>Documentation</strong></p>
<blockquote>
<blockquote><p>Lastly &#8211; write and maintain a data dictionary for all data elements &#8211; rather than just dumping the Oracle data dictionary into a text document or an <a href="http://en.wikipedia.org/wiki/Entity-relationship_model">Entity relationship diagram</a> &#8211; you should also be defining the <em>business</em> meaning of each data item.</p></blockquote>
</blockquote>
<p><strong>Summary</strong></p>
<blockquote>
<blockquote><p>RDBMS naming conventions can become the subject of endless debate &#8211; here are a few last things to consider:</p>
<p>Does your naming convention make names longer or shorter?</p>
<p>PURCHASE_ORDER_DATE versus PO_DATE</p>
<p>Will you have novice users writing SQL against the database?<br />
If so will they understand the meaning of things like PO_DATE</p>
<p>Is the naming convention documented somewhere that everyone can find? If you arent planning to change it very often, drop the text right into a tableSELECT * from Naming_Conventions;</p></blockquote>
</blockquote>
<p><strong>Related:</strong></p>
<p><a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6729304326802">Ask Tom</a> &#8211; Argues against the column prefix<br />
<a href="http://www.oracle-base.com/articles/misc/NamingConventions.php">Oracle-Base.com Naming conventions</a><br />
<a href="http://philip.greenspun.com/sql/style.html">SQL convention</a> from Philip Greenspun<br />
<a href="http://www.xoc.net/standards/default.asp">Reddick Naming convention</a> (hungarian notation)<br />
<a href="http://www.intelligententerprise.com/001205/celko1_1.shtml">Joe Celko</a> &#8211; 10 Bad Habits<br />
<a href="http://vyaskn.tripod.com/coding_conventions.htm">SQL Server Naming conventions</a><br />
<a href="http://www.oriolecorp.com/dbcr.html">Oriolecorp</a> &#8211; File Naming, password conventions<br />
<a href="http://www.wangz.net/pp/sqlformat.htm">SQL formatter</a> &#8211; Online SQL beautifier<br />
<a href="http://support.microsoft.com/?kbid=189220">Q189220</a> &#8211; Microsoft support for spaces in fieldnames<br />
Standard ISO-11179 &#8211; Rules for defining data elements<br />
<a href="syntax-ofa.html">Optimal Flexible Architecture</a> (OFA)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/oracle-naming-conventions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entity Mapping: Table-per-type and Table-per-hierarchy</title>
		<link>http://www.jiramot.info/entity-mapping-table-per-type-and-table-per-hierarchy</link>
		<comments>http://www.jiramot.info/entity-mapping-table-per-type-and-table-per-hierarchy#comments</comments>
		<pubDate>Mon, 12 Jul 2010 02:40:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=528</guid>
		<description><![CDATA[In the object world, Inheritance is natural thing. However the flat data model cannot be easily mapped to the hierarchy object model. Entity Framework provide TPT and TPH to solve this problem.  

Below is a diagram I draw based on the MSDN Table-per-type sample. The right side is a list of entity types in the source [...]]]></description>
			<content:encoded><![CDATA[<p>In the object world, Inheritance is natural thing. However the flat data model cannot be easily mapped to the hierarchy object model. Entity Framework provide TPT and TPH to solve this problem.  </p>
<p><span id="more-528"></span></p>
<p>Below is a diagram I draw based on the MSDN <a href="http://msdn2.microsoft.com/en-us/library/bb738685(VS.90).aspx">Table-per-type sample</a>. The right side is a list of entity types in the source layer while the left side is a list of entity types in the entity layer ( or conceptual layer). In the conceptual layer, the DeptMusic, DeptEnginerring and DeptBussiness are derived from base type Department. That is, four tables have corresponding entity types. Therefore this inheritance solution is called Table-per-type ( TPT ). Although the Department and DeptBusiness tables have no relationship with each other, the primary keys of these tables are mapped to the same DepartmentID of the Department base type.</p>
<p><img src="http://lwang00.files.wordpress.com/2007/11/110407-0518-entitymappi1.png?w=500" alt="" /></p>
<p><a href="http://msdn2.microsoft.com/en-us/library/bb738443(VS.90).aspx">Table-per-hierarchy ( TPH )</a> is another way to create inheritance entity model in the EDM. The MSDN sample uses one person to hold the persisted data from the Student, Administrator, instructor and Person entities. As you might notice, Person is the base type in the hierarchy while Student, Administrator and Instructor are derived types. The PersonCategory column of the Person table is called <strong>discriminator column</strong>. If the value of PersonCategory is 0 in the database, when the data is materialized to object via Entity Framework, a person object will be created. A value of 1,2,3 indicate the Student, Instructor and Administrator types respectively. You can use Entity Mapping Detail window to specify discriminator columns and values.</p>
<p><img src="http://lwang00.files.wordpress.com/2007/11/110407-0518-entitymappi2.png?w=500" alt="" /></p>
<p>source <a href="http://lwang00.wordpress.com/2007/11/04/entity-mapping-table-per-type-and-table-per-hierarchy/">http://lwang00.wordpress.com/2007/11/04/entity-mapping-table-per-type-and-table-per-hierarchy/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/entity-mapping-table-per-type-and-table-per-hierarchy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Grails Custom Constraints</title>
		<link>http://www.jiramot.info/creating-grails-custom-constraints</link>
		<comments>http://www.jiramot.info/creating-grails-custom-constraints#comments</comments>
		<pubDate>Sun, 11 Jul 2010 12:14:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=526</guid>
		<description><![CDATA[Now and than there is the requirement to create custom constraints. As you might already know, there are plenty of constraints that already are shipped with Grails. Those can be applied in the constraints closure of your domain or command classes:
class User  {
String firstName
String surName
Short  age
static constraints = {
firstName(blank: false, maxSize: 150)
surName(blank: false, maxSize: 150)
age(min: 18 [...]]]></description>
			<content:encoded><![CDATA[<p>Now and than there is the requirement to create <em>custom constraints</em>. As you might already know, there are plenty of constraints that already are shipped with Grails. Those can be applied in the constraints closure of your domain or command classes:</p>
<p><span id="more-526"></span>class User  {<br />
String firstName<br />
String surName<br />
Short  age<br />
static constraints = {<br />
firstName(blank: false, maxSize: 150)<br />
surName(blank: false, maxSize: 150)<br />
age(min: 18 as Short, max: 99 as Short)<br />
}<br />
}</p>
<p>In order to implement custom constraints like i.e. an age constraint, which encapsulates the constraint’s implementation you could extend from Grail’s AbstractConstraint class. The problem with this approach is, that you than need to register your custom constraint at bootstrap, to use it in every possible scenario (going from testing to running the app).</p>
<p>Fortunately there is a plugin that helps with creating custom constraints: the constraints plugin.</p>
<p>grails install-plugin constraints</p>
<p>Installs the plugin and adds a dependency entry in your application or plugin settings. If installation was successful your grails help command lists the create-constraint command, that from now can be used to create custom constraints.</p>
<p>Creating an application-specific age constraint would be as simple as:</p>
<p>grails create-constraint Age</p>
<p>which creates grails-app/utils/AgeConstraint which i modified to be</p>
<p>class AgeConstraint {<br />
def validate = { propertyValue -&gt;<br />
return propertyValue &gt;= 18 &amp;&amp; propertyValue &lt;= 99<br />
}<br />
}</p>
<p>After declaring the constraint it can be used in domain or command classes:</p>
<p>class User  {<br />
String firstName<br />
String surName<br />
Short  age</p>
<p>static constraints = {<br />
firstName(blank: false, maxSize: 150)<br />
surName(blank: false, maxSize: 150)<br />
age(age: true)<br />
}<br />
}</p>
<p>If you take a look at the <a href="http://github.com/geofflane/grails-constraints">plugin’s documentation</a> [0] there are several to use default message codes for i18n of error messages and so on. But this plugin works perfectly for adding custom constraints to your Grails environment.</p>
<p>[0] Constraints Plugin - <a href="http://github.com/geofflane/grails-constraints">http://github.com/geofflane/grails-constraints</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/creating-grails-custom-constraints/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Do I Uninstall NetBeans in Mac OS X?</title>
		<link>http://www.jiramot.info/how-do-i-uninstall-netbeans-in-mac-os-x</link>
		<comments>http://www.jiramot.info/how-do-i-uninstall-netbeans-in-mac-os-x#comments</comments>
		<pubDate>Sun, 20 Jun 2010 17:08:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=524</guid>
		<description><![CDATA[
Drag-and-drop to trash all the folders NetBeans 6.x.app, glassfish-v2.x (if installed) , glassfish-v3 (if installed), sges-v3 (if installed), apache-tomcat-x (if installed)
Delete ~/.netbeans/6.x if you don`t want to save your NetBeans settings or if your IDE behaves strangely.
To clear the history of the installed software on Mac OS 10.6 Snow Leopard delete /private/var/db/receipts/org.netbeans.*, glassfish-v3* (if installed), [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Drag-and-drop to trash all the folders NetBeans 6.x.app, glassfish-v2.x (if installed) , glassfish-v3 (if installed), sges-v3 (if installed), apache-tomcat-x (if installed)</li>
<li>Delete ~/.netbeans/6.x if you don`t want to save your NetBeans settings or if your IDE behaves strangely.</li>
<li>To clear the history of the installed software on Mac OS 10.6 Snow Leopard delete /private/var/db/receipts/org.netbeans.*, glassfish-v3* (if installed), apache.tomcat.* (if installed)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/how-do-i-uninstall-netbeans-in-mac-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Environment and Path on OSX</title>
		<link>http://www.jiramot.info/setup-environment-and-path-on-osx</link>
		<comments>http://www.jiramot.info/setup-environment-and-path-on-osx#comments</comments>
		<pubDate>Thu, 17 Jun 2010 20:21:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=521</guid>
		<description><![CDATA[Set PATH
sudo vi /etc/paths
]]></description>
			<content:encoded><![CDATA[<p>Set PATH</p>
<p>sudo vi /etc/paths</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/setup-environment-and-path-on-osx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Red5 install on Mac OS X</title>
		<link>http://www.jiramot.info/quick-red5-install-on-mac-os-x</link>
		<comments>http://www.jiramot.info/quick-red5-install-on-mac-os-x#comments</comments>
		<pubDate>Mon, 07 Jun 2010 21:46:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[red5]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=518</guid>
		<description><![CDATA[These steps work fine with version 0.9.0 RC2 at least…

Download the latest dmg from http://code.google.com/p/red5/
Open the package, drag Red5 to your Applications folder, then start the app (nothing happens visually, it’s a server!)
Open http://127.0.0.1:5080/demos/ in a browser, which should hopefully now show you the demo page

The next step is to install the demos you want to [...]]]></description>
			<content:encoded><![CDATA[<p>These steps work fine with version 0.9.0 RC2 at least…</p>
<ol>
<li>Download the latest dmg from <a href="http://code.google.com/p/red5/" target="_blank">http://code.google.com/p/red5/</a></li>
<li>Open the package, drag Red5 to your Applications folder, then start the app (nothing happens visually, it’s a server!)</li>
<li>Open<a href="http://127.0.0.1:5080/demos/" target="_blank"> http://127.0.0.1:5080/demos/</a> in a browser, which should hopefully now show you the demo page</li>
</ol>
<p>The next step is to install the demos you want to try using a flash control panel that comes packaged with the distribution. Now, be warned, as of version 0.9.0 RC2, the distribution is a little flaky. So when you click the link to “install” demos on the page you just loaded, it won’t work.</p>
<p>So if the link doesn’t work for you, try <a href="http://127.0.0.1:5080/installer/">http://127.0.0.1:5080/installer/</a> instead! Go back to the first page to access the demo you installed.</p>
<p>Finally use a terminal session to browse inside your app folder (i.e. inside /Applications/Red5.app) and have a poke around the underlying code and configurations.</p>
<p>/Applications/Red5.app/Contents/Resources/Java/webapps is a good place to start. You’ll notice that the system packs Tomcat, and the distribution acts as a web server.</p>
<p>source <a href="http://ria101.wordpress.com/2010/01/26/up-and-running-fast-with-red5-on-mac-os-x/" target="_blank">http://ria101.wordpress.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/quick-red5-install-on-mac-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSX: Move Files Instead of Copying</title>
		<link>http://www.jiramot.info/osx-move-files</link>
		<comments>http://www.jiramot.info/osx-move-files#comments</comments>
		<pubDate>Sun, 06 Jun 2010 17:42:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=515</guid>
		<description><![CDATA[You do not have to copy and then delete when moving files on your apple box. Here is how to do it all with one command. This tutorial describes how to drag and drop to move a file from one location to another.
When copying files from one location to another, I have always found it [...]]]></description>
			<content:encoded><![CDATA[<h4>You do not have to copy and then delete when moving files on your apple box. Here is how to do it all with one command. This tutorial describes how to drag and drop to move a file from one location to another.</h4>
<p>When copying files from one location to another, I have always found it an annoying process to drag the files to one location and then go back and delete them from the original location.</p>
<p>The default drag and drop process in OS X is to COPY files.</p>
<p>We want to be able to MOVE files.</p>
<p>To MOVE a file is to actually copy files to a new location and to delete them from the original location.</p>
<p><strong>OS X will move the file if you hold the CMD key while you drag and drop.</strong></p>
<p>One caveat:</p>
<p>Something that confuses people is what happens if duplicate files are found during the move drag and drop. If you release the CMD key to answer the dialog box that appears, the file will be copied but not moved. If you continue to hold the CMD key as you click the Replace button, the move action will be completed.</p>
<p>source <a href="http://www.tech-recipes.com/rx/2581/os_x_move_files_instead_copying/" target="_blank">http://www.tech-recipes.com/rx/2581/os_x_move_files_instead_copying/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/osx-move-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blackberry Hidden Command</title>
		<link>http://www.jiramot.info/blackberry-hidden-command</link>
		<comments>http://www.jiramot.info/blackberry-hidden-command#comments</comments>
		<pubDate>Sun, 14 Mar 2010 20:45:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[blackberry]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=512</guid>
		<description><![CDATA[To Check Your Device General Information:
At  the home screen of your Berry
press: alt + shift + h
this  is what gonna appear

Your PIN will be shown, but If the PIN:  Suspended, means u can&#8217;t use BlackBerry Internet Service. Don&#8217;t Buy  it!!!

To Check Your Device  Voice/Data Usage:
A Brand New item should not [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To Check Your Device General Information:</strong></p>
<p><strong>At  the home screen of your Berry<br />
press: alt + shift + h</strong></p>
<p>this  is what gonna appear<br />
<img src="http://www.crackberry.com/files/u10880/7.jpg" border="0" alt="user posted  image" /></p>
<p>Your PIN will be shown, but If the PIN:  Suspended, means u can&#8217;t use BlackBerry Internet Service. Don&#8217;t Buy  it!!!</p>
<p><span id="more-512"></span><br />
<strong>To Check Your Device  Voice/Data Usage:</strong></p>
<p>A Brand New item should not exceed  the limit</p>
<p><strong>Go to: Options &gt; Status &gt; Type: BUYR</strong> (for  qwerty KeyPad)</p>
<p><strong>Go to: Options &gt; Status &gt; Type: BUZR</strong> (for qwertz KeyPad)</p>
<p><img src="http://1.bp.blogspot.com/_KWJmMfufi8E/SaaaSrzmeBI/AAAAAAAABxg/QHZ-00XTzRE/s320/bb-buyer.png" border="0" alt="user posted image" /><br />
Definitely Brand New Device</p>
<p><img src="http://celemotan.files.wordpress.com/2009/04/capture10_0_34.jpg" border="0" alt="user posted image" /><br />
Not Brand New</p>
<p>If The usage  not exceed, perhaps is just for testing purposes</p>
<p><strong>To Check Your Device Locked or Unlocked:</strong><br />
<strong></p>
<p>Go  to: Options &gt; Advanced Options &gt; SIM CARD &gt; Type: MEPD</strong></p>
<p><img src="http://bekas.files.wordpress.com/2008/05/5.gif" border="0" alt="user posted  image" /><br />
Device Locked by Provider</p>
<p><img src="http://3466.voxcdn.com/wp-content/uploads/mepd_2Dunlocked_small.jpg" border="0" alt="user posted image" /><br />
Device Fully Unlocked</p>
<p><strong><span style="color: #000000;">Enterprise Activation</span> (Options-&gt;Advanced)</strong><br />
ALT+CNFG &#8211; Settings for Enterprise  Activation</p>
<p><span style="color: #000000;"><strong>Address Book</strong><br />
</span>ALT+VALD  &#8211; Validate the data structure and look for inconsistencies<br />
ALT+RBLD &#8211;  Force a data structure rebuild</p>
<p>from the Options menu, type the  following (No ALT+ required)<br />
RSET &#8211; Will prompt to erase &amp; reload  for a reload of the Address book from the BES<br />
(n.b. this will wipe  all entries, but you can goto SIM Phone Book &amp; copy entries back  afterwards)</p>
<p><strong><span style="color: #000000;">Browser</span></strong><br />
ALT+RBVS  &#8211; View web page source code</p>
<p><strong><span style="color: #000000;">Calendar</span></strong><br />
Open  up a Calendar item<br />
ALT+VIEW Inside any Calendar item Show extra info  for a Calendar event<br />
(including message ID &#8211; handy for BES log  troubleshooting)</p>
<p>from the Options menu, type the following (No  ALT+ required)<br />
SYNC &#8211; Enable Calendar slow sync<br />
RSET &#8211; Will prompt  for a reload of the calendar from the BES<br />
RCFG &#8211; Request BES  configuration<br />
SCFG &#8211; Send device configuration<br />
DCFG &#8211; Get CICAL  configuration<br />
SUPD &#8211; Enable detailed Cal. report for backup<br />
SUPS &#8211;  Disable detailed Cal. report for backup<br />
SUPN &#8211; Disable Cal. report  database<br />
LUID &#8211; Enable view by UID<br />
SRSL &#8211; Show Reminder status log</p>
<p><span style="color: #000000;"><strong>Messaging</strong><br />
</span>ALT+VIEW &#8211; For  messages, displays the RefId and FolderId for that particular message.  For PIM items, displays only the RefId.</p>
<p><strong><span style="color: #000000;">Search Application</span></strong><br />
ALT+ADVM Search  Application Enabled Advanced Global Search</p>
<p><strong><span style="color: #000000;">Home Screen</span></strong><br />
ALT(left)+Shift(right)+Del  &#8211; Restart the Blackberry (only for full-keyboard Blackberries)<br />
ALT+JKVV  &#8211; Display cause of PDP reject<br />
ALT+CAP+ H &#8211; Displays the Help Me  screen<br />
ALT + EACE &#8211; Displays the Help Me screen<br />
ALT + ESCR &#8211;  Displays the Help Me screen<br />
ALT + NMLL &#8211; Switches the signal strength  from bars to a numeric value.<br />
ALT + LGLG &#8211; Displays the Java™ event  log.</p>
<p><strong><span style="color: #000000;">WLAN</span></strong> (WLAN  wizard screen)<br />
ALT-SMON WLAN &#8211; Enable simulated Wizard mode<br />
ALT-SMOF  WLAN &#8211; Disable simulated Wizard mode</p>
<p><strong><span style="color: #000000;">Theme</span></strong> (from theme menu)<br />
ALT-THMN &#8211;  Change to no theme (B&amp;W)<br />
ALT-THMD &#8211; Change to default theme</p>
<p><strong><span style="color: #000000;">Date/Time</span></strong> (Date/Time menu &#8211; No ALT+  required)<br />
LOLO &#8211; Date/Time Show Network time values</p>
<p><strong><span style="color: #000000;">SIM Card</span></strong> (Options-&gt;Advanced-&gt;SIM  card &#8211; No ALT+ required)<br />
MEPD &#8211; Display MEP info<br />
<span style="color: #000000;">MEP1 &#8211; Disable SIM personalization<br />
MEP2 &#8211; Disable  Network personalization<br />
MEP3 &#8211; Disable Network subset personalization<br />
MEP4  &#8211; Disable Service provider personalization<br />
MEP5 &#8211; Disable Corporate  personalization</p>
<p><strong>Status</strong> (Options-&gt;Status)<br />
BUYR  &#8211; Data &amp; Voice Usage</span><br />
TEST &#8211; start a device test  (Keyboard, GPS, RF, Audio (Handset,headset,bluetooth, Misc)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/blackberry-hidden-command/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<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>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[tsql]]></category>

		<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>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>

		<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>
	</channel>
</rss>
