Re: [Gambas-user] Gambas-user Digest, Vol 128, Issue 13

2017-01-11 Thread Jeff Zacher

> Your mail is seen as spam, raise it with this answer.
> "Test" what kind of file it is?
 Just a test file and I 'echo "stuff" > test' or 'echo "Other stuff" >>
test' from another shell.

On 01/10/2017 02:46 PM, gambas-user-requ...@lists.sourceforge.net wrote:
> Hello Jeff,
> Your mail is seen as spam, raise it with this answer.
> "Test" what kind of file it is?
> 
> Regards
> Gianluigi
> 
> 2017-01-09 14:35 GMT+01:00 Jeff Zacher <ad_si...@yahoo.com>:
> 
>> I am using Gambas 3.9.1
>>
>> If I open a file for watch:
>>
>> hFile = Open "test" For Read Write Watch
>>
>> The _Read() event gets the first byte written to the file just fine. But
>> after, no changes to the file fire the read event. So as a workaround,
>> just close the file and reopen? On second read the _Read() event in
>> fired immediately and continues to fire past the eof until the file is
>> again closed.
>>
>> Code to reproduce. Form with two buttons:
>>
>>
>>  Gambas class file
>>
>> Private hFile As File
>>
>> Public Sub File_Read()
>>
>>   Dim iByte As Byte
>>   If Not Eof(hfile) Then
>> Read #hFile, iByte
>> Print "Got one byte: "; iByte
>>   Else
>> Print Time()
>>   End If
>> End
>>
>> Public Sub Button1_Click()
>>
>>Close hFile
>>
>> End
>>
>> Public Sub Button2_Click()
>>
>>   hFile = Open "test" For Read Watch
>>
>> End
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Open File for Watch Read Past EOF

2017-01-09 Thread Jeff Zacher
I am using Gambas 3.9.1

If I open a file for watch:

hFile = Open "test" For Read Write Watch

The _Read() event gets the first byte written to the file just fine. But
after, no changes to the file fire the read event. So as a workaround,
just close the file and reopen? On second read the _Read() event in
fired immediately and continues to fire past the eof until the file is
again closed.

Code to reproduce. Form with two buttons:


 Gambas class file

Private hFile As File

Public Sub File_Read()

  Dim iByte As Byte
  If Not Eof(hfile) Then
Read #hFile, iByte
Print "Got one byte: "; iByte
  Else
Print Time()
  End If
End

Public Sub Button1_Click()

   Close hFile

End

Public Sub Button2_Click()

  hFile = Open "test" For Read Watch

End

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Gambas Examples/Tutorials

2017-01-06 Thread Jeff Zacher
Are there any basic Gambas example projects/tutorials or is this a need.
I looked on the Tutorials page on the wiki and it of course says 'not
finished' and the link to working with files is dead. If there are no
examples/tutorials who is providing these and how can we contribute?

More to the point:
I have opened some static files and played with the example on the wiki
using the Process object to run ls and such. What I am really interested
in is 'hooking' an interactive shell, spice/ngspice in particular.
Probably apps like mysql and python would be good candidates also so a
good base class that could:
open an interactive shell program
make stdin/stderror avaible for processing by the Gambas side
write commands back into the interpreter's shell
read the resulting data from the shell
etc, etc

would be very usable to me. However, I am not getting any results from a
read_event when playing with the example. (I'd like to just read the
open message from the shell, issue a 'quit' and read the quit message to
get started). I know this is possible from c with pairs of I/O streams
for each handle but how is this done in GAMBAS?

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Help to make on the fly pointer to various result sets

2011-04-15 Thread Jeff Halverson
By the way, where do you find information like this?  After being
informed of the wonderful Result[String] format, I exhaustively searched
through the Gambas documentation and did not see any mention of it.  Is
this a new style that is not yet documented, of I have missed finding
something in the documentation?

Jeff H

