Posts

Showing posts from May 22, 2011

Seven Tips and Tricks Programming WPF

The Internet has much to offer in any topic and there is much to learn, but where to start? I realized many years ago, when I got intrigued by the Windows Presentation Foundation (WPF), short write-ups that help you acquire additional knowledge, which when combined can provide solutions to the bigger picture. This article provides a list of tips I learned a year ago, while scanning for simple solutions to big problems.  javascript:void(0) Use the list Visibility.Collapsed vs Visibility.Hidden  The collapsed value ensures that the element is not involved in the design and gives you a zero height and width. The latter causes the element to continue to participate in the design.  Reduce CPU consumption for animations to WPF   As you know, WPF animations are based on 60 frames per second. You can reduce this to a lower optimal rate, resulting in less CPU usage. Use the timeline. DesiredFrameRateProperty to change the default, set to a lower value as 15, and then changes according t

Bind jQuery event handlers for this object CoffeeScript

Bind jQuery event handlers for this object CoffeeScript  Friends have told me that the rich domain objects rarely does so using jQuery to improve performance in web pages. I myself have always loved dynamic JavaScript as a language rich first and something for the second DOM. So most of my client-side JavaScript is an object-oriented robust approach similar to Ruby. This is the main reason they have used Prototype.js for so long. Since both jQuery and Rails CoffeeScript announced as the default in version 3.1, I decided it was time to start learning them. I had always known that jQuery linked keyword is in the event handlers to the DOM object. Something you are totally confused and unacceptable for someone working on their own objects to encapsulate behavior. Today I found two ways to deal with my problem, one way and one way CoffeeScript jQuery. First a code example. class MyObject      constructor: ->     @myDomElement = $('#myDomElement')     @._initBehavior

Adding a Controller

Image
Adding a Controller MVC stands for  model-view-controller . MVC is a pattern for developing applications that are well architected and easy to maintain. MVC-based applications contain: Controllers: Classes that handle incoming requests to the application, retrieve model data, and then specify view templates that return a response to the client. Models: Classes that represent the data of the application and that use validation logic to enforce business rules for that data. Views: Template files that your application uses to dynamically generate HTML responses. We'll be covering all these concepts in this tutorial series and show you how to use them to build an application. Let's begin by creating a controller class. In  Solution Explorer , right-click the  Controllers  folder and then select  Add Controller . Name your new controller "HelloWorldController". Leave the default template as  Empty controller  and click Add . Notice in  Solution Explorer  that a new fil