Thursday, June 23, 2011

Coffee: The Greatest Addiction Ever

FTP Plugin for PhoneGap Android

I did this FTP plugin awhile back but forgot to push it to the main phonegap-plugin's repository. I've pushed it over now and I'm putting together this quick blog post to explain how to use it.

The ftp client allows you to upload and download files from within your PhoneGap Android application. It provides basic get and put functionality.

1. To install the plugin, move www/ftpclient.js to your project's www folder and include a reference to it in your html file after phonegap.{ver}.js.

<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>

<script type="text/javascript" charset="utf-8" src="ftpclient.js"></script>

2. Create a directory within your project called "src/com/phonegap/plugins/ftpclient" and copy "src/com/phonegap/plugins/ftpclient/FtpClient.java" into it.

3. Add the following activity to your AndroidManifest.xml file. It should be added inside the <application> tag.

<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name">
<intent-filter>
</intent-filter>
</activity>

4. Copy "libs/commons-net-2.2.jar" into the libs directory within your project. You will also need to right click on this file in eclipse and add the jar to the build path.

Once installed properly, you should be able to upload files using the following syntax:

window.plugins.ftpclient.put("test.txt", "ftp://username:password@ftp.server.com/test.txt;type=i", win, fail);

and of course download files using:

window.plugins.ftpclient.get("test.txt", "ftp://username:password@ftp.server.com/test.txt;type=i", win, fail);

I'm not sure how many people really need FTP functionality but it was an interesting exercise none the less.

Tuesday, June 21, 2011

Just put the Yankees and Red Sox in Their Own Division

Look I'm not a real big baseball fan anymore. I confess the strike in 1994 sapped a lot of my enthusiasm for the game. However I do keep my else on things tangentially and I'd like to suggest to MLB that they just put the Yankees and Red Sox into their own 2 team division in the American League.  I think the division should be called American League Cash Cow.

Basically, both teams would play each other 162 times over the year. The winner of the series would automatically get a buy into the second round of the MLB playoffs. I mean that's what everyone wants right? People just want to see the Red Sox vs the Yankees so let's give it to them.

Honestly, it makes sense. Since 2003 between two teams have been the American League East champions 6 times and wild card entrants 7 times. So of 16 possible play off spots up for grab they've taken 13 so it's not like this is a stretch anyway. Taking a look at the current standings NY is leading the American League East and Boston is in the wild card spot. Business as usual I guess.

So a little bit of re-org will need to happen but it can easily be done by moving Detroit from the American League Central to American League East. That gives us 3 four team divisions and one 2 team division.  Playoff spots would go to the winner of the American League East, Central, West and Cash Cow. Additionally the best two records from the East, Central and West divisions would get the wild card spots. This would allow so new blood into the MLB playoffs.

Hey MLB, I don't need any royalties for this so feel free to implement this idea without attribution.