On Wed, 2011-04-13 at 10:50 +0930, Bruce Bruen wrote:

 On Wednesday, April 13, 2011 09:21:05 AM Jeff Halverson wrote:
  I have something that is puzzling me that seems easy to do, but I can't
  figure it out...  I was hoping somebody might be able to help.
  
  If I have the following available from a resultset:
  
  DataSummary!InvestmentName
  DataSummary!BrokerName
  DataSummary!ManagementCompanyName
  DataSummary!RegionName
  
  And I want to be able to use each of those fields above in a function,
  such as the example below:
  
  IF TextToSearchFor = DataSummary!RegionName THEN
  ' Do a bunch of stuff
  END IF
  
  Is there a way to replace the DataSummary!RegionName within the
  function with a variable that will evaluate to the resultset value?
  Maybe something like:
  
  FieldToSearchFor = DataSummary!RegionName
  IF TextToSearchFor = Evaluate(FieldToSearchFor) THEN
  ' Do a bunch of stuff
  END IF
  
  Obviously the above doesn't work, but is there some means in Gambas to
  achieve this result?
  
  Any help is greatly appreciately.
  
  Jeff H
  Tokyo
  ---
  --- Forrester Wave Report - Recovery time is now measured in hours and
  minutes not days. Key insights are discussed in the 2010 Forrester Wave
  Report as part of an in-depth evaluation of disaster recovery service
  providers. Forrester found the best-in-class provider in terms of services
  and vision. Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
 
 
 Sub Search(SearchCol as String) AS Whatever
   ...
   ...DataSummary[SearchCol]...
   DoABunchOfStuff
 
 etc


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Help to make on the fly pointer to various result sets

2011-04-13 Thread Jeff Halverson
Sorry, I guess I over simplified my example and poorly explained it!
Actually I was looking to be able to use a variable to change the field
I look up in a result...  In some cases, I was hoping to use a
concatenated string to get various results from the database.

It seems this has been answered in a subsequent response to use the form
of ResultName[String] in lieu of ResultName!ResultField.

Thanks!

Jeff H
Tokyo

On Wed, 2011-04-13 at 10:19 +1000, richard terry wrote:

 On Wednesday 13 April 2011 09:51:05 Jeff Halverson wrote:
  I have something that is puzzling me that seems easy to do, but I can't
  figure it out...  I was hoping somebody might be able to help.
  
  If I have the following available from a resultset:
  
  DataSummary!InvestmentName
  DataSummary!BrokerName
  DataSummary!ManagementCompanyName
  DataSummary!RegionName
  
  And I want to be able to use each of those fields above in a function,
  such as the example below:
  
 ***
  IF TextToSearchFor = DataSummary!RegionName THEN
  ' Do a bunch of stuff
  END IF
 
 Not sure what your problem is as the lines above this should work fine as 
 long 
 as the database field data is text,  can you describe what happens when you 
 try 
 this to give us more clues?
 
 Regards
 
 Richard
 
  Is there a way to replace the DataSummary!RegionName within the
  function with a variable that will evaluate to the resultset value?
  Maybe something like:
  
  FieldToSearchFor = DataSummary!RegionName
  IF TextToSearchFor = Evaluate(FieldToSearchFor) THEN
  ' Do a bunch of stuff
  END IF
  
  Obviously the above doesn't work, but is there some means in Gambas to
  achieve this result?
  
  Any help is greatly appreciately.
  
  Jeff H
  Tokyo
  ---
  --- Forrester Wave Report - Recovery time is now measured in hours and
   minutes not days. Key insights are discussed in the 2010 Forrester Wave
   Report as part of an in-depth evaluation of disaster recovery service
   providers. Forrester found the best-in-class provider in terms of services
   and vision. Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
  
 
 --
 Forrester Wave Report - Recovery time is now measured in hours and minutes
 not days. Key insights are discussed in the 2010 Forrester Wave Report as
 part of an in-depth evaluation of disaster recovery service providers.
 Forrester found the best-in-class provider in terms of services and vision.
 Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Help to make on the fly pointer to various result sets

2011-04-13 Thread Jeff Halverson
Thanks, this is exactly what I was looking for.  I knew there must be a
way to do this and am suprised I missed the Results[String] formating
option!

Jeff H
Tokyo

