Friday, December 21, 2012

Dear Microsoft

I am sorry to say this but Windows 8 is one of the worst business decision you have made (beside Vista).  I have used Windows since 3.1 when it was a mere shell.  Windows 8 is so convoluted that several veterans such as myself cannot seem to figure it out.   Simple tasks such as creating a shortcut for you mail program are now so far removed from previous conventions that we are returning the system and my friend is buying a Mac instead.

Windows 8 strikes me as nothing more than an attempt to hide the lack of new features by obfuscating the OS look and feel so users are forced to re learn everything.  I would recommend you follow the lead of the genius who allowed the Control Panel to revert to "classic" look and feel.

The answer is my friend is now returning his new computer and shelling out an additional $500 to buy a Mac.


Thursday, December 13, 2012

Rabbit Turds: Why I dislike NoSQL and Big-Data

Don't get me wrong on this one.  I love and use (and even teach others how to use) graph database's like Neo4J and others who label themselves "NoSQL' such as MongoDB.   I also don't have anything against someone who owns an ultra large piece of data.  It is the terms themselves and that is the subject of today's rant.

What I don't like is the same kind of nonsense, illogical convention for naming as has been present in the past.  It reminds me of another name that lingers to this day like the stench of a dead woodchuck (Web 2.0).   I wrote in the book "Web 2.0 Architectures" (co-authored with Dion Hinchcliffe and James Governor) that Web 2.0 is perhaps inappropriately named as the convention of [name]-[version_Major].[version_minor] sort of implies an observable state of a state-ful object, more than often a piece of software.   Since the web is a dynamic beast that is constantly in a state or flux with multiple technologies, this type of versioning cannot be applied.  I have written in the past that "there is no Web 2.0 architecture" and have even heard Tim O'Reilly himself get a bit (pardon the pun) riled up about those running around talking about Web 3.0, Web 4.0 etc.  Ooh I Cringe just thinking of it.  Like a people building penthouses on a pile of rubbish.   Try a google search for the term "Web 5.0" and just see the lunacy that exists.

When I first heard the term NoSQL used, it seemed to imply that there was not going to be any "SQL" in this movement but it turns out that the acronym stands for "Not Only SQL".    Hmm.  Let's think this one through a bit.  Not only SQL means that you are not excluding SQL.  It also means you are not explicitly including or even implicitly excluding everything else.  So here is the question.  What is defined by a term that is not exclusive of anything?  It is simply a mathematical set that includes "all". Can a rabbit turd be part of NoSQL?  Sure.  It certainly doesn't stand for "Not Only SQL But Definitely Not Rabbit Turds" or NOSQLBDNRT for short.  The most ironic thing about the term is that while many thinks it means "no relational" models or tables, Carlo Strozzi used the term NoSQL in 1998 to name his lightweight, open-source relational database that did not expose the standard SQL interface.  Maybe NoSQL should mean "I was too busy to add an SQL interface and used a different way to access database operations".  It certainly seems more fitting given the cool technological advances.  I was so inspired by the idea of NoSQL I decided to make the movement it's own graphic!  May I present to you...   NOSQL!





Ok, so for the record, I love the idea of building on Graph Databases.   My company is building a very innovative platform called Formstr built on top of Neo4J.  Neo4J is one of the best technologies I have ever come across.  It is time to maybe shift our thinking a bit and start classifying the technologies accordingly.  Graph Databases use Nodes and Relationships to store data.  They use ASCII art languages like Cypher to query them so there is no real SQL involved.   Other databases use native storage formats like JSON that translates into fast returns.  And hello Spring Data!  Why would you use  SQL in Java when you can use @annotations?   There is a good article written by Dan Sullivan here summing up the differences.  This now gets me into the second part of my rant.

Big Data.

What is Big Data?  Last time I looked, data is stored electronically as streams of ones and zeros. Since these are binary concepts, size is really not a consideration.   The ones and zeros are not bigger or smaller than anyone else's.   Big Data is another term that is vague, ill-conceived and has no real quantification or definition.  Loosely interpreted  I am currently under the belief most people really mean to say "A Very Large Amount of Data" or perhaps if it is bigger, we could make the acronym and say we have a VFLAD.  I'll let you guess what the "F" stands for.

Does Big Data mean a single piece of data or a lot of small pieces of data?  I find that due to the interconnected nature of the internet and the accessibility of open data (defined as Data that is accessible by anyone and anytime without any costs or significant barriers), we are really living in a world of "Abundant Data".  Some say "Interconnected Data" which also is sort of misleading.  Like the lessons learned from the old saying "You can't get there from here", I am tempted to say that all data I can connect to is potentially "connectable" data since I can make the connection.  And yes, that is a VFLAD!

So ends my rant, as mild as they come.  This blogger has better things to put energy into that trying to change people's behavior into using meaningful and well thought out terms.

Wednesday, December 12, 2012

Android Winning the Mobile War?

According to Google Chairman and co-founder Erik Schmidt, Google's Android mobile and wireless device is winning the handset war hands down.   Independent Analyst firm IDC confirms this with the numbers coming in for Q3 2012 that Android enjoyed a 75% market share over iOS's runner up spot at 14.9%.  Microsoft's mobile efforts continue to grow well with a 140% increase in year over year smartphone shipments.


One lesson learned here is pay attention to developers.  Developers like easy.  We like open.  Making a developer jump through too many hoops to public a single application is not making friends.  If you examine the amount of energy required to be able to public your first application, RIM is by far the most tedious.   Apple is also fairly cumbersome to set up and Android has a very low barrier to entry.   Note that once you have made one application, the barrier to subsequent application publishing is still easier with Android.   Developers don't make all the decisions, but they do make recommendations.  If you have ever asked a family member who is a mobile developer "what phone should I buy?", chances are they are telling you to buy an Android phone nowadays.   The silent yet important grassroots groundswell cannot be ignored.

Here are some additional factors that may possibly affect the market share:

1. Quality

Apple makes good products and we're sure they are not diminishing.   Because Apple controls both the hardware and software (iOS), it has a distinct advantage over Android which is used on multiple types of hardware platforms.  Unlike the personal computing market, many users never re-install their phones operating system so it is up to each device handset manufacturer to ensure that Android runs well on their hardware.  On a personal note, the Galaxy III S is one lean, mean beast of a phone and is my favorite.

2. Ease of Programming

 One aspect of this battle that is not looked at very often is the popularity of Java amongst developers vs. Objective C.   Java is (for us anyways) much easier to learn than Objective C.  The syntax used by Java is also more familiar to many JavaScript, C# and ActionScript developers.  Objective C does give you far more control, but also forces more lines of code to accomplish the same thing.

3. Developer Tooling

XCode is used by iOS developer while Android developers are free to use whatever they want.  Since xCode's inception, it has steadily improved.   Eclipse is commonly used by Android developers and has some challenges (R.java anyone???).  Intellij's new IDEA is very promising for Android development.  I currently develop on Intellij 11 and may try out 12 with some new Android features and do a series of tutorials on it.   There are

