martes, 31 de diciembre de 2013

Getting Started with Meteor.js JavaScript Framework - Book Review

Since I got this book I got some interest in reading it...mainly because with so many JavaScript Frameworks...I was skeptic...but...Meteor just totally blown my mind...this is my review...



Two things comes to mind one when I think about this book...both Meteor.js and the book...totally rocks! Why? Simply because the book is really well explained...it's funny...yes...it's funny...and it comes with a real full blown application to build...I will show the screens later...

If you're a Windows user like me...follow this link Meteor on Windows. Otherwise...just use the regular link...

The book is not really long...as it's only 131 pages...but it covers everything you need to know to go out and build your first applications...really...after reading the book you just want to build stuff...and I already have a couple of things in mind -;)

The book introduce you to the following themes...
  • Templates
  • Data, Meteor Style
  • Security and Accounts
  • Packaging and Deploying
So...one cool thing about Meteor...is that it comes bundled with Minimongo...a minimized version of the document based MongoDB...which is course more than enough for simple applications...

Now...I guess that you don't believe me...you still think that Meteor is just another JavaScript Framework...well...let me tell you...it has become for sure...my favorite JavaScript Framework...sorry AngularJS....


This is the application that you build with the book...a simple "Lending" application...so you can keep track of your stuff...



Not impressed yet? Well...Meteor comes with a Login UI package...



So you don't have to deal with internal stuff...just create your user...and have fun -:)

The only problem I see right now with Meteor...is that there are not enough books...but hopefully that's going to change while the framework becomes more popular and widely used -;)

And of course...I would buy this book right away if I was you...

Greetings,

Blag.
Developer Empowerment and Culture.

jueves, 26 de diciembre de 2013

Mastering Web Application Development with AngularJS - Book Review

I just finished reading Mastering Web Application Development with AngularJS and I gotta say...I have some mixed feelings -:P


First things first...this book is huge...372 pages...and it covers a lot of things...but...there's always a downside...

The book talks about building an SCRUM application...and it provides a lot of snippets that are related to that application...however...even when you download the book's source code...the application is nowhere to be found...meaning that either you figure out yourself...or just end with a bunch of nice but not very useful snippets...

To be fair...this can be seen as either good or bad...good because it forces you to try it yourself and in the end...learn more...but also bad because without proper experience...there's no way you can build it and that leads to frustration...

Anyway...there are some nice and complete examples that really make you keep going...also...the book covers many interesting aspects like...

  • Model transformations with filters
  • Advanced forms creation
  • Forms validation
  • Navigation
  • Application Security
  • Internationalization
  • Custom build directives

It would say...if you really have AngularJS experience...then this book is for you...as it has some really nice tricks...otherwise...grab a more basic book...build applications...gain experience...and then read this one...otherwise...you will get lost more than once...

Let's take a look at some pictures...





What I like this book however is the fact that it introduces us to many "external" JavaScript libraries...without actually introducing us to them...which is funny...

  • Twitter's Bootstrap
  • Grunt.JS
  • Jasmine
  • Express
  • Passport
  • Restler
At least...by knowing about them...we can explore them and make use of them -;)

This said...I'm glad I read it...but...if I ever put myself on the situation where I actually need to build an AngularJS application...I would read it again...hopefully next time...I would be able to get more out of it...

Greetings,

Blag.
Developer Empowerment and Culture.

Cookoo Watch - Product Review

So...what do a geek like me get for Christmas?


A Cookoo watch of course! -:D

So...let's review it -;)


The watch comes in a nice Birdhouse like case...that can be actually used as a real Birdhouse...or at least...that's what they propose...nice I should say -:)


The watch is a little bit big but doesn't feel annoying when wearing it...after the first 5 minutes...you simply get used to it...also...but being able to link it with your phone...it couldn't be small...


One of the things that I like about the watch is that it allows you to control the phone camera...this by using the Cookoo Life software that it's of course...available for free...actually...I obviously took the picture by using the "Command button" on the watch -;)

Another cool thing...is that it allows you to control the music...one single click to Pause/Play...but longer to change the song and a bit long to actually stop it...

Regarding the battery life...well...the watch connects to your phone by using Bluetooth Smart...so it really doesn't drain too much battery...I made a small experiment today...

I charged my phone up to 100%...then leave home and walk to the office...which takes me around 40 minutes...I had the music on and was checking email, Facebook and Foursquare...when I hit the office...only 8% was drained...so we could say...around 1% every 5 minutes...something like 8 hours till the next recharge...of course...not taking into account "Phone calls"...that will drain your battery quickly...I gotta say...not bad at all...

Also...the watch itself comes with a regular watch battery...so there's no need to charge it...it's supposed to last for at least a year and it's very easy to replace...it's water resistant as well -;)

So...what else does this nice watch does?


As you can see...it can tell you if you have a missing call...if you have new emails...if you have a calendar appointment...if you have a Facebook message...and if you're forgetting your phone...

It's also supposed to allow you to do Facebook check-ins...but I haven't been able to make it work on the latest Cookoo Life update....as the current version is a new one designed specially for IOS 7...I guess they keep working on making it better...

One thing that caught my attention was this....


So...they will release an API to allow developers to create new way to connect the Phone with the watch...I already have some nice ideas but I prefer for now to wait for API to be released before I drop out something...

So far...I love this watch...haven't got any "disconnect" problems...and it's working as promised...can't wait to see how this evolves in the future -:)

Greetings,

Blag.
Developer Empowerment and Culture.

lunes, 23 de diciembre de 2013

Instant AngularJS Starter - Book Review

I have used AngularJS before when I wrote my blog AngularJS, PHP and SAP HANA. But of course...I only learnt what I need at that time...so I really wanted to learn a little bit more -;)

Instant AngularJS Starter is the my first "Instant" book...and I can say...I couldn't be happier with it -:)



Even when the book is fairly short...only 66 pages...it's just the kind of book I love...it comes with a quick introduction to AngularJS and what it's more important...the whole book guides you through the building of a complete application...so you can learn how to build it from the scratch and get a perfect base to build your own projects...

The author explains everything is a nice and easy way...so it's easy to follow and understand...let's see some images of the application you will get to build...




As you can see...it's just a simple application but in the end it uses all the AngularJS settings so you can quickly get use to them and learn them as well...

If you haven't use AngularJS before...then this book is totally for you...if you have some experience...then just go for something more advanced...this book is aimed for the total newbie...and...even when I wasn't a total newbie...I learnt a lot from it...

I got another AngularJS book that I just start reading...so stay tuned for more... -;)

Greetings,

Blag.
Developer Empowerment and Culture.

jueves, 19 de diciembre de 2013

Packt Publishing Book Bonanza!

My friends at Packt Publishing had release a cool campaign!


From December 19th, 2013 to January 3rd, 2014...all books and videos are just $5...without a limit!

Cool, huh? Just follow this link http://bit.ly/1jdCr2W and fill your library -;)

Greetings,

Blag.
Developer Empowerment and Culture.

miércoles, 18 de diciembre de 2013

PhoneGap 3 Beginner's Guide - Book review

This week...I read PhoneGap 3 Beginner's Guide which is a nice book, so here goes my review...


To begin with...in my opinion...this is not a beginner's book at all...it's a book that will walk you through the new and cool things implemented on PhoneGap 3...so if you haven't used PhoneGap before, I will recommend you to choose another book like PhoneGap 2.x Mobile Application Development Hotshot...

If you have previous PhoneGap experience...then this a good book for you...as it cover many cool things like:
  • App Templates
  • JavaScript compression
  • Web DB
  • Sensor
  • GeoLocation
  • Files
  • PhoneGap Plug-Ins.  
There are many examples but they are used to achieve certain things, like using the Camera or dealing with GeoLocation...so no end to end examples are given...but if you have previous PhoneGap experience...that shouldn't be so much of a problem...

One good thing about the book is that it takes care of showing how to achieve things on Mac OS, Linux and Windows, including alternatives when a certain tool can be used only on one of the Operating Systems...giving everyone the ability to try it out.

Let's look at some pictures...




The book also comes with exercises and pop up quizzes, so that's a good way to improve our knowledge and keep coding.

In a overall...I have to say this again...if you're a newbie...be aware that this book is not meant for you...if you have previous experience...then this book is good enough to put you on the right track and show you some PhoneGap goodies...

Greetings,

Blag.
Developer Empowerment and Culture. 


viernes, 13 de diciembre de 2013

Playing with schema flexibility on SAP HANA

The other day, a colleague from the Labs asked me an interesting question..."Let's say you have a table with schema flexibility...with a lot of fields that might be empty...how do you know which are fields that have at least one value?"...of course...I didn't knew how to answer that...so of course...I put myself to work...as expected -;)

First...let's create our table with a couple of values and some "missing" values...

Create table Products
DROP TABLE Products;

CREATE COLUMN TABLE Products(
PRODUCT_CODE VARCHAR(3),
PRODUCT_NAME NVARCHAR(20),
PRICE DECIMAL(5,2)
) WITH SCHEMA FLEXIBILITY;

INSERT INTO Products values ('001','Blag Stuff', 100.99);
INSERT INTO Products (PRODUCT_CODE,PRODUCT_NAME,PRICE,COLOR) 
values ('002','More Blag Stuff',100.99,'Black');
INSERT INTO Products (PRODUCT_CODE,PRODUCT_NAME,PRICE,COLOR,TYPES) 
values ('003','More Blag Stuff',100.99,null,null);

When we check the contents of the table we will have this...


As we can see...the last field has no values at all...so we will need to retrieve the names of the other fields...for this...we're going to create a table to hold them...then...we're going to create a Procedure to retrieve them...

Create table FIELDS_RECORDS
DROP TABLE Fields_Records;

CREATE COLUMN TABLE FIELDS_RECORDS(
FIELD_NAME VARCHAR(256)
);

For the Procedure...we're going to read all the fields that compose the table...then we're going to count all the values that are not null for each field...for this...we're going to use the help of a temporal table and dynamic SQL as sadly...SQLScript doesn't support scarlar binding yet...

GET_FIELDS_WITH_RECORDS
DROP PROCEDURE GET_FIELDS_WITH_RECORDS;

CREATE PROCEDURE GET_FIELDS_WITH_RECORDS(IN TableName VARCHAR(256))
LANGUAGE SQLSCRIPT AS
v_column_name VARCHAR(256);
v_select VARCHAR(256);
v_count INTEGER := 0;
CURSOR c_cursor(v_column_name VARCHAR(256)) FOR
SELECT COLUMN_NAME FROM SYS.CS_COLUMNS_ A inner join SYS.CS_TABLES_ B
on A.table_oid = B.table_oid where schema_name = 'SYSTEM'
and table_name = :TableName
and internal_column_id > 200
order by internal_column_id;
BEGIN
FOR cur_row AS c_cursor(v_column_name) DO
create local temporary table #temptable(found INTEGER);

v_select := 'INSERT INTO #temptable (SELECT COUNT(' || cur_row.column_name || ') 
             FROM ' || :TableName || ' WHERE ' || cur_row.column_name || ' IS NOT NULL)'; 
exec v_select;

