Programming

Fiddler – the HTTP debugging proxy

November 9th, 2007

Play

If you develop Web pages and you need to see what's actually in the traffic to and from the browser, you'll want to check out Fiddler. Fiddler is a really useful free add-on for Internet Explorer. It's particularly useful if you're developing Web applications that use AJAX, or if you want to investigate what actually gets sent to the server when you fill out an online form, or if your PC starts running slowly and you want to check whether there's lots of HTTP traffic going on that you weren't aware of. I found it interesting, and not a little alarming, to see how often passwords I type into a browser are sent up to the server as plain text that anyone along the way could read using a packet sniffer.

Take a look at the Quick Start screencast from fiddlertool.com:
Fiddler-QuickStartVid 
This video is hosted at: http://www.fiddlertool.com/Fiddler/firstrun.asp

Leave a comment

 

SQL find and replace

November 8th, 2007

It's remarkable easy, and quick, to do a search/replace on a MySQL database. PHPmyAdmin makes it even easier.

For example, say you have a table containing Web links to a server on your network and the server name gets changed or, more likely, the Web pages get moved. You might have links such as http://oldwebserver/importantstuff/index.html that should now be http://newwebserver/importantstuff/index.html.  To correct these with an SQL statement, use:

UPDATE table_name SET field_name = REPLACE (
field_name,
"old text",
"new text");

For example:

UPDATE mytable SET url = REPLACE (
url,
"http://oldwebserver/importantstuff/",
"http://newwebserver/importantstuff/");

PHPmyAdmin-searchreplace

Note: The reason I didn't just replace "oldwebserver" with "newwebserver" is as a safeguard against changing things I didn't want changed. You've got to be pretty careful about what you do, and I would strongly advise that you always back up the database before making any changes like this.

WordPress expert Lorelle has some good advice about doing this kind of thing on your WordPress tables at:

http://lorelle.wordpress.com/2005/12/01/search-and-replace-in-wordpress-mysql-database/

Leave a comment



PHP files return a blank page

November 7th, 2007

If, when you browse to a PHP page, you just see the text of the PHP script, it means the server knows nothing about PHP. To it the PHP script is just a text file, so it sends you that, like it would a .txt file.

If, however, you get a blank page, it suggests the Web server knows that .php files should be served up like Web pages, but the PHP isn't being handled properly.

On Apache, the most likely cause - or at least the first thing you should check out - is that the httpd.conf file hasn't been updated properly to point to the PHP module. Make sure this file contains LoadModule, AddType and PHPIniDir statements such as the following (these are for an XAMPP installation of Apache/PHP on Windows):

LoadModule php5_module "c:/xampp/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/xampp/php"

If these lines are in the httpd.conf file, the problem may just be that the file hasn't been read since the change was made. Restart Apache and the changes in the file will be applied.

Potentially similar posts

Leave a comment



Memory Builder version 1.0 released

October 7th, 2007    1 Comment

I've just released onto the world my first publicly available desktop application. I call it Memory Builder. It was designed to help my kids build up their French vocabulary, but you could use it to test yourself on almost any subject where small questions and answers work.

The idea is that you add in a selection of questions/answers (e.g. words/phrases in German and their English meanings, or questions about car engine parts and the answers to those questions), then you just test yourself by going through a few questions every now and again and checking the answers if you need to. I have the program set as a scheduled task so that it pops up every couple of hours and I can do a few questions, or just click Quit. The questions are randomly selected, so you get different ones coming up each time.

The installer I've put up for download comes with a default French/English data file. This presents French words/phrases. You've got to remember the English meanings. Click Next to page through from one French word/phrase to the next:

MemoryBuilder1-0-French

You can click English if you can't remember the word/phrase.

MemoryBuilder1-0-English

To add or remove  entries to/from the data file, click Feed.

MemoryBuilder1-0-QuestionAnswer 

Scroll to the bottom and add more French words and their English meanings, or click in the left, grey column to highlight a row and press Delete on the keyboard to remove it. To get rid of everything and add your own data, highlight the lot and press Delete. The Properties tab allows you to change the button text from French/English to something that suits your questions/answers.

See the Downloads page for a link to the Memory Builder installer.

Potentially similar posts

Leave a comment



Number ranges for common data types

June 23rd, 2005

I spent a while today rooting around trying to find out what range of numbers
could be stored in a particular data type. Here’s a list for future reference:

C
data type

Description

Number range

Storage required

char

character (or string)

–128 to 127

1 byte

int

integer

–32768 to 32,767

2 bytes

short (or short int)

short integer

–32768 to 32,767

2 bytes

long

long integer

–2,147,483,648 to 2,147,483,647

4 bytes

unsigned char

unsigned character

0 to 255

1 byte

unsigned int

unsigned integer

0 to 65,535

2 bytes

unsigned short

unsigned short integer

0 to 65,535

2 bytes

unsigned long

unsigned long integer

0 to 4,294,967,295

4 bytes

float

single-precision floating point (accurate to 7 digits)

+ or -3.4 x 1038 to + or -3.4 x10-38

4 bytes

double

double-precision floating point (accurate to 15 digits)

+ or -1.7 x 10-308 to + or -1.7 x10308

8 bytes

Adapted from a Dummies article: Determining
Types of Numbers in C

 

Potentially similar posts

Leave a comment



^ back to top ^

Page 3 of 3123