Nano 2.0.6 - Saving a file in Mac Format - nano

Any ideas how to save a file edited with Nano, in "Mac format"? I keep getting DOS carriage returns in my newly-saved files on my Linux box. I provided a screen shot of the bottom menu when I go to "write out" file:
M-M Mac Format??? I see that there are save options when saving but cannot figure out how to execute them
M-M Toggle the use of Mac format
Thanks

The command "M-M" means "alt M". In fact, any command starting with "M" means the alt key. Some keyboards gobble up the alt key: in my case, on a Macbook Pro Retina, "esc" followed by "M" is what worked. More info here.
However, since your screenshot is showing [DOS Format] as the current selection, the key combination you really want is "alt D" (or "esc" followed by "D"). That will toggle off [DOS Format] so that you'll be saving your file with the default line-ending character (ASCII 0xA). Turning on [Mac Format] will just give you a new set of problems.

Normally you neither want to save as DOS format nor in Mac format. On Linux you should prefer the Unix format, therfore:
enter a filename
press Enter
and the file will be saved with the default Unix line-endings (which is what you want on Linux):
https://unix.stackexchange.com/questions/396551/gnu-nano-2-dos-format-or-mac-format-on-linux?noredirect=1#comment707780_396551

There is no Mac format anymore. Mac OS X is UNIX.

Related

Pasting (with Command V) in input field on Mac

am writing feature file for UI on Mac.
I would like to enter Key.Command +'v' in an input field, using a feature file.
But I cannot see options for Key.Command in Key.java.
I see Key.SHIFT, Key.ALT, Key.CONTROL etc, but am not able to simulate the apple keyboard's Command Key. Could you please advise on that?
Thanks :)

Converting Windows .PRN file (PCL) to PDF

I have been succesfully capturing PCL content sent by old machinery to a parallel port and converting it to PDF using GhostPCL for a while.
However, we have some older industrial machinery which is based on Windows 2000 and outputs to a HP Laserjet printer via the parallel port. Unfortunately, the software on the machine does not allow additional software or printers to be installed.
The problem is that whilst the captured output appears to be PCL graphic data, I have not found any tools which can convert it - GhostPCL attempts, and you can make out the text a little, but it is completely corrupted.
The captured output results in the output from GhostPCL
I can see that the captured output starts with:
ESC E (PCL command for Reset)
ESC &l0L (PCL command to disable skip perforation)
ESC &r1U (*** UNKNOWN ***)
ESC &l1H (PCL command to Feed from tray 2)
ESC *o0M (*** UNKNOWN ***)
ESC &126A (PCL command for A4 portrait paper)
ESC *g8W (PCL command to configure raster data - 8 bytes)
I can see that the captured output has some PCL codes which do not appear in the official documentation, which results in the weird characters at the start of the PDF.
Does anyone know how to convert this file to PDF ?
Your description shows an attempt to read a language different to pcl, so was the older system designed to talk to a default printer using Epson ESCAPE encoding. so its a dot printing file that the hardware will position those dots in the correct place and pressure, you could try converting to a bmp then massage the image into a pdf page.
You say an HP is connected but is that the true capture of what it is agreeing to use at runtime?
For example If I attempt to save my HP inkjet print file at time of printing I will get a PDF ! but why since the printer normally cant handle those direct?
What may I find If I look and see the default printing language is not set to a PCL or a PJL one.
There are many pcl language variations so a PRN file ideally should have some compatibility declaration such as #PJL ENTER LANGUAGE = PCLXL ) HP-PCL XL;2; Note this is NOT an HP printer just one that declares the following code will be HP style.
The printer can accept many formats and the system can produce many different formats for one printer. Thus you need to check all the system settings to understand what language is actually in run time use. Are you sure that .PRN is a full load of the conversation between the system & printer as print to file is not always the expected 2 way code.
The best way to ensure you capture true printer driver output is to change the drivers output PORT to a fixed filename and ideally use the correct format extension NOT unspecified .prn or .pcl if it is not such.

How do I enforce LF line endings in Jetbrains Rider 2018.1

