Month: January 2016

MySQL数据去重示例

— ==== 数据清洗 ==== — === 表1:ESB_ERP_BASIC_MODEL_PRICE === — 根据MODL_ST去重 取最新记录 — S1: 设置ROWNUM select @x:= 0; update ESB_ERP_BASIC_MODEL_PRICE t1 set t1.ATTRIBUTE10 = (select @x := @x+1); — S2: 根据ROWNUM去重 DELETE FROM ESB_ERP_BASIC_MODEL_PRICE WHERE ATTRIBUTE10 IN ( select ATTRIBUTE10 from ( select t1.* , if(@g1=t1.MODL_ST, @rank:=@rank+1, @rank:=1) as rank , (@g1:=t1.MODL_ST) as g1 from (select ATTRIBUTE10, MODL_ST, LAST_UPDATE_DATE from ESB_ERP_BASIC_MODEL_PRICE order by modl_st asc, LAST_UPDATE_DATE desc) t1 , (select @g1:=null, @rank:=0) t2 ) t where rank>1 ) ; — ===…

Read More »

Secure cookie with HttpOnly and Secure flag in Apache

Secure Apache Web Server from XSS Attack Do you know you can mitigate most common XSS attack using HttpOnly and Secure flag with your cookie? XSS is dangerous, very dangerous. By looking at increasing number of XSS attack on daily basis, you must secure you web applications. Without having HttpOnly and Secure flag in HTTP response header, it is possible to steal or manipulate web application session and cookies. It’s good practice to set HttpOnly and Secure flag in application…

Read More »

Ubuntu 14.04 LTS 系统设置残缺的问题

我不就把iBus给卸载了吗?你作为抗议连系统设置都不给我用了,这就有点过了吧!          一,现状。 先让大家看一下症状,同时可以对比,以免以后你的Ubuntu变成了这样你还到处乱求医问药的。 二,来由。 那天我看到奇丑无比的iBus就果断地找Fcitx来代替它了,谁料这货走之前尽给我使些坏,把系统设置给弄残了。 你不信?你可以给它下这条命令试试 sudo apt-get remove ibus 三,寻根。 我差不多半天不得其解为什么,奇丑无比的iBus跟Ubuntu 14.04关系这么紧密,我还动你不得了。真想让Ubuntu 14.04再去投胎一次(重装系统嘛)!但作为一个专业的Ubuntu家族医生,我是有责任和义务知道她的发病原由的好吧!终于在Ubuntu 14.04的交往记录中我发现了一个秘密,Ubuntu 14.04跟iBus之间的那点关系是万万不能断的。如下图,明了了吧: 三,得解。 明显我知道是Ubuntu 14.04和iBus之间的关系引起的,但我尝试把iBus请回来之后问题依旧。最后我只能跟据记录一个个来恢复了,发现正解如下: sudo apt-get install ubuntu-desktop 这个会把amazon广告也给重新安装上,所以你可以先安装再卸载,或者使用以下命令一次性解决: sudo apt-get install ibus-pinyin unity-control-center unity-control-center-signon webaccounts-extension-common xul-ext-webaccounts   摘自 [ http://jingyan.baidu.com/article/375c8e19985a2125f2a229cb.html ]

Read More »

maven-assembly-plugin 打包可执行jar包

<build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>the.Main</mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>assembly</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

Read More »

Swixml Sample Code

Java and XML Sample Code HelloWorld: Small Sample with Label, TextField, Button, and Submit Action Java2Html | Source | XML | Screenshot HelloMac: Small Sample, showing a some Mac features. Java2Html | Source | XML | Screenshot Eventhandling: Actions and ActionCommands Java2Html | Source | XML | Screenshot Accelerators and Mnemonics Java2Html | Source | XML | Screenshot Layout Managers JGoodies FormLayout Example Java2Html | Source | XML Screenshot GridBag Layout Example Java2Html | Source | XML Screenshot Card Layout…

Read More »

Netty WebSocket 示例

代码: Server package netty.protocol.websocket.server; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpServerCodec; import io.netty.handler.stream.ChunkedWriteHandler; /** * TODO * * @description * @author ez * @time 2015年6月3日 下午4:42:31 */ public class WebSocketServer { public void run(int port) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws…

Read More »

jSSC library – for easy work with serial ports

jSSC (Java Simple Serial Connector) – library for work with serial port from Java. The library was created as a simple and reliable replacement of existing facilities. Briefly about the opportunities it provides. With jSSC you can get the port names, read and write data, control lines RTS and DTR, receive Event etc. jSSC designed to operate 24/7 multi-threaded systems and is currently successfully used in automation, data collection and recording. Now let me give a few examples of actual…

Read More »