Tuesday, March 8, 2011

How To Drop All Stored Procedures In Your Database When Using Sql Server

Ever have the need to drop all of the stored procedures in your database? Well if you do, you are in luck! Here is a script that will drop all of the stored procedures in your Sql Server database for you. Just open a new query window, enter the script, type your database name in the Use statement and press F5!


USE YourDatabaseNameHere
GO

declare @storedProcedureName sysname

declare procCursor cursor for
select name from sysobjects where type = 'P' and objectproperty(id, 'IsMSShipped') = 0

open procCursor
fetch next from procCursor into @storedProcedureName
while @@FETCH_STATUS = 0
begin
exec('drop proc ' + @storedProcedureName)
fetch next from procCursor into @storedProcedureName
end

close procCursor
deallocate procCursor
go

That is it! Now you can delete all of the stored procedures in your database quickly and easily!

Smooches,

Kila

Monday, February 28, 2011

How To Use Html.Action With Areas

Microsoft created Areas to make our lives easier. The sad thing is that some little details can make your life worse. We are going to take a look at one of those things - Html.Action. When you are using Areas in your application, Html.Action can generate errors. The typical error you will see is "The controller for path '/whateverpath/' was not found or does not implement IController".

That is real helpful isn't it? You can tell a lot from that error right? NOT!!!! That error might lead you to believe that some controller is having an issue. That is not the case! Instead, that error means that you have not set up your Html.Action item correctly. To get your areas to cooperate with Html.Action, you have to set your link up like this.:

Html.Action("YourMethod", "YourController", new { area = "YourArea" })

You might be wondering what you should do if you are using Html.Action and you are using a controller that is NOT in an area. Well let me tell you so you can stop wondering. You set up the action method like this:

Html.Action("YourMethod", "YourController", new { area = "" })

And that is it!!

Smooches,

Kila Morton

Problem:

"The controller for path was not found or does not implement IController"

Solution:

Use
Html.Action("YourMethod", "YourController", new { area = "YourArea" })
if you are referencing something inside of an area.

Use
Html.Action("YourMethod", "YourController", new { area = "" })
if you are not referencing something outside of the areas

Tuesday, January 18, 2011

How To Reset The Canon MP 190 So You Can Scan If You Have No Ink! Eliminate The Canon MP 190 Scan Blues!

I hate companies that try to force you into using their products or.....companies that force you to refill their empty ink cartridges just to use a scan feature. OK - hate is a strong word. I will say that I strongly dislike that. Anyway, I have so many printers and scanners that it should be easy for me to print and scan whenever I like. However, that is not always the case. Today I needed to scan something using my Canon MP190. The MP 190 isn't a great all in one, but it does work appropriately in most cases. The one thing that I don't like about it is that the printer will not scan if you do not have ink in there. The reason is that Canon has an initialization process for this printer that checks if there is adequate ink. If there isn't, that process fails and you can't do much else - until now. I figured out a way to bypass this "system fault" so that you can scan again. The solution and is a VERY simple one.

Ready? Hold down the Stop/Reset button for about 30 seconds! There you go! I wish I could make it more intense. There just isn't anything else to it. Holding down that button will allow you to go back and scan documents even if you are completely out of ink. (SEE BELOW)

Don't you just love it?


UPDATE 3/22/2011
I feel compelled to update this post with a few more details.

First, you must have the MP Navigator software installed to use my little trick.
Second, the printer needs to be ON. I didn't specify this when I first posted this and I see that a few people had problems.
Third, you need to hold the Stop/Reset button down UNTIL THE LIGHTS START BLINKING. So hold the button down, let the lights come on and start to blink and then after the lights stop blinking, then let go. That may be MORE than 30 seconds. That is why I said "about" 30 seconds above.

That should get you going.
If it doesn't, please don't post that it didn't work. Instead, post what you did and what happened! That is something that I can investigate. It doesn't work means nothing because it does and did work for me. So help me to help you!


Smooches,

Kila

Thursday, December 16, 2010

Why Do I Love Cheating On Dot Net As Much As I Do With.....Ruby(LOL)!

I try to keep this site clear of anything other than my love for .Net, but I am the biggest cheater I have ever known. You know why? I really, really love Ruby on Rails! There.... I said it! I mean I REALLY love Ruby on Rails! I'm telling you this for a few reasons. First, as you move through the programming world, it is important to keep your mind open. A programmer should know multiple languages. It helps you on a number of levels. Professionally, it helps if you can demonstrate your flexibility in learning new things. Second, if you ever need to find a new job, you have more than one programming language under your belt which can open up more programming opportunities for you. Third, knowing more than one language helps you to see deficiencies more clearly in the languages you use. I can tell you from experience that learning .Net and then learning Ruby made me clearly see some key deficiencies in .Net - even though I still love .Net.

I'm not saying that you need to learn every language under the sun, but knowing additional languages can only be a good thing. If you are a .Net programmer, I HIGHLY suggest that you add Ruby on Rails to your arsenal. As a plus, you can likely create a fully functioning program in Ruby in less time than it took you to read this.

