Showing posts with label Computers. Show all posts
Showing posts with label Computers. Show all posts

Monday, January 30, 2012

The Power of an Icon

It's very common these days for buttons to have icons on them instead of or in addition to text. And I'm not just talking about buttons on computer programs but buttons of physical devices as well. Take the following icon (and the slight variation) for example:



This icon represent the power button. In addition to computers you might have seen this icon on a radio, microwave, washer and dryer, etc. Although most people have seen this icon, I think few people know why it represents power.

The answer is so obvious you probably missed it. If you look closer at the icon you can see the icon is the number 0 and the number 1. One and zero, as in binary, on and off. So this icon represents power (on/off) because some "nerd" (and I use the term affectionately) decided to use binary as an icon to represent power.

So the next time you see this icon it might make a little more sense.

Wednesday, December 28, 2011

Rapid Release Schedule

One thing I've noticed lately is a lot of software is releasing too frequently. Of course, a phrase like "too frequently" is subjective. There is a fine balance between not enough and too frequently.

The whole reason to release a new version of a product is to add new features/support and/or fix bugs in the program. So new versions of a product are a good thing. But there is a downside to releasing too frequently. The main problem is there is a "cost" associated with updating software. Every computer with that software installed needs to download and install the updated version. Sometimes this is automatic sometimes it's manual. If it's manual then a frequently release schedule means the user spends more time upgrading. Automatic is not a panacea either. Automatically updating apps can lead to problems without the users knowledge. Plus there is the problem of bandwidth. Every upgrade requires bandwidth to download and install. For each individual user this isn't a problem, but consider on a whole how much total Internet traffic is wasted on continuous updates.

Probably the biggest problem with frequent updates is in corporate use. Most larger corporations do NOT use automatic updates, they use automated tools to update the software in their enterprise. When you consider how many applications will be used in a large enterprise, and if those applications are on a frequent release schedule this creates a lot of work for the IT admins.

A good example of a "rapid release schedule" would be Mozilla Firefox. I think my only gripe with Firefox is it's release schedule. In the middle of 2011 Mozilla announced Firefox would switch to a rapid release schedule. From 2005 'til 2011 Firefox went from version 1.x to 4.x. In the second half of 2011, Firefox went from 4.x to 9.x. So in less than 6 months Mozilla went through more major release numbers than it did in the previous 6 years. And it's not just Firefox. Google Chrome and Adobe products are two more examples of software that releases too often.

Typically software version numbers are major then minor. Often times there are addition numbers for even smaller releases (like bug fixes). If you increase the major version of a product, this should indicate a MAJOR change in the product. Makes sense huh? Too bad software companies don't seem to grasp this.

Friday, November 11, 2011

Stupid ISP

For the longest time I've had this unusual email problem at home. My work email account, I can read my email but I could not send emails. If I take my laptop into the office and connect to the Internet there I can read and send emails. So the problem isn't my computer, the problem is my network at home.

I finally decided to research this and found the problem. It turns out a lot of ISPs block port 25 which is the standard port for sending emails. They do this to cut down on the amount of spam being sent from their network. I understand wanting to cut down on spam, but it would have been nice if they told me they were blocking this port.

So what do you do if you're in a similar situation? I can only think of two possible situations. First, check to see if your email provider offers a second port through which emails can be sent (my provider offered this). The only other solution I can think of is to create a VPN tunnel into a different network (e.g. office network) that doesn't block port 25.

Thursday, November 10, 2011

Hard drive sizes - why marketing should be shot

Have you ever bought a new hard drive for your computer, but after installation the drive isn't as large as the package claims? Well the short answer is because the marketing department at the hard drive company lied to you. Every manufacture does it, and there is some precedence for what they've done.

It all comes down to math. Computers operate in terms of binary, 1s and 0s. A single 1 or 0 is called a bit. They group 8 of these bits together and call it a "byte." A byte is the smallest representation of data that computers store. When talking about larger numbers typically use prefixes like Kilo, Mega, etc. A kilobyte (KB) is 1,024 bytes. 1024 might seem like an odd choice, but they use it because 2^10 equals 1,024. And since computers use binary this was the obvious choice.

