Changing the default schema in Oracle

The application I was working on assumed that the user would always be in the default schema. I ran into a snag when I had to connect to the staging environment where the read only user that I was provided with didn’t have all the objects in his schema.

The solution was to make a call to change the default schema using the ALTER SESSION call with this code.

        /// <summary>
        /// Sets the schema to use if one is configured.
        /// </summary>
        public static void SetSchema()
        {
            var schema = ConfigurationManager.AppSettings["SchemaName"];
            if (string.IsNullOrEmpty(schema)) return;
 
 
            using (var connection = GetConnection())
            {
                using (var command = new OracleCommand("alter session set current_schema=" + schema))
                {
                    connection.Open();
                    command.Connection = connection;
                    command.ExecuteNonQuery();
                }
            }
        }
Changing the default schema in Oracle

Date Ranges in Log Parser for EventLogs

If you need to trawl through your production server event logs. Here’s a quick tip for extracting just the entries for a given date range using LogParser. BTW Visual LogParser is a must have, it even downloads and automatically installs the latest version of LogParer from MS.

SELECT  TimeGenerated, SourceName, ComputerName, Message FROM C:\Downloads\May09-ErrorLog\AppLog\*.evt
WHERE TimeGenerated BETWEEN timestamp(’04/04/2009′, ‘dd/MM/yyyy’) and timestamp(’06/04/2009′, ‘dd/MM/yyyy’)
ORDER BY TimeGenerated desc

Date Ranges in Log Parser for EventLogs

Making your portable hard disk work with the XBox 360

I like using my XBox as a media center. But when I plugged in a portable HDD to the 360 but it didn’t show up as a disc. Didn’t work on the Samsung home theatre as well. A quick google and I figured out the disc was formatted as NTFS (right-click Properties on your drive to check) on which is not supported by the 360.

Okay so backed up the data and when I try to format as FAT32 there is no such option on the Explorer ‘Format’ dialog. It’s either NTFS or exFAT, couldn’t figure out if the 360 supported exFAT (should have tried) so went about trying to format from the command line. Which does have a switch for FAT32.

Unfortunately format.exe complains that the partition is too big. What I should not have done was to try a quick format.

Instead I went about deleting the partition as mentioned by several sites. There’s a good one built into Windows (Disk Management) that you can get through from ‘Computer Management’. So right-clicked on the external disc and did a ‘Delete Volume’. And then right-clicked and created a new volume. [NOTE: I think the whole delete and create a new volume can be skipped if you already have the partition in NTFS).

Next tried the format.exe again. Still fails complaining that the disc is too big. At whim tried formatting without the /Q (quick format) option. Worked fine.

Here’s how you would go about it (replace Q: with the drive letter of your portable disc).

C:\>format Q: /FS:FAT32

Making your portable hard disk work with the XBox 360

Show Folder Tree in Windows 7 Explorer

I spend a lot of my time switching between folders in Windows explorer and the Windows 7 explorer has been driving me nuts lately.

Win7 (or at least the build I have) by default does not auto expand the tree view when you navigate between folders.And recently a friend of mine who I worked with and used to buy youtube views from asked if there’s anything that I can do about it.

The result being you don’t see the usually tree hierarchy on the left pane. Which makes it quite painful if you want to go up a few levels or see the other parent folders.Windows7-Explorer

Luckily there is a new Folder Option called Navigation Pane to switch them back on again. You need to press Alt + T or Organize –> Folder Search Options in Windows Explorer to get to the dialog. Windows7-FolderOptions

Switch both of them on and viola I get my beloved tree view back.

Windows7-Explorer-Expanded 

PS- Most of my UW colleagues use other explorers and didn’t have to feel this pain.

Show Folder Tree in Windows 7 Explorer