The Big Nerd Ranch Experience

Big Nerd Ranch Training – Seven Days of Intensive Swiftering


I have done Android development for the past four+ years. I have suffered Eclipse, switched to IntelliJ IDEA 11 (at the time) and at some point made the switch to Android Studio.

This apparently gives me the title of Senior Android developer; I wanted to be a Senior Mobile Developer, and Swift 2.0 seemed like a good excuse. I have touched Objective-C like… years ago, when it didn’t have ARC and only for Cocoa (Mac), not iOS.

With these credentials, I enrolled in the Beginning iOS (iPhone/iPad) with Swift course from Big Nerd Ranch.

This short story is a description of what happens at the Asilomar Conference Center during those seven days…

The Days Before

Once you complete the registration and pay, you’re given a few links and PDFs to pre-read. You’re also invited to register at their Nerd Association forums, since that’s the only contact you have with other students and the teacher (especially before the class). Do it and post stuff, my class was very silent and it would have felt better if people posted something there.

Read the material you’re given. In my case it was a simple PDF with 8 chapters of Swift. If you already know any language, the idea is that you have to be able to declare a simple for loop and iterate an array, create a switch statement and or print stuff to the console. In other words, get your machine ready, if in doubt, ask in the forums. The instructor will reply.

The more comfortable you are with Xcode and Swift (or Obj-C if that’s your class) the easier it’s gonna be for you during the first two days when the language gets introduced to you. You will start flying past the “Language” chapters and if you’re familiar with the core concepts, as you approach the end of Sunday, things will be easier. And you will need the language to learn iOS later… so be prepared.

What To Pack

They tell you what you need, and depending what time of the year is your training, you can get awesome weather or cold rainy days.
If the forecast looks good, bring flip-flops and shorts, it can get hot. But always pack for a cold rainy day. Always.

Bring clothes for seven days, and remember, you don’t need to be formal, most people will be wearing t-shirts or short-sleeve-hawaian-shirts… like, perhaps, your instructor… ;)


I drove there. I live in San Francisco, so it was a two-hour, twenty minutes drive. I left SF on Friday around 1pm and got there around three thirty PM. There wasn’t a lot of traffic, but it was not an empty highway either.
The arrival was strange, because I kinda felt I was the first person, which was totally fine, you will meet the rest of the people at 6pm for dinner so don’t panic.

There’s plenty of parking inside the complex, find a spot or ask the staff, they will tell you which one is closer to your room.

You will be given vouchers for ALL meals for ALL week. That’s over 21 cards, color coded. Keep them in the tiny envelope they give you. Don’t lose them.

Also keep the map of the complex, it’s big and buildings have names like “Manzanita” or “Pirate’s Den”, so you better have a map around, especially the first couple of days. (You can see the map here)

Keep in mind that Asilomar is not a private Big Nerd Ranch complex, this is a big place with lots of buildings. It kinds of look like a University Campus, but way cooler and quieter.

You will likely be greeted by Squirrels, Deers and Warning Signs about Mountain Lions and what to do. I have seen lots of squirrels, deers, birds and spiders, but no Mountain Lion. In any case, if you’re afraid of squirrels, you should perhaps chose the Atlanta alternative.

mountain lion

A very descriptive warning. We have yet to encounter one. 

It’s a hotel, so expect to “check-in” like any other mortal tourist. You don’t have to checkout, but you will need a Credit Card for “damages”. You can also charge stuff to your room when you buy stuff at the Cafe or the Restaurant.

Ask and they will know where “Big Nerd Ranch” is meeting for class (tomorrow) and also locate the Dining Hall (it’s very close to where you check in). Meet everybody there at 6pm on Friday if you can make it.

What knowledge should you have…

The more (relevant) stuff you know, the merrier, of course. But there’s one thing that helped me a lot throughout the week.

Version Control. Yes. That is git in this case (since that’s what Xcode creates for new projects). You don’t need to be The Git Master, but if you’re comfortable creating branches and committing to them, it will make your life easier, not to mention you can look at changes and whatnot.

More often than not, the book will end with a series of “Challenges” (all optional). Since they are optional challenges, the book doesn’t assume you’ve made them, in fact, there are no solutions that I could find. It’s up to you to do them and/or to find your solution(s) (even tho the Instructor will be more than happy to be there when you need him, time permitting).