4. Cost

Android phones should logically be lower in cost as there is more competition. Having said that, the observations are that price if not as much of a factor given carriers often subsidize this with plans.

5. Variety

Android wins here again hands down.  There are simply many different device to choose from rather than sticking to the iPhone.

There are more factors beyond this however the summary is clear.  Android is here to stay and will remain a dominent force in the marketplace.

Tuesday, December 11, 2012

The Fragile Rotting Web

Today Michael Arrington said what the rest of us were thinking. The title of Michael's article is "They Screwed Us. Right Before They Screwed Us Again. #poohead". The TechCrunch story just scratches the surface for me.  Dude - where is my internet?  The answer is that it is rotting from the core.

The rotting internet goes beyond just the mechanics.  We sign up for things expecting we deserve to use a service for free on an indefinite basis.  Think of MySpace.com.  At one time the most popular internet destination, now a ghost town.   Never before has history shown us the focus of a planet shifting at such an incredible pace.  Companies that back ventures like MySpace want to eventually earn revenue for their investment.  Sometimes this means redefining licenses and terms of use or imposing certain limits of the free versions of their offerings.  Michael's rant was legitimate IMO but there is a second side to it.  We're getting what we pay for.  Consider this.  Have you ever paid money to Twitter, Facebook, CraigsList, Wikipedia, Skype, MySpace or Instagram?   No?  As a society we expect the services for free?  The fact is we might all need to ask ourselves why Google is giving us free email services, free blogs this one included), an online alternative to Microsoft Office and more.  Google is driving advertising revenue via these items of course.  Facebook, Twitter and others will need to follow eventually.   The various legal systems we have in place to protect our real world rights are sadly lagging far behind the capabilities of the internet and the evolution of social media.  The overwhelming resistance to control via acts like SOPA and PIPA have shown the while we do complain a lot, we also like our wild west frontier justice.

The internet is rotting from it's technical fragility.  Link rot is most prevalent  caused by the very basic architectural patterns of the web.  Anyone can link to anything else in a unilateral manner.  I can simply type in <a href="http://somelink.com/resource.html">anchor</a>  and I have made a link.  The resource I have linked to has no responsibility to me to ensure that the link target does not change.  When I make the link, I assume all the risks.   The problem is that the protocols and standards used to build the web allow this sort of linking with no heart beat mechanism.  If the link is taken down or the site redesigned and factored differently, my link is now leading to a different resource or is a null pointer.  I highly suspect that my blog contains hundreds of broken links that result in 404's.   The basic architecture is flawed by design yet was the best choice.  The alternative, tightly coupling resources would also be problematic. Nevertheless, it might be a good time to re-examine the basic architectural principles of the world wide web.  While Tim Berners-Lee and others run off in pursuit of their semantic web ideals, the core upon which they build continues to become more and more fragile.

Redirects should save us though right?  No!  Redirects cause time lapses and are like temporary bandaids.  I redirect is similar to forwarding your mail when you move.  I just ran the W3C link validator and checker on my former employers site and found many redirects.

The conclusions is inescapable.  As the web grows, domain ownership changes and resources become more intertwined with each other, we will experience more fragility.  The social media giants of today will strive to redefine how far they can push users to extract the maximum revenue from their investment.  Those who push to on user too hard and reconfigure features and functionality will fail like MySpace.    Those who offer simple, one dimensional services and are out to capture marketshare will proliferate overnight like join.me, forsmtr and others.  




Tuesday, November 20, 2012

Safeway: a Case Study why Regular Security Audits are Required

A Security Audit is part of any company's IT practice and must be done on a regular basis. A more specialized computer security audit is combination of a manual or systematic technical assessment of a system or systems and all objects win the context in which they are run, including human behaviours and interactions.  Manual components include interviewing staff, performing security vulnerability scans, reviewing application and operating system access controls, and analyzing physical access to the systems. Automated assessments can no longer be relied on in most cases as social engineering is a major part of the way hackers operate nowadays.

Ignoring this over several years can lead to serious security breaches.  I have seen some very fragile systems however this week I came across one that is a perfect example of why these audits need to be done regularly.

The example we have in mind is Safeway, a Canadian food store chain.  Now that seems like a very unlikely source for a hackers to compromise a person's information and gain access to their systems, but it is very possible and if you read the rest of this, you will probably take steps to protect yourself.  For the record, we invite Safeway to comment back as we are sure they will be taking concrete steps to change this assuming they read it.

CAVEAT:  The goal of this blog post is not to specifically hurt Safeway.  They are a great company and I regularly shop there.  The purpose is to raise the awareness for both those who have not done security audits and for those who use stores like Safeway to be more aware of the vulnerability such systems create for identity theft by multiple systems and protocols evolving over time.

Their system of customer interactions has developed over years and individually, each component makes sense.  Together, they are lethal.   Safeway started identifying customers by implementing a "Club".  Under this club, consumers were given savings on groceries.  The primary method of identification was a Safeway Club Card however many people do not bring these to the stores anymore.  The solution was for Safeway staff to ask people to use their phone numbers as the primary key to identify the fact they have a club card.  There are often spoken verbally to a cashier with a line up of people around who can listen in.

Another great customer experience Safeway uses is to thank customers by their name upon leaving the checkout.  I get a regular "Thank you Mr. Nickull" when I leave.  Now add in the ATM and visa card capabilities into the mix and there is potential for trouble.  Oh - don't forget the total amount of the bill.  This is flashed for all to see.  I'll get back to this in a bit.  If I am real clever I can also get the person's PIN for their card.  Here is the synopsis of how I would hack people based on using Safeway to do the work.

I go to Safeway, make some purchases and stand in line.  Every customer ahead of me who have a club card will verbally tell the clerk their phone number.  At this point I know their phone number.  Next when they pay for their groceries, I can see what card they are using to pay for their groceries.  Let's presume it is a Royal Bank Visa Card.  As the person leaves,  the Safeway clerk says " Thank you Mr. XXX".

Now what has just happened is subtle yet amazing.  I now have the last name, home telephone number, transaction amount, airmiles card number and some bank account detail.   So how do I use this to exploit the person?

The first thing I do is a Google search on the phone number.  I picked a random BC phone number and did a search.  There are plenty of reverse phone number lookups.

http://www.reversecanada.com/lookup/6047338121/

returned to me the following:

Persons First and last name
Physical home address including postal code.  Since I can verify the truth of this (I know the last name after all), if I get a positive match, I can proceed to stage two.

Now, what can I do with this information?  There are many possibilities.  First, I could phone the bank and change the address to a new address (a PO Box I control for example) and ask for a duplicate card to be issued to that address.  Alternatively, I could phone the person and tell them I am from the bank and that their card has been compromised.  I could give them some supplemental details to gain their trust, then get more information from them and ask them to ensure their current data is updated.  Conversation would go like this:

