博文

Java SMTP

SubEtha SMTP is a Java library which allows your application to receive SMTP mail with a simple, easy-to-understand API. This component can be used in almost any kind of email processing application. Hypothetical (and not-so hypothetical) uses include: A mailing list manager (see SubEthaMail ) A mail server that delivers mail to user inboxes A mail archiver like The Mail Archive An email test harness (see Wiser ) An email2fax system SMTPseudo A filtering forwarding server Baton SMTP proxy for one or more backends (rules based on sender/envelope) Mireka - Mail server and SMTP proxy with detailed logging, statistics and built-in, fail-fast filters SubEthaSMTP's simple, low-level API is suitable for writing almost any kind of mail-receiving application. Read more in UsingSubEthaSMTP or join our MailingList . A Little History SubEthaSMTP was split out of the SubEthaMail mailing list manager because it is a useful standalone component. When we wrote SubEtha...

Simulate Mouse Click in SWT

                btnImportFile.getDisplay().syncExec(new Runnable(){                     @Override                     public void run() {                         Event event = new Event();                         event.type = SWT.MouseMove;                         event.x = btnImportFile.toDisplay(10, 10).x;                         event.y = btnImportFile.toDisplay(10, 10).y;           ...
There is one difference between undefined And null in javascript :: undefined is a data type and null is a value defined empty variable is null of datatype undefined Both of them are representing a value of a variable with no value AND null doesn't represent a string that has no value Like var a = '' ; console . log ( typeof a ); // string var a = '' ; console . log ( a == null ); //false console . log ( a == undefined ); // false Now if var a ; console . log ( a == null ); //true console . log ( a == undefined ); //true BUT var a ; console . log ( a === null ); //false console . log ( a === undefined ); // true SO each one has it own way to use undefined use it to compare the variable data type null use it to empty a value of a variable var a = 'javascript' ; a = null ; // will change the type of variable "a" from string to undefined

Java Convert BufferedImage to SWT ImageData

    public ImageData bufferedImage2SwtImage(BufferedImage bufferedImage) {         if (bufferedImage.getColorModel() instanceof DirectColorModel) {             DirectColorModel colorModel                     = (DirectColorModel) bufferedImage.getColorModel();             PaletteData palette = new PaletteData(colorModel.getRedMask(),                     colorModel.getGreenMask(), colorModel.getBlueMask());             ImageData data = new ImageData(bufferedImage.getWidth(),                     buf...

What is the difference between null and undefined in JavaScript?

http://stackoverflow.com/questions/5076944/what-is-the-difference-between-null-and-undefined-in-javascript There is one difference between undefined And null in javascript :: undefined is a data type and null is a value defined empty variable is null of datatype undefined Both of them are representing a value of a variable with no value AND null doesn't represent a string that has no value Like var a = '' ; console . log ( typeof a ); // string var a = '' ; console . log ( a == null ); //false console . log ( a == undefined ); // false Now if var a ; console . log ( a == null ); //true console . log ( a == undefined ); //true BUT var a ; console . log ( a === null ); //false console . log ( a === undefined ); // true SO each one has it own way to use undefined use it to compare the variable data type null use it to empty a value of a variable var a = 'javascript' ; a = null ...

JavaScript quiz - Scoping related

http://www.nczonline.net/blog/2010/01/26/answering-baranovskiys-javascript-quiz/ Answering Baranovskiy’s JavaScript quiz Posted at January 26, 2010 09:00 am by Nicholas C. Zakas Tags: Hoisting , JavaScript Last week, I tweeted about a JavaScript quiz I came across on Dmitry Baranovskiy’s blog entitled, So you think you know JavaScript? As with other quizzes of this type, there is only one question to answer for five different pieces of example code: what is the result? The example code tests some of the quirkier attributes of JavaScript engine behavior. I’ve seen similar quizzes in the past, sometimes by people saying that they use it as a test during job interviews. I think doing so is both disrespectful to the candidate as well as generally useless. You don’t encounter this type of quirk every day, so making that the minimum to get a job is about as useful as asking flight attendant candidate...

JavaScript Scoping

From: http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html Do you know what value will be alerted if the following is executed as a JavaScript program? var foo = 1; function bar() { if (!foo) { var foo = 10; } alert(foo); } bar(); If it surprises you that the answer is “10”, then this one will probably really throw you for a loop: var a = 1; function b() { a = 10; return; function a() {} } b(); alert(a); Here, of course, the browser will alert “1”. So what’s going on here? While it might seem strange, dangerous, and confusing, this is actually a powerful and expressive feature of the language. I don’t know if there is a standard name for this specific behavior, but I’ve come to like the term “hoisting”. This article will try to shed some light on this mechanism, but first lets take a necessary detour to understand JavaScript’s scoping. Scoping in JavaScript One of the sources of most confusion for JavaScript beginners is scoping. Actuall...