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
#import("dart:io"); | |
Future getFuture() { | |
var completer = new Completer(); | |
new Timer(100,(timer) => completer.complete(true)); | |
return completer.future; | |
} | |
void main() { | |
getFuture().chain((_) { | |
print("Before exception in chain block"); | |
throw 'Error in chain block'; |
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
#import("dart:io"); | |
Future getFuture() { | |
var completer = new Completer(); | |
new Timer(100,(timer) => completer.complete(true)); | |
return completer.future; | |
} | |
Future openSocket() { | |
var completer = new Completer(); | |
Socket socket = new Socket('www.dartlang.org', 80); | |
if (socket is! Socket) { |
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
#import("dart:io"); | |
Future getFuture() { | |
var completer = new Completer(); | |
new Timer(100,(timer) => completer.complete(true)); | |
return completer.future; | |
} | |
Future openSocket() { | |
var completer = new Completer(); | |
var result = completer.future; | |
result.handleException((exc) { |
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
#import("dart:io"); | |
main(){ | |
int sum = 0; | |
DirectoryLister lister = new Directory("c:\\dropbox").list(true); | |
var filesProcessed = new List<Future>(); | |
lister.onError = (e) { throw e; }; | |
lister.onFile = (String file) { | |
// print("File: $file"); | |
// Please ignore the length() vs lengthSync(), because my | |
// actual use case is a longer IO operation, e.g. DB call. |
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
#import("dart:io"); | |
Future<Socket> openConnection(){ | |
var socket = new Socket('127.0.0.1', 1234567); | |
Completer completer = new Completer(); | |
socket.onError = (e) { | |
print("connect exception ${e}"); | |
completer.completeException(e); | |
}; | |
socket.onConnect = () { | |
completer.complete(socket); |
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 <windows.h> | |
#pragma hdrstop | |
#include "pt4.h" | |
void TrianglePS(double a, double &P, double &S) | |
{ | |
P = a * 2; | |
S = a * 3; | |
} | |
void Solve() |
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 <math.h> | |
#include <conio.h> | |
#define E 0.0001 | |
using namespace std; | |
int main () | |
{ |
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 <stdio.h> | |
#include <string.h> | |
int main () | |
{ | |
char str[] ="- This, a sample string. word1with"; | |
char digits[] = "0123456789"; | |
char * pch; | |
printf ("Splitting string \"%s\" into tokens:\n",str); | |
pch = strtok (str," ,.-"); |
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 <cstring> | |
#include <conio.h> | |
#include <time.h> | |
/*15. Задан двумерный массив. Найти сумму элементов первого столбца без одного последнего элемента, | |
сумму элементов второго столбца без двух последних, сумму элементов третьего столбца без трех последних и т. д. | |
Последний столбец не обрабатывается. Среди найденных сумм найти максимальную. | |
*/ | |
using namespace std; |
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 <cstring> | |
#include <conio.h> | |
#include <time.h> | |
/*15. Задан двумерный массив. Найти сумму элементов первого столбца без одного последнего элемента, | |
сумму элементов второго столбца без двух последних, сумму элементов третьего столбца без трех последних и т. д. | |
Последний столбец не обрабатывается. Среди найденных сумм найти максимальную. | |
*/ | |
using namespace std; |
OlderNewer