Monday, December 29, 2014

JMeter proxy recording

With Apache JMeter, you can setup a proxy HTTP server that you can use to test your website for images that you wish to keep protected with a copyright watermark.  I have been able to use JMeter to test our photography website to ensure clients cannot download their images for free without the image including a watermark.  I want to ensure all images downloaded contain a watermark that cannot be easily removed with picture editing software in order to protect our business.  I have found that other photography websites use different methods for adding a watermark to the image which can be by-passed with a proxy server.  By using JMeter, I was able to download their high resolution images without the watermark since the image did not contain the watermark itself but was merely added as an overlay via a third party software.

To setup the proxy server for testing, first you need to download JMeter.  I have been using JMeter 2.9 for my testing since that is what I'm familiar with and the settings that I describe in this blog are for that version.  Later version of JMeter have changed the way that the server is configured so I've just stayed with the version that I know works for me.

Next, run the jmeter.bat file and configure the proxy server and configure the Test Plan.
  1. Add a Thread Group to the Test Plan.  Right click on Test Plan, select Add, Threads (Users), Thread Group
  2. Add an HTTP Request Defaults configuration element to the Thread Group.  Right click on the Thread Group, select Add, Config Element, HTTP Request Defaults.
  3. Add a Recording Controller element to the Thread Group.  Right click on the Thread Group and select Add, Logic Controller, Recording Controller.
Now, we need to configure the Workbench to record the traffic through a proxy.
  1. Add an HTTP Proxy Server element to the Workbench.  Right click on Workbench and select Non-Test Elements, HTTP Proxy Server.
  2. You can exclude files from downloading by adding URL Patters to the URL Patterns to Exclude list.  In my case, I typically exclude html, js, png, gif, bmp, swf, and css files since I'm using JMeter to test for jpg downloads only.  Each pattern to exclude should start with ".*\." and then include the file type to ignore.  So, to exclude html files, the pattern would be ".*\.html" which will match every character in the URL up to the last slash and then all characters after the slash up to html.
  3. To save the proxy responses to files, add a "Save Responses to a file" proxy element.  Right click on HTTP Proxy Server and select Add, Listener, Save Responses to a file.
  4. I like to configure the Save Responses to a file element by adding a Filename prefix to save all the files to a separate folder.  For this, just configure the Filename prefix item to include a folder name with a slash followed by a prefix for each file downloaded.  For example, "downloaded/file_" would save all files to the "downloaded" folder and each downloaded file would begin with "file_" as the file name.  I believe the key is just to include the slash character ('/') to define a folder structure.
  5. Alternative to saving the responses, you can view the responses in a tree.  Right click on HTTP Proxy Server and select Add, Listener, View Results Tree.
Next, you'll have to configure your browser to connect with the proxy server.  I find it easier to use and configure Firefox for this.  In the Firefox settings, modify the Connection Settings and select the Manual proxy configuration item.  Configure the HTTP Proxy item as localhost and the Port as 8080 (unless you changed the proxy server default port configuration in JMeter).  Ensure the "Use this proxy server for all protocols" option is checked and select the OK button.  In JMeter, start the proxy server by selecting the Start button on the HTTP Proxy Server workbench element.  This will allow Firefox to connect to the internet through the JMeter proxy and every HTTP request will go through the test server.

Finally, just enter in the web address that you wish to test for file downloads and all non-excluded results will be stored in the configured directory for downloading.  Find the image files in the download directory and open them up to see if your chosen watermarking third party library protects the image from client downloads.  If the watermark does not appear on the image, your clients may be able to download their images without having to buy your product.

Friday, December 19, 2014

Nikon 14-24mm vs Nikon 16-35mm decision

On recent photography projects, my wife and I have found that we need a lens with a wider angle of view.  So, naturally, I began researching to determine the lens that we should buy for our needs.  I had no idea it would be so hard to decide.  I found out that there are two excellent lenses from Nikon for an FX camera.  One is the highly praised Nikon AF-S Zoom Nikkor 14-24mm f/2.8G ED AF Lens and the other is the also highly praised (but not as much) Nikon AF-S Nikkor 16-35mm f/4G ED VR Wide Angle Zoom Lens.  As it turns out, both of these lenses have excellent user reviews.

For the Nikon 14-24mm, this lens is considered the king of ultra wide angle zoom lenses by many and its image quality is unmatched.  There are some that say the 16-35mm does surpass the image quality while others say it doesn't so it is very hard for me to determine which lens has the better image quality without testing both.  But, I'm unwilling to spend the money to rent both lenses for our purposes and thus I've cornered myself into making a decision based on user reviews and specifications.

Each lens has its pros and cons.  The 14-24mm is heavier and has a large bulbous front that can catch unwanted lens flares very easily.  Due to the large front glass, it can't take standard Nikon filters and it requires the user to be careful not to scratch it since it does protrude from the casing a bit.  Also, it doesn't have the VR (Vibration-Reduction) technology which means it most likely would need to be used with a tripod.  We could do this for our real estate or landscape photography but I just don't see us carrying our tripod around for our other business.  However, it does include a larger aperture at f/2.8 over the 16-35mm minimum of f/4.  From what I've read, the distortion of the 14-24mm is minimal.

The 16-35mm is a more portable lens and is lighter than the 14-24mm.  I've read that the lens is made with more plastic and some users feel that this takes away from the build quality.  The widest aperture is f/4 which should be fine for most of our uses but could become a limitation with indoor real estate photography.  However, the lens can take standard Nikon filters which means we could use a circular polarizing filter to take landscape pictures to produce that blue sky we desire in our shots.  At 16mm, it does produce lots of distortion even though users say that this can be easily corrected in Photoshop.  One user review I read indicates that it is not the best lens at the 35mm end of the zoom range either and that there are better options available at 35mm.  From the reviews I've read, 16-35mm seems to be strong in the 20-28mm range.  This lens also includes the VR technology so we should be able to take photographs without carrying the tripod to our sessions.

If I had my desires, I would be able to buy a lens that includes the strengths of both of these lens but there isn't another option that I'm aware of for wide angle zooms.  We could look into wide angle prime lenses but all of the Nikon branded wide angle prime lenses are about the same cost as these highly praised zoom lenses so it doesn't make sense to me to purchase a prime lens in this range.

Each day I look at this I go back and forth on which one is the winner for our needs.  I even went as far as ordering the 14-24mm and then cancelling the order about 4 hours later.  I'm really drawn to the 14-24mm but it does seem like it wouldn't be as versatile as we need it to be.  I have found that the 14-24mm even has an unofficial term used on the internet in user reviews as the "best lens I never use."  That certainly doesn't bode well for it to be the best choice for our needs.  I liked what one user said about discussing these lenses is really like splitting hairs and they both can produce excellent images.

So, as I've struggled with this decision, it feels like I need to "settle" for the 16-35mm since it better meets our photography needs but I really hate that I have the feeling that I'm settling for a lens in this price range.  Even so, I'm sure the 16-35mm will be very useful for our photography needs.

Thanksgiving by dad

Mashed potatoes, green beans, whole cranberry sauce, sweet potato pie, whipped cream, and BGE smoked turkey. Everything except the dinner rolls were homemade (even the whipped cream). I feel like the easiest part was the turkey. Delicious!