Thursday, 26 February 2009

"Cannot load mysql extension. Please check your PHP configuration" Error with XAMPP


so, if your like me, you've downloaded XAMPP... managed to get apache to start, but having trouble with MYSQL integration, then read on....
If you are simply trying to integrat php and mysql, then you may still find this useful.

You may receive this warning when attempting to access the local MYSQL instance packaged with XAMPP. Usually, this is noticed by clicking on the phpmyadmin on the XAMPP control panel.

1. For me: the problem was because i already had PHP installed on my PC. Therefore, the old installation was being used and it was conflicting!!

2. For others: The problem was due to the "php_mysql.dll" extension being excluded from the php.ini file.

- open php.ini located within the main php dir. For me, this is .\xampp\php\.
- Find "extension=php_mysql.dll" and ensure the semicolon is removed from the start of the string. This will then include the mysql extension.
- Now find the "extension_dir" string, and ensure it points to the 'ext' dir within the php dir. For me, this value is: extension_dir = "\xampp\php\ext\"

3. Lastly: Others find the problem is with a currupted mysql configuration file. This is located within the 'mysql\bin' dir. For me, this is ".\xampp\mysql\bin".
This is a cnf file, and for Windows users, this is the same extension as a SpeedDial file, so it will just be called "my". The best way to edit this, is to use the 'winmysqladmin.exe' tool located in the same directory, or drag the file onto Notepad.exe. Ensure the port is setup to a free port on your system... Mine is the default: 'port= 3306'.

If this is still not working, open "winmysqladmin.exe". (this is now an unsupported application, use phpmyadmin for anything else! You may receive DLL errors when using, but just ignore them.). Execute the 'my.ini setup' tab and a new configuration file can be saved out from here.

Wednesday, 25 February 2009

Starting Apache 2.2 on Windows (applies to *nix also)


I recently downloaded XAMPP the other day, and had a little trouble starting the inbuilt Apache 2.2 web server. Here is what i did to resolve these issues.
(This also applies to NIX systems).

I attempted to start the the apache service [apache_installservice.bat], but I received a strange error. So i decided to open the Apache Monitor manually and start the webserver.

Monitor Location: .\apache\bin\ApacheMonitor.exe

I executed the start button and the server failed to start with an ambiguous error message. I opened the event log and found the following error...

The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80


It seemed i already had programs/services running on port 80, so i opened up the Apache config file and altered the port.

Config Location: .\apache\conf\httpd.conf

Change: Listen 80 ---> to: Listen 8080

This will run the server on 8080 rather than 80. (assuming 8080 is free!)... you can check "netstat" on "Start>Run>cmd" to check this.



I then attempted to fire up the web server again, but the same error occured (but with a different port!) This time the port being 443...

The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:443 .


This port tells Apache which port SSL associated with. This can also be modified using the SSL config file.

SSL Config file location: .\apache\conf\extra\httpd-ssl.conf

Change: Listen 443 ---> to: Listen 444

(Providing nothing is running on 444)


I then attemted to start the Apache Server, and everything ran smoothly!

Tuesday, 3 February 2009

Increase File Size limits on .NET Web Services.


Add this to the Web.config file.

Code Snippet
  1. <httpRuntime executionTimeout="3600" maxRequestLength="80960"></httpRuntime>
End of Code Snippet
- executionTimeout is given in seconds.
- maxRequestLength is given in KB.

This will increase the accepted file size over SOAP to 80MB with a timeout of 1 hour.

Tuesday, 25 November 2008

F# - Tutorial 1 - Getting Started and Hello World


recently i have been looking into F#, a rich and purely functional programming language now supported by the .NET framework and developed within the MS research centre.
F# is based on older functional languages such as: Haskell and OCML. Haskell Curry is an infamous mathematician and logistician and this is where the roots of this language originate from...

F# can be run as a standard installer from the research centre website.. or it can be integrated into Visual Studio 2008 by downloading the MSI installer. The latest release is "September 2008 CTP"

Lets have a little look at a simple Hello World application...


//------------------[F# Code]------------------
(*
 
(c) Sean G @ TutorialGenius.com 2008.
 
This sample Hello World application is the keyhole to many F# adventures. Like many other languages, the foundations begin with a Hello World example!
 
*)
 
// Set the compilation warning to light mode; pronounced: "Hash Light".
#light
 
// Output Hello World!
System.Console.WriteLine("Hello World")
 
// Stop console from closing
System.Console.ReadKey(true)

Friday, 31 October 2008

An easy 30KB ISO Mounter


Virtual CD-ROM Control Panel Download


