<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0IBQnw-eip7ImA9WhRUFE0.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252</id><updated>2012-01-24T02:39:13.252-08:00</updated><category term="C#" /><category term="Python" /><category term="Mobile" /><category term="Differences between C# and Java" /><category term="Mobile Web" /><category term="Polymorphism" /><category term="Django" /><category term="Linq" /><category term="Genetic Programming" /><category term="Eclipse" /><category term="OOP" /><category term="Comics" /><category term="Android 3.0" /><category term="OrmLite" /><category term="Android" /><category term="Java" /><category term="My Apps" /><category term="FastShopper" /><category term="StackOverflow Questions" /><title>Corey Sunwold</title><subtitle type="html">Adventures in Code</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://csunwold.blogspot.com/" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/CoreySunwold" /><feedburner:info uri="coreysunwold" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CUEEQH05eSp7ImA9WhdSE0Q.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-8770767632461241419</id><published>2011-07-22T21:00:00.000-07:00</published><updated>2011-07-22T21:00:01.321-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-22T21:00:01.321-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="OrmLite" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Frustrations With Data Access on Android + Intro to OrmLite</title><content type="html">Working in the .Net world during the day and doing some Android development in my spare time has a tendency to bias my opinion against Java. Don't get me wrong, I'll take Java over C/C++/Objective-C any day, but the lack of lambdas and delegates can get frustrating when you are spoiled by .Net's recent trend towards functional programming. This really becomes noticeable at the data access layer of Android applications where the API's for interacting with the onboard SQLite database can best be described as adequate.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Thankfully API problems, unlike core system architecture problems, are easily overcome by open source software and your fellow developers experiencing the same problems as you.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;After having just about enough inline SQL to drive me crazy I decided to investigate what Object Relational Mappers (ORM) are available for the Android OS. Since Android is based on its own implementation of the Java Virtual Machine there are a lot of Java applicable tools out there.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The first and most popular you may run across when looking around is Hibernate. Quite possibly one of the older and more popular open source ORM's available, it was originally built for larger Java applications than a simple Android app.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Another common one you will find is OrmLite. OrmLite is designed to be much more lightweight and smaller scale than Hibernate. This means that it does sacrifice some of the power that Hibernate has, but instead has simplicity and very small Jar files to add to your project.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Because of this I have arbitrarily started exploring OrmLite as my choice for Android development. Later on I may decide to go with Hibernate, but for now its OrmLite.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;So lets say you have run into this same problem and have decided that you too are sick of endless Cursor manipulation and are ready to spend more time writing Android apps and less time praying that the &lt;a href="http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery(java.lang.String, java.lang.String[])"&gt;rawQuery &lt;/a&gt;statement you just wrote is valid SQL syntax.&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;The first thing you need to do is add the Jar's to your project. Go to the&amp;nbsp;&lt;a href="http://ormlite.com/"&gt;OrmLite website&lt;/a&gt;&amp;nbsp;and download the ormlite-core and ormlite-android jar files.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Add these to your project. Assuming you are using Eclipse, right click on the project name and choose Properties. Then under Java Build Path-&amp;gt;Libraries choose Add External JARs... and select the two Jar's that you just downloaded.&lt;/li&gt;
&lt;li&gt;First you want to create the model class that you are going to be working with. OrmLite relies on Annotations to make sense of your class. Use the &lt;a href="http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/table/DatabaseTable.html"&gt;@DatabaseTable&lt;/a&gt; annotation to mark your class as a table, and the &lt;a href="http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/field/DatabaseField.html"&gt;@DatabaseField&lt;/a&gt; annotations to mark your properties as fields. Here is an example of a super simple data class. In it you can see that I set the id field to be the primary key for the table:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;import com.j256.ormlite.table.DatabaseTable;
import com.j256.ormlite.field.DatabaseField;

@DatabaseTable(tableName="data")
public class Data {
 
 @DatabaseField(id = true)
 private long id;
 @DatabaseField
 private String value;
 
 public Data() {
  
 }
 
 public Data(long id, String value) {
  this.id = id;
  this.value = value;
 }
 
 public long getId() {
  return this.id;
 }
 
 public String getValue() {
  return this.value;
 }
}
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Now you need to create your database helper class with the verbosely named&amp;nbsp;&lt;a href="http://ormlite.com/javadoc/ormlite-android/com/j256/ormlite/android/apptools/OrmLiteSqliteOpenHelper.html"&gt;OrmLiteSqliteOpenHelper&lt;/a&gt;. If you have created &lt;a href="http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html"&gt;SqliteOpenHelper &lt;/a&gt;classes before, this should feel very similar. Setup your constructor and override the onCreate and onUpgrade methods as you would a normal SqliteOpenHelper. One important note is that OrmLite relies on &lt;a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html"&gt;Data Access Objects&lt;/a&gt; to act as an intermediary layer on top of your database. This is what abstracts away the details you didn't want to deal with when you decided to go the ORM route. Because of this, it is recommended to give yourself a public method that returns yourself a &lt;a href="http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/Dao.html"&gt;Dao &lt;/a&gt;object specific to the type you are working with. The Dao is a generic class, where the first type is the type of the model you want to work with and the second type is the type of the property you marked as the id in your model. In my example I used a long for the id so I create a Dao&amp;lt;Data, Long&amp;gt;, but if you hadn't set an id property you should be able to use the Object type. Example class: &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;

public class DatabaseHelper extends OrmLiteSqliteOpenHelper {

 private static final String DATABASE_NAME = "test.db";
 private static final int DATABASE_VERSION = 1;
 
 private Dao&lt;data, long=""&gt; mDao;
 
 public DatabaseHelper(Context context) {
     super(context, DATABASE_NAME, null, DATABASE_VERSION);  
     mDao = null;
 }
 
 @Override
 public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
     try {
         TableUtils.createTable(connectionSource, Data.class);
     } catch(SQLException e) {
         Log.e(DatabaseHelper.class.getName(), "Can't create database.");
         throw new RuntimeException(e);
     }
 }
 
 @Override
 public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
     try {
         TableUtils.dropTable(connectionSource, Data.class, true);
  
         onCreate(db, connectionSource);
     } catch(SQLException e) {
          Log.e(DatabaseHelper.class.getName(), "Can't drop databases.");
         throw new RuntimeException(e);
     }
 }
 
 public Dao&lt;data, long=""&gt; getDataDao() throws SQLException {
  if (mDao == null) {
   mDao = getDao(Data.class);
   
  }
  
  return mDao;
 }
 
}
&lt;/data,&gt;&lt;/data,&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;The easiest way to start using your &lt;a href="http://ormlite.com/javadoc/ormlite-android/com/j256/ormlite/android/apptools/OrmLiteSqliteOpenHelper.html"&gt;DatabaseHelper &lt;/a&gt;from your Activity is to create an &lt;a href="http://ormlite.com/javadoc/ormlite-android/com/j256/ormlite/android/apptools/OrmLiteBaseActivity.html"&gt;OrmLiteBaseActivity&lt;/a&gt;. This gives you a few added methods to simplify things for you. For example it gives you the getHelper() method that returns an instance of the DatabaseHelper you wanted to work with. Since you went ahead and created a public method to return yourself and instance of the Dao you also now have an easy way to get at a Dao for doing your data manipulation. Example class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="java" name="code"&gt;import java.sql.SQLException;
import java.util.List;

import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
import com.j256.ormlite.dao.Dao;
import android.os.Bundle;
import android.widget.TextView;

