Tuesday, May 31, 2005

Dumping XML content while reading it from a stream

Oleg Tkachenko posts a nice nugget on Dumping XML content while reading it from a stream. Since I'm a logging junkie this strikes home.

[Listening to: Marilyn Manson - Apple of Sodom]

Monday, May 30, 2005

ORACLE: displaying initialization parameters

Pulled from here and here.

Thinking I was clever I created a little parms.sql which will pull out all matching initialization parameters from the v$parameter table. Of course I find out that there's a built in way of doing this:

C:\> sqlplus someuser/passwd@tnsname
[snip]
SQL> show parameter spfile

NAME TYPE VALUE
------------ ----------- ------------------------------
spfile string %ORACLE_HOME%\DATABASE\SPFILE%
ORACLE_SID%.ORA

And while we're at it, here's how you get the full set of all parameters in a nice human readable format:
SQL> create pfile='filename' from spfile;
Note1: this creates the file on the server beside the original spfile (see VALUE above.)
Note2: you need to run this as sys as sysdba

[Listening to: Barry White - My First, My Last, My Everything]

Thursday, May 26, 2005

Of Performance and Peanut Butter Sandwiches

Rico Mariani (certainly in my top 5 blogs lists ever,) gives some tips on
Narrowing Down Performance Problems in Managed Code which border on instantly useful recommendations. Cool.

[Listening to: Fleetwood Mac - Silver Springs]

Thursday, May 19, 2005

ORACLE: Permissions for SQL Analyze

To run SQL Analyze, the user requires the SELECT_CATALOG_ROLE:

C:\> sqlplus system/passwd@tnsname
[snip]
SQL> grant SELECT_CATALOG_ROLE to theuser;

Grant succeeded.
If you want to use the index recommendation feature you'll need more privileges. You could grant DBA but I hate doing that, so enable each one independently:
C:\> sqlplus "sys/passwd@tnsname as sysdba"
[snip]
SQL> grant SELECT ON SYS.CDEF$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.CON$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.IND$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.OBJ$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.SEG$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.TAB$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.TS$ to theuser;

Grant succeeded.

SQL> grant SELECT ON SYS.USER$ to theuser;

Grant succeeded.
[Listening to: Stone Temple Pilots - Where the River Goes]

Monday, May 16, 2005

ORACLE: What is the difference between & and &&?

Culled from here.

What is the difference between & and && in a SQL script:

"&" is used to create a temporary substitution variable that will prompt you for a value every time it is referenced. Example:

SQL> SELECT sal FROM emp WHERE ename LIKE '&NAME';
Enter value for name: SCOTT
old 1: SELECT sal FROM emp WHERE ename LIKE '&NAME'
new 1: SELECT sal FROM emp WHERE ename LIKE 'SCOTT'

SAL
----------
3000

SQL> /
Enter value for name: SCOTT
old 1: SELECT sal FROM emp WHERE ename LIKE '&NAME'
new 1: SELECT sal FROM emp WHERE ename LIKE 'SCOTT'

SAL
----------
3000
"&&" is used to create a permanent substitution variable. Once you have entered a value (defined the variable) its value will used every time the variable is referenced. Example:

SQL> SELECT sal FROM emp WHERE ename LIKE '&&NAME';
Enter value for name: SCOTT
old 1: SELECT sal FROM emp WHERE ename LIKE '&&NAME'
new 1: SELECT sal FROM emp WHERE ename LIKE 'SCOTT'

SAL
----------
3000

SQL> /
old 1: SELECT sal FROM emp WHERE ename LIKE '&&NAME'
new 1: SELECT sal FROM emp WHERE ename LIKE 'SCOTT'

SAL
----------
3000

[Listening to: Will Smith - Will 2K]

Fixed typo in subject

Friday, May 13, 2005

What Pre-1985 Video Game Character Am I?

I normally don't post the results of these (although I must admit that I participate in every one) but I just couldn't resist:


What Video Game Character Are You? I am an Asteroid.I am an Asteroid.


I am a drifter. I go where life leads, which makes me usually a very calm and content sort of person. That or thoroughly apathetic. Usually I keep on doing whatever I'm doing, and it takes something special to make me change my mind. What Video Game Character Are You?

