Inner joins (aka equijoins)
Basic joining (no need to specifically put in the "INNER JOIN" term). Example:
SELECT lastname, firstname, tag
FROM drivers, vehicles
WHERE drivers.location = vehicles.location
Left join
Returns all rows from the left table (table1) even if there are no matches in the right table (table2). Example:
SELECT *
FROM table1 LEFT JOIN table2 ON table1.column1 = table2.column2
Right join
Returns all rows from the right table (table2) even if there are no matches in the right table (table1). Example:
SELECT *
FROM table1 LEFT JOIN table2 ON table1.column1 = table2.column2
Monday, September 19, 2011
Friday, September 16, 2011
JDBC: Building the connection URL
This is on of the uber-random instances in which I am dealing with Java, JDBC, Websphere etc.
We needed to change the Java application to point to a new database.
After much effort we realised that the db connection string is located in an obscure file located here:
WEB-INF/classes/edujini.conf
The line(s) to change were:
database.connection.url=jdbc\:sqlserver\://<ip address>\:1433;databaseName\=<dbname>;user\=<username>;password\=
and
database.connection.password=<encrypted password string>
Looks simple enough, but not when you didn't know about the existence of the 2nd line and spent the whole day figuring out why there wasn't a need to pass in a password in the 1st line.
After realising that there is this 2nd line, there is another complexity in trying to figure out that the password was actually encrypted. (The system was commissioned very very long ago and no one remembered the password in the dev environment).
Thankfully poor encryption algo saved the day. After some random guessing, we managed to break the password and everything came to light.
Now back to the problem at hand. If I simply replace the sqlserver value with the database instance name, it doesn't work. After some poking around again, I realised that you would need to put in this value instead:
<ip address of server>\\instance name
Not fun at all.
We needed to change the Java application to point to a new database.
After much effort we realised that the db connection string is located in an obscure file located here:
WEB-INF/classes/edujini.conf
The line(s) to change were:
database.connection.url=jdbc\:sqlserver\://<ip address>\:1433;databaseName\=<dbname>;user\=<username>;password\=
and
database.connection.password=<encrypted password string>
Looks simple enough, but not when you didn't know about the existence of the 2nd line and spent the whole day figuring out why there wasn't a need to pass in a password in the 1st line.
After realising that there is this 2nd line, there is another complexity in trying to figure out that the password was actually encrypted. (The system was commissioned very very long ago and no one remembered the password in the dev environment).
Thankfully poor encryption algo saved the day. After some random guessing, we managed to break the password and everything came to light.
Now back to the problem at hand. If I simply replace the sqlserver value with the database instance name, it doesn't work. After some poking around again, I realised that you would need to put in this value instead:
<ip address of server>\\instance name
Not fun at all.
| Reactions: |
Thursday, August 18, 2011
Jquery Static Functions
var user = {}; // Declare my namespace
user.warn = function(msg) {
alert(msg);
}
| Reactions: |
JQuery Animation Effects Resources
1. Collapsible drag-and-drop panels
http://webdeveloperplus.com/jQuery/collpasible-drag-drop-panels/
2. http://www.noupe.com/jquery/50-amazing-jquery-examples-part1.html
Includes Star Rating, Form Validation, Carousel, Tabs, Pager
3. Blink, Wiggle, Bob
http://labs.wondergroup.com/demos/mini-ui/index.html
4. Drag-and-drop
http://jqueryui.com/demos/draggable/
5. Quicksand (rearrange icons)
http://razorjack.net/quicksand/
6. Auto-completer for textbox
http://www.nodstrum.com/2007/09/19/autocompleter/
7. Flip wall
http://demo.tutorialzine.com/2010/03/sponsor-wall-flip-jquery-css/demo.php
http://webdeveloperplus.com/jQuery/collpasible-drag-drop-panels/
2. http://www.noupe.com/jquery/50-amazing-jquery-examples-part1.html
Includes Star Rating, Form Validation, Carousel, Tabs, Pager
3. Blink, Wiggle, Bob
http://labs.wondergroup.com/demos/mini-ui/index.html
4. Drag-and-drop
http://jqueryui.com/demos/draggable/
5. Quicksand (rearrange icons)
http://razorjack.net/quicksand/
6. Auto-completer for textbox
http://www.nodstrum.com/2007/09/19/autocompleter/
7. Flip wall
http://demo.tutorialzine.com/2010/03/sponsor-wall-flip-jquery-css/demo.php
| Reactions: |
Monday, July 18, 2011
JQuery AJAX error function jqXHR.responseText is a string
The jqXHR.responseText is a string although it looks like JSON.
E.g. "{"Message":"domain\\a_fkf has no access","StackTrace":" at CustomAppTaskListRetriever.GetNumTasks(String userID) in C:\\Documents and Settings\\Visual Studio 2008\\Projects\\Retriever.cs:line 45\r\n at MyWorkbox.WorkboxService.GetNumTasks(String appID) in C:\\Documents and Settings\\Visual Studio 2008\\Projects\\WorkboxService.asmx.cs:line 32","ExceptionType":"System.Exception"}"
Here's how you can "parse" it. Not very elegant, but that's the best I can find:
E.g. "{"Message":"domain\\a_fkf has no access","StackTrace":" at CustomAppTaskListRetriever.GetNumTasks(String userID) in C:\\Documents and Settings\\Visual Studio 2008\\Projects\\Retriever.cs:line 45\r\n at MyWorkbox.WorkboxService.GetNumTasks(String appID) in C:\\Documents and Settings\\Visual Studio 2008\\Projects\\WorkboxService.asmx.cs:line 32","ExceptionType":"System.Exception"}"
Here's how you can "parse" it. Not very elegant, but that's the best I can find:
TaskList.prototype.GetTaskItems = function() {
var t = this;
%$.ajax({
}%$.ajax({
...,
success: function(data) {...},
error: function(jqXHR, textStatus, errorThrown) {
});success: function(data) {...},
error: function(jqXHR, textStatus, errorThrown) {
eval("var responseJSON = " + jqXHR.responseText + ";");
alert(responseJSON.Message);
}alert(responseJSON.Message);
| Reactions: |
How can I pass a parameter to a setTimeout() callback?
I am getting "t is not defined" error when trying to execute the following code:
Not too sure why it doesn't work, but here's a workaround:
TaskList.prototype.GetTaskItems = function() {
var t = this;
%$.ajax({
}%$.ajax({
...,
success: function(data) {...},
error: function() {
});success: function(data) {...},
error: function() {
setTimeout("t.GetTaskItems()", 30000);
}Not too sure why it doesn't work, but here's a workaround:
setTimeout(function() {
t.GetTaskItems();
, 30000);
Labels:
javascript,
JQuery,
setTimeout
| Reactions: |
Friday, July 15, 2011
Sorting Array with JQuery
var mylist = $('ul'); var listitems = mylist.children('li').get(); listitems.sort(function(a, b) { var compA = $(a).text().toUpperCase(); var compB = $(b).text().toUpperCase(); return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; }) $.each(listitems, function(idx, itm) { mylist.append(itm); });
| Reactions: |
Subscribe to:
Posts (Atom)