Me: "Hello Mr. XXX.  This is the Royal Bank and I am calling because we have had some strange incidents on your card.  I want to notify you that this call may be recorded for quality assurance.  I must ask you some questions"
Victim: "okay"
Me: "Can you verify that you had a transaction at Safeway on Broadway and MacDonald at [date] for [amount]?"
Victim " yes - that one is valid"
Me: "I have  a second transaction about 30 minutes later buying an iPad for delivery to an address in New Jersey.  Is this one also valid?"
Victim: "No.  I never ordered that"
Me: "Ok please don't worry, we will make sure that you are not billed for this. "
Me: "one more thing, can you please verify the email address you have on record for security"
Victim: (after thinking this is probably little or no security risk) "my email is XXXXX @foo.com".
Me. " Thank you, I have entered this"

Alternatively:

Me: "I have no email address for you on file.  Would you like to add one to your account?"
Victom: "Yes.  Please use victim@imabouttogetscrewed.com"
Me: "Thank you.  That has been added to your record."

So at this point I now have the following information:

- the victims bank name (and possibly PIN code)
- the victims name address and postal code
- the victims airmiles collector card
- the victims phone number

That is enough to set up a fake Airmiles.com email and present the person with an offer too good to be true (based on what I think they will be interested in from their physical appearance and grocery purchases).  For instance, if the person is buy tofu, I would offer them a subscription to vegetarian magazine for free as an Airmiles collector or offer them it for $3.99 and they get 1,000 free airmiles.  When they set up their account, I will get their password which I can then try their password/email against high value websites like Paypal, their email etc.

Once I hack their email account, I can then go to the bank website (I know their bank after all) and click the "forgot password" button and have it send me a new password.  Voila!  I now have their bank account.

Without divulging too many more details, I would also point out that there is a way to rectify this from Safeway's point of view that also might accomplish two other goals:

1. Speed up the checkout lines; and
2. Increase customer service; and
3. Increase customer security.

The scenario above is not Safeway's fault not is it Airmiles.  It is a very typical combination of systems and programs growing uncheck for years without someone having an external security audit specialist come in and analyze the bigger picture.  This scenario happens at many retail outlets.

As a consumer, express your concerns and ask the businesses you work with to take steps.  If you are a business, consider getting someone experienced in IT security to help you prevent your customers from being harmed.  This is something we all have to work towards together.

Monday, November 12, 2012

Logic Fail!

A logic fail is perhaps one of the most epic types of fails.   It resonates as funny to many who are not directly involved with the topic while often leaving the person who was responsible for the fail scratching their head wondering what it is we are all laughing about.  Take for instance the sign below from the Kamloops Zoo.  I was sort of smirking while asking about the free refills and the woman behind the counter asked me what was funny.  Needless to say we ordered three smalls. 



As mobile and wireless devices start to permeate our lives more often, these sorts of logic fails pop up now and then.  Steve Jobs noted in an early interview that architects of the telephony systems had made a fatal logic error by placing the tonal switch signals within the audible bands.    This allowed a rather fun activity called "Blue Boxing" which still worked in some remote parts of the UK until only a decade ago.

A logic fail often comes from architects building upon existing systems without discovering what is really there and questioning if something needs to be there at all.  Some very large logic fails have been recorded in recent time including the recording industry's belief that people will continue to buy music on plastic media.  

Consider the Portable Document Format (PDF) forms as another example.  PDF is great for desktop, but rendering PDF forms on mobile devices is something that should not be done.  I get asked about this quite a bit and want to clarify some of the reasons.  People ask me how to do it because they already have PDF forms.  My answer is "don't do that".

PDF forms are first and foremost often designed to render on a desktop.  The layouts often use an X, Y coordinate system with form fields placed beside each other.  This is not the way most smartphones would render an interactive form.  Smartphones usually use a vertical flow to lay out form widgets over multiple "views".  Compare the two forms below.  They are in fact the same form.  The one of the left was developed and deployed to look like it's paper ancestor while the one of the left was built by Technoracle's forms platform ingesting a PDF form and turning it into a mobile friendly form.


The logic fail here is also from assuming that the digital form should appear and render like it's paper counterpart.   This eventually leads us to believe that our earlier statement is correct.  The further out in any direction an architect goes without understanding the reasons for decisions in the underpinning technologies, the more likely that architect will fail at some point.

The fail in logic here was simply assuming that one should continue to use PDF for wireless and mobile devices.  This is simply not a logical path forward.  Aside from the layout issue, PDF forms are often bloated with much more information than is required for a mobile interaction.   Since the logic that handles things like tabbing orders, mouse hover events and window focus events is not required, using them on wireless eats up CPU and bandwidth, ultimately killing the user's battery and data plans.

We are in pre-beta right now with this technology but are already round tripping data to and from PDF forms to mobile devices.   It will not be long before we declare a public beta.



Friday, November 09, 2012

When Apples go bad

Sometimes pictures are worth more than words.  Here is a great one from OSX 10.8.6 whereby a network diagnostic tool can't quite seem to understand itself.





This next one is from the same computer but inspired by Microsoft's latest antics.   


We've come such a long way since 1995!

Monday, November 05, 2012

The Ultimate Free Boaters Reference Mobile Applicaton!

Technoracle Advanced Systems Inc. has continued to work on advancing mobile capabilities by building consumer applications.   Developing a specialty in Mobile/Wireless device eForms, we have recently completed the Insta-Captain Boater's Friend.  This mobile app runs on Android currently (iOS version awaiting approval).

Insta-Captain Boaters Friend is the ultimate (and free) boaters reference.   Under Canadian Maritime law boats over 8 meters in length must have marine VHF radios on board.  This means buying equipment and passing a government exam plus paying a yearly fee.  While not a substitue for proper marine knowledge, Insta-Captain Boating Reference is an application that solves many of the most common problems for non-marine VHF equipped boats.  In fact, it is so good that it can also augment boats that have marine VHF if you have electrical issues and your radio dies.  Here is a synopsis but don't believe us, download the free app and test it on the water yourself.

Get the app for free (Android only right now) at https://play.google.com/store/apps/details?id=air.com.technoraclesystems.apps.instracaptain


The main screen.  If you hit settings you can enter all the details about your boat.  A future version will send an instant alert into a server with all relevant data if you need rescue including location (lat & long), boat description, number of people on board, time or event and more.  Need a tow or gas?  No problem.  As long as you're in cell range (most under 8 meter boats are), you can call Marine Assist.  Make sure you mention the special code "InstaCaptain".  


If you need to call the Coast Guard and tell them where you are, the exact location is at your finger tips.


