Category Archives: General

This section have articles on general topics on IT and other IT related events and stuffs.

Android Proguard a General Idea

What is Proguard on android and what does it do?

ProGuard is a tool that comes with the Android SDK. It  shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security.

How to enable it? And is it recommended?

ProGuard is integrated into the Android build system. And to enable it you just have to find the “project.properties” file in your android project and have to uncomment the line which sets the path for the ProGuard. Also Proguard slows the app building sequence.
So you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to wait longer time when debugging the app. Having ProGuard run is completely optional, but highly recommended.

So is that all that we have to do to enable and use ProGuard?

Yes that’s the basic, and it only does the Shrinking, but there are 2 more functions that give more advantages in increasing the security and management of the build.
They are Obfuscation and Repackaging.

So what is Obfuscation and how does it Work

With tools available to extract the contents of APK’s, deodex, and read the class files, it’s important to obfuscate to protect the proprietary aspects of your codebase.

ProGuard generates a mapping file that allows you to map the stack traces of obfuscated code to actual methods. Basically it replaces the methods in meaning full name to something unguessable like a work or letter.

Original Code

public Data(int id, int result, String message) {
       mId = id;
       mResult = result;
       mMessage = message;
    }

Obfuscated Code

public a(int paramInt1, int paramInt2, String paramString)
    {
       this.a = paramInt1;
       this.b = paramInt2;
       this.c = paramString;
   }

 Hope you got an idea on how it works

So what is Repackaging?

Repackaging allows ProGuard to take externals jars and class files and move them to a single container with a common java package location.

For those of you building libraries, repackaging is extremely helpful if you choose to show a simple interface to third party developers while keeping a maintainable and well structured project hierarchy in the source repository. This can also be useful in organizing lower level packages while exposing well defined interfaces!

 Optimizing

There is another function of Proguard which Optimizes the code, where you can specify which part of the code, which type of code needs to be Optimized.  However, there are known incompatibility issues with various Dalvik versions.
But It is good to know this feature, which can be used without issues using some other tools.

Reference : http://www.crashlytics.com/blog/mastering-proguard-for-building-lightweight-android-code/, http://developer.android.com/tools/help/proguard.html

Advertisements

Last Runner – Android, iOS and Windows Phone Game

android game

Last Runner is an Endless runner made for Android and iOS. Unlike Temple run and Subway Surfers, it’s a 2D game similar to Monster Dash by Half Brick studio.

Screenshot_2015-02-05-11-08-17  volcano forest

It got only one function, and that is to tap the screen for jump and double tap the screen for double jump. The Double jump functionality is a bit Tricky, it Does not always double jump when you try to double jump. It some times frustrates the player, but that is the beauty of an Addictive game.

Developer says that
“The One who Masters the Double Jump will conquer this Game”

Another most wonderful and main feature is all the drawings of this game are hand drawn and the scene changes every time you surpass a certain score.

Also the Game is integrated with Google Play Services so the player can log with Google Plus and  compete with their friends and Earn Achievements through the Game.

Google Play Game services feature is only available in the Android version

gplay
The Game starts with a Story where a Volcano is erupting in a beautiful environment, its the first sign of world coming to an end. The two characters, the Professor and the Hero are discussing about collecting Life energy from around the world to create a magical Serum which will help turn a bare planet into another beautiful Earth which the earthlings are planning to migrate. So the hero turns into his Super Mode to Go after them through different environments lands.
last runner Winter Scene last runner

last runner high score
The game is a super good casual one specially when u are waiting for a train or bus. Competing with your friends makes it more Addictive. This is a Must try Game.

Watch the Trailer here

So Go On Guys, Download the Game and start playing
DON’T FORGET to RATE  🙂

You can download it by clicking the Buttons below
google_play_store_icon lat runner ios  last runner windows phone

Whatsapp Web – Desktop App Workaround

Hi guys, its cool to see whatsapp coming to the desktop, at least as a chrome app.
But I know there are a lot of people who use browsers other than Google Chrome, and the people who actually wants a hassle free separate desktop app, rather than opening a browser and going to the specific site to view the messages.

So here I am gona explain how to create a chrome application which, kind of create a dedicated browser app for you which you can place in your browser or task bar just like another app and when you click on it, it directly opens like another desktop app.

Step 1
So to do that first you need a Google Chrome browser. If u are a Google Chrome hater, please don’t worry, it only for the first time, after that you can forget about it . Use this link to download the Google Chrome

Step 2
Open the Google Chrome and get in to the Whatsapp web app, using this link https://web.whatsapp.com/

Step 3
Open your Android Whatsapp app and on the menu select the Whats app Web.
Screenshot_2015-01-26-10-28-42
Scan the QR code in the website you visited now using the QR scanner just opened in the Whatsapp android app. And you have successfully registered and accessed the chat.

Step 4
Now in the google Chrome Menu Go to
More Tools –> Create Application Shortcut
chrome

Now you will see the option to create the short cut in Taskbar Desktop or anywhere you like

app

TA DA , now you have a dedicated Whatsapp Desktop App which you can click open with a single click.

Whatsapp Desktop App

This technique can be used with all other websites as well, like facebook, twitter and many others.

Hope this article is helpful for you free feel to share with you friends
😀

JSConf 2014 Asia

Last year I was sent to training by Exilesoft(Pvt) Ltd for the JSConf 2014 Asia conference held in Singapore.

JSConf 2014 Asia
It was an awesome and informative event, got chance to meet people from some popular companies like PayPal, Spotify, Github, Firefox, King(Candy Crush) and many others.

So I would like to share some information and some useful resources I managed to gather their in the conference.

The Conference was held for 2 Days.
Ill be explaining the important point and the resources in the order of the sessions

Day 1

Building Isomorphic Apps – Spike Brehm, Airnb
Session Video

Slides  – http://www.slideshare.net/spikebrehm/building-isomorphic-apps-jsconfasia-2014
Github – https://github.com/spikebrehm/isomorphic-tutorial
Twitter – @spikebrehm

Pixel Art and Complex System – Vince Allen, Spotify
Session Video –

Github – https://github.com/vinceallenvince/Bit-Shadow-Machine
Samples – http://vinceallenvince.github.io/jsasia2014/
Twitter – @vinceallenvince

Bad FormChris Lienert, Jardine Lloyd Thompson
Session Video

Slides – http://www.slideshare.net/cliener/jsconfx?related=1
Github – https://github.com/cliener/Quaid-JS
Twitter – @cliener

HTTP Headers The Simplest Security – Wei Lu
Session Video

Github – https://github.com/helmetjs/helmet
Twitter – @luweidewei

Fun with Javascript and SensorsJan jongboom, Telener
Session Video

Slides – http://www.slideshare.net/janjongboom/fun-with-sensors-jsconfasia-2014
Github – https://github.com/janjongboom/jsconf-asia
Twitter – @janjongboom

The Art of LessMartin Kleppe, Ubilabs
Session video –

Project Site – http://aem1k.com/雨/
Slides – https://speakerdeck.com/aemkei/the-art-of-less-jsconf-dot-asia
Twitter – @aemkei

QuiverJS :  Rethinking Web Frameworks Soares Chen
Session Video

Slides – http://quiverjs.github.io/jsconfasia-2014/assets/player/KeynoteDHTMLPlayer.html#0
Github – https://github.com/quiverjs
Twitter – @soareschen

Translation Workflow And Formatting Complex TranslationTingan Ho, P1.cn
Session Video

Github – https://github.com/tinganho/l10ns
Twitter – @tingan87

Preparing your NodeJS Application for Scale – Dexter Tan and Laurence Franslay, PayPal
Session Video –

Day 2

Web TorrentFeross Aboukhadijeh
Github – https://github.com/feross/webtorrent
Twitter – @feross

There and back again – A Game Dev’s Tale Peggy Kuo, Atlassian
Session Video

Slides – https://speakerdeck.com/pyko/there-and-back-again-a-game-devs-tale
Twitter – @pyko

Versioning, Syncing & Streaming Large Datasets using DAT+NODEMax Ogden
Session Video

Lint to DAT : http://dat-data.com/
Twitter – @maxogden

IPCluster-Scaling Zopim’s Fronted Node ServersYang Bin Kwok, Zopim
Session Video

Github – https://github.com/zopim/ipcluster
Twitter – @zopim

Reactive Programing Made SimpleSlava Kim, Meteor
Twitter – @imslavako

Gibbering at Algoraves: JS in Live Audiovisual Performances Charlie Roberts, UCLA
Session Video

Github – https://github.com/charlieroberts/Gibberish
Link to Gibber – http://gibber.mat.ucsb.edu/

Lets make a Game with PhaserGabe Hollombe, Neo
Session Video

Github – https://github.com/gabehollombe/phaser-pvz
Twitter – @gabehollombe

