Craig Thrall

Previous | Page 5 of 13 | Next

Resizing Screenshots

March 18, 2010, 3:27 p.m.

I've been working on an application that takes a screenshot from a device and displays it in a Windows Forms application that can be resized. Prior to today, we used a PictureBox that was set to StretchImage (the screenshot is surrounded by a picture of the device). However, new versions of the device return a screenshot that is twice as large. Making the new screenshot small then stretching it resulted in a hard to read display. First off, I changed the code to paint the screenshot in the PictureBox separately, so it wouldn't get painted then stretched. Then, I started looking around at sharpening. I found <a href="http://stackoverflow.com/questions/903632/sharpen-on-a-bitmap-using-c">this really helpful article</a>, but the results weren't really what I was looking for. Then I found another post that pointed me towards settings in the Graphics class that can change the output. I used a simple WinForms app with a couple forms displaying the same bitmap with different Graphics settings to subjectively compare the output. This seems to result in the highest quality for text in a resized screenshot (assume g is an instance of Graphics below): <code> g.SmoothingMode = SmoothingMode.None; g.PixelOffsetMode = PixelOffsetMode.None; g.CompositingQuality = CompositingQuality.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; </code>

IPSEC VPN Client for 64-bit Windows

Feb. 21, 2010, 7:54 p.m.

This is awesome! <a href="http://www.shrew.net/">Here is a VPN client that's compatible with a Cisco VPN server running IPSEC</a> you can download for free that is working for me running 64-bit Windows 7. :) Thank you ShrewSoft!

Running Windows 7 on a Shuttle SN45G

Feb. 20, 2010, 7:48 p.m.

I upgraded my lowly Shuttle SN45G PC to Windows 7. It's running an Athlon XP 2500+ CPU with just over 1G of RAM. Amazingly, so far it works pretty well. The graphics card and network adapter worked out of the box, albeit with no support for Aero acceleration. To install the NVidia nForce 2 audio drivers, read these <a href="http://digg.com/microsoft/How_To_Vista_and_Nforce2_With_Full_Driver_Support">two</a> <a href="http://nf2.stuff.googlepages.com/">pages</a>. To get my old NVidia RIVA TNT2 Model 64 GPU running, I followed the instructions <a href="http://kemovitra.blogspot.com/2009/01/nvidia-riva-tnt2-m64-driver-for-windows.html">on this page</a>. It worked!

DD-WRT Client Bridge

Feb. 15, 2010, 12:46 p.m.

Our Fios internet connection is on the opposite end of the house from my home office. This weekend, I got a wireless bridge running from the Fios connection to the office. This will allow me to use my Cisco desk phone over a VPN connection to work. Here's how I currently have it configured: Verizon Fios wifi router -wired-> Cisco ASA 5505 -wired-> Linksys WRT54GL -wifi-> Linksys WRT54G V.3 Both Linksys routers are running the latest version of <a href="http://www.dd-wrt.com/site/index">DD-WRT</a>. Installing the new firmware went smoothly on both routers. The one catch on the WRT54GL is I didn't let it sit and finish booting, as the wiki instructs. You really have to give it a few minutes. The WRT54GL is configured as an AP, and the WRT54G is set to be in client bridge mode. The ASA is plugged in to one of the switch ports on the WRT54GL. The result is, any devices connected to the WRT54G will be on the subnet hosted by the ASA. The only downside I can find thus far is the DHCP and DNS (for the VPN only?) are not forwarded to clients that are physically connected to the WRT54G. When I configure my desktop to have a static IP that is served by the ASA, I have connectivity. When I try DHCP, I don't get an IP. From what I can find on the net, some people claim it works for them, while there are descriptions of why it doesn't work from others. I'll dig deeper into this at some other time. Since my work laptop connects to the WRT54GL via wifi, DHCP works fine there. And DNS does as well, although I'm assuming the reason I get DNS resolution for hosts on the extranet and not for hosts served by the VPN is my desktop is not on the work domain, and my laptop is. Thanks to the DD-WRT team for producing a very impressive open source product!