The entire Phonetic alphabet is also part of the application as well as a fairly comprehensive visual reference for most common aides to navigation.  By selecting any aid you can find detailed information about what it means and what you need to do.  A boaters reference application is a handy addition to any active boaters arsenal of knowledge.


Weather is one of the top reasons why boaters get in trouble.  Insta-Captain also delivers marine weather forecasts and special marine weather warnings right to your device.

The price for all this is free!   Future versions will contain routing, navigation plotting, locations of marinas and more.   For Marina's, if you want to be on this application, please let us know.  Being visible will help drive customers to sell gas and supplies as well as promote your marina.

Tuesday, October 23, 2012

Understanding the Different Flavors of Windows

I've been a Linux and OSX user for as long as I can remember but windows has always been a standby.  Even in today's height of Apple popularity, it is often necessary to have at least one Windows machine at our office.  For testing our PDF to mobile forms conversion platform, we find it a necessity. This lead me to seek out some data for what MicroSoft is offering nowadays and I found this great write up.

Windows 8 and many accompanying devices are launching this month and if you're going to be making a purchase,  I highly recommend you understand the differences between the versions of Windows.    Microsoft announced months ago that it will have a minimum of three consumer versions (please no jokes about the promises to fix all the bugs too ;-).  

While there are some small variations between Windows 8 and Windows 8 Pro, the biggest differences lie between those two — which have a full-featured Start Screen and desktop environments — and Windows RT, which is a mobile environment that runs only Windows Store apps and built-in software.

The story is courtesy of Wired here.  Very worthwhile read.

Sunday, October 21, 2012

(Almost) Free Flex Course and Tutorial

Since parting company with Adobe in November 2011, I have wondered what to do with my Flex and AIR expertise.  My new company (Technoracle Advanced Systems Inc.) is focusing in a new direction and we have an alpha produce that can translate PDF forms into mobile forms that run on any device.  Anyone wanting to leverage their Adobe LiveCycle ES investment to run on mobile might want to take a close look at what we are doing.  

While focusing on this, I have also been working on a conveyance of state of the art knowledge of CS 6.  I feel that this knowledge accumulated in Flex and AIR is worth sharing and is a good value from Mac Pro Video.    If anyone is seeking a series of tutorials for Adobe CS6 Flash Builder, I have begun recording a 15-20 part series in how to use this technology.  it will be released in a series of video courses over the nest few months.  Beginning with Flash Builder 101, the introduction, the courseware will eventually end in developing complex mobile applications that use accelerometers, dynamic maps, GPS and more.

MacProVideo has commissioned a series of video tutorials, each covering around 20 unique lessons.  As an Adobe MAX Master for two consecutive years, I like to imagine that the courses I have developed are worth of being in the top 0.5% (requirements for MAX Master).  The result has been to put these into production.

Here are are the links to the first courses.  The curriculum has a lot fo thought put into it in order to make it the most effective way to learn the technology in the least amount of time.

The Intro to Flash Builder 101 is available at http://www.macprovideo.com/tutorial/flash-builder-101-intro-to-flash-builder.  If you are familiar with setting up applications and building Hello World, this may be a bit primitive but things progress faster from here.

Flash Builder 102: Working with Layout Containers continues the learning path to get to the basics of how to architect and design your application's layout.  The complete instructions to build a functional word processor are also included.

Flash Builder 103: Building a Fille Browser Application advances the learning curve very quickly and shows how to add images and deploy the built-in graphical themes that get you quickly design and building an attractive UI (User Interface). You’ll also learn how to set up the FileBrowserDataGrid object – the heart of this powerful app.  This will show you how to work with the File Systems on both desktop and mobile applications.

The next batch of 3 more videos will build on this knowledge and take it further.  Please note that while the company offering the courses is named "Mac Pro Video", the courses are designed too be effective for both PC and OSX versions of CS6.

Also - for the first 100 people who buy this, I will include source code for mobile applications if you email me at duane at technoracle-systems for com.   This is an offer limited to November 15 and not endorsed officially by  Mac Pro Video, just a special promise from me ;-)










Monday, October 01, 2012

Document tracking at it's finest!

One of Technoracle Advanced Systems (my new company) customers has launched a great service today that allows document users to track the use of and control their documents over the lifecycle of the document.  They have built a very simplified and powerful web based interface to enable users to avoid many huge problems of document management.

The company is called Docktrackr and we are excited to also write this post to invite readers to access this version of docTrackr.  DocTrackr allows you to remotely control access to your Microsoft Office and PDF documents even after sharing them with others:
  • Collaborate and exchange information more securely than ever
  • Remotely destroy your documents at your discretion even after sharing them
  • Control who can access your documents
  • Know in real time how your recipients are using your documents
The best part is that no additional software required. The recipients of your documents only need Adobe Reader or Microsoft Office to open the files.  They have done a lot of work with DocTrackr and we (Technoracle) would like to extend the invitation to try it by emailing support@doctrackr.com or visting http://support.doctrackr.com/ to get an account.

Congratulations to Uli, Clement and Alex!


Thursday, August 09, 2012

How to Render PDF Forms in Mobile

Being ex-Adobe alumni, a lot of questions asking how to best render Adobe PDF forms on mobile devices come this way.  Some are about XFA forms on mobile devices, some Acrobat forms on mobile devices, but all of these have the same answer.   Don't!   Yes, this sounds abrupt and there is a multi-million dollars investment into PDF forms that would be great to turn on to mobile, but PDF was not designed for mobile.  Let's examine a few aspects of why.

First, the core PDF specification needs to be understood.  Portable Document Format (PDF) documents were designed to run on many different desktop computers.  A PDF document is "distilled" from different types of components.  There are a few basics types of objects and that is where the differences from image file formats like JPG or TIFF start.  PDF documents have headers, which are very small and contain only rudimentary information.  The second part is the body which contains objects.  Objects are numbered and can be of many types themselves.  There are cross references and then the trailer.  Besides these, the types of things you might find inside a PDF document are fonts, XMP metadata, a signature dictionary, the PDF envelope, attachments, annotations, embedded files such as images and more.

They are great for that but the model is different for the execution environment.  Mobile devices rotate the screen when the user twists the device.  A PDF is often laid out in absolute x,y coordinates which do not work well on mobile devices.  PDF's also have scripting in not one but two different languages - formCalc and JavaScript.  A PDF may have event listeners for things like "hover" which has no equivalent on a mobile device.  Tabbing order, listening for events like a window being active and more are not relevant.  BLOAT!  The long and short of this point is that PDF was just not designed for mobile.

Now Adobe and others have done a good job of rendering normal PDF's on mobile, but forms, especially flowable, multi-page PDF forms, present some huge challenges.  With soft keyboards (the popup keyboards on popular smart phones for example), the rest of the document must ensure that the form fields are not covered when then user is typing.

So what do you going to do if you have made a huge investment into something like Adobe LiveCycle ES for forms based business processes and now have to support mobile devices?  Technoracle has a solution for this today.  You also can re-write your forms from scratch (costly) or build custom native applications for each platform.  



