$x('//a')
with your XPath expression and it will output list of matched elements, so you can click it and see on the page. Very handy to check Selenium XPath selectors.
$x('//a')
grails-debug instead of simply grails. For example, you want to debug test SeleniumTest.grails-debug test-app functional: SeleniumTest
Debug > Attach Debugger..., by default there is JPDA debugger, connector - SocketAttach, just enter your host and port (default is 5005, you can see yours in Grails console). Press OK. And it should connect to Grails process, so it will stop on breakpoints. Easy. git.exe push    "origin" master:master
remote: error: refusing to update checked out branch: refs/heads/master        
remote: error: By default, updating the current branch in a non-bare repository        
remote: error: is denied, because it will make the index and work tree inconsistent        
remote: error: with what you pushed, and will require 'git reset --hard' to match        
remote: error: the work tree to HEAD.        
remote: error:         
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to        
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into        
remote: error: its current branch; however, this is not recommended unless you        
remote: error: arranged to update its work tree to match what you pushed in some        
remote: error: other way.        
remote: error:         
remote: error: To squelch this message and still keep the default behaviour, set        
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.        
To C:\########
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'C:\########'
git --bare init --shared
create helloWorld --with spring, struts, hibernate, hypersonic, junit, jquery, selenium, jpa, rest, etc.
    for (val in document.body) {
      var before = document.body.offsetHeight;
      document.body[val];
      if (before != document.body.offsetHeight) {
        alert(val);
      }
    }
document.body.filters; 
log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 
There is no Action mapped for namespace / and action name ########. - [unknown location]
    at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
    at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
...
  <constant name="struts.convention.exclude.parentClassLoader" value="false" />
# path to java
wrapper.java.command=java
# this is service launcher, leave it as is
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
# jars related to wrapper
wrapper.java.classpath.1=../lib/wrappertest.jar
wrapper.java.classpath.2=../lib/wrapper.jar
# all jars related to your application
wrapper.java.classpath.3=../mylib/jetty-continuation-7.0.1.v20091125.jar
wrapper.java.classpath.4=../mylib/jetty-http-7.0.1.v20091125.jar
...
# your application class that contains main method
wrapper.app.parameter.1=my.company.Application
# all parameters, when needed
wrapper.app.parameter.2=param1
wrapper.app.parameter.3=param2
...
1:parent.method(1);
2:parent.method(2);
3:parent.method(3);
4:parent.method(4);
5:void method(int i) {
6: init();
7: doStuff(i);
8:}
panel.add(inputField, "split 2,hidemode 2");
panel.add(comboField, "hidemode 2");
inputField.setVisible(true);
comboField.setVisible(false);
DataOutputStream daos = new DataOutputStream(baos);
daos.writeLong(value1);
daos.writeInt(value2);
daos.writeBoolean(value3);
daos.writeUTF(value4);
result = struct.unpack('>II', input1)
value1 = (result[0] << 32) + result[1]
result = struct.unpack('>i', input2)   // result[0] becomes value2
result = struct.unpack('>b', input3)   // result[0] is 1 for true and 0 for false
result = struct.unpack('>H', input4)
result = input5 // it is already acceptable for Python, just calculate result[0] bytes from input
result = struct.unpack('>IIibH', input6)  // result array now contains all unpacked values except string 
       CookieManager cookieManager = new CookieManager();
       CookieHandler.setDefault(cookieManager);
       cookieManager.setCookiePolicy( CookiePolicy.ACCEPT_NONE);boolean verify(JComponent input)
    port.setInputVerifier(new InputVerifier() {
      public boolean verify(JComponent input) {
        String value = port.getText();
        int port = -1;
        try {
          port = Integer.parseInt(value);
        } catch (NumberFormatException e) {
        }
        if ((port > 0) && (port < 65535)) {
          return true;
        } else {
          JOptionPane.showMessageDialog(settings, "Port must be number between 0 and 65535", "Input error", JOptionPane.ERROR_MESSAGE);
          return false;
        }
      }
    });
    GroupLayout layout = new GroupLayout(infoPanel);
    infoPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
    hGroup.addGroup(layout.createParallelGroup().addComponent(typeLabel).addComponent(formatLabel).addComponent(idLabel).addComponent(resultLabel));
    hGroup.addGroup(layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(typeUser).addComponent(typePlaylist).addComponent(typeFavorites)).addComponent(formats).addComponent(id).addComponent(result, GroupLayout.DEFAULT_SIZE, 400, GroupLayout.DEFAULT_SIZE));
    hGroup.addGroup(layout.createParallelGroup().addComponent(typesGap).addComponent(formatsGap).addComponent(generateButton).addComponent(copyButton));
    layout.setHorizontalGroup(hGroup);
    GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
    vGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(typeLabel).addGroup(layout.createParallelGroup().addComponent(typeUser).addComponent(typePlaylist).addComponent(typeFavorites)).addComponent(typesGap));
    vGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(formatLabel).addComponent(formats).addComponent(formatsGap));
    vGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(idLabel).addComponent(id).addComponent(generateButton));
    vGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(resultLabel).addComponent(result, GroupLayout.DEFAULT_SIZE, 200, GroupLayout.DEFAULT_SIZE).addComponent(copyButton));
    layout.setVerticalGroup(vGroup);
    JPanel infoPanel = new JPanel(new MigLayout("", "[][grow][]", "[][][][grow]"));
    infoPanel.add(typeLabel, "");
    infoPanel.add(typeUser, "split 3");
    infoPanel.add(typePlaylist, "");
    infoPanel.add(typeFavorites, "wrap");
    infoPanel.add(formatLabel, "");
    infoPanel.add(formats, "wrap");
    infoPanel.add(idLabel, "");
    infoPanel.add(id, "growx, width 30::");
    infoPanel.add(generateButton, "wrap");
    infoPanel.add(resultLabel, "top");
    infoPanel.add(result, "grow, width 30:300:, height 10:100:");
    infoPanel.add(copyButton, "top");
