Bits from Bill

Technology thoughts leaking from the brain of "Bill Pytlovany"

Monday, September 28, 2009

Free #1 Tweak to Improve Windows Performance

Every year billions of dollars are spent by folks just trying to improve the performance of their computers. Over the last couple years there’s been a big market for “Registry Cleaners” even though there has been little evidence having a “tidy”, smaller registry makes any difference. Truth is, a few simple, free tweaks can be done which can drastically improve the speed of their computers.

Providing support for my WinPatrol program I run into a wide range of symptoms reported by our users. Some problems don’t always make sense yet a surprising number are resolved by just cleaning up the Windows Temporary Internet Folder. I haven’t read much from Microsoft about cluttered Temp Folders but my years of experience tell me if this file gets too large all kind of seemingly unrated problems can result. You might be saying “I don’t use Internet Explorer so why do I care about it’s Temp Internet Folder” option. Trust me, if you’re using Windows XP, Vista or even Windows 7, you care.

The original purpose of the Temp Internet Folder was to save time accessing web pages by storing images and other objects that don’t change on your system. Just like the HOSTs file this was a good idea when we were all on slow dial-up connections but today many dial-up connections are fast enough these features are no longer relevant. Anecdotal evidence shows the Temp Internet Folder is used for more than just browsing the Internet.

Go ahead and open Internet Explorer if it’s not already open. Click on the “Tools” menu and select “Internet Options”. Don’t worry about clicking on the Delete button on the first screen. Nothing will be deleted until the 2nd screen. Note: This is how it looks using Internet Explorer 8 which provides more options on which items you’ll want to remove.

cleaup7a cleanup7b
Click on the Settings button and you can tell Windows how much space to allocate for Temporary files. I recommend selecting the lowest amount recommended.
cleanup7c

If you’re looking for even more performance there are some standard changes you can make that all the experts agree on.
Adding memory will always be a big improvement. It may not be free but memory prices are pretty low these days. If you’re getting a new computer and need to choose between a faster processor and more memory, go for the more memory.

The other tweak where you can’t go wrong is by cleaning up the list of programs which are loaded at startup. I’m obviously biased but you can accomplish this by downloading WinPatrol for free. If you’re not sure a program can be removed, upgrade to WinPatrol PLUS.

As I said earlier and have written before some folks will recommend a Registry Cleaner. I’m not a big fan and worry because I think there is always a small risk of removing something that may really be important.

The other tweak which many recommend is to defrag your hard drive. Some experts swear this should be part of your regular system maintenance but I’m not a big fan. It’s a personal thing and may be due to problems I’ve experienced following a disk defrag.

I will stand by my recommendation to clean up your Temporary Internet Folder and welcome comments from others who have had positive or negative results. Check it out and let me know what you think.

Labels: , , ,

Share on Facebook


Friday, September 25, 2009

SQLite C Code to Read Cookies

While most of the technology leaking from my brain is for a wide audience, today’s post is very technical in nature. I expected the information below to be available online but since it wasn’t I felt obligated to share my discovery with others.

One of the features of my WinPatrol program is to help manage and remove unwanted internet cookies. Starting with Firefox3 I wasn’t able to read cookies because of the change from a cookies.txt to a SQLite database format.  Luckily, the code to access to access SQLite files is public domain and freely accessible. I was hesitant to include the code to access SQLite files fearing it would increase the small size of WinPatrol.exe.  Since SQLite is completely public domain I was able to strip it down to include only those functions I needed.

The next step was figure out the format used by Firefox and find some sample code for accessing SQLite in C/C++. This wasn’t as easy as I had expected but by piecing together little bits of knowledge here and there I was eventually successful. Apparently, not many programmers are still using C/C++ but if you do here’s an example of how to read cookie information stored locally by both Firefox 3.x and Google’s Chrome browsers.

The following is pretty much the identical code used by the soon to be released, WinPatrol 17 to read cookie data used by Firefox3 and Chrome. My actual code includes a little more error checking and validation. If you’re using a different programming language you’ll still want to note the column or field names used in the SQLite table.

There are two based functions that you’ll need.

//  Firefox3 uses the table name of "moz_cookies"
//  Chrome uses table name of just "cookies"
//  This routine opens up the cookies table and passes a callback routine
//  send requested cookies, one row at a time.
// IN: the fullpath to the cookie file name
// IN: the defined type of if it’s a Chrome or Firefox3 type
int    GetSQLiteCookies( LPSTR szCookieFile, int iType )
{
    char       *zErrMsg = 0;
    int         rc;
    sqlite3    *dbCookie;   // defined in sqlite.h
    TCHAR      szSQLiteExec[MAX_SQLITEEXE]; 

    rc = sqlite3_open(szCookieFile, &dbCookie);
    if( rc )
    {
        sqlite3_close(dbCookie);
        return 0;
    }

    // Create SQL statement depending on the browser 
    if(iType == COOKIE_FIREFOX)
          StringCbCopy(szSQLite ,MAX_SQLEXEC, TEXT( "SELECT * FROM moz_cookies") );
    else    // then it much be Chrome
          StringCbCopy(szSQLite ,MAX_SQLEXEC, TEXT( "SELECT * FROM cookies") );

    rc = sqlite3_exec(dbCookie, szSqLiteExec, CookieCallback, 0, &zErrMsg); 
    if( rc!=SQLITE_OK ) 
    {
        sqlite3_free(zErrMsg); 
    }
    sqlite3_close(dbCookie);

    return 1;
}

The next routine is a “Callback” routine.  The result of calling the sqlite3_exe is above is that SQLite will call our Callback routine for every cookie or “row” in the database.  Each call will contain information about each cookie in a array.

// IN iCount = number of columns in this row
// IN szColValue = The data in the column
// IN szColName = Name of column
static int CookieCallback(void *NotUsed, int iCount, char **szColValue, char **szColName)
{
    int    i;
    char    *zErrMsg = 0; 
    COOKIEINFO   ciCookie;  // WinPatrol specific cookie structure
    SYSTEMTIME        myTime;
    memset(&ciCookie, 0, sizeof(COOKIEINFO));

// I’m going to go through each column and check to see
// see if the name matches one of the cookie fields and if
// it matches we grab the value and store it in our cookie
// structure. The actual code is a little more optimize but I’ve broken
// out each test to make it a little clearer.
// Some column names are different firefox vs chrome

  for(i=0; i<iCount; i++)
  {
      if(!lstrcmpi(TEXT("name"), szColName[i] ))
          StringCbCopy(ciCookie.szName,MAX_COOKIE_NAME, szColValue[i] );

      if(!lstrcmpi(TEXT("value"), szColName[i] ))
          StringCbCopy(ciCookie.szValue,MAX_COOKIE_VALUE, szColValue[i] );

      if(!lstrcmpi(TEXT("path"), szColName[i] ))
          StringCbCopy(ciCookie.szPath,MAX_PATH, szColValue[i] );

      if(!lstrcmpi(TEXT("host"), szColName[i] ))  // firefox3
          StringCbCopy(ciCookie.szDomain, MAX_COOKIE_NAME, szColValue[i] );
      if(!lstrcmpi(TEXT("host_key"), szColName[i] ))   // chrome
          StringCbCopy(ciCookie.szDomain, MAX_COOKIE_NAME, szColValue[i] );

      // firefox3 uses expiry, chrome uses expires_utc
      if ( (!lstrcmpi(TEXT("expiry"), szColName[i] )) || (!lstrcmpi(TEXT("expires_utc"), szColName[i] )))
      {
            long lUnixTime;
            lUnixTime = atol( szColValue[i] );
            UnixTimeToSystemTime((time_t)lUnixTime, &myTime);
            GetLocalTimeString(&myTime, ciCookie.szDate);
      }

      if(!lstrcmpi(TEXT("isSecure"), szColName[i] ))    //firefox 3 field name.
                ciCookie.bSecure = (BOOL)szColValue[i];
      if(!lstrcmpi(TEXT("secure"), szColName[i] ))        // chrome field name
                ciCookie.bSecure = (BOOL)szColValue[i];

  }

// Here's where I call another routine which adds my cookie structure
// to a list of cookies so I can display them in WinPatrol.
// your method of storing each cookie will vary.

  return 0;
}

 

I’m now a big fan so if you’re interested in using SQLite you can find everything you need to get started at http://www.sqlite.org/. I didn’t have time to get a book but for more C/C++ code I recommend The Definitive Guide to SQLite

Share on Facebook


Thursday, September 10, 2009

Four Secret Reasons Why Win7 is Ten Times Better

