Posted by

Database Column Definations

Column_Size
The column (or parameter) size of numeric data types is defined as the maximum number of digits used by the data type of the column or parameter, or the precision of the data. For character types, this is the length in characters of the data; for binary data types, column size is defined as the length in bytes of the data. For the time, timestamp, and all interval data types, this is the number of characters in the character representation of this data.

BUFFER_LENGTH
The length in bytes of data transferred on an SQLGetData or SQLFetch operation if SQL_C_DEFAULT is specified. For numeric data, this size may be different than the size of the data stored on the data source. This value is the same as the COLUMN_SIZE column for character or binary data. For more information, see Column Size, Decimal Digits, Transfer Octet Length, and Display Size.

Decimal_Digits
The decimal digits of decimal and numeric data types is defined as the maximum number of digits to the right of the decimal point, or the scale of the data. For approximate floating-point number columns or parameters, the scale is undefined because the number of digits to the right of the decimal point is not fixed. For datetime or interval data that contains a seconds component, the decimal digits is defined as the number of digits to the right of the decimal point in the seconds component of the data.
For the SQL_DECIMAL and SQL_NUMERIC data types, the maximum scale is usually the same as the maximum precision. However, some data sources impose a separate limit on the maximum scale.

Tagged ,

Javascript

Javascript Combobox loop

//Javascript loop a html combobox and set to selected
for ( i = 0; i < document.getElementById("form1:stmtLvl").options.length; i++)
{
	if (document.getElementById("form1:stmtLvl").options[i].value ==
		document.getElementById("form1:hiddenStmtLevel").value)
	{
		document.getElementById("form1:stmtLvl").selectedIndex = [i];
	}
}

innerHTML

document.getElementById("toggMenu").innerHTML = "
<select id="stmtLvl" class="selectOneMenu"></select>
"

Hide/Show DIV display

document.getElementById("det1").style.display = "block";
document.getElementById("det2").style.display = "none";

Convert to 2 decimal places

document.getElementById('form1:xolPremium').value = parseFloat(equate).toFixed(2);

Tagged , , ,

Java Dates

For own documentation purposes.

private String returnDMY(Timestamp date) {
String str = "";
if (date != null) {
String d = date.toString();
// System.out.println("returnDMY (start): "+d);
int year = Integer.parseInt(d.substring(0, 4));
int month = Integer.parseInt(d.substring(5, 7));
int day = Integer.parseInt(d.substring(8, 10));
int hours = Integer.parseInt(d.substring(11, 13));
int mins = Integer.parseInt(d.substring(14, 16));
int secs = Integer.parseInt(d.substring(17, 19));

Calendar gc = new GregorianCalendar(year, month - 1, day, hours,
mins, secs);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
str = sdf.format(gc.getTime());
// System.out.println("returnDMY (end): "+str);
}
return str; // returns empty String if DB field is null
}

private Timestamp plusOneYear(Timestamp date)
{
//2011-03-28 00:00:00.0 - Sample timestamp
String d = date.toString();
//System.out.println("Timestamp toString():"+d);
int year = Integer.parseInt(d.substring(0, 4));
int month = Integer.parseInt(d.substring(5, 7));
int day = Integer.parseInt(d.substring(8, 10));
int hours = Integer.parseInt(d.substring(11, 13));
int mins = Integer.parseInt(d.substring(14, 16));
int secs = Integer.parseInt(d.substring(17, 19));

Calendar gc = new GregorianCalendar(year, month - 1, day, hours, mins, secs);
gc.add(Calendar.YEAR, 1);

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str = sdf.format(gc.getTime());
//System.out.println("PlusOneYear: "+str);

return Timestamp.valueOf(str);
}

Tagged ,

Clearing iPhone’s ‘Other’ space

Requires a jailbroken iPhone, with iFunBox installed.
My iTunes version: 10.3.1.55, using iPhone 4.

  1. Connect iPhone to PC and launch iFunBox
  2. Navigate to [iTunes Control], and then [Music Control] folder.
  3. Delete all sub-folders, sub-directories inside [Music Control] folder
  4. Disconnect and close iFunBox, go to iTunes, and sync your iPhone WITHOUT the music (make sure to uncheck the sync music choice)
  5. Disconnect iPhone. Reboot iPhone. Reconnect phone to PC again.
  6. Launch iTunes, sync iPhone with everything you want (including music, make sure to check it again)
  7. There should be a significant drop in the OTHERS space indicator in iTunes.
Tagged , ,

Guitar Amps and Effects for iPhone, iPod and iPad

Just learnt that there are guitar amplifier apps on the iOS devices. I’ll give these apps a test run on my iPad and iPhone before getting one of those mini portable guitar amplifiers.

Amplitube

Amplitube (iTunes $19.99)
Amplitube (iTunes Free)

The Amplitube iRig costs like SGD$54 on my local Apple Store.
Maybe I should get the replica from DealExtreme instead.

StompBox

StompBox for iPad (iTunes $19.99)

Other Amplifier apps

AmpKit+AmpKit+ (iTunes $19.99/ AmpKit Free)

PocketAmp (iTunes $4.99/ Free lite version available)

Tagged
Follow

Get every new post delivered to your Inbox.