SwiftlyTilting: usability, reusability

Thursday, October 14, 2010

Don’t close your PHP tags!

I saw this post over at sitepoint about whether or not you should close your PHP tags. Apparently there is some debate, though to me it seems pretty clear the choice is to leave them out.

If you’re unaware, the closing ?> tag in PHP files is completely optional. It is only really required if you are mixing HTML and PHP code, which itself is not a particularly good practice. Leaving off the closing tag prevents any erroneous white space or random characters from being sent to the output. It reduces the amount of code and prevents a possible error from occurring.

I can’t really think of a good reason to leave them on (assuming your document is pure PHP). Perhaps if you are from an XML background you will feel compelled to close the tag, but it’s entirely unnecessary in PHP.

Multiple frameworks and libraries such as Zend, CodeIgniter, Drupal and others suggest you to leave off the closing PHP tag as part of their style guide or best practices documentation, and I suggest the same. This is especially important for WinBinder developers (or anyone who uses php-win.exe), where any output sent to the console immediately ends the script.

Some have suggested dropping the need for <?php from php files completely. It’s not a bad suggestion, though i sort of think of it as analogous to #!/bin/sh in unix scripts. Those tags don’t need closing tags either.

So go out there and remove all those nasty ?> tags from your code ;)

WinBinder 2010.10.14 released - WinBinder is a PHP extension for making Windows Applications

I’m now “officially” maintaining WinBinder, so from now on you can get the latest version of WinBinder directly from Winbinder.org’s download page

Read my tutorial on getting started with WinBinder.
Visit the Winbinder Forums if you need more assistance

Changes since 2010.10.01

Added in 2010.10.14
* Fixed bug with return values for wb_sys_dlg_open when using wbc_multiselect
* Made 3rd and 4th parameters of wb_send_message optional

Added in 2010.10.13
* Additional flag parameter for wb_sys_dlg_open that accepts the option WBC_MULTISELECT. If this is enabled, all selected files will be returned as an array.

Sunday, October 3, 2010

Winter 2.2.1 Released - Winter is an Interpreted language for MediaWiki

Here is an update for Winter, the Wiki Interpreter.

Changes include
* added ^o and ^c escape characters
* added + to allowed characters in function names and functions
* added #reset_all_vars function
* added ++ and — functions
* fixed bug with #strpos and #substr returning false when it shouldn’t
* added #is_numeric, #is_int and #is_string functions
* fixed bug with array assignment
* other minor bug fixes

Winter Homepage on Mediawiki.org
Winter Documentation

Download Winter 2.2.1
Downloaded 2883 times

Saturday, October 2, 2010

New version of Winbinder, the PHP extension for making Windows Apps, released

New version of WinBinder… with some actual NEW FEATURES

Download WinBinder 2010.10.01
Downloaded 2320 times
Tutorial on getting started
Winbinder Forum

This is a list of all changes since 0.46.190.

  • PHP 5.3 compatible
  • Unicode support added
  • Removed version checking from wb_windows.inc.php
  • Fixed memory leak in winapi library calls
  • Fixed bug where maximize wasn’t triggering WBC_RESIZE
  • Fixed bug where closing child windows would kill main window
  • Added WBC_NOHEADER style for ListView to disable the listview column header
  • Added WBC_MULTISELECT style for ListBox to that you can select more than one item
  • Added WBC_DEFAULT style to PushButton to make them display as the default button
  • ListView will respond to right clicks and fire WBC_RBUTTON
  • Window callback will pass WBC_GETFOCUS as an event when the window is focused
  • Window callback will respond to WM_HOTKEY(windows message) (experimental)
    New functions for use with the low level Windows API. These functions return pointers to callback functions, which are needed by certain WinAPI functions. The callback functions will send windows messages to the main Winbinder callback function, which will then trigger your PHP based callback function(s).

    • wb_get_midi_callback returns a pointer to MidiOutProc (can also be used for MidiInProc, WaveInProc, WaveOutProc or any similar callback) for use with functions like midiOutOpen
    • wb_get_enum_callback returns pointer to EnumWindowProc
    • wb_get_hook_callback returns a pointer to HookProc for use with various hooks.[/list][/list]

Finally got the time to merge my changes with Winbinder 0.5.0.. thanks to Ermac and Alec for their contributions to that version.

C source is included in the ZIP

Validate XHTML | Word Press