By having Git, you can easily branch before starting the challenge, commit to that branch, and eventually switch back to “master” to continue with the next chapter in the book. Otherwise, the challenge may make your project hard to integrate with whatever you have to do. It happened to me the only time I forgot to branch. Eventually I cherry picked the changes and with some git-fu, I was back on track.

You don’t need to be a git genius:

I followed this practice:

  1. If the project is new, make sure you have the “Create Repository” checked in Xcode.
  2. If the project continues on a new chapter…

Create a branch for chapter 21 for example:

git checkout -b cp21_core_data

…do some work…

git commit -am “working on core data”

…do some more work…
git commit -am “finished chapter 21, core data integrated”

Now Branch for a challenge:

git checkout -b cp21_bronze_challenge

git commit -am “bronze challenge complete”

And eventually return back to master to move forwards…

git checkout master

git checkout -b cp22_more_core_data
and now you continue with chapter 22… without the bronze challenge.

As you can see, this allows you to keep track of everything you do and even upload to github if you want in the future. But the whole thing helped me a lot and I recommend you do it.

I use the terminal for the most part, but a visual git tool is useful, especially the free Git Up.

Also memorize some of the Xcode most common shortcuts, they will speed you up, since Xcode seems to revolve a lot around the concept of using the mouse/trackpad… that feels like a waste of time almost always (except when connecting outlets and actions and when dealing with AutoLayout).

I have shared this pdf with the class. Have it around.

The First Day

You will meet almost everyone for breakfast at the dining hall at 7:30 am! Be there on time at/around 8:30 am everybody will head over to the class.

The first day everybody is quiet, fresh and has no idea what to expect. Just find a spot (be early!) plug your machine and chill.

For your language of choice (Swift) you will use Playgrounds a lot, so have a nice folder somewhere like ~/training/ and save your playgrounds like: Day 1 – If Statements, Day 1 – For Statements, Day 1 – Arrays, etc… it will help you locate them later (and you will want to go and check them out during the iOS portion of the training).

You will also learn about this hard truth…


Inexplicably, after twelve years of existence, Xcode can’t rename a variable in Swift. Granted, Swift is new but… Xcode 7.01 behaves like Notepad sometimes, and sometimes you wish it behaved at least like Notepad. Xcode crashed on us more times than Windows ME with USB devices go figure!

Do go for the afternoon walks (at least the first days), it’s a refreshing change and the place is beautiful. Your brain will appreciate it.

Do write the Wi-Fi password down somewhere. You have to sign in a few times like a hotel and sometimes your Mac “forgets” the password. The Guest one is easy, but that’s not too fast :/

Speaking of Internet, don’t expect to have fiber/cable speeds. It works, but you will notice how slow it is (especially if you are used to fast Internet at work/home). Don’t expect to use your tethering a lot either, T-Mobile worked, but it wasn’t “awesome”.

The iOS Days

After two days of Swift (or Obj-C if that’s your course), on Monday, you will start with iOS. This is when things start to get interesting, and also when you start getting tired, waking up early, sitting all day, listening and reading, it’s tiring if you’re not used to be in front of a computer for long periods of time.

I recommend you drink a lot of water too… and coffee (or Tea)

Now you can use Git a lot for your projects (no more playgrounds!) so remember the tips above.

Additionally, use Notes (or Evernote or whatever you want) to keep minor annotations around. Look at mine at the end:


It’s very useful to keep notes!


Every evening, you have the chance to attend optional Labs. That is, to keep going from 7pm until any time you wish. The instructor usually leaves around 9pm, but you can stay longer if you wish.

Do not stay until super late. Especially the first days, since you will be tired by the end of the week. Staying a couple of hours is fine, but if you’re tired, just go to your room and sleep. It’s fine.

Try to save energies for Thursday night (last lab) since that’s where the most interesting parts and perhaps longer projects will be in full effect, so you will want to be there; you will likely have more questions and a better idea at that point.

Drinking alcohol is allowed, I guess… so enjoy it, but I don’t recommend getting wasted or you will regret it the entire week…

As Friday Approaches…

The last two days are good, because you move fast, but you’re also tired and if you feel like you were “left behind” it may be hard to catch up, so try to use the lab times to catch up if you believe it may help you.

