-
Stop Using the PHP Error Suppressor “@” and “or die”
Posted on August 28th, 2010 No commentsIt annoys me when I see tutorials for learning PHP with code like this: $fd = @ file ( "doesnotexist" ) ; and this: $md = mysql_connect ( "localhost" , "user" , "pass" ) or die ( "Could not connect!" ) ; It’s bad practice in the real programming world and shouldn’t happen. The at symbol (@) is used to silence any errors caused by calling a function as shown above, when proper error handling should be implemented. Similarly, the practice of using “or die” to error check needs to stop being taught.
Read the rest here:
Sphere: Related Content
Stop Using the PHP Error Suppressor “@” and “or die”
17, 5, Class, File, ICO, James, OS, PDO, Program, RDP, SQL, Top, Wordpress, ad, amp, art, asgrim, asgrim.com, at, catch, check, code, coding, csv, die, error, exceptions, fun, function, functions, handling, host, http, ice, image, images, in, include, ing, int, language, like, live, load, me, mysql, no, not, or, personal, php, press, programming, smile, stack, suppressor, symbol, to, tutorial, tutorials, ua, user, when, word, world, wp, www asgrim, catch, Class, csv, functions, hatred, image, language, php -
Alternative to array_merge merging many arrays
Posted on July 8th, 2010 No commentsI have a case at work where I needed to go through a big list of arrays, and add them to a new master array. It turns out this is incredibly slow when adding many large arrays to a larger array. The alternative to this if you don’t care about keys or duplication of values is to just add it into the array
Follow this link:
Sphere: Related Content
Alternative to array_merge merging many arrays
17, 5, Class, ICO, James, OS, RDP, Wordpress, ad, amp, anyone, array, array_merge, asgrim, asgrim.com, car, case, code, coding, data, dataset, duplicate, get, help, http, image, images, in, include, ing, int, key, large, like, list, live, loop, me, merge, method, new, no, one, php, press, process, return, simple, smile, solution, something, time, to, ua, value, values, when, word, work, wp, www amp, asgrim.com, creamy, degree, each-as-well, include, int, list, merge, normally-enough, process, values -
Adding Extra Security – Encrypting Passwords For Multiple Users
Posted on June 26th, 2010 No commentsAs many of you probably know, I’ve been working for quite some time on a project called Private Passwords . It is an online password management tool which stores your passwords for any site and allows you to retrieve them from anywhere in the world. One of the things that has niggled me for a while was the fact that the encrypted passwords were all encrypted using an AES encryption key , but had no real barrier if someone somehow managed to get hold of the AES key
See the article here:
Sphere: Related Content
Adding Extra Security – Encrypting Passwords For Multiple Users
17, 5, Brilliant, FAIL, IDE, James, Kelvin, Someone, ad, amp, art, asgrim, base, blog, busy, check, code, coding, company, data, database, decryption, e-mail, encrypting, encryption, exam, fact, form, forms, get, home, http, import, important, in, ing, int, key, less, mail, management, me, multiple, name, no, not, one, password, passwords, private passwords, project, security, share, site, solution, sw, system, time, tip, to, uk, user, username, when, word, work, world, www busy, check, forms, int, Kelvin, kelvin-at-work, key, password, private passwords -
Replacing text in MySQL text fields
Posted on April 19th, 2010 No commentsI didn’t even think you could do this: UPDATE table SET something = REPLACE ( something , 'oldtext' , 'newtext' ) ; How handy! For replacing text in MySQL tables that is… not for anything else really.
View original post here:
Sphere: Related Content
Replacing text in MySQL text fields
-
isset fail
Posted on April 8th, 2010 No commentsSrsly PHP, why can’t I do this: $value = isset ( $myGPCWrapper -> Get ( "value" ) ) ? $myGPCWrapper -> Get ( "value" ) : $default ; Resulting in this: Fatal error : Can’t use method return value in write context in /path/to/my/script.php on line 21 And instead I have to do this: $foo = $myGPCWrapper -> Get ( "value" ) ; $value = isset ( $foo ) ? $foo : $default ; or $value = isset ( $_GET [ 'value' ] ) ?
Read the original:
Sphere: Related Content
isset fail
-
Double quotes in INI files loaded with parse_ini_file
Posted on March 1st, 2010 No commentsWriting a bit of PHP tonight and found that if you use parse_ini_file to load an INI file in PHP, there is a slightly hacky way of having double quotes in strings. For example, I tried these: somevalue = "This " "string" " has quotes" somevalue = "This " string " has quotes" But none of them worked! Turns out a quick look at the PHP manual reveals a simple (but a bit hacky) solution to this is to define a constant e.g. QUOTE to be “, and use that in the INI string
Read more from the original source:
Sphere: Related Content
Double quotes in INI files loaded with parse_ini_file
EU, File, James, ad, amp, asgrim, coding, config, double, escaping, exam, fine, fun, function, http, in, ing, ini, light, load, me, no, one, parse_ini_file, php, php5, quote, quotes, setting, simple, solution, string, to, ua, value, work, www double, escaping, exam, File, having-double, ing, setting, simple, work -
Announcing My New Website
Posted on February 8th, 2010 No commentsIt’s been live for a couple of weeks now, although I haven’t done much promotion of it, so here is word of an “official” announcement of my new portfolio site. Please take a look around and if you have any constructive criticism, feedback or advice, feel free to let me know through the usual channels… So without further ado, I pronounce www.jamestitcumb.com officially open!
Excerpt from:
Sphere: Related Content
Announcing My New Website
17, 5, James, ad, amp, coding, design, development, freelance, http, ice, in, live, me, new, no, one, open, promotion, site, titcumb, to, ua, web, website, weeks, word, www design, done-much, feedback-or-advice, feel-free, James, know-through, live, officially-open, promotion, the-usual, usual, weeks -
Question: How does source control work in a non-distributed environment?
Posted on February 5th, 2010 No commentsAt our company we currently all work on one shared network drive. The source code is not under any kind of source control, which for me is a big no-no. I’d love to be able to set up SVN and us all work of separate repositories and just commit back to a trunk or branch, but our tech manager doesn’t agree.
Continue reading here:
Sphere: Related Content
Question: How does source control work in a non-distributed environment?
17, CVS, Eclipse, File, James, OS, SVN, amp, auto, change, check, code, coding, commit, company, control, fine, form, http, ical, in, ing, int, issue, linux, me, network, no, not, one, open, open to suggestions, problem, repository, scm, share, solution, something, source, tech, to, tom, ua, update, vcs, version, windows, work before-it-takes, check, commit, linux, network, situation, source-control, tech -
Very Exciting – HipHop by Facebook
Posted on February 2nd, 2010 No commentsWell this evening Facebook have revealed what PHP developers globally have been speculating about and revealed their big secret . And boy, this could really change the landscape of PHP as we know it. I’m a great fan of compiling PHP for one reason or another, but I’ve never seen it reliably work.

