Jun 30 2009

10 Useful, Often Overlooked HTML Tags.

Pop quiz: When would you use the <wbr> tag, and what does it do?

Yeah, I had no idea either. In fact, I had never even seen this tag before, but it’s a list of 10 Rare HTML Tags You Really Should Know from Nettuts+

I have to say that most of these I hadn’t heard of, but they are actually quite useful. Granted, I do most of my work in the .NET code behind and middle ware layers, but I do occasionally get to sling a bit of HTML, and I think I may start using some of these…

Oh, I almost forgot - the <wbr> tag allows you to specify a place where you think a line break might be useful, if needed.

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Pregnancy Fetal Development at Week 1 Although it may seem strange to think about, the journey of your pregnancy actually begins before the baby has actually been conceived. The very first week of your pregnancy does not begin with conception, or with the growth of the fetus in your body, but rather it begins with the......
  • All Regarding On Page SEO When it involves doing business on-line, you will soon discover that it’s all regarding the traffic. Traffic, or the quantity of internet users you’d be ready to get for your website, is and can always be the lifeblood of any on-line venture. After all, what smart may be a web......
  • What Does It Take To Become A Search Engine Optimization Specialist? Search Engine Optimization or SEO has become quite a buzzword on the Internet for a number of years now. It seems that people claiming to be an SEO expert are a dime a dozen but many of these people only have a cursory knowledge on the matter and are only......
  • Communications Mode Shift: The Age of Permasation? Part of my job here is to convince you that we are at the start of a fundamental shift in the way we all communicate with each other. In launching this site, I'm finally embracing a part of me that I have too often suppressed, or that has required my......
  • Copywriting For Search Engines & Directories To induce optimal listings in search engine and directory queries, keywords and key concepts should be placed strategically throughout your web pages. To summaries, you wish these words and phrases in: 1. Title tags 2. Meta-tags (keywords and descriptions) 3. Headings (if used) 4. Body text, and Alt-attribute in the......
Jun 25 2009

Annoying “next message” behavior in Thunderbird, and how to stop it!

I love the Thunderbird email client. I use the portable version on my thumb drive, but one thing has always bugged the hell out of me when I use it: whenever I delete an email that I have opened in a popup window, Thunderbird automatically opens the next message. Most of the quasi-official entries on the forums state that this is the default behavior, and how 90% of email users use the app anyway, so there is no simple check box for disabling the “feature”.

I must be an odd duck then, because it is most certainly not how I use my email client. I distinctly remember disabling the annoying feature in older versions of Outlook Express. Well, I am the type who will not be denied. I go through great pains to get around such roadblocks - out of principle alone!

So I went digging and found many dead ends, and tips & tricks pages that proved to be unrelated. A lot of forums suggest things like adding the delete button to the toolbar, but that only works if you delete it from the main window. I want to read the email first, then delete it. Reading, closing (clicking the “X”) then deleting seems more tedious than necessary.

Then I found this handy add-on. Only one problem: it was for pre 2.0 versions of Thunderbird. The solution: How to hack the add-on to make it work in 2.0+.

Open the install.rdf file, and locate the MaxVersion key:

annoying-next-message-behavior-in-thunderbird_unselect-message-thunderbird-add-on-install_before

Then change the 1.6 to 2.1, like so:

annoying-next-message-behavior-in-thunderbird_unselect-message-thunderbird-add-on-install_after

and voila!

Sweet!

It’s worked great ever since, and I no longer curse Thunderbird. For automatically advancing to the next message, anyway. ;-)

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • eBook Fishing in California The Complete Guide to California Fishing Download Your 32 Page FREE eBook Are you planning a vacation to California? Looking for a better way to fish the more than 1000 lakes throughout this state? You'll find everything you need to know inside The Complete Guide to California Fishing! We've......
  • 4 Weight Loss Tips and Tricks The following weight loss tips and tricks are designed to help you lose weight more effectively and more efficiently than ever before. Following these weight loss tips and tricks is going to have a profound impact on your ability to lose weight quickly and healthfully. 1 - Find a weight......
  • Tips and Tricks for Budgeting Many people think that the budgeting process has to be complicated in order for it to be effective but the truth is actually quite the contrary. Once you know what the basics are when it comes to starting a budget and managing your budget, there is nothing that has to......
  • Scouting for Ski Hills: Tips and Tricks If you're new to the sport of skiing, it goes without saying that you'll want to find the right ski hill for you. The problem, of course, is that if you're new to skiing, you don't know what "the right ski hill for you" even means. Luckily, there are ways......
  • Music Production Tips and Tricks to Help Record, Mix and Master - Source - Author: Ian Waugh What makes a pro recording pro? What is the “sound” that the pros get and how can you make your recordings sound more professional? The simple answer is – there’s no simple answer. But with careful listening and a little experience you can create......
