Showing posts with label enterprise-it. Show all posts
Showing posts with label enterprise-it. Show all posts

Tuesday, June 19, 2012

Java Interview questions

1. How could Java classes direct program messages to the system console, but error messages, say to a file?
The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:

Stream st =
new Stream (new
FileOutputStream (“techinterviews_com.txt”));
System.setErr(st);
System.setOut(st);

2. What’s the difference between an interface and an abstract class?
An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.

3. Why would you use a synchronized block vs. synchronized method?
Synchronized blocks place locks for shorter periods than synchronized methods.

4. Explain the usage of the keyword transient?
This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).

5. How can you force garbage collection?
You can’t force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.

6. How do you know if an explicit object casting is needed?
If you assign a superclass object to a variable of a subclass’s data type, you need to do explicit casting. For example:

Object a;Customer b; b = (Customer) a;

When you assign a subclass to a variable having a supeclass type, the casting is performed automatically.

7. What’s the difference between the methods sleep() and wait()
The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

8. Can you write a Java class that could be used both as an applet as well as an application?
Yes. Add a main() method to the applet.

9. What’s the difference between constructors and other methods?
Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.

10. Can you call one constructor from another if a class has multiple constructors
Yes. Use this() syntax.

11. Explain the usage of Java packages.
This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.

12. If a class is located in a package, what do you need to change in the OS environment to be able to use it?
You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let’s say a class Employee belongs to a package com.xyz.hr; and is located in the file c:/dev/com.xyz.hr.Employee.java. In this case, you’d need to add c:/dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:>java com.xyz.hr.Employee

13. What’s the difference between J2SDK 1.5 and J2SDK 5.0?
There’s no difference, Sun Microsystems just re-branded this version.

14. What would you use to compare two String variables – the operator == or the method equals()?
I’d use the method equals() to compare the values of the Strings and the = = to check if two variables point at the same instance of a String object.

15. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
A. Yes, it does. The FileNoFoundException is inherited from the IOException. Exception’s subclasses have to be caught first.

16. Can an inner class declared inside of a method access local variables of this method?
It’s possible if these variables are final.

17. What can go wrong if you replace && with & in the following code:
String a=null;
if (a!=null && a.length()>10)
{…}

A single ampersand here would lead to a NullPointerException.

18. What’s the main difference between a Vector and an ArrayList
Java Vector class is internally synchronized and ArrayList is not.

19. When should the method invokeLater()be used?
This method is used to ensure that Swing components are updated through the event-dispatching thread.

20. How can a subclass call a method or a constructor defined in a superclass?
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.

21. What’s the difference between a queue and a stack?
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.

22. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.

23. What comes to mind when you hear about a young generation in Java?
Garbage collection.

24. What comes to mind when someone mentions a shallow copy in Java?
Object cloning.

25. If you’re overriding the method equals() of an object, which other method you might also consider?
hashCode()

26. You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use: ArrayList or LinkedList?
ArrayList

27. How would you make a copy of an entire Java object with its state?
Have this class implement Cloneable interface and call its method clone().

28. How can you minimize the need of garbage collection and make the memory use more effective?
Use object pooling and weak object references.

29. There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it?
If these classes are threads I’d consider notify() or notifyAll(). For regular classes you can use the Observer interface.

30. What access level do you need to specify in the class declaration to ensure that only classes from the same directory can access it?
You do not need to specify any access level, and Java will use a default package access level.

Saturday, June 16, 2012

Install Safari on Ubuntu

Ubuntu users lack the number of options available as compared to the PC or Mac users. Main browsers they can use are Firefox, Chromium, Google Chrome & Opera.

In this post I will be writing a tutorial on how you can install Safari on Ubuntu.So, without any further ado we will start.

  • Install Wine


Wine is a known Windows emulator for Linux. It is used to run Windows programs on Linux. We will be installing Wine first in order to install Safari on Linux. To install wine you need to open up the Ubuntu Software center and search for Wine. Or, you can simply go to this website and follow the instructions.The install will take a while. Or, you can install it via the Terminalusing the following apt syntax.
sudo apt-get install wine

After installing Wine you need to install core fonts and the flash (windows version) using winetricks. To do this input the following in the terminal.
winetricks corefonts flash


  • Install 7zip


Installing 7zip is our next step as this will be needed to run Play on Linux. Ignoring this will give you an error related to 7zip.
sudo apt-get install p7zip-full


  • Install Play On Linux


Play on Linux will help us create an environment to run Safari easily. To install Play on Linux you need to download it from this website. Choose the Ubuntu version as we are doing this for Ubuntu.

After installing Play on Linux, open it. A new window will open up which will look like the screenshot below.




play on linux

 

Now click Install. Click Internet and then click Safari. Click Install.

play on linux

Now the package will download some required packages and start installing Safari on Ubuntu. Keep following the wizard and you will have Safari installed on Ubuntu.

play on linux

So, we have successfully installed Safari on Ubuntu.

Safari browser

But lets keep in mind that if you want to experience the real internet browsing experience use the browsers that are built to run on Linux by default and not the browsers that run with Wine.

Friday, June 15, 2012

J2EE Tutorial-16(Modifying the J2EE Application)

Since the J2EE SDK is intended for experimentation, it supports iterative development. Whenever you make a change to a J2EE application, you must redeploy the application.

Modifying a Class File


