<?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>dev&#124;sushi &#187; Adam</title>
	<atom:link href="http://devsushi.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://devsushi.com</link>
	<description>Discussion on Development in Several Different Flavours</description>
	<lastBuildDate>Sun, 28 Feb 2010 03:03:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Blackberry Curve Review</title>
		<link>http://devsushi.com/2008/10/29/blackberry-curve-review/</link>
		<comments>http://devsushi.com/2008/10/29/blackberry-curve-review/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 08:09:20 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[blackberry]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/?p=121</guid>
		<description><![CDATA[This is long overdue! I moved a few posts from my personal blog over here and was reading them as I went. In one I mentioned that I was getting a Curve and that I would review it shortly, oops. I&#8217;ve now had the Curve for just over 9 months so this won&#8217;t contain any [...]]]></description>
			<content:encoded><![CDATA[<p>This is long overdue! I moved a few posts from my personal blog over here and was reading them as I went. In one I <a href="http://adamhewgill.com/devsushi/2007/10/19/blackberry-curve/">mentioned that I was getting a Curve</a> and that I would review it shortly, oops. I&#8217;ve now had the Curve for just over 9 months so this won&#8217;t contain any &#8220;new shiny&#8221; syndrome and should be fairly objective. There are several sub-models in the Curve family now so <a href="http://www.blackberrycurve.com/brains/learnmore/specs.jsp">check the chart for the specs</a> on the one you&#8217;re interested in.</p>
<p><span id="more-121"></span></p>
<h3>The Device</h3>
<p>The Curve has carved out a niche somewhere between the Pearl and the &#8220;business&#8221; model blackberries (8700, 8800, etc.) both in size and in features. The unit is 4.2&#8243; x 2.4&#8243; x 0.6&#8243; and has nice curved edges which fit nicely in the hand. It is 3.9oz which is nice and light but doesn&#8217;t feel cheap and plastic-y. The screen is 320 x 240, supports 65k colours (16-bit), and is very bright. Screen size is the same as the 8700 and 8800 and just a little bigger than the Pearl. Newer blackberries are now slightly larger but there is a great deal of competition out there from Apple and HTC, RIM is falling behind. The MicroSD slot is still inside under the battery which is an issue I noted on the Pearl. The extra memory is still absolutely essential as the internal device memory is paltry. The Curve finally has a standard 3.5mm headphone jack so no more 2.5mm to 3.5mm converters to hookup your favourite headphones. It also works with standard headsets and has bluetooth for those wireless ones. I&#8217;ve always found the Blackberries underpowered and this device is no different, actually it is worse. There are frequent lags throughout which make navigation and use feel disconnected. I was especially frustrated with BrickBreaker which was somewhat fun on the Pearl but is now almost unplayable due to lag.</p>
<h3>The Battery</h3>
<p>As always the battery is user changeable so those who are extra heavy users can always have a fresh battery ready to swap in unlike a lot of phones. The battery life is quite good and lasts a long time with infrequent use and a decent amount under heavy use. The official specs say 4 hours talk 17 days standby but I usually get 2 or more days with my average to light use. Blackberry devices have always had decent battery life though so this should be no surprise.</p>
<h3>The Keyboard and Trackball</h3>
<p>The full keyboard is nice and compact but unfortunately doesn&#8217;t feel very good compared to the Pearl or 8800 keyboards. The distinct keys are hard plastic and you will notice the keyboard plate shifting when pressed which takes away from the feel of quality. Those with big fingers would be better served with the 8800 which has a much better keyboard. The trackball is the same as on the other devices with no refinements as far as I can tell. I have one major gripe with it which is probably only noticeable to a developer. The trackball does not handle diagonal motion properly it has a huge tendency to straight lines on the X and Y axes. It feels like the X and Y motion sensors can&#8217;t operate at the same time. Overall the devices input mechanisms could be greatly improved.</p>
<h3>The Camera</h3>
<p>This time around the camera has been improved slightly and is 2MP with a LED flash bulb. Picture quality looks OK on the device screen but bringing them to the computer is a mistake any shot without perfect outdoor lighting is extremely grainy and washed out. The sorry state of phone cameras on most devices is a bit depressing, why is it so hard when camera technology is so cheap? The <a href="http://gizmodo.com/gadgets/cellphones/nokia-n95-cellphone-has-wings-5mp-cam-gps-hsdpa-203336.php">Nokia N95</a> did a really good job.</p>
<h3>The Browser</h3>
<p>There are very few phones currently on the market that provide a decent web browsing experience. Obviously Apple offering is one, some larger screen internet devices, but not much else. The Curve (and almost every other Blackberry) has a terrible web browser so be forewarned. It does a terrible job rendering pages that are even moderately beyond the standard of the 90s which is shameful. You essentially must <a href="http://www.operamini.com/">download Opera Mini</a> right away and use it instead. Unfortunately due to limitations within the Blackberry OS even Opera Mini doesn&#8217;t provide the best experience but it is markedly better. On another note, does anybody actually know what the WAP browser is for?</p>
<h3>The Meat</h3>
<p>Blackberry has created a business model around enterprise push email service. Their bread and butter is the business clients who want to carry their Outlook environment with them on the road. Blackberries synchronize with Outlook extremely well and when hooked up to BIS or BES do over the air sync, you never have to do a desktop sync ever again. If you have Microsoft Exchange and BES you are really in for a treat as mail functionality on the device is stepped up another notch to include the ability to manager folders of email. Synchronization includes Mail, Calendar, Address Book, Tasks, and Notes which is amazing useful for those that can&#8217;t afford to be &#8220;away&#8221; from the office. Blackberry OS even has the ability to open various Microsoft Office documents for viewing so you don&#8217;t need to go to a PC to review the budget numbers. The Curve is no different in offering all of these features and I haven&#8217;t noticed anything different between it and the 8800.</p>
<p>Voice dialing is still intact along with most of the positive and negative remarks from my Pearl review. You still must have a MicroSD card to play music due to the paltry internal memory.</p>
<h3>The Google</h3>
<p>For sure you will want to check out Google services for Blackberry. <a href="http://www.google.com/mobile/">Google Mobile</a> provides GMail, Maps, Reader, News, Picaza and more through downloadable applications. I&#8217;ve found all of these tools to be very useful and fairly well developed. GMail is missing labels, Maps can be slow, etc but overall they are great products. The Curve 8310 with GPS works really well with Google Maps and has helped me out quite a few times.</p>
<h3>The Conclusion</h3>
<p>Plenty of people have complained about the keyboard on the Pearl, if you are one than this device is probably a nice happy medium between the Pearl and the 8800. The keyboard is pretty good but as I mentioned feels a little cheap and plastic-y. Software is mostly the same along with media capabilities. The larger screen is the only other real plus now that the Pearl product line mirrors the Curves. I have a really high standard when it comes to smart phones and this simply doesn&#8217;t meet all of my criteria for a perfect device however that being said I recently tested the Apple offering and switched back to the Curve. Those able to take one step up should opt for the Blackberry Bold but the Curve isn&#8217;t a bad product either.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2008/10/29/blackberry-curve-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browser Logo Shootout</title>
		<link>http://devsushi.com/2008/09/03/browser-logo-shootout/</link>
		<comments>http://devsushi.com/2008/09/03/browser-logo-shootout/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 03:40:14 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/?p=124</guid>
		<description><![CDATA[In honour of the release of Google Chrome I thought I&#8217;d put together a quick tour and critique of the various icons for the top five web browsers currently out there&#8212;I&#8217;ll explain exactly why a little later. It is very important to create a visual brand for your product, we all know this and we [...]]]></description>
			<content:encoded><![CDATA[<p>In honour of the release of <a href="http://google.com/chrome">Google Chrome</a> I thought I&#8217;d put together a quick tour and critique of the various icons for the top five web browsers currently out there&mdash;I&#8217;ll explain exactly why a little later. It is very important to create a visual brand for your product, we all know this and we see it every day in advertisements. We have become accustomed to the <em>Firefox and Globe</em>, the <em>Internet Explorer Electron</em>, the <em>Opera Big O</em>, the <em>Safari Compass</em>, and now the <em>Chrome Thing-a-ma-jig</em>. (Anyone got a better name for it?)</p>
<p><img src="/images/bigchromelogo.jpg" /><br />
Figure 1. Chrome Thing-a-ma-jig</p>
<p><span id="more-124"></span></p>
<h3>Shortcut Logos</h3>
<p>No matter your browser preference you&#8217;ve no doubt become accustomed to a few of these browser icons. Except of course the people who think the IE icon is a magical link to the Internet and don&#8217;t really get the concept of a browser. Some of the icons have evolved over time such as with Firefox and especially Internet Explorer, others are comparatively new. That being said they are all round which is a little coincidental.</p>
<p><img src="/images/logos.jpg" /><br />
Figure 2. Five browser shortcuts</p>
<p>The Firefox logo is great, good colours, and it incorporates the idea of the web through the globe. Internet Explorer on the other hand makes no sense at all and simply has the most recognizable brand. Google Chrome has a bemusing bright bizarre icon which really doesn&#8217;t make any sense at all. Opera is very self indulgent but works for the community they are targeting. Finally, Safari uses a compass which I believe represents what you need when you go on <em>Safari</em> on the web. I&#8217;ve always disliked this icon and have trouble associating it with Internet browsing.</p>
<h3>Web Page Icons</h3>
<p>Below you will find a sample of the HTML file type icons that are associated with each browser. The reason I decided to write this was due to the crazy bright/ugliness of the Google Chrome icon. Look at how ridiculus a directory full of HTML files looks (see Figure 5). My favorite is the Firefox icon which again uses good colours and looks good in small or large numbers on the screen. Second place would go to Internet Explorer, the combination of the recognizable logo with the simple clear page theme works very well. Opera&#8217;s icon is a little dark for my tastes and stands out much too loudly. I think the issue would be fixed immediately if they dimmed the border of the page to the same grey as IE leaving the red O intact. Safari unfortunately wouldn&#8217;t allow me to set it as the default browser for HTML and thus didn&#8217;t change the icon from the default (which is IE on most people computers). If they did an icon very similar to the IE one but with the compass in place of the E it would look pretty good.</p>
<p><img src="/images/firefox.jpg" /><br />
Figure 3. Firefox web page icons</p>
<p><img src="/images/ie.jpg" /><br />
Figure 4. Internet Explorer web page icons</p>
<p><img src="/images/chrome.jpg" /><br />
Figure 5. Chrome web page icons</p>
<p><img src="/images/opera.jpg" /><br />
Figure 6. Opera web page icons</p>
<p><img src="/images/safari.jpg" /><br />
Figure 7. Safari web page icons, sort of</p>
<p>What are your two cents on the various browser icons? Do you agree with my bewilderment with the Google Chrome logo? Can you think of a better name than <em>Thing-a-ma-jig</em>? Let me know.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2008/09/03/browser-logo-shootout/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blackberry Surreal Theme</title>
		<link>http://devsushi.com/2008/07/22/blackberry-surreal-theme/</link>
		<comments>http://devsushi.com/2008/07/22/blackberry-surreal-theme/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 00:47:45 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/?p=77</guid>
		<description><![CDATA[Today I just found a new theme on the Blackberry free stuff site. It is called Surreal and it looks pretty damn good which is quite shocking considering the fuglyness of all the other free themes available. Take a look at the screenshots from my device. Figure 1. The main screen of the surreal theme. [...]]]></description>
			<content:encoded><![CDATA[<p>Today I just found a new theme on the Blackberry free stuff site. It is called Surreal and it looks pretty damn good which is quite shocking considering the fuglyness of all the other free themes available. Take a look at the screenshots from my device.</p>
<p><span id="more-77"></span></p>
<p><img src="/images/surreal_main.png" alt="Image of main screen" /><br />
Figure 1.  The main screen of the surreal theme.</p>
<p><img src="/images/surreal_menu.png" alt="Image of main screen in menu mode" /><br />
Figure 2. The main screen of the surreal theme in menu mode.</p>
<p>I&#8217;m not sure if all models of Blackberry devices have access to this theme or not&mdash;I have the Curve. If you would like to download this theme follow these steps&#8230;</p>
<ol>
<li>Open the <em>Browser</em> (not the carrier encumbered WAP browser)</li>
<li>Click the <em>Menu</em> key and select <em>Bookmarks</em> from the list of options</li>
<li>Under <em>Blackberry Bookmarks</em> select <em>Home Page</em></li>
<li>Scroll down and select <em>Fun &#038; Games</em></li>
<li>Scroll down and select <em>Themes</em> (notice the other free stuff available here too, some of the free and classic games are good)</li>
<li>Select <em>I Accept</em> on the terms and conditions page</li>
<li>Scroll down until you see the <em>Surreal</em> theme and click the <em>Download</em> link just under the picture</li>
<li>Click <em>Download</em> to begin the download process (you must have a data plan for this to work)</li>
<li>Once completed close the <em>Browser</em> by clicking the <em>End</em> key</li>
<li>Open the <em>Options</em> (usually a wrench icon) and scroll down and select <em>Theme</em></li>
<li>Select <em>Surreal</em> and then close <em>Options</em> using the <em>End</em> key</li>
</ol>
<p>Now take the time to select the most important six icons and move them to the top of the menu. These six with show on the main screen view (Figure 1). Clicking the <em>Menu</em> key will reveal the rest of the icons (Figure 2).</p>
<p>Enjoy!</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2008/07/22/blackberry-surreal-theme/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Blackberry JDE API &#8211; User Interface Field Reference</title>
		<link>http://devsushi.com/2007/12/02/blackberry-jde-api-user-interface-field-reference/</link>
		<comments>http://devsushi.com/2007/12/02/blackberry-jde-api-user-interface-field-reference/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 22:25:25 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/12/02/blackberry-jde-api-user-interface-field-reference/</guid>
		<description><![CDATA[When I first dug into programming with the RIM APIs installed with the Blackberry JDE I ran into quite a few roadblocks that took a while to circumvent. Most stemmed from my unfamiliarity with Java and the standard Java UI toolkits (Swing and AWT). After figuring out how to create and display each of the [...]]]></description>
			<content:encoded><![CDATA[<p>When I first dug into programming with the RIM APIs installed with the Blackberry JDE I ran into quite a few roadblocks that took a while to circumvent. Most stemmed from my unfamiliarity with Java and the standard Java UI toolkits (Swing and AWT). After figuring out how to create and display each of the most interesting fields I figured I might as well document them, provide screenshots, and sample application code to help others like myself.<span id="more-56"></span></p>
<p>First off for those out there only interested in the download-able code example — here you go. Simply open the FieldExample.jdw workspace in the JDE editor and click Debug -> Go.<br />
<a href="/files/FieldExamples.zip">Field Examples source code (.zip)</a></p>
<p></p>
<p>The following field objects are found in the <a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/package-summary.html">net.rim.device.api.ui.component package</a>. These objects are built-in time savers for building GUIs for Blackberry applications. One of the key benefits is that it provides your application with a consistent interface experience which guarantees users will feel right at home. Custom widgets are great and can make your application unique but each has a learning curve which could frustrate users. We&#8217;ll start with the easiest and move to the more complex.</p>
<h3>Quick Reference</h3>
<ul>
<li><a href="#nullfield">NullField</a></li>
<li><a href="#separatorfield">SeparatorField</a></li>
<li><a href="#labelfield">LabelField</a></li>
<li><a href="#textfield">TextField</a></li>
<li><a href="#richtextfield">RichTextField</a></li>
<li><a href="#editfield">EditField</a></li>
<li><a href="#passwordeditfield">PasswordEditField</a></li>
<li><a href="#bitmapfield">BitmapField</a></li>
<li><a href="#radiobuttonfield">RadioButtonField</a></li>
<li><a href="#checkboxfield">CheckboxField</a></li>
<li><a href="#objectchoicefield">ObjectChoiceField</a></li>
<li><a href="#numericchoicefield">NumericChoiceField</a></li>
<li><a href="#gaugefield">GaugeField</a></li>
<li><a href="#datefield">DateField</a></li>
<li><a href="#listfield">ListField</a></li>
<li><a href="#buttonfield">ButtonField</a></li>
</ul>
<p>Note: The API version pointed to by this article is currently v4.5.0 so all API URLs point there. Please utilize the documentation for the version installed with the development kit. It should be available in the start menu alongside the editor.</p>
<h3 id="nullfield">NullField</h3>
<p>I don&#8217;t actually have one of these in the code example since to me they seem completely pointless. I&#8217;m sure some programmers rely on them for various weird hacks but for the most part I would avoid them. They are invisible but can have focus.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/NullField.html">NullField API reference</a></p>
<h3 id="separatorfield">SeparatorField</h3>
<p>In the standard MainScreen layout it is usually necessary to use these. They are very simple to add and provide a single pixel grey horizontal line on the screen from one side to the other. The general purpose is to separate two sections of UI elements. It is possible to override the drawing behavior and change the color/shape of the line but that is a more advanced topic for a future post.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/SeparatorField.html">SeparatorField API reference</a></p>
<pre class="brush: java">add(new SeparatorField());</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/separatorfield.png' title='SeparatorField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/separatorfield.png' alt='SeparatorField screenshot' /></a></p>
<h3 id="labelfield">LabelField</h3>
<p>This element is essentially a glorified String which knows how to draw itself on the screen. As with all text based Fields you can change the drawing Font and use it as the Screen title. By default this element does not accept focus but as will all Fields you can change this by setting the Field.FOCUSABLE style.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/LabelField.html">LabelField API reference</a></p>
<pre class="brush: java">// LabelField variations

add(new LabelField("LabelField"));

add(new LabelField("LabelField 2", 0, -1, Field.FIELD_RIGHT));

LabelField lbl = new LabelField("LabelField 3", 0, -1, Field.FIELD_HCENTER);
Font fnt = this.getFont().derive(Font.BOLD | Font.ITALIC);
lbl.setFont(fnt);
add(lbl);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/labelfield.png' title='LabelField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/labelfield.png' alt='LabelField screenshot' /></a></p>
<h3 id="textfield">TextField</h3>
<p>This class seems to be abstract since it has no constructors listed in the APIs. You can create a TextField but I would avoid it since from everything I have seen it is not used. It is the parent class of RichTextField and BasicEditField which are the fields you should actually use for selectable and editable text respectively.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/TextField.html">TextField API reference</a></p>
<h3 id="richtextfield">RichTextField</h3>
<p>TextFields provide the equivalent of standard TextBox from other platforms. Each letter of the text is focusable and selectable. The RichTextField is not editable by default but can made editable by setting the Field.EDITABLE style. The major benefit of using a RichTextField over other text based fields is the configurability of the text formatting. It is quite cumbersome to setup as you can see by the following code example but is handy.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/RichTextField.html">RichTextField API reference</a></p>
<pre class="brush: java">// RichTextField variations

add(new RichTextField("RichTextField"));

String str[] = new String[] {"RichTextField:", "Value"};
int off[] = new int[] {0, str[0].length(), str[0].length() + str[1].length()};
byte attr[] = new byte[] {0, 1};
FontFamily fontfam[] = FontFamily.getFontFamilies();
Font fon[] = new Font[2];
fon[0] = fontfam[0].getFont(FontFamily.SCALABLE_FONT, 16);
fon[1] = fontfam[1].getFont(FontFamily.SCALABLE_FONT, 18);
add(new RichTextField(str[0] + str[1], off, attr, fon, RichTextField.TEXT_ALIGN_HCENTER));</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/richtextfield.png' title='RichTextField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/richtextfield.png' alt='RichTextField screenshot' /></a></p>
<h3 id="editfield">EditField</h3>
<p>Pretty much the equivalent of the LabelField but is focusable, selectable and editable. There are some mechanisms included which allow configuration of how the key presses interact with the field but overall it is very simple.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/EditField.html">EditField API reference</a></p>
<pre class="brush: java">// EditField

EditField edit = new EditField("Username: ", "");
add(edit);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/editfield.png' title='EditField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/editfield.png' alt='EditField screenshot' /></a></p>
<h3 id="passwordeditfield">PasswordEditField</h3>
<p>As you might expect this is exactly the same as the EditField but replaces keystrokes with asterisk&#8217;s. Both Fields are children of the BasicEditField class. On the Pearl there is a short delay where it shows the actual character before switching it to the asterisk (another benefit of using the built in Fields). Some of the standard features like cut/copy and the auto manipulators are disabled.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/PasswordEditField.html">PasswordEditField API reference</a></p>
<pre class="brush: java">// PasswordEditField

PasswordEditField pass = new PasswordEditField("Password: ", "");
add(pass);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/passwordeditfield.png' title='PasswordEditField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/passwordeditfield.png' alt='PasswordEditField screenshot' /></a></p>
<h3 id="bitmapfield">BitmapField</h3>
<p>The BitmapField allows you to add a Bitmap to your application. It can be aligned just like any other field with Field.FIELD_RIGHT or Field.FIELD_HCENTER and additionally can have border padding. I haven&#8217;t looked to far into positioning beyond the standard but I will get into more complex layouts in a future post. The Bitmap class can load PNG, GIF or JPEG images along with raw byte data. If you include an image in the project it is automatically added to the .cod file as a resource which can be loaded using getBitmapResource(). When targeting a resource the path begins at the root project level. I&#8217;ve made the image focusable just as an example, I belive you can also turn an image into a button.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/BitmapField.html">BitmapField API reference</a></p>
<pre class="brush: java">// BitmapField
Bitmap img = Bitmap.getBitmapResource("com/examples/img/rainbow.png");
BitmapField bf = new BitmapField(img, BitmapField.FOCUSABLE);
add(bf);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/bitmapfield.png' title='BitmapField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/11/bitmapfield.png' alt='BitmapField screenshot' /></a></p>
<h3 id="radiobuttonfield">RadioButtonField</h3>
<p>There are the implementation of the standard radio selection object where you put a bunch into a group and then the user can select one (and only one) of those options. If you have a fairly small set of options these can be nicer than a choice field (a.k.a. drop-down list) since a user doesn&#8217;t have to click into the list and then pick an option. You must place the RadioButtonField objects into a RadioButtonGroup or an error will occur.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/RadioButtonField.html">RadioButtonField API reference</a></p>
<pre class="brush: java">// RadioButtonField (must be part of group)
RadioButtonGroup rgrp = new RadioButtonGroup();
RadioButtonField radio = new RadioButtonField("Radio Button", rgrp, true);
RadioButtonField radio2 = new RadioButtonField("Radio 2", rgrp, false);
add(radio);
add(radio2);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/radiobuttonfield.png' title='RadioButtonField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/radiobuttonfield.png' alt='RadioButtonField screenshot' /></a></p>
<h3 id="checkboxfield">CheckboxField</h3>
<p>Again the standard implementation of a checkbox where each is individual and you can check as many as you want. It appears that you are unable to set the checkbox state to other than on or off. Other platforms generally have a third version representing half checked but it appears the user would need to extend this control to provide that functionality.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/CheckboxField.html">CheckboxField API reference</a></p>
<pre class="brush: java">// CheckboxField
CheckboxField chk = new CheckboxField("Checkbox 1", true);
CheckboxField chk2 = new CheckboxField("Checkbox 2", false);
add(chk);
add(chk2);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/checkboxfield.png' title='CheckboxField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/checkboxfield.png' alt='CheckboxField screenshot' /></a></p>
<h3 id="objectchoicefield">ObjectChoiceField</h3>
<p>The object choice field is essentially what most programmers would know as a drop-down box or list. You provide a list of objects that have the toString() method and it uses that to generate the list the user chooses from. Hitting the space key will roll through the options or the user can click to see all options at one is a list (as seen in the screenshot below). These fields are very handy when you have many options to present or when screen space is at a premium (as it is on most options pages).<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/ObjectChoiceField.html">ObjectChoiceField API reference</a></p>
<pre class="brush: java">// ObjectChoiceField
String choicestrs[] = {"Opt 1", "Opt 2", "Opt 3"};
ObjectChoiceField choice = new ObjectChoiceField("Object Choice Field: ", choicestrs, 0);
add(choice);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/objectchoicefield.png' title='ObjectChoiceField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/objectchoicefield.png' alt='ObjectChoiceField screenshot' /></a></p>
<h3 id="numericchoicefield">NumericChoiceField</h3>
<p>My only guess is that the RIM developers needed lots of choice fields that were numeric. I&#8217;m not sure why but that is the only reason to create this very limited field. It simply creates a standard choice field with numeric choices within the range given in the constructor. You can specify a start number, end number and the increment. For the most part I would recommend just using an ObjectChoiceField since it is more flexible.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/NumericChoiceField.html">NumericChoiceField</a></p>
<pre class="brush: java">// NumericChoiceField
NumericChoiceField numeric = new NumericChoiceField("Numeric Choice Field: ", 1, 10, 1, 4);
add(numeric);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/numericchoicefield.png' title='NumericChoiceField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/numericchoicefield.png' alt='NumericChoiceField screenshot' /></a></p>
<h3 id="gaugefield">GaugeField</h3>
<p>The gauge is a very handy field which allows you to show a progress bar style value selector. If the ObjectChoiceField wasn&#8217;t enough for you never to use NumericChoiceField then perhaps this field could shoulder the load. It can be a straight uneditable field or it can allow focus and edit so the user can change the value. Overall this control is great and would be handy for anybody working on game programming.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/GaugeField.html">GaugeField API reference</a></p>
<pre class="brush: java">// GaugeField
GaugeField gauge = new GaugeField("Gauge Field: ", 1, 100, 50, Field.EDITABLE | Field.FOCUSABLE);
add(gauge);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/gaugefield.png' title='GaugeField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/gaugefield.png' alt='GaugeField screenshot' /></a></p>
<h3 id="datefield">DateField</h3>
<p>I&#8217;ve never actually seen one of these in the standard suite of applications on the blackberry so it took me a bit to figure out how to use it properly. First you get down to the field and click the trackball on it. The appearance of the field will change to be the same as the screenshot below and the date, if not already set, will change to be today. You can then use the trackball to choose the date part and roll through the various dates. When finished click the trackball again to complete. Of all the fields this one has the most configuration options for what I can see. You can choose from many different date input formats and representations, overall it probably needs a full post just for itself.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/DateField.html">DateField API reference</a></p>
<pre class="brush: java">// DateField
DateField dte = new DateField("Date Field: ", Long.MIN_VALUE, DateField.DATE);
add(dte);</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/datefield.png' title='DateField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/datefield.png' alt='DateField screenshot' /></a></p>
<h3 id="listfield">ListField</h3>
<p>This element is what set me on this project in the first place. I was looking to recreate the Status screen under the Wrench icon which has a list with left and right aligned text. I wanted to make an About screen for my game that included device specs like screen size, etc and figured that would be a good way to lay it out. It certainly wasn&#8217;t easy to find out how to do it even after I discovered that ListField was the basis for it. The ListFieldCallback is more complicated than I figure is necessary but the most important part is the drawListRow method. drawText defaults to drawing left aligned text which works for the label of the field and if you add the DrawStyle.RIGHT style it will draw right aligned, voila!<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/ListField.html">ListField API reference</a></p>
<pre class="brush: java">// Listfield (must have a callback)
ListField list = new ListField();
list.setEmptyString("Nothing to see here", DrawStyle.LEFT);
list.setSize(3);
list.setCallback(new TestListCallback());
add(list);

&hellip;

final class TestListCallback implements ListFieldCallback {
    public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
        g.drawText("Testing:", 0, y, 0, w);
        g.drawText(String.valueOf(index * 111), 0, y, DrawStyle.RIGHT, w);
    }
    public Object get(ListField listField, int index) {
        return null;
    }
    public int getPreferredWidth(ListField listField) {
        return Graphics.getScreenWidth();
    }
    public int indexOfList(ListField listField, String prefix, int start) {
        return listField.indexOfList(prefix, start);
    }
}</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/listfield.png' title='ListField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/listfield.png' alt='ListField screenshot' /></a></p>
<h3 id="buttonfield">ButtonField</h3>
<p>The API had to have a button field and here it is but I don&#8217;t feel it is very useful overall. I&#8217;ve never seen one in use in the applications on the blackberry but I haven&#8217;t dug to deeply. Most applications use a ListField for their buttons instead of actual buttons. The FieldChangeListener is used to catch the click event after it is attached to the ButtonField. You can also attach the listener to any Field since the setChangeListener function is in the parent class so you could easily make a BitmapField clickable using this technique.<br />
<a href="http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/ui/component/ButtonField.html">ButtonField API reference</a></p>
<pre class="brush: java">// ButtonField
ButtonField btn = new ButtonField("myButton");
btn.setChangeListener(new ButtonListener());
add(btn);

&hellip;

final class ButtonListener implements FieldChangeListener {
    public void fieldChanged(Field field, int context) {
        ButtonField btn = (ButtonField) field;
        Status.show("Button pressed: " + btn.getLabel());
    }
}</pre>
<p><a href='http://devsushi.com/wp-content/uploads/2007/12/buttonfield.png' title='ButtonField screenshot'><img src='http://devsushi.com/wp-content/uploads/2007/12/buttonfield.png' alt='ButtonField screenshot' /></a></p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/12/02/blackberry-jde-api-user-interface-field-reference/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>Getting started with the Blackberry Java Development Environment (JDE)</title>
		<link>http://devsushi.com/2007/11/15/getting-started-with-the-blackberry-java-development-environment-jde/</link>
		<comments>http://devsushi.com/2007/11/15/getting-started-with-the-blackberry-java-development-environment-jde/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 00:15:25 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/11/15/getting-started-with-the-blackberry-java-development-environment-jde/</guid>
		<description><![CDATA[Recently I became frustrated with the state of free games for the Blackberry platform. BrickBreaker is really hard and choppy on the newer devices so I decided to do something about it. I also have a Blackberry Pearl just sitting at home since my recent upgrade to the Blackberry Curve. So frustration + extra device [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>Recently I became frustrated with the state of free games for the Blackberry platform. BrickBreaker is really hard and choppy on the newer devices so I decided to do something about it. I also have a Blackberry Pearl just sitting at home since my recent upgrade to the Blackberry Curve. So frustration + extra device + time = development on the Blackberry platform. After wading through some web pages on the developer site and running into more than one snag I decided to document to process in tutorial form. I hope this helps you get starting with the Blackberry JDE. Please feel free to drop questions in the comments or to email me at <a href="mailto:ahewgill@gmail.com">ahewgill@gmail.com</a>.<span id="more-52"></span></p>
<h3>Java Required</h3>
<p>In order to develop using the Blackberry JDE you must first have installed the <a href="http://java.sun.com/javase/downloads/index.jsp">Sun Java Development Kit (JDK)</a> (more than just the JRE). This package will give you access to the java compiler which the Blackberry JDE requires.</p>
<h3>Installation</h3>
<p>The first step is to install the <a href="http://na.blackberry.com/eng/developers/downloads/jde.jsp">Blackberry Java Development Environment (JDE)</a> available on from the <a href="http://na.blackberry.com/eng/developers/">Blackberry Developer website</a>. (As of this writing the latest version is 4.5.0). You have to register for an account and verify via email in order to download the software which is very annoying. It took them 24 hours to send me the verification link so that I could sign in and begin the download. It is best to download the full JDE rather than the individual pieces in my opinion but this is up to you and your bandwidth constraints.</p>
<h3>Setting up the PATH</h3>
<p>In order to run the Java compiler, JDE requires it be in the system PATH. To do this right click on <em>My Computer</em> and click <em>Properties</em>. Now click the <em>Advanced</em> tab and then the <em>Environment Variables</em> button. In the system variables (lower) part find and select the PATH variable and then click the <em>Edit</em> button. Now at the very end of the string add <em>;C:\Program Files\Java\jdk1.x.x_yy\bin;C:\Program Files\Research In Motion\BlackBerry JDE 4.x.x\bin</em> (make sure you have the semi-colon at the front). Click <em>Ok</em>, then <em>Ok</em> again and finally one last time. You will have to check for the relevant version numbers on your own computer to fill in above.</p>
<h3>Running a few samples</h3>
<p>Once you have the JDE installed it is time to try out a few of the samples provided. First open the editor by clicking <em>Start -> Programs -> Research in Motion -> Blackberry JDE 4.x.x -> JDE</em>. Windows Firewall may ask if you want to allow JDE to access the Internet; I let it so I don&#8217;t know if it will work if blocked. Once in the editor click <em>File -> Open Workspace&#8230;</em> and browse to <em>C:\Program Files\Research in Motion\Blackberry JDE 4.x.x\samples</em> and select <em>samples.jdw</em>.</p>
<p>Let&#8217;s run the <em>HelloWorldDemo</em> sample. First thing you must do it set <em>HelloWorldDemo</em> to be the only active project. Click <em>Project -> Set Active Projects&#8230;</em> and then in the dialog that appears click <em>Clear All</em> and then check off <em>HelloWorldDemo</em> (formerly <em>com_rim_helloworld</em>) and click <em>Ok</em>. You are now ready to build and run the project. Click <em>Debug -> Go</em> to build the code and run the simulator (can take time to load so be patient).</p>
<p>The first thing you will notice is that you&#8217;re presented with a Blackberry 8300 Curve in its default configuration. Click the menu key and find <em>HelloWorldDemo</em> in the application list. Click the trackball to run it, voila! To exit the application click the menu key and then click the close option. Simple right! I encourage you to take a look through the code of the various demos at some point to become familiar with the Blackberry APIs. I have also created a <a href="http://devsushi.com/2007/12/02/blackberry-jde-api-user-interface-field-reference/">Blackberry API UI reference</a> with screenshots and sample code.</p>
<p>In the editor click <em>File -> Close Workspace</em> and then close any code windows you might have open on the right before continuing.</p>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/helloworld.png' title='HelloWorld Application in list'><img src='http://devsushi.com/wp-content/uploads/2007/11/helloworld-150x150.png' alt='HelloWorld Application in list' /></a><a href='http://devsushi.com/wp-content/uploads/2007/11/helloworld-01.png' title='HelloWorld Application running'><img src='http://devsushi.com/wp-content/uploads/2007/11/helloworld-01-150x150.png' alt='HelloWorld Application running' /></a></p>
<h3>Creating your own <em>HelloWorld</em></h3>
<p>Now that you know how to use the editor and run an application it is time to start your first program. I&#8217;m going to give you the code but the idea of this section is to learn how to create a new workspace, project, and code file. Click <em>File -> New Workspace&hellip;</em> and then give your program a name like <em>MyHelloWorld</em>. In the second box add <em>MyHelloWorld</em> to the end of the creation path leaving off the last backslash. Click <em>Ok</em> and then <em>Yes</em> to the directory creation question. You now have a new workspace in which to put your project.</p>
<p>To create the project simply click <em>Project -> Create New Project&hellip;</em> and enter the project name (eg <em>HelloWorld</em>) into the first box. This time you don&#8217;t have to mess with the directory, just click <em>Ok</em>.</p>
<p>Now it is time to add a code file to your empty project. On the left click the <em>HelloWorld</em> project in the Files tree view. Now click <em>Project -> Create New File in Project&hellip;</em> and enter a file name (eg <em>HelloWorld.java</em>) into the first box. In the second box we need to add at least one directory because Java likes to organize things into packages. Add <em>\com\sample</em> to the end of the second box and note that the automatically generated code has the line <em>package com.sample;</em>. You&#8217;ll notice this type of thing throughout the Java APIs, this is how classes are organized.</p>
<p>Now that we have a code file it is time to add some code. Replace the tiny little empty class stub (everything below the <em>package com.sample</em> line) with the follow code (I stole this directly from the <em>HelloWorld</em> sample we ran above).</p>
<pre class="brush: java">import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;

/*
 * BlackBerry applications that provide a user interface
 * must extend UiApplication.
 */
public class HelloWorld extends UiApplication
{
        public static void main(String[] args)
        {
                //create a new instance of the application
                //and start the application on the event thread
                HelloWorld theApp = new HelloWorld();
                theApp.enterEventDispatcher();
        }

        public HelloWorld()
        {
                //display a new screen
                pushScreen(new HelloWorldScreen());
        }
}

//create a new screen that extends MainScreen, which provides
//default standard behavior for BlackBerry applications
final class HelloWorldScreen extends MainScreen
{
        public HelloWorldScreen()
        {
                //invoke the MainScreen constructor
                super();

                //add a title to the screen
                LabelField title = new LabelField("HelloWorld Sample",
                       LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
                setTitle(title);

                //add the text "Hello World!" to the screen
                add(new RichTextField("Hello World!"));
        }

        //override the onClose() method to display a dialog box to the user
        //with "Goodbye!" when the application is closed
        public boolean onClose()
        {
            Dialog.alert("Goodbye!");
            System.exit(0);
            return true;
        }
}
</pre>
<p>Click <em>Build -> Build</em> (or hit F7) to make sure it compiles with no errors. Any syntax errors or other messages will appear in the bottom Build window so make sure to look there before assuming everything worked. Now hit <em>Debug -> Go</em> to run the code in the Blackberry simulator.</p>
<p><a href='http://devsushi.com/wp-content/uploads/2007/11/helloworld-02.png' title='Our own HelloWorld application in list'><img src='http://devsushi.com/wp-content/uploads/2007/11/helloworld-02-150x150.png' alt='Our own HelloWorld application in list' /></a></p>
<h3>Installation on a physical device</h3>
<p>Once you have an application and have run the simulator a few times you might get the desire to install your app on an actual device. It is fairly easy to do this once you have setup the PATH variable. Open a command window by clicking <em>Start -> Run&hellip;</em> type <em>cmd</em> and hit enter. In the little black window go to the location of your application and find the .cod file. Make sure you&#8217;ve connected your device with the USB cable and then run the following command.</p>
<pre class="brush: plain">javaloader -usb load HelloWorld.cod</pre>
<p>You&#8217;re handset will go white with a spinning hour glass for a few seconds and then back to normal.  You will now see the application icon installed on the device. Congratulations you are now a Blackberry developer!</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/11/15/getting-started-with-the-blackberry-java-development-environment-jde/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>ASP.Net DropDownList annoyance</title>
		<link>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/</link>
		<comments>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 21:26:58 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/10/19/aspnet-dropdownlist-annoyance/</guid>
		<description><![CDATA[I recently ran into a problem with using the ASP.Net DropDownList for toggling the status of an element. The problem stems from how the ASP.Net page object works. In this article I present the problem and then show a solution that seems to work with some caveats. My goal is to create a toggle for [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into a problem with using the ASP.Net DropDownList for toggling the status of an element. The problem stems from how the ASP.Net page object works. In this article I present the problem and then show a solution that seems to work with some caveats.<span id="more-51"></span></p>
<p>My goal is to create a toggle for the status of a page. For example I have a report and it has the possible status of <em>Open</em> or <em>Closed</em>. The DropDownList contains only the opposite of the current status of the report so when the report is <em>Open</em> the DropDownList contains an empty item (no change) and <em>Closed</em>. Here is the code.</p>
<pre class="brush: vb">&lt;script runat="server"&gt;
  Sub Page_Load()
    If Not Page.IsPostBack Then
      Session("bool") = "Open"
    End If

    ' Setup drop down
    ddlItems.Items.Clear()
    ddlItems.Items.Add("")
    If Not Session("bool") = "Open" Then ddlItems.Items.Add("Open")
    If Not Session("bool") = "Closed" Then ddlItems.Items.Add("Closed")
  End Sub

  Sub Click_Submit(ByVal s As Object, ByVal e As EventArgs)
    If ddlItems.SelectedValue = "Open" Then
      Session("bool") = "Closed"
    ElseIf ddlItems.SelectedValue = "Open" Then
      Session("bool") = "Closed"
    End If
  End Sub
&lt;/script&gt;

&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Drop Down Annoyance&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form runat="server"&gt;
  &lt;h1&gt;Drop Down Annoyance&lt;/h1&gt;
  &lt;p&gt;Current Status: &lt;%= Session("bool") %&gt;&lt;/p&gt;
  &lt;p&gt;Update to: &lt;asp:DropDownList ID="ddlItems" runat="server" /&gt;&lt;/p&gt;
  &lt;asp:Button ID="btnSubmit" Text="Update" OnClick="Click_Submit" runat="server" /&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>There are two problems at work here that cause a complete failure of the intended action. Firstly, during <em>Page_Load</em> the <em>Click_Submit</em> event has not yet fired so the Session variable still contains the old value of <em>Open</em>. The code then rebuilds the DropDownList based on the Session variable being unchanged. Secondly, doing the change of the DropDownList resets which option is selected loosing the users input.</p>
<p>We can fix both of these problems with one change to the code. Simply move the DropDownList change to the very last moment right before its declaration. Make sure to add all possible options to the declaration using ListItems, this is a must for it to work.</p>
<pre class="brush: vb">&lt;%@ Page Language="VB" Debug="True" %&gt;

&lt;script runat="server"&gt;

  Sub Page_Load()
    If Not Page.IsPostBack Then
      Session("bool") = "Open"
    End If
  End Sub

  Sub Click_Submit(ByVal s As Object, ByVal e As EventArgs)
    If ddlItems.SelectedValue = "Open" Then
      Session("bool") = "Open"
    ElseIf ddlItems.SelectedValue = "Closed" Then
      Session("bool") = "Closed"
    End If
  End Sub

&lt;/script&gt;

&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Drop Down Annoyance&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form runat="server"&gt;
  &lt;h1&gt;Drop Down Annoyance&lt;/h1&gt;
  &lt;p&gt;Current Status: &lt;%= Session("bool") %&gt;&lt;/p&gt;
  &lt;%
    ' Setup drop down
    ddlItems.Items.Clear()
    ddlItems.Items.Add("")
    If Not Session("bool") = "Open" Then ddlItems.Items.Add("Open")
    If Not Session("bool") = "Closed" Then ddlItems.Items.Add("Closed")
  %&gt;
  &lt;p&gt;Update to: &lt;asp:DropDownList ID="ddlItems" runat="server"&gt;
    &lt;asp:ListItem Text="" Selected="True" /&gt;
    &lt;asp:ListItem Text="Open" /&gt;
    &lt;asp:ListItem Text="Closed" /&gt;
  &lt;/asp:DropDownList&gt;&lt;/p&gt;
  &lt;asp:Button ID="btnSubmit" Text="Update" OnClick="Click_Submit" runat="server" /&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>What is going on here is that when ASP.Net creates the ddlItems object it loads it up with all the ListItems given in the declaration. These items are available throughout the code right up until the point where we Clear and then change the DropDownList. The Session variable has been changed by this time and so everything works out. One very important caveat of this method is that you must not use ddlItems.SelectedIndex since the number of options in the list changes, instead use ddlItems.SelectedValue.</p>
<p>Does anybody else have any novel solutions for working with DropDownList controls?</p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/10/19/aspnet-dropdownlist-annoyance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting a Blackberry Curve</title>
		<link>http://devsushi.com/2007/10/19/blackberry-curve/</link>
		<comments>http://devsushi.com/2007/10/19/blackberry-curve/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 16:22:06 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/?p=83</guid>
		<description><![CDATA[I just found out yesterday that I am able to upgrade my Blackberry Pearl to the Curve through the Rogers hardware upgrade plan. Work is going to pay for the upgrade which is a nice perk. A co-worker recently got the Curve and we have all been trying it out and getting hooked. Most affected [...]]]></description>
			<content:encoded><![CDATA[<p>I just found out yesterday that I am able to upgrade my Blackberry Pearl to the Curve through the Rogers hardware upgrade plan. Work is going to pay for the upgrade which is a nice perk. A co-worker recently got the Curve and we have all been trying it out and getting hooked. Most affected are those of us who have the Pearl since the Curve has a full keyboard that is decent to type on. I&#8217;ll probably review the Curve once I&#8217;ve had a week or two to play with it.</p>
<p><span id="more-83"></span></p>
<p>I&#8217;ve been considering writing a game for the Blackberry since the free ones you get from MagMic are fairly pedestrian. The other day I looked into the pay games and a vendor is selling Mahjong for ten bucks talk about a rip off. I&#8217;m not sure what type of game to make yet but I can guarantee that it will be better than Brick Breaker, I hate that game. The only game that I can stand is <a href="http://magmic.com/game/KaGlom">Ka-Glom!</a> but it becomes boring after a while. Any suggestions out there for what type of game would hold your attention? Consider the platform, 3D is out, any idea has to pretty much be moving sprite based.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/10/19/blackberry-curve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mambo to the beat of the internet</title>
		<link>http://devsushi.com/2007/08/10/mambo-to-the-beat-of-the-internet/</link>
		<comments>http://devsushi.com/2007/08/10/mambo-to-the-beat-of-the-internet/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 16:59:41 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[css/xhtml]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/08/10/mambo-to-the-beat-of-the-internet/</guid>
		<description><![CDATA[A few years ago I looked into using a Content Management System (CMS) to develop a site for a friend. At the time there were a few choices including Mambo, Joomla, Drupal, and about a hundred more which you can test at Open Source CMS. Mambo was really the only player that had the needed [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago I looked into using a Content Management System (CMS) to develop a site for a friend. At the time there were a few choices including <a href="http://mambo-foundation.org/">Mambo</a>, <a href="http://www.joomla.org/">Joomla</a>, <a href="http://drupal.org/">Drupal</a>, and about a hundred more which you can test at <a href="http://www.opensourcecms.com/">Open Source CMS</a>. Mambo was really the only player that had the needed feature set which included forum/gallery/blogs/etc all in one user based interface (thanks to the many extensions). The only issue was that the system was horribly unfriendly to the internet and its standards. Each control/plugin box on the page was wrapped in a table inside another table and finally another table. Doing any template work was nightmare-ish especially if you wanted to use proper XHTML and CSS; and don&#8217;t even get me started on accessibility. I didn&#8217;t end up doing the project because my recommendation was to write it all myself.<span id="more-50"></span></p>
<p>Today I came across a del.icio.us link from <a href="http://snook.ca/jonathan/">Jonathon Snook</a> about how <a href="http://www.source.mambo-foundation.org/content/view/126/1/">Mambo will be integrating Cake PHP for version 5.0</a>. I wasn&#8217;t able to find a development time line but did come across some other interesting news.</p>
<blockquote><p>The team has spent a considerable amount of time working on XHTML validation, WCAG 1.0 (Priority 1, 2, and some 3), removal of unnecessary and/or inaccessible JavaScript code, improved usability, plus much more.<br />
<cite><a href="http://www.source.mambo-foundation.org/content/view/126/1/">from &quot;Baking Mambo&quot; written by Chad Auld</a></cite>
</p></blockquote>
<p>I hope that 4.7 comes out soon and that the work indicated by the preceding quote actually makes a difference. It would be great to see a success for Mambo that causes a cascade of other CMSs to follow suit.</p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/08/10/mambo-to-the-beat-of-the-internet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASP.Net has 9 to 5 appeal</title>
		<link>http://devsushi.com/2007/07/23/aspnet-has-9-to-5-appeal/</link>
		<comments>http://devsushi.com/2007/07/23/aspnet-has-9-to-5-appeal/#comments</comments>
		<pubDate>Mon, 23 Jul 2007 18:13:03 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/07/23/aspnet-has-9-to-5-appeal/</guid>
		<description><![CDATA[My first article on this blog was the first in the &#8220;Dynamic Control Creation&#8221; series. I wrote it because I was frustrated with how ASP.Net worked and wanted to share my discoveries/workarounds with other frustrated developers. After a period of time Google picked up my article and I started to receive a decent amount of [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://devsushi.com/wp-content/uploads/2007/07/9to5appeal.png' alt='9 to 5 Appeal' /><br />
<span id="more-49"></span></p>
<p>My first article on this blog was the first in the &#8220;<a href="http://adamhewgill.com/devsushi/2006/08/27/aspnet-dynamic-control-creation-part-1/">Dynamic Control Creation</a>&#8221; series. I wrote it because I was frustrated with how ASP.Net worked and wanted to share my discoveries/workarounds with other frustrated developers. After a period of time Google picked up my article and I started to receive a decent amount of traffic and some positive feedback. Here at work I use ASP.Net for a majority of my applications and so the blog has continued to focus on it primarily. An interesting thing that I&#8217;ve noticed is that site traffic has a very consistent pattern &mdash; which I attribute to my focus on ASP.Net. Above you see a graph &mdash; from <a href="https://www.google.com/analytics/home/">Google Analytics</a> &mdash; that shows daily traffic over the last five months. Each valley in the graph made up of the numbers for Saturday and Sunday which are consistently very small compared to the weekday traffic.</p>
<p>I&#8217;ve done a few inquiries and looked at a few other sites I have stats for and found that this isn&#8217;t all that common. When other sites match my pattern they have a high number of work time surfers coming to their site as I do.  I use this loose research to conclude that ASP.Net is widely used in the workplace and much less common for personal/weekend projects. PHP blogs and websites have a very consistent amount of traffic on all days of the week as many weekend programmers surf for information.</p>
<p>What does this signify for ASP.Net? Very few people use it for fun for one thing. I certainly don&#8217;t when I don&#8217;t have to. In fact I am phasing it out at work slowly too, starting most new projects in PHP &mdash; which I&#8217;m not really a fan of either. Companies across the globe are buying into Microsoft server products and technologies and forcing it down their employees throats.</p>
<p>How do your traffic statistics look? What is your main theme/topic? Would you prefer to use a different programming language at work? Leave a comment, I&#8217;m very interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/07/23/aspnet-has-9-to-5-appeal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.Net CheckBoxes should be able to have values</title>
		<link>http://devsushi.com/2007/07/16/aspnet-checkboxes-should-be-able-to-have-values/</link>
		<comments>http://devsushi.com/2007/07/16/aspnet-checkboxes-should-be-able-to-have-values/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 19:06:33 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[css/xhtml]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://adamhewgill.com/devsushi/2007/07/16/aspnet-checkboxes-should-be-able-to-have-values/</guid>
		<description><![CDATA[The ASP.Net CheckBox and CheckBoxList control don&#8217;t allow for the use of the full W3C HTML standard. For some reason Microsoft decided to implement a reduced functionality version that creates more work for the programmer. Come on Microsoft why can&#8217;t you follow even the simplest of standards? In this case it would make coding the [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>The ASP.Net <em>CheckBox</em> and <em>CheckBoxList</em> control don&#8217;t allow for the use of the full W3C HTML standard. For some reason Microsoft decided to implement a reduced functionality version that creates more work for the programmer. Come on Microsoft why can&#8217;t you follow even the simplest of standards? In this case it would make coding the .Net framework easier for you not to mention us!<span id="more-47"></span></p>
<p>The W3C HTML 4.01 specification specifically states for the <em>value</em> attribute to:</p>
<blockquote><p>
&#8211; Specify for radio buttons and checkboxes &#8211;<br />
<cite><a href="http://www.w3.org/TR/html401/interact/forms.html#edef-INPUT">W3C HTML 4.01 Specification &#8211; INPUT Element</a></cite>
</p></blockquote>
<p>To me this quote reads as a strong recommendation to specify the <em>value</em> attribute rather than leave it up to the browsers default (generally &quot;On&quot;). Microsoft decided to not even allow the value attribute to be set. They went so far as to have a validation message built into Visual Studio that says:</p>
<blockquote><p>
Attribute &#8216;Value&#8217; is not a valid attribute of element &#8216;CheckBox&#8217;
</p></blockquote>
<p>If you ignore the warning and run the page, the <em>value</em> attribute is missing. I have even tried circumventing the ASP.Net HTML-izer by adding <em>value</em> to the attributes collection with no success. Microsoft intentionally strips it, so I can only assume they have some reasoning behind this behavior and I imagine they will say something about security in defense.</p>
<p>There is one way to circumvent the behavior but it requires not using ASP.Net controls. Simply insert traditional <em>input type=&#8221;checkbox&#8221;</em> elements into your page and collect their values using <em>Request.Form</em>.</p>
<pre class="brush: vb">Sub Page_Load ()
  Dim value As String
  value = Request.Form(&quot;chkItem&quot;)
End Sub
&hellip;
&lt;input type=&quot;checkbox&quot; id=&quot;chkItem&quot; name=&quot;chkItem&quot; /&gt;
&lt;label for=&quot;chkItem&quot;&gt;CheckBox Item Text&lt;/label&gt;
</pre>
<p>I made a big deal out of this issue simply because to me it doesn&#8217;t make any sense. You can get around the issue and still use ASP.Net controls but it requires extra coding.</p>
<pre class="brush: vb">Sub Page_Load ()
  Dim value As String
  If chkItem.Checked Then
    value = &quot;Some Value&quot;
  Else
    value = &quot;Some Other Value&quot;
  End If
End Sub
&hellip;
&lt;asp:CheckBox ID=&quot;chkItem&quot; Text=&quot;CheckBox Item Text&quot; runat=&quot;server&quot; /&gt;
</pre>
<p>When using the <em>CheckBoxList</em> control you will notice ASP.Net uses tables to layout the list. To keep it from doing this you simply need to add a few attributes. It should then use much more standards compliant code. I also show how to access which boxes are checked after postback in a <em>CheckBoxList</em>.</p>
<pre class="brush: vb">Sub Page_Load ()
  ' Find out which boxes were checked
  Dim value As String = &quot;&quot;
  For Each item As ListItem In cblTest.Items
    If item.Selected Then
      value &amp;= item.Value
    End If
  Next
End Sub
&hellip;
&lt;asp:CheckBoxList ID=&quot;cblList&quot; RepeatLayout=&quot;Flow&quot; RepeatDirection=&quot;Horizontal&quot; runat=&quot;server&quot;&gt;
  &lt;asp:ListItem Text=&quot;Item 1&quot; Value=&quot;1&quot; /&gt;
  &lt;asp:ListItem Text=&quot;Item 2&quot; Value=&quot;2&quot; /&gt;
  &lt;asp:ListItem Text=&quot;Item 3&quot; Value=&quot;3&quot; /&gt;
&lt;/asp:CheckBoxList&gt;
</pre>
<p>As always let me know if you have any questions.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://devsushi.com/2007/07/16/aspnet-checkboxes-should-be-able-to-have-values/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
