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> | |
using namespace std; | |
class PhanSo | |
{ | |
private: | |
int ts, ms; | |
public: | |
PhanSo (int ts = 0, int ms = 1); | |
PhanSo operator +(PhanSo); |
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 <string> | |
using namespace std; | |
class Ve | |
{ | |
protected: | |
string MaVe, HoTen; | |
int NamSinh, SoTroChoi; |
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
var util = require('util'), | |
EventEmitter = require('events').EventEmitter; | |
var Ticker = function(){ | |
var self = this; | |
setInterval(function(){ | |
self.emit('tick'); | |
},1000); | |
}; | |
util.inherits(Ticker,EventEmitter); |
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
var oneSecond = 1000 * 1; // one second = 1000 x 1 ms | |
// setTimeout | |
setTimeout(function() { | |
document.write('<p>Hello there.</p>'); | |
}, oneSecond); | |
// setInterval | |
var setInteval(function(){ | |
document.write('<p>Hello there.</p>'); |
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
/** | |
* Normalizing paths | |
* you can use the normalize function present in the path module to normalize path, string, thus taking care of .., ., and //. | |
*/ | |
var path = require('path'); | |
path.normalize('/foo/bar//baz/asdf/quux/..'); | |
// => '/foo/bar/baz/asdf' | |
/** |
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
/** | |
* Querying file statistics | |
* You can query some meta-infomation on a file (or directory) by using the fs.stat function | |
*/ | |
var fs = require('fs'); | |
fs.stat('/etc/paswwd', function(err, stats){ | |
if (err) { throw err;} | |
console.log(stats); | |
}); |
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
/** | |
* Executing external commands | |
* | |
* when you need to lauch an external shell command or an executable file, you may do so by using the child_process module. | |
* You can import module like this | |
*/ | |
var child_process = require('child_process'); | |
// you can the use the exec function that is defined in the module like thí |
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
/** | |
* As you have seen, you can use the child_process.exec() function to launch external processes. | |
* You get your callback invoked when the process ends. This approach is very simple, but it has some drawbacks: | |
* > except for the command-line arguments and the environment variables, using exec() does not allow you to | |
* communicate with the child process. | |
* > the child process output is buffered. As a result, you cannot stream it, and it can consume memory. | |
* | |
* Fortunately, Node’s child_process module allows for finer-grained control when launching, stopping, | |
* and generally interacting with child processes. | |
* You may launch a new process, called the child process, from your application, which is called the parent process. |
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
/** | |
* download dictionary file at http://blackberryvietnam.net/threads/du-lieu-tu-dien-cho-ung-dung-ddict.897/ | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
char s[300]; |
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
/** | |
* A part of contact.txt contents like | |
* | |
* Last name: nguyen van a | |
* General phone: 0123456789 | |
* | |
* First name: nguyen thi b | |
* General phone: 09999999 | |
* | |
* First name: tran van c |
OlderNewer