Author Archives: Keymaster

Swift Optionals

The more I get to know the Swift language, the more I like it. Any time the compiler finds my bugs before I ever run my app, that’s a good thing. And protecting me against my own mistakes is also a good thing.

Optionals is a thing in Swift that protects you against nil pointers. It’s a language feature that strongly encourages you to check your variables for validity before you run off and assume everything is fine. It’s also a very tricky par too the language to fully understand. Thank goodness for Xcode and all its helpful suggestions, but knowing what you are doing will guarantee you have clean code — not just code that compiles.

This is a good article on Optionals that I found easy to read and very helpful:

Swift Optionals

Advertisements

Swift Tips

This is just a link to an article on Swift that I found useful. “guard” is a new Swift thingy that replaces a design pattern I have been using already. The more I use Swift, the more i like it!

Using Guard Properly

Oh, one more little thing I learned today. The C method of writing for-loops is going away, so you should start writing them in the new Swift way:

for x in 0..n { … }

(works if you never write to x, which normally you don’t)

Carry on!

So They Updated the Apple TV

Should you care? In a nutshell, yes, you should.

Does it contain every home entertainment feature you could ever want? No. Nothing will do that. Like most Apple products, it goes after the mainstream consumer without providing bells and whistles that the majority of customers will never need. However, the fact that you can add third party apps makes it infinitely extensible. More on apps later…

The thing about Apple TV that makes it unique in the Apple ecosystem is the low cost of entry. With a very low price tag ($150) and no monthly fee, there is nothing like it. Even a tiny Apple watch costs double that. And the thing about Apple TV, it’s a shred household expense. Whereas you might balk at spending $300 on yourself for an Apple watch or an upgrade to the latest smart phone model, spending $150 “for the family” is much easier to swallow.

Today, the Apple TV is quite entertaining and easy to use. The remote control with its touch pad makes scrolling around very easy and fast. While Siri is often the subject of ridicule, if you simply learn what Siri is good at and stick to that, it’s quite accurate and saves loads of time. How many times have you wondered if a show was on Netflix or Hulu or iTunes? Now you can find out in a few seconds and see all your viewing options in one screen. How many times have you wanted to skip ahead or behind a minute or some arbitrary amount? It’s easy. I could go on and on about the main features but you can ready about that yourself — I want to focus on what makes it special.

By the way, if all the networks can agree to do what’s best for the consumer (ala carte channels and freedom from cable companies) and stop being so greedy, we can have live TV on the new Apple TV, and that would absolutely make it a must-have product. Hopefully that is coming very soon…

So the first time I was testing my trivia app on my Apple TV, I realized how it was different. At that early stage of development, it was loaded with EMT questions because that was readily available. Like most kids, my daughter was walking by and her eyes went right to the big screen in the living room. She was instantly engaged and wanted to “play”. Even though she didn’t know a thing about emergency medicine, the fact that this “game” was on the TV made it interesting and a group activity. The unique essence of the Apple TV, as compared to a watch, tablet, computer, or your phone, is that it’s a shared device that resides in a comfortable, entertaining location in the house. Since it’s on TV, users expect beautiful graphics and don’t mind some noise (sound effects).

And there are apps for it! A skeptical friend of mine said “I can’t even think of any apps I would want on my TV”. That made me think back to the pre-smartphone days when people were happily texting each other on little number keypads. It was common to hear “I just want my phone to make phone calls”, and that was usually precipitated by crappy attempts by cell phone companies to add “smart features” in a way that made the phone difficult to use and harder to make phone calls. Then the iPhone was introduced in 2008 and the world changed. Yes, there are still some people out there who just want their phone to make phone calls and that’s it, but in my opinion they are missing out on some great things. (And if you feel that way, I’m sorry you read this far — you can stop now.)

