September 20, 2005
Experts Exchange Community News
You are receiving this because you are an member who has opted-in to receive newsletters.
What's New at Experts Exchange
Creating DLLs with Visual Basic

egl1044 wrote up a guide to creating Windows DLLs using Visual Basic, and asked us if we would be interested in it. Unfortunately, we've found that publishing anything that looks like code sets off antivirus filters all over the world, so we asked him for a synopsis; there's a link to his website at the end of the article, which has all the specifics.

The process of creating Windows DLLs (Dynamically Linked Library) with Visual basic has been a question I have seen asked many times on Experts Exchange. Recently I read an article that revealed how to create a Windows DLL with Visual Basic. The article is, of course very informational but it lacks an explanation of some of the issues that go along with the completion of the DLL file itself.

Normally, Visual Basic is known to create only ActiveX.DLL files which can then be registered and added to your project as a reference. However, a major disadvantage of an ActiveX.DLL is that it must be registered on the system it is being deployed on. Further, some other languages are restricted from using the ActiveX.DLL.

The advantage of a Windows DLL is that no registration is necessary, and you can just copy it into the /Windows/System32 directory of the deployment system. You can then pass subs and functions back and forth using API (application programming interface). This makes your code look clean and very easy to share with anyone.

One of the discussions that was missing from the original article was how to pass strings back and forth correctly so that the application will return the actual string rather than Unicode strings. I managed to add on some additional information that can deal with such problems; I've also included some simple workaround tips that can be injected when you declare your API.

The code is shown at CreatingDLL.htm.

Tip from the Page Editors: Using pointer questions

Ever have one of those questions that could be asked in two or three topic areas? What you don't want to do is actually ask it three times, because you'll wind up getting three sets of answers, and it may be that you get the same answer three times -- which means you should accept each of them. That's a bit of a waste, and might even cause you to exceed the maximum points rules.

So what do you do? As a pointer question. Say you've asked your question in the ASP topic area, but you also want to get people from the Access topic area to look at it. Once you've asked your ASP question, copy the URL from the question, and then go to the Access TA. Ask a new question, and in the title, put something like "300 points in ASP". Then, for the body of the question, put a short description of the question and include the URL to your ASP question. Set the points at the minimum (20).

The Access Experts will see your question, and will check to see if they can add anything. When you get your answer, you can then go back to your pointer question and simply delete it, and your points will be refunded.

Perspective from Chaos

gregoryyoung has had an interesting couple of weeks; after being evacuated from New Orleans to Baton Rouge, and then to Ft. Lauderdale, he finds himself in Atlanta, still trying to figure out where he's going to wind up.

In the aftermath of Katrina, I have been in contact with many developers and hiring managers throughout the world. In my dealings I have come upon a new perspective of modern software development particularly in the Microsoft .NET areas, although it applies to any object oriented environment. Please excuse my English as it is a second language behind C# at this point.

The particular comment which I have heard numerous times from senior level people is, "We do not create large enough systems to benefit from design patterns". This comment shows a complete lack of understanding of what design patterns are. To think of a system that could not benefit from design patterns I must resort to a "Hello World" program! I have also heard the comment "We would like to use design patterns but do not have the time given our environment" numerous times. Perhaps it had been my isolation in the technology backwaters of New Orleans but I've been under the impression that design patterns are heavily used through out the industry to ease communication between developers and to provide more cohesive systems to lower the learning curve for new developers.

Design patterns are elegant, well tested, and most importantly reusable solutions to recurring problems in software design. By understanding them you can quickly discuss complex architectures with other develpers and more importantly, you can provide a cohesiveness to your code base which allows a faster ramp up for new developers brought onto a project. An example of a design pattern can be seen in any asynchronous operation in the .NET framework. You may have already noticed that they all operate in the exact same way, due to Microsoft's use of the AsyncH Pattern in the framework itself. Needless to say, once you learn the async pattern you can not only use any of the framework objects that support it easily, but you can also implement in your own objects and a developer who has never seen your objects before will understand exactly how to use them. This is in and of itself the benefit of a design pattern, because it is generalized knowledge.

