Tuesday, February 1, 2011

Executing JavaScript from Objective-C in an iOS App

New blog post from Steve Smith, one of the Chariot architects working in our mobile practice.  Steve is currently working on updating the mobile app for our Emerging Technologies conference and will be posting articles from time to time as he finds challenges or discoveries.

Here is an excerpt:

The other day, I found the need to execute some JavaScript from a native iOS application.  After doing a little research, I discovered that the UIWebView has a stringByEvaluatingJavaScriptFromString method.  So I decided to create a quick little proof-of-concept to see how to invoke some JavaScript using this. I am not going to walk through all the details of creating a project, etc. and will cut right to the important aspects of making the JavaScript call from the objective-c code.
We are going to need a JavaScript function to call and a UIWebView to evaluate the JavaScript. It would be nice if the JavaScript function took a parameter as well, so we could also prove out the passing of values.  Here is the JavaScript function that I will use:
1var area = function(diameter) {
2     var radius = diameter/2,
3     area = Math.PI * radius * radius;
4     return Math.round(area*100)/100;
5};


Read more

Monday, January 24, 2011

Android Development: Best Practices

Thanks to Anatoly Polinsky for another blog post

I got introduced to an Android application development during Philly ETE conference by listening to “A guided tour of the Android ETE mobile application” talk, where Andrew Oswald ( a Java Architect from Chariot Solutions ) talked about creating an Android app for the conference, which was a cool introduction to “what it takes” to write one of those apps from scratch. I am looking forward to more talks around mobile development this year at Philly ETE conference as well.

Meanwhile I rely mostly on Android’s Developer Guide whenever I seek answers to my questions or/and best practices. Here are my notes on such practices I picked up listening to “A Beginner’s Guide to Android” Google I/O 2010 talk:

Read More....

Tuesday, January 18, 2011

Enterprise Integration with Spring Training

Are you a Spring Developer?

Do you have Enterprise solutions to develop or architect?



Chariot Solutions, a Spring Training Partner and Philadelphia leader in Spring Training, Mentoring and Consulting can help you take your Spring skills to the next level - Enterprise Integration!

There are many Spring developers who have learned by experimenting, reading documentation and maybe code dives into an existing application or two. But with the knowledge you gain from Official SpringSource training at Chariot from our certified SpringSource instructors, you can be more equipped to chose the right tools for your complex integration solutions.

The Enterprise Integration with Spring (EIwS) course is not only extremely valuable to any Spring developer it should be REQUIRED for anyone architecting Spring applications.

What is cool in the EIwS course?

  • Synchronous & Asynchronous Processing
  • Messaging with Enterprise Integration Patterns
  • Messaging with JMS
  • Exposing Services with RMI, HTTP
  • Web Services with SOAP, REST and WS Security - and why REST is cool!
  • Spring Local and Distributed Transaction Management - JTA/XA - Open Source distributed transactions without a JEE Server
  • Service Integration with SMTP (email), File, JMS, FTP, JDBC, TCP/UDP, XMPP, etc.
  • Polling and Triggering
  • Tasks and Scheduling of Processes
  • Message Filtering, Routing, Transformation, Splitting, Aggregating, Bridging and Chaining
  • Creating Batch processes for inline or offline execution
  • Monitoring Batch process exceptions
  • Unit and Mock testing of application layers
  • Modifying Integration processes without recompiling... AWESOME Right?


One of the key take-aways from this course is knowing which tools are available to choose from and why.

What does Gordon teach?

When I teach the Core or EIwS classes, I go through the common Spring project application layers, and their respective roles and responsibilities. We discuss the tools you have within Spring and which to use to solve integration concerns. In EIwS, the course builds from common concurrency, tasks & scheduling, Messaging with JMS to the flexible power of Spring Integration and Spring Batch tool sets. I teach layering your applications focussing on the power and flexibility of Service POJOs exposing your processes in a Service Oriented Architecture (SOA) manner and keeping your POJOs - Pure business objects, un-compromised by framework or infrastructure java objects.

I am teaching EIwS February 22-25, 2010 in Philadelphia! If you come you will receive:
  • A shiny new course book
  • An Official Spring USB thumb drive with SpringSource Tool Suite, Course Documentation PDF, all the labs & solutions
  • The secret meaning of the acronym "SOA"
  • Bad humor from your instructor (if I teach you can count on it)
  • Demo's that Gordon creates (if taking my class)
  • Lunch, Coffee, Tea & soft drinks