It’s no secret that I’ve never been a fan of Windows Vista. I really wanted to love it but even as a designated Microsoft MVP I couldn’t drink the kool-aid(1) nor did I promote Vista to family and friends.

So, what makes Windows 7 so much better that I’ve changed my tune? I’m still happy with Windows XP but I am encouraging folks to invest their money and time to upgrade to Win7. I’ve put together four reasons that may not be secret but you may not hear a lot about due to their technical nature.

MultiCore Processing
When Microsoft designed Vista they saw a future in 64 bit machines. It was a reasonable assumption but they were a little ahead of the times. While x64 CPU’s are gaining in popularity the technology of cheap multiple core processors still dominates the market. MultiCore processors give you the power of multiple CPU’s within a single chip. Windows 7 doubles the number of your CPU’s.

trafficcop

In any modern OS there is a system that schedules which programs or processes run when and at what priority. It’s like a traffic cop inside your computer. Vista was optimized to easily handle 64 bit operations. Its traffic cop was trained to expect a lot of big Cadillac's and SUV’s to be using the data road.

The Windows 7 traffic cop understands that multiple core CPUs are still popular so it’s still ready for the SUV’s but knows in between there will be a lot of Sport cars, Smart Cars and even Motorcycles on the data roads.

If you have a dual-core, quad-core CPU you will be thrilled with the increased performance. Using Hyper Threading technology from Intel, a virtual core is created for each physical core adding yet more multiprocessing computing power.

Solid State Drives
I’ve been preaching the future of Solid State Drives over many years. While the prices may still be out of the reach of many, they’re continuing to come down. SSD’s are so much quicker than traditional drives which have moving parts. They’re also so much more dependable. Windows 7 understands how data is stored on Solid State Drives and is optimized to handle their unique operation.

General Purpose Graphics Processing Unit
You may have noticed over the years the video cards inside your computer have grown in both size and power. As gaming and video popularity has grown computer manufactures have greatly increased graphical power. Modern video cards now have their own processors(GPU’s) and plenty of memory. Windows 7 can now take advantage of some of this processing power when it’s not being used for rendering graphics. If you have a powerful video card from NVidia or AMD(ATI) you’ll most likely benefit from this technical addition in Windows 7.

Network Startup Time
Quick startup may not be a secret but most folks don’t realize that Microsoft has put a priority on WiFi network discovery on startup. At least 2-3 times a week my wife Cindi would ask me if the network was down when she went to read the morning paper online. The problem was, Windows appeared to be all ready for use but it wasn’t. The cursor reverted from an hourglass to the arrow but Windows was still doing many background tasks including trying to find the default network. So while everything appeared to be ready for action, the internet was still a few minutes away from use. In most cases, you’ll notice Windows 7 will have you connected as quickly as you can load your browser.

References:
Engineering Windows 7: Support and Q&A for Solid State Drives

Toms Hardware: Win7 Desktop Graphics Loves Multi-core CPUs

CNet: Intel, Microsoft Highlight Windows 7 Improvements

MVP Global Summit 2009

(1) Note: While I did make reference to the common expression about drinking the kool-aid it really bugs me when I hear this. Most people relate this expression to the Jonestown mass suicide when in fact the followers of Jim Jones drank grape cyanide-laced Flavor-Aid.

Labels: , ,

Share on Facebook


Sunday, September 06, 2009

WinPatrol PLUS “Back to School” Special

Marisa after her first day of school

It’s that time of year again when the kids at heading back to school. Every year it seems like there is something new we need to protect our kids against.  This year it’s the N1H1 virus but many past dangers still exist.

Hopefully, everyone heading back to school will be protected against computer slow downs, malware and potential viruses. Naturally, one of the best recommendations I have is to install our free WinPatrol. For more complete protection I encourage folks to upgrade to WinPatrol PLUS.

I know not everyone has $29.95 to spare especially with the increasing cost of tuition and books. To help out this year, I’m offering a $10 off “studyhard” coupon as a special “Back to School” discount. Students will still receive all the same PLUS benefits, good for multiple computers and all future versions of WinPatrol. This coupon is valid until October 1, 2009

Just click here to order and use the coupon “studyhard”.

studyhard

Click to upgrade to WinPatrol PLUS

Even if you’re not a student this month you can take advantage of this offer. Our PLUS database was created to help anyone learn more about what’s going on inside their computer.

Share on Facebook