Windows Phone Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 22 December 2007

Quick and Dirty JSON

Posted on 02:24 by Unknown

So you want to write a JSON service for your Silverlight application? Basically this entire thing is a giant hack. first JSON is just the string syntax for JavaScript so it is not like a real protocol of course I get a bit of heart burn calling 'SOAP' a real protocol but really a JavaScript array defintion being a 'protocol' you must admit is a bit of a stretch but ok I can go with it.
Anyway so quick a dirty in your 'Silverlight' web site project in visual studio you can create a JSON service out of any ASPX page. First 'create' your ASPX page. then remove everything so it looks like this:

< % @ Page Language="C#" AutoEventWireup="true" CodeFile="JSON.aspx.cs" Inherits="JSON" % >
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JSON.aspx.cs" Inherits="JSON" %>


note that 'JSON' is just what I happened to call this page.
so then just right click on the page and click view code. You'll see that you have basically one method 'Page_Load'. here basically we just need to write out whatever it is we need in the form of a javascript array. So for example here is a very simple one:

StringBuilder JSON = new StringBuilder();

string ItemDelimter = string.Empty;

JSON.Append(ItemDelimter + "\"1\" : \"john doe\" ");

ItemDelimter = " , ";

JSON.Append(ItemDelimter + "\"2\" : \"jill doe\" ");

JSON.Append(ItemDelimter + "\"3\" : \"jane doe\" ");

JSON.Append(ItemDelimter + "\"4\" : \"jared doe\" ");

JSON.Append(ItemDelimter + "\"5\" : \"jeff doe\" ");

Response.Write("[ { " + JSON.ToString() + " } ] ");

Response.End();

Note that you'll need to add System.Text for the above code but you can basically generate the out put anyway you want and accept input parameters as query string values.

Read More
Posted in .net, c#, json, silverlight | No comments

Full Length Movie Vie Silverlight

Posted on 02:19 by Unknown
I'm ashamed to admit that I contributed in any way to this project... mind you I liked the Movielink team but the content is really really offesive in my opinion but the fact is that this is the first full length feature streamed via Silverlight to the masses. The player itself is straight forward and we un covered a few issues on the mac apprently in the underlying media stack in Silverlight but none the less a bug where about half way through the movie the sounds slowly gets upto a second off from the video... otherwise it works great :) if you must, you can check it out at:

http://blockbuster.jackassworld.com/
Read More
Posted in andrew, devin, identitymine, jared, jason cook, jordan, movie link, player, silverlight, testing | No comments

Friday, 14 December 2007

Testing for version of Silverlight

Posted on 15:50 by Unknown
I was asked recently to about testing the version of silverlight on a project that only would support Silverlight 1.0. silverlight actually supports a method for doing just that and the complete documentation is online. That being the case however here is how todo it:

if( Silverlight.isInstalled("1.1") )
{
// do something.
}
else
{
// or not
}

or you could pass in '1.0' and the method returns true or false. Personally if this is an issue and you really need todo something other then run the silverlight install badge I would drop this into the initialization function your using.
Read More
Posted in javascript, silverlight | No comments

Monday, 10 December 2007

BufferingTime Breaks Blend...

Posted on 15:01 by Unknown
Ok, So Silverlight 1.0 is supposed to be out in the wild now and Expression Blend is like the coolest tool available for working with Silverlight Xaml especially if your a designer it gives you WYSIWYG and code. But alas having all of Silverlight actually not break Blend appears to be a bit unreasonable of an expectation still... not that I'm whinning but it seems that on a media element if you try to set the 'BufferingTime' property Blend will puke. According to the documentation this is defaulted to 5 seconds and the Silverlight Teams says that Silverlight try's to make an intelligent decision about this but if you actually try to tweak it your self as per the documentation it doesn't seem to do anything and blend blows up...
Read More
Posted in blend, silverlight, xaml | No comments

Wednesday, 5 December 2007

Silverlight Performance Testing

Posted on 15:22 by Unknown
So it seems that alot of shops I run into as of late seem not to have done stress testing before... I know that this can't be the case normally but just in case I thought I would post something about pref testing silverlight.

With regard to Silverlight we need to break out pref into two areas. The abiltiy of the hosting infrastructure to server up component parts and do server side processing and then the how well the 'clientside' Silverlight application performs locally on any given client and browser combination. In most cases there would never ever be more then one instance of the application running side by side on any given client.

To do stress testing you can download something free like the MS Stress tool and record some nice test scripts and have a go at your server. Basically your hitting the box, filling informs and or clicking on links and the like and the tool uses that to simulate what your are doing but much faster to the point of failure on the server.

You can download the MS Stress Tool at:

http://www.microsoft.com/downloads/details.aspx?FamilyID=E2C0585A-062A-439E-A67D-75A89AA36495&displaylang=en

but there are a number of other tools such as :

http://jakarta.apache.org/jmeter/

that basically do the same thing.

Anyway when it comes to testing the client it is a matter of having a Mac and PC and all the browsers installed and then opening it up and testing everything. If the silverlight application is following the best practices such as those listed in the last post then it should be good and you can track down anything else on individual testing.

With that you should be armed to start doing some Silverlight perf testing.
Read More
Posted in browser, issues, silverlight, testing | No comments

Monday, 3 December 2007

Silverlight Best Practices

Posted on 22:49 by Unknown
So in a web application from time immemorial the bottle necks have been the database access and the ability of the servers to server up whatever it is that is supposed to be servered. Granted there are things todo or not todo in Silverlight that affect usability and clientside perf but really its all about the server. For the most part the biggest 'gotcha' is usually making sure you are supporting the Xaml mime type and having reasonable archicture to support the expected load. All that aside there are some things you should avoid.

A-sync calls via Ajax or whatever are your friend. Why hold up the users experience to log something if you can just fire and forget. This will provide smoother and a more seamless experience for the user.

Use some reasonable coding conventions. It is more important to be consistent then wither or not to use Hungarian notation. Personally I like my script to look pretty much like my C# .NET code. That and considering main customer demographic of the clients of the company I work for... I'm feel safer using some nice stricked super OCD coding standard.

To keep the browser experience as uniform as possible among browsers it is a good idea to not todo things with the HTML DOM if possible and push things like timers etc into Silverlight.

In Xaml... don't stretch paths and videos. especially videos.

User techniques that simplify your code for example using a trinary operator.

In JavaScript use the prototype object declaration instead of writting a specific class. Object declared like this will be only maintain one reference in the global look up for the script engine nomatter how many instances are created. This way everyone is pointed at one base class instead of complete instances of every class N times.

If you drag and droping set none targets to IsHitTestable=false

dont dynamically add a bunch of stuff to the visual tree and leave it there if you not using it.