Installing GD PHP Extension on a MacBook Pro

Feb. 1, 2010, 9:08 a.m.

I've got XCode installed on my MBP, so you'll need that. Then, follow the instructions <a href="http://www.kenior.ch/macintosh/adding-gd-library-for-mac-os-x-leopard">in this great post</a>. A couple notes: <ul> <li>You'll need to download the Apache PHP mod 44-2 source tarball from the Apple site. This doesn't match the PHP build version number in php_info(), but that's ok.</li> <li>Use the 64-bit instructions. Even though PHP info said I386, when I used the 32-bit instructions GD was enabled when I ran <code>php -i</code> from the command-line but not from php_info() in a browser.</li> <li>Add <code>--disable-dependency-tracking</code> to the configure command line for the JPEG library.</li> </ul>

VMWare ESXi on a Dell Precision T3400

Jan. 5, 2010, 3:41 p.m.

Back up anything you want to save, as these steps will make permanent changes. <ol> <li>Boot, if you see a RAID configuration screen, hit Ctrl-I to enter setup and remove all drives from the RAID array.</li> <li>Reboot, enter BIOS setup and make sure your drive configuration is set to "RAID ATA."</li> <li>While you're in the BIOS setup, enable virtualization in the CPU settings. This will let you create 64-bit virtual guests.</li> <li><a href="http://communities.vmware.com/message/1048915#1048915">Follow these steps to install VMWare ESXi</a></li> </ol>

VMWare Conversion Tips

Jan. 3, 2010, 10:05 a.m.

Here are a couple things I learned about converting VMWare images this weekend. First off, if you get an error that says "failed to obtain lock," go find .lck directories in your image. Rename them or move them out of the folder. Also, if you get an error "failed to open file," make sure the VMWare image is local to the computer where you are running the converter. My source image was on a USB drive. Once I copied it locally, it worked. Part of the problem might be I'm running the conversion tool in a VMWare instance on my MacBook Pro. :) After I removed the .lck directories and copied the image to my VMWare guest on the MacBook, it worked fine. I was able to convert the image and send it over the VPN to my ESXi server.

Copy Protecting Your Software, Part 2

Dec. 31, 2009, 11:14 a.m.

<b>My Requirements</b> I have been working on two types of software products: .NET desktop applications, and Apache/PHP/MySQL web applications. The .NET applications will be node locked using the MAC address of the computer running the software. The web applications will also be node locked using the MAC address. In addition, they will be licensed on a per feature and per connection basis. Activations over the internet are becoming more common, but they have their own issues. For one, many of our customers are going to be in a corporate environment, which typically involves being behind some sort of firewall or HTTP proxy. Microsoft’s Windows activation provides users a way to activate via telephone, but we’d rather not do that. The end result is it will be a requirement that the user be able to download a license key or file, or have it sent via e-mail. Note that I only evaluated these products for .NET and PHP support. As I started looking into this, I found that there are really two categories for copy protection software: simple obfuscators and “kitchen sink” licensing solutions. What’s interesting is the products that provide obfuscation and encryption for interpreted and byte code languages are starting to provide some level of licensing, usually a simple node locked MAC address scheme. Since none of the “kitchen sink” copy protection products do both .NET and PHP (that I could find, anyway), I am leaning towards using two different obfuscators that support node locked licensing. <b>HASP</b> We evaluated HASP, by Aladdin Software (<a href="http://www.aladdin.com">http://www.aladdin.com</a>). HASP provides both code protection/obfuscation and copy protection for native code and .NET (it might support Java as well, but we didn’t evaluate that). HASP will support dongle-based copy protection as well as software-based activation. If you are really paranoid about somebody copying your software, buy HASP and make your users plug a physical device into a USB port. HASP will handle everything for you using the software as a service model. You can either host the HASP activation server at your location, or pay Aladdin a subscription fee for each activation. All this comes at a price. HASP is expensive. It’s a huge product, so installation and configuration are not trivial. And as it doesn’t do PHP obfuscation, it would just be one piece of the copy protection puzzle for us. But if you have a C or .NET app, you should take a look. <b>LM-X License Manager</b> LM-X (<a href="http://www.x-formation.com">http://www.x-formation.com</a>) seems to be a lighter version of HASP. No dongle support, but they do provide a SaaS model for license activations. Like HASP, you need to run SQL Server to store all your customer and license information. HASP seemed more polished but is more expensive than LM-X. LM-X does have an interesting feature: the ability to create reseller objects and have products under the reseller with different pricing. I didn’t look for this feature in the other products, so I’m not sure if it’s there. <b>SolidPHP</b> SolidPHP (<a href="http://solidphp.com">http://solidphp.com</a>) looks very promising. It handles everything you need to sell your PHP application over the web, from payment processing to customer and license management. There’s even a free version. However, I could never get it to work for me. The SolidPHP guys were helpful, even though I was just using the free version, but there is very little documentation and for some reason the license files I got from the SolidPHP web site never worked with the IonCube obfuscator they are using. I made sure to try it on my XP desktop, just to make sure it’s not some issue with Windows 7 and 64-bit. I’ll be trying the latest version when it comes out, but after the initial experience I am a little wary.

CD-ROM Stuck Busy on OS X?

Dec. 31, 2009, midnight

VMWare Fusion provides transparent access to most host devices in Windows. One downside is if you have a VM instance running and you put a CD-ROM/DVD in the drive, VMWare will lock it and you won't be able to do anything until you shutdown that VM instance (or perhaps eject the disc in Windows).

Copy Protecting Your Software, Part 1

Dec. 30, 2009, 8 p.m.

<b>Introduction</b> So you’ve written the next great killer app. It’s going to be huge. <a href="http://ifartmobile.com">iFart</a> huge. But this is a .NET desktop client or PHP server product. You don’t have the advantage of a locked platform like the iPhone. You need to implement your own copy protection. This is written with the assumption that any copy protection can be cracked eventually. Hackers have been cracked the copy protection for computer games for years. You can’t prevent your software from being copied if somebody really, really wants to. However, for our purposes, it’s probably much less likely for a cracker to spend large amounts of time trying to crack a niche business application. <b>Copy Protection != Licensing</b> Licensing is defining how you want to license your software. Copy protection is implementing controls or DRM to enforce that license. Sometimes you purchase a license for a program. Sometimes you purchase a license for a feature of a program. I’m not sure how many versions of Windows 7 there are, but when you purchase a license for Windows 7 Starter, you’re not going to be able to run Windows 7 Ultimate until you give Microsoft some more money. When you purchase a license for a desktop application, you’re usually purchasing a license to use all the features of that application. If the vendor wants to license desktop apps on a per feature basis, or have some other way to up sell the customer, they will usually provide different versions of the application and charge accordingly. Server applications sometimes license on a per connection or even per CPU basis. You have a license for n number of database connections, and if you go over that, any more connections to the database will be refused. <b>Copy Protection Mechanisms</b> Floating licenses are a pool of licenses that live on a license server somewhere. When a new instance of a program is started, it talks to the license server and tries to allocate a license from the pool. If all the licenses are taken, you’ll have to wait. The advantage is the licenses are not locked to a particular computer, as they are with node locked licensing. Node locked licenses are usually locked to the MAC address of the network adapter where the software is being run. When the software is installed, you either send the MAC address and get a license key in return, or the software itself sends the MAC address to a server over the internet, which responds with a license key. <b>Obfuscation</b> Nowadays, much of the software out being sold is at a higher level than native code. PHP code is text. You can open it in Notepad and mess with it. .NET executables are byte code. You can download .NET Reflector and disassemble it. If you integrate or write your own copy protection in one of these interpreted languages, it will be trivial for somebody to circumvent your protection mechanism. Obfuscators encrypt your source code or byte code in a way that prevents attackers from looking at it. Like anything else, it can probably be cracked if somebody really wants to, but it will prevent the majority of people from trying. Newer obfuscation products are implementing copy protection. We’ll read more about this later.