js搜索字符串,成功后返回找到的字符串-JavaScript字符串带有一个match方法用于搜索字符串,如果找到指定的字符串则返回搜索字符串,如果未找到则返回null,match方法区分大小写var str="Hello world!";document.write(str.match("worl……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2203浏览 2211个赞
js代码输出当前时间Unix时间戳-JavaScript语言下面的代码通过Date对象的getTime()放回unix时间戳,即从1970年1月1日到当前时间的秒数<p id="demo">Click the button to display the number of milliseconds si……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1800浏览 1331个赞
js将当前时间转换为标准UTC时间-JavaScript代码,北京在东八区,在北京时间基础上减掉8小时<p id="demo">Click the button to display the UTC date and time as a string.</p><button>……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2358浏览 1212个赞
C#使用TextReader从文本类型文件读取数据TextReader reader = File.OpenText(@"C:\data\file.xml"); // Read a line at a time until we reach the end of filewhile (reader.Peek( ) != ……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1445浏览 1104个赞
在Linux系统里使用C语言获取所有网卡信息的方法#include #include #include #include #include int main(){ struct ifreq ifr; struct ifconf ifc; char buf[2048]; int succ……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1294浏览 1445个赞
使用JavaScript语言创建数组的方法,下面的代码演示了在JS中如何创建数组并赋值,然后对数组进行循环遍历输出var i;var mycars = new Array();mycars[0] = "Saab";mycars[1] = "Volvo";mycars[2] = ……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2756浏览 417个赞
在JavaScript代码中让contact函数合并两个数组下面的代码演示了JS中如何将两个数组连接成一个数组<p id="demo">Click the button to join three arrays.</p><button>Try it</button&……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2190浏览 2981个赞
怎么样用JavaScript的alert显示带换行的警告对话框JavaScript的alert对话框如果需要换行的话可以在字符串中加入\n即可<p>Click the button to demonstrate line-breaks in a popup box.</p><button>T……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2884浏览 2340个赞
使用JavaScript语言获取iframe的longdesc属性<p>Your browser does not support iframes.</p><p>The URL of the long description is:document.write(document……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2996浏览 544个赞
JavaScript中可以使用confirm弹出一个确认对话框,用户可以点击ok或者cancel,JS可以接收到用户点击的按钮<p>Click the button to display a confirm box.</p><button>Try it</button>&l……继续阅读 » 水墨上仙 8年前 (2017-03-30) 3068浏览 1844个赞
C#代码实现穿过代理服务器取远程用户真实IP地址 if(Request.ServerVariables["HTTP_VIA"]!=null){ string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); ……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1565浏览 2555个赞
python API接口调用示例代码#!/usr/bin/python# encoding:utf-8 import urllib2, json, urllib data = {}data["appkey"] = "your_appkey_here"data["word……继续阅读 » 开心洋葱 8年前 (2017-03-30) 2235浏览 0评论356个赞
这段代码用来判断ie的版本,不同的版本调用不同的样式<!-- [if IE]>-->According to the conditional comment this is Internet Explorer<!-- [if IE 5]>-->According to the conditional ……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2674浏览 178个赞
一个构造sql语句的类/*** @package Database Class* @author injection (mail:injection.mail@gmail.com)* @version 1.0*/@ini_set( 'display_errors',0 );class DataBas……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1941浏览 153个赞
js提示用户输入对话框prompt使用代码演示使用JavaScript代码Click the button to demonstrate the prompt box.Try itfunction myFunction(){var x;var person=prompt(“Please enter your name”,&……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2302浏览 123个赞
简单的HTTP服务器用Java代码实现import java.net.*;import java.nio.ByteBuffer;import java.nio.channels.*;import java.nio.charset.*;import java.util.concurrent.*;import java.io.*;……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2577浏览 1347个赞
小程序2048游戏-微信小程序游戏源码小程序2048游戏源码下载地址:……继续阅读 » 开心洋葱 8年前 (2017-03-30) 1507浏览 0评论1870个赞
经典打飞机游戏 – 微信小程序打飞机游戏源码小程序打飞机游戏下载链接: 链接: http://pan.baidu.com/s/1kVfYghL 密码: ……继续阅读 » 开心洋葱 8年前 (2017-03-30) 1841浏览 5评论2187个赞
php代码实现从电子邮件中抽取一个字符串function extract_emails($str){ // This regular expression extracts all emails from a string: $regexp = '/([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+(……继续阅读 » 水墨上仙 8年前 (2017-03-30) 2024浏览 1301个赞
go代码使用 fmt.Sscanf()实现转换科学计数的例子,但是只能转换成int型package mainimport "fmt"func main() { var ( old = "1.00000023e+06" new float64 ) n, err := fmt.Ss……继续阅读 » 水墨上仙 8年前 (2017-03-30) 263808浏览 254个赞
JavaScript添加监控事件 addEventListner// addEventListener polyfill 1.0 / Eirik Backer / MIT Licence(function(win, doc){ if(win.addEventListener)return; //No need to polyfill func……继续阅读 » 水墨上仙 8年前 (2017-03-30) 1312浏览 1196个赞
python作为脚本语言根据类名字符生成类实例非常简单,类似java的Class.forNamepython是一个脚本语言,它不象java一样有一个专门的包来处理反射。以 下是我们来看看python是怎么做到类似java一样的反射功能的。我在网上搜了一下,因为在网上没有很明确的文章说要怎么做,所以,我写了这篇,希望 新手不要……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2678浏览 2334个赞
微擎排行榜游戏合集-微赞营销游戏排合集 摇骰子吧抽奖hl_bbb-微擎微赞通用功能游戏模块http://www.75271.com/709.html 免费html5微信游戏 端午节微信小游戏粽子大战源码类似微信打飞机..http://www.75271.com/676.html俄罗斯方块wdl_cube-微擎微赞好玩的微游……继续阅读 » 开心洋葱 8年前 (2017-03-29) 2489浏览 0评论2423个赞
Java代码实现7种将字符串反转的效果import java.util.Stack;public class StringReverse { public static String reverse1(String s) { int length = s.length(); if (length <= 1) retu……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2518浏览 2697个赞
可以通过userAgent判断是否是微信的客户端打开的网页function is_weixn(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { ……继续阅读 » 水墨上仙 8年前 (2017-03-29) 3097浏览 1209个赞
go语言将golang的科学计数值转换为相应字符串,使用 fmt格式输出package mainimport "fmt"func main() { n := fmt.Sprintf("%.2f", 1.00000027e+06) fmt.Println(n)}……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2445浏览 2064个赞
没有一个具体的网址,但是有时候我们希望浏览器显示一个没有任何内容的网页,可以使用about:blank来显示空白页面。代码很简单,只要在浏览器地址栏输入下面的代码,则浏览器会显示一个空白网页about:blank……继续阅读 » 水墨上仙 8年前 (2017-03-29) 1682浏览 2834个赞
python中获取汉字首字母#!/usr/bin/env python# -*- coding=utf-8 -*-# File Name : pinyin.py# Author : 开心样# Site : 75271.com# Create Time : 2017/03/29 21:37:39def multi_get……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2887浏览 2379个赞
//PHP代码函数实现PHP发送短信功能//本代码基于开心洋葱 运行//代码来源:开心洋葱//PHP发送短信开心洋葱专用(PHP代码函数)//本代码基于开心洋葱 运行//代码来源:开心洋葱 function sms($config,$language,$pdo,$sender,$phone_number,$content){ ……继续阅读 » 水墨上仙 8年前 (2017-03-29) 1489浏览 2294个赞
//PHP代码函数实现https_post提交//代码来源:开心洋葱//https_post提交(PHP代码函数)//代码来源:开心洋葱 function https_post($url,$data){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); ……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2069浏览 184个赞
//PHP代码函数 CURL获取网页//代码来源:开心洋葱//CURL获取网页(PHP代码函数)//代码来源:开心洋葱function curl_open($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURL……继续阅读 » 水墨上仙 8年前 (2017-03-29) 1761浏览 1187个赞
sass scss rem计算公式$root-font-size: 20; // 根字体大小@function getRem($val) { @return $val / $root-font-size + rem;}div { width: getRem(40); // width: 2rem; // 1rem =……继续阅读 » 开心洋葱 8年前 (2017-03-29) 1908浏览 0评论1451个赞
html常用的meta整理 <!-- 使用 HTML5 doctype,不区分大小写 --> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --> <!-- 声明文档使用的字符编码 --> <!-- 优先使用 IE 最新版本和 Chrom……继续阅读 » 开心洋葱 8年前 (2017-03-29) 2531浏览 0评论355个赞
java创建线程池适用于TCP短连接场景import java.util.LinkedList;import java.util.concurrent.atomic.AtomicLong;/** * Copyright ©2017 gonglibin * 守护线程池类接收并执行任务 * @author gonglibin *……继续阅读 » 开心洋葱 8年前 (2017-03-29) 3083浏览 0评论886个赞
pdbs文件读取全部,然后下载到文件夹内的脚本#!/usr/bin/python# coding=utf8# 本脚本负责读取全部pdbs文件名,然后下载到文件夹内import urllib2import osimport stringimport Queueimport threadingimport time……继续阅读 » 开心洋葱 8年前 (2017-03-29) 1264浏览 0评论1610个赞
获取Ueditor里面的图片列表,地址绝对化/** * 内容中图片地址转成绝对地址 * @param $content * @return mixed */ private function imgUrl($content) { preg_match_all(……继续阅读 » 开心洋葱 8年前 (2017-03-29) 2975浏览 0评论194个赞
python 图像的显示和自动关闭'''python 图像的显示和自动关闭需要用交互操作模式打开plt.ion()'''import matplotlib.pyplot as pltplt.ion()# img是从磁盘读取图像或其他方式得到的图像……继续阅读 » 开心洋葱 8年前 (2017-03-29) 2213浏览 0评论1991个赞
//PHP代码函数实现16进制转RGB代码来源:开心洋葱./config/functions.php//16进制转RGB (PHP代码函数)//代码来源:开心洋葱./config/functions.phpfunction hex2rgb($hex){ $hex=str_replace('#',''……继续阅读 » 水墨上仙 8年前 (2017-03-29) 1208浏览 1026个赞
在python中可以使用in符号判断指定的元素是否存在于列表中,但我发现元组和数组存在区别,下面是详细实验结果。>>> '75271.com' in ['haotu.net','75271.com']True>>> '75271.com……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2955浏览 470个赞
可以通过iptraf命令查看网卡的实时流量,图像非常直观。今天在测试服务器上准备看下网络流量[root@localhost ~]# iptraf -d eth0-bash: iptraf: command not found发现运维同事没有给安装只能自己手工安装了首先安装需要的包:yum -y install gccyum -y ……继续阅读 » 水墨上仙 8年前 (2017-03-29) 2194浏览 1984个赞
对于HTML元素本身就带有的固有属性,在处理时,使用prop方法。对于HTML元素我们自己自定义的DOM属性,在处理时,使用attr方法。在高版本的jquery引入prop方法后,什么时候该用prop?什么时候用attr?它们两个之间有什么区别?这些问题就出现了。关于它们两个的区别,网上的答案很多。这里谈谈我的心得,我的心得很简单:对于HTML元素本……继续阅读 » 水墨上仙 8年前 (2017-03-28) 1746浏览 261个赞
代码从DELPHI语言到JAVA语言[delphi],从DELPHI到JAVA[delphi]1 字符串处理 DELPHI var s :string; s := s + 'a string'; JAVA ……继续阅读 » 水墨上仙 8年前 (2017-03-28) 2081浏览 1710个赞
如何将 XML 文件显示为 HTML 表格展示 <html><head><script type="text/javascript">var xmlhttp;function loadXMLDoc(url){xmlhttp=null;……继续阅读 » 水墨上仙 8年前 (2017-03-28) 1564浏览 2199个赞
jQuery中可以通过append在列表的最后添加数据,也可以通过prepend在列表的最前面添加数据 jQuery('#comment_list').prepend('<li>hello www.75271.com</li>');……继续阅读 » 水墨上仙 8年前 (2017-03-28) 1230浏览 2132个赞
ajax() 方法通过 HTTP 请求加载远程数据。该方法是 jQuery 底层 AJAX 实现。简单易用的高层实现见 $.get, $.post 等。$.ajax() 返回其创建的 XMLHttpRequest 对象。大多数情况下你无需直接操作该函数,除非你需要操作不常用的选项,以获得更多的灵活性。最简单的情况下,$.ajax() 可以不带任何参数直接……继续阅读 » 水墨上仙 8年前 (2017-03-28) 2266浏览 1407个赞