Tagged as: Bug-fix, Geek, Learn, Linux, Mac, Programming, Useful, Windows, Work
May
16
Files on computers are made up of different characters that are interpreted by whatever it is that you are using. That means that no matter what file it is, it is essentially a string of bytes that are interpreted by the program opening it. This means that your music program tries to interpret whatever file you open with it to be conformed to some audio standards (mp3, wma, etc.). Try to open the same file in a text editor, and you’ll find yourself looking at (apparently) junk characters. But then you’ll realize that the file is still just a bunch of characters.
I bring this up because
- It seems as if people don’t realize this.
- I encountered this while writing a Perl script today.
Something else that you should read even if you don’t know what Perl is: Windows and Unix-variants (including Mac OS X and up) do not handle files the same. I’m not talking about Fanaticism (because I’ve already posted about that). Windows uses characters that are referred to as the Carriage Return and Line Feed in order to represent a newline. These names originate because of their original use in the typewriter which actually had a physical mechanism to move. In any case, Unix-variants utilize the line feed character to distinguish its newlines. This can obviously lead to some problems if you use the same files on both systems.
If you don’t know what Perl is then you can fairly safely stop reading this article now because the rest won’t help you much. I know that it was hard for me to find and I’d like to make it available if anyone else so happens to run into the same problem.
While writing a script in Perl today, I had a seemingly strange problem where I would do some processing on my Windows machine and then transfer the file via FTP to a Unix-based server. However I noticed that I had a string that when printed to the screen on my Windows computer would display correctly but would display incorrectly in the file put onto the server. I could not figure this out for quite sometime because it seemed as if some of the lines were printing correctly and some were not. Alright enough explanation. Essentially I thought that the last character was getting chopped off in some way that I did not understand in Perl. However it had to do with Perl assuming that the lines has both a carriage return and a line feed on the lines and then chopping them off when the file was being sent via FTP. The fix that I ended up using was simply a one line regular expression like so (a suggestion from a co-worker):
$output=`some action`;
$output=~ s/\n/\r\n/g;
print $output;
print FOUT $output;
Hope that this helps someone searching for an answer. I know that I would have liked to have happened upon the answer while searching for it.
Tagged as: Blog, Geek, Learn, Linux, Software
Apr
27
Sorry about the downtime both today and last night.
Last night I was upgrading to Feisty so it was taking a lot of the bandwidth away from my connection. Thus it would be hard for people to have snuck in and successfully got back the pages that they were looking for without timing out.
And then sometime early this morning, my home DSL connection somehow died. And I didn’t realize this until I was at work. And that meant that nobody was physically around to restart everything. Ah the downfalls of hosting your own site on a home connection. It was pretty good for quite sometime. I didn’t need to restart (and renew my IP address) for possibly a month or two? That’s pretty good. Well at least for me anyways.
Anyways, back to our regularly scheduled program!
Tagged as: Geek, Idea, Life, Linux, Mac, Software, Useful, Windows, Work
Mar
15
A hint for those who are working and find themselves easily distracted. Well I guess a hint for all of us. It’s hard to focus on a single task (such as your current work project) in this multi-tasking day and age. Something that’s helped me Read the rest of this entry »
Tagged as: Emacs, Geek, Life, Linux, Mac, Profound, Rant, Software, Windows
Jan
28
I must write a little something about something that I’ve noticed recently. Fanatics. Granted, I’m not talking about the extreme fanatics who come to mind as choosing to give up their life to kill others. I’m talking about the simple everyday fanatics that someone like me might encounter. There are a few examples that I have seen that are fairly interesting.
Windows vs Apple (vs Linux (vs [insert OS]))
Everyone is aware of this brand of geek fanaticism. Countless Apple users proclaim the goodness of their own computer. They follow every move that Mr. Jobs makes as if he were some sort of god. They are eager at every opportunity to shoot down the evil Microsoft users as geeky, sheep-following idiots. Add the Linux users who are (generally) also very eager to shoot down the users of other operating systems as lame and uncompromising in their closed-source, proprietary, corporate evil methodology. Microsoft Windows users often don’t really join in the fray because either they are not aware of the fray occurring or they don’t really care. But those who do, stick by their guns and enjoy comparing themselves with overpriced, unimpressive, don’t-live-up-to-our-compatibility products from the competition. This is an interesting battle because people have been known to be for one of the many sides, and the fact of the matter is that they shouldn’t be.
I have been especially interested in this topic because I have been looking at getting myself a Macbook Pro 15″ for sometime now. I was following them and the news stories about them since before they came out (which means I’ve been reading about them for over a year now). And I also currently use Ubuntu (a Linux operating system for the uninitiated) on my home computer.
VI vs Emacs (vs Visual Studio (vs TextPad vs Eclipse, et al))
The battle of the editors is a favorite amongst programmers. It’s an interesting one because it’s similar to other battles amongst programmers (i.e. programming language battles of the sort of Java vs C++ or PHP vs Python vs Ruby on Rails) that often occur. I have come to the conclusion that programmers (in comparison to a vast majority of people) use the fact that they can understand things in their reasoning for becoming fanatics for something. Simply because they think they know, they proclaim that they know. The reality is that one must see these editors, IDE’s, programming languages, etc tools. They are things to be used when a certain task arises. Simply because one loves a particular sledgehammer does not mean that ones uses said sledgehammer to do everything. But I digress. VI has some good points (excellent use of the QWERTY layout so minimal finger travel is require) while Emacs has other good points (ability to do pretty much anything that you want). And the list goes on for different editors. But the fact of the whole argument remains that it’s a matter of preference and you can find knowledgeable and intelligent people using either. Don’t close yourself to the idea that it doesn’t really matter what one uses if they are able to get the job done. I recently encountered this a little bit at work because both of my co-workers use TextPad when they are coding. I had never heard of this program before but it’s basically a Windows application that’s has a fairly robust feature set for programming. However, I recently started using Emacs at work in order to see if I was more efficient with it. And I find that it has many features and shortcuts that I am hard pressed to give up. However, I still use TextPad because frankly it’s much more easily integrated into a Windows working environment. In addition to this, I still use VI some of the time because that is all that is on the main server (it runs a fairly old version of Unix). So I deal with it all, and it’s oh so fun.
There are other issues I’m sure, and perhaps I’ll add my thoughts on them when I encounter them.
Conclusions:
The truth and lesson that can be derived from this topic is one that can be applied to many unrelated issues in life. Apple has a good product, yes. Proof enough of this is in their recent success. Linux has good points as well as noted by its up and coming status. Microsoft must have something in their Windows operating system else they would not perennially be on top. But what one can learn is this:
There are many choices and we must not go and align ourselves with one or the other as if one were perfect and the others are not. We can think clearly about the matter and see that they are all lacking in certain regards. Take the good, and leave the rest.
I like this idea in other matters of life as well. The only time that I’ve found that this doesn’t fly is in the face of true absolute truth (i.e. the Bible). Suffice to say, not much else in life is absolutely true.