There’s no rush, as long as you pay attention when your instructor is talking; he is the most valuable resource in the room. Yes, you will keep the printed book, but the book won’t talk back to you and may not answer your questions, so use the instructor time as much as possible. By this time you will be familiar with the mechanics of the class so optimize your time, but do stop what you’re doing and listen when the instructor talks, you may learn more than you think.

I can’t stress this enough. In my class not everybody was paying attention (because they were working or doing something else) and I felt like they were wasting money…

Remember, this course is not free, nor cheap (even if you didn’t pay like I did, it’s still money), so try to get the best out of it; for your own sake, it will make you a better developer.

Speaking of the books, you do get to keep the printed editions of both and a printout of all the slides presented during the seven days. At the time of this writing, the Swift book was in beta so it contained some errors and weird stuff (especially the code samples). Under normal circumstances, you would be given a hard copy of the printed book, but since they weren’t printed (for Swift) yet, we just got the PDFs and the draft printed copy. If you’re flying, it may not be worth to carry these big four books with you, so leave them and your instructor will recycle them.

I kept the four of them because I wrote on notes and because I drove, so weight was not an issue. If anything, I do recommend you use the slides to write notes down, it’s just a draft after all, not a real book and there are way fewer pages in those two (one set of slides is for Swift, the other is for the iOS part). Hopefully, future students will get a real book when it’s their turn.

And hopefully, Xcode will be more stable… and Storybooks… and … well… that would do.


Friday is a mixed-feelings day. On one side you are eager to finish the book but on the other side you go to lunch and then you just say goodbye. It felt good to drive back home, but at the same time, you wish you could go back there on Monday to learn more and more. Much like personalized college. :)


We all look relieved that this is about to end…

The obligatory Group Picture was taken with an iPhone 6s Plus pink gold and an iWatch that acted as a remote.


The place is great. My instructor was great (Thanks Scott!), he was full of stories back from NExT, Sun Microsystems and even Apple and he does very decent margaritas, not that I’ve tried them, but I’ve been told ;)

If you were wondering whether you should spend over five thousand dollars in this, well the answer depends on what kind of background you have and how easy it is for you to pick stuff.

Can you just buy the book and do this on your own?

Yes. But the experience is never going to be the same. And you won’t have an instructor to talk to. You will lack the finesse, and the tips and the tricks. You won’t see him make mistakes and suffer Xcode 7 crashes and bugs and above all, you will need to have a lot of dedication to spend 7 full days studying like a champion. Oh, and you won’t have a T-shirt and a Diploma ;)


I made it, I am a bad iOS Developer

Did it meet my expectations?

Yes. In all honesty, it didn’t greatly exceed my expectations.

I was perhaps expecting a more even field when it comes to knowledge. Our instructor did a fantastic job in keeping up and moving everyone at the same time, but I felt like I was in the group of people with the most experience in the room (we were a few), whereas some others were less prepared for this. Don’t get me wrong, I would do it again, even if I knew this, but it would have been nice to have more people with similar experience, so perhaps we could have focused on more and more details that we had to leave behind for obvious reasons. Perhaps that’s why they have an Advanced version of this ;)

All in all, I have to remember it was for Beginners, but their website and notes are very intimidating with phrases like: “if you’re not a good typist and this or that you will have troubles following…“. I think we all did a very decent job and completed the course with no problems, even when some people didn’t really fit in the above.

Some of us have likely finished this week with a lot of questions like where do I go from here?. Some others will have to go back to the Swift book and re-read the basics, but eventually, it is clear for me that in these seven days, you will learn iOS. We’re all very bad iOS developers, that’s for sure, but I have no doubt that all fifteen can become proficient, given enough practice and time. There were some interesting projects happening during the Labs, you will likely hear about one or two eventually… the guys were very serious about it :)

In conclusion, go ahead and do it, the place is great!

Now enjoy some random pictures.


Relaxing after class…


My room was in this building, Manzanita means Little Apple (Pun?)


Scott trying to teach us Swift…


This is the class room, pretty cool huh?


Deers are around…


We also had a fireplace in the classroom! Woot!


The beach is 3 minutes away and… looks awesome too :)


…but it must come to an end…


