Output all properties for any object

Posted by Monty on July 22nd, 2009

private void outputValues(object inputObject)
{
List<PropertyInfo> propertyInfos = new List<PropertyInfo>(inputObject.GetType().GetProperties());

foreach (PropertyInfo info in propertyInfos)
{
try
{
object obj = info.GetValue(inputObject, null);
if (obj == null)
{
continue;
}
Console.WriteLine("[{0}]:{1}", info.Name, obj.ToString());

}
catch (Exception)
{
continue;
}

}

}

Replace the Console.WriteLine with whatever you want, log4net,  Debug, trace, etc, and it works!

LAB: Image Detection, Part 3

Posted by Monty on May 8th, 2009

After writing some comparison code, we have the following output, thanks to log4net (I love log4net):

output-3

Source


Target

.

X:79 Y:156 W:17 H:23 X:73 Y:149 W:17 H:23

.

X:337 Y:176 W:27 H:50 X:331 Y:169 W:27 H:49

.

X:158 Y:249 W:32 H:31 X:152 Y:242 W:32 H:32

.

X:446 Y:286 W:28 H:32 X:440 Y:279 W:27 H:32

.

X:398 Y:339 W:18 H:26 X:392 Y:334 W:16 H:24

.

X:244 Y:349 W:47 H:52 X:238 Y:342 W:47 H:52

.

X:38 Y:374 W:16 H:15 X:31 Y:366 W:17 H:16

.

X:34 Y:388 W:16 H:17 X:148 Y:423 W:27 H:24

.

X:154 Y:430 W:27 H:24 X:459 Y:435 W:24 H:22

.

X:465 Y:442 W:25 H:22 X:119 Y:450 W:30 H:46

.

X:126 Y:457 W:29 H:46 X:221 Y:465 W:17 H:19

.

X:227 Y:472 W:17 H:19 X:250 Y:594 W:17 H:18

.

X:256 Y:601 W:17 H:18



Comparison
S[X: 79, Y: 156, Width: 17, Height: 23] matched to T[X: 73, Y: 149, Width: 17, Height: 23]
S[X: 158, Y: 249, Width: 32, Height: 31] matched to T[X: 152, Y: 242, Width: 32, Height: 32]
S[X: 398, Y: 339, Width: 18, Height: 26] matched to T[X: 392, Y: 334, Width: 16, Height: 24]
S[X: 38, Y: 374, Width: 16, Height: 15] matched to T[X: 31, Y: 366, Width: 17, Height: 16]
S[X: 154, Y: 430, Width: 27, Height: 24] matched to T[X: 392, Y: 334, Width: 16, Height: 24]
S[X: 126, Y: 457, Width: 29, Height: 46] matched to T[X: 31, Y: 366, Width: 17, Height: 16]
S[X: 256, Y: 601, Width: 17, Height: 18] matched to T[X: 31, Y: 366, Width: 17, Height: 16]
Non matched
S[X: 34, Y: 388, Width: 16, Height: 17]
S[X: 154, Y: 430, Width: 27, Height: 24]
S[X: 465, Y: 442, Width: 25, Height: 22]
S[X: 126, Y: 457, Width: 29, Height: 46]
S[X: 227, Y: 472, Width: 17, Height: 19]
S[X: 256, Y: 601, Width: 17, Height: 18]
T[X: 148, Y: 423, Width: 27, Height: 24]
T[X: 459, Y: 435, Width: 24, Height: 22]
T[X: 119, Y: 450, Width: 30, Height: 46]
T[X: 221, Y: 465, Width: 17, Height: 19]
T[X: 250, Y: 594, Width: 17, Height: 18]

I know its not perfect, I know its only matching about 50% of the blobs, but im working on it. I have a plan up my sleeve for this :)

LAB: Image Detection, Part 2

Posted by Monty on May 4th, 2009

Warning – this post will be heavy on images, so if you are on a low bandwidth connection, well sucks to be you then.

With a few minor improvements to the code, here we have the Source image:

image

Here is the target image’s blobs:

image

As you can see, it has found both blobs, and here is the raw output for the blob data:

image image

They are very similar, only a few pixels out! Now to compare the images somehow…

Code Snippets – Text on images

Posted by Monty on May 4th, 2009

Two code snippets for you:

private void drawTextWithBackground (string Text, Font font, Graphics grpaphics, Brush backgroundBrush, Brush foregroundBrush, int x, int y)

