Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Emil Tchekov
You can use Replace$ to search and remove the \t character in your string.

I am not so fluent in Gambas, but the good old VB6 does support  (null
string) as replacement, so I suppose that Gambas also do this.

Just put your a_line there and search for any \t, replace with  (null
string)...

Your text will get cleared

...


Other point of mention:

It will may be better to split also the a_line on the TAB char and thus
receive semi-two dimensional array containing your values. Then you can
start (re-)creating / displaying your data properly.



kind regards


Emil


P.S. Are you physician?





-Ursprungliche Nachricht-
Von: richard terry [mailto:rte...@pacific.net.au]
Gesendet: Mittwoch, 6. Mai 2009 15:02
An: mailing list for gambas users; Ian Haywood
Betreff: [Gambas-user] help with some simple parsing


See the attached file for the data. Unfortunately I'm brain dead when it
comes
to simple logic.

In one of my hl7 messages in the Free Text segment under an actual pathology
result, there is a list of sequential bood test results representing
previous
results of the same type - , separated by tabs which I need to display
properly. as I've re-constructed the result as html, the tabs simply
disappear in the result, so I've been looking for a solution, and to start I
thought maybe I could split this up into lines and then later put it into a
table embedded in the html to keep it aligned.

Perhaps there is a simple way out, but this is what I've done so far.


So I started with this:

1) Split this into lines

Dim bits as string[]
dim a_line as string

bits = split(the_text_in_the_file,BR,, TRUE)

for each a_line in bits
print a_line
next

Problem with this is that the \t (I presume tab character) gets in the way,
and it dosn't split properly with the results of the bits[] as shown in the
picture. Interestingly an occasional letter is lost off the test names.

Any help appreciated.

richard





--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Stefano Palmeri
Il mercoledì 6 maggio 2009 15:01:45 richard terry ha scritto:
 See the attached file for the data. Unfortunately I'm brain dead when it
 comes to simple logic.

 In one of my hl7 messages in the Free Text segment under an actual
 pathology result, there is a list of sequential bood test results
 representing previous results of the same type - , separated by tabs which
 I need to display properly. as I've re-constructed the result as html, the
 tabs simply disappear in the result, so I've been looking for a solution,
 and to start I thought maybe I could split this up into lines and then
 later put it into a table embedded in the html to keep it aligned.

 Perhaps there is a simple way out, but this is what I've done so far.


 So I started with this:

 1) Split this into lines

 Dim bits as string[]
 dim a_line as string

 bits = split(the_text_in_the_file,BR,, TRUE)

 for each a_line in bits
   print a_line
 next

 Problem with this is that the \t (I presume tab character) gets in the way,
 and it dosn't split properly with the results of the bits[] as shown in the
 picture. Interestingly an occasional letter is lost off the test names.

 Any help appreciated.

 richard

You can't use BR as a separator , because BR is a list of separators. 
This is why you miss some letters, Eg. Results, Bicarb.
I will do a substitution with Replace$ to have a uniq splitting char. (I 
used @)
eg.:

PUBLIC SUB Main()

DIM bits AS string[] 
DIM a_line AS String
DIM sReplacedText AS String

   sReplacedText = Replace$(File.Load(sample_tabbed_text), BR, @)  
   
   bits = Split(sReplacedText, @, , TRUE)

   FOR EACH a_line IN bits
   PRINT a_line 
   NEXT

END

Saluti,

Stefano

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Rolf Schmidt
Hi Richard

 In one of my hl7 messages in the Free Text segment under an actual
 pathology result, there is a list of sequential bood test results
 representing previous results of the same type - , separated by tabs which
 I need to display properly. as I've re-constructed the result as html, the
 tabs simply disappear in the result, so I've been looking for a solution,
 and to start I thought maybe I could split this up into lines and then
 later put it into a table embedded in the html to keep it aligned.

 Perhaps there is a simple way out, but this is what I've done so far.

 So I started with this:

 1) Split this into lines

 Dim bits as string[]
 dim a_line as string

 bits = split(the_text_in_the_file,BR,, TRUE)

 for each a_line in bits
   print a_line
 next

 Problem with this is that the \t (I presume tab character) gets in the way,
 and it dosn't split properly with the results of the bits[] as shown in the
 picture. Interestingly an occasional letter is lost off the test names.

