On connecting device - iTunes or iPhotos must not open
You just have to change the prefs of those 2 apps. For instance, iPhoto you have to choose "No application" in the pop-up menu show hereunder :



And you adjust the settings of iTunes the same way : just check the checkbox "Prevent ...".