Jun 23 2009

How to fake a TreeNodeCollection subclass in .NET

If you’ve ever had reason to try to extend the standard Microsoft web TreeView control, you will have no doubt noticed that MS was quite unkind to you and sealed (or declared NotInheritable for you VB.NET types) the System.Web.UI.WebControls.TreeNodeCollection class.

The problem arises when you want to overload the default behavior that is implemented by the TreeNodeCollection class. For example, when a node was added to my TreeView class (via the TreeView.Nodes.add method), I needed to be able to analyze it for the ultimate purpose of my subclass.

However, this was not possible because the TreeNodeCollection class is sealed, so I wasn’t able to inherit from it and overload the add method behavior as I should have been able to do.

There are always possibilities.

Anyone who knows me knows I don’t give up easily (if ever), and I eventually plowed through many false starts but hit upon a solution.

I decided to wrap the underlying TreeNodeCollection class with my own, and overload the Nodes property on the TreeView class, and the ChildNodes property on the TreeNode class.

The Wrapper.

Here’s what the wrapper looks like:
[vb language=".net"]

Public Class MyTreeNodeCollection

Private mtvwChildNodes As System.Web.UI.WebControls.TreeNodeCollection
Private mMyTreeViewOwner As IMyNodeContainer

Public Sub New(ByVal Owner As IMyNodeContainer, _
ByVal TreeViewChildren As System.Web.UI.WebControls.TreeNodeCollection)
mtvwChildNodes = TreeViewChildren
mMyTreeViewOwner = Owner
End Sub

Public Sub Add(ByVal child As MyTreeNode)
mtvwChildNodes.Add(CType(child, System.Web.UI.WebControls.TreeNode))
mMyTreeViewOwner.RegisterNodeForLookup(child)
End Sub
End Class
[/vb]

As you can see, the constructor takes the real, underlying TreeNodeCollection to pass all node to prior to being “registered” (analyzed). It also takes something that implements the IMyNodeContainer interface.

The IMyNodeContainer interface.

I had to implement this because I wanted to be able to use this wrapper class for both TreeView and TreeNode objects, but the signature of their properties is different - TreeView.Nodes and TreeNode.ChildNodes, respectively. So I opted for the interface to keep things clean.

Here’s what the interface looks like:

[vb language=".net"]
Public Interface IMyNodeContainer

Sub RegisterNodeForLookup(ByVal node As MyTreeNode)
ReadOnly Property Nodes() As MyTreeNodeCollection

End Interface
[/vb]

Wrapping things up.

This is where the magic happens.

To put the wrapper (MyTreeNodeCollection) in place, I overload the collection getting properties in the base class - TreeView.Nodes and TreeNode.ChildNodes, respectively, like so:

[vb language=".net"]
Public Overloads ReadOnly Property Nodes() As MyTreeNodeCollection Implements IMyNodeContainer.Nodes
Get
Return mNodeCollection
End Get
End Property
[/vb]

So, for those of you playing along at home, when the developer calls .Nodes on an instance of MyTreeView class, an instance of MyTreeNodeCollection is returned and the resulting add method in performed on the underlying TreeNodeCollection, thusly:

[vb language=".net"]
Public Sub Add(ByVal child As MyTreeNode)
mtvwChildNodes.Add(CType(child, System.Web.UI.WebControls.TreeNode))
mMyTreeViewOwner.RegisterNodeForLookup(child)
End Sub
[/vb]

