Posts

Showing posts from 2010

Earn money Online free

Earn upto Rs. 9,000 pm checking Emails. Join now!

taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found

I got this problem while building JAR. I have spent 10 to 15 to solve this headech steps wre: Right click over the Project and select option -> Resolve Reference Problem.... Then It will display which reference is really problem just locate the right Libraries. And tan tada done :).... Best of Luck...

Example Code to send mail in JAVA

package javaapplication27; import java.security.Security; import java.util.Properties; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** * * @author SANAT */ public class Main { /** * @param args the command line arguments */ private String mailhost = "smtp.gmail.com"; public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception { try { Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", mailhost); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put

XML Programming using IXMLDOMDOCUMENT in vc++

Here the sample code to start XML programming using XML dom parser. // TestXML1.cpp : Defines the entry point for the console application. // #import #include "stdafx.h" #include #include #include //sample xml u can copy paste it in note pad and save it with .xml extension and store in location c:\ int _tmain(int argc, _TCHAR* argv[]) { CoInitialize (NULL); CComPtr< IXMLDOMDocument > pXMlDoc = NULL; HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pXMlDoc)); VARIANT_BOOL boolval; CComVariant path ="c:\\cdcat.xml"; hr = pXMlDoc->load(path,&boolval); BSTR val ; pXMlDoc->get_xml(&val); MessageBox(0,val,_T("TEST"),0); pXMlDoc = NULL; CoUninitialize(); return 0; }

Good collection of C n C++ interview written Questions and answers

Download Questions in PDF : Download C n c++ written questions and Ans(PDF) C Aptitude 1. void main() int const * p=5; printf("%d",++(*p)); Answer: Compiler error: Cannot modify a constant value. Explanation: p is a pointer to a "constant integer". But we tried to change the value of the "constant integer". 2. main() char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); Answer: mmmm aaaa nnnn Explanation: s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as 3. main() float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); Answer: I hate U Explana

C++ Class Member Initialization order....

Sample Code.... class Test { int x; int y; public:Test(int z) { x=y=z; } }; class Test1 { Test t; const int b; Test1(int z):t(1),b(10) { } }; CSomeClass::CSomeClass() { x=0; y=1; } and in other places I see it written this way: CSomeClass::CSomeClass() : x(0), y(1) { } Some of my programmer friends say that it's better to do it the second way, but no one knows why. Can you tell me the difference between these two methods of initializing class members? A Technically your friends are right, but in most cases it makes no difference. There are two reasons to use the second syntax, which is called a member initialization list: one is necessity, the other efficiency. Let's examine the first reasonĂ¢€"necessity. Suppose you have a class member that is itself a class or struct, and this class only has one constructor that requires an argument. class CMember { public: CMember(int x) { ... } }; Since CMember has an explicit constructor, the compiler do