HTML canvas resize and mouse coordinates

If you are using canvas with predefined width and height you probably know that resizing the window and canvas result in size not always the same as the screen.

This is annoying especially for retrieving mouse coordinates exactly matching with the canvas size instead of the window size.

Here is an idea on how to stretch the canvas and still keep the coordinates correct for the original dimension:

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Yii CSqlDataProvider sort

In order to sort Yii CSqlDataProvider you have to pass CSort() object to it.

In case the CSqlDataProvider is not sorted you should probably check your query passed to the object. Pay attention not to add a semicolon at the end of your query.

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Redirect with Timer in PHP

How you can make a redirect with PHP after a specific number of seconds ?

There are three options available:
The first one is to use a meta refresh

or a javascript function:

You can however use the PHP function header with the following sintax:

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Image (of unknown size) vertically centered inside a div in css

You may have encountered the complexity of centering an image inside a div vertically similar to what was possible with table cell (<td>) and valign property (valign=middle)

Here is an example on how to do it with CSS

image

 

image

 

image

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Amiga UAE experiment page – HTML Javascript emulator online

Scripted Amiga Emulator is an online emulator of Amiga demo and games running on your browser.

The site is the homepage of the project SAE, an experimental Amiga emulator in pure JavaScript and HTML5. SAE is based on WinUAE and does use the AROS-kickstart replacement. For more details, please see the description.

You can access the emaultion from: http://www.scriptedamigaemulator.net

For additional information on the emulator: http://www.scriptedamigaemulator.net/readme.htm

The Amiga is a family of personal computers sold by Commodore in the 1980s and 1990s. Based on the Motorola 68000 family of microprocessors, the machine has a custom chipset with graphics and sound capabilities that were unprecedented for the price, and a pre-emptive multitasking operating system called AmigaOS (source wikipedia).

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Prevent iCloud backup of Phonegap’s localstorage

In a defalt setup (Phonegap 2.8.1), localstorage is marked for backup to iCloud. This may get your app rejected by Apple, depending on the size with the following rejection motivation:

The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be backed up by iCloud.

To prevent this to happen you can use the BackupWebStorage option in config.xml file. You can set BackupWebStorage to “none” or “local

To verify how much data the app is storing Apple suggests the following procedure:

  • Install and launch your app
  • Go to Settings > iCloud > Storage & Backup > Manage Storage
  • If necessary, tap “Show all apps”
  • Check your app’s storage
Facebooktwittergoogle_plusredditpinterestlinkedinmail