Saturday, October 22, 2011

F# and WP7 app

Let us add another sample to use F# on WP7 application, although WP still improvement.

Where Am I

On your way home, business trip, hiking route, one click send your location on your way home, business trip, hiking route. Keep contact with the one you care.

Features include:

- find current longtitude and latitdue
- find civic address
- find current speed
- send location information by email
- send location information by SMS


Tuesday, October 18, 2011

unbox and data conversion

As a C# programmer, I was expect something like

object a = 123;
ulong b = (ulong)a;

should also work on F#. in order to make this work on F#, you need another operator "unbox"

let (a:int) = 123;
let (b:obj) = box(a)   //make the b as an object
let c = uint64(unbox(b)) //unbox b first and then you can convert

F# design pattern Channel 9 video

my video on using F# to implement design patterns.

Monday, October 10, 2011

F# doing WP7 app - More Silverlight

All WP7 by F# can be found at:

Listed below:
  • Earthquake Alert

The earthquake alert notifies you the unusual shake occurred on the surface where the phone is put on. Put the phone on a still flat surface and press start in the next page to start the application. The screen lock will be disabled, so your phone will use more power than usual. Connect the phone charger if you plan to leave the application open for long time, for example, when sleeping. The screen lock will be reactivated once the application is closed. Please Use the phone’s volume control to adjust the alert sound volume to your preferred level.

This application is not a replacement of professional devices. Please always contact your local authority to verify.

  • Expert Sudoku
This game is for those truly into Sudoku, an addictive and challenging game that will drive you mad but keep you itching for more.  Expert Sudoku provides over 6000 expert level puzzles.All games are true Sudoku, with a single solution that can be discovered by logic alone. If you doubt that a Sudoku puzzle can be solved by logic, simply have the hint system show it to you step by step. Come enjoy the rich feature set and advanced hint system. The more you play, the more of a Sudoku expert you will be!

Features include:

- Over 6000 free Sudoku puzzles 
- Optimized for fewer touches
- Undo/redo
- Large, high contrast digits are easy to read
- Ability to delete all pencil marks and/or reset puzzle
- Hint system to provide advice once you're stuck.  
- Ability to check all pencil marks with one key stroke
- Save partially solved games
- Load games 
- Enable user to choose if to show suggestion and highlight
- Save current game as a picture

  • Level
 two tools in one: a level and it also show the current the gravity unit and record the gravity. The level also provides the lean angle and measure angles by using saved angle feature.

F# doing WP7 app - Silverlight-based

All WP7 by F# can be found at:

This is the free version of the widely beloved WP7 game "Love Dice".

Looking for naughty ways to spice up your love life? Look no further. Get the good times rolling and break the ice with these Love dices. After a few rolls, you're guaranteed to get lucky. There are no losers in this game!

One dice describes a body part: Lips, Ears, Neck, Toes, Chest, your choice … by default 12 different body parts. The other dice describes an action: Lick, Tickle, Rub, Kiss, Massage, Surprise … by default 11 different actions. You are free to remove any items and add your own action/body parts. You can lock one dice and roll the other. Be creative!

To be played by two or more adults. Take turns rolling the dice and explore each other's intimate side. Let the games begin...

F# doing WP7 app - Some Games

All WP7 by F# can be found at:

There are some basic games done by F# to explore how to use F# and XNA.

  • Crazy Falling Ball 2

Crazy Falling Ball 2 is the completely upgraded version of the well beloved crazy falling ball. 

1. Improved control. Easier and more responsive. 
2. More relistic physics.
3. Additional barriers forcing the ball to jump up, down, left and right, making it more challenging and fun!
4. Score Ranking section to record your best performance on each of the seven levels. 
5. add prize mode: to get more prize score
6. add math mode: try to control the ball to make the aggregation value to be 0
Tilt the phone to guide the ball through fast moving barriers moving upward.  Seven levels from piece of cake to impossibly tough. See how quick you can move the ball to the bottom and give your boring day a boost!

  • Prix ball game is just another version of Crazy falling ball.
  • Labyrinth
Classic labyrinth game where you control the ball while avoiding holes and traps to reach the destination.

Currently there is only one level supported.

F# doing WP7 app - Graphic calculator

All WP7 by F# can be found at:

The reason I choose F# as my major programming for WP7 application is because

  • F# is .net based language
  • F# requires less code when program the same feature. 
  • F# library and community provides large number of good algorithms, some of them are exotic and never heard of. But over all, that give me confident that I can have more stuff to show on a phone.
  • my previous experience shows F# generate less bugs. 

Many people as what is some real world app using F#? Here are some Windows Phone 7 app by F#. This app is XNA based. There are some app's, such as games, silverlight based application and games and tools

Calculator Pro is a professional calculator. More than 150 functions are supported. It supports:
  1. 50+ math operations, including advanced trigonometric functions, logarithmic functions, and eight variable storage spaces. 
  2. Programmer calculation, hex and oct calculation, bitwise calculation (including AND, OR, XOR), and float to/from int conversion. 
  3. Unit conversion, convert well known US units to metric units. 
  4. Function diagram: use your fingers to change range and understand how the function looks like in an easier way.
  5. Canada income tax calculation
  6. Tip calculation: support sale tax, number of person, round tip, and total display to make your tip calculation much easier.
  7. Statistics functions: stddev, average, Pearson correlation, Spearman correlation, normal distribution, skew, kurt.
  8. Quadratic equation: solve the Quadratic function, proivde you delta (discriminant), x1, and x2. solution can be in imaginary number format.
  9. Mortgage and loan: given term, interest rate, down payment, tax per year, fee per month, and loan amount and get the monthly payment.
  10. Currency conversion feature which enable you to get latest currency rate from Yahoo. By click the "To ANSW" button, you can link the rate with other calculation easily.
  11. Money value mode: get present value and/or future value by giving interest, payment, growth rate and period.
  12. Email funtion: email your last calculation result and merge to your document. You can keep track your tip, and unit conversion, and other computation.
  13. SMS function: SMS your last calculation result when do not have data access.

You got 11 calculation functions within one single app!

Friday, October 7, 2011

Jobs died.


Sunday, October 2, 2011

Install F# for Silverlight 4.0 runtime

The machine configuration is always a painful process unless it works as installation package promises. Today the Silverlight4_Tools.exe drives me nuts when I try to install F# for Silverlight 4 runtime. No matter how many times you run that EXE file, SL4 just won't be picked up by F#!

Here is a way to verify the SL is actually installed:
  1. go to C:\Program Files (x86)\Microsoft F#\Silverlight\Libraries\Client
  2. make sure there is a folder called 4.0 created
In order to make sure the folder is actually created by the installer, follow steps listed below:
  1. download the "Microsoft Silverlight 4 Tools for Visual Studio 2010", do not run it
  2. extract files using WinRAR
  3. find "FSharpRuntimeSL4.msi" in the extract folder
  4. run the "FSharpRuntimeSL4.msi"