java短连接算法后来在网上找到一个生成算法,该算法主要使用MD5 算法对原始链接进行加密(这里使用的MD5 加密后的字符串长度为32 位),然后对加密后的字符串进行处理以得到短链接的地址。原始的算法是C# 版本的,这里我把该算法修改成Java 版本的. 算法的具体……继续阅读 » 5年前 (2021-03-29) 2852浏览 209个赞
Java httpclient 设置user-agent方法hc.getParams().setParameter( HttpMethodParams.USER_AGENT, "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) Gecko/20090803");……继续阅读 » 5年前 (2021-03-29) 2044浏览 510个赞
linux下shell获得某网卡接收的字节数ifconfig eth0 | grep "RX bytes:" | cut -d: -f 2 | cut -d' ' -f 1……继续阅读 » 5年前 (2021-03-29) 4046浏览 428个赞
如果要获取命令文件(如ls)的相关路径的话,用which或者whereis #!/bin/sh### change relative path to absolute path### or get absolute path of a file### return HOME of current account if no parameter g……继续阅读 » 5年前 (2021-03-29) 1740浏览 2438个赞
linux命令行中通过ssh复制文件(scp)到远程服务器 经常需要从一台服务器复制一些文件到另一台服务器,则需要用到远程复制命令:scp如:从已登录的服务器1(192.168.1.1)复制目录/usr/a到服务器2(192.168.1.2)的/usr目录下,命令如下:scp -r……继续阅读 » 5年前 (2021-03-29) 3514浏览 1789个赞
linux为虚拟机创建虚拟网卡#!/bin/bashecho "开始创建tap0..."sudo tunctl -t tap0 -u freelhsudo ifconfig tap0 upsudo ifconfig tap0 192.168.2.1echo "启动tap0完成..."创建虚拟网卡tap……继续阅读 » 5年前 (2021-03-29) 3308浏览 1715个赞
Linux C hostent结构体 获取主机信息/**@Abstract getHostInformation*/#include <stdio.h>#include <stdlib.h>#include <netdb.h>#include <arpa/inet.h>#define N……继续阅读 » 5年前 (2021-03-29) 2219浏览 1690个赞
linux shell 通过ip138查询手机号码归属地#!/bin/bashregex="1([358][0-9]|45|47)[0-9]{4,8}"str=`echo $1|egrep ^"$regex"$`#判断输入是否是正确的手机号码格式,该字符串为空则说明格式错误if [ $# -ne 1 ];……继续阅读 » 5年前 (2021-03-29) 2000浏览 820个赞
在windows下批处理模拟linux的which命令@echo off & setlocal enabledelayedexpansionif "%1" == "" ( echo which可以查找PATH路径中是否包含指定程序 echo 用法:which 程序名 goto :ext)……继续阅读 » 5年前 (2021-03-29) 2093浏览 367个赞
当命令CMD的输出信息变化是,会弹出提示信息watch -g CMD && notify-send "output changed"……继续阅读 » 5年前 (2021-03-29) 3327浏览 2686个赞
Ruby设置CPU的Affinityrequire 'rubygems'require 'inline'# By Peter Cooper - http://www.rubyinside.com/# Oodles of inspiration and examples from# http://www-1……继续阅读 » 5年前 (2021-03-29) 2560浏览 682个赞
根据浏览器的agent判断用户的操作系统类型来确认用户是手机用户还是PC用户using System.Text.RegularExpressions;//头部引入正则的命名空间//为了加强准确性,防止支持wap的浏览器如opera,加入操作系统验证。openwave|后为pc操作系统string osPat = "mozilla|m3ga……继续阅读 » 5年前 (2021-03-29) 2962浏览 1600个赞
snv好用,但是在每个目录下生成.svn文件,要清除非常麻烦,用户下面这个脚本就简单了,赶紧收藏find . -name .svn -print0 | xargs -0 rm -rf……继续阅读 » 5年前 (2021-03-29) 3883浏览 2050个赞
Win/Mac/Linux font family for Verdana.Verdana,Geneva,Kalimati,sans-serif;……继续阅读 » 5年前 (2021-03-29) 2726浏览 1594个赞
[jQuery]两个基于jQuery的渐隐渐显图片轮换幻灯片<!DOCTYPE html><html><head><title>两个基于jQuery的渐隐渐显图片轮换幻灯片</title><style> div,ul, ol, li, h1,h2, p{margin:0;……继续阅读 » 5年前 (2021-03-26) 2428浏览 1095个赞
数据库ORM公用操作类package com.loyin.util.db;import java.io.Serializable;import java.lang.reflect.Field;import java.sql.Connection;import java.sql.DatabaseMetaData;import java.sql……继续阅读 » 5年前 (2021-03-26) 3059浏览 438个赞
Lucene开发实例代码演示,适用于一般企业类搜索服务转自:http://blog.csdn.net/sd0902/article/details/8466608package com.lucene.util;import java.io.File;import java.io.IOException;import java.util.Array……继续阅读 » 5年前 (2021-03-26) 1919浏览 2681个赞
监控服务程序实现调度算法完成nginx服务监控(从nginx配置解析出对应的服务作为监控对象之五,还有可以从数据库里读出待监控的服务)与更新服务后的监控算法: 处理休眠队列———将所有的待监控服务记录放入一个优先级队列里(休眠队列,最小堆的数据结构,堆顶为绝对间隔时间最小的,优先执行),每次只需要检查堆顶就可……继续阅读 » 5年前 (2021-03-26) 2233浏览 1413个赞
总的来说,背包问题是一种动态优化问题。 背包载重量一定,给定一组物品,没件物品有自己的价值和重量,问题要求在不超过背包载重前题下,怎样让载入的物品价值和最大?转自:http://blog.csdn.net/chang_xing/article/details/7786300 ……继续阅读 » 6年前 (2021-03-24) 3735浏览 126个赞
C++#include<iostream>using namespace std;int num[10];bool dir[10];__int64 Array[3628805];int find()//找出排列数中活跃的项{int Max=-1;int index=-1;for(int i=0;i<10;i++)……继续阅读 » 6年前 (2021-03-24) 1743浏览 2839个赞
在开发的过程中,我们通常需要在#include <errno.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <sys/stat.h>//! @brief 生成目录/*!以指……继续阅读 » 6年前 (2021-03-24) 2557浏览 1061个赞
一个滤掉C/C++风格的注释的片段/** A simple code to filter the C/C++ source code.* Copyright (c) 2007 freebsd13 <freebsd13@163.com>*/#include <iostream>using namespace……继续阅读 » 6年前 (2021-03-24) 2158浏览 1433个赞
一个完整,c++实现js.escape的代码片段string& js_escape(string &str){ setlocale(LC_CTYPE,""); wchar_t aa[1<<10]; mbstowcs(aa,str.c_str(),str.size()); wstring wcs(……继续阅读 » 6年前 (2021-03-24) 2407浏览 517个赞
修改mp3的文件名的C++代码片段////////////////////////////////////////////////////////////////////////////////////用法:命令行输入要处理的mp3所在的文件夹的地址,如果不输入默认当前目录 ////功能:修改所给文件夹下的所有的mp3的文件名字,修改是根据mp3文……继续阅读 » 6年前 (2021-03-24) 2818浏览 904个赞
快速排序c++实现//2010/12/21 20:37:26//快速排序#include <iostream>using namespace std;void sort(int array[],int zz,int yy) { int z,y,i,k; if(zz<yy) { z=zz; y=yy; ……继续阅读 » 6年前 (2021-03-24) 2657浏览 1169个赞
自删除(C++)代码 #include <windows.h>#include <stdio.h>void delete(void);int main(){int c;printf("enter "1"\n");scanf("%d",&c);if……继续阅读 » 6年前 (2021-03-24) 1713浏览 290个赞
c++实现合并排序算法#include <iostream>#include <algorithm>#include <vector>#include <ctime>#include <functional>#include <string>#include <l……继续阅读 » 6年前 (2021-03-24) 3601浏览 157个赞
实现链表数据结构 #include <iostream>using namespace std;class linklist{ private: struct node { int data; node *link; ……继续阅读 » 6年前 (2021-03-24) 2627浏览 2761个赞
C++锁定屏幕#include<windows.h>ShellExecute(this->m_hWnd,"open","rundll32.exe","USER32,LockWorkStation","",SW_SHOW);……继续阅读 » 6年前 (2021-03-24) 4452浏览 2631个赞
C++连接MYSQL数据库//下面的……继续阅读 » 6年前 (2021-03-24) 2307浏览 1114个赞
题目要求如下:给定一个数组input[],如果数组长度n为奇数,则将数组中最大的元素放到output[]数组最中间的位置,如果数组长度n为偶数,则将数组中最大的元素放到 output[] 数组中间两个位置偏右的那个位置上,然后再按从大到小的顺序,依次在第一个位置的两边,按照一左一右的顺序,依次存放剩下的数。这种处理后结果,如果按照元素的值表示一种分……继续阅读 » 6年前 (2021-03-24) 3324浏览 784个赞
题意:给你一堆颜色的气球,让你统计处什么颜色的气球数量最多,输出该颜色。Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite……继续阅读 » 6年前 (2021-03-24) 3144浏览 2032个赞
C++随机化快速排序代码#include <iostream>using namespace std;void swap(int &a,int &b){ int temp = a; a =b; b = temp;}int rand(int low,int hight){ int size = hi……继续阅读 » 6年前 (2021-03-24) 3362浏览 1569个赞
C++磁盘文件多路归并代码演示#include <iostream>#include <string>#include <algorithm>#include <time.h>using namespace std;int sort_num=10000000;int memory_size……继续阅读 » 6年前 (2021-03-24) 1785浏览 1834个赞
C++随机生成整数测试磁盘文件排序#include <iostream>#include <time.h>#include <assert.h>using namespace std;const int size=10000000;int num[size];int main(){ FILE ……继续阅读 » 6年前 (2021-03-24) 1636浏览 649个赞
输入: 一个最多有n个不重复的正整数的文件,其中每个数都小于n,且n=10^7 输出: 得到按小到大升序排列的包含所有输入的整数列表 要求: 最多有1MB内存空间可用,但磁盘空间足够。要求运行时间10秒为佳。#include <iostream>#include <bitset>#include <……继续阅读 » 6年前 (2021-03-24) 2589浏览 2937个赞
C++将字符串转换成大写、小写的函数#include <string>std::string toLower( std::string str ){ for ( int i = 0; i < str.length(); i++ ) { /* Only convert upper-case lett……继续阅读 » 6年前 (2021-03-24) 2643浏览 873个赞
Problem DescriptionGiven two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangl……继续阅读 » 6年前 (2021-03-24) 1589浏览 658个赞
下面的C++代码将用户输入的信息写入到afile.dat,然后再通过程序读取出来输出到屏幕#include <fstream>#include <iostream>using namespace std; int main (){ char data[100]; // open a file i……继续阅读 » 6年前 (2021-03-24) 1660浏览 1697个赞
C++实现超赞的解魔方的机器人代码,这段代码精简实用,作者的脑子不知道是怎么长的,厉害。/********************************************************************** * * A cube 'state' is a vector<int> with 4……继续阅读 » 6年前 (2021-03-24) 3551浏览 1842个赞
读取方式: 逐词读取, 词之间用空格区分,遇到”.”就停止读取,返回的内容存取在vector中//read data from the file, Word By Word//when used in this manner, we'll get space-delimited bits of text from t……继续阅读 » 6年前 (2021-03-24) 2566浏览 2119个赞
VC++判断指定的路径是文件还是目录//strPath为需要判断的路径//http://www.75271.comif ( GetFileAttributes(strPath) & FILE_ATTRIBUTE_DIRECTORY ){ MessageBox("Is a Directory");}else{……继续阅读 » 6年前 (2021-03-24) 3429浏览 1444个赞
可以从 GitHub project page 下载uthash下载地址:https://github.com/troydhanson/uthash uthash使用范例 Example 1.&……继续阅读 » 6年前 (2021-03-24) 3199浏览 268个赞
C++自定义函数生成不重复的随机数vector<int> getRandom(int total){ srand((int)time(NULL)); std::vector<int> input = *new std::vector<int>(); for (int i = 0; i <……继续阅读 » 6年前 (2021-03-24) 2020浏览 2826个赞
仿效百度图片首页效果依赖tuzhu_req.js/*土著人开发的common组件 @土著人 (http://www.tuzhuren.com)*/define("common:www/page/jquery/browser.js", function() { var jQuery = window.jQuery || {}……继续阅读 » 6年前 (2021-03-24) 2011浏览 1486个赞