我先试试这个Open Live Writer能不能用。

再在ScribeFire中修改一下已经发布的文章试试看。

这两个写博客的地方都没有原始的编辑器方便,可以插入代码,选择文章的分类。所以以后还有这个编辑器吧。


昨天搞定第一个简单的topology,今天看一个稍微复杂一点的topology,基本上和昨天的一样,这个代码是我在学习极客学院的storm实战的时候,自己照着写下来的。

这个Topology有一个spout输入,三个bolt处理,加上一个topology的类,一共是五个类。【还需要一个工具类】

第一:spout的代码---RandomSentenceSpout.java

随机的发出一条消息

 package cn.aeths.storm.helloworld.spout;

 import java.util.Map;
import java.util.Random; import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichSpout;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import backtype.storm.utils.Utils; //随机发送一条内置消息,继承BaseRichSpout/IRichSpout类
@SuppressWarnings("serial")
public class RandomSentenceSpout extends BaseRichSpout{ SpoutOutputCollector spoutOutputCollector;
Random random; //进行tuple处理的重要的方法
public void nextTuple() {
Utils.sleep(2000);
String[] sentences = new String[]{
"Hello world",
"Big world",
"the cow jumped over the moon", "an apple a day keeps the doctor away",
"four score and seven years ago", "snow white and the seven dwarfs",
"i am at two with nature", };
//从sentences中随机获取一条语句,作为spout发送的消息
String sentence = sentences[random.nextInt(sentences.length)];
//使用emit方法进行tuple发布,参数用Values声明
spoutOutputCollector.emit(new Values(sentence.trim().toLowerCase()));
} //初始化工作,参数传递
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
spoutOutputCollector = collector;
random = new Random();
} //消息保证机制中的ack确认方法
public void ack(Object id){ }
//消息保证机制中的fail确认方法
public void fail(Object id){ }
//声明字段
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
} }

第二:bolt1的代码---WordNormalizerBolt.java

消息标准化

 package cn.aeths.storm.helloworld.bolt;

 import java.util.Map;

 import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.IRichBolt;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values; //消息标准化
@SuppressWarnings("serial")
public class WordNormalizerBolt implements IRichBolt{ //发射消息
private OutputCollector outputCollector; //初始化方法
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
outputCollector = collector;
} //执行订阅的tuple逻辑过程的方法
public void execute(Tuple input) {
String sentence = input.getString(0);
//获得每个输入的流,拆分成单个的字符串数组,对每个元素,发射出去
String[] words = sentence.split(" ");
for (String word : words) {
outputCollector.emit(new Values(word));
}
}
public void cleanup() { } //字段声明
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
} public Map<String, Object> getComponentConfiguration() {
return null;
} }

第三:bolt2的代码---WordCountBolt.java

单词统计,实时获取词频前n的单词发射出去

 package cn.aeths.storm.helloworld.bolt;

 import java.util.HashMap;
import java.util.Map; import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.IRichBolt;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;
import cn.aeths.storm.helloworld.util.MapSort; //单词统计,实时获取词频前N的发射出去
@SuppressWarnings("serial")
public class WordCountBolt implements IRichBolt{ Map< String, Integer> counters;//单词和词频的对应关系
private OutputCollector outputCollector; @SuppressWarnings("rawtypes")
public void prepare(Map arg0, TopologyContext context, OutputCollector collector) {
outputCollector = collector;
counters = new HashMap<String, Integer>();//初始化
}
public void cleanup() { } public void execute(Tuple input) {
String str = input.getString(0);
if(!counters.containsKey(str)){
counters.put(str, 1);//没有的话,给1
}else{
Integer c = counters.get(str) +1;
counters.put(str, c);//有的话在原来的基础上加1
}
int num=8;
int length=0; counters = MapSort.sortByValue(counters);//调用自己写的排序方法重新排序 if(num<counters.keySet().size()){
length = num;//key的长度大于8的时候给length赋值就是8
}else{
length = counters.keySet().size();//否则的话是多长就多长
} String word = null; int count=0;
for(String key:counters.keySet()){
//对每一个输出的map都封装一下value为word
if(count>=length){//长度为0的就算了
break;
}
if(count==0){
word="[" + key + "." + counters.get(key) + "]";
}else{
word=word+",[" +key +":"+counters.get(key) + "]";
}
count++;
}
word ="The first" + num+ ": "+ word;
//发射出去
outputCollector.emit(new Values(word));
} public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
} public Map<String, Object> getComponentConfiguration() {
return null;
} }

