|
Home |
|
Written by Administrator
|
|
Wednesday, 03 June 2009 |
|
You may have notice that my site was displaying an error message across the top of the screen recently, due to my web host disabling "allow_url_fopen" in the PHP config (php.ini), which broke my Skype class that shows my Skype status. Today I finally got around to fixing it. Here's the code change I made, which should be easy to use as an example if you run into similar problems: Old Code: $num = file($this->url); $this->status = $num[0];
New Code: // Establish a cURL handle $ch = curl_init($this->url); // Set cURL options curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the cURL request $num = curl_exec($ch); // Close the cURL session. curl_close($ch);
$this->status = $num[0];
A little more code to do the same thing as before, but apparently this is safer than keeping "allow_url_fopen" enabled. |
|
Last Updated ( Wednesday, 03 June 2009 )
|
|
|
Written by Administrator
|
|
Thursday, 12 February 2009 |
|
As usual Microsoft has done nothing to make running multiple versions of IE on the same computer possible, but a creative hacker named Yousif at Tredosoft.com has released an installer that will install IE 3, 4.01, 5.01, 5.5 and 6.0 as standalone versions that can be run right alongside your copy of IE7 or IE8. Apparently it's been out since 2006, but this is the first I've heard of it and I'm quite glad I did. Shame on Microsoft for not making this easy from the get-go. UPDATE: I no longer recommend the above method because I've discovered very unpredictable behavior using the standalone versions of IE. I now prefer to simply set up separate virtual machines with full versions of each browser installed and just run them all in virtual machines. This way I can test IE 5.5 - 8 in both Win2K and WindowsXP and know that the browsers are behaving normally on all platforms. If you can't spring for a copy of VMWare, you can find some free alternatives.I hear Virtual Box is pretty good. |
|
Last Updated ( Sunday, 09 August 2009 )
|
|
|
Written by Administrator
|
|
Monday, 02 February 2009 |
|
On January 26th, Microsoft released a new version of their latest IE8 release candidate, RC1. According to the IE8 developer blog, there's been many improvements since the last beta, including better IE7 emulation, better CSS 2.1 compliance and many optimizations for handling AJAX design patterns, better introspection tools and many other goodies. Supposedly there's been a lot of work put into bringing the Javascript engine up to speed with the other browsers so that scripts which work fine in Firefox should theoretically work in IE8 without all the headaches of IE6&7's horrible attribute handling that forced everyone to put try/catch statements around everything to avoid triggering javascript errors when attempting to access undefined attributes in the IE javascript engine. I personally don't know why they don't just use the Mozilla javascript engine, which is what everyone else seems to be doing these days. It makes no sense to fork a common language like JavaScript...but that's another story. Sadly, you still can't install the IE8 Beta alongside your current version, but if you're willing to be a guinea pig or have no critical work that depends on IE6 or 7, head on over the the Microsoft IE8 Beta download page and get yourself a copy. Be sure to check out the IE8 developer blog for some more interesting information about the new version. |
|
Last Updated ( Monday, 02 February 2009 )
|
|
|
Written by Administrator
|
|
Sunday, 01 February 2009 |
|
If you're a web developer that had the misfortune to replace your old IE developer toolbar with a newer version, you may have seen some brand new javascript errors appearing in your sites only in IE. You may see a Just-In-Time Debugging window that looks like this . If you debug the javascript error in MS Script Editor it will break at a remote procedure call: [540] C:\Program Files\Internet Explorer\iexplore.exe ...and if you continue debugging from there you'll get the following error message from Visual Studio: Microsoft JScript runtime error: Object doesn't support this property or method. Tracing the code reveals this incredibly sloppy function: function ParseDoc(doc) { var aRules = GatherRulesFromDoc(doc); collSelectors = parser.Parse(aRules); // Set quirks mode if necessary if("BackCompat" == doc.compatMode) { for(var i = 0; i < collSelectors.Count; i++) { collSelectors.item(i).SetQuirksMode(true); } } } The red line above is what causes the error in IE6&7. Seasoned javascript developers will notice the complete lack of error handling here. I'd expect this from something I'd written myself, but not from an offical Microsoft product targeted towards developers who are likely to have strong opinions on poorly written code. It blows my mind that this problem has been around for many months, has an easy fix and MSft just hasn't bothered to release a fix. A single try/catch statement wrapped around the offending code is all that is required...literally 1 line if elementary javascript. Of course, since MSFT products are not open-source, the people who know the solution are not allowed to release a patched binary of the toolbar, so to fix this problem, you'll need to get a resource editor and follow the instructions from this nice hacker at NanoAnt. Of course, disabling the toolbar entirely and doing all your development in Firefox is another popular option. |
|
Last Updated ( Monday, 02 February 2009 )
|
|
|
Written by Administrator
|
|
Friday, 16 January 2009 |
I hate the fact that I constantly need to fix the default sort on my inbox every time I open Thunderbird. After much hair-pulling I discovered a seven year old bug report and feature request which I used to cobble together the solution below. I don't claim to entirely understand why this works, but it works for me in Thunderbird 2.0.0.19.... |
|
Last Updated ( Sunday, 01 February 2009 )
|
|
Read more...
|
|
|
Written by Administrator
|
|
Monday, 05 January 2009 |
|
Adobe and Intel just released news that they will be collaborating on a new version of Flash video that will be optimized for hi-def and will run in the Flash Player, FlashLite and various embedded systems such as set top boxes, phones and other devices. Intel will be working on a "system on a chip" that will be specifically optimized to play Flash video on set top boxes and other devices. This officially ends any fantasies that DIVX fans may have had about DIVX being picked up by Adobe as a potential back-door into the DVD player and set-top device market. It may take some time, but eventually I expect most device makers to drop support for DivX and focus on Flash video compatibility. DivX has quite a head start, but Flash's ubiquity across platforms and devices will eventually win out. DivX has proven to be a miserable failure at infiltrating the streaming video market and generic MPEG4 and h264 codecs have really stolen most of DivX's opportunities in the non-streaming space. They have basically reverted to being a convenient codec for movie pirates (though even there, XviD seems to rule) or for software developers looking for a convenient MPEG4 solution to integrate into their software. DivX has been branching out into h264 codecs, but I see the same obstacles to their success with h264 as with MPEG4. Too many competitors, including open-source solutions, will make it tough to command a premium for their codec technology. |
|
|
Written by Administrator
|
|
Saturday, 01 November 2008 |
|
I've spent countless hours, weeks actually, trying to set up some older versions of php/mysql on Linux for testing purposes. Sadly, there's still a real need for PHP4/MySQL4 development for legacy applications and NO good ways to manage multiple versions on one machine. In particular, many people running the Xcart 4.0 branch are running on PHP4 and MySQL 4.1. Trying to run these sites on MySQL5 or PHP5 is impossible without serious modifications to the source code. So I decided to set up a test server in or two in VMWare and get the versions I needed installed. I wanted to be able to switch versions of php and mysql at will. This proved to be impossible with every flavor of Fedora that I tried and hours of searching revealed no better solutions for other Linux distros. Rather than detail my incredible waste of time trying to install everything from source, I will tell you my final solution, which is to use XAMPP for Linux to install your preferred combination of php/mysql for testing. It's not a perfect solution, but the XAMPP package will let you run various flavors of PHP/MySQL and lets you switch between php4 and php5 at will when you start your servers. You are stuck with the versions of php4/php5/mysql included in whichever XAMPP distro you choose, but if you browse the XAMPP archives, you can find a version with most combinations of php/mysql that you will need to test on. If you click the "release notes" icons next to each distro at SourceForge you can see what versions of PHP/MySQL are included. In particular, XAMPP version 1.4.16 includes PHP 4.4.0, PHP 5.0.x and MySQL 4.1.14. So it's a great combination for people working on transitional PHP/MySQL apps. After MySQL 4.1.x the SQL interpreter was changed to comply with strict SQL standards and it broke some JOINs in x-cart and many other PHP apps. If you have a client that can't or won't upgrade their apps to be compatible with the newer versions of PHP/MySQL, you almost have no choice but to run your own test server with older versions of PHP/MySQL and XAMPP has made this a super-simple task. The only problem I've found is that the instructions are non-existent. I did find this how-to , but that's about it. They don't tell you that all you need to do is untar the XAMPP distro and drop the"lampp" folder into your Linux "/opt/" directory. That's the big trick, it needs to be in the /opt/ directory. Then cd into the /opt/lampp directory and type "./lampp start". That's it! Everything resides in subfolders in the /opt/lampp/ directory, so you can tweak your configuration. If you have problems not being able to start XAMPP properly due to existing services not being uninstalled, you'll need to stop your existing services first and then preferably uninstall all your existing copies of php, mysql, httpd etc. If you installed your previous copies from source, you can simply go to their source directories and type "make uninistall", otherwise you can use yum or rpm, which is a whole other story. You may also need to search for existing processes from your old mysql or httpd servers and kill them. I had to manually kill my previous mysql process by searching for "mysql.pid", then opening the "mysql.pid" file to find out the actual pid I needed to kill. Once you know the pid simply type "kill xxxx" where xxxx is the pid. Also, you may get an error with phpMyAdmin and other apps complaining they can't connect to "localhost.localdomain". To fix, this, simply add the following line before any other lines to /etc/hosts: 127.0.0.1 localhost
That was the only major problem I had to fix to get it XAMPP working on my test machine running Fedora Core 4. I just can't believe I wasted over a week messing with source files before I stumbled onto this. I know there's got to be a better way than using XAMPP because I saw someone do a demo at a PHP conference where they ran a test script through 8 different versions of PHP from the commandline. It seems like there should be a nice GUI for Linux that will just let you install a bunch of versions of PHP and MySQL and arbitrarily switch between them. If anyone out there knows of such a thing please use my contact form to let me know. |
|
Last Updated ( Saturday, 01 November 2008 )
|
|
|
Written by Administrator
|
|
Wednesday, 24 September 2008 |
|
Recently I ran into a very frustrating character encoding problem when trying to add a Wordpress feed display to X-Cart. I was using PHP's SimpleXML object to parse and display the feed in the home.tpl file in x-cart. The database and feed were in UTF-8 format and all the apostrophes and some other character codes were being converted into garbage when they were displayed in X-Cart's templates, but nowhere else. They looked fine in my feed readers and in the Wordpress templates. I initially blamed PHP's SimpleXML object, then LibXML, then decided it was Apache's fault or that the web host had misconfigured the server to force the character encoding to ISO-8859-1. After much troubleshooting and ranting, I finally realized that X-Cart's language settings were overriding the character encoding meta tag defined in the page template and forcing the browser to use ISO-8859-1 encoding. Apparently x-cart injects a character-encoding header into the output before it renders the Smarty templates, so even if you define the character set in your home.tpl file, or meta.tpl file, x-cart will still inject the character encoding defined for your default language into the HTTP headers via PHP's header() function. This isn't necessarily a bad thing, but it was extremely infuriating to track down and I think most template designers probably expect to be able to insert the character encoding into their templates manually and have it work. So to get my UTF-8 blog feed to display properly in X-Cart required going into the "Language" menu of the X-Cart admin area and changing the encoding setting for English to UTF-8. After years of using and modding X-Cart I've never needed to change this setting until today, but it's an important one to know about if you value your sanity. |
|
Last Updated ( Wednesday, 24 September 2008 )
|
|
| << Start < Prev 1 2 3 4 5 6 7 8 Next > End >>
| | Results 9 - 16 of 62 | |
|
Who's Online
We have 13 guests online
|