I didn't find any \t-char in your file. But I think it is a table, where the 
first line hold the column headers and each line starts with a word. So I 
suggest, that you keep the newline - perhaps the char which you substitute 
with the br-Tag - as it is. Then compress all spaces to one space and 
substitute this to \t (i.e. tab-chars).
A shell command like the follwoing one will do this:

cat sample_text | tr -s ' '  | tr ' ' \t  converted_text

(Perhaps a gambas-guru can translate the line in a simple Gambas statement)

Now you can split your converted_text in an array of lines. Use the first 
array entry for your the column headers of a listview (but split the line by 
the \t char)

Do the same for all the other lines and you will get a nice table.
Of course you can create a html-table as well, if you have your data in the 
suggested format.

Hope that helps
Rolf


signature.asc
Description: This is a digitally signed message part.
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Stephen Bungay
   Hi Richard

This code snippet will dump the text into a TextArea for you, it 
asumes (a bad thing) that there are no newline characters in the data 
and as such works with your sample. I used a button to launch the 
code... the important bits are in the middle... :)

PUBLIC SUB ButtonGO_Click()
   DIM hFile AS File
   DIM LineInput AS String
   DIM ScrapString AS String
   DIM SPlitString AS String[]

   hFile = OPEN /home/bungayst/scrap/sample_tabbed_text FOR INPUT
   WHILE NOT Eof(hFile)
 LINE INPUT #hFile, LineInput
   WEND
   CLOSE hFile

   LineInput = Replace$(LineInput, BR, \n)
   TextArea1.Text = LineInput
   SplitString = Split(LineInput, \t)

   FOR EACH ScrapString IN SPlitString
   PRINT ScrapString
   NEXT
END


richard terry wrote:
 See the attached file for the data. Unfortunately I'm brain dead when it 
 comes 
 to simple logic.
 
 In one of my hl7 messages in the Free Text segment under an actual pathology 
 result, there is a list of sequential bood test results representing previous 
 results of the same type - , separated by tabs which I need to display 
 properly. as I've re-constructed the result as html, the tabs simply 
 disappear in the result, so I've been looking for a solution, and to start I 
 thought maybe I could split this up into lines and then later put it into a 
 table embedded in the html to keep it aligned.
 
 Perhaps there is a simple way out, but this is what I've done so far.
 
 
 So I started with this:
 
 1) Split this into lines
 
 Dim bits as string[]
 dim a_line as string
 
 bits = split(the_text_in_the_file,BR,, TRUE)
 
 for each a_line in bits
   print a_line
 next  
 
 Problem with this is that the \t (I presume tab character) gets in the way, 
 and it dosn't split properly with the results of the bits[] as shown in the 
 picture. Interestingly an occasional letter is lost off the test names.
 
 Any help appreciated.
 
 richard
 
 
 
 
 
 
 
 
 
 
 --
 The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
 production scanning environment may not be a perfect world - but thanks to
 Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
 Series Scanner you'll get full speed at 300 dpi even with all image 
 processing features enabled. http://p.sf.net/sfu/kodak-com
 
 
 
 
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] can't terminate fluidsynth processes by sending quit command over socket

2009-05-06 Thread Kevin Fishburne
Hello everyone. I'm having an odd issue that's got me stumped. My GAMBAS
app opens several fluidsynth daemons listening on different ports and
communicates with them over a socket. While they do all send and receive
commands properly, when I issue the quit command to any of the
fluidsynth daemons they don't actually terminate. They do respond with
Cheers!, which is what they say when they terminate, but the processes
remain and they continue responding to commands. I have to use SHELL
pkill fluidsynth, which leaves the daemons unable to be restarted
because they can't bind to their designated port/socket afterward for
some reason.