The concept of knowledge is often represented using the metaphor of building blocks; you use the building blocks that you already have and extend or manipulate them to provide a new piece of knowledge which will eventually be used as a building block for yet another innovation. Whenever a new building block is added there should necesarily be a period of innovation after as it is applied in new and/or different ways. Can you imagine if every physicist had to derive all of Newton's work on his own as opposed to learning it? Once a developer is given the building blocks contained within the most common design patterns there tends to be a "code rennaisance" shortly after, where their newly written code completely transforms. For those supervising managers reading this there also tends to be an extended period of refactoring previously written code to make it simpler, more flexible, and of course more maintainable.

Continuing with the "Building Blocks of Knowledge" metaphor: One can picture these building blocks stacked upon one another with the core blocks being at the bottom and derived blocks being laid upon them, so your core blocks are your most general blocks while more specific blocks of knowledge are derived from them. Based upon this one logically concludes that new building blocks introduced close to the bottom of the stack would intrinsically create further innovation compared to those introduced towards the top of the stack, as the lower blocks would have more blocks they could feasibly interact with. Based upon this one concludes that when it comes to educational returns it is best to focus upon more general items as the more general items will cause larger amounts of innovation within the knowledge space.

While also providing this larger base, the creation of these less granular items has the side benefit of removing core blocks which are in error. Since these are core blocks removing them will cause the derived blocks to be invalidated, thus removing many bad habits at a single point. Since design patterns are generalized to exist outside of any language one can validate that they are indeed a very generalized block of knowledge and will therefore show further gains than other educational works in more granular areas.

Although this explanation is fairly complex (bordering on philosophy) a real life argument can also be put forward. A supervisor who has subscribed to any of the modern development methodologies (i.e. RAD, XP, etc.) knows that the key to a successful real world implementation of any methodology is the ability to re-use code. That means that an expense associated with training your staff to create more re-usable code will show an immediate benefit to your bottom line in future projects as there will be less code to write. Due to this and to the fact that conceptual building blocks are always on a lower level than implementational building blocks it becomes obvious that an educational budget will give a far better return by teaching your developers the concepts of design patterns as opposed to the newest seminar on the whiz-bang component or development tool as the concepts learned through design patterns are language and platform independent.

