Showing posts with label how. Show all posts
Showing posts with label how. Show all posts

Saturday, December 21, 2013

What happens when an integer value goes out of range?

Signed integer variables:

Range of short int : -32,768 to 32,767
Range of long int : -2147483648 to 2147483647


Unsigned integer variables:

Range of short int : 0 to 65535
Range of long int : 0 to 4294967295

When we initialize a integer variable or assign any value to it , if the value is in range of our defined integer then the program works normally as it should.
But if the value goes out of range then there we know that the value that resides in the variable is a garbage or any random value. Is that value actually a random one?
The answer is no , that is a calculated value within the range of the integer which is calculated by the compiler.
Now, how the value is calculated of it goes outside the range and brought back in the range.

The algorithm used is:

y = x % range;
if y in range 
the value is y
else
y = y % range;


The modulus operator(%)  brings back the value gone out of range because the remainder to this expression is always in the range.

The range is taken to be the (negative end range + positive end range + 1). For unsigned variables there is no negative range so , (positive end range + 1). We have to compute the remainder by taking the nearest possible multiple of range to the value x that we assign to the integer. We can also compute the remainder by taking negative multiples if required.

Here is a video to demonstrate the process..



Sunday, November 4, 2012

How to install xampp server on linux

How to install XAMPP server on ubuntu or any other Linux Distro

1. Download the XAMPP server bundle.
        
      XAMPP for Linux

2. Login to terminal as root.

      sudo -s

2. Open terminal window and change the directory to the folder where you downloaded the bundle .

3. Then type the following command in the terminal window to extract the contents of the bundle downloaded.

     tar xvfz xampp-linux-1.8.1.tar.gz  -C /opt

this will extract the files to a folder named 'opt' in root directory.

4. and thats it , your XAMPP server is ready , go to the terminal window and just type in

     sudo /opt/lampp/lampp start

this will start the server .

5. To stop the server type in terminal

     sudo /opt/lampp/lampp stop   


** to solve the problem of pasting content in htdocs folder execute the following command in terminal window

     sudo chmod 777 -R /opt/lampp/htdocs/ 

Wednesday, August 22, 2012

Installing an .apk file in android emulator


  1. Launch your emulator
  2. get an .apk file that you want to install in your emulator
  3. navigate to your android-sdk dir and search for adb.exe
  4. copy the location of the   adb.exe
  5. Right click on my computer and open Advanced Settings and click Environment Variable
  6. select Path from System Variables and click on Edit
  7. add a semi-colon ';' and Paste the location that we copied
  8. open cmd.exe
  9. change the directory to where you have the .apk file located.
  10. after you have reached the directory type :
            adb install filename.apk

and you are done .

Wednesday, August 1, 2012

HAX manager for android emulator

Intel released a new driver for android emulator so that it makes use of our computers GPU and runs faster 

To enable the driver follow the steps below :


  • open the SDK manager and download the Intel x86 Atom System Image for the platform you are working with (Intel x86 system image is only available for android 4.0.3 and android 2.3.3)
  • download the Intel Hardware Acceleration Execution Manager.
                       

  • after the download and install is complete see the location where the driver is downloaded by hovering  over at Installed text.


  • go to the directory and run the setup file
  • install the driver and configure the RAM size according to your system


  • to test that your driver is installed correctly run
  • CMD.exe as Administrator and type  
    sc query intelhaxm


  • open AVD manager
  • create a new avd and Target it at the platform for which you have downloaded the Intel x86 Atom System Image 
  • set the CPU to Intel Atom x86 .
  • enable GPU emulation by clicking on new In the Hardware column and select GPU emulation

  • set it to yes.
  • click on create avd and start the avd just created.
  • you see in the Starting Android Emulator dialog box its written that                            
                        avd runs in fast virt mode





Watch this video tutorial if you face any problem:




Friday, July 20, 2012

How to create a new connection in SQLdeveloper

First of all start your database by going to cmd.exe  and type in
  
 sqlplus

It will ask you for the username and password . Enter any user to connect and enter the password for that user.

After you are connected to the database open SQLdeveloper and click on create new connection .




a dialog box opens.




In the field Connection name enter any desired name, in the field username enter the specific user with which you want to connect and in the next feild enter the password for that user. Also Check save password so that you are not prompted again and again for password.




In the oracle tab set the Role to default and connection type to TNS.





From the list of Network alias select ORCL(The name may vary on different machines)





after that click on Test and You should get Success.




After the Success is printed Click on Connect. And you are done.



if you face any problem please leave a comment.!