Sunday, 5 July 2015
Sudoku modelling through JAVA
Saturday, 4 July 2015
13 tips for shooting low light photos on your phone like a pro.
1) Get the exposure right
2) Go manual
3) Keep your shutter open as long as reasonable
4) Stabilize your shot
5) Get the white balance right
6) Use environmental light to your advantage
7) Use flash sparingly
8) Don't zoom
9) Use your native aspect ratio and resolution
10) Shoot Raw on Android
11) Use filters and edit wisely
12) Convert to black and white
13) Know thy camera
Thursday, 2 July 2015
Blocks in JAVA
BLOCK IN JAVA
JAVA supports 2 types of blocks.
1. Static block
2. Non static block
If the block is declared within the static keyword then the block is known as static block.
The static block always executes before the main method, which is executed by the JVM.
If the block is declared without any static keyword then it is a Non Static block.
Non static block always executes before the constructor called by the user.
Static block is executed only for a single time for the whole life cycle of the program. Whereas non static block may execute "n" number of times, as it depends on the user
The existence of the main method will be checked by the JVM before the execution of the Static block.
Static block execution depends on the JVM. Non static block execution depends on the User.
You can write more than 1 static or non static blocks within a single class, as it is accessed top to bottom manner.
OnePlus Two's image leaks out!
The new flagship is pegged for a July 27 announcement.
Looks gorgeous, doesn't it?
So does its features.
This is what happens when a Google robot gets annoyed with a human
As the Wall Street Journal reports, Google performed a series of experiments in which a human conversed with a computer program. The program had been fed a whole database of movie scripts. You might think, then, that this robot was something of a warmhearted romantic who believed in happy endings.
You might also think that yogurt is made from broccoli.
The conversations were recorded and presented in a paper pleasantly titled "A Neural Conversational Model." (PDF)
One conversation stood out. This was because if the computer program had had arms and legs, I suspect it would have gone MMA on its fellow human conversationalist.
They were chatting about morality. The human kept pressing his robot friend about morality. What was it? What did it mean?
"I need to know how I should behave morally," says the human. The robot understands but replies: "I don't know how to tell you."
The human wonders if morality and ethics are the same. They are, says the robot. But when the human asks for examples of moral behavior, the robot suggests "integrity."
When pressed on the definition of integrity, the robot makes like an unfaithful lover trying to explain herself to her ex: "I don't know what else to say."
It gets worse. When the human exclaims: "Be moral!" the robot shrieks back: "Be a man!"
Below the belt, somewhat?
What followed was surely an exchange that most people reading this have experienced at least 1,412 times in their lives.
The human says: "I really like our discussion on morality and ethics." Yes, the human is a true resident of California, accentuating the positive. I bet he salutes the sun and makes his dog go downward.
However, the robot answers: "And how I'm not in the mood for a philosophical debate."
Oh.
The exchange ends with both parties going to opposite sides of the bed to sulk. Metaphorically, that is.
"What do you like to talk about?" says the human.
"Nothing," replies the robot.
I understand that the human bought the robot flowers, suggested a visit to the symphony followed by a nice dinner out. The robot has yet to reply.
VARIABLES IN JAVA
VARIABLES IN JAVA
JAVA supports 6 types of variables
1. Local variable
2. Static variable
3. Instance variable
4. Final variable
5. Transient variable
6. Volatile variable
LOCAL VARIABLE:
If the variable is declared within a block (block of method, block of constructor, Block of loop, block of if or else, block of switch or case, or any general block) it is known as local variable.
class Test{
-------block-------
}
We cannot make the local variable as public
We cannot make the local variable as public , private or protected because the local variable can only be accessed within the same block , but the public access specifier makes the variable global. Thus it is not possible.
In short, no access specifier is used for a local variable.
Private makes it accessible within the same class.
Local variable is only able to access within the same block in which it is declared.
Local variable is not a member of the class or object, so it can't be called by class name or object name. It only accesses directly within the same block. Before using the local variable, that variable should be initialised.
Static variable
If the variable is declared within the class and not within the block, with a static keyword, then it is known as static variable. Static variable is known as class level variable. This type of variable can be called by class_name or object_name, within the same class as well as outside , it's possible to call a static variable within the same class directly.
Static variable creates a single copy for the whole program.
Instance variable.
This is known as object level variable, because Instance Variable only allocates memory at the time of the object creation.
If the variable is within the class and not within the block without any static keyword, it is known as non static or instance variable. Instance variable only can be called by the object name.
Final variable.
If the variable is declared with a "final" keyword, then it is known as final variable.
JAVA never supports any "const" keyword to declare a constant. If the variable is declared with a "final" keyword, then it is constant in JAVA.
Final variable may or may not be static in JAVA, by its better for programmer to declare the Final variable as Static.
Wednesday, 1 July 2015
Lifehack: Make an Air Conditioner Out of a Cooler for Less Than $50BGR
Sunday, 28 June 2015
OPERATORS IN JAVA
OPERATORS IN JAVA
JAVA supports 44 number of operators and like C and C++, it's divided into 3 categories ,
1. Unary operator.
2. Binary operator
3. Conditional operator.
UNARY: + , - , ++ , -- , !
BINARY:
Arithmatic: + , - , * , / , ÷
Logical: && , ||
Bitwise: & , | , ^
Relational: > , < , >= , <= , != , ==
Assignment: = , += , -= , *= , ÷= , /=
Shift: << , >> , >>> ( unsigned right shift)
Ternary: ?!
Special: ( ), [ ] , , , . , type , instanceof
Modulus operator never works for float and double value in C or C++, but works in JAVA. I.e System.out.println(10.0℅3.0); o/p = 1.0
TYPE OPERATOR OR TYPE CASTING OPERATOR
Typecasting in JAVA is divided into 3 types-
1. Implicit casting
2. Explicit casting
3. Boolean casting.
Instanceof operator: it's am object comparison operator.
This operator always checks the object existence and returns Boolean value.
Object if the child class can be the object of the parent class.
DOT OPERATOR: It access the variable or the constant, accesses the method , accesses the object, accesses the class and accesses the package.
Saturday, 27 June 2015
FLOAT AND DOUBLE
Float and Double : these two datatypes always stores the real Constant.
Real Constant is always by default double in nature.( example, 4.2 is double in nature and thus, it is a real Constant.)
Thus, float x = 4.2; is an error.
Rather you have to typecast it as : float x = (float)4.2; or float x = 4.2f.
CHARACTER DATATYPE:
Character in JAVA supports Unicode. 65536 number of characters are supported by the JAVA language, since the maximum value of 16bits is 216 which is 65536.
Boolean in JAVA only supports true or false values.
Friday, 26 June 2015
DATATYPE AND WRAPPER CLASS
JAVA supports 8 primitive datatypes, then the language is not purely object oriented.
For each datatype. JAVA provides a predefined class ( known as wrapper class in JAVA).
Wrapper class is used to make JAVA pure object oriented.
All the wrapper class present in java.lang package and the default package in JAVA.
PRIMITIVE DATATYPE
Datatype. Size. default value. Wrapper class
Byte. 8 Bits. 0. Byte
Short. 16 Bits. 0. Short
Int. 32 Bits. 0 Integer
Long. 64 Bits. 0L. Long
Float. 32 Bits. 0.0f. Float
Double. 64 Bits. 0.0. Double
Boolean. 1 Bit. False. Boolean
Char. 16 Bits. /u0000. Character
Wrapper class makes JAVA pure object oriented but still it's not purely object oriented ad it supports primitive datatypes.
Signed and unsigned are the two keywords that are not available in JAVA. So by default the datatype is signed in nature. Character datatype in JAVA is signed in nature, I.e it only holds positive value. (As ASCII value us always positive)
Negative number is always stored in the form of 2's complement. Example: 11111111 -> 00000001(2's complement) = -1.
MAX_VALUE & MIN_VALUE are the two predefined static constants which always display the maximum and the minimum value related to the datatype and present in each wrapper class.
toString ( ) is a predefined static method present in the wrapper class which converts any datatype to the string format.
parseByte( ) is a static method present in the Byte upper class which converts a string to byte datatype.
FLIR One : The thermal camera for Android and iOS now available
Just plug it into your micro USB port(for Android) or to the lightning port( for iPhone) and pheww, work's done! Some cool stuff to handle thereafter.
The FLIR thermal camera allows mobile users to see heat from the comfort of their smartphone or tablet.
Spy stuff huh? Well, to be honest, I have seen better( in James Bond and Mission Impossible of course ).
Google takes next-gen autonomous cars to the streets.
Vroom! Tech has always been something orgasmic to me.
And this is, well... NextGen tech!
Google posted pictures of the car driving ...well, itself, in the streets!
Apple removes Civil War games from App Store for showing the Confederate flag
Poor game developers, all their hard work was also shot upon.
In the wake of last week's horrific shooting at a church in Charleston, Apple assassinated all its civil war games, as a gesture of goodwill, I suppose.
Think different! That's always been Apple. Right?
Class 2
Class 2
Void: The main method never returns any value to the JVM. If the main method doesn't return any value, then the return type should be void in JAVA.
public static = static public
COMMAND LINE ARGUMENT
The arguments accepted by the main function is called command line arguments. The main function in JAVA only accepts array of strings as an argument.
String is a predefined class present in JAVA language.
String args [ ] -> name of the array of strings.
NAMING CONVENTION FOR PREDEFINED MEMBERS.
1. Class -
Example: BufferedReader , String
Each word's first letter should be capital, and there shouldn't be any space.
2. Predefined "to" Method -
Example: toString( ), toCharArray( ) ; I.e except the first word, each word's first letter should be capital.
3. Predefined Constant: SIZE , MAX_VALUE; All the letters should be inupper case.
4. Package: java.lang, javax.swing, java.applet ; here each letter should be in lower case and the packages are separated by a "." symbol.
DEFAULT LENGTH OF THE COMMAND LINE ARGUMENT IS 0.
EXAMPLE OF A COMMAND LINE ARGUMENT:
public class Test{
static public void main ( String args[ ] )
{
System.out.println (args.length); // 2
for(int i=0; I<args.length; I++)
{
System.out.println (args [ i ]); //10, 20
}
System.out.println( args[ 0 ] + args [ 1 ] ); // 1020
System.out.println(10+20); // 30
System.out.println (5+6+'A'+'B'+5+6+(4+5)); //76B569
System.out.println("10" + (5 - 10)); // 10-5
}
}
Convert string to integer by parseInt( ). It is a static member and it is called by a class.
Similarly, string to float can be converted by the use of parseFloat.
SYSTEM.OUT.PRINTLN:
A static member is always called by a Class name and a Non Static member is always called by an object name.
The difference between System.out and System.err is that the output produced by System.err can't redirect a file but System.out can
The difference between print and println is that println just adds a new line after printing your desired line.
Thursday, 25 June 2015
Masala of the Maggi
The milk that your milkman leaves at your doorstep every morning is milched from a cow drugged with Oxytocin.
The mangoes you enjoyed this summer had calcium carbide coated onto their skins.
The cauliflower you munched into last winter, was doped with Arsenic.
Yet we panic only when we realise Maggi had lead.
How did Apple manage to reduce the storage size of iOS 9 to 1GB from 5 GB in iOS 8?
This is due to a new technology called 'App Thinning'
Now this consisted of 3 parts, let's just have an bird's eye view:
App Slicing: iOS apps are developed to run on a variety of devices, so they come with code to support all them, whether or not your particular device requires it. App Slicing will allow your device to download only those files required by our device. Example: you don't need the 3x iPhone 6 Plus assets if you're running a 4-inch model.
On-Demand Resources (ODRs): It works on the idea that an app probably doesn't need its entire library of resources at any given time, so parts of it can be downloaded or deleted as needed. Developers will be able to specify what code is needed at what times by tagging sections of code as ODRs. These portions will be automatically downloaded from the App Store when they are required and deleted when they won't be needed again.
Bitcode: It refers to an "intermediate representation" of an app that developers will upload to the App Store rather than a pre-compiled binary. This works hand-in-hand with App Slicing, allowing the bitcode to be compiled on demand as 32-bit or 64-bit, depending on the downloading device. This will also allow any compiler improvements made by Apple to be implemented automatically, rather than having developers resubmit their apps.
INTRODUCTION TO JAVA PROGRAMS
Block----> public class class_name
{
public static void main(string args[ ])
{
System.out.println (...);
}
}
Access specifier in JAVA language:
The major job of access specifier is to specify the scoop of the variable (data member), constructor out any class.
Access specifier---> variable, function, class, constructor.
JAVA folder-> package
Boundaries/scope:
• within the same class
• within the same package
• outside the package
Types of access specifier in JAVA: public, protected, default(no access specifier), private
Public: within the same class, within the same package, outside the package
Protected: within the same class, within the same package and outside the package (only in inheritance)
Default: within the same class, within the same package
Private : within the same class.
In JAVA, you can't declare a variable or function or any member as global.
Java doesn't support an global member like C or C++, bit if a member is declared as public , it behaves as a global member in JAVA.
Execute that class that only contains the main.
You can't execute more than one class simultaneously.
If the class is declared as public then the class name and file name should be the same.
Almost one public class can be declared and that would be the entry point.
Private and public keywords are not allowed for top level class but nested class can be declared as private or protected.
Class
Class is a collection of similar kind of objects, that is from one class we can create "n" number of objects, all with similar type.
Class is a blue print of the object, I.e skeleton.
Class is a logical container which never allocated any memory.
In JAVA , class is able to contain 4 types of members.
1. Data mamber
2. Method member
3. Block member
4. Constructor member
public class Test
{
int x; // data member
Test() // constructor member
{
}
static // block member
{
}
public static void main( string args[]) //method member
{
System.out.println("Hello");
}
Javac: to compile the JAVA program.
Javap: JAVA dessemble. It will display all the members present in all user defined or pre defined class.
Class name is the identifier which maybe same as the file name, but should satisfy the rules of the identifier ( data member, object/ reference name, method name, constructor name, class name, Package name )
Space is not allowed in identifier.
Identifier rules:
1. Space is not allowed in identifier.
2. Digits are allowed but the name can't start with digits.
3. Should not be a reserved word. (Keyword)
4. No special symbols are allowed except "_" or "$"
PUBLIC STATIC VOID MAIN
In JAVA, "main" is user defined function, but the signature is predefined.
Compiler never checks the "main" method existence.
But the execution is always started from the main method.
KERNEL calls the main method in C and C++
But JVM( JAVA Virtual Machine ) calls the main function in JAVA.
• JAVA Virtual Machine.
• System software
• Development in C language.
• Platform dependant ( but JAVA is platform independant)
JVM is a system software inbuilt to OS (I.e itbis present by default)
The main job of JVM is to execute the class file, and the execution always starts from the main method.l, as the main method is always called by JVM from the OS, which is outside the package. So main method should be declared as public, else it can't be called from outside.
WHY MAIN METHOD IS STATIC IN JAVA?
Main method is called by the JVM with the name of the class.
If a method is called by the class name, it should be declared as static in JAVA.
A curved iPhone is reportedly planned
Hold your breath!
Apple is planning to give an "Edge" to Samsung yet again.
Plus,
Sources claim that Apple is very interested in OLED display technology, and that is good news given how well these displays have evolved in color saturation and brightness.
From now, you don't need a Facebook account to log into the Facebook messenger
Facebook Messenger no longer requires a Facebook account. Starting today, new Messenger users in the US, Canada, Venezuela and Peru can sign up using a full name and phone number.
Seems like the messenger didn't get much of a success!
Color-changing condoms tell you what sort of VD you just got
A group of teenage inventors have struck upon a clever way to alert folks to the presence of various venereal diseases before the burning starts: fluorescing condoms that light up when they encounter dangerous bacteria or virii.
Data Structure Chapter 1 & 2
• Definition
What is an Algorithm? (2/2)
• Properties
Classes of Algorithm (1/4)
Classes of Algorithm (2/4)
Classes of Algorithm (3/4)
Classes of Algorithm (4/4)
Algorithm Analysis (2/15)
• How to Calculate Running Time
Algorithm Analysis (4/15)
• Limitations
Algorithm Analysis (5/15)
• Theoretical Analysis
Algorithm Analysis (6/15)
Algorithm Analysis (7/15)
Algorithm Analysis (8/15)
• Counting Primitive Operations
Algorithm Analysis (9/15)
• Estimating Running Time
• a = Time taken by the fastest primitive operation
• b = Time taken by the slowest primitive operation
Algorithm Analysis (10/15)
• Growth Rate Vs Running Time
• Affects T(n) by a constant factor, but • Does not alter the growth rate of T(n)
Example
Algorithm Analysis: (13/15) • Typical Running Time Functions
Asymptotic Notations in Equations
Sorting Algorithms
Name
|
Best
|
Average
|
Worst
|
Method
|
Quick
|
n log n
|
n log n
|
n2
|
Partitioning
|
Merge
|
n log n
|
n log n
|
n log n
|
Merging
|
Heap
|
n log n
|
n log n
|
n log n
|
Selection
|
Insertion
|
n
|
n2
|
n2
|
Insertion
|
Selection
|
n2
|
n2
|
n2
|
Selection
|
Bubble
|
n2
|
n2
|
n2
|
Exchanging
|
A
|
R
|
R
|
A
|
Y
|
\0
|
327
|
328
|
329
|
330
|
331
|
332
|
• This defines a new array containing 3
- int A [3][4];
- • int (*p)[4];
– At begin, end, specific position, after element, before