IT Fixes..

Solutions to common IT related issues

Archive for the ‘Developer’ Category

Display HTML code on a website

Posted by Daman Dang on June 9, 2008

Please visit http://www.ezitfixes.com

HTML is used to design a website but what if you want to display a sample HTML code in a website?? The browser will consider your sample code just as the rest of the HTML code and parse it in a similar way, removing all the tags before it displays the content on the website.

To display some HTML code, you need to use escape characters for all the special characters defined in HTML. The following link has a HTML Encoder/Decoder which can generate the code that should be inserted to achieve the desired HTML code form as output.

HTML Encoder

Just input the code you desire to display and copy paste the encoded code in your HTML file.

Enjoy !!

Posted in Developer | Leave a Comment »

Configuring PHP and MySql on IIS (For Windows XP)

Posted by Daman Dang on June 9, 2008

Please visit http://www.ezitfixes.com

I was once asked to develop a web based database project which I had to do either using PHP or Java and I was not familiar with either of them. I searched on Google and felt that PHP is easy to learn and use. So I started learning PHP using the tutorials available online and building my project on the same time. Today I feel PHP has everything that one may need for any kind of web application which may require a back end database.

Installing PHP can be a mess so here are the instructions are for the following versions: PHP 5.2.3, MySql 5.0 and IIS 6.0

Steps may change a little with other versions.


Installing PHP

Step 1: Create a folder on C: called “PHP” and unzip the files from the PHP download into that folder.

Step 2: Open IIS6 Manager Right Click -> Default Website -> Properties -> Select Home Directory -> Select Configuration. On Application configuration check to see if .php is in list. If not click “Add”. For executable browse to “c:\php” folder and select “php5isapi.dll”. Click “OK” and then “OK” again.

Step 3: In the “C:\PHP” folder copy the file “php.ini-recommended” to your C:\WINDOWS folder. Rename this file to “php.ini”

Step 4: Create a test file in the root of your web folder called “phpinfo.php” and insert the code below:

<php
phpinfo();
?>

Step 5: Click Start –> Run and type IISRESET and press enter.

Step 6: Open Internet Explorer and type “http://127.0.0.1/phpinfo.php” and you should see it give you information about the PHP version.

If you see a page with all sorts of information about your PHP version that means your installation was successful.

Configuring MySQL Server

While running the setup you will need to configur an Instance. You can choose the following options while following the wizard.

MySQL Server Instance Configuration Wizard –> Detailed Configuration –> Developer Machine –> Non-Transactional Database Only –> Decision Support (DSS)/OLAP –> Check Enable TCPIP Netwokring –> Port 3306 –> Standard Character Set –> Install as a Windows Service –> Give it a password –> Execute!!

Configuring PHP for MySQL

Step 1: In the C:\PHP folder copy the file “libmysql.dll” to your C:\WINDOWS\SYSTEM32 folder. Make sure you don’t overwrite any existing file in this folder. If file exists, first rename it so you can go back.

Step 2: In the C:\PHP folder copy the file “php.ini-recommended” to your C:\WINDOWS folder. Rename this file to “php.ini” (You already did this.)

Step 3: Edit this file “php.ini” using a text editor like notepad. Find the line where it says “extension_dir = ***”. Uncomment this line by removing the preceding semi-colon. and set it to:

extension_dir=”c:\php\ext”

Step 4: In the same file “php.ini” also un-comment out 2 other where it says: extension=php_mysql.dll and extension=php_mysqli.dll by removing the semi-colon.

Step 5: Click Start –> Run and type IISRESET and press enter.

You are good to go!!

Posted in Developer | Leave a Comment »

Dynamic IFRAME Resizing

Posted by Daman Dang on June 9, 2008

Please visit http://www.ezitfixes.com

IFRAMEs are generally not considered a good idea to use but sometimes it really helps. But resizing an IFRAME as per the content is a big issue and I found a piece of code after some search which can resolve this issue.

In the head of your document enter the following JavaScript code:

<script language=”JavaScript”>
<!–
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById(‘the_iframe’).contentWindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById(‘the_iframe’).height=
the_height;
}
//–>
</script>

and in the body create the iframe tag:

<iframe width=”700″ id=”the_iframe”
onLoad=”calcHeight();”
src=”testing_page.shtml”
scrolling=”NO”
frameborder=”1″
height=”1″>
</iframe>

This will create an IFRAME of width=700 and the height will depend on the content it stores.

Reference: Guymal Code

Posted in Developer | 2 Comments »