don't use windowless mode if you don't have to and if you do turn it off when not needed.
Read More
Posted in javascript, silverlight | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • Silverlight Streaming in 5 minutes or less
    Microsoft as part of the whole Silverlight ‘thing’ has provided a service to allow people to upload videos and get those video streamed alon...
  • Silverlight Applications Taking All the Available Realestate
    Karim sent me this. It is a simple way make sure you Silverlight Application uses all the available realestate using just CSS: /*...
  • Silverlight TV Episode 3: Multi-Touch 101 with Silverlight
    John interviews Silverlight MVP David Kelley (thats me) about developing multi-touch applications in Silverlight. I discuss the types of mul...
  • Dependency Injection Made Easy
    Part of the whole fun with doing 'ard'd samples is just the fun of doing something not quit PC but the bottom line really is doing c...
  • Silverlight Preloader animation is the answer
    I got this email today: Hi! In our project we call a function which retrieves a data from a webservice. This function takes some time 1-3 se...
  • Silverlight 2 Event bindings
    So in the process of working on this presentation for dev teach and the article and the book I got in a long discussion with alot of the ubb...
  • Windows Phone 7 Development Using Visual Studio 2010
    with David Kelley and AppDev Windows Phone 7 is a new step for Microsoft for the mobile platform. This course will introduce the mobile OS a...
  • Dictionary Definition of Xaml (verb and noun)
    A friend 'Ariel' from www.facingblend.com did a short post about Xaml being a verb. I've heard this a few times and thought th...
  • More on Panels
    I was playing around and made a few more panels. Lets start with a random panel. This panel builds on what we learned about the animating ...
  • No Soap for you! - The No Silverlight Experience
    So I'm collecting hacks for my upcoming book, and I must say, here is a simple one, but one of my favorites... LOL! On my HackingSilver...

Categories

  • .net
  • 3D
  • adam
  • adcontrol
  • adobe
  • agile
  • algorithms
  • analytics
  • andrew
  • android
  • Animating Panel Base
  • animation
  • apache
  • apphub
  • apple
  • apps
  • architecture
  • ariel
  • article
  • ASP.NET
  • balder
  • bar camp
  • behavior
  • best practices
  • beta 1
  • beta 2
  • bi
  • bitmap effect
  • blend
  • blendables
  • blog
  • book
  • book review
  • bookreview
  • browser
  • brush
  • build
  • c#
  • channel9
  • cmm
  • codebrowser
  • codemagazine
  • codemash
  • codeplex
  • color
  • com
  • command
  • composite
  • controls
  • Craig
  • crossfader
  • csharp
  • CSS
  • custom event
  • Dan
  • data
  • datagrid
  • davidjkelley
  • davidkelley
  • ddj
  • Deep Zoom
  • dependencyproperty
  • design
  • design patterns
  • designers
  • devconnections
  • developer
  • developers
  • devin
  • DevTeach
  • dispatcher
  • dotnetslackers
  • dp
  • Dr WPF
  • easy
  • eclipse
  • ecma
  • education
  • einari
  • ET
  • event
  • exchange
  • expression
  • facebook
  • facing blend
  • Faisal
  • firestarter
  • flash
  • flex
  • font
  • free
  • fun
  • futures
  • gadget
  • game
  • games
  • gesture
  • google
  • Grid
  • hack
  • hacking
  • hacking phone 7
  • Hacking Silverlight
  • hard
  • hero
  • holst
  • howto
  • hta
  • HTML
  • html5
  • HTMLAppHostFramework
  • htmlapplication
  • ia
  • identitymine
  • IE
  • IE 8
  • iis
  • images
  • indexability
  • INETA
  • Infragistics
  • Integrator
  • interact
  • iphone
  • isolatedstorage
  • issues
  • itemscontrol
  • ixda
  • jared
  • jason cook
  • javascript
  • jeremiah
  • jobi
  • jobs
  • johnpapa
  • jordan
  • josh
  • jscript
  • json
  • Karim
  • kaxaml
  • kellywhite
  • keynote
  • KimSchmidt
  • law of
  • layout
  • linux
  • listbox
  • LOB
  • mac
  • mango
  • manning
  • marketing
  • marketplace
  • math
  • media element
  • media encoder
  • methodology
  • microsoft
  • MIX
  • MIXer
  • mobile
  • monitization
  • monitizationmodels
  • movie link
  • MSDN
  • msdnbytes
  • msdnradio
  • msretail
  • mstag
  • multitouch
  • MVP
  • MVVM
  • Netflix
  • nike
  • nui
  • object oriented
  • OOB
  • out of browser
  • packt
  • panels
  • parchment
  • parchment apps
  • paths
  • PDC
  • peter
  • phone7
  • phone7unleashed
  • phones
  • php
  • Pixel8
  • pixelshader
  • player
  • popfly
  • prediction
  • preemptive
  • preloader
  • presentations
  • radial panel
  • random panel
  • reference
  • requirements
  • retail
  • review
  • ria
  • robby
  • ROI
  • RPS
  • ryan
  • sajiv thomas
  • SCRUM
  • SD2IG
  • Sea Dragon
  • searchability
  • seattle
  • seattlesilverlight
  • seattleslug
  • sebastian
  • services
  • sharepoint
  • sharepoint2010
  • sic
  • side bar gadget
  • Silver Dragon
  • silverlight
  • silverlight 1
  • silverlight 2
  • silverlight 2.0
  • silverlight 3
  • silverlight 4
  • silverlight insiders
  • silverlight show
  • silverlight4
  • silverlight5
  • Silverlight5
  • silverlightconnections
  • silverlightcream
  • silverlighttv
  • simon
  • simonsaid
  • simple
  • SMART
  • snack
  • stackpanel
  • stevejobs
  • streaming
  • stuartcelarier
  • surface
  • symbian
  • tard
  • teched
  • TED
  • testing
  • textbox
  • TFS
  • threading
  • tim
  • tip
  • tiredallover
  • tool
  • touch
  • touchtag
  • training
  • twitter
  • ui
  • uml
  • usergroup
  • UX
  • uxdesign
  • vagas
  • victor
  • video
  • videos
  • vista
  • visual studio
  • volta
  • VS
  • vsm
  • WCF
  • win8
  • Windows7
  • windows8
  • windowsphone
  • windowsphone7
  • wirestone
  • workflow
  • wp7
  • wp7dev
  • WPF
  • wrappanel
  • wrox
  • xaml
  • xap
  • XML
  • xna
  • zen
  • zphone

Blog Archive

  • ►  2012 (5)
    • ►  May (1)
    • ►  April (2)
    • ►  March (1)
    • ►  February (1)
  • ►  2011 (29)
    • ►  December (2)
    • ►  November (2)
    • ►  October (3)
    • ►  September (1)
    • ►  August (5)
    • ►  June (5)
    • ►  May (2)
    • ►  March (1)
    • ►  February (5)
    • ►  January (3)
  • ►  2010 (51)
    • ►  December (5)
    • ►  November (4)
    • ►  October (3)
    • ►  September (5)
    • ►  August (3)
    • ►  June (3)
    • ►  May (6)
    • ►  April (3)
    • ►  March (9)
    • ►  February (3)
    • ►  January (7)
  • ►  2009 (75)
    • ►  December (3)
    • ►  November (2)
    • ►  October (3)
    • ►  September (7)
    • ►  August (4)
    • ►  July (7)
    • ►  June (9)
    • ►  May (12)
    • ►  April (13)
    • ►  March (8)
    • ►  February (2)
    • ►  January (5)
  • ►  2008 (119)
    • ►  December (8)
    • ►  November (10)
    • ►  October (12)
    • ►  September (10)
    • ►  August (11)
    • ►  July (4)
    • ►  June (10)
    • ►  May (5)
    • ►  April (3)
    • ►  March (11)
    • ►  February (8)
    • ►  January (27)
  • ▼  2007 (34)
    • ▼  December (6)
      • Quick and Dirty JSON
      • Full Length Movie Vie Silverlight
      • Testing for version of Silverlight
      • BufferingTime Breaks Blend...
      • Silverlight Performance Testing
      • Silverlight Best Practices
    • ►  November (11)
    • ►  October (17)
Powered by Blogger.

About Me

Unknown
View my complete profile