Tuesday, September 24, 2013

6. Backups

No matter how big or small your project, you need to backup your data! Why not do it for FREE!
Most people do not know how backup your data properly. If you are building an HTML site or any size application, you need to backup your data. I will explain how to do that correctly and for FREE. 

Online repositories

High end applications can have more than one person working on it. There can be one person per project file or multiple people working on the same project file. The system that stores all of the files in a large application is called a data repository. If the data is on the internet, it is referred to as an online repository. If the data is on your computer, it is called a local repository.

If you backup your data, you can retrieve the backup after you accidentally delete, modify or corrupt any file. But, not only are you limited to whatever you backed up, you also can only retrieve the one backup you made. If you have multiple backups you can get older files but it is usually not easy. Of course if your computer is stolen or gets a virus, without a backup, you are screwed!

If you use an online repository, you have all of your data safe online. You get a free online "folder" that manages every version of every file you use for each project. Anyone can download the entire repository and get every version of every file you have made in your project. It also has tight security and can be configured to transfer all of your files securely.

There are many free online repositories. SourceForge, GitHub and Bitbucket are the most popular. All three allow unlimited space and free hosting for source code. I use Bitbucket because you can setup 5 repositories with 5 users each, all for FREE! It also includes an issue tracker.



Version Control Application

In addition to an online repository, you also need version control software installed on your computer. I will explain how to use TortoiseHg, a version control software for PC's. If you are running a MAC, you can use SourceTree.

People usually think of a backup system as being capable of doing the following tasks.
  • Backup my data.
  • Retrieve a file from my data.
That sounds easy. But, in order to take advantage of the power of a Version Control Application and be ready to scale up any project, you will need to learn how to do the following tasks which I explain below.
  1. Create a local Repository.
  2. Manage local Repositories. 
  3. Commit a change to local Repository.
  4. Upload to online repository.
  5. Download from online repository.
They are very similar to the two steps above (backup and retrieve). But, there are a few other steps because you have the entire backup on your machine and on the online repository (e.g. Bitbucket). 

In order to backup, you first commit a change to your local repository. Then, you upload it to the server (bitbucket). 

To retrieve a file you simply view the history of files and then retrieve any version you previously committed. If your computer gets corrupted, you have the entire repository safe, on the server.
One of the advantages of using a Version control software, is your do not have to save any document as version 1, version 2, etc. Just name every file exactly what it should be called, then backup every version (or "commit" every change, as I will explain below).
1. Create an local Repository

Have you ever bought a new DVD disk or flash drive to backup some data? First it costs money, and second it is not as easy as creating a new repository on your computer to store backups. With the use of a version control system, you will never have to buy another backup disk again, and it's always FREE!

When you start building a new application, one of the first things to do is create a repository to store your files for each project file that you will be building for the application.

Here is how to create a new repository on your computer using Bitbucket (installed).

Open up Windows File Explorer and navigate to the folder where you store your project files. If you have multiple projects for you application you will need to repeat this for each one. 

Right-Click with your mouse in the center of the File Explorer, inside the folder. You will see the following menu. Choose Create Repository Here. When the dialog comes up, leave everything alone and click on Create and you are done.

































This does not backup any data, it simply creates a new local repository for you to store you data. 

When you create a local repository, it creates a folder called .hg. Do not delete, edit, move or modify this file. This is your physical repository, which is actually a compressed package of all of your files. 

2. Manage local Repositories.


Now that you have a repositry, you want to open it up in the TortoiseHg interface to view your backups. From within the TortoiseHg workbench interface, choose File \ Open Repository. Choose the folder you created and open it. Once open, double click the repository listed on the right, you can see the files as displayed in the image below.
























3. Commit to local Repository.

Every time you want to save a backup, usually every night or when you complete something, follow these steps to commit changes to your local repository:

The top item will be called Working Directory, click on it to see what you have recently edited (files are listed below). Of course, you have to have changes to commit or this will not work!