Resources for further learning:
Online (series of articles illustrating GoF patterns in C#) (old link but rather useful) (patterns and XML)

Design Patterns, Elements of Reusable Object-Oriented Software, Erich Gamma et al. (classic work also known as GoF)
Pattern Oriented Software Architecture, Volume 1, A System of Patterns, Frank Buschmann, et al.
Pattern-Oriented Software Architecture, Volume 2, Patterns for Concurrent and Networked Objects, Douglas Schmidt, et al.
Pattern Oriented Analysis and Design: Composing Patterns to Design Software Systems, Sherif M. Yacoub, et al.
Enterprise Solution Patterns Using Microsoft .Net: Version 2.0 : Patterns & Practices, Microsoft Corporation
.NET Concurrency Design Patterns: Programming in C#, William Stamatakis
Agile Principles, Patterns, and Practices of C# and VB.Net, Robert C. Martin, Micah Martin
Patterns of Enterprise Application Architecture, Martin Fowler et al.

Microsoft Patterns and Practices Summit

Greg Young

Macromedia Studio 8

MHenry is the Page Editor for the Macromedia topic areas. He loves his job, and has nothing but good things to say about his boss. Most of the time.

All right kids, sit up straight and pay attention because I have BIG news. No, I'm not talking about Brittney Spears' new baby; I'm talking about Macromedia releasing Studio 8. We've been hearing about Studio 8 for a long time. It seems like Macromedia is borrowing from the Microsoft playbook -- gear up the PR machine for a new version shortly after the current version is released. The difference is Macromedia is delivering in a big way this time.

For those of you that track such things, you may remember I wrote a wish list shortly after the announcement that Adobe would be purchasing Macromedia. Seems like others were hoping for some of the same things I was. Of course, it also appears like some of my fears may come to pass.

Let's do the bad news first: Macromedia decided not to include Freehand in Studio 8. According to everything I've read, that does not mean they are doing away with Freehand, just that Macromedia decided we would be better served with Contribute and Flash Paper. Well, maybe; but I wouldn't bet the farm that there will be a new version of Freehand in the immediate future. What I would do is run out and buy a copy of Freehand MX if you don't already own one. Don't worry that it may not be updated -- it's still about three years ahead of Illustrator so you'll be fine for a while.

I got my hands on a beta copy of Studio 8 about two weeks ago. Due to time limitations, I haven't had a chance to play with all the programs yet. So I just got right to the one I've been waiting for -- the new version of Flash. Yes, I'm a Flash addict and I'm not afraid to admit it. You can rant and rail at me all you want -- doesn't matter. To borrow a line from those extremely rational folks over at the NRA: You can have my Flash when you pry it from my cold, dead hands.

Now for the good news: Tabbed panels are back! Well, after a fashion anyway. This was one of my wish-list items. I'm still not a fan of the MX-style clutter; those horizontal panels just take up too much real estate. In order to use tabbed panels, simply click on any panel's pop-up window and choose "Group With." Of course, some panels will fit together better than others and some, like the properties panel, don't play well as anything but a horizontal panel but all in all, this is a very welcome change. And one more thing: The library now stays put. That's right; you don't have to open the library every time you reopen a file. If you opened it and left it open, it stays open.

And the good news doesn't stop there. Another thing I mentioned in my wish-list was that, after the merger, Photoshop might be able to incorporate the gradient tools of Fireworks. Well, that hasn't happened -- yet. What has happened is that the same style gradient tools of Fireworks are in the newest version of Flash. It's now easy to move, rotate and tweak gradients in a way that was only possible in Fireworks until now. This is a huge time saver for anyone who has ever produces a gradient on a button. And who among us hasn't? C'mon, don't be afraid. You can admit that you've looked at more than one tutorial on how to create a gel button! Even if you were only looking at it for a friend.

Another huge time-saver is the inclusion of Photoshop-style filters. We now have Drop Shadow, Blur, Glow, Bevel, Gradient Glow, Gradient Bevel and Adjust Color filters native to Flash 8! Now we won't have to close Flash and open Photoshop (because if we had both Flash and Photoshop open along with Winamp playing the music necessary to complete that project before deadline, an ugly blue smoke would bellow out of the system shortly before all the colors on the monitor ran together) to get the job done. Believe me, the time you will save tweening blurs will pay for the upgrade all by itself.

Want more? Ok, how about this: Remember how long it took to get used to the fact that you couldn't overlap drawing elements without them intersecting? Think about how frustrating it was to you to realize, no matter how many times you had done it before, that you just drew an oval with a border and forgot to group it before moving it. Those days are gone! Simply click on the Object Drawing button and anything you draw, including stuff drawn with the pen tool, will now be an object, just like drawing in Corel, Illustrator or Freehand. And Flash even includes the ability to adjust the transparency of anything you draw without the added steps of converting it to a graphic or button, then adjusting the alpha levels.

Not to mention the enhancements to integrating video. All right, don't get crabby; I'll mention them anyway. First, Macromedia isn't charging an extra $100 for the video package this time around. They've also simplified the process of importing video and included more skins for players. You can also embed alpha channels and even markers. Markers that you can access to trigger events.

So, would I recommend this upgrade? You bet. Without any reservations whatsoever. This is by far the best software upgrade I've seen since Photoshop added the history panel to provide for more than one level of undo. We've all seen upgrades that were more fluff than substance. That's not the case here.

I think the thing I like most about Flash 8 is that the features they have included are those that we will really use. This isn't just a minor revision. Macromedia has done the damn near impossible: They have provided a tool that improves workflow without sacrificing the creative aspect. If you use Flash at all, you'll find that with this version you will be able to create more exciting content in less time than ever before. And isn't that the way it should be?

Troubleshooting memory dumps (Part II)

We came across a question that was dealing with memory dumps, and noticed that the Expert, GinEric, said that he was putting together an article on the subject. This is the second of two parts; there's quite a bit more information at GinEric's website.

Why does disk become corrupt?

This is way into the field of electrophysics. Data is stored on disks by inducing areas with cumulative polarity fields. You write them by using a very strong current in a nearby conductor, which induces a counter electromotive force sufficient to alter the actual magnetic orientation of the atoms and molecules within the magnetic medium, the disk or coating on the disk.

You read them by passing a much lesser electromagnetic field over the previsouly written or induced area, then measure the amount of counter electromotive force returned from that action and set a one or a zero according to the strength of the returned counter electromotive force. You rewrite them by again applying the much stronger electromotive force.

However, if they haven't been written lately, or they have been constantly read with no interim refresh writing, the magnetic polarization of the aggregate atoms and/or molecules begins to decay (the Law of Entropy aided by millions of low voltage reads) and the returned field becomes weaker and weaker until it reaches the grey area or less, where the returned values is either indeterminate or wrong. If only one bit, this is a one bit error. If more than one bit, this is considered a fatal error. The name given to this error is "memory corruption."

Of course, memory corruption can have other causes; however, they are usually constant failures and not the intermittent ones seen from field decay. So, what you're doing when you move all these page files and rewrite them is to actually refresh the hysteris of the medium.

So, why is this a problem in Windows?

Because Windows does not rewrite system protected areas, so they get refreshed when only autodefrag is used. You must chkdsk, scandisk, and defrag manually, and, you must do this more than one time -- preferably at least three times.

Windows "format" is also supposed to write, read, and rewrite a sufficient number of times to achieve a known level of hysteresis, but this is problematic at best. Low level format by the disk manufacturers should always use this method, especially on a new disk, as well as on an old disk.

But you can circumvent continual failures by forcing the rewrite of certain areas, which is what the method above does. Reapplying a service pack may have a similar result.

About Dispatch Fault and Free Memory Tracker:

Both are part of the same thing; you got a page fault, or you were measuring free memory or freeing it up, and neither is the cause of the problem. How can I say that? Well, recall that the debugger is telling you that it found an "invalid address":

"An attempt was made to access a pageable (or completely invalid) address at an interrupt request level (IRQL) that is too high"

It says that the "address" was invalid, not the data.

When you analyze a crash dump, you must see the overall picture because often the failure occurred before the reported point of failure:

"80443637 f60101 test byte ptr [ecx],0x1
crash because address c0074ee4 does not exist
8044363a 756e jnz nt!MiDispatchFault+0xc6 (804436aa)"

That clearly says that in the call stack, "jump to report error in MiDispatchFault" because the result of a previous test check failed. That failure was at 80443637, not at the Error Handler portion of dispatching a faulted error report MiDispatchFault.

And, as another hint about how IRQ>1 is used, from the Registry, Plug and Play devices, somewhere under CurrentControlSet or the others, ControlSet00, etc., IRQ 2 is pnp0200 under ROOT\*PNP0200\PNPBIOS_2

And the values of the key are for the DMA Controller, which is the Direct Memory Access Controller, and it is by this IRQ number that the Error Handler knows which device and IRQ are associated with the failure, even if the failure was actually caused by software.

So, the real failure is an invalid address, and this issue is addressed more by the timing problem link, or, a bad address while looking for free memory or a valid pointer to something in memory, than to the dispatch routine. Of course the dispatch routine is going to fail if it is dependent on a routine that failed previous to its operation.

That basically means that you cannot assume the tree you have found in the forest is the tree housing the root cause of the problem in the forest. It may just point to the real tree causing the problem, usually, right next to it, as in the call stack.

So, a good firefighter asks "Which tree actually caught fire first?" and thereby, doesn't have to inspect all of the trees in the forest, but only the ones he suspects. In a forest of 410 million trees, there is little need to look at every tree when you can see where the smoke is originating. You go to that area, immediately, and considerably narrow down your search and save valuable time in putting out fires.

To make a point, I didn't need to inspect all 400 million possibilities, nor to spend considerable time doing more tests than I considered necessary (the extra analyze commands), to assess the damage and cause quickly. In fact, it would have confused the attempt to put out the fire and delayed the work unreasonably.

ESI Register can be used for many things -- a counter, the Source Index Register, whatever. What it contains was set by some previous routine. Interpreting these registers is almost useless unless you can single step through the execution, a feature I haven't yet found in these assemblers and disassemblers, which is called the monitor and editor function.

I have single stepped systems to troubleshoot and find the cause of such problems, but I don't know that it even exists on microprocessor systems yet. It does on certain mainframe systems where you can single step a massively large system or network.

Just as an anecdotal note: I was involved in the design of the predecessors to Intel's registers so I think I know what they do and how they do it. It's just a shame that they don't provide a definitive table of acronyms to English meanings of those acronyms, because it's almost impossible to find out what the numerous acronyms mean in a confusing world of acronymia-itus.

To return from defending the reasons for using the much more cost effective technique of troubleshooting without overkill, it is a faster, cheaper, and more constructive of the use of my time, and the time of companies and clients who want their machines up "now!" and not after a federally-funded study in time-waste management. Have your client try the disk cleaning outlined above before ripping the hardware apart.

I will say that a badly seated RAM card or one with any finger oils on the lands can get similar problems, but it's best to eliminate the others first if they can be done with software only.

repage, chkdsk, scandisk, defrag, as per above.

Nothing like a keen mind to play devil's advocate with one's analysis; it sharpens my wits and makes me answer questions I hadn't thought to ask.

Click here to from the newsletter.
The Premium Services include a number of features not available to "limited" members. Among them:
> Unlimited question points
> VIP Search
> Bookmarks
> Quick Links
> Collapsible menu
> No ads
You can purchase Premium Services on a month-to-month, semi-annual or annual basis, and take full advantage of all that Experts Exchange has to offer!
Page Two: More News and Notes
Nata's Corner: New kind of credit card fraud

woman in specticalsMany of my past columns have dealt with the problem of phishing expeditions and email scams and the like, but I ran across a story last week about a different kind of credit card fraud. The usual targets are smaller businesses who actually handle a credit card, not the big ones with sophisticated websites. The credit card industry actually came up with standards for security that were supposed to be implemented by the end of June, but many retailers haven't bothered.

Speaking of phishing expeditions, the various state governments in the US are talking about how to get their hands on the billions of dollars they're not getting in sales tax revenues on purchases made where the seller doesn't have a "physical presence." Congress tried to get a law requiring businesses in one state to collect the taxes for another state a couple of years ago, but it failed to get much support.

I had to laugh when I read the story on c|net about the problems that 180Solutions, the adware maker, is having because some of its distributors write installation routines that hide the installation. I can't for the life of me understand why anyone would want to install adware. Personally, I think a lot of the ads on television are better than the shows, but I've never seen a popup ad on my computer that I thought was very good, at least until I saw one of Sun's "rejected" magazine ads show up on a website this morning.

Finally, Symantec thinks we shouldn't be terribly surprised if some virus writer crashes a portion of the Internet. According to Symantec, a vulnerability in Cisco's Internetwork Operating System could be used to trigger a Denial of Service attack. Since much of the Internet runs on Cisco equipment, the threat is pretty serious. Cisco has issued a fix, but not everyone has installed it.

Inside the numbers
ameba, one of EE's prominent Experts, provides us with a list of newly earned Certificates. His list of all of the Certified Experts is located at his site. The list below covers the period from September 4 through September 18.
Expert Certified in Topic Area
jerryb30 puppydogbuddy GrahamSkan AustinSeven TimCottee WhatIsTheJava kelvinwkw Roonaan jkr craylord leew cpc2004 RobWill rossfingal rnagli eyal_mt s_sansanwal coopzz Arthur_Wood DeerBear nowonderla Wizard Guru Wizard Guru Guru Master Master Guru Guru Master Wizard Guru Master Master Guru Master Master Master Master Master Master MS Access MS Access Visual Basic Microsoft SQL Microsoft SQL ASP ASP JavaScript Windows 2000 Windows 2000 Windows XP Windows XP Windows XP Windows XP ASP.NET ASP.NET ASP.NET ASP.NET ASP.NET Delphi Networking
Expert Certified in Topic Area
Maharajkp TheAvenger SteveGTR steelheart38 DaHa Thalox Erick37 BriCrowe humeniuk Jester_48 SystmProg bugada sajuks rstaveley Jerry_Pang acperkins leew krakken Computron leew byundt Master Sage Master Master Master Master Guru Guru Guru Master Wizard Master Master Wizard Master Master Guru Master Master Guru Guru Exchange_Server C# C# C# C# C# VB.NET VB.NET Web Development Web Development Win Server 2003 PHP PHP C++ ColdFusion Databases Microsoft Network Microsoft Network VB Controls Operating Systems Applications
Expert Certified in Topic Area
cogitate4u gecko_au2003 CrYpTiC_MauleR war1 CrYpTiC_MauleR StormyWaters bochgoch Bozzie4 mwnnj AlexFM kbbcnet decoleur MusicMan carribeantech humeniuk CaptainCyril Tintin waybadmojo yuzh Mikal613 simon_kirk Master Master Master Master Master Master Master Wizard Guru Guru Guru Master Master Master Master Wizard Guru Master Master Guru Guru Applications Applications PHP and Databases Windows Security CSS CSS CSS Lotus Notes/Domino Desktops Win Prog. Routers Security Miscellaneous Firewalls DreamWeaver FoxPro Unix Prog. Netware Unix Net. Pocket PCs All DB Reporting
1621 experts have 2637 certifications: Genius:61 Sage:116 Wizard:169 Guru:482 Master:1809
Copyright ? 2005. All rights reserved.