Aaron Hillegass - Big Nerd Ranch Fri, 11 Mar 2022 16:33:25 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 Where Servers Are Going https://bignerdranch.com/blog/where-servers-are-going/ https://bignerdranch.com/blog/where-servers-are-going/#respond Sun, 28 Oct 2018 09:00:00 +0000 https://nerdranchighq.wpengine.com/blog/where-servers-are-going/ I wonder, however, if Cloud-related technologies have received all the attention and left no space to discuss other trends. In this post, I thought I would mention some interesting stuff that the web team at Big Nerd Ranch is working on.

The post Where Servers Are Going appeared first on Big Nerd Ranch.

]]>

There was a brief era when everything had “Flavor Crystals:” chewing gum, deodorant, sports drinks mix, toothpaste, air fresheners, whatever. If you had a product, it could be made more compelling with flavor crystals. When the term “Cloud” was first coined, it simply referred to the idea that computing power on the Internet should be bought and sold like electricity. Gradually “Cloud” has taken on lots of meanings and become the Flavor Crystal of the modern IT world. I wonder, however, if Cloud-related technologies (including DevOps and containers) have received all the attention and left no space to discuss other trends. In this post, I thought I would mention some interesting stuff that the web team at Big Nerd Ranch is working on.

There are three big trends that are pushing server-side innovations:

  1. The next billion users are in the developing world, where connectivity is not as reliable.
  2. Users are expecting real-time collaboration.
  3. The Internet of Things will begin to generate billions of streams of events to be processed and stored.

Let’s start with a reaction to the first trend: Facebook acknowledged the growing importance of users in the developing world by creating the Facebook Lite app for Android. In their write up about Facebook Lite’s architecture, they describe a system that:

  • Doesn’t use web services, rather it communicates over raw TLS.
  • Compresses messages in each direction.
  • Pushes assets before the client requests them, where possible.

Thus, Facebook is able to create a very responsive user experience over 2G networks.

For twenty years, we have been writing servers that respond to HTTP requests coming in from clients. And now Facebook is writing a server that doesn’t use HTTP?! And the server doesn’t wait for requests, but pushes stuff to the client that it thinks the client might need?! Everything has changed.

Second trend: users want to collaborate in real-time. If one user changes a piece of data while another user is looking at it, the server should push the change to the client. How do we write clients that are always listening for new data from the server? How do we write servers that perform two-way communications over WebSockets?

Third trend: The Internet of Things means that billions of new devices will be given IP addresses and put on the internet. And then they will begin to spew events. Processing and storing these streams is leading to a lot of interest around stream-processing technologies (like Apache Kafka) and databases that deal with time-series data with grace (like Cassandra).

Just like a collaborative app, a thermostat on the internet demands two-way communication with the server. The thermostat sends a stream of temperatures to the server and waits to get orders from that server.

Learning From Game Companies

Fortunately, there are engineers who have been working very hard to create servers that can support two-way communication with millions of clients: the servers for massively multiplayer online games. If you want to know what the future of client/server communication looks like, think of World of Warcraft. Each server will have hundreds of thousands of clients attached. For each user, the server will have a socket open to the user that will enable two-way communications.

In the game server development community, there are two popular approaches to this problem. One approach is to have a single-threaded server that never blocks. The poster child for this approach is Node.js. The other approach is to use a language with very lightweight threads so that each socket can be monitored by its own thread. The poster child for this approach is Erlang.

At Big Nerd Ranch, we appreciate both approaches. We teach how to write a chat server using Node.js in our book “Front-End Web Development: The Big Nerd Ranch Guide”. However, we find Erlang’s approach (lightweight threads coordinated using message passing through channels) to be consistently elegant and efficient. Erlang’s syntax can be a bit inscrutable if you haven’t worked in it before, so we typically work with its cousin Elixir. Erlang/Elixir also comes with OTP, a very mature and sophisticated framework for developing networked servers.

How We Can Help

Maybe you are thinking about developing a mobile or web app that requires more sophisticated server smarts than your team feels comfortable creating. Big Nerd Ranch can help.

The post Where Servers Are Going appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/where-servers-are-going/feed/ 0
Introducing: The Frontier https://bignerdranch.com/blog/introducing-the-frontier/ https://bignerdranch.com/blog/introducing-the-frontier/#respond Thu, 12 Oct 2017 10:00:53 +0000 https://nerdranchighq.wpengine.com/blog/introducing-the-frontier/ Big Nerd Ranch was founded on the idea that developers learn best when immersed in a distraction-free environment. Today I want to talk to you about a new path to advance your skills; one that doesn't look like anything we've offered before.

The post Introducing: The Frontier appeared first on Big Nerd Ranch.

]]>

A Powerful New Path to Advance Your Skills

Some exciting changes are up ahead for Big Nerd Ranch, and those changes are called The Frontier. Before I get into the nitty-gritty, I want to lay some background for you. If you’ve been around these parts for any length of time, you’ve heard me talk about the importance of in-person training. That belief is at the core of our mission, and it informs the way we run our corporate training as well as our immersive bootcamps. And that model works. We’ve taught over 17,000 developers and designers in bootcamps since 2001, and 19 of America’s 25 most popular apps were built at companies whose engineers were taught by Big Nerd Ranch.

Not-so-secret secret sauce

Our secret? It’s not so secret, really. We’ve got a great team. Our engineers are at the heart of everything we do; not only are they world-class developers and designers who build award-winning products for our clients, they’re also excellent teachers with a passion for sharing their knowledge with others. All of us at Big Nerd Ranch are obsessed with staying on top of the latest technologies and are eager to help you do the
same.

In which I eat crow

I’ve come to realize that, even if in-person trainings are the best way to acquire a new skill (and they are!), not everyone has the resources to dedicate to an on- or off-site training course. Nor does every skill you need to learn take a week to teach. Maybe you’re a strong iOS developer who needs some guidance on tvOS. Or maybe you’re curious about Kotlin but only have time to learn new skills on nights and weekends. Maybe you just got back from a Big Nerd Ranch bootcamp and are searching for a way to keep your skills sharp back home. We understand where you’re coming from. And it’s for you that we built The Frontier.

Announcing: The Frontier

The Frontier is Big Nerd Ranch’s newest offering, and it’s unlike anything we’ve ever done before. The platform is comprised of short, practical videos to help you navigate learning advanced skills for iOS and Android, with more to come. The same expert engineers who teach our courses, write best-selling books, and build amazing apps, will come to your screen, on your schedule, to help you try new things and get them done right the first time.

We are very excited to bring you a whole new avenue to engage with our instructors. We’ll be releasing more info about The Frontier soon, but I wanted you to hear it from me first. Stay tuned for more details on how this new offering can supplement the rest of your Big Nerd Ranch experience.

The post Introducing: The Frontier appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/introducing-the-frontier/feed/ 0
You Need a tvOS App https://bignerdranch.com/blog/you-need-a-tvos-app/ https://bignerdranch.com/blog/you-need-a-tvos-app/#respond Mon, 06 Feb 2017 10:00:53 +0000 https://nerdranchighq.wpengine.com/blog/you-need-a-tvos-app/ If current trends continue, most babies born today will never own a laptop or a desktop computer. They will carry a smart phone, and at home they will have a streaming device connected to their TV. That streaming device will run apps. And that leads us to why your company needs a tvOS app.

The post You Need a tvOS App appeared first on Big Nerd Ranch.

]]>

If current trends continue, most babies born today will never own a laptop or a desktop computer. They will carry a smart phone, and at home they will have a streaming device connected to their TV. That streaming device will run apps.

Every major company has embraced the importance of apps on mobile phones, but only a few (mostly media companies) seem to understand the importance of the apps that will run on these streaming devices.

Enter Apple TV

In March, Apple TV will have been shipping for a decade. While it got a slow start, I estimate (using other people’s surveys and Apple’s announcements over the years) that there are more than 40 million Apple TVs out there now.

It is one of the most powerful computers that you can buy for $149. Not to mention that Apple TV is used 25% more than Roku.

Opportunities

Every major media company has recognized the importance of Apple TV and released an Apple TV app, and Big Nerd Ranch has written some of them. Most of the first wave of popular Apple TV apps are content distribution apps and games.

What kinds of apps are likely to be in the next wave? We have some ideas:

  • Social Media
  • Education
  • Shopping
  • Travel Planning
  • Home Automation
  • Health and Fitness
  • Financial Services
  • Reference

Challenges

In creating tvOS apps, our designers have found that creating a clear, elegant user experience that can be driven by the Apple Remote requires taking into account many more additional factors than when designing for a mobile device.

We have enjoyed working with the tvOS SDK and find it very clean and elegant, but its frameworks are significantly less comprehensive than those of iOS or macOS.

Conclusion

Some projections of tvOS predict that the number of devices will increase by 50% per year (as they did from 2014 to 2015). This sort of growth creates huge opportunities. Big Nerd Ranch is committed to tvOS development, and we would like to help you develop your app. Talk with our sales team to get started.

The post You Need a tvOS App appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/you-need-a-tvos-app/feed/ 0
Use TensorFlow and BNNS to Add Machine Learning to your Mac or iOS App https://bignerdranch.com/blog/use-tensorflow-and-bnns-to-add-machine-learning-to-your-mac-or-ios-app/ https://bignerdranch.com/blog/use-tensorflow-and-bnns-to-add-machine-learning-to-your-mac-or-ios-app/#respond Mon, 19 Sep 2016 10:00:53 +0000 https://nerdranchighq.wpengine.com/blog/use-tensorflow-and-bnns-to-add-machine-learning-to-your-mac-or-ios-app/ Should you use BNNS or TensorFlow to add artificial intelligence to your iOS or Mac app? The answer is... both.

The post Use TensorFlow and BNNS to Add Machine Learning to your Mac or iOS App appeared first on Big Nerd Ranch.

]]>

With the release of macOS 10.12 and iOS 10, Apple has given users everywhere access to its Basic Neural Network Subroutines (BNNS, which we at Big Nerd Ranch feel should be pronounced “bananas”). Google open-sourced TensorFlow, its machine learning framework, nearly a year ago. Maybe you think it is time to add some artificial intelligence in your Mac or iOS application and are wondering which to use. The answer, for now at least, is you will probably use both.

But First, a Story

The summer after my first year in college, I had a terrible, terrible job on the night shift at a USAir customer service call center. This job mainly involved talking on the phone with people who hated me—a soul-bruising task. I knew someone who had a great job at the Mitre Corporation’s Advanced Signal Processing Lab, and I asked him, “What do I need to know to get a job like yours?” And he replied, “C programming on Unix.”

I went back to school and raised a ruckus in the Electrical Engineering department until they gave me access to a Unix machine, and I taught myself C. I got the job at Mitre, and I spent the rest of my summers in college doing machine learning experiments. In particular, I worked on speech recognition problems using neural networks.

Thanks to 25 years of video gamers who were willing to pay top dollar for good GPUs, a lot has changed since 1989. Neural networks involve huge amounts of floating point operations, so in 1989 we could only train and use the simplest networks. In 1989, if you sprang for a MIPS R3010, you would be delighted with 4 million floating point operations per second. Today, the Nvidia GTX 1080 graphics card (just $650) is 2 million times faster: it does 9 trillion floating point operations per second.

The Challenges

And this brings us to one of the challenges of using Google’s TensorFlow: The engineers who wrote TensorFlow implemented all the code to move the computation onto the graphics processor using CUDA. CUDA is an Nvidia-specific technology and most Apple products do not use Nvidia graphics processors. (There is an effort to rewrite those parts using OpenCL, which is supported on all Apple devices, but if you are using TensorFlow today it will not be GPU-accelerated on most Apple devices.)

Most deep learning techniques are based on neural nets. Neural nets are a rough simulation of how biological neurons work. They are connected in a network and the output of one neuron acts as one input to many other neurons. The network learns by adjusting the weights between the neurons using a technique called Backpropagation. (You can get more details from Bolot’s recent blog post.)

This brings us to one of the challenges of using Apple’s BNNS: There is no support for backpropagation—the networks don’t learn. To use the BNNS, you need to train the network using something else (like TensorFlow) and then import the weights.

The Solutions

Thus, there are two ways to get deep learning into your Mac or iOS application:

  • Solution 1: Do all the neural net work on a server using TensorFlow. You must be certain that all your users always have a good internet connection and that the data you are sending/receiving is not too voluminous.

  • Solution 2: Train the neural net using TensorFlow and export the weights. Then, when you write the iOS or Mac application, recreate the the neural net using BNNS and import the weights.

Google would love to talk to you about the first solution, so the rest of this posting will be about the second. I’ve used TensorFlow’s MNIST example: handwritten digit recognition with just an input and an output layer, fully connected. The input layer has 784 nodes (one for each pixel) and the output has 10 nodes (one for each digit). Each output node gets a bias added before it is run through the softmax algorithm. Here is the source, which you will get automatically when you install TensorFlow.

My sample code is posted on GitHub.

Getting the Weights out of a TensorFlow Python Script

If you train your neural net using TensorFlow, you will almost certainly write that code in Python. (There is a C++ interface, but it is very limited and poorly documented.) You will create a Variable tensor to hold the weights. Here I’m creating a two-dimensional Variable tensor filled with zeros:

    W = tf.Variable(tf.zeros([784, 10]))

You will give the neural net data and train it. Then write out the weights:

    weight_list = W.eval().tolist()
    thefile = open('/tmp/weights.data', 'w')
    thefile.write(str(weight_list))
    thefile.close()

This will result in a text file filled with arrays of floating point numbers. In my example, I get an array containing 784 arrays. The inner arrays each contain 10 floating point numbers:

    [[0.007492697797715664, -0.0013006168883293867, …, -0.006132100708782673], [0.0033850250765681267, …-5.2658630011137575e-05]]

Using Those Weights in a Cocoa Application with BNNS

This is a easy format to read in Cocoa. The sample code has some routines that will read one- and two- dimensional arrays.

Then, using BNNS, recreate the topology of the neural network that you created in TensorFlow and copy the weights in:

    BNNSVectorDescriptor inVectorDescriptor =
        { .data_type = BNNSDataTypeFloat32, .size = IN_COUNT };

    BNNSVectorDescriptor outVectorDescriptor =
        {.data_type = BNNSDataTypeFloat32, .size = OUT_COUNT};

    BNNSFullyConnectedLayerParameters parameters =
        { .in_size = IN_COUNT, .out_size = OUT_COUNT };

    float *weightVector = (float *)malloc(sizeof(float) * IN_COUNT * OUT_COUNT);

    // Fill 'weightVector' with data from a file here!

    parameters.weights.data = weightVector;
    parameters.weights.data_type = BNNSDataTypeFloat32;

    float *biasVector = (float *)malloc(sizeof(float) * OUT_COUNT);

    // Fill 'biasVector' with data from a file here!

    parameters.bias.data = biasVector;
    parameters.bias.data_type = BNNSDataTypeFloat32;

    parameters.activation.function = BNNSActivationFunctionIdentity;

    // Create the filter
    filter = BNNSFilterCreateFullyConnectedLayer(&inVectorDescriptor,
                                                 &outVectorDescriptor,
                                                 &parameters,NULL);

To use the resulting filter, supply arrays for the input and output:

    float inBuffer[IN_COUNT];

    // Fill inBuffer with input here

    float outBuffer[OUT_COUNT];
    int success = BNNSFilterApply(filter, inBuffer, outBuffer);

There is a big shortcoming here: Once you dump the weights out of TensorFlow, your application won’t get any smarter. At this time, BNNS doesn’t do backpropagation—it doesn’t learn. However, it will be GPU accelerated on any iOS or macOS device, which will make it faster and consume less power.

Note that TensorFlow is very extensive and has lots of operations that are not available in BNNS. When you are creating the topology of your neural network, use the operations that are available in both toolkits. If you don’t, you will need to implement the operation yourself. In this example, TensorFlow had a built-in softmax operation. I had to implement softmax to use it on the Mac.

This is a pretty poor solution, and eventually two things will happen:

  • Apple will extend BNNS to include training and backpropagation.
  • Google will get TensorFlow to be GPU-accelerated on all OpenCL-enabled devices.

However, for now, you will probably use both if you want to add machine learning to your Mac or iOS app.

Want more info on machine learning? Check out this post on getting started with Core ML, a new framework announced at WWDC 2017.

The post Use TensorFlow and BNNS to Add Machine Learning to your Mac or iOS App appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/use-tensorflow-and-bnns-to-add-machine-learning-to-your-mac-or-ios-app/feed/ 0
iOS Developers Need to Know Objective-C https://bignerdranch.com/blog/ios-developers-need-to-know-objective-c/ https://bignerdranch.com/blog/ios-developers-need-to-know-objective-c/#respond Tue, 10 Jun 2014 08:10:22 +0000 https://nerdranchighq.wpengine.com/blog/ios-developers-need-to-know-objective-c/

When Apple announced Swift, I heard a few people say “Hurray! Now I can be an iOS developer without learning Objective-C!” I have three messages for these people:

The post iOS Developers Need to Know Objective-C appeared first on Big Nerd Ranch.

]]>

When Apple announced Swift, I heard a few people say “Hurray! Now I can be an iOS developer without learning Objective-C!” I have three messages for these people:

  • If you want to be an iOS developer, you will still need to know Objective-C.
  • Objective-C is easier to learn than Swift.
  • Once you know Objective-C, it will be easy to learn Swift.

Before I proceed, let me preface this with a confession of love for Swift. The syntax is lovely. The Swift compiler will catch so many errors for us; I’m certain that when everyone is coding in Swift the reliability of apps will improve considerably. The enum construct is gorgeous. Swift is a major step forward for the entire iOS and Mac OS X ecosystem. But…

If you want to be an iOS developer, you will still need to know Objective-C

You can’t do everything in Swift. For example, if you want to use a library of C++ code in your application, you will need to talk to the C++ objects from Objective-C. Swift can call C functions, but I believe that if you are working with a lot of C functions and types, you will want to code in Objective-C.

The community talks in Objective-C. There are thousands of useful Objective-C snippets on StackOverflow and iOS dev blogs everywhere. Objective-C is the language we have used for the last six years to describe to each other how the Cocoa Touch libraries work. If you can’t read Objective-C, you won’t be able to understand this trove of knowledge.

The frameworks are written Objective-C. When you have a bug, it often doesn’t rear its ugly head until execution is deep in Apple’s code. If you want to understand what the debugger is telling you, you will need to understand Objective-C.

Objective-C is stable and well-tested. Swift looks great, but the language is evolving and the compiler is immature. If I were making a significant bet on developing an app this year, I would still use Objective-C.

Objective-C is easier to learn than Swift

C is a really simple little language, and Objective-C is a really simple little extension to C. Swift has many rules that Objective-C does not. (I, as an instructor, am already trying to figure out how I will explain the rules around optional variables and the proper use of ? and ! to signal the programmer’s intent around optionality.) These extra rules mean that the compiler can be much more pedantic about enforcing good coding practices, but it also means that the language will take longer to learn.

Objective-C requires programmers to be explicit. The Swift programming language lets the compiler do more work for the programmer. This is great—less typing for the programmer, right?—but it means that when you look at a line of code, it won’t mean much without a deep understanding of the context in which that line lives. Explicit languages are easier for beginners to understand.

Swift has a bunch of constructs that Objective-C doesn’t have. For example, generics make type checking better in Swift, but it makes that language considerably more complex.

Once you know Objective-C, it will be easy to learn Swift

To make Swift interoperable with Objective-C, Apple had to make Swift a lot like Objective-C. The difficult ideas that drive Objective-C like objects, strong and weak references, and inheritance are exactly the same in Swift—they are just expressed using a different syntax.

Honestly, it doesn’t matter which you learn first; eventually you will know both languages.

In conclusion, suck it up: You still need to learn Objective-C. I suggest starting with Objective-C Programming: The Big Nerd Ranch Guide or our Beginning iOS bootcamp. After that, you can start learning the Swift programming language.

