Archive for the 'Software' Category

Controlling the IE7 “Shrink to Fit” print setting using JavaScript

Friday, November 30th, 2007

You may have noticed that printing in Internet Explorer 7 has a new feature - "Shrink to Fit". In some situations, such as when pages are in an iFrame, "Shrink to Fit" is always applied by default. For general web pages this feature may be appreciated, but in a web application where developers want to control the layout of the page, and perhaps generate reports, we do not appreciate IE7's changing the print layout at all.

If you have not been challenged by this behaviour yet, don't worry - you will! And when you do, here is the solution.

Instead of the typical "print()" command in JavaScript, use:


document.execCommand('print', false, null);

Or if you are wanting to print a document inside an iFrame you can use something like:


window.frames(0).focus();
window.frames(0).document.execCommand('print', false, null);

Note: This solution is for Internet Explorer 7 only - I leave it up to you to do the browser detection.

Debugging in Zend Studio without Zend Platform

Monday, June 4th, 2007

I have been using Zend Studio for quite a while now as my primary PHP IDE. To get the powerful remote debugging and profiling that comes with the tool you used to have to install Zend Studio Server as well. With the release of version 5.5 however, Zend stopped shipping Studio Server and forced developers to install the Zend Platform instead. This is a commercial tool (free to developers) available from Zend that offers PHP acceleration, caching and other features … that I don't want! I just want my debugging back, without having to bloat my local server with software I will not use elsewhere - especially when the Zend Platform does not support APC, which we run on our servers, and it also broke my web application.

It turns out that we do not need the Zend Platform at all. As part of the PDT Eclipse project Zend has made available a standalone version of their debugger. This can be downloaded from here: http://downloads.zend.com/pdt/server-debugger/

Then you just need to put the .so or .dll file in the correct location and add a few lines to your PHP.INI file and you are away. Here are the lines I had to add to my PHP.INI, which is running inside a Debian VMWare image. Note the commas separating the IP numbers - this took me a few goes to work out as the examples showed spaces or forward-slashes which didn't work for me.

zend_extension=/etc/Zend/ZendDebugger.so
zend_debugger.allow_hosts=192.168.1.3,192.168.220.1,192.168.150.1,127.0.0.1,192.168.220.10
zend_debugger.expose_remotely=always

Why did Zend make this so hard to work out? Reading on different blogs and through the Zend forums highlights that this issue has been a source of frustration for many developers. Grrrr…

Google Gears Enables Disconnected Web-Apps

Thursday, May 31st, 2007

Google Gears is an open source browser extension, less than 1Mb in size, that lets developers create web applications that can run offline. There are two main ways the extension can be used - by embedding the API or runtime software in an application you distribute to end users, or by writing a web application which makes use of installations of Gears on end-users' computers.

What problem does it solve?

Web developers write software for … the web. For applications that run via a browser that is connected to the Internet. Google Gears will take web applications to the desktop - enabling Web applications to work offline. A user will not be required to be connected to the Internet to use the application.

How does it work?

First of all web applications will need to detect whether or not Google Gears is installed on a user's machine. If Gears is installed, then the application will be able to access the Google Gears APIs from JavaScript code. If Gears isn't installed, the user can be directed to a customized installation page.

The APIs can then be used to access Google Gears three core features:

  • A local server, to cache and serve application resources (HTML, JavaScript, images, etc.) without needing to contact a server.
  • A SQLite database, to store and access data from within the browser.The Database module is used to persistently store an application user's data on the user's computer. Data is stored using the same-origin security policy, meaning that a web application cannot access data outside of its domain. Standard SQL can be used to access the data, and full-text indexing is supported using SQLite's fts2 extension.
  • A worker thread pool, to make web applications more responsive by performing expensive operations in the background. In web browsers a single time-intensive operation, such as I/O or heavy computation, can make the UI unresponsive. The WorkerPool module runs operations in the background, without blocking the UI.

What browsers are supported?

The final release will run on the following browsers:

  • Apple Mac OS X (10.2 or higher)
    • Firefox 1.5 or higher
    • Safari
  • Linux
    • Firefox 1.5 or higher
  • Microsoft Windows (XP or higher)
    • Firefox 1.5 or higher
    • Internet Explorer 6 or higher

What next?

To find out more about this project you can visit the Google Gears website. From there you can download Gears and then install some of the sample applications available.

Some developers are already playing with Google Gears and sharing their experience and their plans. For example you can listen to a podcast about Dojo Offline being ported to Google Gears, or take a look at RSS Bling moving to Google Gears.

