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
// Dart code sample for establishing communications link between isolates | |
// Tested on Dartium | |
// Source : www.cresc.co.jp/tech/java/Google_Dart/DartLanguageGuide.pdf (in Japanese) | |
// March 2012, by Cresc corp. | |
// October 2012, incorporated M1 changes | |
// January 2013, incorporated API changes | |
// February 2013, incorporated API changes | |
import 'dart:html'; | |
import 'dart:async'; |
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
/* | |
Dart code sample : Timer Isolate | |
Function timerIsolate provides your application with accurate timings with | |
+/- few mS accuracy depending on your pc's performance. | |
note : Windows Vista, Windows Server 2008, Windows 7 or later required for this code. | |
To try this sample: | |
1. Put these codes into the holder named TimerIsolateSample. |
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
/* | |
Dart code sample : Simple tool for HTTP server development | |
Returns contents of the HTTP request to the client | |
1. Save these files into a folder named DumpHttpRequest. | |
2. From Dart editor, File > Open Folder and select this DumpHttpRequest folder. | |
3. Run DumpHttpRequest.dart as server. | |
4. Access the DumpHttpRequest.html file from your browser such as : file:///C:/ … /DumpHttpRequest/DumpHttpRequest.html | |
5. Enter some text to the text areas and click “Submit using POST” or “Submit using GET” button. | |
6. This server will return available data from the request. This data is also available on the Dart editor’s console. | |
Ref: www.cresc.co.jp/tech/java/Google_Dart/DartLanguageGuide.pdf (in Japanese) |
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
// Dart code sample : Status line setting and HTTP response | |
// Returns a response with required status line | |
// 1. Create a folder named StatusLineTest | |
// 2. Put StatusLineTest.dart and StatusLineTest.html into the folder | |
// 3. From Dart editor, File -> Open Folder, and select the StatusLineTest folder | |
// 4. Run StatusLineTest.dart as server | |
// 5. Access file:///c:/..../StatusLineTest/StatusLineTest.html from your browser | |
// 6. Select a status code and test response of available browsers | |
// Ref: www.cresc.co.jp/tech/java/Google_Dart/DartLanguageGuide.pdf (in Japanese) | |
// May 2012, by Cresc Corp. |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Request a File</title> | |
</head> | |
<body> | |
<h1>Request a file</h1> | |
<h2>Enter the file name to download</h2> | |
<!-- Modify following lines for your application --> | |
<form method="get" action="http://localhost:8080/fserver"> |
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
/* | |
*** Cookie based HTTP session manager library *** | |
This is a third party session manager developed before the HttpSession was added | |
to dart:io on October 30th. See: http://code.google.com/p/dart/issues/detail?id=3258. | |
Functions and methods in this library are almost equivalent to those of Java Sevlet. | |
Note: Under evaluation. Do not use this code for actual applications. | |
Applications should not use response.headers.set("Set-Cookie", someString); | |
Instard, use the setCookieParameter method. | |
Available functions and methods: | |
Session getSession(HttpRequest request, HttpResponse response) |
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
library MIME; | |
// get MIME type (returns null if there is no such extension) | |
String mimeType(String extension) => _mimeMaps[extension]; | |
// default MIME type mappings | |
Map _mimeMaps = const { | |
'abs': 'audio/x-mpeg', | |
'ai': 'application/postscript', | |
'aif': 'audio/x-aiff', |
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
/* | |
* Dart code sample for concurrency tests. | |
* Evaluate performances in the following cases: | |
* 1) Only the parent computes fib() Fibonacci function (comment out lines 40 and 41) | |
* 2) Parent uses fib() and the child uses fibo() function (comment out line 41) | |
* 2) Parent and child share the same fib() function (comment out line 40) | |
* Tested on Dartium. | |
* Place dart.js bootstrup code in the packages/browser holder | |
* July 2012, by Cresc corp. | |
* October 2012, incorporated M1 changes. |
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
/* | |
Dart code sample : Simple HttpSession test server. | |
Note: Do not use this code for actual applications. | |
Usage: | |
1) Run this HttpSessionTest.dart as server. | |
2) Access this server from your browser : http://localhost:8080/SessionTest | |
Ref: www.cresc.co.jp/tech/java/Google_Dart/DartLanguageGuide.pdf (in Japanese) | |
November 2012, by Cresc Corp. | |
January 2013, incorporated API change | |
February 2013, incorporated API cange (Date -> DateTime) |
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
<html> | |
<head> | |
<title>CanvasTest</title> | |
</head> | |
<body> | |
<h1>CanvasTest</h1> | |
<h2 id="status">dart is not running</h2> | |
<script defer src="Canvas_Test.dart.js"></script> | |
<canvas id="canvas" width="200" height="200"></canvas> | |
</body> |