Random Thoughts

.NET Style Properties (Getters/Setters) in PHP

DSC01202 On any given day, I can be programming in one of many languages (C# .NET, PHP, JavaScript, CSS, & HTML [I know I may be pushing it calling CSS & HTML languages], and soon Visual Basic .NET because of a collaborative project).  Don’t get me wrong, I love that part of my job.  It keeps me sharp.  Sure there is the occasional mishap where I forget that the . is the member accessor in the .NET languages, but it is the concatenation operator in PHP and I will throw the occasional $ into my C# code…

Another thing to know is that I am an object oriented programmer to the core…I am currently cleaning up after another developer who was not an object oriented guy…grr…there is data access code everywhere and he didn’t know the definition of object…finally I just took the functionality down because it was so bug ridden that whenever I would fix one bug, it would expose another.  One thing that has constantly bugged me since I started coding in PHP that I didn’t like its method of using __get and __set for getters and setters (mainly because I still use a modified version of Hungarian notation, but that is a discussion for another blog post, so I didn’t like what the getters and setters would look like).

Then, tonight, as I was coding, I had an epiphany, I could use PHP’s optional operator syntax for a function to get something close to what I would want.  So, where I would have coded this before:

   1:  <?php
   3:  class Test {
   5:  private $m_intId;
   7:  public function setId($value) {
   9:  $this->m_intId = $value;
  11:  }
  13:  public function getId() {
  15:  return $this->m_intId();
  17:  }
  19:  }
  21:  ?>

where I would do the following to access it $objTest->setId(1); or $intId = $objTest->getId(); (I would have to explicitly call the getter or setter)

Tonight I realized, I could code it this way:

   1:  <?php
   3:  class Test {
   5:  private $m_intId;
   7:  public function Id($value = 0) {
   9:  if($value != 0) {
  11:  $this->m_intId = $value;
  13:  } else {
  15:  return $this->m_intId;
  17:  }
  19:  }
  21:  ?>

Now, I can access the id by doing the following: $objTest->Id(5); or $intId = $objTest->Id();

What are your thoughts developers?


Seven Questions about the last year

On December 29th, 2009 Michael Hyatt posted a very thought provoking article on processing what the last year has contained.  You can read it here.  The gist is that there are 7 questions you should ask yourself about the last year.  This post is my attempt to process these questions for myself from a business perspective.   I will be doing resolution/goal setting posts next week, but here is a look back.

  1. If the last year were a movie of your life, what would the genre be?
    I would have to say suspense.  Two Miles Solutions, LLC will be celebrating its 3rd birthday in March of 2010 so we are still on that upward curve where you don’t know sometimes where that next paycheck is coming from.  This is especially true given what the economic climate in our country was this year.  All that being said, Two Miles Solutions, LLC is ending the year on a great foot and things look very good for 2010.
  2. What were the two or three major themes that kept recurring?
    – Gaining a deeper understanding…this was a year where I grew a lot as an individual, from a business owner perspective, I have learned quite a lot about the politics that you have to play as a business owner sometimes and as much as you try and stay out of the BS, it finds you.  I have learned how to use a lot of cool tools this year and have developed quite the toolbox for myself to help other customers.
    –  Survival of the Fittest…as most of you know this was a tough year economically for a lot of people because of the recession, many businesses shut down, but Two Miles Solutions, LLC is still alive and kicking and looking forward to what 2010 will contain.
  3. What did you accomplish this past year that you are the most proud of?
    I think the first thing I have to say is that I survived.  A lot of business owners I know had to close shop this year.  I am proud to say that Two Miles Solutions, LLC is right on the verge of some really cool things that look to be shaping up for the 2010 calendar year.
  4. What do you feel you should have been acknowledged for but weren’t?
    This one is a personal question that I don’t feel I should post for the world to see.
  5. What disappointments or regrets did you experience this last year?
    There are a few projects that I worked on this year that should have gained traction but for one reason or another didn’t.  All four projects hold the promise of residual income that will allow me to spend less time working and more time with my family, but for reasons I can’t elaborate to the entire world (most if not all of them completely out of my control) none of them turned out the way we expected.  Things are looking better for 2010 on all four projects, but we will see.
  6. What was missing from last year as you look back?
    Sleep.  Most people who know me know that I don’t get a whole lot of sleep.  I hope to change this in 2010 and going forward.
  7. What were major life-lessons you learned this past year?
    When with your family, you need to disconnect from the office.  This is a huge thing for me given that I work from home.  What this means for me is that sometimes I leave my cell phone in my office so that I am not checking my email at the dinner table.
    – Sometimes you just need a break.  As much as I would like to think that I am superman, I am not, sometimes I just need to stop and relax.

Hopefully, you found this post insightful, I would recommend doing the same as you get ready to start the new year and set goals for the upcoming year.  You can’t figure out where you are going if you don’t know where you have been.


Social Media Profiles: To link or not to link, that is the question…

Twitter, Facebook, LinkedIn, FriendFeed, Digg, StumbleUpon, Flickr, Google Profiles, MySpace, the list goes on and on…  If you have no idea what I am talking about, read no further, but if you have profiles or pages on at least 2 of these sites, please continue to read.

Are you still with me?  Good.  I’m glad you came.

As a part of my job, I set clients up with blogs and social media profiles to help them get their name out into cyberspace in a way that their customers can find them.  A lot of times, I am dealing with someone who does not sit in front of a computer all day so in order to help them better manage their online presence, I recommend them linking their Social Media profiles.  For a typical business, I recommend they have a Facebook Fan Page for their business as well as at least a Twitter account, and most of the time, depending on who they are trying to reach, an account on LinkedIn.  All three of these websites offer some degree of interconnectivity, see graphic below…

social media mess

Not only that but as you can see from the graphic, there are services like Ping.fm and hootsuite.com that allow you to aggregate your profiles (the list of applications here is endless) and there you are standing off to the side trying to coordinate this mess.

What is the typical person to do?

First off, what are all these things?  (Starting from the top left)

  1. Twitter – this is what is called a microblogging service.  It gives you 140 characters to broadcast your life to people who have decided to “follow” you…
  2. Facebook Profile – this is a social networking site where you can connect with friends.  I have over 700 friends on Facebook, but here is the kicker, I either know every single one of the people or have done business with them at some point.  Facebook DOES NOT allow you to have a profile for business entities…that is where the next item comes into play.
  3. Facebook Fan Page – this is Facebook’s answer to the business world.  Using a fan page you create a Facebook presence for your business.  This is the officially accepted way of doing the Facebook thing for your business.  With this page, you do not have to be friends with all of your business contacts, but they can become fans of your organization and can receive your updates.
  4. Me – substitute your picture if you would like, but the center of your social media universe, if all is in check, is yourself.
  5. LinkedIn – this is a business network social media site.  In the Madison, WI area LinkedIn is pretty active.  I have both business contacts and personal contacts on this site mainly because some of the people I went to college with who are now in the business world are on LinkedIn.
  6. Aggregate services like Ping.fm & HootSuite – these services try to bring some semblance of order to your social media world.

Now that I have given a brief explanation of what these services are, I will now address the main focus of my blog post…should you link your accounts?  Built into each of these services is the inherent ability to link to other accounts…for instance your Facebook Fan Page can be linked up with your Twitter account so that if you publish a status update it will automagically be published to Twitter, the same thing is true for your LinkedIn profile…throw a couple blogs into the list with plugins that update your statuses who knows where a status update could end up.

If you are just getting into the social media scene then I would recommend just linking your few accounts and going for it.  For more advanced users, or those who are like me and have profiles that are a mix of business and personal (I know, shame on me…), I recommend using a service like Ping.fm or hootsuite.com.  Personally, I use hootsuite.com.  They do not have support yet for Facebook Fan Pages, but I am online enough that I can update that status manually.  Here is how my accounts are set up.

  • Facebook profile: This is a primarily personal account, but since I am a business owner and friends of mine are business people, I have a lot of connections.
  • Facebook Fan Page: This is strictly business, no personal information is posted to this account.
  • Twitter: what is this account not…personal, business, ministry, you name it, it’s on there for me.
  • LinkedIn: again another amalgam between personal and business due to the nature of the friends and colleagues of mine who are on these mediums.

Throw on top of this that I currently run 2 blogs (a business and personal blog) and will soon be running 2 more (ministry related) my ducks must be in a row.  That is why I recommend NOT linking your accounts unless you absolutely have to or are not online very often (I disabled the Facebook Fan Page link to my Twitter account, but I keep LinkedIn linked to Twitter because it gives you the choice on whether or not you want to publish).  This will keep you from inadvertently posting a status update to the wrong site.  Instead I use hootsuite because it gives me this cool little area:


What this allows me to do is be selective of my account updates because I can choose which networks I want my update to go to.

Hopefully you found this post to be informative, please discuss in the comments.


Thoughts on the Recession from a Business Owner…

Let me make a confession, I haven’t watched CNN, Fox, MSNBC, or any other national news station since January. Before the election last year I did watch the news because I wanted to stay informed about the candidates and have as much knowledge about who was running so that I could do my civic (and biblical I might add) duty and in the most informed way that I could possible. In my mind there really wasn’t a good candidate, both of the major party candidates had some things right, but also had some pretty major things wrong, but I voted the best way I could. Anyway, back on track. After the election, I shut off the news because I was sick of hearing about the economy. I turned the TV on for about half an hour while I was working one day in January and shut it off after about 30 minutes because I still didn’t want to be hearing about the economy, the national news networks were feeding the fear.

I heard today that the government is saying that the recession is over…that’s good to know…it will be a long recovery but America will do it.

I don’t know when the official start of the recession was, but I started my business right before the recession hit, so I have weathered the recession. If you want to see my thoughts on the recession and how I wonder if it needed to be as bad as it was, head on over to my personal blog.  In this post, I am going to discuss lessons I learned while weathering the recession.

  1. Never make decisions out of fear. This one seems like common sense, but a lot of Americans made decisions based on fear that they felt and now we are hurting a lot more as a country than if we would have kept level heads and just ridden out the storm.
  2. Trim the fat. I know I just said not to make decisions based on fear, but to keep a level head and this is a continuation on that.  Take a serious look at what you are doing and make sure you aren’t doing anything you don’t need to be doing.  I was in serious money making mode because every dollar counted and that is part of the reason my blogging dwindled for so long.  Also, as I mentioned in a previous post, I found things like a library card where I could have free access to a wealth of great information and inspiration invaluable.
  3. Automate/Batch as much as possible. This is similar to the item above, but just slightly different.  I have a forthcoming book review on The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich one of the ideas that I like in his book is the idea of automation.  While I don’t feel like people should take things to the extremes that he takes them.  Automation is a good thing.  Don’t do things you don’t need to be doing and make things as efficient as possible.
  4. You don’t have to take every job that comes your way. I made this mistake early and took a job with a client that I never should have taken.  There is still an outstanding invoice for $169.00 that I am chalking up to learning experience (I should frame the invoice).  Because I was just starting out my business, I took a job without thoroughly investigating the situation and walked into a complete mess.  Do your research and screen your clients.
  5. Treat your customer like you would treat your grandmother and everything will be great. I don’t know anyone who would treat their grandmother poorly.  Most people would actually go above and beyond for their grandma, you just do that for your grandma.  Michael Hyatt (CEO of Thomas Nelson Publishers) wrote a great blog post on this title The Total Customer Experience that really gets at what I am trying to say here.  Check it out.
  6. Stick to your guns, only the strong survive. You went out on your own for a reason.  Stick with it.  Don’t cave in.  If you can weather this recession, you can weather anything.  Keep going.  Sometimes it just sucks and that’s OK, you aren’ t working for today are you?  I know I’m not.  I’m putting in my time now so I can take it easy later.

I learned a lot more than this during the recession, like how I have an amazing wife and family that has stuck with me through some really tough times and for that I am forever grateful.  I also learned that I have some great friends and colleagues who have helped me along the way.  I also have some great customers and I hope we can continue to help each other make our businesses the best they can be.

Now it is time for your thoughts.  What have you learned during this recession?


Baby update…or lack of baby update…

If you have been following my Facebook or Twitter updates then you know we went to the hospital today because we thought today was the day for little Carrie to arrive.

To get the full story we need to actually back up to last week, here is what has happened up until this point…

Some time around January 15th, 2009…just kidding…we won’t go that far back.

Last Wednesday (9/2/2009) Mandy began having contractions to the point where they were about 5 minutes apart.  We are advised by the on-call physician to head into the hospital for monitoring.  After running around and getting everything ready to go we head towards the hospital.  We take Caleb to a friend’s house and another friend stops by to pick up Buster.  When we arrive at the hospital we are sent to the OB triage unit for monitoring.  After a couple hours they decide that the contractions are not productive and that the cervix is completely closed.  So we go pick up Buster and head home (Caleb was already asleep so we leave him at the friend’s house).  The next morning we pick up Caleb and go about our merry way.  All during this time Mandy is having sporadic contractions.

On Tuesday 9/8/2009 Mandy has an OB appointment and she is dilated to 1 cm and we are told that the Dr. doesn’t think that this baby will go the full 40 weeks (Yay!).

Fast forward to today (I guess it is technically yesterday at this point, but I haven’t gone to sleep yet so for me it is still today).  Around 9 am, Mandy starts having more contractions.  At 10 am, she is to the point where the contractions are 5 minutes apart and lasting around 60 seconds apiece…so according to our handy dandy discharge papers from last week, it is time to call the doctor and the doctor said no more monkeys jumping…(oops, that’s what Caleb would say) anyway, the doctor says that it is time for Mandy to head to the hospital.  I do the stupid thing and alert the whole world via Facebook and Twitter that today is the day….then we finish packing and head to the hospital all the while making arrangements for our two boys (similar setup to last week with a couple different characters thrown in).  Once we get to the hospital we head to triage again (we know exactly where to go this time) and are checked in for monitoring.  At this point the contractions are still pretty regular but after about two hours (about the time it takes to watch 13 Going on 30) the resident checks Mandy’s cervix and reports that she is still at about 1.75 cm so we are sent “home”.  We decided that instead of going home we will try to get something to eat, then run a few errands so that we can stay close to the hospital in case we need to head back (at this point we are still thinking Carrie is still coming today).  So we go to Panera, Home Depot, Madison Lighting (there is no way we are spending $180 on a light fixture for Carrie’s room to replace the one I broke), Menards (2 for $25 works for us, we’ll replace the one in Caleb’s room also), Josh Wanta’s (from Legacy Custom Remodeling) so that I can drop off a key so he can get started on our basement repair from our basement flooding since I “might” not be there in the morning, then on to Borders so that Mandy can get a new book and I can pick up my door prize for my presenation in the morning.  After we get done at Borders I call the hotline because by this point the contractions are taking Mandy’s breath away and are about 2-4 minutes apart.  They advise us to come back in.  We go straight to triage (we’ve been there before, have I told you that?) and get checked in and set up (in the same room as before).  They hook the monitors up to Mandy, the heart rate is great and she gets rocked by a big contraction right after they put the monitors on, here we go…(or so we think).  Mandy gets one more smaller contraction, then they mysteriously vanish for about an hour (but her uterus is doing something, because it is not happy).  The resident comes in and chats with us about what is going on and it is decided that we will head home for the night since the contractions are gone.  Mandy was also advised to take the rest of the week off from work, but we will see, she wants to see how she does tomorrow.  We’re not happy at this point because we just want to meet our daughter and had gotten our hopes up and then nothing, but we head home anyway (making arrangements for us to get Caleb and Buster back).  We get not even 5 minutes from the hospital and the contractions start back up.  So the short and skinny is that no one really knows what is going on, but we don’t have a baby girl in our arms yet.

Hopefully you are still around after my long winded telling of the story.  I will try to keep people up to date via Facebook and Twitter as much as possible.


Two Miles Solutions, LLC – site update

I was able/forced to take some time tonight to update the website.  After the previous update to the site I was not happy with the way things were laid out and how the blog was the main focus of the site.  I have updated the site and am a lot happier with the way that it has turned out.

As for posting, the saying

The cobbler’s sons don’t get shoes

is especially true here.  I have been so busy, I haven’t posted any new projects that have released in quite some time.  I am hoping to remedy that tonight and get a lot of the new projects up in the Portfolio section of the site.


The Best Business Investment I Ever Made

Updated 9/8/2009 to include links to amazon.com

OK, with that title, I know the room just got silent as you eagerly await this knowledge that will revolutionize your business and your life.

The best business investment I ever made was to get a library card.

WHAT? I hear you screaming…but it is true…especially if you are a creative person or any person for that matter who has to have their mind engaged.

I have recently joined a BNI group and as a part of being a member of the group you try to get to know the other members of your chapter by having what they call one on ones.  The sole purpose of these one on ones is for one member of the chapter to spend an entire hour learning about the other person so they can better understand who that person is and what they do. They ask questions about both your personal and your business life because they want to get to know you as a person, this is not just some business card passing group, they are truly and genuinely interested in getting to know you. Anyway, being the new guy on the block I have people coming out of the woodwork all over the place wanting to get to know me and one of the things that I ended up talking about a lot is that I love to read. My wife laughs at me but I usually have more than one book going at a time. Usually, a business book, a fun book, and a personal enrichment/enlightenment book. At the rate I go, I read about a book a week. I think I developed the habit from my dad who also loves to read. My dad always has a book with him. It just makes sense, especially when you are a parent and you always have to wait to pick them up. Why not use that time to read?

Now that I have digressed, I will bring this post back to why a library card is such a great investment. Many people will say that with the advent of the internet books are irrelevant, but I would disagree (obviously, otherwise I wouldn’t be writing this post). My main reason that books are not irrelevant given that the internet is so prevalent now is that the internet doesn’t lend itself to the discipline of deep concentration. Many people don’t actually read webpages…they skim them and are off to the next page or site. When people read a book, they don’t skim, they usually devote all of their attention to the information on the pages, you just can’t replace that. One of the main things that productivity books focus on is our ability to focus and how to best create an environment that allows us to do so. A lot of us in the business world have a strain of ADD that I believe could be cured if we would only spend time reading because of the nature of reading. I am not talking about reading magazines, they fuel our ADD because the articles are so short.

A second reason that reading books is so important is that it causes you to create images or scenarios in your mind which gets the creative juices flowing. This is especially true of fiction books, but is really true for any book. With fiction books you are required to create the image of the characters in your head. Every book requires you to interact with it, a business book causes you to think about how the content of the book applies to your business, a book about programming causes you to think about how what you are learning in the book applies to the problems you have to solve on a daily basis.  Non-fiction books are seen in the light of your present or upcoming circumstances and cause you to visualize putting the principles contained within the book into practice, TV or movies just don’t do this (don’t get me wrong, I love movies, but some of the fun in watching a movie that is based on a book is comparing how my view of the characters is similar or different than the view of the creator of the movie).

Finally, the last benefit I will talk about in this post is that the right books help us to relax. Relaxation is somewhat of a lost art in our culture. We are always on the go and we are always reachable via cell phone but sometimes we just need to come to a complete stop and relax, shut off our cell phones, email, pagers (Does anyone actually use pagers anymore other than doctors?), and whatever other noise maker you have (this could include your children so find some time after they go to bed) and just read, you will be amazed at how refreshed you can feel after reading for awhile in a really good book.

If you are not an avid reader at this point or you have forgotten the art I will give a couple of tips.

  1. Start with a fiction book. This may sound counter-intuitive to the business person who has a stack of business books they want to read but never has the time for, but the reason I suggest fiction books to start with is that you are less likely to give up on a good fiction book. Ask your friends what they are reading (if they aren’t reading anything, I suggest adding a few more people to your friendship circle) or go to the library and ask your librarian what their favorite fiction book is.
  2. Don’t be afraid to give up on a book. Some books just aren’t your cup of tea, and that is ok, that is why there are so many of them. If you don’t like a book get a different one. This is really easy if you are using your library card because you haven’t wasted any money on the book because it was free for you to borrow from the library. What you may find with some books is that it is just not the right time in your life to read that particular book and you will be able to come back to it in the future.
  3. If you are really having trouble getting in the habit of reading, ask a friend to join you in your endeavor. Meet with them once a week to catch up and talk about what you are reading and to encourage each other to continue to read and interact with what you are reading.

Before, I close the post, many of you will probably ask what I have read recently.  Here is the list of what I have read in the last few months or am currently reading (all links point to amazon.com in a new window/tab).

Good luck on your journey, stop by soon…


Welcome to the Two Miles Solutions, LLC – Blog

Hello and welcome to the Two Miles Solutions, LLC blog.  My name is Jeff Miles.  I am a custom software/web developer based in Madison, WI.  My main passion is creating software that makes people’s lives easier and more enjoyable.  With this blog I intend to communicate about tools, books, productivity, and coding in general as it relates to being a small business owner out in the great big world.  From time to time, I will also post random thoughts that I have that make sense to me and hopefully make sense to you.

I look forward to making this journey with you.  I am hoping to get onto a consistent writing schedule, but we shall see what the future holds.