Thursday, May 29, 2008

JavaBat

http://javabat.com/

Interesting introduction or refreshment on Java. Provides little programming problems and runs test cases against your function to make sure its doing what it is supposed to. These are nice little teasers especially towards the complicated side that you don't normally have to face but give you some good insight.

Wednesday, May 28, 2008

Great duplicate removal query...

This is a great query to replace duplicates within a table, the define characteristics are comapring a series of fields that should be the same and then using the unique ID identifier between the table aliases A and B so that you only delete the greater ID. In doing this you will leave the lowest ID giving you one unique row the lowest ID row. Very Great!

delete Table_1 A
where exists
(select * from Table_1 B where A.field_1 = B.field_1 and A.field_2 = B.field_2 and A.field_3 = B.field_3 and A.field_4 = B.field_4 and A.id > B.id)

Thursday, May 22, 2008

Error - GetTypeHashCode() : no suitable method found to override

I usefully hijacked this from: http://blog.stackley.net/article.php?story=20070117165732356

I found it very useful so I want to propagate it. I found a need for it while transferring my site from vb.net to C#.


After creating an ASP.NET web form using Microsoft Visual Studio 2005 Team Suite, I renamed the form from it's default name "Default.aspx" to a more user-friendly name "Order.aspx" within MS VS. After adding more code to the C# code-behind page, I discovered the following line: "public partial class _Default"

Being new to the ASP.NET programming language, I changed the "_Default" to "Order" thinking MS VS had failed to rename items within the code it generates. This caused the following error to display at debug/run time: "GetTypeHashCode() : no suitable method found to override"

There were several other errors displayed as well.

The class names must match between the .aspx and .aspx.cs web pages. Here is what the lines in each file should look like:

In the ASPX source file: %@ Page Language="C#" codefile="FormName.aspx.cs" Inherits="FormName_aspx" %

In the ASPX.CS source file: public partial class FormName_aspx : Page

Once I changed the .ASPX file to match the class name in the .ASPX.CS file, the errors were resolved.

Thursday, May 8, 2008

PHPAdmin does not allow Stored Procedures

I tried very hard to add stored procedures to my MySQL database that is being served on my webserver. I converted my code from the SQLServer code I have gotten more used to writing (until 5.0 MySQL had no stored procedures) the syntax is not quite the same but close enough to just iron out the kinks and throw it into MySQL ... or so I thought. I removed all the syntax changes I saw needed from the MYSQL 5.0 Manual (which is a nice resource) well I was going into one of those pits where you know something is wrong and the fix is not obvious. I assumed it might be the fact I needed to change the delimiter so I tactfully added "DELIMITER ?" which did not help at all. I could tell this was the problem though something was wrong with the delimiter because I would get a slight change in some functions removing verses adding the semicolons. Finally I searched "PHPADMIN STORED PROCEDURES" on google and I found what I needed it was right there on the site the whole time but not placed very tactfully in my case. The solution was staring me in the face at the bottom of the PHPADMIN page, in the bottom under the SQL syntax textbox was a textbox labeled delimiter with a semicolon in it. I changed that to \\ because that is what the post suggested and violas. Stored procedure added.