-

Visual Studio 2010 Crashes using CDHtmlDialog

Posted by Kevin on 09/06/2011 in C++, Development, MFC

When building dialogs using Visual Studio 2010, I kept getting a consistent crash whenever I would try to assign a base class of CDHTMLDialog to a dialog.  It crashes at the point of trying to complete the wizard.  Thanks to kbalertz.com for having the answer.

 

The reason for the crash is due to a bug in the Visual Studio Add Class Wizard JavaScript code.  It is easy enough to fix fortunately which is the only option because there is still no hotfix available for it.

 

The Fix

Open C:\Program File\Microsoft Visual Studio\10.0\VC\VCWizards\CodeWiz\MFC\Simple\scripts\1033\default.js in a editor.

 

At line 126, you will need to move the CloseResourceFile() function below the AddSymbol function.

        if (strBaseClass == "CDHtmlDialog")
        {
            RenderAddTemplate(wizard, "dhtmldlg.htm", strHTMLFile, selObj, false);
            oResHelper.OpenResourceFile(strProjectRC);
            var strSymbolValue = oResHelper.AddResource(strHTMLID, strProjectPath + strHTMLFile, "HTML");
            if (strSymbolValue == null) return;
            oResHelper.CloseResourceFile();
            wizard.AddSymbol("HTML_ID", strSymbolValue.split("=").shift());
        }

 

Change the oResHelper.CloseResourceFile() line to come after the wizard.AddSymbol() function.  As you can guess the problem is that in the original JavaScript its trying to add a symbol on a closed resource.

 

        if (strBaseClass == "CDHtmlDialog")
        {
            RenderAddTemplate(wizard, "dhtmldlg.htm", strHTMLFile, selObj, false);
            oResHelper.OpenResourceFile(strProjectRC);
            var strSymbolValue = oResHelper.AddResource(strHTMLID, strProjectPath + strHTMLFile, "HTML");
            if (strSymbolValue == null) return;
            wizard.AddSymbol("HTML_ID", strSymbolValue.split("=").shift());
            oResHelper.CloseResourceFile();
        }

 

Save it out and then restart Visual Studio.  Now when you set your base class on a dialog as CDHTMLDialog it will complete the Wizard without a crash.

 

 
-

c++ zip_utils encryption error in unzip.

Posted by Kevin on 06/24/2011 in C++, Development, Uncategorized

On Code Project there is a set of files in C++ which easily let you add zip and unzip to your application.  Simply include the required files and call as needed.  Its nice because it has very little overhead and can be built statically so that you can have a single EXE without any DLL requirements.

If you use this code then beware of at least one small bug that can throw you if your not careful.  The encryption or password feature when unzipping always trims 12 bytes off the end of the file.  It doesn’t sound like much but imagine my surprise when the database I just made a backup off appeared to be corrupted.

Interesting points about this bug is that it is only in then unzipping.  If you created the file with a password you will find programs like 7zip unzip/decrypt it just fine.  Also the issue does not affect any zip/unzipping where no encryption is used.

