Jaime Rodriguez
On Windows Store apps, Windows Phone, HTML and XAML

  • Jaime Rodriguez

    browser navigation and RIAs..

    • 4 Comments

    bear w/ some early (and wishful) thinking ...

    I have a great RIA, with navigation inside of it (i.e. its own menus and scene transitions in the RIA).

    My challenge is that I took advantage of the RIA's stateful model to optimize the experience; in other words, I avoided request-response; I do load new scenes, but of course it is all inside the RIA ...

    The problem is that I often find myself clicking "Back" button... and there fore losing the state in the RIA... AAARGHHHH!!

    What are the best practices for this type of app? I would love to see an app that handles this gracefully...   If you wrote one, please feel free to email me or leave a URL in the comments.. 

    My best answer so far is save state often so I can come back to it.. but I have a lot of challenges (like trying to differentiate between new requests, desired reloads, etc. quite messy )

    -- --------------- ----------------

    In the mean time, here is a quick (not thoroughly fleshed) wish list for all browsers... 

    1) Can browsers expose a "Confirm back/forward"  event for user to confirm this is what they wanted to do...

    What I want is when my HTML page is loaded, and before it loads my plug-in, the browser gets told, please ask user to Confirm if they click (go back/ go forward)..

    I am not saying 'ignore the users command, but allow the plug-in to let the browser know it is a RIA and ask user to Confirm when mixing navigation.. The browser can handle the confirmation, to prevent annoying session hi-jacking, which btw I see on plain standards-based sites, so I assume is doable regardless of a Confirm.  

    Yes, I know some people will find it confirmation annoying, but I think it would be up to the application provider to decide..  The user or consumer is still in control - when I go to a website that annoys me, I just don't go back-.  Confirm is an 'opt-in' behavior.

    2) While I am dreaming, could the browser allow "Trusted sites" to manipulate the history? Maybe an extra journal and Back button for within the RIA?  This way I can enter entries into the Journal and users follow their known paradigm ...  but with in the context of the app they are running.. {which I believe is what customers would want a large % of the time}

    [ I am not saying replace Back button, I am saying offer more options; user still in control, we have this w/ active documents merging menus with their hosts ]

    Thoughts??  I am sure lots a people will laugh and think I am naive about browser session hijacking, etc..  I am cool with that.. I leave it to smarter people ( e.g. IE team or w3c ) to figure how to nail the details; I still think the functionality is a nice to have and I am thinking the problem is solvable elegantly if the browsers or w3 define a standard approach..   

    Does what I need exist already??  
    I know smart client gets around this.. but I am trying to stay web (plus a small plug-in like Silverlight ) so bear with me...

    Thanks & sorry for rambling or rant... it was in my head today and I did not seem to crack it..

  • Jaime Rodriguez

    Explaining the Firefox Warning: Unresponsive script for Silverlight 1.0 apps..

    • 3 Comments

    I posted before on the "firefox unresponsive script warning" but enough people have asked off-line to warrant this attempt to explain the issue (since it is not what people expect, and can be tricky to track).

    The explanation:
    The warning is prompted by Mozilla's heuristics to check on long running scripts (details on these heuristics way below).  The problem is that for silverlight or any plug-in that makes Javascript calls, Firefox some times does not reset the timer for the scripts called from plug-ins: If you fire multiple events from a plug-in the events are obviously handled sequentially, if a new event happens while an event handler is executing, then Firefox does not reset its counter for the script time out; it measures the time from these two events as a single script. 

    What does this mean (by example)? :

    • If you run a script that is 11 seconds long, you will get the warning -- this one I understand and expect, this is what Firefox designed for; I do agree it is a good safety measure.
    • If you run 500 event handlers that take 200 milliseconds(each) to run, but are fired continuously and each new event is fired before the previous event handler has completed, then Firefox looks at it as being one very long script and fires their warning...
      • An explicit example:   If you are handling MouseMove in silverlight for an app that is pretty busy, you will likely run into this warning because Firefox will count most of your events as one long script...
    • You can imagine combinations from there... ( for example: 20 scripts that take 0.5 second but are fired continuously, can trigger the warning).. it is this type of random combination that makes the "Warning: Unresponsive script.. " hard to track since most people look for long running scripts and that is not often the case..

    How to get around it?
    So far window.setTimeout  () seems to work best (though I can't say it works 100% of the time). Your mileage may vary, but here is what I do:

    • For my long running event handlers ( > 2 seconds) , I just call window.setTimeout ( <longrunningCallback>, 0) -- this unfortunately means in some cases the events are slightly delayed as setTimeout will get queued (if there are events ahead this means I might handle them out of order). In most of my scenarios this has been acceptable for long running events; if it is not for you, you could write a pseudo dispatcher that queues all other events so things are always in order but of course you have higher overhead).
    • For short, continuous event handlers (e.g. MouseMove) I don't do setTimeout for all events fired; that seemed like too much overhead..   What I do is:
      • First make sure I narrow the scope of the MouseMove event as much as possible ( so no MouseMove on root element, but as low as I can on the pole).. this way less events get fired
      • then keep a timer and do setTimeout every few seconds ( on a MouseMove, doing it every move can be 10s more times than doing it every two seconds)

    Overall, setTimeout is not a perfect workaround, but best I come up with so far.

    ---

    Does the explanation above make sense???  If not, here is a practical repro of the problem, it might make it easier for people to understand..

    Requirements:

    • To see the problem you must be running Firefox .. for this repro if you try IE you will see a different problem, since the heuristics for rogue scripts are very differing in IE.. (IE counts statements and my repro loops mindlessly, so creates too many instructions).
    • Also, my repro below assumes you have the default timeouts in Firefox ( 10 seconds).. If yours is longer then tweak timeouts as needed.  See details below on how to find out if your timeouts were tweaked.

    Steps to repro:

    1. Open repro page in Firefox.
    2. Click twice quickly on the button that says "run from HTML event" ..  This will run two seven seconds loops from HTML... Technically this is 14 secs of continuous scripts, but since each script is < 10 seconds, firefox works fine..
    3. Click on "Clear status"  HTML button  [optional but helps keep repro readable] ..
    4. Now click twice quickly (same than you did before) in the "run from Silverlight event" button in silverlight..   This event handler is the exact same than we used in Step2..  but you will see that half way through second handler, the "Unresponsive script" warning will get triggered.. Why?? because Firefox considered the two user clicks as one  :(
    5. Now that you have seen the error, check the "use setTimeout workaround" that is on the "Repro via long script" table..
    6. Repeat step 4. My hope is you don't see the error this time around..

    To reproduce the problem using a short MouseMove handler ,

    1. Open repro page in firefox
    2. check the "Listen to MouseMove event"
    3. Move the mouse inside the silverlight window continuously (and vigorously) for 13ish seconds..  You should see the warning... If not, continue moving mouse feverishly for long periods of time ..   [if you just can't repro it, try increasing the "handler duration" from 500 milliseconds to 1000]
    4. Once you have seen the error in 3 ...  Check the "useSetTimeout on MouseMove" checkbox;
    5. Repeat the moving of the mouse in Step 3.. My hope is that you don't see the error any more...

     

    A few more details or references on Firefox and their timeout heuristics .

    Firefox controls its time out based on the dom.max_script_run_time setting, which you can tweak via the about://config moniker; the default timeout in most recent versions is 10 seconds.

    • The setting can not be controlled programmatically (so your script can't tweak it), nor per site ( meaning Firefox chooses to 'trust' your site)..  it is all or nothing, which seems a high ask to the visitors on most sites..
    •  FYI, the issue has been reported to Mozilla and they seem to be on it, but of course given ship cycles, priorities, etc.. we might not see a change for a while.  { I do thank the Mozilla folks as they were quite responsive to confirm that I was not crazy when I was seeing the timeouts on short running scripts)
  • Jaime Rodriguez

    Just added Mole to my .NET toolbox..

    • 1 Comments

    Mole is a very handy visualizer for Visual Studio (.NET) developers.   I am late to try it, because it felt similar to snoop, but I installed Mole recently to see what the hype was about and now I find myself using it all the time..  It is incredibly convenient to have all this information available inside Visual Studio...

    If you have not downloaded it yet, Karl Shifflett just released a sweeeettt v4. I highly recommend it..

    ---
    A few extra Mole thoughts:

    1. Congratulations to the whole Mole Team; it is pretty impressive what you have accomplished in such short time...  WOW!!
    2. If you are a snoop user, don't miss out on mole.. They do look alike and overlap, but I found them quite complimentary...

      Mole is incredibly convenient since it integrates with VS; Mole also has nice features to ease navigation, finding and editing properties; mole can visualize also WCF, Windows Forms, ASPX, etc. so its scope is way broader than snoop's. 

      On the other side,  every now and then (but now much less) you will still need the 'injection' features of snoop (for me it is change notifications on DPs, and a little the convenience of navigating the visual tree by mousing over items) ...

      The good news is you can have both since they are both free..

    Happy mole'ng...

  • Jaime Rodriguez

    MIME Types

    • 1 Comments

    I often know I need a mime-type ( e.g. .deploy or .xaml ).. Extensions are easy, but the types are hard to remember ( application/octet-stream is my favorite guess ).. 

     

    Now, courtesy of  Chris Knowlton, Windows Media Server PM, I don't have to guess...

    .323

    text/h323

    .aaf

    application/octet-stream

    .aca

    application/octet-stream

    .accdb

    application/msaccess

    .accde

    application/msaccess

    .accdt

    application/msaccess

    .acx

    application/internet-property-stream

    .afm

    application/octet-stream

    .ai

    application/postscript

    .aif

    audio/x-aiff

    .aifc

    audio/aiff

    .aiff

    audio/aiff

    .application

    application/x-ms-application

    .art

    image/x-jg

    .asd

    application/octet-stream

    .asf

    video/x-ms-asf

    .asi

    application/octet-stream

    .asm

    text/plain

    .asr

    video/x-ms-asf

    .asx

    video/x-ms-asf

    .atom

    application/atom+xml

    .au

    audio/basic

    .avi

    video/x-msvideo

    .axs

    application/olescript

    .bas

    text/plain

    .bcpio

    application/x-bcpio

    .bin

    application/octet-stream

    .bmp

    image/bmp

    .c

    text/plain

    .cab

    application/octet-stream

    .calx

    application/vnd.ms-office.calx

    .cat

    application/vnd.ms-pki.seccat

    .cdf

    application/x-cdf

    .chm

    application/octet-stream

    .class

    application/x-java-applet

    .clp

    application/x-msclip

    .cmx

    image/x-cmx

    .cnf

    text/plain

    .cod

    image/cis-cod

    .cpio

    application/x-cpio

    .cpp

    text/plain

    .crd

    application/x-mscardfile

    .crl

    application/pkix-crl

    .crt

    application/x-x509-ca-cert

    .csh

    application/x-csh

    .css

    text/css

    .csv

    application/octet-stream

    .cur

    application/octet-stream

    .dcr

    application/x-director

    .deploy

    application/octet-stream

    .der

    application/x-x509-ca-cert

    .dib

    image/bmp

    .dir

    application/x-director

    .disco

    text/xml

    .dll

    application/x-msdownload

    .dll.config

    text/xml

    .dlm

    text/dlm

    .doc

    application/msword

    .docm

    application/vnd.ms-word.document.macroEnabled.12

    .docx

    application/vnd.openxmlformats-officedocument.wordprocessingml.document

    .dot

    application/msword

    .dotm

    application/vnd.ms-word.template.macroEnabled.12

    .dotx

    application/vnd.openxmlformats-officedocument.wordprocessingml.template

    .dsp

    application/octet-stream

    .dtd

    text/xml

    .dvi

    application/x-dvi

    .dwf

    drawing/x-dwf

    .dwp

    application/octet-stream

    .dxr

    application/x-director

    .eml

    message/rfc822

    .emz

    application/octet-stream

    .eot

    application/octet-stream

    .eps

    application/postscript

    .etx

    text/x-setext

    .evy

    application/envoy

    .exe

    application/octet-stream

    .exe.config

    text/xml

    .fdf

    application/vnd.fdf

    .fif

    application/fractals

    .fla

    application/octet-stream

    .flr

    x-world/x-vrml

    .flv

    video/x-flv

    .gif

    image/gif

    .gtar

    application/x-gtar

    .gz

    application/x-gzip

    .h

    text/plain

    .hdf

    application/x-hdf

    .hdml

    text/x-hdml

    .hhc

    application/x-oleobject

    .hhk

    application/octet-stream

    .hhp

    application/octet-stream

    .hlp

    application/winhlp

    .hqx

    application/mac-binhex40

    .hta

    application/hta

    .htc

    text/x-component

    .htm

    text/html

    .html

    text/html

    .htt

    text/webviewhtml

    .hxt

    text/html

    .ico

    image/x-icon

    .ics

    application/octet-stream

    .ief

    image/ief

    .iii

    application/x-iphone

    .inf

    application/octet-stream

    .ins

    application/x-internet-signup

    .isp

    application/x-internet-signup

    .IVF

    video/x-ivf

    .jar

    application/java-archive

    .java

    application/octet-stream

    .jck

    application/liquidmotion

    .jcz

    application/liquidmotion

    .jfif

    image/pjpeg

    .jpb

    application/octet-stream

    .jpe

    image/jpeg

    .jpeg

    image/jpeg

    .jpg

    image/jpeg

    .js

    application/x-javascript

    .jsx

    text/jscript

    .latex

    application/x-latex

    .lit

    application/x-ms-reader

    .lpk

    application/octet-stream

    .lsf

    video/x-la-asf

    .lsx

    video/x-la-asf

    .lzh

    application/octet-stream

    .m13

    application/x-msmediaview

    .m14

    application/x-msmediaview

    .m1v

    video/mpeg

    .m3u

    audio/x-mpegurl

    .man

    application/x-troff-man

    .manifest

    application/x-ms-manifest

    .map

    text/plain

    .mdb

    application/x-msaccess

    .mdp

    application/octet-stream

    .me

    application/x-troff-me

    .mht

    message/rfc822

    .mhtml

    message/rfc822

    .mid

    audio/mid

    .midi

    audio/mid

    .mix

    application/octet-stream

    .mmf

    application/x-smaf

    .mno

    text/xml

    .mny

    application/x-msmoney

    .mov

    video/quicktime

    .movie

    video/x-sgi-movie

    .mp2

    video/mpeg

    .mp3

    audio/mpeg

    .mpa

    video/mpeg

    .mpe

    video/mpeg

    .mpeg

    video/mpeg

    .mpg

    video/mpeg

    .mpp

    application/vnd.ms-project

    .mpv2

    video/mpeg

    .ms

    application/x-troff-ms

    .msi

    application/octet-stream

    .mso

    application/octet-stream

    .mvb

    application/x-msmediaview

    .mvc

    application/x-miva-compiled

    .nc

    application/x-netcdf

    .nsc

    video/x-ms-asf

    .nws

    message/rfc822

    .ocx

    application/octet-stream

    .oda

    application/oda

    .odc

    text/x-ms-odc

    .ods

    application/oleobject

    .one

    application/onenote

    .onea

    application/onenote

    .onetoc

    application/onenote

    .onetoc2

    application/onenote

    .onetmp

    application/onenote

    .onepkg

    application/onenote

    .p10

    application/pkcs10

    .p12

    application/x-pkcs12

    .p7b

    application/x-pkcs7-certificates

    .p7c

    application/pkcs7-mime

    .p7m

    application/pkcs7-mime

    .p7r

    application/x-pkcs7-certreqresp

    .p7s

    application/pkcs7-signature

    .pbm

    image/x-portable-bitmap

    .pcx

    application/octet-stream

    .pcz

    application/octet-stream

    .pdf

    application/pdf

    .pfb

    application/octet-stream

    .pfm

    application/octet-stream

    .pfx

    application/x-pkcs12

    .pgm

    image/x-portable-graymap

    .pko

    application/vnd.ms-pki.pko

    .pma

    application/x-perfmon

    .pmc

    application/x-perfmon

    .pml

    application/x-perfmon

    .pmr

    application/x-perfmon

    .pmw

    application/x-perfmon

    .png

    image/png

    .pnm

    image/x-portable-anymap

    .pnz

    image/png

    .pot

    application/vnd.ms-powerpoint

    .potm

    application/vnd.ms-powerpoint.template.macroEnabled.12

    .potx

    application/vnd.openxmlformats-officedocument.presentationml.template

    .ppam

    application/vnd.ms-powerpoint.addin.macroEnabled.12

    .ppm

    image/x-portable-pixmap

    .pps

    application/vnd.ms-powerpoint

    .ppsm

    application/vnd.ms-powerpoint.slideshow.macroEnabled.12

    .ppsx

    application/vnd.openxmlformats-officedocument.presentationml.slideshow

    .ppt

    application/vnd.ms-powerpoint

    .pptm

    application/vnd.ms-powerpoint.presentation.macroEnabled.12

    .pptx

    application/vnd.openxmlformats-officedocument.presentationml.presentation

    .prf

    application/pics-rules

    .prm

    application/octet-stream

    .prx

    application/octet-stream

    .ps

    application/postscript

    .psd

    application/octet-stream

    .psm

    application/octet-stream

    .psp

    application/octet-stream

    .pub

    application/x-mspublisher

    .qt

    video/quicktime

    .qtl

    application/x-quicktimeplayer

    .qxd

    application/octet-stream

    .ra

    audio/x-pn-realaudio

    .ram

    audio/x-pn-realaudio

    .rar

    application/octet-stream

    .ras

    image/x-cmu-raster

    .rf

    image/vnd.rn-realflash

    .rgb

    image/x-rgb

    .rm

    application/vnd.rn-realmedia

    .rmi

    audio/mid

    .roff

    application/x-troff

    .rpm

    audio/x-pn-realaudio-plugin

    .rtf

    application/rtf

    .rtx

    text/richtext

    .scd

    application/x-msschedule

    .sct

    text/scriptlet

    .sea

    application/octet-stream

    .setpay

    application/set-payment-initiation

    .setreg

    application/set-registration-initiation

    .sgml

    text/sgml

    .sh

    application/x-sh

    .shar

    application/x-shar

    .sit

    application/x-stuffit

    .sldm

    application/vnd.ms-powerpoint.slide.macroEnabled.12

    .sldx

    application/vnd.openxmlformats-officedocument.presentationml.slide

    .smd

    audio/x-smd

    .smi

    application/octet-stream

    .smx

    audio/x-smd

    .smz

    audio/x-smd

    .snd

    audio/basic

    .snp

    application/octet-stream

    .spc

    application/x-pkcs7-certificates

    .spl

    application/futuresplash

    .src

    application/x-wais-source

    .ssm

    application/streamingmedia

    .sst

    application/vnd.ms-pki.certstore

    .stl

    application/vnd.ms-pki.stl

    .sv4cpio

    application/x-sv4cpio

    .sv4crc

    application/x-sv4crc

    .swf

    application/x-shockwave-flash

    .t

    application/x-troff

    .tar

    application/x-tar

    .tcl

    application/x-tcl

    .tex

    application/x-tex

    .texi

    application/x-texinfo

    .texinfo

    application/x-texinfo

    .tgz

    application/x-compressed

    .thmx

    application/vnd.ms-officetheme

    .thn

    application/octet-stream

    .tif

    image/tiff

    .tiff

    image/tiff

    .toc

    application/octet-stream

    .tr

    application/x-troff

    .trm

    application/x-msterminal

    .tsv

    text/tab-separated-values

    .ttf

    application/octet-stream

    .txt

    text/plain

    .u32

    application/octet-stream

    .uls

    text/iuls

    .ustar

    application/x-ustar

    .vbs

    text/vbscript

    .vcf

    text/x-vcard

    .vcs

    text/plain

    .vdx

    application/vnd.ms-visio.viewer

    .vml

    text/xml

    .vsd

    application/vnd.visio

    .vss

    application/vnd.visio

    .vst

    application/vnd.visio

    .vsto

    application/x-ms-vsto

    .vsw

    application/vnd.visio

    .vsx

    application/vnd.visio

    .vtx

    application/vnd.visio

    .wav

    audio/wav

    .wax

    audio/x-ms-wax

    .wbmp

    image/vnd.wap.wbmp

    .wcm

    application/vnd.ms-works

    .wdb

    application/vnd.ms-works

    .wks

    application/vnd.ms-works

    .wm

    video/x-ms-wm

    .wma

    audio/x-ms-wma

    .wmd

    application/x-ms-wmd

    .wmf

    application/x-msmetafile

    .wml

    text/vnd.wap.wml

    .wmlc

    application/vnd.wap.wmlc

    .wmls

    text/vnd.wap.wmlscript

    .wmlsc

    application/vnd.wap.wmlscriptc

    .wmp

    video/x-ms-wmp

    .wmv

    video/x-ms-wmv

    .wmx

    video/x-ms-wmx

    .wmz

    application/x-ms-wmz

    .wps

    application/vnd.ms-works

    .wri

    application/x-mswrite

    .wrl

    x-world/x-vrml

    .wrz

    x-world/x-vrml

    .wsdl

    text/xml

    .wvx

    video/x-ms-wvx

    .x

    application/directx

    .xaf

    x-world/x-vrml

    .xaml

    application/xaml+xml

    .xap

    application/x-silverlight-app

    .xbap

    application/x-ms-xbap

    .xbm

    image/x-xbitmap

    .xdr

    text/plain

    .xla

    application/vnd.ms-excel

    .xlam

    application/vnd.ms-excel.addin.macroEnabled.12

    .xlc

    application/vnd.ms-excel

    .xlm

    application/vnd.ms-excel

    .xls

    application/vnd.ms-excel

    .xlsb

    application/vnd.ms-excel.sheet.binary.macroEnabled.12

    .xlsm

    application/vnd.ms-excel.sheet.macroEnabled.12

    .xlsx

    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    .xlt

    application/vnd.ms-excel

    .xltm

    application/vnd.ms-excel.template.macroEnabled.12

    .xltx

    application/vnd.openxmlformats-officedocument.spreadsheetml.template

    .xlw

    application/vnd.ms-excel

    .xml

    text/xml

    .xof

    x-world/x-vrml

    .xpm

    image/x-xpixmap

    .xps

    application/vnd.ms-xpsdocument

    .xsd

    text/xml

    .xsf

    text/xml

    .xsl

    text/xml

    .xslt

    text/xml

    .xsn

    application/octet-stream

    .xtp

    application/octet-stream

    .xwd

    image/x-xwindowdump

    .z

    application/x-compress

    .zip

    application/x-zip-compressed

     

     

Page 1 of 1 (4 items)