Friday, July 5, 2013

JQuery UI Model with submit form on confirm

I was having frustrating problem using jquery's submit button inside a Jquery ui modal box when a user submit. the problem occurs when you explicitly set the submit() to return false that you cannot do anything after it even explicitly saying submit(function (){return true;})

http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/

solution is to NOT use the submit function at all after confirm:

    $( "#dialog-confirm" ).dialog({
        resizable: false,
        autoOpen: false,
        height: 140,
        modal: true,
        buttons: {
            "Delete pendings": function() {
                document.scheduled_release_form.submit();
            },
            Cancel: function() {
                $( this ).dialog("close");
            }
        }
    });

<form action="" method="post" name="scheduled_release_form" id="scheduled_release_form">
<input type="button" name="submit_update" value="submit update" id="submit_update"><input type="button" name="submit_delete" value="delete pendings" id="submit_delete">
</form>

Mac vagrant port forwarding

Just reposting this blog for reference.

http://www.dmuth.org/node/1404/web-development-port-80-and-443-vagrant

If you have a vagrant instance that is running on 8080 for web services and you want to forward 80 traffic to it so you will not be appending ports to your url like http://localhost:8080 but instead just use http://localhost do the following bellow:

sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443

Monday, April 15, 2013

NOTE: SCP syntax

scp -rp ./copy-me/* franz@192.168.1.1:/path/to/location/copy/

Friday, September 9, 2011

Changing the highlight color in Zend Studio/Eclipse

If you want to change the highlight color for example if you drag selections or use the find functionality.

In  Mac:
Preferences -> General -> Editors -> Text Editors -> [Appearance color options] : Selection Background Color

Thursday, September 8, 2011

NOTE: Zend Frameworks Flash Messenger

I have never used the Flash Messenger helper before so I am a little new to it. I guess I can share a couple of mishaps.

Remember when using the flash messenger if namespaces are present is to be aware to first set the namespace name BEFORE retrieving your messages.

example:
//from first controller
public function firstAction()
{
    $this->_helper->flashMessenger
                  ->setNamespace('cloudy')
                  ->addMessage('its cloudy today!');
    $this->_redirect('/second/second');
}

When retrieving this namespace dont forget to set the namespace first:
// second controller
public function secondAction()
{
   $messages = $this->_helper
                    ->flashMessenger
                    ->setNamespace('cloudy')
                    ->getMessages();
   print_r($messages);
}

Remember that if you just do:
$messages = $this->_helper->flashMessenger->getMessages();

You will not retrieve anything. Just my 2 cents since it took me a couple of minutes to figure that out.

Tuesday, September 6, 2011

Tip: Rendering a different view in another view from a different module

Say you have want to retrieve a view from another module and you have this directory structure

/modules/
    /front
        /controllers
            /front-controller-one
        /views
            /scripts
                /front-controller-one
                    /front-view.phtml
    /back
        /controllers
             /back-controller-two
        /views
            /scripts
                /back-controller-two
                    /back-view.phtml

From your controller (say you are in front-controller-one in "front" module):
$frontControllerDir = $this->getFrontController()->getControllerDirectory('back'); // retrieve controller dir of the mentioned MODULE
$this->view->addBasePath(realpath($frontControllerDir . '/../views')); // do NOT add the "scripts" dir as it will be added automatically so do NOT do this: '/../views/scripts'

The script above will add a base path of Back modules view/scripts directory to the View objects script paths so if you do print_r($this->view->getScriptPaths()) you should be able to see the new path you added above in the list.

Now from your view (/front/view/scripts/front-controller-one/front-view.phtml):
<div id="journalEntryView"><?php echo $this->render('back-controller-two/back-view.phtml'); ?></div>