Feeds:
Posts
Comments

Archive for the ‘Windows & Ubuntu’ Category

A Quick Intro to End-Of-Line Conventions

Most people don’t realise that when they hit the Enter key to create a new paragraph in a text file, something very different is going on behind the scenes in the three major operating systems: Windows, Macintosh and Linux. The “end-of-line delimiter” (often expressed as “End-Of-Line“, “End of Line“, or just “EOL“) – which some of you know as the “line break” or “newline” – is a special character used to designate the end of a line within a text file.

UNIX-based operating systems (like all Linux distros and BSD derivatives) use the line feed character (\n or <LF>), “classic” Mac OS uses a carriage return (\r or <CR>), while DOS/Windows uses a carriage return followed by a line feed (\r\n or <CR><LF>). Now that Mac OS X is based on FreeBSD‘s file system, it follows the UNIX convention.

Now, the reason most people don’t know about all this is because nobody really should have to. But while users of Linux distros and Mac OS can open Windows text files in basically any available editor and not even know the difference, the same can’t be said for Windows users opening files created in one of the other operating systems.

If you type up a simple text file in Ubuntu and save it in the default “Unix/Linux” format, in Windows it will appear as one continuous paragraph, with black squares where the line breaks (or new paragraphs) should be. While you can open the file in a more advanced text editor (or proper word processor) to view it as it should look, others you’ve sent it to are just likely to double-click it and let it open in Notepad (which can only handle MS-DOS EOL).

But you can save text files as Windows EOL easily with Gedit, as well as convert to that from UNIX via the terminal, so hopefully the following guide will be of use.

For more detailed info on End-Of-Line, go to the Wikipedia page.

And if you find the editor you’re using to display Windows files in Ubuntu shows ^M instead of a line break (not very likely with even the most lightweight text editors, but something you’ll probably come across if you display the text in a terminal), check out how to convert to Unix/Linux.

Saving Windows Text Files in Text Editor (Gedit)

It’s actually very easy to create text files with Windows EOL in Ubuntu using the default Text Editor, Gedit. When saving a file, go to Line Ending in the dialogue box and choose Windows instead of the default Unix/Linux. For files that were previously created, you can open them in Gedit and use Save As… to convert them (or save copies with the correct EOL).

As you can see, that’s pretty easy, but for more than one or two files, it is way too much work, so check out how to batch-convert multiple files via the terminal.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

A Quick Intro to End-Of-Line

Most people don’t realise that when they hit the Enter key to create a new paragraph in a text file, something very different is going on behind the scenes in the three major operating systems: Windows, Macintosh and Linux. The “end-of-line delimiter” (often expressed as “End-Of-Line“, “End of Line“, or just “EOL“) – which some of you know as the “line break” or “newline” – is a special character used to designate the end of a line within a text file.

UNIX-based operating systems (like all Linux distros and BSD derivatives) use the line feed character (\n or <LF>), “classic” Mac OS uses a carriage return (\r or <CR>), while DOS/Windows uses a carriage return followed by a line feed (\r\n or <CR><LF>). Now that Mac OS X is based on FreeBSD‘s file system, it follows the UNIX convention.

Now, the reason most people don’t know about all this is because nobody really should have to. But while users of Linux distros and Mac OS can open Windows text files in basically any available editor and not even know the difference, the same can’t be said for Windows users opening files created in one of the other operating systems.

If you type up a simple text file in Ubuntu and save it in the default “Unix/Linux” format, in Windows it will appear as one continuous paragraph, with black squares where the line breaks (or new paragraphs) should be. While you can open the file in a more advanced text editor (or proper word processor) to view it as it should look, others you’ve sent it to are just likely to double-click it and let it open in Notepad (which can only handle MS-DOS EOL).

But you can save text files as Windows EOL easily with Gedit, as well as convert to that from UNIX via the terminal, so hopefully the following guide will be of use.

For more detailed info on End-Of-Line, go to the Wikipedia page.

If you’d like a more WYSIWYG approach, check out how to save and convert via Gedit.

And if you find the editor you’re using to display Windows files in Ubuntu shows ^M instead of a line break (not very likely with even the most lightweight text editors, but something you’ll probably come across if you display the text in a terminal), check out how to convert to Unix/Linux.

Converting Linux EOL to Windows via the Terminal