第四:bolt3的代码---PrintBolt.java

打印bolt

 package cn.aeths.storm.helloworld.bolt;

 import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple; @SuppressWarnings("serial")
public class PrintBolt extends BaseBasicBolt{ public void execute(Tuple input, BasicOutputCollector collector) {
String mesg = input.getString(0);
if(mesg!=null)
System.out.println(mesg);
} public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
} }

第五:topology的代码---WordCountTopology

将这些类组成一个Topology分别设置集群模式和本地模式的提交运行与回收

 package cn.aeths.storm.helloworld;

 import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
import backtype.storm.utils.Utils;
import cn.aeths.storm.helloworld.bolt.PrintBolt;
import cn.aeths.storm.helloworld.bolt.WordCountBolt;
import cn.aeths.storm.helloworld.bolt.WordNormalizerBolt;
import cn.aeths.storm.helloworld.spout.RandomSentenceSpout; public class WordCountTopology {
private static TopologyBuilder builder = new TopologyBuilder();
public static void main(String[] args){ Config config = new Config();
builder.setSpout("RandomSentence", new RandomSentenceSpout(),2);
builder.setBolt("WordNormalizer", new WordNormalizerBolt(),2).shuffleGrouping("RandomSentence");
builder.setBolt("WordCount", new WordCountBolt(),2).fieldsGrouping("WordNormalizer",new Fields("word"));
builder.setBolt("Print", new PrintBolt(),1).shuffleGrouping("WordCount"); config.setDebug(false); if(args!=null && args.length>0){
config.setNumWorkers(3);
try {
StormSubmitter.submitTopology(args[0], config, builder.createTopology());
} catch (Exception e) {
e.printStackTrace();
} }else{
config.setMaxTaskParallelism(1);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("WordCount", config, builder.createTopology());
Utils.sleep(10000);
cluster.killTopology("WorldCount");
cluster.shutdown();
} } }

第六:util的代码---MapSort.java

将map按照key排序之后,输出map的工具类

 package cn.aeths.storm.helloworld.util;

 import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map; public class MapSort {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Map<String, Integer> sortByValue(Map<String,Integer> map){
if(map==null){
return null;
}
List<Integer> list = new LinkedList(map.entrySet());
Collections.sort(list,new Comparator(){
public int compare(Object o1,Object o2){
Comparable sort1 = (Comparable)((Map.Entry)o1).getValue();
Comparable sort2 = (Comparable)((Map.Entry)o2).getValue();
return sort2.compareTo(sort1);
}
});
Map result = new LinkedHashMap();
for(Iterator iterator = list.iterator();iterator.hasNext();){
Map.Entry entry = (Map.Entry)iterator.next();
result.put(entry.getKey(), entry.getValue());
}
return result;
}
public static void main(String[] args){
Map<String,Integer> map = new HashMap<String, Integer>();
map.put("test", 3);
map.put("hcy", 1);
map.put("put",2);
map = sortByValue(map);
} }

第七:pom.xml的代码

引用的还是storm-core-0.9.2

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>cn.aeths</groupId>
<artifactId>storm-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>storm-example</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency> <dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.2-incubating</version>
<scope>provided</scope>
</dependency> </dependencies> <build>
<plugins> <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration> <descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>
cn.aeths.storm.helloworld.WorldCountTopology
</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> </plugins>
</build>
</project>

第八:工程的目录结构

第九:运行的效果

 44419 [Thread-18-Print] INFO  backtype.storm.daemon.executor - Preparing bolt Pr
int:(1)
44420 [Thread-18-Print] INFO backtype.storm.daemon.executor - Prepared bolt Pri
nt:(1)
44434 [Thread-19-worker-receiver-thread-0] INFO backtype.storm.messaging.loader
- Starting receive-thread: [stormId: WordCount-1-1464826598, port: 1027, thread
-id: 0 ]
The first8: [the.1]
The first8: [the.1],[cow:1]
The first8: [the.1],[cow:1],[jumped:1]
The first8: [the.1],[cow:1],[jumped:1],[over:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.3],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.3],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.3],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.3],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[world:1],[an
:1]
The first8: [the.3],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
52768 [main] ERROR org.apache.zookeeper.server.NIOServerCnxnFactory - Thread Thr
ead[main,5,main] died
backtype.storm.generated.NotAliveException: null
at backtype.storm.daemon.nimbus$check_storm_active_BANG_.invoke(nimbus.clj:744)
~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.daemon.nimbus$fn__4173$exec_fn__1096__auto__$reify__4186.kill
TopologyWithOpts(nimbus.clj:968) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubat
ing]
at backtype.storm.daemon.nimbus$fn__4173$exec_fn__1096__auto__$reify__4186.kill
Topology(nimbus.clj:965) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_7
4]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_74]
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) ~[clojure-1.5
.1.jar:na]
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) ~[clojure-1.5
.1.jar:na]
at backtype.storm.LocalCluster$_killTopology.invoke(LocalCluster.clj:51) ~[stor
m-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.LocalCluster.killTopology(Unknown Source) ~[storm-core-0.9.2-
incubating.jar:0.9.2-incubating]
at cn.aeths.storm.helloworld.WordCountTopology.main(WordCountTopology.java:39)
~[classes/:na]
The first8: [the.3],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.3],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.3],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.4],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.4],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.4],[world:2],[cow:1],[jumped:1],[over:1],[moon:1],[hello:1],[an
:1]
The first8: [the.4],[world:2],[big:2],[cow:1],[jumped:1],[over:1],[moon:1],[hell
o:1]
The first8: [the.4],[world:3],[big:2],[cow:1],[jumped:1],[over:1],[moon:1],[hell
o:1]
The first8: [the.5],[world:3],[big:2],[cow:1],[jumped:1],[over:1],[moon:1],[hell
o:1]
The first8: [the.5],[world:3],[big:2],[cow:2],[jumped:1],[over:1],[moon:1],[hell
o:1]
The first8: [the.5],[world:3],[big:2],[cow:2],[jumped:2],[over:1],[moon:1],[hell
o:1]
The first8: [the.5],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:1],[hell
o:1]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:1],[hell
o:1]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[hell
o:1]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[hell
o:1]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[hell
o:1]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:2],[and:
2]
The first8: [the.6],[world:3],[and:3],[big:2],[cow:2],[jumped:2],[over:2],[moon:
2]
The first8: [the.6],[world:3],[and:3],[seven:3],[big:2],[cow:2],[jumped:2],[over
:2]
The first8: [the.6],[world:3],[and:3],[seven:3],[big:2],[cow:2],[jumped:2],[over
:2]
The first8: [the.6],[world:3],[and:3],[seven:3],[big:2],[cow:2],[jumped:2],[over
:2]
The first8: [the.6],[world:3],[and:3],[seven:3],[big:3],[cow:2],[jumped:2],[over
:2]
The first8: [the.6],[world:4],[and:3],[seven:3],[big:3],[cow:2],[jumped:2],[over
:2]
The first8: [the.6],[world:4],[and:3],[seven:3],[big:3],[four:3],[cow:2],[jumped
:2]
The first8: [the.6],[world:4],[and:3],[seven:3],[big:3],[four:3],[score:3],[cow:
2]
The first8: [the.6],[world:4],[and:4],[seven:3],[big:3],[four:3],[score:3],[cow:
2]
The first8: [the.6],[world:4],[and:4],[seven:4],[big:3],[four:3],[score:3],[cow:
2]
The first8: [the.6],[world:4],[and:4],[seven:4],[big:3],[four:3],[score:3],[year
s:3]
The first8: [the.6],[world:4],[and:4],[seven:4],[big:3],[four:3],[score:3],[year
s:3]
The first8: [the.6],[world:4],[and:4],[seven:4],[four:4],[big:3],[score:3],[year
s:3]
The first8: [the.6],[world:4],[and:4],[seven:4],[four:4],[score:4],[big:3],[year
s:3]
The first8: [the.6],[and:5],[world:4],[seven:4],[four:4],[score:4],[big:3],[year
s:3]
The first8: [the.6],[and:5],[seven:5],[world:4],[four:4],[score:4],[big:3],[year
s:3]

