Sunday, 5 July 2015

Sudoku modelling through JAVA

Concepts: Arrays, Loops, Functions, If-else
Sudoku

Sudoku (数独 sūdoku?, Digit-single) i/suːˈdoʊkuː/, originally called Number Place,[1] is a logic-based,[2][3] combinatorial[4] number- placementpuzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the

grid (also called "boxes", "blocks", "regions", or "sub-squares") contains all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which typically has a unique solution.
Completed puzzles are always a type of Latin square with an additional constraint on the contents of individual regions. For example, the same single integer may not appear twice in the same 9×9 playing board row or column or in any of the nine 3×3 subregions of the 9×9 playing board.[5]
The puzzle was popularized in 1986 by the Japanese puzzle company Nikoli, under the name
Sudoku, meaning single number.[6] It became an international hit in 2005.[7]



Task:
Write a java program to model the Sodoku game.
 Create a 9 X 9 matrix inside main. Write a function or functions to check whether the solution is as per the rule.

 After that we can think of developing the Game for playing the sudoku.

Yotaphone devices to drop Android for Sailfish OS

Out of the box? Out of the droid!

Find out your device's worth with Swappa Android app

Na biwi na bachha, na baap bada na mayia, the whole thing is that ki bhaiya sabse bada Rupaya!

A Casio smartwatch is coming up next year

Shit just got serious!


First-look at the Android-running BlackBerry 'Venice'

Am I seeing a hypersport class Rolls Royace?

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

Solar Impulse 2 lands in Hawaii, setting record for longest solo flight

It's beautiful, isn't it?

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.

Google apologizes for calling black people as gorillas in photos app

Good boy google! *pats pats*

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

The fan in the video was connected to a battery pack that lasted seven hours, but you can use other power sources including solar panels. Meanwhile, the ice in the cooler melted after five hours.

desertsun02 recommends using big jugs of frozen water inside the cooler so that when they melt, you won’t have to clean it all up. Instead, simply put them back in the freezer when you’re done, and reuse them once the water freezes up again.

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.