Author Archive

I just finished modding my computer with the goal of making it more silent. It all started with an Antec Sonata III 500 which was supposed to hold my new Core2Duo. I like this case. Sturdy build and quite heavy. It has springs for the harddrive mounts to dampen the shocks and sound, a good 500Watt source and gorgeos looks and also it is very easy to work with, especially with me poking my head inside it to check and modify stuff.

 At that time I stuck with the Intel stock cooler which of course proved too loud. From the perfomance it was ok. I am not an overclocker so it was enough for the job. Still I needed to change it because it was loud as hell. I chose A Scythe Ninja 2 which can normally be used also in a fanless mode but I did not risk and installed also the provided fan, which is a 120×120 – 800rpm one (very quiet also).

My shock was of course that my system was as loud as before so I turned my head to the cooler on the VGA. This was a Saphire 4850 with a Zalman cooler; Noisy as hell as I saw, and thus I had to go for yet another upgrade which turned to be an Arctic Accelero S1 Rev.2. Also this is designed as a fanless sollution but again I wanted to play safe and added the turbo module which consists of 2 low rev fans barely audible.

All in all the system is now quiet and yet powerfull to play anything I throw at it. I could not make it dead silent but its miles from where it started. Below are some pictures I took along the process.
Read the rest of this entry »

Comments No Comments »

It’s been again a long time since my last post.
Today I wanted to explore a little bit the realms of paralel processing. As I already stated in some previous posts, the current trend of going multicore is somewhat out of phase of the current programming techniques, meaning we have multicore but we rarely use it. Most applications available on the market are single core and some have just some modules optimized for multicore.
Suprisingly the most parallel applications nowadays are graphics processing. Latest generation GPU’s are actually multicore processors, but specialized for simple operations (thus very fast). For the general purpose software developer this processing powerhouse is out of reach due to the different programming model. What this means is that first of all there is a lack of higher level abstractions of the GPU and also there are limitations because of this specializations.
There are some API’s available from NVIDIA and AMD (read ATI) in the form of CUDA and STREAM, but for me, as a C# developer they are not attractive since they offer a C++ API.

Fortunately there is Microsoft Accelerator which you can get from here. This is a .Net abstraction over the GPU and allows for some basic computations to be forwarded to the GPU instead of the CPU. Naturally I wanted to explore a little bit and especially to do some tests. Below is my test example, some results and remarks.
Read the rest of this entry »

Comments 3 Comments »

Hi,

Some days ago I read an interesting article about SSD performance degradation on Anandtech, and I kinda felt that this was happening to me also. I don’t own an SSD yet but I encountered flash performance degradation on my 8Gb Flash Voyager stick. Now I won’t go into the details about why flash performance degradation because the article above is more explanatory than I could make it. Suffice to say that I wanted to see if I can bring my stick back to life.

What was wrong with my voyager is that in the last weeks the write performance was poor. Whereas normally I could write at around 9MB/sec now I could only do it only at around 2-3MB/sec. From the article I understood that this was because even if the OS was reporting enough free space on the drive, all the space was already holding data and in order to write over it the flash needed to get the invalid data, write it to cache, delete the old location and then overwrite it with the new data. If one could delete everything from the location, subsequent writes would be just writes with no additional steps to execute, thus faster write speeds. This meant that I would need to do a format of the stick. But before that I had to do some tests to see performance before and after.
Read the rest of this entry »

Comments No Comments »

Today I was looking on MSDN and came upon a blog entry of J.D. Meier about 8 new big trends. I must say that I agree and I want to share them also here:

  • Analytics is Hot.  “The 21st century is all about math: some of the most unique, innovative ideas are emerging with these types of analytic projects. This is where the next billion dollar industries are being born.”
  • Small is the new R&D.  “Today, the global R&D process has changed, and small is big. The global, infinite idea loop allows topic experts to share their latest research and insight with their global peers on a continuous basis. It’s a fundamental transformation in which most new scientific discoveries now percolate from the bottom up.”
  • Attitude and Amusement. “The fact is, you’ll need them. That’s why workforce engagement is the big issue — you’ll only be able to get the staff you need if you can keep them active, engaged, interested and amused. A entirely different workplace concept that is radical, yet necessary.”
  • Time Disappears.  “The major trend going forward is the collapse of time. There’s no time to plan anymore – there is just a need for action. While we still need budgets to manage and control, they’ll have to be constantly adjusted to deal with new realities. In this context, volatility is the new normal : the concept of risk management, for example, is transitioning quickly to one of risk containment.”
  • Resistance to Change Retires.  “The coming generation of senior management aggressively pursues and implements new ideas. While the first is reluctant to embrace new business models, the next steamrollers them. Expect velocity!
  • Careers End. “Your paycheck will come from: the global, itinerant, part-time, skills-for-hire economy.”
  • Knowledge & Skills Banks.  “The capital of the 21st century isn’t financial : it’s experiential knowledge that is extremely scarce and specialized.”
  • Interactivity Redefines.  “Every industry will soon be transformed by the forthcoming era of “pervasive connectivity.”  Essentially, every device and thing around us is about to become plugged in — leading us to an era of interactivity and connectivity that is mind-boggling in scope.”