You can see why I had to use the IMyNodeContainer interface here. The RegisterNodeForLookup performs the functionality I was originally trying to subclass the TreeNodeCollection for.

Blog Traffic Exchange Related Posts
Jun 18 2009

Window.scrollTo Fails Under OVERFLOW-Y: auto Style.

I was trying to subclass a Web Treeview control for my own evil purposes and ran into a sticky problem - scrollTo not working! Just for background, my evil purpose was to replace the Infragistics ultra web tree control, since we only use about 5% of the functionality, but pay the full price of upgrades and page size for the other 95%.

anyway, all was going well, until I tried to implement the ScrollTo functionality.

My first pass looked something like this:

[javascript]
<Script Type="text/javascript">
<!–
var ele = document.getElementById(nodeID);
window.scrollTo(ele.parentElement.offsetParent.offsetLeft ,ele.parentElement.offsetParent.offsetTop);
//–>
</Script>
[/javascript]

Now this worked great in my sample text page, but when I dropped it into the main application page, it didn’t do a damn thing. What gives?

Well, I traced the problem down to a style tag on the wrapping div tag:

[css]
OVERFLOW-Y: auto;
[/css]

It seems that the auto setting disallowed my scrolling to a specific x,y coordinate when that coordinate was outside the visible space.

That really stunk because I didn’t have the ability to modify the existing container page, beyond replacing the Infragistics control tag.

Luckily, I found a workaround:

[javascript]
<Script Type="text/javascript">
<!–
var ele = document.getElementById(nodeID);
ele.scrollIntoView();
//–>
</Script>
[/javascript]

Not only does this work within the CSS overflow directive, but it’s also a bit more elegant since I no longer have to worry about all that parent offset nonsense. :)

Blog Traffic Exchange Related Posts
  • How to find what's running under SVCHost.exe My PC was behaving sluggishly the other day. I tried to be patient, but had to fire up the task manager when I could bear it no longer. That's when...
  • How to Delete Empty Folders - FREE! While performing a disk cleanup recently, I had cause to locate and delete any empty folders under a root folder. I knew there had to be a batch file command...
  • Microsoft FxCop doesn't like Microsoft generated code! The other day I thought it might be nice to "do the right thing" and give my code a run against Microsoft's FxCop. I ran it right out of the...
  • 10 Useful, Often Overlooked HTML Tags. Pop quiz: When would you use the <wbr> tag, and what does it do? Yeah, I had no idea either. In fact, I had never even seen this tag before,...
  • Google Chrome: the OS. Google announced last Tuesday that it has its sights on dethroning Microsoft as desktop OS king: "The new operating system, announced late Tuesday night on Google's Web site, will be...
Blog Traffic Exchange Related Websites
  • Search Engine Friendly Content Management Systems What is a Content Management System? A Content Management System (CMS) is a third party software application which allows web site administrators to add, update or delete content, photos, and documents to their web site in “real time”. Many web sites are modified using these web-based tools as they require......
  • Optimising Your Framed Site For Search Engines One method that web designers can use to design and structure a web site is to use frames. However, if your web website utilises frames then you could have major problems getting indexed in the search engines. Although web site design using frames has become less distinguished with the rise......
  • Five Common Myths About Search Engine Picture this scene, an adolescent boy walks into a barber shop and says to the barber, “Don’t touch me, I’m only here because my mom forced me.” Search engine optimizers are sometimes put into the position of the barber. They are knowledgeable and willing to work on their client’s site,......
  • Seven Myths About Search Engines Demystified Today there is a lot of information available on the web about how to get good search engine rankings, some information is good and some information is bad. Over the few years search engines have been around, some myths have developed. Some of these myths are actually just out dated......
  • Search Engine Optimization Seo Search Engine Optimization (SEO) in Dubai Like other business homes Dubai conjointly have internet solutions firms that provide complete range solutions of internet development are operating on new trends and selling ways for on-line businesses. Dubai is the business hub for the globe trade. It’s the time of on-line businesses.......
Jun 16 2009

IE7 WebControl TreeView line gap in quirks mode.

