Rachel Roumeliotis

Rachel Roumeliotis, a Strategic Content Director at O'Reilly Media, Inc., leads an editorial team that covers a wide variety of programming topics ranging from full-stack, to open source in the enterprise, to emerging programming languages. She is a Programming Chair of OSCON and O'Reilly's Software Architecture Conference. She has been working in technical publishing for 10 years, acquiring content in many areas including mobile programming, UX, computer security, and AI.

Rotating a UIView in 3D

OSCON 2013 Speaker Series


Jon Manning (@desplesda) and Paris Buttfield-Addison (@parisba) are co-founders of Secret Lab and authors of the forthcoming Learning Cocoa with Objective-C, 3rd Edition. They’ll be speaking at OSCON this week in Portland, OR. Here they explain how to rotate a UIView in 3D on iOS.


One of the simplest visual tricks you can do in iOS is to make a part of your UI pretend to be a 3D object. We’ve found that this is an excellent way to add some life and visual interest to both apps and games.

Below, you’ll learn how to make a view rotate in 3D and have a perspective effect.

phone

First, your project needs to use the QuartzCore framework.

Next, when you want the animation to begin, you do this:

CABasicAnimation* animation = [CABasicAnimation
animation WithKeyPath:@"transform.rotation.y"];
animation.fromValue = @(0);
animation.toValue = @(2 * M_PI);
animation.repeatCount = INFINITY;
animation.duration = 5.0;

[self.rotatingView.layer addAnimation:animation forKey:@"rotation"];

CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0 / 500.0;
self.rotatingView.layer.transform = transform;

To stop the animation, you do this:

[self.rotatingView.layer removeAnimationForKey:@"rotation"];

How It Works

CABasicAnimation allows you to animate a property of a view from one value to another. In the case of rotating a view, the property that we want to animate is its rotation, and the values we want to animate from and to are angles.

When you create the animation using [CABasicAnimation animationWithKeyPath:], you specify the property you want to animate. In this case, the one we want is the rotation around the Y axis.

CABasicAnimation* animation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.y"];

The animation is then configured. In this example, we made the rotation start from zero, and proceed through to a full circle. In Core Animation, angles are measured in radians, and there are 2 * π radians in a full circle. So, the from value and to value are set thusly:

animation.fromValue = @(0);
animation.toValue = @(2 * M_PI);

Next, the animation is told that it should repeat an infinite number of times, and that the full rotation should take 5 seconds.

animation.repeatCount = INFINITY;
animation.duration = 5.0;

The animation is started by adding the animation to the view’s layer, using the addAnimation:forKey: method. This method takes two parameters: the animation object that you want to use, and a key (or name) that the animation should be referred by.

Don’t be confused by the similarity between the “key” that you use when you add the animation, and the “key path” you use when creating the animation. The former is just a name you give the animation, and can be anything; the “key path” describes exactly what the animation modifies.

[self.rotatingView.layer addAnimation:animation forKey:@"rotation"];

The last step to this is to give the rotating view a little perspective. If you run the code while omitting the last few lines, you’ll end up with a view that appears to horizontally squash and stretch. What you want is for the edge that’s approaching the user’s eye to appear to get bigger, while the edge that’s moving away from the user’s eye to get smaller.

This is done by modifying the view’s 3D transform. By default, all views have a transform matrix applied to them that makes them all lie flat over each other. When you want something to have perspective, though, this doesn’t apply, and we need to override it.

CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0 / 500.0;
self.rotatingView.layer.transform = transform;

The key to this part of the code is the second line: the one where the m34 field of the transform is updated. This part of the transform controls the sharpness of the perspective. (It’s basically how much the z coordinate gets scaled towards or away from the vanishing point as it moves closer to or further from the “camera“.)

As you can see, adding 3D and perspective effects isn’t terribly difficult, but the results can provide an excellent payoff in terms of user immersion.

Enterprise Data Workflows with Cascading

OSCON 2013 Speaker Series

Paco Nathan (@pacoid) is Director of Data Science at Concurrent, O’Reilly Author, and OSCON 2013 Speaker. In this interview we talk about creating enterprise data workflow with Cascading. Be sure to check out Paco’s book on the subject here

NOTE: If you are interested in attending OSCON to check out Paco’s talk or the many other cool sessions, click over to the OSCON website where you can use the discount code OS13PROG to get 20% your registration fee.

