Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-11 Thread Vino.B via Digitalmars-d-learn

On Monday, 11 September 2017 at 08:55:21 UTC, Vino.B wrote:

On Sunday, 10 September 2017 at 23:10:20 UTC, Ali Çehreli wrote:

On 09/10/2017 09:53 AM, Vino.B wrote:

> auto coSizeDirList (string FFs, int SizeDir) {

> //alias DirSizeList = typeof(coSizeDirList());

I worked with a version of coSizeDirList() that did not take 
any parameters. (Could be from an earlier post of yours.)


In this case, you can must use a compilable expression. Since 
coSizeDirList above takes a string and int, you can get its 
return value like this:


  alias DirSizeList = typeof(coSizeDirList(string.init, 
int.init))


The following can work as well:

  alias DirSizeList = typeof(coSizeDirList("", 42))

However, there are other compilation errors when I do that.

Ali


Hi Ali,

The issue occurs at the line "MSresult.get ~= MSizeDirListData" 
when we try to append data the error message is as below, if we 
change this line to "MSresult.get = MSizeDirListData" then the 
code complies without any issue but the output is empty.


T2.d(41): Error: cannot append type 
Tuple!(RangeT!(Array!string), RangeT!(Array!ulong)) to type 
Tuple!(RangeT!(Array!string), RangeT!(Array!ulong))



Code:

import core.stdc.stdlib: exit;
import std.algorithm: all, among, filter, map, setDifference, 
sort, uniq, each, joiner;

import std.array: appender, join;
import std.container.array;
import std.conv: to;
import std.datetime.systime: Clock, days, SysTime;
import std.file: SpanMode, dirEntries, exists, isFile, mkdir, 
remove, rmdirRecurse;

import std.getopt;
import std.parallelism: parallel, task, taskPool;
import std.path: absolutePath, baseName, dirName, 
isValidFilename, isValidPath, globMatch;

import std.range: empty;
import std.stdio: File, writefln, writeln;
import std.string: chomp, chop, isNumeric, split, strip;
import std.typecons: tuple, Tuple;
import std.uni: isAlpha, toLower, isWhite;

auto coSizeDirList (string FFs, int SizeDir) {
ulong subdirTotal;
ulong subdirTotalGB;
Array!string Subdir;
Array!ulong Subsize;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);
}

void ptSizeDirList (string[] SizeDirlst, int SizeDir) {
 alias DirSizeList = typeof(coSizeDirList(string.init, 
ulong.init));

 auto MSresult = taskPool.workerLocalStorage!DirSizeList();
 foreach (string Fs; parallel(SizeDirlst[0 .. $], 1)) {
auto FFs = Fs.strip;
auto MSizeDirList = task(, FFs, SizeDir);
MSizeDirList.executeInNewThread();
auto MSizeDirListData = MSizeDirList.workForce;
//MSresult.get ~= MSizeDirListData;
MSresult.get = MSizeDirListData;
}
foreach(i; MSresult.tupleof)
		//if (!i.empty) { writefln("%(%-(%-63s %)\n%)", 
i[].sort!((a,b) => a[0] < b[0]).uniq); }

writeln(i);
}

void main () {
string SizeDirlst = "C:\\Temp\\TEAM\\BACKUP";
int SizeDir = 1;
coSizeDirList(SizeDirlst, SizeDir);
}

From,
Vino.B


Hi Ali,


  At last was able to resolve the issue, thank you very much for 
all your help. below is the working code.


Program:
import core.stdc.stdlib: exit;
import std.algorithm: all, among, filter, map, setDifference, 
sort, uniq, each, joiner;

import std.array: appender, join;
import std.container.array;
import std.conv: to;
import std.datetime.systime: Clock, days, SysTime;
import std.file: SpanMode, dirEntries, exists, isFile, mkdir, 
remove, rmdirRecurse;

import std.getopt;
import std.parallelism: parallel, task, taskPool;
import std.path: absolutePath, baseName, dirName, 
isValidFilename, isValidPath, globMatch;

