Thri’kreen Translator

As I’ve recently gotten back into D&D, I decided to write this small translator as my current class in a Thri’kreen who can also speak Common and will be for the parties sake.

You can download the translator at https://skydrive.live.com/redir?resid=525746348736F176!2081&authkey=!AAXoNNik11UglfM.

Future updates will probably take into account letter case and such, depending on what users find they need based on comments.

First Windows 8 CP Observations

I’ve had a full day to work with Windows 8 exclusively and have had a few minor observations, some of which might have been different if I didn’t also have a Windows Phone.

1) Email.

I have Yahoo!, Google, and Exchange email accounts but only Google and Exchange are supported natively by Windows 8 CP. As I’m trying to phase out my reliance on Yahoo! Mail (which would phase out my reliance on AT&T internet service since it’s tied to it) this has been a relatively easy loss. This has also shown me just how little I need to be worried about what comes in on that account, when previously I felt it was a big deal. I was tied to this notion that as email came in, I either unsubscribed from it, or updated the email account on the site/service it came from. I’m finding most of the important ones are already done and obsessing over the other non-important emails is not a big priority.

2) Internet.

The full screen Internet Explorer is still somewhat troublesome. It seems to be tied to the windowed Internet Explorer you pull up while in the Desktop app. Passwords are shared, browsing history, and any other info you would expect. But you (or rather, I) cannot seem to keep the windowed IE browsing one page and the full-page IE app browsing another and be able to Alt-Tab back and forth. Also, Alt-Tab seems not to function well when you have multiple “tabs” in the full-page IE app as well as several open apps. Alt-F4′ing the full-page IE app closes all tabs without confirmation which caused me to close some pages I didn’t want or thought were on the windowed app. Partially my fault, but still, I think some synchronization issues lie there.

3). Multiple Monitors.

So far the multiple monitor support has worked well. I have one portrait 32″ monitor and a landscape 24″ and setup was minimal at worst. I’m pleased that the task bar (minus the system tray) appears on both monitors and not just the main one. It is also very nice having a full-page app on the main monitor and basically a desktop extension on the second. I sort of get the best of worth worlds with that functionality.

4) Time.

I absolutely do not like that there is no local time displayed anywhere on the Windows 8 Start screen. I have to go into the Desktop app and look at the system tray on the primary monitor (since, again, it’s not displayed on both monitors, just the task bar is) to see what time it is. This is a pain and hopefully will be addressed before shipping.

5) Start Screen Customization.

 

I have been happy with the rearranging aspect of the Start page. The column group works well as does the dragging of icons. I’d like to be able to force two columns instead of having a required 6 item height but I can live with that. There is always adding another column to get around that if needed.

6. Messenger.

Not having built-in messenger support for anything but Windows Messenger is very limiting for me. I only have two regular contacts I chat with on Windows Messenger, the rest are AIM or Yahoo!. I had to install a normal client to get back to functioning in this realm, but even that is limited unless my chat window is on my second monitor and therefore not hidden by a full-screen app. With Windows 8′s approach to one app for all services, like their People, Mail, and Messenger apps, I can only hope these natural extensions are coming soon.

However, with everything said, nothing yet is so insurmountable that I can’t use the new OS. So far I’m enjoying the challenge of using a new, and radically different, OS. We’ll see where it goes from here.

Windows 8 deployed

In my start of Windows 8 Metro app and Windows Phone 7 development, I have taken the plunged and moved over entirely to a machine running Windows 8 Consumer Preview. At first glance, the apparent lose of functionality is astounding.

I don’t have my Yahoo! and AIM messengers, no Yahoo! email, and my password file is relegated to the Desktop app. Some of the preview apps I’ve downloaded, like YouVersion, are barely what I’d call barebones and do nothing compared to their normal Windows (or even mobile) counterparts. The WordPress for Windows app closed on me abruptly so I had to load up WordPress in Internet Explorer to finish this post. Even the Kindle preview app, although functional, left a lot out. Also there seems to be a big disconnect between the Internet Explorer app and the Internet Explorer windowed app that runs in the Desktop app. I’ve lost three revisions to posts with that bug.

The Skydrive built-in is nice although to access Skydrive files from my password program I still had to install Skydrive for Windows which seemed counterintuitive.

To that end, I’m still excited about the upcoming interface changes and am really looking forward to having a tablet or laptop running Windows 8 sometime in the future. My Windows Phone 7 device works great but typing on them is still a pain, to the point where I would not even attempt the longer drafts needed for some of my work.

I have my copy of Visual Studio 11 Beta installed as well as Blend. The Live SDK is installed and ready to go. I’m following Jeff Blankenburg‘s “31 Days of Windows Phone” development and so far it’s been a huge timesaver. It is my assumption that learning the Metro style interface on a Windows Phone will be easier since it’s documented a tad more than Windows 8 is, but I could be wrong here.