Thank you, Big Nerd Ranch and thanks to BlackPixel (My employer!) for letting me spend seven days in the beautiful Pacific Grove, sitting with nerds and their Macs ;)
… and maybe, only maybe, drinking a Margarita or two.

p.s.: I really wish the class included Aaron’s hat as a gift as well!

Smartwatches – LG Urbane

Smartwatches – LG Urbane

I have spent roughly two weeks with an LG Urbane. I won’t cover it in details nor perform any sort of review. I think that the LG Urbane is perhaps the best Android Wear/Smartwatch you can buy right now (and also perhaps the most expensive at 300 USD), however, I think you should not buy one at this time.


It’s useless, expensive, buggy and doesn’t really do anything better than your smartphone.

Are you Nuts?

Before you go coo-coo trying to defend your nice 300 dollar piece of smartwatch, read a little bit more.

The LG Urbane is really nice. The band could be better, I don’t like it to be honest; I will likely get a metal one. But who cares about that? The important part is the smartness of the Watch.

Let’s avoid Apple Watch (this being the only time it will be mentioned) this time. I can only describe a smartwatch, any smartwatch as an extension of your phone. A faster way to read your notifications and sometimes to interact with them. I get it. I like the idea. But it’s not enough, it’s erratic, sometimes doesn’t work, etc., but above all that, it’s not worth 300 dollars.

Let’s be frank here. It’s three, hundred, dollars.

I will save you the trouble.

On a scale from 1 to 10 where 1 is no way and 10 is GET ONE NOW, I give any smartwatch a three.

There’s no real need to have one. You will only use it to check the time, delete unwanted emails and/or replying the ocassional text.

The Fit part, well if you’re into that, but I’ve noticed battery life suffers a little bit more when the fit thing is on all the time.

Now, if you grab all smartwatches and normalize the scale again so it goes from 1 to 10. I think the LG Urbane is one of the best ones at this time. I haven’t tried many. I’ve seen a few, only interacted with Moto 360s (1st Gen) and the fruity company one. (Sorry, I mentioned it again!).

I give the LG Urbane a solid 8 in my new scale. It’s good. It’s buggy sometimes. It slowsdown when it feels like it, etc. But most of these things have to do with Android Wear not being 100 polished yet and my idea that smartwatches suck no matter what.

The Moto 360 is a joke, its battery life is a joke.

The LG Urbane does a little bit better, provided you don’t do any stupid thing with it (as in, touch it ever 30 seconds to check the weather), you will have 1.5 days of battery life on average. You will still want to charge it every night…

Wi-Fi is nice, when it works. It will be better. But the fact that you don’t have to rely on Bluetooth is nice.

Can it get better?

Yes, and it will. Just give it time.

My Biggest Gripe:

When I cross my arms, the worst decision of all times reminds me that someone, for some reason, thought that press and hold on the watch’s face, should activate a face change feature. Needless to say, this feature activates with haptic feedback, so your wrist is nudged every time. How many times are you going to change your watch’s face? Really. A double tap would have been better. I don’t know. I might even write my own face that captures taps and returns true. Trust me, it’s better than a nudge when you cross your arms.

We’re not alone.

Some people keep telling me that they cross their arms the other way around (so their smart watch is on top). Good for them, but I don’t and I don’t feel like changing 40 years of expertise in arms-crossing-technique.

I guess I’m just holding it wrong™.

You're Holding It Wrong

Note: the solution for now is to double press the hardware button (which the LG Urbane has) to enter Theater Mode which disables the screen… along with the nice ambient-mode that leaves the screen dimmed and on at all times (with optional faces, which is nice).

Single tapping the hardware button turns the mode off and you’re back to normal, but this defeats the purpose of the ambient mode – always on thing. Might as well have that disabled and save the battery. That also means your smartwatch is in a comma state where you don’t get to see notifications by merely looking at your wrist, you have to use your other hand (unless you’re some kind of alien) to press the hardware button.

So no, that’s not a solution, it’s a “well at least this doesn’t bother me all the time” kinda thing. Read more about Theater Mode here…

What to do?

Just save the mula, you will need it soon for something cooler.

But You want to spend the money, huh?

Then buy an Urbane. Don’t wait. And if you really think that Smartwatch XYZ coming soon is better, then wait, why are you reading this? As better as your XYZ will be, it will still be the same thing, for now. We have to wait. At least this is not Google Glass.