I'm frequently running into line ending issues with my JetBrains Rider 2018.1 installation under Windows 10. The IDE turns existing LF files into CRLF files once I edit them. I haven't yet found a way to configure it the way I want.
I would like to always only have LF in my files (for new ones and for edited ones). During a commit process, I don't want to get distracted by line ending changes.
My git is set to core.autocrlf=input. So it should behave neutral and use the as-is settings.
I know I can edit each file manually via the Line Ending switch button on the bottom right of the editor, but I feel that is quite cumbersome.
To change the default line ending for new files, Go to File → Editor → Settings → Code Style and in the "Line Separator" dropdown select "Unix and OS X (\n)".
To change the line endings of existing files, select the files in the "Project" view panel, then go to File → Line Separators → LF - Unix and OS X (\n). Make sure you don't break anything though - some file formats (eg .bat) only work with specific line endings.

How to enter backslash in sqlite3.exe using Korean Windows XP

I am trying to use sqlite3.exe on a computer that has the Korean version of Windows XP. This version of Windows uses the won character (₩) in place of the backslash character in paths (For example, instead of c:\ it's c:₩ ). It seems possible to enter a backslash in text editors like Word, but not in the command line. In fact, even if I copy a backslash character, it is converted to the won character when I paste it in.
Since SQL uses the backslash to designate quotes, I am unable to enter them. Instead of '\"' I end up typing '₩"' which generates an error.
Does anyone know how to force a real backslash to be entered into the command line on this version of Windows?
There is plenty of software written in Korea, so hopefully someone else has had this problem.
Open properties of console window and choose TrueType font in 'Fonts' tab (not sure for Korean, but they commonly are marked with "TT" icon).

How can I stop my app from setting the "quarantine" bit?

Ever since OS X 10.7.3, my text editor is setting the "quarantine" bit on any file it touches.
My text editor is designed for working with shell scripts, and if the quarantine bit is set then a shell script cannot be executed from the command line, until you double click it in Finder and go through a "This application was downloaded from the internet" alert (or remove the quarantine bit with xattr).
For example, I just created a "hello world" script in my app, it has been quarantined, and cannot be executed:
$ xattr -l foo
com.apple.quarantine: 0006;4f51dd2f;Dux;
$ chmod +x foo
$ ./foo
-bash: ./foo: Operation not permitted
If I remove the quarantine bit, the script works:
$ xattr -d com.apple.quarantine foo
$ ./foo
hello world
According to some forum posts, TextEdit also sets the quarantine bit on any shell script it creates.
I'm using a simple NSDocument subclass to create the file:
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
return [self.textStorage.string dataUsingEncoding:self.stringEncoding];
}
How can I remove the quarantine bit from files created in my app? Other text editors, such a TextWrangler, do not set the quarantine bit.
UPDATE
A little more info, this only occurs when creating a "script application" file, which is anything from perl scripts to html.
And it only occurs when my app is sandboxed. Disabling sandboxing fixes the problem, but that's not a long term solution.
I've filed a bug with Radar, it looks like there might be nothing to do but wait/hope that avenue gets it fixed.
Try ensuring that the LSFileQuarantineEnabled in your Info.plist is set to false (which should be the default). If the attribute is still being set, then I'd suggest filing a bug report and removing it programmatically with removexattr(2)/fremovexattr(2)
Nice to know that I'm not the only one with this problem - which has been difficult to track-down information on. I've found this problem occurs with data files saved by my program (these are not scripts, they are just XML data...).
I confirm that LSFileQuarantineEnabled made no difference.
I also tried to remove the attribute after the file was written, using removexattr http://hints.macworld.com/article.php?story=20071029151619619, but this didn't work either - the sandbox prevented the call from working.
By way of background, I also found this discussion of the problem:
http://reviews.cnet.com/8301-13727_7-57374676-263/workarounds-for-quarantine-bug-in-os-x-lion/
For the record, I've separately raised a bug with Apple.
EDIT: I have found the source of the problem, and figured-out the work-around.
The problem was that if the file data is plain XML format data, MacOS mistakenly displays the reported message (I think this is because it wrongly assumes that the file is a script). If I change the file format to be an alternative that clearly isn't XML, the warning disappears. The file is still saved with the quarantine bit set, however!
So this is definitely due to an issue in MacOS, but there is a relatively easy work-around - just change your file format!
As far as I can tell, this bug has been fixed in OS X 10.8 (Mountain Lion).
Seems like I will have to make 10.8 the minimum OS version for my app. Not really a big deal for me... but hopefully Apple fixes it in a bugfix to 10.7 (the system requirements for 10.8 are quite a bit higher than 10.7, I know people who can't upgrade).