Skip to main content

Posts

MongoDB with Php part 01

In this blog we can see how to install mongo db in windows and connect with compass and how to acess mongo using Php with composer.   Follow me  @  facebook      @linkedIn     Installing MongoDb: 1) download mongodb from its official site..( click here to download ) 2) click the .exe file and mongodb gets installed. 3) now goto the parent directory in which monodb is installed and create a directory called 'data' and inside the 'data' create a sub directory called 'db'. 4) now to intialize mongo variable goto the installed directory usually it will be "C:\Program Files\MongoDB\Server\3.6\bin" nad copy that path. 5) goto system properties->advanced system settings->environmental variables in this add this path as a user variables. 6) now open a terminal and type "mongod". it starts the mono database running on local host on the default port 2701.. 7) now open a new terminal and type "mongo" it connects with your mo

Is the Number is Rotated?

Java code to check weather the second number is rotated version of the first number without converting it to string or array....frequently asked in interviews..... Follow me @ facebook     @linkedIn //*********************************Coded-By : SOMES KUMAR K.*******************************//   //*********************************LEARN CODE WITH FUN*************************************// import java.util.Scanner; public class Find_Number_Rotated { int find_count( int a){ int c= 0 ; while (a> 0 ){ c++; a=a/ 10 ; } return c; } public static void main(String[] args) { Find_Number_Rotated no = new Find_Number_Rotated(); boolean xc= false ; Scanner s1 = new Scanner(System. in ); int a= s1.nextInt(); int data = s1.nextInt(); int c = no.find_count(a); int th= 1 ; for ( int i= 0 ;i<c;i++) th*= 10 ; int b=(a*th)+a; int s

X-O game using JAVA

Here, you can find a basic java code to implement X-O game. Follow me @ facebook //*********************************Coded-By : SOMES KUMAR K.*******************************//   //*********************************LEARN CODE WITH FUN*************************************//     import java.util.Scanner; public class X_O_Game { int xi , xj ; static Scanner s = new Scanner(System. in ); char board [][]; public void make_board( int n){ if (n% 2 != 0 ){ setBoard(n); } else { System. out .println( "Enter valid Board Size" ); n = s .nextInt(); make_board(n); } } public void setBoard( int size) { board = new char [size][size]; for ( int i= 0 ;i<size;i++){ for ( int j= 0 ;j<size;j++){ board [i][j]= ' ' ; } } } boolean check_board_empty( int size){ boolean c= true ;

Arrays using Pointers..

In this blog let’s try to understand about pointer.   So, what is pointer?... pointer is thing that used to point something in a group. For example, Here, the pointer is used to point the temperature in the gauge. Similarly, in computer the data gets stored in memory and each data is assigned with an address in the memory. So, the pointer is used to point the data, in other words pointer contains a memory address of that particular data. (int a = 10; here the ‘a’ indirectly act as a pointer which has the value ‘10’.) Now we can see that how arrays are similar with pointer. We know that array is a continuous block of memory that stores multiple data of same kind. Let’s have a close look In c program pointer a declared with ’*’   symbol followed by a variable (eg : int *ptr). int a[10];---------------------------( 1 )------------------> this array stores 10 integers at max, here all elements in array is referenced with the variable ‘a’. which is more less equ

OOP Encapsulation with Modifiers..

                  In this blog we can know about why we go for JAVA?. Java is a language known for object oriented features and its network support. Here object oriented is achieved by three concepts Encapsulation Inheritance Polymorphism                 but Java is not pure object oriented  because of its support to primitive data types(explained later..) like int, float,...to overcome this JAVA has loaded with wrapper class( know more ).          Encapsulation,   we had come across the word "capsule" many times in our life. capsule is nothing but a outer protection(cover) used to protect the something from external factors. example the medicines usually come with a capsule to protect the chemicals inside it. Similarly the encapsulation is used to wrap the code or data from intruders in order to ensure its security. It can be achieved from modifiers. Java has many modifiers each with unique characteristic features but for encapsulation we commonly g

Object in Java..

         Object is a thing used to access a member in class. (i.e) the class members which are non static can be accessed in other class using object it is also referred as Instance of a Class. It is created during run time so its a run-time entity. Object can be used access only one class. But class can have multiple objects unless the constructor is declared as static. For static constructor only one object can be created. During run time object gets created and only when object created the memory of the class variables gets created and the object's memory gets stored in heap. Object can't be created for abstract class and interfaces.   Any object should posses  Identity State Behavior  To create a object Declare a reference variable Construct object with "new" keyword. new is used for dynamic memory allocation.  Assign the reference variable to new keyword. and construct the object. Example: class A{ int a,b; static int x,y; A(){ } void

JAVA CLASS at a glance..

Hi, in this blog let’s get started with java…. let’s skip its history and move to its concepts. Ultimate aim to develop java is to behave as a pure Object-Oriented language but unfortunately it is not. Because its supports primitive data types like int, float, etc., to overcome this JAVA has introduced wrapper class. I’ll tell u detail soon after. The main building blogs of java program is Objects and Class with the help of these we can simulate any real-time object with its qualities as a JAVA program. In this blog I share my knowledge about the class. Class, the class is a blue print or framework which contains variables and methods(functions) that define the quality of an object. The syntax of class is “class <name> {……….}”. for example class box {                        //……………………………………………class name int length = 10; int breadth = 10; String colour =” blue”; String shape = “square”; void print() {                       //………………………………………….method. System.out.pr