Death of a 6000 line project

Hello.
Recently , i was done a complex project with arduino . it was nearly 6000 lines . last time , i just replaced all Serial.print with //Serial.print to comment out all serial commands , and then ... Death !
Some functions are disappeared ! some are half disappeared ! and my code and my project is DEATH .
unfortunately , i dont have any backup of my project , ... .

Did anyone before me do a replace on a 6000 line code ?!
What is happening here ?!

Well, the compiler doesn't move or alter the code You type into ide... So it should be where you left it, usually in the last place you'd look.

it will automatically save everytime it compiles, so that an be annoying some time, but you can disable that.

Sorry to hear that. Just commenting some lines will not cause these kind of issues. Try opening the ino file in a notepad an check again.

Always use Source control.

Poor code backups or management on your part does not imply the IDE is a toy.
I’ve never seen it crash and wipe out whole sections. I do manually save after making big updates just in case, with new version names so I can back up to an earlier version if the changes I made are not working out for what I was trying.

Sorry you lost work.

I use SyncBack for automatic backups daily X2.
One goes to my internal hard drive D and one to a table top network drive.
Once a week I run the program with an USB drive.
Then swapping this USB drive with a similar one that sits in a off site safety deposit box.

You learn.

http://www.2brightsparks.com/syncback/sbpro.html

They have a free version:
http://www.2brightsparks.com/freeware/index.html
.

I don’t use the IDE much - doesn’t it have a ctrl-Z / undo?
Or is the undo depth limited?

mmkhmmkh:
Hello.
Recently , i was done a complex project with arduino . it was nearly 6000 lines . last time , i just replaced all Serial.print with //Serial.print to comment out all serial commands , and then ... Death !
Some functions are disappeared ! some are half disappeared ! and my code and my project is DEATH .
unfortunately , i dont have any backup of my project , ... .

Did anyone before me do a replace on a 6000 line code ?!
Arduino IDE Programmers ! What you are doing there ?!

So , ... , Is Arduino IDE just a TOY ?!!! WTF is happening here ?!

Sorry for your work lose..
I have a project that have more than 7000 lines of code, and I never have this kind of problem!
By the way, my entire project don't have all 7000 lines in one single ino file, I use about 32 separated files each one with your own functions!
Is your project had all the 6000 lines in one single file ?

I'd wager that you fatfingered the find line?

Assuming ctrl+Z isn't able to save you, you're probably SOL.

I put everything I care about into a github repo, so as long as I remember to commit changes regularly, I don't have to worry about losing data, and can go back to an old version easily.

Re: multiple files - I thought there was some issue with the 1.6.6+ IDE and multiple files?

Sorry to hear... Take that has an opportunity to start afresh with new ideas from all the learnings of first version... Usually a version 2 is so much better... (And run back-ups)

I use git and github. Using some sort of code repository system is just basic infrastructure for any working programmer. You need to learn to use git - you'll come to love it. It'd be nice if it were integrated into the IDE, but that's quite a bit of work.

mmkhmmkh:
Some functions are disappeared ! some are half disappeared ! and my code and my project is DEATH .

Were you using code folding: folded code permanently disappears by search and replace action · Issue #4845 · arduino/Arduino · GitHub?

DrAzzy:
Re: multiple files - I thought there was some issue with the 1.6.6+ IDE and multiple files?

I use multiple files(tabs) on every project and can't think of any offhand.

+1 for using git or other version control program. It's a bit of work to learn but definitely worthwhile if you're writing a 6000 line program. I have found it actually makes me a better programmer to have to break my work into logical commits.

pert:
+1 for using git or other version control program. It's a bit of work to learn but definitely worthwhile if you're writing a 6000 line program.

Using CTRL-C or drag-n-drop to make a backup copy of the program directory is also pretty simple.

...R

My Mac is connected to a time machine, so incremental backups happen automatically. I also back up to the cloud in the background. that saved me a few times - or at least helped not start from scratch again.

agree source control is the way to go if you are doing anything serious. nice feature request for the IDE...

First , Thanks to all for replying to my topic .

sarouje:
Sorry to hear that. Just commenting some lines will not cause these kind of issues. Try opening the ino file in a notepad an check again.

Always use Source control.