At first I thought it was fluidsynth behaving badly, but I'm able to
telnet to the fluidsynth daemon and issue the quit command
successfully using the same shell command as GAMBAS. I'm starting
fluidsynth with the following command:

SHELL fluidsynth --connect-jack-outputs --no-shell --verbose --server
--audio-driver=jack --midi-channels=1 --portname=LiquidSynth01
-oshell.port=9800 -oaudio.jack.id=LiquidSynth01 -omidi.driver=alsa_seq
-omidi.portname=LiquidSynth01 -omidi.alsa_seq.id=LiquidSynth01

My code to stop the fluidsynth daemons is:

DIM i AS Integer

' Stop FluidSynth.
FOR i = 1 TO 16
  Send_To_FluidSynth(quit, i)
  SLEEP 0.125
NEXT

PUBLIC SUB Send_To_FluidSynth(FluidString AS String, Daemon AS Integer)

  ' Send a command to FluidSynth
  DIM Timeout AS Single
  FluidString = FluidString  \n ' Add carriage return to command is
executed.
  Socket = NEW Socket
  Socket.Connect(localhost, 9799 + Daemon)
  DO WHILE (Socket.Status  7) AND (Socket.Status  0)
WAIT 0.1
Timeout = Timeout + 0.1
IF Timeout = 0.25 THEN EXIT 
  LOOP
  Timeout = 0
  IF Socket.Status = 7 THEN 
' Socket is good, send command.
WRITE #Socket, FluidString, Len(FluidString)
PRINT Sending command to FluidSynth daemon:   FluidString
  END IF
  DO WHILE Lof(Socket) = 0
WAIT 0.1
Timeout = Timeout + 0.1
IF Timeout = 0.25 THEN EXIT
  LOOP 
  READ #Socket, FluidString, Lof(Socket)
  PRINT FluidSynth daemon replies with:   FluidString
  CLOSE #Socket

END

As you can see there are 16 fluidsynth daemons starting at port 9800 and
going up to port 9815. The for/next loop just cycles through these 16
ports to terminate each process sequentially. I added the timeout stuff
because if the code runs with no fluidsynth processes active/listening
it just hangs there in the do/loop loops.

Here's my debug/console output right after trying to quit the fluidsynth
daemons, including anything they replied with:

Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Sending command to FluidSynth daemon: quit
FluidSynth daemon replies with: cheers!
Terminated
WARNING: Child process terminated by signal 15
cannot read server event (Success)
cannot complete execution of the processing graph (Resource temporarily
unavailable)
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
zombified - calling shutdown handler
fluidsynth: error: Help! Lost the connection to the JACK server
cannot complete execution of the processing graph (Success)
cannot complete execution of the processing graph 

Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Sergio A. Hernandez
Richard,

See the attached file and let me know if this is the output you want.
It is a HTML document. My approach is kind of different, probably the
best way to handle this is by using the XML Writer.



On Wed, May 6, 2009 at 8:52 AM, Stephen Bungay sbun...@csolve.net wrote:
   Hi Richard

    This code snippet will dump the text into a TextArea for you, it
 asumes (a bad thing) that there are no newline characters in the data
 and as such works with your sample. I used a button to launch the
 code... the important bits are in the middle... :)

 PUBLIC SUB ButtonGO_Click()
   DIM hFile AS File
   DIM LineInput AS String
   DIM ScrapString AS String
   DIM SPlitString AS String[]

   hFile = OPEN /home/bungayst/scrap/sample_tabbed_text FOR INPUT
   WHILE NOT Eof(hFile)
         LINE INPUT #hFile, LineInput
   WEND
   CLOSE hFile

   LineInput = Replace$(LineInput, BR, \n)
   TextArea1.Text = LineInput
   SplitString = Split(LineInput, \t)

   FOR EACH ScrapString IN SPlitString
       PRINT ScrapString
   NEXT
 END


 richard terry wrote:
 See the attached file for the data. Unfortunately I'm brain dead when it 
 comes
 to simple logic.

 In one of my hl7 messages in the Free Text segment under an actual pathology
 result, there is a list of sequential bood test results representing previous
 results of the same type - , separated by tabs which I need to display
 properly. as I've re-constructed the result as html, the tabs simply
 disappear in the result, so I've been looking for a solution, and to start I
 thought maybe I could split this up into lines and then later put it into a
 table embedded in the html to keep it aligned.

 Perhaps there is a simple way out, but this is what I've done so far.


 So I started with this:

 1) Split this into lines

 Dim bits as string[]
 dim a_line as string

 bits = split(the_text_in_the_file,BR,, TRUE)

 for each a_line in bits
       print a_line
 next

 Problem with this is that the \t (I presume tab character) gets in the way,
 and it dosn't split properly with the results of the bits[] as shown in the
 picture. Interestingly an occasional letter is lost off the test names.

 Any help appreciated.

 richard





 


 

 --
 The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
 production scanning environment may not be a perfect world - but thanks to
 Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
 Series Scanner you'll get full speed at 300 dpi even with all image
 processing features enabled. http://p.sf.net/sfu/kodak-com


 

 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

 --
 The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
 production scanning environment may not be a perfect world - but thanks to
 Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
 Series Scanner you'll get full speed at 300 dpi even with all image
 processing features enabled. http://p.sf.net/sfu/kodak-com
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Sergio A. Hernandez
Try the following. It is a complete different approach using the XML Writer.
Try it as a console project, just make sure you the gb.xml is selected under
PROJECT\PROPERTIES\COMPONENTS

' Gambas module file
PUBLIC SUB Main()
 DIM docXML AS XmlWriter

 docXML = NEW XmlWriter
 'this line is to save the xml document in your home folder
 docXML.Open(User.Home  /DoctorRicky.html, TRUE)

 'This part is the fancy CSS styling only is not important
 docXML.StartElement(style, [type, text/css])
