RSS
 

Archive for the ‘Development’ Category

What to do if you see your PHP script relies on session side-effect error message.

03 Sep

I came across this error a few times, enough to where I dug around and finally found the real fix to suppress the error completely.

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0

I was able to suppress the error by properly upsetting a session variable:

  //replace this:
  $_SESSION[$field] = null;

  //with this:
  unset($_SESSION[$field]);

The warning is triggered by assigning to the $_SESSION super global directly. By using unset(…) we are not assign null directly.

VN:F [1.9.4_1102]
Rating: 6.5/10 (4 votes cast)
VN:F [1.9.4_1102]
Rating: +2 (from 2 votes)
Retweet
 
Comments Off

Posted in Development, PHP

 

C is for Cookie

03 Sep

A cookie is simply a unique id to identify the visitor when they return, and for subsequent page requests.

Cookies should only store encrypted data, as they are stored on the client machine, and can be readable by other applications, virus, etc.

VN:F [1.9.4_1102]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet
 
Comments Off

Posted in Development

 

Google Code Search Released

31 Aug

Finally, Google has released a code search that enables you to search through source code.

Similar to koders.com and others.

I haven’t seen too much of my own publical GPL code in here, but it’s a start.

The question is: Can I search for special characters?

VN:F [1.9.4_1102]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet
 
Comments Off

Posted in Development, Linux, Open Source

 

Learn to write “Proper Perl”

24 Aug

Perl::Critic is an excellent way to not only validate your Perl source code, but to learn some tips from the Perl monks who have contributed to the Perl::Critic documentation.

I uploaded one of my latest CGI scripts written in Perl to see how good my Perl chops are…turns out I picked up a few tips that I was unsure about in my previous Perl scripts.

A few simple techniques can be used to make your code more standardized in the event that your are not the only person reading it.

The Perl Critic web site has a nice usable web interface for uploading source code and checking its validity — although for obvious reasons if you’re working on enterprise code you should probably download an install the Perl::Critic CPAN module on your own server.

VN:F [1.9.4_1102]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet
 
Comments Off

Posted in Development, Open Source, Perl

 

Selling Text Links

24 Aug

Earlier tonight, I came across this handy link worth calculator. It’s got a nice ajax interface, and does the calculation for you based on some general criteria.

Now that I’ve thought about it, I went ahead and added an advertising campaign banner to the search engine forum to try and sign up more advertisers.

VN:F [1.9.4_1102]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet
 
Comments Off

Posted in Development

 

Pass by Reference in PHP5

14 Aug

PHP5 has a Pass-by-reference notation: &$bar in line 3 as seen here in the parameter to a function bar(); Basically, this is just a point from the sub routine’s “$bar” back to the caller’s $foo. In this case, a change to the reference variable $bar is reflected in the main variable $foo.

“bar points to/references foo”
$bar => $foo;


1

Output:


foo:foo
bar:foo
bar:bar
foo:bar

Recommended reading: PHP 5 Objects, Patterns, and Practice

VN:F [1.9.4_1102]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet
 

JavaScript apps in Firefox…broken?

14 Aug

I don’t know if it’s just me or what, but with FireFox, older and latest releases, I’m seeing a lot more unusable javascript apps in the last few weeks.

Mainly Gmail links don’t open, and also wordpress 2.0 javascript editor seems to be really flaky.

If anyone has seen the same with FireFox let me know. I’m curious if it’s me (this happens on 3 windows machines). Or if it’s an extension that is interfering with the javascript DOM on FireFOx.

VN:F [1.9.4_1102]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.4_1102]
Rating: 0 (from 0 votes)
Retweet