PHParray_unique returns NULLI am dealing with legacy code written by another team and someone asked me why his images were not showing up... Took me an hour to dig that one out. Simply because the optional second parameter to array_unique() was only added in php 5.2.9 and we were using 5.2.4 ... Therefore it was generating an error that was hidden (because of error_reporting) and returning null. I removed the second parameter and VOILA! Too bad the sysadmin does not allow us to upgrade PHP. :)
Indentation: Tabs vs. SpacesThis is one of these archaic question. Short answer: Spaces, and only spaces. Long answer:Origins Concept
Reading book: Zend Framework 1.8 Web Application DevelopmentI am currently working on a PHP project which involves creating web services with Zend Framework. Selenium and popups.I wanted to write a selenium test script to validate calculation done in a page to make sure they match those of another page. I used the store* functions to grab the values from the source. My problem was that the second page was actually a popup. There have been some reported problems with selectWindow and selectPopup and waitForPopup functions. They are not always working with Firefox 3.x. They were not working for me. So I thought that maybe I could have the page NOT popup when it's being accessed by selenium. That way I will not have to use these broken functions.
Detecting mod_rewrite using PHPThe following post is about a solution to the problem of detecting if mod_rewrite is enabled or not. I worked on a project where CS-CART was used and after it was installed, it was complaining that the mod_rewrite module was not installed. I knew that mod_rewrite was installed so I looked at the code. The code that was detecting if mod_rewrite was enabled was assuming the DNS for the domain was working fine. It was doing an HTTP request. This means that if we installed the store in a temporary environment where the hostname is fake (put in the HOSTS file for example) then it would think mod_rewrite is NOT installed or enabled. I think I came up with a better way and here it is. I submitted it to the CS-CART staff, we'll see if they like it.
Watching a file on diskPaul Reinheimer wrote an article on a bug he was trying to solve. He wrote:
If you want to watch the last lines of a file to see when it changes, try this in linux:
Under used resources - Get all the answersIn any development shop with more than one developer, there is always at least one developer that is THE reference for the project/platform/framework/cms that most developers go to with questions. Let's face it, developers are lazy. I mean very lazy. I am lazy! So we look for the easy way. The path with the least resistance. Sometimes (maybe most of the times) that is going to see that senior developer and asking him questions.
I am profiling too!Earlier this year (march 2007) I went to the PHP Quebec Conference in Montreal where I met Rasmus Lerdorf. He gave a very interesting presentation where he talked about various things, including something called calgrin, xdebug and cachegrind. It seemed very interesting but I did not have the opportunity to try it. Until recently that is, now that my project is in beta in terms of features and that we need to tune it to increase performance. I saw this post and it reminded me of these tools.
Drupal Performance TuningI am currently working on a project using Drupal 5.1 for a social networking site. Each page on the development site would take 3-9 seconds to load and on the production environment would take 2-7 seconds. Way too long. I was able to easily increase performance.
Storing Socket in $_SESSION variableIt is not possible to store a socket connection in a session variable in order to keep it open. Instead, use the PHP function pfsockopen to open a socket connection and leave it opened between web requests. This function only allow the connection to be persistent when you are not using CGI mode or running the script as a CLI script. However, the pfsockopen function does not allow you to keep track of the socket on a per user basis. It will simply return you the one that was opened previously.
|
SearchDrupal ContributionsMake a Payment to Christian Roy |