Gary Davis' Blog

DotNET/PayPal Development and other Techie Stuff
posts - 26, comments - 7, trackbacks - 0

Wednesday, July 29, 2009

How I fixed my slow Gigabit network performance

My connection used to be fast when I first installed my TRENDnet TEW 672GR Wireless “N” Gigabit router. I have three computers that are connected using a wired GB connection. Things just seemed real slow when sending or receiving large files between the home server and my (or my wife’s) PC. For example, shutting down MS Money writes a backup to the server and this took several minutes. Copying a gigabyte .avi movie file would take a long time and copying a DVD would take hours.

So I needed some metrics to get a baseline. I decided on Jperf (tutorial) which is a graphical front-end to Iperf. With this tool, you run the client at one computer and the server on the other. The program easily connects between them and sends messages back and forth for several seconds and displays a graph of the performance.

imageThe graph shown on the left is the performance I was seeing which was about 376KB/sec.

Another tool I used to get some more data is WireShark. This is a complex tool to capture low-level packet data on the network. I viewed some tutorials on YouTube and captured a few seconds worth of data (that’s actually a lot of capture). It did confirm that gigabit throughput was happening by looking at the time between frames, but there were areas of re-transmissions due to failed acknowledgements, collisions or something. It takes a lot more networking experience to analyze these captures than I have or want to learn at this point.

So the first thing I tried was to replace the cat5 homemade cables with cat6 manufactured cables from Monoprice, a great place to get cheap inexpensive cables. This did not improve things at all.

image

I next tried a 7.25 GB DVD transfer and it would have completed in about 4 hours if I let it finish (see screen shot on right). The transfer rate is 556 KB/sec, a bit faster than the above graph. It also shows the network utilization at a fraction of a percent. The little graph at the bottom is a nice little utility called DUMeter, nice to keep at the bottom of your desktop.

My next test was to connect my PC and the Server with a 25’ cat6 cable port to port, bypassing the router altogether. This requires a crossover connection so the cable wire pairs are correctly flipped (normally done when connecting via a hub, router or switch. There’s no DHCP to assign IPs when connected this way so I had to assign static IPs to each site (192.168.1.1 and .2).

The throughput jumped to what it should be when using Jperf. Now, instead of 4 hours, the file transfer would take about 7 minutes.

image

The transfer rate is about 23MB/sec and net utilization is 25%. That’s about 50 times faster.

So with the TRENDnet in the middle, the transfer is slow and without it, the transfer is fast. That tells me the router is the problem and that something is seriously wrong with the Gigabit part of it (the wireless part is fine).

I looked at the TRENDnet router configuration settings but there are very few related to the wired LAN and nothing performance-related. Most settings are for wireless. I checked the TRENDnet knowledgebase and forums and found nothing obvious. I started a trouble-ticket with TRENDnet and sent them a screen capture of the performance issue.

I continued thinking about the difference between the two tests and decided to try removing all the attached cables from the router to make sure none of theimage other devices was causing the problem. There are four ports on the router: 1) Server, 2) my PC, 3) wife’s PC and 4) connection to a 8-port cheapie switch (Zonet). Disconnecting one at a time quickly showed that the Zonet switch was the culprit. With it out of the mix, I had the fast network with the TRENDnet. Even if no connections were in any of the Zonet ports (the Tivos, etc.), it caused the slowness. So I told TRENDnet support that they could close the ticket, it was not their device’s fault.

This is the final Jperf graph for the fast network at 36372KB/sec. If the above graph was included in this graph, it would just be a straight line at hugging the bottom around 0.

Update: I tried a different switch (a TRENDnet 10/100 Wireless 4-port router, actually) and it had the same effect as the Zonet switch so the problem is not fixed as I thought. I will get a new Gigabit switch which should work, else I am back to blaming the TRENDnet Gig router.

posted @ Wednesday, July 29, 2009 10:21 PM | Feedback (0) |