To modify a class file in an enterprise bean, you change the source code, recompile it, and redeploy the application. For example, if you want to change the exchange rate in the dollarToYen business method of theConverterBean class, you would follow these steps.

  1. Edit ConverterBean.java.

  2. Recompile ConverterBean.java by typing ant converter.

  3. In deploytool, select ToolsUpdate Files.

  4. The Update Files dialog box appears. If the modified files are listed at the top of the dialog, click OK and go to step 6. If the files are listed at the bottom, they have not been found. Select one of those files and click Edit Search Paths.

  5. In the Edit Search Paths dialog, specify the directories where the Update Files dialog will search for modified files.

    1. In the Search Root field, enter the fully-qualified name of the directory from which the search will start.

    2. In the Path Directory list, add a row for each directory that you want searched. Unless fully-qualified, these directory names are relative to the Search Root field.

    3. Click OK.



  6. Select ToolsDeploy. Make sure the checkbox labeled Save Object Before Deploying is checked. If you do not want to deploy at this time, select ToolsSave to save the search paths specified in step 5.


As a shortcut, you can select ToolsUpdate And Redeploy. With this shortcut, the Update Files dialog box does not appear unless the files are not found.

To modify the contents of a WAR file you follow the preceding steps. The Update Files operation checks to see if any files have changed, including HTML files and JSP pages. If you change the index.jsp file ofConverterApp, be sure to type ant converter. The converter task copies the index.jsp file from the src to the build directory.

Adding a File


To add a file to the EJB JAR or WAR of the application, perform these steps.

  1. In deploytool, select the JAR or WAR in the tree.

  2. Select the General tab.

  3. Click Edit.

  4. In the tree of the Available Files field, locate the file and click Add.

  5. Click OK.

  6. From the main toolbar, select ToolsUpdate And Redeploy.


Modifying a Deployment Setting


To modify a deployment setting of ConverterApp, you edit the appropriate field in a tabbed pane and redeploy the application. For example, to change the JNDI name of the ConverterBean from ATypo toMyConverter, you would follow these steps.

  1. In deploytool, select ConverterApp in the tree.

  2. Select the JNDI Names tab.

  3. In the JNDI Name field, enter MyConverter.

  4. From the main toolbar, select FileSave.

  5. Select ToolsUpdate And Redeploy.

J2EE Tutorial-14(Running the J2EE Application Client)

To run the J2EE application client, perform the following steps.

  1. In a terminal window, go to the j2eetutorial/examples/src/ejb/converter directory.

  2. Verify that this directory contains the ConverterApp.ear and ConverterAppClient.jar files.

  3. Set the APPCPATH environment variable to ConverterAppClient.jar.

  4. Type the following command (on a single line):

       runclient -client ConverterApp.ear -name ConverterClient 
    -textauth



  5. The client container prompts you to log in. Enter guest for the user name and guest123 for the password.

  6. In the terminal window, the client displays these lines:

       Binding name:'java:comp/env/ejb/SimpleConverter'
    12160.00
    0.77
    Unbinding name:'java:comp/env/ejb/SimpleConverter'



J2EE Tutorial-13(Deploying the J2EE Application)

Now that the J2EE application contains the components, it is ready for deployment.

  1. Select the ConverterApp application.

  2. Select ToolsDeploy.

  3. In the Introduction dialog box, confirm that ConverterApp is shown for the Object To Deploy and that localhost is shown for the Target Server.

  4. Select the checkbox labeled Return Client Jar.

  5. In the text field that appears, enter the full path name for the file ConverterAppClient.jar so that it will reside in the j2eetutorial/examples/src/ejb/converter subdirectory. TheConverterAppClient.jar file contains the stub classes that enable remote access to ConverterEJB.

  6. Click Next.

  7. In the JNDI Names dialog box, verify the names you entered in the previous section.

  8. Click Next.

  9. In the WAR Context Root dialog box, enter converter in the Context Root field. When you run the Web client, the converter context root will be part of the URL.

  10. Click Next.

  11. In the Review dialog box, click Finish.

  12. In the Deployment Progress dialog box, click OK when the deployment completes.

J2EE Tutorial-12(Specifying the JNDI Names)

Although the J2EE application client and the Web client access the same enterprise bean, their code refers to the bean's home by different names. The J2EE application client refers to the bean's home asejb/SimpleConverter, but the Web client refers to it as ejb/TheConverter. These references are in the parameters of the lookup calls. In order for the lookup method to retrieve the home object, you must map the references in the code to the enterprise bean's JNDI name. Although this mapping adds a level of indirection, it decouples the clients from the beans, making it easier to assemble applications from J2EE components.

To map the enterprise bean references in the clients to the JNDI name of the bean, follow these steps.

  1. In the tree, select ConverterApp.

  2. Select the JNDI Names tab.

  3. To specify a JNDI name for the bean, in the Application table locate the ConverterEJB component and enter MyConverter in the JNDI Name column.

  4. To map the references, in the References table enter MyConverter in the JNDI Name for each row.


Figure 2-1 shows what the JNDI Names tab should look like after you've performed the preceding steps.



 

Figure 2-1 ConverterApp JNDI Names

J2EE Tutorial-11(Creating the Web Client)

The Web client is contained in the JSP page j2eetutorial/examples/src/ejb/converter/index.jsp. A JSP page is a text-based document that contains static template data, which can be expressed in any text-based format such as HTML, WML, and XML; and JSP elements, which construct dynamic content.

Coding the Web Client


The statements (in bold in the following code) for locating the home interface, creating an enterprise bean instance, and invoking a business method are nearly identical to those of the J2EE application client. The parameter of the lookup method is the only difference; the motivation for using a different name is discussed in Specifying the JNDI Names.