So where does the precedence come in? Well 1,024 is fairly close to 1,000 and as far as the human brain is concerned, doing math with 1,000 is a lot easier than 1,024. So it became common practice to use 1,000 to represent kilobytes. The problem is, as sizes get larger, the error compounds itself. Check out the following table:

Size / Percent difference

Kilobyte / 2.4%
Megabyte / 4.9%
Gigabyte / 7.4%
Terabyte / 10.0%

As you can see the error increases with each increased size. So if you buy a brand new 4 terabyte hard drive, it can actually store only 3.6 terabytes, or 90% of the claimed value. Hopefully at some point hard drive manufactures will discontinue this lie and accurately label their products.

Thursday, November 3, 2011

Watch Bing bleed!

I know I just made an anti-IE post, but I wanted to follow up with an anti-Bing post. It's not that I'm trying to rag on Microsoft. A lot of what they do is great, I mean heck my day job is as a Windows programmer so I owe my existence to them. But that's not to say I have to love everything they do.

Case in point - Bing. I have never been a huge fan of Bing. I'll admit, it's probably the second best browser out there, but the question remains, why use Bing when Google exists? Apparently I'm not alone in this thinking, and Microsoft has been loosing some serious money with Bing. To quantify it, between June 2009 and September 2011 Microsoft lost $5.5 billion dollars! And to make matters worse, the rate of loss is increasing not decreasing. Just check out this graph:


Whether or not you like Bing, this trend cannot continue. So either Microsoft will have to make drastic changes and/or cuts to Bing, or Bing will cease to exist before to long. Should be interesting to see happens.

MP3 versus OGG

Recently I talked about FLAC, the free lossless audio codec. Although lossless is a good thing, me personally I couldn't hear a difference so I decided to go with the space savings of MP3 / OGG. But today I wanted to talk more about MP3 and OGG files.

Without a doubt the MP3 format is the de facto audio format. Everyone uses it, just about every device and piece of software reads that format. But that doesn't mean it's the best format. I recently took a closer look at the OGG format and was surprised by what I learned. Unfortunately I can't show you like I could with the picture samples in my post about image compression, so you'll just have to download some samples and judge for yourself.

Put simply the OGG format offers better compression for the same bitrate compared to MP3. So what this means is you can have smaller files than MP3 without sacrificing quality. Or you could have files of the same size but with better quality. At first I didn't believe these claims, I think part of me was hesitant to give up my trusty MP3 format. But listening to some samples and reading about the two formats it is true. Think of it this way, MP3 dates from the early 90s whereas OGG is from 2000. In that decade they improved upon the technique of compressing audio without losing quality. This is how OGG is able to compress more without loss of quality compared to the MP3 format.

So starting now I'm going to switch to the OGG format for all my furture audio needs.

Friday, October 28, 2011

DNS servers

I remember back in the day it was common to remember the IP address of at least one DNS server. This was probably back when I used a modem to connect to the Internet, and you would typically enter the IP address of a DNS server manually. Without at least one valid DNS server you might as well not be connected to the Internet because it's nearly impossible to access any sites. But remembering DNS server's IP address is never easy, they always have what appear to be random addresses.

Well good news. Google offers two public DNS server with very easy to remember IP addresses. They are 8.8.8.8 and 8.8.4.4. Hopefully you'll remember this little tidbit of info the next time you need to enter an IP address.

Thursday, October 27, 2011

Is the PC dead?

I've seen a lot of news stories and opinion articles lately that say the PC industry is dying. I think because I program on PCs these types of articles rub me the wrong way. Every article like this I've seen, when you read the article in detail it paints a different picture. In every case the PC industry is GROWING year over year. So how do they claim the PC industry is dying? Well their claims are based on the fact that the PC industry isn't growing as fast as it once was, so they are drawing the conclusion that if this continues the PC industry will start to decline. Well no one can predict the future. Certainly the global economy is weak right now, so that could easily explain the slower PC industry growth.

