Search Results

Search found 3 results on 1 pages for 'peterbelm'.

Page 1/1 | 1 

  • Stop Observing Events with JS Prototype not working with .bind(this)

    - by PeterBelm
    I'm working on a Javascript class based on the Prototype library. This class needs to observe an event to perform a drag operation (the current drag-drop controls aren't right for this situation), but I'm having problems making it stop observing the events. Here's a sample that causes this problem: var TestClass = Class.create({ initialize: function(element) { this.element = element; Event.observe(element, 'mousedown', function() { Event.observe(window, 'mousemove', this.updateDrag.bind(this)); Event.observe(window, 'mouseup', this.stopDrag.bind(this)); }); }, updateDrag: function(event) { var x = Event.pointerX(event); var y = Event.pointerY(event); this.element.style.top = y + 'px'; this.element.style.left = x + 'px'; }, stopDrag: function(event) { console.log("stopping drag"); Event.stopObserving(window, 'mousemove', this.updateDrag.bind(this)); Event.stopObserving(window, 'mouseup', this.stopDrag.bind(this)); } }); Without .bind(this) then this.element is undefined, but with it the events don't stop being observed (the console output does occur though).

    Read the article

  • Logging fatal/parse errors in PHP5

    - by PeterBelm
    I'm writing an error logging service that will be integrated into websites running on my server, that will email me error batches, etc. So I've been trying to find out if there's a way to handle fatal and parse errors, however not using the tricks to handle it in PHP code (output buffer, shutdown function). I'm quite happy to write some C code or something to handle it outside of my PHP code. I would also like to issue a redirect if possible (my sites use output buffering so there shouldn't be any headers sent). I'm pretty sure this could be done with a PHP module, but I've never written one and have no idea where to start.

    Read the article

  • Rewrite only URLs that don't exist

    - by PeterBelm
    I'm looking for a way to rewrite URLs only if the path doesn't exist. This isn't to handle 404s, but to redirect page URLs to a shared PHP file (ie: '/contact-us/' - '/show_page.php?page=contact-us'). The basic redirect is easy enough to achieve, however I want to be able to override the default page by adding '/contact-us/index.php' in the site root. Is this achievable with mod_rewrite or would I have to do something else?

    Read the article

1