Vista Hacks: Making My Wacom Serial Tablet Work

As I mentioned previously, the one hardware issue I’ve had with Vista was the inability to get Vista to properly deal with my serial Wacom Intuos tablet.

After a couple e-mails and a phone call to Wacom’s support group, the solution and steps are this:

  1. Download Wacom’s latest driver from their web site.
  2. Create the following registry key if it doesn’t exist:
       [HKEY_LOCAL_MACHINE\SOFTWARE\Tablet]
      "PnPTablets"=",COM1"
  3. Plug in the tablet. If Windows prompts for a driver, hit cancel.
  4. Install the Wacom driver.  The tablet should work after the driver is installed.
  5. Reboot.  If Windows prompts to install a driver for the hardware, choose the option not to present the message again.

The tablet should work from that point forward.
[tags]wacom, intuos, vista[/tags]

Oracle: Making My Head Explode

A couple weeks ago I mused about some differences between Microsoft’s T-SQL and Oracle’s PL/SQL.

Today I came across this gem: Oracle has a boolean field which understands four values.

That qualifies under the category of “things that are just plain wrong.”

[tags]oracle, wtf, geek[/tags]

From T to PL: A SQL Experience

As I learned SQL, I learned the Microsoft flavor: T-SQL (Transact SQL) as used by SQL Server 2000. My new job has me working with Microsoft SQL Server locally, but I also am writing a lot of queries to perform some complex data extrication from some Oracle databases housed at other organizations. One of the things I’m trying to grok is the group of differences between T-SQL and PL/SQL that I should know about. Here, in random order, are some things I’ve discovered:

RANK()

RANK() is an analytic function in PL/SQL. As the name implies, it returns a numeric value which is a rank of a row compared to the other rows returned by a query. The ranking criteria are specified in an ORDER BY clause. Rows which have the same values receive equal rankings.

Here’s an example where we return a list of people ordered by the number of points they have… note what happens when there is a tie:

SELECT Name,
       Points,
       RANK() OVER (ORDER BY Points DESC) AS Rank
    FROM T_Standings
Name                                Points                  Rank

-----------------------------------------------------------------------
Joe Blow                            89                      1

Mary Smith                          86                      2

Don Juan                            78                      3

Fred Jones                          78                      3

Amy Peterson                        72                      5

Packages

Without getting into too many details, Oracle has a concept of Packages which are groups of stored procedures. Related procedures can be grouped together; instead of having procedures called prAddSomething, prDeleteSomething, and prEditSomething, one could have a package called Something with add/edit/delete procedures. How does it look in the syntax? Something.Add(parameter1, parameter2). Very cool.

CREATE OR REPLACE

In T-SQL the following code is needed to replace an existing stored procedure:

IF EXISTS (SELECT name FROM sysobjects
           WHERE name = 'prSomeProcedure' AND type = 'P')
DROP PROCEDURE prSomeProcedure
GO
CREATE PROCEDURE prSomeProcedure
AS
...

In PL/SQL, it is simply:

CREATE OR REPLACE PROCEDURE prSomeProcedure
IS
...

Definitely much nicer, eh?

Anchored Declarations

In T-SQL, variables need to be explicitly declared as a particular type. In PL/SQL, you can use an anchored declaration to declare the variable as being the same type as a column… for example, if you’re creating a variable to work with an address field that is 25 characters, in T-SQL you need to declare:

@addressvar      varchar(25)

In PL/SQL you can use an anchored declaration:

addressvar      T_Data.Address%TYPE

This indicates the variable will be the same type as the base column, and if the base column type changes, the variable will change as well without needing to update the code.

Exception Handling

T-SQL doesn’t have exception handling (sorry, I don’t consider comparing to @@ERROR to be exception handling). PL/SQL on the other hand has a decent system for handling exceptions, allowing the programmer to declare exception handlers for any block of code. Oracle will raise built-in exceptions when a common error occurs, and the programmer can also explicitly define custom exceptions that can be manually raised (using the RAISE keyword). This allows for much more cohesive (and readable) error logic than is possible with T-SQL.


Perhaps some of this information will be of use to someone else looking for differences between T-SQL and PL/SQL.[tags]sql, tsql, plsql, oracle, sqlserver, databases[/tags]

Greasemonkey Script: Fix Oregon Live Permalinks

The permalinks over at Oregon Live are borked because whoever setup their content publishing template can’t correctly use anchor tags.  In a comment over at the Portland Feed, one of their staffers makes it pretty clear they don’t really care about it.

I got tired of dealing with the frustration of their damn website being just plain broken so I learned how to write my first Greasemonkey script.  If you’re using Firefox, gr, then use the link below to install a script which will fix the permalinks:

Click here to install Fix Oregon Live Permalinks script

* the only known issue at this point is the entire page must load before the URL is rewritten so it’s not a quick immediate fix, but after the page loads you’ll jump to the correct location.

Feel free to leave a comment with any feedback or problems.