Python script to convert mysqldump output to JSON file. Most of the code was borrowed from github.com/jamesmishra/mysqldump-to-csv
You'll want to update the 'parse_row' function to map each item in a row to a dictionary.
| package net.reznik.gist; | |
| import static io.netty.buffer.Unpooled.copiedBuffer; | |
| import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive; | |
| import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; | |
| import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; | |
| import static io.netty.handler.codec.http.HttpResponseStatus.OK; | |
| import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; | |
| import io.netty.buffer.ByteBuf; | |
| import io.netty.buffer.ByteBufOutputStream; |
| /* Instructions on compilation and execution | |
| * ========================================= | |
| * | |
| * Compile this program with pthreads: | |
| * | |
| * g++ -Wall -lpthread -o graphdb-simulator graphdb-simulator.cpp | |
| * | |
| * Before you run this program, you need to create the following | |
| * directories: | |
| * |
| // 其实这题可以写的很简单,它的关键根本不是CAS操作。 | |
| // 使用一个标志(flag也好,status判断也罢)来避免Start和Dispose重入是很容易 | |
| // 想到的手段,很多同学也这么做了。大部分同学遇到的问题是:假如StartCore已经 | |
| // 启动,那么如何让Dispose方法等待其完成。有些同学用while (true),有些同学用 | |
| // 锁,但都避免不了让Dispose线程等待Start线程。 | |
| // 这里“避免等待”的关键在于要跳出思维界限:谁说DisposeCore方法一定要在Dispose | |
| // 方法里执行的?我们就不能在Start里销毁对象吗? |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |
Python script to convert mysqldump output to JSON file. Most of the code was borrowed from github.com/jamesmishra/mysqldump-to-csv
You'll want to update the 'parse_row' function to map each item in a row to a dictionary.
| // sending to sender-client only | |
| socket.emit('message', "this is a test"); | |
| // sending to all clients, include sender | |
| io.emit('message', "this is a test"); | |
| // sending to all clients except sender | |
| socket.broadcast.emit('message', "this is a test"); | |
| // sending to all clients in 'game' room(channel) except sender |
| plugins { | |
| id "io.spring.dependency-management" version "1.0.0.RC2" | |
| } | |
| project.group = com.company | |
| project.version = 1.0.0 | |
| project.ext.name = company-project | |
| dependencyManagement { | |
| imports { |
| import org.apache.flink.api.common.functions.MapFunction; | |
| import org.apache.flink.api.java.tuple.Tuple3; | |
| import org.apache.flink.streaming.api.TimeCharacteristic; | |
| import org.apache.flink.streaming.api.datastream.DataStream; | |
| import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; | |
| import org.apache.flink.streaming.api.functions.timestamps.AscendingTimestampExtractor; | |
| import org.apache.flink.table.api.Table; | |
| import org.apache.flink.table.api.TableEnvironment; | |
| import org.apache.flink.table.api.java.StreamTableEnvironment; | |
| import org.apache.flink.types.Row; |