Practices to prevent/control image content - version-control

Dead code is easily recognised and eliminated by having code reviews, however, when it comes to images - unused images still get into our version control. Is there any clean way of organising graphic content so that a direct correlation exists between web pages and image files?
In our current project, we use create master PNG files then export the required layers for development purpose. Recently I figured out that there is some bloat in the images folder. Doing a search for image names in code helps but it is very painful when it needs to be done for hundred odd images. So asking the forum for suggestions

You could walk the website with a crawler (like wget) and remove any image not touched (i.e. not listed in your logs.)
A quicker way would be to just dump all the image file names found in your code.
grep -o -e \w*?\.png (caution: untested regex)

If you have a 1 step build and can test for dead links, then you should be able to write a script that would do a clean checkout of the project, delete a single image and build & test the project. If no errors pop up the image is unneeded.
It would take a long time to run (maybe days depending on the project size) but that's computer time, not man-hours.

Related

Tool to compare and merge files in different folders

I am developing two Java based projects that are very similar which means that what i do to the first one i can use diff to... command in Netbeans to apply the changes to the second one. However there is a problem with the images folder. For example i work one week on the first project and during this week i put 34 new images in the images directory. Then i have to put some of this images in the images directory of the second project. Copy/paste is not a solution because the projects are NOT EXACTLY THE SAME.
That is why i need you to recommend me some tool that can show me which pictures are missing in the seconds directory so i can simply drag them to their new location:)
diff -rq <path1> <path2> will give you a list of files that are only in one of the paths, as well as an indication of whether file names that exist in both actually have the same content.

Hybrid version control & sync system?

Is anyone aware of a hybrid version control and synchronising system?
I'm currently a happy mercurial user, but my projects usually contain a mixture of files.
Most of these (code, documentation, ...) I want to be version-controlled. This is why I use mercurial.
However, on the rare occasion I have files that I would like to synchronise between my working copies, but not version control.
For example, I version control the code I write to do image processing. This code can produce a whole bunch of output images which I'd like to have synchronised so I don't have to remember to shuffle them around my various computers, but there's no point having these version controlled.
To clarify - I am aware of extension to mercurial such as bfiles and bigfiles, which are handy for my image example, but I was just wondering if anyone out there knows of alternative ways to handle this. I just want the one system that I can tell "version control all files except those ones, which should be synced but have no history".
cheers!
EDIT: I could do something like adding a hg marksync <filename> that added <filename> to a list of files to be synced, and then adding a hook to hg push/hg pull that would (say) run rsync (or whichever sync tool) in the background, but I wondered if there was a less hacky solution (I think bfiles/bigfiles do something along these lines anyway).
Version Control System (any) doesn't care about synchronization of
not versioned data
besides default pathes
If you want sync any files - use specially designed for this task tools: f.e. rsync
This code can produce a whole bunch of output images which I'd like to have synchronised
Is this DATA or part of your CODE?
If data: Keep out of your versioning system, just don't go there. If it is part of your code (like layout images) check it in. Those are the only ways which are the generally accepted.
A nice solution for the data would be syncing OR generating them. So you might add a step after deployment to a server: GenerateImages().
edit: In addition to the comment made by the thread starter:
If the images are data and you need to process them on a different system don't think about the version control for your code. It is unrelated. The steps which would make sense to me, in order of processing:
Start with updating your image code, check it in versioning. Then deploy (yes this is deployment) the updated code to the cruncher computer. Now code is done.
Then you have tasks which the number cruncher should handle. Like processing the images. So start that processing from either the cruncher itself (probably some queue happens there) or from a central dispatcher.
Then you have the results locally at the cruncher. Now something has to happen with that data, so that's also part of your software. Decide whether you want the cruncher to send them to some central storage, your workstation or another location. Let the software handle that. This is the most hard part as I read through your question. Many solutions are possible from just FTP/network transfers to specific storage solutions. Willing to help but need more info about the real issues, amounts, sizes etc. on these parts.
If the new updated version of the image processor makes the old generated images obsolete implement that also in your code, by for example attaching an attribute to the files generated, a seperate folder or another indication. That way you could request the cruncher after update to re-generate any obsolete files.

Collaborating on an iOS game with an artist living somewhere else / modifying files in an iOS app without rebuilding

a former coworker (artist) and myself (programmer) are currently developing a small game together in our free time. Since he is not at all interested in learning how to use XCode, save making his own builds (I don't blame him, he is a great artist, but with only little understanding for technical stuff), this is how we have been working so far:
We share a dropbox folder where we store all the ingame artwork
Once enough or important changes have been made, I'd create a build (ad hoc distribution) and send it to him
From time to time we'll meet and work together a couple of hours, maybe once a week since we live in different cities
This was ok for most of the time. However now we're busy finetuning the content and game mechanics. In this development stage, our workflow is just to slow and "disconnected". Whenever he is working on the artwork, he'll have to wait for me to make a build to be able to see the changes reflected in the actual context. Since we're not always working at the same time, this sometimes means he'll have to wait for days - not at all satisfying.
So, what I'd like to know..: What would be the best way to allow him to change the content without the need to rebuild the game?
I know the contents of an iOS app bundle cannot be changed once compiled. So here's what I was thinking about so far:
move the content to the documents folder during development so that it can be accessed via iTunes (handling propably awkward in light of the amount of files in question)
incorporate dropbox into the game, so that the content could be loaded right from our shared folder (extra work needed to implement this, dropbox restricted to 5000 API calls per day while not in production status)
load the content from a webserver (even more complicated compared to using the dropbox)
What do you guys think? Are there better and more comfortable ways to achieve smooth collaboration in our case? Am I missing something?
Thanks alot!!
Edit:
At the moment, I have no plans whatsoever to teach my artist how to make his own builds. You can seriously consider this to be an option only as long as you don't know him in person. He's a great artist, though.
So this question boils down to:
How do I modify files / get new files into an iPhone app after it has been built - as easily as possible and, again, without rebuilding the app?
This has to work during development only, by the way, so dirty approaches are welcome.
In some of the WWDC 2010 videos, Apple discusses this. They advise loading artwork from the web and applying it to UIKit elements or OpenGL contexts programatically.
This is complicated, but a good method, because then you make NO changes to your binary and then your artists can work freely, upload the art to a server and you're golden.
I suggest a good HTTP library, like ASIHTTPRequest, to make those requests easier.
Go with the Web server/dropbox option. You might be able to do this by subclassing or extending UIImage and using the subclass throughout your app.
Jailbreak your iPhone, Then you can ssh into the device using Cyberduck. That way you can navigate to the app's Resources folder (or) App's document folder and change files as you want.
You will have to make sure the folder permissions are proper, or else you need to change them.
Also in your game, in the first run, make sure all your resources are getting copied to the App's documents folder.
I would say that your first option is probably the best. You state the issue with transferring a large number of files through iTunes. To fix that I would to the following:
Create an app to create "package" files. It can take a folder of data and save it in a single in file in the following format:
int - length of name string
char[] - filename
int - length of data chunk
char[] - data chunk
Do this for every file in the folder, and you'll be left with a single image file. Copy that through iTunes, and have your game look at that same folder.
So now his workflow is as follows: 1) edit art 2) run your asset compiler 3) copy the asset file to the device 4) load the game
I hope this helps.
You could also do something like this:
modify the app so on its first start it copies the images into the document folder
load the images from the doc folder instead than from the bundle
with a tool like iPhone Explorer you can then overwrite the files in the document folder
it's a bit boring to find the actual app in the list that iPhone explorer gives you, but then it's just a matter of dragging and dropping the files into the right folder.
It may work also with some file in the .app bundle, but I didn't found any suitable app to try it from there.
Anyway if you want to keep the thing almost hassle free for your artist you may want to put everything in a Documents subfolder nonetheless :)
EDIT
I just tried to edit something into the .app folder and it worked OK, so you don't even have to change your code if you use iPhone Explorer to replace images.
Just remember to disable the PNG optimization if you're using PNGs. Look here for the explanation (search for "PNGs:")
good luck :)
I would say set up a CVS repository. When you're happy with what you have, you can commit your code. He can update his code and change the images however he wants. When he's happy, he can commit his changes so you also have the latest images (as long as he doesn't mess around with out files, it should be fine).
Teach him how to update the images, how to deploy to a device, how to commit to the repository and it should go smooth (albeit I think there'd be some teething issues).

How can I tell xCode to recheck project resources that have been modified?

I'm working with a designer friend on an iPhone app and he likes to refine all sorts of images relating to the project we're working on. All these images have been added to the project previously (and added to the project folder by xcode) and then are modified in their new location. When I preview the images in xCode, the updated images show up but building and running in the simulator or on a device doesn't pick up the new image. In fact, if I do a clean build it seems to ignore the image all together and blank spaces appear where images should be.
Now, I can delete these files from the project and re-add them and everything works peachy again. But there are a lot of them and I'd rather not do that every time an image is updated. Is there a way to get xCode to review and "learn" about these modified images? Is there a good reason for why it's not doing that automatically?
You didn't specify how you're including those image resources into your project, but I'd guess you're including them directly. So unless there's an underlying process that's changing the file in-place (are you using an SCM like Subversion or Perforce?) you're going to be forced to manually overwrite the files whenever your artist friend updates them.
You should include art assets in the project using a folder reference instead. (I'm still assuming you have some sort of SCM set up to handle exchanging data -- if you don't, set one up ASAP.) However, there are still some outstanding Xcode bugs related to picking up changes to files in a nested folder hierarchy included by reference, but at least you can work around that by doing clean builds when necessary.

How can I tell the size of my app during development?

My programming decissions are directly related to how much room I have left, or worse perhaps how much I need to shave off in order to get up the 10mb limit. I have read that Apple has quietly increased the 3G & Edge download limit from 10mb up to 20mb in preparation for the iPad in April.
Either way, my real question is how can I gauge a rough estimate of how large my app will end while I'm still in the development phase?
Is the file size of my development folder roughly 1 to 1 ratio? Is the compressed file size of my development a better approximation? My .xcodeproj file is only a couple hundred kB, but the size of my folder is 11.8 MB. I have a .sqlite database, less than 20 small png images and a Settings.Bundle. The rest are unknown Xcode files related to build, build for iphoneOS, simulator etc.... My source code is rather large with around 1000 lines in most of the major controllers, all in all around 48 .h&.m files. But my classes folder inside my development folder is less than 800kb. Digging around inside my Build file, there is lots of iphone simulator files and debugging files which I don't think will contribute to the final product. The Application file states that it is around 2.3 MB. However, this is such a large difference from the 11.8 MB, I have to wonder if this is just another piece of the equation.
I have the app on the my device, I'm in the testing phase. Therefore, I though that I would try to see how large the working version was on the device by checking in iTunes, however my development app is visible on the right-hand the application's iphone screen, but no information about the app most importantly its size.
I also checked in Organizer, I used the lower portion of the screen-(Applications), found my application and selected the drop down arrow which gave my "Application Data" and a download arrow button to the right to save a file on my desktop, named with the unique AppleID. Inside the folder it had three folders-(documents, library, tmp) the documents had a copy of my .sqlite database, the library a few more files but not anything obvious or of size, and the tmp was empty. All in all the entire folder was only 164kb-which tells me that this is not the right place to find the size either.
I understand that the size is considered to be the size of my binary plus all the additional files and images that I have add. Does anyone have a effective way of guaging how large the binary is or the relating the development folder size to what the final App Store application size will end up.
I know that questions have been posted with similar aspects, but I could not find any answered post that really described...what files, or how to determine size specifically. I know that this question looks like a book, but I just wanted to be specific in conveying exactly what I'm looking for and the attempts thus far. *Note all files are unzipped and still in regular working Xcode order of a single app with no brought-in builds or referenced projects.
I'm sure that this is straight forward, I just don't know where to look?
Build Your App using Active Configuration = Release, then right click on the .xcodeproj. Select Reveal in Finder. Then have a look at App Size in the Build Subdirectory.
LocateMe http://img.skitch.com/20100313-8hc87h85c8a4bb6xufhnfg4ciq.preview.jpg
You are correct that the final size can be estimated pretty closely by checking the sizes of the files in the application bundle. However, Apple will encrypt your binary, so in most situations your zipped application will be a bit smaller than the one on App Store.
Take a look at this : http://forum.unity3d.com/viewtopic.php?p=278022&sid=ea6e4878c70379a05c883f7093a4b41c