How to add a lot of files to svn in one shot

When your svn status gives you a lot of files to add it is quite painful to add them one by one.

Here is a command to add all new file in one shot :

svn status | grep '?' | sed 's/\?       //' | xargs svn add

HTML 5 sample

Here is a very cool demo of what HTML 5 can do :



http://apirocks.com/html5/html5.html#slide1

Via Sylvain

I lost MY SERVER

Hi there, Yesterday my server crashed… oops what a bad news.

After lot of work to make all this f***g stuff to work again, the result is all this strange, <hug!> awfull design in all my blogs. I guess I can fix all that as soon as possible and make things better than they are today.

Stay tuned for more details

A new blog about Iphone development

Hi there. I post more and more about development on iphone so I created a blog for that. In This blog I will reference

  • all Iphone API I find
  • Some tips about Iphone
  • Some development I make

Have a look at it here : http://iphone.demay-fr.net

I’ll continue to populate this blog with other topics Cheers

eGalax and drag on Ubuntu

By default an eGalax touchscreen works fine with a Ubuntu. Fine but not perfectly… because drag is not detected.

After a couple of minute searching on the Internet, I found it is a bug and a known bug (link).

so here is the procedure to fix it on ubuntu Karmic

First of all check your device :

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=3

Then 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 &gt;&gt; debian/patches/series dpkg-buildpackage
sudo dpkg -i ../xserver-xorg-input-evtouch_0.8.8-0ubuntu3_i386.deb

This procedure works perfectly for me and make Enna sexier ;)

Is your compagny product as good as ….




no coments….

[Cocoa] How to add a toolbar with button on top of a UITextView in order to add a dismiss button

The big problem with UITextView is there isn’t any native way to hide the keyboard once the input ended.
The following code describes a DissmisableTextView. This view extends UITextView adding on top of the keyboard associated with this UITextView a toolbar with a « Done » Button :

Here is the code :

//
//  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.
//
 
@interface DismissableTextView : UITextView {
  UIToolbar* keyboardToolbar;
}
- (void) keyboardWillShow:(NSNotification *)note;
- (void) dismissKeyboard; 
 
@end
 
//
//  DismissableTextView.m
//
//  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:@"&lt;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:@"&lt;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

Cocoa : Who to handle MouveXXX events on UIWebView

Default behavior of the UIWebView is : eat touchXXX events and not send them to the nextResponder. One way to be able to catch this kind of event on a UIWebView is to add on top of it a UIView. But at this point, links, scroll, etc… are not capture to inner components of the under UIWebView. Here is a HACK to make this struff work :

 // //  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 

Loi Hadopi en France

«Bourbier juridique», «nuage de Tchernobyl», «pas raisonnable». Hier encore, la loi création et Internet (dite Hadopi) s’est fait tailler un joli costard. Repoussé par la loi sur l’hôpital, l’examen du projet devrait démarrer aujourd’hui à l’Assemblée nationale et, hormis une page de pub dans le Monde rassemblant les signatures de 10 000 artistes en faveur du texte, le climat est hostile.[...] (Libération)

Bannière 1 du site Dédé Ca-va-couper.fr

Writing / Reading files on native Iphone Application

Here is a little sample to write/read files with objective c on native Iphone Application.
This snippet write into the Document Directory of the application. We will see later problems when trying to write in the Resources folder


WRITE

 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]; 



READ

 //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 } 





WARNING : It is possible to get a file from Resources Folder with the follwing line :

 NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:extension]; 


Be carreful with that because if the file does not exist filePath will be null, so it will be impossible to create the file… difficult to write into the file :p