Tag Archives: sublime text

I Forgot My Newline

This is a friendly reminder to always leave a blank line at the end of your text files. You might be thinking that it doesn’t really matter, and in many cases you’d probably be correct. However, there are also plenty of configuration files for apps that require it to be there. Those that do will most likely not tell you so it would be quite hard to find and fix the problem.

Technically, a text file is just a series of lines ending in a newline character “\n”. On very old systems, a file without the ending newline would not even be considered a text file. Operating systems and applications nowadays can handle this and still read the file, but not without problems. The most likely issue is that the last line will be completely ignored. Due to the missing newline, it’s not even considered a line of text. Hope the last line of your file wasn’t important!

A prime example is cron in Unix-like operating systems. Filling up the last line in a crontab and forgetting to add a newline at the end is one of the most common problems people run into when new to cron. That last command at the end of the crontab will simply not run.

I’ve run into this a few times in the past, so I decided to look it up and find out the deeper reasons behind programs expecting “\n”. I thought it would be interesting, and it was. I hope you’ve learned a useful tip, even if you don’t care about the reasons behind it.

If you want to be sure to never have this problem, check out Sublime Text, my favorite text editor for code and everything else. It has an option to force a newline at the end of a file on saving. Sweet! If you are already using Sublime Text, see my previous post on replacing the default icon with something much cooler.

Lessons Learned : All About Icons And Shortcuts

Here’s the latest grouping of my favorite bookmarks and why I think you should check them out!

  • Add Sublime Text to Ubuntu launcher – Ubuntu’s launcher can be pretty finicky when trying to lock new icons to it. I’ve had problems for a while getting Sublime Text’s launcher to stick on my laptop. This concise article shows how to make a proper Unity launcher that shows up in Applications and will stay nicely on the launcher dock. On my machine I installed to my preferred spot of /opt/ as opposed to this author’s ~/My Programs/. Also, instead of the uglyish default, I used this custom icon by Nate Beaty:

    sublime text icon by nate beaty

 

  • 60 Beautiful CSS-Sprite Social Media Icons – This is the set of icons I used for the menu on the very blog you are reading. They were put together and provided with CSS coordinates by Brandon Setter. The lovely icons themselves were designed and provided for free by Icon Dock. Thanks to both for adding flair to my theme!
    Update September 9, 2013: I have since changed the theme and social media icons.
    socialmediacsspriteiconset

 

  • Add shell aliases to ‘sudo’ commands – I am growing a decent list of shell aliases in my .bash_profile and there have been a few cases where I’ve been frustrated by them not being available to ‘sudo’. It’s not that often I run across a use case, but I did today with ‘ufw’. I wanted to alias it to ‘firewall’ but it must always be run as root. Now my alias works thanks to: