Ever needed to search for a string in your stored procedures?

I was digging through an older database I am rewriting and I stumbled on this little stored procedure.  It uses the internals of SQL Server to search the stored procedures for a provided string.  Just one of those bits of code we are all meaning to write but never do.

CREATE PROCEDURE Find_Text_In_SP
@StringToSearch varchar(100) 
AS 
   SET @StringToSearch = '%' +@StringToSearch + '%'
   SELECT Distinct SO.Name
   FROM sysobjects SO (NOLOCK)
   INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID
   AND SO.Type = 'P'
   AND SC.Text LIKE @stringtosearch
   ORDER BY SO.Name
GO

I'm not even sure who wrote it but it seems like something handy to have around.

Getting the version from a ClickOnce published application

Do you get the requirement to put the version in the title bar of your apps?  I do all the time.  With the advent of ClickOnce, though, most apps have TWO version numbers, the Assembly Version, and the Publish Version.  If you go by the Publish Version (you aren't alone) you can get the Version number using the System.Deployment.Application namespace.  Make sure you import it first, and reference it too.

If ApplicationDeployment.IsNetworkDeployed Then
  Me.Text = String.Format("{0}, Version {1}", Me.Text, ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString)
Else
  Me.Text = String.Format("{0}, Version {1}.{2}.{3}.{4}", Me.Text, My.Application.Info.Version.Major.ToString, My.Application.Info.Version.Minor.ToString, My.Application.Info.Version.Build.ToString, My.Application.Info.Version.Revision.ToString)
End If 

Cost Abated Translation, circa 1996

Remember Babelfish?  I sure do.  It was one of the first online translation engines, right about when Jade was asking me to translate Americash Mall into Spanish.

Guess what.  It's still out there.  And it is GOOD.

http://babelfish.altavista.com

AltaVista was one of the first, and second only to Yahoo in the early years, search engines.  Glad to know they are still kickin.

Go to commentsComments (0)

Artichoke Dip

1 bag frozen Trader Joe's artichokes
1 6 oz tube of Cheve
1/2 cup of shredded cheddar cheese
1/2 cup of shredded Parmeasan cheese
2 oz Cream Cheese
1/2 tsp salt
1/2 tsp garlic powder
1/2 tsb red pepper flakes
dash of Worchester sauce
optional can of Trader Joe's Crab

Boil the artichokes in enough water to cover until soft.  Evacuate onto a cutting board and chop up.  Warm the cheve and cream cheese in the microwave until soft.  Mix together all ingredients and put in a shallow dish.  Warm in microwave until the cheddar melts.  Eat with yummy birdseed crackers.

Check out my Productivity article on MSDN

Just had another article posted to MSDN, on Productivity with Visual Basic 2005.

I have constant wars with other .NET programmers about C# versus VB.  Not surewhat to make of it - really it is just a personal choice.  There is no difference in the final product.  I'll just say this.  I have 4 active projects in C# and 7 in VB.  When I work in VB, I never get compiler errors. When I work in C#, I usually have to compile 5-10 times before I get around to finding the runtime problems.  Sloppy coding?  Maybe.  But for me doesn't it make more sense to keep using the compiler that gives me fewer problems?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/VB05Prod.asp

They sold the Heisman?

Now you have to know that I am just not a fan of the Heisman race.  First, football is a team game, and picking "the best player in college football" is much more a reflection of the team than the player.  Every year, there is the best player, and then the one who wins.  Why?  Because you have to have a good team around you to win games, and if you don't win games you aren't on the ballot.
Second, I am really tired of people talking the award in the preseason.  It's like preseason polls - how the heck do you expect to know who will win before anyone plays games?  Like they say, the games aren't played on paper, they are played on grass.
Nonetheless, I can't believe that they sold the Heisman to Nissan.  When the Rose Bowl went, I thought "Well, there goes the farm.  Now everything is for sale."  I never ever ever thought that the Heisman was up to the highest bidder.  It's college football.  These guys are amateurs.  They are playing for fun.  Some of them get hurt and mess up their lives - all for fun.  Why, I ask, does everyone have to make money on them, except them?  Does that seem fair?
Anyway, rant over.  I am a fan of the free enterprise system.  But.  Come on.

Project Reference in VS 2005 causes: Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'

Interesting little bug that I ran into today.  If you reference a Windows Forms project from another Windows Forms project using the Project Reference dialog, you will get this weird error:

Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'

There is actually a KB on it, but it doesn't show up in Google, or of course in MSDN search:

http://support.microsoft.com/?kbid=907757

Learn something new every day.  Service Pack 1, anyone?

Don’t underestimate the My object

Need a file from a secure network share?  Trying to actually understand the NetworkCredentials classes?  Good freakin luck!
I went through the snippets, searched google, and read the MSDN library cover to virtual cover before I just dialed in.
My.
Computer.
Network.
DownloadFile?  Does it have an overload with username and password?
Well I'll be a son of a ...
Final code:

My.Computer.Network.DownloadFile("\\192.168.1.3\share\point\test.xls", "c:\text.xls", "user", "password")

Works like a charm.

Bill Sempf

Husband. Father. Pentester. Secure software composer. Brewer. Lockpicker. Ninja. Insurrectionist. Lumberjack. All words that have been used to describe me recently. I help people write more secure software.

 

 

profile for Bill Sempf on Stack Exchange, a network of free, community-driven Q&A sites

MonthList