Sunday, December 16, 2012

Buyer beware


If you buy HP's G8 servers you must use HP's (expensive) RAM and hard disks. What's the deal with that?

And HP doesn't make it clear that you have to use their components.  HP tech support gave me a part number for a hot-swap disk tray.  When I bought it, it didn't fit!

Wednesday, November 21, 2012

Fun (and Frustration) With Dates in PHP

It is easy to have the wrong type and/or wrong value for dates in PHP.  Dates can be represented/stored different ways or types - strings, numbers and something else called date/time class.  PHP tries to cast dates in the proper type based on the context. It follows that your code can easily get off track and debugging the problem is NOT easy. You don't know if the problem is in an implicit cast somewhere or another issue elsewhere in the code.

  • When and if to use which quote marks is one of the devil in the details. 

PHP Code Snippet:
  $sdate="11/10/2012";
  $strstartdate=$sdate;
  echo "Startdate1 = ", $strstartdate;


Result:
  Startdate1 = 11/10/2012

PHP Code Snippet:
  $sdate="11/10/2012";
  $strstartdate='$sdate';
  echo "Startdate2 = ", $strstartdate;


Result:
  Startdate2 = $sdate

PHP Code Snippet:
  $sdate="11/10/2012";
  $strstartdate="$sdate";
  echo "Startdate3 = ", $strstartdate;


Result:
  Startdate3 = 11/10/2012

  • Explicit date type casting helps avoid implicit casting problems and simplifies debugging.

PHP Code Snippet:
  $sdate="11/10/2012";
  $numstartdate=strtotime("$sdate");
  echo "Numdate1 = ", $numstartdate;

  $strstartdate=date("m/d/Y", $numstartdate);
  echo "Strdate1 = ", $strstartdate; 

Results:
  Numdate1 = 1352523600
  Strdate1 = 11/10/2012



  • Add time (one day) to a given date...  Method 1

PHP Code Snippet:
  $sdate="11/10/2012";
  $numstartdate=strtotime(("+1 day"), strtotime("$sdate")); 
  echo "Numdate2 = ", $numstartdate; 
  $strstartdate=date("m/d/Y", $numstartdate);
  echo "Strdate2 = ", $strstartdate; 

Results:
  Numdate2 = 1352610000
  Strdate2 = 11/11/2012

FYI, the difference between Numdate1 and Numdate2 is 86400, which is the number of seconds in a day.


  • Add time (one day) to a given date...  Method 2

PHP Code Snippet:
  $sdate="11/10/2012";
  $dtstartdate = new DateTime($sdate);
  $dtstartdate->add(new DateInterval('P1D'));
  $strstartdate=$dtstartdate->format('d/m/Y');
  $numstartdate=strtotime("$strstartdate");
  echo "Numdate3 = ", $numstartdate;

  echo "Strdate3 = ", $strstartdate;


Results:
  Numdate3 = 1352610000
  Strdate3 = 11/11/2012

Thursday, June 07, 2012

UPS SNAFU

Or what a long, strange trip it's been (instead of a 1-2 day delivery) ...

Alexandria, VA, United States06/07/20127:17 A.M.Out For Delivery
Richmond, VA, United States06/07/20122:31 A.M.Departure Scan
06/07/201212:59 A.M.Arrival Scan
Roanoke, VA, United States06/06/20129:36 P.M.Departure Scan
06/06/20124:42 P.M.Arrival Scan
Knoxville, TN, United States06/06/201212:03 P.M.Departure Scan
06/06/20129:06 A.M.Arrival Scan
Nashville, TN, United States06/06/20124:00 A.M.Departure Scan
06/06/20123:08 A.M.Arrival Scan
Memphis, TN, United States06/05/201211:08 P.M.Departure Scan
06/05/201210:40 A.M.Arrival Scan
DFW Airport, TX, United States06/05/20121:28 A.M.Departure Scan
Edison, NJ, United States05/30/20124:49 P.M.Origin Scan
United States05/30/201212:05 A.M.Order Processed: Ready for UPS

Monday, June 04, 2012

Swimming the Potomac

I swam across the Potomac River on Saturday, June 2nd.  It was the second Potomac River Sharkfest, run along side the Gov. Harry Nice Bridge.

The water was much clearer and cleaner than I expected.  We had lots of rain Friday night, and the Potomac was silty and brown up river in Georgetown Saturday morning.

The tide was just switching from incoming to outgoing when we started. The tide was not a factor; however the waves were.  Those are white-cap waves in the middle of the river. It was a bit challenging to get tossed around as much we were.


I used a sleeveless wetsuit for the swim.  The water was about 75 degrees, so it wasn't really necessary, but it helped in the waves.  Breathing was difficult with the waves. I was taking in water no matter which side I breathed on. It was better breathing on the lee side, so I'd say I did that mostly. Still, after taking water in on one side, it was necessary to breath immediately on the next side.

Also the waves tossed you around to a degree that was disorienting. Fortunately, the bridge made it easy to stay on course. But when I got on dry land, I staggered to the finish line.

