Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
If you visit xkcd.com it will display a webcomic image. Below it, the direct link to that image is showed below it, for example:
Image URL (for hotlinking/embedding):
http://imgs.xkcd.com/comics/horse.png
Now, how do I parse the page to extract the image link from the page and put it into NSURL variable, using Xcode 6 and Swift, so I can make my UIWebView display only the image rather than the whole page.
Thanks!
Use a regular expression. See this SO Answer for details.
Pay particular attention to the Notes:
(?<=) Ex: (?<=AB) means preceded by AB
(?=) Ex: (?=FG) means followed by FG
These do not capture the matched portion.
Documantation: ICU User Guide Regular Expressions
You can use the Swift String rangeOfString(pattern, options) in place of NSRegularExpression which is much more involved.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am newbie in Apache Jena.I store my RDF-dataset in jena tdb and I serve it in fuseki server.Until now,I am fine.The problem is that I want the output of the SPARQL query to be displayed in a html page.I can't find the way to do this.
If you have ideas,do not hesitate to share them with me!
For part of a page, you need to write a small piece of code that takes a result set and creates the HTML in the format and styling that you want.
You can add an XML stylesheet with "?stylesheet=" but that will get you a whole page.
See this example at www.sparql.org.
http://www.sparql.org/books/sparql?query=PREFIX+books%3A+++%3Chttp%3A%2F%2Fexample.org%2Fbook%2F%3E%0D%0APREFIX+dc%3A++++++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0ASELECT+%3Fbook+%3Ftitle%0D%0AWHERE+%0D%0A++%7B+%3Fbook+dc%3Atitle+%3Ftitle+%7D&output=xml&stylesheet=%2Fxml-to-html.xsl
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hi Im currently developing an app where I have some text which informs the user about something. This information is also on my website and what i want to do is when i change the information on my website I also want the text in my app to change. I know that you can create a backend tableview with for example parse but that's not what Im looking for. I've done som research and think what i need do to is use JSON in some way to display the text from my website in my app. Pleas comment If you don't understand what It s that Im trying to accomplish. If you could either link a tutorial or explain how/if this is possible I would appreciate It very much!
you can make a json call from your app to a url and have a script or file in your website that returns the information you want, this will make it easy to change it in future. then use the same script as the basis ( again using a json call) to get the text for the specific webpage.
It's difficult to answer more specifically since you've mentioned no technology base for your website.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to crawl an entire website. I am using Simple_html_dom for parsing but the problem is that it takes only one webpage link at a time. I want to provide only start (home page) link and it should crawl and parse all the web pages of that website automatically. Any suggestion how to do this ?
When parsing the DOM of that single page, store all links (within the same domain) in an array. Then, at the end of parsing, check if the array isn't empty. If it isn't, take the first link and do the same.
So something like (code sample written with Python-like syntax, but you can adapt it to PHP easily - mine is rusty).
referenced_links = ['your_initial_page.html']
while referenced_links: # if the array isn't empty...
crawl_dom(referenced_links[0])
referenced_links.pop(0) # remove the first item in that array
def crawl_dom(url):
# download the url, parse the DOM and append all hyperlinks to the array referenced_links
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am looking to export data that a user creates in my app in a formatted style. What I mean by this is I would like it to have capabilities like a word document with centered headers, larger font in certain places, etc... In the end the user will be emailing the document, which is why I would like it to look nicer than a standard plain text document. There has to be a way to do this right?
If you could point me in the right direction to get this functionality that would help me a lot..
Create an HTML document with inline styling. You can then use that directly in the body of the email message as an HTML email (I know they can sometimes be frowned upon).
But to be honest, that'll be the quickest way to achieve what you are after.
maybe can you give a look at:
http://www.cocoanetics.com/parts/dtrichtexteditor/
https://github.com/enormego/EGOTextView
https://github.com/omnigroup/OmniGroup/tree/master/Frameworks/OmniUI/iPad/Examples/TextEditor/
and this apple documentation:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/AttributedStrings/Tasks/RTFAndAttrStrings.html
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am fresh to the iPad app development. Now I am developing a calculator. And I want copy my result of the calculation to textEdit or to my mail which is outside the application. How can I do it?
if the text is selectable users should be able to copy and paste the information using the iOS clipboard themselves, this is probably the easiest option if you don't have a specific other application for them to copy to.
You can use Apple's APIs to send an email and put the result into the body/subject as necessary, this would provide a much nicer user experience.
See this answer for more details.