Monday 30 March 2015

Begginer's Guide to C++- Chapter 1: Introduction to C++

This is the first chapter to a long upcoming series, aimed at making you all learn C++, in quite an easy and fun way. You will be able to learn almost all concepts, without getting tired or bored.

We will be using Turbo C++ compiler for the proceedings. You can search for this "Turbo C++ by Neutron", it will get you to a ready to install package. Also, some programmers will say that the conventions, along with the compiler that I use are outdated, and programming has become much more liberal, but I think that developing your skills on any compiler is fine and, you will learn to modify it, to suit other compilers. What is important is to learn to think like a programmer and break your objective into smaller targets/modules. Through my guide, you will learn just that!

C++ is a case-sensitive language, i.e. the words “doctor”,  “Doctor” and “DoCtOr” will be recognised as different by the compiler, so make sure you keep that in mind.

Basic Terminologies:
  1. Keyword: These are the commands that the compiler understands. Thus these are special words that make the compiler do certain things.
  2. Variable/Identifier: These are storage locations, eg. x=5, where x is called the variable (just like mathematics).
  3. Operator: +,-,*,/ etc. Nothing worthy to explain about them, they do what their symbol suggests.
  4. Datatypes: These are a way to specify the kind of variable you are making. Eg- int - integer, char - character.

Rules for naming variables:
  1. It should not be a keyword.
  2. It should not have any special character like ' ', '*', etc. However, '_' is allowed while naming.
  3. The name should not begin with a number.

Operators: The following operators are available in C++,
Algebraic Operators:
1. +,-,*,/...
2. % - It finds the remainder from 2 numbers. Eg- 3%2 will give answer as 1.
      32%10 will give answer as 2.
Conditional/Relational Operators: Used to check conditions.
3. <,>,<=,>=...
4. == - Used to check equality. Consider this statement as "Is this equal?". If you write x==3, you are asking " Is x equal to 3?". I will elaborate on this later, when its use comes up.
Logical Operators:
5. && - And operator, used to join 2 statements with "and". It is just like the usage in English - "I want to eat mangoes and apples." Here we need both apples and mangoes to be given, in order for me to eat them.
6. || - Or operator, used to join 2 statements with "or". It is also used similar to the way we use it normally - "I want to eat mangoes or apples". Here we need at least an apple it a mango, or even both for me to eat them.
7. ! - Not operator, negates the current input. Eg- != will check if two given values are not equal.
Increment and Decrement Operators:
8. ++ - Adds 1 to the variable's value. Eg- If a variable p is equal to 10, p++ will make it equal to 11.  You can write it both as p++ and ++p, it does not matter.
9. -- - Similar to the above operator, but instead subtracts 1 from variable's value.

Datatypes: Datatypes are of the following types:
  1. int- Used to define integer type variables. Range- -32768 to 32767.
Syntax- int variablename;
  1. float- It is used to define a variable with decimal values. Eg- 10.43. Range- 3.4E +/- 38.
Syntax- float variablename;
  1. double- It is similar to float, but it has a greater range. Range- 1.7E +/- 308.
Syntax- double variablename;
  1. char- It declares a character type variable. Characters are enclosed in ‘’ (Single quotes), and are also represented by ASCII Codes. ASCII codes range from - -128 to 127.
Syntax- char variablename;
  1. void- It denotes an empty set of values. I will explain it later. No variable of this type can be declared.

Special Characters: There are some characters that represent a special meaning. Some are as follow -
  • /n - New Line
  • /t - Tab
  • /a - CPU beep sound
  • /' - Prints '
  • /" - Prints "
                            
Rules for variable declaration:
Syntax:
datatype variablename1,variablename2;
You can also initialize a variable by a value while declaring it.
Eg.- int x=10; (initializes an integer variable and designates its value as 10)
There is one rule of thumb, that you must always remember- You can initialize 1 and only 1 variable while defining it. This means you can provide value to only 1 variable while declaring.
Eg- int x=10,y=20;   is invalid
      int x=10,y;          is valid
      int x=y=10;         is invalid