On Wed, 2011-04-13 at 10:50 +0930, Bruce Bruen wrote:

 On Wednesday, April 13, 2011 09:21:05 AM Jeff Halverson wrote:
  I have something that is puzzling me that seems easy to do, but I can't
  figure it out...  I was hoping somebody might be able to help.
  
  If I have the following available from a resultset:
  
  DataSummary!InvestmentName
  DataSummary!BrokerName
  DataSummary!ManagementCompanyName
  DataSummary!RegionName
  
  And I want to be able to use each of those fields above in a function,
  such as the example below:
  
  IF TextToSearchFor = DataSummary!RegionName THEN
  ' Do a bunch of stuff
  END IF
  
  Is there a way to replace the DataSummary!RegionName within the
  function with a variable that will evaluate to the resultset value?
  Maybe something like:
  
  FieldToSearchFor = DataSummary!RegionName
  IF TextToSearchFor = Evaluate(FieldToSearchFor) THEN
  ' Do a bunch of stuff
  END IF
  
  Obviously the above doesn't work, but is there some means in Gambas to
  achieve this result?
  
  Any help is greatly appreciately.
  
  Jeff H
  Tokyo
  ---
  --- Forrester Wave Report - Recovery time is now measured in hours and
  minutes not days. Key insights are discussed in the 2010 Forrester Wave
  Report as part of an in-depth evaluation of disaster recovery service
  providers. Forrester found the best-in-class provider in terms of services
  and vision. Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
 
 
 Sub Search(SearchCol as String) AS Whatever
   ...
   ...DataSummary[SearchCol]...
   DoABunchOfStuff
 
 etc


--
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Help to make on the fly pointer to various result sets

2011-04-12 Thread Jeff Halverson
I have something that is puzzling me that seems easy to do, but I can't
figure it out...  I was hoping somebody might be able to help.

If I have the following available from a resultset:

DataSummary!InvestmentName
DataSummary!BrokerName
DataSummary!ManagementCompanyName
DataSummary!RegionName

And I want to be able to use each of those fields above in a function,
such as the example below:

IF TextToSearchFor = DataSummary!RegionName THEN
' Do a bunch of stuff
END IF

Is there a way to replace the DataSummary!RegionName within the
function with a variable that will evaluate to the resultset value?
Maybe something like:

FieldToSearchFor = DataSummary!RegionName
IF TextToSearchFor = Evaluate(FieldToSearchFor) THEN
' Do a bunch of stuff
END IF

Obviously the above doesn't work, but is there some means in Gambas to
achieve this result?

Any help is greatly appreciately.

Jeff H
Tokyo
--
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] define data-variable as record

2009-04-25 Thread Jeff
Same as the other answers - define a class. It's a good habit to get
into to write accessor methods (set and get) or use properties rather
than public variables.

On Sat, 2009-04-25 at 01:55 -0700, juelin wrote:
 hello,
 it is possible to define a record into gambas?
 thats mean a variable with different datatypes
 for example:
 type recorda as record
a as intger
b as string
c[99] as float
 endtype 
 dim variablename as recorda
 
 kind regards
 Jürgen
 


--
Crystal Reports #45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Logical operators

2009-04-23 Thread Jeff
If I write:

IF expr1 OR expr2 THEN

If expr1 evaluates to TRUE does the OR return TRUE or does it still go
on to evaluate expr2?


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] dynamic classes?

2009-04-21 Thread Jeff
Try:
var = Class.Load(myclassname)

On Tue, 2009-04-21 at 15:51 +0200, Stefan Miefert wrote:
 Hello,
 
 how can i creat a class  having  a dynamic name?
 
 for example.
 
 I have some classnames in my database and want now do this
 
 DIM cclass as class
 Dim var = myclassname
 Class = new var
 
 But that dosent run:( He takes the var  as the class var
 
 How can I use the content  of the var?
 
 --
 Stay on top of everything new and different, both inside and 
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today. 
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] More null problems

2009-04-20 Thread Jeff
I agree with Stephen's third button option. I don't think check boxes
are right as you can't be both simultaneously (except maybe in some
speciality bars and clubs). Radio buttons are the right way to go. 
You may be able to get the behaviour you're asking for if you delete and
recreate the controls but even if you can do that, once a radio button
selection has been made there's no going back. In that case your gui has
a one way street that isn't user friendly - so better to have that 3rd
state. 
I'm currently working in health. We have 4 states: male, female, unknown
and undisclosed. 

