import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.io.*;

class ReadAttachment{
public static void main(String [] args)throws Exception{

String host=”mail.javatpoint.com”;
final String user=”sonoojaiswal@javatpoint.com”;
final String password=”xxxxx”;//change accordingly

Properties properties = System.getProperties();
properties.setProperty(“mail.smtp.host”,host );
properties.put(“mail.smtp.auth”, “true”);

Session session = Session.getDefaultInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user,password);
}
});

Store store = session.getStore(“pop3”);
store.connect(host,user,password);

Folder folder = store.getFolder(“inbox”);
folder.open(Folder.READ_WRITE);

Message[] message = folder.getMessages();
for (int a = 0; a < message.length; a++) {
System.out.println(“————-” + (a + 1) + “———–“);
System.out.println(message[a].getSentDate());

Multipart multipart = (Multipart) message[a].getContent();

for (int i = 0; i < multipart.getCount(); i++) {
BodyPart bodyPart = multipart.getBodyPart(i);
InputStream stream = bodyPart.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(stream));

while (br.ready()) {
System.out.println(br.readLine());
}
System.out.println();
}
System.out.println();
}

folder.close(true);
store.close();
}
}

LOAD THE JAR FILE :  C:\> set classpath=mail.jar;activation.jar;

COMPILE THE SOURCE FILE: C:\> javac ReadAttachment.java

RUN BY :C:\> java ReadAttachment

Advertisements

Amidst so many things said and heard, Business insider has collected some crazy facts about Facebook that have made the company a treat for the readers.

Let’s take a look at 26 such facts that kept the giant social network in the news.

1. Facebooks Worth would be more than eBay, Yahoo, Groupon, LinkedIn, Netflix, IAC, AOL, Zynga and Pandora combined, when

it goes public

.

2. Eduardo Saverin, the Brazilian co founder of Facebook has renounced his US citizenship and is now investing billions in startups at Singapore.

3. Of all the incredible talents that Zuckerberg is bestowed with, his greatest and what seems to be his favorite is Firing People.

4. About 60 percent of the voting power at Facebook is controlled by Zuckerberg.

5. The big shot media company Viacom had offered to acquire Facebook, but was rejected by Mark Zuckerberg.


6. After agreeing to an acquisition offer from Yahoo while it was led by Terry Semel, Facebook staepped down from the deal when there were talks of lowering the offer price.

7. The Microsoft CEO, steve Ballmer had offered to buy Facebook. Steve has invested $240 million in Facebook till date.

8. Facebook interviewed Yahoo executive Ellen Siminoff, Apple veteran Bud Colligan, and former OpenTable CEO Jeff Jordan for the position of COO which is now held by Sheryl Sandberg.

9. Steve jobs had to cancel the presentation that he had offered Facebook for the iphone application in 2008. Jobs, who had expected Zuckerberg to do the presentation was disappointed by the audition of the engineer who was selected by the Facebook CEO.


10. Maintaining his reputation of having a a bad fashion sense, Zuckerberg wore a hoodie to the meeting with wall street investors.

11. In 2005, Mark Zuckerberg took CEO lessons to improve his managerial skills.


12. Mark Zuckerberg is said to be a big time Glee fan.

Whenever I open Run and type regedit and press enter a messageprompt appears saying Registry editing has been disabled by your administrator“.

Let’s see how can we fix it.Here i got 3 Methods to fix this Problem which i have collected them from Net.

Method 1:

You can use a simple UnHookExec.inf to enable registry editing.

1. Download UnHookExec.inf
2. Right click on the downloaded file and select install.

Method 2:

For enabling you can also use the remove restrictions tool(RRT) by Sergiwa.com, if the method 1 doesn’t work for you.

1. First Download Remove Restrictions Tool
2. Run and check the registry tools and click apply.

Method 3:

If the above two methods does not work for you , you can also try executing a small vbscript which I found on major geeks.

1. First Download EnableRegEdit.vbs
2. Double click on the downloaded file to enable registry editing.

I hope at least one of the above will help to fix the trouble.

Google is testing a long-awaited full-text search API (application programming interface) for the Google App Engine, the company said on Tuesday.

The App Engine lets developers build Web applications hosted on Google’s infrastructure, and developers have long complained that the current search API is inadequate.

