Sep 29

How to let your iphone or ipad apps check for network access – reachability

I have recently been working on a new iOS app for the iPhone and I ran into a couple of issues. I don’t really have time to go over them all in this post, but I did want to document one of them because I hear it can be a big deal as far as getting your app approved by Apple. The issue is that of making sure you handle things gracefully if the user’s phone is unable to connect to the internet and they try to do something that does require a connection.

The way I decided to handle it was to use the reachability collection provided by apple. I downloaded the reachability sample from Apple and then copied and imported the 4 files from the “classes” directory into my project.

Then I added the “SystemConfiguration.framework” to my project.

Now I have all of the prereqs for my solution. The next thing I did was I created a NetworkReachabilityTest class with NSObject as its base class. I added a single method called “isNetworkReachableWithAlert” that returned a bool and included one parameter. The parameter specified whether it should automatically pop up an alert box in case of a lack of network connectivity.

I chose to do it this way (as a dumb small class) so I didn’t have to copy the code for this method into every page. Plus it gives me the flexibility to easily reuse it in future projects. So now, before I do something that requires network connectivity I instantiate an instance of this class, I do the check, and if the connection is there I do the work. If the connection is not there I can bail out instead.

Here’s the code (some of this code was included in the example and some was found here around post 29 or 30:

-(BOOL) isNetworkReachableWithAlert:(BOOL)bshowalert


Reachability *r = [Reachability reachabilityWithHostName:@””];

NetworkStatus internetStatus = [r currentReachabilityStatus];

if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))


if (bshowalert)


UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@”No Internet Connection” message:@”An internet connection via WiFi or cellular network is required for this portion of the app to work.” delegate:self cancelButtonTitle:@”Ok”   otherButtonTitles:nil];

[myAlert show];

[myAlert release];


return NO;


return YES;


That’s in the implementation file  of my simple class and it is basically the only thing there! And it does everything we need.

And here it is in use:

NetworkReachabilityTest *nrt = [[NetworkReachabilityTest alloc] init];

if ([nrt isNetworkReachableWithAlert:YES])


// logic that requires or includes web activity here


[nrt release];

Hope that helps. Hope it makes sense. Better ideas or improvements on it are welcome, I just wanted to give someone a simple example of something that I know works  along with the steps I took to make it work.

Sep 25

Printing from within a WinXP Virtualbox client with a Mac OSx host

I have an Mac OSx machine on which I have virtualbox installed. My most often used virtual client machine runs Windows XP. Almost everything works great, but I was having a lot of issues getting printing to work. I finally got everything figured out though and figured I’d write it up real quick. So here’s what I did.

The first thing I would recommend doing if you have a setup like mine is to find the driver for the printer that you need to print to. Why? Because the apple software that I point you to below will install a driver by default that technically works, but it makes everything you print come out super small. [Actually, as I’m writing this is occurs to me that it may be doing this when I print because Apple assumes an HP printer in their tool, but mine is an Epson.  So maybe the default installed by the program provided by Apple will work “out of the box” for an HP printer… But I would still go ahead and get the correct driver for your printer first.]

Then once you have the driver on the client do the following (found this at forum and quoted from here):

1) Shutdown the VirtualBox machine
2) Under Mac OS X

  1. System Preferences, Print & Fax, Check “Share this printer on the network”
  2. System Preferences, Sharing, Check “Printer Sharing” and Check the printer

3) VirtualBox machine, Network:

  1. if only one adapter selected and it is attached as NAT [this is the default], then add Second adapter. Make it attached as Host-only Adapter and choose the name: vboxnet0 (see note B at the bottom if you can’t find this).
  2. if the adapter is attached as Bridged Adapter, then do nothing (you have a reason to be Bridged?)

4) Start up the Vbox machine – let it adjust to added Network Adapter
5) Download and install from Apple “Bonjour Print Services for Windows”
6) start Bonjour Printer Wizard and follow the menus

Note A: That wizard will allow you to print from the client using the printer on the host MacOSx machine. But that wasn’t it for me because Apple defaulted to an HP driver which caused the pages to print all tiny on my Epson. It was an easy fix though. I just had to go back and run the brand specific printer driver install (or manually change the printer driver for the printer added by the apple wizard) so that it would use the brand specific driver instead of the Apple default.

