Windows Home Server FAIL

This is a good reason not to install Windows Home Server.

windows-home-server-fail

The setup will format ALL disks attached to the computer.

Next, I’ll try FreeNAS, powered by FreeBSD.

Advertisements

jQuery Validation and select tags

Just a note to myself, when using jQuery Validation for a select, make sure the first value, "Please select an option" has an empty value.

Like this:

<select id="regions" class="required" name="regions">
    <option value="">Please select an option</option>
    <option value="1">Region 1</option>
    <option value="2">Region 2</option>
</select>

Here’s the original text:

http://docs.jquery.com/Plugins/Validation/Methods/required

Validate a form on a click (pun intended)

I have a grid with users, where for each user several reports can be generated.

The reports must have a start and end date and because some technical constraints and because I wanted to let users re-use an url, I decided to send the values by query string.

Then, I had to add some validation, so that the user would be forced to select the report dates.

Then, the problem, how to prevent the click on the link if the form was not valid?

Here’s the solution:

 

<div id="start-date-area">
    <p>Select the start date:</p>
    <input id="cal-from-date" name="from" type="text" class="required for-report clickable" readonly="readonly" />
    <p></p>
</div>
<div id="end-date-area">
    <p>Select the end date:</p>
    <input id="cal-to-date" name="to" type="text" class="required for-report clickable" readonly="readonly" />
    <p></p>
</div>

 

$("a.submit").live("click", function(ev)
{
    ev.preventDefault();
    var $self = $(this);

    $("#aspnetForm").validate();
    if ($("#aspnetForm").valid())
    {
        // generate a querystring fragment from the fields I need to send to the server
        var qs = $(".for-report").serialize();

        //console.log("qs: " + qs);
        document.location = $self.attr("href") + "&" + qs;
    }
});

I have used $("a.submit").live("click", function(ev) instead of

$("a.submit").click(function(ev) because the rows are added in the grid using ajax and click works only on current elements and not on possible future elements.

jQuery.serializeArray() works also outside a form

 

Quote from jQuery docs: "Note that serializeArray() only works on form elements, using this method on another element will not work."

(http://docs.jquery.com/Ajax/serializeArray)

 

However, this is wrong, at least in 1.4.2 because I’m using the function to send some params to a controller this way:

<input type="hidden" id="LicenseId" name="LicenseId" value="" class="markerDTO" />
<input type="hidden" id="marker_Color" name="marker.Color" value="" class="markerDTO" />
<input type="hidden" id="marker_Id" name="marker.Id" value="" class="markerDTO" />

The 3 fields are not included in any <form></form>

var oo = $(‘.markerDTO‘).serializeArray();

jQuery.ajax({
            url: ‘-my-url-‘,
            dataType: ‘json’,
            data: jQuery.param(oo),
            complete: function()
            {
                var licenseId = $("#LicenseId").val();
                var color = $("#marker_Color").val();

                $(‘div.marker-color[license-id=’ + licenseId + ‘]’).css(‘background-color’, color );

                // unblock when remote call returns
                jQuery.unblockUI();
            }
        });

 

Also it works with just one input:

var oo = $(‘#LicenseId’).serializeArray();

How to lose an interview: ask about the Joel’s test

Recently I had an interview for a job, for an Austrian company, involved in banking automation.

They are looking for .NET software developers for the Bucharest office.

So I passed the first technical interview at the recruiting company and I went on to discuss with the technical manager and the boss.

They asked, I answered pretty well, except for a couple of questions.

Everything seemed alright for them and for me too.

At the end, when I was asked about my questions about the company, how they work and so on, I pulled-up a piece of paper with Joel’s test.

I like to consider the Joel’s test like a smoke test for software companies. You can find the details here: http://www.joelonsoftware.com/articles/fog0000000043.html

The guy seemed a bit shocked but he answered the questions. And the answers made me happy.

I thought, hey, this is a nice company, I might like it here…

 

But… a couple of days later I got a phone call from the recruiting company saying that the answer was negative, but not for technical reasons but because they were very displeased by my questions, from the Joel’s test.

 

The conclusion? Be very careful with what you ask your potential employer. 😉