The post iOS Developers Need to Know Objective-C appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/ios-developers-need-to-know-objective-c/feed/ 0
To the Graduating Class of 2014 https://bignerdranch.com/blog/to-the-graduating-class-of-2014/ https://bignerdranch.com/blog/to-the-graduating-class-of-2014/#respond Mon, 19 May 2014 10:10:22 +0000 https://nerdranchighq.wpengine.com/blog/to-the-graduating-class-of-2014/

Like most people over 40, I have lots of opinions about how people should live their lives. Recognizing that no one wants this unsolicited advice, I work hard to keep these opinions to myself. However, today Tasha (who curates our blog) asked me to write some advice to the young people who are graduating this spring. Thus, I’m about to blurt out some advice that I sincerely hope will be useful to you; I apologize in advance for being a preachy loud-mouth.

The post To the Graduating Class of 2014 appeared first on Big Nerd Ranch.

]]>

Like most people over 40, I have lots of opinions about how people should live their lives. Recognizing that no one wants this unsolicited advice, I work hard to keep these opinions to myself. However, today Tasha (who curates our blog) asked me to write some advice to the young people who are graduating this spring. Thus, I’m about to blurt out some advice that I sincerely hope will be useful to you; I apologize in advance for being a preachy loud-mouth.

Make yourself useful

On your deathbed, you should be able say, “During my brief stay on the planet, I made things a little better.” You don’t need to be Mother Teresa—just pick a career that requires useful skills and hard work instead of fast talking and luck.

On the practical side, it is important to remember that booms and busts are real. Today’s overpaid strategy consultant is tomorrow’s barista, but there is always work for a good plumber.

Leave your sense of entitlement at the door

This one is specifically for engineers. You are probably used to being the smartest person in the room. When you join a team of experienced engineers, you will need to adjust your attitude. Listen carefully to what a more senior engineer says, especially if he or she is critiquing your work. Try to get a little more adept at your job every day.

Don’t try to buy your identity

A car is just a way to get your body from one place to another. Thus, a great car is one that nearly always gets you there. Great shoes keep you from getting blisters and hookworms. And no one needs a watch now that we all carry phones in our pockets.

People who spend more than they can comfortably afford on cars, watches and shoes are suckers. They have been suckered by brilliant marketing departments who work around the clock to convince us that we can purchase dignity, joy and contentment.

When you take on debt, you give away some of your freedom. Anyone who forfeits their freedom trying to buy dignity ends up with neither.

Do or do not

In their 20s, most people expend a lot of energy on worry. The decisions you are making seem irrevocable and scary. Maybe you think that making the wrong decision will be catastrophic.

However, as someone who has made numerous bad decisions, I can tell you that the universe is a little more forgiving than you think. Stop worrying; if you make yourself useful, this world will make a pretty good place for you.

Don’t spend too much of your energy on guilt, either. If you make a decision that hurts someone, ask for their forgiveness and do what you can to make it right. Forgive yourself and try to do better in the future.

Don’t be self-conscious. You are who you are. If others can’t appreciate it, fuck ‘em. Honestly, if you realized how infrequently acquaintances thought about you, you wouldn’t even bother trying to guess what those thoughts were. Walk tall.

It was Yoda who said, “Do or do not. There is no try.” For recent graduates, it is slightly altered: There is no upside to wallowing in worry, guilt and self-consciousness, so just do or do not.

Integrity is important

There are very few things I’ve done in my life that I would be ashamed to share on this blog. I’ve done my best to have a consistent moral code and to live by it. At times, this code has kept me from taking actions that would have made things more fun or convenient or profitable.

But overall, living with integrity has made my life much easier. My family, my friends, my employees, and my customers trust me to do the right thing. And that trust makes everything I do easier and more effective.

The internet will amplify your reputation. If you consistently act with integrity and kindness, the internet will make everything you do easier. When you act small, the internet will make sure that everyone knows about it.

Believe in abundance

Why do people become greedy and fearful? That’s a terrible way to live, right? Most of the greedy, fearful acts I have witnessed have been committed by people who felt that they had to do whatever was necessary to get what they needed; that kindness and integrity were luxuries that they could not afford.

You will live a much happier life if you believe this one thing: There is enough for everyone to get what they need.

Is it true? I have no proof, but I choose to believe that it is. And I think this little bit of faith has made a huge difference in the quality of my life.

Never stop learning

When choosing a career or even a job, look for opportunities for long-term learning. Learning is what makes work interesting, and in the long term, interesting work will be more important to you than money or prestige.

(Quick plug: We are hiring at Big Nerd Ranch, and learning is treasured here.)

Take care of your body

Drink in moderation. Get enough sleep. Exercise regularly. Floss. This sort of care is the most important investment you can make; a healthy body will bring you joy every day, and you probably have many, many days in front of you.

Don’t be afraid to live

This one is the most important. Most of the regrets old people have are about things they didn’t do. So take chances. Get your heart broken. Bet on the underdog. Be the first person on the dance floor. Invite someone famous out for lunch. Make a scene in a crowded, quiet place. Flirt with old people. Go skinny dipping. Disappoint your parents. Fall in love with someone inconvenient. Hug people who expect handshakes. Life is an amazing gift; show your gratitude by really living.

And so, Class of 2014, congratulations on your graduation. I hope life brings you many challenges and delights. I hope you reach the end with many great stories and a few good friends.

