PHP Array Assignment and References

miqrogroove
2017-08-15T08:39:01+00:00

This is a quick explanation of some more referencing quirks in PHP.

Let’s say you need to store an array in a specific variable so that another variable can be freed up and overwritten with different information.  [To clarify, this array may be very large and copying it would be detrimental to performance in this particular application. For small arrays, copying and not referencing may be preferable.]

The operation for referencing the array with a new variable is quite simple:

$array_goes_here =& $need_to_free_up_this_var;

The code above will reference the array to prevent PHP from making an unnecessary copy of the whole thing.

Now here’s what you have to avoid:

$need_to_free_up_this_var = array(); /* wrong! */

Read the rest of this entry »

15 Feb 2013

Category:
Systems Engineering

Tags:

Discuss:
Comments Go Here

My New Website is CaptainsLog.aero

miqrogroove
2013-01-29T23:16:49+00:00
Screen shot of the CaptainsLog.aero website.

Official New Website

Welcome to the slightly reorganized miqrogroove.com.  This is now the home of my technical articles and some archived projects.

Please follow this link to visit CaptainsLog.aero, the new home of Robert Chapin.

That new website is devoted to aviation topics, safety, and professionalism.

You can now subscribe to both websites separately.  If you wish to continue reading my aviation articles, you will need to add a subscription for the new website.

All of the old links and addresses should still work normally.  They will forward you to a new address automatically if I moved them.

I have other aviation projects under construction already, to be announced soon at the new website.

Thank you for reading!

29 Jan 2013

Category:
Website Updates

Discuss:
Comments Go Here

How to Secure iPad VPN with Windows L2TP

miqrogroove
2013-01-15T10:30:39+00:00
VPN diagram showing both Windows and iPad remote clients.

Different protocols for different clients.

Back in August, I mentioned the importance of disabling most versions of PPTP for security reasons, and included my own tutorial for How to Secure a Windows VPN with PEAP.  That solution works great for Windows, but is not compatible with iPads.

Now I will offer a solution that works great for iPad, but may not work on Windows computers.  In addition, I will explain how to get the two solutions to work together securely so that both Windows and iPad computers will be able to connect to a Windows VPN simultaneously without using the insecure versions of PPTP.

The Layer 2 Tunneling Protocol (L2TP) is an obvious choice for the iPad because it is the only supported protocol other than the insecure PPTP option.  On the server side, however, there are some implementation nuances that could easily discourage the use of L2TP.  I took the time to research L2TP in more depth before writing this article, because I felt that a generic recommendation could leave readers totally confused about the security issues involved.  So before delving into a new tutorial, I want to explain two new concepts:  L2TP Pre-Shared Key, and L2TP NAT Traversal.

NAT Traversal could be a major concern for any L2TP implementation, because Microsoft wrote a very technical and rather intimidating knowledge base article called IPSec NAT-T is not recommended for Windows Server 2003 computers that are behind network address translators.  If you’ve seen that article, I want to assure you that the Microsoft recommendation is not relevant here.

A careful reading of the Microsoft recommendation against NAT-T will reveal that the underlying security problem with NAT-T is not a server problem but a client problem.  In other words, Microsoft recommends that Windows XP computers not attempt to use NAT-T to connect to privately-addressed servers.  The Windows 2003 server itself fully supports NAT-T out of the box and doesn’t even need to be configured to use it.  This is perfect for iPad users, because iPad also supports NAT-T out of the box, and this almost eliminates the address translation challenges of using L2TP.

Read the rest of this entry »

14 Jan 2013

Category:
Systems Engineering

Tags:
, ,

Discuss:
Comments Go Here

UPS Replacement and APCUPSD for Windows

miqrogroove
2012-12-26T05:37:14+00:00

After replacing a UPS device, Windows may automatically delete the APCUPSD USB driver.  When the computer boots up, the tray icon status will say “Network Error” and three errors will be logged in the Windows Event Viewer.

To restore APCUPSD to online status, simply re-install the USB driver by following the manual installation instructions.  That information can be found in the program directory.  For example, C:\Program Files\apcupsd\driver\install.txt  In a nutshell, you need to look in the system’s Device Manager.  If there is an item in the Human Interface Devices group named “American Power Conversion USB UPS” then the desired driver is missing.  Right click that item, click “Update driver” and then pick the correct driver.

After restoring the driver, restart the APCUPSD service by using the “Start Apcupsd” shortcut in the Start menu, or by using the Services administrative tool.

Read the rest of this entry »

26 Dec 2012

Category:
Systems Engineering

Tags:

Discuss:
Comments Go Here

Merry Christmas

miqrogroove
2012-12-20T03:43:28+00:00

Screen shot showing Miqrogroove.com with the Christmas 2012 theme.In celebration of winter break, I decided to change my website’s blue marble theme to a deck-the-halls / red glow motif.

May the warm colors bring you a festive mood!

Credit for the background image goes to AreteStock at DeviantArt.  She has generously licensed her work for free use.