Instructions
=========================
1. Copy VCdRom.sys to your %systemroot%system32drivers folder.
2. Execute VCdControlTool.exe
3. Click "Driver control"
4. If the "Install Driver" button is available, click it. Navigate to the %systemroot%system32drivers folder, select VCdRom.sys, and click Open.
5. Click "Start"
6. Click OK
7. Click "Add Drive" to add a drive to the drive list. Ensure that the drive added is not a local drive. If it is, continue to click "Add Drive" until an unused drive letter is available.
8. Select an unused drive letter from the drive list and click "Mount".
9. Navigate to the image file
, select it, and click "OK". UNC naming conventions should not be used, however mapped network drives should be OK.

You may now use the drive letter as if it were a local CD-ROM device. When you are finished you may unmount, stop, and remove the driver from memory using the driver control.

Wednesday, 29 October 2008

C# - Generating Strong Typed Datasets


Over the past few weeks I have been working with Strong Typed Datasets in C# to parse XML content easily and more efficiently.

If you've ever had an Xml file and struggled to flawlessly parse it without errors, and write it back (using System.Xml namespace objects like: XMLReader or XmlDocument) then you should take a look at Strong typed Datasets.

If you've worked with Datasets, then this should come naturally. The idea is, once the XML content has been parsed into the Dataset, we can access the data through column and row information within the Dataset.

Heres how we go about it...

1. Find the "xsd.exe" tool. This is shipped with all versions of Visual Studio or can be downloaded from Microsoft's download center. This will allow us to create an XSD and .cs file for our Xml File.
2. Ensure your Xml File is valid Xml.
3. Use the xsd.exe tool to create the XSD and .cs from your xml by command line.

xsd.exe .xml - This will generate the schema (XSD) based on the XML File.
xsd.exe .xsd /d - This will generate the .cs based on the schema (XSD).


Heres a batch script to automate this process...

@echo off
 
:BEGIN
 
CLS
 
COLOR A
 
REM --- Get XML file name.
echo "What is the Path/Name of the XML file (excluding '.xml'): "
set /p XMlFile=
echo.
echo.
echo "Generating XSD Schema Definitions..."
xsd.exe %XMlFile%.xml
echo.
echo.
echo "Generating Strongly Typed DataSet file..."
xsd.exe %XMlFile%.xsd /d
echo.
echo.
echo "Strongly Typed DataSet Created Successfully!"
echo.
 
PAUSE


4. Add these 3 files to your C# project. You will notice the class name in the .cs file derives its name from the main tag within your xml. Don't forget to add the namepsace if applicable!
If you have done this corrently, you will notice the class inherits the DataSet class: "global::System.Data.DataSet" .

5. Create a new instance of the class, then call the "ReadXml()" method, specifiying the path to the XML file as a string. This will parse your XML file and popualte the Dataset. As the class was generated from the XSD, the template should match up!

6. You may also note that the instance you've created in step (5) contains accessors (one for each child note of your xml!)... Each of these has a "Rows" accessor, which will return a DataRowCollection object. If we run a loop on this collection, we will be able to extract the information!


If the "ReadXml()" function fails, you may need to re-structure your XML. The erros are quite self-explanatory, but generally this will fail due to an XML parser error.

Sean

Thursday, 23 October 2008

New Blog!!


All the posts below have been migrated from the TutorialGenius.com Tips feed.

The tips feed has now been deprecated and replaced with this blog. It just saves lots of time developing a new manageable blog with a nice GUI!

Installing the same .NET component twice, side by side


If you've ever needed to install the same product (wether its a web service or a DLL) on the same machine, twice! then here is a rought guide on how its performed...

If you notice, when you install an MSI or any DLL onto a system, and this component already exists, you will usually be asked wether to upgrade or remove the currently installed copmponent.

To get around this, we can edit the MSI installer and set the [RemovePreviousVersions] property to False... then set the grey box next to the [ProductCode] property, and generate a new code... this will give your component a new GUID (Global unique ID) and then the system will treat these as two seperate components.

This can also be performed in VS6.0 using a different method!

Make the internet control work with IE7


Heres a simple solution.

Close VB.
Open regedit.

Go to the "HKEY_CLASSES_ROOTTypeLib{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}1.1win32" branch and change the default value from
"C:WINDOWSsystem32ieframe.dll1" to
"C:WINDOWSsystem32ieframe.dll"

this will allow you to use the internet control again!

XAMPP! - PHP, MYSQL, Pear for Windows!


http://www.apachefriends.org/en/xampp-windows.html

this makes life a LOT easier for installing these tools on a windows machine.