博文

目前显示的是 2014的博文

JVM垃圾回收优化

JVM参数调优是一个很头痛的问题,可能和应用有关系,下面是本人一些调优的实践经验,希望对读者能有帮助,环境LinuxAS4,resin2.1.17,JDK6.0,2CPU,4G内存,dell2950服务器,网站是shedewang.com,新手可能觉得这文章没有用。  一:串行垃圾回收,也就是默认配置,完成10万request用时153秒,JVM参数配置如下  $JAVA_ARGS .= " -Dresin.home=$SERVER_ROOT -server -Xms2048M -Xmx2048M -Xmn512M -XX:PermSize=256M -XX:MaxPermSize=256M -XX:MaxTenuringThreshold=7 -XX:GCTimeRatio=19 -Xnoclassgc -Xloggc:log/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps ";  这种配置一般在resin启动24小时内似乎没有大问题,网站可以正常访问,但查看日志发现,在接近24小时时,Full GC执行越来越频繁,大约每隔3分钟就有一次Full GC,每次Full GC系统会停顿6秒左右,作为一个网站来说,用户等待6秒恐怕太长了,所以这种方式有待改善。MaxTenuringThreshold=7表示一个对象如果在救助空间移动7次还没有被回收就放入年老代,GCTimeRatio=19表示java可以用5%的时间来做垃圾回收,1/(1+19)=1 /20=5%。  二:并行回收,完成10万request用时117秒,配置如下:  $JAVA_ARGS .= " -Dresin.home=$SERVER_ROOT -server -Xmx2048M -Xms2048M -Xmn512M -XX:PermSize=256M -XX:MaxPermSize=256M -Xnoclassgc -Xloggc:log/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC -XX:MaxGCPauseMi...

S-OFF HTC

Revone Download: http://revolutionary.io/revone Big thanks to the Revolutionary dev team . The original thread can be found here. Written instructions: Download the Revone file above and transfer it to your phone ( or download on your phone) Use a root file explorer and paste the file inside the /data/ local /tmp folder Open a terminal emulator and type of the following: su (enter) cd /data/local/tmp (enter) chmod 755 revone (enter) (IF revone doesn’t work, type revone.bin) ./revone -P (enter) Reboot Open terminal again and type: su (enter) cd /data/local/tmp (enter) ./revone -s 0 -u (That would be a ZERO) (enter) Reboot That’s it! To get rid of the tampered, or relock, follow instructions below To remove “tampered” open terminal cd /data/local/tmp su ./revone.bin -t These are other commands that you can fill in above to  -u – Unlock the device -l – Lock the device (as if it was never unlocked ) -r – Relock the device (mark the device...

刷机失败解决方案

图片
刷机失败解决方案 前言 我们买到手机之后一段时间都会有刷机的想法,有些朋友因为操作上的失误导致刷机失败。那么一旦我们刷机失败后该如何处理呢?下面介绍几种刷机失败后会发生的情况,并提供解决方法,仅供大家参考。 情况分类 1、Hboot状态: Hboot 什么是hboot? 在HTC的Android 系统的系列手机中,HBOOT就是SPL。 SPL英文全称是Second Program Loader,“第二次装系统”,就是负责装载操作系统到RAM中。 SPL 一般提供这几部分功能:检测手机硬件、寻找系统启动分区、启动操作系统为系统的基本维护提供操作界面,可以通过数据线与操作终端(如PC)建立连 接,并接受和执行相应命令。它里面包含许多命令,像r2sd,l,doctest(危险命令,他会擦除gsmdata)等。我们常说的三色屏就是由SPL 驱动的。检测SD卡,当你把一些特殊制作的SD卡插入后,SPL可以在启动时校验并根据SD卡内容刷机或执行一些命令。这有点类似于PC 的从软驱启动。简单点说,SPL就相当于PC的BIOS。 Hboot版本问题 同样的手机机型,Hboot有不同版本;甜椒刷机不会更改hboot,使用官方RUU固件会改变版本,一般情况下RUU刷只能是高于或等于现有hboot的版本 2.33、2.35...各个版本之间Hboot均兼容,4.01、4.02...系统各个版本之间Hboot均兼容, 但是2.3与4.0系统的Hboot不兼容,如果单纯通过甜椒直接刷2.3或者4.0,可能会因此无法开机;用户只需刷入兼容对应hboot的刷机包(刷机包均会详细标明基于2.3或4.0修改),或者用官方RUU固件改变Hboot版本。 6 l( I3 _% c8 c, l* o 进入hboot,以及退出hboot tips:hboot模式中使用“音量键加减”选择上下,电源键为确认 进入hboot的方法: 手机关机状态下,同时按住音量键+电源键 退出hboot的方法: 在hoot模式中选择fastboot,再fastboot模式下选择power down 卡在hboot模式的解决方法: a.如果一直显示checking sd card updata等相似字样,请删除sd卡根目录下是否有zip...

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...