You can see the time as I crossed the finish line in the second photo - 1 hour, 6 minutes for 1.8 miles (3km).  I was second in the 55 - 59 age group.  I'll be 60 next month.  I beat the guy that won the 60 - 64 age group.  (The guy that won the 65 - 70 group was faster than me...).


The event was run by EnviroSports out of California.  I thought it was well run.  I'm looking forward to doing it again.

Friday, May 11, 2012

Acrylic DNS Proxy for Restricting Web Access

From time to time situations arise where a client wants to deploy a PC with very limited internet access.  For example, one of our clients uses a web timesheet application and has a PC on the shop floor that hourly employees use to sign in and out on.  How do you make it so that employees cannot also use that machine to visit other sites, waste time, catch malware, etc?

Acrylic DNS Proxy is a good solution for this situation.  Not only does it do the job, it is free, open source software.  And when I emailed a stupid question to the developer, Massimo Fabiano, he responded within hours with a helpful reply.

To add to the "documentation" available on the web for Acrylic DNS Proxy, here are some things I've learned about it:
  • In the configuration file, if you add just one site to the [WhiteExceptionsSection] you activate the "blacklisting" feature of the software, and all sites are blacklisted except those you add to the [WhiteExceptionsSection].
  • Wildcards are said to be accepted in the software's custom Hosts file, but they do not work in the configuration file.  So to whitelist certain web pages, you have to track down all the secondary host names involved in accessing that web page and add those names in the [WhiteExceptionsSection].
    • For example, it is not enough to whitelist mail.google.com to provide access to Gmail.  At a minimum, you also need to add accounts.google.com.  To get all the button images/text, you also need to add ssl.gstatic.com and clients2.google.com.  So, as you can see, it gets to be a fair amount of work if there are more than a few sites that people need to be able to access.
  • In a peer to peer local-area network with shared folders/drives, without a fully-qualified domain name, host names don't seem to work.  I added a FileServer machine to the Hosts file, and tried to map drives to the FileServer.  Unfortunately, looking at the Acrylic logs, Windows (?) appends a random domain to the host name (e.g. FileServer.router4290.local) and Acrylic blacklists the request.  So I map to the IP of the FileServer instead.  Not a big deal if it has a static IP.
  • When you need to download updates and patches to the PC, or otherwise open the machine up to the Internet for a short period of time, it is a simple matter.  Make a copy of the configuration file.  Delete all the entries in the [WhiteExceptionsSection] of the configuration file. Save the edited configuration file. Restart the Acrylic DNS service.  Now the machine can go anywhere on the Internet.  When you are done, replace the configuration file with the copy you made and restart the Acrylic DNS service.

Thursday, May 10, 2012

SBS 2011 Standard Migration

We recently migrated a client from Microsoft Small Business Server 2003 to Small Business Server 2011 Standard on new hardware.

We performed a migration install on the new server machine. We did the whole migration in the course of one weekend to minimize the chances of a bad outcome - data loss, email loss, business disruption, etc.

Users did not have access to the network while we were doing the migration. Email ports on the firewall were closed as well. If the migration went awry, the plan was to restore the source server from the Friday backup, without losing any mail or data.

It turned out that a "fast" migration has its challenges. Moving mailboxes from the source server to the destination server went very smoothly and fairly quickly. We moved 60 gigs of email without losing a single message in about 4 hours.

Robocopy-ing users' shared folders from the source server to the destination was a different story - copying went very slowly. We needed to copy about 300 gigs of data, but it was quickly apparent that the copying wasn't going to finish before Monday morning. 

Network and cpu utilization on both machines was very low.  We tried running several instances of robocopy to increase the utilization of resources and the speed of the job, but no luck.  In pre-migration testing, we did not see this problem.  Robocopy was reasonably quick in our sandbox environment.

We were in a bad spot.  Going forward with our original migration plan and schedule was no longer an option.  Rolling back to the old server was not going to look good with the client, and if we did so, it was not clear what the additional time and costs would be and who would pay them.

Winging it in the middle of a system implementation is not a best practice.  On the other hand, you cannot anticipate every possible problem.  So, we got a little creative while we still had time before we got to the point of no return for rolling back to the old server.

Here's what we did.  Fortunately it worked.  We stopped the robocopy jobs and "finished" the migration.  We  demoted the source server and removed it from the domain.  With Exchange and Active Directory no longer running on the source server, we restarted the robocopy jobs.  Then it went MUCH quicker.  300 gigs copied in about 6 hours.

Come Monday morning, the new SBS 2011 was live and in charge.

Tuesday, February 07, 2012

Blonde Roast?!

It's "new" at Starbucks. It's coffee. Lighter roast, they say, as if that means something about flavor.  I guess they mean it's not burned in the roaster.  But they don't mean that their other roasts are burned... so, how is "Blonde Roast" better?

Toasting is to bread as roasting is to coffee.  The flavor of toast has mostly to do with the bread (for example, wheat vs. rye), unless you burn it.  Likewise with roast and coffee.

So what do I make of Starbucks' term "Blonde Roast"? It's only marketing. And while Tall, Grande & Venti translate to small, medium & large, "Blonde Roast" translates to confusion.

Friday, February 03, 2012