import std.range: empty, zip;
import std.stdio: File, writefln, writeln;
import std.string: chomp, chop, isNumeric, split, strip;
import std.typecons: tuple, Tuple;
import std.uni: isAlpha, toLower, isWhite;

auto coSizeDirList (string FFs, ulong SizeDir) {
ulong subdirTotal;
ulong subdirTotalGB;
Array!string Subdir;
Array!ulong Subsize;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024);
if (subdirTotalGB > SizeDir) { Subdir ~= d; 

Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-11 Thread Vino.B via Digitalmars-d-learn

On Sunday, 10 September 2017 at 23:10:20 UTC, Ali Çehreli wrote:

On 09/10/2017 09:53 AM, Vino.B wrote:

> auto coSizeDirList (string FFs, int SizeDir) {

> //alias DirSizeList = typeof(coSizeDirList());

I worked with a version of coSizeDirList() that did not take 
any parameters. (Could be from an earlier post of yours.)


In this case, you can must use a compilable expression. Since 
coSizeDirList above takes a string and int, you can get its 
return value like this:


  alias DirSizeList = typeof(coSizeDirList(string.init, 
int.init))


The following can work as well:

  alias DirSizeList = typeof(coSizeDirList("", 42))

However, there are other compilation errors when I do that.

Ali


Hi Ali,

The issue occurs at the line "MSresult.get ~= MSizeDirListData" 
when we try to append data the error message is as below, if we 
change this line to "MSresult.get = MSizeDirListData" then the 
code complies without any issue but the output is empty.


T2.d(41): Error: cannot append type Tuple!(RangeT!(Array!string), 
RangeT!(Array!ulong)) to type Tuple!(RangeT!(Array!string), 
RangeT!(Array!ulong))



Code:

import core.stdc.stdlib: exit;
import std.algorithm: all, among, filter, map, setDifference, 
sort, uniq, each, joiner;

import std.array: appender, join;
import std.container.array;
import std.conv: to;
import std.datetime.systime: Clock, days, SysTime;
import std.file: SpanMode, dirEntries, exists, isFile, mkdir, 
remove, rmdirRecurse;

import std.getopt;
import std.parallelism: parallel, task, taskPool;
import std.path: absolutePath, baseName, dirName, 
isValidFilename, isValidPath, globMatch;

import std.range: empty;
import std.stdio: File, writefln, writeln;
import std.string: chomp, chop, isNumeric, split, strip;
import std.typecons: tuple, Tuple;
import std.uni: isAlpha, toLower, isWhite;

auto coSizeDirList (string FFs, int SizeDir) {
ulong subdirTotal;
ulong subdirTotalGB;
Array!string Subdir;
Array!ulong Subsize;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);
}

void ptSizeDirList (string[] SizeDirlst, int SizeDir) {
 alias DirSizeList = typeof(coSizeDirList(string.init, 
ulong.init));

 auto MSresult = taskPool.workerLocalStorage!DirSizeList();
 foreach (string Fs; parallel(SizeDirlst[0 .. $], 1)) {
auto FFs = Fs.strip;
auto MSizeDirList = task(, FFs, SizeDir);
MSizeDirList.executeInNewThread();
auto MSizeDirListData = MSizeDirList.workForce;
//MSresult.get ~= MSizeDirListData;
MSresult.get = MSizeDirListData;
}
foreach(i; MSresult.tupleof)
		//if (!i.empty) { writefln("%(%-(%-63s %)\n%)", i[].sort!((a,b) 
=> a[0] < b[0]).uniq); }

writeln(i);
}

void main () {
string SizeDirlst = "C:\\Temp\\TEAM\\BACKUP";
int SizeDir = 1;
coSizeDirList(SizeDirlst, SizeDir);
}

From,
Vino.B


Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-10 Thread Ali Çehreli via Digitalmars-d-learn

On 09/10/2017 09:53 AM, Vino.B wrote:

> auto coSizeDirList (string FFs, int SizeDir) {

> //alias DirSizeList = typeof(coSizeDirList());

I worked with a version of coSizeDirList() that did not take any 
parameters. (Could be from an earlier post of yours.)


In this case, you can must use a compilable expression. Since 
coSizeDirList above takes a string and int, you can get its return value 
like this:


  alias DirSizeList = typeof(coSizeDirList(string.init, int.init))

The following can work as well:

  alias DirSizeList = typeof(coSizeDirList("", 42))

However, there are other compilation errors when I do that.

Ali



Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-10 Thread Vino.B via Digitalmars-d-learn

On Sunday, 10 September 2017 at 15:46:46 UTC, Ali Çehreli wrote:

On 09/10/2017 04:54 AM, Vino.B wrote:

> Thank you very much, as stated by you i used the auto
function and now
> i am get the output without any warnings

That's because now you're taking advantage of D's type 
inference. Although it doesn't cover the entire story, you may 
want to read about D's Voldemort types. (Your case did not 
involve Voldemort types though; in your case it was just a 
private symbol.)


So, you can give a name to that return value yourself:

alias DirSizeList = typeof(coSizeDirList());

> Sub Function:

Unrelated: They are all called "functions" in D.

>  //Array!string MStext;
>  string[][] MStext; // Getting Error on this line, while
trying to
> change it to auto;
>  auto MSresult = taskPool.workerLocalStorage(MStext);

Now you can use DirSizeList there:

auto MSresult = taskPool.workerLocalStorage!DirSizeList();

Ali


Hi Ali,

 I tried to add/replace the above line's but still not working.

Error: function T2.coSizeDirList (string FFs, int SizeDir) is not 
callable using argument types ()


import core.stdc.stdlib: exit;
import std.algorithm: all, among, filter, map, setDifference, 
sort, uniq, each, joiner;

import std.array: appender, join;
import std.container.array;
import std.conv: to;
import std.datetime.systime: Clock, days, SysTime;
import std.file: SpanMode, dirEntries, exists, isFile, mkdir, 
remove, rmdirRecurse;

import std.getopt;
import std.parallelism: parallel, task, taskPool;
import std.path: absolutePath, baseName, dirName, 
isValidFilename, isValidPath, globMatch;

import std.range: empty;
import std.stdio: File, writefln, writeln;
import std.string: chomp, chop, isNumeric, split, strip;
import std.typecons: tuple, Tuple;
import std.uni: isAlpha, toLower, isWhite;

auto coSizeDirList (string FFs, int SizeDir) {
ulong subdirTotal;
ulong subdirTotalGB;
Array!string Subdir;
Array!ulong Subsize;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);
//  alias DirSizeList = typeof(coSizeDirList());
}
//alias DirSizeList = typeof(coSizeDirList());
void ptSizeDirList (string[] SizeDirlst, int SizeDir) {
 try {
//alias DirSizeList = typeof(coSizeDirList());
 auto MSresult = taskPool.workerLocalStorage!DirSizeList();
 writeln("Function \t :  List the Folder whose Size greater then 
", SizeDir, " GB");

 writeln("Dir. Scanned \t :", SizeDirlst);
 
writeln("");

 writefln("%-63s %.20s", "File Name", "Size (GB)");
 
writeln("");

 foreach (string Fs; parallel(SizeDirlst[0 .. $], 1)) {
auto FFs = Fs.strip;
auto MSizeDirList = task(, FFs, SizeDir);
MSizeDirList.executeInNewThread();
auto MSizeDirListData = MSizeDirList.workForce;
MSresult.get ~= MSizeDirListData;
}
foreach(i; MSresult.toRange)
if (!i.empty) {
			writefln("%(%-(%-63s %)\n%)", i[].sort!((a,b) => a[0] < 
b[0]).uniq); }


writeln("");
} catch (Exception e) { writeln(e.msg); }
}

void main () {
string SizeDirlst = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 10;
coSizeDirList(SizeDirlst, SizeDir);
}


Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-10 Thread Ali Çehreli via Digitalmars-d-learn

On 09/10/2017 04:54 AM, Vino.B wrote:

> Thank you very much, as stated by you i used the auto function and now
> i am get the output without any warnings

That's because now you're taking advantage of D's type inference. 
Although it doesn't cover the entire story, you may want to read about 
D's Voldemort types. (Your case did not involve Voldemort types though; 
in your case it was just a private symbol.)