Comments 1 Comment »

One of the challenges of today’s projects is automatic tests. When we speak of automated testing we always target repeatability, meaning what we test today we must be able to test tomorrow and later. This is easy for database independent applications but when your testing functionality that modifies data you always find yourself wondering how can you ensure that when the tests start you have correct data.

Just to exemplify we will give an example. Suppose you have a table User with fields Id and Name. Your functionality needs to make an insert into this table but only if a user with the same name does not exist. You make an NUnit that tests the insert, when the tests runs a new user is inserted. But what happens when you run the second time the test? Well the insert will not execute as the user already exists. To avoid this situations you have 3 choices:

  • run a script at the end of the test that will clean up any existing data (you can do this also at the begining of the test). The main problem with this is that it is hard to maintain, especially when the database changes or there are many foreign keys involved.
  • restore a fresh copy of the db at the beginning of the test so you always have the same initial data. This is time consuming and the initial state of the database might change over time so you might have to manually maintain the “fresh” database.
  • use the rollback mechanism of the database.

If we are using NUnit and SqlServer the third choice is an easy one both in implementation and maintenance. There is a mechanism provided by TeamAgile which lets you specify that a test should have the data rolled back when the test ends. The idea is simple. When the tests starts, it informs the database that all the operations in the current thread context will be executed in a transaction and at the end it will instruct the database to do a rollback. The maintenance is eased because the database you use can be a copy of the live database and this suffers no data changes from test to test.

Now we get to the hard part. NUnit test data rollback is solved but lately all big web application also use automatic tests for the interface. The tools vary: Selenium, QTP, WatiN (our choice) or others. Now for this tests data rollback cannot be used like in the case of NUnit because each request gets it’s own thread context and all the other methods have their problems as stated above. So we get to the same problem. How can we do data rollback in automated web tests?

The solution I chose is easy, but depends on the data access layer implementation. For example we have a single point where SqlCommand’s are created and that is good because we can use transactions. The idea is simple; any time a database call is made we check if we have a transaction started and if so then we will execute the call within the existing transaction. But this is implemented in the data layer and our tests are done on the interface layer and we have to somehow connect them.

Create a special page where you  have two buttons and a textbox. One button is for starting a web transaction and one for rollback -ing a transaction. When the start button is pushed we make a call to the data layer to create a web transaction. This looks in a dictionary and gets us an unique id (i.e. an int) which will identify our transaction and this id we will show in the textbox and our tests records it for later use. Then we do our tests in the web pages like usual. When we finished we go to the same page enter in the textbox the transaction id and instruct to rollback.

I will post later some code to this so stay tuned …

Comments 1 Comment »

Ok, this should be a nobrainer for most of C# developers, me included. Still it happened to me and believe me I was dumbstruck.
I wrote a piece of code like the one below:

namespace TestInheritance
{
public class BaseClass
{
public BaseClass(string parameter) {}
}

public class ChildClass : BaseClass
{
public ChildClass() {}
}
}

Nothing special here but on compile time you get an error: “No overload for method ‘BaseClass’ takes ’0′ arguments“. Doh! how come? We don’t expect this to happen ussually but the little devil here is the inheritance and the non default constructor of the base class. When the constructor of the child class is called, it calls first the constructor of the base class with the same parameters. But if the compiler does detect a non default constructor it will not create the default one. So you get this error.

Cheers!

Comments No Comments »

Once upon a time in Developer Land, a developer was instructed to build a page that will show the great achievements of the ancients. He diligently started to create a model and used all that he could think of in order to make it good and make its employers proud. He added text and used nice fonts and alignment tags. He used lists to enumerate battles and deeds, and images to depict the stories.

The developer was good in his work and always printed his masterpieces at InternetExplorer’s shop because they were good friends and got to know each other well. And so his latest work got printed there also and it was looking marvelous.

Unfortunately this developer never got to read all 100 Commandments passed down to developers and stopped just short of 57 where it said:

“All tags should be finished by /> or </ …>”

But his friend, the apprentice from InternetExplorer shop knew him well, and if he found a tag not looking like it should he tried to make the best out of it and it was always good.

One day the employers hired a new developer and he was good also, but this one had read the commandments and even though he did not remember them all he had a tool that checked those rules and saw that in his colleague work an <img> tag was missing the end tag and he added it. When printing it at InternetExplorer shop it was looking fine. But there was you see something wrong, as this infamous tag was looking at first like this:

<img id=”imgAchievement” >

but after the second developer with his tool had modified it, it looked like this:

<img id=”imgAchievement” alt=”" />

Now the apprentice at InternetExplorer shop saw this but did not know where is the image that he should put in place and he said to himself that the developer erred and he went about his work and everything was good.

