Skip to content

Instantly share code, notes, and snippets.

var valueElement = document.getElementById('attr' + i +'value_');
if (!wsptIsNull(valueElement))
{
data.values[dataIndex].value = valueElement.value;
//if this happens to be a checkbox, its returning "true" (string) always,
//and not checking the checked state. valueElement.checked is the boolean i want
}
else
{
data.values[dataIndex].value = '';
this is a triumph!
@dustingetz
dustingetz / gist:799713
Created January 28, 2011 02:26
THE DOCTOR & THE NURSE
THE DOCTOR & THE NURSE
A doctor and nurse, were in the office one morning before patients arrived.
The doctor told the nurse that he was scheduled to see 3 patients in the
morning. The nurse asked how old they were and the doctor answered:
"The product of the ages of those three people is 2450 and the sum is twice
your age. How old are those people?"
The nurse thought for a while and then said, "I cannot answer your question."
from collections import defaultdict
def sorter_second_desc(x,y):
"""for sorting list of pairs by the second element, descending.
e.g. count"""
return -1 * cmp(x[1], y[1])
def main():
sentence='the quick brown FOX JumpeD Over the lazy dog'
public static String buildUpdateSingleSql(SimpleDataCollection data, ITmfTypeInfo typeInfo, ITmfAppContext context)throws Exception
{
long revision = getRevisionValue(data);
List<ITmfTypeFieldInfo> appFields = typeInfo.getAppSingleFields();
StringBuilder sb = new StringBuilder(2048);
sb.append("UPDATE ");
appendSchemaPrefix(sb);
sb.append(typeInfo.getSingleTableName());
IDBConnection conn = appContext.getDbConnection();
IDBTransactionManager transaction = conn.getTransactionManager();
transaction.begin();
try
{
doSave(tmfObject, revision, appContext);
assert false:"bust the transaction";
checkIntegrity(appContext);
transaction.commit();
}
@dustingetz
dustingetz / gist:837504
Created February 21, 2011 18:48
custom assert and verify
import java.util.Locale;
public class Util
{
/**
* Always-enabled assertions.
*
* "Each assertion contains a boolean expression that you believe will be true
* when the assertion executes. If it is not true, the system will throw an error.
{
"events": [
{
"type": "WAVELET_SELF_ADDED",
"modifiedBy": "dustin.getz@googlewave.com",
"timestamp": 1299396504221,
"properties": {
"blipId": "b+L1Y00ipBB"
}
}
@dustingetz
dustingetz / gist:867941
Created March 13, 2011 06:57
blip_renderer.py
#http://google-wave-resources.googlecode.com/svn/trunk/samples/apps/inboxchecker/blip_renderer.py
import logging
import re
import cgi
def log(message, string):
logging.info(message + ': ' + string)
def to_text(blip):
format = "-------------------------------\n\
if (CMD_CREATE.equals(command))
...
else if (CMD_COPY.equals(command))
...
else if (CMD_SAVE.equals(command))
...
else if (CMD_NEXT.equals(command))
...
else if CMD_PREVIOUS.equals(command))
...