{

SizeF size = grpaphics.MeasureString(Text, font);

grpaphics.FillRectangle(backgroundBrush, x,y,size.Width, size.Height);

grpaphics.DrawString(Text,font,foregroundBrush,x+1,y+1);

}

private void drawTextAtBottom (String Text, Font font, Graphics graphics, Image sourceImage, Brush backgroundBrush, Brush foregroundBrush)

{

SizeF size = graphics.MeasureString(Text, font);

int y = (int) (sourceImage.Height – size.Height);

drawTextWithBackground(Text,font,graphics,backgroundBrush,foregroundBrush,1,y);

}

Does exactly what it says on the tin!

LAB: Image Detection, Part 1

Posted by Monty on May 4th, 2009

Every now and then, I get a crazy idea, to try something rather hard in .net – maybe hard isnt the right word for it, but something that hasn’t really been attempted before, or if it has, nothing public about it. So the idea I have is for some form of image detection, to say that Image X is x % similar to Image Y. I prefer to use the terms Source and Target, but it doesn’t really matter.

The source and the target images are here. That’s a photo I took a few weeks ago, if you do decide to steal it, please put a message on there that points back to me ;) Anyway, the target image is 14×15 pixels smaller – that’s a whopping 210 pixels different! It shouldn’t be too hard to match up the two images, or should it?

Histograms

