MarcEdit, Windows XP, and what the way too early log analysis says

By reeset / On / In Library, MarcEdit, Microsoft

Related post: MarcEdit and the Windows XP Sunsetting conversation

So, this has been kind of interesting.  Since Sunday, I’ve been running a script against my access logs to get a better idea of what the MarcEdit XP user community may look like.  I timed this with the update, because I’ve found that in general, a large number of users will update the program within the first couple of weeks of the update.  Equality interesting, even though MarcEdit has an automatic updating tool, there are users that stay with very old versions of the 6.x series.

Anyway, couple of interesting things of note since this active log analysis began:

  1. Since Sunday, MarcEdit’s automatic update script has been pinged north of 250,000+ times.  That means that since Sunday, users that make use of the autoupdate notifications have opened the program to do work at least a quarter of a million times.
  2. Since Sunday, MarcEdit has been updated ~7000 times.  I’ve estimated that the active user community is around 11-12k users, but that year over year, the update service will report a unique user count in the high 20,000s.  Assuming that these are the most active users, I think this gives an idea of who will be most immediately impacted by any potential change in XP support.
  3. Of those approximate 7000 users, 9 run XP.  The largest number of these users come from China and India, but surprisingly, there are still US users (at academic institutions based on the IPs reported) that still run XP…my god.
  4. Surprisingly, the mostly widely used Windows Operating system reported was Windows 8.1.  I honestly expected to see Windows 7.  But by usage, the breakdown was Windows 8.x, Windows 10, then Windows 7.  I really thought the order was going to be Windows 7, 10, then 8.x.

 

So what can I learn from this way to early analysis of the update/usage information.  First, it confirms a suspicion that I’ve had for a while that XP is very much in the minority among MarcEdit’s most active users…and that’s actually about it.  What I anticipate seeing is that the initial trends (can 7 users be a trend) that shows XP usage largely concentrated in China and India (since these are both large user communities).  I’m honestly also curious if this will extend to the Middle East.  Year over year, the Middle East represents the 3rd highest concentration of MarcEdit users.  The question for me as this picture becomes more clear is how wide spread XP use actually is — and that I just don’t know yet.  Oh, and third…I keep thinking there is a paper to be written here…if I could just find the time.  🙂

–tr

 

 

 

 

 

Building your own reminder system

By reeset / On / In C#, Family, Library, Microsoft

One of the hats I wear is as a member of the Independence Library Board.  I love it because I don’t work with public libraries as often as I’d like to in my real job, and honestly, the Independence Public Library is the center of the community.  The Library is a center for adults looking for education opportunities, kids looking for resources, and home to a number of talented librarians that are dedicated to encouraging a love of reading to our community.  It’s one of the few libraries I’ve ever known to have both a children’s and adult reading programs and takes advantage of that in the summer – by having the adults and kids compete against each other to see who logs the most pages (the kids always win). 

Each board meeting is interesting, because as the economy became more difficult for people, more people turned to the library.  Every month, the library sees more circulations, more bodies in the building, more kids, more adults – just more.  And they do it on a budget that doesn’t accurately reflect the impact that they have on the community. 

Anyway, one of the things that the Library has going for it is a very active friends program – and through that group (and some grant funds), the library was able to purchase a number of Laptop computers for circulation within the Library.  The Library currently has some, 8-10 terminals that are always being used and the laptops would provide additional seats, and allow people to work anywhere within the library using the wifi.

The Library setup the laptops using the usual software – DeepFreeze, etc. to provide a fairly locked down environment.  However, what was missing was a customizable timer on the machines.  Essentially, the staff was looking for a way to make it easier for patrons checking out the laptops to avoid fines.  The Laptops circulate for a finite period of time within the building.  Once that time is over, the clock starts ticking for fines.  To avoid confusion, and help make it easier for patrons to know when the clock was running out – I’d offered to work on building a simplified timer/kiosk program. 

The impetus for this work comes from Access 2007 I think.  I had attended the hackfest before the conference and one of the project ideas was an open source timing program.  I had worked on and developed a proof of concept that I passed on.  And while I never worked on the code since – I kept a copy myself.  When we were talking about things that would be helpful, I was reminded of this work. 

