Skip to main content

Posts

Showing posts with the label Programming Skills

How to know currently installed PHP version

1. Create a php file in your web root directory,     If you are using Linux then it will in /var/www directory       Create a file using linux commands:     cd /var/www     nano phpinfo.php 2. Write the following code     <?php               phpinfo();      ?> 3. Then run this php script on the browser and have fun!!!

How to fix E: could not get lock /var/lib/dpkg/lock - open (11 resource temporarily unavailable) in ubuntu 12.04

Use the following commands to resolve this problem 1. Search for processes       ps -A | grep apt-get 2. See if there is any process running as apt-get then kill that process using the process id       sudo kill -9 <process id>            for example: if the process id  9119 then command will be sudo kill -9 9119

Difference between Java and C++

How Java is different from C++ 1.       Java does not support “goto”, “sizeof”, and “typedef” keywords. 2.       Java does not support keywords like “auto”, “extern”, “register”, “signed”, and “unsigned”. 3.       Java does not support any pre-processor like #define, #include. 4.       Java does not support operator overloading. 5.       Java does not support template class. 6.       Java does not support multiple inheritance. 7.       Java does not support global variable. 8.       Java does not support pointers as in C++. 9.       Java replace destructor() function with finalize() method. 10.   There are no header files in Java. 11.   Java is a highly case sensitive language.

Error: main method's m starts with capital letter

Code:- public class test1 { public static void Main(String args[]) // here  main method starts with capital letter (like Main) { System.out.println("Testing Main Method"); } } This program will compile but does not run. IT give a runtime error: "main method not found in test1 class" Solution: change the capital m to small case letter (main).

Multiple main methods in a Java Program

Main method is the only entry point of the java console application. Normally we used only one main method in our program. A java application can have multiple main methods. Code: -  // myclass.java class test { public static void main(String args[]) { System.out.println("Main of test class..."); } } public class Myclass { public static void main(String args[]) { String str[]={"A","B","C"}; test.main(str); } }  In the above example, program starts from Myclass . For invoking a  main method it require a command line arguments also. So that we declared and initialized str[] and passed it to the test.main(str);

Java.lang.NoClassDefFoundError problem Solved

Exception in thread "main" java.lang.NoClassDefFoundError Sometimes when we try to execute java program we got error message like "Exception in thread "main" java.lang.NoClassDefFoundError". But this is not a major issue. It just a common human mistake. You might have compiled java program with small letter-case followed by .java extension but actually file name is in the capital letters. The program will compile without any error but do not. Note: Check filename before you compile java program ( Java is case Sensitive). for example: In my case: filename is MyClass.java I compiled it as javac myClass.java        Compiled successfully But do not execute... give error message like this Solution: Compile it as javac Myclass.java Java is very case sensitive language.

How to Install and Run PHP file

To download wampserver and it's installation, and  To run php script on browser Step 1: Download php Virtual server like WAMPSERVER or XAMPP http://www.wampserver.com/ Note: - Download php and VC10 (link is provided in warning section) Step 2: After that, install php. (Follow the steps and just click next...next...next...). Step 3: After the complete installation, start wampserver. Step 4: Now go to System tray and click on wampserver icon. Step 5: Click on “start all Services” (Now icon turns green) Note: - If the icon turns green that means all services are started or red then services are stopped or yellow that means temporarily stopped (you need to start all services). Step 6: Now click on “www directory” Step 7: Create new folder (in my case, named it as “vik”). Step 8: Open vik folder and create php file e.g.: Type the below php script in notepad or any other text editor as you want (It is bet...

How to Compile Java Program Using Command Prompt

Step 1 : Go to command prompt (or type cmd in Run Dialog box). Step 2 : Set the path as the location of the bin directory of java which is located in the program file directory. In my case path = C:\Program Files\Java\jdk1.7.0_01\bin Step 3 : Now change directory to the location where source code is residing. Step 4 : After that time to compile java program. You need to type following commands: -   javac source_code.java   ( for compilation, if successfully compiled then program is ready to execute) java source_code (for execution)

How to Create New SQL Server Database in Visual Studio 2008

Step 1 : Go to server explorer (or press ctrl + alt + s). Step 2 : Right click on “ Data Connections ” and select “ Create New SQL Server Database ”. Step 3 : Type Server Name as “ .\sqlexpress ” for sql server connection              And type Database Name              And click OK.

Apache vs IIS

Apache IIS Portable Configuration Yes text/file Yes (Import & Export ) binary Operating Systems Supported Cross-platform (Windows, Mac OS X, Linux, BSD, Solais, eCS, OpenVMS, AIX, z/OS) Windows License Apache License 2.0 Proprietary Cost Free Bundled with Windows NT family products Basic access authentication Yes Yes Digest access authentication Yes Yes HTTPS Support Yes Yes Virtual Hosting Yes Yes CGI Support Yes Yes FastCGI Support Yes Yes Servlets No No SSI Support Yes Yes Asp.Net Support Yes (via “mod_aspdotnet” module) Yes Runs in user or kernel space User Space Kernel or user space Administration Console Yes Yes IPv6 Yes ...

Differences between TCP and UDP

TCP UDP Full Form Transmission Control Protocol User Datagram Protocol Function Connection based protocol which is used to transport message across the internet from one computer to another Non-Connection based protocol used in message transport or transfer Working TCP connection is established via a three way handshake, which is a process of initiating and acknowledging a connection. UDP uses a simple transmission model without implicit handshaking dialogues for guaranteeing reliability, ordering, or data integrity Example HTTP, HTTPS, FTP, SMTP, Telnet, etc. DNS, DHCP, FTP, SNMP, RIP, VOIP, etc. Usage TCP is used in case of non-time critical applications UDP is used for games or applications that require fast transmission of data Ordering TCP rearranges data packets...