These articles always go on to say that most users are buying tablets and smartphones, and that these devices will eventually replace the PC. I personally find that hard to believe. I would say a desktop/laptop computer has two main uses - leisure and work. Leisure would be activities like playing games, watching videos, surfing the web, etc. I will agree that tablets and smartphones can do these leisure activities just as well as a desktop/laptop computer if not better. And they are portable so you can do it anywhere.

But what about "work." This would be tasks like writing documents, editing files, programming, accounting, etc. This is where tablets and smartphones I think will always fall short. Do you really want to write a 20 page paper on a 7" screen using the keyboard on the screen? Think about it another way. Businesses throughout the world buy millions of desktop/laptop computers for their employees to use. They are far and away the largest consumer of computers, far more than home users. I think that tasks people do on a work computer would not translate well to a tablet/smartphone. So as long as businesses need computers, the industry will continue to grow.

If I had to make a prediction here it would be this. Tablets and smartphones will continue to gain in popularity, especially with home users, and most home users will still buy a computer for home user although these numbers will decline slightly. Finally, I predict that businesses will continue to need mass quantities of computers.

Wednesday, October 26, 2011

Free Lossless Audio Codec (FLAC) files

In my last post I talked about PNG, the newer lossless image format which I personally think is superior to JPG. Today I wanted to talk about FLAC which is a lossless audio format.

As a general rule, lossless formats do not compress as well as lossy formats. So whereas FLAC will be smaller than the raw WAV file, it will not be as small as an MP3 or OGG. From what I've seen a good rule of thumb is a FLAC file will be about 50% the size of the original WAV. Compare that to MP3 and OGG which will be about 10% the original size. Or another way of looking at it is FLAC will be about 5 times larger than an MP3 / OGG.

If you read my last post, you know I liked the PNG format because you could see the lost image quality even in JPGs saved at 100%. So for me to recommend FLAC over MP3 / OGG there has to be a noticeable difference in audio quality. Unfortunately I cannot "show" you the difference as I can with images, you'll just have to download audio samples and have a listen. That said, I personally couldn't really tell a difference between FLAC and MP3 / OGG. I suspect that it really comes down to A) what the source material is and B) how good your speakers are. The same would be true of images. Most images you cannot see the "noise" in the JPG when saved at 100%. But certain images, such as my sample image with text, the issues with quality were apparent. So I'm guessing the same is true of audio files. Some audio samples you'll have to try very hard to hear a difference, whereas other audio samples the difference will be apparent. Given this, and the fact that MP3 / OGG are noticeably smaller than FLAC, my preference is to stick with MP3 / OGG for most applications.

Even through FLAC didn't win for me, it's still a nice format to have around. There are instances where I will use it, and since it's a totally free codec you don't have to worry about legal issues. One final note I'll mention for all you people out there who listen to your music on Apple devices. Apple has their own proprietary audio format called Apple Lossless. Both formats are lossless, but FLAC is definitely better. FLAC encodes and decodes the music in less than half the time, and the end file is a few percentage points smaller than Apple.

Tuesday, October 25, 2011

Portable Network Graphics (PNG) files

In the world of computers there are dozens if not hundreds of image formats. So many that I'm not even going to try and list them. But in terms of the Internet, relatively few formats are commonly supported. In fact it seems as if there are 3 main image formats; GIF, JPG, and PNG. I wanted to look more closely at these formats and try and learn more and the PNG format.

GIF
One of the first, if not the first, image format on the Internet is GIF. In the early days of the Internet, most people connected to the Internet via a slow 2400 or 9600 baud modem. So keeping file sizes small was very important. The GIF format uses a palette of 256 colors, so file sizes are pretty small. GIF does support transparencies (a single alpha channel) as well as animations.

JPG
The JPG format has undoubtedly become the king of image formats, both on and off the Internet. The JPG format uses lossly compression to achieve some pretty good compression ratios. I don't think JPG supports transparencies, nor does it support animations.

