Something unusual. While using Rails, I noticed one of my simple Javascripts wasn’t working under (surprise!) Internet Explorer 6. Usually, you can just grab the control by its ID using the DOM and then call the focus method:
document.getElementById("myControl").focus();
So, this wasn’t working. After some Googling, I found that there were some folks suggesting that the timing of the events was causing the focus() method to fire at the wrong time to work properly. The solution is to wait for the page to load completely before firing the Javascript code.
Under Prototype, this can be accomplished as such:
document.observe("dom:loaded", function()
{
$('myControl').focus()
});
or using JQuery, try the following:
jQuery(document).ready(function()
{
$("#myControl").focus()
});
I would be remiss if I did not mention the added benefit of unobtrusive code. By utilizing the observe(“dom:loaded” or (document).ready you can safely place all your Javascript into a separate linked file. Since the scripts will not fire until the page has completely loaded, there is never a need to embed the Javascript code directly into the webpage positioned after the controls you want to affect. Embedding Javascript is considered bad coding practice.
One of the most popular IDEs in the world has reached another milestone. The
The PHP editor has code completion and debugging (using xdebug). Many PHP developers may not be accustomed to being able to utilize breakpoints, variable watches and other debugging niceties largely unavailable in free development tools. Needless to say, having debugging features available will save many hours of frustration and speed up your coding practices. Code completion also helps practitioners of dot notation to speedily find libraries and method paths without needing to reference the API.
Groovy on Grails is a coding by convention application framework in the spirit of Ruby on Rails. What separates the two is that Groovy is pure Java code while Ruby is, well .. Ruby; an interpreted language. Both utilize ORM persistence but while Rails prefers ActiveRecord, Grails employs Spring and Hibernate by default. Both are supported in Netbeans so check them out for yourself.