I’ve been writing a subclass of the MS Webcontrol.TreeView control for one of our Web Applications at work. I figured this would be a fairly easy task, since I only needed to extended it with a few properties. It turns out that I was caught on a nit-picky annoyance in the TreeView control itself.

The TreeView control renders verticals lines with gaps.

Here’s a screen cap of the problem.

ie7-webcontrol-treeview-line-gap-in-quirks-mode_treeview-line-break

As you can see, the TreeView control renders the vertical line with a gap, or break (looks like a dashed line!). It didn’t matter how I loaded the data - dynamic/runtime/design time - I get the same gap no matter what!

I was able to see that it was not a problem in IE 6 or less, but what good is that? Well, it turns out that it was a bit of a clue because starting with version 5, IE didn’t render things correctly per the CSS boxing specification. This was fixed in IE 7, but to provide backwards compatibility, Microsoft carried this busted form of rendering forward in IE 6 as QuirksMode. The line gap problem only occurs in strict mode (default for IE 7 and 8, as well as firefox). I could make the line gap go away by forcing the browser into QuirksMode (by adding a comment, ex:

< ! - - QUIRK! - - >

to the very top of the HTML file), but I was writing a web control and would not always have the luxury of controlling my container.

I needed to find a long term solution to this problem.

Next, I looked at the HTML source of the rendered page, and saw this:

[html]
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td>
<div style="width:20px;height:1px">
<img src="/TreeviewControlTest/WebResource.axd?d=OYmDnVppVECKIpxOWC8o8Y7DO6QwB2J3EY4s4RR8zAU1&amp;t=633765128008804061" alt="">
</div>
</td>
<td>
<img src="/TreeviewControlTest/WebResource.axd?d=OYmDnVppVECKIpxOWC8o8UGy0bLoCc8gOB1oQm6Pzj81&amp;t=633765128008804061" alt="">
</td>
<td class="TreeView1_WebTree_1" style="white-space:nowrap;">
<a class="TreeView1_WebTree_0" href="javascript:__doPostBack(’TreeView1$WebTree’,'Root//Tree’)" onclick="TreeView_SelectNode(TreeView1_WebTree_Data, this,’TreeView1_WebTreet6′);" id="TreeView1_WebTreet6" name="TreeView1_WebTreet6">Tree</a>
</td>
</tr>
</table>
[/html]

Each node is rendered as a table, with the vertical line and expand/collapse icons being in their own table cell and wrapped in a div. The problem was the style applied to the outer div - style=”width:20px;height:1px“.

That 1px height was causing the vertical line image to be compressed, but where did it come from?

Reflecting on System.Web.UI.WebControls.TreeNode

I spent almost an hour delving into the various (and copious!) style properties for the tree and its nodes, looking for where this height setting was generating from. I couldn’t find it! I eventually opened the System.Web.UI.WebControls.dll in Reflector to see what the render code for the node was doing:

ie7-webcontrol-treeview-line-gap-in-quirks-mode_treeview-reflector

Well, once I saw that the code was hard-wired to render this CSS style, I was done. Or was I?

!important

Well, it wasn’t going to be as easy as setting the style in the code behind, but I could override the style in my own class.

The trick is to define, and apply the following CSS class:

[css]
<style type="text/css">
.MyTreeView TD Div
{
height: 20px!important;
}
</style>
[/css]

The !important CSS directive overrides the style applied in the System.Web.UI.WebControls.TreeNode render method.

ie7-webcontrol-treeview-line-gap-in-quirks-mode_treeview-no-line-break

Again, just as with the QuirksMode comment above, I was able to add the CSS style to the page and voila - problem solved. But this still wasn’t good enough. I needed this to work out of the box for any consumers of my control.

The ultimate answer was to override the RenderBeginTag of the TreeView control, and render this style before the control itself:

[vb language=".net"]

