Wednesday, December 2, 2009

Office application version does not match with Office 2003

You may have bought a new PC with Office 2007 installed and you want to go back to the user friendly Office 2003.

There are 3 steps you need to carry out before you can get 2003 to run correctly:

  1. Uninstall Office 2007
  2. Uninstall the 60 day Trial update helper
  3. and make sure you Uninstall Business Contact Manager because this causes the version does not match message.

Friday, November 27, 2009

Windows 7 – Fails to install updates

 

  • Security Update for Microsoft Office Excel 2003 (KB973475) failed with: Code 57A
  • Security Update for Microsoft Visual Studio 2008 Service Pack 1 (KB972222) failed with: Code 643

I downloaded and ran the excel update manually and it failed even when I ran as administrator.

The problem was:

Error 1402, Setup cannot open the registry key UNKNOWN\...
Verify that you have sufficient permissions to access the registry or contact your information technology dept. for assistance.

I’m the only user of the PC so I reckoned it was safe to:

  • run Regedit
  • changed the permissions for HKEY_LOCAL_MACHINE so that Everyone has Full Control
    image
    (You may have to add the user “”Everyone”)

 

Windows Updates worked just fine now.

So far so good.

Friday, August 14, 2009

Visual Studio 6 and VB6 – Hosted on Windows 7 (64k)

There are still lots of VB6 applications out there that need to be maintained. I couldn’t install VB6 directly on the  Windows 7 desktop because of ActiveX and adoDB problems, but I could install it using Windows Virtual PC XP Mode.

image

I’ve set up VS6 in Windows Virtual PC and created a shortcut on my Windows 7 toolbar:
image I run it from there and dragging it around my desktop just like any other window:
image

Here’s how:

  1. Check that your chip & bios support virtualisation using this Intel download
  2. Go here and carry out the 3 steps
    image
  3. Install Visual Studio 6 within the Virtual PC and update it with the necessary .

Of course you could use VMWare instead (but you dont appear to be able to use both together)

Friday, August 7, 2009

Move Office 2003 from one PC to another

This is dead easy.

  • On you old PC - stop sending & receiving