Wednesday, July 25, 2012

Immediate Jobs at Tehnoracle

Technoracle immediately requires the two positions.  To apply, please send resumes to engineering (at) technoracle-systems (dot) com.  Both require next to perfect English language skills.


Job Req. #019

Title: Sr. iOS developer.

Department: Engineering/Agile environment
Type: Full Time
Min. Experience: Experienced in Audio/Video, network calls and graphics (skinning). We are looking for a gifted iOS developer with an eye for carefully crafted and well-designed product. If you have already shipped successful apps in the App Store that use streaming audio and video, are familiar with the RTMP protocol and can develop cutting edge applications that will work in bandwidth constrained environments, please send us your resume.

Responsibilities:
Build both iPhone and iPad apps
Work closely with product management, designers, and other teams
Rapidly fix bugs and solve pressing problems
Must work rapidly and be able to suggest new ways to solve engineering challenges
Location not important.

Requirements:
Excellent OO programming skills in Objective-C
Experience building high performance applications in memory and bandwidth constrained platforms
Strong network background
Must have audio/video streaming experience.
Strong sense of design and user experience
Have a passion for long hours and hard work.


Bonus Points:
Developed and released iPhone and iPad applications in the App Store
Previous startup experience
Android, Windows or BlackBerry native programming experience. Candidate must be able to start immediately fulltime.  


Job Req. #020 

Title: Sr. Android developer.


Department: Engineering/Agile environment
Type: Full Time Min.
Experience: Experienced in Audio/Video, network calls and graphics (skinning). We are looking for a gifted Android developer with an eye for carefully crafted and well-designed product. If you have already shipped successful apps that use streaming audio and video, are familiar with the RTMP protocol and can develop cutting edge applications that will work in bandwidth constrained environments, please send us your resume.

Responsibilities:
Build both smartphone and tablet applications with a system to reuse logic.
Must have strong network knowledge and Java skills
Work closely with product management, designers, and other teams
Rapidly fix bugs and solve pressing problems
Must work rapidly and be able to suggest new ways to solve engineering challenges
Location not important.

Requirements:
Excellent OO programming skills in Java
Able to use Android NDK for low level processing
Experience building high performance applications in memory and bandwidth constrained platforms
Strong network background
Must have audio/video streaming experience.
Strong sense of design and user experience
Have a passion for long hours and hard work.

Bonus Points:
Developed and released applications using audio, video streaming
Experience with WOWZA
Previous startup experience
iOS, Windows or BlackBerry native programming experience.
Candidate must be able to start immediately fulltime.

Thursday, July 19, 2012

Dude - Where is my C2DM?

So a project we're working on at Technoracle requires push notifications.  For iOS builds we are using Apple's APNS, which is very secure and reliable.  I had an issue with C2DM and went to the Google Developer website and was blind sided by this message:




Dang!  For the uninitiated, C2DM is Cloud to Device Messaging.  Those little red notifications you see on your phone letting you know that you have actionable items to look at works by a small daemon running in the background at all times, waiting for messages.  The messages are composed of several logical parts but the basic message contains a section describing the application destination, then another about the message.

C2DM vs GCM?

So what is GCM and why is it better?  Google Cloud Messaging is built from the lessons learned from C2DM, or so it appears to us.  Like C2DM, it's main purpose is to transfer messages to Android powered devices to let them know there is a message on a server waiting for them to do something with.  C2DM was very lightweight and easy to implement.  GCM offers some improved options.  From the google GCM website:

"a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device."

We are excited to try it and look forward to this improvement.

More reading:

To learn more about GCM, you can join the android-gcm group and read the following documents: 

Getting Started  Read this document to learn the basic steps involved in developing Android applications based on GCM.

Architectural Overview Read this document for a description of the underlying concepts and architecture in GCM.

Demo App Tutorial Read this document to walk through setting up and running the GCM demo app.

Advanced Topics Read this document to get a more in-depth understanding of key GCM features.

Migration Read this document if you are a C2DM developer moving to GCM.

GCM also provides helper libraries for client and server development.

Monday, June 25, 2012

Apple Removes Claims of "Macs being immune to viruses"


I originally bought a Mac computer based on a perception of better performance.   One of the side benefits was that OSX, the operating system behind Apple's computers, allows any virus or malware to be easily identified and removed.  As an old hand with Unix and Linux, I am more than familiar with the commands to identify any processes running on a system.  For the general public however, many simply believed that Apple computers did not get hit with viruses.  As someone who wrote malware as an experiment in high school, I can tell you this is simply not true.   Any system is prone to attack.  The Mac systems have historically been much less of a target though and relatively safe, even in the hands of newbies.  If you're running any *nix based system, grabbing a terminal and typing in "top" gives you the table or processes.  Processes cannot hide from SUDO.




Today Apple admitted this reality.  They quietly switched out a statement that claimed OSX based computers from Apple are immune to viruses with a less-forward statement: 'It's built to be safein the aftermath of the Flashback Trojan.    The Flashback Trojan (not related to Adobe Flash) infected hundreds of thousands of Macs earlier this year. 


So what can you do to protect yourself?  One tip is to set up a new user account that is not an administrator level account and use that.  The limited account will not have sufficient privileges to install the malware and you will be summoned to switch to a more privileged user to install any new packages.  UNIX was designed around these principals and it fosters awareness.


If you are not updating your software, you might also be exposing yourself to vectors for attack.  Be careful with this however as Apple also has made some upgrades that will create instability with other software such as it's own Final Cut Pro of which older versions do not run well with 10.7 OSX.


Be aware.  Apple computers are popular, which make them a target.  If you really want to be on the cutting edge, try using a VMWare image of Ubuntu and doing most of your business in that environment.  A VMWare image is sandboxed and cannot affect it's host.

Thursday, June 14, 2012

Anatomy of a Cloud Failure

Technoracle has published many articles on Cloud Computing, a technology of virtualizing computer functionality.  The virtualization occurs when a network or system's physical topology no longer aligns to it's logical topology.

Today an event happened that once again should serve as a reminder that cloud computing might not always be the best solution.  At around an hour ago Pacific Daytime Time, reports starting surging in that instances of Neo4J on the cloud were failing.  These messages initially were focused on Heroku, a generally very reliable cloud provider.  It became quickly apparent that the outages were hitting Amazon Web Services EC2 instances as well as other cloud providers.  The messages at YCombinator revealed how groups became aware of these outages:

michaelfairley 48 minutes ago | link
This is a more widespread EC2/EBS issue: http://status.aws.amazon.com/ reply DigitalSea 41 minutes ago | link I couldn't see any red circles indicating an issue with EC2/EBS.

reply michaelfairley 37 minutes ago |
link The circle is green with a little "note" on it. "8:50 PM PDT We are investigating degraded performance for some volumes in a single AZ in the us-east-1 region." reply