Happy Smartwatching, said no one ever.

Espresso Cup Safety Board

Espresso Cup Safety Board

I have solved two mysteries this morning.

  1. Yesterday I was looking for my 4th espresso cup, thinking I had left it somewhere in the house.
  2. I have also determined that my espresso cups cannot whit stand a drop from 10+ ft.

Espresso Cup Safety Board Report:

During the morning of 5th of September 2015, shattered glass was found in the 50/52 side of our building. No missing reports were officially filled at the time, but there was one missing cup. A neighbor issued the alert upon discovering the crash site.

The ECSB determined that the glass was mine because it explains why my 4th cup is suddenly missing; inspecting the wreckage site, I found pieces of glass that correspond with the ones found in the other three espresso cups.

The trajectory and velocity seems to be consistent with what a cup of a similar espresso cup’s mass would follow pre-impact if the starting point was my kitchen window and no external forces where applied other than Gravity and standard atmospheric pressure.

There was no evidence of pre-flight explosions or fire of any kind before impact.

When the ECSB inspected my kitchen, they detected a missing vibration absorbing pad at the bottom of my espresso machine; this is used to reduce vibrations while brewing. On the day of the accident, the pad was removed by a technician for cleaning. The technician in charge didn’t put it back until the next morning. The technician was my mother, which was unfamiliar with the procedures.

It is known that making espressos in that machine without the pad, causes enough vibration to shuffle/move objects in the counter, as specified by the espresso machine manufacturer and personal experience.

Based upon the above information, the ECSB determined that:

  1. The glass is mine.
  2. The cause of the drop can be attributed to the barista in charge (me) for: “Failing to observe window position when security vibration pad is out of place and inability to realize the vibration pad was out of place overnight or during brewing operations, which lead to an espresso cup to move out of place and rest in an unsafe location”.
  3. The mug was affected by Earth’s gravity and therefore fell from its position to the concrete ground down below, shattering upon impact.
  4. The old saying that “if a tree falls in a forest and nobody hears it, did it really fall?” has proven to be inaccurate. This espresso cup fell and nobody heard it, yet, we have enough evidence to conclude that it actually happened.

The ECSB Recommends:

  1. Clean debris/impact site: [✓] Done
  2. Ensure window is not left open when dangerous operations are conducted in the counter.
  3. Ensure the vibrations pad is in place at all times and replaced immediately upon removal, especially overnight or during laundry/washing operations, which cause a structural shake to the whole house.
  4. Train new baristas about the security operations and procedures with the machine and security devices and operations.
  5. Improve Espresso cup missing and rescue operations, instead of foolishly wait for it to magically appear, issue an immediate search and rescue operation, even outside the premises, since objects are not known to vanish from the air without being actually re-located by an external force.

San Francisco, September 2015.

Adding multiple clicking regions to an Android TextView

At work I was asked to make a list of tags clickable. The list of tags came from the API in a comma separated list. So it looks like this:

tag1, Tag2, tag3, TAG4, etc. 

This is nice because I don’t need to worry about displaying it correctly. It’s the API’s job to send me the data.

If you take a look at the XML for the Layout, it’s very simple:

style="@style/mix_list.tag_cloud" />

And the style is very straightforward too:

<style name="mix_list.tag_cloud">
 <item name="android:maxLines">1</item>
 <item name="android:clickable">true</item>
 <item name="android:ellipsize">end</item>
 <item name="android:singleLine">true</item>
 <item name="android:lineSpacingExtra">1sp</item>
 <item name="android:textAllCaps">true</item>
 <item name="android:fadingEdge">horizontal</item>
 <item name="android:paddingLeft">10dp</item>
 <item name="android:textColor">@color/black</item>

The initial requirement was to show tags in a single line and if there were more, just add the ellipsis “…”, and this worked fine. No need to use anything other than a single TextView to display the data. Android took care of everything. All was good until I was asked to make the tags clickable. So if the user taps tag1 the app should react to that and do something (in this case, a new Activity is launched and the tag1 is used to obtain data). After testing different approaches, this is the easiest I could come up with. I didn’t want to mess with the Layout, one TextView was fine and dynamically adding TextViews (with their ClickListeners) would have been a pain in every possible way, so I resorted to the SpannableString and it’s various incarnations. Before the change, I was simply doing this in my ListAdapter (notice I’m using a ViewHolder pattern):


