Android/Eclipse - How save working copies? Versioning? - eclipse

New to Eclipse, Android and Java, so this is sure to be a real newbie question...
I'm working on a simple project (say, display a button) and get it working in the emulator. All is good.
Now I want to add a second button to my stunning app, but want to make sure if I horribly break the code, I can go back to my first working code and try again. I don't really see a way to do this without creating a whole new project. This seems kind of crazy, since I like to save the working versions pretty often so there isn't a lot of lost work/time. Is there a better way?
Also, if this IS the way it is done, what is the best way to create a 'new' project which is simply a copy of the last working project (under a new project name)?
Thx.

Related

Save code after every successful modification in WebStorm

I have been writing some code in WebStorm for a practice project. But the problem is, I have written some code today and the application seems to work fine, then tomorrow when I am writing some more code and the application is catching a bug which I am not able to debug, then I have to start all over again, which is pretty painful.
I would therefore like to save the code while it is working so that if required I can revert back to the last working version. I believe this is called version control and most people use GitHub for this, is it ?
I couldn't find a similar question. Maybe I am not using the correct keywords while searching.

GWT Development mode

I have started creating my first project with GWT. In first lines of code, it worked normally and I had no need to GWT Compile every time to see a simple change in my browser.
For client changes, a save file was enough and for server a save and refresh server. But now it has stopped working like before.
For the smallest change like adding a "Window.alert("msg")" I need to reGWTCompile the whole project to see it! What could have issued this?
Make sure you're running in DevMode (i.e. have ?gwt.codesvr= in your URL)

What is the purpose of Product -> Clean in Xcode?

What does it do exactly? Can't find an explanation in plain language
Basically it erases all compiled components, so the next build will build everything fresh. This in theory should never be necessary, since we all know that IDEs are perfect and totally keep track of all source changes and hence know precisely what components need recompiling/rebuilding at any given time. (But, of course, such perfection seems to be a bit elusive.)
The concept of "clean" is found in most IDEs. You use it when things are behaving strangely, or in certain known cases where a "clean" rebuild is required.
A very important usage for "Clean" is when you have images in your application and you update their contents without changing their name. For example say you have an image named Background.png that you used for a while, then you edited this picture in Photoshop and saved the new one in the same name. On the next run of the app the image will not be refreshed; the compiler will continue to show the old one. To make sure to see the updated image you need to do "Clean" before you run. So in principle on all image updates where the name did not change you need to "Clean".
By the way, you might need to "Clean" once for the simulator and once for the real device run. One final note, don't have the idea in mind that every time you write code that you think should work but don't work as you expect then the solution is "Clean", in such a case it is always a problem in your code which needs revision.

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).

When my colleague changes code and commits it to the repository I can see the code, but xCode compiles as if his contributions weren't there

Have any other iPhone developers experienced this phenomenon? I can see his contributions in xCode - I see for example my colleague has wrapped a navigation controller around one of my view controllers and added it to my tab bar. Great! That view really did call for a navigation controller and this is a welcome addition to the project.
So, I up my code and compile - no navigation controller. I do build -> clean all targets, thinking maybe some pre-compiled code is mucking me up and compile again. Same result. I was eventually able to get his changes to compile by deleting the whole directory and checking it out from the repository, but I really don't want to do that every time my colleague checks in code.
Is there some kind of box I need to check or something? What could be causing this behavior?
Thanks in advance.
Here are a number of possible fixes:
1) Delete the current version of your app off the simulator and/or device. This especially becomes necessary when using Default.png or app icons. There are a lot of shortcuts that the compiler takes for apps that are already "installed".
2) Make sure that there are NEVER any build folders or user specific files (pbuser.USERNAME I think). These files wrecked havoc on a few projects and we basically had to delete and start over.
3) Make sure that all files are svn added to the project before each commit (although this wouldn't matter for your current problem.
4) Find the changed code and set breakpoints for the debugger to catch. I believe that breakpoints that turn YELLOW while running signify that there is a difference between run and code.
I would tend to believe that it would be a problem with the .proj file also, but it sounds like that's not it.
Some things to check (but maybe you already did it):
is the new code added to the correct target? You will still see it in the project tree, but it won't be compiled
if you are using a SVN (or CVS) client that is not XCode, you have to remember to commit (and update) the .xcodeproject file too.
Your question isn't entirely clear to me, so forgive these follow-up questions:
Where in Xcode did you see the changes? In the repository browser, or in the file browser part of Xcode?
What do you mean by "up your code"? (I'm assuming you mean that you chose the "Update source from repository" option or whatever it is called - I'm away from my mac right now - but I thought I'd check.)