Now, unfortunately, I couldn’t use much of the old project at all.  The needs were slightly different – but it helped me have a place to start so that I wasn’t just looking at a blank screen.  So, with idea in hand, I decided to see how much time it would take to whip together an application that could meet the needs. 

I’ll admit, nights like tonight make me happy that I still do more than write code in scripting languages like python and ruby.  Taking about 3 hours, I put together a feature complete application that meets our specific needs.  I’ll be at the Oregon Library Association meeting this week, and if folks find this kind of work interesting, I’ll make it a bit more generic and post the source for anyone that wants to tinker with it.

So what does it do?  It’s pretty simple.  Basically, it’s an application that keeps time for the user and provides some built-in kiosk functionality to prevent the application was being disabled. 

Here are a few of the screen shots:

image
When the program is running, you see the clock situated in the task tray

image
Click on the icon, and see the program menu

Preferences – password protected

image

image

image
Because we have a large Hispanic population, all the strings will need be able to be translated.  This was essentially is just the locked message.  I’ll ensure the others are customizable as well – maybe with an option to just use Google Translate (even though it far, far from perfect) if a need to just get the gist across is the most important.

image
Run an action (both functions require a password)

image
Place your cursor over the icon to get the minutes

image
Information box letting you know you are running out of time

image
Sample lockout screen

In order to run any of the functions, you must authenticate yourself.  In order to disable the lockout screen, you must authenticate yourself.  What’s more, while the program is running, it creates a low-level keyboard hook to capture and pre-process all keystrokes, disabling things like escape keys, the windows key, ctrl+alt+del so that once this screen comes up – a user can not break out of it without shutting off the computer (which would result in needing to log in).  Coupled with DeepFreeze and some group policy settings, my guess is that this will suffice.

The source code itself is a few thousand lines of code, with maybe a 1000 or 1500 lines of actual business logic and the remainder around the UI/threading components.  Short and simple.

Hopefully, I’ll get a chance to do a little testing and get some feedback later this week – but for now – I’m just happy that maybe I can give a little bit back to the community library that gives so much to my family.  And if I hear from anyone that this might be of interest outside my library – I’ll certainly post the code up to github.

–TR

Windows 8 first impressions

By reeset / On / In Windows 8

I’ve been spending a lot of time working with the Windows 8 beta, partly because I wanted to make sure marcedit would work with the new system and partly because I know that at some point I’d be seeing it.

First impressions:

  1. Not having the start button is a little jarring because you find and start programs differently (think search or tiles). 
  2. there are some cool new shortcuts that once you get use to using the windows key, actually make using the system fun
  3. I like the mail program since it gives your outlook calendar and email integration, while providing integration for my google, facebook and windows live calendars
  4. I like the people tile (reminds me of my phone)
  5. like the integration with skydrive
  6. not sure what I think yet about the way desktop and metro are integrated.  I’m getting use to it, but it doesn’t always feel as slick as it should. Though maybe that will get better with time
  7. love, love, love the integration with xbox. If you have one, that will be your killer feature in windows 8 since you can stream your games from your xbox to windows 8 device.
  8. It will be interesting to see if they create a metro office interface because I don’t like how office 2010 integrates. Decided to use libreoffice and google docs till I see what comes out.

However, the big question is how it works as a tablet os? Well, I got an Acer Iconia Tab and have installed Windows 8 and so far so good. Its both lite-weight with all the functionality of a desktop. So I’ll periodically check in to let folks know how it goes.

TR

P.S. This was actually written on the tablet, using live writer.

XP Virtualization in Windows 7

By reeset / On / In Windows 7

I generally prefer to run Sun’s VirtualBox for virtualization – but the fact that Microsoft provides a free version of XP for virtualization was too good to pass up for my testing purposes.  Installing XP Mode was easy enough – but what I found interesting was how Microsoft integrated the XP Mode.  While you can run a version of XP in a virtualized environment (much like VMWare and VirtualBox) – Microsoft has also allowed users to run applications installed within the hypervisor without opening the entire virtualized environment.  So for example, in the Programs List, you would see the following:

image

If you look, you can see that you can actually execute applications installed within Virtual PC directly (just as if you were running a native application).  It takes a second to boot (because Virtual PC loads dependencies into the background) – but I thought that this was a pretty nifty implementation.  I wish that it didn’t require maintaining XP separately – but it’s a good first step I suppose.