On Mon, 2009-04-20 at 08:27 -0400, Stephen Bungay wrote:
 It is the nature of radio buttons to allow only one in a set to be 
 toggled on, If you really want to go that route then I would suggest 
 that you use checkboxes instead of radio buttons, A better way (IMHO) is 
 to place a third button on the form labelled as Unknown and set that 
 one when the gender is a null.
 
 Bruce wrote:
  I have a set of two radio buttons in a panel control (Male  Female),  when 
  a 
  new person object is loaded into the form I need to set the gender 
  appropriately.  However, some persons' gender is not known, say for Brown, 
  J and I am trying unsuccessfully to set both radio buttons to reflect this.
  
  IF p.gender = M THEN
  rbMale.Value = TRUE
  rbFemale.Value = FALSE
  ELSE IF p.gender = F THEN
  rbMale.Value = FALSE
  rbFemale.Value = TRUE   'OK So far, but...
  ELSE
  rbMale.Value = FALSE
  rbFemale.Value = FALSE
  ENDIF
  
  In the unknowns case, the radiobuttons are always left in the state they 
  were 
  in on the previous object.  So, if I go from Brown, Hillary (F) to Brown, J 
  the value is left as for Hillary.  But if I go from Brown, Kevin (M) to 
  Brown, J its left as for Kevin.
  
  I've also tried setting both rb Values to NULL but this gives the same 
  result.
  
  
  Any clues?
  
  tia
  Bruce
  
  --
  Stay on top of everything new and different, both inside and 
  around Java (TM) technology - register by April 22, and save
  $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
  300 plus technical and hands-on sessions. Register today. 
  Use priority code J9JMT32. http://p.sf.net/sfu/p
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
  
 
 --
 Stay on top of everything new and different, both inside and 
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today. 
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] handling database nulls

2009-04-15 Thread Jeff
On Wed, 2009-04-15 at 16:19 +0800, Werner wrote:
 Bruce wrote:
  This has sort of been asked before. However, the answers I have found 
  haven't 
  helped.
 
  My database has a LOT of integer fields, arranged into sets of fieldwork 
  results.  The majority of them contain nulls, quite validly as the data for 
  a 
  particular set may not have been entered or even collected yet.
 
  My Gambas problem is creating the classes for the various plot types.  
  Within 
  Gambas the data items are integers. When I try and read the existing datum 
  point into the class (as in dp.rangeheight=$dbresult!rangeheight ) it is 
  complaining that the value is a null not an integer, as in wanted integer, 
  got null instead).
 
  Now, coercing the value of the object data to zero is NOT valid, as in the 
  above example, the rangeheight is null not zero, as zero means 0m above the 
  basepoint.  Similarly, coercing it to a negative value wont work either, as 
  that means meters below the base point.
 
  Is there any way to set the value of an integer variable to an 
  uninitalised 
  state?
 
  bruce

 A solution might be to use the Variant data type instead of Integer.
 Alternatively, you could define a class that holds a data point plus a
 flag whether the data is valid.
 

... or a collection. 
data items accessed by a key. If no data item then it's not in the
collection. 

 Werner
 
 
 --
 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] binary numeral system

2009-04-14 Thread Jeff
Gah - you just beat me :-)

Mine is as follows. Interesting to see different styles/solutions:

PRIVATE FUNCTION myBin(binString AS String) AS Long
  
  DIM i AS Integer
  DIM length AS Integer
  DIM binResult AS Long = 0
  
  length = Len(binString)
  
  FOR i = length TO 1 STEP -1
binResult = binResult + CInt(Mid(binString, i, 1)) * Exp2(length -
i)
  NEXT 

  RETURN binResult  
END




On Tue, 2009-04-14 at 14:24 +0200, Emil Tchekov wrote:
 Just checked the gambas online documentation.
 
 The TextBox does have CHANGE event - thus it is possible to make converter
 wich reacts on each additional letter typed
 
 as example here my fast shoot maded in VB6 - very simple and without error
 handling (BUT WORKING!)
 
 
 Private Sub txtBin_Change()
 Dim StrBin As String
 
 StrBin = Me.txtBin
 
 If StrBin   Then
 
 Me.lblDec.Caption = CStr(dec(StrBin))
 
 Else
 
 Me.lblDec.Caption = n.a.
 
 End If
 
 End Sub
 
 
 Private Function dec(ByVal StrBin As String) As Long
 Dim i As Integer
 Dim l As Integer
 Dim c As String
 
 
 
 l = Len(StrBin)
 
 dec = 0
 
 For i = 1 To l
 
 c = Mid(StrBin, i, 1)
 
 If c = 1 Then
 dec = dec + 2 ^ (l - i)
 End If
 
 Next i
 
 End Function
 
 
 
 very best regards
 
 Emil
 
 
 
 
 -Ursprüngliche Nachricht-
 Von: Simonart Dominique [mailto:simonart.domini...@wanadoo.fr]
 Gesendet: Dienstag, 14. April 2009 14:04
 An: mailing list for gambas users
 Betreff: Re: [Gambas-user] binary numeral system
 
 
 vlahonick vlahonick a écrit :
 
  hello all :D
 
  i am trying to create a program that calculates a number from the binary
 numeral system and gives a result
 
  example of what the program will do :
 
  we have the number (at binary numeral system) 10011
 
  so to have result we have to do (1*2^4)+(0*2^3)+(0*2^2)+(1*2^1)+(1*2^0)=
  16+0+0+2+1=19
 
  to do that in a program first i have to calculate the powers
  so i have to write (y=number of digits) for the first of the digits
 y-1,second y-2etc
 
  so if i have 5 digits then the power for the first one will be y-1=5-1=4
 
  this is done by the Len(textbox1.text)
 
  but HOW i will write Len(textbox1.text)=y ?
 
  then how i can make the program to recognize that for the 1st digit
 entered in the Textbox1.text have to
  give (d*2^y-1) (d=the digit that can be 0 or 1 and y the number of the
 digits) for the second (d*2^y-2)etc...
 
  so the main question is how i can make JUST ONE TEXTBOX to understand that
 for every digits enter it will give something else for a result
 
  sorry about my english but it has been long time since i had english
 lessons...
  plz if u dont understand something let me know and i will try to explain
 better...
  if you want to contact me directly :tsopanotr...@hotmail.com |
 vlahon...@gmail.com | ch...@vlahonick.freehost.gr
 
  thanks in advance Vlahonick (all the truth is always in
 www.vlahonick.freehost.gr)
 
  _
  News, entertainment and everything you care about at Live.com. Get it now!
  http://www.live.com/getstarted.aspx
  --
 
  This SF.net email is sponsored by:
  High Quality Requirements in a Collaborative Environment.
  Download a free trial of Rational Requirements Composer Now!
  http://p.sf.net/sfu/www-ibm-com
  ___
  Gambas-user mailing list
  Gambas-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/gambas-user
 
 
 Hi Vlahonick,
 
 I'm not sure to understand exactly what you want to do!
 1) If you want to convert a bynary number to decimal value,
 you just have to write in Gambas exactly what you sayd in
 your message! :)
 2) If you want to display the changing decimal value as soon
 as you enter a binary digit, this is not possible because
 you don't know what WILL be the final length of the binary
 number!
 
 For the 1) comprehension, here is an exemple (I took a
 TextArea because I want to start a new line in the text)
 
 PUBLIC SUB Button1_Click()
 DIM S AS String
 DIM i, y, N AS Integer
 
 S = TextArea1.Text
 y = Len(S)
 if y = 0 THEN RETURN
 N = 0
 FOR i = 1 to y
d = Val(Mid(S, i, 1)) ' I assume that d is 0 or 1
N += d * (2 ^ (y-i))
 NEXT
 TextArea1.Text = \nBinary   S   = decimal   Str(N)
 END
 
 Hope I understand you!
 Dominique Simonart
 
 
 
 --
 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
 
 
 

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Jeff Gray

That's pretty cool.

My only comment would be that it took me a few goes at stepping through the 
code before I worked out how the blazes it worked, so perhaps less readable 
than the exponent version.

But hey - I'm no rocket scientist :-)
 
 From: ron...@tiscali.nl
 
 
 
 function bin2dec(sBin) as long
 dim r as long
 r=0
 for i= 1 to len(sBin)
 r = r*2 + Val(Mid(sBin, i, 1)) 
 next
 return r
 end
 

_
Need a new place to rent, share or buy? Let ninemsn property search for you.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline_t=774152450_r=Domain_tagline_m=EXT
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] LinkedIn

2009-04-12 Thread Jeff
Cool.
I have set it up. It will be interesting to see how many join.

