Latest Episode
 

Go Back   Keith and The Girl Forums Keith and The Girl Forums Talk Shite

Talk Shite General discussion

Reply
 
Thread Tools Display Modes
Old 06-17-2009, 01:08 AM   #491 (permalink)
Senior Member
 
Emelath's Avatar
 
Join Date: Jun 2006
Location: Napoli, Italy
Posts: 227
Thanks will have to wait till Friday on the update I leave for Crete today. I will let you know my progress when I get back thanks
(Offline)   Reply With Quote
Old 06-17-2009, 01:36 AM   #492 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
Quote:
Originally Posted by Emelath View Post
Thanks will have to wait till Friday on the update I leave for Crete today. I will let you know my progress when I get back thanks
If you want to do it today the links to 3.0 are posted in this thread on I think page 43, but people have had mixed results and I wouldn't want you to bork your phone right before a trip.
(Offline)   Reply With Quote
Old 06-17-2009, 10:31 AM   #493 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
This isn't in the official literature but it's an interesting comment (I suspect that this was fired off blindly without actually testing it's validity):

Quote:
If you bought the original iPhone, you have the pride of being the first to own one... but you will also be left out when you install and use some of the nice new features in the iPhone 3.0 update.

One of the most awaited features, push notifications, requires a constant data connection. While the iPhone 3G can handle data and voice simultaneously when using a 3G/HSDPA connection, on EDGE (the cellular data service that the original iPhone uses) you are unable to take calls and maintain a persistent data connection. As a result, if you turn on the push notification service, you will be unable to receive voice calls.

Some iPhone owners might consider this a slap in the face from Apple, while other iPhone users will just be glad that their phone now has notifications. Either way, the good thing is that the voice mail system uses a data connection, so you will still get your voicemails.

Push notifications could also end up being a flop for other iPhone users too. Due to the structure of the service, push notifications can get lost in transit, and pushes to the same app (possibly all pushes) kick older ones out of the push queue.

Let us know your thoughts about push notifications on the first generation iPhone in our poll and comments!
Original iPhone owners & Push Notifications

EDIT: and they already retracted it because it was dumb and wrong. Nevermind.
(Offline)   Reply With Quote
Old 06-17-2009, 10:49 AM   #494 (permalink)
Senior Member
 
yoav's Avatar
 
Join Date: Apr 2006
Posts: 1,049
Quote:
Originally Posted by hayroob View Post
This isn't in the official literature but it's an interesting comment (I suspect that this was fired off blindly without actually testing it's validity):



Original iPhone owners & Push Notifications

EDIT: and they already retracted it because it was dumb and wrong. Nevermind.
that's hilarious, sounds like the guy got fired the other day and left it as a goodbye gift to apple.
(Offline)   Reply With Quote
Old 06-17-2009, 01:50 PM   #495 (permalink)
Senior Member
 
TheGrundle's Avatar
 
Join Date: Jun 2006
Location: New Orleans
Posts: 748
Quote:
Originally Posted by yoav View Post
that's hilarious, sounds like the guy got fired the other day and left it as a goodbye gift to apple.
Yeah, totes wrong. I'm on an original iPhone and can do both push and receive callls.
(Offline)   Reply With Quote
Old 06-17-2009, 03:02 PM   #496 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
Quote:
Originally Posted by Sajizzle View Post
Does push notification work on the iPod Touch with wifi?
I think so, haven't tested but I don't see why not. Install and let me know and I'll send a test.
(Offline)   Reply With Quote
Old 06-17-2009, 03:16 PM   #497 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
Quote:
Originally Posted by Sajizzle View Post
OK, installed. My wireless has been a little bitchy recently, so if I don't get it, it could be because of my end. I'll let you know if I do get it.
Go to the chat.
(Offline)   Reply With Quote
Old 06-17-2009, 04:35 PM   #498 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
Todays build with people added.
http://whywontyoudie.com/06-17-09-KATG.com.zip
(Offline)   Reply With Quote
Old 06-17-2009, 10:50 PM   #499 (permalink)
Senior Member
 
FrozenViking's Avatar
 
Join Date: May 2008
Location: Norway, its fuckin cold
Posts: 302
Trying the newest build with 3.0 installed.

Works like a charm, fucking awesome. No problems so far at least!
(Offline)   Reply With Quote
Old 06-17-2009, 10:53 PM   #500 (permalink)
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
I've got some working python that will run in the background and check for tweets from a particular user to another particular user and then based on that criteria forward the message to a push notification.

Code:
from twitter import *
from xml.dom.minidom import parse, parseString
from ConfigParser import SafeConfigParser
import socket, ssl, json, struct
import urllib, time, sys, os
import pickle

# Export your "Apple Development Push Services" certificate from your Keychain (important: select it from the "My Certificates" category in the sidebar). Export the certificate as a "Personal Information Exchange (.p12) file. You shouldn't give the exported file a password (well you could but YMMV).
# Convert the .p12 file you just exported into a pem file:
# openssl pkcs12 -in certificates.p12 -out dist_cert.pem -nodes -clcerts

# The first time you launch this or if your d.pkl file is deleted/corrupted use the --prime switch to make sure you don't send old notifications

def getTweets(d):
	credentials = loadConfig(os.path.join(os.getcwd(), 'config'))
	twitter = Twitter(credentials.get('user'), credentials.get('pass')) # create a file called config with your username and password for the account receiving the tweet
	tweets = twitter.replies()
	t = []
	for tweet in tweets:
		x = tweet.get('user')
		if x.get('screen_name') == 'someusername': #this is the user name the tweet is coming from
			time = tweet.get('created_at')
			body = tweet.get('text')
			if not(time in d):
				print 'Send notification:'
				send(body[15:])
				d[time] = body
	return d


def prime(d):
	credentials = loadConfig(os.path.join(os.getcwd(), 'config'))
	twitter = Twitter(credentials.get('user'), credentials.get('pass'))
	tweets = twitter.replies()
	t = []
	for tweet in tweets:
		x = tweet.get('user')
		if x.get('screen_name') == 'hayroob':
			time = tweet.get('created_at')
			body = tweet.get('text')
			if not(time in d):
				d[time] = body
	return d


def send(Message):
	print Message
	url = 'http://yourfeed.com/feed'
	data = ''
	filehandle = urllib.urlopen(url, data)
	
	time.sleep(5)
	xml = filehandle.read()
	xmldoc = parseString(xml)
	nodeArray = xmldoc.getElementsByTagName('deviceToken')
	tokens = []
	for node in nodeArray:
		try:
			deviceToken = node.firstChild.toxml()
			tokens.append(deviceToken)
		except:
			continue
	
	sound = 'keithandthegirl.com.caf' #sound in your resources file
	
	for deviceToken in tokens:
		thePayLoad = {
			'aps': {
				'alert':Message,
				'sound':sound,
				'badge':1,
				},
			}
		
		theCertfile = 'dist_cert.pem'
		theHost = ('gateway.push.apple.com', 2195)
		
		data = json.dumps(thePayLoad)
		deviceToken = deviceToken.replace(' ','').decode('hex')
		
		theFormat = '!BH32sH%ds' % len(data)
		theNotification = struct.pack(theFormat, 0, 32, deviceToken, len(data), data)
		
		ssl_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM), certfile=theCertfile)
		ssl_sock.connect(theHost)
		ssl_sock.write(theNotification)
		ssl_sock.close()


def loadConfig(filename):
	options = ({})
	if os.path.exists(filename):
		cp = SafeConfigParser()
		cp.read([filename])
		if cp.has_option('twitter', 'user'):
			options['user'] = cp.get('twitter', 'user')
		if cp.has_option('twitter', 'pass'):
			options['pass'] = cp.get('twitter', 'pass')
	return options


try:
	pkl_file = open('d.pkl', 'rb')
	d = pickle.load(pkl_file)
except:
	d = ({})

for arg in sys.argv:
	if arg.startswith('--prime'):
		prime(d)
		print 'Primed'

try:
	doAction = lambda : getTweets(d)
	while True:
		d = doAction()
		time.sleep(180)
except KeyboardInterrupt:
	output = open('d.pkl', 'wb')
	pickle.dump(d, output)
	output.close()
	print >>sys.stderr, '\n[Keyboard Interrupt]'
	pass
and the config file:

Code:
[twitter]
user : yourusername
pass : yourpassword
You'll need python 2.6 and http://mike.verdone.ca/twitter/

Last edited by hayroob; 06-17-2009 at 11:28 PM.
(Offline)   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT -5. The time now is 02:41 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Keith and The Girl