PHP(6): Character encoding and other new features

April 13, 2010

The Internet is converging on UTF-8 for a common / universal character encoding. Set your apache environment to utf-8 by adding ‘AddDefaultCharset utf-8’ to your .htaccess. If you do not use apache add ‘default_charset utf-8’ to your php.ini. You have to do either of them (not both), php will use the apache setting where needed. And, of course, your html-header: ‘< meta http-equiv="Content-type" content="text/html;...

Read more »

PHP(6): ASCII / UTF-8, String Handling Issues

April 12, 2010

There is no, built-in, limitation in string length in PHP. String is a type in PHP and it is a series of characters. A string is an array of (1 byte) characters. PHP has had no native support of Unicode, UTF-8 or otherwise. PHP6 will have native support for Unicode / UTF-8. ASCII (not ISO-8859-1, etc.) is a subset of UTF-8 and that UTF-8...

Read more »

SQL db Injection, Cross-Scripting, RFI, and LFI

March 27, 2010

It is possible for a hacker to enter the following seemingly innocuous text into the UserName textbox to gain entry to the system without having to know a valid user name and password: ‘ Or 1=1 — The hacker breaks into the system by injecting malformed SQL into the query. This particular hack works because the executed query is formed by the concatenation of...

Read more »

Comparing OOP in php, java, and C++

March 18, 2010

Sample introductory Object Oriented Programming code in php, java, and C++ showing the similarities and differences. Never-the-less, OOP, despite all the bragging we hear about it, is a lot more expensive to write and to maintain than clean structured code. The reality of it does not live up to the theory, and the hype is "smoke and mirrors" propaganda, unfortunately. This simplest of introductions...

Read more »

Original Technology terms translated

February 25, 2010
Original Technology terms translated

Just for the fun of it: (found this a long time ago) Hope you enjoy it also!

Read more »

accessing a MySQL db

February 12, 2010

4 sample C utility programs that came with MySQL 1. connect_test.c 2. select_test.c 3. insert_test.c 4. list_test.c They came with the disclaimer below. /* connect_test.c A program to connect to a database. ********************************************************************** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation;...

Read more »

screen I/O pgm

February 10, 2010

screen I/O pgm in C & Pascal This program will go through a list of songs, throwing out one song or another until it finds a total time that most nearly matches the target time. It will display and write to a (text) file the new (sub) list and, separately, the song(s) that it threw out. What was surprising was that with only 1...

Read more »

php Number Formatting, Rounding, and Incrementing

February 10, 2010

Rounding "The round() function rounds the number passed in to the specified number of decimal places. If the decimal places is a negative number then the numbers to the left of the decimal place are rounded. If the decimal places parameter is not passed in then it defaults to zero and will round as an integer. 5 is round up and < 5 is...

Read more »

[C] File I/O and params

February 7, 2010

Simple example of file I/O, buffering, and input parameters. The pgm breaks a file into diskette (or any) size pieces. if the parameters are not correct, instructions are written to the screen. #include /* BREAK UP . C */ #define FALSE -1 /* +----------------------+ */ #define TRUE 0 /* | This c program is to | */ FILE *input_file_pointer ; /* | break a...

Read more »