Archive for October, 2011

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)

AI and Machine Learning

Machine Learning and Artificial Intelligence have long been interests of mine.

Most recently, I’ve enrolled for the AI and Machine learning classes being offered by Stanford. I truly feel as if advanced engineering practices such as machine learning and AI are going to be what separates the good companies from the truly great companies over the course of the next decade. So far, these classes have great introductions if you’ve never been exposed to the fields, and promise to go much deeper.

I’m very glad that this online education movement, which was legitimized by Khan Academy IMO, is gaining momentum. Soon, the whole world will have easy access to even the most advanced topics … the future will be ours to create, if only we step up to the challenge.

In the meantime, if you’re interested you should get started by watching the intro lectures, and (at least in the case of the ML Class) installing Octave: http://www.gnu.org/software/octave/

Comments

R.I.P. Steve Jobs

Comments