I'm not sure which part I like best: being summed up by a classic video game; being summed up by one of my favourite games from back in the day; or being summed up by a rock. In any case: sweeet.

Tuesday, May 10, 2005

ORACLE: Creating tablespaces

Scooped from here:

Normal a.k.a. Permanent a.k.a. Data

create tablespace {TABLESPACE-NAME}
logging
datafile 'C:\path\relative\to\oracle\server.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

Temporary
create temporary tablespace {TABLESPACE-NAME}
tempfile 'C:\path\relative\to\oracle\server.dbf'
size 32m
autoextend on
next 32m
maxsize 2048m
extent management local;


[Listening to: Disturbed - Stupify]

Monday, May 09, 2005

RSS Bandit 1.3 - Recovering disappearing menus and toolbars

I'm using RSS Bandit 1.3.0.29 (although I've seen this problem in earlier versions of 1.3 as well.) Occasionally all the menus and toolbars just disappear on me. The Feed Subscriptions tab, Search Tab and Feed Details Tab are still there but nothing else.

The bigger problem seems to be the fact that I can't find anywhere to right click to bring up the toolbar customization dialog to make them visible again.

Here's what you need to do to get them back:

Navigate to the AppSettings folder for RSS Bandit (C:\Documents and Settings\dmontgomery\Application Data\RssBandit on my machine) and edit the file .settings.xml

Look for a line like this (note that you're looking for "&lt;Toolbar", not "<Toolbar":

   &lt;Toolbar Guid="c95feca6-b21e-4660-ad20-8e8e5b9fe26c" DockLine="15" DockOffset="2" Visible="False" Container="f7942d78-c06c-44f8-943e-b0f68611be66"&gt;

Change Visible="False" to Visible="True"

Start up RSS Bandit again. This should make the "Main Tools" toolbar visible. Now you can right click to enable the rest.

Occasionally I need to change the DockLine setting too, but I can't remember what the "bad" value was.

I figure it's probably something to do with switching between a dual monitor setup to a single monitor or vice versa, but I'm not sure.

[Listening to: Guns N' Roses - Bad Apples]

Thursday, May 05, 2005

Give your DLL a dedicated config file - level 300

Jeffrey Palermo has some sample code on how to give your DLL a dedicated config file. This is just as useful as a sample of how to throw together an app domain.

[Listening to: Down - Stone the Crow]

Tuesday, May 03, 2005

XML Documentation

Alan Dean is posting a series on using XML Documentation:

  • Part 1: The Overview
  • Part 2: The Detail
  • Part 3: Complex Tables.

  • I've always been a fan of XML Documentation, but the coolest bit for me are the undocumented tags (like <event>) and the undocumented switches in a cref attribute in <see>.

    Nice job Alan.

    [Listening to: Jethro Tull - Broadsword]

    Update: Change title to reflect the series, not just the first article. I've gotten lazy with the "BlogThis" button.

    Monday, May 02, 2005

    ORACLE: Using ROWNUM or SORT with UNION

    [Pulled from dbforums]

    If you want to use ROWNUM or SORT across the results of a UNION:

    SELECT *
    FROM (
        SELECT employee_id, last_name, first_name
        FROM   EMPLOYEES
        UNION
        SELECT department_id, 'DEPT', department_name
        FROM   DEPARTMENTS
    )
    WHERE ROWNUM < 100
    ORDER BY last_name;


    * I realize this is a brutaly contrived example, but hey, whaddaya expect?
    ** I have no idea how this performs.

    ORACLE: Tidbits

    I'm starting to read up on Oracle and figure the beast out. Naturally the first thing I do is to subscribe to the I Hate Oracle Club (IHOC). I'm still trying to figure out a way to order the mug or T-Shirt.

    I figure I'll post whatever little tidbits I come across that I found useful. Mostly so I don't have to remember them myself.

    [Listening to: Static-X - Cold]

    Encrypting app.config configuration sections in Whidbey

    Pulled from That Indigo Book: A nice easy way to encrypt an app.config (or web.config) configuration section. It's the little things.

    [Listening to: Lisa Loeb - Dance with the Angels]

    Catching up

    It's long past time I started making my way through the "To Blog" queue. Here goes nothing...