tile - Dave's Blog

Search
My timeline on Mastodon

JavaScript Microsoft Store app StartPage

2017 Jun 22, 8:58

JavaScript Microsoft Store apps have some details related to activation that are specific to JavaScript Store apps and that are poorly documented which I’ll describe here.

StartPage syntax

The StartPage attributes in the AppxManifest.xml (Package/Applications/Application/@StartPage, Package/Applications/Extensions/Extension/@StartPage) define the HTML page entry point for that kind of activation. That is, Application/@StartPage defines the entry point for tile activation, Extension[@Category="windows.protocol"]/@StartPage defines the entry point for URI handling activation, etc. There are two kinds of supported values in StartPage attributes: relative Windows file paths and absolute URIs. If the attribute doesn’t parse as an absolute URI then it is instead interpreted as relative Windows file path.

This implies a few things that I’ll declare explicitly here. Windows file paths, unlike URIs, don’t have a query or fragment, so if you are using a relative Windows file path for your StartPage attribute you cannot include anything like ‘?param=value’ at the end. Absolute URIs use percent-encoding for reserved characters like ‘%’ and ‘#’. If you have a ‘#’ in your HTML filename then you need to percent-encode that ‘#’ for a URI and not for a relative Windows file path.

If you specify a relative Windows file path, it is turned into an ms-appx URI by changing all backslashes to forward slashes, percent-encoding reserved characters, and combining the result with a base URI of ms-appx:///. Accordingly the relative Windows file paths are relative to the root of your package. If you are using a relative Windows file path as your StartPage and need to switch to using a URI so you can include a query or fragment, you can follow the same steps above.

StartPage validity

The validity of the StartPage is not determined before activation. If the StartPage is a relative Windows file path for a file that doesn’t exist, or an absolute URI that is not in the Application Content URI Rules, or something that doesn’t parse as a Windows file path or URI, or otherwise an absolute URI that fails to resolve (404, bad hostname, etc etc) then the JavaScript app will navigate to the app’s navigation error page (perhaps more on that in a future blog post). Just to call it out explicitly because I have personally accidentally done this: StartPage URIs are not automatically included in the Application Content URI Rules and if you forget to include your StartPage in your ACUR you will always fail to navigate to that StartPage.

StartPage navigation

When your app is activated for a particular activation kind, the StartPage value from the entry in your app’s manifest that corresponds to that activation kind is used as the navigation target. If the app is not already running, the app is activated, navigated to that StartPage value and then the Windows.UI.WebUI.WebUIApplication activated event is fired (more details on the order of various events in a moment). If, however, your app is already running and an activation occurs, we navigate or don’t navigate to the corresponding StartPage depending on the current page of the app. Take the app’s current top level document’s URI and if after removing the fragment it already matches the StartPage value then we won’t navigate and will jump straight to firing the WebUIApplication activated event.

Since navigating the top-level document means destroying the current JavaScript engine instance and losing all your state, this behavior might be a problem for you. If so, you can use the MSApp.pageHandlesAllApplicationActivations(true) API to always skip navigating to the StartPage and instead always jump straight to firing the WebUIApplication activated event. This does require of course that all of your pages all handle all activation kinds about which any part of your app cares.

PermalinkComments

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

Ben Goldacre’s TED talk on publication bias, drug...

2012 Sep 28, 3:55


drug companies hiding the results of clinical trials.

(via I did a new talk at TED, on drug companies and hidden data.)

PermalinkCommentsscience video ted

A VC: The Twitter "Patent Hack"

2012 Apr 18, 6:19

Specifically Twitter has said that they will only used these assigned patent rights defensively to protect themselves against hostile actions. And further that any company that acquires these patent rights from Twitter will need the inventor’s consent to use them in an offensive action. Twitter has also provided the inventor with certain rights to license the patent to others for defensive purposes. You can read the entire set of provisions on GitHub.

PermalinkCommentstechnical twitter ip patent software-patent