PNG
The newest format to come along is PNG. Like JPG, this format supports full color, but unlike JPG it uses a lossless compression so image quality is not compromised. Also, PNG has full alpha channel support, not just a single channel as with GIF. So really, you can think of PNG as the best of the two formats.


But how do the three formats compare? I created a sample image using GIMP. It's a gradient from blue to red on top, pure white on the bottom, and some sample text in the middle. Let's have a look at the image in the different formats.

GIF:

If you look closely at the GIF file you can see it dithered the image down to 256 colors. This is especially evident in the red part of the gradient. This would be even more evident if the original image had more colors. The GIF file is fairly small at 16KB.

JPG (80%):

The JPG saved at 80% quality looks really bad around the text. It's easy to see the compression has lost image data in order to get the file size down. This file is 6KB in size.

JPG (90%):

Whereas the JPG saved at 90% looks better, you can still see the loss in image quality. This file is 8KB in size.

JPG (100%):

The JPG saved at 100% looks pretty good. Unless you look really close you cannot see the loss of image quality. This file is 21KB in size.

PNG:

The PNG file is absolutely perfect. You cannot see any quality issues in the image because there are none to be seen. This is pixel for pixel identical to the original image. The PNG file is the largest at 31KB.


Let's have a closer look at these images:

I've enlarged the images 300%. You can clearly see the loss of image quality in the JPG 80% and 90%. The JPG at 100% looks good, until you compare it to the PNG below it. The PNG image is crisp and clear whereas the JPG is blurry.


Conslusions:
When the PNG format started gaining in popularity, I'll admit that I avoided it. Anytime I downloaded an image that was in the PNG format I converted it to JPG. After all, JPG is the king of image formats. But having seem the loss of image quality, even in a JPG saved at 100%, I now see the benefit to the PNG format. Add to that the full support for alpha channel and the decision is clear to me. The PNG format is a better format than the venerable JPG format. For only a slight increase in size you gain lossless compression and full alpha channel support.

Monday, October 24, 2011

Router firmware: Tomato

In my last post I mentioned 3rd-party firmwares for your wireless router. I wanted to talk a little more in depth about Tomato which is the router firmware I'm currently using. In the research I've done, DD-WRT is the most popular 3rd-party firmware, and it may even have the most features. However, most people who've tried both say they prefer Tomato. I personally haven't tried DD-WRT, so take what I say here with a grain of salt.

I wanted to show you some of the cooler features of Tomato. One of my favorite features is the router will display other nearby routers and the channel they are using. This will allow you to select a channel that has the least traffic and thereby eliminate or reduce conflicts. In the following screenshot, at the bottom you can see the list of other wireless routers. There are 3 APs (access points, a.k.a. wireless routers) on channel 1, six on channel 6, and one on channel 11. This makes it easy to pick the best channel for my area.


This next screenshot shows the bandwidth graphs. You can view graphs for real-time as well as 24 hour traffic, and totals for daily, weekly, and monthly. Useful if you need to track your usage, and just cool to look at.


On the advanced wireless page you can set things like "Afterburning" which is a burst protocol to increase wireless throughput, and increase the transmission power. The default was 42 mW, I increased mine slightly to 50mW. I guess anything up to 70 or so is fine, but beyond that it's self defeating as the broadcast strength causes reflections and a loss of signal.


And on this final page you can view graphs showing you the break down of your traffic according to your QoS rules. For me, I don't have any QoS rules right now, so the graph merely shows 100% of my traffic is unclassified.


Hopefully this has whet your appetite to try a 3rd-party firmware on your router. I've only been running Tomato for about 1 month now, but it's been working flawlessly. I've heard reports that DD-WRT has a tendency to randomly lockup, but I haven't had a single issue.

Wireless router firmware



A lot of people have a wireless router in their house similar to the picture above. But did you know with a change in the firmware you can turn that $60 router into a $600 piece of hardware?

Firmware, if you're not familiar with the term, is the software installed on the router. Just as software controls your computer and make it work, so does the software on the router. Whatever brand router you have, you can go to that manufactures web page and download updated firmware. These updates typically fix bugs and may even add new features.

But I wanted to mention something even cooler. Many routers out there support 3rd-party router firmware. This is firmware written by someone other than the manufacture. Why would you want to do this you ask? Simple, the hardware is capable of more than the manufacture wants you to do, so if you use a 3rd-party firmware you can enable tons of new features. Below is a small list of the types of things you can do with a 3rd-party firmware:


  1. Increase the broadcast strength. If you get poor signal in parts of your house increasing the broadcast power will likely help.
  2. Enable "afterburner" which is a burst protocol that enables faster wireless transfers.
  3. Add advanced networking capabilities to your router such as VLANs.
  4. Function as a VPN server and/or client allowing you to connect multiple remote networks together.
  5. Turn the router into a "bridge" to extend the range the initial router.
  6. Add graphs and charts to track and view network traffic up and down. See how much traffic you're using each day, week, month, etc. Some ISPs throttle you can depending on how much traffic you use each month, now you have a way to track it yourself.
  7. Enable powerful and effective quality of service (QoS) control. If you play XBox on the Internet and every time someone else in the house downloads some files your connection gets laggy, you need QoS. With QoS you ensure the XBox gets all the bandwidth it needs, and the file download gets whatever is left over. Yes, your default firmware probably supports QoS, but trust me, it doesn't really work the way it should.
  8. Turn your router into a web server. Yes, you can host a small web site from a wireless router. With the use of dynamic DNS you can even have it public so everyone can access it.


This is just a small list of the types of things you can do. All you need to do is download and install the new firmware. It's absolutely free! But this won't work on all routers, so if you're considering this route be sure and do more research.

If you're looking for 3rd-party firmware might I suggest Tomato, TomatoUSB, DD-WRT, or OpenWRT. I've heard great things about all of them. At home I'm running Tomato. I haven't tried the others, although I am curious to.

Thursday, October 13, 2011

The case of the crashing server

In my office at work I have a server computer that has been crashing more and more lately. I very quickly ruled out the possibility of a software problem, if Windows were crashing I would get a blue screen of death (BSOD) or a mini-dump file. Instead the machine would just hard reboot at random intervals. The BIOS log contained nothing, so I was left to figure this out the hard way.

First I tried replacing the power supply, thinking maybe the output power would occasionally "dip" causing the crash. But it continued to crash. I noticed the crashes seemed to occur most often during heavy disk activity. So I suspected either the RAM or the disk controller. Since the disk controller was onboard the motherboard, I checked the RAM next. Reseating the RAM didn't help, so I ordered new replacement RAM (DDR3 is cheap right now). The new RAM appeared to fix the problem, it hasn't crashed since then.

But while testing the new RAM I noticed something else disturbing. Using HWMonitor I noticed the CPU (Core i5) was running hot! The idle temp was 50 degree Celsius and under load it got as hot as 104 degree Celsius. That's not good, you shouldn't be able to boil water on your CPU. When I built this computer I used the stock Intel cooler, but I've always hated the stock Intel cooler. Not because of performance or noise, but because they seem to be difficult to install. And the instructions don't help, they only contain pictures and no text.

I turned the machine off and removed the stock cooler. I discovered two faults when I installed the original cooler, so no wonder it was running hot. I cleaned off the CPU and cooler, applied some Arctic Silver 5 (consistently rated as the best thermal compound), and reinstalled the cooler. Now the CPU is idling at 30 degree Celsius and under load it goes no higher than 50 degree Celsius. Much better than before!

I'm sure between the bad RAM and the overheating CPU that I've solved this machines instability problem.

Tuesday, October 11, 2011

Extra power cords



Most small to medium electronics use power supplies with a box on the end. I've heard them called "wall warts" or even "bricks." Whatever you call it, it's a power supply and they seem to becoming more common. Everything from cell phones to fax machines use these types of power supplies. What happens when the electronic item powered by these breaks or is lost? I think most peoples reaction is to just throw away the power cord, after all what use is it without the item it's designed to power? Well as it turns out they can be very useful and I would encourage you to save it just in case. Just as you may lose the electronic item and retain the power cord, you may also lose the cord but still have the item. And some of these power cords are interchangeable. The purpose of this post is to tell you how to know if you can reuse an old power cord.

As an example I'll use a real life example that happened to me yesterday. I bought a used wireless router of craigslist for dirt-cheap because it didn't have a power cord. So I went digging through my box of cords to find a suitable replacement cord.

Now let me be clear, do NOT just use the power cord if the connector fits, you're very likely to break the eletronic device! You need to follow these steps to determine if the power cord will work for you.

First, locate the power specs on both the power cord and the electronic device you're hoping to power. The specs should be on a sticker or stamped into the plastic and look something like this.


Step 1: Type
First step is to identify the type of output power, either AC or DC. Most power cords ouput DC, but a small number output AC. If the power cord matches the electronic item then proceed to the next step. If they differ then this power supply will not work. Note, sometimes they don't say "AC" or "DC." A solid and a dashed line means DC and a wavy line (sine curve) means AC.


Step 2: Voltage
Next you need to check the output voltage. The voltage needs to be an exact match. Technically you can go slightly higher on the power cord (10V power cord for a device requiring 9V), but be aware that higher voltage places the device under additional "stress" and may cause it to fail sooner. In this case the power supply is 12 volts which is what I'm looking for.


Step 3: Amps
Next locate the output amps. The amps on the power cord needs to be the same or higher than the device. It's important to note that the amps rating on the power cord is the maximum amp output, it does not mean the power cord forces that many amps on the output. So as long as the amps is the same or higher than your device you can use it. In this case my router needs 1amp and this power cord outputs upto 1.25 amps so it's good.


Step 4: Polarity
Most power cords like this use what's called a barrel-connector. Polarity of the connector is very important, getting it wrong would be like putting the batteries in backwards. For my power cord the inside is positive and the outside is negative. If the polarity does not match your device, all is not lost. You can cut the cord, strip the wires back, rotate one end, and reattach the cord. Bare minimum you need to twist the wires together and then cover with electrical tape, but ideally you solder the wires together and cover with heat-shrink tubing.


Step 5: Physical connector
The last step is determining if the physical connector will work. This information is not printed on the power cord or the device. So just check it, does the power connector fit snugly into the device? If not, you can fix this for cheap. Places like Radio Shack and digikey.com sell replacement barrel connectors. You cut off the old connector and solder on the new one. Just make sure to get the polarity correct. If you need to check polarity use a multimeter (or a LED).

There you go, the steps necessary to reusing old power cords and saving tons of money. Using this technique I found a power cord for my new wireless router and saved at least $20 over other used routers. You will notice we didn't look at the "input" section of the power cord at all. Assuming you don't have any foreign power cords, this should be a safe assumption. If however you have power cords designed to work in foreign countries these steps may not work.

Thursday, September 29, 2011

Adobe and Apple BOTH suck!

I remember back when the iPad was released, Steve Jobs told the world that the reason the iPad didn't support Adobe Flash was because Adobe could not write good software and Flash was the cause of the majority of computer crashes. In effect he was saying Adobe didn't know how to program well. I personally find this ironic because I consider Apple to be guilty of the same thing.

First off let me say I totally agree with Steve Jobs, Adobe software does suck. My biggest gripe is it's bloatware factor, meaning it installs way too much. Case in point Adobe Reader. This program is over 110 MB in size and all it does it display PDF documents. Compare that to SumatraPDF which is about 4 MB in size. And I've never had compatibility problems with SumatraPDF, it opens and correctly displays every PDF I've thrown at it. Why is Adobe Reader so big? That's a good question.

But Apple is guilty of the same "sin." The latest version of Apple's iTunes software installs over 410 MB of files!!! To give you a point of reference, Media Player Classic Home Cinema is about 12 MB in size. So again, why does iTunes install so many files. I think the root problem is developer laziness. Apple iTunes installs tons of files for every possible language. iTunes should only install files for the language I'm currently using. If I speak English do I really want 100 other languages installed on my computer?

So in conclusion; Apple and Adobe both suck at producing software. Their developers are lazy and we the consumers are the ones who pay the price. I recommend avoiding them if at all possible.

Friday, September 16, 2011

How to Profile

No, I'm not talking about racial profiling. The term "profiling" is used in computers to describe the process of analyzing an application for performance reasons - to locate and reduce or eliminate bottlenecks. Profiling an application can be as simple as making changes to your code and using a stop watch to time executions to improve performance. Fortunately there is a much better way, there are tools to help you profile your application. Below I'll tell you have to use Visual Studio 2005 to profile your application. Note that most every version of Visual Studio has a Profiler, and the use of that Profiler may very. This is only for Visual Studio 2005.

For starters the Profiler is only an option on the highest levels of Visual Studio - I believe they call it Team Suite. You also have to select the Profiler option during Visual Studio installation. From your Visual Studio IDE, select the Tools menu and look for a "Performance Tools" option. If you don't see it then you didn't install the Profiler and/or you don't have a level of Visual Studio high enough.

If you have the "Performance Tools" menu option then you've crossed the first hurdle. Next you need to select a Release build of your project. You can profile a Debug build, but you'll get a lot of "noise" so best to use a Release build. You need to do two things before you compile your code. First, enable Symbols for your Release build. Second, you need to add the "/PROFILE" switch to the linker. This option must be added manually in the "Additional options" section. The /PROFILE switch instructs the linker to generate output that is friendly to the instrumenter.

At this point you can use the "Performance Tools" menu option to create a profile session. To profile your application you must run it from within Visual Studio, and you must use the "launch" button in the profiler view.

There is one more gotcha. If your application is more than a single EXE, if it contains DLLs, the Profiler will NOT traverse down into those DLLs which is probably what you want it to do. To profile your entire application including DLLs there is an additional step. You have to manually instrument your DLL files. To do this open a command prompt. The command is "vsinstr.exe a.dll" Note that when you instrument a file is generates a new PDB file.

Happy profiling!

Friday, July 29, 2011

32-bit versus 64-bit

The computer word is undergoing a change right now, from 32-bit to 64-bit computers. Back in the early 90s it underwent a similar change from 16-bit to 32-bit. 16-bit was a severe limiting factor on what the computer could do, so the switch to 32-bit was definitely worth it. So by the same token, the switch to 64-bit is worth it for everyone to switch over, right? Well as it turns out, the change isn't really necessary, at least not yet.

The first "myth" I'd like to debunk is that 64-bit Windows is faster and/or more efficient than 32-bit Windows. This is completely false, there is no speed improvement from 32-bit to 64-bit. The only benefit to 64-bit is increased memory access. 32-bit computers are limited to 4GB of memory, whereas 64-bit is limited to 1.67 million TB (or 17 billion GB) of memory. But just because your computer can access more memory doesn't mean you should upgrade. First off, unless your computer has more than 4GB of RAM, the switch is moot. Second, you need 64-bit software. If every program you run is 32-bit, it doesn't matter how much RAM you have in your computer, any one program is limited to 4GB. And finally, you need one or more 64-bit programs that would actually benefit from increased RAM. This last one is the big one. Most programs need only a fraction of that 4GB of RAM. In order for 64-bits to pay off, a program needs to use more than 4GB of RAM - and very few programs use that much RAM. Examples of software that does use that much memory are; DB engines, high-end image/video/sound editors, 3D CAD editors, some larger video games.

So to sum up, you should only consider upgrading to 64-bit if and only if:

  1. Your computer supports 64-bit
  2. Your computer has more than 4GB of RAM
  3. You have a high-end program that would benefit from increased RAM
  4. You have a 64-bit copy of that high-end program



Now I'm not saying to avoid 64-bit. If you buy a new computer and it comes with 64-bit Windows, that's fine. But don't go out and buy 64-bit Windows unless you meet all of the above conditions.

Friday, July 15, 2011

Password Prompts

If you've used a computer then you've been prompted for a password. But have you ever noticed that sometimes you have to enter your password twice and other times you only enter it once. Have you ever wondered why that is? If you think about it logically it's pretty easy to figure out why, because if you enter the password twice you're less likely to make a mistake (i.e. fat finger your password). But if that's the case, then why not always require you to enter your password twice?