I needed to change that now. So I created a small method which does it for me:

makeTagLinks(item.tag_list_cache, holder.tagcloud);

This small method looks like this:

1	private void makeTagLinks(final String text, final TextView tv) {
2		if (text == null || tv == null) {
3			return;
4		}
5		final SpannableString ss = new SpannableString(text);
6		final List items = Arrays.asList(text.split("\\s*,\\s*"));
7		int start = 0, end;
8		for (final String item : items) {
9			end = start + item.length();
10			if (start < end) {
11				ss.setSpan(new MyClickableSpan(item), start, end, 0);
12			}
13			start += item.length() + 2;//comma and space in the original text ;)
14		}
15		tv.setMovementMethod(LinkMovementMethod.getInstance());
16		tv.setText(ss, TextView.BufferType.SPANNABLE);
17	}

Let’s go through the relevant pieces.

The first thing to notice is that we only use one SpannableString and and then we define regions (spans) inside it. List of tags is automatically split thanks to Java (line 6).

Two auxiliary integers are used (start and end) defined in line 7. The values of these will increment as we move through the tags.

So the loop is a Java 5.x iteration though a List<String>. Nothing fancy. (Line 8).

In Line 9 we start the magic. First calculate the end of the Span. In the first iteration, start (and end) are both zero, so the end is basically the size of the first String.

Line 10 is a security check, if the start went beyond the end, just skip it (that means you’re probably done).

Line 11 is the real magic. Defines a new ClickableSpan from start to end. The MyClickableSpan is a small class that we’ll see later, but it could have been any other type of span (Color, style, etc.); you can even define multiple spans for the same region. We don’t use flags, but you should read the class in Android to see what the flags are, but chances are you’re not going to need them.

Line 13 moves the starting point forward. Since the original text had a comma and a space separating the tags, we need to account for these two characters when moving forwards, because we’re iterating the Strings in the List<> but the span has the whole text. So the start adds the item length plus two more spaces (comma and space between tags). The loop iterates and we get a new string. Start is now positioned at the beginning of this string, so we recalculate the end, which is now start plus the new item length.

Rinse and repeat.

The final two lines 15 and 16 are important. If you don’t set the MovementMethod, it’s not going to work.

Like my friend Jeff Atwood uses to say, read the source, Luke. Here’s what the source code for setMovementMethod says:

* Sets the movement method (arrow key handler) to be used for
* this TextView. This can be null to disallow using the arrow keys
* to move the cursor or scroll the view.

Hmmm ok… doesn’t really say much. What is a MovementMethod anyway? It’s a Java Interface (Protocol for those Objective-C guys) that…

* Provides cursor positioning, scrolling and text selection functionality in a {@link TextView}.

So in line 15 we provide the default implementation, so the tags are “moveable” (it sounds weird).

And this is how it looks in the Android source code:

* A movement method that traverses links in the text buffer and scrolls if necessary.
* Supports clicking on links with DPad Center or Enter.

So by passing an instance of LinkMovementMethod, we’re providing out TextView with all this power!

Anyway, in line 16 we just set the text of the TextView to be the SpannableString and we tell it that the Buffer is Spannable. It’s worth looking through the TextView source code to see what all these things do. There’s a lot going on behind the scenes and it’s always interesting to see “how they did it”.

And that’s it. The only mystery is not to reveal what MyClickableSpan is. You will be disappointed.

private class MyClickableSpan extends ClickableSpan {
   private final String mText;
   private MyClickableSpan(final String text) {
      mText = text;
   public void onClick(final View widget) {

Yes, that’s all. I just wanted a ClickableSpan that could store a String (the text associated with the “span”).
Wait, what is mListener?
Just an Interface/Callback that was passed to this Adapter that has one method. onTagClicked(String). In my particular case it’s a Fragment that handles this tag clicking thing, but it can be anything you want.

And that’s it! I’m not sure if this is simple or not, the documentation is not very clear and there are way too many classes floating around…

In any case, just experiment and remember your allies: Google and StackOverflow but don’t become a CopyPaster. Read what the code does, try to understand every single line and ask if you don’t understand what it does. You will be surprised how much you can learn by just reading code.