The classes needed by the client are declared with a JSP page directive (enclosed within the <%@ %> characters). Because locating the home interface and creating the enterprise bean are performed only once, this code appears in a JSP declaration (enclosed within the <%! %> characters) that contains the initialization method, jspInit, of the JSP page. The declaration is followed by standard HTML markup for creating a form with an input field. A scriptlet (enclosed within the <% %> characters) retrieves a parameter from the request and converts it to a BigDecimal object. Finally, JSP expressions (enclosed within <%= %> characters) invoke the enterprise bean's business methods and insert the result into the stream of data returned to the client.

<%@ page import="Converter,ConverterHome,javax.ejb.*,
javax.naming.*, javax.rmi.PortableRemoteObject,
java.rmi.RemoteException" %>
<%!
private Converter converter = null;
public void jspInit() {
try {
InitialContext ic = new InitialContext(); Object objRef = ic.lookup(" java:comp/env/ejb/TheConverter"); ConverterHome home = (ConverterHome)PortableRemoteObject.narrow( objRef, ConverterHome.class); converter = home.create(); } catch (RemoteException ex) {
...
}
}
...
%>
<html>
<head>
<title>Converter</title>
</head>

<body bgcolor="white">
<h1><center>Converter</center></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
<%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p><%= amount %> dollars are
<%= converter.dollarToYen(d) %> Yen.
<p><%= amount %> Yen are
<%= converter.yenToEuro(d) %> Euro.
<%
}
%>
</body>
</html>


Compiling the Web Client


The J2EE server automatically compiles Web clients that are JSP pages. If the Web client were a servlet, you would have to compile it.

Packaging the Web Client


To package a Web client, you run the New Web Component wizard of the deploytool utility. During this process the wizard performs the following tasks.

  • Creates the Web application deployment descriptor

  • Adds the component files to a WAR file

  • Adds the WAR file to the application's ConverterApp.ear file


After the packaging process, you can view the deployment descriptor by selecting ToolsDescriptor Viewer.

To start the New Web Component wizard, select FileNewWeb Component. The wizard displays the following dialog boxes.

  1. Introduction dialog box

    1. Read the explanatory text for an overview of the wizard's features.

    2. Click Next.



  2. WAR File dialog box

    1. Select Create New WAR File In Application.

    2. In the combo box, select ConverterApp.

    3. In the WAR Display Name field, enter ConverterWAR.

    4. Click Edit.

    5. In the tree under Available Files, locate the j2eetutorial/examples/build/ejb/converter directory.

    6. Select index.jsp and click Add.

    7. Click OK.

    8. Click Next.



  3. Choose Component Type dialog box

    1. Select the JSP radio button.

    2. Click Next.



  4. Component General Properties dialog box

    1. In the JSP Filename combo box, select index.jsp.

    2. Click Finish.




Specifying the Web Client's Enterprise Bean Reference


When it invokes the lookup method, the Web client refers to the home of an enterprise bean:

Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");


You specify this reference as follows:

  1. In the tree, select ConverterWAR.

  2. Select the EJB Refs tab.

  3. Click Add.

  4. In the Coded Name column, enter ejb/TheConverter.

  5. In the Type column, select Session.

  6. In the Interfaces column, select Remote.

  7. In the Home Interface column, enter ConverterHome.

  8. In the Local/Remote Interface column, enter Converter.

J2EE Tutorial-10(Creating the J2EE Application Client)

A J2EE application client is a program written in the Java programming language. At runtime, the client program executes in a different virtual machine than the J2EE server.

The J2EE application client in this example requires two different JAR files. The first JAR file is for the J2EE component of the client. This JAR file contains the client's deployment descriptor and its class files. When you run the New Application Client wizard, the deploytool utility automatically creates the JAR file and stores it in the application's EAR file. Defined by the J2EE Specification, the JAR file is portable across all compliant J2EE servers.

The second JAR file contains stub classes that are required by the client program at runtime. These stub classes enable the client to access the enterprise beans that are running in the J2EE server. Because this second JAR file is not covered by the J2EE Specification, it is implementation specific, intended only for the J2EE SDK.

The J2EE application client source code is in j2eetutorial/examples/src/ejb/converter/ConverterClient.java. You already compiled this code along with the enterprise bean code in the section Compiling the Source Files.

Coding the J2EE Application Client


The ConverterClient.java source code illustrates the basic tasks performed by the client of an enterprise bean:

  • Locating the home interface

  • Creating an enterprise bean instance

  • Invoking a business method


Locating the Home Interface


The ConverterHome interface defines life-cycle methods such as create. Before the ConverterClient can invoke the create method, it must locate and instantiate an object whose type is ConverterHome. This is a four-step process.

  1. Create an initial naming context.

        Context initial = new InitialContext();


    The Context interface is part of the Java Naming and Directory Interface (JNDI). A naming context is a set of name-to-object bindings. A name that is bound within a context is the JNDI name of the object.
    An InitialContext object, which implements the Context interface, provides the starting point for the resolution of names. All naming operations are relative to a context.

  2. Obtain the environment naming context of the application client.

       Context myEnv = (Context)initial.lookup("java:comp/env");


    The java:comp/env name is bound to the environment naming context of the ConverterClient component.

  3. Retrieve the object bound to the name ejb/SimpleConverter.

       Object objref = myEnv.lookup("ejb/SimpleConverter");


    The ejb/SimpleConverter name is bound to an enterprise bean reference, a logical name for the home of an enterprise bean. In this case, the ejb/SimpleConverter name refers to the ConverterHomeobject. The names of enterprise beans should reside in the java:com/env/ejb subcontext.

  4. Narrow the reference to a ConverterHome object.

       ConverterHome home =
    (ConverterHome) PortableRemoteObject.narrow(objref,
    ConverterHome.class);




Creating an Enterprise Bean Instance


