Articles

VirtualBox: Installation failed! Error: System can not find the path specified.

I’ve just discovered today that I couldn’t install new version of VirtualBox due to problem with Installation failed! Error: System can not find the path specified.. After some investigation here is the solution:

  1. Open command line cmd
  2. Go to the directory where is your VirtualBox installation file. Mine installation file is (at the moment) VirtualBox-4.3.4-91027-Win.exe
  3. Run VirtualBox-4.3.4-91027-Win.exe -extract . It will extract files to directory C:\users\USERNAME\AppData\Local\Temp\VirtualBox or to your defined TEMP directory
  4. Above l[……]

Read more about post VirtualBox: Installation failed! Error: System can not find the path specified.

Modal windows – are they always necessary?

I do not want to write about “what is modal windows”, but focus on potential problems which may occur when you start using modal windows in some scenarios. More about modal windows you can find in article Techniques for creating modal windows.

Example:

Screenshot of My Library modal window example
Source: Screenshot of My Library modal window example

Before you create modal windows everywhere consider:

  • Provide “resize option. Otherwise customer will not be able to resize the modal window and probably some content may not be visible e.g. when user will set font size bigger.
  • [……]

Read more about post Modal windows – are they always necessary?

JS Tip: How to check if specified HTML element is supported by the browser

To check if browser support specified HTML element you can use:

function isHTMLElementSupported(elm) {
    return (Object.prototype.toString.call(document.createElement(elm)) !== '[object HTMLUnknownElement]');
};

Object.prototype.toString returns the value of the object’s internal [[Class]] property.

Every object has a toString() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected. By default, the toString() method is inherit[……]

Read more about post JS Tip: How to check if specified HTML element is supported by the browser

How to check if browser supports cookies using client-side technique

Introduction

There is at least (which I know) two methods to find out if cookies are enabled or not. You can use client-side script techniques or server-side techniques. Here I will present client-side technique.

To check if browser supports cookies I’ll create some methods for set, get and enabled and use Navigator.cookieEnabled. Now I will do 2 steps:

  • use window.navigator.cookieEnabled which returns a Boolean value that indicating whether cookies are enabled or not (read-only).
  • or try to set test cookie (if Navigator.cookieEnabl[......]

Read more about post How to check if browser supports cookies using client-side technique

Simple date picker

Basic information’s

I’ve created simple date picker using just JavaScript and CSS. Yes, there is a lot of date pickers, but not like this one 😀 Anyway, my goal was to build date picker which will be:

  • independent of any 3rd party libraries
  • working with keyboard navigation
  • working with screen readers
  • fast and as much as possible small file size
  • simple to implement
  • cross-browser
  • passing JSLint in case of JavaScript code

The first, basic version of datepicker you can see and download at my lab section. There is still some l[……]

Read more about post Simple date picker

Simple technique to preload images at specified moment

There are many ways to preload images, including methods that rely on CSS, JavaScript, and various combinations thereof. Here I would like to present some of my favorite technique which can be used for preloading images.

Why preloading?

Preloading images can be useful when you need resources without waiting for download them. However, while technique for preloading is important then sometimes is more important when you do this.

Disadvantages

Preloading is useful. However, there is a problems which could affect on overall performance[……]

Read more about post Simple technique to preload images at specified moment

JS tip: always use full reference

Let’s say we have an example of code like this:

(function(){

    function close_window() {
        if (typeof self.close === 'function') {
            self.close();
        }
    }
    // and somewhere in the code above method is called many times

    function some_action() {
        // here some code
        close_window();
    }

}());

Note: method close_window could be written in a better way, but in that case I wanted to show just a simple example.

Some time later someone did more changes and then after all the code[……]

Read more about post JS tip: always use full reference

PHP: simplexml_load_file and unable to find the wrapper

Tried to use method simplexml_load_file, but I’ve got Warning: simplexml_load_file(): Unable to find the wrapper "https" – did you forget to enable it when you configured PHP?. I use WAMP package and I found that I had no enabled php_openssl.dll in PHP ini configuration. So, I solved it by removing comment in line ;extension=php_openssl.dll in file c:\wamp\bin\apache\apache2.2.22\bin\php.ini (this depend on your configuration, so check where php.ini is).

CSS: provide a unit for zero lengths

Zero lengths do not need unit. However, there is some significant benefits of using unit with zero lengths while developing code.

See real unit and easy change of them in browser developer tools

If you have an element which you need to modify the margin, padding, width or height for, you can use the cursor keys to increment/decrement the size. Simply use the up and down cursor keys to increment/decrement by a unit of 1.

In Chrome, Firefox and Safari you can increment/decrement by a unit of 10 by holding the “Shift” key whilst pressing th[……]

Read more about post CSS: provide a unit for zero lengths

Get HTML img element reference by document.getElementById vs document.images

document.images returns a collection of the images in the current HTML document. Well, I assumed that it could be faster to get image reference by using document.images collection than just document.getElementById because document.images not operating on as large an HTMLCollection.

However, I made some test (on jsperf as well) and seems that document.getElementById method is faster in Firefox 22 and Chrome 27.0.1453.116 m, but not in IE 10.0.9200.16618 and not in Opera 12.15. All tests was done on Windows 7, 64bit.

Note:

As suggested b[……]

Read more about post Get HTML img element reference by document.getElementById vs document.images

Pagination