Scripts: The example of the work with the CSV file as with a table - page 2

 
i_logic:
Woah, is it even possible to post such codes here? O_o

1) This is an example of work that I haven't seen either in documentation or in CodeBase

2) Is it normal code to colour an already published code or to pair two or three mashes with different averaging and then clone them based on adding colouring? I tried to bring an idea, not a ready-made solution, which is as useless in trading as half of the published solutions.

 
lazarev-d-m:
Is that comparing it to me, or is that as a fact?)))))

it's about filling the kotobase.

I thought (I repent) that you actually made a library for reading tabular files and a class for working with tabular data. Read/Insert rows/delete cells, etc.

But when I clicked the "view code" button - it took me a long time to find where to set your described nuance "need to know the number of columns".
After a minute poking into the code I realised that my mind is too narrow-minded to understand this, how can one publish such endeavours.

 
sergeev:

it's about filling the cat database.

I thought (I repent) that you actually made a library for reading table files and a class for working with table data. Read/Insert rows/delete cells, etc.

But when I clicked the "view code" button - it took me a long time to find where to set your described nuance "need to know the number of columns".
After a minute poking into the code I realised that my mind is too narrow-minded to understand this, how can one publish such endeavours.

Ok, now the criticism is fully understood and reasoned, we'll fix it
 
lazarev-d-m:

1) This is an example of work that I haven't seen either in documentation or in CodeBase

2) Is it normal code to colour an already published code or to pair two or three mashes with different averaging and clone them again based on adding colouring? I tried to bring an idea, not a ready-made solution, which is as useless in trading as half of the published solutions.

1. You have a bad working example. You should realise that your code will be viewed by thousands of beginners and that your example will teach them the correctness of the code. And instead of that we have -

2. There is no error checking. There is no check that the file may end without reading the required field. No check for reading a row before the end of extra columns. Not a single line of comments about what is done and why.

And it's not about colouring the code.
The code can be valuable without any output on the chart at all - just as a set of important and useful functions.

In general, I'm still surprised how the administration could miss it.

PS

input int nCol=4; // Number of columns in the file

void OnStart()
{
  string column[]; ArrayResize(column, nCol); 
  int filehandle=FileOpen("News.csv",FILE_READ|FILE_CSV|FILE_ANSI,';'); if (h<=0) return; // open the data file
  for (int i=0; i<nCol; i++) // read the first line
  {
    column[i]=FileReadString(filehandle);
    Alert("column",i,"=",column[i]);
  }
  // go through all rows and read until we get the value of "true" in the last column.
  while(column[nCol-1]!="true" && !FileIsEnding(h))
    for (int i=0; i<nCol; i++) column[i]=FileReadString(filehandle); 

  if (column[nCol-1]=="true") Alert("The thing you're looking for is in ",column[0],"-th line."); else Alert("Search not found.");
  
  FileClose(filehandle);
}
 
sergeev:

1. You must realise that thousands of newcomers will look at your code and that your example will teach them the correctness of the code. And instead of that, you have -

2. There is no error checking. There is no check that the file may end without reading the required field. There is no check for reading a row to the end of extra columns. Not a single line of commentary about what is done and why.

And it's not about colouring the code.
The code can be valuable without any output on the chart at all - just as a set of important and useful functions.

In general, I'm still surprised how the administration could miss it.

PS

I will do my best, I will take into account mistakes in everything, this is the first experience, you can't become a GODZILLA from the first time))))))
 
sergeev:
Ayyayy -- one of the first rules -- grab a resource -- immediately write code to release it. FileClose is missing.
 
lazarev-d-m: ... you can't become a GODZILL the first time.))))

Apparently, you still don't understand why you were given the G-80 level.

That's a load of bollocks:

input string nCol=4; // Number of columns in the file

void OnStart()
{
  ....ArrayResize(column, nCol); 
  for (int i=0; i<nCol; i++) // read the first line
  {
 
TheXpert:
Ayyayy -- one of the first rules -- grab a resource -- immediately write code to release it. FileClose is missing.

No way.

There's more errors.

I'm writing this hastily.

 
Yedelkin:

This is fucked up:

Where's the kicker?
 
TheXpert: Where's the bleep?
It's totally fucked up. Can you read code or what?