DigitalSea 29 minutes ago |
link Wouldn't that only affect a small subset of visitors. For example why would I be seeing any issues if I'd be hitting an Asia-pacific volume instead of a us-east region one? Seems like it goes deeper than that. reply mechanical_fish 4 minutes ago | link One problem which we've seen before is: If a large percentage of AWS infrastructure goes down, the customers don't just quietly suffer. Instead they scramble to try and launch infrastructure in other zones or regions, which creates a cascading series of load spikes throughout the AWS system. AWS is a fascinating science experiment. Pity about the websites, though. -----

michaelfairley 12 minutes ago |
link It's now yellow with this: "9:27 PM PDT We continue to investigate this issue. We can confirm that there is both impact to volumes and instances in a single AZ in US-EAST-1 Region. We are also experiencing increased error rates and latencies on the EC2 APIs in the US-EAST-1 Region." AWS has been historically bad at reporting the severity of their outages promptly. reply

The conversation can be viewed here - http://news.ycombinator.com/item?id=4114846

The spread of this from one cloud provider to another in such rapid succession shows the fragility interconnected systems have an how they are susceptible to these types of events.  With time, it is hoped that the lessons learned from these types of events will help us all build better systems. 

At the time of this posting, the event is still unfolding.

Wednesday, June 06, 2012

Cheap water heaters: Rheam & Hillside Still Suck

I get so many hits on this piece I wrote about their failure to honor a simple warranty.

http://technoracle.blogspot.ca/2007/05/buying-hot-water-heater-read-this-first.html

I feel this is once again worth mentioning as people have been constantly reading this and either thanking me for helping them change their minds and buy from a reputable company or to suggest a class action lawsuit based on getting ripped off as I did.   Rheam and Hillcrest Plumbing,  partners in crime.

Tuesday, May 29, 2012

Where Facebook is Heading?

Recently there has been a lot of hyperbole around Facebook.  The acquisition or Instagram for $1 billion, the rumors of a Facebook phone and now the potential acquisition of Opera.  I predicted the IPO would be a bad investment and the recent news consolidates my feelings about a company that is running amok. Why would Facebook, a company that according to some can't even build a good mobile application, consider buying a browser?  At Technoracle, we are not analysts but once in a while like to express opinions on current trends.

An acquisition of Opera would not be very beneficial for either company, nor would it be of much use in generating revenue for Facebook.  Facebook is a platform and Opera users already use Facebook.  We seriously doubt it would mean every Opera user would instantly become a new Facebook user.  Even if they did, to what end?

We are not alone in these thoughts either.  Trip Chowdry writes

"Buying Opera will likely be another stupid acquisition, the previous one being Instagram," 

Trip Chowdhry is a managing director of equity research at Global Equities Research.  We differ on rationale slightly.  Trip notes that buying Opera would potentially narrow Facebooks's ecosystem, not expand it.    The one item that Facebook needs to desperately expand upon is revenue generation.  Some investors have launched lawsuits alleging alleges that the defendants (Zuckerberg et al) hid the company's weakened growth forecasts from investors prior to the acquisition.  Whether this is true or not, growing revenue is one thing that keeps Wall Street happy.

Rather than go out and acquire technology, Facebook needs to wrangle in revenue producing companies or monetize their current investments. The IPO is done, the war chest is full of money.   Now is the time to build the business model that ensures long term success.  Remember MySpace?  The public is fickle and Facebook is not infallible.  MySpace's fall from grace happened so quickly most bands don't even bother with it anymore.

The acquisition of Instagram is also causing head shaking.  Instagram, as many have noted, is not technically a large amount of work to recreate.  They do have a solid install base which could be a play for users yet I suspect that two developers could re-create the applications in a week.  Filters are not hard to build.  Sharing photographs is a feature already built in to most modern camera equipped phones today.

The current Facebook API's and mobile applications are basically wrappers around the website.  So what is the long term plan here?  Let's try and sum up what we see happening.

Is it possible that Facebook wants to enter the contextual, POS advertising market?  Imagine this scenario.  You are walking down the street and your Facebook phone buzzes.  It alerts you that one of your Facebook friends is 100 meters away.  A backend algorithm has deduced that both of you like Starbucks (tm) and it sets up a DM to your friend suggesting you meet at the starbucks adjacent to your corner for a quick beverage.  It also provides you with a code for a discount on Starbucks which is tracked and revenue shared back to Facebook.

This scenario could offer a white boxed customer loyalty program for many businesses.  Unlike the Groupon model where drastic discounts can cause issues, Facebook could potentially use a 4Square type model to build a new contextual advertising market place.

For this scenario,  you would need the following components:

1. Large social graph
2. A GPS enabled phone or mobile app that can use GPS data
3. Either a proper mobile app or an HTML5, location aware browser that can be used to display the data
4. A deeper understanding of consumer spending habits and impulse purchases
5. A way to share the memories or post photos

Is this where Facebook is heading?

Thursday, May 24, 2012

My Thoughts on Adobe Creative Cloud vs CS 5.5.

Recently there has been a lot of advertising urging me to "upgrade" from CS 5.5 to the Adobe Creative Cloud.  I am hesitant for a few reasons.  The first is pricing.  Right now introductory pricing is between free (introductory trial) $29.95 and $79.95 per year.  This is noted as "Introductory pricing.  My concern is that instead of buying the software as I have in the past, I am not in a model whereby I will be paying rent every month.  There is no guarantee that pricing will not go up in the future either.  I am concerned about a new model where I pay monthly revenues every month, even if I do not require or use the software.

The next part is fairly obvious.  Storage will cost money.  The $79.95 plan (roughly $950 per year), comes with twenty (20) GB of storage.  I have episodes of Duane's World that are over 100 GB.  How much is this going to cost me?  Maybe I archive it locally?

Some good points should be the performance.  I will definitely be trying some of the more computationally expensive tasks from the free account to test.  Another benefit is that all my files (well 20GB of them) are with me wherever I go.

Adobe has put a lot of thought into this and it will be interesting to see what percentage of CS 5 and 5.5. users actually jump to the cloud or upgrade further.  I'm not a good designer (as is obviously by my blog design) and probably cannot make use of most of the features. This makes me happy to stay on 5.5.

I'd like to hear stories from those on the Creative Cloud.  What kind of experience are you having?

Friday, May 18, 2012

Apple 10.7.4 IMPORTANT NOTICE BEFORE UPGRADING!

I had a hard drive issue the other day and decided to upgrade and re-install my OS on a new drive.  I started by installing OSX Snow Leopard and then upgraded to Lion 10.7, which immediately prompted some updates to the OS, leaving me with 10.7.4. My machine is a Mac Pro running 2 X 3 GHz Quad-Core Intel Xenon processors.