But one day a client said “I don’t like the guys at InternetExplorer shop and I want to use FireFox shop to print” and so he did, but there the apprentice of FireFox was a genius and knew all commandments and when looking at the <img> tag, he saw it was not saying where the image was and so he went about and did what he knew was right and showed there a picture of the whole artwork. But this was not good for the customer and so they tried to fix it but the developer could not speak with the apprentice from FireFox shop because they spoke different languages and only knew what the client said and so they struggled for what seemed to be an eternity.

Then the original developer remembered that a long time ago another client used to print this work at FireFox shop and that there was no problem and so he said “Why don’t we give this customer what I gave the customer from a long time ago ?”. And this was good ’cause the print was fine and wonderful and this because of one tiny thing. The old print had the old <img> tag which the apprentice from FireFox shop saw it was wrong and incomplete and ignored the troublemaker.

But our story does not end here because the new developer was a perfectionist and his proofing tool never failed and when he saw that the model was wrong again he modified it unaware of the troubles it would bring. A while later another client went and used the FireFox shop and the problems were there again. But this one was determined to find out why, and so he took the long journey to the city where FireFox Inc. had shop and through endless discussions and sign languages he found what the problem was, and then he was struck. He did not need that <img> tag, it was not doing anything but trouble and so he removed it and that model was still printed for years to come even on the shop of Safari Inc.

Conclusion

You see young developers we all must abide by the commandments, because by them work also the print apprentices ,and while some learn our habbits and move and make shop in other countries calling themselves FireFox 2 or FireFox 3.0.3 or Internet Explorer 6.1 or 7.0 they all know the commandments. And if we make the model by those commandments we can be sure the prints are as we envision them.

Comments 2 Comments »

Damn, I knew it would come to this … probably gonna take a holiday … :D

For the nostalgic ones here are some movies from past fallouts:

The intro from Fallout1

This is the famous “War never changes …” story from the intro of Fallout2. It took quite some time to find one that has the sound in good quality.

And finally the intro from Fallout3

Comments No Comments »

Yesterday I cam across an issue while integrating a project in our CruiseControl.Net (CC). We needed a file from a project to be checked out always on the CC server. This is impossible with the current implementation of CC because when it tries to get the latest version from VSS it would crash, because the combination of parameters that CC sends to VSS is such that it cannot ignore locally checked out files.

VSS is actually called using the executable “ss.exe”. This accepts an option for the get command called “-GWS”. The problem is that the configuration section of CC does not support this parameter so we don’t have any way to tell VSS about skipping checked out files.

The solution looks simple although it caused me some headaches. You just have to  create a batch file that calls “ss.exe” with the right parameters. Below is the file:

@echo off

IF %1==history GOTO lhistory
IF NOT %1==history GOTO lget

:lhistory
“c:\Program Files\Microsoft Visual SourceSafe\ss.exe” %*
GOTO lend

:lget
“c:\Program Files\Microsoft Visual SourceSafe\ss.exe” %* -GWS
GOTO lend

:lend

@echo on

So what does this? It looks at the first parameter of the command sent by the CC and if it is “history” then it would just call the “ss.exe” with the parameters received from CC otherwise it would add another parameter “-GWS”. Why the branch? because the history command does not support the option GWS and you’d get errors.

To use this just replace the name of the executable of VSS in your ccnet.config file to use the batch file and not “ss.exe”. Like this:

<executable>c:\Program Files\Microsoft Visual SourceSafe\SS.bat</executable>

Of course this can be further improved and the idea used for other purposes.

Happy integration!

Comments No Comments »

This week I did alot of work with FormView and of course databinding when I encountered strange cases of data not being posted back to the business objects that it was bound to. It did give me a hard time but in the end the answer was simple. Take a look below:


<asp:formview ID=”frmAddress” runat=”server” DataSourceID=”odsAddress”>

     <ItemTemplate>

        <table cellspacing=”10″>

            <tr runat=”server” id=”trMainAddress”>

                <td style=”width:200px;” valign=”top”>

                    <b style=”font-size:large”>Main address:</b>

                </td>

                <td valign=”top”>

                    <asp:Textbox ID=”txtAddress” runat=”server”

                         Text=’<%# Eval(“AddressAsString”) %>‘>

                   </asp:Textbox >

                </td>

            </tr>

        </table>

    </ItemTemplate>

</asp:formview>

The reason was the striked out code at line 4. Because the table row has a runat attribute and an ID,  it is regarded as a server control.

An example on what happens can be easily understood by the syntax change for getting a refference to the textbox txtAddress:


// table row does not have runat and id

TextBox txt = (TextBox)frmLabelOnly.FindControl(“txtAddress”);

 

// table row has runat and id set

TextBox txt =

   (TextBox)(frmLabelOnly.FindControl(“trMainAddress”).FindControl(“txtAddress”));

 

In the case of the row having an id and runat attribute, the formview simply does not see the textbox because it’s on a level below the controls list. and cannot thus gather the information entered by the user and cannot send this data to the dataobject that it was bound to. And of course it can give you a massive headache :)

Cheers.

Comments No Comments »