To create the bean instance, the client invokes the create method on the ConverterHome object. The create method returns an object whose type is Converter. The remote Converter interface defines the business methods of the bean that the client may call. When the client invokes the create method, the EJB container instantiates the bean and then invokes the ConverterBean.ejbCreate method. The client invokes the createmethod as follows:

Converter currencyConverter = home.create();


Invoking a Business Method


Calling a business method is easy--you simply invoke the method on the Converter object. The EJB container will invoke the corresponding method on the ConverterEJB instance that is running on the server. The client invokes the dollarToYen business method in the following lines of code.

BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);


ConverterClient Source Code


The full source code for the ConverterClient program follows.

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;

public class ConverterClient {

public static void main(String[] args) {

try {
Context initial = new InitialContext();
Object objref = initial.lookup
("java:comp/env/ejb/SimpleConverter");

ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);

Converter currencyConverter = home.create();

BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount =
currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);

System.exit(0); } catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}


Compiling the Application Client


The application client files are compiled at the same time as the enterprise bean files, as described in Compiling the Source Files.

Packaging the J2EE Application Client


To package an application client component, you run the New Application Client wizard of the deploytool. During this process the wizard performs the following tasks.

  • Creates the application client's deployment descriptor

  • Puts the deployment descriptor and client files into a JAR file

  • Adds the JAR file to the application's ConverterApp.ear file


After the packaging process you can view the deployment descriptor by selecting ToolsDescriptor Viewer.

To start the New Application Client wizard, select FileNewApplication Client. The wizard displays the following dialog boxes.

  1. Introduction dialog box

    1. Read the explanatory text for an overview of the wizard's features.

    2. Click Next.



  2. JAR File Contents dialog box

    1. In the combo box, select ConverterApp.

    2. Click Edit.

    3. In the tree under Available Files, locate the j2eetutorial/examples/build/ejb/converter directory.

    4. Select the ConverterClient.class file and click Add.

    5. Click OK.

    6. Click Next.



  3. General dialog box

    1. In the Main Class combo box, select ConverterClient.

    2. Verify that the entry in the Display Name field is ConverterClient.

    3. In the Callback Handler Class combo box, select container-managed authentication.

    4. Click Next.

    5. Click Finish.




Specifying the Application Client's Enterprise Bean Reference


When it invokes the lookup method, the ConverterClient refers to the home of an enterprise bean:

Object objref = myEnv.lookup("ejb/SimpleConverter");


You specify this reference as follows.

  1. In the tree, select ConverterClient.

  2. Select the EJB Refs tab.

  3. Click Add.

  4. In the Coded Name column, enter ejb/SimpleConverter.

  5. In the Type column, select Session.

  6. In the Interfaces column, select Remote.

  7. In the Home Interface column, enter ConverterHome.

  8. In the Local/Remote Interface column, enter Converter.

Govt to remove multi-level TDS on software from July

Image In a big relief to the software industry, the government today said it will do away with the complex multi-level system of Tax Deduction at Source (TDS) for the sector from July 1.

"... no deduction of tax shall be made on... payment by a person (transferee) for acquisition of software from another person (transferor), being a resident," the Finance Ministry said in a notification.

The provisions will come into force from July 1, 2012, it said.

Under the current structure, TDS of 10 per cent is levied at every level of software distribution chain -- right from master distributor to retailer and then to the final consumer.

Responding to the long-standing demand of the software sector, Finance Minister Pranab Mukherjee had last week said that Section 194J of the Income Tax Act, 1961, would be amended so as to avoid multi-level TDS on information technology sector.

Section 194(J) of the IT Act deals with fees for professional and technical services and covers royalty and non-compete fees.

The exemption from multi-level TDS would be applicable in case where the software is acquired in a subsequent transfer, without any modification.

Besides, the exemption will also be provided in cases where tax has been deducted under 194J on payment for any previous transfer of such software or under Section 195 on payment for any previous transfer of such software from a non-resident.

Further, it will also apply in those cases wherever the transferor had paid the taxes.

Software industry body Nasscom had been demanding removal of the multi-level TDS on software arguing that such a decision would improve finances of the IT sector.

The TDS model, it had argued, "was leading to an unsustainable model for software distributorswho operate on very low margins."

Tuesday, June 12, 2012

India to take steps to protect cyber infrastructure



India is set to take steps to protect itscyber infrastructure and designate agencies for carrying out offensive cyber attacks on other countries. The move comes at a time when proof shows countries launching cyber attacks - not only for intelligence gathering - and many nations describing the attacks as an act of war.

According to sources, the National Security Council(NSC) headed by Prime Minister Manmohan Singhwould soon approve the comprehensive plan and designate the Defence Intelligence Agency (DIA) and National Technical Research Organization (NTRO) as agencies for carrying out offensive cyber operations, if necessary. All other intelligence agencies would be authorized to carry out intelligence gathering abroad, but not offensive operations, sources said.

The detailed policy for national cyber infrastructure protection is presently before the NSC awaiting its approval. The policy would identify all government agencies that would have a role in the protection of Indian cyber infrastructure and define their roles.

The move to not just define defensive mechanism but also designate agencies for offensive operations comes as New Delhi tackles repeated waves of cyber intrusions, though all of them are aimed at gathering information from critical networks. But the next stage, of an adversary carrying out offensive cyber attack, of bringing down a power grid, stalling air traffic control systems, or manipulating controls of a dam are now believed to be a real possibility.

Stuxnet, the cyber worm created by US's National Security Agency and Israeli military and specifically targeted at Iran's nuclear enrichment center at Natanz, was found to have infected Indian systems. "It was probably unintentional, but an intentional attack on India's critical infrastructure cannot be ruled out," says a senior official. "We haven't yet seen a cyber attack, but only intelligence gathering. An attack that can debilitate our infrastructure is what we must be prepared for," he said.

