1. Why no post in Stackoverflow.com
- Posted by rneu Jun 16, 2017
- 1666 views
I have recently started using OpenEuphoria and I am finding it very interesting. However, I could not find any question on Euphoria or OpenEuphoria on Stackoverflow, which is a very active site for programming related topics. This seemed surprising since OpenEuphoria appears to be very well developed now. I posted a question there but there was no response: https://stackoverflow.com/questions/44353495/reading-a-text-file-line-by-line-in-euphoria . I will be interested to know others' views on this.
2. Re: Why no post in Stackoverflow.com
- Posted by _tom (admin) Jun 16, 2017
- 1677 views
I have recently started using OpenEuphoria and I am finding it very interesting. However, I could not find any question on Euphoria or OpenEuphoria on Stackoverflow, which is a very active site for programming related topics. This seemed surprising since OpenEuphoria appears to be very well developed now. I posted a question there but there was no response: https://stackoverflow.com/questions/44353495/reading-a-text-file-line-by-line-in-euphoria . I will be interested to know others' views on this.
from stackoverflow
I am trying to read a simple csv (comma separated text file) using Euphoria langauge: #! /usr/bin/eui include get.e integer file_id = open("myfile.csv","r") if file_id != -1 then sequence input_data = gets(file_id) while sequence(input_data) do printf(1, "The string read is: %s", {input_data}) input_data = gets(file_id) end while end if printf(1, "before closing..\n") close(file_id) printf(1, "after closing..\n")
However, it end with error at the end of the file and never reaches "before closing" statement. type_check failure, input_data is -1
How can I make this detect end of the file so as to end the program normally? I tried checking documentation but could not find it.
Problems in Euphoria simplify down to atom and sequence; if you need both then use the object data-type.
Therefore you want
object input_data = gets(file_id)
The result is when a line of code is read you are reading a sequence of values. At the end of file the return is an atom, which you use to end the input loop.
If you use the object declaration you can use both data-types at the same time.
You "could" use object for every variable and you program will run. However, it is easier to read code when it is divided into atom and sequence. You can even declare your own data-types based on the default data-types.
The easy way to read a text file is:
include std/io.e fh = open ( " my_file.txt " , "r" ) data = read_file ( fh ) close ( fh ) -- data contains the entire contents of ## my_file.txt ## -- there is also write_file
If you have problems use this Forum. If you don't like the documentation complain to me directly. In the world of Euphoria, RTFM means "redact the fine manual", if it doesn't work we will fix it.
They say: "Stack Overflow has 7.3 million programmers."
I guess they need more programmers!
_tom
3. Re: Why no post in Stackoverflow.com
- Posted by _tom (admin) Jun 16, 2017
- 1634 views
In your code you are using
include get.e
That would be code from the original RDS Euphoria 3.1
So what version of ⵚE are you using?
Euphoria users now include:
- RDS Euphoria 3.1 {legacy}
- ⵚpenEuphoria 4.1
- Phix
_tom
4. Re: Why no post in Stackoverflow.com
- Posted by petelomax Jun 16, 2017
- 1657 views
I have recently started using OpenEuphoria and I am finding it very interesting. However, I could not find any question on Euphoria or OpenEuphoria on Stackoverflow, which is a very active site for programming related topics. This seemed surprising since OpenEuphoria appears to be very well developed now. I posted a question there but there was no response: https://stackoverflow.com/questions/44353495/reading-a-text-file-line-by-line-in-euphoria . I will be interested to know others' views on this.
Congratulations on posting the first ever properly-tagged Euphoria question on stackoverflow!
I've taken the liberty of answering it there, as above [object not sequence input_data]
Tom, do you have any thoughts on writing a tag wiki for OpenEuphoria?
Pete
5. Re: Why no post in Stackoverflow.com
- Posted by rneu Jun 16, 2017
- 1623 views
Thank you all for your replies. The code now works.
I am using ⵚpenEuphoria 4.1 .
I still think there should be a good presence of Euphoria on Stackoverflow now.
6. Re: Why no post in Stackoverflow.com
- Posted by _tom (admin) Jun 16, 2017
- 1611 views
Thank you all for your replies. The code now works.
I am using ⵚpenEuphoria 4.1 .
I still think there should be a good presence of Euphoria on Stackoverflow now.
Welcome to the Euphoria Languages: Euphoria, ⵚpenEuphoria, and Phix.
Thanks for your observation about Stackoverflow; it is valid and should be addressed.
Sorry, but I'm still trying to catch up on updating the ⵚE docs.
Pete. Yes, we need tag wikis. We will need to work together on this.
We are always short handed here. Here is hoping that you like Euphoria enough that you will be willing to help out.
The wordmark ⵚE is a new gimic I'm trying. It is so new that I haven't got any feedback on it.
_tom
7. Re: Why no post in Stackoverflow.com
- Posted by rneu Jun 17, 2017
- 1577 views
- Last edited Jun 20, 2017
The wordmark ⵚE is a new gimic I'm trying. It is so new that I haven't got any feedback on it.
I think it is not a good idea and it really scares the beginners. As soon as I saw ⵚE, I wondered if this is something too technical or hard-coded. What exactly does it mean? How do I pronounce it? How am I going to type it? Will I need to type Alt-numbers every time or can I copy-paste it? What functionality does it add? IMHO, it is just not in line with 'Simplicity' principle of the language.
8. Re: Why no post in Stackoverflow.com
- Posted by jmduro Jun 18, 2017
- 1508 views
The wordmark ⵚE is a new gimic I'm trying. It is so new that I haven't got any feedback on it.
I think it is not a good idea and it really scares the beginners. As soon as I saw ⵚE, it wondered if this is something too technical or hard-coded. What exactly does it mean? How do I pronounce it? How am I going to type it? Will I need to type Alt-numbers every time or can I copy-paste it? What functionality does it add? IMHO, it is just not in line with 'Simplicity' principle of the language.
I didn't find this sign in Windows character table which is already huge in size. Maybe Œ (Latin capital ligature OE) would be easier to type (Alt+0140).
Jean-Marc
9. Re: Why no post in Stackoverflow.com
- Posted by irv Jun 18, 2017
- 1481 views
Personally, I wouldn't bother, because of stackoverflow's poor reputation.
I won't enumerate the reasons for that poor reputation, a Google search will suffice.
If we do post Eu questions on stackoverflow, we can expect that Google searches for OpenEuphoria will soon be filled with negative, uninformed, and troll answers. That isn't going to help Eu's reputation.
"All publicity is good if it is intelligent." - Atlanta Constitution, January 1915
Note the 'intelligent' part :)
10. Re: Why no post in Stackoverflow.com
- Posted by petelomax Jun 18, 2017
- 1490 views
Either of
"\xE2\xB5\x9A"&"E" "\u2D5A"&"E"
should work. (tested on Phix, using MessageBoxW anyway)
Pete
11. Re: Why no post in Stackoverflow.com
- Posted by _tom (admin) Jun 19, 2017
- 1456 views
- Stack Overflow
I won't enumerate the reasons for that poor reputation, a Google search will suffice.
A quick search reveals that SO (stackoverflow) has its problems.
I certainly don't have time to hang out at SO, collect points, and frustrate myself.
- Tag Wiki at SO
Tom, do you have any thoughts on writing a tag wiki for OpenEuphoria?
Can we write a tag that essentially redirects a user to our Forum?
It looks like in six months tags get auto-deleted if not used much. Will a "Euphoria" tag survive?
- End of ⵚE
I think it is not a good idea and it really scares the beginners.
That is enough to kill the ⵚE wordmark.
_tom
12. Re: Why no post in Stackoverflow.com
- Posted by rneu Jun 25, 2017
- 1411 views
The easy way to read a text file is:
include std/io.e fh = open ( " my_file.txt " , "r" ) data = read_file ( fh ) close ( fh ) -- data contains the entire contents of ## my_file.txt ## -- there is also write_file
Thanks for this most convenient method.