Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Building Mobile Application Development in the Cloud
This is the forum to discuss the Wrox book Beginning Building Mobile Application Development in the Cloud by Richard Rodger ; ISBN: 978-1-1180-3469-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Building Mobile Application Development in the Cloud section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 22nd, 2011, 07:57 AM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2011
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 2 Draw and Mac/MAMP

Hello,

I have been working through this book and it has caused me some issues. I was hoping to get a little help. First, I am on a MacBook Pro and for reasons beyond me I spent the last week trying to get nginx to actually install and work correctly. It has been a lot of trouble, but in the end it never worked right so I went with the easier MAMP setup.

So far so good and all the examples were working just fine up until Chapter 2. The Draw-Tracer app works very well, but the initial Draw app does not. The ontouchestart/ontouchmove events never get called so nothing draws. I even tried this in Chrome and used the excellent debug tools in Chrome to set break points and everything. I thought it was perhaps something in my typing, but that was not the case. I downloaded chapter 2 source and tried it there and the same problem. On FireFox 8, Chrome and Safari, the draw app shows nothing and looks like it isn't working. Lo and behold on the phone it works great and I see my drawing.

I don't know if this was because of something in MAMP? If so why does it work on the phone? I don't fully understand what is happening here, but without being able to test in the browsers and only seeing it work on the phone it makes debugging these apps very hard. Even my break points are not hit on the browser, but they get called on the phone.

Any ideas?
Reply With Quote
  #2 (permalink)  
Old November 22nd, 2011, 09:01 PM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm just learning this too but I think the desktop browser doesn't support touch events. Not related to MAMP.

Check out this SO post.
Reply With Quote
  #3 (permalink)  
Old November 22nd, 2011, 09:36 PM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2011
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quite possibly, but the book seemed to read as though it would be possible to test this in Safari at the least. It sure doesn't seem like it and since the events never get called, what you linked to makes perfect sense.

I would like to know if there is a better way to do this then. Suspect there isn't quite one.
Reply With Quote
  #4 (permalink)  
Old November 22nd, 2011, 10:19 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Andrew Reynolds

It has been my wish to be a powerful marketer that's why I usually utilize the right techniques making sure that I will be successful in this area. Thanks to the techniques of Andrew Reynolds because I recognized a bunch of business tips.
Reply With Quote
  #5 (permalink)  
Old December 25th, 2011, 07:55 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ben Glover

I do believe Andrew Reynolds is truly a very good person, I was able to go through some compliments regarding him on the internet and it was truly very impressing.
Reply With Quote
  #6 (permalink)  
Old December 28th, 2011, 10:55 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Arneld Ambrose

I am a gadget lover and I just love my Roku 2 coupon that I got from a friend. The entertainment devices of this brand are just amazing. Now, I can finally get one for myself.
Reply With Quote
  #7 (permalink)  
Old January 16th, 2012, 08:51 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fonsie Cavitch

Being a TV researcher, I traditionally need to do a great deal of research. diamond engagement rings houston, designer jewerly houston, estate jewelry houston, diamond rings houston and jewelry stores houston are just a variety of the topics that I have worked on.
Reply With Quote
  #8 (permalink)  
Old April 14th, 2013, 12:50 AM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
Default One potential solution

Quote:
Originally Posted by Akira71 View Post
Quite possibly, but the book seemed to read as though it would be possible to test this in Safari at the least. It sure doesn't seem like it and since the events never get called, what you linked to makes perfect sense.

I would like to know if there is a better way to do this then. Suspect there isn't quite one.
As was noted, desktop Safari doesn't generate touch events, so the existing code sample's events never fire.

You're right that the author is vague in some places (and seems to be misleading in others [chapter 4 node installation]) about whether a given example should work on the desktop only, mobile only, sim only, or some combination there of.

Of course, this is meant to be a mobil web app book, so it's understandable that example code is best run in the sim or on a mobile device.

Regardless (and regardless that it's been over a year since you posted your missive.... sorry it took me so long to find this book!), here's one possible solution that hooks mouse events into the existing touch events:

Code:
    // included just to be able to orient oneself
    canvas.ontouchmove = function(event) {
        event.preventDefault();
        var newx = event.touches[0].clientX;
        var newy = event.touches[0].clientY - canvastop;
        line(lastx, lasty, newx, newy);
        lastx = newx;
        lasty = newy;
    }

    // new code here
    var mouseDown = 0;
    canvas.onmousedown = function(event) {
        ++mouseDown;
        event.preventDefault();
        event.touches = [ {} ];
        event.touches[0].clientX = event.clientX;
        event.touches[0].clientY = event.clientY;
        canvas.ontouchstart(event)
    }
    
    canvas.onmouseup = function(event) {
        --mouseDown;
    }
    
    canvas.onmousemove = function(event) {
        if (mouseDown) {
            event.preventDefault();
            event.touches = [ {} ];
            event.touches[0].clientX = event.clientX;
            event.touches[0].clientY = event.clientY;
            canvas.ontouchmove(event)
        }
    }
        
    var clearButton = document.getElementById('clear');
Reply With Quote
  #9 (permalink)  
Old April 14th, 2013, 12:52 AM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
Default One potential solution

Quote:
Originally Posted by Akira71 View Post
Quite possibly, but the book seemed to read as though it would be possible to test this in Safari at the least. It sure doesn't seem like it and since the events never get called, what you linked to makes perfect sense.

I would like to know if there is a better way to do this then. Suspect there isn't quite one.
As was noted, desktop Safari doesn't generate touch events, so the existing code sample's events never fire.

You're right that the author is vague in some places (and seems to be misleading in others [chapter 4 node installation]) about whether a given example should work on the desktop only, mobile only, sim only, or some combination there of.

Of course, this is meant to be a mobil web app book, so it's understandable that example code is best run in the sim or on a mobile device.

Regardless (and regardless that it's been over a year since you posted your missive.... sorry it took me so long to find this book!), here's one possible solution that hooks mouse events into the existing touch events:

Code:
    // included just to be able to orient oneself
    canvas.ontouchmove = function(event) {
        event.preventDefault();
        var newx = event.touches[0].clientX;
        var newy = event.touches[0].clientY - canvastop;
        line(lastx, lasty, newx, newy);
        lastx = newx;
        lasty = newy;
    }

    // new code here
    var mouseDown = 0;
    canvas.onmousedown = function(event) {
        ++mouseDown;
        event.preventDefault();
        event.touches = [ {} ];
        event.touches[0].clientX = event.clientX;
        event.touches[0].clientY = event.clientY;
        canvas.ontouchstart(event)
    }
    
    canvas.onmouseup = function(event) {
        --mouseDown;
    }
    
    canvas.onmousemove = function(event) {
        if (mouseDown) {
            event.preventDefault();
            event.touches = [ {} ];
            event.touches[0].clientX = event.clientX;
            event.touches[0].clientY = event.clientY;
            canvas.ontouchmove(event)
        }
    }
        
    var clearButton = document.getElementById('clear');
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MAMP & WP Email Configuration msheaver BOOK: Professional WordPress 1 January 7th, 2016 07:31 AM
Trouble getting cpuid example in chapter 4 to work on a Mac malexgreen Assembly Language 1 January 10th, 2010 06:05 AM
How To Draw Using Slago VS.NET 2002/2003 0 March 20th, 2006 08:25 AM
chapter 7 image upload on Mac OS X laolaonk BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 February 19th, 2006 09:20 PM
JRun4 for Mac OS + Mac OS X's Java 1.4.1 elbicho J2EE 0 June 27th, 2003 12:18 PM



All times are GMT -4. The time now is 12:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.