docXML.Text(table.fancyTable {padding: 2pt; widht:100%;})
docXML.Text(th {font-weight: bold; background-color: #99;
color: #00})
docXML.Text(tr.evenRow {background-color: #f5f5dc; text-align: center})
docXML.Text(tr.oddRow {background-color: #ff; text-align: center})
 docXML.EndElement

 docXML.StartElement(table, [class, fancyTable])
   'th / is the HTML tab for the headers
   docXML.Element(th, Test)
   docXML.Element(th, Date 1)
   docXML.Element(th, Date 2)
   docXML.Element(th, Date 3)
   'tr / is the tag for the rows
   docXML.StartElement(tr, [class, oddRow])
 'td / is the tag for the colums
 ' number of td / elements must be the same as the number of th
/ elements
 docXML.Element(td, LDL Fraction)
 docXML.Element(td, 50 ml/dl)
 docXML.Element(td, 100 ml/dl)
 docXML.Element(td, 150 ml/dl)
   docXML.EndElement()

   'On the real life you'll prefer to handle this with a Loop Control Structure
   docXML.StartElement(tr, [class, evenRow])
 docXML.Element(td, HDL Fraction)
 docXML.Element(td, 50 ml/dl)
 docXML.Element(td, 75 ml/dl)
 docXML.Element(td, 100 ml/dl)
   docXML.EndElement()
 docXML.EndElement()
 'PRINT Xml.EndDocument
END

On Wed, May 6, 2009 at 7:01 AM, richard terry rte...@pacific.net.au wrote:
 See the attached file for the data. Unfortunately I'm brain dead when it comes
 to simple logic.

 In one of my hl7 messages in the Free Text segment under an actual pathology
 result, there is a list of sequential bood test results representing previous
 results of the same type - , separated by tabs which I need to display
 properly. as I've re-constructed the result as html, the tabs simply
 disappear in the result, so I've been looking for a solution, and to start I
 thought maybe I could split this up into lines and then later put it into a
 table embedded in the html to keep it aligned.

 Perhaps there is a simple way out, but this is what I've done so far.


 So I started with this:

 1) Split this into lines

 Dim bits as string[]
 dim a_line as string

 bits = split(the_text_in_the_file,BR,, TRUE)

 for each a_line in bits
        print a_line
 next

 Problem with this is that the \t (I presume tab character) gets in the way,
 and it dosn't split properly with the results of the bits[] as shown in the
 picture. Interestingly an occasional letter is lost off the test names.

 Any help appreciated.

 richard




 --
 The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
 production scanning environment may not be a perfect world - but thanks to
 Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
 Series Scanner you'll get full speed at 300 dpi even with all image
 processing features enabled. http://p.sf.net/sfu/kodak-com
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user




MMain.module
Description: Binary data
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] help with some simple parsing

2009-05-06 Thread Sergio A. Hernandez
Opps i uploaded the wrong file.
Sorry.


On Wed, May 6, 2009 at 9:50 PM, Sergio A. Hernandez info.g...@gmail.com wrote:
 Try the following. It is a complete different approach using the XML Writer.
 Try it as a console project, just make sure you the gb.xml is selected under
 PROJECT\PROPERTIES\COMPONENTS

 ' Gambas module file
 PUBLIC SUB Main()
  DIM docXML AS XmlWriter

  docXML = NEW XmlWriter
  'this line is to save the xml document in your home folder
  docXML.Open(User.Home  /DoctorRicky.html, TRUE)

  'This part is the fancy CSS styling only is not important
  docXML.StartElement(style, [type, text/css])
    docXML.Text(table.fancyTable {padding: 2pt; widht:100%;})
    docXML.Text(th {font-weight: bold; background-color: #99;
 color: #00})
    docXML.Text(tr.evenRow {background-color: #f5f5dc; text-align: center})
    docXML.Text(tr.oddRow {background-color: #ff; text-align: center})
  docXML.EndElement

  docXML.StartElement(table, [class, fancyTable])
   'th / is the HTML tab for the headers
   docXML.Element(th, Test)
   docXML.Element(th, Date 1)
   docXML.Element(th, Date 2)
   docXML.Element(th, Date 3)
   'tr / is the tag for the rows
   docXML.StartElement(tr, [class, oddRow])
     'td / is the tag for the colums
     ' number of td / elements must be the same as the number of th
 / elements
     docXML.Element(td, LDL Fraction)
     docXML.Element(td, 50 ml/dl)
     docXML.Element(td, 100 ml/dl)
     docXML.Element(td, 150 ml/dl)
   docXML.EndElement()

   'On the real life you'll prefer to handle this with a Loop Control Structure
   docXML.StartElement(tr, [class, evenRow])
     docXML.Element(td, HDL Fraction)
     docXML.Element(td, 50 ml/dl)
     docXML.Element(td, 75 ml/dl)
     docXML.Element(td, 100 ml/dl)
   docXML.EndElement()
  docXML.EndElement()
  'PRINT Xml.EndDocument
 END

 On Wed, May 6, 2009 at 7:01 AM, richard terry rte...@pacific.net.au wrote:
 See the attached file for the data. Unfortunately I'm brain dead when it 
 comes
 to simple logic.

 In one of my hl7 messages in the Free Text segment under an actual pathology
 result, there is a list of sequential bood test results representing previous
 results of the same type - , separated by tabs which I need to display
 properly. as I've re-constructed the result as html, the tabs simply
 disappear in the result, so I've been looking for a solution, and to start I
 thought maybe I could split this up into lines and then later put it into a
 table embedded in the html to keep it aligned.

 Perhaps there is a simple way out, but this is what I've done so far.


 So I started with this:

 1) Split this into lines

 Dim bits as string[]
 dim a_line as string

 bits = split(the_text_in_the_file,BR,, TRUE)

 for each a_line in bits
        print a_line
 next

 Problem with this is that the \t (I presume tab character) gets in the way,
 and it dosn't split properly with the results of the bits[] as shown in the
 picture. Interestingly an occasional letter is lost off the test names.

 Any help appreciated.

 richard




 --
 The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
 production scanning environment may not be a perfect world - but thanks to
 Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
 Series Scanner you'll get full speed at 300 dpi even with all image
 processing features enabled. http://p.sf.net/sfu/kodak-com
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user



--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] can't terminate fluidsynth processes by sending quit command over socket

2009-05-06 Thread Doriano Blengino
Kevin Fishburne ha scritto:
 Hello everyone. I'm having an odd issue that's got me stumped. My GAMBAS
 app opens several fluidsynth daemons listening on different ports and
 communicates with them over a socket. While they do all send and receive
 commands properly, when I issue the quit command to any of the
 fluidsynth daemons they don't actually terminate. They do respond with
 Cheers!, which is what they say when they terminate, but the processes
 remain and they continue responding to commands. I have to use SHELL
 pkill fluidsynth, which leaves the daemons unable to be restarted
 because they can't bind to their designated port/socket afterward for
 some reason.

 At first I thought it was fluidsynth behaving badly, but I'm able to
 telnet to the fluidsynth daemon and issue the quit command
 successfully using the same shell command as GAMBAS. I'm starting
 fluidsynth with the following command:

 SHELL fluidsynth --connect-jack-outputs --no-shell --verbose --server
 --audio-driver=jack --midi-channels=1 --portname=LiquidSynth01
 -oshell.port=9800 -oaudio.jack.id=LiquidSynth01 -omidi.driver=alsa_seq
 -omidi.portname=LiquidSynth01 -omidi.alsa_seq.id=LiquidSynth01

 My code to stop the fluidsynth daemons is:

 DIM i AS Integer

 ' Stop FluidSynth.
 FOR i = 1 TO 16
   Send_To_FluidSynth(quit, i)
   SLEEP 0.125
 NEXT

 PUBLIC SUB Send_To_FluidSynth(FluidString AS String, Daemon AS Integer)

   ' Send a command to FluidSynth
   DIM Timeout AS Single
   FluidString = FluidString  \n ' Add carriage return to command is
 executed.
   Socket = NEW Socket
   Socket.Connect(localhost, 9799 + Daemon)
   DO WHILE (Socket.Status  7) AND (Socket.Status  0)
 WAIT 0.1
 Timeout = Timeout + 0.1
 IF Timeout = 0.25 THEN EXIT 
   LOOP
   Timeout = 0
   IF Socket.Status = 7 THEN 
 ' Socket is good, send command.
 WRITE #Socket, FluidString, Len(FluidString)
 PRINT Sending command to FluidSynth daemon:   FluidString
   END IF
   DO WHILE Lof(Socket) = 0
 WAIT 0.1
 Timeout = Timeout + 0.1
 IF Timeout = 0.25 THEN EXIT
   LOOP 
   READ #Socket, FluidString, Lof(Socket)
   PRINT FluidSynth daemon replies with:   FluidString
   CLOSE #Socket

 END

 As you can see there are 16 fluidsynth daemons starting at port 9800 and
 going up to port 9815. The for/next loop just cycles through these 16
 ports to terminate each process sequentially. I added the timeout stuff
 because if the code runs with no fluidsynth processes active/listening
 it just hangs there in the do/loop loops.

 Here's my debug/console output right after trying to quit the fluidsynth
 daemons, including anything they replied with:

 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Sending command to FluidSynth daemon: quit
 FluidSynth daemon replies with: cheers!
 Terminated
 WARNING: Child process terminated by signal 15
 cannot read server event (Success)
 cannot complete execution of the processing graph (Resource temporarily
 unavailable)
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the connection to the JACK server
 zombified - calling shutdown handler
 fluidsynth: error: Help! Lost the