1. AI fun
- Posted by ChrisB (moderator) 3 days ago
- 109 views
- Last edited 2 days ago
Asked AI to write me proggy to conflate and extract some stuff from a buch of files. 15 mins from start of prompt to file - I'm getting lazier and lazier
How odd - when I tried to post eucode between tags, get a file server error
and without the eucode tags too
Internal Error Fatal run-time error: Couldn't insert new message: Incorrect string value: '\x92s HTM...' for column `c2_euwebprod`.`messages`.`body` at row 1
and that's the error I get. CLearly doesn't appreciate co-pilot code
Cheers
Didn't work between here either
And also won't paste into a paste bin either. Very strange.
Here's a link to the code if anyone wants to have a go pasting it on here.
https://app.box.com/s/85ksmztxitpe9rdu998vynl7fzzz1zxm
Cheers Chris
2. Re: AI fun
- Posted by andreasWagner 2 days ago
- 78 views
Asked AI to write me proggy to conflate and extract some stuff from a buch of files. 15 mins from start of prompt to file - I'm getting lazier and lazier
How odd - when I tried to post eucode between tags, get a file server error
and without the eucode tags too
Internal Error Fatal run-time error: Couldn't insert new message: Incorrect string value: '\x92s HTM...' for column `c2_euwebprod`.`messages`.`body` at row 1
and that's the error I get. CLearly doesn't appreciate co-pilot code
Cheers
Didn't work between here either
And also won't paste into a paste bin either. Very strange.
Here's a link to the code if anyone wants to have a go pasting it on here.
https://app.box.com/s/85ksmztxitpe9rdu998vynl7fzzz1zxm
Cheers Chris
-- notepad_extract.ex -- -- Usage: -- eui notepad_extract.ex output.txt file1.html file2.html file3.html ... -- -- For each HTML file: -- - Extracts title between <anotepadtitle>...</anotepadtitle> -- - Extracts content between <anotepadcontent>...</anotepadcontent> -- - Writes to output as: -- -- Title text -- ========== -- Content text -- -- - Blank line between notes include std/io.e include std/text.e include std/sequence.e include std/filesys.e function read_file_as_text(sequence filename) integer fh = open(filename, "r") if fh = -1 then printf(STDERR, "Could not open file: %s\n", {filename}) return "" end if sequence data = "" object line while 1 do line = gets(fh) if atom(line) then exit end if data &= line end while close(fh) return data end function function extract_between(sequence text, sequence start_tag, sequence end_tag) integer start_pos = match(start_tag, text) if start_pos = 0 then return "" end if start_pos += length(start_tag) integer end_pos = match(end_tag, text[start_pos..$]) if end_pos = 0 then return "" end if end_pos = start_pos + end_pos - 2 return text[start_pos..end_pos] end function procedure write_note(integer out_fh, sequence title, sequence content) -- Trim whitespace title = trim(title) content = trim(content) if length(title) = 0 and length(content) = 0 then return end if -- Title puts(out_fh, title & "\n") -- Underline with '=' same length as title sequence underline = repeat('=', length(title)) puts(out_fh, underline & "\n") -- Content puts(out_fh, content & "\n\n") end procedure procedure main() sequence cmd = command_line() sequence HTML_list = {} integer out_name, out_fh /* AI generated code -- cmd[1] = interpreter, cmd[2] = script name if length(cmd) < 4 then puts(STDERR, "Usage:\n" & " eui notepad_extract.ex output.txt file1.html file2.html ...\n") abort(1) end if sequence out_name = cmd[3] integer out_fh = open(out_name, "w") if out_fh = -1 then printf(STDERR, "Could not open output file: %s\n", {out_name}) abort(1) end if */ --with no command line, just going to get a list of all HTML files HTML_list = dir(current_dir() & "\\*.html") out_fh = open("ANotepad_all.txt", "w") if out_fh = -1 then printf(STDERR, "Could not open output file: %s\n", {out_name}) abort(1) end if -- Process each HTML file for i = 1 to length(HTML_list) do sequence fname = HTML_list[i][D_NAME] printf(STDOUT, "Processing %s...\n", {fname}) sequence html = read_file_as_text(fname) if length(html) = 0 then continue end if -- Handle both correct and slightly malformed closing tags for safety sequence title = extract_between( html, "<anotepadtitle>", "</anotepadtitle>" ) sequence content = extract_between( html, "<anotepadcontent>", "</anotepadcontent>" ) -- If the user s HTML has a typo like </anotepadcontent)>, try that too if length(content) = 0 then content = extract_between( html, "<anotepadcontent>", "</anotepadcontent)>" ) end if write_note(out_fh, title, content) end for close(out_fh) printf(STDOUT, "Done. Notes written to %s\n", {out_name}) end procedure main() /*This was the prompt write me a euphoria program, that I can feed many htmles to, tat will analyse the content and produce a single text file. The analysis should produce a title and content for each note. The title should be underlined by "=". The html file contains a title and a content for each note. The title is delineated within <anotepadtitle></anotepadtitle> and the content is delineated between <anotepadcontent></anotepadcontent) */
3. Re: AI fun
- Posted by ChrisB (moderator) 2 days ago
- 62 views
Well, that's odd - thanks anyway!
Chris
4. Re: AI fun
- Posted by andreasWagner 2 days ago
- 55 views
Well, that's odd - thanks anyway!
Chris
I've had this problem before. That's why I always send text from the web browser through MS-Edit, convert it to US-ASCII, and then check at least twice to see if I see any strange characters. Yes, I also save and reload twice.
Of course, I did the same with your text.
Hope that helps.