Monday, March 30, 2009

How I became an advocate for Pancreatic Cancer funding

My younger brother, Dr. Ron Davis, was diagnosed with Pancreatic Cancer last February and passed away nine months later. Ron was diagnosed while president of the AMA. Ron was a preventative health specialist and worked for years for the Center for Disease Control's Office on Smoking and Health under Dr. Everett Koop and later, for the Ford Health System in Detroit.

Today, I am in Washington D.C., preparing with my wife Deborah, to participate in the third annual PanCan Advocacy Day (tomorrow). Our "team" will meet the Florida senators (Mel Martinez and Bill Nelson) as well as our congressional representative Ron Klein. In addition, we will meet with a few other reps and for those we don't have scheduled meetings, we will drop off a packet of information about this disease.

There are two things we are asking of these elected officials:

  • To co-sponsor the Pancreatic Cancer Research and Education Act, and
  • To double the budget for the NCI over the next five years ($6B for FY10)

Here are a few facts about Pancreatic Cancer

  • It's the fourth leading cause of cancer-related death
  • There are currently no early-detection tools (usually, by the time you find out you have it, it's at stage 4)
  • 75% of Americans diagnosed with Pancreatic Cancer die within the first year.

For more information, you can see my Team Ron page and also the PanCan site and Advocacy Day pages.

 

 

posted @ Monday, March 30, 2009 5:53 PM | Feedback (0) |

Wednesday, November 26, 2008

How I Fixed the Windows Sidebar Netflix Gadget

The Netflix Now Showing gadget for the Windows Vista Sidebar is a useful little thing to display the DVDs you currently have checked out as well as a few of the upcoming DVDs you are to receive from the top of your Netflix queue.

Sometimes, when my Windows Vista 64 Ultimate starts up and I log on, an error message pops up three times indicating Line 91: Error: 'xmlathome' is undefined:

NetflixGadgetError

A search of Google showed several people had this error (which was an annoyance but did not prevent the gadget from working). I went to the author's site but there was no mention of the gadget there.

So, I decided to click Yes to debug using Visual Studio. The line in error was highlighted:

     var athomestate = xmlathome.readyState;

The debugger showed that xmlathome was truly undefined (null) so the attempt to reference readyState caused the error.

Looking at the code showed that a race condition existed where the CheckState function could be called before the xmlathome variable was initialized. The fix is to make sure the variable is initialized before the function could ever be called. The line to initialize the xmlathome variable just needs to be moved up in the code a few lines (from line 77 to line 71 as shown):

NetflixGadgetFix

The file that needs to be fixed is netflix.js in this folder (copy/paste this into Windows Explorer):

     %UserProfile%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\Netflix[1].gadget\

posted @ Wednesday, November 26, 2008 10:56 AM | Feedback (0) |

Monday, September 01, 2008

Bad Home Inspections

Rotted garage door trimCheck out this blog article about a home purchase in the West Palm Beach area which could have been avoided if the home inspection was done professionally.

The blog article may be read at Bad Home Inspections.

The inspection was done July 1 2008, by Feldman Building Inspections Inc., located in Delray Beach, FL. If you think you can rely on an inspection to tell you everything about the property you’re about to purchase you are very much mistaken.

posted @ Monday, September 01, 2008 6:17 PM | Feedback (0) |

Friday, August 29, 2008

How to create dynamic Encrypted Website Payments (EWP) PayPal buttons

If you want to sell something on your website, perhaps something like a personalized kid's storybook, you can add a PayPal buy-button that will send the user to PayPal to make a payment to your PayPal account. You will get an email and then you can create and send the book to the buyer.

The Html code that makes up the button (created manually or from the PayPal button factory) contains things like your PayPal account email, the item description and price and perhaps a few other parameters. However, someone knowledgeable could view the source of your page or save the Html from the browser, change the price and then click the modified button and you will receive the order with a lower payment. Maybe you will notice it but if you get lots of orders for various items, it may go unnoticed until after you send the book.

The solution is to use PayPal's Encrypted Website Payments (EWP) buttons. This can be done by the button factory and you can set a flag in the profile to only allow encrypted buttons to be used on your site. People will no longer be able to modify your buttons in any way. All the parameters that make up the button are encrypted into one string of characters and that string is sent as a single parameter to PayPal when the button is clicked. When created by the factory, PayPal knows how to decrypt what it encrypted in the first place.

However, what if you want to dynamically generate your buy-buttons in your code? You can create the parameters as you need on the fly and use them unencrypted but if you want to encrypt them, you can't use the factory. For example, the personalized book's item description could be "Billy Jones and the Magic Pancake" which will display when the buyer enters PayPal to pay. Dynamic buttons are also useful when you have a database with lots of items. Once you create the set of parameters for the button, you can then run the string through an encryption routine and use the encrypted string in your buy button. The PayPal site explains how to do this (link).

There are several steps to do this as discussed in the link above:

  1. Obtain a private key and public certificate - You use your private key to decrypt something encrypted by your public cert. Public certs are used for encryption and authentication.

  2. Upload your public cert to PayPal - You then give away your public certificate to anyone that needs to authenticate that you are you or encrypt data to send to you. In this case, you upload your public cert to PayPal. Actually, PayPal does not need to send you anything encrypted so they mainly need your public cert for authentication. There are other non-PayPal uses of this private key/public cert pair like encrypted email but I will discuss that in a future posting.

  3. Downloading PayPal's public cert - PayPal has two certs, one for the live PayPal site and one for the PayPal sandbox (or beta sandbox). You use PayPal's cert to encrypt the buy-button parameters. PayPal provides links for you do download their certs. Certs are created with an expiration date. In PayPal's case, their certs will expire in 2035.

  4. Set your PayPal profile to only allow encrypted buttons.

For testing purposes, I have created a simple tool to do steps 1 and 3. This will allow you to create your private key, public cert and have both PayPal public certs and provide them to you in a zip file. Once you have your development working, you can then go through the steps to recreate your key and cert and re-upload to PayPal but you will have to install OpenSSL on your PC. This way you know you are the only one that has your private key. Using the private key from my tool in production will certainly work but it did originate from my computer.

Form to request cert

Click the Buy Now and after some seconds, if you selected the Free cert, a link will display to download the zip file and if you selected a longer expiration date, you will first pay through PayPal and then return to click the zip download. This is the file:

The image shows the two PayPal public certs, the Pkcs12.p12 file, your private key (keep this secure) and your public cert (to give away). The Readme.txt file has some hints and information on the OpenSSL commands used to create these files. The p12 file is used by your code that generates your encrypted buttons. This file also should be kept secure since it contains both your private key and public cert.

The tool to create your private key and public cert is at http://www.webguild.com/PayPal.aspx (click the Certs and Keys tab). This page actually uses a PayPal buy button that uses a dynamic EWP button if you select the non-free option. The item name and price is encrypted and you will notice the personalized item name when you arrive on the PayPal site.

 

posted @ Friday, August 29, 2008 11:53 AM | Feedback (1) |

Wednesday, August 13, 2008

How I solved a Windows Update failure

I installed Windows XP SP2 on a Virtual PC drive and ran Windows Update. It wanted to immediately update to SP3 but the update failed so I downloaded SP3 and installed it manually.

Then Windows Update wanted to do 18 more updates but they also failed. The error was:

Problem: A problem on your computer is preventing updates from being downloaded or installed

There was no error code number. I ran across a posting with a solution. I copied these statements into the clipboard and then pasted them into a command prompt window. A bunch of "Succeeded" popups displayed and I OK'd them. I retried the Windows Updated and now it worked.

regsvr32 wuapi.dll
regsvr32 wuaueng1.dll
regsvr32 wuaueng.dll
regsvr32 wucltui.dll
regsvr32 wups2.dll
regsvr32 wups.dll
regsvr32 wuweb.dll

Other things to check if this does not work is the Windows Service ("Services" in Administrative Tools) named Automatic Updates. Make sure its Status is started and its Starup Type is automatic.

Another thing that has been known to cause problems is the IE security settings. Go to IE's Internet Options->Security tab and click the Trusted Sites icon and Sites button. Uncheck  Required server checkbox and add these sites, one at a time:

http://*.microsoft.com
https://*.microsoft.com
http://*.windowsupdate.com

 

posted @ Wednesday, August 13, 2008 4:39 PM | Feedback (0) |

Wednesday, May 21, 2008

How I Solved Comcast's Block of my SMTP (Email) Port 25

I received an email from Comcast telling me that they are blocking my outgoing email:

Dear Comcast Customer:

ACTION REQUIRED: Comcast has determined that your computer(s) have been used to send unsolicited email ("spam"), which is generally an indicator of a virus. For your own protection and that of other Comcast customers, we have taken steps to prevent further transmission of spam from your computer(s).

Comcast did provide information on configuring my email client to get it to work. It's not too difficult if you are simply sending email, however my setup is not normal. The fix is basically to modify the client to send outgoing email using port 587 instead of the standard SMTP port 25. Also, the port must be configured with authentication (my Comcast ID and password).

For my situation, I run a home server to handle incoming and outgoing email so for me the fix for outgoing email is not to my client which talks to my email server (on port 25), but to fix the email server to send out using port 587 authenticated.

That was the easy part. However, my wife said she had not received any email for the last several days. I poked around and found out that incoming port 25 was also being blocked. I was not able to connect to my home server's port 25 from an external site (telnet debsrealty.com 25). My wife has her own business domain for which email was directly sent to the home server (http://www.debsrealty.com). This blockage did not affect my email to webguild.com since the mail collects on that hosted site and my home email server periodically picks up the mail via POP3.

The solution is to use a different port than 25. However, there are several steps to get this to work.

  1. My (dynamic) DNS name server is handled by sitelutions.com (free). They have a solution to redirect SMTP to a different port but costs $29/yr. I found a free redirection from a different company (www.rollernet.us). So the first step is to have Sitelutions redirect debsrealty.com email to mail.rollernet.us and mail2.rollernet.us with two "MX" records. 

  2. Rollernet.us has this SMTP redirection free for a small amount of email (or $40 for a larger amount). It will also do filtering so I set up to only redirect deborah@debsrealty.com email to debsrealty on port 2525. If you receive more email than the free account allows, combine step 1 and 2 and just go with the Sitelutions $29/yr solution or check with your own nameserver company.

  3. The 3rd step is to modify my router to accept incoming requests on port 2525 instead of 25. Also, the router configuration will route the requests to my home server on port 25 so I did not have to change the email server to listen on port 2525. I used www.grc.com to verify port 25 was indeed blocked and 2525 was now open.

After this was all done, email started coming in for deborah@debsrealty.com. Messages sent over the last few days often are retried by the various email transports and were received. It's certainly possible that some were lost.

The rollernet site keeps a log of email transactions that is useful in verifying functionality.

posted @ Wednesday, May 21, 2008 7:16 PM | Feedback (1) |

Saturday, May 10, 2008

How I fixed my son's new laptop 160GB drive

My son bought a new 160GB SATA drive for his Dell laptop to replace the original 40GB drive. I used a USB adapter to connect the drive to the laptop and used Acronis V11 Home to clone the Dell drive to the new drive.

After it completed the clone, I pulled out the old and installed the new and powered up. The drive started the boot and the Windows XP screen displayed and I thought we were home free! However, it blue-screened shortly after the Windows screen displayed.

I booted to the setup bios and it showed the new drive as 40GB, same as the old. Every tool I tried showed 40GB instead of 160GB and I have a lot of them. Reformatting, zeroing, etc would not bring the drive back to its original state.

After some hours of searching, I finally found a thread which led to the solution. The tool is called HDAT2. The problem seems to be the combination of the Dell laptop (with MediaDirect which uses a Host Protected Area (HPA) of the disk) and Acronis which had apparently problems with this HPA configuration corrupting the drive.

I burned the HDAT2 ISO to a bootable CD and booted it up to a laptop with the new drive connected via the USB adapter. HDAT2 did see the USB drive when the USB ASPI driver was selected during bootup but the option I was looking for (Set Max (HPA)) was not on the main menu like it was for the internal drive. So, I pulled out the old and popped in the new (again) and booted up the HDAT2 CD and this time the Set Max (HPA) menu item displayed for the drive.

I selected this option and it immediatly showed the discrepancy and had the Max Address field already populated with the correct value so all I had to do was type S to Save and that fixed the problem. The new drive now reported its correct size.

I will not use Acronis with this Dell for a disk clone. BTW, Acronis had worked fine for my old Dell when I upgraded its drive.

Note that the thread referenced above discussed a Seagate drive that had issues and a special procedure for dealing with 28 vs 48 bit LBA. My son's drive is a Western Digital and did not have those problems. A simple press of the S key was all that was needed in my case.

 

 

posted @ Saturday, May 10, 2008 8:46 PM | Feedback (0) |

Monday, January 07, 2008

How I Became a PayPal Certified Developer

A few months ago, I attended a PayPal Developers Days conference in Miami. The seminar covered the various ways to integrate PayPal Pro into your web site to accept payments. The options included using Express Checkout which lets the user log on and choose a billing and shipping address and a method of payment; Direct Pay which allows a web site to accept credit cards cleared by PayPal without the customer having to have a PayPal account and Standard Checkout which redirects the customer to PayPal's site to log on and complete the payment. PayPal sends an IPN (Instant Payment Notification) message to a web service-like page on your site so you know you can proceed to fulfil the order.

I have been doing PayPal development for a long time so the test given at the seminar was trivial - a few hours of refresher using the supplied study guide were sufficient to quickly complete (and pass) the exam. Eventually, I got listed on the PayPal Directory.

I also got a nice PayPal shirt:)

