Posts
-
RE: Read and Write (update) problem
Thanks to every one here (and also Thomas Thomassen) the work is now finished!
-
RE: [REQ] Grasshopper for Sketchup
It is going to be available soon!
https://www.youtube.com/watch?v=xQOgv2OedJM -
RE: Read and Write (update) problem
special thanks to you TIG, the timer was genius idea .
-
RE: Read and Write (update) problem
the problem is that I need the update-data in each cycle and the provider (the one that send the text files) is the one that decides when the reading action should stop. similar to web browsers when we want to get notified when sth changes.
I am using the sleep to make the action less frequent in the hope of achieving more/better iterations.
does that make sense? is there a better solution? -
RE: Read and Write (update) problem
well, we can change the sleep time (or we can omit it) but still 3-times reading is the best I can get out of this.
-
RE: Read and Write (update) problem
thanks for your quick reply TIG.
so the code would be sth like this:continuereading=0
def reeed(continuereading)
lines = IO.readlines("C:/GHConnection/temp.txt")
return (lines[0]).to_i
endwhile ((reeed (continuereading)))==1
puts ('I am Reading the Source file')
sleep(3)
endit works fine but again it is 2 slow; all the characters in my text-file do not add up to 100 yet after iteration 3 the solution is practically worthless.
-
RE: Read and Write (update) problem
by the way you should replace ContinueReading with continuereading
the code would be:
continuereading=0def reeed(continuereading)
k=[]
File.open("C:/GHConnection/temp.txt", "r") do |f|
f.each_line do |e|
k<<e
end
end
continuereading= k[0].to_iputs (k[0])
return continuereading
endwhile reeed(continuereading)==1
reeed(continuereading)
puts ('I am Reading the Source file')
sleep(3)
break if reeed(continuereading)==0
end -
Read and Write (update) problem
hello.
I have a Ruby code that I want to use to gather data but it is to slow;
does anybody know why>?ContinueReading=0
def reeed(ContinueReading)
k=[]
File.open("C:/TT/temp.txt", "r") do |f|
f.each_line do |e|
k<<e
end
end
ContinueReading=k[0].to_i
puts (k[0])
return ContinueReading
endwhile reeed(ContinueReading)==1
reeed(ContinueReading)
puts ('I am Reading the Source file')
sleep(3)
break if reeed(ContinueReading)==0
end