Note B: I did a fresh vbox install to test this because some people weren’t seeing the vboxnet0 at this stage. I was able to reproduce the problem and fix it based on another reader’s suggestion. All I had to do to get it fixed was go to ‘VirtualBox’->’Preferences’->’Network’. It’s probably completely blank for you if you’re reading this note. What you want to do is just click the little green plus to add a new hostonly network and it’ll add ‘vboxnet0’. Now go back and finish the tutorial where you left off and you should be printing in no time. Hope that helps.

Note C: In the comments below you’ll see a couple of readers (Jeffrey Weber and Leigh Warren) that were only able to get things working by using Bridged instead of HostOnly (see step 3 above for where this matters). The “method” I defined in the main part of the post seems to work in most cases, but there is obviously some type of setup that requires bridged rather than host-only. I recommend that you try it the original way first and then double check everything if it doesn’t work. After that if the original way still doesn’t work you might try tweaking this setting going bridged instead. Keep in mind that if you’re already bridged and everything is working then, as the original write up says, do NOT add the host-only.

Aug 28

Some thoughts on Software Patents

I have read a lot of what I consider to be fairly convincing arguments relating to software patents and whether the courts should “allow them” or “ban them”. Before I had the insight I’m going to share below I was definitely a fence hopper, but I think I have finally satisfied myself with an answer. It takes a wee bit of imagination and a willingness to be somewhat philosophical to get there, but I think the thought process will get you there.


If you’ve seen “The Matrix” you know that almost the entire movie involves real people living and acting in a virtual world. If you’ve seen “The Matrix Reloaded” you’ll remember a scene where a ship is returning to realworld city of Zion and they are getting ready to enter the gates to the city. The city is very mechanical and computers are utilized to control everything, but do the people of Zion who operate the computers sit behind a keyboard? No they don’t. Instead they “plug in” in the real world transferring they minds into the virtual world in which someone (presumably other humans) has programmed all of these controls. The controls cool thing about these controls is that not only can they be laid out like a keyboard, but they can also be like a lever. It’s their own virtual world so they can build it however they want. They just need to be presented with an environment that they can manipulate to get “the job” done.


Now imagine current earth humans being able to allow their mind to live or work inside of a virtual world. Everything in that virtual world is actually software! Nothing is physical though it could be designed to look it and feel it. It may be designed such that your physical actions (ie grabbing a lever and pulling / pushing it) causethe software to behave in different ways, but it’s still not actually physical. How you interact with that software simply causes some state change in the outside world, but what you are interacting with IS software. Yes, the changes you introduce by manipulating the controls made available to you will cause some other software to cause changes in the outside world which will in turn cause a change to the view of the world presented to the those in the virtual world (and in the physical world). But it’s still software making it all work. The tools are software. The connections are software. The actor could even be software.


Once these types of systems are possible, and especially once they are common place, there could be a rush of what, in the physical world of today, we would call innovative people coming up with new widgets that can be used inside of this virtual world. These innovations will almost surely come with a price that would be paid by the programmer. In that case there would be a need for protection under some type of law in order to encourage people to create, test, and perfect them. Do we have a system that provides this sort of protection today? Yes, we do, and it is the patent system. It would also be applicable to this sort of situation considering the new types of “tools” that people would “physically” interact with inside the virtual world. All manner of things are possible in the real world today that we just knew wasn’t possible before (until someone innovated a way to do it), and the same will be true in the virtual world. Ways of doing things never even thought of will be, given the right motivation, not only thought of but implemented and improved upon. Different ways of looking at problems will cause unique solutions to become apparent. The solutions would be “obvious” once pointed out, but would be nonobvious prior. Why would someone dedicate their time to looking for alternate solutions if the answer will net them no reward? History shows us that they won’t… not to the same degree anyway.


Q: What about a hammer vs a “virtual hammer”? Would you really allow a patent on a virtual hammer that does the same thing in software world that it does in the real world? That seems like everything would get repatented with the only difference being that it is “in software”.


A: This question stems from one of the common errors untrained people make when judging patent validity. You can’t just look at the title, or the summary. Think about it. A software hammer wouldn’t be the same thing as a hardware hammer would it? Software doesn’t have physical nails to drive. But maybe a software hammer can be made such that it easy automates the binding of two or more components using a single connective module. Something that used to take 10 virtual actions can be easily rolled  up into the action of hitting the objects with a hammer. The hammer basically just does all of those steps that “physically” had to be done before and elminates them through some ingenious “piece of code”. Testing this peice of code and finding just the right tweaks for it came with a cost of thousands of lost operations (cpu cycles), mangled data, and even memory leaks that had to be dealt with before it became stable to be used in the virtual world. Why would someone give up these precious resources if it would not gain them some advantage? Now that it is done it is a easily copyable solution so what’s to stop another from copying it and using it without having put their own butts on the line? Copyright doesn’t do the trick as code can be rewritten (hell, translate it to another language and you’ll have to modify it to do so). You’re still using the same algorithm, but it obviously not the same code. Yes it is and you shouldn’t be allowed to steal the code, change the language, and call it new.


