Archive

Archive for the ‘Uncategorized’ Category

Sage data objects

For anybody developing software to integrate with sage, here’s a tip which will save the £1,500 enrollment fee in the sage developer program. You can download the Sage data objects from http://www.eosuk.com/downloads/downloadsuk.htm
 
If you copy the relevant TLB (type library files) into Windows/system32 on a machine that previously had Sage installed (i.e. SDOENG90.dll is in the system folder) you can then make a COM reference to the type library. And for those .NETter’s out there, i’m sure you can create the wrapper class from that.
 
 
Categories: Uncategorized

C# Library for ZIM

Categories: Uncategorized

Running a block of SQL files sequentially

In Enterprise manager, you can script out the schema of a database, including stored procedures & all by clicking All-Tasks then "Generate SQL script". In this you have an option to create one big SQL file, or one file per object.
 
I opted for one file per object, because, I wanted to create a database project, in order to put the database schema under source control, and thus multiple developers could change the database schema at the same time.
But this time, with version tracking, and all the other associated benifits of source control.
 
However, when you are left with 1000 or so SQL files, how do you run them all together. – I used a batch file like this:
 
@echo off
cls
echo Databse installation utility
echo ——————————————
echo Useage: InstallDB [server] [database name]
for %%1 in (*.*) do osql -S %1 -E -d %2 -i %%1 -n
 
(You can substitue -E with -U & -P for a non-trusted connection)
 
 
Categories: Uncategorized

Microsoft.XMLHTTP to the rescue

Following up on my previous post regarding forwarding a user to a different page whilst another page is loading. I came up with a solution.
 
If you are loading a page from http://localhost, you cannot simultaneously load a page from localhost in the same session. This, I guess is a browser quirk, but nonetheless, it effects both IE and Firefox. However, you can load a page from http://127.0.0.1 – even though they’re the same server.
 
In the particular applcation I was working on, it was not acceptable to change domains, since the referer would change. Therefore, after about 4 hours of research, I read up on XMLHTTP – a technology used for out-of-band calls – as I used earlier in a .NET chatroom application.
 
So to get right to the code – here it is:
 
function openWindow(url)
{
 var xmlhttp=false;
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
 // JScript gives us Conditional compilation, we can cope with old IE  versions.
 // and security blocked creation of the objects.
 try {
 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
 try {
 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (E) {
 xmlhttp = false;
 }
 }
 @end @*/
 if (!xmlhttp && typeof XMLHttpRequest!=’undefined’)
 {
  xmlhttp = new XMLHttpRequest();                                           
 } 
 
 try
 {                  
  xmlhttp.open("GET", "http://<alternative URL>/" + url,true);
  win=window.open();
  xmlhttp.onreadystatechange=function()
  {                  
   if (xmlhttp.readyState==4)
   {                    
    win.document.write(xmlhttp.responseText);                 
   }
  }
  xmlhttp.send(null)  
 }
 catch(e2)
 {
  // The browser doesn’t support XMLHTTP.
  window.open(url);
 }
}   
 
Categories: Uncategorized

Help!. Can’t reopen a page whilst another is loading…

If a page takes a long time to load, but has already flushed out content containing a hyperlink, that
hyperlink will not work until the page is fully loaded.
 
To demonstrate:
 
<a href="tempTest.aspx" target="_blank">Click to reopen this page</a><br>
<%
 for (int i=0;i<1000;i++)
 {
  System.Threading.Thread.Sleep(100);
  Response.Write(i + "…");
  Response.Flush();
 } 
%>
 
If you save this as tempTest.aspx, then load it in your web browser, and click on the link before
it has counted to 1000, you will see that the popup window hangs until the first page is complete.
 
Free pint of beer to whoever solves this one!
 
Categories: Uncategorized

Barcode reading webservice

Categories: Uncategorized

Clipboard ring in Visual studio .NET

Categories: Uncategorized

Integrating VSS witn Dreamweaver and VS.NET

Categories: Uncategorized

Installing IIS on XP Home

Although it’s a hack, I just figured out how to install IIS on XP Home. With the help of these two urls.

http://www.iis-resources.com/modules/AMS/article.php?storyid=48

and

http://www.webthang.co.uk/tuts/tuts_server/iis_xph/pippo_xp.asp

I did hit two problems, one was that it came up with an error "The Specified Module Could not be found" – This is fioxed by opening the IIS snap in, properties > Directory Security > Anonymous access > edit > then uncheck "Allow IIS to control password".

Then, to install .NET, I used aspnet_regiis.exe -i

———-

As an experiment, I tried to get .NET beta 2 to install aswell,but I got this error in the event log

Exception: System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace: at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)

at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)

at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters).

 

Categories: Uncategorized

Stored Procedure version control

Often, when you work on a large scale database-driven application, you end up with hundreds of stored procedures. As the project evolves, the stored procedures get modified over time, and you often loose older versions of stored procedures.

Although there are many ways to provide stored procedure version control, I opted for a simple approach.

If you have a stored proc called MyProc, before editiing it, create a new procedure called MyProc;2. then edit MyProc (which I shall refer to as MyProc;1 for clarity).

When you call exec MyProc, then MyProc;1 will be executed. and MyProc;2 will not appear in any lists of stored procedures in Enterprise manager or Query Analyser.

To view the source of an older version of a stored proc, you can no longer use sp_helptext, but you can say "select text from syscomments where
id=(select id from sysobjects where name=’myProc’)
AND NUMBER=2"

 

 

 

Categories: Uncategorized