The post To the Graduating Class of 2014 appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/to-the-graduating-class-of-2014/feed/ 0
Don't Start a Company, Kid https://bignerdranch.com/blog/dont-start-a-company-kid/ https://bignerdranch.com/blog/dont-start-a-company-kid/#respond Mon, 02 Dec 2013 19:45:22 +0000 https://nerdranchighq.wpengine.com/blog/dont-start-a-company-kid/ This post is about why starting a company is just dumb. And I know: I started a successful company.

The post Don't Start a Company, Kid appeared first on Big Nerd Ranch.

]]>

The day before Thanksgiving, I read a post on Hacker News:

Started a stupid company. Failed.

Ran out of money. Ran out of credit. Losing house in two months (already foreclosed). Wife pregnant. Three kids all under 6. Pretty sure I am the opposite of everyone here. I am no man. Just a statistic. Everything is gone. Selling spare parts to keep the lights on. It was a nice fantasy, HN. To the rest of you: fight hard and good luck.

In January, I’m going to wander from college to college begging the soon-to-graduate to apply for jobs at Big Nerd Ranch. Several of the most promising will tell me something like, “I’m starting a company with a friend. It is like Instagram for pet owners.”

This post is about why starting a company is just dumb. And I know: I started a successful company.

You are more likely to fail than you think. Nearly every story that you read about the founding of a company is one that ends with a successful company. In reality, most companies fail. This survivor bias is well-known, and I would not belabor the point, except that it is exacerbated by the next point:

The role of luck in success or failure is underestimated. You have a good idea? You are the smartest guy you know? You have a mature business advisor? So you think, “The ‘most companies fail’ rule does not apply to my company.”

You have wildly underestimated the role of luck.

Let’s take me as an example: I was a smart guy with a lot of real-world experience. I decided to start a professional services company for Apple technologies when Apple’s stock was below $10 per share. I had worked in the professional services team at NeXT and Apple, and I thought there was an opportunity doing training and consulting on Objective-C and its related technologies. I ran around explaining the beauty of these technologies to anyone who would listen, and Big Nerd Ranch managed to grow to seven employees.

And then, in 2008, Apple released the iPhone SDK and the seven of us were suddenly the best programmers in the hottest technology that had ever existed. Today we are more than 100 employees and we are world-famous experts in iOS, Android, JavaScript and Ruby. We have offices in Europe and Latin America.

Being smart and hard-working got me to seven employees. Luck took me the rest of the way.

If you read interviews with successful entrepreneurs, some will tell you that having the right people is the most important part. Others will say that a carefully planned strategy is key. Or core values. Or passion. Or the right investors. Or failing fast and pivoting. Or a commitment to doing something great. Why so many opinions? I suspect that few people appreciate the role that luck played in their success.

Or, even more importantly, the role that luck played in other people’s failure.

The first few years of a company’s existence are a terrible awkward adolescence. You will work like a dog. You will spend a large percentage of your energy on stuff that will eventually be thrown away. You will live on the edge of poverty.

But here is the worst part: Every company that you are competing with has an advantage over you. They know the industry. They have customers and revenues. They have their payroll system set up. You know how “fresh eyes” and “the beginner’s mind” are often touted as advantages? Well, 99.4 percent of the time, they are a liability.

When you start a company, economies of scale are working against you: Having one employee introduces just as much overhead as having a hundred. The value of specialization is working against you: You will spend hours doing something that would have taken someone else 10 minutes. (I have done every job at Big Nerd Ranch, most of them poorly.)

When you have Enough, the extra money means very little. I’ve been broke, and being broke sucks balls. Having Enough is awesome. How would I define “Enough”? Enough means that you can take a friend out to a nice lunch and not have to worry about how much it costs. I have hung out with a couple of billionaires—my experiences indicate that being a billionaire is just incrementally better than Enough.

Thus, as you look at your future, the question should not be, “How can I become a billionaire?” You should ask, “Where can I get Enough?”

Very few entrepreneurs have Enough; most of them eventually go get jobs.

(And don’t even talk to me about retiring early. There are few things sadder than a smart person who retires early and spends a few decades playing golf and waiting to die. If I am really lucky, I’ll push a clever chunk of code to Github in the morning and die at the dinner table that night.)

You are guessing about problems. When you start a company, you look for a problem to solve. You hope the problem is real, that no one else is trying to solve it, and that someone will pay you for your solution. But you don’t really know.

When you work for a company, like our client Procter & Gamble, they will present you with a problem. “Here,” they will say, “is our problem and a big bucket of money. Please create a solution.” There is no need for guessing.

Here is a video about Procter & Gamble’s problems and solutions. Big Nerd Ranch created many of the solutions.

The point is, old companies are desperate for innovation and they have the resources to take your ideas to fruition. You will probably have thousands of customers the same day you ship. There is a deep satisfaction that comes from being genuinely useful in this world.

The best part of creating a company is defining a culture. If you can find a company that has a culture you like and will pay you Enough to solve problems, go work for that company. Don’t start your own.