Yes . I then opened it in notepad . it was same and corrupted.

LarryD:
Sorry you lost work.

I use SyncBack for automatic backups daily X2.
One goes to my internal hard drive D and one to a table top network drive.
Once a week I run the program with an USB drive.
Then swapping this USB drive with a similar one that sits in a off site safety deposit box.

You learn.

http://www.2brightsparks.com/syncback/sbpro.html

They have a free version:
http://www.2brightsparks.com/freeware/index.html
.

Thanks , i will use it from now .

AWOL:
I don't use the IDE much - doesn't it have a ctrl-Z / undo?
Or is the undo depth limited?

Yes , i undo it , but it undoes for about 10 times , not more . the replacement was about 100 lines.

rmartins:
Sorry for your work lose..
I have a project that have more than 7000 lines of code, and I never have this kind of problem!
By the way, my entire project don't have all 7000 lines in one single ino file, I use about 32 separated files each one with your own functions!
Is your project had all the 6000 lines in one single file ?

Thanks , Yes . all the 6000 lines are in one single file ! ( also there are approximately 2000 lines in other files ... )

DrAzzy:
I'd wager that you fatfingered the find line?

Assuming ctrl+Z isn't able to save you, you're probably SOL.

I put everything I care about into a github repo, so as long as I remember to commit changes regularly, I don't have to worry about losing data, and can go back to an old version easily.

Re: multiple files - I thought there was some issue with the 1.6.6+ IDE and multiple files?

No, it was just replace "Serial.print" with "//Serial.print"

PaulMurrayCbr:
I use git and github. Using some sort of code repository system is just basic infrastructure for any working programmer. You need to learn to use git - you'll come to love it. It'd be nice if it were integrated into the IDE, but that's quite a bit of work.

My program is not open source and is not public usable ! I know that it was my fault , because i didnt make any backups from it , and its not what i usually do ...

pert:
Were you using code folding: folded code permanently disappears by search and replace action · Issue #4845 · arduino/Arduino · GitHub?
I use multiple files(tabs) on every project and can't think of any offhand.

+1 for using git or other version control program. It's a bit of work to learn but definitely worthwhile if you're writing a 6000 line program. I have found it actually makes me a better programmer to have to break my work into logical commits.

This is the point ! yes , i use code folding . and every functions that is corrupted was folded .

YES , something like this : folded code permanently disappears by search and replace action · Issue #4845 · arduino/Arduino · GitHub

Last night , i retyped all of my fuctions that was deleted . so my code is complete again.

Thanks to everyone,
and Sorry for my bad english ,
MMKH .

mmkhmmkh:
yes , i use code folding . and every functions that is corrupted was folded

That's a really terrible bug, sorry to hear it bit you so badly. It's a shame the developers haven't put priority on fixing it. At the very least they should remove the option to use code folding until it's fixed. The other annoying bug with code folding is everything unfolds every time you switch tabs.

Ok , so for next update fix this bug , and also add some more options for code folding ( fold all , unbend all and etc.)

Have you ever used Notepad++ as your editor?
Set external editor in the IDE preferences.

https://notepad-plus-plus.org/

Search this site for settings to get colours, I think Riva did the work.
Edit:

.

I use Geany for my editing and I have a Python program to verify and upload directly from within Geany.

...R

LarryD:
Have you ever used Notepad++ as your editor?
Set external editor in the IDE preferences.

https://notepad-plus-plus.org/

Search this site for settings to get colours, I think Riva did the work.
Edit:
http://forum.arduino.cc/index.php?topic=141050.15

.

Yes ! i use Notepad++ for many langueges . i will try it for arduino ...

Robin2:
I use Geany for my editing and I have a Python program to verify and upload directly from within Geany.

...R

i will test it ...

If Serial was used only for debugging ONLY. This is a nice bit of code to remove Serial without having to comment out everything.

#define DEBUG false                         // Set to true to enable Serial Debug
#define Serial if (DEBUG)Serial            // WARNING: Use only when Serial is used for Debugging only (THIS REMOVES Serial COMPLETLY!!!)

There are also other Debug macro schema's that can be used to remove Debug print's with a simple true/false flag that do not remove Serial.

Much quicker and safer than commenting out lines.