My First Unity3D App

Wow…so that was exciting.

I just developed and published my first app using Unity 3D. I’ve learned a couple things along the way that might help someone else. For what it’s worth, I monetized with AdMob…not because I think AdMob is the best option (I don’t believe that at all), but because AdMob is a pretty solid mobile ad server. I may use a different solution in the future, but I’m not investing big money until I see how this pans out.

Which reminds me, I’ll also buy a Mac if this pans out. Using a VM was a pain in my ass (the setup went really quick). First, install your Mac OS X virtual machine on an SSD. I guarantee it will make a world of difference. Second, I like to work in big screens. It didn’t help me do that at all. I’m sure there’s a way, but in the last three weeks I’ve learned the basics of Unity 3D, C# (for scripting in Unity), how to basically use XCode (having never done it before). In the event you’re looking to build iOS apps with Unity…you need access to a Mac in some form or fashion. You can’t export iOS code without XCode (and integrating the AdMob SDK requires XCode anyway).

Second, make sure you have your code-signing ducks in a row. In XCode, this means using Apple’s Developer and iTunes Connect sites. There’s a caveat—you’ll need to make sure your account allows for push notifications, even if your app doesn’t push. Whether it was Unity 3D or the AdMob SDK, I’m not 100% sure, but you’ll save a step now (and potentially later) by enabling it (it requires you to generate some keys; Apple does a pretty good job of explaining how). However, Apple doesn’t really tell you how to get your keys, so I’ve included that below. For Android, you have to view the build settings in Unity 3D, create a new keystore (check the box, enter and confirm your password, click “Browse Keystores,” and save the keystore), and then create a new key with Unity (you’ll have the option to do so from the “Alias” drop down). Sign your code before you upload it.

  1. Log into iOS Dev Center
  2. Select “Certificates, Identities, & Profiles” from the “iOS Developer Program” menu on the right-hand side (click here for a screen shot)
  3. Choose “Provisioning Profiles” under the iOS Apps header
  4. Select “App ID’s” under “Identifiers”
  5. Click the “+” at the top
  6. Name the App ID, determine whether you want a specific or wildcard ID, and select the services you want (make sure to select “Push Notifications”)
  7. Confirm the information is correct and submit
  8. You will have to set up SSL certificates to use Push Notifications; Apple will walk you through it
  9. Select “Distribution” under “Provisioning Profiles” in the right-hand navigation
  10. Click the “+” at the top
  11. Select “App Store” under distribution and click “Continue”
  12. Select the App ID you want to create the profile for
  13. Select the associated certificate (may have one or more to select from)
  14. Name and generate the profile
  15. You’ll have to download the profile but everything else is pretty clear-cut

Feel free to post questions here as you have them!

High Treason

I was thinking about the mess with California Senator Leland Yee today, and the way in which things are handled in politics.

Just last year, Representative Nancy Pelosi (D-CA) accused Edward Snowden of treason for leaking NSA secrets. Pelosi is the Minority Leader of the US House of Representatives and was Speaker of the House from 2007 to 2011. Earlier this year, Pelosi called allegations of the CIA spying on the Senate Intelligence Committee “pretty appalling.”

Back up for a second there…

Pelosi claims it’s entirely acceptable for the NSA to spy on everyday Americans, the vast majority of whom are complying with the law.

Yet this week, staunch anti-gun advocate and California State Senator Leland Yee (D-CA) was indicted on weapons charges. He was arraigned on seven charges of corruption and firearms trafficking. Wow, if anyone needed a connection between organized crime and gun control, Yee served it up to them on a platter. This is the same Senator who was so concerned with “legal loopholes” (his wording) that he wanted to ban “bullet buttons.” If you live in a normal state, a bullet button is a device that prevents you from swapping magazines in a semi-automatic rifle or shotgun without a tool (bullets of the respective caliber can often be used as that tool, hence the name). Basically Yee wanted to make nearly every existing semi-automatic rifle in California illegal (maybe he was running out of machine guns to push and figured semi-autos had a better profit margin).

Yee is accused of trafficking in “illegal guns”—meaning full-auto machine guns (constructed after May of 1986 in accordance with federal law; or practically all machine guns in some states, like California). This is the same man who spoke of the dangers of “unregulated guns.”

If the accusations are true, I believe Yee is guilty of treason. He worked to defeat the rights of American citizens while putting incredible firepower on the streets.

Obviously he had no qualms about putting guns in criminals’ hands…nor taking them from everyday citizens. This is how you create an environment of fear and drive people to the “protection” of government.

To NULL or Not to NULL

I’ve found programmers that I’ve worked with lately don’t like my use of null declarations in PHP. I come from a Perl and JavaScript background (with just enough C++ to be dangerous but not particularly useful), so I tend to declare variables before assigning them values (granted, it’s not a requirement in Perl, just a good idea).