The post Don't Start a Company, Kid appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/dont-start-a-company-kid/feed/ 0
Going to Voices That Matter Seattle? https://bignerdranch.com/blog/going-to-voices-that-matter-seattle/ https://bignerdranch.com/blog/going-to-voices-that-matter-seattle/#respond Tue, 22 Feb 2011 17:05:33 +0000 https://nerdranchighq.wpengine.com/blog/going-to-voices-that-matter-seattle/

Voices that Matter is going to let me do the keynote on the first morning of their iOS conference this spring. The conference is April 9 and 10 in Seattle. You should come – it is a well-run and informative gathering. (Early-bird pricing ends on Feb 25, so sign up now.)

The post Going to Voices That Matter Seattle? appeared first on Big Nerd Ranch.

]]>

Voices that Matter is going to let me do the keynote on the first morning of their iOS conference this spring. The conference is April 9 and 10 in Seattle. You should come – it is a well-run and informative gathering. (Early-bird pricing ends on Feb 25, so sign up now.)

If you are coming, you might want to consider signing up for the one-day introduction to iOS programming that I’m doing the day before.

The post Going to Voices That Matter Seattle? appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/going-to-voices-that-matter-seattle/feed/ 0
New Kindle version of "iPhone Programming" book https://bignerdranch.com/blog/new-kindle-version-of-iphone-programming-book/ https://bignerdranch.com/blog/new-kindle-version-of-iphone-programming-book/#respond Sun, 20 Feb 2011 19:04:44 +0000 https://nerdranchighq.wpengine.com/blog/new-kindle-version-of-iphone-programming-book/

Making a .epub or .mobi version of a book is not as easy as it looks. Until recently, if you bought the Kindle version of our iPhone book you were buying something that was generated from our PDF. In particular, all the code blocks were just images from the PDF.

The post New Kindle version of "iPhone Programming" book appeared first on Big Nerd Ranch.

]]>

Making a .epub or .mobi version of a book is not as easy as it looks. Until recently, if you bought the Kindle version of our iPhone book you were buying something that was generated from our PDF. In particular, all the code blocks were just images from the PDF.

Chris Loper at Intelligent English worked very hard to make better eBooks from our original DocBook XML source. This new version has taken a long time to percolate through the system, but it is finally available at Amazon.

If you have the old Kindle book (with the code as images), you can get the new version if you ask for it from Kindle Support. The phrase that pays is “Please send the updated version of iPhone Programming: The Big Nerd Ranch Guide to my Kindle account.”

If you have any bookmarks or notes attached to the old edition, you will lose them when you download the new version. (That’s why Amazon doesn’t automatically push new versions.)

(At this time the purchase of the eBook is completely separate from the purchase of the pBook. There is no discount for buying both.)

The post New Kindle version of "iPhone Programming" book appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/new-kindle-version-of-iphone-programming-book/feed/ 0
BNRPersistence https://bignerdranch.com/blog/bnrpersistence/ https://bignerdranch.com/blog/bnrpersistence/#respond Mon, 01 Feb 2010 17:58:58 +0000 https://nerdranchighq.wpengine.com/blog/bnrpersistence/

I just open sourced a simple persistence layer for Cocoa and iPhone that uses Tokyo Cabinet. If you are frustrated with Core Data, you might find it useful. Check it out on GitHub.

The post BNRPersistence appeared first on Big Nerd Ranch.

]]>

I just open sourced a simple persistence layer for Cocoa and iPhone that uses Tokyo Cabinet. If you are frustrated with Core Data, you might find it useful. Check it out on GitHub.

Here is the Readme:

After a few years of whining that Core Data could have been better, I thought I should write a persistence framework that points in what I think is the right direction. And this is it.

One big difference? Objects can have ordered relationships. For example, a playlist of songs is an ordered collection. This is awkward to do in Core Data because it uses a relational database.

Another big difference? It doesn’t use SQLite, but rather a key-value store called Tokyo Cabinet.

BNRPersistence is not really a framework at the moment, just a set of classes that you can include in your project.

Install

First, you need to download Tokyo Cabinet:
http://1978th.net/tokyocabinet/
(There is a sourceforge page, but the latest build seems to be on this site.)

In Terminal.app, untar the tarball and cd into the resulting directory.

(You want 64-bit library? In Terminal, set an environment variable for 64-bit builds:

export CFLAGS='-arch x86_64'

)

Configure, build, and install:

./configure
make
sudo make install

Now, you have a /usr/local/lib/usr/local/lib/libtokyocabinet.a that needs to linked into any project that uses these classes. (I usually use the “Add->Existing Frameworks” menu item to do this.)

You’ll also need to have /usr/local/include/ among your header search path. (See the Xcode target’s build info to add this.)

Now just add the classes in the BNRPersistence directory into your project. (If you copy them, you won’t get the new version when you update your git repository. This may be exactly what you want, but these are pretty immature, so I would suggest that you link to them instead.)

Using it

You’ve used Core Data? The BNRStore is analogous to NSManagedObjectContext. BNRStoredObject is analogous to NSManagedObject. There is no model, instead, like archiving, you must have two methods in you BNRStoredObject subclass. Here are the methods from a Playlist class:

