January 2012
2 posts
GeoCoordinateWatcher.Position has NaN values
I was trying to get the current position of the Windows Phone:
new GeoCoordinateWatcher(GeoPositionAccuracy.High).Position;
Position’s fields are almost entirely NaN. To remedy this, call Start() first:
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
watcher.Start();
GeoPosition<GeoCoordinate> geoPos =...
On Campus Recruiting (at Cornell)
In an earlier post, I wrote about how to hire college kids once you get to the on-site stage and make an offer. In this post, I’ll discuss the beginning of the process. My perspective on this comes from watching companies recruit myself and other tech students at Cornell since Fall 2008. (I’m not sure how much of this is generalizable to other schools.)
Career Fairs
At Cornell, the process is...
December 2011
4 posts
Advice on hiring smart college kids
I recently finished interviewing for a full time position at 5 different companies: one tech giant, a mid-sized company, and three startups. Some of the startups are still trying to optimize their process for hiring college kids. To that end, here are some of my thoughts as an applicant in the process.
Most people want to work with the smartest co-workers possible. I have been burned several...
Lessons Learned from Corpionage
This semester, I worked on Corpionage, a Facebook game for people who like to mess with their friends. I thought it turned out pretty well, but there are a few key take-aways.
Our general architecture:
The server is Google App Engine, the UI is GWT, and the Engine is PlayN. (More detail)
Automated testing is non-negotiable. In the last few weeks of the project, a bug fix was just trading...
Weka's API is Cumbersome
I’ve only used Weka a bit, and it appears to be an impressive machine learning toolkit. However, its API is quite a pain to deal with.
Consider the following code that I wrote, which translates from one representation of an example to Instance, used by Weka:
public static Instance getInstance(WeatherLabeledFeatureVector featureVector, Instances instances) {
Instance inst = new...
I Wish Java Had Good Generics
Do you see the problem with this code?
// map from url as a string to content for that url
// apparently URL.equals() is bad:
// http://javaantipatterns.wordpress.com/2007/11/24/comparing-urls-with-urlequals/
private static Map<String, String> urlCache = Maps.newHashMap();
private static String getURLContent(URL url) throws IOException {
if (urlCache.containsKey(url.toString())) {
...
October 2011
2 posts
GWT DeferredBinding fails at runtime
I had a UiBinder component for whom deferred binding in compilation went fine, but failed in runtime. Turns out the constructor was throwing an exception at runtime. Fixing the exception also fixed the runtime failure.
1 tag
NullPointerException when initializing GWT's...
I have a simple Composite that uses UiBinder. GWT was crashing on the following line:
public StartView() {
initWidget(uiBinder.createAndBindUi(this)); // NullPointerException
}
StartView.ui.xml:
<g:VerticalPanel>
<g:HorizontalPanel>
<comp:FloorPicker />
<g:HTMLPanel ui:field="gamePanel" />
<comp:BuildMenu />
...
September 2011
1 post
2 tags
You CAN change the referrer header on WP7
There are a few threads complaining that you can’t set the referrer header on an HTTP request from Silverlight in WP7:
HttpWebRequest and Referer field on a WP Silverlight App
Odd behavior with the Image control and the HTTP Referer Header
httpwebrequest and referer header
However, it’s currently possible relatively easily:
WebClient webClient = new...
August 2011
6 posts
4 tags
Holy shit disqus
The disqus docs are a bit confusing - the param name for the API key seems to be buried. Here are a few things I’ve discovered:
Secret key is for server side, public key is for client side
This url works: http://disqus.com/api/3.0/forums/listThreads.json?api_key=YourPublicKey&forum=YourForum
The value you want for forum is the subdomain you use to administer Disqus:...
App Engine Fails to Start with GWT
I fired up Eclipse today, and saw this error when I tried to run or debug my GWT app:
Unable to load server class 'com.google.appengine.tools.development.gwt.AppEngineLauncher'
java.lang.ClassNotFoundException: com.google.appengine.tools.development.gwt.AppEngineLauncher
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at...
3 tags
hg push --force in TortoiseHg
To do hg push --force with TortoiseHg 2.0.2 on Windows:
right click on the repo directory » TortoiseHg » Synchronize
Click “options” near the top right.
Check “Force push or pull (override safety checks, —force)
4 tags
Guava and GWT
Google’s Guava is a fantastic framework that makes Java tolerable. (It was a major reason I wanted to work there.) Using it with GWT in Eclipse is fairly straightforward. Here are the steps that worked for me:
Add guava-r09 and guava-r09-gwt to war/WEB-INF/lib
Add them both to the classpath.
Make sure you import like this:
import com.google.common.base.Function;
NOT like this:
...
Windows Phone 7: Allowing the user to send an...
Senthil Kumar mentions a way to work the EmailComposeTask in Windows Phone 7 programming, but the code can be even more concise than what he lists. He writes:
private void button1_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "<a href="mailto:test@ginktage.com">test@ginktage.com</a>";
...
2 tags
Databinding in GWT?
Silverlight has cool data binding. Given a data class in BlogPost.cs:
public class BlogPost {
public string Title {get; set;}
public string Author {get; set;}
public string Content {get; set;}
}
You can easily and declaratively add it to the UI in BlogView.xaml:
<StackPanel>
<TextBlock Text="{Title}" />
<TextBlock Text="{Author}" />
<TextBlock...