Wednesday, April 18, 2012

Debugging experience

Debugging is a hard thing. Here records some of my experiences.

- A same program instance is running on many machines for years without problem. But today one single machine reports an error. A stored procedure that takes multiple parameters, is now getting those parameters in reverse order.
Reason: A query that returns the list of parameters is now returning the entries in reverse. MSSQL returns data set in undeterministic order if "order by" is not used. It has worked consistently for years on all the machines, now for unknown reason is functioning differently on one single machine.
Solution: Add "order by" clause to the query.

- The Database server in production was accidentally uninstalled ... This happened because the admin logged into the wrong server. As the solution, the desktop background is changed to reflect the server name.

"Same Domain Policy" limitation of jQuery

The same domain policy prevents javascripts hosted on one domain from accessing data from a remote domain. This is for security purpose. So when use jQuery, you can not directly access a web service from a remote server.

The solution is to create a serverside script (for example, in php, as shown below) on your domain, which will serve as a proxy, get the data from the remote domain, and then output it. For example:

<?php
readfile('http://remote_server.com/service?param=' . urlencode($_GET['param']);
?>

[1] Getting data from remote URL using jquery
[2] Cross-domain requests with jQuery

Wednesday, March 14, 2012

Drop Schema

DROP SCHEMA (Transact-SQL)

DROP SCHEMA schema_name

To drop a schema, any objects (e.g.: tables) associated with the schema must be dropped first.

Sunday, March 11, 2012

Some articles from CACM

On software engineering: The Risks Of Stopping Too Soon - By David Lorge Parnas
On publication system: Stop the Numbers Game - By David Lorge Parnas

Blog Archive

Followers