My first attempt was with Histograms. I grabbed some open source (unsafe!) code that generates an array of int[] and lists the histogram values, so I shoved both images through that, and got it to output the Source’s histogram value, the Target’s histogram value, the difference between them both, and the percentage of how similar it is, like so: (The first number is the key# of the int in the array, just because)

image

Right at the bottom, I had an average of all the percentages, to see how “similar” the image is. I was expecting the percentage to be fairly high, since there is only a few hundred pixels difference, and I didn’t change any of the levels or colours when I cut the images out of each other, but it told me there was a 87.7% similarity! That was very shockingly low. If you see something wrong with my maths from the code below, please let me know:

public HistogramCompareResults(int key, int source, int target)

{

this.key = key;

this.source = source;

this.target = target;

difference = source – target;

if (difference < 0)

{

difference = difference*-1;

}

if (source != 0 && target !=0)

{

if (source > target)

{

percentage = (double)target / (double)source;

}

else

{

percentage = (double)source / (double)target;

}

percentage = percentage*100;

}

}

Image Processing

My next port of call was basically image processing, like what I did with my ANPR project that I created – basically filtering stuff out and building a “thumbprint” of the image, that hopefully will withstand being resized and stuff like that. Using image filters, flattening images and looking for large “blobs” of images, sofar I have come up with this:

image

That is the current “thumbprint” for the red channel, on the source image.

An introduction to Pex

Posted by Monty on April 16th, 2009

Pex generates Unit Tests from Parameterized Unit Tests through Automated White box Testing based on Input Generation

Ill be the first to admit, I have never been a big fan of unit testing. To me, it seems like a big waste of time. I’m not sure why, but I just don’t like it – I suppose it has something to-do with spending time writing tests instead of actually doing proper, paid work. Yes, yes, I know that tests “prove” that your code works, as long as you have coded your tests right. But what if you haven’t?

Anyway, I thought id give Pex a test since it generates unit tests for me. I love things that generate things for me, because I like to do things as quickly as possible, and the computer is millions of times faster than me at generating stuff.

For starters – head over to the Pex website, and download it – I downloaded the academic version, since im running VS.NET 2008 pro. Installing it after downloading it also might help matters.

Once you have installed it, you should be able to just open up a project and when right clicking inside a .cs file, you should see a few menu items:

WindowClipping (192)

Once you click on that little baby, Pex should start whizzing into action. Be warned, Pex will only test Public classes and methods – it dosent like testing anything else that isnt public, and I believe it will give you a warning.

In VS.NET’s status bar, you will get a bunch of messages, along the lines of “Pex: listening to monitored process (cold start)” and then “Pex: Finished”. It should also pop up a window, something vaguely like the following:

Pex Exploration Results - stopped - 1 failed, 2 runs

I know this looks confusing at first, but it really isn’t. Its quite simple really. You have various options, but what’s interesting (I think) is the grid view in the middle. The first icon says if the test passed or failed – green = pass, red = ? (Take a guess, gwan, take a guess!) The number denotes the number of the test (its incremental), and the name is the value it has tried If the test fails and throws an exception, that will be listed under the Summary and Error message bits.

If you click on the test, you can see the following to the side :

WindowClipping (194)

The details is the actual code for the unit test that it has executed. I know, it says “this.” instead of the class name, and that’s because Pex creates a copy of the code to run tests on, in a partial class. Under the stack trace subtab, it well, gives you the stack trace (Please tell me you knew what that would do. Please.)

This is where Pex becomes rather … brilliant – it allows you to save all of these generated tests into its own project, simply by selecting the tests you want to save, and hitting the fancy “Save Test…” button – it will go off, and generate its own project (It will ask you for the name of the project, where it should live etc, I will provide a screenshot later) – and it will save the tests to that project! Tests that you can run later, and you don’t have to use vs.net’s test suite – you can decide to plug in different testing libraries such as MBUnit (my current fav) by downloading extensions that are available on CodePlex, or I believe you can create your own.

More on Pex later!

OnItemCommand for Nettiers 2.3

Posted by Monty on April 6th, 2009

Well the good news is I have submitted my patch to include the OnItemCommand for the TableRepeater in Nettiers 2.3 – You can either download the file from this link, or directly from here (it lives in WebLibrary\UI)

Nesting Repeaters without OnItemDataBound

Posted by Monty on February 10th, 2009

windowclipping-106

windowclipping-107

And the page result is:

abc 12345
def 67890

Delete YAF from my database

Posted by Monty on February 5th, 2009

BEGIN TRAN
DROP PROCEDURE yaf_registry_list
DROP PROCEDURE yaf_checkemail_save
DROP PROCEDURE yaf_registry_save
DROP PROCEDURE yaf_user_delete
DROP PROCEDURE yaf_active_updatemaxstats
DROP PROCEDURE yaf_user_approve
DROP PROCEDURE yaf_eventlog_delete
DROP PROCEDURE yaf_poll_stats
DROP PROCEDURE yaf_eventlog_create
DROP PROCEDURE yaf_poll_save
DROP PROCEDURE yaf_bannedip_save
DROP PROCEDURE yaf_choice_vote
DROP PROCEDURE yaf_bannedip_list
DROP PROCEDURE yaf_pollvote_check
DROP PROCEDURE yaf_bannedip_delete
DROP PROCEDURE yaf_post_list
DROP PROCEDURE yaf_category_list
DROP PROCEDURE yaf_user_accessmasks
DROP PROCEDURE yaf_category_save
DROP PROCEDURE yaf_forum_simplelist
DROP PROCEDURE yaf_category_simplelist
DROP PROCEDURE yaf_topic_delete
DROP PROCEDURE yaf_topic_active
DROP PROCEDURE yaf_forum_delete
DROP PROCEDURE yaf_topic_latest
DROP PROCEDURE yaf_forum_listpath
DROP PROCEDURE yaf_post_last10user
DROP PROCEDURE yaf_forum_listSubForums
DROP PROCEDURE yaf_message_approve
DROP PROCEDURE yaf_forum_moderatelist
DROP PROCEDURE yaf_message_delete
DROP PROCEDURE yaf_forum_list
DROP PROCEDURE yaf_pageload
DROP PROCEDURE yaf_forum_listall_fromcat
DROP PROCEDURE yaf_forum_listall
DROP PROCEDURE yaf_forum_save
DROP PROCEDURE yaf_forum_listallmymoderated
DROP PROCEDURE yaf_forum_updatelastpost
DROP PROCEDURE yaf_category_listread
DROP PROCEDURE yaf_forum_updatestats
DROP PROCEDURE yaf_user_list
DROP PROCEDURE yaf_forumaccess_group
DROP PROCEDURE yaf_nntpforum_update
DROP PROCEDURE yaf_group_save
DROP PROCEDURE yaf_topic_updatelastpost
DROP PROCEDURE yaf_message_update
DROP PROCEDURE yaf_topic_move
DROP PROCEDURE yaf_nntptopic_savemessage
DROP PROCEDURE yaf_system_initialize
DROP PROCEDURE yaf_nntpforum_list
DROP PROCEDURE yaf_system_updateversion
DROP PROCEDURE yaf_message_save
DROP PROCEDURE yaf_active_list
DROP PROCEDURE yaf_topic_prune
DROP PROCEDURE yaf_attachment_list
DROP PROCEDURE yaf_topic_save
DROP PROCEDURE yaf_board_create
DROP PROCEDURE yaf_board_delete
DROP PROCEDURE yaf_watchforum_list
DROP PROCEDURE yaf_board_poststats
DROP PROCEDURE yaf_category_delete
DROP PROCEDURE yaf_accessmask_delete
DROP PROCEDURE yaf_forumaccess_list
DROP PROCEDURE yaf_forumaccess_save
DROP PROCEDURE yaf_group_delete
DROP PROCEDURE yaf_forum_moderators
DROP PROCEDURE yaf_user_find
DROP PROCEDURE yaf_user_guest
DROP PROCEDURE yaf_pmessage_save
DROP PROCEDURE yaf_group_list
DROP PROCEDURE yaf_group_member
DROP PROCEDURE yaf_active_stats
DROP PROCEDURE yaf_usergroup_list
DROP PROCEDURE yaf_mail_createwatch
DROP PROCEDURE yaf_mail_delete
DROP PROCEDURE yaf_mail_list
DROP PROCEDURE yaf_message_findunread
DROP PROCEDURE yaf_message_getReplies
DROP PROCEDURE yaf_message_list
DROP PROCEDURE yaf_message_unapproved
DROP PROCEDURE yaf_board_stats
DROP PROCEDURE yaf_message_simplelist
DROP PROCEDURE yaf_watchtopic_list
DROP PROCEDURE yaf_post_list_reverse10
DROP PROCEDURE yaf_topic_listmessages
DROP PROCEDURE yaf_user_activity_rank
DROP PROCEDURE yaf_pmessage_list
DROP PROCEDURE yaf_forum_listread
DROP PROCEDURE yaf_pmessage_prune
DROP PROCEDURE yaf_topic_list
DROP PROCEDURE yaf_userpmessage_list
DROP PROCEDURE yaf_user_deleteold
DROP PROCEDURE yaf_pmessage_delete
DROP PROCEDURE yaf_smiley_delete
DROP PROCEDURE yaf_smiley_list
DROP PROCEDURE yaf_smiley_listunique
DROP PROCEDURE yaf_smiley_save
DROP PROCEDURE yaf_topic_lock
DROP PROCEDURE yaf_topic_findnext
DROP PROCEDURE yaf_topic_findprev
DROP PROCEDURE yaf_topic_info
DROP PROCEDURE yaf_topic_simplelist
DROP PROCEDURE yaf_forum_listtopics
DROP PROCEDURE yaf_user_removepointsbytopicid
DROP PROCEDURE yaf_user_resetpoints
DROP PROCEDURE yaf_user_removepoints
DROP PROCEDURE yaf_user_login
DROP PROCEDURE yaf_user_recoverpassword
DROP PROCEDURE yaf_user_nntp
DROP PROCEDURE yaf_user_savepassword
DROP PROCEDURE yaf_user_saveavatar
DROP PROCEDURE yaf_user_suspend
DROP PROCEDURE yaf_user_setpoints
DROP PROCEDURE yaf_active_listtopic
DROP PROCEDURE yaf_user_savesignature
DROP PROCEDURE yaf_active_listforum
DROP PROCEDURE yaf_userforum_list
DROP PROCEDURE yaf_user_upgrade
DROP PROCEDURE yaf_eventlog_list
DROP PROCEDURE yaf_user_simplelist
DROP PROCEDURE yaf_user_emails
DROP PROCEDURE yaf_user_getsignature
DROP PROCEDURE yaf_user_addpoints
DROP PROCEDURE yaf_user_adminsave
DROP PROCEDURE yaf_user_avatarimage
DROP PROCEDURE yaf_user_changepassword
DROP PROCEDURE yaf_user_deleteavatar
DROP PROCEDURE yaf_user_getpoints
DROP PROCEDURE yaf_watchforum_delete
DROP PROCEDURE yaf_watchforum_add
DROP PROCEDURE yaf_watchforum_check
DROP PROCEDURE yaf_watchtopic_delete
DROP PROCEDURE yaf_watchtopic_check
DROP PROCEDURE yaf_watchtopic_add
DROP PROCEDURE yaf_attachment_save
DROP PROCEDURE yaf_attachment_delete
DROP PROCEDURE yaf_attachment_download
DROP PROCEDURE yaf_usergroup_save
DROP PROCEDURE yaf_rank_delete
DROP PROCEDURE yaf_rank_list
DROP PROCEDURE yaf_rank_save
DROP PROCEDURE yaf_accessmask_save
DROP PROCEDURE yaf_accessmask_list
DROP PROCEDURE yaf_userforum_save
DROP PROCEDURE yaf_userforum_delete
DROP PROCEDURE yaf_board_save
DROP PROCEDURE yaf_board_list
DROP PROCEDURE yaf_nntpserver_delete
DROP PROCEDURE yaf_nntpserver_list
DROP PROCEDURE yaf_nntpserver_save
DROP PROCEDURE yaf_nntpforum_save
DROP PROCEDURE yaf_nntpforum_delete
DROP PROCEDURE yaf_nntptopic_list
DROP PROCEDURE yaf_pmessage_info
DROP PROCEDURE yaf_userpmessage_delete
DROP PROCEDURE yaf_pmessage_markread
DROP PROCEDURE yaf_replace_words_delete
DROP PROCEDURE yaf_replace_words_edit
DROP PROCEDURE yaf_replace_words_list
DROP PROCEDURE yaf_user_save
DROP PROCEDURE yaf_replace_words_save
DROP PROCEDURE yaf_checkemail_update
DROP VIEW yaf_vaccess
DROP FUNCTION yaf_forum_topics
DROP FUNCTION yaf_forum_posts
DROP FUNCTION yaf_bitset

ALTER TABLE yaf_Choice DROP CONSTRAINT [FK_yaf_Choice_yaf_Poll]
ALTER TABLE yaf_PollVote DROP CONSTRAINT [FK_yaf_PollVote_yaf_Poll]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_Poll]
ALTER TABLE yaf_AccessMask DROP CONSTRAINT [FK_yaf_AccessMask_yaf_Board]
ALTER TABLE yaf_Active DROP CONSTRAINT [FK_yaf_Active_yaf_Board]
ALTER TABLE yaf_BannedIP DROP CONSTRAINT [FK_yaf_BannedIP_yaf_Board]
ALTER TABLE yaf_Category DROP CONSTRAINT [FK_yaf_Category_yaf_Board]
ALTER TABLE yaf_Group DROP CONSTRAINT [FK_yaf_Group_yaf_Board]
ALTER TABLE yaf_NntpServer DROP CONSTRAINT [FK_yaf_NntpServer_yaf_Board]
ALTER TABLE yaf_Rank DROP CONSTRAINT [FK_yaf_Rank_yaf_Board]
ALTER TABLE yaf_Registry DROP CONSTRAINT [FK_yaf_Registry_yaf_Board]
ALTER TABLE yaf_Smiley DROP CONSTRAINT [FK_yaf_Smiley_yaf_Board]
ALTER TABLE yaf_User DROP CONSTRAINT [FK_yaf_User_yaf_Board]
ALTER TABLE yaf_User DROP CONSTRAINT [FK_yaf_User_yaf_Rank]
ALTER TABLE yaf_Active DROP CONSTRAINT [FK_yaf_Active_yaf_User]
ALTER TABLE yaf_CheckEmail DROP CONSTRAINT [FK_yaf_CheckEmail_yaf_User]
ALTER TABLE yaf_EventLog DROP CONSTRAINT [FK_yaf_EventLog_yaf_User]
ALTER TABLE yaf_Forum DROP CONSTRAINT [FK_yaf_Forum_yaf_User]
ALTER TABLE yaf_Message DROP CONSTRAINT [FK_yaf_Message_yaf_User]
ALTER TABLE yaf_PMessage DROP CONSTRAINT [FK_yaf_PMessage_yaf_User1]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_User]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_User2]
ALTER TABLE yaf_UserForum DROP CONSTRAINT [FK_yaf_UserForum_yaf_User]
ALTER TABLE yaf_UserPMessage DROP CONSTRAINT [FK_yaf_UserPMessage_yaf_User]
ALTER TABLE yaf_WatchForum DROP CONSTRAINT [FK_yaf_WatchForum_yaf_User]
ALTER TABLE yaf_WatchTopic DROP CONSTRAINT [FK_yaf_WatchTopic_yaf_User]
ALTER TABLE yaf_Forum DROP CONSTRAINT [FK_yaf_Forum_yaf_Category]
ALTER TABLE yaf_Active DROP CONSTRAINT [FK_yaf_Active_yaf_Forum]
ALTER TABLE yaf_Forum DROP CONSTRAINT [FK_yaf_Forum_yaf_Forum]
ALTER TABLE yaf_ForumAccess DROP CONSTRAINT [FK_yaf_ForumAccess_yaf_Forum]
ALTER TABLE yaf_NntpForum DROP CONSTRAINT [FK_yaf_NntpForum_yaf_Forum]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_Forum]
ALTER TABLE yaf_UserForum DROP CONSTRAINT [FK_yaf_UserForum_yaf_Forum]
ALTER TABLE yaf_WatchForum DROP CONSTRAINT [FK_yaf_WatchForum_yaf_Forum]
ALTER TABLE yaf_Attachment DROP CONSTRAINT [FK_yaf_Attachment_yaf_Message]
ALTER TABLE yaf_Forum DROP CONSTRAINT [FK_yaf_Forum_yaf_Message]
ALTER TABLE yaf_Message DROP CONSTRAINT [FK_yaf_Message_yaf_Message]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_Message]
ALTER TABLE yaf_Active DROP CONSTRAINT [FK_yaf_Active_yaf_Topic]
ALTER TABLE yaf_Forum DROP CONSTRAINT [FK_yaf_Forum_yaf_Topic]
ALTER TABLE yaf_Message DROP CONSTRAINT [FK_yaf_Message_yaf_Topic]
ALTER TABLE yaf_NntpTopic DROP CONSTRAINT [FK_yaf_NntpTopic_yaf_Topic]
ALTER TABLE yaf_Topic DROP CONSTRAINT [FK_yaf_Topic_yaf_Topic]
ALTER TABLE yaf_WatchTopic DROP CONSTRAINT [FK_yaf_WatchTopic_yaf_Topic]
ALTER TABLE yaf_NntpForum DROP CONSTRAINT [FK_yaf_NntpForum_yaf_NntpServer]
ALTER TABLE yaf_NntpTopic DROP CONSTRAINT [FK_yaf_NntpTopic_yaf_NntpForum]
ALTER TABLE yaf_ForumAccess DROP CONSTRAINT [FK_yaf_ForumAccess_yaf_AccessMask]
ALTER TABLE yaf_UserForum DROP CONSTRAINT [FK_yaf_UserForum_yaf_AccessMask]
ALTER TABLE yaf_ForumAccess DROP CONSTRAINT [FK_yaf_ForumAccess_yaf_Group]
ALTER TABLE yaf_UserGroup DROP CONSTRAINT [FK_yaf_UserGroup_yaf_Group]
ALTER TABLE yaf_UserPMessage DROP CONSTRAINT [FK_yaf_UserPMessage_yaf_PMessage]

