• If you intend to take the Junior Level Linux Professional (LPIC-1) exams and to be Ubuntu Certified Professional (UPC), Canonical and the Linux Professional Institute have created a bundle promotion at the special price of USD $120 (approximate) per exam (LPI-101, LPI-102 and LPI-199), if purchased together. So, if you are interested about this offer you can read more about this special offer exam. You can request the vouchers using the online form or contact an Ubuntu Training Partner.

    Before you registered for the exam you should register for an account at Linux Professional Institute. After you register you’ll receive an unique LPI ID which you must provide (also with a valid ID card) at the exam center for proper identification.

    Exams can be taken on Pearson Vue or Prometric Testing Centers. You can locate a Vue testing center or look-up for a Prometric test center.

    I found Vue’s site more user friendly and the information more easy and more quickly to find, but this is just a personal opinion. On the other hand, it is possible that Prometric to have a testing center more close to you than Vue. It is better to take a look on both websites, to analyze data and to take the right action, convenient to your needs. The prices are similar for both providers, at least for my country. The difference is that on Vue’s site you can register for all three exams at any time and on Prometric’s site candidate must successfully pass either LPI 101 or 102 before booking for the second LPI exam and the Ubuntu 199 exam can be booked at any time.

    Vouchers are valid for 12 months from date of receipt so, there is enough time to learn and to prepare for successfully passing the LPIC-1 and UPC exams.

    Update, 06 June 2010: The link to “special offer exam” is dead. But the offer is still valid, and the link to “the online form” is still active. Good luck.

    • Share/Bookmark

    Tags: , , , ,

  • Web Design 21.07.2009 5 Comments

    To display elements in the way we desire we have to follow some rules, which means that, if we want to position an element inside a web page or to set the font size of the text, we can use some CSS style properties (such as margin, padding, font-size etc.) and eventually we can acquire the same result on most web user agents. The goal is to have the same result in all major web browsers. At this time we are talking about Mozilla Firefox, Internet Explorer, Opera, Safari and Chrome.

    CSS units for measurements

    According to W3 Consortium lengths refer to horizontal or vertical measurements and there are two types of length units: relative and absolute. Using relative units means that the scale from one medium to another will be more easily.

    Relative units are:

    • em: the ‘font-size’ of the relevant font
    • ex: the ‘x-height’ of the relevant font
    • px: pixels, relative to the viewing device

    The absolute units are:

    • in: inches — 1 inch is equal to 2.54 centimeters.
    • cm: centimeters
    • mm: millimeters
    • pt: points — the points used by CSS 2.1 are equal to 1/72nd of an inch.
    • pc: picas — 1 pica is equal to 12 points.

    Absolute length units are only useful when the physical properties of the output medium are known and with this, the discussion about these measurement units is closed.

    The most known and used units within CSS style sheets are em and px. One is relative to the relevant font and the other is relevant to the viewing device.

    Using em as measurement unit

    If we check the properties for our default (or many) web browser we will see that the default font size is set to 16px. A good approach is to define the font-size style attribute for the elements displayed in a web page to 62.5% which means that 1em measurement unit will be equal to 10px (simple calculation 62.5%*16px = 10px), or to directly declare font-size:10px. This is good because if we define a 1.1 em unit it is translated to 11px and so on. On the other hand if we are using values with more than one digit to represent non-integer values, problems may occur because, using values like 1.2345em cannot split a pixel to the desired value (1.2345*10px = 12.345px) and the measurement unit will take the rounded value. The problem comes when the subvalue is half of the value, because there is a different behavior among the top wide-spread web browser on rounding these values. Some of them will round the subvalues up (IE 6 and IE 7) and some of them will round the subvalues down (Opera and Safari) and Firefox tends to round both up and down. With this approach the result will not be the same on different web browsers.

    So, a good behavior is to use as much as possible multiplying values that in the end will compute integer values (measured as pixels). Take a look at this application which transforms px to em values and viceversa.

    Using px as measurement unit

    Because the content of the web pages is mostly served as graphic representation through an user agent to the audience a good reflex might be to set all measurement units using px values. This approach tends to be necessary and most desirable when the width and height style properties are declared, and even the measurement unit is relative to the viewing device, in absolute values the space occupied is the same.

    Using a mix of em and px as measurement units

    Another option is to use px as a measurement unit to declare some style properties, such as width, height, background-position or letter-spacing, and em measurement unit to declare another style properties like margin, padding, line-height, font-size or text-indent. In the last case, the properties will follow the size of the text font.

    Conclusions for what measurement units to use

    Based on whatever option we chose and use for measurement units it’s good to follow some practices.

    A good start is to declare explicitly the font-size for the body element to a fixed value of 10px. In this case the control of the sizes isn’t influenced by the default font size value on users’ web browser. If we set the value as a percent (62,5%) relative to the default web browser’s font size value, and if this value is different from 16px, problems may occur.

    Use px as a measurement unit for width and height of the elements. You may find that in IE7 11em is not equal with 110px when you set the width of an element (assuming that 1em = 10px).

    When we use em as measurement unit is better to define subvalues of it with one digit. Using more than one could lead to some unexpected displaying behavior on some web browsers which can make the web site pages look messy.

    Also, some attention should be given on inheritance on DOM tree. Changing the font-size value, after the initial declaration of 10px, should be made using the em measurement unit. Using px to declare the font size of an element will also modify the value of em measurement unit.

    Today web browsers developers tend to adhere to HTML and CSS standards more accurately than a few years ago, and for a web site developer this represents less time consumed for fixing bugs for old versions of user agents. I hope that one day in the near future, the old versions browser will be gone for ever, and the HTML and CSS standards will be implemented in the same way in all major browsers.

    • Share/Bookmark

    Tags: , , ,

  • AJAX 07.05.2009 1 Comment

    Ajax stands for Asynchronous JavaScript and XML and is a set of techniques for creating highly interactive web sites and web applications. The desired result is to update the website pages, using data fetched from the Internet, without refreshing the web page in the users’ browser.

    The communication between the server and the web browser is done using XMLHttpRequest objects manipulated through a JavaScript function. The goal is to create a JavaScript function which, based on users action, will change the data displayed on users’ browser following some well defined rules.

    Creating the XMLHttpRequest Object

    This object is built in the browser and, depending on what browser you are running the code, it is accessed in different way. Netscape Navigator (version 7.0 and later), Apple Safari (version 1.2 and later), and Firefox let you create XMLHttpRequest objects with code like this:

    XMLHttpRequestObject = new XMLHttpRequest();

    In case that you are dealing with Internet Explorer the object can be created using code like this:

    XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);

    The object is accessed in those browsers through the browser window object, and checking it’s presence means that you are dealing with certain web browsers.

    For Netscape, Safari and Firefox the code will be as follows:

    if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
    }

    For Internet Explorer we’ll have:

    if (window.ActiveXObject) {
    XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);
    }

    Although the XMLHttpRequest object supported in different browsers differs we can use the same basic properties and methods of this object.
    So, the code used to create XMLHttpRequest object for different web browsers will be:

    var XMLHttpRequestObject = false;
    if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
    XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);
    }

    Opening the XMLHttpRequest Object

    It’s time to open the XMLHttpRequest object. Here’s how you use the XMLHttpRequest object’s open method in general (items in square brackets are optional, and items in italics are placeholders that you fill in yourself):

    open(“method”, “URL”[, asyncFlag[, "userName"[, "password"]]])

    Where method is the HTTP method used to open the connection, such as GET, POST, PUT, HEAD, or PROPFIND, URL is the requested URL, asyncFlag is a boolean value which indicates if the call is asynchronous (default value true), userName is the user name of your account and the password is the password of your account.

    The method used to open the connection will be for this case the GET method. After the connection is open, we can start to open the XMLHttpRequest object and to configure it in preparation for connecting to the server and downloading data.

    This piece of JavaScript code will prepare the object:

    XMLHttpRequestObject.open(“GET”, dataSource);

    Note that using the open method like this configures the XMLHttpRequest object and it does not connect, or open any connection to the server.

    The onreadystatechange property contains the name of the event handler that should be called when the value of the readyState property changes (read/write). Using this property we can call an anonymous function that will open the connection to the server and to download the necessary data. Inside the anonymous function, we need to check on the data that’s been downloaded: is the download complete and are we ready to use that data? We can determine that with two properties of the XMLHttpRequest object: readyState and status.

    The value of 4 for the readyState property means that the download is complete and the value of 200 for the status property means that is completed OK. Checking these values with an if statement which returns the true value means that we can go further with our request.

    The JavaScript code will be as follows:

    XMLHttpRequestObject.onreadystatechange = function(){
    if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
    {//here we’ll place the necessary code to fetch the data}
    }

    To recover the downloaded text we can use the XMLHttpRequest object’s responseText property. That property is where the XMLHttpRequest object stores downloaded plain text. If we use XML data the object property will be responseXML (we’ll use it a little bit later) which is common for all major browsers.

    The JavaScript code will be:

    documentGetElementById(divID).innerHTML = XMLHttpRequestObject.responseText;

    where the element with the divID id will be the placeholder for our requested data.

    Connecting to the server

    In this example, we’re using the GET method, so we call the XMLHttpRequest object’s send method, passing it a value of null, which is JavaScript’s placeholder for a value of nothing.

    The JavaScript code will be:

    XMLHttpRequestObject.send(null);

    At this point we have created the XMLHttpRequest object, we opened it and we have created the connection to the server. From now we can make useful XML to store data and to have the source for our Ajax requests.

    Using Ajax with XML

    In the Firefox/Mozilla brand of browsers, we have to specify that we’re going to be downloading XML data, not plain text. To do that, we have to set the MIME type of the download to text/xml. We can achieve this using this line of code:

    XMLHttpRequestObject.overrideMimeType(“text/xml”);

    Another difference will be that we will use the XMLHttpRequest object’s responseXML property, which holds a JavaScript XML document object:

    var xmlDocument = XMLHttpRequestObject.responseXML;

    Let’s say that we want to download data regarding streets name from a certain city area (Bucharest in my case). For this we have to create a variable streetsName which will hold the data parsed from the XML file ruled by the Tag Name read-only property:

    streetsName = xmlDocument.getElementsByTagName(“streetName”);

    After this we need to create the format for the placeholder of the data. In this case I will create a list of elements <span> displayed as block. Maybe it will be better to generate elements of an unordered list, but the problem is that, using the following sequence of JavaScript code, the HTML output will be a type of <ul></ul><li>...</li>, which means that we have an empty ul element and some orphans li elements, and this could lead to problems on CSS formatting.

    The necessary code will be:

    var xmlDocument = XMLHttpRequestObject.responseXML;
    streetsName = xmlDocument.getElementsByTagName("streetName");
    obj.innerHTML = "Here are the fetched streets name:";
    for (loopindex = 0; loopIndex < streetsName.length; loopIndex++)
    {
    obj.innerHTML += "<span>" + streetsName[loopIndex].firstChild.data + "</span>";
    }

    where obj = document.getElementById(divID); which is the container of our data.

    The structure of the XML file will be simple:

    <?xml version="1.0" ?>
    <streetsName>
    <streetName>Calea Victoriei</streetName>
    <streetName>Regina Elisabeta</streetName>
    <streetName>Lascar Catargiu</streetName>
    <streetName>Iuliu Maniu</streetName>
    <streetName>Cotroceni</streetName>
    <streetName>Ion Ionescu de la Brad</streetName>
    <streetName>Calea Dorobantilor</streetName>
    </streetsName>

    From now the only thing we need to create is a form element which, based on user click action, will execute the function that will fetch the desired data from server.

    The entire code (HTML and JavaScript) can be downloaded from the following link, a simple example on how data is fetched form server using Ajax and XML.

    • Share/Bookmark

    Tags: , ,

Polls

New blog template! What do you think?

View Results

Loading ... Loading ...

 

July 2010
M T W T F S S
« Mar    
 1234
567891011
12131415161718
19202122232425
262728293031  
ally-disappointed