This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package netty.sample | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer.ByteBuf | |
import io.netty.bootstrap.ServerBootstrap | |
import io.netty.channel.ChannelOption | |
import io.netty.channel.ChannelOption._ | |
import io.netty.channel.ChannelFuture | |
import io.netty.channel.ChannelInitializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package netty.sample | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer.ByteBuf | |
import io.netty.bootstrap.Bootstrap | |
import io.netty.channel._ | |
import io.netty.channel.nio._ | |
import io.netty.channel.socket._ | |
import io.netty.channel.socket.nio._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// e.g: copyDir("folder\\", "destFolder\\", false); | |
bool copyDir(const char *r_szSrcPath, const char *r_szDesPath, bool recur) { | |
WIN32_FIND_DATA FindFileData; | |
HANDLE hFind; | |
char l_szTmp[MAX_PATH]; | |
strcpy(l_szTmp, r_szSrcPath); | |
char l_szSrcPath[MAX_PATH]; | |
char l_szDesPath[MAX_PATH]; | |
strcpy(l_szSrcPath, r_szSrcPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* http://www.bittorrent.org/beps/bep_0010.html | |
* http://www.bittorrent.org/beps/bep_0009.html | |
*/ | |
package netty.sample | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer.ByteBuf | |
import io.netty.bootstrap.Bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
class A | |
{ | |
}; | |
class B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* http://www.bittorrent.org/beps/bep_0010.html | |
* http://www.bittorrent.org/beps/bep_0009.html | |
*/ | |
package bep.impl | |
import java.io._ | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <vector> | |
#include <map> | |
class DecisionStmt { | |
public: | |
enum { DECISION_RET = (unsigned) -1 }; | |
typedef std::map<unsigned, int> CondResult; | |
typedef std::vector<CondResult> AccResults; | |
typedef std::vector<unsigned> CondList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int length(char *str) { | |
int s = 0; | |
for (; *str; ++str) ++s; | |
return s; | |
} | |
char *reverse(char *str) { | |
int size = length(str); | |
for (int i = 0; i < size / 2; ++i) { | |
str[i] ^= str[size - i - 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lichecker | |
import scala.concurrent._ | |
import scala.concurrent.duration.Duration | |
import ExecutionContext.Implicits.global | |
import com.codemacro.AsyncTask | |
object FutureList { | |
def run[T, T2](args: List[T], fn: => T => T2, max: Int): List[T2] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Printer : public Theron::Actor | |
{ | |
public: | |
// Constructor, passes the framework to the baseclass. | |
Printer(Theron::Framework &framework) : Theron::Actor(framework) | |
{ | |
// Register the message handler. | |
RegisterHandler(this, &Printer::Print); | |
} |