Click on the button above the files to make sure you have selected all files to be added or removed.
















Type in something to describe your modification into to the box then click Commit. Keep in mind, the files must not be open when you click on commit or it will not work. 











Before you can upload to an online repository you need to setup an account with an online repository. If you have not done already, go to bitbucket.org and create a new account and repository. Once you do you can choose the repository. Name the repository the same name as your Flash Builder or Flash Develop project file name. Make sure you have chosen local repository you want to synchronize and working directory has been selected. 

After you commit your files, the file icons in your project, viewed from Windows Explorer will have a green check mark next to them. When you modify files, the green check changes to a red one.

4. Upload to online Repository

After you commit changes to your local repository, you can upload it to the online repository anytime you want. If you are working alone, you might update your online repository around every week or so. But, if you are working with other team members, you will need to update the online repository daily so that other team members can get your changes.

  • Log into Bitbucket and select your repository. 
  • Choose HTTPS from status dialog pull down, as shown in image below. 




















  • Copy the address displayed into your clipboard. 
  • Enter TortoiseHg and select your project.
  • Select Working Directory.
  • Click on Push Changes button as shown on the image below.










An error will appear, click OK.
  • Paste the address into the box provided, as shown in the image below.










  • Click on Push Changes again.
  • Supply your Bitbucket password to start the upload. 
In a future blog, I will explain advanced version control techniques like branches, pull requests, forking and merging code. I will also explain setting up secure connection with your online repository through "configured files" so that the process does not include copying and pasting anything.

5. Download from online repository.

Now that you have an online repository with all of your data, you can have other team members download it. Or, simply access it to replace corrupt files on your computer. 

When they download the repository, they are downloading every version of every file that everyone has ever made for that project.

Bitbucket makes this real easy; you can view the entire folder structure with the Source button. To download the source code, click on Download, on the bottom of the Bitbucket status area, as seen in the image below.



















 

About Sonoma Data Solutions LLC

My company, Sonoma Data Solutions is located in Sonoma County, in northern California. I started my company with the goal of building high end applications. I have worked for HP, Agilent, and on applications for EA Sports and Disney.

We provide full services to conceptualize, design, build, test and deploy your application online. We also provide financial options to make your application a reality.
Do not wait to build your application, define and grow your brand, and monetize your ideas.
Check out my website or contact me if you have any questions.

Thank you, 
John Molinari

Sonoma Data Solutions LLC
john@sonomadatasolutions.com


PREVIOUS POST  - NEXT POST


Sunday, September 22, 2013

5. Installing and Configuring

When people think of Adobe Flash, they usually say something like "Isn't that dead?"
For better or worse, Adobe has kept the name Flash to describe two completely different technologies, Adobe Flash Player and Adobe Flash Development products. The first is a consumer product and the later are professional products. So it makes sense that most people do not even know that the professional products even exists; and therefore most people do not know the power they have.

Flash player is not dead! In fact, it now has the abilities of the most advanced 3D gaming systems. It does not try to complete with HTML either. If you want to build a website, use HTML. If you want to build a high end application that runs on EVERYTHING, use Flash. 

You might be asking: What does Flash have to do with Apache Flex? 

As I explained in an earlier blog, Apache Flex's engine is nothing without a development environment. Since Adobe originally built Apache Flex, Adobe has made it so that you can also compile your application directly from Adobe Flash Professional, a design and animation product. Therefore, you can build a simple development environment with simple design and animation using Flash Professional. But, to build high end applications, DO NOT use Flash Professional as your code editor.

The diagram below outlines the Flash Development environments using three code editors that can generate mobile, tablet and websites (in the form of an HTML file and a "swf").

Compiling using Flash Professional, Flash Builder and Flash Develop 

Technically, the Flash Compiler is currently known as the "Falcon" compiler. A new product called Falcoln JS, under development will allow users to generate HTML / JavaScript from the same Flash development environments.
MXML and Actionscript are the languages that you can use to code your application.  In addition, Apache flex also supports Java, C++, C# and Objective C languages too. 

You are now ready to choose your development environment. If you wish, you can download a code editor from the links I provided in the previous post. Or, you can simply follow along and see how easy it is as I continue. 

Adobe Flash Builder

Most of my examples will be using Flash Builder. I will include project files and examples using Flash Develop in future blog posts. If you choose to use Flash Builder, you can follow along as I explain each step.

Once you install your application, you can create a new project using the File \ New menu (in Flash Builder).

 


























As you can see, you can create many different projects. If you are building a simple application that you want to work on all mobile and tablets, choose Flex Mobile Project. If you want a simple application for a websites, choose Flex Project. If you are building a high end application, you will actually be building many projects to support your entire application. For now, lets start with a Mobile Project.

If you use Flash Develop, you would create a new project using the Project menu. As you can see, it has many of the same choices. 

Flash Develop - New Project Dialog












Once you create a project, name it and save it, you will see the following buttons on the top menu (in Flash Builder). 





These buttons compile and run your application on your connected device or through a simulator on your computer. The buttons from left to right are Debug, Run, Profile. You will use Debug most of the time. To see the application run at the speed that it will when it is finished, choose Run. To test the memory and performance of the application, choose the Profile button.

When you are finished writing your application, choose the Export Release Build from the Project menu.

If you choose Debug with a Mobile project, can choose from many configured mobile devices as you can see below. You can also add new ones as they are released. This is not the full list of supported devices, just the ones I have configured to be tested.



Which language do I choose?

Do you already know HTML? if so, you already know the basics of MXML. If not, I will explain everything in later posts.

If you need the performance that is required to deliver a high end 3D game with lots of graphics, you will need to choose Actionscript with NO MXML. If this is not the case, you can choose MXML with Actionscript.

If you are building a high end application, you will need to separate the application into multiple projects. Each one can be have their own language and are independent of the others.

Here is an example of project files needed for a high end multi-platform application with Apache Flex.
  1. Data Model Project: Written with Actionscript.
  2. Test Suites Project: Written with Actionscript.
  3. Mobile Application View and Controllers: Written with MXML and Actionscript.
  4. Web Application View and Controllers: Written with MXML and Actionscript.
The information in your application is managed by the Data Model Project that generates a library file that the other projects use. The Test Suites Project runs automated tests against the library file. The last two projects are responsible for the logic to run and display on the specific platforms. If an advanced technique is required, it can be written for the specific device using C++, Java and Objective-C then included with one of the last two projects.

In my next blog I will discuss the topic of backing up data using a version control system and data repository, one of the most important aspects of development. 

 PREVIOUS -- NEXT

Friday, September 20, 2013

4. Creating Apps

Most of the time it takes to build an application is in the setup.
Imagine if you had a computer sitting in the corner with an application environment already installed and ready to develop your application. It has specifically been designed and configured to compile your application. When you click on the magic button, it does exactly that! Wouldn't that be easy?

Well, there are many different types of applications. So, there are different types of development environments. If someone actually configured a computer as I described above, it would probably generate similar applications. What's the point of that? Games! Games! Games! That's right, and there is an application development environment that is designed to generate games. Most games generally act the same. So, a company called Unity Technologies, created a "turn-key" solution for building games. It is a high end, packaged solution with a high end price tag, see Unity3D.

If you can afford Unity3D and you are building a game, it is a very good solution. But, if you do not have thousands of dollars to spend, this might not be an option.
Design your development environment based on your app
If you are not building a game or do not want to pay the Unity high end price tag then you need to take the time to setup your own development environment with Apache Flex.

Imagine having a great car engine without a car body. Well, that is what Apache Flex is. It is a great engine to create multi-platform apps. But like a car, it needs a "body" to work. If you look inside the car, you will see a bunch of buttons and knobs to control the engine and stuff. Well, the body for a compiler is similar and is called a "code editor".

There are two popular Apache Flex code editors; one is free and one is not. Both include everything you need to compile multi-platform applications.

Flash Developwww.flashdevelop.org
Pro: Free and easy setup.
Con: No easy iPhone, Android, or Blackberry output.

Flash Builderwww.adobe.com
Pro: Easy setup. 
Con: $699 or $50 a month for all Adobe products.

Flash builder is the easiest to get up and running fast. 

There are also other code editors in addition to the two listed above, including Flash Professional. 

A development environment requires many things including a code editor, a server, MVC libraries, release build scripts, online repository and automated test projects. 

Keep tuned.. In my future blogs, I will go over the details of installing, configuring and compiling apps using both development environments. 


PREVIOUS  --   NEXT


Monday, September 16, 2013

3. Compiler

In my last post, I proposed to you the possibility that I could magically tell you the one compiler that would answer all of your prayers and make everything as easy as a single button click.

I have bad news and a confession to make... I cannot predict the future!

That's right! If I could, I might tell you that Apple, Microsoft and Blackberry will die within a decade and Android will dominate the entire landscape. If that was true, choose an Android compiler and you are ready to go. But, I am in now way presuming or predicting that!

The Good News.

Even though I cannot predict the future, I can make an educated guess. And I predict that one of the four compilers I mentioned above have a high likelihood of being around in a decade. So, I want to choose a compiler that exists today that supports all 4 devices. I also want that compiler to be fee and easy to use! Well, I have the answer for you. It's called Apache Flex!

What is Apache Flex?
Adobe, the makers of Photoshop, introduced a compiler called Adobe Flex many years ago. Eventually, Adobe donated Adobe Flex to Apache. See flex.apache.org
 
What is Apache?
Apache is a non-profit foundation formed to build open source software, which is free to use and distribute. See apache.org.
Using Apache Flex, you can compile directly to Apple iOS, Android, Windows, MAC OSX and Blackberry operating systems, all for FREE!
There are many great compilers on the market. But there is no compiler that support all of these devices. If you are trying to reach as many customers as possible, you should choose Apache Flex! Plus, they are now supporting the new 2014 interactive televisions sets!

Click here to see hundreds of examples of Apache Flex and Adobe Flash Apps.

My next blog will begin the detail of setting up and programming using Apache Flex.

PREVIOUS   --  NEXT

Saturday, September 14, 2013

2. Applications - An introduction

The term "Application" is used for desktop apps, downloaded apps and even some advanced HTML websites are referred to "Applications"

Most HTML websites are written in and run from a bunch of text files, created using simple English characters. So, if you know how to type in English, you can create HTML websites quite easily.

"Real" applications run through a process called "compiling", which translates the same "English characters" into a bunch of "Machine Code". 

Its important to note here that when I use the term "English characters", I am referring to the characters you can type in on your keyboard. In reality, the "English characters" that you type is in the form of something called a "computer language". A computer language is just a bunch of "English characters" written in a specific format as I will explain later. From now on, I will refer to the "English characters" as a computer language.

What's Machine Code? 
Well, when you compile a file that was written using a computer language, the new file it generates is the format of "Machine Code". And, since machine code is written in the language that the computer understands, it runs really fast; Much faster than HTML! Machine code cannot be read by humans, only computers.

How difficult is it to compile into Machine Code? 
It's as simple as clicking on a single button. 
"Real Applications are compiled"
If you are building a small website or a project that you expect to have little traffic and usage, then it is not worth the time to learn how to create "Real Applications". In this case, you are better off building your project using HTML or a site builder like blogger.com, sites.google.com for simple sites. You can also learn HTML or hire someone that knows HTML. Nowadays, almost everyone knows someone that knows HTML. 

An important point to make is that there are many different computers, and many of them support different types of Machine code. For example, a Macintosh compiled product will not work in a Windows system because it does not support the same machine code. The same is true between an Apple iPhone and an Android Phone, they do not speak the same machine code. This means that you need to compile into multiple Machine Codes.

