Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m Frustrated

Browser Interface lost in translation!

Hi,
I recently bought this book as a kindle AND a physical. I have been (slowly) working my way through the book with particular interest in the hotel app and arduino. I have so far managed to work through most of the examples and got them to work (to my surprise being a total Ardweebo and having never done programming before) but have come drastically unstuck when I reached the browser interface for the Arduino NDEF writer device.

Simply put, I am unable to translate and connect what I am required to do in this chapter with the previous chapters. I have even downloaded all of the source code from the GitHub repository and still completely and hopelessly stuck because I don't know where to put them or access them from the command line!

I am having major difficulties trying to understand how to create the directory and then install the express.js and node-serialport libraries to the correct place. I managed to create the location finder and NDeef reader and writer to my smartphone which was exciting but I am clueless as soon as I stepped outside the cordova arena.

The book says "make a directory for this application and save this there as package.json. The other files you'll need are your main source file, which you'll call index.js, and an index.html file that you'll use to create the user interface. The rest will be installed by the node package manager, npm." I have the command prompt open, my command line states c:\Users\John> and this is as far as I have managed to get.

I know how to make a directory in relation to the cordova folder: C:\Users\John\Documents> cordova create Location com.example.location Location. This puts a folder named Location in my documents folder. I change directory to C:\Users\John\Documents\Location> to add plugin and android. I know I use Sublime text to open the Index.html and Index.js file to change the code as necessary.

I get that this will be a simple fix for the more enlightened so how do I translate this into creating the browser interface? Sorry for long message but I have been at this for a week now and still no further forward!

Please help...

John
1 person has
this question
+1
Reply
  • Hi John,

    You didn't mention the title of the book that you are referring to. I would need that in order to help you.

    Best regards,
    Chris Olson
    O'Reilly Customer Service
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi Chris,
    Sorry, thought it was automatically linked to book, no worries. the book I am working through is Beginning NFC (Tom Igoe et al).

    Still haven't solved my problem yet so any helpo would be greatly appreciated!

    John
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi John,

    Sorry you ran into trouble here. I'm looking at pages 165 to 171 of the print edition where we're create a Node.js application that sends data to Arduino to create an NFC tag.

    For this project I created a new directory named HotelNodeApp. It doesn't matter where this directory is located. Your Documents directory is a good place. Open HotelNodeApp in sublime.

    Create a new file package.json in the HotelNodeApp directory.

    Put this text into the package.json file


    {
    "name": "HotelNodeApp",
    "version": "0.1.0",
    "description" : "A browser-to-serial application",
    "keywords": "serial, node-serialport",
    "author": {
    "name":"Tom Igoe"
    },
    "dependencies": {
    "serialport": "1.1.x",
    "express": "3.x"
    },
    "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
    }
    }


    index.html and index.js also go in the HotelNodeApp directory. Follow the chapter for the code that goes in them.

    Express and other other libraries will be installed when you run npm install.

    I used node.js 0.10.42 to test this. https://nodejs.org/download/release/v...

    npm install gave some *warnings* about serialport_unix.cpp which I ignored. The code still ran OK.

    We have the all the source code for the book online. Take a look at https://github.com/tigoe/BeginningNFC... for a working example of this project.

    - Don
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • If you update serialport to version 2.0.6 in the dependencies section of package.json, the code runs with Node.js version 4.3.1.


    {
    "name": "HotelNodeApp",
    "version": "0.1.0",
    "description" : "A browser-to-serial application",
    "keywords": "serial, node-serialport",
    "author": {
    "name":"Tom Igoe"
    },
    "dependencies": {
    "serialport": "2.0.6",
    "express": "3.x"
    },
    "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
    }
    }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi John,

    It sounds like you might need a primer on how command line interfaces work. If that's the case, you might want to check out this link to understand how to create directories and move from one directory to another:

    http://www.cs.princeton.edu/courses/a...

    The three of us are primarily OSX/Linux users, and Windows uses a different command line interface from other operating systems. Many windows users prefer to install a program called cygwin to get a Linux-like command line. Here's an intro to that:

    http://lifehacker.com/5633909/who-nee...

    Cordova automatically creates directories spefically related to cordova projects, but what you're asking about is creating directories in general. These links should help you to understand that process better.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated