- 博客(33)
- 收藏
- 关注
转载 代码笔记 | java 正则表达式高级篇(四种常用的处理方式:匹配 分割 替代 获取)
package test; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 正则表达式 * 正则表达式 的用法主要是4种方面的使用 * 匹配,分割,替换,获取. * 用一些简单的符号来代表代码的操作 * @author cyc * */p
2016-09-12 17:41:58
840
转载 代码笔记 | PHP支持断点续传,分块下载的类
<?php /** * User: djunny * Date: 2016-04-29 * Time: 17:18 * Mail: 199962760@qq.com * 支持断点下载的类 */class downloader { /** * download file to local path * * @param $u
2016-09-12 17:40:30
607
转载 代码笔记 | java实现牛顿插值法
import java.util.Scanner; public class Newton_interpolation { /*拷贝向量*/ private static void copy_vector(double from[],double to[]){ int k=from.length; int k2=to.length;
2016-09-02 14:00:22
3242
转载 代码笔记 | java实现高斯赛德尔算法解线性方程组
package linear_equation; import java.util.Scanner; /*使用高斯赛德尔迭代法求解线性方程组*/public class Gauss_Seidel_Iterate { /*求下三角*/ private static float[][] find_lower(float data[][],int k){ i
2016-09-02 13:59:21
1375
转载 代码笔记 | 最短路径算法
import java.util.Scanner;public class ShortestPath{ public static void main(String args[]){ int iCase; Scanner input=new Scanner(System.in); System.out.pr
2016-09-02 13:57:30
399
转载 代码笔记 | 宽度与屏幕相等,高度根据图片拉伸后做适配
public class ScaleScreenImageView extends ImageView { public ScaleScreenImageView(Context context) { super(context); } public ScaleScreenImageView(Context context, At
2016-09-02 13:54:46
460
转载 代码笔记 | BP神经网络的C语言代码
#include#include#include#include typedef enum {CUSTOM,SIGMOD} ActionType; typedef double(*Function)(double); typedef struct { int cbSize; //神经网络所占用的内存空间 int szLayer;
2016-09-01 18:29:50
1782
转载 代码笔记 | 哥德巴赫猜想的计算机验证
## 哥德巴赫猜想的计算机验证 prime_table = list()prime_table.append(2) # Check if n is a prime based on existing primedef is_prime(n): for i in prime_table: if n%i == 0 and n/i > 1:
2016-09-01 18:28:15
1782
转载 代码笔记 | 微信红包算法
/**生成红包的函数*/function getRandMoney($totalMoney, $totalPeople=2, $miniMoney=1){ $randRemainMoney = $totalMoney - $totalPeople * $miniMoney;//剩余需要随机的钱数 return _getRandMoney($randRemai
2016-09-01 18:26:57
753
转载 代码笔记 | PHP实现N*M的字符矩阵90度旋转
<?php //1、提取a.txt文件内容 $str = file_get_contents("a.txt"); //2、将str里面的内容转换成二维数组 $arr1 = preg_split("/\\n/", $str); for ($i=0;$i<count($arr1);$i++){ $arr2[$i] = preg_split("/,/
2016-09-01 18:24:58
1326
转载 代码笔记 | TCP 组包和拆包算法
/*************************************文件名: server.cTCP 组包和拆包实现算法 */#include #include #include #include #include #include #include #include #include #define BUF_SIZE 1024*
2016-09-01 18:23:40
1703
转载 代码笔记 | 洗牌算法
/// /// 洗牌算法/// private void test(){ int[] iCards = new int[54]; for (int i = 0; i < iCards.Length; i++) { iCards[i] = i + 1; } // Random rand = new Random(); i
2016-09-01 18:22:49
387
转载 代码笔记 | 一个简单的游戏框架
#include#include#include#include#includeint x,y,hp,hpmax,misson;int exp,lv,gold;char mapdata[60][25];char name[10];void startmov();void menu();void createpsn();void loadpsn();void psnmenu
2016-09-01 18:20:04
604
转载 代码笔记 | jquery 测试密码的强度
//下面的正则表达式建议各位收藏哦,项目上有可能会用得着$(function(){ $('#pass').blur(function(e) { // alert('---------'); //密码为八位及以上并且字母数字特殊字符三项都包括 var strongRegex = new RegExp("^(?=.{8,})(?=.
2016-09-01 18:15:54
358
转载 代码笔记 | Echart显示或导出图片
接收Echar生成的Base64数据,转换为图片或生成下载。 using System;using System.Web;using System.Data;public class ExportImg : IHttpHandler{ public void ProcessRequest(HttpContext context) { try
2016-09-01 18:14:09
1978
转载 代码笔记 | Perl生成随机生成密码
#!/usr/bin/perluse strict;use warnings;use Getopt::Std;sub show_help { print "Useage:\\n"; print "newp -aAnsl\\n"; print "-a\\t\\t the password contains lower case letters(a-z)\\n";
2016-09-01 18:12:24
622
转载 代码笔记 | Redis的使用
public class RedisClient { public static Logger log = Logger.getLogger(RedisClient.class); /** * jedis 连接池 */ private static JedisPool jedisPool; @Resource public void setJedis
2016-09-01 18:03:06
331
转载 代码笔记 | 用C#实现跟CI里面的加密解密
using System;using System.Text;using System.IO;using System.Security.Cryptography; namespace CI{ class CI_Encrypt { private string key; private string hash_type = "sha1"
2016-09-01 18:01:29
389
转载 代码笔记 | 填写验证码倒计时60秒
//点击验证码的方法 var countdown = 60; function settime(obj) { if (countdown == 59) { //发送验证码的主代码 } if (countd
2016-09-01 17:59:30
672
转载 代码笔记 | 多线程使用queue模块同步访问共享数据
import threading,queue,timenumproducer=4nummessages=4numconsumer=2 dataQueue=queue.Queue()safeprint=threading.Lock() def producer(i,dataQueue): for msg in range(nummessages):
2016-09-01 15:28:33
464
转载 代码笔记 | js数组实现图片自动轮播
使用数组实现图片自动轮播 #main{ width: 700px; height: 450px; margin: 0 auto; text-align: center; } var curIndex = 0; var timeInterval = 1000; var arr = new
2016-09-01 15:24:19
1038
转载 代码笔记 | 定位导航效果
定位导航效果 * { margin: 0; padding: 0; } body { font-size: 12px; line-height: 1.7; } li { list
2016-09-01 15:23:00
362
转载 代码笔记 | 自动爬取百度贴吧的网页
import string,urllib2def baidu(url,bp,ep): for i in range(bp,ep+1): sName=string.zfill(i,5)+'.html' print 'Download' + str(i) + 'page,store named' + sName + '......' f=ope
2016-09-01 15:21:14
401
转载 代码笔记 | 一个用python实现的简单的文件服务器
#!/usr/bin/env python3"""实现客户端和服务器端逻辑,通过套接字从服务器传输任意文件到客户端;使用一个简单的控制信息协议,而不是单独的套接字,用于控制和数据(如在ftp上)分派每个客户端请求到一个线程处理,通过分块,循环传输整个文件;"""import sys,os,timeimport _thread as threadfrom socket import
2016-09-01 15:18:36
710
原创 代码笔记 | TCP网络协议编程实现
/******* 服务器程序 (server.c) ************/#include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int so
2016-09-01 15:16:21
663
原创 代码笔记 | UDP编程实现
/********** server.***********/#include #include #include #include #include #include #include #include #include #include #include #define SERVER_PORT 8000 #define BUFFER_SIZE 1024 #
2016-09-01 15:09:02
837
转载 代码笔记 | 图灵聊天机器人API调用
HttpWebResponse Response = null;public string ConnectTuLing(string p_strMessage){ string result = null; try { //注册码 String APIKEY = "apikey"; String _strMessage =
2016-09-01 15:07:30
713
转载 代码笔记 | ajax实现服务器与浏览器长连接的功能
var uid = "{$uid}"; var i = 0; var timer; $().ready(function(){ //打开扫码登录模态框 $('#login').click(function(){ //如果用户已经登录,则返回 if(uid){ r
2016-09-01 15:05:27
385
转载 代码笔记 | Python抓取并保存美女图片集
import requestsfrom bs4 import BeautifulSoupimport randomfrom datetime import dateimport osimport threadingimport sys,reheaders={ "Referer":"http://www.mm131.com/", "User-Agent"
2016-09-01 14:59:20
14295
转载 代码笔记 | zeromq 的 router学习分析
// lbbroker_cpp.cpp : 定义控制台应用程序的入口点。///**************************************************************技术博客http://www.cnblogs.com/itdef/*************************************************************
2016-09-01 14:57:15
499
转载 代码笔记 | 基于Python的净值数据接口调用代码实例
#!/usr/bin/python# -*- coding: utf-8 -*-import json, urllibfrom urllib import urlencode #----------------------------------# 净值数据调用示例代码 - 聚合数据# 在线接口文档:http://www.juhe.cn/docs/25#------------
2016-09-01 14:55:45
509
转载 代码笔记 | 网站微信登录
<?php//处理并返回微信用户信息类class wx{ //配置APP参数 private $appid = ''; private $secret = ''; private $re_url = ''; private $state = 'state'; private $acces
2016-09-01 14:53:21
524
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人