Sunday, February 28, 2010

EnhanceJS

EnhanceJS is a new JavaScript framework (a single 2.5kb JavaScript file once minified/gzipped) that that automates a series of browser tests to ensure that advanced CSS and JavaScript features will render properly before they’re loaded to the page, enabling you to build advanced, modern websites without introducing accessibility problems for people on browsers that aren't capable of supporting all advanced features. It's designed to be easily integrated into a standard progressive enhancement workflow: just construct the page using standard, functional HTML, and reference any advanced CSS and JavaScript files using EnhanceJS to ensure they're only delivered to browsers capable of understanding them.

EnhanceJS is written with plain old JavaScript, so it has no dependencies, and works alongside other JavaScript libraries such as jQuery, Prototype and Dojo. The list of browsers that pass the default EnhanceJS test suite includes modern browsers back to Internet Explorer 6, Safari 3, Firefox 1.5, and mobile safari (iPhone); while browsers like Internet Explorer 5.5, Safari 2, and the Blackberry browser will receive the basic experience. The EnhanceJS test suite can be configured to meet the needs of any project, so the division of browsers will change depending on the capabilities you choose to test.

http://www.filamentgroup.com/lab/introducing_enhancejs_smarter_safer_apply_progressive_enhancement/

http://code.google.com/p/enhancejs/

Thursday, February 25, 2010

Ajax.Responders.register

Ajax.Responders.register({
onCreate: function() {
new Effect.Appear('ajax_loader', { duration: 0.3, to: 0.5 });
},
onComplete: function(request, transport, json) {
if (0 == Ajax.activeRequestCount) {
new Effect.Fade('ajax_loader', { duration: 0.3, from: 0.5 });
}
if(!request.success()) {
var errorMapping = $H({
400: ['Bad Request', 'The request contains bad syntax or cannot be fulfilled.'],
401: ['Authorization Required', 'You need to authenticate to access this page.'],
403: ['Forbidden', 'The request was a legal request, but the server is refusing to respond to it.'],
404: ['Page Not Found', 'The requested resource could not be found.'],
405: ['Method Not Allowed', 'A request was made of a resource using a request method not supported by that resource; for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource.'],
406: ['Not Acceptable', 'The action you tried to perform on this resource was considered unacceptable.'],
415: ['Unsupported Media Type', 'The media type you are requesting is unsupported.'],
422: ['Unprocessable Entity', 'The request was well-formed but was unable to be followed due to semantic errors.'],
500: ['Application Error', 'An error occurred in the application code. Report sent.'],
503: ['Service not available', 'The webserver did not respond to the request.'],
505: ['HTTP Version Not Supported', 'The requested version is not available on this server.']
});

var errorMessage = errorMapping.get(transport.status) || ['Unknown Error', 'An error occurred, but could not be determined correctly.'];

if (transport.responseJSON && transport.responseJSON.error)
errorMessage = [transport.responseJSON.error.title, transport.responseJSON.error.message]

var notifyUser = new GrowlNotifier({
title: errorMessage[0],
message: errorMessage[1],
image: "/images/elements/growl_warning.png",
type: 'error'
});
}
}
});
The Window.Growl Script.aculo.us mod is a modified version of Daniel Mota's Window.Growl adapted for the Script.aculo.us framework.
Growl.Smoke({
title: "Growl.Smoke Script.aculo.us mod",
text: "http://blog.var.cc/static/growl/",
image: "image/var-logo-60.png",
duration: 2.0
});
http://blog.var.cc/static/growl/
http://pastie.org/818221

Tuesday, February 23, 2010

jQuery's getJSON

I recently had a struggle getting jQuery's $.getJSON function to work on Internet Explorer (IE6 & IE7). I tried and tried to debug the javascript, but was getting no where. After giving up for a while and coming back to it the next day, I thought of checking the target file—the file jQuery was fetching asynchronously—for problems.

It turns out that IE doesn't like JSON encoded documents that are specified as UTF-8. Not sure what the problem is, but the document has to be returned in a format IE likes. If not, IE will not allow jQuery to process it. Now, I had a header on this file that specified the content-type and charset. But, I changed it and instead I put only the content-type at the top of my JSON-returning PHP files:

header("Content-Type: application/json");

Why does IE balk at UTF-8 specified charsets for JSON-encoded responses?? Who knows. But, from the research I've done, specifying the charset in the HTTP header is not something that is required.

http://firelitdesign.blogspot.com/2009/07/jquerys-getjson.html

Garbage Collection Slides from LA Ruby Conference


http://timetobleed.com/garbage-collection-slides-from-la-ruby-conference/

Tuesday, February 16, 2010

WTFJs