CERT-IN (Computer Emergency Response Team India) would be responsible for protection of most of the cyber space, while NTRO would be tasked to protect the critical infrastructure such as important government networks. NTRO would be tasked to create the National Critical Information Infrastructure Protection Centre (NCIPC), which would be a command-and-control centre for monitoring the critical infrastructure. It would be a round-the-clock centre, providing real time response to cyber security breaches.

The proposal before NSC also envisages creation of sectoral CERTs in order to respond quickly to protect power distribution networks, Air Traffic Controls, traffic networks and other areas that heavily dependent on networked systems, and thus are susceptible to attacks.

The policy suggests that the defence forces would be responsible for their own networks' protection.

NTRO and Intelligence Bureau (IB) would primarily be responsible for security of various government networks. While NTRO would operate through NCIPC, IB would be mainly looking at the physical security of networks. State polices, CBI, NIA etc would be tasked to do follow up action, if any intrusions are detected.

Monday, June 11, 2012

11 Free Linux Apps Your Business Needs Now

The good news is that there are free and open-source alternatives for virtually every package a small business might need, and most of them are excellent. Whether or not you've already made the switch to Linux -- there are, after all, myriad security and other reasons for doing so -- these free apps can be just what any small business needs to succeed.

1. Office Productivity: OpenOffice

OpenOffice.org 3 (also known as OO.o) is a fantastic open-source alternative to Microsoft Office. With components for word processing, spreadsheets, presentations, graphics, databases and more, it is available in many languages and works on all common operating systems, including Linux, Mac and Windows. All data gets stored in an international open standard format, and the software can read and write files from Office as well. Perhaps best of all, the interface is so familiar and intuitive that you might not even realize you're using anything new. You can download and use OpenOffice free of charge.

2. Accounting: GnuCash

GnuCash is a personal and small-business financial-accounting software package that's also available for Linux, Mac OS X, and Windows. Both powerful and flexible, GnuCash lets you track bank accounts, stocks, income and expenses. As quick and intuitive to use as a checkbook register, it is based on professional accounting principles to ensure balanced books and accurate reports. Among GnuCash's key features are double-entry accounting, small-business accounting, invoicing and more. Data can be imported from programs such as Microsoft Money and Quicken, while it can be exported to spreadsheets such as Microsoft Excel. Once again, thisfree software's interface is so intuitive and familiar that if you've used other accounting programs before, this one will be no problem.

3. Desktop publishing: Scribus

Scribus is a free program that offers professional page-layout capabilities for Linux, Mac OSX and Windows desktops. Scribus supports professional publishing features including CMYK color separations for both press-ready output and PDF creation. I've found the software can do just about anything the paid packages can, and it's comparable to InDesign or Publisher, for instance.

4. E-mail: Zimbra

Zimbra Desktop is free e-mail and calendar software that runs on any Linux, Mac or Windows computer. The tool offers e-mail, contacts, calendar and document capabilities all in one application, and it lets users read e-mail from any POP or IMAP e-mail account, including Gmail, Hotmail or business e-mail. Owned by VMware, Zimbra works both online and off, and there's no limit to the size of your e-mail storage. As an added bonus, it's also available in 20 languages.

5. Web page editing: KompoZer

Much like Microsoft's old FrontPage, KompoZer is a tool for anyone who ever works with a Web page. Downloadable for free and compatible with Linux as well as the usual other alternatives,KompoZer is a WYSIWYG (What You See Is What You Get) editor, meaning that you can edit Web pages visually as well as by working with the raw HTML code. The free software is extremely easy to use, making it ideal for nontechnical computer users who want to create an attractive, professional-looking Web site without necessarily needing to know HTML.

6. Graphics: GIMP

GIMP, which stands for "GNU Image Manipulation Program," is a free and open source alternative to Adobe's pricey PhotoShop product. With an interface very similar to PhotoShop's,GIMP offers capabilities including photo retouching, image composition and image authoring. I believe GIMP will satisfy all but the highest-end professional graphic designers. It's perfect for making Web graphics, retouching product photos and creating marketing materials, and any images created can be saved in an array of common formats, including PSD Photoshop.

7. Backup: Amanda

Amanda is a backup and recovery solution that lets you set up a single master backup server to back up multiple hosts to a single large-capacity tape or disk drive. The software can back up a large number of workstations running multiple versions of Linux, Mac OS or Windows. Currently, it's used to protect more than half a million servers and desktops around the world. A sister service to Amanda, meanwhile, is Zmanda, which provides paid backup in the cloud.

8. HR management: OrangeHRM

OrangeHRM is a free package for human resources management. With modules for personnel information management, benefits, recruitment, employee self-service, leave, and time and attendance‚ the software also offers optional paid services including training, support and customization.

9. E-mail campaigns: phpList

If your business runs e-mail campaigns, phpList can be a great tool. The software is free to download, install and use, and it's easy to integrate with any Website. Ideal for newsletters, publicity lists, notifications and many other uses, phpList is designed to manage mailing lists with up to hundreds of thousands of subscribers. A Web interface lets you write and send messages and manage phpList over the internet.

10. Project management: OpenProj

OpenProj is a free project-management package that substitutes nicely for Microsoft Project but works with Linux and Mac as well as Windows. With more than a million users, OpenProj's installed base is second only to that of Microsoft Project itself--which, of course, costs a heck of a lot more. Gantt charts, PERT charts and all the other capabilities offered by Microsoft's software are in OpenProj as well, and existing Project files can be easily imported.

