Friday, September 28, 2007

List of Access Modifiers in C#

I have been programming in C# for more than 3 years now, always I forget the specifics on keywords like access modifiers. The most commonly used access modifiers are of course 'public' and 'private', and it's pretty obvious what they mean. But for example "protected internal", I just cannot recall on top of my head what it pertains to, so just as a note, here's all of them:

Access Modifier Meaning
public Available to all classes
protected Available only to the current class or to derived classes
internal Available only to classes in the current assembly
protected internal Available only to the current class, derived classes, or classes in the current assembly
private Available only to the containing class
virtual Creates a virtual method or property that can be overriden by a subclass

Monday, September 24, 2007

My Son's Playing in His First Piano Recital

He had been practicing at least once daily for the past few weeks to prepare for his first recital ever. His perseverance and hard work surely paid off. In his short program, he played two pieces back to back, Baby Face and Swing Town. My goodness, no tense, nor flustered he is, he just played it, beautifully. As for me, it was nerve wracking, but I made it. Just ecstatic! I'm proud of you son.

Friday, September 14, 2007

Hey There Delilah

Another song I like. By Plain White T's. There are songs that just strike your heartstrings. This is one of them. This song reminded me of when my then girlfriend had to leave to go to another country. I liked the song, first because of the lyrics, hmmm... a bit similar to the words that I said in my letters and phone calls to her. Hey, this guy is just simply retelling a segment of my life. Second, the melody of the song is just great, hauntingly folkish. Btw, just a little bit of trivia about this song, this was actually released in 2005. And now that the band had reached superstar (or superband?) status, some of their songs had been revisited, this song was one of them. It got re-released and reached the Billboard's top spot in July 2007. Now even considered as the biggest hit of the summer. Read more from here.

Hey there Delilah,
What's it like in New York City?
I'm a thousand miles away,
But girl tonight you look so pretty,
Yes you do,
Time Square can't shine as bright as you,
I swear it's true.

Hey there Delilah,
Don't you worry about the distance,
I'm right there if you get lonely,
Give this song another listen,
Close your eyes,
Listen to my voice it's my disguise,
I'm by your side.

Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me,
What you do to me.

Hey there Delilah,
I know times are getting hard,
But just believe me girl some day,
I'll pay the bills with this guitar,
We'll have it good,
We'll have the life we knew we would,
My word is good.

Hey there Delilah,
I've got so much left to say,
If every simple song I wrote to you,
Would take your breath away,
I'd write it all,
Even more in love with me you'd fall,
We'd have it all.

Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me.

A thousand miles seems pretty far,
But they've got planes and trains and cars,
I'd walk to you if I had no other way,
Our friends would all make fun of us,
And we'll just laugh along because,
We know that none of them have felt this way,
Delilah I can promise you,
That by the time that we get through,
The world will never ever be the same,
And you're to blame.

Hey there Delilah you be good,
And don't you miss me,
Two more years and you'll be done with school,
And I'll be making history,
Like I do,
You'll know it's all because of you,
We can do whatever we want to,
Hey there Delilah here's to you,
This one's for you.

Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me,
Oh it's what you do to me,
What you do to me.

Ohhh

How to search all stored procedures in a db for a particular "text"

After migrating a large db from SQL Server 2000 to SQL Server 2005, one of the changes I needed to make was to switch from using xp_smtp_sendmail to sp_send_dbmail using the new "Database Mail" feature. Since I'm dealing with a db with at least a couple hundred stored procedures, I didn't want to manually look at each one. Here is a blogpost I found tackling this issue.

Summarizing, here's what I have used:

use mydb;
go

select routine_name, routine_definition
from information_schema.routines
where routine_definition like '%xp_smtp_sendmail%'
and routine_type = 'procedure'
go

Tuesday, September 04, 2007

SSIS problems with Excel Source

I'm working on an import to my databases from an Excel sheet. This should have been a breeze with SSIS if not because of issues with the Excel Source data flow, which is apparently because of Jet OLEDB. Let me describe the issue. When data is read from an Excel worksheet, the Jet samples the first few rows for the data type, the problem is that when it encounters a different one other than what it assumed at first, instead of raising an exception, it just simply drops the data and replaces it with NULL. And so, what happened at first, I thought that all data was imported in the database not knowing that some of them were NULL. Bad...bad...bad.

Anyhow, here's the solution, enjoy:

1. Going to the Excel Connection Manager, I changed the Connection Strings to: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\BillingReport\Upload.xls;Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1";

I added IMEX=1

2. Went to the registry of where the package will run and changed: Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/TypeGuessRows to 0 (zero for maximum).

This solution came from these posts:

msmvps
sqlteam
bi-polar23

Thank you all!