posted @ Monday, January 07, 2008 5:05 PM | Feedback (0) |

Monday, December 24, 2007

How I got Pinnacle to burn a DVD with audio

Using Pinnacle Studio 11 (actually 11.1.1.5224) to create a DVD and then burn (burn with Pinnacle or Nero), the resulting DVD had no sound. Google search on the problem did not turn up much on this problem that others have had. Some said the latest patch solved the problem but it did not for me.

Pinnacle has a support article on this problem with no good solution. However, one of the posts I read pointed to IFOEdit as a fix. I did have good results with this technique.

First, create the DVD as an image on the hard drive but don't burn it. Edit the IFO file. In the file I created, there were two IFO files: VIDEO_TS.IFO and VTS_01_0.IFO. The one to edit is VTS_01_0.IFO. This only takes a minute.

Get the free current version of IFOEdit . Run it and click the OPEN button on the bottom. Browse to your VTS_01_0.IFO file int he VIDEO_TS folder.

What we want to do is change the audio from Mpeg-1 to Dolby AC-3. Locate the line as shown (Movie attributes for the Mpeg-1 audio). Double click the line to display the edit box and change Coding Mode from Mpeg to Dolby AC-3 and click OK.

The change will not show - it still says Mpeg-1 but click to save it anyhow (replace old version). A box will pop-up asking if you also want to save as a .BUP. Say yes. If you reopen the file in IFOEdit, it will now display the audio as Dolby.

The DVD can now be burned and will play the audio correctly.

 

posted @ Monday, December 24, 2007 2:01 PM | Feedback (0) |

Powered by: