• Context Connection and SQLCLR Functions

    For one of the projects I have worked on recently, a set of variables needed to be computed for each product and for each month of the year on a regular basis. The product data was stored in SQL Server 2005 SP2. The computed volume was quite large since around 60 variables x 120 products x 12 months = 86,400 results needed to be calculated every time and be stored in the result table. The business requirements were the following:

    • The calculated variables were based on complex business rules which were quite tricky to be implemented in TSQL.
    • Each variable related to a product had to use input from various tables.
    • Variables related to a given product were independent of other products.
    • On the other hand, variables were sometimes based on others variables for the same product.

    It was decided to express the business rules using a .NET language such as C# and to create a Table-Valued Function (TVF) using the CLR. Srinivas Sampath wrote a good introduction on how to implement a TVF in .NET.

  • Review of SQL Server 2005 Reporting Services, Essential Skills for Database Professionals

    As I wanted to have a complete view of the features delivered by SQL Server Reporting Services (SSRS in short), and yet knowing how to use the product in real-world scenarios, I got a book titled Microsoft SQL Server 2005 Reporting Services by Brian Larson.

    The book is divided into three parts. All the examples are based on the Galaxy database, a fictional inter-galactic delivery service. The first version of the book was based on the sample database coming with SQL Server 2005, Adventure Works, but it seems that it was worth to develop a new sample database for the new edition of the book. But, it can make the TSQL queries a little bit harder to understand.

  • Testing Equality Operators with NUnit

    Any class or structure in .NET can define the equality and inequality operators. Implementing such operators, however, can be error-prone. The operators therefore need to be validated by unit tests. We will first discuss the challenges of writing such unit tests. We will then review how just one new NUnit constraint can help writing thorough tests for the equality and inequality operators.

  • Shortcut to sp_help

    sp_help is a stored procedure introduced by SQL Server 2000 which reports information about any database object. For example, executing the following SQL command in the context of Northwind will return information related to the table Customers.

    sp_help Customers

    SQL Server Management, the managing environment for SQL Server, allows the user to define many shortcuts, including shortcuts to stored procedures. The shortcuts are defined in the menu Tools/Options.... In the category Environment, Keyboard, each stored procedure is associated with a shortcut. By default, Alt+F1 is associated with sp_help.

  • Duplicating block settings across themes in Drupal

    I am currently working on an evolution of a website powered by Drupal (version 5). This evolution requires to install a new theme which will then be enabled for specific pages. Activating a new theme triggers the creation of a new set of configuration options for the blocks. In Drupal, blocks are boxes of content that may be rendered into certain regions of web pages, for example, into sidebars. Blocks can be positioned by specifying which area of the page they should appear in (e.g., a sidebar).

    Unfortunately, the settings for the blocks for the new theme are reset to the default values. It is a bit problematic because these settings are usually identical across similar themes. For example, my project has already 85 activated blocks including 27 visible blocks. The visibility of these blocks are often controlled by PHP code.

    Block Administration Settings in Drupal 5
  • Model-Driven Development: Doing it faster and cheaper

    Software engineers often deal with rich concepts related their lines of business such as suppliers, orders, commodity, authorizations, etc. Since the business logic drives the value of the software, this logic needs to be made a first-class citizen in applications. More specifically, the business concepts need to be modelized within a business layer (or business entities or business objects; all the terms being interchangeable).

    The CSLA framework written by Rockford Lhotka provides good guidelines for the required functionalities of such business objects. These functionalities are however not fine-grained enough for some projects. For example authorizations in CSLA depend on the type of the business object, not on the instance.

    This article aims at presenting some ideas which have been implemented during one of my latest projects. It is not a full-fledge architectural proposal, but a presentation of workable principles which have increased the productivity and the reliability of our projects. In the first part, we will first define core concepts which are supported by our business objects. In the second part, we will show how these concepts can be reflected into the UI by using data-binding expressions.

  • Electricity in Tanzania

    Plugging appliances in Tanzania is not as straightforward as one may think. During this my stay, I have polished my knowledge quite a bit. Firstly, I will introduce what kind of electric system is set up in Tanzania. I will then lay out case studies about two different appliances that I brought from the US.

    Disclaimer: I am not an electrician, so the coming advices and observations may be inaccurate. Do not blame me if your appliance gets toasted by following my advices.

  • Slides from the Advanced Data Mining course

    I have made available the slides from my two-hours presentation related to the Advanced Data Mining and Machine Learning course (COP 6579). The presentation aims at presenting the concepts used to implement noise elimination with the Ensemble-Partitioning Filter. The work is based on my thesis and has been covered in publications such as Advances in Computer Science.

    Download them here.

  • Real-time deformation of solids, Part 2

    Solid being deformed In the last article, a solution to deform solids in real-time was outlined. Deforming solids is based on a method called the Finite Element Method (FEM). In order to get real-time results, the FEM has been slightly adapted, and an implementation intended for video-games has been written.

    To summarize, the first step of the method which is carried out during the construction of video game levels consists of finding the linear relation between the stress applied on the solid and the node displacements. This linear relation is represented by a matrix which is serialized in a file. During the loading of the level, the application deserializes the file to extract the matrix. During the execution of the level, a collision occurring when a rocket bursts near a wall, for example, is translated into a force vector. Multiplying this force vector by the loaded matrix allows the application to find the deformation of the related solid with a high degree of accuracy. Please refer to the previous article to learn more about the FEM and its modification for real-time scenarii.

    Whereas we have been focused on general statements so far, we are now going to have a deeper look at the implementation and its possible optimizations.

    Steps of the method
  • Real-time deformation of solids, Part 1

    Screenshot of a deformed cube In the last few years, an important hardware gap has been filled by the video game industry: the GPU have replaced the CPU and software emulation. Although physics simulation has been extensively studied since the beginning of the computer age, this kind of simulation paradoxically remains little explored by video games.

    Let us take the case of physics simulation. Before the birth of the computer age, physicians had come up with many analytical equations for various physical problems. But unfortunately, these equations were focusing on simple cases. When computer started being used, analytical equations finally allowed finding approximate solutions; it was the beginning of the numerical computation.

    Numerical methods enable engineers to expand their abilities to solve practical design problems. They now treat real shapes as distinct from the somewhat limited variety of shapes from simple analytic solution. Similarly, they do not need to force a complex loading system to fit a more regular load configuration in order to conform to a purely academic situation. Numerical analysis thus provides a tool with which the engineer may feel free to look for the solution of practical problems.