public class Main extends OrmLiteBaseActivity&lt;databasehelper&gt; {
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
     Dao&lt;data, long=""&gt; dao = getHelper().getDataDao();
            Data d = new Data(1, "Hello World");  
     dao.create(d);
 } catch (SQLException e) {
     e.printStackTrace();
 }
  
 try {
     Dao&lt;data, long=""&gt; laterDao = getHelper().getDataDao();
     List&lt;data&gt; result = laterDao.queryForMatching(new Data(1, "Hello World"));
            TextView tv = new TextView(this);
     tv.setText(result.get(0).getValue());
     setContentView(tv);
 } catch (SQLException e) {
     e.printStackTrace();
 }  
        
    }
    
}
&lt;/data&gt;&lt;/data,&gt;&lt;/data,&gt;&lt;/databasehelper&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-8770767632461241419?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OMFyPdhpBSyoAsI_3kZc5dbE1lg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OMFyPdhpBSyoAsI_3kZc5dbE1lg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OMFyPdhpBSyoAsI_3kZc5dbE1lg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OMFyPdhpBSyoAsI_3kZc5dbE1lg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/3ocymNwSz-U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/8770767632461241419/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/07/frustrations-with-data-access-on.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8770767632461241419?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8770767632461241419?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/3ocymNwSz-U/frustrations-with-data-access-on.html" title="Frustrations With Data Access on Android + Intro to OrmLite" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/07/frustrations-with-data-access-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EEQXo6eCp7ImA9WhZSEUw.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-659713279757168409</id><published>2011-03-25T22:00:00.000-07:00</published><updated>2011-03-25T22:00:00.410-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-25T22:00:00.410-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="FastShopper" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Marketplace Statistics</title><content type="html">&lt;div&gt;&lt;span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-collapse: separate; color: black; font-family: Tahoma; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;Google took another positive step forward with their Marketplace recently. As a developer they have finally released statistics that let you track the number of devices that your app is installed on, what type of devices, and what countries those devices are located in. You can also see a graph showing the number of installs over time.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-collapse: separate; color: black; font-family: Tahoma; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-collapse: separate; color: black; font-family: Tahoma; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;So here are a few interesting, and unexpected stats that I have learned from mine:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;While the vast majority of FastShopper users are in the US, the second largest country is Taiwan.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;Android 2.1 and 2.2 are the dominant OS versions. Over 99% of my users are on those two versions.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;The Motorola X is the single device with the most installs representing 10.5% of all installs.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;There are more tablet users than I expected. 5% of installs are on the Galaxy Tablet.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;English is the primary language for only about 60% of my users. Knowing this now I'm going to be doing more work to ensure that my apps work across multiple languages.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma;"&gt;The total number of installs goes up then slowly trails down after each release. My guess is because a large number of users frequently download new apps from the "Just In" category to try out but very few end up liking and sticking with these applications.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-659713279757168409?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/enD3WebH0epfTRMtVBv2z3PfkIQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/enD3WebH0epfTRMtVBv2z3PfkIQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/enD3WebH0epfTRMtVBv2z3PfkIQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/enD3WebH0epfTRMtVBv2z3PfkIQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/_3tL7BpsNAw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/659713279757168409/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/03/marketplace-statistics.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/659713279757168409?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/659713279757168409?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/_3tL7BpsNAw/marketplace-statistics.html" title="Marketplace Statistics" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/03/marketplace-statistics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcFRng7eyp7ImA9Wx9bF0k.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-5851135861826542052</id><published>2011-02-26T11:20:00.000-08:00</published><updated>2011-02-26T11:20:17.603-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-26T11:20:17.603-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Code Assist Slow in Eclipse for Android Development</title><content type="html">This one has been bugging me for awhile but I finally had enough. Because I'm spoiled on content assist and Visual Studio Intellisense I go about most of my normal Android development relying heavily on Eclipse to find the methods I am looking for and auto-complete them. Unfortunately if you are running Eclipse 3.6 or below, even on the newest ADT version the content assist is unbearably slow.&lt;br /&gt;
&lt;br /&gt;
Thankfully it seems they are coming out with a fix for this in Eclipse 3.7. Since most of us are impatient and don't like waiting for fixes, one kind developer out there &lt;a href="http://groups.google.com/group/android-developers/msg/0f9d2a852e661cba"&gt;backported &lt;/a&gt;the fix into Eclipse 3.6.:&lt;br /&gt;
&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;You can replace your &amp;lt;ECLIPSE_HOME&amp;gt;/plugins/&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar plugin with one from&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;a href="http://www.google.com/url?sa=D&amp;amp;q=http://adt-addons.googlecode.com/svn/patches/org.eclipse.jdt.core_3.6.1.v_A68_R36x.zip" rel="nofollow" style="color: #0000cc;" target="_blank"&gt;http://adt-addons.googlecode.com/svn/patches/org.eclipse.jdt.core_3.6...&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;and restart Eclipse. Content Assists will be much better. Just try it.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;Don't forget backup your original plugins.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
I have verified that this is working, and unlike other fixes which require you to download the entire Android source for each version you are working in, you can have this up and running in under a minute.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-5851135861826542052?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/w0qu1kyDKtnHMiYYraeuwLJiGTg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w0qu1kyDKtnHMiYYraeuwLJiGTg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/w0qu1kyDKtnHMiYYraeuwLJiGTg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w0qu1kyDKtnHMiYYraeuwLJiGTg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/S01OL1IQZxA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/5851135861826542052/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/02/code-assist-slow-in-eclipse-for-android.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/5851135861826542052?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/5851135861826542052?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/S01OL1IQZxA/code-assist-slow-in-eclipse-for-android.html" title="Code Assist Slow in Eclipse for Android Development" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/02/code-assist-slow-in-eclipse-for-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcCQXk9fip7ImA9Wx9bFU8.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-8110819535462361330</id><published>2011-02-23T20:01:00.000-08:00</published><updated>2011-02-23T20:01:00.766-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-23T20:01:00.766-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Android 3.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Android 3.0 SDK - I'm Tired of The Emulator</title><content type="html">Anyone who has done any Android development knows that the emulator is the weak point of all Android development tools. On the upside it runs true ARM code, so what is ran on the device really is what is ran in the emulator &lt;a href="http://stackoverflow.com/questions/121018/is-it-possible-to-develop-for-the-iphone-without-an-iphone/121242#121242"&gt;unlike iPhone development&lt;/a&gt;. However, this interpreter is horrendously slow and with the improvements to Android 3.0, it feels like it just got a heck of a lot slower.&lt;br /&gt;
&lt;br /&gt;
I downloaded the &lt;a href="http://developer.android.com/sdk/android-3.0-highlights.html"&gt;3.0 SDK&lt;/a&gt; last night, anxiously ready to try out the new features in this tablet focused OS. Unfortunately, what I got was about 10 minutes just to boot the emulator, and once I got in it I lost out completely on the new experience because opening anything took absurdly long. All the animations where unreasonably choppy. I'm honestly unsure how Google was able to develop any of the "built in" apps on this given how slow it is.&lt;br /&gt;
&lt;br /&gt;
As the company who revolutionized Javascript performance, I expect a little more when it comes to software speed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-8110819535462361330?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OVz9cZ2IVCL7i6e2JBeWF6_LlIQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OVz9cZ2IVCL7i6e2JBeWF6_LlIQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OVz9cZ2IVCL7i6e2JBeWF6_LlIQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OVz9cZ2IVCL7i6e2JBeWF6_LlIQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/3gylZnC-kkU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/8110819535462361330/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/02/android-30-sdk-im-tired-of-emulator.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8110819535462361330?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8110819535462361330?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/3gylZnC-kkU/android-30-sdk-im-tired-of-emulator.html" title="Android 3.0 SDK - I'm Tired of The Emulator" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/02/android-30-sdk-im-tired-of-emulator.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAMR3kzfip7ImA9Wx9VGUk.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-3463981567718855149</id><published>2011-02-05T15:29:00.000-08:00</published><updated>2011-02-05T15:33:06.786-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-05T15:33:06.786-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Django" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><title>'unicode' object has no attribute '_meta'</title><content type="html">It appears I have run across another annoying problem for which there is a lot of contradicting information. I'm working on a Django project and I ran into this error:&amp;nbsp;'unicode' object has no attribute '_meta'. What is really important is the context in which I received the error. There are a lot of different possible culprits and an even larger number of possible fixes.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The context within I was receiving this error was in a view function that was "supposed" to be returning a list of strings in json. If you have any experience with returning Django queryset results in json you probably immediately think of doing something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="python" name="code"&gt;#Not what you want!
from django.core import serializers 
from django.http import HttpResponse
from myproject.myapp.models import MyModel

