ui page 7 - Dave's Blog

Search
My timeline on Mastodon

Words with Hints Windows 8 App Development Notes

2013 Jul 4, 1:00

My second completed app for the Windows Store was Words with Hints a companion to Words with Friends or other Scrabble like games that gives you *ahem* hints. You provide your tiles and optionally letters placed in a line on the board and Words with Hints gives you word options.

I wrote this the first time by building a regular expression to check against my dictionary of words which made for a slow app on the Surface. In subsequent release of the app I now spawn four web workers (one for each of the Surface's cores) each with its own fourth of my dictionary. Each fourth of the dictionary is a trie which makes it easy for me to discard whole chunks of possible combinations of Scrabble letters as I walk the tree of possibilities.

The dictionaries are large and takes a noticeable amount of time to load on the Surface. The best performing mechanism I found to load them is as JavaScript source files that simply define their portion of the dictionary on the global object and synchronously (only on the worker so not blocking the UI thread). Putting them into .js files means they take advantage of bytecode caching making them load faster. However because the data is mostly strings and not code there is a dramatic size increase when the app is installed. The total size of the four dictionary .js files is about 44Mb. The bytecode cache for the dictionary files is about double that 88Mb meaning the dictionary plus the bytecode cache is 132Mb.

To handle the bother of postMessage communication and web workers this was the first app in which I used my promise MessagePort project which I'll discuss more in the future.

This is the first app in which I used the Microsoft Ad SDK. It was difficult to find the install for the SDK and difficult to use their website, but once setup, the Ad SDK was easy to import into VS and easy to use in my app.

PermalinkCommentsdevelopment technical windows windows-store words-with-hints

MSVC++ 64bit Enums

2013 Jul 1, 1:00

If you want to represent a value larger than 32bits in an enum in MSVC++ you can use C++0x style syntax to tell the compiler exactly what kind of integral type to store the enum values. Unfortunately by default an enum is always 32bits, and additionally while you can specify constants larger than 32bits for the enum values, they are silently truncated to 32bits.

For instance the following doesn't compile because Lorem::a and Lorem::b have the same value of '1':


enum Lorem {
a = 0x1,
b = 0x100000001
} val;

switch (val) {
case Lorem::a:
break;
case Lorem::b:
break;
}

Unfortunately it is not an error to have b's constant truncated, and the previous without the switch statement does compile just fine:


enum Lorem {
a = 0x1,
b = 0x100000001
} val;

But you can explicitly specify that the enum should be represented by a 64bit value and get expected compiling behavior with the following:


enum Lorem : UINT64 {
a = 0x1,
b = 0x100000001
} val;

switch (val) {
case Lorem::a:
break;
case Lorem::b:
break;
}
PermalinkComments64bit c++ development enum msvc++ technical

Number 1 and Benford’s Law - Numberphile (by...

2013 Jun 25, 4:40


Number 1 and Benford’s Law - Numberphile (by numberphile)

I’d heard of Benford’s Law before but it sounded totally counter intuitive to me. This video does a good job explaining why one shows up as the leading digit in sets of random numbers that span large ranges.

PermalinkCommentsmath video benfords-law

laughingsquid: How Common Is Your Birthday, A Chart of Birth...

2013 Jun 10, 2:49


laughingsquid:

How Common Is Your Birthday, A Chart of Birth Date Frequencies

PermalinkCommentsbirth-day chart

Sci-fi short stories disguised as Internet docs

2013 May 29, 2:48
The recent short story Twitter API returning results that do not respect arrow of time by Tim May written as a Twitter bug report reminded me of a few other short sci-fi stories written in the style of some sort of Internet document:
PermalinkCommentscsc fiction sci-fi Scifi time-travel twitter

laughingsquid: The Ultimate Spaceship Face-off, Interactive...

2013 May 22, 3:10


laughingsquid:

The Ultimate Spaceship Face-off, Interactive Guide For Comparing the Speeds of Famed Sci-Fi Ships

PermalinkCommentssci-fi scifi tardis doctor-who star-trek star-wars nerd

laughingsquid: Arrested Development Season 4 Trailer Brings...

2013 May 13, 2:47


laughingsquid:

Arrested Development Season 4 Trailer Brings Back the Dysfunctional Bluth Family

Come on!

PermalinkCommentshumor trailer arrested-development awesome

laughingsquid: Time Travel in Movies Flowchart

2013 Apr 15, 3:41


laughingsquid:

Time Travel in Movies Flowchart

PermalinkCommentstime-travel movies chart movie bttf

laughingsquid: Tetris Stackable LED Desk Lamp

2013 Apr 13, 12:57


laughingsquid:

Tetris Stackable LED Desk Lamp

PermalinkCommentstetris lamp game humor

laughingsquid: An ‘American Psycho’ Parody Starring Huey Lewis...

2013 Apr 4, 5:33


laughingsquid:

An ‘American Psycho’ Parody Starring Huey Lewis & Weird Al

Hey its the high school band audition judge from Back to the Future.

PermalinkCommentshumor weird-al huey-lewis american-psycho video

laughingsquid: Two-Year-Old Picks the Lock to His Sister’s Room...

2013 Mar 28, 3:30


laughingsquid:

Two-Year-Old Picks the Lock to His Sister’s Room and Steals Her Toys

PermalinkCommentshumor child video

laughingsquid: Everybody Wants to Kill Bruce Willis, An Action...

2013 Mar 26, 7:47


laughingsquid:

Everybody Wants to Kill Bruce Willis, An Action Movie Mashup

PermalinkCommentshumor video bruce-willis

laughingsquid: ‘Veronica Mars’ TV Show Attempts to Make a Film...

2013 Mar 13, 11:38


laughingsquid:

‘Veronica Mars’ TV Show Attempts to Make a Film Via Crowdfunding

PermalinkCommentsveronica-mars movie kickstarter

laughingsquid: New & Necessary Punctuation Marks

2013 Feb 25, 9:01


laughingsquid:

New & Necessary Punctuation Marks

PermalinkCommentshumor punctuation internet

draft-ietf-websec-framework-reqs-00 - Web Security Framework: Problem Statement and Requirements

2013 Feb 20, 2:48

Web Security Framework: Problem Statement and Requirements

PermalinkCommentstechnical rfc security web html

laughingsquid: The Truth About Phones on Airplanes

2013 Jan 7, 11:57


laughingsquid:

The Truth About Phones on Airplanes

PermalinkComments

laughingsquid: Stick-N-Find, Tiny Bluetooth Stickers Help You...

2013 Jan 4, 5:35


laughingsquid:

Stick-N-Find, Tiny Bluetooth Stickers Help You Keep Track of Things

PermalinkComments

laughingsquid: Blind Man Shows How Blind People Use Instagram

2013 Jan 4, 5:34


laughingsquid:

Blind Man Shows How Blind People Use Instagram

PermalinkComments

laughingsquid: Solitaire.exe, A Real Deck of Cards Inspired by...

2012 Nov 19, 4:56


laughingsquid:

Solitaire.exe, A Real Deck of Cards Inspired by the Windows 98 Solitaire PC Game

PermalinkCommentshumor solitare game cards windows

laughingsquid: Windows 95 Tips, Tricks, and Tweaks Some very...

2012 Nov 14, 5:39


laughingsquid:

Windows 95 Tips, Tricks, and Tweaks

Some very H. P. Lovecraft style redesigns of some classic Win95 UI.

PermalinkCommentshorror humor windows windows-95
Older EntriesNewer Entries Creative Commons License Some rights reserved.