Tools -> Send Receive -> Send Receive Settings -> Disable ...

  • Shut down outlook
  • Copy all your PST and other outlook data files to exactly the same place on the new PC
    (I abandoned Bill's My ... naming convention long ago and keep my stuff on a mapped M:\ drive)
  • Use the Save My Settings wizard on the old PC to save your current settings that is sitting (probably unused) in your Microsoft Office Tools folder
    (See Description and use of the Save My Settings Wizard)
  • Make sure you stop any Office 2003 programs on your new PC
  • Do the import
  • Start Outlook and everything's great
    • Even all your eamil accounts have been migrated between registries
    • You still have to teach Outlook the passwords of your pop3 email accounts

Why did I do it any other way in the past?

Monday, April 20, 2009

A VB.NET console app to backup your blog(s)

If you want a small program that you can run periodically to backup your blogger blogs, you can use the following source code with the Google GData .NET Library.

See Sorting photo data from Google's Picasa API for another example of using the GData .NET library.

Code highlights
  • You need to supply your email address and password at service.Credentials
  • You need to specify the backup folder (Dim folder as String =)
  • The file is written as an XML file in
    • a sub-folder based on each blog's title
    • uses a unique filename based on the date and time
Imports Google.GData.Client
Imports System.Xml
Imports System.Text.RegularExpressions
Imports System.Net
Imports System.IO
Module Module1
    Dim exp As New Regex("[^a-zA-Z0-9]")
    Dim service As New Service("blogger", "BloggerSampleApp")
    Sub Main()
        service.Credentials = New GDataCredentials("<emailaddress>", "<password>")
        Dim query As New FeedQuery
        query.Uri = New Uri("http://www.blogger.com/feeds/default/blogs")
        Try
            Dim bloggerFeed As AtomFeed = service.Query(query)
            While bloggerFeed.Entries.Count > 0
                For Each entry As AtomEntry In bloggerFeed.Entries
                    exportBlog(entry)
                Next
                If bloggerFeed.NextChunk = Nothing Then
                    Exit While
                End If
                query.Uri = New Uri(bloggerFeed.NextChunk)
                bloggerFeed = service.Query(query)
            End While
        Catch ex As Exception
            Console.WriteLine(ex.ToString)
        End Try
    End Sub
    Sub exportBlog(ByVal blog As AtomEntry)
        Dim title As String = blog.Title.Text
        Dim folder As String = "M:\WWW\Blogs\" + title
        Console.WriteLine(folder)
        Try
            IO.Directory.CreateDirectory(folder)
        Catch ex As Exception
        End Try
        Dim filename As String = folder + "\" + exp.Replace(Now.ToString("s"), "") + ".xml"
        Console.WriteLine(vbTab + filename)
        Dim o As New FileStream(filename, FileMode.Create)
        Dim blogId As String = ""
        Dim ss() As String = blog.SelfUri.Content.Split("/")
        For i As Integer = 0 To ss.Count - 1
            If ss(i).ToLower.Equals("blogs") Then
                blogId = ss(i + 1)
            End If
        Next
        Dim url As String = "http://www.blogger.com/feeds/" + blogId + "/archive"
        Dim str As IO.Stream = service.Query(New Uri(url))
        Dim b(50000) As Byte
        While True
            Dim len As Integer = str.Read(b, 0, 50000)
            o.Write(b, 0, len)
            If len < 1 Then
                Exit While
            End If
        End While
        str.Close()
    End Sub
End Module

Monday, January 12, 2009

NoClassDefFoundError when attempting to use MTOM with NetBeans 6.5 Jax-WS 2.1 client

A Java client that communicates with a .NET host has problems when the HOST has messageEncoding set to MTOM in web.config :

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="FileTransferServicesBinding" transferMode="Streamed" 
          messageEncoding="Mtom" maxReceivedMessageSize="10067108864">
        </binding>
      </basicHttpBinding>
    </bindings>
...


(it works fine when messageEncoding="Text")



The client app throws:

    java.lang.NoClassDefFoundError: org/jvnet/mimepull/MIMEMessage



I fixed the problem by downloading from: here and including the mimepull.jar in the libraries.



[One can only hope that the data is transmitted to the host with MTOM encoding]



MTOM stands for Message Transmission Optimization Mechanism, it's explained here.

NetBeans 6.5: Problems building WSDL Java apps after upgrade from 6.1

I recently updated to NetBeans 6.5 and a WEB Services client stopped working. At build time I got the following error message:

C:\myproject\JavaApplication29\nbproject\jaxws-build.xml:10: taskdef A class needed by class com.sun.tools.ws.ant.WsImport cannot be found: com/sun/istack/tools/ProtectedTask

I fixed the problem by adding:
   <classpath path="${libs.jaxb.classpath}"/>
to jaxws-build.xml

 <target name="wsimport-init" depends="init">
  <mkdir dir="${build.generated.dir}/wsimport/client"/>
  <mkdir dir="${build.generated.dir}/wsimport/binaries"/>
  <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
    <classpath path="${libs.jaxws21.classpath}"/>

    <classpath path="${libs.jaxb.classpath}"/>
  </taskdef>
 </target>



Saturday, January 10, 2009

Jetty embedded WEB server offers GZIP compression out of the box

Jetty is an Open Source WEB server written Java that you can embed in your application. You can find out more about it here.

It's very useful as an a way to serve a browser based control panel for an appliance, desktop system tray or windows service application that generally runs unattended.
image
Browser based control panels are particularly useful if the application is running in a dark room with no direct access.

My ADSL modem has a good looking, intuitive menu based control panel and if I had a manual it's long lost.
image

"One key benefit of such a solution (written in Java) is that static HTML, XML, JavaScript and CSS files can all be included within the application jar file where they can't be tampered with by the casual user."

An AJAX based solution gives users a nice ride and quick feedback but the the EXT/JS framework that I use has some pretty big js, css, and image files to slow things up.

If you've read my posts about GZIP compression (Safari Browser provides Web Inspection Tool, Use Fiddler to explore HTTP GZIP compression and Fiddler helps you analyse HTTP traffic) you know that download bandwidth can be improved dramatically. This can improve download speed.

  1. Before Using this code 
    imagethe download cost 675KB & 1.46 seconds
  2. After using the the GzipStream instead
    image the download cost 203KB & 1.37 seconds

A saving of 472KB but only 90ms, probably because it's running on localhost where the operating system is passing data via pipes and streams.
The speed improvement on LAN or WWW would probably be significant.

Jetty makes the decisions

Of course we could GZIP the files and include them in the JAR file but the variations in browsers make decision making about which file to serve pretty difficult.

Doing it on the fly makes sense, particularly if your service up large dynamic data files or images.

Here's the code for you to cut:

byte[] b = readResource(uri);
OutputStream os = response.getOutputStream();
// GzipStream os = new GzipStream(request, response, b.length, 8192, 100);
os.write(b);
os.close();
if (uri.endsWith(".js")) {
   response.setContentType("text/javascript");
} else {
   String s = mt.getMimeByExtension(uri).toString();  
   response.setContentType(s);
}
response.setStatus(status);

Another improvement would be to set the last modified header.

This code does not work:
image because f.lastModified() returns 0.
Maybe because it's a resource.

When we go live, we can use the date on the jar file, but that's no good during debugging.

I'll post the solution when I find it.

Friday, January 9, 2009

Safari Browser provides Web Inspection Tool

In previous posts, Use Fiddler to explore HTTP GZIP compression and Fiddler helps you analyse HTTP traffic I mentioned tools to analyse how you web site.

The Safari browser offer the same detail, but in a more visual user interface. (Download it here.)

Safari WEB Inspector

Click on a page name, and you get the content:
image

Click on the time bar and it accordion opens the details:
image 

It makes suggestions about improving throughput.

"If your developing WWW sites, you probably need Safari installed anyway.

"Why not use it to improve your throughput."

Sunday, January 4, 2009

Sorting photo data from Google's Picasa API

In the earlier post Google Calendar Service hosts a Gig Guide, I showed how to to use Google Data APIs to use Google Calendar data.

SNAG-1075The client has posted photos of interest to Picasa and given them tags that determine which page of their WEB site they are displayed on.

This post describes

  • how to use the Picasa Service to host photos and use them in a ASP.NET WEB site using VB
  • how to sort the GData feed into "caption" sequence using a .Net IComparer
  • how to avoid possible problems when the application is hosted on a virtual WEB hosting site like GoDaddy.

The software uses the Picasa API which should be downloaded and installed.

  1. Install the DLLs in the Bin folder of your ASP.NET application
  2. If you are having the app hosted in a shared environment, make sure you use the DLL's in the ASP.NET folder
  3. You must also use the 1.2.2 (or later) version of the API. Earlier versions do not work.
  4. If you are in a shared environment, you will also need to set the MSBuild properties as follows of the VB.NET app as follows:
    image

In the code snippet below, the class:

  1. Connects to the service and sets user credentials
  2. genHTML(tag) returns a HTML table for that tag, by constructing the string from the entries returned by getPhotoFeed(tag, size) and getComment(entry)
  3. getPhotoFeed builds the query and retieves the results
    It also sorts these using, myEntryCompare - our specialist implementation of IComparer
Imports Microsoft.VisualBasic
Imports Google.GData.Photos
Imports Google.GData.Client
Imports Google.GData.Extensions
Imports Google.GData.Extensions.Location

Public Class FoodList
Dim password As String = "secret"
Dim username As String = "secret"
Dim albumName As String = "WWW"
Dim service As PicasaService
Public Sub New()
service = New PicasaService("more secrets")
service.setUserCredentials(username, password)
End Sub
Public Function getMenuHTML(ByVal tag As String) As String
Dim html As String = "<table>"
For Each entry As PicasaEntry In getPhotoFeed(tag, "320")
html += "<tr><td colspan=2><h4>" + entry.Summary.Text + "</h4><tr><td><img src='" + entry.Content.AbsoluteUri + "'/> <td>" + getComment(entry)
Next
html += "</table>"
Dim x = ""
Return html
End Function
Private Function getPhotoFeed(ByVal tag As String, ByVal size As String) As ArrayList
Dim query As New PhotoQuery(PicasaQuery.CreatePicasaUri(username, albumName))
query.Tags = tag
query.ExtraParameters = "imgmax=" + size + "u" ' set the maximum size of the returned images
Dim feed As PicasaFeed = service.Query(query)
Dim arr As New ArrayList
arr.AddRange(feed.Entries) ' add all the entries to an array
arr.Sort(New myEntryCompare) ' sort the entries by the caption (Summary.Text)
Return arr
End Function
Public Class myEntryCompare
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
Dim myX As String = DirectCast(x, PicasaEntry).Summary.Text
Dim myY As String = DirectCast(y, PicasaEntry).Summary.Text
Return myX.CompareTo(myY)
End Function 'IComparer.Compare
End Class
Private Function getComment(ByVal photoEntry As PicasaEntry) As String
Dim query As CommentsQuery = New CommentsQuery(PicasaQuery.CreatePicasaUri(username, albumName, (New PhotoAccessor(photoEntry)).Id))
Dim feed As PicasaFeed = service.Query(query)
Try
Return feed.Entries(0).Content.Content
Catch ex As Exception
End Try
Return ""
End Function
End Class