Deep Space – A Simulation Drama  –  Simon Swain, Modus Interactive
Session Video

Github – https://github.com/simonswain/deepspace
Twitter – @simon_swain

Future of NodeMikel Rogers, Digital Ocean
Session Video

Site to create NodeConf – http://oneshot.nodeconf.com/
Twitter – @mikeal

The post will be updated till individual video links appears in youtube, mean while you guys can watch this play list of all the sessions

Basic Swift for iOS: Core Syntax

Hi guys, I was given a Mac Book Pro recently and thought of learning some iOS development. So as a first step thought of going through the Basics first. And as you now sharing what I learn with other is the number one way of learning…! This blog will go in a format of short notes or points.
So here you go guys…!

Most of the basics are same as most other popular languages, but still there are some changes, Ill be high lighting the serous issues.

We don’t use semi colones at the end of the statements in Swift.
Also we avoid parenthesis when declaring a condition as much as possible, if there is a complex logic its advised you use it, other than that nope.

We follow the camel case naming convention in Swift

Playground

There is a tool called Play Ground in Xcode where you can write some code and observe the results soon as you write them. Its a great tool to learn the basics and to test some complex logics

Variables

In swift you don’t have to mention the type when you are creating a variable, it automatically decides itself according to the values you pass.

var myInt = 32
var myString = "cat"

But if you want to create a variable without assigning a value you can specify it like this

var myVariable :String
var myIntVariable :Int

Constants

Constants are variables with immutable values, so once a value is defined that value cannot be changed after that

So they are declared with the word “let”

let myConstVariable = 32
let myUnChangedVal = "car"

String Interpolation
Ooops don’t get scared by the word. Its basically a way of passing values or concatenating values in between strings.

var name = "Batzee"
var level = 11

just say you got 2 String values which u have to add in between a standard println() statement