We’ll see how this goes…

64-bit Windows OS returning invalid Registered Owner/Company Name

http://support.microsoft.com/kb/2603229 Released on October 25, 2011.

Let it not be said that Microsoft can’t screw up royally. In my opinion, this was a major bug.

In short, this bug causes any 32-bit applications running on a 64-bit OS that queries the OS for the current Registered Owner and Registered Company Name to be returned invalid data. A 64-bit application would get the correct values.

I am unsure whether this affects just queries made to the registry itself (which I personally verified as incorrect) or whether the API calls to return the same information return those same invalid values.

In either case, if your a developer using this information to form a licensing hash for tying a software license to a machine expect people to start showing up unregistered, which is exactly what happened to us.

 

 

LeadTools 16.5 to 17 upgrade path for Delphi, Vector Library

The v17 upgrade path was not as quick as in prior upgrades, normally just an install, re-compile and distribution of new DLLs was all that was required but several changes were made in this version of the source code that requires changes to get it to work, and I have not found any documentation on all the changes, the following are just the ones I was able to find in our use of the toolkit, which is probably not as involved as others, so sorry if your compiling issues are not resolved here.

1. Uses statement changes

First and foremost, all the unit names have changed. In previous versions all you needed to include in your uses statements were 3 PAS files, Ltdlldef, Ltdlltyp and Ltdllunt. This is no longer the case, all the functions have been broken up into individual units. In my application alone this went up to 12 files (Ltlck, LTDLLUnt, Lterr, Lttyp, Ltfil, Ltfil_f, Ltkrn, Lvkrn, Lvkrn_f, Ltkrn_f, Ltimgclr_f, Ltdis_f). If you count the actual .PAS files in the Uses sub-folder of your LeadTools installation you will see it went from 4 up to 102, so substantial changes were made in the structure of the package. Not saying they weren’t needed, but some documentation would have been nice.

Thankfully Delphi still comes with ol’ faithful GREP, so this will be helpful in finding the files you need to include.

2. VECTORPOLYLINE and VECTORPOLYGON have gone missing

For those enumerating through a vector files objects, you may have seen these types come up a time or two. They correspond to the Object type constants VECTOR_POLYLINE and VECTOR_POLYGON. These two structures have been renamed to VECTORCURVEOPENED (the old VECTORPOLYLINE) and VECTORCURVEOPENED (the old VECTORPOLYGON). The type constants have remained the same names however, which added to some confusion on my part initially.

3. VECTORxxx structure _Object field renamed to uObject

Also for those who enumerated through objects, you were used to the _Object variable contained within each vector structure that corresponded to the basic entity data. This field has been renamed to a less clunky uObject.

4. VECTORPEN changes

The VECTORPEN structure used to have a Pen field that was a EXTLOGPEN type. This has been renamed to uPenUnion and is now a union structure containing both a LOGPEN and EXTLOGPEN. Basically, when your old call to the color of the Pen would have been VECTORLINE.Pen.Pen.elpColor for instance, it is now VECTORLINE.Pen.uPenUnion.uExtLogPen.elpColor.

5. Vector Library unlock code

Although I was given a brand new v17 unlock code string to pass to L_UnlockSupport, I received -400 (ERROR_VECTOR_NOT_ENABLED) when making any vector calls. I had to use my 16.5 unlock code string to enable vector functionality on my development machine. I also have both 16.5 and 17 versions of LeadTools installed on this machine. However when the new exe was distributed, it did not work on that machine, I had to put back the v17 unlock code string, making it no longer work on my machine. I’m most likely going to have to rename the directory the v16.5 DLLs are in to make it work on my machine simultaneously as the clients machine.

I hope this list helps some of you get up and running as quickly as possible in v17!

Enforced Z-order?

I admit I have been confused by the recent discovery that in some AutoDesk DWG files, there is an enforced z-order for drawing and in others there is not.

I have not fully been able to track down the cause for this, whether it is the system variable DRAWORDERCTL or object variable DRAWORDER. I also did not see in AutoCAD LT a way to reset an objects DRAWORDER, if that can even be done.

Personally I don’t care about the draw order as we bring across the objects into our own format and we don’t draw things in an enforced order anyway, we have a particular way in which we handle draw order.

However when using LeadTools’ L_VecPaint() to draw, the draw order is important. Apparently, AutoCAD draw everything in a particular object order, irregardless of layer, with the only way to change this order is the use of BringToFront, SendToBack, etc. LeadTools however draws in layer order, drawing all the objects on a particular layer before moving onto the next layer.

This causes an issue when trying to faithfully reproduce a sketch as it would have been drawn in AutoCAD, as it might not draw the objects in proper order. To “fix” this, they, instead of keeping the layer property’s as they are in the file, they modify them and force all objects onto the ’0′ layer, this way object order is preserved, if not the data.