11. Antivirus: ClamAV

Even if you're running Linux, it's still a good idea to use some kind of antivirus software. Originally designed for Unix, ClamAV is a nice package that's now available for Linux as well as for Windows and a number of other platforms. The tool offers built-in support for almost all mail file formats as well as popular document formats including Microsoft Office, HTML, RTF and PDF. With a virus database that's updated multiple times per day, ClamAV is, of course, also free.

MAMP


MAMP installs a local server environment in a matter of seconds on your Mac OS X computer, be it PowerBook or iMac. MAMP will not compromise any existing Apache installation already running with your OS X. You can install Apache, PHP and MySQL without starting a script or having to change any configuration files.

Screenshot

CyberDuck


Cyberduck is an open source FTP, SFTP-client and also a WebDAV, Mosso Cloud Files and Amazon S3 browser for the Mac. It features an easy to use interface with quickly accessible bookmarks. The outline view of the browser allows to browse large folder structures efficiently and you can quickly preview files with Quick Look. To edit files, a seamless integration with several external editors makes it easy to change content quickly. An alternative: Filezilla.

Screenshot

iClockr


This is a small application that tracks your work time. You can set up different projects, and tasks for each project, and associate them to a client. The concept around iClockr is to have actions timed, for that you create tasks to be timed and those tasks add up to create a project. Each task is timed with a stopwatch, even the application’s dock icon changes to a stopwatch.

iClockr

You can edit the task durations for better and more exact timing. iClockr also offers two modes to manage your times: Flat Rate or Range based. You can match each project with customers (within the application’s Preferences pane). iClockr is a Mac Universal application that runs on Leopard only.

C interview questions and answers


  • What will print out?main()
    { 
    char
     *p1=“name”; 
    char
     *p2;
    p2=(char*)malloc(20);
    memset (p2, 0, 20);
    while(*p2++ = *p1++); 
    printf
    (“%sn”,p2);

    }

    Answer:empty string.

  • What will be printed as the result of the operation below:
    main()
    { 
    int
     x=20,y=35;
    x=y++ + x++;
    y= ++y + ++x; 
    printf
    (“%d%dn”,x,y);}

    Answer : 5794

  • What will be printed as the result of the operation below:
    main()
    {
    int x=5;
    printf(“%d,%d,%dn”,x,x< <2,x>>2);}

    Answer: 5,20,1

  • What will be printed as the result of the operation below:
    #define swap(a,b) a=a+b;b=a-b;a=a-b;void main()
    {
    int x=5, y=10;
    swap (x,y);
    printf(“%d %dn”,x,y);
    swap2(x,y);
    printf(“%d %dn”,x,y);
    }

    int swap2(int a, int b)
    {
    int temp;
    temp=a;
    b=a;
    a=temp;
    return 0;

    }

    Answer: 10, 5
    10, 5

  • What will be printed as the result of the operation below:
    main()
    {
    char *ptr = ” Cisco Systems”;
    *ptr++; printf(“%sn”,ptr);
    ptr++;
    printf(“%sn”,ptr);}

    Answer:Cisco Systems
    isco systems

  • What will be printed as the result of the operation below:
    main()
    {
    char s1[]=“Cisco”;
    char s2[]= “systems”;
    printf(“%s”,s1);
    } 

    Answer: Cisco

  • What will be printed as the result of the operation below:
    main()
    {
    char *p1;
    char *p2;    p1=(char *)malloc(25);
    p2=(char *)malloc(25);

    strcpy(p1,”Cisco”);
    strcpy(p2,“systems”);
    strcat(p1,p2);

    printf(“%s”,p1);

    }

    Answer: Ciscosystems

  • The following variable is available in file1.c, who can access it?:

    static int average;


    Answer: all the functions in the file1.c can access the variable.

  • WHat will be the result of the following code?
    #define TRUE 0 // some codewhile(TRUE)
    {

    // some code

    }

    Answer: This will not go into the loop as TRUE is defined as 0.

  • What will be printed as the result of the operation below:
    int x;
    int modifyvalue()
    {
    return(x+=10);
    }int changevalue(int x)
    {
    return(x+=1);
    }

    void main()
    {
    int x=10;
    x++;
    changevalue(x);
    x++;
    modifyvalue();
    printf("First output:%dn",x);

    x++;
    changevalue(x);
    printf("Second output:%dn",x);
    modifyvalue();
    printf("Third output:%dn",x);

    }

    Answer: 12 , 13 , 13

  • What will be printed as the result of the operation below:
    main()
    {
    int x=10, y=15;
    x = x++;
    y = ++y;
    printf(“%d %dn”,x,y);}

    Answer: 11, 16

  • What will be printed as the result of the operation below:
    main()
    {
    int a=0;
    if(a==0)
    printf(“Cisco Systemsn”);
    printf(“Cisco Systemsn”);}

    Answer: Two lines with “Cisco Systems” will be printed.

10 Important Companies in Cloud Computing

10. Verizon:
The $1.8 billion deal of Verizon acquiring the newbie Terremark has just been stated as one of the ground breaking deals in the cloud computing history. Since then Terremark has launched its Enterprise Private Cloud which is a single-tenant environment reportedly offering the level of security to enterprises and government agencies. Meanwhile Verizon also has grabbed Terremark’s co-founder and CTO John Considine who is renowned as the founder of cloud switch. But with other telco giants like Savvis, Global Crossing or even Tata Communications on the path, things are for sure to heat up this year.