So what kind of app would be a good fit for Apple TV? How about some workout apps? Yoga, boot camp, fitness routines. How about some nice ambience apps that show a nice relaxing mountain stream or a fireplace, complete with video and sound? How about some games that work well at parties or with couple and families? Trivia games, name that tune, etc. Karaoke is a good one. The list goes on and on, but for sure, there are games that work well on a large screen and there are some that do not. You can also connect a real game controller to the Apple TV and it begins to compete with consoles. You know, those things that cost more than an Apple TV and every good game costs over $50? You won’t get console-quality game play on your Apple TV, but it begins to approach that market and take a bite out of it.

Peakview Software is working on some apps for the Apple TV right now. We have already released “Awesome Trivia” as a starter. It’s a multiplayer app that is great for couples, parties, families, or something you can just play by yourself. If you are in the emergency services, especially if you teach, imagine if you will having an Apple TV connected to your TV at work (or video projector), and a database of training material that you can pull up in an instant and present to your department. Yes, I bet you can see how useful that would be! Stay tuned…

My Experience With The Apple Watch

I have had the opportunity to try out an Apple Watch (Sport model) for the last couple months, and I wanted to share my thoughts. This isn’t a comprehensive review with all the specifications and options — you can find those type of reviews everywhere — just my personal opinions and feelings about the product. I will also discus three different watch bands which I have tried out in another blog post (sport band, leather loop and milanese loop).

The Apple Watch is very nice. It’s a great piece of technology. It feels good and looks good, like you would expect from an Apple product. In a nutshell, it is something you can live without, but after a while you don’t want to be without. It’s a luxury and a convenience, but not a necessity. Conversely, I feel like my phone is a necessity. Want vs Need.

There are lots of times when your phone is stashed away somewhere, like your pocket or purse, and you get a message. With the watch, you can just glance at your watch and see who sent the message and what it is about. It’s easy to tap and send a one-word reply like “OK”, “yes” or “thanks”. Very convenient. With a little more effort, you can speak your response and it will be transcribed very accurately, or you can just send the audio. I do this many times each day without pulling out my phone.

Every push notification that comes to your phone will come to your watch automatically, with no set up. If the notification or message requires more attention, then you can pull out your phone (or iPad or computer) and deal with it that way.

When I am at home, I like to stash my phone somewhere and forget about it. My watch will let me know if something important requires my attention. I happen to play alot of softball and I stash my phone in my bag. While I am in the dugout, my watch will let me know if someone is trying to contact me. I’ve even responded to a text message while playing first base, as we had the first base dugout. When I exercise outdoors, I keep my phone stashed in a waist band and use my watch to monitor my progress (heart rate, pace, mileage, speed, whatever). When I exercise at the gym, my phone stays in a locker and my watch lets me know if something important comes up. (As long as your phone and watch are connected to the same wifi network, or are within bluetooth range, this works great)

You will be surprised how many times it’s just not that convenient to pull out your phone, or it’s not nearby. The watch is a great “notifier”.

I’m a geek, so I use the completely non artistic “modular” watch face. Yes, it’s fun to change your watch face to Mickey Mouse when you go out or something, but I rarely change it. I’ve customized the watch face to show me the date, the current temperature outside, the moon phase, my battery level (which has never gone below 50% so I dono’t need this anymore), and the next item on my calendar. Oh yeah, it tells the time too. In particular, I find myself checking the temperature all the time now that it is so convenient.

And there are lots of apps that run on the phone. It’s a bit awkward to find the tiny little “dot” icon and tap on it, then wait for the app to load as data is transferred over from the phone. (In watch OS 2.0, this will be much more speedy as then native apps will be possible that don’t need to transfer data to/from the phone all the time) Usually when I need more than just a quick glance of information, I’d rather pull out my phone with the larger screen than try to do the same thing on a tiny little watch screen. Once in a while though, if I can’t readily get to my phone, I’ll use an app. By the way, it’s ridiculous what some developers try to cram on to a watch app. Do you really want to watch videos or browse photos on a 42 mm screen?!?

OK, I hit the highlights of what I use my watch for. Back in the “olden times” when watches just told time, I didn’t find it worthwhile to burden my wrist. Now that I can do so much more, I gladly wear one. And by the way, the watch bands are just as revolutionary and cool as the watch itself, so it really feels good to wear. More on the bands soon…

