Visual Studio 2010 Beta 2 Needs Work

January 17, 2010 at 2:18 AMRampidByter

I’ve been trying to use nothing but Visual Studio 2010 for my at-home development uses. For the most part it works decently until it decides to be not be so cordial. I’ve seen things from group boxes all of a sudden only half the text on any contained controls displays. Restarting Visual Studio does nothing to redisplay the text even though it’s clearly in the Text property window. The only solution to that seems to be to add or change one character on any of the contained controls and auto-magically the rest of the text in all the controls displays properly again within the group box. That one has happened several times already.

There has also been the fancy quirks of leaving Visual Studio 2010 running and using it through a remote desktop connection. That one causes some strange behavior from getting stuck in a frozen state, not releasing locks to referenced assemblies, which that assembly part sucks when said assemblies solution is open in another Visual Studio instance you want to compile. That may have just been something weird between Visual Studio 2010 as the main windows form project and Visual Studio 2005 as the assembly project. The worst being when switching between code pages where the code-behind looses the cursor. Just stops showing up, don’t know where you are, but it can still move and select text using the mouse or keyboard. Just the funny thing is the text doesn’t show itself being selected either, but you can definitely ctrl-c it and it copies find to the clipboard.

Who knows, but the oddities are adding up quickly. I just had Visual Studio 2010 crash for the third time for unknown reasons as a result of adding an About Form to the project and modifying the About Form’s form wide text. Open the project, close all code behind, open the About Form, right-click to view code, and then it prompts to restart itself. I think that means go to bed and shut down for the night.

Posted in: Microsoft | Programming

Tags:

DataGridView Drag and Drop with Multiple Files

January 14, 2010 at 12:44 AMRampidByter

I was working on a project tonight and I noticed something kind of odd. There are a ton of references out there for how to handle the DragDrop event with a single file, but I wasn’t able to find really anything about handling multiple files. Needless to say I figured I’d make a post to remedy this problem.

First thing to note is to select the DataGridView in the designer and from the properties window set “Allow Drop” to “True" to enable the events. Second is to add an event handler to the DataGridView DragEnter event. Within the event simply set e.Effect to one of the desired DragDropEffects enumeration values as such:

private void dgvImageFiles_DragEnter(object sender, DragEventArgs e)
{
 e.Effect = DragDropEffects.Copy;
}

The next step is to simply add an event handler for the DragDrop event and use e.Data.GetData(“FileDrop”) to get a string array containing the full file paths to each file dropped into the DataGridView control. That was at least my desire when building this code, but you could just as easily handle any of the other data format values available from e.Data.GetFormats() function. Below is the DragDrop event I’ve used to get the files dropped into the DataGridView control:

 private void dgvImageFiles_DragDrop(object sender, DragEventArgs e)
 { 
 if (e.Data.GetDataPresent("FileDrop"))
 {
 string[] files = (e.Data.GetData("FileDrop") as string[]);
 
 foreach (string file in files)
 {
 . . . 
 }
 }
 }

That is how to handle drag and drop with the DataGridView with multiple files. Easy enough eh? Well then back to programming I go.

Posted in: .Net | Programming

Tags:

Logitech Mouse Kicked the Bucket

January 10, 2010 at 10:03 PMRampidByter

I can’t help but miss my Microsoft Intelimouse Explorer more and more. I bought a replacement Logitech mouse model M-BZ105A and the thing didn’t even last a full year. It’s been a huge disappointment as the mouse wheel caused a blister on my pointing finger, the wheel is difficult to get pressed directly down and often goes either left or right. Tonight the mouse acted as if moving the mouse was stuck unable to move left or right and finally just stopped responding. It’s the only mouse Logitech made that fits my hands even close to what the Intelimouse did. I can’t help but feel a bit cheated after spending sixty dollars on a device that can’t last even a year compared to the ten years of solid use my Intelimouse endured.

Thankfully I found that of all places NewEgg.com actually sells an older style Microsoft Intelimouse Explorer! I’m thrilled I hope to goodness it holds up to the standards of the last one. I just placed the order and am anxiously awaiting the new mouse. I really should have just bought another Magic Mouse and hooked it to Windows, but gaming would be difficult to adjust to the touch surface of the Magic Mouse.

Posted in: Hardware

Tags:

Blog Engine Spam Cleanup Utility

January 10, 2010 at 3:38 AMRampidByter

While this is totally a reactive approach to dealing with the spam bots posting comments I thought I’d share the clean-up project. In the end I have to give the bots credit for being so kind in nature of appreciative comments. It’s easy to get a big head reading the comments even though they are clearly bots with scripted content.

Attached is the project along with the XML block list. The block list is not complete with equal email, author, IP, and website listing for all the comment postings I received. It was sufficient enough for my needs to clean the comments up. The list may vary depending on the different bots that have visited the blog site, but should allow anyone in the same situation to clean up the mess. The code is roughly written and meant for a one-off cleanup, but below is the code along with the full project that includes the XML block list.

Blog Comment Cleaner Utility

Please note the project was created with Visual Studio 2010 beta 2 in case of difficulty opening the solution file.

Example Command Line:

BlogCommentCleaner.exe “c:\blog\App_Data\posts” “c:\blog\App_Data\block.xml”

Posted in: Offbeat | Programming

Tags:

Blog Engine Spam Cleanup

January 8, 2010 at 1:09 AMRampidByter

After reviewing my web logs I’ve noticed a big uptick in the number of external links to spam sites. I knew about the spam bots posting tens of hundreds of comments on this blog and I promptly shut down comment postings. The bad thing is I authorized all of them to appear not realizing I had set comments to being moderated, and promptly forgot to authorize any comments. That’s why nobody ever saw or heard from me in reply to legit comment postings. ~Sorry~

I took it upon myself to write a blog engine comment spam cleanup utility. It’s basically a console application that just runs through the XML postings (not database driven) using LINQ to XML to query comments looking for criteria on Author, Email, IP, and Website. These elements exist within the posting files within the comment element, and was core to the filtering process.

Essentially I just created a new XML filter file called ‘blocked.xml’ that I created using the following structure:

 1: <block>
 2:  <emails>
 3:  <email>...</email>
 4:  </emails>
 5:  <authors>
 6:  <author>...</author>
 7:  </authors>
 8:  <ips>
 9:  <ip>...</ip>
 10:  </ips>
 11:  <websites>
 12:  <website>...</website>
 13:  </websites>
 14: </block>

From there I load each section into a generic list, using LINQ, and loop through creating a new XDocument for each posting file looking for the comments element’s child comment elements. It queries each comment section in each post looking for any comment that contains emails/ips/author/ or websites contained in the generic lists created from the block list file. Upon finding an offending element it removes its parent element, being the comment element, and removes it from the comments element. Thus removing forever the spam that currently exists from all posting files based on the block list.

The problem is building out the block list. Don’t want to arbitrarily remove valid comments. Luckily most of the spam bots that have taken root on the block share many of the some websites even though email addresses are often random for the same bots. I’m still building out my block list and at this point only have a hundred or so blocked elements added. I will need to most likely script out the creation of the block list so I don’t have to manually build the list. Still so far after manually building the list for an hour it’s dropped the existing spam count by a quarter of what it used to be. Not finished, but it’s getting there.

All of this work brought out an interesting fact that there is no option to remove all comments from view in the blog comment settings, which would have been nice to reduce external linking to websites with T & A related content. You’d think since it can enable and disable allowing comments there would equally be a show/hide all comments setting for those not looking to ever allow comments. Probably pretty niche, but still would be nice for just such an spam infestation occasion.

Posted in: Programming | Utilities

Tags: