Re: std.net.curl : Performance
On Monday, 9 November 2020 at 20:57:33 UTC, Daniel Kozak wrote: On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: >> ... > > The only curl option you need to set within the loop is the > CurlOption.url. So your foreach block should look more like: > > foreach (...) { > string url = chain(apihost, only(':'), > to!string(apiport), > apiuri).to!string; > https.handle.set(CurlOption.url, url); > https.perform(); > scope(failure) exit(-4); > scope(exit) https.shutdown; > apidata.insert(tuple(seq, cast(string) content)); > content = []; > } > > Every other line can be placed before the foreach. In fact, you don't need url in there either since it's not dependent on loop variables, and you don't need the scope guards if this is running in main (you can move them out of the loop too). foreach (...) { https.handle.set(CurlOption.url, url); https.perform(); apidata.insert(tuple(seq, cast(string) content)); content = []; } In fact he does not need foreach. Because he use it on empty result Hi All, The reason that the above code is within foreach loop is because there are several api's and each of the api's have separate configuration. These configuration are maintained in a table in MySQL database, the result contains the configuration details for each of these api's, below is the complete code. Sequence The code collects the data from several api's whose output is json. The output of the api's are parsed, filtered, validated and stored in a array using another function.(using asdf json parser) The data stores in array is then inserted into the table in MySQL database.(using hunt-database). Code: auto getData () { Array!(Tuple!(int,string)) apidata; Row[] result; result = getApiconf(); \\ fetch's the api configuration from the database table. foreach(i, k; parallel(result,1)) { string apihost = result[i][0].get!(string); int apiport = result[i][1].get!(int); string apiuser = result[i][2].get!(string); string apipass = result[i][3].get!(string); int seq = result[i][4].get!int; string apiuri = result[i][5].get!(string); int connecttimeout = result[i][6].get!(int); int tcp_nodelay = result[i][7].get!(int); int http_version = result[i][8].get!(int); int sslversion = result[i][9].get!(int); int use_ssl = result[i][10].get!(int); int ssl_verifypeer = result[i][11].get!(int); string url = chain(apihost, only(':'), to!string(apiport), apiuri).to!string; string usrpass = chain(apiuser, only(':'), apipass).to!string; auto https = HTTP(); https.handle.set(CurlOption.buffersize, 512000); https.handle.set(CurlOption.userpwd, usrpass); https.handle.set(CurlOption.connecttimeout, connecttimeout); https.handle.set(CurlOption.tcp_nodelay, tcp_nodelay); https.handle.set(CurlOption.http_version, http_version); https.handle.set(CurlOption.sslversion, sslversion); https.handle.set(CurlOption.use_ssl, use_ssl); https.handle.set(CurlOption.ssl_verifypeer, ssl_verifypeer); https.handle.set(CurlOption.url, url); https.method(HTTP.Method.get); https.StatusLine st; https.onReceiveStatusLine = (https.StatusLine st) { if (st.code != 200) { throw new Exception(st.reason); } }; ubyte[] content; https.onReceive = (ubyte[] data) { content ~= data; return data.length; }; https.perform(); scope(failure) { https.shutdown; exit(-4); } scope(exit) https.shutdown; apidata.insert(tuple(seq, cast(string) content)); } return apidata[].sort; } From, Vino.B
Re: C++ or D?
On Tuesday, 10 November 2020 at 01:00:50 UTC, Mark wrote: Hi all, my question would be about using D or not using D. Here are some things you will NOT get in D: youtube -> Dconf 2014 Day 2 Keynote: The Last Thing D Needs -- Scott Meyers For example, you will not get neurosis from it, or badly infected wounds someone mentioned earlier :D I also like the fast compile times, and the compile time programming, the ability that you can program D in D if you wish.
Re: C++ or D?
On Tuesday, 10 November 2020 at 01:00:50 UTC, Mark wrote: Hi all, Anyone have any thoughts how C++ and D compare? C++ has a bit more mathematical feeling, everything has been sorted out in the spec, even if the rules are crazy difficult. D feels like it's up to _you_ to write the spec as you discover things in the compiler. C++ code feels a bit more cast in stone than any other language, you can't move around things as quickly, and you won't be willing to. But as you wrote the lines slower, likely you were a bit more careful too as a side-effect. If you write a small command-line tool, using D vs C++ will be appreciably more productive. Just std.process will speed up things by a lot, for this kind of work Phobos really shines. I don't think it makes the same difference for large projects. Learning D is something that can be almost finished, whereas with C++ you have to aggressively conquer new features from the standard one by one, and unfortunately C++ evolves faster than you can assimilate C++. Generally when you meet a C++ programmer, you are meeting someone who has given up the hope to have a full understanding of the language and instead stay strategically on a useful, codebase-specific subset (eg: if you learn about std:unique_ptr, you can avoid to learn about most of move semantics so that's a good learning investment). D lets you think more about your problem domain, and less about language things. Don't know precisely why. If you are deeply immersed in C++ everyday, you won't see that problem, but it's there. It's as if the culture of C++ was "complexity is free", there is little attempt to contain it. And it shows in the small things, for example: - D atomics (core.atomic) has 11 public functions and defined 5 memory models. - C++ atomics has 29 functions and 6 memory models. It doesn't seem like much, but there is a bit _more of everything_ you can count. All in all as a D replacement C++ seems a bit lacking, unless you want a particular domain-specific library that only exists in C++. I'm sure with a bit more effort, it could be a bit more attractive to the vast masses of D programmers.
Re: C++ or D?
On Tue, Nov 10, 2020 at 01:00:50AM +, Mark via Digitalmars-d-learn wrote: [...] > my question would be about using D or not using D. Is the newest C++ > iteration any good compared to D? [...] > I haven't looked into the newest C++. In theory, they might have added > something helpful in the past years. > > Anyone have any thoughts how C++ and D compare? It depends on what you're looking for, what you're trying to do, and what you expect. If you're looking for good tooling, top-notch IDE integration, extensive libraries, etc., then D might not be for you. That's not to say there *isn't* good tooling, IDE integration, or libraries; they are there, but there are rough corners that some people might find frustrating. Also, if you're looking for widespread adoption and employment opportunities, you might find D is not quite there yet. However, if you're looking for language qualities, like expressive power, productivity, scalability, ease of writing, ease of maintenance, metaprogramming, or just general programming language sanity (less pathological language constructs, gotchas, etc.), I *definitely* recommend D over C++. Any day, hands down. And I say this as an ex-C++ programmer who has renounced C++ almost a decade ago and never looked back since. My experience with D has been so good, I've been totally ruined; I can't stand writing code in any other language anymore. Every time I have to face C or C++, or worse, Java, I chafe inside, wishing that I could use this or that D feature. Don't get me wrong; D has its own share of dark corners and WATs, but compared to C++, it's a mere scratch vs. a festering, infected wound that is quickly turning necrotic and requires immediate surgery or amputation. Every time I'm forced to work with C++ code I feel an urge to disinfect my hands with something strong... but all I need is to write some D and the urge vanishes. ;-) YMMV, though. :-D T -- What did the alien say to Schubert? "Take me to your lieder."
Re: C++ or D?
On Tuesday, 10 November 2020 at 01:00:50 UTC, Mark wrote: Anyone have any thoughts how C++ and D compare? Broadly speaking: D has a better core language, and C++ has a much better library and tooling ecosystem.
C++ or D?
Hi all, my question would be about using D or not using D. Is the newest C++ iteration any good compared to D? The reason I haven't used C++ anymore for years is that I was too naive sometimes. I tried to use new features in Visual C++, found myself being like a beta-tester for some things. And the way C++ was always able to frustrate me is mainly, when undefined behavior takes too long to take effect. Sometimes I must have had bad luck, or I'm too silly. But for some subtle bugs in my hobbyist C++ past the solution would have been to rewrite a lot of code. Sometimes it was just too much work to get anything done at all. When I used shared pointers, it got better. But it got a little bit ugly, too. And in general, being encouraged or forced to write boiler plate code was also frustrating. I haven't looked into the newest C++. In theory, they might have added something helpful in the past years. Anyone have any thoughts how C++ and D compare?
Re: Value based overload resolution?
On Monday, 9 November 2020 at 22:04:55 UTC, kdevel wrote: It appears to me that the overload resolution may depend on the /value/ of the function argument. According to [1] the type of 1 is int and that of 1L is long. Thus I would have expected foo!int and foo!long being called in those cases. [1] https://dlang.org/spec/lex.html#integerliteral As you've discovered, the types of integer literals (and literals in general) is somewhat fluid: the *default* type of `1` is `int`, but the compiler may infer a different type based on the value, or on the context in which the literal is used. For example: static assert(is(typeof([1, 2, 3]) == int[])); int[] a = [1, 2, 3]; ubyte[] b = [1, 2, 3]; Perhaps even more confusingly, this also applies to manifest (enum) constants: enum literal = [1, 2, 3]; static assert(is(typeof(literal) == int[])); int[] a = literal; ubyte[] b = literal;
Re: Value based overload resolution?
On Monday, 9 November 2020 at 22:04:55 UTC, kdevel wrote: It appears to me that the overload resolution may depend on the /value/ of the function argument. According to [1] the type of 1 is int and that of 1L is long. That's not exactly true because of value range propagation. It is weird in this case. But the intention is for stuff like short a = 1; to work without an explicit cast from 1 being an int. So the compiler looks at what it can see in the expression - exact values of literals, ranges of possible values from other variables - and determines the smallest type it can fit inside. Then it automatically assigns it that type instead. What gets pretty weird is if you add a bool overload and pass 1 the compiler considers bool to be a very restrained integral type... and it knows the values of `enum` too which can give some surprising results. But yeah the values or the possible ranges of values can actually affect the types of arithmetic expressions and this is considered in overloading for better or for worse.
Value based overload resolution?
Today I came across this: ~~~id.d import std.stdio : writeln; T foo (T) (T s) { __PRETTY_FUNCTION__.writeln; return s; } short foo (short s) { __PRETTY_FUNCTION__.writeln; return s; } T id (T) (T t) { return t; } int main () { foo (1); foo (1L); foo (id (1)); foo (id (1L)); foo (0x1_); foo (0x1_L); return 0; } ~~~ Output: $ ./id short id.foo(short s) short id.foo(short s) int id.foo!int.foo(int s) long id.foo!long.foo(long s) int id.foo!int.foo(int s) long id.foo!long.foo(long s) It appears to me that the overload resolution may depend on the /value/ of the function argument. According to [1] the type of 1 is int and that of 1L is long. Thus I would have expected foo!int and foo!long being called in those cases. [1] https://dlang.org/spec/lex.html#integerliteral
Re: std.net.curl : Performance
On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: > >> ... > > > > The only curl option you need to set within the loop is the > > CurlOption.url. So your foreach block should look more like: > > > > foreach (...) { > > string url = chain(apihost, only(':'), to!string(apiport), > > apiuri).to!string; > > https.handle.set(CurlOption.url, url); > > https.perform(); > > scope(failure) exit(-4); > > scope(exit) https.shutdown; > > apidata.insert(tuple(seq, cast(string) content)); > > content = []; > > } > > > > Every other line can be placed before the foreach. > > In fact, you don't need url in there either since it's not > dependent on loop variables, and you don't need the scope guards > if this is running in main (you can move them out of the loop > too). > > foreach (...) { > https.handle.set(CurlOption.url, url); > https.perform(); > apidata.insert(tuple(seq, cast(string) content)); > content = []; > } > In fact he does not need foreach. Because he use it on empty result
Re: std.net.curl : Performance
On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: ... The only curl option you need to set within the loop is the CurlOption.url. So your foreach block should look more like: foreach (...) { string url = chain(apihost, only(':'), to!string(apiport), apiuri).to!string; https.handle.set(CurlOption.url, url); https.perform(); scope(failure) exit(-4); scope(exit) https.shutdown; apidata.insert(tuple(seq, cast(string) content)); content = []; } Every other line can be placed before the foreach. In fact, you don't need url in there either since it's not dependent on loop variables, and you don't need the scope guards if this is running in main (you can move them out of the loop too). foreach (...) { https.handle.set(CurlOption.url, url); https.perform(); apidata.insert(tuple(seq, cast(string) content)); content = []; }
Re: std.net.curl : Performance
On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: ... The only curl option you need to set within the loop is the CurlOption.url. So your foreach block should look more like: foreach (...) { string url = chain(apihost, only(':'), to!string(apiport), apiuri).to!string; https.handle.set(CurlOption.url, url); https.perform(); scope(failure) exit(-4); scope(exit) https.shutdown; apidata.insert(tuple(seq, cast(string) content)); content = []; } Every other line can be placed before the foreach.
Re: std.net.curl : Performance
Just delete it On Mon, Nov 9, 2020 at 9:00 PM Vino via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi All, > >Request your help to on how to improve the performance of the > below code. > > import std.conv: to; > import std.net.curl : get, HTTP, CurlOption; > import std.parallelism: parallel; > import std.range: chain, only; > import std.typecons: Tuple, tuple; > > void main () > { > Array!(Tuple!(int,string)) apidata; > Row[] result; > string apihost = "abc.com"; int apiport = 1830; string apiuri = > /getdata; > string apiuser = "user"; string apipass = "pass"; > foreach(i, k; parallel(result,1)) > { >string url = chain(apihost, only(':'), to!string(apiport), > apiuri).to!string; >string usrpass = chain(apiuser, only(':'), > apipass).to!string; >auto https = HTTP(); >https.handle.set(CurlOption.buffersize, 512000); >https.handle.set(CurlOption.userpwd, usrpass); >https.handle.set(CurlOption.connecttimeout, 600); >https.handle.set(CurlOption.tcp_nodelay, 1); >https.handle.set(CurlOption.http_version, 2); >https.handle.set(CurlOption.sslversion, 1; >https.handle.set(CurlOption.use_ssl, 3); >https.handle.set(CurlOption.ssl_verifypeer, 0); >https.handle.set(CurlOption.url, url); >https.method(HTTP.Method.get); >https.StatusLine st; >https.onReceiveStatusLine = (https.StatusLine st) { if > (st.code != 200) { throw new Exception(st.reason); } }; >ubyte[] content; >https.onReceive = (ubyte[] data) { content ~= data; return > data.length; }; >https.perform(); >scope(failure) { https.shutdown; exit(-4); } scope(exit) > https.shutdown; >apidata.insert(tuple(seq, cast(string) content)); > } > return apidata[].sort; > } > > From, > Vino.B >
std.net.curl : Performance
Hi All, Request your help to on how to improve the performance of the below code. import std.conv: to; import std.net.curl : get, HTTP, CurlOption; import std.parallelism: parallel; import std.range: chain, only; import std.typecons: Tuple, tuple; void main () { Array!(Tuple!(int,string)) apidata; Row[] result; string apihost = "abc.com"; int apiport = 1830; string apiuri = /getdata; string apiuser = "user"; string apipass = "pass"; foreach(i, k; parallel(result,1)) { string url = chain(apihost, only(':'), to!string(apiport), apiuri).to!string; string usrpass = chain(apiuser, only(':'), apipass).to!string; auto https = HTTP(); https.handle.set(CurlOption.buffersize, 512000); https.handle.set(CurlOption.userpwd, usrpass); https.handle.set(CurlOption.connecttimeout, 600); https.handle.set(CurlOption.tcp_nodelay, 1); https.handle.set(CurlOption.http_version, 2); https.handle.set(CurlOption.sslversion, 1; https.handle.set(CurlOption.use_ssl, 3); https.handle.set(CurlOption.ssl_verifypeer, 0); https.handle.set(CurlOption.url, url); https.method(HTTP.Method.get); https.StatusLine st; https.onReceiveStatusLine = (https.StatusLine st) { if (st.code != 200) { throw new Exception(st.reason); } }; ubyte[] content; https.onReceive = (ubyte[] data) { content ~= data; return data.length; }; https.perform(); scope(failure) { https.shutdown; exit(-4); } scope(exit) https.shutdown; apidata.insert(tuple(seq, cast(string) content)); } return apidata[].sort; } From, Vino.B
Re: Extract sub string from a string
On Monday, 9 November 2020 at 18:55:44 UTC, Ali Çehreli wrote: On 11/9/20 9:53 AM, k2aj wrote: > string text = "welcome2worldinfo"; > string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~ text[8..13]); If those concatenations with the ~ operators prove to be costly at runtime, the following range expression may be faster because it does not allocate any memory: import std.string; import std.range; import std.algorithm; import std.stdio; void main() { string text = "welcome2worldinfo"; auto hg = chain(text[0..7], only('-'), text[7..8], only('-'), text[8..13]).map!toUpper; writeln(hg); } Ali I am responding to this just for my personal records. I wish we could've a "add to favorites" option here.
Re: Extract sub string from a string
On Monday, 9 November 2020 at 18:55:44 UTC, Ali Çehreli wrote: On 11/9/20 9:53 AM, k2aj wrote: > string text = "welcome2worldinfo"; > string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~ text[8..13]); If those concatenations with the ~ operators prove to be costly at runtime, the following range expression may be faster because it does not allocate any memory: import std.string; import std.range; import std.algorithm; import std.stdio; void main() { string text = "welcome2worldinfo"; auto hg = chain(text[0..7], only('-'), text[7..8], only('-'), text[8..13]).map!toUpper; writeln(hg); } Ali Hi Both, Thank you very much, your solution resolved our issue.
Re: Extract sub string from a string
On 11/9/20 9:53 AM, k2aj wrote: > string text = "welcome2worldinfo"; > string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~ text[8..13]); If those concatenations with the ~ operators prove to be costly at runtime, the following range expression may be faster because it does not allocate any memory: import std.string; import std.range; import std.algorithm; import std.stdio; void main() { string text = "welcome2worldinfo"; auto hg = chain(text[0..7], only('-'), text[7..8], only('-'), text[8..13]).map!toUpper; writeln(hg); } Ali
Re: Extract sub string from a string
On Monday, 9 November 2020 at 16:00:28 UTC, Vino wrote: Hi All, Request your help on how to extract sub string from a string, below is an example in PHP, need your help on how to do the same in D. $text = "welcome2worldinfo"; $hg = strtoupper(substr($text , 0, 7).'-'.substr($text, 7, 1).'-'.substr($text, 8, 5)); print_r($hg) \\ Output : WELCOME-2-WORLD From, Vino.B Strings in D are actually immutable arrays of chars, so you can slice them to get a substring: import std.string : toUpper; string text = "welcome2worldinfo"; string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~ text[8..13]); writeln(hg);
Re: Extract sub string from a string
On Monday, 9 November 2020 at 16:00:28 UTC, Vino wrote: Hi All, Request your help on how to extract sub string from a string, below is an example in PHP, need your help on how to do the same in D. $text = "welcome2worldinfo"; $hg = strtoupper(substr($text , 0, 7).'-'.substr($text, 7, 1).'-'.substr($text, 8, 5)); print_r($hg) \\ Output : WELCOME-2-WORLD From, Vino.B Some like this: substr($text , 0, 7) // --> text[ 0 .. 7 ] substr($text, 7, 1) // --> text[ 7 .. 7+1 ] substr($text, 8, 5) // --> text[ 8 .. 8+5 ] $hg = a . b . c // --> string hg = a ~ b ~ c; strtoupper( s ) // --> s.toUpper print_r($hg) // --> writeln( hg ) And import names: import std.uni : toUpper; import std.stdio : writeln; Help: https://dlang.org/phobos/std_uni.html https://dlang.org/phobos/std_stdio.html https://dlang.org/spec/arrays.html#strings
Re: Unicode Regular Expressions
On Mon, Nov 09, 2020 at 03:39:05PM +, Per Nordlöw via Digitalmars-d-learn wrote: > Is there any library that can deal with decoding and generating > character matchers for Unicode regular expression described at > > https://www.regular-expressions.info/unicode.html I'm pretty sure std.regex already supports Unicode regexes. T -- Written on the window of a clothing store: No shirt, no shoes, no service.
Re: DMD: invalid UTF character `\U0000d800`
On Sunday, 8 November 2020 at 10:47:34 UTC, Per Nordlöw wrote: Can I just do, for instance, cast(dchar)0xd8000 for `\Ud800` to accomplish this? There's also: dchar(0xd8000)
Extract sub string from a string
Hi All, Request your help on how to extract sub string from a string, below is an example in PHP, need your help on how to do the same in D. $text = "welcome2worldinfo"; $hg = strtoupper(substr($text , 0, 7).'-'.substr($text, 7, 1).'-'.substr($text, 8, 5)); print_r($hg) \\ Output : WELCOME-2-WORLD From, Vino.B
Re: asdf get first value from a json string.
On Sunday, 8 November 2020 at 19:31:50 UTC, frame wrote: On Sunday, 8 November 2020 at 19:29:39 UTC, frame wrote: On Sunday, 8 November 2020 at 16:30:40 UTC, Vino wrote: Request your help on how to get the first value of "type" from the below json, the expected output required is as below, You need a data structure to work with, eg: static struct S { string characteristicValue; } foreach (ref j; parseJson(data)["items"].byElement()) { auto sArr = j["type"].deserialize!(S[]); writefln("value: %s", s[0].characteristicValue); } Then split your S.characteristicValue into tokens with std.array.split writefln("value: %s", sArr[0].characteristicValue); Hi, Thank you very much, your solution resolved the issue.
Unicode Regular Expressions
Is there any library that can deal with decoding and generating character matchers for Unicode regular expression described at https://www.regular-expressions.info/unicode.html
Re: New vs length on dymamic array
On Monday, 9 November 2020 at 09:05:58 UTC, Imperatorn wrote: On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; You can check using compiler explorer: https://godbolt.org/ Cool tool! Array creation disassemble: https://godbolt.org/z/GzxWao
Re: New vs length on dymamic array
On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; It's the same. If the two are valid then you are in a function. So it's an alloca for the dynamic array payload (8+8 bytes on x86_64) then a LengthExpression that will lead to a GC.malloc, and finally a memset for all the elements default values.
Re: New vs length on dymamic array
On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; In theory auto array = new wchar[111]; // or new wchar[](111); should do less work, but in practice I would guess there will be almost zero difference in speed. If you need to create new dynamic array with known size you should prefere auto array = new wchar[111]; // or new wchar[](111); because it is make much more sense than create empty non initialized array and then set it a length
Re: New vs length on dymamic array
On Monday, 9 November 2020 at 09:05:58 UTC, Imperatorn wrote: On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; You can check using compiler explorer: https://godbolt.org/ I don't understand assembly, so this does not tell me anything useful. Are there any reasons to prefer one over the other? I assume this is what OP is actually asking about.
Re: New vs length on dymamic array
On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; You can check using compiler explorer: https://godbolt.org/
New vs length on dymamic array
Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111;