So, you can give a name to that return value yourself:

alias DirSizeList = typeof(coSizeDirList());

> Sub Function:

Unrelated: They are all called "functions" in D.

>  //Array!string MStext;
>  string[][] MStext; // Getting Error on this line, while trying to
> change it to auto;
>  auto MSresult = taskPool.workerLocalStorage(MStext);

Now you can use DirSizeList there:

auto MSresult = taskPool.workerLocalStorage!DirSizeList();

Ali



Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-10 Thread Vino.B via Digitalmars-d-learn

On Friday, 8 September 2017 at 23:48:14 UTC, Ali Çehreli wrote:

On 09/08/2017 11:21 AM, Vino.B wrote:

> One final help on how to print the below
> output , just in case if this issue is fixed in next release,
>
> Output:
> [Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\dir1"),
> Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\DND5")][34, 4]
>
> Required output:
> C:\\Temp\\sapnas2\\BACKUP\\dir1 34
> C:\\Temp\\sapnas2\\BACKUP\\DND5  4

std.algorithm.zip can help:

void main () {
auto results = coSizeDirList();
auto dirs = results[][0];// A range
auto sizes = results[][1];   // Another range
auto combined = zip(dirs, sizes);// Corresponding 
elements linked


foreach (result; combined) {
auto dir = result[0]; // The element from the first 
range
auto size = result[1];// The element from the 
second range

writefln("%-40s %20s", dir, size);
}
}

Ali


Hi Ali,

 Thank you very much, as stated by you i used the auto function 
and now i am get the output without any warnings, but this do not 
help me in my overall program, meaning, when i call this sub 
function  from the main thread function program it is not working 
as expected and throwing an error.


Sub Function:

auto coSizeDirList (string FFs, int SizeDir) {
ulong subdirTotal;
ulong subdirTotalGB;
Array!string Subdir;
Array!ulong Subsize;
//Tuple!((Array!string), (Array!string)) Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);

}

Main Thread function :
void ptSizeDirList (string[] SizeDirlst, int SizeDir) {
 try {
 //Array!string MStext;
 string[][] MStext; // Getting Error on this line, while 
trying to change it to auto;

 auto MSresult = taskPool.workerLocalStorage(MStext);
 logF.writeln("Function \t :  List the Folder whose Size greater 
then ", SizeDir, " GB");

 logF.writeln("Dir. Scanned \t :", SizeDirlst);
 
logF.writeln("");

 logF.writefln("%-63s %.20s", "File Name", "Size (GB)");
 
logF.writeln("");

 foreach (string Fs; parallel(SizeDirlst[0 .. $], 1)) {
auto FFs = Fs.strip;
auto MSizeDirList = task(, FFs, SizeDir);
MSizeDirList.executeInNewThread();
auto MSizeDirListData = MSizeDirList.workForce;
MSresult.get ~= MSizeDirListData;
}
foreach(i; MSresult.toRange)
if (!i.empty) {
			writefln("%(%-(%-63s %)\n%)", i[].sort!((a,b) => a[0] < 
b[0]).uniq); }


writeln("");
} catch (Exception e) { writeln(e.msg); }
}

void main () {
string SizeDirlst = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;

ptSizeDirList(SizeDirlst, SizeDir);
}

Error:
Error: no identifier for declarator MStext
Deprecation: use { } for an empty statement, not ;



Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-08 Thread Ali Çehreli via Digitalmars-d-learn

On 09/08/2017 11:21 AM, Vino.B wrote:

> One final help on how to print the below
> output , just in case if this issue is fixed in next release,
>
> Output:
> [Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\dir1"),
> Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\DND5")][34, 4]
>
> Required output:
> C:\\Temp\\sapnas2\\BACKUP\\dir1 34
> C:\\Temp\\sapnas2\\BACKUP\\DND5  4

std.algorithm.zip can help:

void main () {
auto results = coSizeDirList();
auto dirs = results[][0];// A range
auto sizes = results[][1];   // Another range
auto combined = zip(dirs, sizes);// Corresponding elements linked

foreach (result; combined) {
auto dir = result[0]; // The element from the first range
auto size = result[1];// The element from the second range
writefln("%-40s %20s", dir, size);
}
}

Ali



Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-08 Thread Vino.B via Digitalmars-d-learn

On Friday, 8 September 2017 at 16:58:35 UTC, Ali Çehreli wrote:

On 09/08/2017 07:48 AM, Vino.B wrote:

> if
> std.container.array.RangeT(A) is deprecated

No, it's not deprecated. It's a private symbol of the 
std.container.array module. You shouldn't be able to use it at 
all. The fact that you are able to use it is due to a bug fix, 
which hasn't been fully activated yet. The bug is fixed but the 
compiler is still letting you use the symbol until the bug is 
effective in some future date.


In summary, you should not refer to RangeT in your code at all. 
Use auto return types if you have to but I'm happy to see that 
you've solved the remaining issues.


> subdirTotalGB = (subdirTotal/1024/1024); {
Subdir ~= d;

That should be MB, right? Kilo, mega, giga, etc.

Ali


Hi Ali,

 Sure, will wait for the fix, and for the line "subdirTotalGB = 
(subdirTotal/1024/1024); {
Subdir ~= d;" that's ok the issue  was rising from the line 
"string[][]" as you know std.container array do not have the 
capability of multi dimensional array hence i need to change it 
back from "Tuple!((Array!string), (Array!string)) Result;" which 
was causing the issue, will try it once again once the issue is 
fixed. Once again thank you very much for you help. One final 
help on how to print the below output , just in case if this 
issue is fixed in next release,


Output:
[Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\dir1"),  
Tuple!string("C:\\Temp\\sapnas2\\BACKUP\\DND5")][34, 4]


Required output:
C:\\Temp\\sapnas2\\BACKUP\\dir1 34
C:\\Temp\\sapnas2\\BACKUP\\DND5  4

From,
Vino.B




Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-08 Thread Ali Çehreli via Digitalmars-d-learn

On 09/08/2017 07:48 AM, Vino.B wrote:

> if
> std.container.array.RangeT(A) is deprecated

No, it's not deprecated. It's a private symbol of the 
std.container.array module. You shouldn't be able to use it at all. The 
fact that you are able to use it is due to a bug fix, which hasn't been 
fully activated yet. The bug is fixed but the compiler is still letting 
you use the symbol until the bug is effective in some future date.


In summary, you should not refer to RangeT in your code at all. Use auto 
return types if you have to but I'm happy to see that you've solved the 
remaining issues.


> subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d;

That should be MB, right? Kilo, mega, giga, etc.

Ali



Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-08 Thread Vino.B via Digitalmars-d-learn

On Friday, 8 September 2017 at 15:47:39 UTC, Vino.B wrote:

On Friday, 8 September 2017 at 14:48:38 UTC, Vino.B wrote:

Hi All,

  The below code output's the below warning, so if 
std.container.array.RangeT(A) is deprecated then what is the 
equivalent for this, request your help on this.


Warning :
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
["C:\\Temp\\sapnas2\\BACKUP\\dir1", 
"C:\\Temp\\sapnas2\\BACKUP\\DND3", 
"C:\\Temp\\sapnas2\\BACKUP\\DND5"][34, 1, 5]


Code:
import std.algorithm: filter, map, fold;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

Tuple!(RangeT!(Array!string), RangeT!(Array!ulong)) 
coSizeDirList () {

string FFs = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;
ulong subdirTotal;
ulong subdirTotalGB;
Array!(string) Subdir;
Array!(ulong) Subsize;
Tuple!((Array!string), (Array!string)) Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);

}

void main () {
writeln(coSizeDirList[]);
}

From,
Vino.B


Hi All,

 Was able to resolve the above issue but not sure whether it is 
correct and now i am getting the output as below, request your 
help.

Output:
C:\Temp\sapnas2\BACKUP\dir1, 34, C:\Temp\sapnas2\BACKUP\DND3, 
1, C:\Temp\sapnas2\BACKUP\DND5, 5


Required Output:
C:\Temp\sapnas2\BACKUP\dir134
C:\Temp\sapnas2\BACKUP\DND3 1
C:\Temp\sapnas2\BACKUP\DND5 5

Program:
import std.algorithm: filter, map, fold;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

Array!string coSizeDirList () {
string FFs = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;
ulong subdirTotal;
ulong subdirTotalGB;
Array!(string) Subsize;
Array!string Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Result ~= d; 
Result ~= to!string(subdirTotalGB); }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return Result;
}

void main () {
writefln("%-(%s, %)", coSizeDirList[]);
}

From,
Vino.B


Hi All,

 At last was able to resolve the issue including the output too, 
thank you very much for your help, please let me know in case if 
you find any issue with the below code.


import std.algorithm: filter, map;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

string[][] coSizeDirList () {
string FFs = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;
ulong subdirTotal;
ulong subdirTotalGB;
Array!(string) Subsize;
string[][] Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024);
if (subdirTotalGB > SizeDir) { Result ~= [[d] ~ 
[to!string(subdirTotalGB)]]; }

subdirTotal = 0;
}
return Result;
}

void main () {
writefln("%(%-(%-63s %)\n%)", coSizeDirList[]);
}

From,
Vino.B


Re: Deprecation: std.container.array.RangeT(A) is not visible from module Size

2017-09-08 Thread Vino.B via Digitalmars-d-learn

On Friday, 8 September 2017 at 14:48:38 UTC, Vino.B wrote:

Hi All,

  The below code output's the below warning, so if 
std.container.array.RangeT(A) is deprecated then what is the 
equivalent for this, request your help on this.


Warning :
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
Size.d(10): Deprecation: std.container.array.RangeT(A) is not 
visible from module Size
["C:\\Temp\\sapnas2\\BACKUP\\dir1", 
"C:\\Temp\\sapnas2\\BACKUP\\DND3", 
"C:\\Temp\\sapnas2\\BACKUP\\DND5"][34, 1, 5]


Code:
import std.algorithm: filter, map, fold;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

Tuple!(RangeT!(Array!string), RangeT!(Array!ulong)) 
coSizeDirList () {

string FFs = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;
ulong subdirTotal;
ulong subdirTotalGB;
Array!(string) Subdir;
Array!(ulong) Subsize;
Tuple!((Array!string), (Array!string)) Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Subdir ~= d; 
Subsize ~= subdirTotalGB; }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return tuple (Subdir[], Subsize[]);

}

