随笔分类 - 编程技巧
C、C++、Java、Python、Lua等编程语言的使用方法和技巧。
摘要:package demo.future; import java.util.ArrayList;import java.util.List;import java.util.concurrent.*; /** * 试验 Java 的 Future 用法 */public class FutureTe...
阅读全文
摘要:Nginx的反向代理通常用来映射内网中提供的Apache、IIS、Lighttpd服务,以实现负载均衡;同时,由于动态服务程序运行在内网,服务器的整体安全性也有所提高,那么怎样用nginx设置SSL的反向代理呢?使用nginx设置SSL的优点不少:易用性:nginx安装、升级简单,nginx的平滑升...
阅读全文
摘要:引言: 在JQuery的Ajax POST请求中,进行请求,其中的中文在后台,显示为乱码,该如何解决呢?问题的引入: var regid = $('#oregion').combobox('getValue'); //var sname = $('#sname').val(); var sname ...
阅读全文
摘要:public static ConfigurableApplicationContext context = null; public static void main( String[] args ) throws Exception { //1. start ...
阅读全文
摘要:import java.io.File;import javax.servlet.Servlet;import lombok.extern.slf4j.Slf4j;import org.springframework.boot.autoconfigure.AutoConfigureAfter;imp...
阅读全文
摘要:.btn-warning { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #faa732; background-image: -moz-linear-gradient(top,#fbb450,...
阅读全文
摘要:import java.util.ArrayList;import java.util.HashMap;import java.util.regex.Matcher;import java.util.regex.Pattern;import lombok.AllArgsConstructor;imp...
阅读全文
摘要:原先的字串./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-zip --enable-calendar --with-mysql=/usr/local/mysql --with-...
阅读全文
摘要:http://www.ibm.com/developerworks/cn/linux/l-gperf.html命令行处理和 gperf 的作用命令行处理一直以来都是软件开发中最容易被忽视的领域。几乎所有比较复杂的软件都具有一些可用的命令行选项。事实上,大量if-else语句经常被用来处理用户输入,因...
阅读全文
摘要:http://blog.csdn.net/span76/article/details/11473315有时候我们不关注程序是否有界面(比如自动化测试),只要程序在运行就可以了很感谢 xvfb 这个工具给我们提供了相关的功能
阅读全文
摘要:【原文】http://blog.csdn.net/wildfireli/article/details/19829479Charles是目前最强大的http调试工具,在界面和功能上远强于Fiddler,同时是全平台支持,堪称圣杯级工具,唯一的缺陷是这货是收费的,而且是要¥50美元大洋…当然网上是有破...
阅读全文
摘要:在arena_s结构中,由NBINS数组将bin按照不同规模等级分别存储,每一个等级对应一颗run树,即一颗以chunk_map_t为节点的红黑树,而这些chunk_map_t节点实际分布于各个chunk的chunk_map_t数组中(每个chunk缺省为4M大小),由于chunk其实地址是chun...
阅读全文
摘要:在当期用户的主目录下创建文件.vimrc,打开编辑内容(~/.vimrc):filetype onsyntax on
阅读全文
摘要:在调用arena_malloc_small过程中,要根据申请内存大小,进行对齐计算,然后分配一个整块儿。算法如下:1)定义一个SIZE_CLASSES宏,它主要用于生成后面两个表,small_size2bin与arena_bin_info数组;2)根据small_size2bin查找当前申请内存块大...
阅读全文
摘要:一、5种malloc方法1)tcache_alloc_small2)arena_malloc_small3)tcache_alloc_large4)arena_malloc_large5)huge_malloc//written in jemalloc_internal.h fileimalloct...
阅读全文
摘要:一、利用select多路复用I/O的Web服务应用模型/* 可读、可写、异常三种文件描述符集的申明和初始化。*/ fd_set readfds, writefds, exceptionfds; FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptionfds); int max_fd; /* socket配置和监听。*/ sock = socket(...); bind(sock, ...); listen(sock, ...); /* 对socket描述符上发生关心的事件进行注册。*/ FD_SET(&r
阅读全文
摘要:#include #include int main(){ FILE* stream = popen ("sort", "w"); fprintf (stream, "This is a test.\n" ); fprintf (stream, "Hello, world.\n"); fprintf (stream, "My dog has fleas.\n"); fprintf (stream, "This program is great.\n"); fprintf (s
阅读全文
摘要:#include #include #include #include int main(){ int fds[2]; pid_t pid; pipe( fds ); pid = fork(); if( pid == (pid_t)0 ) { close( fds[1] ); dup2(fds[0], STDIN_FILENO ); execlp( "sort", "sort", 0 ); } ...
阅读全文
摘要:#include #include #include int main (){int segment_id;char* shared_memory;struct shmid_ds shmbuffer;int segment_size;const int shared_segment_size = 0x6400;/* Allocate a shared memory segment. */segment_id = shmget (IPC_PRIVATE, shared_segment_size,IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);/* Attach
阅读全文
摘要:Shared memory permits processes to communicate by simply reading and writing to a specified memory location.Mapped memory is similar to shared memory, except that it is associated with a file in the filesystem.Pipes permit sequential communication from one process to a related process.FIFOs are simi
阅读全文