This file contains hidden or 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://johan.heapsource.com | |
| */ | |
| import std.stdio; | |
| import std.json; | |
| JSONValue doc; | |
| void main() { |
This file contains hidden or 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://johan.heapsource.com | |
| */ | |
| import std.stdio; | |
| import std.json; | |
| void main() { | |
| JSONValue v = parseJSON(q{ | |
| {"a":2, "b":{"c":20}} |
This file contains hidden or 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://johan.heapsource.com | |
| */ | |
| import std.stdio; | |
| import std.json; | |
| void main() { | |
| JSONValue * v = new JSONValue; | |
| *v = parseJSON(q{ |
This file contains hidden or 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 heaploop.looping; | |
| import couched; | |
| import std.json; | |
| void main() { | |
| loop ^^ { | |
| auto client = new CouchedClient("http://127.0.0.1:5984"); | |
| client.databases.ensure("albums"); | |
| CouchedDatabase db = client.databases["albums"]; |
This file contains hidden or 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 std.json; | |
| ... | |
| JSONValue doc; | |
| assert(doc == JSONValue.init); // always true, doc was never assigned. |
This file contains hidden or 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
| /** | |
| JSON type enumeration | |
| */ | |
| enum JSON_TYPE : byte | |
| { | |
| /// Indicates the type of a $(D JSONValue). | |
| STRING, | |
| INTEGER, /// ditto | |
| UINTEGER,/// ditto | |
| FLOAT, /// ditto |
This file contains hidden or 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 std.stdio : writeln; | |
| import std.json; | |
| void main() { | |
| JSONValue[] values = [parseJSON("28"), | |
| parseJSON("\"hello world\""), | |
| parseJSON(q{{"name": "Johan"}}), | |
| parseJSON("[2,3]"), | |
| parseJSON("true"), | |
| parseJSON("false"), |
This file contains hidden or 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
| 500 - Internal Server Error | |
| Internal Server Error | |
| Internal error information: | |
| core.exception.AssertError@../../../opt/vibe/source/vibe/core/drivers/libevent2_tcp.d(120): Trying to acquire a TCP connection that is currently owned. | |
| ---------------- | |
| ./dub-registry(_d_assert_msg+0x45) [0xa12b0d] | |
| ./dub-registry(void vibe.core.drivers.libevent2_tcp.Libevent2TCPConnection.acquire()+0xe3) [0x7a0b27] | |
| ./dub-registry(void vibe.core.drivers.libevent2_tcp.Libevent2TCPConnection.close()+0x6e) [0x7a0df2] |
This file contains hidden or 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 std.stdio; | |
| import mime; | |
| void main() { | |
| /*Proposal for Mime type package for D*/ | |
| auto mime = Mime.fromExtension(".midi"); | |
| assert(mime.description == "MIDI Audio"); | |
| mime = Mime.fromType("application/x-midi"); | |
| assert(mime.description == "MIDI Audio"); |
This file contains hidden or 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
| public string WebGetString(Uri endpoint, string path, params WebParam[] queryParams) | |
| { | |
| System.Net.WebClient client = new System.Net.WebClient(); | |
| StringBuilder relativePath = new StringBuilder(path); | |
| var filteredParams = (from p in queryParams where p.Value != null select p).ToArray(); | |
| if (filteredParams != null && filteredParams.Length > 0) | |
| { | |
| relativePath.Append("?"); | |
| foreach (var param in filteredParams) | |
| { |