Building a faster and stronger web

Recently Google started a new beta service to optimize the performance of websites, called PageSpeed Service. PageSpeed Service is an online service to automatically speed up loading of your web pages. PageSpeed Service fetches content from your servers, rewrites your pages by applying web performance best practices and serves them to end users via Google’s servers across the globe.

Google also offers best practice rules and analysis and optimization tools and SDK’s to make the web faster.

O’Reilly organizes conferences to change the world by bringing you face-to-face with the knowledge of innovators and practitioners. Velocity, about web performance and operations, is much more than a conference; it’s become the essential training event and source of information for web professionals from companies of all sizes. Fluent, javascript and beyond, presents the tools and technologies driving the web.

Steve Sounders started in 2010 the HTTP archive to track how the Web is built. Trends in web technology load times, download sizes, performance scores and much more can be downloaded to present statistics.

Responsive Web Design (RWD) and Lazy Loading are two ways to build a better web.

Regular expressions and regex test tools

Last update : March 7, 2013

A regular expression (regex) is a specific pattern that provides concise and flexible means to match strings of text (particular or patterns of characters, words, …). A regular expression is written in a formal language that can be interpreted by a regular expression processor.

The following list provides links to some regex test tools :

Tools and utilities developed by Nir Sofer

Last update : March 2, 2013

NirSoft USDDeview Tool

I recently discovered the unique collection of small and useful freeware utilities and tools, available on the website NirSoft, created in 2001. The name NirSoft is the combination of the developers first name Nir and the prefix of the word Software, respectively the last name of the developer, Sofer.

Nir Sofer is an experienced developer with extensive knowledge in C++, .NET Framework, Windows API, and Reverse Engineering of undocumented binary formats and encryption algorithms.

The domains covered by the more than 100 tools of NirSoft are various : Password Recovery, Network Monitoring, Web Browser, Video/Audio, Internet, Desktop, Outlook/Office, Programming, Disk, System, …

All of the utilities are fast, small, portable and effective. Most are developed in C++ and don’t require any installation.

My favorite Nirsoft tools are the following :

Nir Sofer provides also tips and tricks about computers and software as well as code samples.

Groovy : a dynamic language for the Java platform

Groovy is an agile and dynamic language for the Java Virtual Machine. It builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk. Groovy seamlessly integrates with all existing Java classes and libraries and compiles straight to Java bytecode so you can use it anywhere you can use Java. A set of Eclipse plugins that provide Eclipse support for Groovy projects is available (Groovy-Eclipse).

The current stable version is 1.8. Groovy is used among others for the development of plugins for the DLNA media server Serviio.

GPU Caps Viewer

Last update : September 16, 2014

GPU Caps Viewer is a video card information utility that gives details about hardware (GPU) and software (OpenGL, OpenCL and CUDA API level support).

The current version of the program is 1.21.1.2 released on September 5, 2014. The following pictures show the informations displayed  for my desktop PC used for some tests with the outstanding ReconstructMe Project.

GPU Caps Viewer 1.16.0 : General View

GPU Caps Viewer 1.16.0 : CUDA View

GPU Caps Viewer 1.16.0 : OpenCL View

GPU Caps Viewer has been developed by Jérôme [JeGX] Guinot from Switzerland. He considers himself as OpenGL developer and GPU torturer. He is the owner of the blog Geeks3D providing informations about 3D tech news each and every day. He is also the founder of the website oZone3D.Net (“Heat up your graphics card”) and maintains the personal log JeGX’s Infamous Lab (former JeGX’s DevBlog). Some other creations of JeGX are GeeXLab, FurMark, TessMark, FluidMark, ShaderToyMark, GPU Shark, GLinspector, EVGA OC Scanner and MSI Kombustor.

The program  contains 11 OpenGL and 8 OpenCL demos.

Windows folders, junctions and libraries

Microsoft first introduced the My Documents folder in Windows 95 OEM Service Release 2, as a standard location for storing user-created files. The folder was displayed on the user’s desktop, but located under the root of the hard drive where Windows was installed. In Microsoft 98 the special folders My Music and My Pictures were added, later the My Videos folder by installing the Windows Media Player 10 or 11.