[ Keep up with software development issues and trends with InfoWorld‘s Fatal Exception blog. | Master the latest in Java development with our JavaWorld Enterprise Java newsletter. | Follow the cloud with InfoWorld’s Cloud Computing blog andCloud Computing Report newsletter. ]

“Beside the cruel irony [of] not having full-text search I am starting to wonder why it would take Google so long to implement this,” a developer wrote in the App Engine forum last month.

Google released the full-text search API in “experimental” mode and warned it could make changes in future versions that might be incompatible with the current API.

The API will allow users to search by keyword and delineate specific fields and ranges, Google said. The new capabilities also include scoring and snippeting.

Developers can use the API for free up to 20,000 calls a day or a total index size of 250 megabytes.

JDK (JAVA DEVELOPMENT KIT)

 

Java Developer Kit contains tools needed to develop the Java programs, and JRE to run the programs. The tools include compiler (javac.exe), Java application launcher (java.exe), Appletviewer, etc…

 

Compiler converts java code into byte code. Java application launcher opens a JRE, loads the class, and invokes its main method.

 

You need JDK, if at all you want to write your own programs, and to compile the m. For running java programs, JRE is sufficient.

 

JRE is targeted for execution of Java files

 

i.e. JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime libraries.

 

JDK is mainly targeted for java development. I.e. You can create a Java file (with the help of Java packages), compile a Java file and run a java file

JRE (JAVA RUNTIME ENVIRONMENT)

 

Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE. If you want to run any java program, you need to have JRE installed in the system

 

The Java Virtual Machine provides a platform-independent way of executing code; programmers can concentrate on writing software, without having to be concerned with how or where it will run.

 

If u just want to run applets (ex: Online Yahoo games or puzzles), JRE needs to be installed on the machine.

JVM (JAVA VIRTUAL MACHINE)

 

As we all aware when we compile a Java file, output is not an ‘exe’ but it’s a ‘.class’ file. ‘.class’ file consists of Java byte codes which are understandable by JVM. Java Virtual Machine interprets the byte code into the machine code depending upon the underlying operating system and hardware combination. It is responsible for all the things like garbage collection, array bounds checking, etc… JVM is platform dependent.

 

The JVM is called “virtual” because it provides a machine interface that does not depend on the underlying operating system and machine hardware architecture. This independence from hardware and operating system is a cornerstone of the write-once run-anywhere value of Java programs.

 

There are different JVM implementations are there. These may differ in things like performance, reliability, speed, etc. These implementations will differ in those areas where Java specification doesn’t mention how to implement the features, like how the garbage collection process works is JVM dependent, Java spec doesn’t define any specific way to do this.

Linux is one of the world’s most powerful and popular operating system. Linux operating system was developed by Linus Benedict Torvalds at the age of 21. At present there are more than 300 flavors of Linux available and one can choose between any of them depending on the kind of applications they want. If you are new to Linux read, Top 5 Advantages of Using Linux Os

Linux is a freeware and generally speaking its free from Virus and other malware infections.  In this post I will share few Linux facts which may or may not be know for many of us.

15 MOST INTERESTING LINUX FACTS

  1. Only 2% of the current Linux kernel written by Linus Torvalds.
  1. The Linux kernel version is written in the programming language C.
  1. The first commercial distribution GNU / Linux was Yggdrasil was launched Lice-CD format in 1992. Red Hat was one of the first distributions to settle within companies and data centers in 1999.
  1. A guy named William Della Croce Jr. registered the name Linux and demanded royalties for use of the mark. Later, he agreed to assign the trademark to the true owner, who is Torvalds.
  1. Countries such as Russia, Brazil and Venezuela have put their focus on Linux as a basis for interoperable management , cost efficient and technologically independent.
  1. U.S. Department of Defense, U.S. Navy Submarine Fleet, Federal Aviation Administration uses Linux in government offices. Indian state of Tamil Nadu uses Linux for education purpose.
  1. 90% of the world’s most powerful supercomputers using an operating system GNU / Linux, in fact, the top ten of supercomputers use Linux. In fact, the penetration of Linux in data centers is very high, 33.8% of the world runs on Linux servers compared to 7.3% does so in a Microsoft operating system.
  1. The name of the penguin, Tux , is not entirely clear. On the one hand, it is said that the origin of the name comes from the fact that penguins appear to be wearing a tuxedo, which in English is said max tuxedo tux and is abbreviated. In contrast, another source comes from the letters of the logo of Tux are Unix Torvalds.
  1. Torvalds wanted to call the kernel Freax (a combination of “free”, “freak”, and the letter X to indicate that it is a Unix-like), but his friend Ari Lemmke, who administered the FTP server where the kernel was hosted for download, the download directory called kernel of Linux Torvalds.
  1. Debian was one of the first GNU / Linux that was constituted and organized as a community of developers.
  1. Linux is present in highly critical applications such as Japan’s bullet trains, traffic control, San Francisco, the New York Stock Exchange, CERN, many air traffic control systems or control of nuclear reactors of submarines and ships many nuclear war.
  1. Linux programmers are often associated with living “isolated” in the world, however, over 75% of the code developed for the Linux kernel came from private sector developers. In fact, large technology companies like Intel, Google, IBMAMD, Sun Microsystems, Dell, Asus, HP, Analog Devices, Oracle, Novell or Red Hat help developing applications, contributing to the core or pre-installing any GNU / Linux their machines. In fact, during the 2003 Super Bowl (which paralyzes the United States and remains glued to the TV for many Americans), IBM delivered a beautiful ad talking about Linux and open source options.
  1. The GNU project in 1991, had no drivers and kernel, that’s what led to Linus Torvalds to address the Linux kernel development. If GNU had had, perhaps, Torvalds had not been put to work on that.
  1. The Linux kernel is now the most widely ported operating system, running on a great variety of operating systems.
  1. World known companies such as Google, Cisco, FacebookTwitter, Linked in etc use Linux as their main operating system.

Tim Cook has pulled a startling coup, getting Larry Ellison to start cooking — if not eating — his own dog food.

The headlines make it sound like Oracle, the inherited owner of Java, has generously stepped in to help protect Mac owners from infections like Flashback. There’s an important backstory, though, that hasn’t hit the headlines.

Although Steve Jobs tried for years to get out from under the Java ball and chain, last week Tim Cook finally coerced Oracle into supplying updates for its own software. It only took 700,000 infected systems to convince Oracle to handle Java on OS X itself.

Steve Jobs dropped Java for the Mac in October 2010, removing it as part of the standard OS X install. The Mac OS X Developer Library post for Oct. 20, says, “The Java runtime ported by Apple and that ships with Mac OS X is deprecated. Developers should not rely on the Apple-supplied Java runtime being present in future versions of Mac OS X.” At the same time, Apple stopped accepting apps for the Mac App Store that relied on the Java Runtime Environment. Apple had never supported Java clients in itsiOS.

On Oct. 21, 2010, the MacRumors forum said that Jobs replied to a concerned Java developer, claiming, “Sun (now Oracle) supplies Java for all other platforms. They have their own release schedules, which are almost always different than ours, so the Java we ship is always a version behind. This may not be the best way to do it.”

Of course, Jobs knew at the time he was blowing smoke — or perhaps a reality distortion field set in. With a few notable exceptions, Java’s owner has never supplied versions “for all other platforms.” Back when Java started, Sun supplied a version of the runtime for Linux because, as the “father of Java” James Gosling says, “there was no one else to do it.” Every other distributor — Microsoft,IBM, Hewlett-Packard, and Apple — rolled its own version, based on Sun’s reference code.

Java 1.0 for Mac OS 9 was released in 1996, the year Apple bought NeXT and Jobs returned to the Apple fold. Jobs knew full well that Apple was developing its own version of Java, just like all the other platform providers.

Microsoft started taking its version of Java far afield, adding its own extensions to the language, and Sun sued in 1997 to get its trademark back. A bitter, extended, and very public court battle ended in January 2001, with Microsoft paying Sun $20 million for its transgressions and Sun taking control of Java updates. Until this last week, Sun had released Java versions only for Linux and Windows. All the other platforms made their own.

The fact is that Jobs had been trying for years to get Sun, then Oracle, to take over Java releases for OS X. Back in 2007, Jobs is quoted as saying, “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.” In 2010, when Jobs dropped Java like a hot cup of coffee, he tried to shame Oracle into supporting it. Since then, Java’s been a neglected stepchild in the Mac world, completely shunned in iOS.

As Gosling says, “In the early days, they [Apple] were insistent on doing the port themselves. They put terrific energy into it. They did a good job. But then, as OS X took hold and Apple was able to convince developers to target their nonportable/proprietary environment, Apple’s fundamental control-freak tendency took over and they put less and less energy into Java.”

Oracle is now distributing Java SE 7 Update 4 for Mac OS X, and that will become the default version on Java.com starting May 1. Henrik Stahl, senior director of Java product management at Oracle, says, “Oracle’s JDK and JavaFX release supports OS X Lionon any 64-bit capable Intel-based Mac. … There are community efforts based on OpenJDK to build JDK 7 [and JVM on 32-bit machines] for other configurations, easily found using your favorite search engine. We applaud these efforts! :-)”

Oracle has announced full plans to embrace OS X Lion and later with new updates to the Java Standard Edition and Java Development Kit. (The JDK includes the Java Runtime Environment, JRE, which in turn includes the Java Virtual Machine, JVM. And you thought Microsoft’s terminology was confusing!)

It’s not clear if Oracle will be updating the Java runtime for earlier versions of OS X. That’s particularly troubling because Dr. Web, the site that originally broke the story on the Flashback infections, now says that 25 percent of all Flashback infections come from Macs running OS X 10.5 Leopard, and 63 percent more are from OS X 10.6 Snow Leopard. Only 12 percent of all infections are in OS X 10.7 Lion, and those are the only machines that will be patched with Oracle’s Java SE 7 Update 4. Leopard and Snow Leopard users are left to the “community efforts.” If either Apple or Oracle is concerned about the hundreds of thousands of customers left swinging in the wind, there’s no indication I can find.

In contrast, Apple’s two recent Java patches covered Lion and Snow Leopard. They didn’t cover Leopard.

It seems that Jobs’ desires have finally been fulfilled, with the Java monkey now on Oracle’s back. Cook was at the helm — perhaps actively involved? — when it happened. Apple’s now able to wash its hands of all Java’s faults going forward. Oracle has responsibility for its own product. All it took was 700,000 infections.

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class sendMail
{
public static final String MAIL_SERVER = “smtp.gmail.com”;
public static final String USERNAME = “Your gmail user name should be here”;
public static final String PASSWORD = “gmail password“;
public static String fromAddress = null;
public static String toAddress = null;

public static void main(String[] args)
{
try
{
fromAddress = “gmail email id”;
String toAddress = “xyz@psdf.com”;
String subject = “This is a test Message”;
String message = “Hello Hows u?”;

Properties properties = System.getProperties();
properties.put(“mail.smtps.host”, MAIL_SERVER);
properties.put(“mail.smtps.auth”, “true”);

Session session = Session.getInstance(properties);
MimeMessage msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(fromAddress));
msg.addRecipients(Message.RecipientType.TO, toAddress);
msg.setSubject(subject);
msg.setText(message);

Transport tr = session.getTransport(“smtp”);
tr.connect(MAIL_SERVER, USERNAME, PASSWORD);
tr.sendMessage(msg, msg.getAllRecipients());
tr.close();

}
catch (AddressException ex)
{
System.out.println(“in addressException”);
System.out.println(ex.getMessage());

}
catch (MessagingException ex)
{

System.out.println(ex.getMessage());
}
System.out.println(“message successfully sent”);
}

}

 
 
 

MONDAY, MAY 28, 2012

How To Clean Your RAM Using Notepad

 

Cleaning your RAM using notepad

Many friends of me ask where can I download a software which can keep my RAM free? And I found these software are nothing but using some lines of code which can be implemented by using notepad or any editor tool. So if any one does not have any software, you can use it by doing the following things which I am going to mention.

Steps to Clean Your RAM Using Notepad:

Step 1: Open Notepad
Step 2: Type FreeMem=Space(10240000000)
Step 3: Save it as “CLEANER.VBS” in any location you like.
Step 4: You can edit the code and write 512 instead of 1024 if you own a 512mb RAM or change to anything you like.
Step 5: Run it !

After this final step your RAM will be free.

Hope you enjoyed it. :)
Please Pass comments on i