This is definitely a project to watch. With Google obviously coordinating with the efforts of popular projects such as Dojo, as well as supporting all the major browsers, there are some interesting possibilities opening up for web applications.

Linus Upson, the engineering director at Google, stated that the goal of Google Gears is to "create a single, standardized way to add offline capabilities to Web applications." Google is certainly on the right track … I'm off to have a play!

Generating Random Sample Data

Tuesday, April 17th, 2007

I found a very useful tool today - the Data Generator. It generates large volumes of random, custom data for use in testing software. The tool is a free download, and can generate data in the following formats:

  • HTML
  • Excel
  • XML
  • CSV
  • SQL

There is an online demo available that is limited to 200 results. Click here to find out more…

Zend Studio 5.5 with Zend Framework Support

Wednesday, November 15th, 2006

Zend FrameworkI have been waiting for an update to Zend Studio for a few months - particularly hoping for support of SubVersion 1.4. Zend delivers this and more in the beta release of Studio 5.5. One of the most exciting enhancements for me is the integration of support for the Zend Framework.

Here is a complete list of the feature enhancements in version 5.5:

Zend Framework Integration:

  • Enable code completion for Zend Framework
  • View Zend Framework classes and functions in the PHP Inspector View
  • View source and debug into Zend Framework code

Source Control:

  • Explorer: highlights file labels according to their status in source control (added, merged with conflicts, modified, not versioned and up to date)
  • Source Control file status highlighting is customizable (from the Preferences dialog)
  • Can easily switch between CVS and Subversion support
  • Support for Subversion 1.4

PHP 5.2:

  • New PHP 5.2 Support

General:

  • Installation support for Mactel (Install Anywhere 8 )
  • Support for antialiasing (via Preference settings)

Editor:

  • Supports opening URLs from the Editor using right click

Web Services Support (SOAP):

  • Support for URLs in SoapClient Constructors

Java:

  • Embedded Java code completion of packages and classes in PHP code
  • Configure the Workspace's default JRE / JDK
  • Configure project specific preferences
  • Nested Java code completion

Zend Platform 3.0 Integration:

  • View Zend Platform Events in a dedicated Events List window
  • Customize, sort and filter Event List entities
  • Limit number of visible rows and initiate auto refresh
  • View Events from user-selected servers
  • Direct access to Platform's Configuration dialog from the toolbar / menu
  • Configure Zend Platform's GUI URL and authentication information

IBM in the News: AJAX, DB2, LAMP

Friday, February 3rd, 2006

IBMThere have been some very exciting developments from IBM over the last few weeks. Here are four areas of major interest to me:

AJAX Toolkit Framework (ATF) Project

In January 2006 IBM announced the ATF Project. The goal is to extend the Eclipse platform to allow for extensible frameworks and exemplary tools for building IDEs (integrated development environments) for the many different AJAX runtime offerings such as Dojo, OpenRico, and Zimbra. These tools will contain features for developing, deploying, debugging and testing AJAX applications, which is not so easy to do using development tools of today.

The tools built upon these frameworks will include some very exciting features:

  • Enhanced JavaScript editing such as edit-time syntax checking;
  • An embedded Mozilla web browser;
  • An embedded DOM (Document Object Model) browser;
  • An embedded JavaScript debugger.

Open Ajax Initiative

On February 1st IBM and other industry leaders announced the "Open AJAX" initiative to promote the adoption of AJAX technology. This project is going to see collaboration between BEA, Borland, the Dojo Foundation, Eclipse Foundation, IBM, Laszlo Systems, Mozilla Corporation, Novell, Openwave Systems, Oracle, Red Hat, Yahoo, Zend and Zimbra.

The goal? To promote Ajax's promise of universal compatibility with any computer device, application, desktop or operating system, and easy incorporation into new and existing software programs.

DB2 Express-C

On January 30th IBM introduced a free version of its DB2 database. DB2 Express-C is the same database as IBM's commercial offerings but the company places limits on what kind of hardware it can run on. It can be deployed on systems with two processor cores or up to two dual-core chips on AMD or Intel-based servers. The memory limit is 4GB but there are no limits on the size of database or number of users.

This move really follows the footsteps of Microsoft with SQL Server Express, and Oracle with Oracle 10g Express Edition.

Already the LAMP-based community is showing interest in using DB2. For example ActiveGrid has just released an edition of its front-end development tool and server software to work with DB2 Express-C. DB2 offers some exciting functionality not found in PostGres or MySQL, such as the ability to combine PHP with DB2's native XML capabilities.