The answer has to do with how and when the password is authenticated. The rule is if your password is authenticated right here right now then you only prompt for the password once. If however your password is to be authenticated at a later time, then you should be required to enter your password twice. Let's look at some scenarios.

1. You're logging into your computer. You're password is authenticated immediately upon clicking "Login" so you should be prompted once. If you fat-finger your password, you'll be given an opportunity to reenter your password.

2. You're setting a new password on your computer. Even though you're entering your password now, it isn't authenticated until subsequent logins. So you should be promoted to enter your password twice, to help guard against fat-fingers.

3. Some software requires you to enter your password ahead of time, which it uses to later log you in. Again, since this happens later you should be required to enter it twice.

So that's the rule, but it doesn't mean software designers always follow it. I have seen programs that do not correctly follow the rules.

While on the subject of passwords, I wanted to share another interesting tidbit of info. Obviously passwords are encrypted for security reasons. When you set a new password, the password is encrypted and stored for later use. But I think a lot of people make assumptions about how subsequent logins work. They assume the encrypted password is decrypted then compared against the password entered by the person trying to login. This is completely wrong, in fact it's impossible to decrypt the password once it's been encrypted. So how is it you're able to login? Well the password entered by the person trying to login is encrypted, and then the two encrypted passwords are compared against each other. If they match, then the assumption is made that the two original passwords were the same. (And yes, it is an assumption. It is technically possible for the wrong password to work when logging you in. However, the possibility of that happening are so remote that it's never likely to happen.)

Thursday, July 7, 2011

The case of the crashing computer

Recently I upgraded my main system to use dual monitors. This can be of great help when developing software. But ever since adding the second monitor, my machine would experience random crashes - about once a day. But these crashes weren't the usual BSOD that occur in Windows, instead both monitors would go blank and the computer would half power itself off. It was like the machine entered standby, except it would not wake up. If you pressed the reset button the machine would power off (huh?).

I quickly ruled out a Windows software problem. A driver crash almost always results in a BSOD which wasn't occurring. So I started to look at the hardware. I suspected the motherboard, RAM, or video card. But how do I find out what? I checked the BIOS event log... nothing. I tried leaving the second monitor off, but it still crashed. My next guess was perhaps the power supply. When a second monitor the video card should use more electricity, and maybe if it used too much electricity the power supply couldn't keep up. My machine has a 400W power supply which should be more than enough.

Then I remembered my computer has an "automatic voltage regulator," specifically the APC Line-R 600. An automatic voltage regulator is like a surge protector in that it prevents over-voltage, but it also protects the system against brief brown-outs and black-outs. It is not a battery backup unit, but it does some of the same. So I tried replacing this unit with a normal surge protector and wouldn't you know it, the crashes have gone away!

So apparently my computer and two monitors could pull just enough energy from the unit to cause it to crash my system.

Wednesday, June 29, 2011

A complaint about SQL

So I would like to complain about SQL (Structured Query Language) - which is a common way of accessing a database on computers. My complaint stems from efficiency. One thing that has always bugged me is inefficient things, both in computers and in the real-world. I guess it's my fastidious side.

Anyway, you access data in an SQL database via a query string. For example, "select name, phone from Students where major = "business" and enrolled = '1'" The whole idea behind SQL was that non-computer-programmers could look at the code and have some idea about what's going on. But this is a very inefficient way of accessing the data. The data in the database as well as the database engine itself are in binary, and your program is in binary, so why do we have to convert everything into strings to access the data? We should be able to query the data in a binary way and eliminate the conversion.

The best way I can think to demonstrate this is with an example. Suppose I went down to my local restaurant and ordered lunch, but I had to speak to the cashier in Chinese, and the cashier had to speak to me in Chinese. Both of us are native English speakers, and the entire kitchen staff are native English speakers. But we're forced to translate into Chinese for communication. I know, this makes no sense. Well neither does SQL. That's my rant for the day.