How do I know which code will work on which machine?
The operating system on the device defines the Machine Code support. So, a device running Apple's iOS will not work on a Windows 8. It will also will not work on a Macintosh which has a completely different operating system.

OK, what compiler should I use?
Since there are many devices and many languages, there are many compilers to choose from. I will simplify the choices for you.

If you want to compile to one device, use the compiler that is designed to compile to that operating system. This is usually supplied by the manufacturer of the device. For example, if you want to compile only to the Apple iOS devices, use Apple's "Xcode" compiler. 

So, I need to write the application many times for each device?
If you want to compile to every device that exists, that answer is yes. But, there are some compilers that actually compile machine code for multiple devices with the same language. For example, iOS and Macintosh OSX both use Apple's XCode compiler. But, they do not support Android. 

Professional Vs Consumer

It is important to differentiate the product you want to build before you decide which compiler to use. If it is a professional product that will be distributed to a very targeted market, then you can choose to support a limited number of devices. In this case, choose the compiler that meets the specific devices you want to support. 

However, if you are focusing your product on the consumer market then you need to take a different approach. 

First lets go over some data...

Today, 70% of the consumer market is on tablets and mobile devices. And there is every indication that this will increase.

There is about 8 Billion people on the planet. Out of that 8 billion, 5 billion have a cell phone. Out of that 5 billion, 2 billion have smart phones and the rest have older "dumb" phones that cannot run applications. Over the next few years, Apple and other manufacturers are working hard to sell lower cost "smart phones" to replace their older "dump" phones. There are about 2 Billion people that will probably never buy a cell phone. 
That means that 6 out of the 8 billion people on the planet will have a device on them that will be capable of running your app!
Now the major question...

What compiler will allow me to target the 6 Billion consumers?

The answer in the next Blog...

PREVIOUS - NEXT


Friday, September 13, 2013

1. Languages and end results

Languages and end results

What’s the point of learning a computer language? This is usually to get a job or build something you are passionate about.

I started in computer languages with simple scripts called batch files. For most of you, this will sound foreign. For everyone else, you know a batch file is a file that “does a bunch of things on the computer, in order when you run it”. Funny thing is that all computer languages do this. The only difference is that more advances languages do it on more than one computer. But it is still the same basic concept: “doing a bunch of things, in order”.

As everyone knows, computers get faster every year. Therefore, the tasks can be run faster every year. So fast that you can automate or simulate things that human beings can’t do, especially that fast.

Computers are everywhere! You can now wear them on your wrist and on your eyes to add to everything else we use them for in work and life. And each new phone or tablet is much faster than anything we have seen before. This creates a need for talented, high-end software engineers in the workplace to keep up with the advancements in computers.

If you want a job or build something that has never been built before, it is in your grasp to learn high end programming and make your passion a reality.

As I stated earlier, I started with writing batch files. Then, I learned internet technologies called html and css. Eventually, I realized that I needed to learn something called “object oriented software in order to build applications like video games, high end security data software and animation production software. Then, I learned that I needed to learn something called MVC in order to organize complex applications.

It was a very long and exhausting journey. Eventually I create simplified explanations of each step which I will explain along the way.

Html vs Applications

The websites you visit every day are most likely built using some sort of html language.

The applications you download from iTunes, Google Play and get at your local Best Buy store or local software retail store, was not necessarily built using html.

HTML is the web standard for websites. But, there is no standard language for building applications.

If you want to build websites, use html or something that supports html. This blog will not cover html development.

Applications allow users to charge for content, protect code and take advantage of mobile hardware features on the device, like location, camera and microphone. Many of these features are also available in HTML. But, the tight integration with hardware along with the advancements in tools has made building cross platform applications easier and can retain more value to the end user than HTML sites, if done correctly.

Most applications use some HTML. Applications are much more difficult to build than an HMTL site, as I will teach you. Applications usually take 2 to 5 times longer to build than an HTML site. They are usually investments in time and money that most people and small companies do not want to take on because of the scale of it. 
I will simplify the entire process of building applications on many platforms.