(via Defend our freedom to share (or why SOPA is a bad idea):...

2012 Jan 18, 3:21


(via Defend our freedom to share (or why SOPA is a bad idea): Clay Shirky on TED.com)

PermalinkCommentsvideo copyright clay-shirky sopa pipa legal politics mpaa ted

Color Changing Tiles | Apartment Therapy San Francisco

2010 Jan 20, 5:05Shower tiles that change based on heat. Neat!
PermalinkCommentsshower shower-tile wishlist house design

Cheap Multiplayer Tricks for New Super Mario Bros. Wii

2010 Jan 5, 1:47

The New Super Mario Bros. Wii is a great game. Its the fun of old school Mario with the addition of great graphics and the kind of multiplayer I've wanted for Mario since playing the original as a child: its got up to four player simultaneous cooperative multiplayer. I recommend it to anyone who has enjoyed Mario in the past. Watch this amazing video of level 1-3 you can unlock in the game.

As noted elsewhere, multiple players attempting to navigate platforms, grab power ups, and throw turtle shells creates new challenges but along with that there's new ways to be incredibly cheap.

Jumping Higher
A second player means a head one can jump on to reach higher locations. Jump on your friend's head at the apex of their jump while holding down the jump button yourself for maximum jumping. In the game you can also grab other players and hold them over your head. This is useful for reaching the top of the flagpole at the end of levels. On that same line, if the player you grab has a flying cap you can now use them to fly in the same manner you would use a flying block which makes it easy to get two players to the top of the finish flagpole if only one of you has a flying cap.
Power-Ups
Normal power-up blocks now spawn enough power-ups for everyone. A mushroom is spawned for each small player and full power-ups for the rest, except in the case everyone is small: then one of the power-ups is a full power-up. If there's two players and you're both small, the full power-up always jumps out of the block to the right. Some hidden power-up blocks only give out one power-up and in that case its a mushroom or not based on the player who hits the block - so be sure that a big player hits that if you have one.
Death & Bubbles
When a player dies but at least one other player lives the dead player comes back in a limbo bubble from which they must be released before they may play again. Because of this, in a tough spot you can send one player in and leave a second behind. If the first dies you don't lose your place in the level and the first comes back in a bubble ready to try again. For instance, if you're trying to get the last star coin in 2-1 which sits just above the abyss, one player can just jump to their death for it and as long as another player lives you've collected the coin. However you need not sacrifice your life to do this: you can press down and 'a' to force yourself into a bubble saving yourself from death. This is true in general as long as you have enough time to see your death coming. This is also useful if one player runs ahead to the right. The screen will expand a bit but then it will just move to the right following the player in the lead. Players left behind walls or now forced into lava pits will die unless they use the bubble.
Misc.
  • If all players hit the ground at the same time from a ground pound it acts like hitting a pow block, killing the enemies on the screen.
  • If you hold a player who has a projectile power over your head they can still use their power.
  • Bubbles can be popped by hitting them with your fire or ice projectiles as well as thrown shells or blocks.
  • All players get the extra lives from anyone collecting 100 coins or finishing a level with more than 7 enemies on the screen.
PermalinkCommentsmultiplayer mario wii

How to Remove Caulk in 6 Easy Steps - Popular Mechanics

2009 Oct 18, 5:22"Q: The caulk around my bathtub is peeling away in places, and it looks pretty ugly. How do I remove it and recaulk?"PermalinkCommentshowto diy home tool caulk shower bathtub tile

IE6 denial message for Momentile.com on Flickr - Photo Sharing!

2009 Jun 15, 4:46"This was such a fun project - this is what users of Internet Explorer 6 see when they visit Momentile." Funny image. There's just two things I don't like about this: (a) it makes me feel sorry for IE6 when the only thing anybody should feel in relation to IE6 is the urge to upgrade to IE8 and (b) I hate it when websites get all preachy and try to convert you to another browser.PermalinkCommentshumor webdesign ie6 ie browser comic

Two Stanford students rethink the light switch - Nudge blog

2009 Feb 23, 11:04"...the two have designed what they are calling a SmartSwitch, which lets people know how much energy they are using, not through colors, but through tactile feedback."PermalinkCommentsecology ui interface hci energy light lightswitch

rec.arts.sf.science qdFAQ

2008 Aug 26, 3:42Links to write ups on how much energy it would take to destroy the Earth or at least make it inhabitable in various fashions: "Destroying the Earth, It is often asked what it would take to shatter the Earth into little pieces. Erik Max Francis gives a rough answer. A less drastic measure would be to sterilise it by heating the outside. Brian Davis does the arithmetic, but I think he should have calculated what it would take to boil the oceans, which is a few thousand times more by my BotEC. Occasionally it is asked what would happen if you shot a fast-moving projectile at the Earth; I've written something up."PermalinkCommentsscifi science math

TileStack - Your Creative Playground

2008 Jun 9, 5:10"Remember that great application that used to come with all Macs called HyperCard?" I do! Closed beta now but looks fun.PermalinkCommentshypercard programming web apple mac

Plane Wackiness

2004 Apr 22, 6:44My interview was scheduled for Monday starting at 8am, so when I signed up for the trip and MS suggested a departure time of 4:30pm on Monday I thought that'd be good. Unfortunately the entire process ended at 4:15pm and it takes a little more than 15 minutes to get from Redmond to Seattle and then through the whole airport deal. So after the taxi ride to the airport and waiting in line for like 20 minutes its 5:30pm and I'm at the front of the line asking this woman for a new ticket.

Woman: *typing* Well I can get you to LA... Me: Yeah well that's the right state. Woman: *still typing* Oh... Hmm... Uhoh... *other non-words* Me: *waiting patiently* ... Woman: Are you ready to run? Here's your ticket. Gate C11.

I look at the ticket and the plane's boarding at, what do you know?, 5:30pm. So yeah I start running. I hit the security check point line and I know all about this. I take off my belt and shoes and empty my pockets into my backpack, my only luggage. I am Mr. Prepared, or maybe Prepared-ness is my middle name, whatever. I get through the line with no problem, put on my backpack and holding my shoes and belt in one hand I notice a big old clock just to my left. While I'm staring at it, it changes from 5:42 to 5:43. "Oh shit!" I think, so I start running again. I finally get to the appropriate gate and get on the plane all out of breath. I'm walking down the aisle with shoes and belt in hand, and I guess I look a bit out of sorts. I sit in my seat and I'm telling the guy next to me about my whole deal: "Ha. Yeah. I was late and with the running and the security checkpoint..." into incoherent mumbling and gesturing. So it turns out the pilot and copilot's incoming flight was way late and I ended up sitting in my seat for another 15 minutes before we could take off. All that wasted running. What a shame. Coming into LA we've been "landing" for like 20 minutes. We finally get on the ground and its 30 minutes passed the boarding time of my connecting flight. I start thinking about anyone I know who lives in LA. All the other passengers stand up and block the aisle. Then, an announcement "Will Daniel Riesney please come to the front of the plane." OK I can tell that's supposed to be my name, but how the hell am I supposed to get to the front of the plane? The people near me who have heard me talking to the guy next to me about this let me past easily enough. But now I have to explain this to each person out of ear shot to further my progress. "Hi. Excuse me. They called me to the front of the plane. Pardon me. Can I get by." And so on. Its getting more hostile the closer I get to first class. Up to this one guy. He's trying to talk on his cell phone but its not working because everybody is trying to talk on their cell phone now that we've landed. His phone connection has failed. I can't guess at what else has happened to him today but he's decided to make his Custerian last stand here between me and the rest of the plane.

Me: *continuing from previous passengers* Excuse me. Pardon me. Guy: *spinning around* WHAT!? Me: Can I please get by? Guy: What? Why? Were not going anywhere! This whole time I've been forcing my way past him. Guy: There OK your past me now! Your several feet ahead of me! Congratulations! Me: Dude, I'm sorry they called me to the front of the plane. Guy: I find that highly unlikely!

Whatever. I keep walking and like 7 people past the asshole I guess the flight attendants give up on me and start letting people off the plane. Now who feels like an asshole? Its me. I get off the plane and some airport guy has a new schedule for me. Oh good I'm thinking, I've got an hour until the next flight's boarding time at 10:30pm. So I get on a tram to travel to the other side of LAX. I wait for oncoming traffic to stop so I can climb up a stopped escalator (Incidentally right next to it is another escalator which has been closed off. Why would they do that? Escalators cannot break they just become stairs.) I get up there and wait in line for an extreeeeme amount of time and finally get up to claim my ticket. Its 10:20. I get my ticket and, yeah, the departure time is 10:30, the boarding time is 10:10. So I start running again. More security check fun. I finally find my boarding gate. I rush up...

Me: *breathing heavy* Here's my ticket Lady: Oh good your finally here. Just go right out that door, *points* down the stairs, *more pointing* and wait for the tram.

WHAT? Isn't there supposed to be a PLANE somewhere? This is what I'm thinking not what I'm saying. So I walk outside and down these steps. And I'm waiting. The lady from inside joins me.

*awkward silence* Lady: The bus should be here pretty soon. Me: So... I'm going to miss my plane huh? Lady: Oh no, see here? *points at my ticket* Your ticket is confirmed so they can't leave without you. Me: Oh good... I hope they didn't tell the other passengers that.

Lets see how many passengers I can piss off in one night. Eventually this bus shows up. I get in and the guy starts driving. "Do you know where I'm going?" I ask. "Yeah" the guy says. Great. Fine. Whatever. I don't care anymore. So we drive back around to the OTHER SIDE of the airport. You know, the side I started on. Yeah that side. So I get off the bus and walk into the small building set aside for smaller airlines. I see the frantic looking ladies manning another of these gates. They see me, check my ID and ticket, and one of them ushers me out the door next to the gate. Out the door and into a small gated area outside. So me and this new lady are just standing here. Even had I the energy to ask her what was going on its very loud what with all the planes. So we just stand here at this gate facing the planes for a while. I look at her trying to make eye contact and get some sort of acknowledgment that we are in fact waiting for SOMETHING. Eventually one of the day-glow guys appears from between some planes and saunters up. The lady hands him a paper and walks away. At the time I was kind of offended but looking back on it, maybe the lady was a deaf mute and I'm the one being insensitive. So now I follow this guy through a bunch of planes. I'm yelling "San Luis Obispo?" trying to be heard over all the ambient noise and this guy is somehow responding to me with an even tone no yelling required. I don't know how he did that. We finally get to the plane and its 10:40. So I delayed the flight ten minutes. I'm thinking its going to be really awkward when I sit down and we immediately leave. Its going to be suspicious even. But, not to worry, we wait while the flight attendant argues with the guy who brought me to the plane for another ten minutes about how many people are supposed to be on the plane. Whatever.PermalinkComments
Older Entries Creative Commons License Some rights reserved.