Posts Tagged ‘Workarounds’

.NET 3.5 SP1 in Windows 2000

Monday, March 23rd, 2009

I’ve posted a couple of times earlier on .NET 3.5 in Windows 2000.  The .NET framework 3.5 sits on .NET 2.0 SP2, which is only available to install on Windows XP and onwards.  However, from experimentation, this does not mean that the same tricks don’t work.  As long as you have .NET 2.0 SP1 installed, you can get away with copying most of the DLLs in with no trouble.  It also seems to work with some of the newer ones.

Bullet Point Indentation on TextControl

Thursday, March 5th, 2009

I use TextControl .NET for a lot of the programs that I write – it is a great word processor component and works well for document based reporting as well.  However, there are a few niggling little bugs that annoy me.  One of them is bullet point indentation.  

I discussed this problem with the technical support people at TextControl and they said that I would have to write some code to catch the Changed event.  

I initially thought that this was a problem with the bullet point indentation itself, and then I noticed that if I added bullet points and removed them, the paragraph jumped back to 0 (default indentation is usually 500).  

After a bit of playing about, I discovered that I needed to change the selection’s paragraph format properties for left indent and hanging indent as follows: -

    Private Sub tcEditor_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles tcEditor.Changed

        If tcEditor.Selection.ParagraphFormat.LeftIndent < 500 AndAlso tcEditor.Tables.GetItem() Is Nothing Then            tcEditor.Selection.ParagraphFormat.LeftIndent = tcEditor.Selection.ParagraphFormat.HangingIndent + 500
        End If
    End Sub

This might look a little odd, but in order to set the left indent to the correct value, it needs to be 500 greater than the hanging indent in order to get the correct behaviour

Storing Partial/Incomplete Date/DateTime Values in SQL

Wednesday, March 4th, 2009

I am currently working on a project where I am taking data from an old database.  Unfortunately, many of the date fields in the database contain incomplete date values, simply because not all the data was available when it was entered (it was taken off paper, memory and other relatively unreliable storage media).

In the old database, these fields were stored as text.  However, I wanted them to be searchable by date, so I was thinking about it and I have come up with a couple of possible ideas…

Firstly, you can store the centrepoint datetime and a float to represent a timespan in days of how accurate this is.  Whilst I think it is possible to do an SQL query to query this (I haven’t actually tried it), it is a bit messy, and I think it would probably be a nightmare to write a Linq to SQL query or use another query framework.

Secondly, you can store the min and max datetime that it could be.  This also allows you to do a little clever parsing when you retrieve the date from the database and for example, you can list a date which is in the database as 2009-01-01 to 2009-01-31 (in ISO date format)  as “January 2009″.

Of course, both of these only work if the missing data is the least significant part (in mathematical terms).  I mean, if you know the day and month, but not the year, neither of these schemes work.  For that you’d probably need to use 3 nullable integer fields, but then searching on that would be a pain.

Google Chrome and Microsoft ASP.NET AJAX

Wednesday, March 4th, 2009

If you use ASP.NET AJAX and you or any of the people who use your site use Google Chrome, you might find that it causes trouble (this is actually a problem with ASP.NET AJAX, not Chrome – it also doesn’t like the latest version of Safari, which is also based on WebKit, the engine that Chrome uses for rendering HTML).Anyway, you might want to look at this blog entry - they have come up with a nice solution to the problem.  I’ve tried it and it works really well.

Update on .NET 3.5 in Windows 2000

Monday, March 2nd, 2009

This has now been running fine for a couple of months and is being used on a day to day basis.  Not all functionality works perfectly out of the box, but most of the stuff I have tried can be worked around.  I’m using compilation on the fly using the VB.NET 3.5 compiler to make dynamic Linq to SQL queries, which I have needed to create a workaround using vbc.exe – the VB.NET compiler and passing in command line parameters.  I needed to copy in the required DLLs that it was complaining that it didn’t have, and a few extras as well that I threw in predicting that it might need them.  Let me know if you want more details – comment below.

More info on .NET 3.5 in Windows 2000

Thursday, September 18th, 2008

People have been requesting more information about whether my previously mentioned trick to get .NET 3.5 functionality in Windows 2000 works.  So far, it mostly seems to be a success although the software is still not being used on a large scale, but I have only found 1 real problem… When I made a WCF service client to access a web service, VS.NET created a section in the app.config file.  This caused an exception when I loaded the program on the Windows 2000 PCs.  However, I removed the section from the config file and hard coded the configuration info for the WCF client and it worked fine!

Microsoft .NET Framework 3.5 in Windows 2000 Test 1

Wednesday, March 26th, 2008

I mentioned earlier how to install .NET framework 3.5  in Windows 2000.  I have been testing this on 7 Windows 2000 PCs, and I have successfully managed to get them to do a simple Linq to SQL query with the method that I mentioned.  I can’t speak for WPF or anything, but I am currently only interested in Linq.  I will post more in future when I have the live system in place.

Setting register_globals from php.ini

Thursday, March 13th, 2008

I don’t do that much work with php these days, but I still have a few sites that I use it for.  The problem is that a lot of these sites are still relying on register_globals working.  That means that instead of $_GET[name], $_POST[name], $_SESSION[name] etc., you could just use $name.  This was pretty easy, but it did cause a lot of security problems.

By default, php has register_globals disabled on new installs these days, and it will actually be completely removed in php6, but for the moment, I needed a workaround.  Now, I’m no expert on all the different configurations of php running on various web servers (apache, IIS etc), but if you have one where you can do this, it is fairly easy to turn register_globals on, or alternatively, if it is on, you could possibly use this to turn it off.

Simply, create a file called php.ini in your http root, and put the following text in it…

register_globals = On;

That should do it, as long as your configuration allows it!

Microsoft .NET Framework 3.5 in Windows 2000

Wednesday, March 12th, 2008

Microsoft don’t support using .NET 3.5 in Windows 2000, which is particularly annoying, especially if, like me, you have a client who has 8 out of 12 PCs still using Windows 2000.

So, I decided to have a go and see if I could find any way of doing it. This is completely unsupported, and if it breaks anything, don’t blame me, but it is actually fairly straightforward and it seems to work fine to me (although I doubt it works with things like WPF, but if anyone tries it, please leave a comment to say how it goes)…

  1. Make sure you have Windows 2000 SP4 installed
  2. You may need to install KB 835732 before step 3
  3. Install .NET Framework 2.0 Service Pack 1

Now, there are 2 ways of continuing. Either you can copy over all the .NET 3.5 assemblies (you’ll have them on a .NET 3.5 PC in the Program Files\Reference Assemblies\Microsoft\Framework\v3.5 folder). You can either dump them in the application folder or probably register them in the GAC (not tried it, but it should work).

Alternatively, try running your application. You will probably get a load of AssemblyReferenceFailedExceptions. Copy in the required DLL from the above folder into your application folder for each one.

It should all work now!