Archive for November, 2010

Want to Localize Your Flex/AIR Apps? It’s Easy! I’ll Show You How!

If you have an application or a website, and you’re targeting (or want to be targeting) an international audience, then you’re going to have to localize!  What that means is preparing your application for international use by building support for multiple languages.  It may sound like a daunting task, but the Flex framework makes it surprisingly easy.  I’ve written a very simple tutorial on the Adobe Developer Connection Flex Community that walks through a straightforward way of localizing a basic Flex application.

Localization in Flex – Part 1: Compiling resources into an application

Here is the end-product of the tutorial, which you can easily create yourself, or implement within your own existing project!

This tutorial is only part 1 of the series, and illustrates one common way to achieve localization.  There is another different, but common, way, which I’ll illustrate in part 2, and I’ll announce on this blog as well :)

Until next time, happy coding!

Update: I’ve just completed Part 2. Read about it here :)

WANTED: Computer Scientist Summer Intern!

Crazy awesome pic provided by eBoy.

Crazy awesome pic provided by eBoy

We’re hiring! I’m part of the Services Infrastructure team here at Adobe, and we’re looking for some bright and eager individuals to help us build some really cool things! This position is based out of the Adobe office in Seattle and for our team :D  Here’s the description…

Job Title:
Computer Scientist Summer Intern

Position Summary:
The Adobe Services Infrastructure Team is looking for exceptional people to work on systems software and tools in a creative, fun, and fast-paced environment. Join us and help build the core components of Adobe’s SaaS platform, the foundation for online products like photoshop.com and acrobat.com.

As a member of the team, you will work alongside the rest of the engineering staff. We’re a flexible team, and we will give you projects addressing a real-world need that will be put into service, while challenging your skills and providing you with practical work experience. We will work with you to set you up for success, starting small and building from there. Adobe has an end-of-summer Intern projects “expo” in a science-fair format where you present your work to Adobe staff (including hiring managers!). Plus, there will be a few fun things like an afternoon trip to the movies.

The following are examples of possible projects: write a tool that auto-generates release notes from check-in comments and bug database records, build an application for managing our wall of monitors reporting statistics on our various services, create a small AIR application that streams real-time statistics from our services to internal users’ desktops (like a stock ticker), or expand the functionality of our emergency phone dialer service.

This job requires a 3rd or 4th-year in a BS Computer Science or equivalent degree, work development experience, excellent verbal and written communication skills, some knowledge of or exposure to test automation frameworks, and preferably some experience developing Java applications and Flex/ActionScript/JavaScript client applications.

Requirements:
• Working towards BS or MS in Computer Science, or related technical discipline.
• Extensive experience with C/C++ and/or Java.
• Preferred experience building and maintaining software systems and/or services.
• A solid foundation and understanding in computer science with strong competencies in algorithms, data structures, and software design.

Contact:
E-mail me your resume and any other relevant materials you’d like to include at charlesb [at] adobe [dot] com.

For anyone that’s interested, I started off as an intern (with this team, in fact), and it’s a great way to gain some fantastic experience, work on cool projects with some great people, and just be part of an awesome company! I hope to hear from you!

Charles

C Puzzler – Like Java Puzzlers, but for C!

I’m a big fan of Java Puzzlers. If you’re not familiar with what those are, I highly encourage you to watch this Google Tech Talk by Joshua Bloch. In short, Java Puzzlers are quirky pitfalls and corner-cases one might encounter when programming with the Java language. I liked the concept so much, I thought I’d add a section on my blog for my own puzzlers! The format is simple:

  1. Code – I introduce the code
  2. Question - I pose a multiple-choice question and you guess what the outcome is…think hard!
  3. Walkthrough - I walk through a reasonable explanation
  4. Answer - I tell you the real outcome (it might surprise you), and explain why
  5. Moral - How can we avoid making mistakes like this in our own code

Now that we know what a Puzzler is, here is a simple C Puzzler:

Code:

/** c-puzzler-lets-get-funcy.c **/
#include <stdio.h>
 
int funcOne();
int funcTwo();
 
int x = 1;
 
int main()
{
	int y = funcOne() + funcTwo();
 
	return y;
}
 
int funcOne()
{
	return x;
}
 
int funcTwo()
{
	return ++x;
}

Question:

What value does main return?

  1. 2
  2. 3
  3. 4
  4. it varies

Walkthrough:

There is a global variable, x, and it is initialized to 1. In main(), there is a local variable, y, and it is initialized to the value returned by funcOne() plus the value returned by funcTwo(). The function funcOne() simply returns the value stored in variable x, which is 1. The function funcTwo() also references x, but increments it in the process. Since the increment operator is a prefix, it performs the increment before returning the value, and so funcTwo() will return the incremented value of x, which is 2. Therefore, y will equal 1 + 2, which is 3, and main() will return the int value 3. So, my answer is b, main will return 3.

 

*SPOILER ALERT – ANSWER BELOW*


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Answer:

The answer is d – it varies. This is because in ANSI C, there is no guarantee as to the order in which the operands of an operator are evaluated. So, depending on the compiler implementation, funcOne() can be evaluated before funcTwo(), and vice versa, giving us a result of 3 or 4 depending on the compiler. It should be noted, though, that MOST C compilers will evaluate expressions of operands left to right, including the GNU compiler, but there is no guarantee that this is the case. As a result, the safest way to achieve compiler-agnostic results would be to use intermediary variables.

Moral:

The order in which operands of an operator is unspecified in C. So, to give safe and predictable results, external variables should be modified carefully, and specifically noted in the function’s documentation. If the documentation for a function is lacking, or you are working with a 3rd party API which, for all intents and purposes, is a black-box, use of intermediary variables to ensure order of operations is safest.

I hope you’ve enjoyed my first C Puzzler! Until next time, happy coding!

Charles

c-puzzler-lets-get-funcy.zip (source code)