<?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>SlickDev &#187; Tips &amp; Tricks</title>
	<atom:link href="http://www.slickdev.com/category/tipsntricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.slickdev.com</link>
	<description>Freelance Web and Software Developer</description>
	<lastBuildDate>Mon, 30 Jan 2012 14:21:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>VMWare Sphere 5 Boot Delay</title>
		<link>http://www.slickdev.com/2012/01/30/vmware-sphere-5-boot-delay/</link>
		<comments>http://www.slickdev.com/2012/01/30/vmware-sphere-5-boot-delay/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 14:19:25 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mods]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[mod]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=220</guid>
		<description><![CDATA[Note, this is a WhiteBox setup so not all parts are officially supported by VMWare. Specs below&#8230; i7 2600K Gigabyte P67A-UD4 B3 8GB DDR3-1866hz 9-9-9 1TB Samsung F3 drives Intel Gigabit Network card Now, the issue here is that after a clean install of VMWare Sphere 5, boot-up would take at least 5-9 min to [...]]]></description>
			<content:encoded><![CDATA[<p>Note, this is a WhiteBox setup so not all parts are officially supported by VMWare. Specs below&#8230;</p>
<ul>
<li>i7 2600K</li>
<li>Gigabyte P67A-UD4 B3</li>
<li>8GB DDR3-1866hz 9-9-9</li>
<li>1TB Samsung F3 drives</li>
<li>Intel Gigabit Network card</li>
</ul>
<p>Now, the issue here is that after a clean install of VMWare Sphere 5, boot-up would take at least 5-9 min to complete from a clean power-on. Compared to an upgrade from VMWare Sphere 4.1U1 which will load all the necessary drivers right away after a restart/power-on. It seems like its not detecting the HDD at all at first glance but soon found its way. Further tests, experiments and research yielded that this is a side-effect on how VMWare handled their installation process in VMWare Sphere 5 compared to 4.1U1. In 4.1U1, it uses the MBR for the boot process by default, while in 5.0 it uses GPT. You can fixed this if you force the installer to use MBR during the installation phase.<br />
<span id="more-220"></span><br />
A developer from VMWare confirmed this and posted a way to fix this. You can find the thread <a href="http://communities.vmware.com/message/1822791#1822791" target="_blank">here</a>. </p>
<p>To quote him&#8230;</p>
<blockquote><p>By default ESXi 5.0 uses GPT based partitions tables and not MBR like it did previously.  This allows you to have disks which are greater than 2TB in size, but some systems are incompatible with it (possibly including yours) or need to have the correct BIOS setting.</p>
<p>You can try changing your BIOS to see if it&#8217;s compatible with EFI or will work in &#8220;legacy/compatibility mode&#8221;.  Alternatively you can reinstall and use the &#8220;formatwithmbr&#8221; setting at the boot prompt which will cause the partitions to be set up the way they were in ESX 4.x.  Just add it in the same way you would to tell the machine to do a scripted install.</p></blockquote>
<p>To make things short, as written by <strong>wdbarker</strong>&#8230;. </p>
<blockquote><p>the boot prompt appears after you hit <strong>Shift-O</strong> during the boot process. You will see <strong>runweasel </strong>already in the boot prompt. Right arrow to the end, add a space and <strong>formatwithmbr </strong>and press enter. The prompt will look like: <strong>runweasel formatwithmbr</strong></p></blockquote>
<p>So, there you go. Hope this helps.</p>
<p>This was in collaboration with a friend of mine (Earlz) for setting up the box and helping me debug.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2012/01/30/vmware-sphere-5-boot-delay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 Server ACPI/APM Support</title>
		<link>http://www.slickdev.com/2011/08/17/ubuntu-10-04-server-acpiapm-support/</link>
		<comments>http://www.slickdev.com/2011/08/17/ubuntu-10-04-server-acpiapm-support/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 23:38:04 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mods]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=181</guid>
		<description><![CDATA[Advance Configuration and Power Interface (ACPI) or APM ( Advance Power Management ) support for Ubuntu 10.04 was not installed by default after server installation.  I needed this so that during power outage I can just press the power button to automatically shutdown the PC. sudo aptitude install acpi acpi-support apm This will install the [...]]]></description>
			<content:encoded><![CDATA[<p>Advance Configuration and Power Interface (ACPI) or APM ( Advance Power Management ) support for Ubuntu 10.04 was not installed by default after server installation.  I needed this so that during power outage I can just press the power button to automatically shutdown the PC.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> acpi acpi-support <span style="color: #c20cb9; font-weight: bold;">apm</span></pre></div></div>

<p>This will install the power-button-power-off feature in you server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2011/08/17/ubuntu-10-04-server-acpiapm-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Built-in Intel 82579 Based Ethernet Card in Intel DH61WW Motherboard under Ubuntu 10.04 Server LTS</title>
		<link>http://www.slickdev.com/2011/08/07/enable-built-in-intel-82579-based-ethernet-card-in-intel-dh61ww-motherboard-under-ubuntu-10-04-server-lts/</link>
		<comments>http://www.slickdev.com/2011/08/07/enable-built-in-intel-82579-based-ethernet-card-in-intel-dh61ww-motherboard-under-ubuntu-10-04-server-lts/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 05:47:14 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mods]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=163</guid>
		<description><![CDATA[82579 based Ethernet network cards are only supported in Kernel 2.6.36 and up, thus Ubuntu 10.04 LTS will not have out-of-the-box support for the network card. I needed this to work since I&#8217;ll be using this as my server and 11.04 is not LTS, I have no choice. To fix this with the motherboard I have from [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">82579 based Ethernet network cards are only supported in <strong>Kernel 2.6.36</strong> and up, thus Ubuntu 10.04 LTS will not have out-of-the-box support for the network card. I needed this to work since I&#8217;ll be using this as my server and 11.04 is not LTS, I have no choice. To fix this with the motherboard I have from Intel, here are the steps that I did&#8230;</p>
<ol>
<li>Download the driver source from Intel driver webpage <a href="http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&amp;ProdId=2198&amp;DwnldID=15817&amp;ProductFamily=Ethernet+Components&amp;ProductLine=Ethernet+Controllers&amp;ProductProduct=Intel%C2%AE+82573L+Gigabit+Ethernet+Controller&amp;DownloadType=Drivers&amp;OSFullname=Linux*eng" target="_blank">here</a>, or the latest one they have. Double check if the driver supports the version of the network card, the one I have is 82579.</li>
<li>Ready the Ubuntu server, install <strong><em>make gcc g++ </em></strong>and <strong><em>linux headers</em></strong>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #c20cb9; font-weight: bold;">g++</span> linux-headers-<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

</li>
<li>Un-pack the src driver that you just downloaded, compile and install.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gunzip</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>filename<span style="color: #7a0874; font-weight: bold;">&#93;</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>filename<span style="color: #7a0874; font-weight: bold;">&#93;</span>.tar
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>folder_name<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

</li>
<li>If everything goes well, no error should come out, then enable your new ethernet card.

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">modprobe e1000e</pre></div></div>

</li>
<li>You can check your new network card via <strong><em>ifconfig</em></strong><br />
Enjoy! <img src='http://www.slickdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ol>
<p><strong>Note:</strong> If you update your kernel or linux image via <strong>aptitude safe-upgrade</strong> or <strong>dist-upgrade</strong>, you need to remove the <strong>e1000e</strong> module, re-compile the driver and install the newly compiled driver again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2011/08/07/enable-built-in-intel-82579-based-ethernet-card-in-intel-dh61ww-motherboard-under-ubuntu-10-04-server-lts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blocking DNS requests with Shorewall to prevent OpenDNS Bypass</title>
		<link>http://www.slickdev.com/2011/06/28/blocking-dns-requests-with-shorewall-to-prevent-opendns-bypass/</link>
		<comments>http://www.slickdev.com/2011/06/28/blocking-dns-requests-with-shorewall-to-prevent-opendns-bypass/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 13:38:46 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=148</guid>
		<description><![CDATA[Here&#8217;s a way to block users from using a different DNS address other than your own local DNS server to bypass OpenDNS filtering. I&#8217;m currently using Shorewall in an Ubuntu 8.04 LTS server setup as my Firewall, Gateway and DNS, and works nicely. This should also work in 10.04 or other Ubuntu install that has [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a way to block users from using a different DNS address other than your own local DNS server to bypass OpenDNS filtering. I&#8217;m currently using Shorewall in an Ubuntu 8.04 LTS server setup as my Firewall, Gateway and DNS, and works nicely. This should also work in 10.04 or other Ubuntu install that has Shorewall firewall. Side effect for the user will be that they wont be able to surf the net until they revert back to the assigned DNS to use.</p>
<p>In your Shorewall <strong>Rules</strong> file, add this above the other rules.</p>
<p><code><br />
DNS/ACCEPT  $FW     net<br />
DNS/ACCEPT  net     $FW<br />
DNS/DROP    loc     net<br />
DNS/DROP    net     loc</code></p>
<p><strong>$FW</strong> is your firewall/gateway and in my setup my DNS. You can change <strong>$FW</strong> to <em>loc:&lt;dns_ip_address&gt; </em>if your DNS is located in another machine other than your gateway.</p>
<p>Have fun raining in on their parade <img src='http://www.slickdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>P.S. You can add filters to allow certain IP or MAC addresses to use DNS outside (i.e. Google DNS ).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2011/06/28/blocking-dns-requests-with-shorewall-to-prevent-opendns-bypass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto Updating OpenDNS with Dynamic IP Address via Ubuntu Server</title>
		<link>http://www.slickdev.com/2010/11/05/auto-updating-opendns-with-dynamic-ip-address-via-ubuntu-server/</link>
		<comments>http://www.slickdev.com/2010/11/05/auto-updating-opendns-with-dynamic-ip-address-via-ubuntu-server/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 14:58:01 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openDNS]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=136</guid>
		<description><![CDATA[I have a linux Ubuntu server and a dynamic IP for the DSL connection. The office needs web filtering and getting a static IP will just add cost to the now tight budget. Looking around there is actually a way to update OpenDNS IP address under linux. Below are what is needed to be installed [...]]]></description>
			<content:encoded><![CDATA[<p>I have a linux Ubuntu server and a dynamic IP for the DSL connection. The office needs web filtering and getting a static IP will just add cost to the now tight budget. Looking around there is actually a way to update OpenDNS IP address under linux. Below are what is needed to be installed and configured.</p>
<ul>
<li>Any latest Ubuntu server ( I&#8217;m using Ubuntu 10.10 Server )</li>
<li><strong>ddclient </strong>installed (use &#8220;aptitude install ddclient&#8221;)</li>
<li>net connection, I have set up my linux server as a firewall/gateway</li>
</ul>
<p>After installing <strong>ddclient</strong>, go to <strong>/etc</strong> and edit <strong>ddclient.conf</strong>, below is the format that I used, modify it to suite your configuration.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">ssl</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">use</span>=web, <span style="color: #007800;">web</span>=whatismyip.org
<span style="color: #007800;">server</span>=updates.opendns.com
<span style="color: #007800;">protocol</span>=dyndns2
<span style="color: #007800;">login</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>openDNS_username_here<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #007800;">password</span>=<span style="color: #ff0000;">'&lt;openDNS_password_here&gt;'</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>openDNS_network_label_here<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #666666; font-style: italic;">#this can be found under settings, just the label, nothing else should be added here</span></pre></div></div>

<p>Save the new configuration file and restart the client <code> /etc/init.d/ddclient restart</code><br />
Also make sure that the network that your going to update the IP address has set its <strong>Dynamic IP Update</strong> option <strong>enabled</strong>. This can be found under the advance setting of the network.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2010/11/05/auto-updating-opendns-with-dynamic-ip-address-via-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Special Character Encoding in XML</title>
		<link>http://www.slickdev.com/2010/02/13/special_character_encoding_in_xml/</link>
		<comments>http://www.slickdev.com/2010/02/13/special_character_encoding_in_xml/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 02:36:16 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=121</guid>
		<description><![CDATA[Ran into a problem returning an XML data with special characters encoded into it through an AJAX call. The problem was that special characters (i.e. &#38;ntilde; -> &#241;) throws an error when being returned through XML and is in the process of being parsed by the browser. The catch? XML does not support named entities [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into a problem returning an XML data with special characters encoded into it through an AJAX call. The problem was that special characters (i.e. &amp;ntilde; -> &ntilde;) throws an error when being returned through XML and is in the process of being parsed by the browser. </p>
<p>The catch?<br />
XML does not support <em>named entities</em> by default, you have to declare it before hand. Only <strong>&amp;lt; &amp;gt; &amp;amp; &amp;quot;</strong> and <strong>&amp;apos;</strong>  are predefined.</p>
<p>Something like:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td 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: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE xsl:stylesheet [ &lt;!ENTITY nbsp &quot;&amp;#160;&quot;&gt;</span> ]&gt;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:stylesheet</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/XSL/Transform&quot;</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></pre></td></tr></table></div>

<p>Got this from <a href="http://www.dpawson.co.uk/xsl/sect2/nbsp.html">here&#8230;</a></p>
<p>The fix&#8230;<br />
Instead of using named entities in the XML (I think this also affects JSON, I could be wrong since I didn&#8217;t test this is JSON) like &amp;ntilde;, use character references to support special character encoding.</p>
<p>Example:<br />
white space = &amp;nbsp; = &amp;#160;<br />
&ntilde; = &amp;ntilde; = &amp;#241;</p>
<p>they are all the same&#8230; #160 is referenced/mapped to &#8221; &#8221; and #241 is referenced/mapped to &ntilde;</p>
<p>So when forming your XML before returning it through an AJAX call, form the special characters via character reference.</p>
<p>Hope this helps you out there having this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2010/02/13/special_character_encoding_in_xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java IO Problem in Tomcat</title>
		<link>http://www.slickdev.com/2010/02/13/java-io-problem-in-tomcat/</link>
		<comments>http://www.slickdev.com/2010/02/13/java-io-problem-in-tomcat/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 02:05:23 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=117</guid>
		<description><![CDATA[Encountered this problem today while testing an image upload AJAX script in tomcat. Later on I found out that the folder is actually protected Win7 and tomcat couldn&#8217;t write the cache or temporary file into the folder. So anyone having this problem, check the following&#8230; What OS are you running? Vista/Win7? What IDE are you [...]]]></description>
			<content:encoded><![CDATA[<p>Encountered this problem today while testing an image upload AJAX script in tomcat. Later on I found out that the folder is actually protected Win7 and tomcat couldn&#8217;t write the cache or temporary file into the folder.</p>
<p>So anyone having this problem, check the following&#8230;</p>
<ul>
<li>What OS are you running? Vista/Win7?</li>
<li>What IDE are you using?</li>
<li>Was your IDE elevated to admin status?</li>
</ul>
<p>So, check your OS, I&#8217;m using Win7. I was developing this under WinXP a few months back, and now under Win7, the folder is protected since it was under the &#8220;Program Files (x86)&#8221; folder group. (Argh!)<br />
I closed my IDE, using IDEA IntelliJ 9.0, ran the IDE under <strong>&#8220;Administrator Level&#8221;</strong> and the problem disappeared!</p>
<p>So check those out first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2010/02/13/java-io-problem-in-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java JNI: Unsatisfied Link Error in Library Path</title>
		<link>http://www.slickdev.com/2009/05/05/java-jni-unsatisfied-link-error-in-library-path/</link>
		<comments>http://www.slickdev.com/2009/05/05/java-jni-unsatisfied-link-error-in-library-path/#comments</comments>
		<pubDate>Tue, 05 May 2009 08:29:06 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=88</guid>
		<description><![CDATA[I&#8217;m currently playing around with Java Native Interfaces(JNI) and I must say its been too long since I programmed in Java. Its good to be back! Anyway, lets hop to the main topic&#8230; I was following the tutorial from Sun in creating my first JNI and calling my compiled C++ library, I was stuck in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently playing around with Java Native Interfaces(JNI) and I must say its been too long since I programmed in Java. Its good to be back! Anyway, lets hop to the main topic&#8230;</p>
<p>I was following the tutorial from Sun in creating my first JNI and calling my compiled C++ library, I was stuck in the last part where this error popped out whenever I tried to invoke</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java HelloWorld</pre></div></div>

<p>the error was&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java.lang.UnsatisfiedLinkError: no HelloWorld <span style="color: #000000; font-weight: bold;">in</span> java.library.path
          at java.lang.ClassLoader.loadLibrary<span style="color: #7a0874; font-weight: bold;">&#40;</span>ClassLoader.java:<span style="color: #000000;">1709</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
          at java.lang.Runtime.loadLibrary0<span style="color: #7a0874; font-weight: bold;">&#40;</span>Runtime.java:<span style="color: #000000;">823</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
          at java.lang.System.loadLibrary<span style="color: #7a0874; font-weight: bold;">&#40;</span>System.java:<span style="color: #000000;">1030</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
          at HelloWorld.<span style="color: #000000; font-weight: bold;">&lt;</span>clinit<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>HelloWorld.java:<span style="color: #000000; font-weight: bold;">&lt;</span>line number<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Could not <span style="color: #c20cb9; font-weight: bold;">find</span> the main class: HelloWorld. Program will exit.</pre></div></div>

<p>one way of fixing this is to include the current location of your newly compiled shared library (ex. HelloWorld.so). I&#8217;m using Ubuntu linux,so to include the current folder where your &#8220;.so&#8221; file is located, invoke&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">export</span> LD_LIBRARY_PATH</pre></div></div>

<p>or you can also do &#8230;<br />
<span id="more-88"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">LD_LIBRARY_PATH</span>=.
<span style="color: #7a0874; font-weight: bold;">export</span> LD_LIBRARY_PATH</pre></div></div>

<p>another way is to define the location when running the program&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java -Djava.library.path=. HelloWorld</pre></div></div>

<p>this will instruct java to locate the native library in the current location. Now call your program again and this time it work execute your native program.</p>
<p>It&#8217;s possible that when you execute your program after doing the above steps, another error will come out. This happened to me and the culprit was when I compiled the cpp file. The error would look something like&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java.lang.UnsatisfiedLinkError: <span style="color: #000000; font-weight: bold;">&lt;</span>library location<span style="color: #000000; font-weight: bold;">&gt;</span>: <span style="color: #000000; font-weight: bold;">&lt;</span>library location<span style="color: #000000; font-weight: bold;">&gt;</span>: only ET_DYN and ET_EXEC can be loaded
        at java.lang.ClassLoader<span style="color: #007800;">$NativeLibrary</span>.load<span style="color: #7a0874; font-weight: bold;">&#40;</span>Native Method<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        at java.lang.ClassLoader.loadLibrary0<span style="color: #7a0874; font-weight: bold;">&#40;</span>ClassLoader.java:<span style="color: #000000;">1778</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        at java.lang.ClassLoader.loadLibrary<span style="color: #7a0874; font-weight: bold;">&#40;</span>ClassLoader.java:<span style="color: #000000;">1674</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        at java.lang.Runtime.load0<span style="color: #7a0874; font-weight: bold;">&#40;</span>Runtime.java:<span style="color: #000000;">770</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        at java.lang.System.load<span style="color: #7a0874; font-weight: bold;">&#40;</span>System.java:<span style="color: #000000;">1005</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        at HelloWorld.<span style="color: #000000; font-weight: bold;">&lt;</span>clinit<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>HelloWorld.java:<span style="color: #000000;">16</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>to fix this, include the &#8220;-shared&#8221; option when compiling the cpp file.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-shared</span> HelloWorld.cpp <span style="color: #660033;">-o</span> HelloWorld.so <span style="color: #660033;">-I</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>folder<span style="color: #000000; font-weight: bold;">/</span>where<span style="color: #000000; font-weight: bold;">/</span>jni.h<span style="color: #000000; font-weight: bold;">/</span>is<span style="color: #000000; font-weight: bold;">/</span>located <span style="color: #660033;">-I</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>folder<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Do not include the &#8220;-c&#8221; option, this will skip the linking stage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2009/05/05/java-jni-unsatisfied-link-error-in-library-path/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Continuous Explorer Restarting Virus/Trojan</title>
		<link>http://www.slickdev.com/2008/12/09/continuous-explorer-restarting-virustrojan/</link>
		<comments>http://www.slickdev.com/2008/12/09/continuous-explorer-restarting-virustrojan/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 03:56:35 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=76</guid>
		<description><![CDATA[Came across this little bugger in my manager&#8217;s pc. The whole thing is that after logging into windows, the windows explorer continuously restart and exits. You can click the start button, open something but will naturally kill itself when explorer exits. You can&#8217;t even open the drives and folders normally since it will close sooner [...]]]></description>
			<content:encoded><![CDATA[<p>Came across this little bugger in my manager&#8217;s pc. The whole thing is that after logging into windows, the windows explorer continuously restart and exits. You can click the start button, open something but will naturally kill itself when explorer exits. You can&#8217;t even open the drives and folders normally since it will close sooner or later, anything running under Explorer.exe will die when Explorer.exe dies. Simplest way around the folder and drives is using the good ol&#8217; command prompt. Did this and amazingly it didn&#8217;t die, thank God for command prompts. As usual scouring the RECYCLER folder for hidden trojans resulted in a no show, next was the usual system32 and system folder under windows folder. These little buggers get smarter everyday. There weren&#8217;t and hidden files so I was already assuming the exe file is there and ran through windows startup using the registry. Using autoruns from sysinternals, found one of the problems, a rogue exe is started everytime the system starts. Deleted the entry from the registry, located the file under system32 folder and also removed it. </p>
<p>That didn&#8217;t fixed the problem.</p>
<p>There was something else running when windows starts up. Next target&#8230; DLLs. Amazingly, there were dlls that was out-of-placed and curiously named. Example crypt32.dll that wasn&#8217;t signed by microsoft. Removed the entry and tried to remove the dll. No luck, its being used. Next tool that was very useful was Unlocker. I &#8216;unlocked&#8217; the hook for the dll and restarted. Still didn&#8217;t fix it but I was getting close. There were two more dlls I found that was very suspicious. I tried to kill one and removed, the other regenerated the dll. I try to unhook the other dll, the whole pc restarts. Smart bugger. Thank goodness for safe mode. Restarted in safe mode and use unlocker again to unhook the dll. Removed one of the dll and its entry in the registry. Good&#8230; it didn&#8217;t restart&#8230; just a countdown for a system shutdown.. freaking dll.</p>
<p>The system restarted and good news is the dll that forced the shutdown wasn&#8217;t regenerated. Last dll was a bit simpler. Used unlocker to unhook the dll, deleting was not successful, though unlocker had a feature to delete the dll after a restart. Selected the option and waited. Thankfully, the whole ordeal ended there. All three dlls didn&#8217;t regenerate after that. </p>
<p>Note to PC users who watch videos from torrent ( Heroes, Prison break&#8230;). If it asks you to download a player to run the video you downloaded.. DON&#8217;T!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2008/12/09/continuous-explorer-restarting-virustrojan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Slave Failed to Open the Relay Log</title>
		<link>http://www.slickdev.com/2008/10/20/mysql-slave-failed-to-open-the-relay-log/</link>
		<comments>http://www.slickdev.com/2008/10/20/mysql-slave-failed-to-open-the-relay-log/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 14:53:32 +0000</pubDate>
		<dc:creator>Chaoz</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.slickdev.com/?p=68</guid>
		<description><![CDATA[This problem is a little tricky, there are possible fixes that MySQL website has stated. Sad to say, the one&#8217;s I read in the forum and site didn&#8217;t fix my problem. What I encountered was that the relay-bin from my MySQL slave server has already been &#8216;rotated&#8217;, meaning deleted from the folder. This happens when [...]]]></description>
			<content:encoded><![CDATA[<p>This problem is a little tricky, there are possible fixes that MySQL website has stated. Sad to say, the one&#8217;s I read in the forum and site didn&#8217;t fix my problem. What I encountered was that the relay-bin from my MySQL  slave server has already been &#8216;rotated&#8217;, meaning <em>deleted</em> from the folder. This happens when the slave has been disconnected from the master for quite a long time already and has not replicated anything. A simple way to fix this is to flush the logs, but make sure the slave is stopped before using this command&#8230;</p>
<p><code>FLUSH LOGS;</code></p>
<p>Bring in a fresh copy of the database from the master-server and update the slave-server database. THIS IS IMPORTANT! Since if you don&#8217;t update the slave database, you will not have the data from the time you were disconnected until you reset the relay logs. So UPDATE YOUR SLAVE WITH THE LATEST DATABASE FROM THE MASTER!</p>
<p>Now when the logs are flushed,all the relay-bin logs will be deleted when the slave is started again. Usually, this fixes the problem, but when you start the slave and the failed relay log error is still there, now you have to do some more desperate measures&#8230; reset the slave. This is what I had to do to fully restore my MySQL slave server. Reseting the slaves restores all the settings to default&#8230; password, username, relay-log, port, table to replicate, etc&#8230; So better to have a copy of your settings first before actually do a slave reset. When your ready to rest the slave, do the command&#8230;</p>
<p><code>RESET SLAVE;</code></p>
<p>after which you should restore all your setting with a command something like&#8230;</p>
<p><code>CHANGE MASTER TO MASTER_HOST=.....</code></p>
<p>now start your server with&#8230;</p>
<p><code>SLAVE START;</code></p>
<p>check your slave server with&#8230;</p>
<p><code>SHOW SLAVE STATUS\G</code></p>
<p>look for &#8230;</p>
<p><code>Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes</code></p>
<p>both should be <strong>YES</strong>, if not, check your syslog if there are other errors encountered. I&#8217;ll leave this until here since this is what I encountered and I was able to fix it.</p>
<p><strong>Edit 5/14/11:</strong></p>
<p>There is a possible change that after executing the CHANGE MASTER command that you&#8217;ll receive this error below&#8230;</p>
<p><em>ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log</em></p>
<p>This can occur when the relay logs under /var/lib/mysql were not properly cleaned and are still there. The next thing is to delete them manually, log back in to mysql, refresh logs, reset slave then execute the CHANGE MASTER command again. The file to delete would be <em>relay-log.info</em> .This should work now. Sometimes I don&#8217;t know why mysql can&#8217;t reset the slave logs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slickdev.com/2008/10/20/mysql-slave-failed-to-open-the-relay-log/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