To my horror, when I went to install Sorenson Squeeze 5, which is market on the outside package as "Universal" install for Mac meaning it runs on both PPC and Intel architectures.  When you open the folder, there are two installers - one for Intel based Macs (like mine) and one for PPC based Macs.


PPC is no longer supported but to my horror, when I tried to install the Intel version, I got the following message.


I got the same behavior with several other "universal" installs so I set up a call with Apple to discuss this, thinking it is obviously a bug.  The call took place at 9:00 AM PDT and I am going to share with you what was said to me.  BTW = if anyone from Apple wants to know who the person was, the case was Express Lane Case 315474064: Scheduled Support Call.    First  the Apple guy told me it was because Lion no longer supports PPC.  I told him that up until the day before, I had my Final Cut Pro and Sorenson running on this same machine with the Lion OSX.  He was unapologetic and told me I just had to just pay Apple to upgrade to a newer version of Final Cut Pro.  My reaction was to put my hands up and say "don't shoot" but I politely suggested this sort of behaviour was not appropriate given the stamp "Universal" means it runs on Intel.   I also told him that by him telling me I had to go and upgrade all my software was akin to robbery.   I told him I was going to blog about this and he got really worried and said he had not said anything and I should refer to the website.    He said "I didn't say that and anything you say you are making up".

Sorry pal.  The truth is the truth and this blog stays here!  That's final.  Nio court gag order will take this down.

Well, I am blogging about because other people might want to know about this.  There is an error and I hope someone from Apple reads this and sorts it out.   Please be warned! 



Dear Apple:  Please explain what "universal" really means?  From their website:

"Now every new Mac ships with an Intel processor. Experience delightful responsiveness from the smallest Mac mini to the most beefed-up Mac Pro. Use one of more than 7,000 universal applications that take full advantage of the Intel chip."

Hmmmm.

Wednesday, May 16, 2012

Adobe LiveCycle ES3 (version 10.0) Download

Adobe has recently announced that Adobe LiveCycle ES3 is available as a download.  This announcement was met with some great enthusiasm by the community, none less than us here at Technoracle.  The brand itself had been subject of much speculation regarding it’s future and we are happy to see the investment into LiveCycle continue.  This re-invigorates our own investment to work with this excellent SOA platform.

Having now been accepted into the Adobe Enterprise Solution Partner Program, we are extremely excited to be amongst the first in the world to offer you, the customers, the ability to purchase Adobe LiveCycle ES3 and professional services around it, starting from initial project consulting to complete project management.  In case you haven’t heard, there are several new features that many enterprises have asked for.   Our great former colleagues Jeff Stanier and Dave Welch have done a spectacular job of making this release a “must have”.

LiveCycle ES3 first and foremost incorporates the Data Services ES3 module (version 4.6.1), an optimized Java server framework that can enhance and simplify the development of rich, data-intensive enterprise and mobile applications.  This includes several mobile platforms such as iOS, Android etc.

ES3 also offers a new SAP to Java connector for creating front-end interfaces to SAP systems. Alongside this update are connectors for FileNet 5 and easier SharePoint server farm deployment and integration.

Our favorite new feature is within LiveCycle Designer.  When you add a new submit button, Designer allows you to select an encryption method and choose from from several XML encryption/decryption algorithms.   This will help with many accounts we are currently working on.
Out mobile MEAP-lite platform is also a good way to add custom mobile functionality for wireless device integration into business process.  Companies like Uberity have already released a great free and open source mobile SMS module including the full source code and binaries at http://blog.uberity.com/2012/02/extending-adobe-livecycle-es-to-use-sms-in-business-processes/

So why wait?  Get started today.   Contact us, a company founded by former top LiveCycle ES rock stars and engineering managers.  Leave a omment if you wish to inquire about our services around LiveCycle ES3.

Tuesday, May 15, 2012

Neo4J Tutorial #4: Registering a shutdown hook

In the previous tutorials on Neo4J, we discussed what Neo4J is, how to start it and use Cypher for basic queries and getting started with Neo4J and Java.  In the third of these, we had hinted there are some things you should do that are best practices in a proper environment.

To start this tutorial, please first follow the 3rd of the series from http://technoracle.blogspot.ca/2012/05/third-neo4j-tutorial-getting-started.html

You' notice that on Neo4J's pages, they discuss a shutdown hook.  So what exactly is that and why would anyone use it?


If you examine the code on the previous tutorial, you will see that you can shutdown a database by simply calling grapDB,shutdown();  These lines of code are shown above.  Note that calling shutown() only tries to shutdown the database.  The Shutdown hook simply ensures that the database shuts down cleanly.

To add a shutdown hook to the code in the previous tutorial, navigate to the createDB() method and register a shutdownhook handler right under the line where you create the database.  With the new line added, your code should look like this:


At this time, you may notice red X's as this introduces errors into the project.  We have registered a shutdown hook which takes a single argument of  the graphDB instance it will register the hook for.  Now it is time to write the hook.  