It is my belief that as things become more virtualized and as virtual reality starts to become both more real and more immersive that we will see more need for patents on things in the virtual world. These things are no doubt software. But they are also no doubt in need of protection.


To be continued… or is this one step too far?


And if we know that software should be patentable in the case of said eventual world, then software should be patentable now due to the simple fact that the simulation argument leads there.


May 14

To lock down or not lock down

A while back I did a post about making sure that you lock down your wifi so that people do not do nefarious things on your connection and get you into trouble. Well, apparently that was not the best “legal” suggestion. Apparently, if your wifi is open and someone does something wrong then, well, it could have been anyone that was using your IP. But if your wifi is closed and something is done wrong (beginning at your IP address) then you are viewed as that much more likely to be the target of an investigation. Afterall, who could have been using your IP? Your wifi was closed!

According to the Electronic Frontier Foundation (EFF), keeping your router OPEN may offer more legal protection than having it closed.

If you run an open wireless network, you may be able to receive significant legal protection from Section 230 of the CDA (against civil and state criminal liability for what others publish through the service) and Section 512 of the DMCA (against copyright claims based on what others use the service for). While these protections are not complete, EFF regularly engages in impact litigation to help ensure that these laws offer as strong protection to network operators as possible.

The fact is that wireless router security is often viewed as something you just set up and then leave alone and it works to keep the bad guys off your line. However, wireless security is relatively weak and much of it can be broken. It won’t be long before the bad guys have access to your locked router and start making trouble. When they do, it will look like YOU are the one making trouble. On the one hand, you hate to give the bad guys a free ride, but on the other hand you would hate to get punished for what they do if they stole your ride and did something inappropriate with it.

I continue to go back and forth on this one. I have gone months with my router open, and then some time with it closed. I usually have to close it due to too much bandwidth being used. My netflix will start lagging (don’t mess with my Sarah Conner Chronicles!) or whatever and I know that someone is getting a little happy with my bandwidth.

It makes me nervous both ways to be honest. I have several houses with teenagers that live around me, all with wireless reach. Do I want them going to sites or performing illegal activities over my router? Nope. Do I want them using up all my bandwidth? Nope. Do I want to be nice and allow for free access? Yes. Do I want to have someone crack my WEP, gain access to my router, and then do unruly things so that it appears it was me? No way! So what I do? What would you do?

My plan is to in general go open wireless. Sometimes I’ll close the open access if I have bandwidth hogging issues and then I’ll open it back up once I think they’ve gotten the point. If you come around and don’t find an open network currently available don’t be discouraged. I have likely gone into non-sharing mode for a short time in order to get the bandwidth hogs to move along and will reopen for public use soon enough. Really, this isn’t much of a change. I like to provide a needed service, and I understand the need for open wireless points. Now that I see there are even legal “goodies” to go along with having it open I feel even better about the way I’ve operated historically and will continue to lean towards open, available wireless.

Mar 29

Context Clues (why is there a lion on the radio?)

Kids are so awesome… they’re just missing the filter that most of us have that keep us from asking silly questions. I mean, after all, maybe there are special situations where a lion might actually be on the radio!

The other day I was driving my 5 year old home from ballet class. We were chatting about class and when we were done I started my Dave Ramsey podcast up. For those of you who are unfamiliar with Dave Ramsey I’ll just tell you that he is someone who helps people become financially secure by providing them with a plan for paying off their debts and getting their finances / investing in order. He does a radio show, live events, has some books, and more I’m sure. I may have done him a great disservice with that super brief description, but, to be honest this post isn’t about him… it’s about my kiddo and her use of context clues.

She hears Dave talking on the radio and says “who is that”.

Daughter (5 yrs): Who is that?

Me: On the radio? That’s Dave Ramsey.

Daughter: Who? Is that a man or a woman?

Me: Well, the caller was a woman. But the person talking now is Dave… and he’s a man.

Dave just finished with the previous caller and now a new caller is getting started.

Radio: … Hey, Dave. Thanks for taking my call. I was just wondering….

Daughter: What!? Why is there… Is there a lion on the radio?

Me: Huh? What did you say?

