中國壹石頭
ChinaEstone · 共 198 篇文章
Linux Shell将逗号分隔的字符串转成换行
OLD_IFS="$IFS" IFS="," arr=(`cat a.txt`) IFS="$OLD_IFS" for s in ${arr[@]} do echo $s | tr -d '"' done 将逗号分隔的字符串放到 a.txt文件,中格式:ss,21,ss, 输出格式: ss 21 xx
2016-08-19 15:23 · Linux学习资料 · Linux Tips · 评论(0)
C++实现Java中System.arrayCopy()的方法
//src[5~15]的数据复制到dest[20~29]的位置 unsignedchar*src=(unsignedchar*)malloc(20*sizeof(unsignedchar)); memset(src,10,20); unsignedchar*dest=(unsignedchar*)malloc(40*sizeof(unsignedchar)); memset(dest,2,40); unsignedchar*oldSrc=src; //movesrcposto5 for(inti=0;i<5;i++){ src++; } unsignedchar*oldDest=dest; …
2015-01-13 11:36 · 评论(0)
git clone断点续传
例如: (1): git fetch git://repo.or.cz/tomato.git 如果中途掉线,继续执行上面(1)命令 (2): git checkout FETCH_HEAD 或者git fetch git://repo.or.cz/tomato.git HEAD 参考文章:http://blog.csdn.net/cupidove/article/details/9019165
2015-01-13 11:27 · 评论(0)
生成Idea12-13版本的注册码
package com.unique.web; import java.math.BigInteger; import java.util.Date; import java.util.Random; import java.util.zip.CRC32; public class HH { /** * @param s * @param i * @param bytes * @return */ public static short getCRC(String s, int i, byte bytes[]) { CRC32 crc32 = new CRC32(); if (s != nu…
2014-12-26 12:32 · 评论(0)
何氏命名规则(Ho's Case)
button bt channel chl template tpl background bkgd delete dlt color clr 我总结下这类单词的简写 既有符合美学原理 又简单明了 归纳如下: 如果单词中包含上凸或下凹的字母(b,g,l,h,p等),那么就可以直接将单词中的这些字母抽出来,拼成单词的缩写 例如:template 中字母 t p l t 都是或高或低 视觉上比较容易观察 e m a 这种字母不高不低,不显眼,所以简写出来不美观 所以template缩写成tpl 或 tplt 既符合审美 也容易记住
2014-10-31 17:42 · 高性能服务器 · 评论(0)
线性同余随机算法实现
package com.wistone.server.core; public class MyRand { private int seed; public MyRand(int seed) { this.seed = seed; } public int next() { int next = (seed * 29 + 37) % 1000; seed = next; return next; } public static void main(String[] args) { MyRand rand = new MyRand(100); for (int i = 0; i < 100;…
2014-09-24 15:02 · Java技术 · 评论(0)
如何避免git每次提交都输入密码
vim /home/chinaestone/.git-credentials 输入内容 https://{username}:{password}@github.com 保存退出后执行下面命令 git config --global credential.helper store 执行完后 /home/chinaestone/.gitconfig 会新增一项 helper = store 这是再执行git push/pull的时候就不会在要求你输入密码了。别问我 为什么不用ssh?没有为什么,就是不用。
2014-08-07 13:12 · Linux学习资料 · 评论(0)
测试udp端口是否打开
nc -vuz 192.168.2.152 9386 显示 Connection to 192.168.2.152 9386 port [udp/*] succeeded! 端口开启
2014-07-09 13:51 · Linux Tips · 评论(0)
crontab任务显示问题
crontab -l显示出来的内容和/etc/crontab中配置的内容是不一样的 虽然两个编辑的任务都可以在crontab中执行。
2014-06-27 15:27 · 评论(0)
Java Pass By Value Example
package author.estone.java; import java.util.Date; public class PassByValue { public static void main(String[] args) { Date d1 = new Date("1 Apr 98"); nextDateUpdate(d1); System.out.println("d1 after nextDay: " + d1);// date的值已被修改 Date d2 = new Date("1 Apr 98"); nextDateReplace(d2); System.out.prin…
2014-05-03 09:32 · Java技术 · 评论(0)
golang first network program example code (for archvie)
package main import "fmt" import "net" import "net/http" import "net/url" //import "bufio" import "io/ioutil" import "bytes" import "encoding/binary" //import "compress/gzip" //import "testing" import "encoding/json" import b64 "encoding/base64" //import ( // //"code.google.com/p/mahonia" // "fmt" …
2014-04-25 11:08 · 高性能服务器 · 评论(0)
How to use git in eclipse ?
when we use git in eclipse, when we commit the project ,sometimes will ignore the .project,.classpath and etc othe files . but when we import the project from the git repo ,the project will not import as an general java project. how to solve this problem? first, git clone the repo from remote git s…
2014-04-20 11:03 · Java技术 · 评论(0)
Generic marshalling with Google Protocol Buffers
Protobuf解析时 不能使用通用解析方法 无法使用消息的多态性问题的临时解决办法 http://planet.jboss.org/post/generic_marshalling_with_google_protocol_buffers Protobuf的继承使用的java实现 http://blog.wolfman.com/articles/2011/11/23/how-to-implement-polymorphic-protocol-buffers-in-java http://www.indelible.org/ink/protobuf-polymorphism/
2013-11-23 21:51 · 高性能服务器 · 评论(0)
java nio netty资料
http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf http://www.kafka0102.com/2010/06/167.html ioc http://www.martinfowler.com/articles/injection.html
2013-09-28 14:55 · 评论(0)