drop table dbo.yaf_AccessMask
drop table dbo.yaf_Active
drop table dbo.yaf_Attachment
drop table dbo.yaf_BannedIP
drop table dbo.yaf_Board
drop table dbo.yaf_Category
drop table dbo.yaf_CheckEmail
drop table dbo.yaf_Choice
drop table dbo.yaf_EventLog
drop table dbo.yaf_Forum
drop table dbo.yaf_ForumAccess
drop table dbo.yaf_Group
drop table dbo.yaf_Mail
drop table dbo.yaf_Message
drop table dbo.yaf_NntpForum
drop table dbo.yaf_NntpServer
drop table dbo.yaf_NntpTopic
drop table dbo.yaf_PMessage
drop table dbo.yaf_Poll
drop table dbo.yaf_PollVote
drop table dbo.yaf_Rank
drop table dbo.yaf_Registry
drop table dbo.yaf_Replace_Words
drop table dbo.yaf_Smiley
drop table dbo.yaf_Topic
drop table dbo.yaf_User
drop table dbo.yaf_UserForum
drop table dbo.yaf_UserGroup
drop table dbo.yaf_UserPMessage
drop table dbo.yaf_WatchForum
drop table dbo.yaf_WatchTopic

IF @@ERROR &lt;&gt; 0
BEGIN
ROLLBACK TRAN
return 11
END