Read the original:
Sphere: Related Content
Very Exciting – HipHop by Facebook
17, 5, Class, James, News, OS, RDP, Read, Search, Wordpress, Zend, action, ad, amp, apache, blog, book, box, change, code, coding, compile, compiling, convert, developers, development, early, engine, extensions, face, facebook, feature, form, forward, gap, gaps, get, hiphop, http, ical, image, in, ing, landscape, language, left, live, load, logo, magic, me, new, no, not, one, php, press, roadsend, send, site, table, test, title, to, twitter, type, ua, upload, user, variables, view, web, website, word, work, wp, www code, compile, development, from-the-php, ical, News, php, platform-which, variables -
MySQL gotcha when using non-compulsory foreign keys
Posted on January 27th, 2010 No commentsI’m just writing a query at the moment that filters out test records from a database. These records have a foreign-keyed value that identifies test apps, e.g. a table with: id name 1 TEST 2 ANOTHER_VALUE 3 SOMETHING_ELSE This is joined onto the main data table, sensibly with a query like this: SELECT * FROM the_data LEFT JOIN the_values ON the_data.some_value = the_values.id WHERE the_values.name != 'TEST' The gotcha is however, that this doesn’t work as you’d expect
Read more here:
Sphere: Related Content
MySQL gotcha when using non-compulsory foreign keys
17, Eye, IDE, James, SQL, amp, base, check, coding, data, database, filter, gotcha, http, in, ing, join, key, left, like, me, mysql, name, no, not, null, query, record, simple, solution, something, table, test, to, value, values, work amp, base, gotcha, identifies-test, instance, joined-onto, null, onto-the-main, query, record, simple, simple-once, table, work












