9. VMware:
Seeing VMware being featured on the list usually may raise some eyebrows. But if you go through about their future projects and what they are about to bring to cloud computing, you are surely in for a surprise. Although VMware doesn’t offer any cloud services, the vCloud software is more than enough for VMware to be the best in cloud marketing business. The vCloud Director 1.5 software stands as a middleman for enterprises to get to private and public clouds. The vCloud Director 1.5 simply is software to build clouds. VMware boasts like about 100 clouds can be made using this software. But will this idea go all the way or will it remain nothing but a data provider, is still to be seen.
8. Linode:
If you ask a Linux user about his favorite cloud, then don’t be surprised in getting the same answer over and over again. Yes, it’s Linode who justifies its spot at number 8 in our top 10 cloud companies. There are many ways in handling clouds and Linode simply stands unique in this department. Linode builds cloud at a fixed cost- called Virtual Private Servers or VPS, which exact is the opposite of the normal, pay-as-you-go-model. So if you are talking about fixed cost clouds, then Linode is your answer.

7. Salesforce.com:
Salesforce.com has been on the scene for a decade and it’s time for them to make their presence felt. A company who were successful in enterprise cloud based solutions; Salesforce already has patched up for the next big step. Their $212 million acquisition of Heroku-which is a cloud for running your own home-grown applications, is seen as their initiation in cloud marketing. With this deal Salesforce has acquired Heroku’s technology and intellectual assets along with its famous ruby based applications, which will help them to establish a strong position in the cloud marketing

6. Citrix Systems:
Citrix has marked its position at the top as the best in cloud service provider along with some of the other well known companies. Citrix, who also builds software for clouds, has already started to put up some heat on other cloud developers like VMware.  Citrix made the big jump after acquiring the startup Cloud.com for a reported $200 + million. This gave Citrix the much needed access in the open source world. Later the introduction of Cloud Stack- open source software made Citrix the best in open source cloud market.

5. Red Hat:
Red Hat’s OpenShift has been in and out of controversies lately. The main reason was that it used Amazon’s AWS instead of its own data centers. But the reason why Red Hat features in our list is because of its popularity among Linux users. OpenShift helps users to load their applications into Amazon in an easy way. But the reason why OpenShift is so popular among Linux users is that this software is offered for free and it is one of the strong contenders against companies like VMware and Citrix.

4. Google:                                                                                  
One of the best out there, that’s Google for you. Recently Google has been doing a whole lot in tech, especially in cloud. Google has introduced Google App Engine where users can upload their applications, which includes Java and Python apps. Google Cloud Storage is now the most preferred alternative for enterprises to Amazon S3. Apps like Google Drive, Google CloudPrint, and Google Cloud Connect are just some of the software that Google is set to launch in the cloud platform. Not to mention the ChromeOS, where every user can run apps from the cloud instead of running from the system itself.

3. Microsoft:
Microsoft is a company that recently who’s been all over the place. Although Microsoft had its own mishaps, they are still hoping for the best in the cloud network. Azure, the cloud platform that Microsoft offers, is still one of the best in business. One of the standout features that Azure provides is the Media Services for streaming videos. Rumors are flying around that Azure is getting ready to be released in Linux platform. Microsoft has some of the best freebies in cloud market like Hotmail and Skydrive and also their enterprise cloud app called Office 365.

2. Rackspace:

 
Rackspace rose into fame with its open source methods for building clouds. The introduction of OpenStack made Rackspace the best in open source market. Rackspace is known for the best strategies that they undertook during the process.  Like VMware, Rackspace didn’t pay up for software they couldn’t control. So they tied hands with NASA and invented one of the best software up to date. Rackspacre invited programmers from all over the globe to help with codes and ideas which eventually lead to the improvement of OpenStack.

1. Amazon:

 
A company that was founded to sell books suddenly turned itself into a spark which lead to so many changes in the IT industry including cloud computing- that’s Amazon for you. And without a tinge of surprise its Amazon who is the best among companies in cloud computing. Amazon has delivered the best in terms of ideas, strategies and products. They always are ahead of the pack in cloud computing. Nothing but sheer determination and willingness is what brought Amazon to these heights. The Amazon Web Services (AWS) is the best in providing cloud services. Over the past 6 years Amazon has cut short the prices an astonishing 19 times. Although the annual revenues aren’t disclosed, reports say that Amazon received around $6 billion on 2011 which is not bad when compared to Amazon.com’s overall revenue of $48 billion.

Monday, June 4, 2012

Behind The Scenes Of Failed Indian Startup

Hundreds of techies nowadays are moving on from working for a company to start their own company. While a lot of them are noticeable in the market and a few of them have reached the heights of glory and success, some start-ups fail pretty badly.

 
Lessons to build an enterprise can not only be derived from successful companies but also from those which fade into the oblivion. Thenextweb.com has listed the lessons from failing attempts of today’s aspiring entrepreneurs that can be used to save your startup.

 
Here are the lessons that caution you against some perilous mistakes.

 
1. Not getting your language right

 
It is very important to first decide the coding language that you are going to keep as a base of your startup. In case you want to start a web startup, then it is important that you start learning and honing your skills on the web designing and web programming tools. For a startup that designs applications on a particular platform, then you need to learn the particular platform based programming languages. Otherwise, you might end up wasting a whole lot of time on learning languages when you are supposed to get all set up.

2. Not building a team

 
A company can be single handed at its embryonic stage but it needs a team when it is on the launch pad. There must be a logical distribution of work and functions and a balance in decision making. Any enterprise is not just about, it has many divisions like promotion and marketing, which cannot be all governed by one person. So build a team of enough employees to support your startup when required.



3. Not thinking about money

