<?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>Andrey Butov</title>
	<atom:link href="http://www.andreybutov.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andreybutov.com</link>
	<description></description>
	<lastBuildDate>Sat, 17 Dec 2011 20:02:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Pregnancy Food Guide on Android</title>
		<link>http://www.andreybutov.com/2011/12/17/pregnancy-food-guide-on-android/</link>
		<comments>http://www.andreybutov.com/2011/12/17/pregnancy-food-guide-on-android/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 19:53:06 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Antair]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1284</guid>
		<description><![CDATA[Pregnancy Food Guide has been available for the iPhone for a short while now, and as of today, it&#8217;s also available for your Android phone.]]></description>
			<content:encoded><![CDATA[<p><strong>Pregnancy Food Guide</strong> has been available <a href="http://itunes.apple.com/us/app/pregnancy-food-guide/id472845598?ls=1&amp;mt=8">for the iPhone</a> for a short while now, and as of today, it&#8217;s also available <a href="https://market.android.com/details?id=com.antair.android.pregnancyfoodguide">for your Android phone</a>.</p>
<p><a href="https://market.android.com/details?id=com.antair.android.pregnancyfoodguide"><img class="alignnone size-full wp-image-1287" title="Pregnancy Food Guide for Android" src="http://www.andreybutov.com/wp-content/uploads/2011/12/screenshot_200_356.png" alt="" width="200" height="356" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/12/17/pregnancy-food-guide-on-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The What Now? Podcast</title>
		<link>http://www.andreybutov.com/2011/12/16/the-what-now-podcast/</link>
		<comments>http://www.andreybutov.com/2011/12/16/the-what-now-podcast/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 21:27:52 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1279</guid>
		<description><![CDATA[A long time ago, Gavin Bowman and I worked together at Antair. Gavin is now the co-founder of Retro Dreamer, where he makes awesome mobile games &#8230; and I&#8217;m still stuck here. Anyway, check out our new podcast, What Now?, where we talk about making a living by peddling mobile apps and games. &#160;]]></description>
			<content:encoded><![CDATA[<p>A long time ago, <a href="http://twitter.com/#!/GavinBowman">Gavin Bowman</a> and I worked together at <a href="http://www.antair.com">Antair</a>.</p>
<p>Gavin is now the co-founder of <a href="http://www.retrodreamer.com">Retro Dreamer</a>, where he makes awesome mobile games &#8230; and I&#8217;m still stuck here. <img src='http://www.andreybutov.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyway, check out our new podcast, <a href="http://www.whatnowpodcast.com">What Now?</a>, where we talk about making a living by peddling mobile apps and games.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/12/16/the-what-now-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Antair Nightstand on the Amazon Kindle Fire</title>
		<link>http://www.andreybutov.com/2011/11/26/antair-nightstand-on-the-amazon-kindle-fire/</link>
		<comments>http://www.andreybutov.com/2011/11/26/antair-nightstand-on-the-amazon-kindle-fire/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 17:00:59 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Antair]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1277</guid>
		<description><![CDATA[Antair Nightstand is now available on the Amazon Kindle Fire. You can purchase your copy directly from your Kindle Fire.]]></description>
			<content:encoded><![CDATA[<p>Antair Nightstand is now available on the <a href="http://www.amazon.com/Antair-Nightstand/dp/B006C1G8L6/ref=sr_1_1?ie=UTF8&amp;s=mobile-apps&amp;qid=1322325868&amp;sr=1-1">Amazon Kindle Fire</a>.</p>
<p>You can purchase your copy directly from your Kindle Fire.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/11/26/antair-nightstand-on-the-amazon-kindle-fire/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Our latest app for the iPhone</title>
		<link>http://www.andreybutov.com/2011/11/16/our-latest-app-for-the-iphone/</link>
		<comments>http://www.andreybutov.com/2011/11/16/our-latest-app-for-the-iphone/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 15:29:11 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Antair]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1265</guid>
		<description><![CDATA[I&#8217;d like to introduce the Pregnancy Food Guide, Antair&#8217;s latest app for the iPhone. &#160; Know what you can eat and what you can&#8217;t when you&#8217;re expecting. When shopping for food or eating at a restaurant, this handy and informative guide will help you make safe decisions for you and your baby. The application features [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to introduce the <a href="http://itunes.apple.com/us/app/pregnancy-food-guide/id472845598?ls=1&amp;mt=8">Pregnancy Food Guide</a>, Antair&#8217;s latest app for the iPhone.</p>
<p><a href="http://itunes.apple.com/us/app/pregnancy-food-guide/id472845598?ls=1&amp;mt=8"><img class="alignnone size-full wp-image-1266" title="screenshot3_320_480" src="http://www.andreybutov.com/wp-content/uploads/2011/11/screenshot3_320_480.png" alt="" width="320" height="480" /></a></p>
<p>&nbsp;</p>
<p>Know what you can eat and what you can&#8217;t when you&#8217;re expecting.</p>
<p>When shopping for food or eating at a restaurant, this handy and informative guide will help you make safe decisions for you and your baby.</p>
<p>The application features hundreds of common foods, drinks, and ingredients, along with information on whether the food is safe to consume during pregnancy, and any related benefits or dangers.</p>
<p><a href="http://itunes.apple.com/us/app/pregnancy-food-guide/id472845598?ls=1&amp;mt=8"><img class="alignnone size-full wp-image-1267" style="border: none;" title="app-store" src="http://www.andreybutov.com/wp-content/uploads/2011/11/app-store.png" alt="" width="200" height="65" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/11/16/our-latest-app-for-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set up a faster Android emulator</title>
		<link>http://www.andreybutov.com/2011/10/14/how-to-set-up-a-faster-android-emulator/</link>
		<comments>http://www.andreybutov.com/2011/10/14/how-to-set-up-a-faster-android-emulator/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 02:02:10 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1204</guid>
		<description><![CDATA[For certain projects, you may find that the default Android emulator is far too slow for accurate testing. In this guide, I will show you how to set up a faster alternative. I will be using Windows, but the tools are platform-agnostic, so you shouldn&#8217;t have trouble setting up a faster Android emulator on a [...]]]></description>
			<content:encoded><![CDATA[<p>For certain projects, you may find that the default Android emulator is far too slow for accurate testing.</p>
<p>In this guide, I will show you how to set up a faster alternative. I will be using Windows, but the tools are platform-agnostic, so you shouldn&#8217;t have trouble setting up a faster Android emulator on a Mac or a Linux box. I will also show you how to configure the resolution of the new Android emulator so you can emulate specific Android devices, such as the Amazon Kindle Fire.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1218" title="VirtualBox" src="http://www.andreybutov.com/wp-content/uploads/2011/10/virtualbox.png" alt="" width="400" height="191" /></p>
<p>First, download and install <a href="https://www.virtualbox.org/">VirtualBox</a>. We&#8217;ll be running our faster Android emulator as a virtual machine. You can probably use VMWare, or Parallels, but VirtualBox is available free of charge, and works perfectly well for our purposes.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1220" title="Android Images" src="http://www.andreybutov.com/wp-content/uploads/2011/10/androidimages.png" alt="" width="400" height="270" /></p>
<p>Now, download the <a href="http://code.google.com/p/androbox/downloads/list">Android image</a>. For this guide, I will be using Android 2.3 (Gingerbread). For that release, the matching download is <strong>android-x86.2.3-4th-test-110620.iso</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1222" title="New Virtual Machine" src="http://www.andreybutov.com/wp-content/uploads/2011/10/newmachine.png" alt="" width="400" height="299" /></p>
<p>Start VirtualBox and create a new virtual machine.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1223" title="Setting up a new Virtual Machine" src="http://www.andreybutov.com/wp-content/uploads/2011/10/vmname.png" alt="" width="400" height="297" /></p>
<p>Enter a name for your new virtual machine. Select <strong>Linux</strong> for the operating system, and <strong>Other Linux</strong> for the version.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1225" title="Virtual Machine Memory" src="http://www.andreybutov.com/wp-content/uploads/2011/10/memory.png" alt="" width="400" height="300" /></p>
<p>I want my Android emulator to run with 1 GB of RAM. You can choose whatever amount of memory is best for your needs.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1227" title="New Hard Disk" src="http://www.andreybutov.com/wp-content/uploads/2011/10/harddisk1.png" alt="" width="400" height="298" /></p>
<p>For Virtual Hard Disk, check <strong>Start-up Disk</strong>, and choose to <strong>Create a new hard disk</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1229" title="Type of Virtual Disk" src="http://www.andreybutov.com/wp-content/uploads/2011/10/vdi.png" alt="" width="400" height="299" /></p>
<p>Select <strong>VDI (VirtualBox Disk Image)</strong> for the type of virtual disk.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1231" title="Dynamically Allocated Storage" src="http://www.andreybutov.com/wp-content/uploads/2011/10/vdi2.png" alt="" width="400" height="299" /></p>
<p>Choose <strong>Dynamically Allocated</strong> storage.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1232" title="Disk Size" src="http://www.andreybutov.com/wp-content/uploads/2011/10/disksize.png" alt="" width="400" height="298" /></p>
<p>For disk size, I tend to allocate 512 MB. Feel free to allocate more or less disk space for your new emulator.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1233" title="New Machine Created" src="http://www.andreybutov.com/wp-content/uploads/2011/10/newmachine2.png" alt="" width="400" height="287" /></p>
<p>Once this is done, continue with the last few dialog boxes to create the new Android virtual machine.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1235" title="Virtual Machine Audio" src="http://www.andreybutov.com/wp-content/uploads/2011/10/sound.png" alt="" width="400" height="352" /></p>
<p>Click on <strong>Audio</strong>, and change the Audio Controller from ICH AC97, which doesn&#8217;t work very well with this setup, to <strong>SoundBlaster 16</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1236" title="Virtual Machine Network Settings" src="http://www.andreybutov.com/wp-content/uploads/2011/10/network.png" alt="" width="400" height="352" /></p>
<p>Click on <strong>Network</strong>, and change the setting to <strong>Host-only Adapter</strong>. Now, this bit is specific to your particular network configuration. Some folks claim that setting this to <strong>NAT</strong> or <strong>Bridged Adapter</strong> gives best results. Use whichever works best for your rig. I will proceed with <strong>Host-only Adapter</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1238" title="New CD or DVD device." src="http://www.andreybutov.com/wp-content/uploads/2011/10/cd.png" alt="" width="400" height="352" /></p>
<p>Click on <strong>Storage</strong>. Under Storage Tree, click on the icon to add a new CD/DVD device. When prompted, click on Choose Disk, and select the Android .iso image you downloaded earlier.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1240" title="" src="http://www.andreybutov.com/wp-content/uploads/2011/10/installtodisk.png" alt="" width="400" height="337" /></p>
<p>Start the new virtual machine. When prompted, choose <strong>Install Android-X86 to harddisk</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1242" title="Create a new partition" src="http://www.andreybutov.com/wp-content/uploads/2011/10/createpartition.png" alt="" width="400" height="257" /></p>
<p>When prompted to choose a partition, select <strong>Create/Modify partitions</strong>. In the cfdisk partition manager screen that follows, choose <strong>New</strong>, then <strong>Primary</strong>, and keep the default partition size. Toggle <strong>Bootable</strong>, and then proceed to <strong>Write</strong>. After the partition is created, choose <strong>Quit</strong> to exit cfdisk. Select the newly created partition, and choose <strong>ext3</strong> for the filesystem format. Select <strong>Yes</strong> when prompted to install the boot loader GRUB, and <strong>Yes</strong> to make the /system directory read-write. Installation should take just a few seconds.</p>
<p>After installation, close the virtual machine and remove the Android .iso CD/DVD in the <strong>Storage Settings</strong> before starting the virtual machine again.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1243" title="New Android Emulator" src="http://www.andreybutov.com/wp-content/uploads/2011/10/newandroid.png" alt="" width="400" height="332" /></p>
<p>When you start the new Android virtual machine, you&#8217;ll notice that you cannot use your mouse inside the Android OS. To fix this, choose <strong>Machine</strong> from the VirtualBox menu, and then choose to <strong>Disable Mouse Integration</strong>. You will now be able to use the mouse inside the Android OS. Take note of the <strong>host key</strong> used by your installation of VirtualBox. Without this host key, you won&#8217;t be able to get your mouse back out of the Android OS. I believe that the default host key used by VirtualBox on Windows is the right <strong>Control</strong> key, but this may be different in your installation. Click inside the Android virtual machine to bring your mouse into that environment. Click on the host key to get the mouse back out.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1246" title="IP Address" src="http://www.andreybutov.com/wp-content/uploads/2011/10/ip.png" alt="" width="400" height="111" /></p>
<p>To test your application in the new Android emulator from Eclipse, you&#8217;ll need to know the IP address of the virtual machine. Click <strong>ALT-F1</strong> to bring up the VirtualBox console, and type <strong>netcfg</strong> to display the IP address assigned to it. Take note of the IP address and click <strong>ALT-F7</strong> to get rid of the console.</p>
<p>You can now connect the Android Debug Bridge (<strong>adb</strong>) to the new virtual machine Android emulator. Bring up a command prompt window, and type <strong>adb connect 192.168.56.102</strong>. Of course, you&#8217;ll use the IP address of your virtual machine, which may be different. If your system can&#8217;t find <strong>adb.exe</strong>, add it to your environment PATH. You&#8217;ll find adb.exe in your Android SDK installation directory.</p>
<p>Now you can set up a new Run Configuration in Eclipse to test your application in the new Android emulator. When setting up a new <strong>Run Configuration</strong> in Eclipse, click on the <strong>Target</strong> tab, and select a <strong>Manual</strong> deployment target.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1249" title="Choose a Device" src="http://www.andreybutov.com/wp-content/uploads/2011/10/choosedevice.png" alt="" width="400" height="290" /></p>
<p>Once this is done, when you choose to Run your application from Eclipse, you&#8217;ll be presented with a dialog from which you can select the Android device on which to run your application. Since you connected adb to your new Android virtual machine, you should see the IP address of the virtual machine as one of the available devices on which to test.</p>
<p>&nbsp;</p>
<p><strong>Custom Resolutions</strong></p>
<p>What if you need to run the Android virtual machine with a custom resolution?</p>
<p>I&#8217;m going to configure my new emulator to look like the <strong>Amazon Kindle Fire</strong>, which has a DPI of 169 with a resolution of 1024 x 600.</p>
<p>First, in your VirtualBox, right click on your new virtual machine, and choose <strong>Show in Explorer</strong>. This will show you the location of the <strong>.vbox</strong> configuration file for the new VM. We&#8217;re going to edit this file, but first, we&#8217;ll need to close VirtualBox, and close our virtual machine, if it&#8217;s running.</p>
<p>Edit the <strong>.vbox</strong> file; it&#8217;s just an XML configuration file.</p>
<p>Find the <strong>ExtraData</strong> section, and add a line to it declaring your custom resolution:</p>
<pre>&lt;ExtraData&gt;
      &lt;ExtraDataItem name="GUI/LastCloseAction" value="powerOff"/&gt;
      &lt;ExtraDataItem name="GUI/LastGuestSizeHint" value="800,600"/&gt;
      &lt;ExtraDataItem name="GUI/LastNormalWindowPosition" value="998,300,800,639"/&gt;
      &lt;ExtraDataItem name="CustomVideoMode1" value="1024x600x16"/&gt;
&lt;/ExtraData&gt;</pre>
<p>&nbsp;</p>
<p>I added the <strong>CustomVideoMode1</strong> line above.</p>
<p>Save and close the configuration file.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1258" title="GRUB" src="http://www.andreybutov.com/wp-content/uploads/2011/10/grub.png" alt="" width="400" height="337" /></p>
<p>Now, start your virtual machine, and when you see the GRUB boot loader screen, choose <strong>Debug Mode</strong>.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1259" title="GRUB menu." src="http://www.andreybutov.com/wp-content/uploads/2011/10/grubmenu.png" alt="" width="400" height="256" /></p>
<p>At the command prompt that follows, type the command <strong>vi /mnt/grub/menu.lst</strong> to edit the GRUB boot menu file.</p>
<p>You should probably be familiar with the <strong>vi</strong> editor for this part. If you aren&#8217;t, find a quick tutorial to familiarize yourself with the basics.</p>
<p>Duplicate one of the existing entries in the file to create a new one, then change its title to something more meaningful, change its DPI parameter to 169 (that&#8217;s what we want from our Amazon Kindle Fire emulator), and add the parameter <strong>vga=ask</strong> to the end of the line.</p>
<p>Save, close the file, and restart the virtual machine.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1261" title="New GRUB menu item" src="http://www.andreybutov.com/wp-content/uploads/2011/10/newresolution.png" alt="" width="400" height="337" /></p>
<p>You will see the new boot entry as one of the menu items on the GRUB loading screen.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1260" title="Available resolutions" src="http://www.andreybutov.com/wp-content/uploads/2011/10/vga.png" alt="" width="400" height="257" /></p>
<p>When you select the new boot entry, you&#8217;ll be given the option to hit <strong>ENTER</strong> to see the available resolutions (you entered <strong>vga=ask</strong> in the GRUB configuration file, remember?). Your new entry, <strong>1024x600x16</strong>, will be one of the items.</p>
<p>&nbsp;</p>
<p><img class="alignnone size-full wp-image-1262" title="Android running at 1024x600" src="http://www.andreybutov.com/wp-content/uploads/2011/10/runningcustom.png" alt="" width="400" height="259" /></p>
<p>And here&#8217;s our new Android emulator running at a resolution of 1024&#215;600 and a DPI of 169 &#8212; all ready for you to test your Amazon Kindle Fire applications.</p>
<p>&nbsp;</p>
<p><strong>That&#8217;s all!</strong></p>
<p>That should be all. I&#8217;m sure you&#8217;ll find that the Android emulator running as a virtual machine is far more responsive that the standard emulator. Happy testing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/10/14/how-to-set-up-a-faster-android-emulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Help! My BlackBerry JDE won&#8217;t start anymore.</title>
		<link>http://www.andreybutov.com/2011/08/26/help-my-blackberry-jde-wont-start-anymore/</link>
		<comments>http://www.andreybutov.com/2011/08/26/help-my-blackberry-jde-wont-start-anymore/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 03:57:26 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[Antair]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[BlackBerry Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1177</guid>
		<description><![CDATA[You&#8217;ve been writing BlackBerry applications and building your code with the BlackBerry JDE for some time now. Then, one day, you launch the JDE and it fails to open! What gives? I assume you&#8217;ve covered the basics &#8211; your system has the Java runtime environment set up, with all the Java-related environment variables set up [...]]]></description>
			<content:encoded><![CDATA[<p><strong>You&#8217;ve been writing BlackBerry applications and building your code with the BlackBerry JDE for some time now. Then, one day, you launch the JDE and it fails to open!</strong></p>
<p>What gives?</p>
<p>I assume you&#8217;ve covered the basics &#8211; your system has the Java runtime environment set up, with all the Java-related environment variables set up properly and pointing to the right places.</p>
<p><strong>Are you running on a 64-bit system?</strong></p>
<p>BlackBerry tools don&#8217;t play nice with 64-bit systems. Tools don&#8217;t run properly, simulators don&#8217;t simulate accurately (sometimes not at all). If you are running the BlackBerry dev tools on a 64-bit version of Windows, and start seeing weird behavior, all other things aside, this could be the cause.</p>
<p>At <a href="http://www.antair.com">Antair</a>, we run all of our BlackBerry tools on 32-bit Windows XP (virtual) machines. Until RIM updates their tools to support 64-bit systems (ha!), I suggest you set up a 32-bit rig for your BlackBerry dev work.</p>
<p><strong>I&#8217;m already running on a 32-bit system. The JDE just fails to open!</strong></p>
<p>OK. Maybe it&#8217;s a memory or configuration issue.</p>
<p>Let&#8217;s take a look at the batch file that launches the IDE. If you&#8217;re working with JDE 4.5, you&#8217;ll find the launcher batch file in</p>
<p><em><strong>&#8220;C:\Program Files\Research In Motion\BlackBerry JDE 4.5.0\bin&#8221;</strong></em></p>
<p>Take a look at the <strong>ide.bat</strong> file. The batch file launches the JDE with something like:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">start javaw <span style="color: #000000;">-</span>Xmx256M <span style="color: #000000;">-</span>DRIM_RUNTIME=<span style="color: #000000;">..</span>\lib <span style="color: #000000;">-</span>DRIM_BIN=<span style="color: #000000;">..</span>\bin <span style="color: #000000;">-</span>jar IDE<span style="color: #000000;">.</span>jar</pre></div></div>

<p>Open up the command prompt, go to the directory containing the <strong>ide.bat</strong> file, and run the launch command manually to see if any errors are thrown out to the console:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">javaw <span style="color: #000000;">-</span>Xmx256M <span style="color: #000000;">-</span>DRIM_RUNTIME=<span style="color: #000000;">..</span>\lib <span style="color: #000000;">-</span>DRIM_BIN=<span style="color: #000000;">..</span>\bin <span style="color: #000000;">-</span>jar IDE<span style="color: #000000;">.</span>jar</pre></div></div>

<p><em><strong></strong></em>If you get a clear error message,  you can take steps to address whatever the process was complaining about. In certain instances, you may get an error indicating that there isn&#8217;t enough memory provided to the process to launch the IDE. It can happen. But hey, memory is cheap, so let&#8217;s give it some more:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">javaw <span style="color: #000000;">-</span>Xmx1024M <span style="color: #000000;">-</span>DRIM_RUNTIME=<span style="color: #000000;">..</span>\lib <span style="color: #000000;">-</span>DRIM_BIN=<span style="color: #000000;">..</span>\bin <span style="color: #000000;">-</span>jar IDE<span style="color: #000000;">.</span>jar</pre></div></div>

<p>See if that fixes things. We&#8217;ve had instances where allowing the process to grab more memory fixes the entire &#8220;JDE not starting&#8221; issue.</p>
<p><strong>OK. 256, 1024, 2048, it doesn&#8217;t matter. I don&#8217;t see any error messages on the console, and the JDE still won&#8217;t start.</strong></p>
<p>You installed a simulator recently didn&#8217;t you? Admit it. You&#8217;re testing an existing application to see if it will run on a new BlackBerry device, and you just downloaded and installed one of those brand new simulators that RIM provides. Right?</p>
<p>This breaks JDEs. I don&#8217;t know why, but installing standalone simulators with existing JDEs on the system, sometimes breaks some of those JDEs.</p>
<p>To fix it, go into the same bin directory that contained the <strong>ide.bat</strong> file we&#8217;ve been messing with. In there, you&#8217;ll find a <strong>&#8220;Settings.rc&#8221;</strong> file.</p>
<p>Delete it. Or move it, to be safe. Then start the JDE.</p>
<p>It&#8217;ll start as a &#8220;newly installed&#8221; JDE, with the <em>samples</em> project open, and no customizations that you spent all that time setting up &#8230; but it<strong> will </strong>start.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/08/26/help-my-blackberry-jde-wont-start-anymore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I find unused functions in my PHP project?</title>
		<link>http://www.andreybutov.com/2011/08/20/how-do-i-find-unused-functions-in-my-php-project/</link>
		<comments>http://www.andreybutov.com/2011/08/20/how-do-i-find-unused-functions-in-my-php-project/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 16:46:48 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1140</guid>
		<description><![CDATA[Find unused functions and methods in a set of PHP files. USAGE: find_unused_functions.php &#60;root_directory&#62; NOTE: This is a &#8216;quick-n-dirty&#8217; approach to the problem. This script only performs a lexical pass over the files, and does not respect situations where different modules define identically named functions or methods. If you use an IDE for your PHP [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Find unused functions and methods in a set of PHP files.</strong></p>
<p>USAGE: <strong>find_unused_functions.php &lt;root_directory&gt;</strong></p>
<p>NOTE: This is a &#8216;quick-n-dirty&#8217; approach to the problem. This script only performs a lexical pass over the files, and does not respect situations where different modules define identically named functions or methods. If you use an IDE for your PHP development, it may offer a more comprehensive solution.</p>
<p>Requires PHP 5</p>
<p style="margin-top: 30px;">
Direct download: <a style="text-decoration: none; font-weight: bold;" href="http://www.andreybutov.com/wp-content/uploads/2011/08/find_unused_functions.zip">find_unused_functions.zip</a>
</p>
<p style="margin-top: 30px:">
Code:
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">#!/usr/bin/php -f
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// find_unused_functions.php</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// Find unused functions in a set of PHP files.</span>
<span style="color: #666666; font-style: italic;">// version 1.3 - 08/20/2011</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// Copyright (c) 2011, Andrey Butov. All Rights Reserved.</span>
<span style="color: #666666; font-style: italic;">// This script is provided as is, without warranty of any kind.</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// http://www.andreybutov.com</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This may take a bit of memory...</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'memory_limit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'2048M'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$root_dir</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$root_dir</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$root_dir</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;ERROR: '<span style="color: #006699; font-weight: bold;">$root_dir</span>' is not a readable directory.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> php_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$root_dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tokenized</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No PHP files found.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$defined_functions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$files</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$tokens</span> <span style="color: #339933;">=</span> tokenize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tokens</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// We retain the tokenized versions of each file,</span>
		<span style="color: #666666; font-style: italic;">// because we'll be using the tokens later to search</span>
		<span style="color: #666666; font-style: italic;">// for function 'uses', and we don't want to </span>
		<span style="color: #666666; font-style: italic;">// re-tokenize the same files again.</span>
&nbsp;
		<span style="color: #000088;">$tokenized</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tokens</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$current_token</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$next_token</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_token</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$next_token</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$next_token</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> T_FUNCTION <span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// Find the 'function' token, then try to grab the </span>
					<span style="color: #666666; font-style: italic;">// token that is the name of the function being defined.</span>
					<span style="color: #666666; font-style: italic;">// </span>
					<span style="color: #666666; font-style: italic;">// For every defined function, retain the file and line</span>
					<span style="color: #666666; font-style: italic;">// location where that function is defined. Since different</span>
					<span style="color: #666666; font-style: italic;">// modules can define a functions with the same name,</span>
					<span style="color: #666666; font-style: italic;">// we retain multiple definition locations for each function name.</span>
&nbsp;
					<span style="color: #000088;">$function_name</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$next_token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$next_token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$function_name</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$line</span> <span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$function_name</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$function_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$function_name</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span>
						<span style="color: #009900;">&#123;</span>
							<span style="color: #000088;">$defined_functions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$function_name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'line'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$line</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>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// We now have a collection of defined functions and</span>
<span style="color: #666666; font-style: italic;">// their definition locations. Go through the tokens again, </span>
<span style="color: #666666; font-style: italic;">// and find 'uses' of the function names. </span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tokenized</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$tokens</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tokens</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$token</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> T_STRING <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$function_name</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$function_line</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$token</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$function_name</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$function_line</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$locations_of_defined_function</span> <span style="color: #339933;">=</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$defined_functions</span><span style="color: #339933;">,</span> <span style="color: #000088;">$function_name</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$locations_of_defined_function</span> <span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$found_function_definition</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$locations_of_defined_function</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$location_of_defined_function</span> <span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$function_defined_in_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$location_of_defined_function</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
						<span style="color: #000088;">$function_defined_on_line</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$location_of_defined_function</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'line'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
						<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$function_defined_in_file</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">&amp;&amp;</span> 
							 <span style="color: #000088;">$function_defined_on_line</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$function_line</span> <span style="color: #009900;">&#41;</span>
						<span style="color: #009900;">&#123;</span>
							<span style="color: #000088;">$found_function_definition</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
							<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
						<span style="color: #009900;">&#125;</span>
					<span style="color: #009900;">&#125;</span>
&nbsp;
					<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$found_function_definition</span> <span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #666666; font-style: italic;">// We found usage of the function name in a context</span>
						<span style="color: #666666; font-style: italic;">// that is not the definition of that function. </span>
						<span style="color: #666666; font-style: italic;">// Consider the function as 'used'.</span>
&nbsp;
						<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$defined_functions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$function_name</span><span style="color: #009900;">&#93;</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>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
print_report<span style="color: #009900;">&#40;</span><span style="color: #000088;">$defined_functions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> php_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Get a listing of all the .php files contained within the $path</span>
	<span style="color: #666666; font-style: italic;">// directory and its subdirectories.</span>
&nbsp;
	<span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$folders</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$folder</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_shift</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$folders</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #339933;">,</span> <span style="color: #990000;">glob</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$folder</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;*.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$moreFolders</span> <span style="color: #339933;">=</span> <span style="color: #990000;">glob</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$folder</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'*'</span><span style="color: #339933;">,</span> GLOB_ONLYDIR<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$folders</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$folders</span><span style="color: #339933;">,</span> <span style="color: #000088;">$moreFolders</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$matches</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> safe_arr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$default</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$default</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> tokenize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$file_contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$file_contents</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$tokens</span> <span style="color: #339933;">=</span> <span style="color: #990000;">token_get_all</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_contents</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$tokens</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$argv</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;find_unused_functions.php&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;USAGE: <span style="color: #006699; font-weight: bold;">$file</span> &lt;root_directory&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> print_report<span style="color: #009900;">&#40;</span><span style="color: #000088;">$unused_functions</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unused_functions</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No unused functions found.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$unused_functions</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$function</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$locations</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$locations</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$location</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;'<span style="color: #006699; font-weight: bold;">$function</span>' in <span style="color: #006699; font-weight: bold;">{$location['file']}</span> on line <span style="color: #006699; font-weight: bold;">{$location['line']}</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;=======================================<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Found <span style="color: #006699; font-weight: bold;">$count</span> unused function&quot;</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">''</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'s'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;.<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ============================================================================</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* EOF */</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/08/20/how-do-i-find-unused-functions-in-my-php-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whatcha doin&#8217;?</title>
		<link>http://www.andreybutov.com/2011/08/07/whatcha-doin/</link>
		<comments>http://www.andreybutov.com/2011/08/07/whatcha-doin/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 19:22:05 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1132</guid>
		<description><![CDATA[What are you doing? Working. But it&#8217;s Sunday! Yeah. How much do you work? I don&#8217;t understand. Well &#8230; how many hours do you work? I always work.]]></description>
			<content:encoded><![CDATA[<p><em><span style="color: #003300;">What are you doing?</span></em></p>
<p><span style="color: #000080;">Working.</span></p>
<p><em><span style="color: #003300;">But it&#8217;s Sunday!</span></em></p>
<p><span style="color: #000080;">Yeah.</span></p>
<p><em><span style="color: #003300;">How much do you work?</span></em></p>
<p><span style="color: #000080;">I don&#8217;t understand.</span></p>
<p><em><span style="color: #003300;">Well &#8230; how many hours do you work?</span></em></p>
<p><span style="color: #000080;">I <strong><em>always</em></strong> work.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/08/07/whatcha-doin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Your Web App on a BlackBerry Simulator</title>
		<link>http://www.andreybutov.com/2011/08/05/testing-your-web-app-on-a-blackberry-simulator/</link>
		<comments>http://www.andreybutov.com/2011/08/05/testing-your-web-app-on-a-blackberry-simulator/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 23:24:14 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[BlackBerry Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1060</guid>
		<description><![CDATA[The web browser provided by BlackBerry simulators is a fairly accurate representation of what your users are running on their BlackBerry devices. While it&#8217;s always advisable to test native client applications on a real device prior to shipping the product, as a web app developer, you can get a good understanding of how your application [...]]]></description>
			<content:encoded><![CDATA[<p>The web browser provided by BlackBerry simulators is a fairly accurate representation of what your users are running on their BlackBerry devices. </p>
<p>While it&#8217;s always advisable to test native client applications on a real device prior to shipping the product, as a web app developer, you can get a good understanding of how your application will act on a BlackBerry, without having to purchase a real device.</p>
<p style="font-weight:bold; font-size: 1.3em;margin-top:40px;">Downloading the simulators</p>
<p>RIM offers a <a href="http://us.blackberry.com/developers/resources/simulators.jsp">wide variety of simulators</a> for you to choose from. If you&#8217;re not sure which to choose, I would recommend the following selections:</p>
<p><strong>BlackBerry Torch, 98xx</strong></p>
<p>This is one of the most popular models in today&#8217;s BlackBerry market, and has one of the largest screen resolutions. The BlackBerry Torch also features a touch-screen, and the ability to flip from portrait to landscape mode.</p>
<p><strong>BlackBerry Style, 9670</strong></p>
<p>The BlackBerry Style is RIM&#8217;s current flip-style phone. While not as popular as some of the other models, it has a unique screen size. If you need to reach as wide an audience as possible, it wouldn&#8217;t hurt to test your web application on this simulator.</p>
<p><strong>BlackBerry Pearl, 81xx</strong></p>
<p>The Pearl was the first consumer-targeted BlackBerry. While they have lost popularity as of late, plenty of BlackBerry users are still walking around with these models. The Pearl has a long-and-thin form-factor, with a resolution of 240&#215;260.</p>
<p><strong>BlackBerry Curve, Bold, or Tour</strong></p>
<p>While the BlackBerry Torch has recently gained popularity, most BlackBerry owners of the past few years would have one of these three models. The Curve, Bold, and Tour share a similar form-factor. With the exception of recent models, these devices do not have a touch-screen, and they do not allow the user to switch from portrait mode to landscape mode.</p>
<p style="margin-top:40px;">
<span style="font-weight: normal;">Your web application may behave differently depending on the version of the operating system running on the device. When choosing simulators, it&#8217;s a good idea to select a wide range of operating systems.</span></p>
<p>A good &#8220;older&#8221; model would be a simulator running RIM OS 4.2. As I&#8217;m writing this, the newer simulators will be running RIM OS 6.x.</p>
<p><img src="http://www.andreybutov.com/wp-content/uploads/2011/08/simulators.gif" alt="Downloading a BlackBerry Simulator" title="Downloading a BlackBerry Simulator" width="600" height="552" class="alignnone size-full wp-image-1095" /></p>
<p style="font-weight:bold; font-size: 1.3em;margin-top:40px;">Downloading the MDS simulator</p>
<p>To test your web application on a BlackBerry simulator, the simulator&#8217;s web browser needs to be able to connect to the internet, and for that, you will need to run the <strong>MDS simulator</strong> first.</p>
<p>The MDS simulator allows the BlackBerry simulator to connect to the internet. You can download the MDS simulator as part of the <a href="https://swdownloads.blackberry.com/Downloads/entry.do?code=996009F2374006606F4C0B0FDA878AF1">BlackBerry Email and MDS Services simulator package</a>.</p>
<p><img class="alignnone size-full wp-image-1093" title="MDS Package" src="http://www.andreybutov.com/wp-content/uploads/2011/08/mdspackage.gif" alt="MDS Package" width="600" height="340" /></p>
<p style="font-weight:bold; font-size: 1.3em;margin-top:40px;">Testing your web application on the simulator</p>
<p>Start with installing both the MDS simulator and the phone simulators you&#8217;ll be testing on.</p>
<p>It&#8217;s worth noting that although the BlackBerry phone simulators are Java-based, and require Java to be installed on the computer to run, they will only work on Windows machines. The simulators also tend to behave strangely on 64-bit systems. </p>
<p>At <a href="http://www.antair.com">Antair</a>, we do our simulator testing on 32-bit Windows XP hosts, running as virtual machines.</p>
<p>Once installed, start the MDS simulator. All it will do is open a terminal window and dump some startup output. If an error comes up, you can look at the output information for a clue. Otherwise, you can just minimize this window.</p>
<p><img class="alignnone size-full wp-image-1085" title="MDS Simulator" src="http://www.andreybutov.com/wp-content/uploads/2011/08/mds.gif" alt="MDS Simulator" width="600" height="217" /></p>
<p style="margin-top: 30px;">Now, start one of the BlackBerry phone simulators.</p>
<p>You should be able to launch the web browser and type in the URL of your web application.</p>
<p>The settings and options presented by the web browser in the simulator, are the same options that will be available to your users. You will be able to test whether your web application works well with Javascript turned off, or cookies disabled, etc.</p>
<p><img class="alignnone size-full wp-image-1087" title="BlackBerry Web Browser with CNN mobile." src="http://www.andreybutov.com/wp-content/uploads/2011/08/mobileweb.gif" alt="BlackBerry Web Browser with CNN mobile." width="600" height="345" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/08/05/testing-your-web-app-on-a-blackberry-simulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Antair Nightstand 1.6</title>
		<link>http://www.andreybutov.com/2011/08/01/antair-nightstand-1-6/</link>
		<comments>http://www.andreybutov.com/2011/08/01/antair-nightstand-1-6/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 19:43:42 +0000</pubDate>
		<dc:creator>Andrey Butov</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.andreybutov.com/?p=1050</guid>
		<description><![CDATA[Antair Nightstand 1.6 for the BlackBerry PlayBook is now available. This release introduces the news functionality, adds a new animated theme called Daydream, and has several other improvements. The Daydream theme displays the clock and weather information over a background of animated lights. The News feature allows you to view local and international news directly [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.antair.com/nightstand/">Antair Nightstand 1.6</a> for the BlackBerry PlayBook is now available.</p>
<p>This release introduces the <strong>news</strong> functionality, adds a new animated theme called <strong>Daydream</strong>, and has several other improvements.</p>
<p>The <strong>Daydream</strong> theme displays the clock and weather information over a background of animated lights.</p>
<p><img src="http://www.andreybutov.com/wp-content/uploads/2011/08/daydream1.jpg" alt="Antair Nightstand - Daydream Theme" title="Antair Nightstand - Daydream Theme" width="600" height="351" class="alignnone size-full wp-image-1053" /></p>
<p>The <strong>News</strong> feature allows you to view local and international news directly from Nightstand.</p>
<p><img src="http://www.andreybutov.com/wp-content/uploads/2011/08/news.jpg" alt="Antair Nightstand - News" title="Antair Nightstand - News" width="600" height="350" class="alignnone size-full wp-image-1054" /></p>
<p>The new Antair Nightstand is available in the <a href="http://appworld.blackberry.com/webstore/content/24399?lang=en">BlackBerry App World</a>. </p>
<p>Here&#8217;s a brand new video of Antair Nightstand, with the new theme and news functionality.</p>
<p><iframe width="640" height="510" src="http://www.youtube.com/embed/O5OY_lhTs3M?rel=0" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andreybutov.com/2011/08/01/antair-nightstand-1-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