void main () {
writeln(coSizeDirList[]);
}

From,
Vino.B


Hi All,

 Was able to resolve the above issue but not sure whether it is 
correct and now i am getting the output as below, request your 
help.

Output:
C:\Temp\sapnas2\BACKUP\dir1, 34, C:\Temp\sapnas2\BACKUP\DND3, 1, 
C:\Temp\sapnas2\BACKUP\DND5, 5


Required Output:
C:\Temp\sapnas2\BACKUP\dir134
C:\Temp\sapnas2\BACKUP\DND3 1
C:\Temp\sapnas2\BACKUP\DND5 5

Program:
import std.algorithm: filter, map, fold;
import std.container;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.stdio: File, writefln, writeln;
import std.typecons: tuple, Tuple;
import std.parallelism: parallel;
import std.conv;
import std.range;

Array!string coSizeDirList () {
string FFs = "C:\\Temp\\sapnas2\\BACKUP";
int SizeDir = 1;
ulong subdirTotal;
ulong subdirTotalGB;
Array!(string) Subsize;
Array!string Result;
	auto dFiles = Array!string ((dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));

foreach (d; dFiles[]) {
auto SdFiles = Array!ulong(dirEntries(d, 
SpanMode.depth).map!(a => a.size));

foreach(f; SdFiles[]) { subdirTotal += f; }
subdirTotalGB = (subdirTotal/1024/1024); { Result ~= d; 
Result ~= to!string(subdirTotalGB); }

if (subdirTotalGB > SizeDir)
subdirTotal = 0;
}
return Result;
}

void main () {
writefln("%-(%s, %)", coSizeDirList[]);
}

From,
Vino.B