Key highlights include:

  • Cascading is an abstraction layer on top of Hadoop [Discussed at 0:23]
  • Define your business logic at a high level [Discussed at 1:21]
  • Is Cascading good for enterprise? [Discussed at 2:31]
  • Test-driven development at scale [Discussed at 3:35]
  • Cascalog and the City of Palo Alto Open Data portal [Discussed at 7:39]

You can view the full interview here:

Read more…

High Availability with MySQL and Moving to MongoDB

OSCON 2013 Speaker Series

Henrik Ingo (@h_ingo) is a MySQL architect, author, and OSCON 2013 Speaker. In this interview we talk about high availability in MySQL and why he switched to MongoDB.

NOTE: If you are interested in attending OSCON to check out Henrik’s talk or the many other cool sessions, click over to the OSCON website where you can use the discount code OS13PROG to get 20% your registration fee.

Key highlights include:

  • Why is high availability so important now? [Discussed at 2:25]
  • Percona and Maria DB are not much different than plain old MySQL. [Discussed at 6:24]
  • Moving from MySQL to MongoDB [Discussed at 8:40]

You can view the full interview here:

Read more…

Location Functionality in Mobile Apps

OSCON 2013 Speaker Series

Andy Gup (@agup) is a Developer Evangelist at ESRI and OSCON 2013 Speaker. In this interview we talk about location capabilities in apps as well as location analytics.

NOTE: If you are interested in attending OSCON to check out Andy’s talk or the many other cool sessions, click over to the OSCON website where you can use the discount code OS13PROG to get 20% your registration fee.

Key highlights include:

  • Mobile apps must have location capabilities [Discussed at 0:25]
  • Consider your goals when incorporating location into an app [Discussed at 1:05]
  • Is it difficult to add location functionality? [Discussed at 2:19]
  • A real-world example of where it made a big difference [Discussed at 3:32]
  • Location analytics are very powerful [Discussed at 5:11]
  • Augmented reality and location capabilities [Discussed at 6:38]

You can view the full interview here:

Read more…

A Journey from Google I/O to Microsoft Build

Microsoft, Apple, and Google try to define themselves as they become more alike

As I was sitting in the Build keynote I realized that both of the keynotes that I had attended recently (Google I/O and Build—I couldn’t get into WWDC) were really about me—well not just me but us, the consumers. This time it was Microsoft that had the DJ playing tunes as we were treated to images from Windows 8.1 and colored spotlights careened off of every surface (no pun intended) in the subterranean hall at Moscone South. The main thrust of the Build keynote, which started with Steve Ballmer announcing that Microsoft would now enter a time of rapid release for its software, was how well Windows 8 had done and how Windows 8.1 would be even better.

There were big cheers for the return of the Start Button, the ability to boot to desktop, a “refining” and “re-blending” of the massively overhauled Windows OS, all of which I think are great steps forward. In fact, there have been over 800 updates to Windows since November 2012. This already demonstrates that rapid release is the focus at Microsoft. And then there were the devices, so many devices, from Windows Phones to giant desktops that become giant tablets to all-in-ones that convert from laptops to tablets.

Read more…

Human-Centered Design May Be What Makes Your App Stand Out

OSCON 2013 Speaker Series

Tony Santos, (@tsmuse) is a User Experience Lead at Mozilla and OSCON 2013 Speaker. We talk about Human-Centered Design and how it can make all the difference.

NOTE: If you are interested in attending OSCON to check out Tony’s talk or the many other cool sessions, click over to the OSCON website where you can use the discount code OS13PROG to get 20% your registration fee.

Key highlights include:

  • Defining human-centered design. [Discussed at 0:20]
  • Hey Developers, Want your app, software, or product to be a success? Then you need to care about this, seriously. [Discussed at 1:05]
  • So, what do users actually want? [Discussed at 2:10]
  • Some (user) research is better than no (user) research. [Discussed at 3:03]
  • Open source sort of abides by human-centered design by its very nature, but can do even better. [Discussed at 4:01]
  • A human-centered design success story. [Discussed at 6:26]

You can view the full interview here:

Read more…

Rapping about RepRap

OSCON 2013 Speaker Series

Ed Snajder is a 3D-printer aficionado, DBA at Jive Software and OSCON 2013 speaker. We talk about the ins and outs of the new world of 3D printing (a little sneak preview of what Ed will be speaking about at this year’s OSCON). If you are interested in attending to check out Ed’s talk or the many other cool sessions, click over to the OSCON website where you can use the discount code OS13PROG to get 20% your registration fee.

Key highlights include:

  • What is RepRap? [Discussed at 0:20]
  • Hack a printer together from scratch, purchase a kit or get one ready to print (sort of) [Discussed at 3:15]
  • How do you get from 2D to 3D? [Discussed at 5:54]
  • If you smell popcorn and you’re not making it, your 3D printer is burning [Discussed at 9:59]
  • Creating a greener world one object at a time [Discussed at 12:36]
  • 3D printer = Piracy machine? [Discussed at 14:25]

You can view the full interview here:

Read more…

A First Slice of Raspberry Pi

Tips on Getting Started with Simon Monk

Simon Monk @simonmonk2 is a full-time author who focuses his writing talents on open source hardware topics. He is currently writing the Raspberry Pi Cookbook which will be available in early release in July and in final release in the fall. Recently, I had the opportunity to sit down with Simon and we talked about one of the coolest things in open source hardware today, the Raspberry Pi.

Key highlights include:

  • Invest in a Raspberry Pi starter kit [Discussed at 0:29]
  • Python is probably the best bet for beginners [Discussed at 1:25]
  • Raspberry Pi and Arduino are both great but really excel in different ways [Discussed at 3:54]
  • How about when Raspberry Pi and Arduino are used together? [Discussed at 5:14]
  • Save time and avoid common mistakes like hardware compatibility issues [Discussed at 7:23]
  • Overclocking helps performance [Discussed at 8:47]

You can view the full interview here:

Read more…

The Future Is Graph Databases

A conversation with the founder of Neo4J, Emil Eifrem

Emil Eifrem @emileifrem is the Founder of Neo4j and CEO of Neo Technology. He is also one of the authors of Graph Databases. Recently, I had the opportunity to sit down with Emil and we talked about the current and future opportunities for graph databases.

Key highlights include:

  • Emil explains graph databases. [Discussed at 0:29]
  • Facebook Graph Search is a well-known example of a graph database. [Discussed at 3:28]
  • But really, graph databases can be used much more than social search. [Discussed at 4:50]
  • Neo4j is the original graph database. [Discussed at 5:25]
  • Graph databases “shape” data. [Discussed at 6:20]

You can view the full interview here:

Read more…

TechEd 2013: The ASP.NET Team, Surfaces at a Deep Discount, (and Google Glass?)

Humid, harmonious, and happy

People weren’t kidding when they told me New Orleans is humid, but the good news is the conference venue has great air conditioning. As expected TechEd is focused mainly on system administrator issues, but I’m feeling that even more so this year with BUILD right around the corner on June 26. However, that isn’t keeping the ASP.NET team from letting us in on what they’ve been working on these past few months.

I wrote a post a little more than a year ago on how Microsoft was starting to embrace open source. Well, it seems to be paying off with Web API 2: two of the new features, CORS and Attribute Routing, were initially contributed by community members and then perfected with the ASP.NET team. These two features are making writing code for your website more streamlined.

In other impressive updates, layout and styling are now based in Bootstrap and cross-browser testing is now much quicker with a tool codenamed “Artery.” We saw, Damian Edwards, Program Manager on the ASP.NET team, make a change in the code, rerun the program, and show us the updated website on local versions of Explorer and Chrome. In addition to upgrade announcements, a welcome change came in the form of a consistent toolset offering with Visual Studio 2013 that makes working across Web Forms and MVC much easier for developers. All new versions of these technologies, ASP.NET MVC 5, Web API 2, and Signal R2 will run only with .NET 4.5.

Sitting in the front of the packed room I kept thinking this is what Microsoft needs—an engaged audience that can work with a brilliant team to consistently update the technology and encourage change.

Oh, and Microsoft (in what I think is a smart move) is selling the Surface RT and Surface Pro, to full attendees, at deep, deep discounts, with the RT priced at $99 and the Pro at $399. The lines have been massive since the offer was announced. Hopefully this will provide Microsoft with more mindshare if not market share in the coming months.

And a note about Google Glass: I brought them to the conference in my continued social experiment to see how people would react. It has been a mixed bag of folks wanting to talk to me about them, those afraid I am recording them, and even a few that aren’t sure what it is. It continues to be good conversation starter as is the story of my eating my first crawdad—a New Orleans staple!