tag:blogger.com,1999:blog-226468612024-03-12T19:40:31.620-06:00Miguel MaderoMiguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.comBlogger135125tag:blogger.com,1999:blog-22646861.post-73250565852161740842009-10-26T08:19:00.001-06:002009-10-26T08:19:21.962-06:00SDDN Sydney November Meeting<p> </p> <p><strong><font color="#ff0000">[NOTE: From now on, we will be publishing all Sydney SDDN info on </font><a href="http://sydney.sddn.org.au"><font color="#ff0000">http://sydney.sddn.org.au</font></a><font color="#ff0000">, please subscribe to the RSS. Starting next month I’ll stop publishing announcements on my blog] </font></strong></p> <p>For this month, Justin King will be speaking about RIA Services and Miguel Madero will talk about different Testing Approaches for Silverlight Applications.</p> <p>As usual we will meet the first Tuesday of the month at the Crown Hotel (<a href="http://maps.google.com/maps?f=q&hl=en&q=162+Elizabeth+Street,+Sydney,+Australia&ie=UTF8&hq=&hnear=162+Elizabeth+St,+Sydney+NSW+2000,+Australia&z=16&iwloc=A" target="_blank">map</a>) in 162 Elizabeth Street at 6:00 pm to get some dinner and start the discussion followed by the talks at 6:30 pm. </p> <p>Please <a href="http://www.facebook.com/home.php#/event.php?eid=161975808061&ref=mf" target="_blank">RSVP</a> on Facebook.</p> <p><b>.NET RIA Services – Building Data Driven applications in Silverlight 3</b></p> <p>Learn how Microsoft is simplifying the traditional n-tier application pattern by bringing together <a href="http://ASP.NET">ASP.NET</a> and Silverlight. See the new application framework that removes some of the complexity for connecting to your data layer and see patterns for working with data, implementing reusable and independently testable application logic, ease of client side validation and  see how this relates to other patterns such as MVVM. We are sure this will lead to lots of architecture debates and pros/cons of this framework.</p> <p><b>Testing in Silverlight</b> </p> <p>At first sight it looks like we don’t have a lot of options to test Silverlight Applications. Although it’s not an easy task, we do have a lot of alternatives. In this demo oriented talk, Miguel will present different approaches, techniques and types of tests from simple Unit Testing and Mocks to Visual Tests, UI Automation, REPL Testing, Performance, Memory Leaks and Recorded Web Tests.</p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com2tag:blogger.com,1999:blog-22646861.post-59310928070952365272009-10-06T08:31:00.001-05:002009-10-06T08:31:46.500-05:00Geek Events in Sydney<p> </p> <p>Some people have asked me about making the information about events available. I maintain a separate calendar for Geek Events and I decided to make it public. You can use the following links respectively to subscribe from an RSS Reader, Add it to a Calendar App or just view the page in HTML. For more information about the links <a href="http://www.google.com/support/calendar/bin/answer.py?answer=37104">read this page</a>.</p> <p><a href="http://www.google.com/calendar/feeds/miguelmadero.com_aqp3fn700qnrs7fbgt2g40sgds%40group.calendar.google.com/public/basic"><img src="http://www.google.com/calendar/hosted/miguelmadero.com/images/xml.gif" /></a> <a href="http://www.google.com/calendar/ical/miguelmadero.com_aqp3fn700qnrs7fbgt2g40sgds%40group.calendar.google.com/public/basic.ics"><img src="http://www.google.com/calendar/hosted/miguelmadero.com/images/ical.gif" /></a> <a href="http://www.google.com/calendar/hosted/miguelmadero.com/embed?src=miguelmadero.com_aqp3fn700qnrs7fbgt2g40sgds%40group.calendar.google.com&ctz=Australia/Sydney"><img src="http://www.google.com/calendar/hosted/miguelmadero.com/images/html.gif" /></a></p> <p>This is the embedded version of the calendar. </p> <iframe style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" height="600" src="http://www.google.com/calendar/hosted/miguelmadero.com/embed?src=miguelmadero.com_aqp3fn700qnrs7fbgt2g40sgds%40group.calendar.google.com&ctz=Australia/Sydney" frameborder="0" width="800" scrolling="no"></iframe> <p>Keep in mind that ATM this is just my personal list of events, it certainly doesn’t represent everything going on in Sydney. Please feel free to suggest me new events. </p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-75926964499857265902009-10-03T04:32:00.001-05:002009-10-03T04:42:18.275-05:00SDDN Sydney October Meeting – Tools<p> </p> <p>This month we’ll have three talks about tools. </p> <ul> <li>XAML Power Toys – <a href="http://chrisa.wordpress.com/">Chris Anderson</a></li> <li>Html to XAML Converter – <a href="http://www.blender3dlive.com/">Jason Schluter</a></li> <li>Telerik Controls – <a href="http://www.miguelmadero.com/">Miguel Madero</a></li> </ul> <p>As usual we will meet the first Tuesday of the month (October 6th) at the Crown Hotel (162 Elizabeth St). We’ll get there at 6:00 pm to start some open discussions and get a meal, to go on with the talks from 6:30 to 8:30 and then continue with the Networking part of the event. </p> <p>Please confirm your assistance through the mail list (ozsilverlight@ozsilverlight.com) or the <a href="http://www.facebook.com/editevent.php?guests&new&m=2&eid=139696396129#/event.php?eid=139696396129&index=1">facebook group</a>.</p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-67600541885918045662009-08-23T06:10:00.001-05:002009-08-30T09:18:17.801-05:00SDDN Sydney September Meeting - Lightning talks<p> </p> <p>For our September meeting we will do some lightning talks. You can't miss it. These are some of the talks we'll have.</p> <ul> <li>Expression Design – Lee Goodaman </li> <li>Rx Framework – Ali Shafai </li> <li>Debugging Memory Leaks – Miguel Madero </li> <li>Dashboards – Chris Anderson </li> <li>Html-XAML Converter - (not confirmed) </li> <li>New Network Stack – Paul Glavich </li> <li>Silverlight with Azure – David Burela </li> <li>Flex - (not confirmed) </li> </ul> <p>The best is that we can still make some room for yours. Lightning talks can be the perfect opportunity for virgin speakers to have a quickie without worrying for having to prepare for an hour long performance. Experienced presenters will definitely have something to say and 10 minutes is the perfect time to deliver a Wow demo. </p> <p>If you want to speak, just leave comment, reply in the mailing list or shoot me an email. If you’re not sure of what to speak about we can bounce some ideas.</p> <ul> <li>Validations </li> <li>Behaviours </li> <li>Using Blend </li> <li>Sketchflow </li> <li>Designer/Developer Workflow </li> <li>Games </li> <li>MVVM </li> <li>Animations </li> <li>Making your app look good </li> <li>Testability </li> <li>Architecture </li> <li>Design Tips </li> <li>Integrating Silverlight with non-.NET Backends </li> <li>Making money with Silverlight </li> <li>Scaling RIA Applications </li> <li>RIA Services </li> <li>Debugging in Silverlight </li> <li>Finding and Avoiding Memory Leaks </li> <li>Tools for Silverlight </li> <li>The coolest thing that you found last week </li> <li>Creating iPhone apps using MonoTouch and Silverlight </li> </ul> <p>As always, we’ll see you on the first Tuesday of the month (September 1st) at the Crown Hotel. Try to get there early and leave late. The talks start at 6:30, but we meet half hour before to get some beers and have a chat. After the presentations we usually have dinner and discuss further the topics of the day. </p> <iframe height="350" marginheight="0" src="http://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=162+Elizabeth+St+&sll=-33.866433,151.189163&sspn=0.010868,0.020664&ie=UTF8&ll=-33.866995,151.21376&spn=0.010867,0.020664&t=h&z=14&iwloc=r0&output=embed" frameborder="0" width="425" marginwidth="0" scrolling="no"></iframe> <br /><small><a style="text-align: left; color: #0000ff" href="http://www.google.com/maps?f=q&source=embed&hl=en&geocode=&q=162+Elizabeth+St+&sll=-33.866433,151.189163&sspn=0.010868,0.020664&ie=UTF8&ll=-33.866995,151.21376&spn=0.010867,0.020664&t=h&z=14&iwloc=r0">View Larger Map</a></small> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com1tag:blogger.com,1999:blog-22646861.post-54664941932750038102009-07-22T07:47:00.001-05:002009-07-22T07:47:27.924-05:00Silverlight Designer and Developer Network Sydney - August Meeting<p>This month <a href="http://cynergysystems.com/blogs/page/josefajardo">Jose Fajardo</a> from <a href="http://cynergysystems.com/">Cynergy Systems</a> will talk on “Don't lose site of what's important, Interactivity and Experience” at the Crown Hotel. Here are all the details: </p> <p>Crown Hotel <br />162 Elizabeth St <br />Sydney <br />August 4th. 6:00 pm for drinks, 6:30 for the talk <br />Use the registration tool on the top of the <a href="http://www.sddn.org.au/">SDDN Site</a>.</p> <iframe height="350" marginheight="0" src="http://www.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Crown+Hotel+Sydney&sll=10.101536,74.52283&sspn=124.187604,257.167969&ie=UTF8&cid=6195549325043133544&ll=-33.866995,151.21376&spn=0.003973,0.007848&t=h&iwloc=A&output=embed" frameborder="0" width="425" marginwidth="0" scrolling="no"></iframe> <br /><small><a style="text-align: left; color: #0000ff" href="http://www.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Crown+Hotel+Sydney&sll=10.101536,74.52283&sspn=124.187604,257.167969&ie=UTF8&cid=6195549325043133544&ll=-33.866995,151.21376&spn=0.003973,0.007848&t=h&iwloc=A">View Larger Map</a></small> <h5> </h5> <p>If you are interested in a particular topic or have any suggestions for future meetings, please let us know. </p> <p>Here are the details of the talk.</p> <h5>Don't lose site of whats important, Interactivity and Experience</h5> <h6>by <a href="http://cynergysystems.com/blogs/page/josefajardo">Jose Fajardo</a></h6> <p>Patterns, Frameworks, MVVM, Prism, MEF, these are all great aides to helping us deliver a RIA solutions, BUT what they all lack is a designers perspective. Experience has shown me that the majority of a project is spent in xaml and creating interactivity through animations and styling. The view model is lean and clean BUT the view layer through evolutions of the WPF/Silverlight technology has gotten much heavier and more complex. I want to walk through with you the new features in SL and Blend from the perspective of bring order to the chaos in our view layer, and in so doing helping extend our frameworks to be relevant for designers.</p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-21080798066729741272009-06-29T10:00:00.001-05:002009-07-05T07:09:33.612-05:00Silverlight Designer and Developer Network Sydney - July Meeting<p>This month Ali Shafai will talk on Silverlight, Prism and Unity and Miguel Madero will do a mini presentation on a less attractive, but important topic, Security in Silverlight at the Crown Hotel. Here are all the details: </p> <p>Crown Hotel <br />162 Elizabeth St <br />Sydney <br />July 7th. 6:00 pm <br />Use the registration tool on the top of the <a href="http://www.sddn.org.au/">SDDN Site</a>.</p> <iframe height="350" marginheight="0" src="http://www.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Crown+Hotel+Sydney&sll=10.101536,74.52283&sspn=124.187604,257.167969&ie=UTF8&cid=6195549325043133544&ll=-33.866995,151.21376&spn=0.003973,0.007848&t=h&iwloc=A&output=embed" frameborder="0" width="425" marginwidth="0" scrolling="no"></iframe> <br /><small><a style="text-align: left; color: #0000ff" href="http://www.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Crown+Hotel+Sydney&sll=10.101536,74.52283&sspn=124.187604,257.167969&ie=UTF8&cid=6195549325043133544&ll=-33.866995,151.21376&spn=0.003973,0.007848&t=h&iwloc=A">View Larger Map</a></small> <h5>Silverlight, Prism and Unity</h5> <h6>The holy trinity</h6> <h6>by <a href="http://www.platysoft.com.au/Blog.aspx">Ali Shafai</a></h6> <p>Ali will be building a LOB application with Silverlight 3 using prism (with MVVM) and will be showing how to use Unity to inject the dependencies into your classes. The application will have the skeleton of a minimal prism application. </p> <p>I will also share some of my findings on more advanced topics such as: </p> <ul> <li>dynamically creating views </li> <li>region managers and how to use them </li> <li>best practices on wiring events </li> <li>loading essential data before application loads </li> <li>showing a splash screen while the essential data is being loaded </li> <li>tricks on styling your controls beyond what you thought possible </li> <li>How to break the application into smaller assemblies </li> </ul> <p>Ali Shafai started programming a few months before he could touch a computer, during this time, he was the programmer, the program and the computer. Then he got his hands to real computers and learned COBOL, PL/I, BASIC, C, Prolog, X86 Assembly, C++, Object Pascal, C# and Python in that exact order. He can still remember the first program he wrote and the joy he felt writing it. He moved to Sydney in 2001, was introduced to XP, TDD, CI and some other acronyms. In 2004 the company he was working for (EDI) won the <a href="http://www.consensus.com.au/SoftwareAwards/CSAarchive/CSA2004/ediEnterprise.htm">2004 Consensus Software Award</a> and <a href="http://www.microsoft.com/business/smb/en-nz/cbc/cbccontent/SolutionDetail.mspx?solutionid=c08e73ac-7ed2-4e9c-9035-2eeddc767344">Microsoft Realizing Potential Award</a>, he then joined forces with Chris Anderson and Mark Wallis and formed <a href="http://www.peerplacements.com/">Peer Placements</a>, a software talent management company. He is still enjoying programming and does freelance software development. His latest joy is Silverlight/Prism/Unity. </p> <h5></h5> <h5>Security in Silverlight</h5> <h6>by <a href="http://www.miguelmadero.com">Miguel Madero</a></h6> <p><font color="#333333">Miguel will show in several demos different Application Security concerns specific to Silverlight Applications commonly overlooked. He will teach us how to avoid being hacked and protect our data with some basic tips. These are some of the topics covered in this lightning talk:</font></p> <ul> <li>Common Hacking Techniques </li> <li>Security as an Aspect </li> <li>End to end data protection </li> <li>UI Level Security </li> <li>Authentication Mechanisms </li> <li>Authorization and User Context </li> <li>Service Level Security </li> </ul> <p>Miguel has been programming for fun for the last 15 years when he realized that it was better to play with QBasic and Pascal than Prince of Persia. He found out that he could actually get some money out of this hobby so he started a couple of web companies 5 years later and then a Development Shop before moving to Australia to work for Readify where he’s now having fun coding some of the coolest projects in Australia. He discovered Silverlight two years ago and it’s still keeping him busy and entertained. </p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-59086764914111847002009-05-26T19:46:00.001-05:002009-05-26T19:46:44.913-05:00Silverlight Designer and Developer Network – June Meeting<p> </p> <h2></h2> <p></p> <p>Next Tuesday, June 2 at 6:30 at Microsoft in Sydney (1 Epping Road, North Ryde NSW) we will have the SSDN Sydney’s June Meeting. This time Tatham Oddie will be talking about the new Out of Browser features in Silverlight 3 and Sergey Klementiev will presenting “LOB applications in Silverlight Lap around middle tier”. You will also have the opportunity to win a copy full of Expression 2 Suite and the best of all network amongst your Silverlight peers. So don’t miss it.</p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com2tag:blogger.com,1999:blog-22646861.post-49860286045602549592009-05-13T09:09:00.001-05:002009-05-17T19:28:23.638-05:00First Virtual Silverlight Designer and Developer Network Meeting<p><font color="#ff0000">UPDATE 18/05/09: </font><font color="#000000">this is the <a href="https://www323.livemeeting.com/lrs/8000181573/Registration.aspx?pageName=gprcrzd1lgf2dhh4">link for the event</a>, please register before the meeting and be sure you have Live Meeting installed on your computer. Some people have asked me about the place and how is this a Virtual Event. We’ll be using this tool called Live Meeting that allow us to interact with audio, video and share the desktop, polls, Q&A, etc, but rather than trying to explain what Live Meeting is, you can just try it tonight. Just <a href="https://www323.livemeeting.com/lrs/8000181573/Registration.aspx?pageName=gprcrzd1lgf2dhh4">register</a> and follow the instructions.</font></p> <p>SDDN it’s doing great after several meetings and trainings in Melbourne, Adelaide, Perth and Sydney we decided to try something a bit different that will give the opportunity to everyone to participate. Including designers and developers from Canberra and other cities, where we have not done any events yet.</p> <h3></h3> <h3><span style="font-family: "Verdana","sans-serif"; letter-spacing: -0.75pt; color: rgb(19,91,166); font-size: 13.5pt">When and Where?</span></h3> <p>May 18, 2009 at 9:00 pm Sydney Time. This will give enough time to everyone in the West Coast to get home, have dinner and be ready for the meeting. We’ll do it through Live Meeting. I’ll update this post with the link ASAP.</p> <h3><span style="font-family: 'Verdana','sans-serif'; letter-spacing: -0.75pt; color: rgb(19,91,166); font-size: 13.5pt">Format</span></h3> <p>Instead of the typical presentation, we decided to have an open discussion around different topics. Each topic will have a different moderator who will do a brief introduction and open the floor for discussion. The moderator won’t be answering all the questions, he’s just a facilitator for the group, but also another participant with experience in the discussed topic. We’ll have three different topics during the meeting. </p> <h3></h3> <h3><span style="font-family: 'Verdana','sans-serif'; letter-spacing: -0.75pt; color: rgb(19,91,166); font-size: 13.5pt">Who will participate?</span></h3> <p>Everybody that has an interest in Silverlight can attend. This is a space for Designers and Developers. In the last meetings we had a bigger presence of developers, but we’re really targeting both audiences, so you can expect topics of mutual interest. </p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-84011156284727869102009-04-29T07:37:00.001-05:002009-05-14T18:26:10.097-05:00First Meeting of Silverlight Designer and Developer Network in Sydney<p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt"></span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">Our next meeting is on Tuesday the 5th of May in Sydney <p></p> </span></p> <p style="mso-margin-bottom-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; letter-spacing: -0.75pt; color: #135ba6; font-size: 13.5pt">What's on? <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">This meeting we will see <b><span style="color: #135ba6">Chris Anderson</span></b> (</span><a href="http://chrisa.wordpress.com/"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">blog</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">), from Peer Placements will be discussing advanced styling in Silverlight for both developers and designers. Topics will cover styling strategies, tools, advanced xaml techniques, fashions, and a discussion on designing user experiences.   <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><b><span style="font-family: "Verdana","sans-serif"; color: #135ba6; font-size: 8.5pt">Jordan Knight</span></b><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt"> (</span><a title="Jordan's Blog" href="http://blog.webjak.net"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">Blog</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">) from Readify will run through the exciting new features in <b><span style="color: #135ba6">Silverlight 3</span></b>, and demonstrate how you might use them in a real working reference application. This in depth session will cover perspective 3D, pixel shaders, navigation features, out of browser and much more. Other concepts like Model-View-ViewModel, dependency injection, unit testing and designing template friendly (read designer friendly) applications will also be touched upon. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; letter-spacing: -0.75pt; color: #135ba6; font-size: 13.5pt">WIN! <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">Attendees will have the opportunity to win a copy of the full Expression 2 suite, worth $1000! <p></p> </span></p> <p style="mso-margin-bottom-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; letter-spacing: -0.75pt; color: #135ba6; font-size: 13.5pt">When and Where? <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">The date and time: Tuesday May 5 at 6:00 PM for a 6:30 PM start. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">The venue is the Pyrmont Bridge Hotel, Level 2, Pyrmont, NSW. See </span><a href="http://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=96+Union+Street+Pyrmont+2009&sll=37.0625,-95.677068&sspn=32.514368,64.248047&ie=UTF8&z=17&iwloc=A"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">map</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt"> for details. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">Attendance is FREE, but please RSVP by entering your details in the registration in the registration tool on the site (</span><a href="http://www.sddn.org.au"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">http://www.sddn.org.au</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">) or send an email to </span><a href="mailto:info@sddn.org.au"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">info@sddn.org.au</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; letter-spacing: -0.75pt; color: #135ba6; font-size: 13.5pt">Who will this group interest?</span><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt"> <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">The focus of the group is not just on developers. Traditionally developers have had great community support, whereas designers not so much… now that Silverlight 2 is out we plan to change this. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">Silverlight is as interesting for developers as it is for designers. Due in part to Silverlight’s excellent separation of design and development concerns we have new problems to solve around finding the best ways to work together. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">To this end the SDDN will facilitate an ongoing discussion and promote the development of ideas and best practices for anyone who works with Silverlight. <p></p> </span></p> <p style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto" class="MsoNormal"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">To register interest head over to </span><a href="http://www.sddn.org.au"><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">http://www.sddn.org.au</span></a><span style="font-family: "Verdana","sans-serif"; font-size: 8.5pt">. <b>Use the registration tool in the header of the site</b>. </span></p> Miguel Maderohttp://www.blogger.com/profile/06759379443629667029noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-75213369511064467972008-11-28T18:09:00.001-06:002008-11-28T19:51:21.220-06:00Windows and TimeZones<p>People from IT and DB guys have told me they can't rely on Windows when it comes to TimeZones and when time zone adjustments are necessary. I've seen systems re-implementing this feature again just to have have more control. At first this seemed unnecessary for me, but I just noticed today, talking with my sister in law that I had the wrong time of Argentina. </p> <p><a href="http://lh6.ggpht.com/_gOM0MyY45rs/STCH3DyFWAI/AAAAAAAAAJQ/VpGthR2XOGw/s1600-h/image%5B3%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="257" alt="image" src="http://lh4.ggpht.com/_gOM0MyY45rs/STCH57QEg5I/AAAAAAAAAJU/ybTjkdn_K2g/image_thumb%5B1%5D.png?imgmax=800" width="502" border="0" /></a> <br />The main clock is Sydney in the image is Sydney.</p> <p>I thought the cause was that Argentina was an additional clock and not my "main clock", so I change that and noticed that according to windows Buenos Aires start's the Daylight Savings beings on December. How hard is for windows to get this right?</p> <p><a href="http://lh5.ggpht.com/_gOM0MyY45rs/STCH8A88pDI/AAAAAAAAAJY/rh823US1QvA/s1600-h/image%5B10%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="449" alt="image" src="http://lh5.ggpht.com/_gOM0MyY45rs/STCIBEwgneI/AAAAAAAAAJc/VZ6-RlfQJ-Q/image_thumb%5B6%5D.png?imgmax=800" width="450" border="0" /></a> </p> <p>According to the first page I found in Google (<a title="http://www.timeanddate.com/worldclock/" href="http://www.timeanddate.com/worldclock/">http://www.timeanddate.com/worldclock/</a>) Argentina moved to Daylight Saving and the time is 8:29 not 7:29. </p> <p><a href="http://lh5.ggpht.com/_gOM0MyY45rs/STCICX4_-RI/AAAAAAAAAJg/zY9J5JsPe_4/s1600-h/image%5B15%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="221" alt="image" src="http://lh6.ggpht.com/_gOM0MyY45rs/STCIFpVrMpI/AAAAAAAAAJk/uQVn7KiV47A/image_thumb%5B9%5D.png?imgmax=800" width="382" border="0" /></a></p> <p>How disappointed. Well, let's give it another try and manually update it. </p> <p><a href="http://lh5.ggpht.com/_gOM0MyY45rs/STCIHR13jUI/AAAAAAAAAJo/z440UvkaNHQ/s1600-h/image%5B23%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="235" alt="image" src="http://lh3.ggpht.com/_gOM0MyY45rs/STCIJUI5EZI/AAAAAAAAAJs/QuMNcHlFEbU/image_thumb%5B13%5D.png?imgmax=800" width="388" border="0" /></a> </p> <p>Wait for a while</p> <p><a href="http://lh3.ggpht.com/_gOM0MyY45rs/STCIKvEMn_I/AAAAAAAAAJw/1lZt55d7uxQ/s1600-h/image%5B22%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="231" alt="image" src="http://lh6.ggpht.com/_gOM0MyY45rs/STCIM2NWeAI/AAAAAAAAAJ0/SNKSdcflcEk/image_thumb%5B12%5D.png?imgmax=800" width="382" border="0" /></a> </p> <p>Doesn't work :(</p> <p> <a href="http://lh3.ggpht.com/_gOM0MyY45rs/STCIKvEMn_I/AAAAAAAAAJw/1lZt55d7uxQ/s1600-h/image%5B22%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="231" alt="image" src="http://lh6.ggpht.com/_gOM0MyY45rs/STCIM2NWeAI/AAAAAAAAAJ0/SNKSdcflcEk/image_thumb%5B12%5D.png?imgmax=800" width="382" border="0" /></a> </p> <p>Let's try another server</p> <p><a href="http://lh5.ggpht.com/_gOM0MyY45rs/STCIOOmo4FI/AAAAAAAAAJ4/Nx7GMD-33ZI/s1600-h/image%5B39%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="245" alt="image" src="http://lh3.ggpht.com/_gOM0MyY45rs/STCIQHUCHOI/AAAAAAAAAJ8/JOvCa4ghzwc/image_thumb%5B21%5D.png?imgmax=800" width="394" border="0" /></a> </p> <p>Same with all their servers. Failed. Why do they need so many servers only for time? If there were a valid reason, why would the user have to select a different one? Is it like Microsoft saying, "probably we will get it wrong, so we will give you more options just in case (which by the way might also fail)" or "probably you need to create your own time server in case you want to run an anarchy and don't want to go to daylight saving periods". This Internet Server's won't fix our Daylight Saving, they care about time not time zones, so they actually have an other purpose and could bring new problems for systems where seconds or milliseconds are important. </p> <p>I remember that Microsoft distributed a patch for Windows and Windows Mobile to be able to adjust properly for the Daylight Saving in Sydney. Probably I need a patch for my recently configured Time Zone that went to summer time two months ago. Windows Update? Nothing </p> <p>Well this isn't not that bad, Microsoft, has this Server product that works fantastic. But they still got it wrong (also in windows seven). </p> <p><a href="http://lh5.ggpht.com/_gOM0MyY45rs/STCIRtle9OI/AAAAAAAAAKA/4ypzbe14XMg/s1600-h/image%5B52%5D.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="188" alt="image" src="http://lh5.ggpht.com/_gOM0MyY45rs/STCIT97d_kI/AAAAAAAAAKE/hbZssDR2_Ck/image_thumb%5B28%5D.png?imgmax=800" width="419" border="0" /></a> </p> <p>Now a typical discussion would go like this:</p> <p>Customer: We need to adjust the {Enter Feature Heare} based on the time zones of our new markets.   <br />NET Guy: Microsoft is super cool. We can just rely on them for this time zone thingy and we don't care about it. When we do datetime comparisons it takes into account the TimeZone and when saving it or sending it over the wire that information is also considered and we can easily adjust it to UTC, transport or Local time. <br />IT Guy 1: That doesn't work. (Because .NET relys on the OS info) <br />IT Guy 2: All we need to do is keep patching the system for all our servers and client machines on time for all our different markets <br />IT Guy 1: That's a pain. <br />IT Guy 3: We better move the time manually and disable the auto adjust for daylight saving. <br />IT Guy 1: That's a pain in the <a href="mailto:!@$%">!@$%</a>!@(~.  <br />IT Guy 4: .NET Guy, could you do it for us? <br />NET Guy: I can't it's too complex. If MS didn't got it right it's because it's super dupper complex and we better not code it ourselves, it's going to be more painful. It's better to install that patches, that's why MS provides it. <br />IT Guy 4 (taking advantage of the super hero pride of the dev): Com'on you're better than Microsoft, you can do everything (sarcastically smiling) <br />Customer: Uses the puppy face look <br />NET Guy (all full in drunk in pride and self-steem): I am going to do it.</p> <p>This is a code that should work on DotNet, but it doesn't. </p> <pre class="csharpcode"><span class="rem">// Buenos Aires at 19:45 (UTC -3 +1 For Daylight Saving) == UTC 21:45</span><br />var argentinianDate = <span class="kwrd">new</span> DateTime(2008, 11, 29, 19, 45, 0, DateTimeKind.Local);<br />Console.WriteLine(argentinianDate.ToUniversalTime());<br /><br /><span class="rem">// UTC 21:45 == 19:45 Buenos Aires</span><br />var utcDate = <span class="kwrd">new</span> DateTime(2008,11,29,21,45,0,DateTimeKind.Utc);<br />Console.WriteLine(utcDate.ToLocalTime());<br /> <br />Console.ReadLine();</pre><br /><br /><pre class="csharpcode"><a href="http://lh6.ggpht.com/_gOM0MyY45rs/STCgEPphECI/AAAAAAAAAKI/6iDl8W1OCWU/s1600-h/image%5B12%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="143" alt="image" src="http://lh6.ggpht.com/_gOM0MyY45rs/STCgFj27N7I/AAAAAAAAAKM/PjgiRgTdtBw/image_thumb%5B5%5D.png?imgmax=800" width="415" border="0" /></a> </pre><br /><br /><p>So if the OS gets it wrong, you will get it wrong also in .NET. </p><br /><br /><ol><br /> <li>There're other <strike>options</strike> hacks. <br /><br /> <br />According to this <a href="http://www.eggheadcafe.com/software/aspnet/31391821/argentina-daylight-saving.aspx">blog post</a>. You can use this tool called "tzedit" to create a custom time zone and decide when you want to start your Daylight Savings. That way you and your family can start saving at a different time of the year, you will be probably late for work, but saving light. </li><br /><br /> <li>A <a href="http://blogs.technet.com/dst2007/archive/2008/10/17/guidance-for-argentina-on-upcoming-daylight-saving-time-implementation-for-2008-2009.aspx">blog from Microsoft</a> even mentions as Option 1 to move your TZ to GMT-2. </li><br /><br /> <li>There other option is to install a patch, that isn't supported on Windows Vista and Server 2008 systems and it's only targeted to enterprise suers. What? By the way, this post was published one day before the daylight saving started. </li><br /></ol> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-24243006854348163942008-10-25T19:14:00.001-05:002008-10-25T19:14:19.688-05:00Reflector Add-In's Save the Day<p>Recently my brother had a problem with an old winforms application we developed to help him upload images and product information. The issue was really simple, once I had a chance to run and debug the application the issue was evident. The app was using FTP to upload pictures to the website and the credentials were invalid. </p> <p><a href="http://lh3.ggpht.com/miguel.madero/SQO0CxJk7jI/AAAAAAAAAGc/RE_1uwOtWk4/s1600-h/image%5B3%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="174" alt="image" src="http://lh4.ggpht.com/miguel.madero/SQO0ge5D-ZI/AAAAAAAAAGg/92v620rhvzQ/image_thumb%5B1%5D.png?imgmax=800" width="456" border="0" /></a> </p> <p>Easy I thought, go to the config file and change it, it'll probably be encrypted and might give me a hard time to hack. I opened it and didn't find anything. Let's open reflector and see what's happening I have a Stack Trace to start with, but that wasn't the best place. I remembered the name of the user, so the Reflector Add-in Code Search quickly pointed me to the right place:</p> <p><a href="http://lh3.ggpht.com/miguel.madero/SQO0oWtOkOI/AAAAAAAAAGk/k_vhrZZ07UM/s1600-h/image%5B15%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="305" alt="image" src="http://lh3.ggpht.com/miguel.madero/SQO0yv7RVgI/AAAAAAAAAGo/IKHmMJpcG60/image_thumb%5B9%5D.png?imgmax=800" width="394" border="0" /></a></p> <p> From there a double click sent me to the method</p> <p><a href="http://lh4.ggpht.com/miguel.madero/SQO1GKTc96I/AAAAAAAAAGs/xvIq_QNIpkI/s1600-h/image%5B37%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="312" alt="image" src="http://lh3.ggpht.com/miguel.madero/SQO1XKB3GyI/AAAAAAAAAGw/yiHk6piikV0/image_thumb%5B23%5D.png?imgmax=800" width="527" border="0" /></a> </p> <p>Great. Someone thought it was safer to hard code it instead of using the web.config.</p> <p>Then the question remains, how can we change it? The proper solution would be to open Visual Studio, connect to TFS, get the sources, edit recompile and sent back the new version. However I don't think the latest version is stable, so I would need to search for a label to get the latest deployed version. I'm running on a really slow connection now and that would probably take a while, beside it's sunday and I'm ready to go surfing (or at least try to). </p> <p>Option 2. In that same screen just open Reflexil (another Reflector-Addin) locate the IL line that sets the password (this is not as hard as it sounds) and edit the string. </p> <p><a href="http://lh4.ggpht.com/miguel.madero/SQO1l3Nxi7I/AAAAAAAAAG0/ezu_XMUqJLU/s1600-h/image%5B43%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="602" alt="image" src="http://lh6.ggpht.com/miguel.madero/SQO16szIzlI/AAAAAAAAAG4/rOExEs4BCUw/image_thumb%5B27%5D.png?imgmax=800" width="531" border="0" /></a> </p> <p>Then we simply save the assembly. This was probably the hardest part, this was the first time I used Reflexil and I was expecting the Save As option to be right next to the place where I do the edit, in the Tools menu or a toolbar, I finally found the option when clicking file in Reflector. </p> <p><a href="http://lh4.ggpht.com/miguel.madero/SQO2EF8A21I/AAAAAAAAAG8/I8hr4YQAsTw/s1600-h/image%5B48%5D.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="351" alt="image" src="http://lh5.ggpht.com/miguel.madero/SQO2Rpvr-MI/AAAAAAAAAHA/PThQuzFptGo/image_thumb%5B30%5D.png?imgmax=800" width="362" border="0" /></a> </p> <p>After that, just save the file e-mail it and ready to go, but then I had the brilliant idea of write this post and it took me more time than the fix. </p> <p>You can find this an other reflector add-ins in <a title="http://www.codeplex.com/reflectoraddins" href="http://www.codeplex.com/reflectoraddins">http://www.codeplex.com/reflectoraddins</a></p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com6tag:blogger.com,1999:blog-22646861.post-52623433201819377172008-10-06T05:47:00.001-05:002008-10-06T05:47:07.598-05:00Learning with Tests (MessageBroker in NInject)<p>A great way to learn a few coding practices is to get an open source project (one good, don't get the first thing you see en codeplex) and trying to understand the code, how they apply patterns, use certain classes or reuse code through the project. The best way to start (with most of the good projects) is with the tests. </p> <p>I have been playing lately with <a href="http://ninject.org/">Ninject</a>, a Dependency Injection Framework,  it's well designed, auto-documented and documented (probably too much documentation at the code level), the downside is that the <a href="http://dojo.ninject.org/AllPages.aspx">wiki</a>, the <a href="http://dojo.ninject.org/Blog%20Posts%20and%20Tutorials.ashx">blog posts and tutorials</a> barely cover the basics. However, the tests do a good job to describe the project at a higher level. As an example an example we can see one of the tests for the MessageBrokerModule. </p> <pre class="csharpcode"> [Test]<br /> <span class="kwrd">public</span> <span class="kwrd">void</span> OnePublisherOneSubscriber()<br /> {<br /> <span class="kwrd">using</span> (var kernel = <span class="kwrd">new</span> StandardKernel(<span class="kwrd">new</span> MessageBrokerModule()))<br /> {<br /> PublisherMock pub = kernel.Get<PublisherMock>();<br /> Assert.That(pub, Is.Not.Null);<br /><br /> SubscriberMock sub = kernel.Get<SubscriberMock>();<br /> Assert.That(sub, Is.Not.Null);<br /><br /> Assert.That(pub.HasListeners);<br /> Assert.That(sub.LastMessage, Is.Null);<br /><br /> pub.SendMessage(<span class="str">"Hello, world!"</span>);<br /><br /> Assert.That(sub.LastMessage, Is.EqualTo(<span class="str">"Hello, world!"</span>));<br /> }<br /> }</pre><br /><br /><p>The code is really easy to follow, first he asserts that the kernel can create instances of the publisher and subscriber, then the publisher should have a listener, the subscriber doesn't have any message and finally he sends a message than the subscriber should receive. The other tests like OnePublisherTwoSubscribers and ManyPubsManySubscribiers are similar. </p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-43239902063239667952008-10-04T09:29:00.001-05:002008-10-04T09:29:04.864-05:00Task Board for Scrum for Team System<p> </p> <p>I have been using <a href="http://www.scrumforteamsystem.com/">Scrum for Team System</a> since beta 1 and I quickly fell in love with that template. It reflects the way we were working, however, there was a big gap in the process, specially when planning for a sprint, we usually did all the prioritizations, sizing, assigning and breakdown of Product Backlog Items using other tools like <a href="http://www.google.com/url?q=http://www.mindjet.com/products/trials/default.aspx&sa=X&oi=smap&resnum=1&ct=result&cd=1&usg=AFQjCNExYGbi-tnh2KunKj8zeeQK0XTKeQ">Mindmanager</a>, Excel or sticky notes.</p> <p>Recently the guys from <a href="http://www.conchango.com/Web/Public/Content/OurAgileApproach/OurAgileApproach.aspx">Conchango</a>, creators of the template, released a beta of a tool that will help use fill that gap. It's a cool WPF tool that will interact with TFS and allow us to create and edit sprint backlog items. </p> <p><img height="489" src="http://www.scrumforteamsystem.com/en/images/TaskBoardImages/ToolTip.jpg" width="688" /></p> <p>I don't think the tool will replace Mindmanager and the whiteboard still will be an indispensable resource, but I don't think I would like to go back to Excel to edit my items (well lets see how it goes after a couple of sprints of working with it). </p> <p>When I was looking at the tool I was thinking, mmm yes, you can move a task from In Progress to Done, that's cool, but excel can do much more specially with pivot tables and reports, but then I saw the rest of the features, like changing to Planning Mode to start adding Product Backlog Items, automatically doing the binding between product backlogs and sprint backlog items, searching, filtering and reporting and I have to say, this tool is something worth to try. So in two weeks I'll let you know more about this. </p> <p>I'm still not sure about the pricing scheme and I'm a bit concern. At the moment is beta, and you can simply request a license, but it doesn't seem something that will remain free. I will need to consider if this is a tool that every developer on the team will be able to use.</p> <p><a href="http://blogs.conchango.com/crispinparker/">Crispin Parker</a> from <a href="http://www.conchango.com/Web/Public/Content/OurAgileApproach/OurAgileApproach.aspx">Conchango</a> published <a href="http://www.scrumforteamsystem.com/en/TaskBoardBeta/WebCasts.aspx">some useful webcasts</a> and a <a href="http://blogs.conchango.com/crispinparker/archive/2008/09/25/task-board-for-team-system-beta-3-released.aspx">post</a> with more info on the product. </p> <p>By the way, it would be great to get a <a href="http://www.microsoft.com/surface/">surface</a> to use this tool. </p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-4936568541825681532008-09-15T08:24:00.001-05:002008-09-15T08:24:40.242-05:00Sydney ALT.NET Group<p>The newest user group in Sydney will have it's first meeting on September 30 at the <a href="http://www.thoughtworks.com.au/">Thoughtworks</a> offices. Richard Banks published the <a href="http://sydneyaltdotnet.blogspot.com/2008/09/september-30th-what-going-to-happen.html">agenda</a> and <a href="http://sydneyaltdotnet.blogspot.com/2008/09/sydney-altnet-first-meeting-will-be.html">details</a> in the <a href="http://sydneyaltdotnet.blogspot.com/">group's blog</a>, but what exactly is an ALT.NET Group? Why do we need another one if we have generic groups like Sydeny's DNUG and RDN or technology specific groups like OzTFS and OzSilverlight?  </p> <p>ALT for Alternative has caused a lot of controversy that lead to misunderstanding, so let's better start for what it's <strong>NOT</strong>, it's not the anti-microsoft group, its not the open source community tired of Java wanting to use something better (altough some of them might be part of the group), its not a group that loves NHibernate and hates Entity Framework.</p> <p>Simply is a group of developers that like to look for better ways to do their work, keeping a "get things done" approach and commonly identified with agile practices, continuous improvement and the pragmatic thinking, people who "use what works while keeping an eye out for a better way". </p> <p>If you feel identified with these ideas, come and join us or if you're not in Sydney, find an ALT.NET User Group or create a new one. </p> <p>In our first meeting we will have talks about Ruby and Mocking. </p> <p>Recommending reading/listening:</p> <ul> <li>Recent Glenn Block's <a href="http://blogs.msdn.com/gblock/archive/2008/09/11/the-alt-net-criterion.aspx">post</a>. "What are the kinds of things that concern folks from the ALT.NET community?" </li> <li><a href="http://altdotnet.org/">altdotnet.org</a> </li> <li><a href="http://www.hanselminutes.com/default.aspx?showID=122">Hanselminute's show On ALT.NET with Dave Laribee</a> </li> <li><a href="http://www.dotnetrocks.com/default.aspx?showNum=333">DotNetRocks on ALT.NET with Dave Laribee and Jeremy Miller</a> </li> <li>Sydeny's ALT.NET Group <a href="http://blogs.msdn.com/gblock/archive/2008/09/11/the-alt-net-criterion.aspx">Blog</a> </li> </ul> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-16761985558843728162008-09-09T06:25:00.001-05:002008-09-09T06:26:51.158-05:00C# and more dynamic features (C# 4.0?)<p class="MsoNormal" style="tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"><span lang="EN" style="font-size: 10pt; color: blue; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU">static</span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"> <span style="color: blue">void</span> Main(<span style="color: blue">string</span>[] args) <br /></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU">{ <br /></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">    </span><span style="color: blue">dynamic <br /></span></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">    </span>{ <br /></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">        </span><span style="color: blue">object</span> myDynamicObject = GetDynamicObject(); <br /></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">        </span>myDynamicObject.SomeMethod();<span style="mso-spacerun: yes">         </span><span style="color: green">// call a method<span style="mso-spacerun: yes">    <br /></span></span></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">        </span>myDynamicObject.someString = <span style="color: #a31515">"value"</span>; <span style="color: green">// Set a field <br /></span></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">        </span>myDynamicObject[0] = 25;<span style="mso-spacerun: yes">              </span><span style="color: green">// Access an indexer <br /></span></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU"><span style="mso-spacerun: yes">    </span>} <br /></span><span lang="EN" style="font-size: 10pt; font-family: " courier new"; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN; mso-fareast-language: EN-AU">} <p></p> </span></p> <p class="MsoNormal">How cool is it? I don’t know, probably will be something dangerous if not used with care, C# depend a lot of compile time checking. <br /></p> <p class="MsoNormal">To see more about this see <a href="http://blogs.msdn.com/charlie/archive/2008/01/25/future-focus.aspx">Charlie Calvert’s Blog</a></p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-81213660734790932852008-08-19T07:41:00.001-05:002008-08-19T07:43:05.614-05:00Cool Site with great controls, components and skins - www.wpfstyles.com<p><a href="http://lh6.ggpht.com/miguel.madero/SKq_bxswSQI/AAAAAAAAAGU/Zx4wJlmVEIU/s1600-h/Logo%5B4%5D.gif"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="66" alt="Logo" src="http://lh4.ggpht.com/miguel.madero/SKq_c1DGAPI/AAAAAAAAAGY/gxwqkL47QEU/Logo_thumb%5B2%5D.gif?imgmax=800" width="195" align="left" border="0" /></a> If you haven't you gotta check <a href="http://www.wpfstyles.com">www.wpfstyles.com</a> by <a href="http://geekswithblogs.net/dotNETPlayground/Default.aspx">Andrew den Hertog</a>. The just released site oriented to the dev community, is quickly becoming a great resources for controls, components and skins sharing for WPF and Silverlight. Go give it a try and if you have something, share it and if you need something, probably you will find it here. If you don't check it back later, the site is new and people is starting to publish content, so don't freak out if you don't see 1,000 controls yet. </p> <h6>Personal Note/Public Apology: There has been a while without a post, because I have been traveling a lot and didn't have Internet connection in several of those places. I just moved to another country and I'm still getting installed, but you can expect frequent posts again. </h6> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-45168041705029646002008-08-05T01:17:00.001-05:002008-08-05T01:17:26.593-05:00Using the ASP.NET Providers from Silverlight - Membership, Roles and Profile<p>Brad Abrams wrote an excellent <a href="http://blogs.msdn.com/brada/archive/2008/05/03/accessing-the-asp-net-authentication-profile-and-role-service-in-silverlight.aspx">post</a> about how to set everything in the server and client to consume this services. He covers for areas:</p> <p>1. Login\Logout <br />2. Save personalization settings <br />3. Enable custom UI based on a user's role (for example, manager or employee) <br />4. A custom log-in control to make the UI a bit cleaner</p> <p>These Services are simple wrappers to the actual providers and only provider the most common functions (i.e. Membership has login/logout, but not CreateUser), but would be pretty straightforward to extend them. If your application is not 100% SL and you have parts already build in ASP.NET you can easily combine them, for example, use the Login controls to Authenticate users, but use the Role Services to restrict certain functions depending on who is who. </p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-85200246174221934832008-08-02T02:12:00.001-05:002008-08-02T02:12:18.569-05:00Value Converters - More Simple Samples<p>This is the third of several posts related to Value Converters. Reading the posts in order can be useful, but not necessary. The first post, <a href="http://miguelmadero.blogspot.com/2008/07/value-converters-databinding-101.html">Databinding 101</a>, served as an intro to the problem and the second, <a href="http://miguelmadero.blogspot.com/2008/08/value-converters-default-value.html">DefaultValueConverter</a>, introduced the basics about ValueConverters. Now we're ready to present several examples to give you more ideas of where ValueConverters can be used. </p> <h3> </h3> <h3>ImageSourceConverter </h3> <p>The Image control doesn't update its Source property automatically, so setting it to a path will work only the first time, but if the path in your datasource changes it won't be reflected, well the ImageSourceConverter will help you. This is really a bug that will be corrected in SL RTM, but meanwhile this is another place to use ValueConverters. </p> <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> ImageSourceConverter : IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">string</span> path = (<span class="kwrd">string</span>)<span class="kwrd">value</span>;<br /> <span class="kwrd">return</span> <span class="kwrd">new</span> BitmapImage(<span class="kwrd">new</span> Uri(path, UriKind.RelativeOrAbsolute));<br /> }<br /><br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();<br /> }<br />}</pre><br /><br /><h3>VisibilityConverter</h3><br /><br /><p>You might want to change the visibility of a control based on a boolean property of your objects, this is simple with the VisibiltyConverter:</p><br /><br /><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> VisibilityConverter:IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">if</span> ((<span class="kwrd">bool</span>)<span class="kwrd">value</span>)<br /> <span class="kwrd">return</span> Visibility.Visible;<br /> <span class="kwrd">return</span> Visibility.Collapsed;<br /> }<br /><br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();<br /> }<br />}</pre><br /><br /><h3>StringFormatConverter</h3><br /><br /><p>This is one of my favorites. ASP.NET and Winforms use a StringFormat that let you display properly numeric or date objects (use these <a href="http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf">cheat sheet</a> as reference). With this converter for example you can simply pass the ConverterParameter of C to format a numeric value as currency and will work similar to the way it does in the mentioned platforms. This is another convertar that I feel should be part of the Binding object. </p><br /><br /><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> StringFormatConverter:IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">string</span> formatString = parameter.ToString();<br /> <span class="kwrd">return</span> String.Format(<span class="str">"{0:"</span> + formatString + <span class="str">"}"</span>, <span class="kwrd">value</span>);<br /> }<br /><br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> InvalidOperationException(<span class="str">"This Convert supports only OneWay binding"</span>);<br /> }<br />}</pre><br /><br /><h3>StringFixedLengthConverter </h3><br /><br /><p>For some controls you might want to specify a fixedlength for the text. You can do it with the StringFixedLengthConverter setting its ConverterParameter. This is rarely useful...</p><br /><br /><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> StringFixedLengthConverter : IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)<br /> {<br /> <span class="kwrd">return</span> GetFixedLengthText((<span class="kwrd">string</span>)<span class="kwrd">value</span>, <span class="kwrd">int</span>.Parse((<span class="kwrd">string</span>)parameter));<br /> }<br /><br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();<br /> }<br /><br /> <span class="kwrd">private</span> <span class="kwrd">string</span> GetFixedLengthText(<span class="kwrd">string</span> originalString, <span class="kwrd">int</span> maxChars)<br /> {<br /> <span class="kwrd">int</span> textLength = originalString.Length;<br /> <span class="kwrd">if</span> (textLength > maxChars)<br /> <span class="kwrd">return</span> originalString.Substring(0, maxChars - 3) + <span class="str">"..."</span>;<br /> <span class="kwrd">int</span> padding = (<span class="kwrd">int</span>)Math.Round((maxChars - textLength) / 2d);<br /> <span class="kwrd">string</span> paddingChars = <span class="str">""</span>;<br /> <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i < padding; i++)<br /> paddingChars += <span class="str">" "</span>;<br /> <span class="kwrd">return</span> paddingChars + originalString + paddingChars;<br /> }<br />}</pre><br /><br /><h3>IfNullChangeColorConverter </h3><br /><br /><p>This is not common, but we had run into cases where we need to change the color of a control in case a property is null. This could be combined with the <a href="http://miguelmadero.blogspot.com/2008/08/value-converters-default-value.html">DefaultValueConverter</a> presented yesterday. Imagine you will display a DefaultValue of 'Not Available' if the person doesn't have a phone number, but you also want to greyout the text to emphasize the lack of data. To create this effect, specify the desired color in the ConverterParameter (if no value is specify grey will be used). </p><br /><br /><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> IfNullChangeColorConverter : IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">if</span> (<span class="kwrd">value</span> == <span class="kwrd">null</span>)<br /> <span class="kwrd">return</span> <span class="kwrd">new</span> SolidColorBrush(GetColor(parameter)); <br /> <span class="kwrd">return</span> <span class="kwrd">new</span> SolidColorBrush(Color.FromArgb(255, 0, 0, 0));<br /> }<br /><br /> <span class="kwrd">public</span> Color GetColor(<span class="kwrd">object</span> parameter)<br /> {<br /> <span class="kwrd">byte</span>[] argbColor = <span class="kwrd">new</span> <span class="kwrd">byte</span>[4];<br /> <span class="kwrd">if</span> (parameter != <span class="kwrd">null</span>)<br /> {<br /> <span class="kwrd">string</span>[] argbColorStrings = parameter.ToString().Split(<span class="str">','</span>);<br /> <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i < 4; i++)<br /> {<br /> argbColor[i] = <span class="kwrd">byte</span>.Parse(argbColorStrings[i]);<br /> }<br /> }<br /> <span class="kwrd">else</span><br /> {<br /> <span class="rem">//#FFC0C0C0</span><br /> argbColor[0] = 255;<br /> argbColor[1] = 192;<br /> argbColor[2] = 192;<br /> argbColor[3] = 192;<br /> }<br /> <span class="kwrd">return</span> Color.FromArgb(argbColor[0], argbColor[1], argbColor[2], argbColor[3]);<br /> }<br /><br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();<br /> }<br />}</pre><br /><br /><p>Creating ValueConverters is really easy and these examples are meant to show that, rather than to try to cover every scenario. However, ValueConverters have many drawbacks. You can't combine them (e.g. use StringFormat and DefaultValue for the same property because the binding object only allows one) and won't scale easily (you will end up with lots of classes for super simple scenarios). Tomorrow I will talk about a pattern that can overcome these drawbacks. </p><br /><br /><p>You can download the attached code <a href="http://roller.com.mx/ValueConverters-Part3.zip">here</a> with the last examples and the classes presented here. <br /><br /> <br />I format my code using <a href="http://www.manoli.net/csharpformat/">Manoli's website</a><br /><br /> <br />Don't forget to <a href="http://team.intellekt.ws/blogs/miguel/archive/2008/07/28/silverlight-tip-of-the-day-vote-for-the-future-posts.aspx">vote</a> for your favorite topics for this column.</p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-27254649404319508692008-08-01T01:29:00.001-05:002008-08-01T01:29:55.473-05:00Professional Visual Studio 2008 for Sale Now.<p>As I mentioned <a href="http://miguelmadero.blogspot.com/2008/07/professional-visual-studio-2008-is.html">before</a> I was invited to write the chapters of Team System in the book <a href="http://www.professionalvisualstudio.com/books/ProVS2008/">Professional Visual Studio 2008</a>, well the book is finally out now and you can get it in <a href="http://www.amazon.com/gp/product/0470229888?ie=UTF8&tag=peaksite-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0470229888">Amazon</a>, <a href="http://search.barnesandnoble.com/Professional-Visual-Studio-2008/Nick-Randolph/e/9780470229880/?itm=1">Barnes & Noble</a> or your favorite bookstore. This is the Table of Contents:</p> <h4>Table of Contents</h4> <h5>Part I: Integrated Development Environment</h5> <p>Chapter 1: A Quick Tour <br />Chapter 2: The Solution Explorer, Toolbox, and Properties <br />Chapter 3: Options and Customizations <br />Chapter 4: Workspace Control <br />Chapter 5: Find and Replace, and Help </p> <h5>Part II: Getting Started</h5> <p>Chapter 6: Solutions, Projects, and Items <br />Chapter 7: Source Control <br />Chapter 8: Forms and Controls <br />Chapter 9: Documentation Using Comments and Sandcastle <br />Chapter 10: Project and Item Templates </p> <h5>Part III: Languages</h5> <p>Chapter 11: Generics, Nullable Types, Partial Types, and Methods <br />Chapter 12: Anonymous Types, Extension Methods, and Lambda Expressions <br />Chapter 13: Language-Specific Features <br />Chapter 14: The My Namespace <br />Chapter 15: The Languages Ecosystem </p> <h5>Part IV: Coding</h5> <p>Chapter 16: IntelliSense and Bookmarks <br />Chapter 17: Code Snippets and Refactoring <br />Chapter 18: Modeling with the Class Designer <br />Chapter 19: Server Explorer <br />Chapter 20: Unit Testing </p> <h5>Part V: Data</h5> <p>Chapter 21: DataSets and Data Binding <br />Chapter 22: Visual Database Tools <br />Chapter 23: Language Integrated Queries (LINQ) <br />Chapter 24: LINQ to XML <br />Chapter 25: LINQ to SQL and Entities <br />Chapter 26: Synchronization Services </p> <h5>Part VI: Security</h5> <p>Chapter 27: Security in the .NET Framework <br />Chapter 28: Cryptography <br />Chapter 29: Obfuscation <br />Chapter 30: Client Application Services <br />Chapter 31: Device Security Manager </p> <h5>Part VII: Platforms</h5> <p>Chapter 32: ASP.NET Web Applications <br />Chapter 33: Office Applications <br />Chapter 34: Mobile Applications <br />Chapter 35: WPF Applications <br />Chapter 36: WCF and WF Applications <br />Chapter 37: Next Generation Web: Silverlight and ASP.NET MVC </p> <h5>Part VIII: Configuration and Internationalization</h5> <p>Chapter 38: Configuration Files <br />Chapter 39: Connection Strings <br />Chapter 40: Resource Files </p> <h5>Part IX: Debugging</h5> <p>Chapter 41: Using the Debugging Windows <br />Chapter 42: Debugging with Breakpoints <br />Chapter 43: Creating Debug Proxies and Visualizers <br />Chapter 44: Debugging Web Applications <br />Chapter 45: Advanced Debugging Techniques </p> <h5>Part X: Build and Deployment</h5> <p>Chapter 46: Upgrading with Visual Studio 2008 <br />Chapter 47: Build Customization <br />Chapter 48: Assembly Versioning and Signing <br />Chapter 49: ClickOnce and MSI Deployment <br />Chapter 50: Web and Mobile Application Deployment </p> <h5>Part XI: Automation</h5> <p>Chapter 51: The Automation Model <br />Chapter 52: Add-Ins <br />Chapter 53: Macros </p> <h5>Part XII: Visual Studio Team System</h5> <p>Chapter 54: VSTS: Architect Edition <br />Chapter 55: VSTS: Developer Edition <br />Chapter 56: VSTS: Tester Edition <br />Chapter 57: VSTS: Database Edition <br />Chapter 58: Team Foundation Server </p> <p>I also had a chance to review a couple of chapters. Writing a book was a great experience and I hope you will enjoy the results. </p> <p>As <a href="http://peaksite.com/">Dave Gardner</a> <a href="http://www.professionalvisualstudio.com/blog/2008/07/28/professional-visual-studio-2008-is-now-available/">mentioned</a> there are <a href="http://professor.wiley.com/CGI-BIN/LANSAWEB?PROCFUN+PROF1+PRFFN13+FUNCPARMS+CWIL%28A0010%29:N+LANG%28A0010%29:0+ISBN%28A0090%29:470229888">books available</a> for instructors from the publisher and other's through the <a href="http://www.professionalvisualstudio.com/blog/2008/07/28/professional-visual-studio-2008-is-now-available/">books's page</a>. <a href="http://community.softteq.com/blogs/nick/archive/2008/07/30/professional-visual-studio-2008-now-available-with-teched-offer.aspx">Nick Randolph</a> mentioned later than they will have books to give away in TechEd Australia and TechEd New Zealand. </p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-80983032790831041802008-08-01T00:14:00.002-05:002008-08-01T00:24:03.115-05:00Value Converters - Default Value Converter<p>This is the second of several posts related to Value Converters. Reading the posts in order can be useful, but not necessary. As we saw <a href="http://miguelmadero.blogspot.com/2008/07/value-converters-databinding-101.html">yesterday</a> sometimes we need to specify a DefaultValue for cases where there's no value specified by our datasource. This is a look of the application with data, then without a phone number and the third pic shows how would it look with the DefaultValueConverter. </p><form id="aspnetForm" name="aspnetForm" action="http://team.intellekt.ws/blogs/miguel/archive/2008/07/30/value-converters-databinding-101.aspx" method="post"><div id="CommonOuter"><div id="Common"><div id="CommonBody">With data:<br /><img src="http://lh4.ggpht.com/miguel.madero/SJETQQ9FDVI/AAAAAAAAAGA/iXaclEbdANc/image_thumb.png?imgmax=800" /><br />Without data: <br /><a href="http://lh4.ggpht.com/miguel.madero/SJKbwt6_-GI/AAAAAAAAAGE/RHNNT9WuHyI/s1600-h/image%5B2%5D.png"><img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="109" alt="image" src="http://lh3.ggpht.com/miguel.madero/SJKbxRy3zzI/AAAAAAAAAGI/DSfzVsJkoLI/image_thumb.png?imgmax=800" width="244" border="0" /></a> <br />Wit DefaultValueConverter:<br /><a href="http://lh4.ggpht.com/miguel.madero/SJKbyPI5KPI/AAAAAAAAAGM/ai_eX8j2A_4/s1600-h/image%5B8%5D.png"><img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="101" alt="image" src="http://lh6.ggpht.com/miguel.madero/SJKbyxn0hcI/AAAAAAAAAGQ/ckod_0zKPp8/image_thumb%5B2%5D.png?imgmax=800" width="244" border="0" /></a> </div>The change in XAML is really simple, this is the original line:<br /><pre class="csharpcode"><span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">='{Binding Mode=OneWay, Path=PhoneNumber}'</span><span class="kwrd">/></span></pre><pre class="csharpcode"> </pre>This is the modified line:<br /><br /><pre class="csharpcode"><span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">='{Binding Mode=OneWay, Path=PhoneNumber, ConverterParameter="[Not Available]", Converter={StaticResource DefaultValueConverter}}'</span><span class="kwrd">/></span></pre><p><span class="kwrd">We also need to add a Resource that holds the reference to our DefaultValueConverter</span></p></div></div></form><pre class="csharpcode"><span class="kwrd"><</span><span class="html">UserControl.Resources</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">SilverlightApplication14:DefaultValueConverter</span> <span class="attr">x:Key</span><span class="kwrd">="DefaultValueConverter"</span><span class="kwrd">/></span><br /><span class="kwrd"></</span><span class="html">UserControl.Resources</span><span class="kwrd">></span></pre><p><span class="kwrd"></span><span class="kwrd">We added two attributes to the Binding object, a ConverterParameter and a resource that will hold an instance of our ValueConverter. A ValueConverter is simply a class that implements IValueConverter and consists of two methods Convert and ConvertBack. ConvertBack is used with TwoWay BindingMode, but we won't use it here. The Convert method simply checks if the value is null and if it is, it returns the parameter which will hold the object specified in the ConverterParameter. </span></p><div class="csharpcode"><pre class="alt"><span class="kwrd">public</span> <span class="kwrd">class</span> DefaultValueConverter : IValueConverter<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">if</span> (<span class="kwrd">value</span> == <span class="kwrd">null</span>)<br /> <span class="kwrd">return</span> parameter;<br /> <span class="kwrd">return</span> <span class="kwrd">value</span>;<br /> }<br /> <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)<br /> {<br /> <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();<br /> }<br />}</pre></div><br /><p>In WPF the Binding object has a DefaultValue property, so there's no need to create a ValueConverter there. </p><br /><p>You can download the attached code <a href="http://roller.com.mx/ValueConverters-Part2.zip">here</a><br />I format my code using <a href="http://www.manoli.net/csharpformat/">Manoli's website</a><br />Don't forget to <a href="http://team.intellekt.ws/blogs/miguel/archive/2008/07/28/silverlight-tip-of-the-day-vote-for-the-future-posts.aspx">vote</a> for your favorite topics for this column.</p>Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-7612688912980523932008-07-30T20:20:00.003-05:002008-07-31T03:56:36.248-05:00Value Converters - Databinding 101<p>This is the first of several posts related to Value Converts. Trying to minimize the length of the posts I break it in 4 deliveries, but the first one will have to be an intro to databinding before I can get into Value Converters tomorrow. </p><p>Databinding is great and probably one of the best features in WPF and SL (I know I have said that before for others), well, it's great, but somehow inflexible as we will see tomorrow and Value Converters will add a bit of flexibility. </p><p>As with winforms or ASP.NET to do databinding we will need a DataSource. We will define our person class. </p><div class="csharpcode"><pre class="alt"><span class="kwrd">public</span> <span class="kwrd">class</span> Person<br />{<br /> <span class="kwrd">public</span> <span class="kwrd">string</span> Name { get; set; }<br /> <span class="kwrd">public</span> <span class="kwrd">string</span> LastName { get; set; }<br /> <span class="kwrd">public</span> <span class="kwrd">string</span> PhoneNumber { get; set; }<br />}</pre><br /></div><br /><br /><p>In our Codebehind we will add this to the DataContext property of the control</p><div class="csharpcode"><pre class="alt"><span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Page : UserControl<br />{<br /><br /> <span class="kwrd">public</span> Page()<br /> {<br /> InitializeComponent();<br /> DataContext = <span class="kwrd">new</span> Person {Name = <span class="str">"Miguel"</span>, LastName = <span class="str">"Madero"</span>, PhoneNumber = <span class="str">"+52 (871) 123-4567"</span>};<br /> }<br />}</pre><br />Obviously in a real example we won't hard code the values and instead get our data from a Service. Then in XAML we will define the controls that will be bound to our object. In this case we're using only textboxes inside inside a StackPanel. </div><br /><div class="csharpcode"><pre class="alt"><span class="kwrd"><</span><span class="html">StackPanel</span> <span class="attr">Orientation</span><span class="kwrd">="Horizontal"</span><span class="kwrd">><br /></span> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">="{Binding Name}"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/><br /></span> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">="{Binding LastName}"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Text</span><span class="kwrd">="{Binding PhoneNumber}"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/><br /></span><span class="kwrd"></</span><span class="html">StackPanel</span><span class="kwrd">></span></pre></div><br /><p>That's it, super simple. There are obviously more complex examples, but I probably won't go there since other people have already have done a great job covering them, for example binding to a List Box (read <a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx">Scott's post</a>) or a DataGrid (all <a href="http://blogs.msdn.com/scmorris">Scott Morris blog</a>), or a step by step <a href="http://silverlight.net/learn/tutorials/databinding.aspx">tutorial</a> by <a href="http://silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> who explains Binding objects, change notifications implenting INotifyPropertyChanged, Binding Modes (OneTime, OneWay, TwoWay). This is not an intro to databinding, rather an intro to Value Converters and why is it needed.</p><br /><p>After a couple of modifications (see <a href="http://roller.com.mx/ValueConverters-Part1.zip">attached code</a>) the page will look like this:</p><br /><p><a href="http://lh3.ggpht.com/miguel.madero/SJETPn_ffFI/AAAAAAAAAF8/e2084ory2MU/s1600-h/image%5B2%5D.png"><img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="120" alt="image" src="http://lh4.ggpht.com/miguel.madero/SJETQQ9FDVI/AAAAAAAAAGA/iXaclEbdANc/image_thumb.png?imgmax=800" width="244" border="0" /></a> </p><p>Everything looks as expected, so why would we need value converters. Imagines some people won't have phone numbers, we would be displaying a blank space, that might not be the desired experience. What if we want to show a default value like "Not available". Tomorrow we will see how to show default values using ValueConverters. </p><p></p><br /><p>You can download the attached code <a href="http://roller.com.mx/ValueConverters-Part1.zip">here</a><br />I format my code using <a href="http://www.manoli.net/csharpformat/">Manoli's website</a><br />Don't forget to <a href="http://team.intellekt.ws/blogs/miguel/archive/2008/07/28/silverlight-tip-of-the-day-vote-for-the-future-posts.aspx">vote</a> for your favorite topics.</p>Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-14252990299439333392008-07-30T02:35:00.002-05:002008-07-31T04:02:22.230-05:00No More Need to Change Your URIs<p>It's a pain having to remember to edit your ServiceReferences.ClientConfig (the file with the service proxies configuration) or editing your code to point to another path when changing between developing, testing and production environments. Well, it's time to stop the pain:</p><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span> Uri uri = HtmlPage.Document.DocumentUri;<br /><span class="lnum"> 2: </span> <span class="kwrd">return</span> String.Format(<span class="str">"{0}://{1}:{2}/"</span>, uri.Scheme, uri.Host, uri.Port);</pre></div><p>It would be better to encapsulate this in a class:<br /></p><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">class</span> UriHelper<br /><span class="lnum"> 2: </span> {<br /><span class="lnum"> 3: </span> <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetHost()<br /><span class="lnum"> 4: </span> {<br /><span class="lnum"> 5: </span> <span class="kwrd">if</span>(!HtmlPage.IsEnabled) <span class="rem">// Get design time URI<br /></span><span class="lnum"> 6: </span> <span class="kwrd">return</span> <span class="str"><a href="http://localhost:1650/">http://localhost:1650/</a></span>;<br /><span class="lnum"> 7: </span> Uri uri = HtmlPage.Document.DocumentUri;<br /><span class="lnum"> 8: </span> <span class="kwrd">return</span> String.Format(<span class="str">"{0}://{1}:{2}/"</span>, uri.Scheme, uri.Host, uri.Port);<br /><span class="lnum"> 9: </span> }<br /><span class="lnum"> 10: </span> }</pre><br />I suggest you to update your proxies, so instead of using the URL defined in your ServiceReferences file it will use the URI provided by your method:</div><br /><div class="csharpcode"><br /><pre class="alt"><span class="lnum"> 1: </span><span class="kwrd">public</span> AuthenticationServiceClient()<br /><span class="lnum"> 2: </span> : <span class="kwrd">base</span>(<span class="str">"BasicHttpBinding_AuthenticationService"</span>, UriHelper.GetHost() + <span class="str">"B2B2/Cotizador/AuthenticationService.svc"</span>){}<br /><br /><br /></pre></div><p>It will be useful for pictures too:</p><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span><span class="kwrd">string</span> uri = String.Format(<span class="str">"{0}/Images/{1}.jpg"</span>, UriHelper.GetHost(), productId);<br /><span class="lnum"> 2: </span> image.ImageSource = <span class="kwrd">new</span> BitmapImage(<span class="kwrd">new</span> Uri(uri, UriKind.RelativeOrAbsolute));</pre><br />Hope this helps.<br />Don't forget to <a href="http://team.intellekt.ws/blogs/miguel/archive/2008/07/28/silverlight-tip-of-the-day-vote-for-the-future-posts.aspx">vote</a> for your favorite topics.<br />I format my code using <a title="http://www.manoli.net/csharpformat/" href="http://www.manoli.net/csharpformat/">Manoli's website</a></div>Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-35194461300618598132008-07-29T00:08:00.001-05:002008-07-29T00:08:30.128-05:00Silverlight Tip of The Day - Vote for The Future Posts<p>Before I started writing this column, I began writing ideas for future posts and the list seems to grow faster than the daily frequency my posts have. So this is a list of posts in the queue, you can vote for them either by e-mail of leaving a comment. </p> <p>Because of time constraints I have not been able to post some of the interesting topics. </p> <ul> <li>Debugging Tips </li> <li>Deploying </li> <li>Cross Domain Calls </li> <li>Problems Debugging </li> <li>Recommendation of cool tools (for Dependency Injection, AOP, extensions, etc) </li> <li>Model-View-ViewModel Pattern </li> <li>Handling Image Paths </li> <li>Using ASP.NET Providers (Membership, Roles, Profile) </li> <li>Styles and Templates <ul> <li>Basics </li> <li>Controls </li> <li>Create a Clean Style for ListBox or ItemsControl </li> <li>Change ListItemStyle </li> <li>Blend and Styles </li> <li>Blend and Templates </li> <li>Visual State Manager </li> <li>Visual State Manager and Blend </li> </ul> </li> <li>Blogs I read and cool links </li> <li>Patterns for code reuse between Silverlight and .NET or .NET Compact Framework </li> <li>Patterns for XAML code reuse between Silverlight and WPF </li> <li>Silverlight Unit Testing </li> <li>Test Code reuse </li> <li>Refactoring your ASP.NET code to Silverligtht </li> <li>Changing patterns from ASP.NET to Silverlight </li> <li>Dummy Data and Better Design Experience (See controls with data in Blend) </li> <li>Services and Security </li> <li>Interoperability (JavaScript-.NET) </li> <li>Caching and ClientSide Persistence </li> <li>Silverlight Disconnected Client - Designing for Occasionally Disconnected Systems </li> </ul> <p>Vote for your favorite topics, but remember, they might take a while to appear, If you want to learn a topic for today's project, probably this is not the place and you would be better off in the <a href="http://silverlight.net/forums">SL Forum</a>, another blog or reading a book that gets you from a to z, but this can be an useful resource to learn SL a step a day or find some hidden tricks. </p> <p>The idea of this column is it to be something simple and a quick daily read. Something won't take you more than 5 minutes (and that probably won't take me that much time to write either). When needed I will point you to other places to get deeper info, so open your favorite RSS reader and <a href="http://feeds.feedburner.com/MiguelMadero">subscribe now</a> and remember to vote through e-mail or leave a message for the topics you would like to read soon here. </p> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0tag:blogger.com,1999:blog-22646861.post-52099507779133928122008-07-28T23:30:00.001-05:002008-07-28T23:31:17.293-05:00How to Update a TextBox Binding OnPropertyChanged<p>When using TwoWay Binding, most properties get updated after the control's property changes, but the Text in a TextBlock is a different case, it gets updated after the TextBox lost focus. It makes sense, since the value might be incomplete and validations and other logic triggered at the Business Object level unnecessarily, but sometimes this is not the desired behavior. </p> <p>WPF has an UpdateSourceTrigger as part of the Binding object and you could say something like:</p> <p>      <TextBox Text={Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}></p> <p>This is not available in Silverlight, but there's a quick workaround provided by <a href="http://silverlight.net/members/Yi_2D00_Lun-Luo-_2D00_-MSFT.aspx">Yi-Lun Luo</a> in this <a href="http://silverlight.net/forums/t/19746.aspx">thread</a>. </p> <p>        private void cantidadTextBox_TextChanged(object sender, TextChangedEventArgs e) <br />        { <br />            otherControl.Focus(); <br />            cantidadTextBox.Focus(); <br />        }</p> <p>It's really ugly, but works. </p> <p> </p> <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4c5af4a9-2a56-4965-94e1-c1f77686eb9e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Blogger Tags: <a href="http://miguelmadero.blogspot.com/search/label/Silverligh%20Tip%20of%20The%20Day" rel="tag">Silverligh Tip of The Day</a></div> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com2tag:blogger.com,1999:blog-22646861.post-13419015081730252012008-07-25T21:30:00.001-05:002008-07-28T17:18:14.903-05:00Style Inspector<p>Go check it out, it's a <a href="http://blogs.msdn.com/delay/archive/2008/03/22/improved-access-to-silverlight-2-s-generic-xaml-resources-silverlightdefaultstylebrowser-available-via-clickonce.aspx">cool tool</a> from the <a href="http://blogs.msdn.com/Delay">Delay</a>, the name is self explanatory and the tool is really easy to use so this post is one line long. Well an a screenshot.</p> <p><a href="http://delay.members.winisp.net/SilverlightDefaultStyleBrowser/SilverlightDefaultStyleBrowser.application"><img alt="SilverlightDefaultStyleBrowser sample image" src="http://blogs.msdn.com/blogfiles/delay/SilverlightDefaultStyleBrowser.png" /></a> </p> <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dc8aaf90-a345-46fe-bcf1-f40b6d9fd6a0" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Blogger Tags: <a href="http://miguelmadero.blogspot.com/search/label/Silverlight%20Tip%20of%20The%20Day" rel="tag">Silverlight Tip of The Day</a></div> Miguel Maderohttp://www.blogger.com/profile/16778996186476038710noreply@blogger.com0