If it adds to the complexity (and/or size) of code, why do it?

Yes, it will make the file a little bit larger…but I’ve never seen—or heard of—a minimized PHP file. Minimizing is great for client-side code (primarily JavaScript, HTML, and CSS) but unnecessary when servers handle the workload. You can find discussions of single- vs. double-quotes all over the Internet, even on, but declaring variables in PHP seems odd because there’s no requirement to do so (technically, a variable in PHP has a NULL value when declared…but that doesn’t mean you won’t flag a notice).

Why do I [usually] declare NULL?

  1. Clarifying code; by declaring everything before I use it, I know what variables to look for later when I’m debugging (OOP PHP does this out of necessity with class-level variables)
  2. When using an IDE, the software auto-references those variables later; if I don’t have a matching variable, it won’t reflect in the IDE and I can catch typos before they become time-sucking issues
  3. Finally, PHP flags a notice-level error when a variable is referenced that has not been pre-declared; not everyone knows to turn off notice-level errors, and it’s a waste of log space (and effort to dig through logs full of notices)

I highly recommend working with other programmers; I believe it makes us better coders, we learn new ways of doing things and thinking about things. For continuity, you need to agree on programming conventions. I’m not overjoyed about giving up NULL declarations, but all things change—Facebook just released their fork of PHP, Hack.

Dodge Vipers and the Downfall of Society

If you haven’t heard yet, Chrysler Group is demanding a number of early (and even some pre-production) Dodge Vipers crushed. As a longtime fan of this marque (I was 15 when they came out and it is my all-time favorite automobile), I was brokenhearted. Cars get donated to schools and destroyed after their useful lifetimes all the time. Chrysler claims these cars are not historically significant (although I would say any small-batch car is historically significant, especially pre-production ones). Chrysler claims “they felt it was time,” but a little digging shows a couple of these cars got into the wild.

Let’s back up for a second…the donated cars are used to teach students how to work on cars. The reality is technology has come a long way in the last 15-20 years, and the Viper has been one of the few cars that (at least up until the Generation V’s) you could work on from home without complex computer systems. These cars have never been forgiving to drive (stability control is brand new on them in 2013) and somewhere around 20% of all new Vipers end up wrecked. This is the draw of the Viper—as close as you can get to a street-legal race car off the showroom floor.  This isn’t a car for new or under-skilled drivers. Again…this is the draw.