Let’s get started

Let’s get right into it.

Learning a computer language is similar to learning a new spoken language. I speak English. So, I already know how complex the English language is. To translate that to another language sounds daunting. It seems like I need to learn thousands of words, rules, exceptions, etc. And, to learn multiple languages sounds like a lifetime of work.

The bad news is that computer languages are also very complex. Each one also has many “words, rules, exceptions”. WOW! That also sounds like a lifetime of work!

The good news, is that I can simplify the learning into four categories.
There are four major terms to remember about all languages.

1.    Location
2.    Variables
3.    Functions
4.    Objects

That’s it! Everything you learn falls into these four categories, no matter what language you learn. So, instead of thinking about languages as being thousands of stuff to learn. Think of it as putting everything you learn into four easy to understand categories.

How is this easier? Well, a car also has thousands of parts. But, thinking of them as major components (body, drive train, engine, and cooling system, electric) makes it easier to understand. It’s easy to understand that a broken electrical system it will not change the body of the car. In software, if you start by learning these four fundamental aspects it much easier to learn any high end language because every language you learn has the same for elements (like every car has a body, engine, etc.).

Location

In the real world, we call this the same thing, a place where you put things. In the computer, it is pretty obvious but sometimes overlooked. Your file remains at the same location until you move the data of the file or delete the file and clean the garbage. When you put down a note in the real word, you can physically see where you place it. But in the computer, every file has a location that might not be obvious human beings. In fact every file has a specific address (unique number on the computer) where the file is stored.

The computer has two major places to store data, the drive and the memory. All data is stored on the hard drive. When you turn on the computer, it loads the files it needs to run the computer into memory. The interface is displayed by the files that were loaded into memory. When you load an application, it is loaded from the hard drive into memory and takes up the same amount of space in memory as it did on the hard drive.

A location can also be called a path, address or namespace. A location can also be physical or related to another. For example you can put down the shirt on the bed (physical). Or you can put down the shirt next to the bed” (related to another). Location is very important!

Variables

If you do not like math, you might think “Oh no, a math term”. You do not need to know match to understand variables, as I will now demonstrate.

If you have an empty box, and label the box “kitchen stuff”. You now have an empty storage container to hold some stuff that you labeled “kitchen stuff”. What do you want to call that? Well how about an empty box? What happens if you have 20 boxes and each one is labeled differently? Now, what do you want to call one of the boxes? Well, you could call it “the empty box labeled kitchen stuff”. In the real world that all makes sense. But the computer is always doing this… creating an empty box to store stuff. The “box” could be on the hard drive, on in memory. The “box” is always labeled like “kitchen stuff” and as I said earlier, it has a physical location. Unlike the real world, the box can start very small and grow as you put things into it. That’s pretty cool! What do you want to call that? Well, let’s call it a variable! It makes sense, since its size and contents can change at any time!

Functions

Remember I told you that the computer fundamentally is a device that does a bunch of things, really fast. If I want to make a list of things for the computer to do, I would write it down somehow, right? If you went shopping you write down a single list. If you were to write down the instructions to build a battleship, it would be many, many lists and very complex. So, how do I simplify the lists of things to do? How about “boxing them up”, kind of like the definition of a variable above. But, with lists of things to do, instead of a bunch of files. OK, let’s box all actions into lists and call them Functions! Eventually, you will have hundreds or thousands of functions. But, just like the box of kitchen stuff, you don’t need to know the contents of a faction called login, you only have to know that it does a bunch of stuff to login.

A functions can be also called a method.

Objects

An object is a combination of functions and variables at a specific location. If you read the previous descriptions, that should make perfect sense. The term object is usually referred to something that was loaded into memory. I am simplifying the description to make it easier to understand. Objects are also referred to as classes. Since an object has a location, the object in your applications can have relationships between them including parent / child relationships which I will explain later.

PREVIOUS - NEXT


W69EM58PEFWX