We always write a=b+c; to store the value of b+c in a. b+c=a is wrong, and the compiler will report an error. Eg- It is always "Tom plays a guitar" rather than "Guitar plays a Tom".



Comments:
Comments help in noting down what statement serves what purpose. They are of two types-
  1. Single Line - For writing a single line comment, first put a “//” and then write the comment. Eg- int x=10; //Initializing x
  2. Multiline - Multiline comments begin by “/*” and end at “*/”.
Eg- /* Hey, howdy?
This is a multi-line comment
I hope you understood the concept*/

So friends, I take my leave here. Please go over the article again, and try to memorize the whole thing because these are the most basic and fundamental concepts in C++, and you will need them at every step.

Wednesday 25 March 2015

Top 5 Apps to Increase Performance and Battery Life on Rooted Phones

You have rooted your phone, and are probably looking for a performance boost without fiddling much with the system core files. The following apps are a boon to low-end devices and extend their usability for a very long time -

1. Metamorphosis Boosters Plus Battery Saver Pro
These apps are under-rated, and provide boosts instantaneously. They come under different categories to cater to all requirements. Ram Booster & Performance Booster to name a few. It modifies the kernel for better management of processes, and different apps offer different tweaks. I recommend not using more than 2 apps from this collection at the same time, as they make conflicting tweaks, and the end result may be just the very opposite of what you are intending.

If you are willing to spend money, then the app also features a "double-booster" feature, which doubles the boost given by the app, and also includes some Beta features.


Update 1.01: Previously Gejos Enterprises Boosters collection, they have now been sold out to Metamorphosis apps as the developer's account was banned by Google. Sadly, these apps have now moved from being free (with some paid features), to being entirely paid only. The app has multiple boosters for various requirements like battery saving, RAM boosing, internet boosting. It modifies the kernel for better management of processes, and different boosters offer different tweaks. I recommend checking out all te boosters, and trying out which combination works the best for you. Remember that turning all boosters on may have the opposite effect than intended.

For those of you who are angry with metamorphosis turning the app to paid only, you may still be able to download the old apk by Gejos from other markets and websites such as apkmania.

These boosters are completely non-intrusive and hassle-free, and you will notice the effect right away.
                                          Image result for gejos ram booster pro apk            

2. Roehsoft RAM Expander
It is a paid app, that uses a SWAP file of the specified size from your SD Card. In simple words, it converts some space from your SD Card into RAM. It works only on those ROMs which have swapping enabled, if your ROM does not, download a good custom ROM with SWAPPING enabled.
This app tends to reduce the life of your SD card, and also sometimes fails to work entirely, but if it does, you will have a 4GB RAM and a blazing fast phone.

3. Greenify
This app essentially hibernates the apps which the user is not currently using. This helps in increasing battery life along with a decrease in load on the RAM. It has a user friendly interface and also allows you to hibernate system apps, if you pay for the full version. This app definitely deserves to be on this list, as its widgets on the homescreen allow you to hibernate apps whenever you want.                    

Image result for Greenify
4. Tasker
This app is an automation app, not particularly increasing performance or battery life, but making your phone intelligent, with minimal coding required. For eg. I have programmed my phone such that whenever the battery is less than 10% and I am not at home, it sends a text to my parents, with the current battery level, location and time.
If you use it wisely, you can also increase battery life. For eg- I have my auto-sync turned off, but everyday at a fixed time, it turns on, along with my Wi-Fi and syncs my mail. Also, my Wi-Fi is switched off, if I am out of range for too long.
While you can use it without rooting as well, but rooting certainly provides many extra features, which you wouldn't have access to otherwise.

5. Pimp My ROM
This is an app with tonnes of tweaks for your phone. You will be able to change almost each default setting on your phone for maximum efficiency and stability. You will need to install BusyBox before using all its features. Otherwise this app is as good as a show-piece.
Some features include-
  • Over-clocking
  • Network Tweaks
  • init.d support
  • And many more...
                                                           Image result for Pimp My ROM

If you are able to balance these apps together intelligently, you will certainly have a extremely fast phone in your pocket, which is not a bad thing. Is it?