On Sat, 2009-04-11 at 22:28 +0200, Benoît Minisini wrote:
  Hey Benoit
  I thought about setting up a group on LinkedIn for Gambas users. Could
  help to spread the word. Are you ok with it or would you rather not?
 
 
 I am ok. :-)
 


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] MoveFirst MoveNext etc

2009-04-09 Thread Jeff

 But during the long years now I have written programs :-) I found that we 
 most 
 often test for errors than success. So using TRUE for errors leads to less 
 lines of code.
 
 It is just a matter of habit. And changing habits is a good thing, it keeps 
 you young. :-)
 

I need something to keep me young :-)

 You can write your loop this way:
 
 MyResult.MoveFirst()
 WHILE MyResult.Available
   ...
   myResult.MoveNext()
 WEND
 
Aaaahh - the available property. Yes that's what I was looking for.
Obvious now. Thanks.


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Combo box

2009-03-12 Thread Jeff
Hi All,
First post, so forgive me newbie-ness.

If I use the add method to add rows to a combo box I specify an index:
Eg: 
ComboBoxProjects.Add(ZZ, 0)
ComboBoxProjects.Add(AA, 1)

Then in a button click event I use the index property to get the
selected row:

PRINT ComboBoxProjects.Index

This is fine until I set the sort property to true on the combo box. The
order of the text changes but the index remains the same, so selecting
the AA row gives me an index of 0, not 1 as expected.

Any ideas? What am I doing wrong?

I am using Gambas 2.7.1 on Ubuntu Ibex




--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Path for open file write

2008-07-06 Thread Jeff Johnson
My program also recreates html pages as the program runs, so am I correct in 
thinking that I will not be able to do that either. I am converting a hamradio 
program from VB, and will also need to do my logging. So my thinking since 
everything is RO then I am out of luck on it? 

On Sunday 06 July 2008 13:23:46 Benoit Minisini wrote:
 On dimanche 06 juillet 2008, Jeff Johnson wrote:
  I know this has probably been replied to many times.
 
  This works
 hFile = OPEN wxaprs.ini FOR INPUT
 
  This works
 hFile = OPEN ./wxaprs.ini FOR INPUT
 
 
  This fails with access forbidden
  DIM hFile1 AS File
  hFile1 = OPEN ./wxaprs.ini FOR OUTPUT CREATE
 
  This fails with access forbidden
  DIM hFile1 AS File
  hFile1 = OPEN wxaprs.ini FOR OUTPUT CREATE

 Relatives paths are paths to files located inside the project, and so are
 read-only.

  This works
  DIM hFile1 AS File
  hFile1 = OPEN /home/jeffjohnson/aprs/wxaprs.ini FOR OUTPUT CREATE

 ...But when you use an absolute path, nothing is checked. But then your
 code does not work once the program is compiled into an executable.

  I need to either determine the full working path so I can make it
  hFile1 = OPEN $Path  wxaprs.ini FOR OUTPUT CREATE
 
  or the correct way to create a file
 
  Any ideas of where I fell off the trolley?

 You can't create file inside the project at execution time. You need to
 store your file inside the user home directory.

 You can use the Settings class, that creates a settings file like in
 Windows in a standard path inside the user home directory.

 Or you can create your own file, as an hidden file (beginning with a dot),
 or as a file stored inside an hidden directory.

 Now the standard is defined by freedesktop.org: a configuration file is
 stored in ~/.config/application. The Settings class stored its own
 configuration file in ~/.config/gambas[3]/application.conf

 Regards,



-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Path for open file write

2008-07-06 Thread Jeff Johnson
Pharm out...That is what I needed to know..  Thanks a bundle

On Sunday 06 July 2008 15:21:36 Benoit Minisini wrote:
 On dimanche 06 juillet 2008, Jeff Johnson wrote:
  My program also recreates html pages as the program runs, so am I correct
  in thinking that I will not be able to do that either. I am converting a
  hamradio program from VB, and will also need to do my logging. So my
  thinking since everything is RO then I am out of luck on it?

 Only your project is read-only.

 If the pages you create are temporary, i.e. they disappear when the program
 ends, then you can use the process temporary directory created by the
 interpreter (Temp$ function).

 If the pages you create are persistent, then you must store them inside the
 user home directory, or in another directory specified by him.

 If you are doing a program that is run by root or another priviledged user,
 you should store your logs in /var/log.

 Regards,



-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user