Dealing with DOS "end of line" in cvs

bradymiller wrote on Monday, April 27, 2009:

hey,

What do we do if we find a file peppered with DOS "end of line" CR/LF characters?

Found in this file:
openemr/openemr/interface/reports/receipts_by_method_report.php

Issuing a dos2linux comman will fix it but then basically changes entire file.

-brady

tmccormi wrote on Monday, April 27, 2009:

That is what you must do.  All files need to have consistent line endings or merging changes becomes a nightmare.  We had to develop triggers for that to clean up all files before committing them in a mixed OS development environment.  Should be a normal part of the precheck before committing any files to cvs.
–Tony

cfapress wrote on Wednesday, April 29, 2009:

Hi Brady,

I use ViM as my code editor. Any time I open a file loaded with CR/LF, which appear as ^M characters on my screen, I do a global replace. A year or more back I went through and cleaned up nearly all the code and committed it back to CVS. Surely, since then, people have inadvertently added back the CR/LFs.

In ViM, or vi, I use these keystrokes:
:
.,$s/^M//
To get a ^M character I need to press CTRL-V then CTRL-M.

But that’s only one file at a time. Not too handy to batch-clean-up a whole folder.

Jason

bradymiller wrote on Wednesday, April 29, 2009:

Jason,
doesn’t the dos2unix command do this also?
-brady

bradymiller wrote on Wednesday, April 29, 2009:

Jason,
pretty interesting. vim show the ^M characters and saves them if you leave them. the jed editor (now my editor of choice for the time being) does not even show the ^M characters, and removes them all if you save the file.
-brady

tmccormi wrote on Thursday, April 30, 2009:

Most modern editors and IDE’s will allow you to configure to strip DOS formatting coming and going.   I really recommend a good, full featured IDE like free KomodoEdit (or the costly KomodoIDE).  I use that for heavy development and Bluefish for quick work.  Vi still has is uses (nearly every day…)
–Tony

cfapress wrote on Thursday, April 30, 2009:

Tony,

Could you recommend a Windows software package that can seamlessly open, edit, and save files located on a remote Linux server?

I’ve been hunting around for years, on and off, for such a program. I finally gave up and just stick with SSH and ViM. But if there’s an IDE or just an editor out there that can do what I’m looking for I would seriously consider it. BTW - I’m not talking about some editor with a FTP interface built in. I’m looking for seamless productivity.

Thanks for any suggestions you have,
Jason

whimmel wrote on Thursday, April 30, 2009:

jEdit (http://www.jedit.org/) will do just that.  You can open and save remote files as if they were local.

Eclipse will do it too but it takes a bit of work.

tmccormi wrote on Thursday, April 30, 2009:

All of the high end editors have some model to edit remote files.  But it’s not magic, you have to use some kind of transport protocol, FTP is the most commonly used for that.   and various protocols over ssh like sFTP and scp are sometimes supported.  Zope remote protocol is also, sometimes an option.

The easiest solution, if you have control over the systems is NFS or SMB mounts so everything looks like a local directory.

Another option is using built in source code control interfaces to SVN, CVS etc.  Then all actions from the editor are checkout/edit/test/commit to the repository.  That’s what I do the most.  10 years of product build, source control and release management will do that to you. :slight_smile:

I have used ActivateState’s Komodo IDE (FTP/sFTP or SCP) for years as well as Visual SlickEdit and CodeWrite (all commercial products in the $250-$500 range)

Eclipse has always baffled me, but my main developer (Aron) uses it exclusively.

The tricky part is having one editor that runs on all the platforms, that’s why I use Komodo and Aron uses Eclipse.

tmccormi wrote on Thursday, April 30, 2009:

I guess I shouldn’t forget to mention Zend Studio for Eclipse.  Full, visual step debugging and more    … according to the website.
–Tony

ideaman911 wrote on Thursday, April 30, 2009:

OK, my brain just exploded.  But being a Windows guy, I suddenly feel guilty and don’t know why.  I have never even looked at the example file, so that was not my efforts.  But i know I have sent a bunch of stuff to various people.  Jason & Brady; can you tell if any of my stuff has or has not got the dreaded ^M concern?  Since the very first notes I saw about using OpenEMR in Windows said to not use the DOS editor, I have been using HTMLkit, which works great as an editor on the PHP files, etc, and has an automatic word wrap setting and color separation for code which makes it easy to work with.

I have no idea if it could be used as a web editor, but it handles LAN files including VPN fine.  Please let me know if I am inadvertently polluting, OK?

Joe Holzer    Idea Man
http://www.holzerent.com

whimmel wrote on Thursday, April 30, 2009:

> I guess I shouldn’t forget to mention Zend Studio for Eclipse. Full,
> visual step debugging and more … according to the website.

I can confirm this. I use Zend Studio, it’s basically Eclipse with all the plugins plus few more goodies.

bradymiller wrote on Thursday, April 30, 2009:

hey,
(bummer, my last message didn’t go thru, will try to create it again)

Would be nice to recommend a free high end Windows editor that deals with ^M, but most importantly can create patch files (like the linux diff -> patch mechanism) from the original file.  With windows developers there has been a real bottleneck since we need to type/past/copy their changes and then test before submit to cvs (takes a lot of time).  With a patch it literally takes seconds to copy changes and test.  Anybody have any good recs?  I’m predicting we will start getting more submissions from windows developers because of the xampp-openemr release so would be nice to have this worked out and not lose “potential” coders.
(also, Joe, don’t worry; not seeing the ^M in your stuff)
-brady

tmccormi wrote on Thursday, April 30, 2009:

All windows developers would do well to install Cygwin tools on their machines.  This will give the the full set of Unix/Linux command line tools including the dos2unix, unix2dos, diff patch mechanism, grep, vi, and all the rest.

www.cygwin.com/

-Tony

sunsetsystems wrote on Thursday, April 30, 2009:

Editpad Lite is a good free Windows text editor.

Rod
www.sunsetsystems.com

aperezcrespo wrote on Friday, May 01, 2009:

Hi
   Notepad ++ is also a real nice one for windows (lots of plug ins available too)
http://notepad-plus.sourceforge.net right here on good old sourceforge.net

Thanks

aperezcrespo wrote on Friday, May 01, 2009:

Oh and before I forget

Free EDI notepad

Really cool

Thanks

physmed wrote on Friday, May 01, 2009:

You might take a look at Crimson Editor as well!  It is the only text editor that I have been using with Openemr for the past 2 years and it hasn’t let me down yet.

Rick