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, Bug-fix, Useful, Wordpress
Apr
08
Today (okay maybe last night) I wanted to finally fix a stupid error that I’ve had with my Wordpress installation. Now I think that Wordpress has been pretty great, but there was something about it that was making me a little bit irritated. Wordpress was working great when I first started, but then one day it seemingly reverted itself back to the Default theme as Kiki so astutely pointed out on this post.
Ever since I was simply temporarily fixing the problem by renaming the default theme to kubrick and actually making a copy of my real theme (Not So Fresh) and naming it default. Thus if wordpress ever decided to revert again, it would have no effect on what people saw.
This is obviously a dumb fix.
Read the rest of this entry »
Tagged as: Blog, Bug-fix, Social-Bookmarking, Useful, Wordpress
Apr
08
If you use Wordpress, I recommend the very nice Gregarious plugin for social bookmarking. It has an excellent interface and the Share This button works very well. But I was having a bug with it because the popup wouldn’t display.
Most of my readers won’t care one iota about this entire post. But I don’t post what they want to read, I post whatever I want to post! And onward!
Read the rest of this entry »
Tagged as: Blog, Bug-fix, Wordpress
Mar
21
So I’ve been using feedburner for stats on my website lately. It’s just a little bit of Javascript added to the templates. Pretty simple. Except it wasn’t working today! It kept showing 0 visitors when I know for SURE that there were visitors (like me!). What’s going on?? Read the rest of this entry »
Tagged as: Blog, Bug-fix, Geek, Learn, Wordpress
Feb
02
So last night I encountered a fairly common error. For some reason (I still don’t know why) the Internet connection at home was not working. Now this meant that I would have to renew the IP address (and thereafter update the DNS to reflect this change). I had done this at least once before so it was pretty straightforward.
HOWEVER, after changing the host record on namecheap’s site, the DNS would still not redirect me to the correct IP address (my own). Bah, so I figured that there was a refresh problem and just went to sleep. (I also turned off the server as I do every night in case you might be wondering why you can’t get to it at night). I woke up this morning and checked it out to see what was up. Still no change. How could this be?! I tried updating it and checking it over and over. I finally realized something was terribly wrong. I thought that perhaps it had to do with submitting my site to google’s index so I tried removing it. I have since realized that probably has nothing to do with it. Then I came to the conclusion that namecheap might not be as optimal as previously thought. That’s too bad. But no love lost since it’s not a big deal. Thus I transferred the DNS services to zoneedit which has an ugly site but has good reviews. They took a little while (~30 min) to transfer the DNS as well as update the host record. Pretty good. We’ll see how it holds up.
So in sum, we’re back online! 