println("\(name) is a Level \(level)" Agent in Ingress")

So the out put will be

"Batzee is a Level 11 Agent in Ingress"

So here instead of using ‘+’ operator we are using ‘\()’ operator

Functions

Functions in Swift are created with the key word ‘func’

func eatBurger(){
}

and called using the function name with the paranthesis

eatBurger()

If the function has a return type then the function is written as

func eatBurger() -> Int{
var burgerNo = 3
return burgerNo
}

‘->’ followed by the return type must follow the function before the curly braces starts.

if Statements

if statement is same as you have written an ‘if’ statement anywhere else, but there are certain things you have to consider when writing in Swift.
As always the Swift says it’s best practice if you can avoid the parenthesis around the condition
And on statements that has one line of executable line of code on success also must have it self surrounded by the curly braces unlike other languages, where you can avoid using the curly braces around the single line code.

if  x<500  {
return x
}

Loops

So there are 4 kinds of loops in Swift

The 1st one is the traditional for loop there is not much difference, only thing you have to consider is to remove the parenthesis around the condition

for  var x = 0; x<10 ; x++  {

}

The 2nd one is the for in loop this is something like foreach loop you specify a collection to loop through. Whatever you pass it converts it in to a collection. If you give a range, it loops through the range. If you pass an Array, it loops through the array element, and if you pass a string it converts the String in to character array and loops through the character array elements

Example 1

var total = 0

for x in 1...100{
total = total+x
println()
}

So the x will loop from 1 to 100

Example 2

var name  = "cat"

for y in name{
println(y)
}

here the variable name will be taken as a string array and the out put will be

c
a
t

The 3rd one is the While loop, it is same as any other while loops in other languages, only considerable change is, not necessarily to add the parenthesis around the condition

while condition {
// do if the condition is true
}

The 4th one is the Do While loop, in this there is some noticeable change, the condition is added at the end of the body, this is to run the code inside the body at least once before it checks on the condition

do{
//runs for the 1st time and runs for the second time and after, if the condition is satisfied
}while condition

Range

Range operator is something new in Swift

which is defined by ‘…’ this says to consider the number mentioned in the left of the operator and all the numbers in between it and the number mentioned in the right of the operator.
Also in the Range operator you can control the 1st and the last dot, like ‘..<‘ , ‘>..’ so this basically will work like a for loop

for  x in 1...100 {
println(x)
}

this will print 1 to 100

similarly

for y in 1..<100{
println(y)
}

will print 1 to 99

Switch Cases

So the Switch Statement in Swift has some points to consider .

The case range must be Exhaustive, unlike other languages you cant check only for a handful of conditions but for all the possible values.
for example if you are checking for integer cases, integer is never ending so u have to handle it. In that case you will use the default case to catch all the situations that you don’t want than what u actually wanted.

let chocoCount = 7
Switch chocoCount{

case 0:
//in case 0 do this
case 1:
// in case 1 do this
case 12:
//in case 12 do this
default:
// do this if the cases dont match the given cases

}

Also in Swift’s Switch statements they don’t have the ‘fall through’ option, which automatically falls into another case for a range of cases. In that case we can use the range case, We have already seen what is a range operator does above.
This is how it is done.

switch chocCount{

case 1...7:
//if the case is between 1 and 7 do this
case 8...15:
// if the case is between 8 and 15 do this
default:
break

}

This post is written after learning from a video, so there are some chances that I may have made some mistakes, so please feel free to comment them down, Ill me more happy to correct them. And stay tuned in for more blogs on Swift and iOS development.

Reference: Notes are taken by studying the Swift Essentials from Lynda.com

Setting Up JDK for JAVA Development in your Windows PC

Android is based on Java so
First you need JDK(Java Development KIT) installed in your machine and it needs to be configured in the Environment Variables.
To check if JDK is already installed in your machine. Open the command prompt and type “javac”
javac

Then press enter. If you see a screen like this

javacresults

That means you have JDK installed and configured.
else go to
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

And download the JDK suitable for your pc version(The latest version changes with years this Screen shot is taken on 2014 September)
JDK Download

After you have downloaded it and installed it copy the path of the bin folder in side the installation folder. Installation folder path will be normally
C:\Program Files\Java\jdk1.8.0_05\bin
Depending on the version of Java u have installed the folder name and depending on the Windows version the program folder name also changes.

Now Go to Control Panel-> System and click on Advanced System Settings
Advanced system Settings

Step 1
You will see a new Window called “System Properties” Pop up

Step 2
Then in that Windows you will see a Button Saying “Environment Variables”, click on it

Step 3
It opens a new window called “Environment Variables”

Note: Before Going to Step 4, check if the “User Variables for ‘Your PC user name’ “, already got “path” in the list, if it was not there follow Step 4 else skip to Step 5.2

Step 4
In that window under the “User Variables for ‘Your PC user name‘ “Click the New Button

Step 5
Now you will see a new window “New User Variable”, there on the ‘Variable name‘ section type “path”, and on the ‘Variable value‘ section paste the java sdk path you have copied earlier

Step 5.2
If there is already a path variable, select that section and click on the “Edit”, and without doing anything  in the ‘Variable name‘ section, go to the ‘Variable value‘ and add a “;” next to the existing value and paste the java sdk path you have copied earlier.

Step 6
After adding the value, click ‘OK’ , then again ‘OK’ on the “Environment Variables” window and finally click  on the ‘Apply” button on the “System Properties” window.

Settings

Now you will be able to get the result I have got earlier when typing “Javac” on the command prompt.

 

 

 

What is Android ?

The word Android originally means Human Robot.

trwetsrtg

But here what we are going to see is Android the Mobile OS that is ruling the world now. So Android basically is an operating system like windows xp, windows 7, Ubuntu, Fedora and many other.

Android is open source. So developers are all around world are always up to improving the OS for a better performance. So Android always comes up with new and latest features compared to other OS available in the market.

Android project started by an individual and then later bought by Google and now it is developed in a large scale.

Operating system is free and updates are also given out as free. After Google acquired the Android, Google services are also connected with android which enhanced the features and power of the devices.

Google is constantly working on new versions of the Android software. These releases are infrequent; at the moment they normally come out every six months or so, but Google is looking to slow this down to once a year.

Versions usually come with a numerical code and a name that’s so far been themed after sweets and desserts, running in alphabetical order.

  • Android 1.5 Cupcake
  • Android 1.6 Donut
  • Android 2.1 Eclair
  • Android 2.2 Froyo
  • Android 2.3 Gingerbread
  • Android 3.2 Honeycomb
  • Android 4.0 Ice Cream Sandwich: The first OS to run on smartphones and tablet
  • Android 4.1 Jelly Bean
  • Android 4.2 Jelly Bean
  • Android 4.3 Jelly Bean
  • Android 4.4 KitKat

Android is developed using a slightly customized JAVA also known as Android. The lower level architecture works on Linux.

Eclipse with ADT plugin and Android Studio are used as tools to develop apps for Android Phones.

To know about Android you can visit – http://www.android.com/
To know about Android development you can visit – http://developer.android.com/index.html