In Windows XP the “My Documents folder” was set up in the user’s profile directory \Documents and Settings\[user name]\My Documents\ (alias %USERPROFILE%\My Documents\. as a special folder, which is presented to the user through an interface as an abstract concept, instead of an absolute folder path. This makes it possible for an application to ask the operating system where an appropriate location for certain kinds of files can be found, regardless of what version or language of operating system is being used.

The same was true for My Music, My Pictures and My Videos.

Windows Vista renamed the “My XXX folders” simply as “Documents, Music, Pictures, Videos” and moved them under the user’s profile directory (C:\Users\[user name]\ alias %USERPROFILE%\). To enable backward operability (compatibility) with legacy applications, the concept of NTFS junction points was introduced. A junction folder is a sort of shortcut and displayed with an curved arrow in the icon. When clicking on a junction folder in Windows Explorer, an “Acces denied” message is usually displayed.

Windows 7 keeped the same location and mecanisms, but reintroduced the “My” prefix in the user’s profile directory. Windows 7 launched also the concept of libraries to make it easier to find, work with, and organize files scattered across a PC or a network. Libraries are user-defined collections of content. To assemble a photo album for example, snapshots can be saved physically in different locations, but with a library they show up in a single window.

Windows 7 comes with one main library called “Libraries”, containing four default libraries : documents, music, pictures, and videos. They can be extended, customized and shared with others with just a few clicks. Up to 50 folders can be included in one library. Every library has a default save location. Each library contains two physical file locations, the user’s personal folder(s) and the public folder. Only locations that are indexed by Windows 7 can be added to a library.

A library consists of the following parts :

  • General library information
  • Library properties
  • Library locations

More informations about folders, junctions and libraries are available at the following links :

XMLHttpRequest’s in Internet Explorer 5 and 6

Internet Explorer versions 5 and 6 did not define the XMLHttpRequest object identifier in their scripting languages as the XMLHttpRequest identifier itself was not standard at the time of their releases.

The following JavaScript encapsulation is used to provide a backward compatibility with these browsers :

 
if (typeof XMLHttpRequest == "undefined") 
  XMLHttpRequest = function () 
    { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } 
      catch (e) {} 
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } 
      catch (e) {} 
    try { return new ActiveXObject("Microsoft.XMLHTTP"); } 
      catch (e) {} 
    //Microsoft.XMLHTTP points to Msxml2.XMLHTTP and is redundant 
    throw new Error("This browser does not support XMLHttpRequest."); 
};

Cross Domain Communication, Same Origin Policy and CORS

In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The term origin is defined using the domain name, protocol, and port number of the HTML document running the script. It has always been possible for the browser to make cross origin requests by specifying a resource from a foreign domain in the IMG, SCRIPT, IFRAME tags etc. But with these requests the client-side script does not have access to the content of this resource, it can only be executed or rendered by the browser.

The same origin policy permits scripts running on pages originating from the same site to access each other’s methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites. The goal of the policy is to prevent cross-site scripting (XSS), a type of computer security vulnerability typically found in Web applications that enables attackers to inject client-side script into Web pages viewed by other users.

With the growing popularity of Ajax, a group of interrelated web development methods used on the client-side to create asynchronous web applications, the same origin policy became more and more a serious drawback. With Ajax, data is usually retrieved using the XMLHttpRequest object.

Various alternatives have been developed to circumvent the same origin security feature, for example :

  • Flash or Silverlight with a  crossdomain.xml policy file
  • iFrame URL Technique
  • JSONP (JSON with padding)
  • XMLHttpRequest Level 2, which has been merged into the main XMLHttpRequest specification in December 2011
  • XDomainRequest (non standard) used by IE 8
  • window.location.hash hack
  • Facebook cross domain communication channel
  • window.postMessage() : supported by Firefox 3, Safari 4, Chrome and IE 8

With HTML 5, a new web browser technology emerged which defines ways for a web server to allow its resources be accessed by a web page from a different domain. This technology is called CORS (Cross-Origin Resource Sharing), a first working draft was published by W3C.

CORS works on a per-page access-control model. Every page has to respond with a special header, the Access-Control-Allow-Origin header to be accessible by a foreign site.In the CORS model the responsibility of Access Control is in the hands of the developers and not the server administrators. One drawback of this technology is that the Access-Control-Allow-Origin header is not yet supported by Amazon AWS S3. A lot of web designers are requesting this feature on the AWS Developer Forum.

The following list gives additional useful links to websites reporting about this topic :

xmlns : XML-namespace

XML namespaces, tagged xmlns, are used for providing uniquely named elements and attributes in an XML document. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved.

A namespace name is a uniform resource identifier (URI) and describes a resource under the control of the author or organisation defining the vocabulary, such as a URL for the author’s Web server. It is however not required to use the URI to retrieve informations. The URI is treated as a string and describes the namespace to human readers. Despite the absence of any formal relationship of the URI with the HTTP protocol, the use of an URL form is common.

It’s not required that a document is available at the named address, but one convention adopted by developers is to place a Resource Directory Description Language (RDDL) document at the location of the URI.

The default namespace is declared as :

<html xmlns="http://www.w3.org/1999/xhtml">

The Facebook namespace is declared as :

<html xmlns:fb="http://ogp.me/ns/fb#">

To use both namespaces in one document, the declarations are combined :

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">

Further informations about namespaces are available at the following links :

Google Web Toolkit, Google Doctype, Closure Tools

Closure Logo

Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. GWT is open source and used by thousands of developers around the world.

Google Doctype is an open encyclopedia and reference library.

The Google Closure Tools help developers to build rich web applications with JavaScript that is both powerful and efficient. The Closure tools include:

  • The Closure Compiler compiles JavaScript into compact, optimized and high-performance code
  • The Closure Library is a broad, well-tested, modular, server-agnostic and cross-browser JavaScript library.
  • The Closure Templates are a client- and server-side templating system that helps developers to dynamically build reusable HTML and UI elements.
  • The Closure Stylesheets is an extension to CSS that adds variables, functions, conditionals, and mixins to standard CSS.
  • The Closure Linter ensures that all JavaScript code follows the guidelines in the Google JavaScript Style Guide.
  • The Closure Inspector is an extension to Firebug, the Firefox debugger extension.

The Google Closure Website provides FAQ’s, a Blog and other resources about Closure tools. The Google Doodle “Happy Holidays 2011”, created by software engineer Nathan Naze, is based on Closure.