Official ObjectGraph Blog

Accessing Lon/Lat/Alt

April 16th, 2008

I could access Lon/Lat/Alt values from iPhone’s Location Manager class. This is kind neat. I got exact same value that I put my apartment address in google map. When I run this on the simulator, it always returns a address in Santa Clara. Is this Apple’s company building address or something? Let me know if anyone familiar with the address below.

Lon Lat on Simulator

Simulator generates values

iPhone Application Movie - Shake Me 3 times!

April 14th, 2008

Check out our sample iPhone Application demo movie. It says “boring” after you shake it 3 times.

OpenFlashCards.com Tutorial Movie Released

April 12th, 2008

OpenFlashCards.com tutorial

Compiling Objective-C using only Command Line

April 11th, 2008

My newest love is TextMate, the ultimate Mac OSX text editor. I am so used to having TextPad on Windows that i felt lost with out a good  editor. I used vi for a while, but it felt awkward after sometime.  As you know from my previous blog posts, I am learning Objective-C to program the iPhone. I am using textmate now to program simple console based Objective C programs. So if you want to compile them using command line use the following

gcc sample.m  -o sample -L /System/Library/Frameworks/Foundation.framework/Foundation

 

iPhone OS expires

April 8th, 2008

UPDATE: Back in business as of 8:50 PM EST. 

Early in the morning today my iphone stopped working. I checked with kiichi and his iphone was bricked too. Here is a screen shot of what XCode says.

    

The version of software available on Apple’s developer site is the same as i have, so the OS version did not update yet. Seems like many other developers are having the same problem.

  

Embedding Flash Cards

April 1st, 2008

ObjectGraph Approved for Apple Developer Program - Take 2

March 28th, 2008

After a little struggle, got my iPhone changed to version 2.0, was able to connect to our exchange server at school and was able to launch an OpenGL application on the iPhone.

So, no more excuses. We at objectgraph have to get our act together and start building applications for iPhone starting yesterday.

OpenFlashCards.com Launched

March 27th, 2008

We would like to announce that OpenFlashCards.com was published today. This is a website which you can browse,create, and share multiple choice questions flash cards. The interface is simple and easy to start to create your own cards. Please feel free to create your cards. We will add more features on this website :
1. Embedding Cards in your website.
2. Community Functions such as rating system.
3. More configuration about flash cards settings.


http://www.openflashcards.com/

Check these screen shots:

Please give us your suggestion and recommended categories in this comment box!

ObjectGraph Approved for Apple Developer Program

March 27th, 2008

Cool news today!! After sending apple all our company’s documents, we got approved for the developer program. I purchased it for $99 + Tax, the store status says it is electronically delivered, but i did not get any email with a certificate key or anything.

Will keep you posted on  the latest news!

PageChat Update: Smaller Player

March 22nd, 2008

We enhanced the pagechat player to hide the top bar and users menu. Now all you have to do is copy and paste the following code

<script>
var pagechat_width = ‘600px’;
var pagechat_height = ‘400px’;
</script>
<script
src=”http://s1.pagechat.com/pagechat/js/embed.js”
id=”pagechat_embed”>
</script>

Check it out @ http://www.oreillymaker.com

Arthur C. Clarke passes away

March 18th, 2008

Information is not knowledge, knowledge is not wisdom, and wisdom is not foresight.

Arthur C. Clarke


sprintf with NSString

March 16th, 2008

So, I have been struggling to learn Objective C. Here is a snippet of code that might be helpful. Basically you can use NSString’s initWithFormat method to create a new NSString object and use it just like sprinf function in C

[[NSString alloc] initWithFormat:@”(%f,%f)”,center.x,center.y]   

iPhone Development and a sample Objective C Program

March 15th, 2008

Kiichi and I really liked the demo from apple about the iPhone SDK.

If you haven’t seen it, check it out@

http://www.apple.com/quicktime/qtv/iphoneroadmap/

We at ObjectGraph think the new app store feature will level the playing field for all developers, big(EA) and small(OG). Now its up to developers to create new applications and make them success stories. So We started developing in Objective C. With its kinda wierd syntax coming from C#, Java, ActionScript and Python, but here is my first try anyway :-)

I am creating a MyPoint class with a distance function that takes a reference of an another point.


#import <Cocoa/Cocoa.h>

@interface MyPoint : NSObject {

	int x;
	int y;

}

-(void) print;
-(void) setX:(int) a; // void setX(int a);
-(void) setY:(int) b;
-(int) getX;
-(int) getY;
-(double) distance:(MyPoint*) p;

@end

Implementation

#import "MyPoint.h"
#import <stdio.h>
#import <math.h>

@implementation MyPoint

-(void) print
{
	printf("(%d,%d)",x,y);
}

-(void) setX:(int) a
{
	x=a;
}

-(void) setY:(int) b
{
	y=b;
}

-(int) getX
{
	return x;
}

-(int) getY
{
	return y;
}