Q&A


Q: What if I have not taken the Core Spring course?
A: It is highly recommended that you attend the Core Spring Course first. Click here to see the Course Schedule

Q: What if I am not using Spring 3 yet?
A: No problem, although the course focuses on 3.0 features, you will still get usable information for your applications.

Q: What will I learn?
A: Scroll up.

Q: What if I already have used some of the topics covered?
A: Relax during those chapters or, even better, provide your "in the trenches" experience with the class.

Q: How can I get management to pay for the class?
A: This course is Essential to my skills, to provide you with better tools to choose the right approach to solving our complex integration needs. Check Here for possible Early Bird Discounts.

Q: Where do I find out about the Enterprise Integration course?
A: Click here for SpringSource Training Site

Q: When is Gordon teaching the class?
A: Click here for the next scheduled course on February 22, 2011

Q: Is there certification for Enterprise Integration Specialist?
A: Check here for the status on Enterprise Integration Specialist Certification

Memorable Quotes:


  • "Wow, I just learned in 5 minutes what it took me 2 weeks to do in the past"
  • "A Spring Developer without
  • "Understanding the layered design of Spring applications really helps me best architect my solutions."
  • "I really needed to provide file processing into my database, glad I took this class for those implementation discussions"


So, what are you waiting for? Register NOW for Enterprise Integration with Spring!


Monday, January 17, 2011

Simple Spring Social for Twitter Friends

The Spring Social project provides us developers with an easy way to interact with Twitter, Facebook, LinkedIn & TripIt via the familiar Template objects we have used. Spring has provided Templates for convenient interaction with JDBC, REST, Hibernate, JNDI, and more.


One of the simplest social media calls is to lookup someone's Twitter friends with the TwitterTemplate.


1. Add the Spring Social project dependency to the pom.xml file


<dependencies>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>${spring.social.version}</version>
</dependency>
...
</dependencies>

2. Add the Spring Milestone Repository repository to the pom.xml file



<repositories>
<repository>
<id>spring-maven-milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository><
...
</repositories>

3. Create the TwitterTemplate, and ask for friends


TwitterTemplate twitterTemplate = new TwitterTemplate();
List<String> friends = twitterTemplate.getFriends("chariotsolution");
for (String friend : friends) {
System.out.println("Friend: " + friend);
}

4. Use the code above anywhere in your application


In the next blog, I will cover how to use Open Authentication (OAuth) to perform more Twitter operations.

Simple Spring Social for Twitter Friends

Gordon Dickens recently posted on his blog some thoughts on the Spring Social project.  

The Spring Social project provides us developers with an easy way to interact with Twitter, Facebook, LinkedIn & TripIt via the familiar Template objects we have used. Spring has provided Templates for convenient interaction with JDBC, REST, Hibernate, JNDI, and more.
One of the simplest social media calls is to lookup someone’s Twitter friends with the TwitterTemplate.
Read more..


Monday, January 10, 2011

An Introduction to Mobile Device Detection

One of our architects, Steve Smith, recently posted this on his blog:

These days, there are many ways to browse the internet.  There are desktop browsers, mobile phone browsers, tablets, tablet/phones (e.g. Dell Streak), etc. all with different screen sizes, resolution, and capabilities.  How do you render an appropriate view optimized for the device accessing your site?  The answer is device detection.
The two main approaches for device detection are server-side detection and client side detection.  Server side detection involves determining the device at the time of the request and then presenting the appropriate view.  Client side detection involves manipulating the view after the content has been sent to the browser.

Read the full post..



Friday, December 31, 2010

Build and Release Management With Apache Maven

More than ten years ago, Joel Spolsky of "Joel on Software" fame wrote The Joel Test: 12 Steps to Better Code. It was a great set of 12 yes/no questions, all of which you should be able to honestly answer "yes" if your team is to have any hope of producing good software in a timely and efficient manner.

The Joel Test stands up pretty well even today. Joel's first two questions, "Do you use source control?" and "Can you make a build in one step?" are a good start at addressing the need for build automation. With the tools available today, however, I suggest that build management (not just automation) and release management should be added to the "must have" list for productive software development teams.