Public Overrides Sub RenderBeginTag(ByVal writer As System.Web.UI.HtmlTextWriter)
‘/////////////////////////////////////////////////////////////////////////////////////////
‘/// This is a total hack to get around some Microsoft BS which hardwires
‘/// a style attribute on the node div to set the height = 1px!
‘///
‘/// This renders a css override to force the div to the proper height
‘/////////
Me.CssClass = String.Concat(Me.CssClass, " MyTreeView")
writer.WriteBeginTag(HtmlTextWriterTag.Style.ToString)
writer.WriteAttribute(HtmlTextWriterAttribute.Type.ToString, "text/css")
writer.WriteLine(HtmlTextWriter.TagRightChar)
writer.Write(".MyTreeView TD Div ")
writer.WriteLine("{ height: 20px!important; }")
writer.WriteEndTag(HtmlTextWriterTag.Style.ToString)
writer.WriteLine()
‘//////////////////////////////////////////////////

‘/// Render the Standard Begin Tag
MyBase.RenderBeginTag(writer)
End Sub
[/vb]

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Getting Started Writing Articles The job of article writing requires considerable skill and expertise in order to carry out with ease and perfection. Yes, this job is not as easy as many would think. An article is written in order to provide some information and it is very important that the article writer......
  • Search Engine Optimization Seo Search Engine Optimization (SEO) in Dubai Like other business homes Dubai conjointly have internet solutions firms that provide complete range solutions of internet development are operating on new trends and selling ways for on-line businesses. Dubai is the business hub for the globe trade. It’s the time of on-line businesses.......
  • Fallene Cotz SPF 58 Water Resistant UVB/UVA Sunscreen for Sensitive Skin, 2.5-Ounce Tube User Reviews Send this to a friend Fallene Cotz SPF 58 Water Resistant UVB/UVA Sunscreen for Sensitive Skin, 2.5-Ounce Tube Manufacturer: Fallene Customer Rating: List Price: $26.00 Sale Price: $16.50 Availibility: Usually ships in 24 hours Free Shipping Available Buy Now Product Description Fallene Cotz SPF 58 is a......
  • Hybrid Diesel Auto Insurance This post is a guest blog written by Travis Overby. In recent years, the popularity of ‘green’ cars has been steadily increasing across the country. When people think of fuel efficient cars, the first thing they think of is hybrid gas-electric cars. However, technological advancements in hybrids have resulted in......
  • What Does It Take To Become A Search Engine Optimization Specialist? Search Engine Optimization or SEO has become quite a buzzword on the Internet for a number of years now. It seems that people claiming to be an SEO expert are a dime a dozen but many of these people only have a cursory knowledge on the matter and are only......
Jun 11 2009

How to find what’s running under SVCHost.exe

My PC was behaving sluggishly the other day. I tried to be patient, but had to fire up the task manager when I could bear it no longer. That’s when I noticed great gobs of my swap file allocated to “SVCHOST.EXE”:

whats-running-under-svchost_exe_tasklist-ss

The problem is, SVCHOST is a catch all windows service container. Meaning, many windows services run under the same instance of SVCHOST. How was I going to figure out which services might be the culprit?

Enter the tasklist command.

Tasklist displays info about running tasks, including SVCHOST.

Simply running tasklist at the command prompt displays a laundry list of all running processes. This wasn’t going to do it, so I ran it with the “/?” switch to try and find how to narrow the info…

/SVC Displays services hosted in each process.
/FI filter Displays a set of tasks that match a given criteria specified by the filter.

Looks good so far, now I need to know what filter to apply:

Filters:
    Filter Name     Valid Operators           Valid Value(s)
    -----------     ---------------           --------------------------
    IMAGENAME       eq, ne                    Image name

OK, this gives us:

“C:\>tasklist /svc /FI “IMAGENAME EQ SCVHOST.EXE”

But it seems the filter is case sensitive, because when I run that command, I get this:

INFO: No tasks are running which match the specified criteria.

So, switching to lower case gives me what I want:

“C:\>tasklist /svc /FI “IMAGENAME EQ svchost.exe”

Image Name     PID        Services
=========== =====  =======================
svchost.exe     744        DcomLaunch
svchost.exe     844        RpcSs
svchost.exe     888        AeLookupSvc, AppMgmt,
                                    AudioSrv, BITS, Browser,
                                    CryptSvc, dmserver,
                                    EventSystem,lanmanserver,
                                    lanmanworkstation, Netman,
                                    Nla, RasMan, Schedule,
                                    seclogon, SENS,ShellHWDetection,
                                    Themes, winmgmt, wuauserv