At the end of the day, your main goal is to raise money. Isn’t that why most of us start our companies? So the moment you think about starting an enterprise, think about all the sources you can grab the dough from. Pitch your idea to the veterans and the ones who are interested in investing in startup like yours. It is one of the most important jobs that entrepreneurs procrastinate and end up with a startup with no money to take it forward.

4. Distractions

 
It is natural that when you are setting up a startup, you tend to do a lot of research, talk to people and attend events. It is good until a given point and overdoing should be avoided. Do not waste your time in going through similar articles and repetitive blogs when you can actually work on developing or marketing your product. Keep a focus on what exactly your product is going to be about and do not try your hand at everything possible.


5. Go Mobile

The tech industry has moved from laptops and desktops to smartphones since quite a while, and if you have not realised it yet then wake up. When you are developing your product, keep in mind that you encourage provisions to make it compatible on cellphones and smartphones, or you are going to be away from a major group of users who could add so much to your revenues.


PM Sets up Mechanism to Fast Track Project Implementation

New Delhi: Amid declining growth rate and the need to arrest economic slowdown, Prime Minister Manmohan Singh approved setting up of an Investment Tracking System to ensure speedy implementation of mega projects envisaging outlay of over 1,000 crore.

The proposed mechanism is aimed at addressing delays in implementation of projects, said a statement from Prime Minister's Office (PMO).

While implementation of public sector projects of over Rs 1,000 crore will be tracked by the National Manufacturing Competitiveness Council, those in the private sector would be monitored by the Department of Financial Services in the Ministry of Finance.

The decision to fast track investments would provide fresh impetus to the economy, which is grappling with slowdown. The economic growth rate during 2011-12 slipped to a nine-year low of 6.5% mainly because of slowdown in manufacturing and poor investment.

Several mega projects, including Posco's proposed $12-billion steel plant in Orissa, has been hanging fire because of regulatory clearances and land acquisition issues.

The decision to set up Investment Tracking System, the statement said, is in "the context of delays faced by projects on multiple fronts - security clearances, environmental clearances, other clearances, land related matters, etc."

Issues concerning delay in implementation of projects was raised by India Inc at the last meeting of Prime Minister's Council on Trade and Industry in December

Facebook Posts Its Internal C++ Software Library


Facebook has released a library of C++ software components used to help run its site, the social networking company announced Saturday.
"One clear bottleneck to releasing more work has been that any open sourced project needed to break dependencies on unreleased internal library code," wrote Facebook software engineer Jordan DeLong, who posted an entry on Facebook announcing the release.By releasing this library, called Folly, Facebook will be able to release more of its internal programs as open source, because they rely on different components in this library.

Facebook engineers also announced the release at a C++ conference the company is holding Saturday at its campus at Menlo Park, California.

Facebook has relied on open-source software, such as MySQL, PHP and memcached, to run its sites. And so the company has made a point of releasing its own internal programs as open-source software as well, such as the HipHop PHP compiler and the Thrift service sharing framework.

For many of its open source releases though, Facebook developers have had to rewrite some of the functionality that was borrowed from this library. By releasing the library itself, Facebook will be able to "continue open sourcing parts of [its] stack without resorting to reinventing ... internal wheels," DeLong wrote.

Even if developers don't plan on using Facebook developed applications, they should still take a look at this library, as it includes many utilities of possible to use in other environments, DeLong said. Many of the components available in Folly run more quickly than their equivalents available elsewhere, he boasted. "Our motivation was to build components that were faster and more efficient than what we previously used," he wrote. These utilities were designed to be used in heavy production environments, across thousands of servers.

The components cover a range of functionality. One component was designed to use memory more efficiently. Another reduces contention. The AtomicHashMap utility cuts the amount of time a piece of data in memory is locked by an operation, which can slow performance and cause bottlenecks in heavily used environments. A set of string manipulation components use fewer CPU cycles than formatters in other C++ libraries, DeLong boasted.

The Folly library is posted on GitHub, and Facebook will add new components as they are written, according to DeLong.

60% employers to monitor their employees‘ Facebook, Twitter pages by 2015: Gartner


Many employers already monitor their workers' Facebook, Twitter and other social media pages - but the practice is set to increase, a new report has revealed.

A new report by data analysts Gartner has claimed that by the year 2015, 60 per cent of employers will monitor social media pages of their employees.

The 'Big Brother' monitoring will be driven by security worries about employees leaking information or talking negatively about their workplace.

"The growth in monitoring employee behavior in digital environments is increasingly enabled by new technology and services," the Daily Mail quotedAndrew Walls, research vice president of Gartner, as saying.

"Surveillance of individuals, however, can both mitigate and create risk, which must be managed carefully to comply with ethical and legal standards," Walls said,

Most employers will use their monitoring to prevent security breaches - but simply having the technology at their disposal will be a huge temptation to managers who want to know more about their staff.

"The development of effective security intelligence and control depends on the ability to capture and analyse user actions that take place inside and outside the enterprise IT environment," he said.

Walls predicts that the practice, which is increasingly common in America, of asking for Facebook passwords as part of job interviews, will fade out of fashion.

Earlier this year, Facebook said it has "seen a distressing increase in reports of employers or others seeking to gain inappropriate access to people's Facebook profiles or private information."

Debate over the legality of employers forcing job applicants to hand over their passwords has raged on since the rise of social networking.

It has become common for managers to review publicly available Facebook profiles, Twitter accounts and other sites to learn more about job candidates.

But many users, especially on Facebook, have their profiles set to private, making them available only to selected people or certain networks.

Companies that don't ask for passwords have taken other steps -- such as asking applicants to friend human resource managers or to log in to a company computer during an interview.

Once employed, some workers have been required to sign non-disparagement agreements that ban them from talking negatively about an employer on social media.