Thursday 7 January 2010
A new blog about Iphone development
Par Vincent DEMAY, Thursday 7 January 2010 :: Wicket
- all Iphone API I find
- Some tips about Iphone
- Some development I make
I'll continue to populate this blog with other topics Cheers
Thursday 7 January 2010
Par Vincent DEMAY, Thursday 7 January 2010 :: Wicket
Monday 4 January 2010
Par Vincent DEMAY, Monday 4 January 2010 :: Ubuntu
[doume]>cat /proc/bus/input/devices I: Bus=0003 Vendor=0eef Product=0001 Version=0100 N: Name="eGalax Inc. USB TouchController" P: Phys=usb-0000:00:1d.0-1/input0 S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input5 U: Uniq= H: Handlers=mouse2 event5 B: EV=b B: KEY=400 0 0 0 0 0 0 0 0 0 0 B: ABS=3Then patch evtouch and rebuild it :
cd /tmp sudo apt-get build-dep xserver-xorg-input-evtouch apt-get source xserver-xorg-input-evtouch cd xf86-input-evtouch-0.8.7/ rm debian/patches/02-buttonless-device.patch wget -O debian/patches/02-buttonless-device.patch http://launchpadlibrarian.net/26529094/02-buttonless-device.patch echo 02-buttonless-device.patch >> debian/patches/series dpkg-buildpackage sudo dpkg -i ../xserver-xorg-input-evtouch_0.8.8-0ubuntu3_i386.debThis procedure works perfectly for me and make Enna sexier ;)
Thursday 6 August 2009
Par Vincent DEMAY, Thursday 6 August 2009 :: Technologies
Thursday 2 July 2009
Par Vincent DEMAY, Thursday 2 July 2009 :: IPhone
// // DismissableTextView.h // // A textView allowing to dismiss keyboard with a toolbar and a // Done button on top of the keyboard // // Created by Vincent Demay on 02/07/09. // #import@interface DismissableTextView : UITextView { UIToolbar* keyboardToolbar; } - (void) keyboardWillShow:(NSNotification *)note; - (void) dismissKeyboard; @end
//
// DismissableTextView.m
// murena
//
// Created by Vincent Demay on 02/07/09.
//
#import "DismissableTextView.h"
@implementation DismissableTextView
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
//register a specific method on keyboard appearence
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
}
return self;
}
- (void)keyboardWillShow:(NSNotification *)notification
{
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) {
// Now iterating over each subview of the available windows
for (UIView *keyboard in [keyboardWindow subviews]) {
// Check to see if the description of the view we have referenced is UIKeyboard.
// If so then we found the keyboard view that we were looking for.
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) {
NSValue *v = [[notification userInfo] valueForKey:UIKeyboardBoundsUserInfoKey];
CGRect kbBounds = [v CGRectValue];
if(keyboardToolbar == nil) {
keyboardToolbar = [[UIToolbar alloc] initWithFrame:CGRectZero];
keyboardToolbar.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(dismissKeyboard)];
UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
NSArray *items = [[NSArray alloc] initWithObjects:flex, barButtonItem, nil];
[keyboardToolbar setItems:items];
[items release];
}
[keyboardToolbar removeFromSuperview];
keyboardToolbar.frame = CGRectMake(0, 0, kbBounds.size.width, 30);
[keyboard addSubview:keyboardToolbar];
keyboard.bounds = CGRectMake(kbBounds.origin.x, kbBounds.origin.y, kbBounds.size.width, kbBounds.size.height + 60);
for(UIView* subKeyboard in [keyboard subviews]) {
if([[subKeyboard description] hasPrefix:@"<UIKeyboardImpl"] == YES) {
subKeyboard.bounds = CGRectMake(kbBounds.origin.x, kbBounds.origin.y - 30, kbBounds.size.width, kbBounds.size.height);
}
}
}
}
}
}
- (void) dismissKeyboard {
[self resignFirstResponder];
}
- (void)dealloc {
[super dealloc];
}
@end
Tuesday 23 June 2009
Par Vincent DEMAY, Tuesday 23 June 2009 :: IPhone
//
// TouchUIWebView.h
//
// Created by Vincent Demay on 19/06/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import
@interface DummyTapView : UIView {
UIView * uiScroller_;
UIView * uiWebDocumentView_;
}
@property(nonatomic, retain) UIView *uiScroller;
@property(nonatomic, retain) UIView *uiWebDocumentView;
@end
@interface TouchUIWebView : UIWebView {
}
@end
//
// TouchUIWebView.m
//
// Created by Vincent Demay on 19/06/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "TouchUIWebView.h"
const char* kUIScrollerName = "UIScroller";
const char* kUIWebDocumentView= "UIWebDocumentView";
@implementation DummyTapView
@synthesize uiScroller = uiScroller_;
@synthesize uiWebDocumentView = uiWebDocumentView_;
//
// retreive the scroller view in uiwebView
// used to compute scrolling in the loaded web page
//
- (UIView*) uiScroller {
if( self.superview !=nil && uiScroller_ == nil ) {
NSArray *views = [self.superview subviews];
for( id view in views ) {
const char* name = object_getClassName(view);
if( !strncmp( name, kUIScrollerName, strlen(name) ) ) {
uiScroller_ = view;
return uiScroller_;
}
}
}
return uiScroller_;
}
//
// retreive the document view in UiWebView
// used to compute touch on link etc...
//
- (UIView*) uiWebDocumentView {
if( self.superview != nil && uiWebDocumentView_ == nil ) {
NSArray *views = [self.uiScroller subviews];
for( id view in views ) {
const char* name = object_getClassName(view);
if( !strncmp( name, kUIWebDocumentView, strlen(name) ) ) {
uiWebDocumentView_ = view;
return uiWebDocumentView_;
}
}
}
return uiWebDocumentView_;
}
- (id) initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
self.backgroundColor = [UIColor clearColor];
return self;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.uiScroller touchesBegan:touches withEvent:event];
[self.uiWebDocumentView touchesBegan:touches withEvent:event];
[self.nextResponder touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self.uiScroller touchesMoved:touches withEvent:event];
[self.uiWebDocumentView touchesMoved:touches withEvent:event];
[self.nextResponder touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.uiScroller touchesEnded:touches withEvent:event];
[self.uiWebDocumentView touchesEnded:touches withEvent:event];
[self.superview didFinishGesturesInView:self.superview forEvent:event];
[self.nextResponder touchesEnded:touches withEvent:event];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[self.uiScroller touchesCancelled:touches withEvent:event];
[self.uiWebDocumentView touchesCancelled:touches withEvent:event];
[self.nextResponder touchesCancelled:touches withEvent:event];
}
@end
@implementation TouchUIWebView
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
// Initialization code
DummyTapView* view = [[DummyTapView alloc]
initWithFrame:CGRectMake( 0,0,self.frame.size.width,self.frame.size.height)];
[self addSubview:view];
[view release];
}
return self;
}
@end
Thursday 12 March 2009
Par Vincent DEMAY, Thursday 12 March 2009 :: About Me
Wednesday 4 February 2009
Par Vincent DEMAY, Wednesday 4 February 2009 :: IPhone
NSString *dataStr = @"my data"; //get Document Root NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; //append file name to path NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"myFile"]; //prepar data in A NSData from a String NSData *aData = [dataStr dataUsingEncoding: NSUTF8StringEncoding]; //Write to the file. //File will be automacally created if not exist [aData writeToFile:filePath atomically:YES];
//get Document root
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"myFile"];
NSString *myText = [NSString stringWithContentsOfFile:filePath];
if (myText) {
return myText;
} else {
//can not read because file does not exists
//make here your error handler
}
NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];
Sunday 11 January 2009
Par Vincent DEMAY, Sunday 11 January 2009 :: IPhone
//prepar request
NSString *urlString = [NSString stringWithFormat:@"http://urlToSend.com"];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
//set headers
NSString *contentType = [NSString stringWithFormat:@"text/xml"];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
//create the body
NSMutableData *postBody = [NSMutableData data];
[postBody appendData:[[NSString stringWithFormat:@"<xml>"] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"<yourcode/>"] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"</xml>"] dataUsingEncoding:NSUTF8StringEncoding]];
//post
[request setHTTPBody:postBody];
//get response
NSHTTPURLResponse* urlResponse = nil;
NSError *error = [[NSError alloc] init];
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Response Code: %d", [urlResponse statusCode]);
if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) {
NSLog(@"Response: %@", result);
//here you get the response
}
Friday 9 January 2009
Par Vincent DEMAY, Friday 9 January 2009 :: IPhone
NSString * stringFromInfoPlist = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"stringInInfoPlist"];
Wednesday 7 January 2009
Par Vincent DEMAY, Wednesday 7 January 2009 :: About Me
Saturday 3 January 2009
Par Vincent DEMAY, Saturday 3 January 2009 :: IPhone
// open the default address book.
ABAddressBookRef m_addressbook = ABAddressBookCreate();
if (!m_addressbook) {
NSLog(@"opening address book");
}
//get people and index
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(m_addressbook);
CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook);
//iterate on each person
for (int i=0;i < nPeople;i++) {
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i);
//get phone numbers and names
ABMultiValueRef phoneNumberProperty = ABRecordCopyValue(ref, kABPersonPhoneProperty);
NSArray* phoneNumbers = (NSArray*)ABMultiValueCopyArrayOfAllValues(phoneNumberProperty);
NSString* name = (NSString*)ABRecordCopyValue(ref, kABPersonFirstNameProperty);
CFRelease(phoneNumberProperty);
//Loop to display results
NSLog(@"Name = %@", name);
NSLog(@"Phone numbers = ");
for (int j=0; j<[phoneNumbers count]; j++) {
NSLog(@" phone -> %@", [phoneNumbers objectAtIndex:j]);
}
//release memory
[phoneNumbers release];
}
Wednesday 3 December 2008
Par Vincent DEMAY, Wednesday 3 December 2008 :: IE sucks
From http://iedeathmarch.org/:Internet Explorer 6 will be SEVEN years old on August 27th. It came out a few weeks before the Twin Towers fell. It came out before the Nintendo GameCube. It came out before the first iPod.
It’s time to put a deadline on dropping IE6, and I say that time is now, and the deadline should be soon… say like, March 2009.
Friday 21 November 2008
Par Vincent DEMAY, Friday 21 November 2008 :: SEO Optimization
Monday 20 October 2008
Par Vincent DEMAY, Monday 20 October 2008 :: About Me
Tuesday 14 October 2008
Par Vincent DEMAY, Tuesday 14 October 2008 :: MacOS