Also new here is the upgraded WordPress 3.5, to which I made some small but very important contributions.  Any WordPress author should be happy to know that I found and patched a bug that prior to version 3.5 caused WordPress to say your draft work had been saved automatically, when in fact WordPress was automatically discarding your work all along.  I first noticed the bug in September when my website ate a fairly long article to which I had devoted some hours.  I resolved the bug in the new version by removing the code that was causing the problem.

While tinkering with themes and WordPress, I also adjusted the printer styles so that it will be easier to print articles from this website.

Happy Holidays!

20 Dec 2012

Category:
Website Updates

Tags:

Discuss:
Comments Go Here

Galileo Offline Maps

miqrogroove
2012-11-21T18:46:33+00:00
Galileo Offline Maps logo screen shot

It’s free on iOS devices.

Galileo is my favorite GPS moving map for driving unfamiliar roads.  It’s installed on my iPad, which is much easier to carry and charge in the car than a laptop GPS system.

Here are a few pros and cons to this application, as well as a comparison to ForeFlight and Apple Maps.  Why these three choices?  Among the many mapping applications I’ve looked at and tried out, these are the only three  I still have on my iPad.

Pros:

  • Quick start up.
  • Fast and smooth panning and zooming.
  • Intuitive map caching.
  • Try before you buy.  All except a few features work in the free version.
  • Uses the best maps, and you can edit them if they need changes.

Read the rest of this entry »

20 Nov 2012

Category:
Free Things

Tags:
,

Discuss:
Comments Go Here

Retina ‘Add to Google’ Button

miqrogroove
2012-11-04T16:03:01+00:00

Here’s another HiDPI resource for webmasters.  These are home made Add to Google Reader buttons.

google-reader@2x.png and google-reader-alt@2x.png These look great on Retina displays when reduced to half size.

+ Google Reader + Google

google-reader.png This links to the original button I modified with transparent corners.

+ Google

4 Nov 2012

Category:
Free Things

Tags:

Discuss:
Comments Go Here

Retina Gravatars

miqrogroove
2012-11-03T16:56:02+00:00

I’ve released a new HiDPI Gravatars plugin for WordPress.  This is a slick website add-on for the iPad/iPhone audience, and future high-resolution displays.  Download the plugin here.

In addition to my regular blogging homework, I am doing some coding behind the scenes to make sure my classmates will be able to easily read and respond to articles using mobile devices and the latest web browsers.  HiDPI support is one of the main new features of the upcoming WordPress 3.5.  When I found out the Gravatar feature won’t be upgraded in the next version, I decided to write my own solution.

I also updated my Simple Short Links plugin, so if you want to share this article with a friend, you can also send this shorter address, miqrogroove.com?p=891

3 Nov 2012

Category:
Website Updates

Tags:
,

Discuss:
One Comment

Split Tunnel VPN, Part 2

miqrogroove
2012-08-31T00:06:09+00:00
Diagram of the split tunnel VPN configuration that does not require static routing

Updated Split Tunnel Design

Two years ago, I devised a Windows XP split tunneling solution that involved static routing.  That solution had the advantage of being cheap, but also had the disadvantage of scaling poorly with any number of client computers.

Now I have a second solution that eliminates the static routing problems.

While researching new VPN security issues recently, I came across an obscure piece of information about the Windows VPN client.  It is nestled cryptically in this one sentence from a Microsoft whitepaper:

When the Use default gateway on remote network check box is cleared, a default route is not created, however, a route corresponding to the Internet address class of the assigned IP address is created.

Absent any other explanation, that sentence requires some mental gymnastics to understand.  Allow me to help with this.

Read the rest of this entry »

31 Aug 2012

Category:
Systems Engineering

Tags:
,

Discuss:
Comments Go Here

How to Secure a Windows VPN with PEAP

miqrogroove
2013-04-22T14:25:22+00:00
Authentication Methods page in the RRAS Remote Access Policy Wizard

Setting up PEAP

In light of last month’s announcement by Moxie Marlinspike and David Hulton that they developed a method for decrypting Windows VPN traffic in under 24 hours, it is now important to stop using MS-CHAPv2 as a means of authenticating VPN passwords.

There is a relatively simple fix for this.  Microsoft VPN servers have the ability to authenticate passwords using another protocol called PEAP, also known as PEAP-EAP-MSCHAPv2.  The only reason one might avoid using PEAP in the first place is that the Microsoft documentation is confusing and describes a requirement for Public Key Infrastructure (PKI) deployment.  The PKI as described in Deploying Remote Access VPNs requires anywhere from one to three servers just to issue certificates.  However, it only specifies the PKI requirement for a slightly different protocol called EAP-TLS.

To be clear, PEAP does not require a full-blown PKI or even an internal Certificate Authority.  You can, in fact, use the same certificate that has been, or would be, issued to a web server for SSL encryption.  There is no reason to add a second certificate just for a VPN server.  This also means there is no investment required in PKI if a free certificate issuer is used, such as startssl.com.

Below is a brief tutorial for configuring an existing RRAS installation with PEAP-MS-CHAPv2.

Read the rest of this entry »

12 Aug 2012

Category:
Systems Engineering

Tags:
,

Discuss:
7 Comments