Search Results

Search found 6 results on 1 pages for 'gutzofter'.

Page 1/1 | 1 

  • why attach to window

    - by Gutzofter
    I was looking over the code for qunit. My question is why would you want to attach the qunit object via property to window object. Here is the link to the file. Look at line 11. If I look at a unit test run using firebug you can see it is a property of window.

    Read the article

  • return empty string from preg_split

    - by Gutzofter
    Right now i'm trying to get this: Array ( [0] => hello [1] => [2] => goodbye ) Where index 1 is the empty string. $toBeSplit= 'hello,,goodbye'; $textSplitted = preg_split('/[,]+/', $toBeSplit, -1); $textSplitted looks like this: Array ( [0] => hello [1] => goodbye ) I'm using PHP 5.3.2

    Read the article

  • How to write a technical blog?

    - by Gutzofter
    I have a blog that I would like to increase traffic on. I've read lots of technical blogs, but it's a lot different writing a blog versus reading a blog. There seems to be several ways to write a post. General article: I like this tool. This is how I do it. Specific technical issue: Programming solutions. I do get some traffic, but they don't leave any comments. Should I use HN and Reddit. What are some of the other places I can promote my blog? How to respond to negative comments (trolls)? Another thing is you might want to have some link-thrus. comment on other peoples blog posts. BTW my blog is: (defun ugly-lisp-code () ()) New Blog ugly web development

    Read the article

  • A standard event messaging system with AJAX?

    - by Gutzofter
    Is there any standards or messaging framework for AJAX? Right now I have a single page that loads content using Ajax. Because I had a complex form for data entry as part of my content, I need to validate certain events that can occur in my form. So after some adjustments driven by my tests: asyncShould("search customer list click", 3, function() { stop(1000); $('#content').show(); var forCustomerList = newCustomerListRequest(); var forShipAndCharge = newShipAndChargeRequest(forCustomerList); forCustomerList.page = '../../vt/' + forCustomerList.page; forShipAndCharge.page = 'helpers/helper.php'; forShipAndCharge.data = { 'action': 'shipAndCharge', 'DB': '11001' }; var originalComplete = forShipAndCharge.complete; forShipAndCharge.complete = function(xhr, status) { originalComplete(xhr, status); ok($('#customer_edit').is(":visible"), 'Shows customer editor'); $('#search').click(); ok($('#customer_list').is(":visible"), 'Shows customer list'); ok($('#customer_edit').is(":hidden"), 'Does not show customer editor'); start(); }; testController.getContent(forShipAndCharge); }); Here is the controller for getting content: getContent: function (request) { $.ajax({ type: 'GET', url: request.page, dataType: 'json', data: request.data, async: request.async, success: request.success, complete: request.complete }); }, And here is the request event: function newShipAndChargeRequest(serverRequest) { var that = { serverRequest: serverRequest, page: 'nodes/orders/sc.php', data: 'customer_id=-1', complete: errorHandler, success: function(msg) { shipAndChargeHandler(msg); initWhenCustomer(that.serverRequest); }, async: true }; return that; } And here is a success handler: function shipAndChargeHandler(msg) { $('.contentContainer').html(msg.html); if (msg.status == 'flash') { flash(msg.flash); } } And on my server side I end up with a JSON structure that looks like this: $message['status'] = 'success'; $message['data'] = array(); $message['flash'] = ''; $message['html'] = ''; echo json_encode($message); So now loading content consists of two parts: HTML, this is the presentation of the form. DATA, this is any data that needs be loaded for the form FLASH, any validation or server errors STATUS tells client what happened on server. My question is: Is this a valid way to handle event messaging on the client-side or am I going down a path of heartache and pain?

    Read the article

  • Overriding check box in JavaScript with jQuery

    - by Gutzofter
    Help with unit testing checkbox behavior. I have this page: <!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(function() { $('<div><input type="checkbox" name="makeHidden" id="makeHidden" checked="checked" />Make Hidden</div>').appendTo('body'); $('<div id="displayer" style="display:none;">Was Hidden</div>').appendTo('body'); $('#makeHidden').click(function() { var isChecked = $(this).is(':checked'); if (isChecked) { $('#displayer').hide(); } else { $('#displayer').show(); } return false; }); }); </script> </head> <body> </body> </html> This doesn't work it is because of the return false; in the click handler. If I remove it it works great. The problem is if I pull the click function out into it's own function and unit test it with qunit it will not work without the return false;

    Read the article

  • Ajax request. Which callback is executed first complete or success?

    - by Gutzofter
    I could spike this to find out, but I'm going to use SO. In my unit tests (qunit) I use the asynchShould (alias for asynchTest) test. Part of the assertion is to wait for the completion/success of the request. Like this: asyncShould('talk to customer list server', 1, function() { stop(2000); var forCustomerList = newCustomerListRequest(); forCustomerList.page = 'helpers/helper.php'; forCustomerList.data += '&action=customerListServer&DB=11001'; var originalSuccess = forCustomerList.success; forCustomerList.success = function(msg) { if (msg.flash !== undefined && msg.data !== undefined && msg.status !== undefined) { ok(true, 'json structure correct') } else { ok(false, 'json structure not correct'); } originalSuccess(msg); start(); }; testController.getServerData(forCustomerList); })

    Read the article

1