2010年9月28日

Gmail Pop3 implementation

Before you dash off to try the example code, a warning though. Talking to mail servers even with JavaMail has pitfalls even with the FAQ to hand. For example, when I was writing this article, I decided initially to use GMail, Google's mail service and its POP3 support. Strangely though, Google's POP3 service is not RFC compliant which means as soon as you read a message from it, not matter what you do, that message will disappear from the message queue. With another mail server, the version of the server interpreted the RFC standard on authentication slightly differently causing a login error. How do you track down problems like this? One big help is turning on JavaMail debugging; when you get the Session, you can call the setDebug method to turn on debugging which in turn dumps everything that goes up or down the wire to the console. Be warned, when you are getting attachments, this can be some rather large sections of base 64 encoded text. Another way to flip the debug on is to set the system property "mail.debug" to true.

JavaMail has a whole range of properties which can affect the behaviour of providers. For example, with POP3, the standard provider has properties which control timeouts, authentication and how the provider actually interacts with the mail server. This in turn may resolve those compatibility issues mentioned above. These properties are provider implementation specific. Take the standard POP3 provider though; some POP3 providers automatically delete read messages when you disconnect, but the POP3 RSET command can reset the mailbox to its original read state. The property mail.pop3.rsetbeforequit set to true can enable that behaviour in the POP3 provider; the "pop3" part of the property name reflecting the provider's name, so change it to "pop3s" if you are using secure POP3. Here's code from the example which enables that for both and turns debugging on:

Properties props=System.getProperties();
props.setProperty("mail.pop3s.rsetbeforequit","true");
props.setProperty("mail.pop3.rsetbeforequit","true");
session=Session.getInstance(props,null);
session.setDebug(true);

And if you are wondering, no, this has no effect on Google Mail's POP3 implementation; once you've read it, it's gone. Next month, we'll look at using the MailRetriever as a servlet, complete with displaying those attachments, and look at handling some other types of mail beyond simple attachments.

2010年8月29日

The webkitTransform problem of iPhone 4G

On iPhone 4G
this.element.style.webkitTransform = translate(...) is very slow.

You should use
this.element.style.webkitTransform = translate3d(...)

2010年8月9日

NSData dataWithContentsOfURL has memory leak problem

NSData dataWithContentsOfURL has memory leak problem.

Should use it like below.

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

// ** Your Operations **

NSData *data = [NSData dataWithContentsOfURL:someURL];

// ** Your Operation **

[pool release];

2010年6月1日

有空想研究一下NMEA

有空想研究一下NMEA.
看来不需要了,无法定位是因为越狱,已找到解决方法。

I have released a Cydia package that fixes the location services issue caused by the Spirit jailbreak.

1. In Cydia, add the source http://cydia.pushfix.info/

2. Install the package "iPad Location Services Fix"

That's it. It restarts locationd on install and on every boot after the SpringBoard finishes loading. You should have no more problems with location services after install.

2010年5月18日

测试IAP时需要使用Developer证书。

测试IAP时需要使用Developer证书。

2010年4月30日

ActionScript 3 使用相对路径读入外部图片时,需注意的问题。

http://www.actionscript.org/forums/archive/index.php3/t-124859.html

loader.load(new URLRequest((root.loaderInfo.url.substring(0, (root.loaderInfo.url).lastIndexOf("/") + 1 ) ) + "trefle.png"));

2010年4月14日

VMware上安装Snow Lepard出现风火轮无法启动

解决方法:

for all people who have ACPI_SMC timeout, open your vmx file et change smc.present = “TRUE” to smc.present = “FALSE” and normaly the sytem will boot, and even you can shutdown et reboot without hang up ! (it works for me)