Computer Programming is an Art

Programming is an art, not a science. Sure, you can say it is both, but the real value and the real separator between a good programmer and a bad programmer is not about the science. A good computer programmer is an artist, and takes pride in their work because it is well crafted code, not because it is clever or technically advanced or complex.

So what are the characteristics of good code? Well, being bug-free is ideal but is rarely achieved. Reducing bugs is not the main goal of your code, but it is really a side effect of good programming habits. You don’t write code with the express purpose of not introducing bugs, you write code with a goal of solving a problem. After all, what good is a 100% bug-free program that does nothing useful?

If you write code properly, it will be easy to find those pesky bugs. Don’t use the most esoteric and advanced language features, don’t condense your code into as few lines as possible, do use long and meaningful names, and do start with the simple approach. Readability is key here. Nicely crafted code should be easy to read with enough whitespace and comments that even a junior level programmer can follow it. Simple code equates to fewer bugs, and readable code makes bugs easier to find.

If you successfully wrote good code and solved a useful problem, then guess what happens next? You will want to change that code! Yes, the biggest compliment you can receive about an app is “I like that, but I wish it could do this…”. Some people get offended when they receive constructive criticism but that means people are interested enough to care. When you get the polite “that’s nice” comment, that is the kiss of death — that person is not interested, or thinks you are so far away from where you need to be, it’s hopeless.

OK, so you should plan for success, right? Success means changing your code to add new features or improve the app in some way. Now someone will have to read through your code and figure out the best way to make those changes. That someone may very well be yourself, several months into the future, when you may have forgotten the finer details. You will thank yourself for writing clear, readable code, and you will thank yourself for those comments!

What is the main enemy of well written code? You might say ignorance, that some people don’t care about readability, and that is certainly true. However, most of us know deep down inside what we should be doing. The main enemy is time. Deadlines. Being rushed. When we have limited time, readability (comments, for sure) can go out the window. We just try to get the darn thing working and move on to the next rushed project. I have been guilty of this many times, we probably all have once we get to the front lines of shipping products to customers. Customers and managers want everything done yesterday, right?

Do your best to balance the need to finish on time with the need to write clean, readable code. An extra hour today will probably save you three hours in the future. If the definition of success means you will change that code in the future, then try to do it right the first time and make your code readable. Sometimes, if you know there will be a version 1.1 update, you can get 1.0 out the door quickly and then spend part of the 1.1 schedule cleaning up the 1.0 code. There is usually a little more padding in the schedule after the first release. (That’s when the people who were demanding you work overtime to get them the product will tell you “Thanks. Oh by the way, I won’t get a chance to look at that until I get back from my European vacation in three weeks” : )

When you stop trying to be clever with your code, and stop worrying about bytes and milliseconds until you actually have to, that’s when you have turned the corner and are well on your way to becoming a computer programming artist.

Update: After I wrote this post, I read another blog post which says much of what I am saying here about not trying to be too clever. I think it is spot on.

I Don’t Need That To Do My Job!

…and I don’t either. But it’s nice to have : )

Emergency Response, and especially Firefighting, is a world steeped in tradition. There’s an expression that goes something like this: “200 years of tradition unimpeded by progress”. Well, that really isn’t true, but everyone would agree that changes come slowly in the fire service, and the old timers will raise an eyebrow at the latest high tech gadgetry.

If you dare pull out your smartphone and show off the latest cool app (from Peakview Software, of course) you might hear “I don’t need one of those gizmos” to fight a fire. Or my favorite “what are you  going to do when the batteries die. What then, huh?” they say with a smug smirk.

Well, of course nobody needs a smartphone to fight a fire, but that doesn’t mean it shouldn’t be a tool in your personal toolbox. Batteries die on radios all the time, but we still carry them, right? And GPS devices, thermal imagers, gas detectors, etc. We don’t need anything except water to fight a fire, but we still carry an assortment of other tools to make the job easier. And if a gadget breaks or dies, like good firefighters, we improvise.

