IPhone Geocoding - objective-c

There is absolutely no tutorials on geocoding on the iphone. Only reverse geocoding. I have an address, want to convert to coordinates, then display a streetview of that address. How can this be accomplished...
EDIT
The below answer pretty much echos what I found online, but I know this can be accomplished using Googles JSON geocoding. I am working on this now, will update post when I figure out how to pull out the coordinates.
"http://maps.google.com/maps/geo?q="+ address+"&key="+apiKey+"&sensor=false&output=json"

built in forward geocoding is new to iOS5. look at CLGeocoder, which includes methods like geocodeAddressString:completionHandler:. if you want to support pre-iOS5 then you'll have to use another service, e.g. google's. i haven't used it myself, but a quick search turned up: https://github.com/mjisrawi/iOS-Geocoding-Services which may be of use.

Related

Google Maps API search location and pin

I am trying to put google maps on my browser and I am having trouble with APIs. What I am trying to do is have a searchbox with a map under it, where the user can put address and it will search near restaurants and pin them on the map. What I tried is searching the hole google and it just gets more confusing. I need help with this.
I came across something similar not so long ago and stumbled upon this neat jQuery Autocomplete Plugin.
It autocompletes the location you type and searches for it, after which it focuses the map on that location. It doesn't however highlight the nearest restaurants/bars/etc., but you can easily place a marker if said location was found. Hope this helps.
If you're interested in using PHP, this library will greatly help your journey. It saved me countless hours with the Google Maps API.

Objective C get html page's links

I'm quite new in Objective C programming and I'm trying to make an application that returns all the link addresses in HTML page. In that case i shouldn't just parse the HTML, but get these links intercepting them from the page's network request.
Is it possible to intercept the application's network requests or something?
Thanks
Coincidentally, Ray Wenderlich's rather AWESOME iOS tutorial site posted this article in the last hour. As you are new to iOS/ObjC, I highly recommend reading it thoroughly.
Let’s say you want to find some information inside a web page and
display it in a custom way in your app.
This technique is called
“scraping.” Let’s also assume you’ve thought through alternatives to
scraping web pages from inside your app, and are pretty sure that’s
what you want to do.
Well then you get to the question – how can you
programmatically dig through the HTML and find the part you’re looking
for, in the most robust way possible? Believe it or not, regular
expressions won’t cut it!
And before you think Regular Expressions might really be an answer, please read this.

Getting twitter feed into NSArray

How would I get the text of the last 10 tweets, for a specific twitter user, into an NSArray?
In more modern versions of iOS, you can access Twitter directly via the Social Framework. Twitter has some example code available which shows how to use it.
You could, if you need something for earlier versions of iOS, check out MGTwitterEngine. It'll take care of all the heavy lifting required. Specifically, the methods getUserTimelineFor sinceID startingAtPage count and getUserTimelineFor sinceID withMaximumID startingAtPage count will fetch what you're looking for. It is getting a little long in the tooth, however, so making use of the built-in iOS stuff is preferable.
You would have to parse the json with something similar to what is described here: http://blog.zachwaugh.com/post/309924609/how-to-use-json-in-cocoaobjective-c and here: http://mobile.tutsplus.com/tutorials/iphone/iphone-json-twitter-api/

Google suggest API does not work with Chinese locale

I have a problem with Google suggest API when using Chinese locale. I am picking Chinese hieroglyphs at random and use the REST API to retrieve suggestions. Unfortunately, Google always return an empty list of suggestions (I am completely sure, that I convert my request in utf-8, and it is working fine with other languages, ex. Russian):
Sample request:
http://suggestqueries.google.com/complete/search?qu=%E9%80%9F
Google answer:
window.google.ac.h(["速",[]])
Does anyone know how to retrieve suggestions for Chinese locale? Maybe I am missing some flags or something? Maybe there is an official document from Google, saying that Chinese is not supported? And are there any people from China, using Google toolbar? Does it really work? I'd appreciate any help!
If it matters, I am writing a simple WinAPI application, using C++...
http://googleblog.blogspot.com/2009/03/local-flavor-for-google-suggest.html says, at the bottom, that google suggest now supports "155 domains in 51 languages." This implies a possible solution, which is that you need to use the relevant domain.
http://suggestqueries.google.cn/complete/search?qu=%E9%80%9F
gives me
window.google.ac.h(["速",[["速腾","2,020,000 结果","0"] ...
A bit of experimentation shows that I'm able to get results for japanese only from google.co.jp, but not from google.com. I'm in Japan, YMMV.
Hmm I don't know it seems to work for me. e.g
http://suggestqueries.google.com/complete/search?qu=%e6%9c%a8
yields
window.google.ac.h(["木",[["木村了","297,026 results","0z"]]])

Accessing iSight programmatically?

Is it possible to access the iSight camera on a macbook programmatically? By this I mean I would like to be able to just grab still frames from the iSight camera on command and then do something with them. If so, is it only accessible using objective c, or could other languages be used as well?
You should check out the QTKit Capture documentation.
On Leopard, you can get at all of it over the RubyCocoa bridge:
require 'osx/cocoa'
OSX.require_framework("/System/Library/Frameworks/QTKit.framework")
OSX::QTCaptureDevice.inputDevices.each do |device|
puts device.localizedDisplayName
end
I don't have a Mac here, but there is some Documentation up here:
http://developer.apple.com/documentation/Hardware/Conceptual/iSightProgGuide/01introduction/chapter_1_section_1.html
It looks like you have to go through the QuickTime API. There is supposed to be a Sample Project called "MungGrab" which could be worth a look according to this thread.
If you poke around Apple's mailing lists you can find some code to do it in Java as well. Here's a simple example suitable for capturing individual frames, and here's a more complicated one that's fast enough to display live video.
There's a command line utility called isightcapture that does more or less what you want to do. You could probably get the code from the developer (his e-mail address is in the readme you get when you download the utility).
One thing that hasn't been mentioned so far is the IKPictureTaker, which is part of Image Kit. This will come up with the standard OS provided panel to take pictures though, with all the possible filter functionality etc. included. I'm not sure if that's what you want.
I suppose you can use it from other languages as well, considering there are things like cocoa bridges but I have no experience with them.
Googling also came up with another question on stackoverflow that seems to address this issue.
Aside from ObjC, you can use the PyObjC or RubyCocoa bindings to access it also. If you're not picky about which language, I'd say use Ruby, as PyObjC is horribly badly documented (even the official Apple page on it refers to the old version, not the one that came with OS X Leopard)
Quartz Composer is probably the easiest way to access it, and .quartz files can be embed in applications pretty easily (and the data piped out to ObjC or such)
Also, I suppose there should be an example or two of this in the /Developer/Examples/
From a related question which specifically asked the solution to be pythonic, you should give a try to motmot's camiface library from Andrew Straw. It also works with firewire cameras, but it works also with the isight, which is what you are looking for.
From the tutorial:
import motmot.cam_iface.cam_iface_ctypes as cam_iface
import numpy as np
mode_num = 0
device_num = 0
num_buffers = 32
cam = cam_iface.Camera(device_num,num_buffers,mode_num)
cam.start_camera()
frame = np.asarray(cam.grab_next_frame_blocking())
print 'grabbed frame with shape %s'%(frame.shape,)