jQuery quickies

Written on 8 May 2011, 11:13pm

Tagged with: ,

1. Get all the text input fields or textareas having IDs starting with a pattern

$('input, textarea').filter('[id^='+fieldID+']').each(function() 
{
	var field_value = this.value;
	var field_id = this.id;
	//do things here...
}

2. Add options to a select (in the example below – add the Google supported languages)

//Get the Languages array
	var languages = google.language.Languages;

	//populate the languages select
	$.each(languages, function(key, value)
		{   
		$('#my_select').
		append($("<option></option>").
		attr("value",value).
		text(key)); 
		}
	);

(more…)

Google Maps: radius search in Oracle

Written on 21 April 2011, 12:11pm

Tagged with: , ,

Recently I had to implement a ColdFusion + Oracle application using Google Maps. One of the requirements was search by distance (or radius search) for some items, already geocoded.
The items are stored in T_ITEM, with the columns:
ITEM_ID
COORDX --latitude
COORDY --longitude

The latitude and longitude are already calculated, and stored in database as VARCHAR.
The task was to create some sort of function to accept:
-latitude
-longitude
-radius
and to return the items from T_ITEM located within radius kilometers from the given coordinates.

In implementing this task, I started with (more…)

6 useful Oracle commands

Written on 26 March 2011, 12:43pm

Tagged with: , ,

This is more of a reference post to store some useful Oracle features. Or a cheat sheet if you wish 🙂

1. How to find the maximum column size in a table


select
       max(vsize(mycol))
from
       mytable;

2. How to paginate in Oracle using rownum

Method 1:


select * from 
( 
       select rownum r, a.* from 
       (
             YOUR_QUERY
       ) a 
       where rownum < = 10
) 
where r >= 1;

Method 2: (more…)