Posts which you will also like.

Saturday, July 28, 2012

BackTrack 5 KDE startx problem fixed


While installing the BackTrack 5 KDE(64 bit) OS when you try to enter into GUI mode via typing startx you get a strange error message like this:

BackTrack
This is well known bug in BackTrack 5 KDE (64 bit version) and many user asked me about the solution of this bug.
This problem can be fixed by deleting the kcache files from the following directories:
  • /root/.kde/cache-bt
  • /root/.kde/cache-root
Since GUI is not available without the startx so you will have to use the commands to delete all kcache files in the above directories.So Type the following commands
# cd /root/.kde/
# find . -type f -iname "*.kcache" -delete
or
rm /root/.kde/cache-root/icon-cache.kcache
rm /root/.kde/cache-root/plasma_theme_Volatile.kcacherm /root/.kde/cache-bt/icon-cache.kcache
rm /root/.kde/cache-bt/plasma_theme_Volatile.kcache

As usual now type startx command.

Some people also found some alternatives to fix this problem you can also try these

  • Boot from live cd or use vmware to boot the backtrack
  • Wait till the screen to decide which mode to boot.
  • Press the TAB key. (This opens the grub options for the live boot)
  • Change the section with "text splash vga=791" to "text splash vga=791 i915.modeset=1".
  • Press the ENTER key.
  • Type startx and Wait for Gui to appear
bt5-6
More on this at techcresendo.com
Read More ->>

Wednesday, July 25, 2012

Java Tutorial:Difference Between equals and ==


Sometimes in our java code we find that equality comparison operators(equals() and ==) do not work as expected.But why is that happening so? We know how they works Smile.

Really?

Actually we don’t know in depth how they work.So in this java tutorial I am going to show how equals and == works and what is difference between them.So keep reading this java tutorial.

equals():

This method compares the actual content inside the object i.e two instances of a class having content with same meaning  e.g

Integer num1=new Integer(10);

Integer num2=new Integer(10);

so num1.equals(num2) is true as obvious.

==:

== compares the references i.e the reference which is referring to the actual object not the content inside the object.Then if two references referring to the same object then references will be same. e.g

Integer num1=new Integer(1000);

Integer num2=num1; Now num2 is also referring to 1000

so num1==num2 is true.

Suppose if we say Integer num2=new Integer(1000); Now a new Integer object is created on the heap and its reference is assigned to num2.

so num1==num2 is false.

Now guess the output of

Integer n1=10; Integer n2=10;

if(n1==n2)

System.out.println(“same object”);

else

System.out.println(“Diff.object”);

Output is: same object

Yes that’s true;behaviour of == changes when boxing involves.This strange behaviour happens because JVM create the literal pool same as (String constant pool) for following wrapper objects (which must have been created through boxing)

  • Boolean
  • Byte
  • Character range(\u0000 to \u007f)
  • Short
  • Integer range(-128 to 127)

So whenever you are creating such wrapper object then first it will be searched in it’s respective constant pool if it is found there it’s reference will be returned to new reference of wrapper object other wise it is created and stored in the pool.This strange thing happens just to save memory.

Read More ->>

Thursday, July 19, 2012

Creating and Running a Linux Script file


Scripting is very powerful feature of Linux.It helps the administrator of Linux to automate the daily routine task so it is recommended to learn scripting for Linux administrators.Shell scripts are much more like MS DOS batch file.Any way I am not making you a Linux admin but in any case if you learn the scripting you will feel its benefits by yourself.
In this blog post I will describe the various methods to run a Linux script file.
A Linux script file contains the scripting commands written in it and this file has “.sh” extension(not mandatory).We can run this file in four ways.I will discuss them one by one.
1.<shell name> <script-name>
bash myscript
or
ksh myscript
In this case a new shell(bash or korn for the above case) will be spawned from the previous parent shell and your script will in the child shell.
2. ./<script-name>
./myscript
In this case also a new shell is spawned but in this case first we will have to change the file permission of the script file to be executable using chmod command then we can run.
e.g chmod +x myscript or chmod 755 myscript
3.  . <script-name>
.myscript
In this case new shell will not be spawned neither we have to set the file permission for the script.
4. Self executable script file:
In this type of run we just give the name of script and it will run automatically i.e self executable.
but for this first line of your script should contain:



#!/bin/bash   (or path of any shell)


#!(path)



If you do not know the path of shells or the no of shells present in your system type:


cat /etc/shells


It will show the required information.


One more thing if you want to know whether new shell was created or not you can execute the


following command at terminal before executing a shell script and after executing the shell script:


echo $$


It will show the PID of the current shell.
Read More ->>
DMCA.com Protected by Copyscape Online Plagiarism Tool