- (void)readContentFromBuffer:(BNRDataBuffer *)d
{
    [title release];
    title = [[d readString] retain];
    
    [songs release];
    songs = [d readArrayOfClass:[Song class]
                     usingStore:[self store]];
    [songs retain];
}

- (void)writeContentToBuffer:(BNRDataBuffer *)d
{
    [d writeString:title];
    [d writeArray:songs ofClass:[Song class]];
}

So, BNRDataBuffers are like NSData, but they have methods for reading and writing different types of data. (It does byte-swapping so you can move the data files from PPC to Intel without a problem.)

(I certainly debate the idea of a model file that would replace these methods, but for now this is fast and simple. If you would rather have a model file than implement these methods, you are invited to write a BNRPersistenceModelEditor.)

All the instances of class will be stored in a single TokyoCabinet file, thus you will be saving to a directory containing one file for each class that you are storing.

To create a store, first you must create a backend. I have tried BerkeleyDB and GDBM, but I am quite enamored with Tokyo Cabinet right now. (If you would like to try the other backends, write me and I’ll send you the necessary classes.)

NSError *error;
NSString *path = @"/tmp/complextest/";
BNRTCBackend *backend = [[BNRTCBackend alloc] initWithPath:path
                                                     error:&error;];
if (!backend) {
    NSLog(@"Unable to create database at %@", path);
    ...display error here... 
}

Now that you have a backend, you can create a store and tell it which classes you are going to be saving or loading:

BNRStore *store = [[BNRStore alloc] init];
[store setBackend:backend];
[backend release];
    
[store addClass:[Song class]];
[store addClass:[Playlist class]];

(You must add the classes in the same order every time. The classID of a class (see BNRClassMetaData) is determined by the order)

Now to get a list of of the playlists in the store:

NSArray *allPlaylists = [store allObjectsForClass:[Playlist class]];

To insert a new playlist:

Playlist *playlist = [[Playlist alloc] init];
[store insertObject:playlist];

To delete a playlist:

[store deleteObject:playlist];

To update a playlist:

[store willUpdateObject:playlist];
;

(Yes, this is a place where a model file would make the framework cooler: I could become an observer of this object and get notified when the value changed.)

(As a side-note, there is some experimental support for automatically updating the undo managed. Just give the store an undo manager. This also could be made better with a model file.)

To save all the changes:

BOOL success = [store saveChanges:&error;];
if (!success) {
    NSLog(@"error = %@", [error localizedDescription]);
    return -1;
}

Each class in a store can have a version. This is kept in the BNRClassMetaData object for the class. You can reach this in your readContentFromBuffer method (because you have access to the store).

In your BNRStoredObject class, you can implement these two methods if you wish:

- (void)prepareForDelete;
- (void)dissolveAllRelationships;

prepareForDelete is where you implement your delete rule: When a song is deleted, for example, it needs to remove itself from any playlists it is in.

dissolveAllRelationships is a fix for a common problem. You close the document, but the objects in the document have retain cycles so they don’t get deallocated properly. In dissolveAllRelationships, your stored objects (the ones in memory) are being asked to release any other stored objects they are retaining.

In the directory, you will find TCSpeedTest and CDSpeedTest. These are command-line tools that compare the speed of some tasks in BNRPersistence (TCSpeedTest) and Core Data (CDSpeedTest)

Your mileage may vary, but I see:

Creating 1,000 playlists, 100,000 songs, and 100 songs in each playlist and saving (ComplexInsertTest):
BNRPersistence is 10 times faster than CoreData

Reading in the playlist and getting the title of the first song in each playlist (ComplexFetchTest):
BNRPersistence is 13 times faster than CoreData

Creating 1,000,000 songs and inserting them and saving (SimpleInsertTest):
BNRPersistence is 17 times faster than CoreData

Fetching in 1,000,000 songs (SimpleFetchTest)
CoreData is a little faster than BNRPersistence
(BNRPersistence is single-threaded and CoreData has some clever multi-threading in this case. I think I can do similar tricks in BNRPersistence and catch up in this case. In either case, it is very, very fast. On my machine, fetching a million songs takes 3 seconds the first time and 2 seconds the second time.)

Getting it on the phone

The first problem is that you need to compile TokyoCabinet for arm. I tried every configure trick I could come up with and then just created an Xcode static library project and dumped the source into the project. This project is in the repository.

When you link to the resulting static library, you will also need to link in libz, which is part of the iPhone SDK

License

My code is under the MIT license and Tokyo Cabinet is under the LGPL. I think this will enable you to use it how you want to use it. If something bad happens because of the code, you can’t sue us. And if you make changes to Tokyo Cabinet, I think you need to submit those changes to the author. But I’m not a lawyer…

To Do

I recognize that there is room for improvement here:

1) The creation of a model-file architecture and editor
2) Add Tokyo Distopia to make full-text search fast
3) Use B+ trees to make attributes indexable
4) Better automatic undo support
5) Automatic syncing to a web service
6) Easy hooks for QuickLook images and Spotlight metadata in BNRStoreDocument
7) Hook it up to Tokyo Tyrant for non-local storage

The post BNRPersistence appeared first on Big Nerd Ranch.

]]>
https://bignerdranch.com/blog/bnrpersistence/feed/ 0