There is a relatively simple fix, however it has not been deeply tested.  In the file unzip.cpp in the unzReadCurrentFile method, comment out the line that decrements rest_read_uncompressed by –= uDoEncHead.

   1: int unzReadCurrentFile  (unzFile file, voidp buf, unsigned len, bool *reached_eof)

   2: { int err=UNZ_OK;

   3:   uInt iRead = 0;

   4:   if (reached_eof!=0) *reached_eof=false;

   5:  

   6:      ......

   7:  

   8:     unsigned int uDoEncHead = pfile_in_zip_read_info->encheadleft;

   9:     if (uDoEncHead>pfile_in_zip_read_info->stream.avail_in) uDoEncHead=pfile_in_zip_read_info->stream.avail_in;

  10:     if (uDoEncHead>0)

  11:     { char bufcrc=pfile_in_zip_read_info->stream.next_in[uDoEncHead-1];

  12:       //pfile_in_zip_read_info->rest_read_uncompressed-=uDoEncHead;

  13:       pfile_in_zip_read_info->stream.avail_in -= uDoEncHead;

  14:       pfile_in_zip_read_info->stream.next_in += uDoEncHead;

  15:       pfile_in_zip_read_info->encheadleft -= uDoEncHead;

  16:       if (pfile_in_zip_read_info->encheadleft==0)

  17:       { if (bufcrc!=pfile_in_zip_read_info->crcenctest) return UNZ_PASSWORD;

  18:       }

  19:     }

Tags: , ,

 
-

Parallel Nsight 2.0, Ready for Computation…

Posted by Kevin on 06/18/2011 in C++, CUDA, Data Processing

As of May 11th, NVIDIA released the CUDA Toolkit 4.0 and also released was Parallel Nsight 2.0.  Developing CUDA code for Windows has had a reasonable startup cost due to no real tight integration with Visual Studio.  Even though Parallel Nsight has been around for almost two years, it started as more advanced debugging tools then a tool to ease CUDA development.  With the 2.0 release its both.

Every technology has its steps that it must take to reach the masses.  I remember it taking several hours to turn a CD into a set of MP3 files before the year 2000 and that was well before an iPod was in everyone’s hands.  CUDA has taken its steps as well. 

GPU programming started with programs that used the raw hardware of the GPU to do computations.  Soon that process graduated to having the GPU manufactures providing their own API’s to make it easier to use the hardware.   It’s a fast growing industry niche, just last year you had to have a good understanding of how compilers where setup to get NVCC and Parallel Nsight 1.0 to work with VS 2008.  Fortunately the crawling to walking is done, and now programmers are set to run with it.

To use Parallel Nsight, you must of course have a NVIDIA GPU that supports CUDA.  You can find out more about those here.  You also need Visual Studio 2008 or 2010.  To use more advance features such as on device debugging you will need a little more hardware.  The full hardware requirements can be found here.

Once you have the requirements, getting Parallel Nsight is as easy as signing up for a free account with NVIDIA and then visiting the download page.  Now it comes as two files, one for the main application and the second is the special drivers required to make computational access to the GPU easier.  Once installed, you can open Visual Studio and start a new CUDA project.  You will find it under NVIDIA .  From there you can easily modify the example code to see what you can build.

Once you have this up and working one of the quickest ways to speed up CUDA development in C++ is with Thrust.  Its much like using the Standard Template Library and is freely available.  IT also comes with a lot of great examples and a very active mailing list.

Happy data analysis at a hundred times the speed!

Tags: , ,

 
-

Custom Data Processing and Conversions Available

Posted by Kevin on 12/21/2010 in Data Processing

To many applications have data in too many different formats.  When it comes to your need to generate reports or migrate data from dissimilar systems you almost always have to perform conversions.  Sometimes you get lucky and the program your using has a export function and can produce a CSV (comma separated value) file, but what about when that option is not available?

That’s where we step in.  We can help you migrate your data from any format to any format.  Using custom software systems we are able convert large amounts of data in a minimal amount of time.  So if you need data conversion for your business or personal projects just drop us an email.  Prices start as low as $25 per hour for custom projects.

 
-

IP Geographic Location Tool

Posted by Kevin on 11/27/2010 in Software, Testing

Its amazing the amount of information that can be obtained from an IP address.  Equally as interesting can be why the information is even required.  Now days with the laws in the U.S. introduced the the USA Patriot Act, Bank Secrecy Act and other regulatory entities knowing your client before passing information to them is required by law.

For your own purposes you can use a set of free tools I have been developing for gathering information on IP addresses. I started developing this set of pages as an experiment after back tracing some malicious email that was sent to a loved one.  Using tools like this it really is quite easy to locate the starting point of such emails, especially when the sender doesn’t even try to mask their own personal IP address.

More details will be added as time allows – for now it will give you the basics including a nice location pointed to on Google Maps.

27nov2010-iptools-sc1

 

K.

Tags: , , ,

 
-

Pain Management Journal

Posted by Kevin on 09/03/2010 in Development, Pain Management, Software

I have noticed in my research this past month that more forms and sheets are being developed for a push that people with chronic pain conditions keep a journal.  In developing Pain Management Assistant, I have found that the issue isn’t as much how much data could be useful and tracked, but picking the right data to track that will give the biggest effect.

Picking the right set of data to track varies by patient and the type of pain issues they are fighting.  Neuropathic pain is quite different in management then say a Cancer pain.  Similarly fibromyalgia’s become a big issue in the last few years (though having been a problem for much longer media and drug companies have targeted more recently).

Seeing the majority of new modalities has had me rethinking the configuration and design of PMA.  Instead of one that provides a set static group of forms for tracking pain, to one that will allow you to configure which information sets are important for you to track.  As well we will build in configurations for form sets that are more likely to be of use to a specific pain modality.

 
-

Why PMA?

Posted by Kevin on 05/09/2010 in Pain Management, Software

Pain Management Assistant (PMA) will be the next incarnation of the Pain Management Tracker program I developed originally.  Its intent is to be far greater and more useful then the first.  Pain isn’t managed by medicine alone.  In fact pain medicine is only one part of the puzzle which when working properly can help lower your pain by 30% if your lucky.  So what about the other 70%?

On my last visit to my pain management physician I was proud to tell them I had had the best month since the start of my ordeal.  In the previous almost 8 years, five of them post surgery (when my neuropathy was made permanent) I hadn’t had a month with my pain managed so well.

Now, two weeks later I am certainly feeling I spoke too soon.  Consistency or the lack is one of the difficulties in managing pain.  There are always good months and bad months, but the bigger question to me is why?  What’s different?  What changed?  Better so, what’s the best way I can show my doctor?

Pain Management Tracker tracks the pain levels to medicine ratios for you.  That program can be a tool to help you work with your physician to isolate what medicines are working, when they are working and how effectively.  Further, when a regimen changes how does it affect you overall.

In my case it looks like a new treatment that started over two months ago but which has been paused in the recent month is at least part of the issue here.  To prove the point tomorrow I will have more blood work done to see where the levels over various items are.

So if you are fighting similar battles with pain I invite you to download the free pain management tracking software and try using it yourself.  Let me know how it goes for you, if it helps, or if you can think of a way I can improve it.  Hopefully together we can all have a little less pain in our lives.

Tags: , ,

 
-

Welcome 2nd Quarter 2010

Posted by Kevin on 04/19/2010 in Development, Pain Management, Software

Of the many things I love about computers web site updates actually are one of them.  However when I put updates here I prefer it to be of some use and not just typical blog banter.  WordPress is just a far easier content management system for me then most.  I would actually love to hang out a new article of substance every week, but then I would be a writer more and a developer less.

I have decided to update the them to something that loads faster, is simpler, and more functional.  The previous theme though beautiful was high on resource requirement and provided no real additional value aside from aesthetics.  As there are more important issues to solve (such as managing pain) the site is going for simplistic and relevant.

Talking about software, I am excited about the upcoming release.  I have been adding the new dialogs for handling details for medicines, something the previous version did not handle.  It also has features for reminding you of when various medicines need to be taken and when.  Using the new details dialog you can mark out not only your dosages, times to take them including maximums per day.  You can also keep detailed notes on specific medicines. 

The new version also has some features meant to keep the data your tracking safer.  For instance you no longer delete medicines completely.  When you delete something it is more like being hidden from view so that all history information stays complete. Also, you can disable medicines and locations temporarily with a click of a mouse instead of the previous version which required you to adjust the name (by adding a – in front of it).

Finally, this last week I started working with graphing and charting libraries.  The first version of the software was meant to be a reminder and tracking tool since the amount of medications required for pain management can be daunting to keep track of. However this new version will include reporting which will help you see the results of your treatments and know what is working and what is not.

BETA testing should start at the end of June on time for end of 2nd quarter 2010.

Tags: , ,

 
-

Automated User Interface Testing with Windows

Posted by Kevin on 12/20/2009 in C#, Development, Testing

Not as easy as one would think really, and yet its one of the most valuable services we rely on as programmers.  When you can get a good testing team to help you pound on a feature before release and give you first class feedback it helps immensely.   Testers with an attention to detail that help your project along are your best friends.

When you release an update and fix a few bugs or add new features and do your limited testing only to find out that it broke something else from your test group; its disheartening.  With all their hard work they feel like two steps forward and one backwards and it challenges you the programmer even more.

One way to improve on this I have found is to use a good set of test scripts. Even with regular testers doing things manually, a good set of scripts I have learned is very important.  While working with RSmart Group on the Sakai project, the set of test scripts they had from their use cases, was a perfect step by step to make sure all items and fields were tested.

In a small programming shop where time is very valuable, is it worth the time to build an automated testing system?  I believe so when I consider the iterative use of the scripts once committed to a working test application.  Thanks to Microsoft’s Windows Automation Interface that is exactly what I focused on this week while polishing off my latest project.

I knew of the Accessibility and Automation library for some time.  However aside from a few lightly used projects such as White, or articles on Code Project, its not covered heavily outside of Microsoft.  White looks very promising, but the documentation is limited and the framework deep.  This would be excellent, and perhaps I am taking the road less travelled working on a custom version for our app, however White will sit in a directory near by for some time at least as a reference work.

Some of the better works I have seen as for introducing the technology are from MSDN Magazine and Dr. James McCaffery.  His first article was in February 2008 introducing the Automation UI, and the second more recently in March 2009 is really more of a follow up.  He covers a few new details about collections, but really it amounts to a rewrite of the first.

In my own experience, taking his example and developing my own proof of concept was the fastest introduction to the code.  With my primary daily time spent in C++ I don’t find C# difficult but switching back and forth is less optimal for me in efficiency.   However with the limit of example code available, what I found was more prevalent in C# then C++.

In closing for this note, if you have testing you will need to do consistently over time, then the time spent developing your own automation may well be worth the investment.  Other packages I saw on the market might help with a small percentage of the overall requirements, but in the end seem to lean back to coding of some sort with or without screen recorders.  If anyone has a preference, or experience on any of those packages, I would love to hear about actual experience.

Tags: , , ,

 
-

Once upon a time…

Posted by Kevin on 11/28/2009 in Uncategorized

I used to love digging through Linux, playing in the command line, etc.  I still do when I have time.  However this last month this has not been it. 

Missing an update can be a terrible thing in this world today.  I remember watching my honeypot grab thousands of attacks an hour at times.  All for what?  nothing, not a single thing besides this blog or that of a family member.

Well the seasons almost over, the code is almost written and soon I will have more time for here (at least I might actually see what a weekend is).  Till then I press on – and this place is empty.

For those that link here for Pain Management Tracker, it will return by December 15th at the latest.  I would love to restore the backup now, but time is just something I don’t have much of at this moment.

KBC

Copyright © 2009-2012 Carpenter Systems All rights reserved.
Desk Mess Mirrored version 1.9 theme from BuyNowShop.com.