Daughter: Is there a lion on the radio?

Me: A lion? I thought that is what you said.

Now, at this point I’m not sure what is going on in her head, but I’ve learned that this one doesn’t generally ask goofy questions for no reason. There is usually some thought that actually gets her here. So I try to figure out how we got here.

Me: So…. why would you think there was a lion on the radio.

Daughter: He has a paw. (very nonchalantly)

Me: Ummm… I don’t understand. He has a paw?

Daughter: Yeah, he said “Hey, Dave. Thanks for shaking my paw”.

Me: Ahhh… I think you misheard him, kiddo. He said, “Thanks for TAKING MY CALL”.

This idea made much more sense to hear than the idea that there was a lion on the radio, but her little mind made sense of what it thought it had been presented with and didn’t skip a beat. Well, maybe enough of one to ask why a lion was on the radio, but not enough of one to rule out the possibility.

Of course, the next question was “what’s a call?”… and why is Dave taking it from this other guy (who we now know not to be a lion). I gave her the answers she sought as we continued home, all the while chuckling to myself about the lion on the radio who was thanking dave ramsey for shaking his paw.


Jan 21

I cut the cord (part 2)

This is a followup to a previous post in which I listed my notes relating to how to get rid of my cable service. So how did it work out? Pretty well, actually, so far. We’ve been without cable for 3 or 4 months now and we’re doing alright.

I definitely miss NBA on TNT. I missed Monday night football. I’m certain I’ll miss all the NBA playoff games that only come on TNT. Sports is by far the biggest thing for which there is simply no good alternative location or service that has as much coverage as cable TV. Actually, xbox recently partnered with ESPN3 and you can stream ESPN events directly through you xbox. There are often things worth watching and they look just like regular TV (or better).

We have basically been unable (or unwilling) to keep up with our regular TV shows. We used to watch TV in our “downtime” when we just played it off of our DVR. Live TV just never happened except for sports. Having the DVR was convenient. However, going through hulu and those other options is a really big pain in the butt. Well, actually, it is just an inconvenience, but it is enough of an inconvenience to make it mostly not worth while for me. It is NOT the same as DVR. My wife, however, still manages to watch her shows when she sees fit via hulu, etc.

Netflix (I should be getting paid for this, but I’m not) has a great set of options of children’s programming and children’s movies. My kids even love the idea of getting something from Netflix in the mail. About half the time it is a grown up movie and half the time it is something the kids will like, but they’re always excited when that red envelope shows up. However, it is certainly not limited to dvds. You can stream tons of videos and tv shows. I actually watched some old episodes of “she-ra” (my wife wanted to watch this) and “inspector gadget” streaming through my xbox.

So, between Netflix and hulu (and clones) we seem to have found a winning option. We save about $100 per month and end up with extra time as well. On the downside there are some significant shortcomings when it comes to sports coverage, but as more options become available I think this will also to become less significant.

Jan 04

I cut the cord – how to give up cable (part 1)

Not too long ago I got a huge bill increase from my cable company. I was coming off of the 1 year introductory pricing so it wasn’t actually a huge increase in rates, but practically, that is exactly what it was. I was paying $80 or so and then I was asked to pay $135 or so.

It immediately occured to me that even though I liked having access to so much and LOVED my DVR I really didn’t watch but 4 or 5 shows and the same movies over and over (or “whatever” was on). So, I went about the process of researching exactly how I could do the same thing for less money. Below are the notes I came up with during my search. You will want to read part 2 to see how all of this worked out and for something that will be a little more clear. Below is literally my notes I was taking while researching with a slight bit of proofing so I wouldn’t be totally embarrassed for it to make it on my site.

First I sought out people who had done the same… here are some:


Then I went about trying to determine what would get me most of what I already had… basically, I needed to show my wife that she would still have access to most of her shows and the kids would still have Dinosaur Train. So here’s some of your options to cover those things:
·         YouTube,
·         Hulu,
·         Amazon,
·         AppleTV / iTunes,
·         Netflix ($8.99 cheapest)