PHP Collaboration Project

This is now old news, but late last year IBM joined forces with Oracle, MySQL, Intel, Actuate, ADP, FileMaker, Schematic, StepUp Commerce, OmniTI, 100days.de, SugarCRM, bebe.com, and Marco Tabini (publisher of PHP Architect Magazine) in the PHP Collaboration Project. The initial objectives of the project are:

  • Zend PHP Framework: A Web application framework which will standardize the way PHP applications are built. The framework will accelerate and improve the development and deployment of mission-critical PHP Web applications
  • Engagement with the Eclipse Foundation: Zend is joining the IBM founded Eclipse Foundation as a Strategic Developer. Zend is now proposing to lead a project focused on PHP within Eclipse

 

I for one am enjoying seeing IBM partnering with other companies and projects to help formalise the future of AJAX and a PHP Framework / toolset. I haven't decided about DB2 yet for my everyday projects - but I will be taking a look for sure.

ReactOS: A Free Replacement of Windows XP?

Thursday, February 2nd, 2006

ReactOS Logo

While this is project is only in Alpha it is something to keep an eye on. Here is a quote from the ReactOS site as to the goal of the project:

The ReactOS® project is dedicated to making Free Software available to everyone by providing a ground-up implementation of a Microsoft Windows® XP compatible operating system. ReactOS aims to achieve complete binary compatibility with both applications and device drivers meant for NT and XP operating systems, by using a similar architecture and providing a complete and equivalent public interface.

You can check out some screenshots of the operating system in action.

Here are some interesting comments from Wikipedia:

ReactOS is primarily written in C, with some elements like ReactOS Explorer, written in C++. Various components of ReactOS are licensed under the GNU General Public License, the GNU Lesser General Public License and/or the BSD License. To ensure that no part of the OS is tainted with leaked Microsoft code, a total source code audit has been ordered by the head developers of ReactOS.
. . .
This is expected to set the project back by a lot as it could take years to complete the audit and rewriting of affected parts of the source code. This audit was done by creating a new repository and copying code from the old repository as it is audited.

It seems like the project has been aptly named - there should be plenty of "reaction" to this from all quarters…

Sage: The Firefox Atom & RSS Feed Reader

Saturday, January 28th, 2006

Sage Screenshot

If you are like me you are still figuring out the best way to manage your favorite RSS feeds. Today I discovered Sage, a Firefox extension that lets you read your RSS and Atom feeds inside your browser - which makes sense to me. It is very simple to use and is not cluttered with features I don't need. Here are some of the features I like about it:

  • Press "Alt-S" to toggle Sage on/off in the Sidebar.
  • Press the magnifying glass icon to auto-discover feeds on the current page.
  • Manage your list of feeds exactly like managing your bookmarks - you can sort them any way you like, rename them and place a seperator between them.
  • This is probably my favorite feature - Sage very quickly renders a column formatted list of the posts to read. See the image posted above for an example. The look and feel of this layout can be customised via CSS - in fact there are additional styles already created for you to download.

Catching up on the latest via RSS is now a logical extension of my browsing experience thanks to Sage

FireBug: The Ultimate JavaScript, DHTML, AJAX Debugger

Tuesday, January 24th, 2006

I only just wrote an article on Console² and I found something better - FireBug. FireBug is a new tool for Firefox that aids with debugging Javascript, DHTML, and Ajax. It is like a combination of the Javascript Console, DOM Inspector, and a command line Javascript interpreter.

FireBug is fairly simple - it adds a console to the bottom of every web page in Firefox. It enables the following features:

  • Mouse-over DOM Elements on the page
  • Type in JS expressions into the command line for execution
  • Inspect AJAX (XMLHttpRequest) responses as text or XML
  • Only show errors for the current page - previous data is cleared
  • Display JavaScript, CSS or XML Errors
  • Show a red dot in the Status Bar to indicate errors on the current page
  • Set preferences on what errors you want to see

If you are a developer you can even get your page to write directly to Firebug - instead of using "alert()" or other methods for debugging. There is even a tutorial on how to do this.

Yup, you have to install this one

Thunderbird 1.5 Released

Thursday, January 12th, 2006

ThunderbirdThe new version of Thunderbird was released yesterday. Thunderbird 1.5 introduces several new features including a software update system, spell check as you type, built in phishing detector, auto save as draft, and support for deleting attachments from email messages. Message filtering has also been improved with new filter actions for replying and forwarding. Saved search folders can now search folders across multiple accounts. A great update to a great product.