This weekend I’ll be giving Monodraw a test drive. It’s an ASCII-art drawing program for Mac OS X. If it’s as good as advertised I may use it to draw images for my new book.
asciiflow.com is my favorite ASCII art drawing tool. It lets you draw and re-size boxes, draw lines and arrows, add text, supports and undo feature, and more. All online, all free.
When working with text files on a Unix/Linux system, you'll occasionally run into a situation where a file will contain extended ASCII characters. These extended characters will generally appear to begin with
[characters in your text files. For instance, the vi/vim editor will show
^M characters in DOS text files when they are transferred to Unix systems, such as when using the ftp command in binary transfer mode. Oftentimes, you'll want to easily delete these characters from your files.
This python.org page has a nice discussion on Unicode and the history of character codes. It’s good background material in case you ever wondered how we got where we are, and how character codes work on computers.
Every time I go back to writing GUI programs, I find that I want to document my UI layout code, especially when I use something like a JGoodies layout in a Java/Swing application. I just took a look around and found some ASCII drawing programs, which may help me create the documentation I’m looking for, i.e., an ASCII drawing I can put in my Java/Scala comments, above my UI layout code. I created this particular drawing with asciiflow.com.
Problem: You have a file that should be a plain text file, but for some reason it has a bunch of non-printable binary characters (also known as garbage characters) in it, and you'd like a Ruby script that can create a clean version of the file.
Solution: I've demonstrated how to do this in another blog post by using the Unix tr command, but in case you'd like a Ruby script to clean up a file like this, I thought I'd write up a quick program and share it here.
Problem: You have a byte value, or a string of byte values, and you want to use a Ruby script to convert each byte to its equivalent ASCII character.
I just ran into this problem while working on a script to remove binary/garbage characters from a Unix text file. In short, the file had a bunch of binary "garbage" characters in it, and I wanted a clean version of the file that contained only printable ASCII characters in it.
Problem: You have a character, or a string of characters, and you want to use a Ruby script to convert each character to its ASCII decimal (byte) value.
I just ran into this problem while working on a script to remove binary/garbage characters from a Unix text file. In short, all you have to do to convert a character in Ruby to its equivalent decimal ASCII code is use the
? operator in front of it, like this:
I just ran into a need to see what non-printable (non-visible?) characters were embedded in a text file in a Unix system, when I remembered this old sed command:
sed -n 'l' myfile.txt
Note that the character in that sed command is a lower-case letter "L", and not the number one ("1").
This command shows the contents of your file, and displays some of the nonprintable characters with the octal values. On some systems tab characters may also be shown as ">" characters.