May 2007 - Posts

DevDays Review

This year was my first DevDays and I have to say I enjoyed it!!! I started off with "Building ASP.NET AJAX enabled Applications". I found the session informative and well presented. I am not a web developer so I just wanted to know what AXAJ are and a demo of how it works. For the second season, I decided to skip the next AJAX session and opted for "Client-side Development with Office". In this session I for the first time started thinking of office as a business platform. While sitting in this presentation, I started thinking of ways of using the information that was presented. When I got home, I downloaded VSTO SE and immediately started developing a sample application. The next session was the one that I looked forward to... "Building rich interactive web applications with Silverlight". I was a bit disappointed in the fact that only Silverlight 1.0 was used. For the last session I attended the "IIS 7 End-to-End Developer overview”. The session showed nice config examples and I was impressed by the demo of IHttpHandler to add copyright messages into photos

Overall I thought DevDays was a worthwhile event, the only thing I regret is not being able to go to the SADeveloper.net after party

Posted by rudi | with no comments
Filed under:

SQL + Images Redux

Thank you for all the suggestions on how and why I should or should not store images in a SQL database. After posting my blog, I decided to do some reading about my problem. I found the link posted by Pieter to be very helpful. The following pros and cons were identified:

Pro's

  • The images are backed up with the data in a coordinated fashion.
  • All "pointers" between your structured data and the images are maintained.
  • No "broken link" problems
  • No out of sync problems
  • No multiple namespaces

Con's

  • Two different security environments.
  • Performance, performance, performance!!!
  • SQL Server breaks images up into chunks that fit on database pages. This makes reassembling the images slower than if they are stored, without additional internal structure, in a file. It also makes it impossible to use the operating system's built-in facilities to transmit a file directly from disk out over a communications link in kernel mode. So, from the standpoint of serving the image out onto the web it is definitely much slower.
  • Images stored in SQL Server are returned to the application via the TDS protocol and the data access APIs. Again, these are not optimal for image processing and impose overhead that doesn't exist with a file.
  • Most applications that process images read and write them from the file system. So, if the image is stored in SQL Server then you have to read the image out of the server, write it to a temporary file, and then invoke the image processing software against the temporary file.

 

In Impilo Health Management project, the images that need to be stored aren't high volumes. There are maybe 50+ gym exercise machines, and thy are not regularly accessed. It is planned that these images are only used in 2 situations:

  • 1) In general operation, members can browse all the available equipment owned by the gym to view possible uses and operating instructions. Members will also be able to browse equipment by muscle group affected. This browsing will generally happen on the KIOSK application and not from the website
  • 2) Later operation will include exercise program were members can configure exercise program and print these program from the web...

I believe that this is relative low usage and would allow me to rather save the images in the database. It would also simplify future rollouts if there are multiple clubs with different equipment...

 

For more information about the Impilo Health Management project visit us at www.codeplex.com/impilo

 

Posted by rudi | with no comments
Filed under:

SQL + Images

I have a question for all the SQL experts... In the Impilo Health Management project, I want to create a browser of all the existing gym equipment. I created tables in my database to store information about these machines (ie. Description, instructions, manufacture, etc). I also need a image or thumbnail of this machine to be displayed using a LINQ query? Should I:

  1. Store the image in the SQL database and bind it to the Image object
  2. Store a path name to a image and bind this to the Image URI?

For more information visit www.codeplex.com/impilo

 

Posted by rudi | 7 comment(s)
Filed under: , ,

MySpace

I found a very interesting website detailing some developments at MySpace. It's amaizing to read about how fast thy grew and scaled... e-NaTIS might take some tips from themWink

http://www.baselinemag.com/print_article2/0,1217,a=198614,00.asp

 

Posted by rudi | with no comments
Filed under:

Dependency Properties

I am currently reading an excellent book by Charles Petzold called "Application = Code + Markup". The current chapter I am reading is called Dependency Objects. I have decided to try and practically implement DependencyObjects as part of the Impilo Health Management System.

One of my projects requirements is an application to be installed in locker rooms of a health club. On the screen it must show all the lockers in the locker room and then mark the lockers that are already occupied. A user must also be able to select a locker and authenticate his identity and then the application must open the selected locker and reserve it for the member. Once the member is finished exercising, he can just authenticate his identity and the locker must open for him to remove his belongings. For the purpose of this blog, I will only explain my experiences trying to implement the Locker class and how I bind it to the graphics representation of the lockers.

I first created a class called Locker with dependency properties for isAvailable, occupiedBy and Description

1) Define the property

public static readonly DependencyProperty isAvailableProperty;

public bool isAvailable