–TR

Trying out Windows 7 with the TV

By reeset / On / In Media PC, Netbook, Windows 7

One of the benefits of having a large flat screen TV is the wide abundance of video inputs.  At present, there are 8 on our TV, 4 HD,  2 RCA style, 1 cable and 1 PC connection (DVI).  This leaves lots of room for experimentation. 

As noted on Saturday (http://blog.reeset.net/archives/614), I picked up a netbook, the MSI Wind (http://www.msimobile.com/level3_productpage.aspx?cid=3&id=40).  Officially, the netbook is for my wife – who has taken up blogging and book reviewing as a hobby.  It gives her a chance to work away from the desktop and in the living room with me in the evening.  However, unofficially, it’s also a toy for me to try new things, as well as play with a netbook (as well as evaluate the feasibility of getting these for work). 

Anyway, one of the first things that I did with the Netbook was drop Windows XP for the test build of Windows 7.  I’ve been looking for a place to try it, and since my wife has been using Vista for a little over a year (I like the parental controls) – I figured that Windows 7 wouldn’t be too much of a difference.  As I noted in the previous post, I was very pleased with how well it has run on this netbook.  In all honest, it boots faster than the original XP system (takes about 10 seconds to go from a cold boot to active) – can run the areo interface on much lighter hardware than Vista (the netbook for example has no problem with it using the integrated video card), and as I spend time working with the system, have been really impressed with the polish in a beta build (especially when you consider what the first public Vista beta looked like). 

So, that was a long explanation for my current project.  I have a lot of computers at home.  The oldest machine that I still use occasionally is a machine that I purchased from Dell in 1998 (I just keep updating the components) up to our current desktop.  Well, yesterday, I was sitting around and wanted to watch an episode of the Simpsons .  I didn’t have the particular episode that I was interested in watching, so I went online and found it (on hulu I think).  Anyway, I hooked up the netbook and feed the video directly to the TV and it worked so well through the DVI cable that I thought I’d setup my own Media PC and see how well I could get it to work.

So….I dusted off a 4 year old media pc that I rarely turn on and decided to wipe the hard-drive and install Windows 7 and see how the new media functionality worked on it (as well as see how Windows 7 worked on a really old system that I wouldn’t touch Vista with).  Again, like with the netbook, the install took approximately 20 minutes to install and apply current updates and create user account.  As well, Windows 7 recognized all the old hardware, and appropriate drivers were added.  From there, I moved the computer next to the TV and let the experiment begin.  I figure, if I like this setup, I’ll likely end up purchasing a light-weight PC that I can use as a media machine – but for now – this will do.  With the current setup, the machine can stream content directly to the TV (unfortunately, not recording yet – though I might pick up a cheap TV input card so I can setup a simplified DVR recorder).  So right now, I’m hanging out at home watching the last episode of the Office (which I missed), an episode of He Man, masters of the Universe (I love old cartoons) and then an episode of Married…With Children (another one of my guilty pleasures).  I’ve been primarily watching episodes via Hulu – and I’m surprised at the video quality.  It’s not DVD quality – but certainly as good an anything off VHS or cable.  I’m not sure if this is because of Hulu’s quality, my high speed internet (thank you Monmouth-Independence) or a combination of things. 

But so far, so good.  It looks like this little setup will work great for testing and seeing why so many people are getting DVR devices.  If anyone has done something similar, give me a shout.  Otherwise, I’ll continue to post updates as I (and my boys) spend time feeding videos through our new test media PC (the boys like watching cartoons online as much as I do, though they seem to be more interested in the current content on Cartoon Network).

–TR 

New toys

By reeset / On / In Netbook, Windows 7

So like most folks, I’m hanging out today kind of watching the super bowl – but am also playing with a new toy, my MSI Wind netbook.  This is a nifty little device, running a 1.6 ghz, 1 gb, 160 gb HD, 10.1 inch monitor weight about 2 lbs.  The machine came installed by default with Windows XP – but part of the reason why I decided to pick up this little device was to have a platform to test Windows 7, and the netbook seemed like as good as place as any to test out the claims that this OS will take less resources, be more efficient, etc.  So, occasionally, I may jot down a few notes of my experiences using my little advice.

First thoughts are I like this little machine.  It has a full keyboard so I don’t feel cramped typing, has an expandable drive (so soon I’ll have 2 GBs on the machine), 3 USB drives, an SD card reader – all the stuff that you really need to get things onto and off of the machine.  The device seems fairly rugged and cannot believe how light it is.  I’ve tried the ASUS, Acer and HP netbooks and I really like the design that the folks at MSI have used here.  Oh, and the 6 cell battery – looks like I’ve been getting about 3 1/2 hours of burn time.  Oh, and this is quiet and cool.  The laptops that I have at home simply run hot (I’m rarely cold during the winter so long as I have my laptop).  This little device simply doesn’t put out much heat and is super quiet.  A nice, unexpected change from previous hardware used.

Windows 7…At home, I use a wide number of operating systems.  I have a couple of flavors of linux, XP and Vista (no mac since they won’t let me virtualize it), mostly to test various projects that I work on under different systems.  One of the hallmark of Windows installs tends to be scary installs.  I was pleasantly surprised to see that install tool approximately 18 minutes on this netbook – all hardware was recognized, drivers loaded.  Since, I’ve loaded Google Chrome, Office 2007, Live Writer (which is what I’m using now) and MarcEdit.  Overall, I’ve been pretty impressed with the way the system handles.  At this point, I have Chrome open, streaming a video from youtube (bruises from chairlift), 5 other tabs, IE with 3 tabs (one my exchange mail), 3 word documents, an excel document (~4 mbs in size) and MarcEdit and still have ~200 mbs of RAM free and not a hint of sluggishness.  This is something I’ll track as I continue working on this little box.

–TR

.NET 64-bit processor memory issues when using sendmessage to access a winform element

By reeset / On / In C#, MarcEdit, Microsoft

I’m posting this in hopes that it will save someone else a lot of time or someone that knows .NET a bit better than I can provide a better solution. 

Problem:

Last week, I had someone ping me regarding MarcEdit and a problem that they were running into with the Editor running it on a 64-bit version of Windows 2003 Server.  MarcEdit is compiled for any processor, so in theory, the framework should adjust the variable types to the current CPU type and go on it’s merry way.  And was it not that I have to work with some unmanaged code within my application, I’m sure that this would be the case.  However, when opening the MarcEditor, the user was getting the following error message:

This is odd because I test MarcEdit on every version of Windows from 98 to Vista.  The problem however, is I’ve never ran the program in a 64-bit version of Windows. 

Background:

I did a little bit of research, and found what I thought to be the problem.  The 64-bit version of windows shares many of the same signatures as its 32-bit counter-part, but one place where the signatures differ is in the Messaging Queue.  SendMessage, for example, which uses integers to pass values between processes had been updated to 64 bit integers and would crash if the wrong data type is sent into the function.  No problem, I fixed the signature issue, but the error message remained.  What I didn’t realize is that this wasn’t the actual problem (though it was a problem).  The real problem seemed to be related to simply accessing the RichTextbox Handle and passing it the callback.  Anytime the Handle was touched and passed, this error would be generated.

Solution:

So, Microsoft does make the Enterprise version of Windows 2003 Server available on a trial basis for developers wanting to test their software.  So, I dug up a box with an AMD-64 bit processor and set to installing the software.  Next, I installed SharpDevelop, an Open Source IDE for .NET.  I created a small sample program to isolate the code that was causing me problems.  In my case, the code that was causing the problem is necessary because of MARC being a UTF8 encoded data format.  Microsoft’s Richtext library supports the loading of plaintext (ASCII), Unicode text, text with OLE objects and text in just about any character format, including UTF8.  Unfortunately, the .NET framework only exposes plaintext and Unicode text as supported formats.  This means that in order to load UTF8 data and utilize the components streaming nature to minimize the memory footprint during loading, we need to essentially write our own EditStreamCallback function, create the delegates, the EDITSTREAM struct, etc.  And in that, there is the rub.  When compiling the code in SharpDevelop, I specified that the code should be targeted specifically for a 64-bit processor.  During compile, I got two warning messages that two core .NET components are compiled specifically for 32-bit processors.  Since the signatures on the 64 and 32 bit machines are identical, one can generally ignore these compilation warnings, as the framework does it’s magic.  However, the fact that I’m utilizing functionality from one of these two components within an unmanaged code block causes the problem.  Within the .NET (and 64-bit environment in general), an 64-bit process cannot load a library compiled for a 32-bit process.  A 32-bit process can run within a 64-bit environment, they just cannot share processes between themselves.  My best guess is that this is what was happening.  Since these two .NET components were compiled specifically for the 32-bit processors, my attempts to load them into a 64-bit process and utilize them within an unmanaged code block caused issues.  The solution is a simply one — for the GUI application of MarcEdit (which doesn’t do much anyway), the program simply needs to be complied to target 32-bit processors.  Now it runs just fine within a 64-bit environment, and will remain so until Microsoft cleans up these two core libraries.  With that said, if anyone has a better way of dealing with this problem (code is attached, so if you can make it work, I’d love to here from you), I’d love to hear about it.

RichText Code:

Finally, it’s pretty difficult to find example code dealing with the Richtext components in C#.  I think this is primarily because most folks that use high level languages like C# either don’t have a need for it or don’t have the background in C++ to understand what is actually happening at the Proc level.  Anyway, to that end, I’m posting the source to my small sample program (get it here) that I used to diagnosis this problem.  The trick to doing this type of interaction is to avoid the use of integer class variables.  In .NET, you have to remember that you are dealing with managed code, so when you make the call to a API like SendMessage, you should be Marshalling all your data, and passing it into the function via the IntPtr structure.  The only exception to that with the SendMessage API is the message argument, which microsoft defines and an unsigned 32-bit integer on all platforms, though for practical purposes, the message argument should be classed as a 32-bit integer.

API/Delegate Declarations

   1:  private const int SF_USECODEPAGE = 0x020;
   2:          private const int SF_TEXT = 0x001;
   3:          private const int SF_RTF = 0x002;
   4:          private const int CP_UTF8 = 65001;
   5:   
   6:          private const int WM_SETREDRAW      = 0x000B;
   7:   
   8:          private const int WM_USER = 0x400;
   9:          private const int EM_STREAMIN = WM_USER + 73;
  10:          private const int EM_GETEVENTMASK   = (WM_USER + 59);
  11:          private const int EM_SETEVENTMASK   = (WM_USER + 69);
  12:          private const int EM_STREAMOUT = WM_USER + 74;
  13:          private const int ENM_NONE =    0;
  14:          private const int EM_SETTEXTMODE        = WM_USER + 89;
  15:   
  16:          private const int TM_PLAINTEXT       = 1;
  17:   
  18:          private const int ECO_AUTOWORDSELECTION = 0x00000001;
  19:          private const int ECO_AUTOVSCROLL = 0x00000040;
  20:          private const int ECO_AUTOHSCROLL = 0x00000080;
  21:          private const int ECO_NOHIDESEL = 0x00000100;
  22:          private const int ECO_READONLY = 0x00000800;
  23:          private const int ECO_WANTRETURN = 0x00001000;
  24:          private const int ECO_SAVESEL = 0x00008000;
  25:          private const int ECO_SELECTIONBAR = 0x01000000;
  26:          private const int ECO_VERTICAL = 0x00400000;
  27:          private const int ECOOP_SET = 0x0001;
  28:          private const int ECOOP_OR = 0x0002;
  29:          private const int ECOOP_AND = 0x0003;
  30:          private const int ECOOP_XOR = 0x0004;
  31:  
  32:          private const int EM_SETOPTIONS = (WM_USER + 77);
  33:          private const int EM_GETOPTIONS = (WM_USER + 78);
  34:   
  35:   
  36:          delegate IntPtr EditStreamCallback(IntPtr dwCookie, IntPtr pbBuff, IntPtr
  37:              cb, out IntPtr pcb);
  38:   
  39:  
  40:          struct EDITSTREAM
  41:          {
  42:              public IntPtr dwCookie;
  43:              public IntPtr dwError;
  44:              public EditStreamCallback pfnCallback;
  45:          }
  46:   
  47:  
  48:   
  49:          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
  50:          static extern IntPtr SendMessage(HandleRef hWnd, Int32 Msg,
  51:                                          IntPtr wParam, IntPtr lParam);
  52:  
  53:          [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
  54:          static extern IntPtr SendMessage(HandleRef hwnd, Int32 msg, IntPtr
  55:              wParam,    ref EDITSTREAM lParam);

In the declarations, you will see that two forms of SendMessage have been defined.  One where the lParam references the EDITSTREAM structure and on where it references an IntPtr structure.  The former is used when streaming data into the RichText window, the latter is used when sending regular messages between controls.  It should be noted, the later could be removed in .NET 2.0 by making use of the System.Windows.Forms.Message class, which essentially allows you to send messages to controls so long as all arguments can be sent as IntPtrs.

After the declarations, the remainder of the code is setting up the actual streaming, and creating the function that the delegate prototypes.  In this example, I’ve called the streaming function, ReadRichTextStream and the actual streaming function, StreamIn.  These functions would look like the following:

ReadRichTextStream: Accepts a RichTextBox Object and the filename of the file to load.

   1:          private void ReadRichTextStream(System.Windows.Forms.RichTextBox objRich,
   2:              string sfilename)
   3:          {
   4:  
   5:              string filename = sfilename.ToLower();
   6:              objRich.Text = "";
   7:              int eType = SF_TEXT;
   8:              if (filename.EndsWith(".mrk")|filename.EndsWith(".mrk8")|filename.EndsWith(".tmp")|filename.EndsWith(".xml"))
   9:              {
  10:                  eType = (((CP_UTF8)<<16)|SF_USECODEPAGE|SF_TEXT);
  11:              }
  12:              else if (filename.EndsWith(".bmrk"))
  13:              {
  14:                  eType = SF_TEXT;
  15:              }
  16:              else if (filename.EndsWith(".rtf"))
  17:              {
  18:                  eType = SF_RTF;
  19:              }
  20:              else if (filename.EndsWith(".txt"))
  21:              {
  22:                  eType = SF_TEXT;
  23:              }
  24:              else
  25:              {
  26:                  eType = (((CP_UTF8)<<16)|SF_USECODEPAGE|SF_TEXT);
  27:              }
  28:   
  29:              //this.Redraw = false;
  30:              long b_length = 0;
  31:              System.IO.FileStream fs = new System.IO.FileStream(sfilename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
  32:              b_length = fs.Length;
  33:              Application.DoEvents();
  34:              System.Runtime.InteropServices.GCHandle gch = System.Runtime.InteropServices.GCHandle.Alloc(fs, System.Runtime.InteropServices.GCHandleType.Normal);
  35:              EDITSTREAM es = new EDITSTREAM();
  36:              es.dwCookie = (IntPtr)gch;
  37:              EditStreamCallback callback = new EditStreamCallback(StreamIn);
  38:              es.pfnCallback = callback
  39:  
  40:              SendMessage(new HandleRef(objRich, objRich.Handle), (Int32)EM_STREAMIN, (IntPtr)eType, ref es);
  41:  
  42:              //Remember to free allocated memory to avoid leaks.
  43:              gch.Free();
  44:              fs.Close();
  45:  
  46:  
  47:          }

StreamIn: StreamIn is the function that actually reads the data from the file and pushs the data into the RichTextBox callback to print into the control.

   1:          public IntPtr StreamIn(IntPtr dwCookie, IntPtr pbBuff, IntPtr
   2:              cb, out IntPtr pcb)
   3:          {
   4:              byte[] buffer = new byte[cb.ToInt32()];
   5:              uint result = 0;
   6:   
   7:  
   8:  
   9:  
  10:              System.IO.FileStream fs = (System.IO.FileStream)((GCHandle)dwCookie).Target;
  11:              //pcb = cb;
  12:              try
  13:              {
  14:                  pcb = (IntPtr)fs.Read(buffer, 0, cb.ToInt32());
  15:  
  16:                  if (pcb.ToInt32()<=0)
  17:                  {
  18:                      pcb = IntPtr.Zero;
  19:                      result = 1;
  20:                      return (IntPtr)result;
  21:                  }
  22:                  else
  23:                  {
  24:  
  25:                      System.Runtime.InteropServices.Marshal.Copy(buffer, 0, pbBuff, pcb.ToInt32());
  26:                  }
  27:              }
  28:              catch
  29:              {
  30:                  pcb = IntPtr.Zero;
  31:                  result = 1;
  32:                  return (IntPtr)result;
  33:              }
  34:              fs.Close();
  35:              return (IntPtr)result;
  36:          }

Anyway, the gist of all this, is that by setting the compile option to target 32-bit processors in the MarcEdit gui, I’ve been able to solve this issue.  I’m having the user that found the problem verify that I’ve indeed hunted this bug down and squashed it — so as soon as that’s confirmed, I’ll be pushing this fix out with MarcEdit.

–TR

Random Google Thoughts

By reeset / On / In Google, Microsoft

I was following a thread today talking about some of the legal wrangling’s related to Google and their Google Books project.  The message that made me laugh was a series where someone had commented that Google had long since forgotten their ‘do no evil’ philosophy and have become pure evil.  Of which, someone said it was a tie between Microsoft and Google, and then asked the question: What would happen if they merged? The end of civilization as we know it?, which put a smile on my face.

However, it did get me thinking — why do folks view Google in such a positive light?  Or, better yet, how did Google convince libraries (large academic libraries) to essentially give away their content for virtually nothing.  Well, I should qualify that — Google is spending a great deal of money digitizing library content — but the costs of digitization pale in terms of the total value of the collection itself and the value of the collection in terms of the collection development decisions that went into building a library’s materials.  In putting up some capital, Google is able to catch up as a cultural archive on nearly 200+ years of purchasing and collection management decisions and will have surpassed some of our finest academic libraries in terms of content and breath of collection.  Not a bad deal for them. 

But I’ll digress since that’s a different discussion.  I’m really fascinated by Google’s image and how they have been able to maintain their image as a socially conscious company that’s open for integration by others and open as in friendly to open source.  However, if you really think about it — that image doesn’t fit reality.  Google has in effect cultivated this image of “open” by making available bread crumbs into their systems.  Folks have often been able to do very cool things with these bread crumbs (Google Maps, Search API, etc) but these really are only a small part of the Google machine.  While Google offers api it also is, without a doubt, one of the most propriety companies that I’ve ever seen.  Their answers in fiscal filings are difficult to pin down (that’s just about any large corporation though) and they vigorously (actually, that’s an understatement) guard their search algorithems.  Folks should make no mistake — they are a big business and they act like any other business, but they’ve just somehow been able to wrap themselves in a cloak of openness.  In fact, I’ve started to wonder if Google isn’t the ultimate leech.  Now, leeches aren’t bad things.  They’ve used them in medicine for years — but leeches don’t produce anything — and lately, I’ve been starting to wonder what exactly Google has produced.  There is their search engine — which while still wildly popular, is no longer my first choice for all types of searches and then their add placement.  And while innovative in their time — even these services don’t really produce anything.  Outside of that — I can think of a lot of places where Google is taking other people’s content and repackaging it (or using it to sell versions of it) or are swallowing technologies and assimilating them into the collective.  Maybe that should be Google’s new motto, “Resistance is futile”, well, maybe not.  😉

–TR

Using XMLTextReader to improve XSLT processing

By reeset / On / In Microsoft, Programming

One of the things that I spend a little too much time working on was how to setup a more streamlined version of resolving entities and ignoring entities.  The key has to do with avoiding a call to the XMLValidateNavigator object, and using the XMLTextReader gives you more granularity over the process.  Here’s an example:

/*=====================================================
* Function/sub: TransformXSLT
* Description: Does the XSLT translation
* ====================================================*/
public int TransformXSLT(string sSource,
string sDest,
string sXSLT,
bool bRemote)
{
System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(sSource);
if (bRemote==false) {
reader.XmlResolver =
null;
}
 System.Text.UTF8Encoding Encoding = new System.Text.UTF8Encoding(false);
System.IO.StreamWriter writer =
new System.IO.StreamWriter(sDest, false, Encoding);

try
{
  System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(reader);
    System.Xml.Xsl.XslTransform xslt = new System.Xml.Xsl.XslTransform();
    xslt.Load(sXSLT);
    xslt.Transform(doc, null, writer, null);
    writer.Close();
    reader.Close();

 } catch (System.Exception eee) {
    this.sXSLTError = eee.ToString();
    writer.Close();
    reader.Close();
    return mengine60.ERR_XSLT_ERROR;
}
return 0;
}

 

–TR