COMMIT TRAN

Dropping views, functions and proc’s

Posted by Monty on February 5th, 2009

Part 3 of my “Getting rid of YAF” series involves dropping views, functions and stored procedures.


SELECT 'DROP PROCEDURE '+name FROM dbo.sysobjects WHERE (type = 'P') union all
SELECT 'DROP VIEW ' + name from dbo.sysobjects WHERE (type = 'V') union all
SELECT 'DROP FUNCTION ' + name from dbo.sysobjects WHERE (type = 'FN')

Which should hopefully give you the following:


DROP PROCEDURE yaf_registry_list
DROP PROCEDURE yaf_checkemail_save
DROP PROCEDURE yaf_registry_save
DROP PROCEDURE yaf_user_delete
DROP PROCEDURE yaf_active_updatemaxstats
DROP PROCEDURE yaf_user_approve
DROP PROCEDURE yaf_eventlog_delete
DROP PROCEDURE yaf_poll_stats
DROP PROCEDURE yaf_eventlog_create
DROP PROCEDURE yaf_poll_save
DROP PROCEDURE yaf_bannedip_save
DROP PROCEDURE yaf_choice_vote
DROP PROCEDURE yaf_bannedip_list
DROP PROCEDURE yaf_pollvote_check
DROP PROCEDURE yaf_bannedip_delete
DROP PROCEDURE yaf_post_list
DROP PROCEDURE yaf_category_list
DROP PROCEDURE yaf_user_accessmasks
DROP PROCEDURE yaf_category_save
DROP PROCEDURE yaf_forum_simplelist
DROP PROCEDURE yaf_category_simplelist
DROP PROCEDURE yaf_topic_delete
DROP PROCEDURE yaf_topic_active
DROP PROCEDURE yaf_forum_delete
DROP PROCEDURE yaf_topic_latest
DROP PROCEDURE yaf_forum_listpath
DROP PROCEDURE yaf_post_last10user
DROP PROCEDURE yaf_forum_listSubForums
DROP PROCEDURE yaf_message_approve
DROP PROCEDURE yaf_forum_moderatelist
DROP PROCEDURE yaf_message_delete
DROP PROCEDURE yaf_forum_list
DROP PROCEDURE yaf_pageload
DROP PROCEDURE yaf_forum_listall_fromcat
DROP PROCEDURE yaf_forum_listall
DROP PROCEDURE yaf_forum_save
DROP PROCEDURE yaf_forum_listallmymoderated
DROP PROCEDURE yaf_forum_updatelastpost
DROP PROCEDURE yaf_category_listread
DROP PROCEDURE yaf_forum_updatestats
DROP PROCEDURE yaf_user_list
DROP PROCEDURE yaf_forumaccess_group
DROP PROCEDURE yaf_nntpforum_update
DROP PROCEDURE yaf_group_save
DROP PROCEDURE yaf_topic_updatelastpost
DROP PROCEDURE yaf_message_update
DROP PROCEDURE yaf_topic_move
DROP PROCEDURE yaf_nntptopic_savemessage
DROP PROCEDURE yaf_system_initialize
DROP PROCEDURE yaf_nntpforum_list
DROP PROCEDURE yaf_system_updateversion
DROP PROCEDURE yaf_message_save
DROP PROCEDURE yaf_active_list
DROP PROCEDURE yaf_topic_prune
DROP PROCEDURE yaf_attachment_list
DROP PROCEDURE yaf_topic_save
DROP PROCEDURE yaf_board_create
DROP PROCEDURE yaf_board_delete
DROP PROCEDURE yaf_watchforum_list
DROP PROCEDURE yaf_board_poststats
DROP PROCEDURE yaf_category_delete
DROP PROCEDURE yaf_accessmask_delete
DROP PROCEDURE yaf_forumaccess_list
DROP PROCEDURE yaf_forumaccess_save
DROP PROCEDURE yaf_group_delete
DROP PROCEDURE yaf_forum_moderators
DROP PROCEDURE yaf_user_find
DROP PROCEDURE yaf_user_guest
DROP PROCEDURE yaf_pmessage_save
DROP PROCEDURE yaf_group_list
DROP PROCEDURE yaf_group_member
DROP PROCEDURE yaf_active_stats
DROP PROCEDURE yaf_usergroup_list
DROP PROCEDURE yaf_mail_createwatch
DROP PROCEDURE yaf_mail_delete
DROP PROCEDURE yaf_mail_list
DROP PROCEDURE yaf_message_findunread
DROP PROCEDURE yaf_message_getReplies
DROP PROCEDURE yaf_message_list
DROP PROCEDURE yaf_message_unapproved
DROP PROCEDURE yaf_board_stats
DROP PROCEDURE yaf_message_simplelist
DROP PROCEDURE yaf_watchtopic_list
DROP PROCEDURE yaf_post_list_reverse10
DROP PROCEDURE yaf_topic_listmessages
DROP PROCEDURE yaf_user_activity_rank
DROP PROCEDURE yaf_pmessage_list
DROP PROCEDURE yaf_forum_listread
DROP PROCEDURE yaf_pmessage_prune
DROP PROCEDURE yaf_topic_list
DROP PROCEDURE yaf_userpmessage_list
DROP PROCEDURE yaf_user_deleteold
DROP PROCEDURE yaf_pmessage_delete
DROP PROCEDURE yaf_smiley_delete
DROP PROCEDURE yaf_smiley_list
DROP PROCEDURE yaf_smiley_listunique
DROP PROCEDURE yaf_smiley_save
DROP PROCEDURE yaf_topic_lock
DROP PROCEDURE yaf_topic_findnext
DROP PROCEDURE yaf_topic_findprev
DROP PROCEDURE yaf_topic_info
DROP PROCEDURE yaf_topic_simplelist
DROP PROCEDURE yaf_forum_listtopics
DROP PROCEDURE yaf_user_removepointsbytopicid
DROP PROCEDURE yaf_user_resetpoints
DROP PROCEDURE yaf_user_removepoints
DROP PROCEDURE yaf_user_login
DROP PROCEDURE yaf_user_recoverpassword
DROP PROCEDURE yaf_user_nntp
DROP PROCEDURE yaf_user_savepassword
DROP PROCEDURE yaf_user_saveavatar
DROP PROCEDURE yaf_user_suspend
DROP PROCEDURE yaf_user_setpoints
DROP PROCEDURE yaf_active_listtopic
DROP PROCEDURE yaf_user_savesignature
DROP PROCEDURE yaf_active_listforum
DROP PROCEDURE yaf_userforum_list
DROP PROCEDURE yaf_user_upgrade
DROP PROCEDURE yaf_eventlog_list
DROP PROCEDURE yaf_user_simplelist
DROP PROCEDURE yaf_user_emails
DROP PROCEDURE yaf_user_getsignature
DROP PROCEDURE yaf_user_addpoints
DROP PROCEDURE yaf_user_adminsave
DROP PROCEDURE yaf_user_avatarimage
DROP PROCEDURE yaf_user_changepassword
DROP PROCEDURE yaf_user_deleteavatar
DROP PROCEDURE yaf_user_getpoints
DROP PROCEDURE yaf_watchforum_delete
DROP PROCEDURE yaf_watchforum_add
DROP PROCEDURE yaf_watchforum_check
DROP PROCEDURE yaf_watchtopic_delete
DROP PROCEDURE yaf_watchtopic_check
DROP PROCEDURE yaf_watchtopic_add
DROP PROCEDURE yaf_attachment_save
DROP PROCEDURE yaf_attachment_delete
DROP PROCEDURE yaf_attachment_download
DROP PROCEDURE yaf_usergroup_save
DROP PROCEDURE yaf_rank_delete
DROP PROCEDURE yaf_rank_list
DROP PROCEDURE yaf_rank_save
DROP PROCEDURE yaf_accessmask_save
DROP PROCEDURE yaf_accessmask_list
DROP PROCEDURE yaf_userforum_save
DROP PROCEDURE yaf_userforum_delete
DROP PROCEDURE yaf_board_save
DROP PROCEDURE yaf_board_list
DROP PROCEDURE yaf_nntpserver_delete
DROP PROCEDURE yaf_nntpserver_list
DROP PROCEDURE yaf_nntpserver_save
DROP PROCEDURE yaf_nntpforum_save
DROP PROCEDURE yaf_nntpforum_delete
DROP PROCEDURE yaf_nntptopic_list
DROP PROCEDURE yaf_pmessage_info
DROP PROCEDURE yaf_userpmessage_delete
DROP PROCEDURE yaf_pmessage_markread
DROP PROCEDURE yaf_replace_words_delete
DROP PROCEDURE yaf_replace_words_edit
DROP PROCEDURE yaf_replace_words_list
DROP PROCEDURE yaf_user_save
DROP PROCEDURE yaf_replace_words_save
DROP PROCEDURE yaf_checkemail_update
DROP VIEW yaf_vaccess
DROP FUNCTION yaf_forum_topics
DROP FUNCTION yaf_forum_posts
DROP FUNCTION yaf_bitset

Using the scrips below and this script should be all you need to have a YAF free database.


Copyright © 2007-2010 Muntedhar Alhakim. All rights reserved.