JavaScript is a language we love despite it giving us so much to hate. This is a collection of those very special irregularities, inconstancies and just plain painfully unintuitive moments for the language of the web.
  1. alert(111111111111111111111);
  2. [] == ![] // true
  3. 0.1 + 0.2 === 0.3 // false
  4. Nan != NaN // true
http://wtfjs.com

Monday, February 15, 2010

SlickEdit Core

SlickEdit CoreSlickEdit Core is a subscription plug-in for Eclipse that brings SlickEdit's rich history of excellence to the Eclipse framework. SlickEdit Core consists of the SlickEdit editor, 7 additional views, and the DIFFzilla ® differencing engine.




  1. Support for over 40 languages in one plug-in.
  2. Emulations for 13 popular editors including Brief and Vim.
  3. Write your own support for in-house languages, including Syntax Expansions, Aliases, Color Coding, Keyword Definitions, and more!
  4. Works with both the Eclipse 3.4 and 3.5 environments.
  5. Maintenance and Support Service included with each license.

SlickEdit Core Screenshot

Dynamic class in Ruby

name = "Group"
group = Object.const_get(name).new

jQuery Lint

jQuery Lintis a simple script you can download and use with jQuery. It works over the top of jQuery and diligently reports errors and any incorrect usage of jQuery. It will also, to some extent, offer guidance on best practices and performance concerns.

Unlike JSLint,jQuery Lint is a runtime reporter. To use it, you need to include it, after jQuery, in your document:

jQuery lint’s main objective is to notify you of incorrect usages of jQuery’s API. So, if you pass incorrect arguments to any method then jQuery Lint will let you know. It compares your arguments to the argument signatures in jQuery’s API. It reports via Firebug, although you can quite easily plug-in your own console mechanism.

It has four different error-reporting levels (accessible via jQuery.LINT.level), zero reports nothing, three will report everything, including small things like using css().css().css() instead of css({...}). It’s quite configurable too. You can add your own checks. E.g.

jQuery.LINT.special[1].jQuery = jQuery.LINT.special[1].jQuery || [];

// Add check on error-reporting level one.
// Check jQuery method.
jQuery.LINT.special[1].jQuery.push(function(selector, context) {

if (selector === '*') {
return "Don't use the universal selector!";
}

});

jQuery Lint tries to help you in determining where the problem occurred in your code. It’s not much help to you if it just says, “Err, you called css() incorrectly!”. If it occurred as a result of an event then Lint will say so, and if you’re using a browser that provides a stack-trace as part of its Error object (like Firefox) then Lint will also provide you with the file-name and line number. E.g.

jquery Lint - Reporting line number and file name where problem occured.

http://james.padolsey.com/javascript/jquery-lint/

Tuesday, February 2, 2010

rails-upgrade is now an official plugin

To use it now, simply install the plugin:

script/plugin install git://github.com/rails/rails_upgrade.git

The plugin adds the following tasks:

rake rails:upgrade:check      # Runs a battery of checks on your Rails 2.x app
# and generates a report on required upgrades for
# Rails 3
rake rails:upgrade:gems # Generates a Gemfile for your Rails 3 app out
# of your config.gem directives
rake rails:upgrade:routes # Create a new, upgraded route file from your
# current routes.rb
http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin

MariaDB versus MySQL

MariaDB 5.1 is based on MySQL 5.1 and is available under the terms of the GPL v2 license.

MariaDB will be kept up to date with the latest MySQL release from the same branch.

In most respects MariaDB will work exactly as MySQL: all commands, interfaces, libraries and APIs that exist in MySQL also exist in MariaDB.

Currently the main differences between MariaDB 5.1 and MySQL 5.1 are:

In MariaDB 5.2, the new features are:

  • Group commit for the Maria storage engine. (faster)
  • userstatv2', which creates several new information_schema tables with useful statistics information. You enable the statistics by setting the 'userstat' variable.

(for a definite and up-to-date list of features in 5.2, see MariaDB 5.2 page).

http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL

The Evil Side of Google? Exploring Google's User Data Collection

Google Inc. is first and foremost a data company. In the past, it competed on a level playing field by manipulating publicly available data better than its competition. By doing this, it had unprecedented success.

Enter Web 2.0. Hard drives, processors, bandwidth, and even workers are now all relatively inexpensive. This has caused the barriers to entry in the search field to drastically lower. As Google’s competition has started to catch up (MSN Image Search) and new competitors are arising, (Cuill) the search engine is looking for some kind of advantage. Since everyone has reasonably equal access to the internet’s content, leaders have been striving to gain access to private data. The most cost effective way of doing this for the engines is by collecting data from the users that already use their services. Google has been increasingly serving its users by using their personal data to manipulate public data in individualized ways. These methods are impossible to copy without the necessary personal data.

http://www.seomoz.org/blog/the-evil-side-of-google-exploring-googles-user-data-collection