-(double) distance:(MyPoint*) p;
{
	return sqrt((x-[p getX])*(x-[p getX])+(y-[p getY])*(y-[p getY]));
}

@end

Main

#import <Foundation/Foundation.h>
#include <stdio.h>
#import "MyPoint.h"

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

	MyPoint *point1=[[MyPoint alloc] init];
	[point1 setX:10];
	[point1 setY:20];

	[point1 print];

	MyPoint *point2=[[MyPoint alloc] init];
	[point2 setX:10];
	[point2 setY:30];
	[point2 print];

	printf("Distance: %lf\n", [point1 distance:point2]);

	[point1 release];
	[point2 release];

	[pool drain];
    return 0;
}

Blog moved to wordpress

March 15th, 2008

I really wanted to learn how to create plugins for wordpress, So as a first step i am moving the official blog to wordpress. I am still not impressed with the templates that are available, So in the next few days I will try to make the look and feel look more like the www site.

Announcing PageChat.com

February 5th, 2008

PageChat.com is an innovative tool to communicate with anyone by dynamically creating chat rooms.

You could also use page chat to communicate with others about various topics of interest. Integrate our chat rooms with your websites/blogs to create a unique experience for your audience to chat with each other while on the same page.

We are currently releasing this version as a public beta and these are upcoming features:

  • Sharing Files
  • Guest View
  • Youtube integration

Please Check it out @

http://www.pagechat.com/

Enjoy!

O’Rielly Maker: Make fun O’Rielly Book Covers

January 21st, 2008

Make funny book covers that resemble O’Reilly books using the link below.



http://www.oreillymaker.com

We just launched it yesterday and there are already some really funny ones.

Check these out.








Zen of Python

November 7th, 2007

>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

iPhone Cake 2.0

October 21st, 2007

10_20_07 120.jpg

10_20_07 124.jpg


Happy Birth Day!

django vs rails - Funny

October 15th, 2007

and yes, we are DJ Ango!

PyScraper: The Python Screen Scraper

September 25th, 2007

I wrote a light weight python based screen scraper, which seems to be working great.

Some of the features:

  • Session Management when using cookies
  • Seperate functions for get,post and downloading large files
  • Automatic handling of redirections

Here is the code for it.

import httplib,urllib,random,sys,re,os
from urlparse import urlparse

class PyScraper:
 def __init__(self):
  self.cookie=""
  self.currenturl=""
  self.urlhist=[]

 def __str__(self):
  ret=''
  for item in self.urlhist:
   ret=ret+item+'->'
  return ret

 def download(self,url,localfolder):
  bufsize = 1024
  self.urlhist.append(url)
  o=urlparse(url)
  scheme,hostname,path,q,query,position=o
  head,fname = os.path.split(path)
  if(query!=''):
   path=path+"?"+query

  conn=httplib.HTTPConnection(hostname)
  conn.request('GET', path,None,{'Cookie':self.cookie})
  resp=conn.getresponse()
  total=int(resp.getheader('content-length'))
  f = open(localfolder+"/"+fname,'wb')
  sofar = 0
  while 1:
   data = resp.read(bufsize)
   f.write(data)
   sofar += len(data)
   perc = (float(sofar)/float(total))
   count = int(perc * 20)
   sys.stdout.write("\r%-30s|%-20s|%3d percent" % (fname,'#'*count,perc*100))

   sys.stdout.flush()
   #sys.stdout.write("\r" + str(sofar) + " / " + str(total))total
   if len(data)==0:
    break
  f.close()
  if(resp.getheader('set-cookie')!=None):
   self.cookie=resp.getheader('set-cookie')
  conn.close()
  if(resp.status==302 or resp.status ==301):
   return self.get(resp.getheader('location'))
  return data

 def get(self,url):
  self.urlhist.append(url)
  o=urlparse(url)
  scheme,hostname,path,q,query,position=o
  if(query!=''):
   path=path+"?"+query

  conn=httplib.HTTPConnection(hostname)
  conn.request('GET', path,None,{'Cookie':self.cookie})
  resp=conn.getresponse()
  data= resp.read()
  if(resp.getheader('set-cookie')!=None):
   self.cookie=resp.getheader('set-cookie')
  conn.close()
  if(resp.status==302 or resp.status ==301):
   return self.get(resp.getheader('location'))
  return data

 def post(self,url,data):
  self.urlhist.append(url)
  o=urlparse(url)
  scheme,hostname,path,q,query,position=o
  conn=httplib.HTTPConnection(hostname)
  conn.request('POST', path,data,
{'Content-Type':'application/x-www-form-urlencoded','Cookie':self.cookie})
  resp=conn.getresponse()
  data= resp.read()
  if(resp.getheader('set-cookie')!=None):
   self.cookie=resp.getheader('set-cookie')
  conn.close()
  if(resp.status==302 or resp.status ==301):
   return self.post(resp.getheader('location'),data)
  return data

Here is some snippet of code on how to use it.

from pyscraper import PyScraper

p=PyScraper()
data=p.get("http://www.yahoo.com/")
print data