Stage {
    title: "Test"
    scene: Scene {
        width: 300
        height: 250
        content: [
          VBox {translateX: 10 translateY: 10 spacing: 20
                content: [
                     HBox {spacing: 5
                       content: [
                         Label {text: "Field:"}
                         Button {text: "Button1" strong: true }
                         Button {text: "Button2" strong: true }
                       ]
                     }
dependencies {
    compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '7.0.1.v20091125'
    compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '7.0.1.v20091125'
    compile group: 'org.eclipse.jetty', name: 'jetty-util', version: '7.0.1.v20091125'
    compile group: 'org.eclipse.jetty', name: 'jetty-http', version: '7.0.1.v20091125'
    compile group: 'javax.servlet', name: 'servlet-api', version: '2.5'
    testCompile group: 'junit', name: 'junit', version: '4.+'
}
task copyAndSign() << {
    ant.delete(dir:'build/signed')
    ant.mkdir(dir:'build/signed')
    for(file in configurations.runtime.resolve()) {
      ant.signjar(destDir: 'build/signed', jar: file, alias:"myself", keystore:"myKeystore", storepass:"123456", preservelastmodified:"true")
    }
}
jar.doLast {
  ant.signjar(destDir: 'build/signed', jar: tasks.jar.archivePath, alias:"myself", keystore:"myKeystore", :"123456", preservelastmodified:"true")
}
ant {
  taskdef( name: 'gcupload', classname: 'net.bluecow.googlecode.ant.GoogleCodeUploadTask', classpath: 'ant/ant-googlecode-0.0.2.jar' )
}
task uploadAll << {
  collection = files { file('build/signed/').listFiles() }
  collection.each { 
    ant.gcupload(username:gcusername, password:gcpassword, projectname:"project", 
        filename:it, targetfilename:it.name, summary:"automatic", labels:"")
  }
}
function serverSideSum(v1, v2) {
  $.post('http://localhost/sum', {val1: v1, val2: v2}, function(data) {
    $('#result').text(data.result);
  });
}
$.post = function(url, data, func) {
  func({result:4});
};
$.post = function(url, data, func) {
  equals(data.val1, 2);
  equals(data.val2, 2);
  func({result:4});
};
test("server side 2+2=4", function() {
  $.post = function(url, data, func) {
    equals(data.val1, 2);
    equals(data.val2, 2);
    func({result:4});
  };
  serverSideSum(2, 2);
  equals(4, $('#result').text());
});
function serverSideSum(v1, v2) {
  $.post('http://localhost/sum', {val1: v1, val2: v2}, function(data) {
    $('#result').text(data.result);
  });
  $.post('http://localhost/counter', {}, function(data) {
    $('#counter').text(data.count);
  });
}
test("server side 2+2=4", function() {
  ajaxMock([
    [{result:4}, function(data) {equals(data.val1, 2); equals(data.val2, 2);}],
    [{count:123}, function(data) {}]
  ]);
  serverSideSum(2, 2);
  equals(4, $('#result').text());
  equals(123, $('#counter').text());
});
function ajaxMock(params) {
  ajaxCallsCounter = 0;
  ajaxCallsParams = params;
  var callback = function(url, data, func) {
    ajaxCallsParams[ajaxCallsCounter][1](data);
    func(ajaxCallsParams[ajaxCallsCounter][0]);
    ajaxCallsCounter++;
  }
  $.get = callback;
  $.post = callback;
}
equals(ajaxCallsCounter, ajaxCallsParams.length);
too_many_recent_calls
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:oracle:thin:@########", "login", "password", "oracle.jdbc.driver.OracleDriver")
    sql.eachRow("select * from get_data_from_table") {goal-> 
        ...
    }
    def display = sql.dataSet("add_to_table") 
    display.add(id:goal.goal_id, country:it, type:'P') 
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:oracle:thin:@########", "login", "password", "oracle.jdbc.driver.OracleDriver")
langs = ['LV', 'LT', 'EE']
def update() { 
    def display = sql.dataSet("add_to_table") 
    sql.eachRow("select * from get_data_from_table") {goal-> 
        langs.each{ 
            display.add(id:goal.goal_id, country:it, type:'P') 
            display.add(id:goal.goal_id, country:it, type:'B') 
        } 
    }
}
update()
<class name="com.test.GenericClass<Reference>">public class SpecificClass extends GenericClass<Reference>
new HardDrive().capacity(150).external().speed(7200);
HardDrive hd = new HardDrive();
hd.setCapacity(150);
hd.setExternal(true);
hd.setSpeed(7200);
parent.add(new Node()
.setName(name)
.setValue(value)
.setParent(parent))
.setId(id)
Node node = new Node();
node.setName(name);
node.setValue(value);
node.setParent(parent);
parent.setId(id);
parent.add(node);
Control the current page menu (document icon to the left of address input) then Developer/JavaScript console.console.log({qwe:123}) (where {qwe:123} is just any JSON object).<html>
  <head>
    <script src="jquery-1.3.2.js"></script>
    <script src="testrunner.js"></script>
    <script type="text/javascript" src="code.js" ></script>
    <link rel="stylesheet" href="testsuite.css" type="text/css"/>
    <script type="text/javascript">
    </script>
  </head>
  <body>
    <ol id="tests"></ol>
    <div id="main"></div>
  </body>
</html><ol id="tests"></ol> and <div id="main"></div> is where QUnit puts it's stats.function sum(v1, v2) {
  return v1 + v2;
}test("2+2=4", function() {
  var result = sum(2, 2);
  equals(4, result);
});function showSum(v1, v2) {
  $('#result').text(sum(v1, v2));
}<html>
  <head>
    <script src="jquery-1.3.2.js"></script>
    <script src="testrunner.js"></script>
    <script type="text/javascript" src="code.js" ></script>
    <link rel="stylesheet" href="testsuite.css" type="text/css"/>
    <script type="text/javascript">
      test("2+2=4", function() {
        var result = sum(2, 2);
        equals(4, result);
      });
      test("show 2+2=4", function() {
        showSum(2, 2);
        equals(4, $('#result').text());
      });
    </script>
  </head>
  <body>
    <ol id="tests"></ol>
    <div id="main"></div>
    <div id="result"></div>
  </body>
</html>module("my tests", {
  setup: function() {
    $('#result').text('12345');
  },
  teardown: function() {
    $('#result').text('');
  }
});localStorage['key'] = 'value';Result was great, and I got nice alert with 'value' on it.
alert(localStorage['key']);
localStorage['key'] = {test:'value'};
alert(localStorage['key'].test);
localStorage['key'] = {test:'value'};says that I have nice '[object Object]'. I checked it a bit and had found that this script
alert(localStorage['key']);
localStorage['key'] = {test:'value'};says that my localStorage result is in fact 'string', which was quite unexpected, as it should be Object.
alert(typeof localStorage['key']);
localStorage['key'] = JSON.stringify({test:'value'});In WRT there is no such nice lib, but it is possible to download it at json.org. And it can be nicely used like this:
alert(JSON.parse(localStorage['key']).test);
widget.setPreferenceForKey(JSON.stringify({test:'value'}), 'key');There is small issue though. As you see JSON lib is used to convert object to string, but it was not able to convert string to object on my Nokia device. But this small eval hack still works great and I am getting my value as expected.
alert(eval(widget.preferenceForKey('key')).test);