svchost.exe     928         Dhcp, Dnscache
svchost.exe     976         LmHosts, W32Time
svchost.exe     1772       Net Driver HPZ12
svchost.exe     1816       Pml Driver HPZ12
svchost.exe     2424       TermService
svchost.exe     3312       TapiSrv
svchost.exe     2688       W3SVC

From there, it’s just a matter of shutting down or restarting each of the services listed under the process id 888 ( I got this from taskmanager).

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Maintenance for your Swimming Pool On a humid and hot day in August, there is nothing that feels quite as good as a dip in your pool. If your pool is looking a little bit more like a pond than a place for swimming, then nobody is going to be happy. Here are some tips......
  • Tips for Snowboarding pt 4 For a lot of people, however, it is their very first time buying a brand new snowboard, and so they unfortunately do not have much of an idea of what they should be doing or even what they should be looking for. When you are going online to buy a......
  • SVCHOST.exe - What is it and why are there so many of them? I get asked this a lot.  When you run Task Manager in XP and look at the process list, you see tons of svchost.exe processes running.  You can't kill them (you don't really want to) and there's no obvious reason that there are so many of them. What are they? ......
  • Top 10 - SEO Do's & Don'ts SEO Do's Create a Useful, Content-Rich Website Properly Optimize Your Website Pages Have Relevant Websites Link to Your Website Analyze and Understand Your Website Statistics Revise Optimization Based on Feedback Create a Long-Term Content Strategy or Plan Do Learn Patience, Search Engine Success Takes Time Understand What Will and Will......
Jun 09 2009

Arraylist and generics don’t mix with IEnumerable(Of T).GetEnumerator.

The other day I was writing an in-house tool to assist in some upgrades we were performing on client installations. This tool was supposed to perform its operations on a batch of items, and display the results upon completion.

Since processing this batch of items was a lengthy endeavor, I wanted the failure to process one of the items to simply be recorded and allow the processing of the others to continue. Part of the processing of each item was a call to multiple web services, so I would need a way to handle the collection of errors along the way and make them available for their eventual display.

I had what I thought was a clever idea: a private Arraylist of exceptions that occurred during processing.

[vbnet]
Public Class BatchExceptions
Implements ICollection(Of System.Exception)

Private mExceptionlist As ArrayList
.
.
.
End Class
[/vbnet]

That way, I could simply iterate over the list and perform the standard exception handling, like so:

[vbnet]
Dim exc As Exception
For Each exc In BatchExceptions
HandleError(exc)
Next
[/vbnet]

Of course, in order to make use of the “For Each” construct, I had to implement the GetEnumerator of the ICollection interface.

[vbnet]
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of System.Exception) _
Implements System.Collections.Generic.IEnumerable(Of System.Exception).GetEnumerator
Return (mExceptionlist.GetEnumerator)
End Function
[/vbnet]

Cool. Only one problem:

arraylist-and-generics-dont-mix-when-enumerating-generics_generics-enumerator

That was OK though, because I was using generics after all. The compiler was being helpful and reminding me that I had to specify ‘IEnumerator(Of Exception)’:

arraylist-and-generics-dont-mix-when-enumerating-generics_generics-enumerator2

[vbnet]
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of System.Exception) _
Implements System.Collections.Generic.IEnumerable(Of System.Exception).GetEnumerator
Return (DirectCast(mExceptionlist.GetEnumerator, IEnumerator(Of Exception)))
End Function
[/vbnet]

Everything compiled fine, but at run-time I got the following RTE:

Unable to cast object of type ‘ArrayListEnumeratorSimple’ to type ‘System.Collections.Generic.IEnumerator`1[System.Exception]‘.

arraylist-and-generics-dont-mix-when-enumerating-generics_generics-enumerator-rte

This was frustrating. It seemed like the compiler failed to warn me of this incompatibility, and simply kicked the can on down the road to the run-time to deal with.

Solution:

Well, I did a little poking around and finally ended up replacing my Arraylist with a list like so:

[vbnet]
private mExceptionlist as System.Collections.Generic.list
[/vbnet]

Well, that did the trick but I can’t say it was as intuitive as it would seem. It makes sense, in hindsight, but why did I have to get some cryptic RTE? Why couldn’t the compiler have picked up on my use of an ArrayList and say, “Hey dummy - use a generic list!”? Still, I have a new trick to toss in my bag for the time I want to implement an enumerator on an Arraylist!

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Explaining the ‘Mental’ Side of Weight-Loss This is a guest article written by Dr. Michael A. Snyder, MD, FACS, creator of FullBar. The major barrier to weight loss is accepting the need to change your diet, behaviors, AND relationship with food. These changes require a commitment. And, all of us know that commitments are very difficult!!......
  • Free Success Ebook: “How to Turn Your Desires and Ideals Into Reality” by Brown Landone – Free Download! FIRST, AN ideal to come true must be an ideal; an idea will not do.  Second, an ideal to become a reality must have a heart of desire, – and a good strong heart.  Third, an ideal to come into manifestation must be a body of real etheric substance. ......
  • List Builder Pro I just received this email from a trusted source. I know I am always looking for quality leads.  This sounds worth checking into. If you're fed up with building your business one lead or subscriber at a time, then I've got some great news for you! But first ... Here's......
  • EBay Versus Amazon.com Marketplace: Which One Is Easier And Better For Creating Extra Cash On The Internet There's a good possibility that you've paid for an item on ebay, or done shopping at Amazon's market place this year, however which one is the better of the two to Making Money?. It's dependent upon what you're selling!, ebay comes to mind as a good place to get rid......
  • How Lacquered Door The process of varnishing a door is to do a little maintenance at the door by creating a smoother surface, perfect and smooth while giving protection to the wood against water and other harmful agents. The process is long, but is not complicated, and I've made a video in Spanish......
Jun 04 2009

How to Delete Empty Folders - FREE!

While performing a disk cleanup recently, I had cause to locate and delete any empty folders under a root folder. I knew there had to be a batch file command to accomplish this, but I couldn’t for the life of me remember what it was!

Enter Google.

five minutes of some keyword searching with surgical precision and piecing together commands yielded my solution.

DIR /AD/B/S | SORT > FOLDERLIST.BAT

How It Works.

The Dir command is the familiar directory list command that comes standard with all versions of Windows since 95. The magic is in the switches:

/A Displays files with specified attributes.
When applied to the “D” attribute, it returns directories
/B Uses bare format (no heading information or summary).
/S Displays files in specified directory and all subdirectories.

SORT is an often overlooked command for, you guessed it, sorting. Here, the results of the Dir command are piped (”|”) into the SORT command as input. The result of the SORT command is then redirected from the command prompt to a file called FOLDERLIST.BAT.

Kick it up a notch.

Now that you’ve created this list, say you want to automate the deletion of each entry in the list. This is where pumping the output to a “.bat” file comes in. Open the bat file in textpad, or notepad, or your text editor

For example:

Typing:
DIR /AD/B/S | SORT > FOLDERLIST.BAT

in my C:\Program Files\Microsoft Visual Studio 8\VC folder yields the following results:

empty-file-results

Next, open the file in a text editor, word, or open office and replace the beginning of each line with the RD command followed by a space and a single quote. Like so:

empty-file-replace

This should give you the following:

empty-file-first-replace

Notice how each line now begins with “RD “” This is the old DOS Remove Directory command. Don’t worry, it only removes empty directories. But you still need to add an ending quote to each line. This is where Word or Open Office is handy. You can do another search and replace, but this time search for “^p” (new paragraph) and replace with ““^p” (end quote and new paragraph).

Save the file, and you’re all done except the double clicking.

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • Wordpress Backup Wordpress Backup is an essential plugin for all Wordpress blog administrators by the Blog Traffic Exchange. It performs regular backups of your upload (images) current theme, and plugin directories. Backup files are available for download and optionally emailed to a specified email. Don't get caught without a recent backup of......
  • The Lab Today just release "The Lab". The Lab is something simple, it is a place where all the scripts from this site can be found. Is a simple dir listing with the script description and use full links. I used a Php script to do the files listing and sorting by......
  • 5 Ways To Make Money Marketing Online Internet marketing for any product or program is a numbers game to a certain extent. You need eyeballs on your website. If you become good at getting traffic you can work at converting more of those visitors into sales and make more money. Here are 5 ways to make money......
  • Weight Loss Tips and Tricks When it comes to losing weight, you probably know the drill. Burn more calories than you consume, eat healthy, and be healthy and the results will happen. Most diets and weight loss plans do not have much substance which is why dieting in general is far from healthy for you.......
  • Anti Aging Makeup Tricks and Tips pt 1 There are all kinds of makeup tricks and tips out there, but choosing the right ones for your own personal needs is something that you need to figure out. Here are some unique makeup tricks and tips that are anti-aging in nature. What I meant to say is that there......
Jun 02 2009

Microsoft FxCop doesn’t like Microsoft generated code!

The other day I thought it might be nice to “do the right thing” and give my code a run against Microsoft’s FxCop.

I ran it right out of the box - I didn’t bother making my own rules or changing the defaults. I was bored. Anyway, here’s one of the results that actually made be chuckle once I read it carefully:

Warning, Certainty 90, for DoNotInitializeUnnecessarily
{

Target : #.ctor() (IntrospectionTargetMember)
Location : <735>> (String)
Resolution : “‘MyDocument.New()’ initializes field ‘MyDocument.disposedValue’
of type ‘Boolean’ to false. Remove this initialization
because it will be done automatically by the runtime.”

Help : (String)
Category : Microsoft.Performance (String)
CheckId : CA1805 (String)
RuleFile : Performance Rules (String)
Info : “Do not make initializations that have already been
done by the runtime.”
Created : 3/6/2009 6:58:21 PM (DateTime)
LastSeen : 3/6/2009 8:36:25 PM (DateTime)
Status : Active (MessageStatus)
Fix Category : NonBreaking (FixCategories)

}

The reason for the chuckle was that the code which triggered this violation of the rule was written by the Microsoft IDE! My role in this infraction was really quite simple: I typed “Implements IDisposable” and hit Enter. The IDE was “nice” enough to plugin the rest for me:

[vb language=".net"]

‘ To detect redundant calls
Private disposedValue As Boolean = False

‘ IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
Array.Clear(mDocumentContent, 0, mDocumentContent.Length)
End If
End If
Me.disposedValue = True
End Sub
[/vb]

It’s bad enough that the IDE writes code for me without prompting, but maybe the FxCop team should talk to the IDE team to avoid such embarrassing nuisances (I had dozens of similar warnings to weed through) in the future.

According to the Code Analysis Team, this is the new default for FxCop 1.36.

Here’s how to avoid it:

Using an FxCop project:

  1. Open your FxCop project in FxCop
  2. Choose Project -> Options -> Spelling & Analysis
  3. Check Suppress analysis results against generated code
  4. Click OK

OR, if you prefer the command-line:

  1. Pass the /ignoregeneratedcode switch, for example:

FxCopCmd.exe /file:MyAssembly.dll /out:AnalysisResults.xml /ignoregeneratedcode

Blog Traffic Exchange Related Posts Blog Traffic Exchange Related Websites
  • The Complete Home Improvement Perspective There are lots of people these days that consider themselves good handy people.  These people are fond of bragging about their complete home improvement skills and all of the projects they have managed to put together.  If you are listening to some of these people, you may just be tempted......
  • 2004 internet business ethics standards [affmage source="chitika" results="0"][/affmage] [mage lang="" source="flickr"]2004 internet business ethics standards[/mage] ResumeHow to Make a Resume Because of the volume of resumes employers receive; most of them now use some kind of resume tracking or applicant tracking system. This automates many of the tasks necessary for tracking candidates, and also makes......
  • Establishing Remodel Cost: Home Remodeling Critical First Step Nothing ruins a fantastic remodel more quickly than exceeding the project budget.  Why is this phenomenon so common in residential remodeling?  Simple:  Many homeowners struggle to establish a detailed budget at the appropriate time in the course of the project. Why is establishing remodel cost one of your most important......