A new Brand Silverlight contest – Ball Watch Silverlight Contest June 8, 2010
Posted by Jose Luis Latorre Millas in Silverlight.1 comment so far
Hey, we love contests and Microsoft knows that. Oh yeah!
What could be better for Silverlight developers & designers than to sharpen their skills while learning the newest tool on the town for showing off their skills… with the goal of winning a fabulous Watch that silently says “Hey I’m a great Silverlight professional” don’t you think that would be great?
The prize watch is the following one, the Engineer Hydrocarbon TMT Watch (retail value $3,399 – wow!)
.jpg)
Well, Microsoft has offered the market this great contest, which you can learn more here http://expression.microsoft.com/es-es/ff714455%28en-us%29.aspx?ocid=ballwatch-ms and here: http://expression.microsoft.com/es-es/ff723792%28en-us%29.aspx.
The only think I’d like to ask is if you could open this contest overseas, I love to participate in contests and I know you respond to feedback
.
So, would you kindly mind making this contest global?
Thanks from the Sunny western-European sunny Spain
!!
Project3DToMouse, a mouse powered 3D projection behavior June 3, 2010
Posted by Jose Luis Latorre Millas in 3D, Silverlight.add a comment
Behaviors were a great addition for Silverlight 3 and just have become better for Silverlight 4. One of my playgrounds at home have been Projection animation experiments for providing advanced – or crazy – interactions and effects… The main thing is this is not simple to implement and it’s hard to let it be “fine tuned” by a designer or even by yourself, as who wants to recode everything if you can get a great interface for personalizing your effects without much effort?
Thus I’ve made the 3D projection to mouse behavior.
You can try it out here:
http://www.brainsiders.com/playground/Project3DToMouse/default.html
What does it do?
- It animates a the projection of a FrameworkElement on the X and Y axis in the proportion of the position of the mouse regarding another FrameworkElement, normally the main Canvas, LayoutRoot.
- It calculates the projection and applies it with certain amplitude degrees for the X and Y axis. Why not only one amplitude? because you might want your content not to turn the same degrees horizontally as it does vertically, screens aren’t squared and maybe you want a concrete effect (only horizontal, or only vertical).
- Also, it does this as an animation on a configurable time and on a configurable EasingFunction, which is good for a designer, so you can make it move smoothly or in a funny elastic way
. - I have set up a flag to decide if you want to make the orientation of the projection towards the mouse, facing it or against it.
- It also has a nice animation to go back to the starting position if the mouse gets out of the application.
Going to the code, everything is categorized and with descriptions to help it being used, adapts well to FrameworkElements that have a fixed or dynamic height and width and the storyboard is generated on the go in memory so it is not possible to step over other animation, this meaning that this behavior can be applied to more than one element in the same UserControl.
The wiring up is done on the OnAttached and OnDetaching events, the Invoke does nothing so it could be deleted.. I have used the TargetedTriggerAction because I need the pick up the behavior from a control that takes the whole screen and apply the projection effect to another control, preferably smaller to appreciate the effect. It would be good if we could deactivate the “invoke” so that designers would not get confused.. just my 5 cents..
On how to use it, this is easy, copy the Project2Mouse.cs file to your project and that’s it. At least it is easy for a developer, for a designer it would be cool if we could configure a behaviors folder and leave there all the behaviors encapsulated as “dll”, so Blend would load and show up the behaviors blend has, the ones on the project and the ones at the folder… then it would add references as needed at the project.
Other thing I am finding difficult is that the current Behaviors interface is good for having 10 to 20 Behaviors, it turns difficult to locate quickly a behavior. It would be good if they could be categorized or tagged (author, description, category and tags (1 .. n would be great).
To get it, it is published at the Microsoft Expression Behaviors Gallery, here: http://gallery.expression.microsoft.com/en-us/Project3DToMouse
I am thinking on publishing some other interaction behaviors – after cleaning a bit the mess that happens when playing with different behaviors until you get the desired effect, that is..
If you happen to have an idea of an interesting behavior I’d be happy to hear it and try to implement it
.
New Themes launched for Silverlight 4 – This is great but… is enough? May 31, 2010
Posted by Jose Luis Latorre Millas in Silverlight.2 comments
Recently Tim Heuer has launched several “themes” for Silverlight, you can read about them in http://timheuer.com/blog/archive/2010/05/03/new-silverlight-4-themes-available-for-download.aspx and http://timheuer.com/blog/archive/2010/05/17/silverlight-4-tools-released-and-new-application-templates.aspx.
This announcement has been done along with the launch of the Silverlight tools for Visual Studio 2010. Although this news was overwhelmed by the tools announcement, I think is very interesting since they are defining (or at least proposing) a standard for the definition of a complete theme structure for Silverllight …
We have been expecting a sample like this, because it is shows clearly the purpose of Silverlight & WPF for separating the Designer and Developer concerns and enables to showcase Blend as an efficient designer tool: Disconnect the interaction between the designer and on the part associated with the developer.
This separation of concerns was improved greatly with the appearance of behaviors in Blend 3.0 and Silverlight and now is better with improved support for Blend 4.0 (beta) and SL 4.0.
For now, the way to “handle” all this themes is to manually place a series of files in a folder of “Assets” which if done right includes various styles files, resource libraries, behaviors – see http://storage.timheuer .com/newthemes-structure1.png for a clearer picture – also this themes can incorporate any Font, image or video, according to the style in question.
This in itself is rather large achievement as we can decouple the interaction of styles and is relatively simple …. for a Developer … for a “pure” designer this is complex and costs understanding and concentration…
I am proposing an evolution of this already great proposal, to make it greater..this is to further simplify the interaction model for the themes which enables to create and work on them separately, uncoupling them from the application, assigning them its own “theme” project type, like “cosmopolitan.theme.dll” wich is nothing else than a Silverlight class library with a assigned dll.
This way, a designer can create a theme library like “Cosmopolitan.theme.dll”and the application can change the theme at any time using the theme dll without the need of having to delete files of styles, behaviors, images, fonts, etc … (which costs time and is prone to errors).
This also enables to have several associated themes and change them as we want through code or, better, a behavior.
There are some clear advantages of my proposal:
- The designer can abstract from the complexity of the application and focus only on the design of the theme and its styles.
- The designer avoids touching any code sensitive for the developer, even accidentally – favoring the separation and decoupling.
- We favor a potential marketplace for “themes” for Silverlight. If I want to sell themes, it would be good that the technology supports them as separate beings.
- Promotes the theme reuse for creating other themes, thus stimulating creativity and competitiveness “between designers (and also some developers).
- It will make very visible at last the advantage of Blend and Silverlight to fully decouple the visual aspect and interaction with the application development. (Very necessary).
On the other hand is very easy to set up a generic test project in which multiple pages are displayed that showcases all controls, SL controls, SDK controls, graphics, Toolkit controls as well as it would be easy to add our own controls dynamically. .. This would make wonderfully simple for the designer to test his theme very easily…
And, as a firm petition, this would be fantastic if this was enabled into Silvelright and it integrated on Blend
On the other hand, the type of proposed type of dll “theme.dll” is that of a normal Silverlight class library, it would be easy to make a “base template project” with implementations of all controls by default. This would mean to only change or add a template to these themes dll’s… and modify the existing ones to allow dynamic loading and unloading based directory Assets, for instance). MEF we would allow to do this very easily ..
How do you see this? If you think this is a good idea, please vote for it on the Silverlight feature request! Let’s help everybody to make this technology a huge success!
The link to vote : http://dotnet.uservoice.com/forums/4325-silverlight-feature-suggestions/suggestions/793999-support-for-theme-projects-dynamic-theme-switchi
Or suggest how would you focus this? I am eager to read your suggestions and construct together what would be the best implementation for a native theme support for Silverlight.
Slides & Code from SL4BIZ, thanks BDNug! May 24, 2010
Posted by Jose Luis Latorre Millas in Uncategorized.add a comment
Hi,
Here are the slides and codes from past Thursday presentation at the Bartlesville NET User Group, I was honored to join you at your past meeting
.
Sadly it was a virtual event so I could not enjoy the free lunch nor participate in a more direct way, which is something you loose for the extremely reduced travel costs that Live Meeting brings on to all .NET user’s group!
Thanks Ankesh for organizing it so amazingly and thanks to everybody that assisted, being heard is a big thing.
The slides are here and the code is here. Have fun and please answer to this post if there is any issue with this.
Have fun!
MIX 10K Entry Techniques for reducing Silverlight code and XAML size February 10, 2010
Posted by Jose Luis Latorre Millas in Silverlight, Uncategorized.Tags: 10k, community, compress code, entry, inverse kinematics, magnifier, MIX, MIX10k, parallax, Silverlight, silverlight compression
3 comments
Preface…
As commented here are the full techniques I have applied for reducing the size of my MIX 10K entry, the “Silverlight Magic Lantern”, which can be found at the url http://mix10k.visitmix.com/Entry/Details/261.
The main basis of my entry was “to surprise” and that’s not easy being this the MIX Conference & MIX Online assistants a mix of Designers and Developers, some 100% developers, others 100% Designers and some rare cases 50% each – or even more rare cases 60 to 70% each…
As for my entry to comment that it has tried to combine both wow factors, having coded in less than 10kb the following techniques:
- Bing search engine integration through REST.
- Usercontrol creation (for the knob) in very very small piece of code..
- Inverse kinematics programming – which btw I had never done before J. I’d like to thank Jeff Paries for his great book which covers some techniques on the matter… Btw, I bought the Flash Book as I did not know that there was a Silverlight one J. Now I have both.. you can get it here http://www.amazon.com/Foundation-Silverlight-Animation-Jeff-Paries/dp/143022407X – with no commission
- Magnifier effect – which was done initially with a shader (way cooler) and next with a writable bitmap in order to weigh less bytes L.
- Position the magnifier exactly where the inverse kinematics extreme was – that is no easy, believe me..
- Parallax effect with inverse-moving shadows, to provide a depth effect from the main front panel to the results at the back – At the end I had to take out the shadows in order to get more space available… L
Also I wanted to surprise graphically so I had the idea of enabling “skin interchange” but, sadly I had to take it out and let only one skin in place.. the nicest one of course… anyway it was way simple as it required only changing the source of the 6 images my entry uses… and it was implemented through a knob too
.
Both of that got me the edge (I hope so at least) of being able to surprise both Designers and Developers.. and hopefully the Judges too – Anyway there are pretty good entries this year so, the best one will win!!! Good Luck to you all!!
Aaand… I will release the code (the one that is not fully compressed) in short so keep tuned…
The Techniques…
As, for the main topic of this post, the techniques used to reduce code size have been, in order of precedence:
1. Common sense à Taking out code not used, comments, blank lines, etc.
2. Use of Var if the type name declaration is bigger…
3. In some cases use global variables so they haven’t got to be declared over and over. I had to do some metrics to see how much I was using an int variable to see how much space it was taking and declare it globally. Not the thing you do in your everyday code..
4. Use Inline if’s instead of normal if’s.
5. If you apply a compare rule more than once, package it in a Boolean
:
If you have:
If ((a ==b) &&( c!=z))&….
And
If ((a ==b) &&( c!=z))&….
You can do
G = ((a ==b) &&( c!=z))
And make
If (G & … everywhere else..
6. Change constants defined by its direct value that is depending on the length of its value and its use, obviously.
7. Reduce functions using anonymous functions. For example:
nextSegment.MouseLeftButtonUp += new MouseButtonEventHandler(nextSegment_MouseLeftButtonUp);
void nextSegment_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { zoomActivated = false; }
Can be converted into:
nextSegment.MouseLeftButtonUp += delegate(object s, MouseButtonEventArgs e){ zoomActivated = false; };
8. Use Object & Collection Initializers, like:
ksi.go(new List<string>() { “Small”, “Medium”, “Large” }, “Size”);
9. Reduce functions size c hanging the default parameters sender by s for example, as the previous code piece.
10. Reduce the use of the usings, that is easily done by deleting/commenting them all and resolve all the dependencies manually.
11. Use Alias on the usings, but be careful, be aware this is only necessary in the case you have to write the entire namespace path in case of conflicts with a declaration of the same name.
12. Subclass a class you are using with just the signature – I did end up not using this as it was not worth it.
13. Reduce the use of XAML files – for example, app.xaml is not really needed.
14. Reduce app.xaml.cs size -à most of its code can be greatly reduced. Mine ended looking like this:
public class App : Application
{
public App()
{
StartupEventHandler ha = null;
if (ha == null)
{
ha = delegate(object s, StartupEventArgs e)
{
base.RootVisual = new mh();
};
}
base.Startup += ha;
}
}
15. Minimize XAML Code: there is a lot of code that Blend adds and it is not necessary, there is also a lot of code pieces that are set up but also are default so taking them out does not affect the render.
16. Refactor the variable names, function names, and all the other names! I recommend that this is done first in a 3 to 6 length name so it still has some meaning – at the end you can refactor that to only 1 or 2 characters if needed… So you can touch the code with full understanding of what you have coded J.
17. Use only one – C# file
– that will help reduce even more the use of the usings & also the own size of the extra files usage. This will reduce the namespace definition and usage to only one.
18. As the final step I compressed the code, I coded a simple tool that took a file and got all the whitespaces, carriage returns, etc.. it’s about 3 to 6 hours coding something like that.
Other ideas..
Other ideas I had but did not use but I think it’s cool to mention them
:
1. Compressing the XAML
Compress the xaml (zip it) and uncompress it in runtime and render it over user control placeholders. As Silverlight comes with a compress/decompress utility the code needed for this is really small! I even looked up for the best way to do this (check this great post: http://www.sharpgis.net/post/2009/04/21/REALLY-small-unzip-utility-for-Silverlight.aspx) but the point is that I have to do whatever the “Initialize component does”. In my case is this:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri(“/bml;component/IKSegment.xaml”, System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Canvas)(this.FindName(“LayoutRoot”)));
this.ScaleSegment = ((System.Windows.Media.ScaleTransform)(this.FindName(“ScaleSegment”)));
this.RotateSegment = ((System.Windows.Media.RotateTransform)(this.FindName(“RotateSegment”)));
this.IKSegmentImage = ((System.Windows.Controls.Image)(this.FindName(“IKSegmentImage”)));
this.brazo = ((System.Windows.Controls.Image)(this.FindName(“brazo”)));
}
Which is not small code and it is unclear that this will end up giving me the edge…
That technique is only for xaml intensive applications… but will keep this for next year’s MIX 10K
.
1. Compressing different CODE pieces and compiling/running it “on the go”
Other technique I put my eye on was to have code zipped and unzip and make it run on the client but… it just can’t be done L it needs to travel back to the server, be compiled and returned to the client, then attached and et voila! It lives! This way would make the application to atone with the rules as all the code used would be in the XAP file – it just will be transferred to the server, compiled and returned back as an assembly J. I explored this for my Magnifier Tool but ended up not using this as there was no time and still had some “basic code compression” techniques to try out.
Anyway if you are interested, this is the best reference I found on how to apply this technique: http://nokola.com/TryCSharp/ Thanks Nokola!
At the end..
Hope you enjoyed the article, if you liked it I’d like to get your feedback, maybe with a comment? J
Thanks for reading!!
Dynamic Backgrounds October 23, 2009
Posted by Jose Luis Latorre Millas in Silverlight, Uncategorized.add a comment
As this is a era of new user experiences, I’ve created a codeplex project to gather different user experience experiments with the target of offering an interactive background to the user, one that interacts with his mouse movements and enhances the experience without being too captivating not to get the user’s attentino for the whole website experience..
The main idea of this project is to keep adding clear implementation of these background techniques. By now there is only one which is a parallax multi-layer background that allows us to provide different elements across multiple randomly dynamically generated layers, it moves the layers more or less depending on how far away they are from the monitor so it provides a interesting depth feeling.
I used this for the Inetians contest and also other websites, some of them did not see the light
– it was a 2nd silverlight contest in the shape of http://silverlightchallenge.eu/ but this time for the world, but the bad timing (the crysis) helped it not to become a reality… now we’re flooeded by contests so it doesn’t make sense – if you think it would make sense having a worldwide contest and make a big buzz, just let me know as this is a matter of looking for sponsors… everything else is written down
– you can get a glimpse here http://silverlightchallenge.ineta.org/ but I do not assure it will be working tomorrow, I’ve advised… please take in account it’s a work in progress and left unattended.. my apologies for that
There is other site that is using this approach in an evolved way, with more powerful algorythms with a star theme, with randonmly generated star shapes and a better mouse-driven animation, but it’s still to be finished and published
– I can’t talk!!! or some company that starts with “M” and ends with “t” will cut my tongue or worse…
Please, download the code and let me know what do you think… it is hosted at codeplex; http://dynamicbackgrounds.codeplex.com/
Have fun
INETIANS 10k entry – code released :) October 23, 2009
Posted by Jose Luis Latorre Millas in INETA, INETA Europe, Silverlight, Silverlight Streaming, Windows Live.add a comment
Well it took some time but I have published the full source code of my Mix 10k entry http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0138.