{

      set

      {

            SetValue(isAvailableProperty, value);

      }

      get

      {

            return (bool)GetValue(isAvailableProperty);

      }

}

2) Register the property in the constructor

isAvailableProperty = DependencyProperty.Register("isAvailable",typeof(bool),typeof(Locker));

For the purpose of this blog, I will only bind a single locker object to a checkbox. This will allow me to click on the checkbox and verify that my locker object is updated.

The following code assumes that a checkbox and a button are already created:

locker = new Locker();

locker.isAvailable = true;

locker.Description = "Locker 1";

 

Binding bind = new Binding();

bind.Source = locker;

bind.Path = new PropertyPath(Locker.isAvailableProperty);

cbAvailable.SetBinding(CheckBox.IsCheckedProperty, bind);

 

To verify that the binding works, I added the following event to a button:

if ( locker.isAvailable )

    MessageBox.Show("Available");

else

    MessageBox.Show("Not Available");

If you run the following application you can toggle the checkbox and verify the state by clicking on the button. DependencyObjects/DependencyProperties are very easy to use and implement. Binding to these properties are natively supported by WPF. Other advantages of using DependencyObject are:

  • Default values
  • Expressions
  • Inheritance
  • Styling
  • Property Invalidation

If there is a demand, I will try and explain some of these features in more detailed in future blogs...

For more information about Impilo Health Management project visit www.codeplex.com/impilo

 

Posted by rudi | 2 comment(s)
Filed under:

Should I log every visit?

As I mentioned in some earlier blogs of mine,I am working on a Health Club Management suit of applications called Impilo. I am currently busy updating the database and I am faced with relatively big dicsion. The application needs to keeps records of the gym members visits. I am now wondering if my Members table must just have a value called visits and I increment this visits or should I rather creat a new table called Visit that keeps a refrence to the members ID and saves the date and time of the visit and count this? What are the pro's and con's of each implementation?

 Implementation 1: Incement visit counter

Pros: This implementation should be very easy to implement and will have minimum overhead on the database but it isn't very flexiable.

Cons: Reports can now only show the total amount of visits. These visits can't be data mined to try and determin visit trents, etc.

Implementation 2: Log each visit

Cons: This implementation might increase my database size considering that a average gym might have up to 5000 members. If 20% of these members visit the gym per day then there will be up to 1000 transactions per day. The increase in data to be stored might impact performance

Pros: More details stats can be gathered and a member can even see a trend based on his visits (ie. Gyms more in the morning than the evenings, Stay longer in the summer than the winter, never train on mondays, etc.).

 For more information on this project visit the codeplex site: www.codeplex.com/impilo

Posted by rudi | 6 comment(s)
Filed under: ,

Bind LINQ and WPF

The following sample code shows how to bind a LINQ query to a WPF control only using C#. 

listBox1.ItemsSource = dataContext.Members;

 

DataTemplate template = new DataTemplate();

FrameworkElementFactory factory = new FrameworkElementFactory(typeof(StackPanel));

template.VisualTree = factory;

FrameworkElementFactory childFactory = new FrameworkElementFactory(typeof(Label));

childFactory.SetBinding(Label.ContentProperty, new Binding("Name"));

factory.AppendChild(childFactory);

childFactory = new FrameworkElementFactory(typeof(Label));

childFactory.SetBinding(Label.ContentProperty, new Binding("Surname"));

factory.AppendChild(childFactory);

listBox1.ItemTemplate = template;

 

 

 

Posted by rudi | with no comments
Filed under: ,

LINQ

Last night I attended a very informative talk hosted by sadeveloper.net. Armand explained in detail how LINQ works. Some very interesting subjects was touched on (ie. Lambda expressions, Anonymous types, Extension methods, etc.). The only subject that wasn't touched on was binding to WPF controls. I am hoping to post a little more on this subject in the near feature.

I also lauched my first official open-source project today. Please note that the project is still in very early development but in the near feature will harness loads of the very powerfull features in the new .NET 3.0 framework including WPF & LINQ. The project is aimed at teaching myself new features in the .net framework. The early version already contains a DAL created using DLINQ (SQLMetal) and a BLL using some of the new LINQ query statements. A simple KIOSK application is also under development using some of the very interesting WPF features. Some simple binding to the database is also used. The next version will be a more functional, I was a little bit rushed to alteast release some code as my 30 day period on codeplex expired today.

The project is hosted at www.codeplex.com/Impilo. If anybody would like to contribute, please contact me ASAP. I hope to have a full DVD with all the required applications and code available at DEVDAYS.

Posted by rudi | 2 comment(s)
Filed under: ,