Direct javascript printing from android & IOS - javascript

I'm currently developing a web based application that requires RAW communication to printers straight from Javascript.
On the PC/Mac side of things I've had a great time implementing qz-print, a java based plugin for doing just this.
It's now come time that I look at how I can reproduce the same behaviour iOS and Android.
Here's some ideas that I've had so far:
Wait a god awful time for RawSockets (javascript TCPSocket implementation).
Build a simple android application to relay http requests to a tcpsocket (I'm getting started on this right now).
Use an existing Android/iOS app to achieve the above. I found "Let's Print Droid" which provides a HTTP server. It can send data to the printer but I can't seem to get the server part working. From my web app I've tried sending POST and PUT requests with no luck and came across a CORS (Cross-Origin-Resource-Sharing) issue. There is also no documentation for the LetsPrintDroid Http feature and to fix the CORS issue it would be up to the app to send specific headers to allow CORS.
Does anybody know of any awesome libraries, helper-apps or additional solutions?
What's your oppinion on the above solutions.
Any advice appreciated :-D
UPDATE:
I got a little android http-tcp socket running and it's working great!
The only obvious issue with this is that another app will be needed on IOS.
Thought it would be helpful so I've made the code available on Github:
https://github.com/micwallace/HttpSocketAdaptor

The Lets print droid proxy server uses a multipart mime upload facility. The first part is the JSON string describing the printer as detailed in the help files. The second part is the data file.

Related

How to store webpages automatically for viewing offline as fallback?

I'm currently doing a project for showing a slideshow (build in HTML, CSS and JavaScript) on a television, using a Raspberry Pi. Now I would like the slideshow to be displayed even when the Raspberry is not connected to the internet. Does anyone have a solution or idea how I could solve this?
If I am understanding your question correctly...
What you will need to look into is service workers!
Important note: They only work on trusted websites: Sites with https or on localhost (for testing purposes)
Here is a tutorial on offline support with service workers: https://css-tricks.com/serviceworker-for-offline/ But there are other great tutorials out there too!

Does Apple reject Hybrid app if it loads resources including javascript from remote server?

For some purpose, I use web technology to develop my iOS app. In order to improve the UIWebView performance, I put the resources(including html/css/javascript) locally in app bundle to reduce the loading time.
I also create a thread to check resource update, and download the newer resources if needed. Next time the app can use the resources to render web view.
This solution works well.
But I worried that whether apple will reject my app because I download javascript from remote server. Is there any hybrid app that use similar solution and appear in app store?
You can download and execute javascript, provided that it's being executed by a UIWebView.
This is actually pretty common. If you need an example during a review (you won't), point to any alternate iOS web browser, like Chrome. They download and execute all kinds of web resources, but it's okay because they do it in a UIWebView and Apple trusts UIWebView.
That said, if you download resources that change your app's functionality in a way that would not be appropriate for an App Store product, you're likely to get it pulled and -- if the violation is egregious enough -- you may lose your developer account.
IBM Worklight platform is using similar approach.
You can read more on this thread (and it might give you some answers):
IBM Worklight - is Direct Update allowed by Apple's guidelines for the App Store?

communcation between node.js and processing

i'am working on a project where i receive data from mobile phones via websockets to a node.js server using socket.io. and this i want to pass to processing. The processing sketch is not running in the browser, it manage sounds, arduino, ... so i wonder what would be a good protocool to send the data to the processing sketch?
I did not found a way to use socket.io in processing, so i thought about using osc?
Or is there a other socket protocoll i can use between mobile phones, node, processing?
thanks!
See if this shield will do the trick for you: http://arduino.cc/en/Main/ArduinoEthernetShield Found a few simple projects from google that seem to fit your description of what you want (turn something on/off from the web).
Node can be your server, with sockets.io, and node can most likely communicate over the web with this shield. Note: I've never used it, just googled, saw a project that looks like what you are interested in.
EDIT: Here is another possible solution: http://xseignard.github.io/2013/06/25/interfacing-leap-motion-with-arduino-thanks-to-nodejs/ using: https://github.com/rwaldron/johnny-five

Web app not working on Chromium in Chrome OS

I'm working on a web app for note-taking called VideoNot.es (http://videonot.es). This app is build with AngularJS and webapp2 and hosted on the Google App Engine.
My app is working fine on Chrome for the major OS (Windows, Mac, Linux) but some users have started to report issues with Chrome OS (mainly teachers with GAFE accounts).
I've decided to run it in Virtualbox and there is effectively an issue.
The app never receives answer send over the Google Channel API (https://developers.google.com/appengine/docs/python/channel/overview) while the backend is logging that it sent it. I had received reports before we moved to it so it is not really link to it.
I really don't understand what is wrong here.
Thanks for your help.
If it's a bug in the Javascript, you'd want to file it on the issue tracker. I haven't noticed much progress on Channel API bugs, so I wouldn't expect much though.
I'd recommend working around it by polling, or another solution, like Node.js hosted elsewhere.

How to debug a jQuery application remotely on client's browser/OS/system?

I have developed a web app (that uses jQuery) which works just fine for me but isn't working for one of my users. I've tried replicating the problem matching his browser/OS but it is of no use. The application works for me but not for him. He has tried with a lot of browsers: Chrome/Firefox/IE but it doesn't work in any for him. The only clue I have is that he says all his computers have German version of Windows installed. I wonder how that can be a cause.
Is there any tool that can dump JavaScript/HTML errors and email it to me? Or any script/extension for helping me remotely debug the issue? Help is appreciated.
The web app BTW is http://visualwebsiteoptimizer.com/ in case it helps.
If he's trying it in Chrome or Firefox, have him press Ctrl+Shift+J and that will bring up the Javascript Error Console. You can then ask him to copy-paste you whatever errors it might be having.
You could try Copilot or some other remote-help solution. That way you will have complete control over the client's computer and I think that will be the easiest way to debug this.
Ask your client to create a trace with Fiddler or FiddlerCap. Then you can replay the trace on your local system and see if the client received all the files or if certain http requests had errors.
Tracing instructions: Fiddler, FiddlerCap
If you're not familiar with Fiddler check out the video or the slides for the "Become a Web Debugging Virtuoso with Fiddler" session from this year's PDC conference.
Hope this helps some.

Categories