第十:出现的问题

首先是这个错误

可能是我没有把本地集群关闭,那几行没写,但是正常运行的9的结果也出现了这个问题。待续吧。

 41030 [main-EventThread] INFO  org.apache.curator.framework.state.ConnectionStat
eManager - State change: CONNECTED
41030 [ConnectionStateManager-0] WARN org.apache.curator.framework.state.Connec
tionStateManager - There are no ConnectionStateListeners registered.
41045 [main] INFO backtype.storm.daemon.supervisor - Starting supervisor with i
d ce0df93a-0061-4107-aab0-378bc2adcdac at host kongchung
41108 [main] WARN backtype.storm.daemon.nimbus - Topology submission exception.
(topology name='wordcount') #<InvalidTopologyException InvalidTopologyException
(msg:Component: [Print] subscribes from non-existent stream: [default] of compon
ent [WordCount])>
41124 [main] ERROR org.apache.zookeeper.server.NIOServerCnxnFactory - Thread Thr
ead[main,5,main] died
backtype.storm.generated.InvalidTopologyException: null
at backtype.storm.daemon.common$validate_structure_BANG_.invoke(common.clj:169)
~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.daemon.common$system_topology_BANG_.invoke(common.clj:304) ~[
storm-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.daemon.nimbus$fn__4173$exec_fn__1096__auto__$reify__4186.subm
itTopologyWithOpts(nimbus.clj:944) ~[storm-core-0.9.2-incubating.jar:0.9.2-incub
ating]
at backtype.storm.daemon.nimbus$fn__4173$exec_fn__1096__auto__$reify__4186.subm
itTopology(nimbus.clj:962) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_7
4]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_74]
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) ~[clojure-1.5
.1.jar:na]
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) ~[clojure-1.5
.1.jar:na]
at backtype.storm.testing$submit_local_topology.invoke(testing.clj:253) ~[storm
-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.LocalCluster$_submitTopology.invoke(LocalCluster.clj:38) ~[st
orm-core-0.9.2-incubating.jar:0.9.2-incubating]
at backtype.storm.LocalCluster.submitTopology(Unknown Source) ~[storm-core-0.9.
2-incubating.jar:0.9.2-incubating]
at cn.aeths.storm.helloworld.WorldCountTopology.main(WorldCountTopology.java:38
) ~[classes/:na]

然后是这个错误

文献:http://bbs.csdn.net/topics/390721505

说是因为字段声明有问题果然是我的一个字段的声明没写是空的,添加之后能妥善运行了。

 40681 [main] INFO  backtype.storm.daemon.supervisor - Starting supervisor with i
d 42584273-a237-4472-a830-595633f81cb9 at host kongchung
40744 [main] WARN backtype.storm.daemon.nimbus - Topology submission exception.
(topology name='WordCount') #<InvalidTopologyException InvalidTopologyException
(msg:Component: [Print] subscribes from non-existent stream: [default] of compon
ent [WordCount])>
40744 [main] ERROR org.apache.zookeeper.server.NIOServerCnxnFactory - Thread Thr
ead[main,5,main] died
backtype.storm.generated.InvalidTopologyException: null
     //字段声明
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
}

storm的javadoc很多的东西描述的不清楚,或者人觉得不用描述,现在就是学着用很多的类都没看懂怎么用。慢慢学吧。

2016-06-02  08:26:58

STORM_0006_第二个storm_topology:WordCountTopology的代码与运行的更多相关文章

  1. “全栈2019”Java多线程第二十一章:同步代码块产生死锁的例子

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java多 ...

  2. Java第二次作业參考代码

    Java第二次作业參考代码 [程序11] 题目:有1.2.3.4四个数字,能组成多少个互不同样且无反复数字的三位数?都是多少? public class lianxi11 { public stati ...

  3. C#_技巧:计算代码块运行的时间

    System.Diagnostics下类Stopwatch,给程序代码块运行计时, 利用start()和stop()方法来标记代码快. 该命名空间下还有一些其他类,可以对程序进行诊断(diagnosi ...

  4. 网页HTML代码在线运行器

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. PHP文件PHP代码及运行(适合PHP初学者)

    本文转自:https://blog.csdn.net/cnds123/article/details/80700444 如果在warmpserver上运行php只显示源代码,可能是在用记事本保存后缀为 ...

  6. 撰写一篇博客要求讲述四则运算2的设计思想,源程序代码、运行结果截图、编程总结分析,并按照PSP0级的要求记录开发过程中的时间记录日志。

    一.撰写一篇博客要求讲述四则运算2的设计思想,源程序代码.运行结果截图.编程总结分析,并按照PSP0级的要求记录开发过程中的时间记录日志. 1.设计思想: ①创建test.jsp建立第一个前端界面,提 ...

  7. NodeJs>------->>第二章:Node.js中交互式运行环境--------REL

    第二章:Node.js中交互式运行环境--------REL 一:REPL运行环境概述 C:\Users\junliu>node > foo = 'bar' ; 'bar' > 二: ...

  8. AppCan IDE中有时格式化代码后,代码就运行不了了。

    AppCan IDE中有时格式化代码后,代码就运行不了了.

  9. 使用记事本编写html代码并运行

    在使用记事本编写html代码,运行时需要将其.txt后缀改为.html双击运行即可. 有时电脑会默认的隐藏其后缀,这时需要修改一下. win7系统修改方法: 双击  我的电脑: 选择  组织: 选择  ...

随机推荐

  1. Delphi 线程同步技术(转)

    上次跟大家分享了线程的标准代码,其实在线程的使用中最重要的是线程的同步问题,如果你在使用线程后,发现你的界面经常被卡死,或者无法显示出来,显示混乱,你的使用的变量值老是不按预想的变化,结果往往出乎意料 ...

  2. Spring+Mybatis+jQuery.Pagination.js异步分页及JsonConfig的使用

    在开发工作中经常用到异步分页,这里简单整理一下资料. 一.Controller方法 package com.lwj.controller; import javax.servlet.http.Http ...

  3. LCD参数解释及计算【转】

    转自:http://blog.csdn.net/longxiaowu/article/details/24319933 Linux内核的amba lcd控制器使用clcd_panel结构体表示一个LC ...

  4. 那些情况该使用它们spin_lock到spin_lock_irqsave【转】

    转自:http://blog.csdn.net/wesleyluo/article/details/8807919 权声明:本文为博主原创文章,未经博主允许不得转载. Spinlock的目的是用来同步 ...

  5. bin和sbin的区别

    bin和sbin的区别: bin:用户命令(所有用户均可使用) sbin:管理命令(通常只有管理员可以使用)

  6. 图示-Centos7完整安装

    工作过程中,一些未接触过Centos,或未安装过Centos的同事经常会问,如何安装?这个事说简单真简单,只有操作过一次,第二次就能够熟练的自己动手安装:但说难也难,如果没人带,第一次安装的时候确实不 ...

  7. PHP弱类型安全问题的写法和步骤

    鉴于目前PHP是世界上最好的语言,PHP本身的问题也可以算作是web安全的一个方面.在PHP中的特性就是弱类型,以及内置函数对于传入参数的松散处理.本篇文章主要就是记录我在做攻防平台上面遇到的PHP的 ...

  8. 20145227 《Java程序设计》第7周学习总结

    20145227 <Java程序设计>第7周学习总结 教材学习内容总结 第十二章 Lambda 如果使用JDK8的话,可以使用Lambda特性去除重复的信息. 在只有Lambda表达式的情 ...

  9. java 1G大文件复制

    对比几种复制方法 复制的文件是980m的txt文件 1.  FileChannel 方法 代码: public static void mappedBuffer() throws IOExceptio ...

  10. c#记事本

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...