Archive for the ‘Uncategorized’ Category

a horror of php

Uncategorized | Posted by Gauthier
Apr 17 2014

To start off with PHP has always been on my list of acceptable languages to test things out with. Today i decided to add database queries and times to my tiny library to speed things up. The reason was after reading this article .After implementing a quick tally, My code all worked flawlessly, now it just needs something to display on the GUI.

Someone I know using my code suddenly had all of his code break. At first I couldn’t even guess what the problem was, but it boiled down to uninitialized PHP variables.

They write code like the top half. I change my function to be like the bottom half.

function x() { return 'z';}
function data() { throw Exeception(); }

$data[itemone]['array'][1.+2][x().y][$news][] = data;

echo '['.print_r($data, true) . ']';

// vs this little bit of logical code

if (array_key_exists('somedata', $otherdata)) {
$otherdata['somedata'] = array();

echo '['.print_r($otherdata, true) . ']';

The concept that PHP magically makes variables and nested arrays breaks my head a title.

I alerted them of the uninitialized variables, also I altered my function to check if the parameter in the function is an array.

if (!is_array($otherdata)) {
$otherdata = array();
if (array_key_exists('somedata', $otherdata)) {
$otherdata['somedata'] = array('timer'=>0);

echo '['.print_r($otherdata, true) . ']';

Programming magic

Uncategorized | Posted by Gauthier
Jan 31 2011

Almost anything can be done with a small bit of code. Doing it properly is the real problem. There are so many security risks, and things that can be injected in to your code.
I have a new website project I am going to be starting on. First I have to get the basic crud interface up. Time to find some basic templates.

Wordbook plugin success

Uncategorized | Posted by Gauthier
Aug 15 2010

One of the basic plugin for the site had a face-lift of sorts and now works with the latest version of Facebook. I have to mention it and see if it posts online.

A thought crossed my mind to redo some of the backend and have it work myself, however I seem to have the motivation of cat.