How to add MountSpec component in LayoutSpec or XML in android - litho

I am able to set MountSpec directly in Activity setContentView(), but its not working when I am trying to add it with my existing XML view (using LayoutSpec or even directly).

You might want to use LithoView to connect between Spec and Android native view.
Also Spec can't be used in XML directly.

Related

How to get change in HTML DOM in LabVIEW?

I am doing IOT related project in Labview using Arudino as hardware.
I was able switch off/on an led on Arudino by Pressing OFF/ON on website by using datasocket vi. Now what i want is to control the intensity of led from Website.
I have a range slider in my website and its real time value can be viewed in textarea,div,input type.
Is there any way i can get that real time value that is being changed in HTML DOM in Labview.
I know that datasocket vi returns the html source code but not the HTML DOM.
I dont want to use the Web Publishing Services as they dont work in my Laptop.
This is the link im referring for datasocket.
Datasocket Labview
You can do something like creating a web socket, but I expect the easiest thing is to use a web service. You can create one in LV and add a setLEDIntensity method to it and call it from your JS code. You can find a simple example here and in other documents in that community.
Use WebSocket API for LabVIEW to send and receive data from the web. This is the best option for you.
https://decibel.ni.com/content/docs/DOC-40572

How to Find a JSON object of a Website

New to the JSON world and I'm trying to find out how to view a JSON object of a webpage. Will every webpage have a JSON object and if so how do I find it in order to get the data and display it on my site? I vaguely remember something about using Firebug?
Thanks,
B
Will every webpage have a JSON object
No.
Many web sites will not use any JSON; many will be completely static (HTML and CSS only).
It may only apply if there is a "Web API" (for programmatic access to content), but there are non-JSON ways to do APIs (the X in AJAX is for XML).
To determine how to access a site programmatically look at the site's developer documentation. If there isn't any documentation then any AJAX web debuggers (like FireBug) show may well be internal only and intended only for the site's own implementation; other uses could well be not welcome (you could be up for violating IP).
This might become a vulnerability to add sensitive JSON to your final HTML page.. JSON should be loaded like an ingredient to the soup, via Ajax for example on authenticated page. If it's not sensitive JSON then you should load it for performance reasons once it is required... it really depends on your choice. I have built a library to handle these kind of requests for web, check it out: https://github.com/alexmano/jsMan

PDF Annotator with JSON layers

I am attempting to create a pdf annotator using PDF.js and a HTML5 drawing app to create a JSON file.
Using this: https://github.com/mozilla/pdf.js/blob/master/examples/learning/prevnext.html
Maybe this: http://codecanyon.net/item/html5-drawing-tools/8869338?WT.oss_phrase=&WT.oss_rank=2&WT.z_author=appsandsites&WT.ac=search_thumb
to create a JSON like http://www.html5rocks.com/en/tutorials/canvas/integrating/#web
Any thoughts or suggestions on how to do this? Do you think I could use PHP to create and place the file on my server?
Direction on the best way to do this is appreciated.. what version of JSON, how to use canvas to create a file and edit it, etc
Update, I want to lay this over PDF.js:
https://github.com/trsanders/responsive-sketchpad
and then in PHP create a JSON file that stores the url of a PDF and the URL to the generated json/image.
Update 2/23
I found a document browser in Perl with flexpaper which lays aframework foundation for what I want to do, but does not add in drawing support. What I was thinking is the above image.
http://eric-blue.com/2010/02/12/example-document-browser-code/
Hypothes.is supports text annotation of PDFs (via PDF.js and Annotator). The plan at The Hypothesis Project (a non-profit...also where I work, fwiw) is to upstream the PDF related features that have been made to its customized Annotator, so they'll be available to more developers.
Here's an example of Hypothes.is loaded on a PDF via a proxy. The same functionality is provided without the proxy by using a bookmarklet in Firefox or the Hypothes.is Chrome extension.
Additionally (if you're wanting shape drawing on top of PDF.js rendered PDFs), you might check out the Annotorious polygon preview. Similar to what you've described, plus annotation, plus storage...though I don't believe it works on PDFs...just images.
There is also ongoing work being done at the W3C to build an interoperable annotation data model. Checkout the Annotation Working Group for more information.
Lastly, PDF.js is also getting work done to it now to support PDF-level annotations. Eventually, it should give PDF.js a strong foundation for exposing annotations loaded from other sources.
Hopefully that's enough to get you started. :)

How do I programmatically create a DragEvent?

This page describes the api for programmatically creating an event. Looking at the list, it indicates that Chrome and Safari do not support this api for creating DragEvents.
I'm trying to write automated tests for native html5 drag and drop behavior in an angular app. How can I programmatically mimic drag and drop events so I can do that?
You may want to use action chains (from selenium): https://code.google.com/p/selenium/wiki/AdvancedUserInteractions#Generating_Action_chains
We've used them on a non-angularjs app in the past for drag-drop. Anyway, as protractor (angularjs defacto tool for testing e2e apps) uses selenium webdriver, I bet you can use even protractor (https://github.com/angular/protractor) to accomplish that (with the object "browser.webdriver".
From protractors doc:
The browser.get method loads a page. Protractor expects Angular to be present on a page, so it will throw an error if the page it is attempting to load does not contain the Angular library. (If you need to interact with a non-Angular page, you may access the wrapped webdriver instance directly with browser.driver).
You're better off using the following protractor API:
https://code.google.com/p/selenium/source/browse/javascript/webdriver/actionsequence.js
You'll most likely want to use the following pattern:
browser
.actions()
.dragAndDrop(myEle, {x:100,y:100})
.perform();

file uploading in asp without ActiveX class

Is there a way to check file size on the client (without the use of ActievX which also errors out), before it is passed back to the server? in asp
In ASP? No, by definition. Active Server Pages can't do anything before they get a request from the client.
There is a draft File API that will allow you to perform this sort of check using client side JavaScript. The Mozilla Developer Network has a guide on getting information about selected files. Once you have a reference to the file, you can just access its .size property.
Note that since the specification is a draft, it is rather new and subject to change. This one is very new and thus has [very limited browser support](http://caniuse.com/#search=file api).
You might also be able to achieve what you want using a Java applet or Flash (the latter of which would be better supported).