To me the data would be more important, however I guess it’s just me.

LeadTools vector to grayscale conversion

I had the need to display a LeadTools VECTORHANDLE in grayscale (or even monochrome) over displaying everything in their natural colors. This is normally based on the need that some viewers have a black background and some white, and you can imagine that black on black or white on white lines are hard to see.

LeadTools doesn’t currently support drawing in monochrome or grayscale, so I had to write code to do it myself.

I do this by copying the VECTORHANDLE to another one (L_VecCopy), then converting that one to grayscale. I only have need for groups, polylines, polygons, lines, arcs, circles and text in my drawings, but the other supported types can be added easily enough.

Pass your VECTORHANDLE to the function GrayScaleVectorFile() and you are done. You will need to modify it if you intend to pass a custom pUserData.

function GrayScaleColor (InColor : Integer) : Integer;
// a color to greyscale algorithm I found online
var
  GrayShade, Red, Green, Blue : Byte;
  PixelColor : Integer;
begin
  PixelColor := ColorToRGB (InColor);
  Red := PixelColor;
  Green := PixelColor shr 8;
  Blue := PixelColor shr 16;
  Grayshade := Round(0.3 * Red + 0.6 * Green + 0.1 * Blue);
  Result := RGB(Grayshade, Grayshade, Grayshade);
end; { GrayScaleColor }

function ProcessVectorGrayScale (pVector : pVECTORHANDLE; pObject : pVECTOROBJECT; pUserData : Pointer) : Integer; far; stdcall;
var
  vp : VECTORPOLYLINE;
  Vo : VECTORPOLYGON;
  Vl : VECTORLINE;
  Va : VECTORARC;
  Vc : VECTORCIRCLE;
  Vt : VECTORTEXT;
  Vclone : VECTORCLONE;
begin
  with PAxSketchData(pUserData)^.CurFile, CurPage do begin
    case pObject.nType of
    VECTOR_CLONE : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vclone);
      Vclone.Pen.Pen.elpColor := GrayScaleColor (Vclone.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vclone);
      end; { VECTOR_CLONE }
    VECTOR_POLYLINE : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vp);
      Vp.Pen.Pen.elpColor := GrayScaleColor (Vp.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vp);
      end; { VECTOR_POLYLINE }
    VECTOR_POLYGON : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vo);
      Vo.Pen.Pen.elpColor := GrayScaleColor (Vo.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vo);
      end; { VECTOR_POLYGON }
    VECTOR_LINE : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vl);
      Vl.Pen.Pen.elpColor := GrayScaleColor (Vl.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vl);
      end; { VECTOR_LINE }
    VECTOR_ARC : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Va);
      Va.Pen.Pen.elpColor := GrayScaleColor (Va.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Va);
      end; { VECTOR_ARC }
    VECTOR_CIRCLE : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vc);
      Vc.Pen.Pen.elpColor := GrayScaleColor (Vc.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vc);
      end; { VECTOR_CIRCLE }
    VECTOR_TEXT : begin
      L_VecGetObject (pVector, pObject, pObject.nType, @Vt);
      Vt.Pen.Pen.elpColor := GrayScaleColor (Vt.Pen.Pen.elpColor);
      L_VecSetObject (pVector, pObject, pObject.nType, @Vt);
      end;{ VECTOR_TEXT }
    end; { case }
  end; { with }

  Result := SUCCESS;
end; { ProcessVectorGrayScale }

function ProcessVectorObjectsInGroupGrayScale (pVector : pVECTORHANDLE; pObject : pVECTOROBJECT; pUserData : Pointer) : Integer; far; stdcall;
begin
  Result := ProcessVectorGrayScale (pVector, pObject, pUserData);
end; { ProcessVectorObjectsInGroupGrayScale }

function ProcessVectorGroupsGrayScale (pVector : pVECTORHANDLE; pGroup : pVECTORGROUP; pUserData : Pointer) : Integer; far; stdcall;
var
  Grp : VECTORGROUPDESC;
begin
  FillChar (Grp, SizeOf(VECTORGROUPDESC), #0);
  if L_VecGetGroup (pVector, pGroup, @Grp) = SUCCESS then
    L_VecEnumObjectsInGroup (pVector, pGroup, @ProcessVectorObjectsInGroupGrayScale, nil, 0);

  Result := SUCCESS;
end; { ProcessVectorGroupsGrayScale }

procedure GrayScaleVectorFile (pVector : pVECTORHANDLE);
begin
  L_VecEnumObjects (pVector, @ProcessVectorGrayScale, nil, 0);
  L_VecEnumGroups (pVector, @ProcessVectorGroupsGrayScale, nil);
end; { GrayScaleVectorFile }