August 9, 2011

Hacking Visual Lisp IDE to be a little more awesome!

Filed under: AutoCAD,Development — Tags: , — Darrin Maidlow @ 11:12 am

Even though it’s the year 2011 and is available in all its glory for .NET I still spend a lot of time in the IDE (VLIDE).   While ObjectARX is powerful and full of awesome, it comes at a cost of a lot of overhead to setup a project, add all the needed references, heck even compiling / debugging is a huge pain in the ass in comparison to Lisp.  Lisp is still hands down the most efficient way to do most batch modifications within an AutoCAD session for those who have made the time to learn it.lispide

There are a couple of problems with Visual Lisp right now though.  One of my biggest complaints about the VLIDE is the default colors.  The high contrast white background is an eye killer.   The IDE is configurable though and we’re given full a 16 bit color palette – with which I was able to configure a color scheme that was more to my liking.   If you start Visual Lisp, go to the Tools menu and choose Window Attributes you are presented with the dialog that should let you configure your colors.   Before opening this configuration dialog select a code window in Visual Lisp to modify. Set the properties accordingly. If you are happy with the colors when you press Ok on the dialog you will be prompted to “Use current as EDITOR prototype?”. Clicking yes here will update you editor prototype, resulting in future windows using these defaults.

One key limitation here is that on x64 editions of AutoCAD this dialog is broken.  You may also see the following error when you attempt to close the dialog:

; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000094

**Update May 11th 2012 – This appears to have been fixed in AutoCAD 2013 x64.  Hurray!

It seems that Autodesk has let this code go to some extent. I’ve seen a number of of  people mentioning the unwind error.  This is a shame and partly why I’m writing this post!  First off – if you have an x86 release of AutoCAD you are in luck.  You can configure your IDE no problem using the UI.  For you x64 users, all is not lost.  Lucky for us Visual Lisp saves all this configuration information to a text file named VLIDE.dsk.  On my Vista x64 machine its found in the following locations:

AutoCAD 2006 – C:\Users\dmaidlow\AppData\Roaming\Autodesk\AutoCAD 2006\R16.2\enu

AutoCAD 2009 – C:\Users\dmaidlow\AppData\Roaming\Autodesk\AutoCAD 2009\R17.2\enu

AutoCAD 2010 – C:\Users\dmaidlow\AppData\Roaming\Autodesk\AutoCAD 2010\R18.0\enu

AutoCAD 2011 – C:\Users\dmaidlow\AppData\Roaming\Autodesk\AutoCAD 2011\R18.1\enu

AutoCAD 2012 – C:\Users\dmaidlow\AppData\Roaming\Autodesk\AutoCAD 2012 – English\R18.2\enu

These paths should be the same or similar on Windows 7.

