自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

diandian82的专栏

Welcome to my blog. Hope you can get what you want.

原创 Filebeat configuration sample

###################### Filebeat Configuration Example ######################### # This file is an example configuration file highlighting only the m...

2019-04-19 05:54:57 153 0

原创 Yield* in dart

import 'dart:async'; main(List<String> args) async { await for (int i in numbersDownFrom(10)) { print('$i apples'); ...

2019-03-30 07:13:50 883 0

原创 Dart Stream Sample

import 'dart:async'; Future<int> sumStream(Stream<int> stream) async{ var sum=0; await for(var value in stream){ sum +...

2019-03-30 06:24:31 81 0

原创 Dart named constructor

class Point { num x, y; Point(); // Named constructor Point.origin() { x = 1; y = 2; } @override String toString() { // ...

2019-03-28 07:15:21 93 0

原创 singleton

// dart singleton main(List<String> args) { var helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); helper = DBHelper(); ...

2019-03-28 07:12:40 31 0

原创 Web Push Notification By GCM

https://developers.google.com/web/fundamentals/codelabs/push-notifications/ server push: const webpush = require('web-push'); webpush...

2019-03-27 06:46:22 131 0

原创 Dart mixin - multiple inheritance in dart class.

mixin Musical { bool canPlayPiano = false; bool canCompose = false; bool canConduct = false; void entertainMe() { if (canPlayPiano) { ...

2019-03-06 00:47:51 49 0

转载 使用Docker快速搭建Kafka开发环境

创建 docker-compose.yml version: '2' services: zoo1: image: wurstmeister/zookeeper restart: unless-stopped hostname: zoo1 ...

2018-11-03 07:15:21 669 0

原创 What you don't know about template string.

var a = 1, b = 2; var d = 'abc'; function tag(strings, ...values) { console.log(strings); // "Hello " console.log(values...

2018-09-21 11:42:59 56 0

原创 Implemented Iterator in ES6

class Fruits { constructor() { this.items = []; } add(item) { this.items.push(item); } [Symbol.iterator]() { ...

2018-09-21 11:40:12 40 0

原创 Service worker coding test

var version = '4.0'; self.addEventListener('install', function (event) { event.waitUntil(caches.open(version)); }); self.ad...

2018-04-13 07:06:03 88 0

原创 自制ES6 Promise

Checked all Promise sample, none of them is in ES6 syntax, this is weird, which age are we now. Simplest verison class MyPromise { constructor(fn...

2017-12-23 01:51:26 119 0

原创 Jquery PlugIn for lazy loading items.

//use it with slider control and lister onChange event (function($) { $.fn.sliderthumbs = function(options) { var myOptions = { ...

2017-08-15 16:50:14 196 0

原创 Share folder between windows and ubuntu linux vm from Virtual Box

1. Click“settings” on the toolbar of VM VirtualBox Manager 2. Click“Shared Folders” from left side of settings page. Select a folder on Windows. e.g...

2015-07-24 16:52:12 428 0

原创 C# play with json in dynamic

var jsonString = @"{ 'id': '4', 'first_name'...

2014-12-09 15:03:59 609 0

转载 Diskpart 删除分区

管理员打开cmd diskpart sel disk 0 list part 看好分区号 sel part 分区号 del part override

2014-11-13 23:00:03 6497 0

原创 Working with promise and generators

var Q = require('q'); function asyncSquare(n) { var defer = Q.defer(); setTimeout(function(){ if(n>5) defer.reject(88...

2014-08-23 07:32:05 463 0

原创 Using HTTP Proxy in Node.js with request package

const request = require('request'); request({'url':'http://example.com', 'proxy':'http://127.0.0...

2014-08-09 02:16:07 906 0

原创 通过Wiston创建log,一天一文件

/** * User access, app run and error log. * * @module Logger */ //import var fs = require('fs'); var util = require('util');...

2014-03-24 11:18:24 1955 0

转载 Javascript format numbers

Round to a certain number of places For rounding decimals you can use the built-in JavaScript methods toFixed or toPrecision. var num = 10; var res...

2013-07-10 13:13:41 510 0

原创 use nodemailer to send gmail

1. sudo npm install nodemailer 2. Import the following class to your source code var nodemailer = require("nodemailer"); function MailPo...

2013-06-07 14:07:11 1567 0

原创 js正则表达式笔记

1. 匹配整个单词列表 var reg = /\b(shoes|shirt|pants)\b/;

2013-06-06 15:25:04 739 0

原创 示例:js使用正则表达式group来提取字符串中的数据

var linkStr = "/black-mountain/35-cotton-creek-cir-black-mountain-nc-421_537763.html"; // 括号表示组。访问可以用group[index]来访问每组的信息 var linkRegx = /\...

2013-06-04 16:58:28 18242 0

原创 构造函数+原型混合方式实现js的继承

function ClassA(sColor){ this.color = sColor; } ClassA.prototype.sayColor = function(){ console.log(this.color); } function ClassB(sColor, sName...

2013-05-26 19:30:36 1530 0

原创 Hogan.js 使用pratial示例

var hogan = require("hogan.js"); var template = hogan.compile('{{#list}}{{foo}}{{> par}}\n{{/list}}'); var partial = hogan.com...

2013-05-24 15:40:48 3224 0

原创 Use command line arguments in Node.js

var args = process.argv.splice(2); if(!args || args.length ==0){ console.log("no params"); } for(var i=0;i<args.length;i++) console.l...

2013-05-23 10:45:12 1442 0

原创 Adding timeout support for http request in Node.JS

This is HttpUtil Module, you need "require" it before using the module. var http= require("http"); var HttpUtil = function(...

2013-05-18 13:26:57 1034 0

原创 Silverlight中为Margin添加动画

因为在Silverlight中没有ThicknessAnimation,所以为Margin添加动画有点麻烦: 1. 使用ObjectAnimationUsingKeyFrames来做,这个就是通过计算要显示的每一帧内容来设置动画,可能看起来不是那么平滑,如果需要平滑的话,那样就需要写代码来动态生...

2012-12-02 20:46:14 1532 0

原创 Visual Studio中的正则替换

现有strings 如下: /*China*/ /*Japan*/ 需要替换为: string s = "Hello " + "China" + ".Welcome to" + "China" s...

2012-11-28 17:10:04 762 0

转载 使用DBCC缩减数据库中log文件的大小

USE [master] GO ALTER DATABASE CustomsAtom SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE CustomsAtom SET RECOVERY SIMPLE --简单模式 GO USE Customs...

2012-09-04 07:43:10 1648 0

原创 Asp.net MVC 通过Attribute验证datamodel(二) ---使用IClientValidatable

上一篇文章实现的都是服务器端的验证,ASP.net MVC框架给我们提供了非常好的客户端验证机制。下面来修改一下上面的Attribute定义,使其实现IClientValidatable接口 //验证逻辑就是判断专辑的Title是否包含某一个关键字 public class AlbumT...

2012-08-08 22:17:17 2346 1

原创 Asp.net MVC 通过Attribute验证datamodel(一)

1. 除了可以使用Required, StringLength等Attribute,asp.net mvc中还可以自定义属于自己的验证Attribute。 例如: //验证逻辑就是判断专辑的Title是否包含某一个关键字 public class AlbumTitleValidateA...

2012-08-08 21:23:37 1918 0

原创 Ajax.ActionLink使用方法

1. 添加unobtrusive-ajax引用, 2. 添加ActionLink @Ajax.ActionLink("Click here to see today's special", "DailyDeal", new AjaxOption...

2012-08-07 17:50:36 7028 0

原创 JS端调用Facebook API

1. 申请Facebook账号 2.登陆http://developers.facebook.com/申请APPID 3.一定要对你申请的APP设置Site URL 和Site Domain, 如果你需要调试,可以设置为http://localhost/和localhost 4.在页面中引用...

2012-08-07 14:25:56 6985 1

原创 ASP.net MVC 属性验证

1. 建立Model public class Order { [ScaffoldColumn(false)] public int OrderID { get; set; } [Required(ErrorMessage = "...

2012-08-06 14:33:12 1074 0

原创 ASP.NET MVC3 学习笔记----HTML.Action()和HTML.RenderAction()

HTML.Action()和HTML.RenderAction()类似于HTML.Partial()和HTML.RenderPartial()辅助方法。Partial辅助方法通常在单独的文件中应用视图标记来帮助视图渲染视图模型的一部分。另一方面,Action是执行单独的控制器操作并显示结果。Act...

2012-07-25 13:44:01 13829 1

原创 Script to change gateway by command

@echo off rem eth //eth 为网卡名称,可在网络连接中查询,如"本地连接" set eth="本地连接" rem ip //ip 为你想更改的IP set ip=10.0.125.38 rem gw //gw 为网关地址 set gw=1...

2012-07-19 13:11:02 584 0

原创 获取Cassendra中某个ColumnFamly所有的值

项目中需要获取Cassendra中某个ColumnFamly所有的值,并且缓存起来。感谢Andy童鞋给了我很好的示例 代码背景: 这个ColumnFamly是Super的,SuperColumn是Year,Key是ID,每一个SuperColumn下面存放着不同的数据,比如MSR, Name,...

2012-07-19 11:20:17 733 0

原创 Android判断是否有网络连接

1. 添加相应的权限   2. 判断方法 public boolean isNetworkAvailable() { Context context = getApplicationContext(); ConnectivityManager conn...

2012-07-11 17:08:43 560 0

原创 安卓本地存储

1.SharedPreferences类将数据保存在一个xml文件中,文件存放在/data/data//shared_prefs目录下 // //创建异或获取一个已经存在的sharedPreferences对象 SharedPreferences sharedPreferences = get...

2012-07-11 16:39:25 645 0

提示
确定要删除当前文章?
取消 删除