/** 密码发生器 在对银行账户等重要权限设置密码的时候,我们常常遇到这样的烦恼:如果为了好记用生日吧,* 容易被破解,不安全;如果设置不好记的密码,又担心自己也会忘记;如果写在纸上,担心纸张被别人发现或弄丢了…* 这个程序的任务就是把一串拼音字母转换为6位数字(密码)。* 我们可以使用任何好记的拼音串(比如名字,王喜明,就写:wangx……继续阅读 » 水墨上仙 8年前 (2017-07-11) 2800浏览 324个赞
//// main.c// test1//// Created by yt on 2017/.// Copyright © 2017年 yt. All rights reserved.//#include <stdio.h>#include <time.h>#include <stdlib.h>……继续阅读 » 开心洋葱 8年前 (2017-07-08) 3060浏览 0评论202个赞
golang日志记录库简单使用方法范例package mainimport ( "fmt" "log" "os")func main(){ logfile,err := os.OpenFile("/var/golang/75271.com.log",……继续阅读 » 水墨上仙 8年前 (2017-07-04) 2613浏览 2160个赞
Methods with the same name as their class will not be constructors in a futusupports_collation is deprecated since version 3.5.0! Use wpdb::has_cap( ‘collation’ ) inst……继续阅读 » 开心洋葱 8年前 (2017-06-16) 2488浏览 0评论2143个赞
Java求1000以内的水仙花数打印出所有的 “水仙花数 “,所谓 “水仙花数 “是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个 “水仙花数 “,因为153=1的三次方+5的三次方+3的三次方。public class 水仙花数 { public static v……继续阅读 » 水墨上仙 8年前 (2017-06-09) 3169浏览 2122个赞
Temporary breakpoint 2 at 0x100000ef4: file sort_select.c, line 30.Starting program: /Users/yt/Documents/CodeProj/c/sort_select During startup program terminated with signal SIG1……继续阅读 » 开心洋葱 8年前 (2017-06-04) 1540浏览 0评论2951个赞
字符串编辑距离 这是一种字符串之间相似度计算的方法。 给定字符串S、T,将S转换T所需要的插入、删除、替代操作的数量叫做S到T的编辑路径。 其中最短的路径叫做编辑距离。 这里使用了一种动态规划的思想求编辑距离。package com.mycompany.project;/** * 字符串编辑距离 * * 这是一种字符串之间相似度计算的方法……继续阅读 » 水墨上仙 8年前 (2017-06-04) 1486浏览 2959个赞
二、编译警告:warning C4996 与 Security Enhancements in the CRT将过去的工程用VS2005打开的时候。你有可能会遇到一大堆的警告:warning C4996。比如:warning C4996: ‘strcpy’: This function or variable may be un……继续阅读 » 开心洋葱 8年前 (2017-06-02) 2123浏览 0评论2883个赞
用样式控制网页部分区域不被打印,我们经常需要在打印的网页上面放置一个打印按钮,如何让这个按钮不被同时打印出来,可以用一句样式解决。定义如下样式.noprint{display:none;} 只需要给不想打印的标签贴上noprint的class就可以了 <div class="noprint"> <i……继续阅读 » 水墨上仙 8年前 (2017-06-01) 2772浏览 2264个赞
打印出所有的 “水仙花数 “,所谓 “水仙花数 “是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个 “水仙花数 “,因为153=1的三次方+5的三次方+3的三次方。public class exp2{ public static void main(Strin……继续阅读 » 水墨上仙 8年前 (2017-05-31) 2758浏览 1362个赞
C语言回溯法解决背包问题#include #include #include using namespace std;#define MAXN 10struct Goods_Info{ int v; //价值 int w; //重量 double vw; //价值重量比}goods[MAXN];int n;……继续阅读 » 水墨上仙 8年前 (2017-05-31) 3068浏览 2242个赞
100 可以表示为带分数的形式:100 = 3 + 69258 / 714 还可以表示为:100 = 82 + 3546 / 197 注意特征:带分数中,数字1~9分别出现且只出现一次(不包含0)。 类似这样的带分数,100 有 11 种表示法。#include#include/*检查某个数是否出现重位的情况,可以与nKill整合,但这儿单独列出*……继续阅读 » 水墨上仙 8年前 (2017-05-31) 2296浏览 2082个赞
JS代码返回iframe的name属性(名称)<!DOCTYPE html><html><body><iframe id="myframe" src="/default.asp" name="myframe"><p>……继续阅读 » 水墨上仙 8年前 (2017-05-31) 3244浏览 1451个赞
0-1背包问题:给定n种物品和一背包.物品i的重量是wi, 其价值为ui,背包的容量为C. 问如何选择装入背包的物品,使得装入背包中物品的总价值最大? 分析: 0-1背包是子集合选取问题,一般情况下0-1背包是个NP问题. 第一步 确定解空间:装入哪几种物品 第二步 确定易于搜索的解空间结构: 可以用数组p,w分别表示各个物品价值和重量。 用数组x记录,是否……继续阅读 » 水墨上仙 8年前 (2017-05-31) 2753浏览 2317个赞
$file = Input::file(‘myfile’);if($file -> isValid()){ //检验一下上传的文件是否有效.$clientName = $file -> getClientOriginalName();$tmpName = $file ->getFileName(); // 缓存……继续阅读 » 开心洋葱 8年前 (2017-05-31) 2839浏览 0评论1254个赞
Input输入 输入设备(如按键,键盘,触摸屏,鼠标等)是典型的字符设备,其一般的工作机制是低层在按键,触摸等动作发生时产生一个中断(或驱动通过timer定时查询),然后cpu通过SPI,I2C或者外部存储器总线读取键值,坐标等数据,放一个缓冲区,字符设备驱动管理该缓冲区,而驱动的read()接口让用户可以读取键值,坐标等数据。 Linux 输入子……继续阅读 » 开心洋葱 8年前 (2017-05-29) 2232浏览 0评论2584个赞
通过JS代码控制iframe居左或者居右显示,下面的代码控制iframe居右显示,如果希望居左显示,只需要将right改成left即可<!DOCTYPE html><html><body><p>This is some text. This is some text. This is so……继续阅读 » 水墨上仙 8年前 (2017-05-27) 2867浏览 1963个赞
如果希望通过按钮动态修改iframe的高度和宽度,可以参考下面的JS代码<!DOCTYPE html><html><head><script>function changeSize(){document.getElementById("myframe").hei……继续阅读 » 水墨上仙 8年前 (2017-05-27) 2951浏览 1289个赞
Java使用逆波兰表达式算法制作的表达式计算器package com.infogrid.g2b; import java.util.HashMap; import java.util.Map; public class Op { private static final Ma……继续阅读 » 水墨上仙 8年前 (2017-05-27) 1721浏览 1615个赞
下面的代码可以用来去除iframe的滚动条<!DOCTYPE html><html><head><script>function removeScroll(){document.getElementById("myframe").scrolling="……继续阅读 » 水墨上仙 8年前 (2017-05-27) 2450浏览 1326个赞
============================================================GeoHash PHP ClassProvides a class for generating and decoding geohashes asdocumented at http://en.wikipedia.org/wiki/……继续阅读 » 开心洋葱 8年前 (2017-05-22) 2482浏览 0评论560个赞
php按单词截取字符串的代码,指定字符串和单词数量进行截取<?phpfunction limit_words($string, $word_limit){ $words = explode(" ",$string); return implode(" ",array_splice($……继续阅读 » 水墨上仙 8年前 (2017-05-09) 2507浏览 919个赞
php生成随机密码的函数function auth_pwgen(){ $pw = ''; $c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones $v = 'aeiou'; ……继续阅读 » 水墨上仙 8年前 (2017-05-09) 2591浏览 1266个赞
php检查要包含的文件是否存在可读……继续阅读 » 水墨上仙 8年前 (2017-05-09) 2242浏览 2684个赞
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: AuthTest::testLoginPageFacebook\WebDriver\Exception\WebDriverC……继续阅读 » 开心洋葱 8年前 (2017-05-08) 2701浏览 0评论451个赞
如果文件大小为字节单位的,阅读起来不方便,这个函数可以把字节单位转换成KB,MB,GB,TB等单位,方便阅读function ByteSize ( $file_size ){ $file_size = $file_size-1; if ($file_size >= 1099511627776) $show_filesize = nu……继续阅读 » 水墨上仙 8年前 (2017-05-05) 3088浏览 2269个赞
php将文件夹下的所有图片放入数组function listImages($dirname=".") { $ext = array("jpg", "png", "jpeg", "gif"); $files = array(); ……继续阅读 » 水墨上仙 8年前 (2017-05-05) 1897浏览 2443个赞
指定一个文件夹,在php里include这个文件夹下的所有.php文件foreach (glob("*.php") as $filename) { include($filename);}……继续阅读 » 水墨上仙 8年前 (2017-05-05) 2970浏览 1237个赞
php检测浏览器类型代码// Simple browser detection$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = false; if (strpos($_SERVER['HTTP_U……继续阅读 » 水墨上仙 8年前 (2017-05-05) 1452浏览 1597个赞
php动态生成表单代码<?php define('VALID_NOT_EMPTY', '/.+/'); define('VALID_EMAIL', "/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&&……继续阅读 » 水墨上仙 8年前 (2017-05-04) 2702浏览 318个赞
php动态改变图片尺寸后输出,输出图片时使用下面的地址:image_resize.php?img=image.jpg&w=150&h=150&constrain=1w和h为要显示的尺寸 0) { // calculate resized height and width if percent is defined ……继续阅读 » 水墨上仙 8年前 (2017-05-04) 1227浏览 1947个赞
php不破坏单词截取子字符串的方法/* snippet(phrase,[max length],[phrase tail]) snippetgreedy(phrase,[max length before next space],[phrase tail]) */ function snippet($text,$le……继续阅读 » 水墨上仙 8年前 (2017-05-04) 1360浏览 2835个赞
php 将数组转换成xml的类class ArrayToXML{ /** * The main function for converting to an XML document. * Pass in a multi dimensional array and this recrusively loops through and bu……继续阅读 » 水墨上仙 8年前 (2017-05-03) 2408浏览 2337个赞
Migration table not found.Migration table created successfully. [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was ……继续阅读 » 开心洋葱 8年前 (2017-04-24) 1902浏览 0评论1586个赞
(node:23771) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.> node-sass@3.13.1 ins……继续阅读 » 开心洋葱 8年前 (2017-04-22) 2773浏览 0评论2820个赞
You can however run a command with sudo using –allow-root optionError: post install error, please remove node_modules before retry!Run “sh -c bower install &……继续阅读 » 开心洋葱 8年前 (2017-04-22) 2974浏览 0评论831个赞
Do not run Composer as root/super user! See https://getcomposer.org/root for detailsLoading composer repositories with package informationInstalling dependencies (including requi……继续阅读 » 开心洋葱 8年前 (2017-04-22) 1691浏览 0评论2630个赞
堆栈计算逆波兰式使用C语言实现逆波兰式(Reverse Polish notation,RPN,或逆波兰记法),也叫后缀表达式(将运算符写在操作数之后)一个表达式E的后缀形式可以如下定义:(1)如果E是一个变量或常量,则E的后缀式是E本身。(2)如果E是E1 op E2形式的表达式,这里op是如何二元操作符,则E的后缀式为E1’E2……继续阅读 » 水墨上仙 8年前 (2017-04-20) 1277浏览 984个赞
通过JS代码提交(submit)表单,将提交按钮的类型设置为普通button,然后添加onclick属性 <!DOCTYPE html><html><head><script>function formSubmit(){document.getElementById("frm……继续阅读 » 水墨上仙 8年前 (2017-04-20) 2867浏览 1688个赞
下面的JS代码删除了iframe的frameBorder,iframe就没有了明显的边框显示 <!DOCTYPE html><html><head><script>function removeBorder(){document.getElementById("myframe……继续阅读 » 水墨上仙 8年前 (2017-04-20) 1824浏览 2469个赞
Go语言操作redis的代码演示/** * Created with IntelliJ IDEA. * User: happyonion * Date: 17-1-6 * Time: 上午10:58 */package mainimport ( "fmt" "log" &quo……继续阅读 » 水墨上仙 8年前 (2017-04-16) 1681浏览 2224个赞
fmt.Sscanf科学计数法示例package mainimport "fmt"func main() { var ( old = "75271.0000002e+19" new float64 ) n, err := fmt.S……继续阅读 » 开心洋葱 8年前 (2017-04-14) 1836浏览 0评论2732个赞
创建,添加到PHP中的数组里$MyArray = array(); do { $MyArray[] = $row_rsMyRecordset['MyField'];} while ($row_rsMyRecordset = mysql_fetch_assoc($rsMyRecordset));pr……继续阅读 » 开心洋葱 8年前 (2017-04-14) 1689浏览 0评论2914个赞
Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.js遇到这种问题解决办法,目前还没有解决,知道的小伙伴可以在评论区留言,找到答案后……继续阅读 » 开心洋葱 8年前 (2017-04-14) 2198浏览 1评论2320个赞
判断给定的数是否是回文数Java使用StringBuffer的reverse方法实现回文数是指一个像16461这样“对称”的数,即:将这个数的数字按相反的顺序重新排列后,所得到的数和原来的数一样。import java.util.*; public class PalindromeV2{ public static void main(……继续阅读 » 水墨上仙 8年前 (2017-04-13) 1809浏览 1700个赞