Influencing Viral

I’m a software developer.  I make mobile games, among other things.  I’m also a Dad to two teenage children.  The combination of the two leads me to watching what they’re doing with their mobile phones.

Back when the indie game “Threes” came out I bought a copy and played it.  I didn’t mention the game to my kids, but not too long after I saw my older daughter playing “2048”, so I said:

“Oh, I see you playing 2048.  That’s really just a copy of another game called Threes.  Do you want to play that?”

“Uh… OK.  I’ll try it.”

Continue reading

Area of Latitude/Longitude Rectangle using PHP

I went searching for how to calculate the area of a rectangle* on the surface of the earth using PHP and didn’t find one online.  Someone probably has one somewhere, but it was just as fast for me to adapt one as it was to continue searching, so here it is.  Enjoy.

This code is also available on GitHub if you prefer:
https://github.com/prairiewest/PHPRectangleArea

Continue reading

Windows 2012 Multihomed Domain Controller

In researching whether one can run a Windows 2012 domain controller with multiple network cards (aka “multihomed”) I ran into a lot of old posts referring to Windows 2003, Windows 2000 and even NT4 – but not a lot of new information.  All of them say something like a multihomed configuration “isn’t recommended” or “isn’t supported”; not many of the pages actually address whether it will work.  So here is my recent experience.

Yes, you can run a domain controller on a multihomed machine, but you need to make some configuration changes for it to work.

The reason that we wanted to do this was to physically split up the network traffic.  We were running a private network between all of our servers and the network attached storage, and didn’t want the clients to see this traffic at all, let alone have a badly behaving client overload the network hardware and impact the connection to storage.

For the purposes of demonstrating with an actual example, let’s assume that you have a machine with 2 network interface cards:

  • NIC 1: “PUBLIC” 192.x.x.x network (clients use this to reach the DC)
  • NIC 2: “PRIVATE” 10.x.x.x network (private network, only for servers or storage)

I’ve labelled the 192.x.x.x network as PUBLIC just so it’s clear that client machines use this to contact the DC, it doesn’t mean that the IP address is necessarily publicly routable.

Here are the changes needed:

1. [required] Prevent the DC from offering DNS services on the PRIVATE interface

  • Right-click the Windows menu and select Run
  • Type regedit and hit enter
  • Navitage to: HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters
  • Add a new string: PublishAddresses
  • For the value, put the PUBLIC (192.x) static IP address

2. [optional] Remove unneeded items from the PRIVATE connection

Some of these may vary depending on your setup.  You should know what you need on your own PRIVATE network; we only needed TCP/IPv4 so here is what we disabled:

  • Open the Network and Sharing Center
  • Click on the connection for the PRIVATE network
  • Click on Properties
  • Uncheck “File and Printer Sharing for Microsoft Networks”
  • Uncheck “Microsoft Network Adaptor Multiplexor Protocol”
  • Uncheck “Link-Layer Topology Discovery Responder”
  • Uncheck “TCP/IPv6”

3. [required] Stop the PRIVATE address from being added as a DNS entry for this host

  • Open the Network and Sharing Center
  • Click on the connection for the PRIVATE network
  • Click on Properties
  • Click on TCP/IPv4
  • Click on Properties > Advanced
  • In the DNS tab, uncheck the box “Register this connection’s addresses in DNS”

4. [required] Remove PRIVATE addresses that were already registered

  • Open Server Manager
  • Click on Tools > DNS
  • Click on the folder for each of your forward lookup zones, and anywhere that you find a PRIVATE address, right-click and remove it
  • Open the folder for each of your forward lookup zones, and in each of the sub-folders also remove any PRIVATE addresses that you find (examine the whole tree)

5. [required] Reboot the machine

This is needed for all of the above changes to take effect.

Corona SDK Volume Sliders

If you are developing mobile apps with Corona SDK that use volume controls, here’s a quick tip for implementing more natural feeling controls.  Assuming that the control is a slider with values from 0 to 100, all it takes is one line of code:

volume = (math.pow(3,sliderValue/100)-1)/2

But since I really like seeing things work myself, I’ve built a very small demo project that you can download and run:
screenshot
VolumeSliders.zip

If you would like to read more on why this formula works or why it’s even needed, this page may be interesting for you: http://www.dr-lex.be/info-stuff/volumecontrols.html

Multi-language Apps with Corona SDK

Language SelectionsI was looking at the various mobile app stores and their ability to push apps out to countries all over the world and I thought that I needed to write an app that took advantage of this worldwide distribution. My reasons for doing so were two-fold: first, it was an exercise in learning, which I’m always up for; second, I thought it may actually help increase sales in foreign countries (or at least couldn’t hurt).
Continue reading