Other Notes:

  • You can view fox shows at (link to ‘Glee’ for example):
  • I assume 24, Glee, House, Fringe, Bones also.
  • “I also have the privilege of access to my beloved out-of-market NY Giants games each week with DirecTV’s online Supercast service. It broadcasts all of the Sunday Ticket NFL games over the internet, but access to the online content requires DirecTV service and the full SuperFan package that runs a ridiculous $400 per year (Manhattan residents can access Supercast without DirecTV service). However, if you know someone with a Supercast account, you can piggyback.
  • If baseball is your thing, offers a service similar to Supercast for around $100 per year depending on the package—although it only includes out-of-market games. Live golf can be viewed for free on; college sports, baseball, tennis, soccer and more is free on ESPN360 (if you are affiliated with an ESPN-approved broadband provider) and streaming sites like offer plenty of free sports viewing options, including live ESPN. Windows Media Center owners can also get SportsLounge, with Fox Sports.”
  • NBA – (broadband version – not sure about the cost)
  • NFL- Could not find a comparable other than those listed above… Will ask Mike what the UofM video streaming site was that he was using… might be a solution.
  • (a sunday night nfl streaming site)
  • PBS is over the air (Dinosaur Train, Word World [is this pbs], etc) (Can also buy on itunes 1.99)
  • iTunes has TV episodes for 2.99 (current season) and various prices like 1.99 per or discounted packages (previous seasons)

Stay tuned for part 2 where you’ll find out how it worked out.

Oct 01

Peeve worthy: Unsavory links that don’t tell you they are unsavory

I want to mention one of my newer peeves to you folks and see if people agree.

I do web stuff. Sometimes I look to buy websites. If a website makes some money then maybe I buy it for 10-15 times that amount and eventually I make my money back. There are ALL KINDS OF SCAMS involved in this so it’s a messy situation sometimes, but when everything is on the up-and-up it can be a win for everyone. But when someone does something shady or just inconsiderate then it can be frustrating. This post is about an inconsiderate person. What follows is the story.

I’m was looking over at digitalpoint for a website to buy. I spent a few hours looking and finally settled on this site that is supposedly making a couple hundred bucks a month. It’s and image related site pix-ol-something-or-another… doesn’t matter. Really, that’s would cost like $2500 to buy and that is out of my budget, but if it was a GREAT deal I’d have to atleast consider considering it. So anyway, I read the description, the price, check out the analytics, etc. There is a lot of traffic so I’m thinking “this might actually be a good deal”. Then I decide to go to the site to see what it is. Standard operating procedure. The first page just basically asks if you want to upload an files. I say no… and BAM… nakedness all over the screen. That’s right, apparently guy was selling an “adult” site and didn’t bother mentioning it in the ad. Jerk.

So what bothers me? Well, I do this same type of research during the day sometimes on the weekend and possibly even at work. It just so happens that while, in this case, it was the weekend the kids were already in bed and not goofing off where they can see over daddy’s shoulder. That was a relief at least. Also, there are people that have legitimate problems and addictions to those types of sites and by linking to them without warning people may be unduly caused to stumble in their efforts to heal. What if I had been at my day job? I could be in the unemployment line because some putz didn’t bother mentioning the site he was selling was “not safe for work”. It’s definitely not a thing to play around with.

Who knows… maybe I’m just an old fogy and should get over it, but it just seems like people should have a little more respect for one another and IF a person might be taking someone down path that could cause issues they should at least be warned about what lies ahead.

Jul 18

lock down you wifi! and an overview of things to come

I had a birthday recently. On my birthday I made a sort of “resolution” to try to write atleast one post per week. This is week 3 (or 4 maybe) after that birthday and I’m just writing the first one. Sounds about right for a resolution, eh?

So here’s what I thought I would do. I’m going to make a list of some things that I plan to write about so I can reference it and have quick ideas in the future.

One of the things I want to write in depth on is the dangers of leaving your wifi open. I’ve read some really scary stories lately that in retrospect could probably have been predicted. I’ll give you the short version of my recommendation right now… lock down you wifi. No matter how altruistic your motives for leaving it open to whoever wants to use it allowing them to do so is not worth the potential legal issues. I just added security (or attempted to anyway) in the last couple of weeks, and I just hope no one did anything too shady before then. I’ll give a full writeup at some point in the near future.

Another thing I’ll be writing about will be some things I’ve learned business related. It’s been another year that I’ve been running a website that COULD make money and I will share some of what has and has not worked for me along those lines. The things that didn’t work were either due to being a poor idea in general or perhaps due to poor execution. I’ll talk about advertising on Facebook, google adwords, arguing with your customers, plans for revenue streams.

I might talk about kids. They are certainly a never ending source of material. The same parents can have kids that are opposite in so many ways it can be almost comical if it wasn’t so frustrating. One child knows exactly why they do everything… the other child believes “I don’t know” is an answer to why they did anything wrong. Bill Cosby would be proud of the second.