Mozy Hassles

Based on positive reviews by a number of independent web sites, I recently selected the Mozy Pro online-backup service for a small business client. Getting this set up has been a lot of hassle.  Here's what I mean:
  • Starting at the Mozy website, I was given the choice of Home or Pro. I choose Pro, and then I was given the choice of a Workstation or Server license . Turns out if you want to backup files on mapped network drive, you need the server license for a workstation. But there is no information on the website to guide you to the correct choice. So, I installed the workstation license on a workstation and found that I could not backup files on a mapped drive.
  • Having unwittingly made the wrong choice, I sought technical support. That was an ordeal. For some reason, I had to create a salesforce.com account to get to Mozy live-chat, online tech support. That dumped me to a page that said "there was no such forum."  
    • Now I am getting spammed by salesforce.com.
  • So, I submitted a form to get Mozy "email support" about my issue. A couple of days passed before someone from Mozy phoned me (not exactly email support, but I'm not complaining). The guy was helpful and explained the situation to me and upgraded the license I bought. I then had to uninstall the workstation license and install the server license on the workstation. 
  • But the backup software was still not ready to backup the mapped network drive. Back to tech support. (I found a phone number and called them.) They told me that I had to manually add the mapped drive to the file system tree in the Mozy software.   Really?!
Everything seems to be working now, but getting it set up was way too difficult and time consuming.  For now, those good reviews are definately misleading.

Thursday, January 26, 2012

Windows 8 Preview

Recently played with Windows 8 beta on a desktop PC.  Not impressed.

Window 8 puts a Windows Mobile-like GUI on top of a more familiar Windows 7-like desktop.  Furthermore, when you drill down to changes made to the desktop interface, it is sufficiently different (not better) from Windows 7 to be annoying.

It seems that Windows 8 wants to standardize the user experience across smartphones, tablets and PCs. Can it be all things to all people? Microsoft is not Apple. I am skeptical.

Thursday, January 19, 2012

Administrator Mode on the HP t5335z?

I have a new HP t5335z Thin Client device with the annoying feature out of the box of going into suspend mode (?) after several minutes of inactivity.  Nobody on the HP support forums seems to know how to change that feature, so I thought I'd ask the easier question of how to get into the device as an administrator.  No replies from the HP community to that either, so I had to figure it out myself.  Here's the answer for gaining administrative access.
  • Install the HP ThinClient Smart Client Service on a computer on the same subnet as the thin client. 
    • Before installing, you have to have IIS running on the computer and .NET framework 3.5. See this link to get your server machine configured properly.
    • Download the software from here.  A default installation is fine. 
I installed the Smart Client Service on a Windows 7 machine, so here's what worked on that platform. Other operating systems may be different.
  • In the Windows 7 Start menu, navigate to the hp Profile Editor icon. Left-click and choose "Run as Administrator." Unless you Run as Administrator, you cannot save changes to the profile.
  • Go to the Registry Editor section of the Profile Editor. Select your platform and check the box for Show all settings.
  • Scroll down to users. Expand the folder until you get to users/user/apps/hptc-root-xterm. Select authorized and enter the value 1 in the text box.
  • Click Next two times and then select Save Profile and then Finish.
  • Find the file, profile.xml, on your computer and change the permissions. Right click on the file, select properties, select the security tab and click the Edit button to change permissions. Add "Everyone" and give them full control.
  • Turn off the Windows (or other) Firewall on your server machine.  If you don't, the thin client will not be able to grab the profile.  You can turn it back on after you update the profile on the thin client.
  • Boot the t5335z and it should connect to the server, download the profile changes you saved and run them. If it worked, and it did for me, you now have root access to the device through the xterm window. You get there from Settings/Additional Configuration menu (X Terminal). Good Luck (it shouldn't be this hard)!

Thursday, January 12, 2012

CES 2012 Impressions

Thumbs down on Smart TVs. Why do I want to buy a television with a computer inside. It will be obsolete in 24 months.

Why the buzz about Ultrabooks?  "Ultra portable" laptops you been around for years. This is another case of marketing over substance.

4K displays caught my attention. These are the next generation after hdtv.  Sharp and Sony had them at CES. 

4K refers to the number of pixels along the diagonal of the screen image.  Current hdtv provides up to 1080 pixels along the horizontal. But much of the hdtv content that is currently available is only 720 pixels wide.

Today, 4K displays cost $25,000 or more.  And there is no content available at 4K resolutions now or for the foreseeable future.  FYI, 8K displays are down the road.

Monday, January 09, 2012

Portable Computers

These are laptops, tablets, and smartphones.  And portable computing is the leading edge of change in information technology.
The movers and shakers in portable computing are Apple, Amazon, Google, Samsung and others. Not Microsoft, Intel, Dell, HP nor other established players.
Change is coming, and it's going to get messy.  Microsoft is trying to play catch up. HP doesn't know if it is coming or going.  Amazon is a ruthless competitor.
I'll be looking at the Consumer Electronics Show this week to see if there are any indications of changes to come.
Posted it from my Google Nexus S smartphone, running Android 4.0 AKA Ice Cream Sandwich.