SELECT found INTO v_count FROM #temptable;
IF v_count > 0 THEN
v_select := 'INSERT INTO FIELDS_RECORDS VALUES(''' || cur_row.column_name || ''')';
drop table #temptable;
exec v_select;
END IF;
END FOR;
END;

When we call our Procedure, we simply need to pass the name of the table...and then read it's content...

Call Procedure and get info
CALL GET_FIELDS_WITH_RECORDS('PRODUCTS');

SELECT * FROM FIELDS_RECORDS;

Let's see what do we have on FIELDS_RECORDS -;)


Just as expected -:) Nice, huh?

Greetings,

Blag.
Developer Empowerment and Culture.

miércoles, 11 de diciembre de 2013

Learning jQuery, Third Edition - Book Review

I started reading this book in order to learn JQuery...just because...

I didn't had high expectations but this book really blown me away...

Learning jQuery, Third Edition is just amazing...it's a really long book full with practical examples and things that you could use right away...


The book starts with the very basics and slowly moves into more complex examples and external JQuery plug-ins...after reading it...I just love JQuery -;)





With 13 chapters and 2 appendixes...this is a huge book that will have you both hook and entertained for a long time -:) 

This book should be on your book shelve for sure! JQuery can really boost up your old HTML pages -;)

Greetings,

Blag.
Developer Empowerment and Culture.

lunes, 2 de diciembre de 2013

Twitter Battle

I love to have fun with R and Twitter...there are a lot of cool things that you can do with it...so I just thought of having a small Twitter Battle application...something that will grab the number of followers and lists from two users...apply some crappy algorithms and determine the Twitter importance between those users...using our .RData file that holds the Twitter OAuth info...

Twitter Battle
require("Rook")
library("ROAuth")
library("twitteR")

setwd("C:/Blag/R_Scripts/Important_Scripts")
load("credentials.RData")

Get_Percentages<-function(p_one,p_two,flag){
      if(p_one > p_two){
        if(flag == 0){
          OneFollowPercent<-100
          TwoFollowPercent<-round((p_two * 100) / p_one)
        }else{
          TwoFollowPercent<-100 - (round((p_two * 100) / p_one))
          if(TwoFollowPercent <= 49){
            OneFollowPercent<-50 + TwoFollowPercent
            TwoFollowPercent<-100 - OneFollowPercent
            flag<-0
          }else{
            OneFollowPercent<-50 + TwoFollowPercent
            TwoFollowPercent<-100 - TwoFollowPercent
            TwoFollowPercent<-100 - round((round(TwoFollowPercent * 100) / OneFollowPercent))
            OneFollowPercent<-TwoFollowPercent
            TwoFollowPercent<-100 - OneFollowPercent
            flag<-1
          }
        }
      }
      if(p_one < p_two){
        if(flag == 0){
          OneFollowPercent<-round((p_one * 100) / p_two)
          TwoFollowPercent<-100
        }else{
          OneFollowPercent<-100 - (round((p_one * 100) / p_two))
          if(OneFollowPercent <= 49){
            TwoFollowPercent<-50 + OneFollowPercent
            OneFollowPercent<-100 - TwoFollowPercent
            flag<-0
          }else{
            TwoFollowPercent<-50 + OneFollowPercent
            OneFollowPercent<-100 - OneFollowPercent
            OneFollowPercent<-100 - round((round(OneFollowPercent * 100) / TwoFollowPercent))
            TwoFollowPercent<-OneFollowPercent
            OneFollowPercent<-100 - TwoFollowPercent
            flag<-1
          }
        }
      }
      if(p_one == p_two){
        OneFollowPercent<- 50
        TwoFollowPercent<- 50
      }
      percents<-c(OneFollowPercent,TwoFollowPercent,flag)
      return(percents)
}

newapp<-function(env){
  req<-Rook::Request$new(env)
  res<-Rook::Response$new()
  res$write('<form method="POST">\n')
  res$write('Enter your Twitter username: <input type="text" name="YourUserName">')
  res$write('</BR>')
  res$write('Enter your his/her Twitter username: <input type="text" name="HisHerUserName">')
  res$write('</BR>')
  res$write('<input type="submit" name="Start the Battle!">')
  res$write('</form>')
    
  if (!is.null(req$POST())) {
    YourUserName = paste("@",req$POST()[["YourUserName"]],sep="")
    HisHerUserName = paste("@",req$POST()[["HisHerUserName"]],sep="")
    
    reg<-registerTwitterOAuth(credentials)
    
    GetYourUser<-getUser(YourUserName,cainfo="cacert.pem")
    GetHisHerUser<-getUser(HisHerUserName,cainfo="cacert.pem")
    
    GetYourFollowers<-GetYourUser$followersCount
    GetYourLists<-GetYourUser$listedCount
    GetHisHerFollowers<-GetHisHerUser$followersCount
    GetHisHerLists<-GetHisHerUser$listedCount

    FollowPercents<-Get_Percentages(GetYourFollowers,GetHisHerFollowers,0)
    ListPercents<-Get_Percentages(GetYourLists,GetHisHerLists,0)

    YourPercents<-FollowPercents[1] + ListPercents[1]
    HisHerPercents<-FollowPercents[2] + ListPercents[2]

    FinalPercents<-Get_Percentages(YourPercents,HisHerPercents,1)

    YourPercents<-FinalPercents[1]
    HisHerPercents<-FinalPercents[2]
    if(FinalPercents[3] == 0){
      DiffPercent<-abs(YourPercents - 50)
    }else{
      DiffPercent<-FinalPercents[1]
    }
    
    if(YourPercents > HisHerPercents){
      message<-paste(req$POST()[["YourUserName"]],"is",DiffPercent,
                     " % more important on Twitter than",req$POST()[["HisHerUserName"]],sep=" ")
      res$write(paste('<H1>',message,'</H1>'))   
    }
    if(YourPercents < HisHerPercents){
      message<-paste(req$POST()[["YourUserName"]],"is",DiffPercent,
                     " % less important on Twitter than",req$POST()[["HisHerUserName"]],sep=" ")
      res$write(paste('<H1>',message,'</H1>'))
    }
    if(YourPercents == HisHerPercents){
      message<-paste(req$POST()[["YourUserName"]],
                     "is equally important on Twitter as",req$POST()[["HisHerUserName"]],sep=" ")
      res$write(paste('<H1>',message,'</H1>'))
    }
    
    pieValues<-c(YourPercents,HisHerPercents)
    pieNames<-c(paste(req$POST()[["YourUserName"]],YourPercents,"%"),
                      paste(req$POST()[["HisHerUserName"]],HisHerPercents,"%"))
    
    png("Twitter_Battle.png",width=1000,height=700)
    pie(pieValues,labels=pieNames,main="Twitter Battle")
    dev.off()
    res$write("<div align='center'>")
    res$write(paste("<img src='", server$full_url("pic"), "/", 
                    "Twitter_Battle.png'", "/>", sep = ""))
    
    res$write("</div>")
}
  res$finish()
}

server = Rhttpd$new()
server$add(app = newapp, name = "Twitter_Battle")
server$add(app = File$new("C:/Blag/R_Scripts/Important_Scripts"), name = "pic")
server$start()
server$browse("Twitter_Battle")

When we execute it...we're going to have some interesting results...




Have fun with it -;)

Greetings,

Blag.

Twitter unfollowers with R and Rook - Revisited

Some time ago I wrote a post called Twitter unfollowers with R and Rook where I used R and Twitter to get a list of the people that we follow...but that doesn't follow us back...

Right now...that post is obsolete as Twitter changed its API to API 1.1 which means that OAuth authentication must be used...

So...of course...we're going to use that for our new version of Twitter Unfollowers -;)

Getting Twitter Auth
library("ROAuth")
library("twitteR")

setwd("C:/Blag/R_Scripts/Important_Scripts")

options(RCurlOptions = list( capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"), ssl.verifypeer = FALSE))

reqURL<-"https://api.twitter.com/oauth/request_token"

accessURL<-"http://api.twitter.com/oauth/access_token"

authURL<-"http://api.twitter.com/oauth/authorize"

consumerKey<-"Your own Consumer Key"

consumerSecret<-"Your own Consumer Secret"

download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")

credentials<-OAuthFactory$new(consumerKey=consumerKey,
                              consumerSecret=consumerSecret,
                              requestURL=reqURL,
                              accessURL=accessURL,
                              authURL=authURL)

credentials$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))

save(credentials, file="credentials.RData")

What are we doing here is simply get Authorization from Twitter and save that information as an RData file that we can use later on. This script is needed to be executed only once...and will ask you to enter a PIN number to validate the connection...


After that...we're ready to go -;)

Twitter Unfollowers
require("Rook")
library("ROAuth")
library("twitteR")

setwd("C:/Blag/R_Scripts/Important_Scripts")
load("credentials.RData")
registerTwitterOAuth(credentials)
Get_Screen_Name<-function(p_userid){
  SomeUser<-getUser(p_userid,cainfo="cacert.pem")
  SomeUser<-SomeUser$screenName
  return(SomeUser)
}

newapp<-function(env){
  req<-Rook::Request$new(env)
  res<-Rook::Response$new()
  res$write('<form method="POST">\n')
  res$write('Enter your Twitter username: <input type="text" name="UserName">\n')
  res$write('<input type="submit" name="Get Bad People!">')
  res$write('</form>')
  
  People_Id<-""
  Bad_People<-c()
  Bad_Names<-c()
  j<-0  
  
  if (!is.null(req$POST())) {
    UserName = req$POST()[["UserName"]]
    
    User<-userFactory$new(screenName=UserName)
    followers<-User$getFollowerIDs(n=NULL,cainfo="cacert.pem")
    following<-User$getFriendIDs(n=NULL,cainfo="cacert.pem")

    for(i in 1:length(following)) {
      Match<-following[i] %in% followers
      if(Match == TRUE){
      }
      else{
        Bad_Person<-Get_Screen_Name(following[i])
        res$write(paste(' ',Bad_Person,sep=' '))
        res$write('</BR>')
      }
    }
}
  res$finish()
}

server = Rhttpd$new()
server$add(app = newapp, name = "Twitter_Rook")
server$start()
server$browse("Twitter_Rook")

Thanks to this...I was able to shrink the code from 85 lines of the previous version to only 51 lines of code...nice achievement if you ask me -;)

So...when we execute the code...we will have this...


Of course...I don't expect them all to follow me back as they are mostly companies...but for people...follow me back or get unfollowed -:P

Greetings,

Blag.

Goodbye external developers...hello internal developers...

I joined SAP Labs almost two years ago...first in SAP Labs Montreal and now in SAP Labs Palo Alto. During that time, my team changed names from PEDA (Platform Evangelism and Developer Adoption) to TIDE (Technology Innovation and Developer Adoption) to DevEx (Developer Experience) and were focused on External Developers...which meant...bring developers to our SAP Ecosystem.

Now...we have changed our name again, and we are called Developer Empowerment and Culture. Not only our name has changed but also our focus, and now we're going to move away from External Developers and focus on Internal Developers instead...

Like I like to say..."We're changing SAP from the inside"...

What this means? For you my readers...not so much...I will continue to write blogs and get the most out of both SAP and External technologies...but for the SAP Ecosystem it will mean that I will focus on our own Developers...make them happy and more productive is our new goal...

While it has been awesome to work with External Developers and write blogs, organize events and spread the word about SAP Technologies...our new focus will also bring a lot of challenges and satisfactions and we will help SAP to become a better company and truly work..."Like never before"...

See you around -;)

Blag.
Developer Empowerment and Culture.