If you open up this file you’ll see a large list of dotted pair lists full of settings.  The one I’m most interested in here is the *editor-sample-window property.  This is the “default” configuration to use when opening a lisp file.

   1: (*editor-sample-window* (:AUTOLISP :FGC 16777215 :BGC 0 :LXC T :CLV #40(nil nil 16711935 nil nil nil 16776960 nil 32768 nil 32768 nil 8421376 nil 8388736 12632256 8388736 12632256 8388736 12632256 255 nil 128 nil 8388608 nil 128 nil 12632256 nil 16777215 0 16777215 16750899 16777215 255 nil 8388608 nil 16776960) :TW 4 :LM 10))

Two values of importance are FGC (foreground color) and BGC (background color).  I was having a hard time finding a color wheel that did integer based color codes – but you can convert your favorite hex color codes to decimal ().  The next bit is a little ugly.  Within the :CLV property we have a list.  This list is basically a list of 16 bit integers containing a color code of the foreground and background color of each window property.  If the color is set to nil – it is transparent.  This list appears to be in the order in which the properties are displayed within the UI:

  • :LEX-SPACE
  • :LEX-STR
  • :LEX-SYM
  • :LEX-NUM
  • :LEX-INT
  • :LEX-REAL
  • :LEX-COMM
  • :LEX-COMM1
  • :LEX-COMM2
  • :LEX-PAREN
  • :LEX-SPEC
  • :LEX-SPEC1
  • :LEX-UNKN
  • :WINDOW-TEXT
  • :WINDOW-SELECTION
  • :ERROR-HIGHLIGHT
  • :INPUT-ZONE
  • :CONSOLE-MESSAGE

TW and LM contain the tab width and left margin respectively.  So go wild editing these values and configure your new IDE!  Keep in mind when editing the Visual Lisp settings using the UI, the vlide.dsk file is not saved  until AutoCAD is shutdown cleanly.  If AutoCAD crashes, you will lose your configuration.  If you would like to try out my IDE settings – I’ve attached a zip file containing  a copy of my .DSK file.  I also recommend you make a backup of the .dsk file before you start tinkering.

Now, if only I could figure out some way to build a vlx file from the command line so as to integrate it into my automated build system..

Update!

For those of you who don’t read the comments – Dennis Hill was cool enough to share his digging into the DSK file and also his IDE colors which I’ve been running for a week or so now.  Take a minute to read the comments and check out his color scheme.  Thanks Dennis!

Technorati Tags: ,,

July 28, 2011

Mapguide Development Tips from The Map Guy(de)

Filed under: Mapguide,Uncategorized — Tags: — Darrin Maidlow @ 3:41 pm

Jackie Ng posted a great post on that I wanted to share with you – some great tips for anyone starting out with Mapguide development or even seasoned pros!   I especially enjoyed his thoughts on antique browsers =) Thanks Jackie!  I have a couple of things to add to his list.   My first addition to his list would be Chrome.  I did have a few problems with firebug causing random ajax errors to occur in the Mapguide javascript which prompted me to switch to Chrome and its development tools.  I have not looked back…

The other thing I have to add is 6.0.  Every .NET developer should have this incredible toolset.   It really does enhance the Visual Studio IDE.  The javascript/ajax support is great with some syntax highlighting, the .NET refactoring and code generation tools are huge productivity enhancements once you get them figured out.   I couldn’t live without the navigation and  on-the-fly code analysis tools.  The built-in de-compiler can be incredibly handy too, and ties right in with the navigation tools.

If you are into Mapguide dev, I strongly encourage you to check out Jackie’s post – and become a regular reader of .

Technorati Tags: ,

July 25, 2011

It’s a girl!

Filed under: General — Tags: — Darrin Maidlow @ 5:02 pm

Hey everyone!OLYMPUS DIGITAL CAMERA

It’s been an insane month.  Just wanted to take a moment to let my friends, colleagues and my loyal readers know that my wife popped out our first child the other day.  July 12th at 2:10 am Ms. Georgia Laine Pawliuk-Maidlow was born and let me tell you she is full of awesome!  Both Mom and Babby are doing great.  Both Mom and Dad are both pretty tired  =)  Here is a picture for your viewing enjoyment =P

June 30, 2011

Coolest marketing campaign I’ve seen in a long time..

Filed under: General — Tags: — Darrin Maidlow @ 1:39 pm

Ok.  I had to break the long blog silence here to send a tip of the hat to Telerik for their promo.  Not only do you get to play a cool PacMan’esque game (WITH throwing stars), but they also give you that you can redeem for discounts on products.  Check it out.  Hugely cool.  http://www.telerik.com/products/ninja-in-the-maze.aspx

well done!

Technorati Tags:

June 27, 2011

Transferring US Dollar Funds out of PayPal

Filed under: General — Tags: — Darrin Maidlow @ 12:27 pm

Great post on how to setup PayPal with Royal Bank of Canada US dollar account to save on the steep exchange rates charged by PayPal..

Transferring US Dollar Funds out of PayPal.

May 12, 2011

A new breed of scam – QuickResolve.Net

Filed under: General — Tags: , , — Darrin Maidlow @ 12:33 pm

Today I received an unsolicited phone call from a helpful Indian fellow named Karesh, sadly his number was blocked so I cannot share that with you =).  He informed me that there were "deadly junk files” on my computer, that were much worse than virii and trojans.  He really cared about the health of my PC.  He asked me to start the event viewer and showed me all the errors that were on my computer.  It was terrifying.

Finally, he informed me that given the age of my PC we needed to “register my license with Microsoft to receive ongoing security assistance from Microsoft Certified Technicians”.   He told me that “Microsoft provides two kinds of secure warranty.  hardware and software! “ I needed to reactivate this protection…For the low low price of 109$ / year or 388 for 4 years I could get my computer protected from junk files, virii, trojans, and terrorists.

Next step was a LogmeInRescue session.  At this time, I told my helpful friend Karesh that my PC had blue screened!  Oh no!  This bought me a little time to fire up a test virtual machine and Camtasia :).  Turns out now a Mr. Kevin Andersen would be helping me, with a trial LogMeIn account  :)  I wonder if they noticed that my Windows Vista had now all of a sudden become Windows XP?  hmmm doesn’t look like it.a new scam 1

This is where it got a little scary.  Well not scary for you or I, but for your grandmother or other computer illiterate person.   They started digging trough Windows for negative looking things.  First they started the Windows certificate store and they highlight a number of revoked by Microsoft.  They were even so kind as to highlight these problems!

 

a new scam 2At this point they brought me to the Quick Resolve website (quickresolve.net) where they were ready to help me enter all my information to pay the fee.  At this point, I asked to get four years of coverage.  Karesh became quite excited!  First I needed to see the “Junk Files” on my PC.  Mr. Kevin Andersen started the “Junk Files Viewer” (which you may know as the event viewer).  He applied some tricky filters and then BAM.  Errors and warnings.  Now your grandmother is probably scrambling to find her credit card…

I let Karesh talk for a bit more, ready to stop my VM – finally I had another “Blue Screen” and hung up.  Oops ,look I restored a snapshot…  Unfortunately the joke is on me..they’ve been calling back over and over and over.  <sigh>

At first, I went along for the ride because I figured it might be fun.  Soon I started to realize that this will be very  convincing to a lot of people, and I started to think that maybe I should write this up in hopes of letting the geeky masses know.  So please let the people in your lives who could benefit by knowing about this type of scam know that no one will ever call you at home out of the blue to help you remove junk files…

Here is the video of the LogMeIn session:

A new breed of scam?

Technorati Tags: ,

March 22, 2011

Debugging COM DLL files in AutoCAD x64 and Visual Studio

Filed under: AutoCAD,Development — Tags: , — Darrin Maidlow @ 12:19 pm

While attempting to work out some x64 specific kinks in some of the COM code that is being migrated to .NET I hit a pretty annoying wall.  Well, it was actually a series of small walls (probably around knee high)  that kept tripping me…

In this post, I’m working on a problem that is pertaining to a 64 bit version of AutoCAD loading a COM enabled .NET assembly – however this information should apply to any x64 executable calling any x64 COM assembly.   Replace AutoCAD with <YourApp.exe> and you should be good to go =)

The first thing I did was to ensure each of the projects had been set to build for  “ANY CPU”.   This got the ball of fun rolling.   We have a VLX which instantiates the COM class using vlax-get-or-create-object.  When called this would constantly return nil.   Of course this all works just peachy when running an x86 build of AutoCAD.   At this point my breakpoints would appear in Visual Studio as disabled and would happily inform me that “The breakpoint will not currently be hit”.

This usually results when the incorrect DLL is being loaded, or when the PDB file is missing.   Once Visual Studio is running in debug mode you can bring up the Modules window from the Debug/Windows/Modules menu.  This should show you all the assemblies involved in the current session as well a bunch of other information including their paths.  The assembly in question was not listed here – so at this point I’m assuming that Windows cannot find the dll.

Junk in the Registry

I am now thinking that I have orphaned and duplicated types and CLSIDs in the registry, likely pointing to other builds of the dlls.   If the GUIDs for the classes or types changed you end up with a lot of junk in the registry.   I don’t trust those registry “cleaner” apps and in the interest of keeping my OS working – I chose to manually search out and nuke all the registry references manually.  This can be done by searching both for your assembly’s type name, and COM exposed class names in regedit.  A lot of this was done in the HKEY_CLASSES_ROOT root.  After all of that the problem still exists..