It’s easy enough to create new text files with Windows EOL in Ubuntu using the default Text Editor (Gedit), but what if you’ve created a whole bunch with the default Unix/Linux EOL and need to convert them for Windows users? Well, you can actually open them in Gedit and use Save As… to save over them (or to create copies), but for more than a couple of files this would be the long, complicated solution.

By far the quickest and easiest approach is to convert the offending files via the command-line. This way, you could batch-convert hundreds of such files at once, not have to do them individually.
There are actually quite a few ways to do this, but we’ll look at a couple of tiny packages you can install, and the related commands to use.

The first – the tofrodos package – is undoubtedly the most widely-used, so we’ll look at that in detail – especially since many of the guides out there are outdated, since the commands it contains have been renamed.

The second is a little package called flip, and since it’s tiny and won’t cause any issues, it’s worth installing as a backup (just in case. I found it useful after trying to get tofrodos going on a new system, before I found out the commands were changed).

There is no actual command tofrodos, as it is just the package that contains the commands todos and fromdos. Currently, the vast majority of online guides will list the commands as unix2dos and dos2unix, but as the developer states:

With this release the symlinks “unix2dos” and “dos2unix” are dropped from the package. This will allow the introduction of the original dos2unix package, which also supports conversion to MacOS style files.

So now you can choose to use either todos (to convert to Windows) and fromdos (to convert to Linux), or just fromdos with options (fromdos -u to convert to DOS, and fromdos -d to convert to UNIX, though obviously the -d option really isn’t needed, as it is the default behaviour for the fromdos command).

We’ll use todos, as it is easier to remember, and show how to alter a single file, or all text files in a given folder. When you’re ready to proceed, open a terminal in the folder containing the text file(s) and use one of the following commands (note that for the purpose of illustration, the .txt suffix is used, but you can specify any other extension for your text files).

To convert to DOS/Windows format:

Single file (remember to replace filename.txt with the actual name of the file)

todos filename.txt

All text files in a folder (if the extension differs to .txt, simply replace it in the command)

todos *.txt

Similarly, flip is easy to use:

flip -m filename.txt (or flip -m *.txt for multiple files).

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

A Quick Intro to End-Of-Line

Most people don’t realise that when they hit the Enter key to create a new paragraph in a text file, something very different is going on behind the scenes in the three major operating systems: Windows, Macintosh and Linux. The “end-of-line delimiter” (often expressed as “End-Of-Line“, “End of Line“, or just “EOL“) – which some of you know as the “line break” or “newline” – is a special character used to designate the end of a line within a text file.

UNIX-based operating systems (like all Linux distros and BSD derivatives) use the line feed character (\n or <LF>), “classic” Mac OS uses a carriage return (\r or <CR>), while DOS/Windows uses a carriage return followed by a line feed (\r\n or <CR><LF>). Now that Mac OS X is based on FreeBSD‘s file system, it follows the UNIX convention.

Now, the reason most people don’t know about all this is because nobody really should have to. But while users of Linux distros and Mac OS can open Windows text files in basically any available editor and not even know the difference, the same can’t be said for Windows users opening files created in one of the other operating systems.

If you type up a simple text file in Ubuntu and save it in the default “Unix/Linux” format, in Windows it will appear as one continuous paragraph, with black squares where the line breaks (or new paragraphs) should be. While you can open the file in a more advanced text editor (or proper word processor) to view it as it should look, others you’ve sent it to are just likely to double-click it and let it open in Notepad (which can only handle MS-DOS EOL).

Occasionally, the reverse is the issue, but you can convert Windows text files to UNIX easily with Gedit, as well as convert them via the terminal, so hopefully the following guide will be of use.

For more detailed info on End-Of-Line, go to the Wikipedia page.

Or if you’re wanting to do the reverse, check out how to convert to Windows format via the terminal and with Save As… in Gedit.

Converting Windows EOL to Linux via the Terminal

If you find the text editor you’re using to display Windows files in Ubuntu shows ^M instead of a line break (not very likely with even the most lightweight text editors, but something you’ll probably come across if you display the text in a terminal), don’t worry – just convert them to Unix/Linux format.

While you can actually open them in Gedit and use Save As… to save over them (or to create copies) in the correct format, for more than a couple of files this would be the long, complicated solution.

By far the quickest and easiest approach is to convert the offending files via the command-line. This way, you could batch-convert hundreds of such files at once, not have to do them individually.
There are actually quite a few ways to do this, but we’ll look at a couple of tiny packages you can install, and the related commands to use.