It comes from some background experiments with parallax, inspired in old age video games and an interesting entry from Jose Fajardo, http://www.cynergysystems.com/blogs/page/josefajardo?entry=what_a_beautiful_thou_distracting in which he introduced a very interesting parallax background effect that I tried to emulate and make it a bit toolable - a codeplex project for this background system is on its way
.
You can get the code here: http://inetians.codeplex.com/
Have fun!
Slides and demos of my talk at KulenDayz.. June 23, 2009
Posted by Jose Luis Latorre Millas in INETA, INETA Europe, Silverlight, Uncategorized.Tags: community, event, microsoft, speaker, talk
add a comment
Thank you KulenDayz!
I am very thankful to have went to the famous european Event KulenDayz, name that comes with the game of mixing Cool Days and the famous “Kulen”, a great famous spicy food which is also, the logo of the event, which can be seen next:
There I was very happy to be able to provide an introduction to the new Silverlight version, 3.0, which will see the light in short time, the 10th of July.
As promised, here are my slides and the demos I showcased there. Note that I took off the videos in order to make the demos as small as possible.
I’ll be glad to answer any question regarding the slides or the demos.
And, as for the event, I’ll try to make a post in short, but, for now, here are some images I took there: http://www.flickr.com/photos/joslat/sets/72157619870531664/
Hope you enjoyed the session
www.houssesandcovers.com is live :) March 23, 2009
Posted by Jose Luis Latorre Millas in Silverlight, website.add a comment
And it’s a new brand Silverlight 2.0 only website ..
Only to share this simple website that I have done completely with Silverlight 2.0, http://www.houssesandcovers.com/
On it I have used some very interesting open source libraries, AgTweener (http://agtweener.codeplex.com/), nice library for implementing animations and ARLayout (http://arlayout.codeplex.com/) this is to make the layout absolutely adaptable and resizeable to the browser’s size - Try to change the browsers size and see what I mean -
Also, I’ve used some snippets of code from very interesting sites, making a special mention to the samples from Terence Tsang’s Shinedraw website (see http://www.shinedraw.com/), and also some example from the Silverlight Gallery which I have adapted for doing the image gallery.
The design is also mine, so feel free to make recommendations and suggestions..
Inetians live! February 5, 2009
Posted by Jose Luis Latorre Millas in Uncategorized.add a comment
Well my Mix 10k entry has been recently published at the website of the MIX online
, and you can see it live here: http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0138.

It comes from some background experiments with parallax, inspired in old age video games and an interesting entry from Jose Fajardo, http://www.cynergysystems.com/blogs/page/josefajardo?entry=what_a_beautiful_thou_distracting in which he introduced a very interesting background effect that I tried to emulate and make it a bit toolable - a codeplex project for this background system is on its way
.
Also I wanted not only to create static background items but , why not, live elements that seem to be alive and at different levels, giving some Experience to the users of the website.
As I was developing the Background system of the coming Global INETA Silverlight Challenge, between other components of the same, I used the Inetians image as background so the evolution was clear.
I added a Silverlight user control “Inetian” with a random vector direction with a Max speed, then a control for not going out of the visible area, and some features, some of them were women, some men, they have a lifespan and when they get over 18 if they found some Inetians nearby of opposite sex, they do reproduce
and new Inetians are born…
I also put a cap on how much Inetians could be represented at once, and that is applied to the reproduction moment, so you can see it as a population regulation – sorry for that – but believe me, your screen and cpu will thank you ![]()
Also they are rendered in different layers, providing – at least initially - a cool 3D parallax effect.
There are some interesting things I would have loved to add, but did not have the time or the 10k limit pushed me into not implementing them:
-
Make them disperse naturally – everybody needs their vital space.
-
Add “Food” elements, with their lifespan and regulate the behaviour of Inetians between “wandering around”, “flirting” and “eating”.
-
Add the capability of moving between layers, up and down, depending of the food and flirting needs.
-
Add the capability of Dragging and dropping the inetians at the top layer . You can help the community!!! Just put an inetian near food or other inetian of different sex!
-
Add them functionality to their eyes… so they will look their “target”, being it the Inetian they have fallen in love with or the food they want to eat…
-
Make them aware of the cursor, if there is a cursor near them, make them look at it with fear (or not).
-
Adding them animations for changing state, eating, flirting, moving from layers, being dragged, etc..
If you have more ideas, do not hesitate to propose them or contact me
In short I will publish this as a codeplex project and add whoever thinks this “live background” idea is cool and will be happy to have some help with this.
Also, if you think the idea is original, I’ll be happy to get a comment on http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0138 and if you want to vote for my entry, I might end up getting the community prize.
By the way, if won, all the community prize will be given completely to INETA Europe…
Thanks!!
Jose