With this knowledge in hand (and recalling that the Vipers loaned to schools were  worked on by students, taken apart and put together over and over again over the years, and were deemed unsafe to drive. That’s probably a fair sentiment, a well-maintained Viper in the hands of an unskilled driver is potentially unsafe (the same could be said for the Corvette ZR1, Lamborghini Aventador, or any other high-powered car). You don’t put that much power into the hands of an unskilled driver. Take a beast of a car like the Dodge Viper, give it 15 years of being worked on and modified by students just to make changes, and the car gets out? What the f*** do you think is going to happen?

We live in an age of lawsuits, and Fiat (via owning Chrysler Group) gets sued when someone gets hurt. I’m not sure at which point Fiat was at fault, it seems to me that the dimwit who took the car for a joyride is the only one to blame. If ignorance of the law is no excuse, than ignoring the common sense of you don’t f***ing drive a car that’s been worked on by students for years should also be no excuse.

Vipers by Generation (semi-official)

Generation I RT-10 1992-1995
Generation II RT-10, GTS, ACR (’99) 1996-2002
Generation III SRT-10: Roadster, Coupe (’06) 2003-2006
Generation IV SRT-10 Roadster & Coupe, ACR 2008-2010
Generation V SRT, GTS, TA (’14) 2013-

No Longer Under the Law

I’ve been thinking about this for a while, and this blog post has been written for probably two or three months. I think it’s as important now as ever.

It seems to me the fights “liberals” and “conservatives” have, and all the mudslinging back-and-forth, only benefits politicians who thrive on our willingness to tear one another apart (while we ignore what they do behind closed doors and worry about what our *neighbors* do behind closed doors).

Which of those is going to have the greatest effect on your life and mine? Why would you want to start the slippery slope of denying rights to a group of people? How many people realize that gun control is where it’s at because rich old white men wanted to disarm the Black Panthers? Almost all of us can agree that criminals shouldn’t have guns. If said Black Panthers were engaging in criminal activity, they shouldn’t have had guns. But stripping guns (or rights) away from the oppressed only starts a slippery slope toward taking those rights away from EVERYONE.

Republicans often talk about keeping the government out of private lives…that means even when you disagree with someone’s choice of who to marry. That means allowing gay marriage…not forcing a church that believes it’s wrong to go against their beliefs but rather allowing it. There are churches that are okay with gay marriage…you may find it distasteful (or pick another term) but instead of condemning that church, maybe we ought to look inside ourselves and ask why we’re worried about what other people do.

I’m of the [unpopular] opinion that as Christ taught peace, love, and tolerance, he expected that to go to everyone…sinner or not (think Mary Magdalene or even the taxman Matthew…Matt 9:11). Further, as the New Covenant, Christ frees us from the severity of law of the Old Testament (which is why we’re not sacrificing animals, avoiding blended clothing, etc.). It just so happens that the whole “don’t wear blended clothing” (Lev 19:19) is just a few verses away from the one forbidding homosexuality (Lev 20:13).

Unless you want to hold yourself to every law in the Old Testament, perhaps we should consider Christ’s words in Matthew 7:1-5 (NIV): “Do not judge, or you too will be judged. 2 For in the same way you judge others, you will be judged, and with the measure you use, it will be measured to you. 3 “Why do you look at the speck of sawdust in your brother’s eye and pay no attention to the plank in your own eye? 4 How can you say to your brother, ‘Let me take the speck out of your eye,’ when all the time there is a plank in your own eye? 5 You hypocrite, first take the plank out of your own eye, and then you will see clearly to remove the speck from your brother’s eye.”

Let’s take Matthew 7:9-12 also (NIV): 9 “Which of you, if your son asks for bread, will give him a stone? 10 Or if he asks for a fish, will give him a snake? 11 If you, then, though you are evil, know how to give good gifts to your children, how much more will your Father in heaven give good gifts to those who ask him! 12 So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets.”

In Matthew 19:16-19, a wealthy young man approaches Jesus and asks for guidance: 16 Just then a man came up to Jesus and asked, “Teacher, what good thing must I do to get eternal life ?”17 “Why do you ask me about what is good?” Jesus replied. “There is only One who is good. If you want to enter life, keep the commandments.” 18 “Which ones?” he inquired. Jesus replied, “‘You shall not murder, you shall not commit adultery, you shall not steal, you shall not give false testimony, 19 honor your father and mother,’[c] and ‘love your neighbor as yourself.’[d]” I assume most of you know how this ends, with Jesus telling the young man to give up his wealth…before anyone decides to get socialist on me, the lesson is not that money is evil but that LOVE of money is evil…that the young man desired his wealth MORE than his salvation!

Nowhere did Christ even *reference* Leviticus. He didn’t even reference all Ten Commandments. Yet there are believers who believe their vision superior to Christ’s!

Instead of worrying about what others are doing, Christ teaches us to take care of others and to concern ourselves with our own righteousness…that faith in Christ is the ONLY way to Heaven. If we were concerned about legalities, no one would make it…David and Job are considered amongst the holiest men and even they cracked (and David did some pretty bad stuff)!

Before you decide to exclude a group of people for their actions, consider how Christ would behave in the exact same situation. I don’t believe Christ would argue the fine points of marriage or the semantics of it…the Pharisees and Sadducees often tried to trip Christ up with words and legalese…and every time he pointed out where they failed.

You might think, “but I’m no Pharisee or Sadducee!”…we all are at some level. Anytime we get on the legalese of the Old Testament or think we have all the answers because we’re “educated” (religiously or otherwise) we’re acting just like them.

I’m no expert. I’m no theologian. I believe and I ask for direction…that’s it…in my opinion, that’s all any of us can do. I think the world can use a lot less hate (call it what you want, lie to others and to yourselves, but God knows your heart) and a lot more love and acceptance.

Lime Light CRM API

I put up a new repository at GitHub yesterday that converts the entire Lime Light CRM API into a simple PHP class. The superclass (creatively called LimeLight) has two child classes, Membership and Transaction (with respect to the pertinent Lime Light APIs). This is a work-in-progress and is still in beta…it’s mostly bug-free. As there is no official PHP implementation (only recommendations and companies that will integrate for you), I figured it was high-time for an open source version. I’ve written this code probably a dozen times and frankly I’m tired of rewriting it.

Also, I lack the time to integrate Lime Light outside my existing client scope, and this is as good a way as any to put it in everyone’s hands.

It’s pretty rough and I’m working on building in controls to provide better options and more accurately reflect the API. In the meantime, take a look at the source code here, and feel free to fork it/improve it/etc. I’ve learned and benefited a great deal from open source solutions and am looking forward to giving back.

If you haven’t decided on a CRM solution yet…and you go with Lime Light CRM…tell them I sent you.

NOTE: Neither True Marketing Partners nor Lime Light CRM paid me to write this post or recommend their product. IF you buy Lime Light CRM and if you mention me on the contract, they’ll kick me back. If you buy it and don’t mention me or don’t put me down as your reference on the contract, I won’t get one cent. If you’re already using Lime Light and want to expand from the web forms to the API, this is a good place to start. I have to have a live version within a week anyway… 😉