Professional Documents
Culture Documents
PHP
Every user who logs on to a web site automaticaaly associates with an HTTP
session object. The servlet can use this object to store information about the user’s session.
Open source software refers to applications developed in which the user can access and
alter the "source" code itself. Some open source applications have restrictions on their
use and distribution, but many do not. Unlike public domain software, Open source
software does have copyrights.Examples of open source software include: LINUX,
Apache, Firefox, KOffice, Thunderbird, OpenOffice, KOffice, and SquirrelMail.
Open source code can be technically reliable, it also reduces the overhead costs of
production. Some of the disadvantages lie in the simple fact that open source software is not as
strenuously tested as other types of software. This can lead to problems later on like unusable
programs, and proliferation of malicious code in the form of viruses. While open source software is for
the most part safe to use, there are some programs out there that aren't.
6. What are benefits of open source software?
Open source software is free and allows you to take and add components to the software.
It can be freely used or edited by anyone.
<html>
<head>
<title>Hello World</title>
<body>
<?php echo "Hello, World!";?>
</body>
</html>
PHP has a total of eight data types which we use to construct our variables:
Integers: are whole numbers, without a decimal point, like 4195.
Cookies:
You can use HTTP cookies to store information. Cookies will be
stored at browser side.
URL rewriting:
With this method, the information is carried through url as
request parameters. In general added parameter will be sessionid,
userid.
HttpSession:
Using HttpSession, we can store information at server side. Http
Session provides methods to handle session related information.
TYPE_FORWARD_ONLY:
The result set cannot be scrolled; its cursor moves forward only, from
before the first row to after the last row. The rows contained in the
result set depend on how the underlying database generates the results.
That is, it contains the rows that satisfy the query at either the time
the query is executed or as the rows are retrieved.
TYPE_SCROLL_INSENSITIVE:
The result can be scrolled; its cursor can move both forward and backward
relative to the current position, and it can move to an absolute position.
The result set is insensitive to changes made to the underlying data source
while it is open. It contains the rows that satisfy the query at either the
time the query is executed or as the rows are retrieved.
TYPE_SCROLL_SENSITIVE:
The result can be scrolled; its cursor can move both forward and backward
relative to the current position, and it can move to an absolute position.
The result set reflects changes made to the underlying data source while
the result set remains open.
sleep():
It is a static method on Thread class. It makes the current thread into the
"Not Runnable" state for specified amount of time. During this time, the thread
keeps the lock (monitors) it has acquired.
wait():
It is a method on Object class. It makes the current thread into the "Not Runnable"
state. Wait is called on a object, not a thread. Before calling wait() method, the
object should be synchronized, means the object should be inside synchronized block.
The call to wait() releases the acquired lock.
16. What happens if one of the members in a class does not implement Serializable interface?
When you try to serialize an object which implements Serializable interface, incase if the
object includes a reference of an non serializable object then NotSerializableException will be
thrown.
17. What is race condition?
A race condition is a situation in which two or more threads or processes are reading or
writing some shared data, and the final result depends on the timing of how the threads are
scheduled. Race conditions can lead to unpredictable results and subtle program bugs. A thread
can prevent this from happening by locking an object. When an object is locked by one thread
and another thread tries to call a synchronized method on the same object, the second thread will
block until the object is unlocked.
We know that Map contains key-value pairs, whereas a list contains only objects. Since
Entry class contains both key-value pair, Entry class will helps us to convert from Map
(HashMap) to List (ArrayList). By using Map.entrySet() you will get Set object, which intern
you can use it to convert to list object.
public static void main(String a[]){
Map<String, String> wordMap = new HashMap<String, String>();
Set<Entry<String, String>> set = wordMap.entrySet();
List<Entry<String, String>> list = new ArrayList<Entry<String,
String>>(set);
}
Here out is an instance of PrintStream. It is a static member variable in System class. This
is called standard output stream, connected to console.