The first – the tofrodos package – is undoubtedly the most widely-used, so we’ll look at that in detail – especially since many of the guides out there are outdated, since the commands it contains have been renamed.

The second is a little package called flip, and since it’s tiny and won’t cause any issues, it’s worth installing as a backup (just in case. I found it useful after trying to get tofrodos going on a new system, before I found out the commands were changed).

There is no actual command tofrodos, as it is just the package that contains the commands todos and fromdos. Currently, the vast majority of online guides will list the commands as unix2dos and dos2unix, but as the developer states:

With this release the symlinks “unix2dos” and “dos2unix” are dropped from the package. This will allow the introduction of the original dos2unix package, which also supports conversion to MacOS style files.

So now you can choose to use either todos (to convert to Windows) and fromdos (to convert to Linux), or just fromdos with options (fromdos -u to convert to DOS, and fromdos -d to convert to UNIX, though obviously the -d option really isn’t needed, as it is the default behaviour for the fromdos command).

We’ll use fromdos, as it is easier to remember, and show how to alter a single file, or all text files in a given folder. When you’re ready to proceed, open a terminal in the folder containing the text file(s) and use one of the following commands (note that for the purpose of illustration, the .txt suffix is used, but you can specify any other extension for your text files).

To Convert to UNIX/Linux via Terminal:

Single file (remember to replace filename.txt with the actual name of the file)

fromdos filename.txt

All text files in a folder (if the extension differs to .txt, simply replace it in the command)

fromdos *.txt

Similarly, flip is easy to use:

flip -u filename.txt (or flip -u *.txt for multiple files)

Converting Windows EOL to Linux with Gedit

It’s actually very easy to convert text files with Windows EOL to Unix/Linux in Ubuntu using the default Text Editor, Gedit. Simply open the files, choose Save As…, go to Line Ending in the dialogue box and choose Unix/Linux instead of Windows. While that is easy enough, for more than one or two you’d really want to save yourself some time and hassle and perform a batch-conversion via the terminal.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Whenever you freshly install an OS – be it Ubuntu or Windows – your previous collection of fonts can’t be expected to just suddenly appear there. But it’s really quick and simple to get them back, and you won’t even need to reboot before you can start using them.

All you will be doing is copying files from a source folder to a destination folder, which is just a basic bit of file management. First, locate your original fonts folder on your Windows partition, which should be C:\Windows\Fonts\. Next, you will need to create a hidden folder in your home folder on your Ubuntu partition, which you can do by entering the following command into a terminal:

mkdir ~/.fonts

If you’re wondering why a folder had to be created, especially since the system has fonts installed (so they have to be residing somewhere already), the short answer is just to make things easier for you. Fonts that come with the system, and a few that get installed by programs, are found in /usr/share/fonts – which, being a protected system folder, means you’ll need to ask for permission before you can do anything with it (like copy files into it).

The new .fonts folder, while being hidden (denoted by it starting with a period), is owned by you, so you can drag files in and out without being told you don’t have the appropriate permissions for that task. And of course Ubuntu will immediately recognise that you have a fonts folder of your own, and incorporate those with the ones already installed.

Once you have a folder window open for both source and destination, simply select your fonts and drag them from your Windows partition to the new fonts folder, and copies will be placed there. At this point, you can either choose to be selective, dragging over only those you will actually use from the collection that has accumulated over the years, or just select them all with Ctrl+A.

If you’re not sure about certain fonts, as filenames are shown, not font names, you can double-click those for a preview, then click the Install Font button at the bottom right.

Once you’re finished, the fonts are ready to use. If you had a word processor or similar open while doing this, the fonts won’t be recognised yet, so simply close and reopen it, and you’ll see all your fonts there. Note that this will also work with Windows programs running under Wine, meaning next time you run Adobe Photoshop or what have you, all the fonts accessible in Ubuntu will be available to it.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

If you’d like to do all this the easiest way – via the terminal – a command like the following will do the trick:

mkdir ~/.fonts && cp -rT /media/Windows/Windows/Fonts/ ~/.fonts

You will probably need to change the path of the source, depending on where it is mounted (in this example, it assumes your Windows partition is mounted as /media/Windows). Also, if there are spaces in the path (like if the mount point is /media/Windows XP), you will need to enclose that path in single quotes, and make note of any case issues (if C:\Windows is actually C:\WINDOWS, you will need to put it as such). Here is a revised command taking all those into consideration:

mkdir ~/.fonts && cp -rT '/media/Windows XP/WINDOWS/Fonts/' ~/.fonts

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

How to Show Hidden Files & Folders

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

If you’ve ever installed any Windows programs in Ubuntu, you’d know Wine takes care of extracting the program’s icon (usually in the ancient .ico format) for use in Ubuntu. But, for whatever reason it may be, you may need to recreate those, but you don’t have the reinstall your programs just to do so.

In my case, copying over the entire .wine folder to a freshly-installed system gave me all my old Windows programs in perfect working order (gotta love Linux!), but the launchers no longer have the familiar icons. While I copied over a hidden folder with panel launchers, I’d have to do some digging in my old system to restore those icons to what they were, but probably a less time-consuming answer would be to just extract those icons, have them converted to .png, and put them somewhere safe for use with the associated program.

Another scenario for why you would want to extract icons is that the default icon for one of your programs is horridly pixellated, yet you know the .exe actually contains a bunch of higher resolution icons, and wish to change it to one of those, simply to make it look better.

Now, there are a bunch of apps available for this, mostly command-line solutions but a few little GUI apps as well, but the easiest to use is gExtractWinIcons. All you have to do is open a resource file (like an executable .exe or .dll library), pick a destination to save to, select the desired icon(s) for extraction, and click Save.

If the file contains a lot of images, click Deselect All, and manually mark those you want for extraction. Once you’re finished, move your icons somewhere safe, and assign them to your Wine programs’ launchers.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Here is a Wine “error” that appears to be fairly new, and if you’ve been upgrading your system (and Wine along with it), you probably haven’t encountered it yet. However, if you’ve recently installed Ubuntu (10.04 – not sure if this affects any earlier versions), you would have noticed it won’t let you run any Windows .exe files:

Blocked: wine start /unix
The file ‘/home/user/Downloads/program_name.exe’ is not marked as executable. If this was downloaded or copied form an untrusted source, it may be dangerous to run. For more details, read about the executable bit.

If, like me, you decided to do a fresh install, but copied your old .wine folder over so all your Windows programs work as they had in the old system you’ve migrated from, you probably have no problems opening those previously installed, only new .exe files that Wine hasn’t dealt with before.

But this isn’t a bug or an error, just an overly-cautious default setting, and it is actually really easy to disable. Open a terminal and enter the following command:

gksu gedit /usr/share/applications/wine.desktop

Located the line Exec=cautious-launcher %f wine start /unix and change it to Exec=wine start /unix %f

Save and exit the file, and Wine will now behave as you want when it comes across new Windows programs.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

If you prefer to leave this cautious setting as the default, you can always exclude individual Windows programs or, rather, bypass this security measure for individual .exe files. Simply right-click the .exe file in question, select Properties, and in the Permissions tab check “Allow executing file as program“. Click Close and that particular .exe will open as normal when you double-click it.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Please note that this is for the “legacy” version of GRUB still widely in use, not the next-generation GRUB 2. If unsure, check out this guide on how to find out which version of GRUB you are using.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

You can make GRUB boot to an operating system other than Ubuntu, like Windows, by simply editing a bit of text. Open menu.lst for editing as superuser by pasting the following into a terminal:

sudo gedit /boot/grub/menu.lst

and near the top you should see:

default         0

You will need to change the “default” value from “0” (zero) to the number of the Windows entry, which should be near the bottom of the file and look like:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Windows XP Professional x64 Edition
root        (hd0,0)
savedefault
makeactive
chainloader    +1

Noting that the default entry (Ubuntu) is “0not “1”, simply count the entries at the bottom of menu.lst, and deduct 1 from the value of the Windows drive/partition.

In other words, if your GRUB menu has the four basic options (Ubuntu, Ubuntu Recovery Mode, Memtest+, and Windows), then your Windows drive is the fourth option, so the “default” value should be “3”. Obviously, if your boot menu has some earlier kernels still listed, and altogether there are 8 entries with Windows as the last, then the value would be “7“. As I said, simply count the entries at the bottom of menu.lst (they should all look similar to the Windows one) and deduct one from it (assuming Windows is the last entry, of course).

Close and save menu.lst and GRUB will automatically boot Windows from then onwards. You can of course still choose another OS like Ubuntu at the boot menu before the countdown finishes.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

Related Guides:

Make GRUB (Legacy) Automatically Boot to the Last Used Operating System

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Older Posts »