Since I mostly work in Java, I'll talk about Java build and release management. There are a few comprehensive tools for Java build and release management (actually many more build management tools than release management tools), but the most popular by far is Apache Maven.

Maven started in 2001 as a part of the Apache Alexandria project, moved to be a part of the Apache Turbine project in 2002, became a top-level Apache project in 2003, and had its first milestone release, v1.0, in October of 2005. Version 2.2.1 has been in wide use since its release in August of 2009. Version 3.0 was released in October of 2010, and the current version, 3.0.1 was released in November 2010.

Maven bills itself as a "software project management and comprehension tool". Its most basic use is as a build tool, commonly as a replacement for Apache Ant, but it does several other things, which taken together, really do form a useful software project management and comprehension tool. Maven is certainly not an absolute requirement for a good software development team, but the issues that it addresses must be addressed somehow. If your Java development team is not currently addressing these issues in a satisfactory way now, Maven is a good way to get started addressing them in a coherent way.

As a build tool, Maven takes the now-common "convention over configuration" approach that seems to have started around 2004 with the Ruby on Rails web framework. As such, Maven was designed to be a highly opinionated tool, giving structure to the free-for-all that Ant usage had become in many projects. Maven is based on the Project Object Model, an XML configuration file that specifies what goes into a project, but unlike Ant, generally not how to build it. This is where the convention over configuration comes in - you put your source code and other build artifacts in a directory structure that Maven expects, and then Maven can build it with no further configuration. This results in both simplified build management (no build script to write and maintain), and a project that anyone familiar with Maven can build. There is a well-defined build lifecycle, with well-defined targets: "mvn install" builds, tests, and packages any project built with Maven, and installs the resulting artifact in a local repository (more about repositories later). This is a great improvement over Ant, where the names of the build targets, and what they do are up to the whim of the person writing the Ant build script.

Maven is much more than just a build tool. It has many more features, but to me, the most important are Dependency Management and Release Management.

Dependency Management is all about dealing with the libraries (jar files) upon which your project depends (direct dependencies), and those jar files' dependencies (transitive dependencies). With Ant or any other build system that does not manage dependencies, this is left as a manual exercise for the developers. Typically, all of the dependencies are resolved manually, and all of the jar files are put into the project's 'lib' directory. This frequently means that multiple projects using the same third-party libraries will each need to keep a copy of them.

Maven's paradigm is to have the developer declare the project's direct dependencies in the POM. Maven then resolves the transitive dependencies, and pulls the required jar files (direct and transitive dependencies) from a Maven Repository at build time. Jar files are not kept within the project, just the specification of which jar files to use at build time. There is a "standard" external repository (the "central" repository) that is web-based, and hosted by maven.org, and a local repository in the filesystem on the developer's machine. Jar files are pulled from the central repository, or other external repositories that may be configured, and cached in the local repository.

This arrangement works well for small, one-off development efforts, but many shops have reusable jar files of their own that are used by multiple internal projects. Historically, many development teams have distributed these reusable in-house developed jar files by either putting them on a shared network directory, or by checking them into the source code version control system. This results in a process that is more manual and cumbersome than it should be, and generally violates the DRY principle.

Using Maven instead of Ant or a home-grown build system, and managing dependencies through it are a good first step, but for reusable code, Release Management becomes important, and again, Maven can help. Maven, through its release plugin, supports a well-defined release lifecycle, and allows teams to store their reusable code in a centralized Maven repository, just like the "standard" jar files that are kept in the central repository. Teams (or whole companies) can set up their own internal, web-based repository that either enhances or replaces the central repository. Using Maven, they can then "release" their jar files to this repository. Projects using Maven can then declare these jar files as dependencies the same way that they do for jar files in the central repository, and they will be resolved by Maven. No need for shared directories, or placing binaries in the source code version control system. The release plugin takes care of incrementing version numbers and updating them in the version control system, in a standard way.

The features that have been presented here are just the most prominent ones - Maven is capable of much more, especially with its extensive list of plugins. If your team is not using Maven (or something like it), or is only using Maven as a build tool, I encourage you to spend some time learning more about Maven. It will be time well spent. There are the Maven project's own "Getting Started" guides and a series of books by Sonatype (the commercial company behind Maven) for starters.

Sonatype provides online, instructor-led training courses, and here at Chariot Solutions, we offer public, on-site training in our Ft. Washington, PA facility, as well as custom private courses.