This page is powered by Blogger. Isn't yours? tech

qptech blog

The companion to qpmarl blog. Here you will find all technical related posts (mostly computer and linux stuff)

Sunday, March 19, 2006

 

con

Try to make a file (or directory) named con - you can't do it (if you're using some version of Microsoft Windows). This is a relic of MS-DOS still present in Windows XP. "con" is short for console and directs input/output to the console rather than a to a file.

enter copy con at the command prompt. (If you don't know how to get to the command prompt, hit start->run and enter cmd ) You'll get a cursor on a blank line. Now start typing. Enter whatever you'd like. Notice the strange results. This is very similar to the unix "cat" command. hit CTRL+C to get back to the prompt.

Now enter copy con newfile.txt at the command prompt. Whatever you type will be output to newfile.txt instead of echo'd back to the screen. Type CTRL+Z then hit ENTER to stop input. Now open newfile.txt to see what you've created.

If you are very familiar with the linux command line, then you can stop reading now as the following will all seem very basic.

This is all very basic stuff for linux command line use - but it's much more intuitive in linux. In win/dos if you hit cntrl+c to end input, the OS will throw away everything you've written and say that 0 files were copied - in linux ctrl+c will end input, but the file will be created. also in linux the command would be cat > newfile.txt - cat is much more functional than copy - especially when paired with other command line tools. "cat" is short for "concatenate" as it was originally intended to concatenate two or more files cat file1 file2 > newfile will do just that - newfile will contain the contents of file2 tacked to the end of the contents of file1. It is also commonly used to list short text files cat anyfile will display the contents of "anyfile" on the screen. cat file1 file2 will display the contents of both files on the screen (you could specify as many files as you'd like - you aren't limited to 2).

Of course cat is not the best tool for displaying files. more will stop at the end of each screenfull to allow you to read a screen at a time - cat will just keep going as if you could read it as fast as it can output it. of course there is an even better tool than more - it is called less. less not only waits for you to read each screenfull, it allows you to scroll backwards and read something from a previous screen.

If any of this sounds new and exciting to you, then you need to get a copy of linux and start playing with it - maybe on some old piece-of-junk computer you've got sitting in a closet somewhere - linux will fit and run nicely on it if you find the right distribution. Don't even install a GUI the first time you install it. Just install the very basic packages and play around with the command prompt - it'll help of you have another computer nearby connected to the internet so that you can go to the linux documentation project website and read up. I suggest the Linux User's Guide (LUG) - which is quite outdated, but still very relevant because the command line and unix filesystem basics remain rather constant. It's not that complicated or hard to learn. Think of how hard it must seem to a kindegardener learning to read - he may want to give up and just look at the pictures, but reading really isn't that hard and it's definitely worth the initial effort.

 

desktop shortcut to resart the DNS client

I described the problem and solution in an earlier post. The next step of course is to make a desktop shortcut to take care of everything instead of manually restarting the service from the computer management tool. So I made a batch file to do it. Here are the contents

net stop dnscache
net start dnscache

That's it, it works. Now whenever I sit down to a stale windows session in which the dhcp client is probably not functioning properly, I can just hit the icon on my desktop to restart it. It doesn't even matter if the dhcp client does happen to be working - there's no harm in restarting it.

I had to edit this post because when I first wrote it, I mistakenly said that it was the DHCP client (I wrote it in a rush or something) and had dhcp instead of dnscache in the batch file listing. Now it's right.

Friday, March 17, 2006

 

I hate Apple too.

Stupid Quicktime. I gotta download their player because some idiots out there post videos only in Quiktime format. That's not a problem. I don't mind letting a few megabytes of storage go to another video player. But the stupid thing tries to take over my computer. You can't just get the Quicktime player anymore. You gotta get the iTunes client which includes the Quicktime player. I don't want iTunes. I don't plan to ever buy anything from iTunes. I don't have an iPod. I don't want music in their proprietary media format. I don't want the iTunes client. Then the stupid Quicktime plugin sets itself as the default for just about every type of file I might try to view in my web browser - not just videos, not just media files - all sorts of stuff. It wanted to make itself the default player for everything, but fortunately warned me and gave me the option to alter this durring installation. Why does nearly every piece of software do this - assume that you want to use it for every type of file that it could possibly open. I don't want Photoshop (or some other editor) to be the default application for jpeg files when it takes 10 minutes to load while the windows image viewer (which does suck, but it's what I use anyway) usually loads in less than a second and only occationally takes 10 minutes to load (these times are of course exagerated (only slightly)).

Firefox has this neat feature where it can automatically download a file and open it with a real application - hey that's a great idea, why don't we play mp3's in winamp instead of some stupid plugin. I just gotta make it enque the songs instead of playing them immediately.

 

Windows XP's "DNS Client" service is a POS

I've been having this problem with my laptop for quite some time now. I'd had it for a few weeks before I'd noticed the problem, so it may have been caused by a windows update or something.

Every time the computer goes into hibernation and back out and perhaps when it's been on for quite a while (overnight) without hibernating, the stupid internet connection stops working.

At first I thought it was related to my wireless network card because that's what I was using when it first happened, but now I'm not sure that the wireless card has anything to do with it.

The quick solution (and the only thing that seemed to work) was to reboot the machine. There was no problem with the internet connection itself - the wireless icon in the system tray shows a good connection and activity, whenever trying to access a web page, it would show a small amount of traffic, but the browser would fail to find the page. Renewing the connection obviously did no good. I thought that it might be some bug with Zone Alarm whereby it wouldn't let any traffic through. Disabling Zone Alarm did no good. I could access other computers on the network as well as the wireless router configuration - but getting out into the wild proved impossible without reboot.

Just now, I soved it. It was obviously some problem with windows itself, not the browser, not the firewall, etc. So I opened up the Services section of the Computer Management tool and started restarting internet related services one by one. I pretty much started at the top of the list and began working my way down with every service that has anything to do with internet. I only had to restart two however - the first one is not important because it didn't do any good. The second one happened to be the DNS Client and I thought "yeah, if it's anything it's probably this. I didn't know any popular web site IP's off the top of my head, so I hadn't tried connecting to any IP directly, but it would explain why windows networking and accessing the router by IP address would work and nothing else (some other internet services would work as well, but now that I think of it, they also would have been using IPs rather than URLs). I restartd the service, switched to firefox which I'd already had open in the background, hit the home button, and the page loaded in about 0.3 seconds. A-Ha! it was the DNS client. I don't have to reboot to resolve this issue anymore. So then I cruised over to blogger.com and started writing this post.

Stupid Microsoft.