TechnoBuzz

A Techno Blog, mainly about Java

GitHubba

I first heard of GitHub (what is GitHub anyway? ) several years ago at the NoFluffJustStuff conference. After the conference I set up an account (technobuzz is a member since Sep 03, 2010) , allthough I have not made much use of it.

https://help.github.com/

http://git-scm.com/doc/

http://git-scm.com/documentation/book

Also, in PhoneGap  they show you how to get started with Git bash .

I am using Aptana Studio which shows you a little about Git use and it comes with the tool/plugin.

http://pressedweb.com/tutorials/how-to-use-github-part-1/

– Some git hub resources

– git man pages

set up git

C:\Program Files (x86)\Git\bin\ssh>ssh-keygen -t rsa -C “yagottabelieve@gmail.co
m”
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/xyz/.ssh/id_rsa):
Created directory ‘/c/Users/xyz/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xyz/.ssh/id_rsa.
Your public key has been saved in /c/Users/xyz/.ssh/id_rsa.pub.
The key fingerprint is:
b2:f8:32:17:e1:ea:41:61:7b:79:39:b1:a0:55:88:4a xyz@gmail.com

https://github.com/settings/profile

go to .ssh dir and get text of pub key

C:\Users\xyz\.ssh>type id_rsa.pub

paste it into github ssh (https://github.com/settings/ssh)

Test out key:
C:\Users\xyz\.ssh>ssh -T git@github.com

C:\Users\xyz\.ssh>git config –global user.name “Dave-o”

C:\Users\xyz\.ssh>git config –global user.email “xyz@gmail.com”

GitHub for Windows includes this helper, and provides a git shell so you don’t need to install and configure git manually

cd c:\wamp\www\jquery

git init

git status

git add file1.txt

git commit – m “add test file ”

git remote add orgin git@github.com:technobuzz/jquery.git

git pull orgin master

git push  orgin master

https://help.github.com/articles/fork-a-repo

July 22, 2012 Posted by | Uncategorized | Leave a comment

Knockout jQuery Binding and Visibility

Reading more on Knockout js

Here is the panel we will enable or disable:

< div id=”optionalPanel” style=”color: red;” data-bind=”visible:isEnabled”>The following is an example div</div>

Here we have a button that sends an event when it is clicked

< input type=”button” id=”Button1″ value=”My Button” data-bind=”event: { click:buttonEvent } ” /> 

Here is what the associated binding  (javascript) looks like:

function viewModel() {
   var self = this;

    myValues = ko.observableArray([]);

    this.isEnabled = ko.computed(function () {   return myValues().length > 0;  }    );

    // Here when er receive event we enable div tag by making size of myValues greater than zero

    buttonEvent = function (selectedSection, userAction) { myValues.push(“some value”);   };

};

//Must apply a model to bindings
ko.applyBindings(new viewModel());

The documentation for this example (also an example with booleans).

Likewise, here is an example of using anonymous function in html to reference the javscript bindings.

A  dropdown  binding example

More binding techniques

Site point series : 1 2 3

special comments for “if” binding

select list  example (i.e. picklist) , alternate select list example

July 21, 2012 Posted by | Uncategorized | , | Leave a comment

Knockout jQuery

In the GWT ecosystem , the Model View Presenter (MVP) pattern is the architecture of choice. However, the model requires some special capabilities when  dealing with the state (i.e. what the user did should force some special visibility rules).

In MVP the model typically refers to just the domain objects that will be displayed, things like a Customer, Contact or Account. From a Presentation Model perspective the term model encompasses the domain data plus all additional state that can change during the normal operation of the UI.

Likewise, pure javascript libraries have to deal with these type of issues too. They have a name for the MVP + (Editors/Pectin) pattern.  Its called MVVM.

Model–View-ViewModel talks of creating a new model (in addition to your domain model). This model normally adds additonal properties from the prespective of View (as we understand that View has controls in addition to data which it’s displaying).

Knockout  handles data binding :  “Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes)”.

A simple example always explains it best.

The ViewModel can be considered a specialized Controller that acts as a data converter. It changes Model information into View information, passing commands from the View to the Model.

For example, let us imagine that we have a model containing a date attribute in unix format (e.g 1333832407). Rather than our models being aware of a user’s view of the date (e.g 04/07/2012 @ 5:00pm), where it would be necessary to convert the address to it’s display format, our model simply holds the raw format of the data. Our View contains the formatted date and our ViewModel acts as a middle-man between the two.

KnockoutJS interprets the ViewModel as the represtation of data and operations that can be performed on a UI. 

Another simple example with code.

The intent of Knockout and other MVVM framework offerings is to move those conditional logic statements into the ViewModel and let the ViewModel be the sole source of the business logic

more: http://learn.knockoutjs.com/#/?tutorial=intro

July 18, 2012 Posted by | Uncategorized | , | Leave a comment

MVC in Javascript

http://www.alexatnet.com/articles/model-view-controller-mvc-javascript

Controller:

  • add an item
  • delete an item
  • update

View

  • wired to listen for add button click, invokes controller
  • wired to listen for delete button click, invokes controller
  • Event (model) handler for itemAdded, itemRemoved
  • sender object
  • attach method to add handler to the event
  • notify method to invoke a handlers

Model

  •  list of current items
  • selected index
  • define Event (model) for item added, removed, selectedindex changed
  • model getters/setter methods for items

July 17, 2012 Posted by | Uncategorized | | Leave a comment

From Sencha to jQuery

After learning alot about EXTJS, it makes sense to get familiar with jQuery. If you have 15 minutes, this is a good overview. Similarly, try this slide share too as it provides good explanations.  As well, there is a jQuery fundamentals, an  online book or  jQuery in Action. As the first chapter says :

If you’ve spent any time at all trying to add dynamic functionality to your pages, you’ve found that you’re constantly following a pattern of selecting an element or group of elements and operating upon those elements in some fashion. You could be hiding or revealing the elements, adding a CSS class to them, animating them, or modifying their attributes.

This javascript library make it easier to accomplish these routine blocks of code in your client code.
To collect a group of elements, we use the simple syntax:

$(selector)
or
jQuery(selector)

The $ () function (an alias for the jQuery() function)  returns a special javascript object containing an array of DOM elements (known as the wrapped set or wrapper)  that match the selector.

Then, jQuery provides methods (or sometimes known as commands or actions) that can act on the group of elements. Some of these actions when completed return the same set of elements that can then again be acted on (known as chaining).

jQuery. or $. is the notation for utility functions.

15 days of jQuery

Selectors

Dimensions

Traversing

Maniplulation

Utilities

Events , Event Object

Ajax

July 14, 2012 Posted by | Uncategorized | , | 1 Comment

Mobile advancements by Qualcomm

http://scobleizer.com/2012/07/11/mobile-3-0-arrives-how-qualcom-just-showed-us-the-future-of-the-cell-phone-and-why-iphone-sucks-for-this-new-contextual-age/

But in the future your mobile device, whether it be something you hold in your hand like a smart phone, or wear on your face, like Google Glasses, will know a hell of a lot about you.

How?

Well, Qualcomm just shipped the developer SDK, called Gimbal.

Apple does NOT give developers access to the Bluetooth and Wifi radios. This is going to really hinder developers in this new contextual world.

This is the location based services we have been hearing about for years. It is the auto check in functionality. Let’s say you are driving n your car, it knows you have visited Starbucks on many occasions. It knows that you are approaching a StarBucks, it offers you  a coupon code.

July 11, 2012 Posted by | Uncategorized | Leave a comment

Mobile Apps explosion

http://blog.daniel-kurka.de/2012/05/talk-about-mgwt-gwt-phonegap-at-dutch.html

Clutter phone with apps instead of web pages

What we will do with phone in future going to explode.

Search for apps on our phone since there are so many

Periodically delete apps since cluttering phones

Web much better

One answer is phone gap

With different platforms  have to know different OS and API and languages. a lot to learn, and code  API changing all time.

The web provides a common software to bring different platforms together.

Build on standards (i.e. html5) , deploy app everywhere.

Native development – slow since have to develop for every platform, have to do separate implementation for every device, no portability, high cost, good performance on devices, native functionality

web development  – portability, low cost , no native functionality, device specific browser

Phone Gap – hybrid, web app and native app . Build it on standards and can run on anywhere. consistent api

gwt tool for building web apps

gwt  use java to build in javascript with compile (browser compatibility) , efficient javascript

mobile slow cpu drain battery slow network connections

can use phonegap and gwt together

web app – device, browser, mgwt great looking gui

apache 2.o license

native and javascript  (web)  in phone gap

adobe buys phonegap

donate code to Cordova

phone gap is one distribution of phone gap

adobe will build tools on it

web – native web control html,css – browser

phone gap plugins  (native) – camera plugins, android plugins, ioS

July 7, 2012 Posted by | Uncategorized | Leave a comment

HBaseball

http://www.cloudera.com/resource/intorduction-hbase-todd-lipcon/

HBase : open source, distributed, sparse (no strict schema), column oriented (control how stored on disk) sorted map data store, modeled after Big Table.

Usage scenario: alot of data, very high write throughput (i.e. sequential writes), easy to scale (distribute across machines), data layout efficient(key look up disk seeks efficient and cost transparent some rows filled in some not still efficient)

column oriented – every row with same column, transaction on single row basis, not full acid, hbase no sql except with hive, but not realtime,

get :  single row get columns

put : put row these columns

scan row x in sorted order until row y, some filtering

indexing – primary key only

clustered indexes –  primary key is clustered key index

Hbase built on top of Hadoop, requires HDFS, work with map reduce but built on top of it.

HDFS sequential writes , cant update in middle of file, provides streaming I/O

HDFS lacks random read/write capabilities

HBase random read and write in middle of file

converts random writes to  writes into log, merge log back into table

log structure merge trees 89

http://www.cloudera.com/resource/chicago_data_summit_apache_hbase_an_introduction_todd_lipcon/

Failover handled with Zookeeper

Sorted Map Datastore:

Not a relational database

Tables consists of rows and primary key

Each row any number of cols

rows stored in sorted order

Have primary key and columns have attributes (column families) that can store many different things

logical view (row key : data) :

– info and roles are column families

– Can have versions of the data

cutting (row key):  info {height: ‘9ft’, state : ‘CA’}, roles {ASF : ‘director’, Hadoop : ‘Founder’}

tlipcon (row key):  info {height: ‘5ft7’, state : ‘CA’}, roles {Hadoop : ‘Committer’@ts=2010,Hadoop :’PMC’@ts=2011, Hive: ‘Contributor’}

physical view (for each column family, row key (primary key), col key (what data), time stamp, value) :

– column families stored separately on disk

info column family:

cutting (row key) ,  info.height (col key) , 12345678910 (timestamp), 9ft (value)

cutting (row key) ,  info.state (col key) , 12345678911 (timestamp), CA (value)

tlipcon(row key) ,  info.height (col key) , 12345678912 (timestamp), 5ft7 (value)

tlipcon (row key) ,  info.state (col key) , 12345678912 (timestamp), CA (value)

–  roles column family:

cutting (row key) ,  roles.ASF (col key) , 12345678910 (timestamp), Director (value)

cutting (row key) ,  roles.Hadoop (col key) , 12345678911 (timestamp), Founder (value)

tlipcon(row key) , roles.Hadoop(col key) , 12345678912 (timestamp), PMC (value)

tlipcon (row key) ,roles.Hadoop(col key) , 12345678912 (timestamp), Committer (value)

tlipcon (row key) ,roles.Hive(col key) , 12345678912 (timestamp), Contributer (value)

– Sorted in ascending order by row key and column key, and descending order by timestamp

–  column families:

each column may have different access patterns or properties

can configure compression, cache priority, #versions properties

– Java API, Rest Calls, Apache Thrift, Hive (sql)/Pig (hybrid) integrate

get(row)

put (row,Map)

scan (key-range, filter)

http://jimbojw.com/wiki/index.php?title=Understanding_Hbase_and_BigTable

HBASE Architecture

” HBase handles basically two kinds of file types. One is used for the write-ahead log and the other for the actual data storage. The files are primarily handled by the HRegionServer‘s.”

You may also notice that the actual files are in fact divided up into smaller blocks when stored within the Hadoop Distributed Filesystem (HDFS).

The general flow is that

a new client contacts the Zookeeper quorum (a separate cluster of Zookeeper nodes) first to find a particular row key. It does so by retrieving the server name (i.e. host name) that hosts the -ROOT- region from Zookeeper.

With that information it can query that server to get the server that hosts the .META. table. Both of these two details are cached and only looked up once.

Lastly it can query the .META. server and retrieve the server that has the row the client is looking for.

http://hbase.apache.org/book/quickstart.html

http://hbase.apache.org/book/zookeeper.html

A distributed HBase depends on a running ZooKeeper cluster. All participating nodes and clients need to be able to access the running ZooKeeper ensemble. HBase by default manages a ZooKeeper “cluster” for you.

http://hbase.apache.org/book/datamodel.html

http://hbase.apache.org/book/data_model_operations.html

http://hbase.apache.org/book/schema.html

http://hbase.apache.org/book/mapreduce.html

http://hbase.apache.org/book/architecture.html

http://www.larsgeorge.com/2010/01/hbase-architecture-101-write-ahead-log.html

http://ria101.wordpress.com/2010/02/24/hbase-vs-cassandra-why-we-moved/ :

” I will write about why I think we will see a seismic shift from SQL to NOSQL over the coming years, which will be just as important as the move to cloud computing. ”

“HBase and its required supporting systems are derived from what is known of the original Google BigTable and Google File System designs (as known from the Google File System paper Google published in 2003, and the BigTable paper published in 2006″

” Cassandra on the other hand is a recent open source fork of a standalone database system initially coded by Facebook, which while implementing the BigTable data model, uses a system inspired by Amazon’s Dynamo for storing data (in fact much of the initial development work on Cassandra was performed by two Dynamo engineers recruited to Facebook from Amazon).”

HBase being more suitable for data warehousing, and large scale data processing and analysis (for example, such as that involved when indexing the Web)

Cassandra being more suitable for real time transaction processing and the serving of interactive data.

where platforms are perceived as similar, people tend to aggregate around the platform that is going to offer the best supporting ecosystem in the long term

When starting with HBase, my impression then was that it had the greatest community momentum behind it, but I now believe that Cassandra is coming through much stronger.

HBase vs Cassandra: NoSQL Battle!” link more , or HBASE vs Big Table

ccelerating momentum behind Cassandra. You might also take note of the big names coming on board, such as Twitter, where they plan broad usage (see here).

“CAP Theorem, and was developed by Professor Eric Brewer, Co-founder and Chief Scientist of Inktomi.

The theorem states, that a distributed (or “shared data”) system design, can offer at most two out of three desirable properties –Consistency, Availability and tolerance to network Partitions.

Very basically, “consistency” means that if someone writes a value to a database, thereafter other users will immediately be able to read the same value back,

“availability” means that if some number of nodes fail in your cluster the distributed system can remain operational, and

“tolerance to partitions” means that if the nodes in your cluster are divided into two groups that can no longer communicate by a network failure, again the system remains operational.

a complete HBase solution is really comprised of several parts: you have the database process itself, which may run in several modes, a properly configured and operational hadoop HDFS distributed file system setup, and a Zookeeper system to coordinate the different HBase processes

HBase in pseudo distributed mode on a single server is difficult – so difficult in fact that I did my best to write a guide that takes you past all the various gotchas in the minimum time (see http://ria101.wordpress.com/2010/01/28/setup-hbase-in-pseudo-distributed-mode-and-connect-java-client/ if you wish to try it). As you will see from that guide, getting HBase up and running in this mode actually involves setting up two different system systems manually: first hadoop HDFS, then HBase itself.”

http://nosql.mypopescu.com/post/651051316/hbase-and-data-locality

http://www.larsgeorge.com/2010/05/hbase-file-locality-in-hdfs.html

Cassandra quick tour

http://research.google.com/archive/gfs.html

http://research.google.com/archive/bigtable.html

http://www.scribd.com/doc/21244790/Google-Designs-Lessons-and-Advice-from-Building-Large-Distributed-Systems

http://nosql.mypopescu.com/post/573604395/tutorial-getting-started-with-cassandra

July 5, 2012 Posted by | Uncategorized | Leave a comment

Data on the Tube Blasts

Interview with Dr. Jim Goodnight CEO SAS Institute On Data Analytics

What is Hadoop in 9 minutes

Hadoop by Linkedin engineer

Google Compute Engine

July 4, 2012 Posted by | Uncategorized | Leave a comment

Hadoop you do

Hadoop is a computing environment built on top of a distributed clustered file system  that was built specifically for large scale data.   The approach of Hadoop is distributing the data into a collection  of commonly available servers where each server is an in inexpenseive disk drive. Moreover, as it says here : “we introduce the idea of “big data” that the string is too huge to one master machine, so “master method” failed. Now we distribute the task to thousands of low cost machines.” With Hadoop, redundancy is built into the environment where data is stored in multiple places across the cluster. Not only is the data stored in multiple places in the cluster, but the programming model is such that  failures are expected and resolvedby running portions of the program on different servers in the cluster.

Hadoop  has two main parts :

  • HDFS, the Hadoop Distributed File System, is a distributed file system designed to hold very large amounts of data (terabytes or even petabytes), and provide high-throughput access to this information. The design of HDFS is based on GFS (Google File System). Files are stored in a redundant fashion across multiple machines to ensure their durability to failure and high availability to very parallel applications. There is one NameNode, and multiple DataNodes.  Moreover, via Facebok Under the Hood says :  “HDFS clients perform filesystem metadata operations through a single server known as the Namenode, and send and retrieve filesystem data by communicating with a pool of Datanodes. Data is replicated on multiple datanodes, so the loss of a single Datanode should never be fatal to the cluster or cause data loss.”  Also see IBM Big Data Analytics  HDFS, Facebook’s Realtime Hadoop
  • MapReduce , the programming model.  it is a programming paradigm that allows for massive scalability across the many servers in a hadoop cluster. map reduce performs two seperate tasks. first is the map job which takes a set of data and converts it into another set of data where elements are broken down into key/value pairs. The reduce job takes the output from a map as input and combines the key/value pairs into a smaller set of key/value pairs.

Note: The IBM Infosphere BigInsights platform (current version is  1.4) is built on top of Hadoop .

More:

July 3, 2012 Posted by | Uncategorized | Leave a comment