Tuesday, August 16, 2005
Getting PHP to work with MySQL on IIS/W2k3
Make sure that the PHP directory is in the System PATH variable. Only version 5.1.5 works with 64bit W2K3.
Labels:
Code
Monday, July 25, 2005
Getting a .Net Compact Framework Form to cover full screen
The form must not have a menu or a control box. Set the WindowState to Maximized in the form load event. That's it.
Labels:
Code
Wednesday, July 13, 2005
Getting PHP MySQL to work on Fedora Core 3
The Php MySQl module is not installed by default on Fedora Core 3. Install the following RPM:
ftp://rpmfind.net/linux/fedora/core/updates/3/i386/php-mysql-4.3.11-2.6.i386.rpm
ftp://rpmfind.net/linux/fedora/core/updates/3/i386/php-mysql-4.3.11-2.6.i386.rpm
Importing GPG public keys on Fedora Core 3
# rpm --import /usr/share/doc/fedora-release-3/RPM-GPG-KEY*
Labels:
Code
Wednesday, June 8, 2005
VBScript to delete all files older than 2 months
const fldname = "c:\test"
set fso = createobject("scripting.filesystemobject")
set fldr = fso.getfolder(fldname)
set dttoday = date
set dt2monthsago = dateadd("m", -2, dttoday)
recurse fldr
sub recurse( byref fldr)
dim subfolders,files,folder,file
set subfolders = fldr.subfolders
set files = fldr.files
wscript.echo fldr.path
for each file in files
if file.datelastmodified < dt2monthsago then
wscript.echo "Deleting " & file.name & " last modified: " & file.datelastmodified
on error resume next
file.delete
end if
next
for each folder in subfolders
recurse folder
next
set subfolders = nothing
set files = nothing
end sub
set fso = createobject("scripting.filesystemobject")
set fldr = fso.getfolder(fldname)
set dttoday = date
set dt2monthsago = dateadd("m", -2, dttoday)
recurse fldr
sub recurse( byref fldr)
dim subfolders,files,folder,file
set subfolders = fldr.subfolders
set files = fldr.files
wscript.echo fldr.path
for each file in files
if file.datelastmodified < dt2monthsago then
wscript.echo "Deleting " & file.name & " last modified: " & file.datelastmodified
on error resume next
file.delete
end if
next
for each folder in subfolders
recurse folder
next
set subfolders = nothing
set files = nothing
end sub
Labels:
Code
Sunday, June 5, 2005
Getting PHP to work on IIS6 on Win2K3
Copy c:\php\php.ini-distrib to c:\windows\php.ini
In IIS, under 'Home Directory', click on the 'Configuration', 'Application Mappings' tab.
Click 'Add' and enter C:\php\php5isapi.dll for .php extensionGo back to IIS.
Add and allow the PHP ISAPI Extension to IIS Web Service Extensions: C:\PHP\php5isapi.dll Open IIS Manager
Click on "Web Service Extensions"
Add a new Web service extension...Enter "PHP ISAPI Extension" as the "Extension name" Click the "Add..." button and browse to the php5isapi.dll file in your PHP install directory Check the "Set extension status to Allowed" checkbox and click "OK"
In IIS, under 'Home Directory', click on the 'Configuration', 'Application Mappings' tab.
Click 'Add' and enter C:\php\php5isapi.dll for .php extensionGo back to IIS.
Add and allow the PHP ISAPI Extension to IIS Web Service Extensions: C:\PHP\php5isapi.dll Open IIS Manager
Click on "Web Service Extensions"
Add a new Web service extension...Enter "PHP ISAPI Extension" as the "Extension name" Click the "Add..." button and browse to the php5isapi.dll file in your PHP install directory Check the "Set extension status to Allowed" checkbox and click "OK"
Labels:
Code
Wednesday, June 1, 2005
Getting the virtual URL of a SharePoint web app script
Request.Url doesn't give you what it says on the browser Url box. You need to use the following:
string scriptUrl = Request.ServerVariables["HTTP_VTI_SCRIPT_NAME"];
string scriptUrl = Request.ServerVariables["HTTP_VTI_SCRIPT_NAME"];
Labels:
Code
Tuesday, May 31, 2005
Test for AlphaNumeric in C#
public bool IsAlphaNumeric(String str){
Regex regexAlphaNum=new Regex("[^a-zA-Z0-9]");
return !regexAlphaNum.IsMatch(str);
}
Regex regexAlphaNum=new Regex("[^a-zA-Z0-9]");
return !regexAlphaNum.IsMatch(str);
}
Friday, May 27, 2005
To create a Sharepoint web app with Visual Studio.Net
Map a drive (S:) to the sharepoint server at "C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS".
Create a new project at http://sharepointserver/_layouts/WebAPP.
Visual Studio will fail. Change the path to S:\WebApp and retry.
Visual STudio will complain about permission problems and the need to create an application at the server. Just click okay all the way through.
Go to the sharepoint server. Start the IIS management applet, and browse to the WebApp folder just created. Right-click and select properties. Create an application. Select the Sharepoint application pool.
Restart IIS using iisreset.
Go back to Visual Studio and add reference to Microsoft.SharePoint.dll.
Within each code file, add the following:
using Microsoft.SharePoint;using Microsoft.SharePoint.WebControls;using Microsoft.SharePoint.Utilities;
Create a new project at http://sharepointserver/_layouts/WebAPP.
Visual Studio will fail. Change the path to S:\WebApp and retry.
Visual STudio will complain about permission problems and the need to create an application at the server. Just click okay all the way through.
Go to the sharepoint server. Start the IIS management applet, and browse to the WebApp folder just created. Right-click and select properties. Create an application. Select the Sharepoint application pool.
Restart IIS using iisreset.
Go back to Visual Studio and add reference to Microsoft.SharePoint.dll.
Within each code file, add the following:
using Microsoft.SharePoint;using Microsoft.SharePoint.WebControls;using Microsoft.SharePoint.Utilities;
Labels:
Code
Wednesday, May 25, 2005
T-Mobile GPRS UK Settings
Session Type Continuous/Permanent
Security Off
Gateway Address 149.254.001.010
Authentication Normal
Access Point Name general.t-mobile.uk
Port number 9201
Mail server (SMTP) smtp.t-email.co.uk
Username user
Password one2one
Home Page http://wap.t-mobile.co.uk/
http://www.t-zones.co.uk
Security Off
Gateway Address 149.254.001.010
Authentication Normal
Access Point Name general.t-mobile.uk
Port number 9201
Mail server (SMTP) smtp.t-email.co.uk
Username user
Password one2one
Home Page http://wap.t-mobile.co.uk/
http://www.t-zones.co.uk
Friday, May 6, 2005
Send mail in ASP.NET
MailMessage oMsg = new MailMessage();
oMsg.From = "me@MyServer.Net";
oMsg.To = "you@YourServer.Net";
oMsg.Cc = "him@HisServer.Net";
oMsg.Subject = "Test";oMsg.Body = "This is only a test";
oMsg.Attachments.Add(new MailAttachment("c:\temp\Test.txt"));
SmtpMail.Send(oMsg);
oMsg.From = "me@MyServer.Net";
oMsg.To = "you@YourServer.Net";
oMsg.Cc = "him@HisServer.Net";
oMsg.Subject = "Test";oMsg.Body = "This is only a test";
oMsg.Attachments.Add(new MailAttachment("c:\temp\Test.txt"));
SmtpMail.Send(oMsg);
Labels:
Code
Tuesday, April 19, 2005
.Net Remoting
Process currentProcess = Process.GetCurrentProcess(); Process [] duplicateProcesses = Process.GetProcessesByName(currentProcess.ProcessName); if (duplicateProcesses.Length == 1) { AssociateFileTypes(); TcpChannel chan = new TcpChannel(8420); ChannelServices.RegisterChannel(chan); RemotingConfiguration.RegisterWellKnownServiceType( System.Type.GetType("InteractiveLogBook.RemoteExecute, InteractiveLogBook"), "RemoteExecute", WellKnownObjectMode.SingleCall); } else { TcpChannel chan = new TcpChannel(); ChannelServices.RegisterChannel(chan); RemoteExecute obj = (RemoteExecute) Activator.GetObject(typeof(RemoteExecute), "tcp://127.0.0.1:8420/RemoteExecute"); if (obj == null) MessageBox.Show("Could not locate running Interactive LogBook", "Error", MessageBoxButtons.OK,MessageBoxIcon.Error); else obj.ProcessArgs(args); return; } public class RemoteExecute : MarshalByRefObject { public RemoteExecute() { } public bool ProcessArgs(String[] Args) { InteractiveLogBook.FormILB.mainForm.ProcessCommandLine(Args); return true; } } |
Labels:
Code
Downloading a file from Sharepoint 2
// C#
public void DownloadDocument(string localFile,string remoteFile)
{
try
{
// Create the web request object
WebRequest request = WebRequest.Create(remoteFile);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Method = "GET";
// Get a web response back
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream reader = response.GetResponseStream();
FileStream fstream = new FileStream(localFile, FileMode.OpenOrCreate, FileAccess.Write);
byte [] buffer = new byte[1024];
int bytesRead = 0;
do
{
bytesRead = reader.Read(buffer,0,1024);
fstream.Write(buffer,0,bytesRead);
} while(bytesRead >0);
response.Close();
fstream.Close();
}
catch(Exception ex)
{
MessageBox.Show(host.HostForm,ex.Message,"Error Downloading",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
public void DownloadDocument(string localFile,string remoteFile)
{
try
{
// Create the web request object
WebRequest request = WebRequest.Create(remoteFile);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Method = "GET";
// Get a web response back
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream reader = response.GetResponseStream();
FileStream fstream = new FileStream(localFile, FileMode.OpenOrCreate, FileAccess.Write);
byte [] buffer = new byte[1024];
int bytesRead = 0;
do
{
bytesRead = reader.Read(buffer,0,1024);
fstream.Write(buffer,0,bytesRead);
} while(bytesRead >0);
response.Close();
fstream.Close();
}
catch(Exception ex)
{
MessageBox.Show(host.HostForm,ex.Message,"Error Downloading",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
Uploading a file to Sharepoint 2
//C#
public void UploadDocument(string localFile, string remoteFile)
{
// Read in the local file
FileStream fstream = new FileStream(localFile, FileMode.Open, FileAccess.Read);
byte [] buffer = new byte[fstream.Length];
fstream.Read(buffer, 0, Convert.ToInt32(fstream.Length));
fstream.Close();
try
{
// Create the web request object
WebRequest request = WebRequest.Create(remoteFile);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Method = "PUT";
request.ContentLength = buffer.Length;
// Write the local file to the remote system
BinaryWriter writer = new BinaryWriter(request.GetRequestStream());
writer.Write(buffer, 0, buffer.Length);
writer.Close();
// Get a web response back
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();
}
catch(Exception ex)
{
MessageBox.Show(host.HostForm,ex.Message,"Error Uploading");
}
}
public void UploadDocument(string localFile, string remoteFile)
{
// Read in the local file
FileStream fstream = new FileStream(localFile, FileMode.Open, FileAccess.Read);
byte [] buffer = new byte[fstream.Length];
fstream.Read(buffer, 0, Convert.ToInt32(fstream.Length));
fstream.Close();
try
{
// Create the web request object
WebRequest request = WebRequest.Create(remoteFile);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Method = "PUT";
request.ContentLength = buffer.Length;
// Write the local file to the remote system
BinaryWriter writer = new BinaryWriter(request.GetRequestStream());
writer.Write(buffer, 0, buffer.Length);
writer.Close();
// Get a web response back
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();
}
catch(Exception ex)
{
MessageBox.Show(host.HostForm,ex.Message,"Error Uploading");
}
}
Wednesday, April 21, 2004
Evaluation of Ergo Microlite XL laptop
First impressions
The laptop arrived in a fairly well padded box, labelled "Fragile" and "Glass for Industry", presumably for security purposes. Inside the box was an own-brand, slightly oversized moulded laptop case containing the laptop. Though strapped in the case, the diminutive laptop still slid around a little. A smaller case might have been more appropriate.
The laptop was also securely wrapped in polythene and sticky tape. Perhaps a little too securely, requiring a knife or similar to open up the wrapping, thus risking damage to the laptop.
On power up, the laptop was fully charged and Windows XP fully installed, which was a nice touch. The printed instructions to register the Windows serial key didn't seem to be applicable to this particular machine, which could be confusing. The lack of a recovery CD is a serious oversight. There was also no printed manual. However, all these may be due to the fact that this was a review/evaluation machine.
The laptop was no lightweight at 2.2Kg, but the magnesium alloy casing lent it a quality look and feel. However this meant that it could feel icy cold before it warmed up, and thus carried the danger of moisture condensing on the laptop when changing rapidly from cold to warm environments.
The overall quality feel extended to the keyboard, which had good key travel and positive feedback, with fashionable grey translucent keys. There were 4 hot-keys across the top of the keyboard, with the first two engraved, and hardwired to Outlook Express and Internet Explorer, and the remaining two being programmable.
The was also a Speed/Power toggle button to switch the laptop between higher speed or low power consumption. Unfortunately the application "Hcontrol.exe" crashed on on a number of occasions, rendering these buttons useless.
It was fairly quick to boot up, compared to other laptops of a similar spec.
Wireless networking was tricky to set up because of the "Intel PROSet" software which seemed to conflict with Windows XP's built-in wireless configuration. The PROSet software also failed to start on several logins, thus cutting off wireless network connectivity.
On occasions, during log-off a process called "Sample" hung, and had to be killed manually. This seemed to happen with user accounts which were not administrators of the laptop.
The touchpad was accurate and responsive, with up-down scroll buttons as well as scrolling regions.
The laptop also doubled as an audio CD player, when it was powered off. A row of small buttons along the front edge provided the usual buttons for navigating an audio CD as well as controlling the volume. A separate power switch underneath the laptop turned the audio CD player on and off. The sound quality was acceptable given the small size of the speakers, which faced downwards into the table.
The LCD display was reasonably bright and sharp, with no visible artefacts or unevenness. The anti-glare screen surface also worked well in bright or external lighting.
Very little in the way of bundled applications were supplied with the laptop. Though, at the very least, some form of time-limited anti-virus package should have been included, as with most other suppliers these days.
In general, first impressions were favourable, but one bone of contention is that the system supplied was not exactly the specification requested. The request was for a laptop with the 256MB RAM and 30GB hard disk, and the supplied laptop has 512MB RAM and 20 GB. The increased RAM would have given a false impression of better performance over the 256MB version. (Note: We were later told by Ergo that the extra 256MB was a no-cost upgrade).
Longer Term Use
In day-to-day use, the laptop was generally pleasant to use. The battery life was impressive at more than 3 hours and stretching to 5 hours of continuous use, on occasions, though this seemed to shorten as the days went by. The solid feel of the unit made it seem robust. Nothing broke or fell off, and by the end of the evaluation period, all the flaps, covers, and connectors were still in place and worked.
The wireless LAN connectivity on the other hand, gave trouble from day one. The “Intel PROSet” software kept crashing, and denying wireless connectivity. In the end, the decision was taken to un-install the PROSet software and to rely entirely on Windows XP’s wireless driver and software. Since then, wireless connectivity worked without a hitch. The range and reception of wireless system, however, was not comparable to that of a standard HP/Compaq PCMCIA wireless LAN card, often dropping connections in low signal areas, where the PCMCIA card would still maintain connectivity.
On closer inspection, the laptop revealed itself to be an OEM-rebadged version of the Asus MC2400E Notebook PC (http://taiwan.asus.com.tw/products/notebook/m2series/m2000e/m2000e_overview.htm ). The same Asus laptop is also rebadged by a number of other small laptop manufacturers. This was reassuring in the sense that a sizeable company with experience, and a fairly good track record in laptops was manufacturing the laptop. However, on the other hand, it meant that Ergo may have little control over the parts and components availability for the laptop, and its future.
The other fly in the ointment is the spacebar key on the keyboard. It seemed to have suffered a reduction in sensitivity with use, requiring a harder prod each time before it would register. This got very annoying when typing fast, as words tended to run together.
At about week 4, the DVD drive disappeared from the “My Computer” folder in Windows. A support email on this issue was sent via Ergo’s website on a Friday and a support engineer called back the following Monday and quickly identified the problem correctly. The DVD drive had come slightly loose and Windows XP couldn’t see it again until it was pressed firmly back in. The support engineer was knowledgeable, polite, courteous and patient. Generally, it was a pleasant support call experience.
The touch pad lost its sensitivity a few times after a reboot, but seemed to recover after further reboots. All in all, two things marred an otherwise generally positive experience: The annoying spacebar fault and the flaky built-in wireless networking. The spacebar’s inability to register keystrokes seemed to get worse over time, and the wireless networking would sometimes completely refuse to connect altogether when other devices have no difficulties in connecting, forcing the use of an external PCMCIA wireless LAN card.
Sum Up
In summing up the laptop was well made and baring 2 small problems performed well. Ergo’s support service seemed good, at least above average. However, in terms of value for money, the market for laptops towards the lower to middle end of the market is tremendously fierce. Two other similar notebooks were available for comparisons during the course of this evaluation: The Toshiba A10 Satellite Pro, starting from £500 ex.VAT, and the HP NX9005 starting from £545 ex.VAT. This made the Ergo Microlite XL Laptop look decidedly poor value at just over £1000 ex. VAT.
The laptop arrived in a fairly well padded box, labelled "Fragile" and "Glass for Industry", presumably for security purposes. Inside the box was an own-brand, slightly oversized moulded laptop case containing the laptop. Though strapped in the case, the diminutive laptop still slid around a little. A smaller case might have been more appropriate.
The laptop was also securely wrapped in polythene and sticky tape. Perhaps a little too securely, requiring a knife or similar to open up the wrapping, thus risking damage to the laptop.
On power up, the laptop was fully charged and Windows XP fully installed, which was a nice touch. The printed instructions to register the Windows serial key didn't seem to be applicable to this particular machine, which could be confusing. The lack of a recovery CD is a serious oversight. There was also no printed manual. However, all these may be due to the fact that this was a review/evaluation machine.
The laptop was no lightweight at 2.2Kg, but the magnesium alloy casing lent it a quality look and feel. However this meant that it could feel icy cold before it warmed up, and thus carried the danger of moisture condensing on the laptop when changing rapidly from cold to warm environments.
The overall quality feel extended to the keyboard, which had good key travel and positive feedback, with fashionable grey translucent keys. There were 4 hot-keys across the top of the keyboard, with the first two engraved, and hardwired to Outlook Express and Internet Explorer, and the remaining two being programmable.
The was also a Speed/Power toggle button to switch the laptop between higher speed or low power consumption. Unfortunately the application "Hcontrol.exe" crashed on on a number of occasions, rendering these buttons useless.
It was fairly quick to boot up, compared to other laptops of a similar spec.
Wireless networking was tricky to set up because of the "Intel PROSet" software which seemed to conflict with Windows XP's built-in wireless configuration. The PROSet software also failed to start on several logins, thus cutting off wireless network connectivity.
On occasions, during log-off a process called "Sample" hung, and had to be killed manually. This seemed to happen with user accounts which were not administrators of the laptop.
The touchpad was accurate and responsive, with up-down scroll buttons as well as scrolling regions.
The laptop also doubled as an audio CD player, when it was powered off. A row of small buttons along the front edge provided the usual buttons for navigating an audio CD as well as controlling the volume. A separate power switch underneath the laptop turned the audio CD player on and off. The sound quality was acceptable given the small size of the speakers, which faced downwards into the table.
The LCD display was reasonably bright and sharp, with no visible artefacts or unevenness. The anti-glare screen surface also worked well in bright or external lighting.
Very little in the way of bundled applications were supplied with the laptop. Though, at the very least, some form of time-limited anti-virus package should have been included, as with most other suppliers these days.
In general, first impressions were favourable, but one bone of contention is that the system supplied was not exactly the specification requested. The request was for a laptop with the 256MB RAM and 30GB hard disk, and the supplied laptop has 512MB RAM and 20 GB. The increased RAM would have given a false impression of better performance over the 256MB version. (Note: We were later told by Ergo that the extra 256MB was a no-cost upgrade).
Longer Term Use
In day-to-day use, the laptop was generally pleasant to use. The battery life was impressive at more than 3 hours and stretching to 5 hours of continuous use, on occasions, though this seemed to shorten as the days went by. The solid feel of the unit made it seem robust. Nothing broke or fell off, and by the end of the evaluation period, all the flaps, covers, and connectors were still in place and worked.
The wireless LAN connectivity on the other hand, gave trouble from day one. The “Intel PROSet” software kept crashing, and denying wireless connectivity. In the end, the decision was taken to un-install the PROSet software and to rely entirely on Windows XP’s wireless driver and software. Since then, wireless connectivity worked without a hitch. The range and reception of wireless system, however, was not comparable to that of a standard HP/Compaq PCMCIA wireless LAN card, often dropping connections in low signal areas, where the PCMCIA card would still maintain connectivity.
On closer inspection, the laptop revealed itself to be an OEM-rebadged version of the Asus MC2400E Notebook PC (http://taiwan.asus.com.tw/products/notebook/m2series/m2000e/m2000e_overview.htm ). The same Asus laptop is also rebadged by a number of other small laptop manufacturers. This was reassuring in the sense that a sizeable company with experience, and a fairly good track record in laptops was manufacturing the laptop. However, on the other hand, it meant that Ergo may have little control over the parts and components availability for the laptop, and its future.
The other fly in the ointment is the spacebar key on the keyboard. It seemed to have suffered a reduction in sensitivity with use, requiring a harder prod each time before it would register. This got very annoying when typing fast, as words tended to run together.
At about week 4, the DVD drive disappeared from the “My Computer” folder in Windows. A support email on this issue was sent via Ergo’s website on a Friday and a support engineer called back the following Monday and quickly identified the problem correctly. The DVD drive had come slightly loose and Windows XP couldn’t see it again until it was pressed firmly back in. The support engineer was knowledgeable, polite, courteous and patient. Generally, it was a pleasant support call experience.
The touch pad lost its sensitivity a few times after a reboot, but seemed to recover after further reboots. All in all, two things marred an otherwise generally positive experience: The annoying spacebar fault and the flaky built-in wireless networking. The spacebar’s inability to register keystrokes seemed to get worse over time, and the wireless networking would sometimes completely refuse to connect altogether when other devices have no difficulties in connecting, forcing the use of an external PCMCIA wireless LAN card.
Sum Up
In summing up the laptop was well made and baring 2 small problems performed well. Ergo’s support service seemed good, at least above average. However, in terms of value for money, the market for laptops towards the lower to middle end of the market is tremendously fierce. Two other similar notebooks were available for comparisons during the course of this evaluation: The Toshiba A10 Satellite Pro, starting from £500 ex.VAT, and the HP NX9005 starting from £545 ex.VAT. This made the Ergo Microlite XL Laptop look decidedly poor value at just over £1000 ex. VAT.
Labels:
Review
Subscribe to:
Posts (Atom)