Smooches,

Kila

Friday, November 12, 2010

Finding The .SQL Mime Type SQL Server Mime Type

OMG! Why are some things so much more difficult than they need to be? I am creating a database application to make my life simpler. The application allows you to enter class file information once and then the application automatically, or should I say automagically, creates the class .cs file, Fluent NHibernate mapping files in your choice of AutoMap or ClassMap files (AutoMap and overrides are my preference) and the database .sql script. Creating the files and saving them to the database is simple. The problem came when I needed to download the files from the database. The system was adding a .txt file to the end of the file - Example: FileName.sql.txt. This was making me very sad.

I decided to get the actual mime type for a sql file so that the file would download appropriately without adding .txt to the file. Well you would think that I was trying to find how to get into Fort Knox or something. The general consensus is that most people just want to use text/plain. Not I said the mouse! Well I decided to use something I had used before - the Gnome Mime Type database. This database had allowed me to find a mime type that worked properly with some other Microsoft files that I was saving and retrieving from a database (for example, the mime type for a .cs file in the Gnome library is text/c-sharp and it works perfectly). Sooooo back to my good old friend.

The mime type for a .sql file is text/x-sql. The Gnome mime library is pretty extensive. The goal is to be a resource and standard way of using and finding mime types.

This is a simple thing, but since Google wasn't the easiest resource for finding the mime type for .sql files, I thought you might find this useful.

PROBLEM:
What is the .sql mime type? Where can I find the .sql mime type? Should I use text/plain or another mime type for .sql files?

SOLUTION:
You can use text/x-sql and you can use the Gnome library to find out more mime types as needed.

Smooches,

Kila Morton

Friday, October 22, 2010

How To Solve System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial'

Sometimes there are errors when you build in ASP.NET MVC that just make you want to shoot your own computer! You resist the urge of course (I hope), but the desire is still there! While I was creating an extension helper in ASP.NET MVC using Visual Studio 2010, I came across this error:

How To Solve System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

Ummm.....NO I am NOT missing a using directive or assembly reference - thank you very much! Well actually I was - LOL. I'm using MVC2. It seems that it wants an additional reference to reference RenderPartial now.

Here is a list of the usings I was using
(notice that wording - "usings I was using" - that makes me laugh - I crack myself up sometimes!) -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web;
using System.Reflection;

The using statements above SHOULD be enough to allow me to use RenderPartial. Unfortunately, I had to add ONE MORE using statement to make it work -

using System.Web.Mvc.Html;

That solved the issue! Why does Microsoft change little things like this? Do they do it just to drive people crazy?

Smooches,

Kila


PROBLEM:
How To Solve System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

SOLUTION:
Make sure you are referencing MVC in your web.config, make sure you have a mvc using statements listed above in your file and make sure you add the following item to that list of using statements.

using System.Web.Mvc.Html;

Sunday, October 10, 2010

Problems With The HP ZD8000!

There are very few products that I actually can say that I hate, however, HP has managed to make two products that are on my list.

A few years ago, I was given an HP zd8000 as a gift. I know the person that gave this thing to me cares for me very much so I don't hate them, but this laptop has to be one of the worst pieces of technology I have EVER owned. If this was my only laptop, I would be really, really angry right now. As it stands, it is one of many. However, since I just had to spend more time than I care to admit upgrading it to Windows7, I'm going to just list the problems I have had to date.

The computer is now 3 years old. However, I have been having many of these issues for a while now.

1.) The keyboard misses, skips and does not register some keystrokes. It happens to all of the keys. You will go along typing with a smile on your face only to realize that half the letters you typed were not registered by the keyboard. I used to have a USB keyboard attached to this laptop so I didn't notice this problem. It makes you want to scream!

2.) Several of the USB ports have DISCONNECTED from whatever they are connected to inside of the computer. I'm pretty handy with a screwdriver so I can correct this one, but it should not have happened in the first place.

3.) The computer overheats to the point that it could cause a fire! I have handled this issue with a Belkin cooling fan underneath the laptop. I hope this will help.

4.) The DVD RW drive stopped recognizing DVDs. This was OK after an upgrade to Windows 7. Well let me say that it MIGHT be OK. I say MIGHT because I JUST upgraded the machine from XP to Windows 7 TODAY! However, so far so good on that issue.

5.) The laptop battery no longer works. The system will not register that there is a battery. This is my FOURTH battery! There is a recall on this issue, so maybe it will work now.

6.) The power supply stopped working. It seems like it is the power supply connector that is the issue. I had to use some electrical tape to keep it connected and still.

7.) The middle of the touch pad has worn down to the point that I can see the green circuit board underneath it.

Of course, the warranty is gone so the best I can do is replace the parts myself. I wasn't angry about these things until I did a search and discovered that these are major issues for MANY ZD8000 owners! In fact, I saw MANY people talking about and suggesting class action lawsuits over the ZD8000 issues.

It makes me feel sick to my stomach that a company like HP would make computers like this without the thorough testing needed to make sure that they will work consistently and it really makes me sick to know that HP won't make things right!