Wow6432Node Registry Keys

Registry keys were a two part problem. After dealing with the junk in the registry, I found I also had to deal with the x86 .   DraftLogic has been until this point limited to x86 architecture as a result of  the VB6 code not being x64 friendly.   As a result of this, all of the needed keys had been placed in the WOW6432Node of the appropriate software registry sections.   This was the easiest wall to find and hop over.  Unfortunately, this also didn’t solve the problem.

Improperly Registered Assemblies-thanks for nothingVisual Studio

So the next and fortunately final problem turns out that Visual Studio 2005/2008 (unsure about 2010)   Turns out the last piece of the solution is pretty simple – couple changes to the project.  What’s happening is that Visual Studio is running the x86 build of regasm.exe to register the assemblies on run, probably because Visual Studio is an x86 app itself.  This results in all kinds of x64 hating… To solve this we have to change two things in the COM enabled projects.

First though, I created a new build configuration called x64 so these changes would not affect in my ANY CPU configuration – which will be used to build my shipping assemblies.  It is also important to note that this problem is MOSTLY only a problem when running code from the IDE.  Assemblies installed and registered using an installer should not have this problem if the installer takes into consideration the “bitness” of AutoCAD (or any application calling your COM enabled dll).  ie.  Installshield asks the user on install what “bitness” of AutoCAD they are using, and the assemblies are registered as needed.  It may also be possible to register an assembly using both the 32 and 64 bit versions of regasm – but I have not tried this.

So with the new x64 configuration created I edited the properties of each COM enabled project  I unchecked “Register for COM interop” and added a post-build event command line of:

%Windir%\Microsoft.NET\Framework64\v2.0.50727\regasm $(TargetPath) /register /codebase /tlb

This would ensure that my COM enabled assemblies were properly registered for use by 64 bit  applications.

After all that, my breakpoints were finally hit, and I could actually start working out the x64 specific bugs. Too bad we couldn’t have moved this to ObjectARX.NET instead – then this would have been a non-issue =)  In retrospect, each of these problems were a contributing factor and each needed to be resolved. 

Hopefully if you are facing a similar issue this post helps you get over at least a couple of the walls!

March 9, 2011

ReSharper 6 is going to be rad!

Filed under: Development — Tags: — Darrin Maidlow @ 2:38 pm

Finally had a little time to catch up on the internets today and came across this bundling a decompiler!   My curiosity had been piqued by a posted by JetBrains shortlt after the  about reflector and the subsequent firestorm in the .NET community that ensued that announcement.

The timing is perfect.  We’ve got a growing need to better understand how some of our code is interacting with some vendor provided 3rd party libraries and this is making a huge difference.   In true ReSharper form – this new functionality looks solid, and easy to use.  The ReSharper navigation tools we’ve all grown love (well maybe not just love, but also  to depend on) are available.   I’m not going to miss trying to navigate code only to be greeted with an Object Browser window. ..

Looks like a standalone decompiler/browser is also coming too…

And by saying “free”, we actually mean “free”.

Love it!  Keep up the great works JetBrains – looking forward to the release!

Technorati Tags:

February 24, 2011

AutoCAD VBA/VB6 to .NET Similar Function Comparison

Filed under: AutoCAD,Development — Tags: , — Darrin Maidlow @ 11:53 am

I’ve been working on supporting the team doing the VB6 code migration to .NET the past few weeks.   This code is many years worth of COM based AutoCAD development.   Came across this that will give you a good head start in the right direction on which functions are the new equivalents in .NET of the old VBA/COM  calls.

Technorati Tags: ,,

February 21, 2011

1337 System Idle Process

Filed under: General — Tags: — Darrin Maidlow @ 2:14 pm

Came across this by chance today on one of our servers =)

1337 uptime

« Newer PostsOlder Posts »

Powered by WordPress

Switch to our mobile site