I'm trying to make use of Vexflow (http://vexflow.com/) on the Android. However, I'm stumped as to the best way to display the output. Is it possible to have a series of webviews and then feed the javascript calls to them? Something like this is what I'm trying to achieve:
example image http://paraboxstudios.com/javascript_example.png
You can include an HTML file along with any JavaScript files in your assets or resources and then load it in a single WebView. The loadData method may be of particular interest (if you have problems, you can also try the loadDataWithBaseURL method which sometimes gets around some issues).
Related
I want that if one image is selected it detects Label, text and faces in single image at one time only.
Just call all of the functions on your image file at once, then combine the results using something like zip in RXJava.
Alternatively, you could nest the results (e.g. call FirebaseVision.getInstance().onDeviceTextRecognizer.processImage(image) inside the onSuccessListener of another function), although this will take much longer to complete all.
If you provide code of your existing attempts, StackOverflow can help further.
If I have a Browser and I call browser.loadURL("view-source:http://www.example.com); it goes straight to Chromium's source viewer. Is there a way to do the same thing with the loadHTML or loadData methods?
Or is there a way to programatically switch it to that view once the page has loaded?
The view-source URL prefix is a specific URI scheme that is handled by Chromium itself. Therefore, this prefix can be used with URLs only.
The general purpose of the loadHTML() and loadData() methods is to load and render the HTML string as a regular web page instead of displaying the source code in the browser. Therefore, there is no straightforward approach to make these methods display the source code instead of rendering the page.
However, you can consider saving the HTML to a temporary file and then load it as shown below:
browser.loadURL("view-source:file:///f:\\data\\contents.html");
I am developing an application to test whether a HTML page is responsive or not. Right now, I am assuming that using media queries is the only way to make a HTML page responsive.
But I am using a very crude logic to test it. I am parsing the HTML file and reading it for the presence of a media query statement. If its present I am declaring it as responsive, otherwise non-responsive.
Is there any other way I can go about it?
Is there any other test I can perform before declaring it as responsive or non-responsive?
Check if they are using hard coded px instead of % or em. Maybe see if text is too small or links to close together.
At the end of the day it wont be a great resource for responsive checking since there are so many factors
According to Ethan Marcotte's seminal article that introduced Responsive Web Design (http://alistapart.com/article/responsive-web-design), a responsive page will use media queries, flexible grid layouts and responsive text.
But, even if a page has these elements, it doesn't mean that it is using them correctly. A responsive page is not one that simply uses media queries.
I'm not sure that the ability to programmatically determine if a page is built responsively is even a viable goal. You can check for ingredients, but that won't tell you if the right recipe was followed.
Also, why have you tagged this question with Java?
I have a code that generates a captcha image from random characters in Java and returns to the HTML form where it is displayed. But I want to add sound clip as well to the image for the people who are visually impaired.
Can anyone help me with any tutorial or example or something they have themselves come up with?
For the server-side, you might have a servlet that generates the sound using javax.sound.sampled (for concatenating pre-recorded parts for the letters and numbers). See Concatenating or mixing audio files for working source.
Unless you explicitly intend to use an applet (which I do not advise) then the client-side of this is not really related to Java.
So, I'm using HTTP Post Requests in Android Java to log into a website, before extracting the entire HTML code. After that, I use Pattern/Matcher (regex) to find all the elements I need before extracting them from the HTML data, and deleting everything unnecessary. For instance when I extract this:
String extractions = <td>Good day sir</td>
Then I use:
extractions.replaceAll("<td>", "").replaceAll("</td>", "");
I do this multiple times until I have all the data needed from that site, before I display it in some kind of list.
I'm not particularly stuck on anything, but please, can you tell me if this is an effective/efficient/fast way of getting data from a page and processing it, or are there ways to do this faster? Because sometimes it's like my program takes a lot of time to get certain data (although mostly that's when I'm on 3G on my phone).
Like others have said, regex is not the best tool for this job. But in this case, the particular way you use regex is even more inefficient than it would normally be.
In any case, let me offer one more possible solution (depending on your use case).
It's called YQL (Yahoo Query Language).
http://developer.yahoo.com/yql/
Here is a console for it so you can play around with it.
http://developer.yahoo.com/yql/console/
YQL is the lazy developer's way to build your own api on the fly. The main inconvenience is that you have to use Yahoo as a go-between, but if you're ok with that, then I'd suggest you go that route. Using YQL is probably the quickest way to get that kind of work done (especially if the html you're targeting keeps on changing and if its html tags are not always valid).
Using regex to parse a website is always a bad idea:
How to use regular expressions to parse HTML in Java?
Using regular expressions to parse HTML: why not?
Have a look at the Apache Tika library for extracting text from HTML - there are many other parsers also available, such as PDF etc. : http://tika.apache.org/