When your radio dies or you can’t get through, it’s nice to have a phone for backup communication. Your smartphone is also a very nice GPS mapping tool, a camera, a notepad, messaging (text and email), and load with the right emergency response apps, it’s a world of other job tools all rolled into one. Why let the fact that it might die or you might break it stop you from having all those extra goodies available?

And boy, when you are sitting at the station with nothing to do, it is a great training tool. We have many study guides to get you ready for the next level or keep you sharp. You can use out hydraulics calculators to do some “what if” scenarios in seconds. Review checklists for all those special calls that you don’t do that often. Glance at some common hazmat response protocols. Look at predicted wildland fire behavior, record your cert dates or see what you need to do to recert, etc. That sure beats wasting all your idle time.

So yeah, I don’t need a smartphone to do my job, but it sure can come in handy quite often. And if the battery dies (which doesn’t happen to me, because I maintain it like I would maintain my personal radio), I’ll fall back to different tools and techniques to get the job done.

Working At Home

I’ve been fortunate to be able to work at home a good portion of my career. Fortunate is probably not the right word, as it took a series of tactical moves, planning, and willingness to take risks to get to this point. Even though working at home sounds pretty awesome, it’s not for everyone. You need a lot of discipline and you must set up the proper work environment to avoid going stir crazy or getting nothing done.

I thought I would share some of my “rules to work by” that I use to stay productive while working at home:

  • Treat this as a “real” job, and stick to a schedule. Whether you are working for yourself, or working for someone else, just because you are sitting at home doesn’t mean you can sleep late, have a long breakfast, take a break every 30 minutes, have a long lunch, go to the gym for an hour (or whatever), play with the kids all day, etc. For most of us, working Monday through Friday  with the goal of getting 40 hours of work done in that period is a good standard schedule, so do that or pick a different schedule, and stick to it. Try to get 4 hours of work done before lunch, limit your lunch break to no more than an hour, and get 4 hours of work done after lunch. If you want to go to the gym, fine, do it during your one hour lunch break and eat lunch at your desk after.
  • Prepare a good work space. You probably need a desk, your computer, a comfortable chair, and some room to work in an area that is designated as your “office”. It should feel like an office and you should do everything you can to make it productive for you, with no distractions. Don’t try sitting on the couch with your laptop on your lap, at least not often. There are too many distractions in that environment.
  • Have a remote workspace option. The neighborhood coffee shop is a good place to go to escape the distractions of home or family, but there are many distractions. Many towns have great options for shared office space you can rent by the hour or for a small fee each month.
  • Tell your family when you are working. Perhaps you have kids at home, or a spouse. Let them know the times that you will be working and that you should not be disturbed then. Close your office door and block out the distractions. Plan for a specific break time when you will come out of your office and socialize with them.
  • Maintain normal work habits. I don’t like to set an alarm unless I have to, but I give myself 30 minutes from the time I wake up to be working. I take a shower, shave, brush teeth, put on clothes (maybe not pants right away : ) just like I would if I was about to drive to an office. Breakfast is something quick that I might eat while working at my computer. Maintain the same routine every day.
  • No TV! You can’t watch TV at a regular office, can you? Then don’t do it at your home office. I have a rule that the TV doesn’t come on until after my work day is done. There is no such thing as a quick TV break — it will end up much longer than planned.
  • Cabin Fever. If you don’t talk to anyone all day long, I tend to get a little cabin fever and crave a little human interaction. Going out to lunch helps, as does using a remote work space. Meetups are another great way to socialize and learn at the same time.
  • Schedule in some research and learning time. If you are working for someone else, you need to get your assigned work done, but you will be a better employee if you keep up with the latest industry news and trends, so it’s OK so spend a few minutes each day surfing the internet in a productive way. Likewise, if working for yourself, you don’t want to fall behind the latest state of the art techniques in your field.
  • Be your own CEO. Hold yourself accountable. Look at what you accomplish each day and imagine reporting your daily or weekly status to a boss. Would he or she be pleased with your work? You can even use a spouse or friend as a stand-in for the “boss”.