Archive for General

Back in Orlando

Well that was fun :) It was only two years ago that I moved to NYC. In that time, I made a ton of new friends, had great conversations, and expanded my horizons by changing my focus to mobile development. It was an amazing experience, and I’m glad I had it. That being said, I am glad to be back in Orlando amongst family and friends. Working from home will be an interesting experience. I’ve done it before, but always under slightly different circumstances. I plan on visiting several co-working spaces from time to time … there’s been lots of exciting activity going on in Orlando, so I’m looking forward to getting to know more of the tech community here.

But, as they say, time stands still for no man; so I’ve already got a few events coming up that you should totally come to and participate in!

There’s a few other things in the works … it’s an amazing time to be a developer :)

Comments

JavaScript Engine for Windows Phone

Edit: This is now available on GitHub: https://github.com/joelmartinez/Jint.Phone

Did a fun bit of hacking, ported the Jint JavaScript interpereter to Windows Phone 7.5 … the result is seen below:

1 2 3 4
var engine = new JintEngine();
engine.SetFunction("alert", new Action<string>(t => MessageBox.Show(t)));
 
engine.Run("alert('Hello World, from dynamically interpereted JavaScript on WP7!')");
view raw gistfile1.cs This Gist brought to you by GitHub.

And when we run that code in a silverlight application:

mapped alert method

This would also work in XNA games for wp7, so one can imagine scripting scenarios if that’s your cup of tea. Though it would take more work for this to be supported on the xbox since DynamicMethod is not supported there.

I was really happy to see that Windows Phone 7.1 (Mango) brings in support for the DynamicMethod and some of the other Reflection.Emit features. One of my previous projects (New LateBinder) showed significant perf benefits to using this over regular old reflection.

I had to overcome some quirks due to the slight differences in the compact framework, but after some time I got it all working … so far all my tests have been successful (though it’s not to say it’s all fully working). Many props to the team of developers that did this over at codeplex.

Comments (7)

R.I.P. Steve Jobs

Comments

Exec-Sql PowerShell Function

And the hits just keep on coming … here’s a simple little function which executes a query against a database and pipelines the results as PSObjects.

.SYNOPSIS
Executes SQL against the supplied connection string.
.DESCRIPTION
Executes SQL against the supplied connection string. The result set is then pipelined as a PSObject which can subsequently be formatted and filtered any way you choose.
.PARAMETER query
The query to execute
.PARAMETER connstring
The connection string to use
.EXAMPLE
PS C:\> Exec-Sql -q "select top 1 * from common.country" -conn ""
.EXAMPLE
PS C:\> Exec-Sql -q "select * from common.country (nolock)" -conn "" | where {$_.Code -eq "AX" } | select code, name
#>
function global:Exec-Sql
{
param ([Alias("q")]$query, [Alias("conn")]$connstring)

[system.reflection.assembly]::LoadWithPartialName("System.Data")
$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection

$connection.ConnectionString = $connstring
$connection.Open()

$command = New-Object -TypeName System.Data.SqlClient.SqlCommand

$command.Connection = $connection
$command.CommandText = $query
$reader = $command.ExecuteReader()

$fieldcount = $reader.FieldCount

while ($reader.Read())
{
$o = new-object psobject

for ($i=0;$i -lt $fieldcount;$i++)
{
$o | add-member -membertype noteproperty $reader.GetName($i) $reader[$reader.GetName($i)].ToString()

}

write-output -inputobject $o
}

$connection.Close()

}

Comments

Minor PowerShell Prompt Customization

Having recently started using PowerShell a lot more, I wanted to share a minor customization I made to my powershell prompt.

function prompt
{
    $loc = $(get-location).ToString()
    $usr = ($env:userprofile).ToString()
    if ($loc.StartsWith($usr, $true,[System.Globalization.CultureInfo].CurrentCulture)) {
	$loc = "~"+$loc.SubString($usr.Length, $loc.Length - $usr.Length)
    }
    Write-Host ("PS " + $loc +">") -nonewline -foregroundcolor Yellow
    return " "
}

all it does is that when I’m in my user profile directory, it shortens the prompt to something like: PS ~>. Since you can use the ‘~’ character as a shortcut for your user directory, may as well shorten the path to give you more space. Also, it makes the prompt yellow so that it can be more easily distinguished from the rest of the output.

Comments

Lego/Snap-Circuits Mashup

My daughter Layla mentioned a few days ago that they are teaching her how to program simple Mindstorms robots at school. As a software developer, I was of course super excited when she started explaining the logic she was “writing” in the visual programming language to make her little mindstorms robot move around and turn. So then today my son Ashton goes upstairs and grabs all his legos, and the Snap Circuits I bought him a few years ago, and asked me to help him build a robot. The options were pretty limited because the snap circuits kit only had one motor, and the legos he has don’t have any gears or anything.

It was a blast helping the kids with it :-) The biggest challenge was figuring out how to transfer the power from the snap circuits motor to the lego pieces. We ended up cobbling together a rudimentary axle, and used a rubber band to transfer the torque from the motor to the axle.

And it totally works!

well, mostly … the motor was too weak to actually move the car without first getting a push … but as you can see above, they got it to actually turn the wheels :-) Of course it wasn’t done all on their own … I gave them help along the way, but I’m happy that they worked through the process of figuring out something like. And most importantly, it was because they wanted to … I can’t wait to see what this generation does with all the technology they are growing up with.

Comments

Khan Academy for WP7 Review

This was a nice little surprise :-) My (unofficial) Khan Academy app for windows phone 7 got reviewed on an episode of Hot Apps By Laura Foy – check the video below.

Only reason I noticed was because I checked the download stats and saw a sustained spike in traffic a few weeks ago. Thanks Laura!

Comments

Lmnd.st for wp7?

In honor of the NY Startupbus at SXSW … a wp7 app for lmnd.st :-)

Yes, it’s pointing to the live API … though only the display of the current listings is built right now. Total time spent thus far:

  • 50 minutes on the train this morning
  • 1 hour during lunch

Comments

P2P Lending Data

Just wanted to point you to a recent project of mine which is now ready for consumption: http://p2plendingdata.com

From the site description:

So what’s this all about? we take data from LendingClub, mash it up in our database, and try to extract some insight for Peer to Peer investors to use in their search for new notes to invest in.

Since Lending Club so generously let’s anyone download a daily dump of their Loan database, it was fairly easy to import it into a database and make some reports. Astute readers will note that I’ve been toying with this idea for a few months, but it was only the recent launch of AppHarbor that pushed me to polish it up and get it out there.

It’s obviously relatively simple at this time, but I do have plans to add additional features. Namely:

  • oData endpoint so users can use something like PowerPivot to slice and dice the data to their heart’s content.
  • Statistical ratings of individual notes.
  • More reports!

If you are a lending club investor and find this useful, please let me know in the comments, via email, or on twitter.

Comments

Khan Academy for Windows Phone 7 is Live!

After reviewing the UI design guidelines, re-theming the application, and submitting on Sunday, the application was approved about 24 hours later. It’s now live on the marketplace!

You can download it by clicking here if you have the Zune software installed, or just navigating to Marketplace > Books &  Reference > Reference, or of course, just searching the marketplace for “Khan Academy”.

This has been a great learning experience, and I hope to continue working with the Khan Academy to iterate and improve on the application based on user feedback. If you do have feedback, please don’t hesitate to leave a comment, email me, or create a discussion on the codeplex site. And of course, Rate and Review the application after you download it :-)

Comments