registerShutdownHook() is a static method that returns nothing (void).  The syntax above is a bit confusing given line 91 calls addShutDownHook on a new thread and closes around line 99, hence the erroneous looking but much required "});" syntax.  This essentially encapsulates the functionality.    The shutdown hook ensures that the Neo4j instance shuts down nicely when the VM exits (even if you "Ctrl-C" the running instance before it has finished running.  Try running this example now with the modifications and you should see the following print out in your console.





Tuesday, May 08, 2012

Third Neo4J Tutorial: Getting Started with Java

In this tutorial we will learn how to talk to Neo4J using Java.  There are a few tutorials from Neo Technologies which are very useful however I have my unique style of teaching and want to explain this technoracle-style.

First, if you haven’t already familiarized yourself with Getting Start with Neo4J and the Getting Started with the Neo4J Cypher Shell, check out those two articles.

Here are the steps to communicating with Neo4J from a Java environment.  This tutorial should take you about 30 minutes to complete.

SETUP

1.  Ensure you have the right version of Java and the Java JDK environment set up properly. On a Mac, this is probably already done for you. On a PC, you might have to manually download and install the right version of Java and set the PATH and JAVA_HOME environmental variable from scratch. 

2. Download and install Neo4J. In this tutorial I am using Neo4J 1.8 M01 release. I installed it on my OSX 10.7.3 laptop under my home directory (/Users/dnickull/Software/Neo4J_1.8/)

3.  Ensure you have the correct version of Eclipse installed. For this tutorial, I downloaded Eclipse Indigo Service Release 1, Build id: 20110916-0149.  I use the version entitled Eclipse IDE for Java EE Developers.

STARTING THE PROJECT

4.  Within Eclipse, select File -> new -> Java Project and give the new project a name. In my case I m calling mine “Neo_1.8”. Select Next.

5.  Under the second new project page, select Java Build Path (1) the libraries tab (2) and then click on Add External Jars (3). This will allow you to browse for external jar files.


6. Browse to the directory you installed Neo4J under and look under the “libs” directory. 



 7. Click on one of the *.jar files under that directory and hit the mnemonic key to select all (Command –A on OSX, Control A on PC). Click Add and Finish (even if you're not from Finland ;-). 

 8. In Eclipse, right click (Control click on PC) on the “src” folder of your newly created Eclipse project and select New -> Package. In the dialog window, add a new package name. In the figure below, I added com.technoraclesystems.neo4jutils. Hit the Finish button.



9. Right click (PC) or Control Click (OSX) on the newly created package name and select “New -> Java Class”. Provide a name for your class. In the example below I created a public class called HelloNeo4J.  Click Finish



10. Add the following import statements into your project.


11. Next we have to create the path to the actual Neo4J instance you installed. This is done with one line of code. Just below the class declaration, add the following line replacing the path with your path to the Neo4J 1.8. Note that the path on a PC will use the “\” chafacter instead of the “/” character and you will also have to escape it by placing a second “\” in front of each path separator.  THis should be the first line under your public class HelloNeo4J { statement.



12. For this simple tutorial, we will create 5 new class member variables as shown below on lines 19 - 23. Note that I have closed the imports statements but Eclipse keeps the lines numbers intact.



13. The variables will be used as follows in the program.
          a. myString – concatenates various strings to print back to the console
          b. graphDB – an instance of Neo4J to work with
          c. myFirstNode – a neo4J node
          d. mySecondNode – a second neo4J node
          e. myRelationship – the simple relationship between the two nodes.

 14. The next item to create is a static method to declare the list of relationships In this case we are using the word “KNOWS”, which sub-types the neo4J interface RelationshipTypes (API Docs).




15. A relationship type is mandatory on all relationships and is used to navigate the node space. RelationshipType is in particular a key part of the traverser framework but it's also used in various relationship operations on Node. RelationshipType is designed to work well with Java 5 enumerationss. This means that it's very easy to define a set of valid relationship types by declaring an enum that implements RelationshipType and then reuse that across the application.

16. Now we need to implement our main() method. The main method has 3 basic parts. The first is to instantiate myNeo4JInstance, an embedded instance of Neo4J. There are then consecutive calls to createDb(), removeData() and shutdown().  Add the stub code for these methods.



17. The first method to complete will be the createDb(). Add the following lines of code to this method.

NOTE: This is a bare bones, minimal tutorial.  In production, there are several other items to take care of such as registering a shutdown hook to ensure the database stops properly.  This would normally be done at this stage.  Read more about the importance of the shutdown hook here http://docs.neo4j.org/chunked/stable/tutorials-java-embedded-setup.html


THE TRANSACTION 

18. The first line calls the GraphDatabaseFactory method to create a new instance of the embedded Neo4J which takes one argument, the DB_PATH we set up earlier.  The second line start a new transaction named tx.


19. The next line will set up a new Transaction with the identifier “tx” and calls the graphDB’s createNode() method. The transaction basically has two main parts:

 try { 
        //Some logic 
         tx.success 
       } finally { 
         tx.finish(); 
 } 

20. The idea is that your application logic goes under the try. All your application logic should be executed before the tx.success() statement. If all goes well, tx.success marks the transaction as successful but does not actually commit it. This is only done when tx.finish() is called. If tx.falure() is thrown during the logic phase, the database is rolled back. This is about as simple and elegant as it gets.

Here is how our logic will go to create a very simple graph of two musicians who know each other.


21. Lines 44 and 45 set properties for myFirstNote while lines 46-47 do the same for mySecondNode.  Starting on line 49, a relationship is created between those two nodes using the type from our Java enum, namely "KNOWS".  This is all printed to string before tx.success() is called.  tx.finish() is where the transaction is actually committed.

22. Next we will tackle the removeData() method, which will be executed next in the main method. This essentially undoes all the work we just completed. Modify the contents as follows. Note that this uses the exact same transaction construct as when we created the database.


23. Line 70 basically provides a start context for the transaction by looking for myFirstNode and calls the delete() method on the relationship.    The same delete() method is then called on both other nodes.

24. The last portion of the code to write is to shutdown the database. Luckily once more the engineers from Neo4J have provided a great method for doing this, aptly named shutdown().


RUN THE PROJECT

25. That is it!  If you run your project, all should go well and you should see the following in your console.



If you would like the source code for this project, please email me duane at nickull dot net.  Also, this is very important to remember.  This is a very basic tutorial.  It is very important to learn about other methods and hooks such as the synch hook, shutdown hook and how to clear the database in order to use Java safely with Neo4J.  There is a great tutorial at http://docs.neo4j.org/chunked/stable/tutorials-java-embedded.html that explains more and the Java API docs are at http://api.neo4j.org/1.8.M01/.

SOURCE CODE

package com.technoraclesystems.neo4jutils;

// From the //neo4j_install_dir/lib directory
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;

public class HelloNeo4J {
    private static final String DB_PATH = "/Users/duanenickull/Software/neo4j-community-1.8.M01/";

    String myString;
    GraphDatabaseService graphDb;
    Node myFirstNode;
    Node mySecondNode;
    Relationship myRelationship;

    private static enum RelTypes implements RelationshipType
    {
        KNOWS
    }
    
    public static void main( final String[] args )
    {
    
        HelloNeo4J myNeoInstance = new HelloNeo4J();
        myNeoInstance.createDb();
        myNeoInstance.removeData();
        myNeoInstance.shutDown();
        
    }
    
    void createDb()
    {
        graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );

        Transaction tx = graphDb.beginTx();
        try
        {
            myFirstNode = graphDb.createNode();
            myFirstNode.setProperty( "name", "Duane Nickull, I Braineater" );
            mySecondNode = graphDb.createNode();
            mySecondNode.setProperty( "name", "Randy Rampage, Annihilator" );

            myRelationship = myFirstNode.createRelationshipTo( mySecondNode, RelTypes.KNOWS );
            myRelationship.setProperty( "relationship-type", "knows" );
            
            myString = ( myFirstNode.getProperty( "name" ).toString() )
                       + " " + ( myRelationship.getProperty( "relationship-type" ).toString() )
                       + " " + ( mySecondNode.getProperty( "name" ).toString() );
            System.out.println(myString);

            tx.success();
        }
        finally
        {
            tx.finish();
        }
    }
    
    void removeData()
    {
        Transaction tx = graphDb.beginTx();
        try
        {
            myFirstNode.getSingleRelationship( RelTypes.KNOWS, Direction.OUTGOING ).delete();
            System.out.println("Removing nodes...");
            myFirstNode.delete();
            mySecondNode.delete();
            tx.success();
        }
        finally
        {
            tx.finish();
        }
    }
    
    void shutDown()
    {
        graphDb.shutdown();
        System.out.println("graphDB shut down.");   
    }   
}


Enjoy and have fun!