def get_my_strings(request):
&amp;nbsp;&amp;nbsp; &amp;nbsp;some_models = MyModel.objects.filter(user=request.user)
&amp;nbsp;&amp;nbsp; &amp;nbsp;my_strings = []
&amp;nbsp;&amp;nbsp; &amp;nbsp;for s in my_strings:
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;my_strings.append(some_models.some_string)
&amp;nbsp;&amp;nbsp; &amp;nbsp;#error will be thrown
&amp;nbsp;&amp;nbsp; &amp;nbsp;my_strings = serializers.serialize('json', my_strings) 
&amp;nbsp;&amp;nbsp; &amp;nbsp;return HttpResponse(my_strings, mimetype='application/json')&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;This is wrong.&lt;br /&gt;
&lt;br /&gt;
What you actually want is to use the simplejson.dumps function to serialize your data. &amp;nbsp;Here is the correct form:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="python" name="code"&gt;#Import simplejson instead
from django.utils import simplejson 
from django.http import HttpResponse
from myproject.myapp.models import MyModel

def get_my_strings(request):
&amp;nbsp;&amp;nbsp; &amp;nbsp;some_models = MyModel.objects.filter(user=request.user)
&amp;nbsp;&amp;nbsp; &amp;nbsp;my_strings = []
&amp;nbsp;&amp;nbsp; &amp;nbsp;for s in my_strings:
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;my_strings.append(some_models.some_string)
&amp;nbsp;&amp;nbsp; &amp;nbsp#Corrected!
&amp;nbsp;&amp;nbsp; &amp;nbsp;my_strings = simplejson.dumps(my_strings, indent=4) 
&amp;nbsp;&amp;nbsp; &amp;nbsp;return HttpResponse(my_strings, mimetype='application/json'
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-3463981567718855149?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ss84TIMYeGg1R3b16rA1f51F1m8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ss84TIMYeGg1R3b16rA1f51F1m8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ss84TIMYeGg1R3b16rA1f51F1m8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ss84TIMYeGg1R3b16rA1f51F1m8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/2L39m0b3qeI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/3463981567718855149/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/02/unicode-object-has-no-attribute-meta.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3463981567718855149?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3463981567718855149?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/2L39m0b3qeI/unicode-object-has-no-attribute-meta.html" title="'unicode' object has no attribute '_meta'" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/02/unicode-object-has-no-attribute-meta.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UBSXY5fSp7ImA9Wx9XFEo.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-1165950621142766145</id><published>2011-01-08T00:26:00.000-08:00</published><updated>2011-01-08T00:27:38.825-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-08T00:27:38.825-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Lessons in Android UI Design</title><content type="html">I've never considered myself to be very talented when it comes to visual design of any kind, I generally just go with what I think will work really well for me and then hope it will work well for other people. &amp;nbsp;If it doesn't work, I try to adjust accordingly. &amp;nbsp;With &lt;a href="http://csunwold.blogspot.com/2010/12/fastshopper.html"&gt;my first app&lt;/a&gt; up on the market for coming up on a month there are three things I've learned that I'm going to try and carry forward into future app design.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&amp;nbsp;&lt;a href="http://google.about.com/od/l/g/long_touch_click_android.htm"&gt;Long-press&lt;/a&gt; is an interaction that users get&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I had my doubts about this because it was a few weeks after I first bought my Droid that I realized it was even an option. &amp;nbsp;If you haven't tried this much, try press and holding on as much as possible on your Android device. &amp;nbsp;You will be amazed at how much more functionality you discover. &amp;nbsp;My girlfriend even tried pressing and holding on a list item to edit it only to realize I never programmed such functionality, she just assumed it would be available. &amp;nbsp;New feature on the way there.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Not everyone knows to press the "menu" button to bring up more functionality in an app&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I tucked away some important options in FastShopper in the menu. &amp;nbsp;The biggest one is the ability to edit aisles (groups). &amp;nbsp;This means a significant number of people haven't discovered one of the most powerful features of my app, which is the ability to customize the aisles based on the store you are working in. &amp;nbsp;I consider this a huge oversight on my part which I will be working to correct.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. People want to be able to edit anything and everything&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you have data, they want to edit it. &amp;nbsp;They don't want to delete it and create a new one, they want to edit the one in front of them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-1165950621142766145?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fP1m1rOTJn0_1M6rU19luE1ETjE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fP1m1rOTJn0_1M6rU19luE1ETjE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fP1m1rOTJn0_1M6rU19luE1ETjE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fP1m1rOTJn0_1M6rU19luE1ETjE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/ZxpmxgZoOUI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/1165950621142766145/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/01/lessons-in-android-ui-design.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1165950621142766145?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1165950621142766145?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/ZxpmxgZoOUI/lessons-in-android-ui-design.html" title="Lessons in Android UI Design" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/01/lessons-in-android-ui-design.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEABSXw5eip7ImA9Wx9XEUw.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-8420699143439348281</id><published>2011-01-03T19:45:00.000-08:00</published><updated>2011-01-03T19:45:58.222-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-03T19:45:58.222-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Android Developers Wishlist</title><content type="html">After having my &lt;a href="http://csunwold.blogspot.com/2010/12/fastshopper.html"&gt;first app&lt;/a&gt; on the Android Market for about 3 weeks I already have a small list of improvements I would like to see built into the Developer Console for the Android Market:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Integrated Admob revenue tracking for Android applications&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I check stats on FastShopper way too often, especially considering the small user base, but when I do have to pull open two sites, one for http://market.android.com/publish/home to see how many people have downloaded and have active installs and http://www.admob.com to check my ads statistics. &amp;nbsp;Since Admob is now owned by Google and is becoming a significant source of revenue for many Android developers why not put 2 and 2 together? &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Graphs showing dates and times of downloads and uninstalls&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I don't need to see who is downloading my app, but it would be nice if I could figure out trends. &amp;nbsp;When are people downloading my app? &amp;nbsp;When are people removing my app? &amp;nbsp;Is there a trend at all? &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Feedback information when a user uninstalls an application.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This seems ridiculous to me that developers don't already have this information. &amp;nbsp;When a user removes an application from their phone they are prompted to give feedback as to why they are removing it. &amp;nbsp;This is huge! &amp;nbsp;Developers need to know why users are getting rid of their app in order to make it better.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-8420699143439348281?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6zn3jd6d784Kzb2xzH_--1OPdc8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6zn3jd6d784Kzb2xzH_--1OPdc8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6zn3jd6d784Kzb2xzH_--1OPdc8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6zn3jd6d784Kzb2xzH_--1OPdc8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/rKlob5gV7D8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/8420699143439348281/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2011/01/android-developers-wishlist.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8420699143439348281?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8420699143439348281?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/rKlob5gV7D8/android-developers-wishlist.html" title="Android Developers Wishlist" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2011/01/android-developers-wishlist.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04MQH89eCp7ImA9Wx9QEE8.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-4212043468792543872</id><published>2010-12-22T06:59:00.000-08:00</published><updated>2010-12-22T06:59:41.160-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-22T06:59:41.160-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Mobile" /><title>A Theory on How to Succeed In The New Smartphone Market, And Why Android Is Ahead of The Curve</title><content type="html">When the iPhone came out the race to get apps on the market was called a gold rush. &amp;nbsp;There really were good amounts of money to be made for quality applications. &amp;nbsp;As the market became saturated and competition increased, prices fell and it became&amp;nbsp;harder and harder to make any sort of decent income. &lt;br /&gt;
&lt;br /&gt;
In early November 2009, Verizon debuted the Droid. &amp;nbsp;It was to be their flagship smartphone, and they were quick to promote that it was backed with an Android operating system. &amp;nbsp;I'll be honest, I fell for all the hype and bought one the weekend it was released and have no regrets about doing so.&lt;br /&gt;
&lt;br /&gt;
When the Droid was released it sparked a huge boom to the Android market. &amp;nbsp;Developers who already had applications on the market reported huge jumps in sales and ad revenue because of increased downloads. &amp;nbsp;This really was the turning point for Android and the start of its huge climb in market share that it is continuing today. &lt;br /&gt;
&lt;br /&gt;
For application developers who were increasingly having a more difficult time getting exposure on the ever more saturated iPhone market, Android started looking like the next gold rush. &amp;nbsp;Over the last year the number of Android applications has gone from &lt;a href="http://www.maximumpc.com/article/news/android_market_going_strong_now_has_20000_apps"&gt;20,000&lt;/a&gt; to &lt;a href="http://www.androlib.com/appstats.aspx"&gt;over 100,000&lt;/a&gt;. &amp;nbsp;However this wasn't quite the same gold rush as the iPhone. &amp;nbsp;For whatever reason Android users tend to be a bit more picky and unwilling to shell out the same kind of cash that the Apple crowd does. &amp;nbsp;Still, putting out several applications can still bring in some nice supplemental income and depending on how many apps you have and your standard of living you may actually be able to&lt;a href="http://www.kreci.net/reports/developer-income-report-5/"&gt; live off that income&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
With penny-pinching Android users, and another saturated market of applications, Android is getting harder and harder to make money off of as well. &lt;br /&gt;
&lt;br /&gt;
So what is next? &amp;nbsp;Windows Mobile 7 seems to be the next big player coming into the market. &amp;nbsp;Microsoft released sales today showing that in the last 6 weeks on the market they have sold 1.5 million phones, but there are only around 4,000 applications on the Windows Mobile app store. &amp;nbsp;One of the complaints I have already heard about Windows Mobile is a huge lack of applications, especially when you compare it to iOS or Android. &amp;nbsp;Is anyone hearing an opportunity? &lt;br /&gt;
&lt;br /&gt;
I'm sure I'm not the only one to see this. &amp;nbsp;Most likely as Microsoft keeps releasing sales figures and if they can keep up the steady increase in sales they will gradually see and increase in applications. &lt;br /&gt;
&lt;br /&gt;
Unfortunately all this leaves developers in a bit of a quandry. &amp;nbsp;First you had one major platform to develop for and make all of your revenue off of. &amp;nbsp;Than you had two. &amp;nbsp;Now its looking like there will be a third major player. &amp;nbsp;The competition is increasing steadily. &amp;nbsp;So if you want to capture the largest market possible and reach the widest number of users you have to port your application to three separate and completely different systems. &amp;nbsp;Effectively you have to rewrite the entire application three times to reach the maximum number of users. &lt;br /&gt;
&lt;br /&gt;
Inevitably in the coming five years or so another major player or two will probably jump into the market and the competition for smartphones will heat up even further with more mobile operating systems to develop for. &amp;nbsp;This leaves us as developers getting pulled in several different directions, and in order to maximize their return on investment for each platform they develop for we are going to have to take into account the cost of entry to the mobile operating system's market or app store, the ease of development, not to mention market share. &lt;br /&gt;
&lt;br /&gt;
This means that if mobile operating system vendors like Google, Microsoft, and Apple want to incentivize developers to bring their applications to them the barrier to entry will need to be lowered. &amp;nbsp;Google is already paving the way on this. &amp;nbsp;In the face of Apple's walled garden approach and approval process Google opened up the market to anyone that wanted to publish apps, chose one of the widely known languages in the world to develop on, and continues to improve their development tools. &amp;nbsp;In short, Google is ridiculously easy to develop for and get into their market compared to Apple. &amp;nbsp;Google even took it a step further and made it so you can develop Android applications on any platform, a striking contrast to Apple's Mac only development. &amp;nbsp;Microsoft seems to be coming out somewhere in the middle. &amp;nbsp;They based on the development tools around Silverlight and .Net 4.0, something nearly all Microsoft developers are already familiar with and for everyone else are relatively easy to break into. &amp;nbsp;The downside is they require you to develop on a Windows machine and you still have to go through an approval process to get your application to their store.&lt;br /&gt;
&lt;br /&gt;
My prediction is that as new mobile operating systems come out they will try to cater to developers more and more, with lower entry costs and higher quality development tools. &amp;nbsp;Google will continue to try and improve their tooling with each release and will probably continue to develop better and wider API's. &amp;nbsp;I wouldn't be surprised to see Microsoft drop their $100 a year developer cost to remain in the app store, and raise their limit of applications in the store from 5 to 10, and maybe eliminate it all together. &amp;nbsp;Apple will probably change very little, or very slowly. &amp;nbsp;Apple has never been about capturing market share, and is probably going to revolutionize the tech world with another paradigm shifting device on the scale of the iPod, iPhone, or iPad before making any huge concessions to developers in order to maintain profitability and their position as a leader in high quality tech products.&lt;br /&gt;
&lt;br /&gt;
And as an even nicer side effect, users will probably win in all of this. &amp;nbsp;Easier development tools will mean higher quality applications available for them and an ever more competitive smartphone market will mean the vendors will work harder and harder to meet the needs of their end users.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-4212043468792543872?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3h7P1Cd52G9_ip2aI_6ukEZOeeU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3h7P1Cd52G9_ip2aI_6ukEZOeeU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3h7P1Cd52G9_ip2aI_6ukEZOeeU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3h7P1Cd52G9_ip2aI_6ukEZOeeU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/qBauHleS09E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/4212043468792543872/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/12/theory-on-how-to-succeed-in-new.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/4212043468792543872?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/4212043468792543872?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/qBauHleS09E/theory-on-how-to-succeed-in-new.html" title="A Theory on How to Succeed In The New Smartphone Market, And Why Android Is Ahead of The Curve" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/12/theory-on-how-to-succeed-in-new.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4NQnw-fyp7ImA9Wx9RFEs.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-1635723881794539597</id><published>2010-12-15T19:09:00.000-08:00</published><updated>2010-12-15T19:09:53.257-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-15T19:09:53.257-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="FastShopper" /><category scheme="http://www.blogger.com/atom/ns#" term="My Apps" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>FastShopper</title><content type="html">After some frustration with most shopping lists I went ahead and built myself a better one.&lt;br /&gt;
&lt;br /&gt;
I dont know how most people read through lists, but I like to go top to bottom. &amp;nbsp;Unfortunately grocery stores are not designed this way. &amp;nbsp;If you try to go through a shopping list from top to bottom you will probably hit every corner of the store several times and waste yourself a lot of time. &amp;nbsp;Why not have an application that organizes your list to get you through the store faster? &amp;nbsp;Enter FastShopper. &amp;nbsp;The paid version is $3.99 and allows you to take full control of the groups, while the free version is ad supported and only has default groups with a predefined sort order. &amp;nbsp;It should still be helpful but not nearly as powerful as the paid version. &lt;br /&gt;
&lt;br /&gt;
Busy suburban moms everywhere: Spend less time in the grocery store.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.appbrain.com/app/fastshopper/samuraisoftware.fastShopper"&gt;FastShopper&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.appbrain.com/app/fast-shopper-lite/samuraisoftware.fastShopper_lite"&gt;FastShopper Lite&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-1635723881794539597?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IgEFjlA1ZqZ534Ce1Uo1bs1q0_Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IgEFjlA1ZqZ534Ce1Uo1bs1q0_Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IgEFjlA1ZqZ534Ce1Uo1bs1q0_Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IgEFjlA1ZqZ534Ce1Uo1bs1q0_Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/tKakVVPVia4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/1635723881794539597/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/12/fastshopper.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1635723881794539597?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1635723881794539597?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/tKakVVPVia4/fastshopper.html" title="FastShopper" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/12/fastshopper.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4MQ3w5fCp7ImA9Wx9RE0U.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-3631259906053311301</id><published>2010-12-14T20:39:00.000-08:00</published><updated>2010-12-14T20:39:42.224-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-14T20:39:42.224-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Unable to build: Could not find dx.jar file</title><content type="html">&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I got to update to the latest version of the ADT tonight when I hit the weirdest error out of the blue:&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Unable to build: the file dex.jar was not loaded from the SDK folder&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
After way too long of Googling and not coming up with an answer I finally found it on some really obscure mailing list archive site.&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
Look in the project with the error and delete the default.properties file. &amp;nbsp;That is it. &lt;br /&gt;
&lt;br /&gt;
Just make sure you have the latest versions of Eclipse and ADT when you do it, and that should be it. &amp;nbsp;Back to Android programming...&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-3631259906053311301?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/C1nSVAxd7J3NJcyiVasxVBJWhXc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/C1nSVAxd7J3NJcyiVasxVBJWhXc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/C1nSVAxd7J3NJcyiVasxVBJWhXc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/C1nSVAxd7J3NJcyiVasxVBJWhXc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/DLqfogra2xM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/3631259906053311301/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/12/unable-to-build-could-not-find-dxjar.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3631259906053311301?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3631259906053311301?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/DLqfogra2xM/unable-to-build-could-not-find-dxjar.html" title="Unable to build: Could not find dx.jar file" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>7</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/12/unable-to-build-could-not-find-dxjar.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcHQXcycCp7ImA9WxFUEks.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-8314235911568580590</id><published>2010-06-22T21:40:00.000-07:00</published><updated>2010-06-22T21:40:30.998-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-22T21:40:30.998-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Mobile Web" /><title>Congratulations!  You Have Just Made Me Hate Your Mobile Site</title><content type="html">Occasionally when I find myself in waiting rooms, waiting for class to start, or sometimes when I'm just at home with nothing to do I will jump on to Hacker News, Programming Reddit (/r/programming) just to get that dopamine kick from reading something new and interesting.&amp;nbsp; I generally do this from my Motorola Droid, and about 99% of the time I have no problem browsing these sites or any of the pages they link to.&amp;nbsp; I do run into some occasional problems.&lt;br /&gt;
&lt;br /&gt;
The first is I get taken to a page that has a heavy amount of Flash.&amp;nbsp; This is extremely rare, and generally these types of sites I could live without going to anyway.&lt;br /&gt;
&lt;br /&gt;
The second is a little bigger.&amp;nbsp; Depending on how a site is setup to handle mobile devices it may do one of several things.&amp;nbsp; It might do nothing and just try to render the whole site in its entirety at its native screen size and make you scroll and zoom around to read what you want.&amp;nbsp; Sites that have a better comprehension of a good mobile web experience will take you to a "mobile" optimized version of the site which is designed exactly for your mobile browsers screen size. These tend to be the best mobile browsing experiences you can get.&amp;nbsp; There is a caveat to this.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Today there were several pages on Hacker News linking to articles on Salon.com.&amp;nbsp; Salon.com has its site setup to take you to a mobile optimized site.&amp;nbsp; It does not however take you to a mobile optimized version of the page you originally clicked a link to.&amp;nbsp; This means when I want to read article X on Salon.com I get kicked to mobile.Salon.com instead of mobile.Salon.com/X.&lt;br /&gt;
&lt;br /&gt;
Simple Solution: Pass me through to the mobile version of the page I requested when I click a link from a mobile browser.&amp;nbsp; Painfully simple solution for an annoying problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-8314235911568580590?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/q98gzHaF-zMZ50qAq4euRq72lxA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q98gzHaF-zMZ50qAq4euRq72lxA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/q98gzHaF-zMZ50qAq4euRq72lxA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q98gzHaF-zMZ50qAq4euRq72lxA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/_1kGal5qbHw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/8314235911568580590/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/06/congratulations-you-have-just-made-me.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8314235911568580590?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/8314235911568580590?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/_1kGal5qbHw/congratulations-you-have-just-made-me.html" title="Congratulations!  You Have Just Made Me Hate Your Mobile Site" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/06/congratulations-you-have-just-made-me.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08EQHc5fSp7ImA9WxBaGUg.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-6506916209076252623</id><published>2010-03-30T06:30:00.000-07:00</published><updated>2010-03-30T06:30:01.925-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-30T06:30:01.925-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Comics" /><category scheme="http://www.blogger.com/atom/ns#" term="Genetic Programming" /><title>Genetic Programming: Not An Easy Solution to Everything</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://imgs.xkcd.com/comics/recipes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="172" src="http://imgs.xkcd.com/comics/recipes.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://xkcd.com/720/"&gt;http://xkcd.com/720/&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Kind of makes me wonder what kind of recipes a genetic algorithm would come up with...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-6506916209076252623?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gudmDHrrlcN3yrcvXNX0H8bY8Ik/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gudmDHrrlcN3yrcvXNX0H8bY8Ik/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gudmDHrrlcN3yrcvXNX0H8bY8Ik/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gudmDHrrlcN3yrcvXNX0H8bY8Ik/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/6EPDM7i5p3s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/6506916209076252623/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/genetic-programming-not-easy-solution.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/6506916209076252623?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/6506916209076252623?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/6EPDM7i5p3s/genetic-programming-not-easy-solution.html" title="Genetic Programming: Not An Easy Solution to Everything" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/genetic-programming-not-easy-solution.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8MRH05eSp7ImA9WxBbFU8.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-4789520386727485686</id><published>2010-03-13T17:08:00.000-08:00</published><updated>2010-03-13T17:08:05.321-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-13T17:08:05.321-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Genetic Programming" /><title>Genetic Programming VS. Trig Round 2</title><content type="html">After some experimentation, I found two things working against me that caused the program to run for so long. &lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Unnecessarily large search space.&lt;/li&gt;
&lt;li&gt;A tendency for the program to get "stuck" in near optimal solutions, aka local minima.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;The easiest solution to this is to limit the search space. &amp;nbsp;Since the function I was working with was f(x, y) = (sin(x) + cos(y)) / y I knew I could keep out bitwise and, bitwise or, logarithm and multiplication. &amp;nbsp;After doing this I was able to get the right result back in a matter of seconds. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This all lead me to ask myself, if I was given an arbitrary set of parameters and expected results, what could I do to allow the program to easily find the solution without getting stuck in the same problems I ran into here? &amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-4789520386727485686?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wmdYqBryePPoPsiQjgp_MtKfG4c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wmdYqBryePPoPsiQjgp_MtKfG4c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wmdYqBryePPoPsiQjgp_MtKfG4c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wmdYqBryePPoPsiQjgp_MtKfG4c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/oWmZN2IaRJE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/4789520386727485686/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/genetic-programming-vs-trig-round-2.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/4789520386727485686?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/4789520386727485686?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/oWmZN2IaRJE/genetic-programming-vs-trig-round-2.html" title="Genetic Programming VS. Trig Round 2" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/genetic-programming-vs-trig-round-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cFRn09eSp7ImA9WxBbFUg.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-2247938767629104130</id><published>2010-03-11T21:46:00.000-08:00</published><updated>2010-03-14T01:30:17.361-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-14T01:30:17.361-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Genetic Programming" /><title>Hello World Genetically</title><content type="html">Finally, for all to view is my "Hello World" genetic programming example code.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
GaString.java&lt;br /&gt;
&lt;pre class="java" name="code"&gt;import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;

public final class GaString 
{
 public static final String TARGET = "Hello World";
 private static final int POPULATION_SIZE = 4096;
 
 private String string;
 private int fitness;
 
 public static List&lt;gastring&gt; createPopulation()
 {
  int targetSize = TARGET.length();
  Random generator = new Random(System.currentTimeMillis());
  
  List&lt;gastring&gt; population = new ArrayList&lt;gastring&gt;();
  
  for(int i = 0; i &amp;lt; POPULATION_SIZE; i++)
  {
   
   GaString citizen = new GaString();
   citizen.fitness = 0;
   citizen.string = "";
   for(int j = 0; j &amp;lt; targetSize; j++)
   {
    citizen.string += (char)(Math.abs((generator.nextInt() % 90)) + 32);
   }
   
   population.add(citizen);
  } 
  
  return population;
  
 }
 
 public String getString()
 {
  return this.string;
 }
 
 public void setString(String str)
 {
  this.string = str;
 }
 
 public int getFitness()
 {
  return this.fitness;
 }
 
 public void setFitness(int fitness)
 {
  this.fitness = fitness;  
 }

}

&lt;/gastring&gt;&lt;/gastring&gt;&lt;/gastring&gt;&lt;/pre&gt;&lt;br /&gt;
GaStringComparer.java &lt;br /&gt;
&lt;pre class="java" name="code"&gt;import java.util.Comparator;


public class GaStringComparer implements Comparator
{

 @Override
 public int compare(Object o1, Object o2)
 {
  if (o1 instanceof GaString &amp;amp;&amp;amp; o2 instanceof GaString)
  {
   int first = ((GaString)o1).getFitness();
   int second = ((GaString)o2).getFitness();
   
   return first - second;
  }
  else
  {
   return 0;   
  }
 }

}

&lt;/pre&gt;GeneticDriver.java &lt;br /&gt;
&lt;pre class="java" name="code"&gt;import java.util.List;
import java.util.*;
import java.math.*;


public final class GeneticDriver
{
 public static final float GA_MUTATION = (float)(Integer.MAX_VALUE * 0.25);

 public static void main(String[] args)
 {
  List&lt;gastring&gt; population = GaString.createPopulation();
  
  assert false;
  
  for(int i = 0; i &amp;lt; 32768; i++)
  {
   calcFitness(population);
   Collections.sort(population, new GaStringComparer());
   if (population.get(0).getFitness() &amp;lt; 25)
   {
    System.out.println(population.get(0).getString() + " FITNESS: " + population.get(0).getFitness());
   }
   if (population.get(0).getFitness() == 0)
    break;
   
   mate(population);   
  }
  
  System.out.println("DONE");
  System.out.println(population.get(0).getString());

 }
 
 public static void calcFitness(List&lt;gastring&gt; population)
 {
  int fitness;
  for(int i = 0; i &amp;lt; population.size(); i++)
  {
   fitness = 0;
   for(int j = 0; j &amp;lt; GaString.TARGET.length(); j++)
   {
    fitness += Math.abs(population.get(i).getString().charAt(j) - GaString.TARGET.charAt(j));
   }
   
   population.get(i).setFitness(fitness);
  }  
  
 }
 
 public static void mutate(GaString member)
 {
  Random generator = new Random(System.currentTimeMillis());
  int position = Math.abs(generator.nextInt() % GaString.TARGET.length());
  int d = Math.abs((generator.nextInt() % 90) + 32);
  
  char oldCharacter = member.getString().charAt(position);
  
  char mutatedCharacter = (char)((oldCharacter + d) % 122);
  
  StringBuilder builder = new StringBuilder(member.getString());
  builder.replace(position, position + 1, "" + mutatedCharacter + "");
  
  member.setString(builder.toString());
 
 }
 
 public static void mate(List&lt;gastring&gt; population)
 {
  Random generator = new Random(System.currentTimeMillis());
  
  for (int i = 25; i &amp;lt; population.size(); i++)
  {
   int first = Math.abs(generator.nextInt() % (population.size() / 2));
  
   int second = Math.abs(generator.nextInt() % (population.size() / 2));
   
   int spos = Math.abs(generator.nextInt() % GaString.TARGET.length());
   
   population.get(i).setString(population.get(first).getString().substring(0, spos) + 
     population.get(second).getString().substring(spos));
  
   if (generator.nextInt() &amp;lt; GA_MUTATION)
    mutate(population.get(i));
  }
 }
 

}

&lt;/gastring&gt;&lt;/gastring&gt;&lt;/gastring&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-2247938767629104130?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HIADHjFor9vFhSPOozdvQqQUyhc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HIADHjFor9vFhSPOozdvQqQUyhc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HIADHjFor9vFhSPOozdvQqQUyhc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HIADHjFor9vFhSPOozdvQqQUyhc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/Eaq6mZO51JY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/2247938767629104130/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/hello-world-genetically.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/2247938767629104130?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/2247938767629104130?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/Eaq6mZO51JY/hello-world-genetically.html" title="Hello World Genetically" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/hello-world-genetically.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUEQXo6eCp7ImA9WxBUGUo.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-3602871318801093391</id><published>2010-03-07T06:30:00.000-08:00</published><updated>2010-03-07T06:30:00.410-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-07T06:30:00.410-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Genetic Programming" /><title>Genetic Programming VS. Trig Round 1</title><content type="html">A couple weeks ago I started to dive into genetic programming. &amp;nbsp;After building my Hello World program in Java to get my feet wet, I got the idea to build something that would take some integer values and an expected result and figure out the expression that would take the integers as parameters and produce the result. &amp;nbsp;I mapped out something on my whiteboard, but pretty soon discovered that someone had beat me to it and come up with a &lt;a href="http://rogeralsing.com/2008/02/07/genetic-programming-math/"&gt;fairly simple program in C#&lt;/a&gt;&amp;nbsp;built by &lt;a href="http://rogeralsing.com/about/"&gt;Roger Alsing&lt;/a&gt; that did exactly what I was hoping to build in a nearly identical fashion. &lt;br /&gt;
&lt;br /&gt;
So being the young and overly confident young male I am, I figured there must be a way that I could improve on this. &amp;nbsp;My first step was to add more math operators to it. &amp;nbsp;The solution file that Roger posted on the web only contains operators for Add, Binary And, Binary Or, Divide, Multiply, Exponential Power, and Exclusive Or. &lt;br /&gt;
&lt;br /&gt;
My first choices to add were Sin, Cosine, and Logarithm. &amp;nbsp;Thanks to the easily extensible architecture that Roger built I quickly threw those in and started coming up with test cases. &lt;br /&gt;
&lt;br /&gt;
One thing to note here is that if you take some of the test cases that Roger has left commented out in the code and try them with the basic operators this program has, it comes up with solutions fairly quick. &amp;nbsp;Sometimes in as few as several hundred generations. &amp;nbsp;Then I came up with the function&lt;br /&gt;
&lt;br /&gt;
f(x, y) = (sin(x) + cos(y)) / y&lt;br /&gt;
&lt;br /&gt;
I pretty quickly realized that was not going to be a very easy solution to find. &amp;nbsp;The wait began...&lt;br /&gt;
&lt;br /&gt;
One load of laundry, a red bull, a haircut, and a few skimmed articles off of Hacker News later I figured there were some improvements that would need to be made if I wanted to make this work for more complex equations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;I would need to stop running the program on my VirtualBox WinxP virtual machine.&lt;/li&gt;
&lt;li&gt;I need to pick out parts of the program to run in parallel to take advantage of my dual core processor.&lt;/li&gt;
&lt;li&gt;It is clear that I have a lot to learn about GP, and it is time to start researching things that speed up evolution.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;To be continued...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-3602871318801093391?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zR8KoTB07VLUre9H8Hd5W0Aa2As/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zR8KoTB07VLUre9H8Hd5W0Aa2As/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zR8KoTB07VLUre9H8Hd5W0Aa2As/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zR8KoTB07VLUre9H8Hd5W0Aa2As/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/xlBm24d9k-E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/3602871318801093391/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/genetic-programming-vs-trig-round-1.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3602871318801093391?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3602871318801093391?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/xlBm24d9k-E/genetic-programming-vs-trig-round-1.html" title="Genetic Programming VS. Trig Round 1" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/genetic-programming-vs-trig-round-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4EQXY5fip7ImA9WxBUGE0.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-7405151434119043600</id><published>2010-03-05T07:45:00.000-08:00</published><updated>2010-03-05T07:45:00.826-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T07:45:00.826-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Linq" /><title>Custom Sorting with IComparer in .Net</title><content type="html">Its not uncommon to find situations where you want to be able to sort a collection of objects in a very specific way. &amp;nbsp;Thankfully, .Net gives us the&lt;a href="http://msdn.microsoft.com/en-us/library/system.collections.icomparer.aspx"&gt; IComparer&lt;/a&gt; interface to handle this.&lt;br /&gt;
&lt;br /&gt;
Heres an example:&lt;br /&gt;
&lt;br /&gt;
class MyClass&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public int SomeInteger { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public MyClass(int i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.SomeInteger = i;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class MyClassComparer : IComparer&amp;lt;MyClass&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public int Compare(MyClass x, MyClass y)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return x.SomeInteger - y.SomeInteger;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class MyClassDriver&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string [] args)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;MyClass&amp;gt; list = new List&amp;lt;MyClass&amp;gt;()&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new MyClass(1),&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new MyClass(5),&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new MyClass(3);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;list.Sort(new MyClassComparer());&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-7405151434119043600?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vOm3MUusQLC-vARBKYlYOBPUnSo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vOm3MUusQLC-vARBKYlYOBPUnSo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vOm3MUusQLC-vARBKYlYOBPUnSo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vOm3MUusQLC-vARBKYlYOBPUnSo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/Kc0MZPps8PA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/7405151434119043600/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/custom-sorting-with-icomparer-in-net.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/7405151434119043600?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/7405151434119043600?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/Kc0MZPps8PA/custom-sorting-with-icomparer-in-net.html" title="Custom Sorting with IComparer in .Net" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/custom-sorting-with-icomparer-in-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUEQXc-eip7ImA9WxBUGE4.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-3146288110360748276</id><published>2010-03-03T06:35:00.000-08:00</published><updated>2010-03-05T16:43:20.952-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T16:43:20.952-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Genetic Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Genetic Programming: Letting the computer do the hard work for you</title><content type="html">I recently stumbled upon on Roger Alsing's post &lt;a href="http://rogeralsing.com/2010/02/14/genetic-programming-code-smarter-than-you"&gt;Genetic Programming: Code smarter than you!&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I've been getting into genetic algorithms recently and trying to learn as much as I can. &amp;nbsp;I should have a post in a few days with a Hello World example that I did in Java. &amp;nbsp;Basically what Roger did was he took a problem set where there were two input parameters and an expected output value, then used some genetic programming techniques to create an abstract syntax tree to represent the formula that represents the relationship between the input parameters and the output value.&lt;br /&gt;
&lt;br /&gt;
He's even been kind enough to&lt;span class="Apple-style-span" style="line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;a href="http://www.puzzleframework.com/roger/genmath.rar"&gt;&amp;nbsp;post the code&lt;/a&gt; for the solution. &amp;nbsp;I highly recommend taking a look.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-3146288110360748276?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DfH9Q8UU6yssxVstp-JbEr36pK4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DfH9Q8UU6yssxVstp-JbEr36pK4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DfH9Q8UU6yssxVstp-JbEr36pK4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DfH9Q8UU6yssxVstp-JbEr36pK4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/cY3LXs7uNMU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/3146288110360748276/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/03/genetic-programming-letting-computer-do.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3146288110360748276?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/3146288110360748276?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/cY3LXs7uNMU/genetic-programming-letting-computer-do.html" title="Genetic Programming: Letting the computer do the hard work for you" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/03/genetic-programming-letting-computer-do.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcFSXczeCp7ImA9WxBbFUk.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-2209596224274031636</id><published>2010-02-25T20:28:00.000-08:00</published><updated>2010-03-13T20:13:38.980-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-13T20:13:38.980-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="StackOverflow Questions" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Differences between C# and Java" /><title>C# Equivalent to Java's "final"</title><content type="html">From &lt;a href="http://stackoverflow.com/questions/2339074/c-can-parameters-be-constant"&gt;Stackoverflow:&lt;/a&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;b&gt;I'm looking for the C# equivalent of Java's &lt;code&gt;final&lt;/code&gt;. Does it exist?&lt;/b&gt;&lt;br /&gt;
Does C# have anything like the following:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&lt;code&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;Foo&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="kwd"&gt;final&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;int&lt;/span&gt;&lt;span class="pln"&gt; bar&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;In the above example, &lt;code&gt;bar&lt;/code&gt; is a read only variable and cannot be changed by &lt;code&gt;Foo()&lt;/code&gt;. Is there any way to do this in C#?&lt;br /&gt;
For instance, maybe I have a long method that will be working with &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, and &lt;code&gt;z&lt;/code&gt; coordinates of some object (ints). I want to be absolutely certain that the function doesn't alter these values in any way, thereby corrupting the data. Thus, I would like to declare them readonly.&lt;/blockquote&gt;&lt;br /&gt;
To clarify the question a little bit, the poster is wondering whether a C# equivalent to final exists that allows you to prevent the changing of &lt;b&gt;parameter&lt;/b&gt; values.&lt;br /&gt;
&lt;br /&gt;
The Java final keyword has a large number of uses, and C# uses several different keywords to account for several of those uses.&amp;nbsp; For example, to prevent a class from being inherited by a child class, you can use the &lt;a href="http://msdn.microsoft.com/en-us/library/88c54tsw%28VS.71%29.aspx"&gt;sealed&lt;/a&gt; keyword in C# where you would use final in Java.&amp;nbsp; Or if you had a class level variable, or field that you didn't want the value to change you could use the &lt;a href="http://msdn.microsoft.com/en-us/library/e6w8fe1b%28VS.71%29.aspx"&gt;const&lt;/a&gt; keyword and say "const int x;" where you would say "final int x" in Java.&amp;nbsp; For a detailed explanation of all the many uses of the Java keyword final, check out this &lt;a href="http://renaud.waldura.com/doc/java/final-keyword.shtml"&gt;link.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There is than one use of the final keyword that C# does not have an equivalent for.&amp;nbsp; When you pass a parameter to a method in Java, and you don't want that parameter's value to change &lt;b&gt;within&lt;/b&gt; the scope of that method you can set it as final like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="java"&gt;public Foo(final int bar) {
    bar++; //Compiler error on this line 
}
&lt;/pre&gt;&lt;br /&gt;
Its important to note that its the value that will not change when you use the final keyword here.&amp;nbsp; If we were to pass a reference to the object, we could call methods on that object that change the internal state of the object, but we couldn't set the reference to be a new object.&amp;nbsp; Example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="java"&gt;public Foo(final MyClass o) {
    o.ChangeState(); //Valid
    o = new MyClass(); //Compiler error
}
&lt;/pre&gt;&lt;br /&gt;
So where does that leave us in our C# code?&amp;nbsp; Actually it turns out that there really is no strong need for an equivalent in C#.&amp;nbsp; While it would certainly be nice to have the compiler check to make sure you aren't changing the parameter, in practice you really don't need it.&amp;nbsp; If you have run across situations where you really did find a true need for such a feature please let me know.&lt;br /&gt;
&lt;br /&gt;
So if its not something you really need in C#, and Microsoft found reason to remove it, why has Sun/Oracle kept it in?&amp;nbsp; Anonymous classes.&amp;nbsp; In Java you can create an anonymous class in a method, and if a parameter is marked final that parameter becomes available to the anonymous class.&amp;nbsp; While my Java experience is fairly limited, GUI programming is where I have seen the most examples of it.&amp;nbsp; A good example would be adding an ActionListener to a JButton.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="java"&gt;public JButton createButton(final MyClass o) {
    JButton button = new JButton();
    button.setAction(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            button.setText(o.toString());
        }
    });
}
&lt;/pre&gt;In C#, we avoid the need for anonymous classes by using delegates as a reference to a method.&amp;nbsp; That means we can do this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="csharp"&gt;class MyForm extends Form
{
    MyClass o = new MyClass();

    public void MyForm()
    {
        var button = createButton();
    }

    public Button createButton()
    {
        var button = new Button();
        button.Click += button_Click;
    }

    public void button_Click(object sender, EventArgs e)
    {
        var button = (Button)sender;
        button.Text = o.ToString();
    }
}
&lt;/pre&gt;&lt;br /&gt;
In conclusion, there is no equivalent to final parameters in C# but with the help of delegates we are able to avoid needing them where they are used most in Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-2209596224274031636?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ybKY8O0N-J0TUEZSnfiZIANA624/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ybKY8O0N-J0TUEZSnfiZIANA624/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ybKY8O0N-J0TUEZSnfiZIANA624/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ybKY8O0N-J0TUEZSnfiZIANA624/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/xXvz4xCwwVE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/2209596224274031636/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/02/from-stackoverflow-im-looking-for-c.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/2209596224274031636?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/2209596224274031636?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/xXvz4xCwwVE/from-stackoverflow-im-looking-for-c.html" title="C# Equivalent to Java's &quot;final&quot;" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/02/from-stackoverflow-im-looking-for-c.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEANQXw8cCp7ImA9WxBWGUs.&quot;"><id>tag:blogger.com,1999:blog-2061058624088955252.post-1469233861327916429</id><published>2010-02-11T20:49:00.000-08:00</published><updated>2010-02-12T00:19:50.278-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-12T00:19:50.278-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="OOP" /><category scheme="http://www.blogger.com/atom/ns#" term="Polymorphism" /><title>Polymorphism and Complex Conditionals</title><content type="html">I ran into a situation today on an old application I inherited where I thought I might be able to take advantage of some polymorphism to refactor some complex if/else structures.&amp;nbsp; This lead me to the thought "what kind of performance impact would using polymorphism have compared to leaving this large if/else block?"&lt;br /&gt;
&lt;br /&gt;
After a quick google search I came across this:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.8892&amp;amp;rep=rep1&amp;amp;type=pdf"&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.8892&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It's a research paper written by Serge Demeyer at University of Antwerp, written in 2002 where looked into that very same question.&amp;nbsp; I was honestly a little surprised by his results.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
To summarize the paper, he points out that over the years there has been great debate between programmers regarding the handling of conditional logic.&amp;nbsp; On the one hand you have programmers wanting to leave the if/else structure because the time spent on refactoring would be too great and you would have a negative performance impact on the application.&amp;nbsp; On the other hand you have programmers arguing that the code would be easier to read after refactoring, which would save a substantial amount of time on bug fixes and feature addition.&amp;nbsp; While there is a substantial amount of evidence to show that the refactored versions of programs are substantially easier to maintain, there is no conclusive evidence as to whether the program is actually slower.&lt;br /&gt;
&lt;br /&gt;
For Serge's experiment, he uses&amp;nbsp; a small c++ program against several different compilers.&amp;nbsp; His results surprised me.&amp;nbsp; For the majority of the compilers, the time to process was approximately the same when using polymorphism as switch statements.&amp;nbsp; However, in all but one case the if/else structure was slower, and sometimes substantially slower.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Serge concludes that with the advances in modern compiler theory, using virtual methods will not negatively impact performance.&lt;br /&gt;
&lt;br /&gt;
In the future I myself would like to look into this same situation using Java and C# to see what kind of difference refactoring conditionals into polymorphism will have on performance with languages that have just in time compilers and an intermediate language.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tldr; &lt;b&gt;Polymorphism is faster and easier to maintain than conditionals.&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2061058624088955252-1469233861327916429?l=csunwold.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gNPBIz5wNn8iReQ8dwZTJkvgfTc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gNPBIz5wNn8iReQ8dwZTJkvgfTc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gNPBIz5wNn8iReQ8dwZTJkvgfTc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gNPBIz5wNn8iReQ8dwZTJkvgfTc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CoreySunwold/~4/lpBydwvYFCg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://csunwold.blogspot.com/feeds/1469233861327916429/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://csunwold.blogspot.com/2010/02/polymorphism-and-complex-conditionals.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1469233861327916429?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2061058624088955252/posts/default/1469233861327916429?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CoreySunwold/~3/lpBydwvYFCg/polymorphism-and-complex-conditionals.html" title="Polymorphism and Complex Conditionals" /><author><name>Corey Sunwold</name><uri>http://www.blogger.com/profile/03034494611188304767</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://csunwold.blogspot.com/2010/02/polymorphism-and-complex-conditionals.html</feedburner:origLink></entry></feed>

