Re: [Gambas-user] Shell command

2017-08-08 Thread Jussi Lahtinen
Isn't that exactly what I suggested..? However there shouldn't be crash
anyway, only error raised.


Jussi

On Tue, Aug 8, 2017 at 4:43 AM, Shane  wrote:

> of cause missed that looking in wrong place
>
> Thanks Tony
>
>
>
> On 08/08/17 00:17, Tony Morehen wrote:
>
>> Shane,
>>
>> I can reproduce your crash here on 3.9.2.  It's cause is the line:
>>
>> Settings["Options/stmDevice"] = ComboBox1.Current
>>
>> If that line is changed to:
>>
>> Settings["Options/stmDevice"] = ComboBox1.Current.Text
>>
>> or the simpler, and in my mind preferred:
>>
>> Settings["Options/stmDevice"] = ComboBox1.Text
>>
>> The segmentation fault goes away.
>>
>> So the code that I'd recommend you use (I commented the code changes):
>>
>> Public sdevices As String
>>
>>
>> Public Sub SaveOps_Click()
>>
>>   Settings["Options/CCompCLine"] = TextBox1.Text
>> 'to fix the crash
>>   Settings["Options/stmDevice"] = ComboBox1.Text
>>   Settings.Save()
>>   Me.Close
>> End
>>
>> Public Sub Form_Open()
>>  Dim d As String
>>
>>TextBox1.Text = Settings["Options/CCompCLine"]
>>Shell "stm8flash -l" To sdevices
>> '  fill combobox with devices
>> 'trim gets rid of the trailing "\n"
>> 'moving Split into the loop saves an intermediate, unneeded string
>> creation
>>For Each d In Split(Trim(sdevices), " ", "", True)
>>  ComboBox1.Add(d)
>>Next
>> 'index = find selects the saved device
>>   ComboBox1.Index = ComboBox1.Find(Settings["Options/stmDevice"])
>> 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
>>
>
>
> 
> --
> 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
>
--
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] Shell command formating

2017-08-07 Thread Shane

thanks tony this works just needs the & in front of the 1


On 08/08/17 00:30, Tony Morehen wrote:

Try changing command to:

command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path & " 
2>1"



On 2017-08-06 09:52 PM, Shane wrote:

command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path




-- 


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



--
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] Shell command formating

2017-08-07 Thread Shane

That worked great T Lee thanks



On 08/08/17 00:00, T Lee Davidson wrote:

On 08/06/2017 09:52 PM, Shane wrote:

So again on the shell command I have this code

Dim result As String
Dim command As String

path = File.SetExt(file_name, "ihx")

  command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path

Shell command To result

FMain.TextArea1.Text = result

but the output is going to stdout and not the result String i know it 
to do with the command string


but now do you set it up ?

Thanks Shane..



Perhaps the output is actually going to stderr for some silly reason. 
Maybe try redirecting stderr to stdout:


command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path & " 
2>&1"






--
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] Shell command

2017-08-07 Thread Shane

of cause missed that looking in wrong place

Thanks Tony


On 08/08/17 00:17, Tony Morehen wrote:

Shane,

I can reproduce your crash here on 3.9.2.  It's cause is the line:

Settings["Options/stmDevice"] = ComboBox1.Current

If that line is changed to:

Settings["Options/stmDevice"] = ComboBox1.Current.Text

or the simpler, and in my mind preferred:

Settings["Options/stmDevice"] = ComboBox1.Text

The segmentation fault goes away.

So the code that I'd recommend you use (I commented the code changes):

Public sdevices As String


Public Sub SaveOps_Click()

  Settings["Options/CCompCLine"] = TextBox1.Text
'to fix the crash
  Settings["Options/stmDevice"] = ComboBox1.Text
  Settings.Save()
  Me.Close
End

Public Sub Form_Open()
 Dim d As String

   TextBox1.Text = Settings["Options/CCompCLine"]
   Shell "stm8flash -l" To sdevices
'  fill combobox with devices
'trim gets rid of the trailing "\n"
'moving Split into the loop saves an intermediate, unneeded string 
creation

   For Each d In Split(Trim(sdevices), " ", "", True)
 ComboBox1.Add(d)
   Next
'index = find selects the saved device
  ComboBox1.Index = ComboBox1.Find(Settings["Options/stmDevice"])
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



--
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] Shell command formating

2017-08-07 Thread Tony Morehen

Try changing command to:

command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path & " 2>1"


On 2017-08-06 09:52 PM, Shane wrote:

command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path




--
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] Shell command

2017-08-07 Thread Tony Morehen

Shane,

I can reproduce your crash here on 3.9.2.  It's cause is the line:

Settings["Options/stmDevice"] = ComboBox1.Current

If that line is changed to:

Settings["Options/stmDevice"] = ComboBox1.Current.Text

or the simpler, and in my mind preferred:

Settings["Options/stmDevice"] = ComboBox1.Text

The segmentation fault goes away.

So the code that I'd recommend you use (I commented the code changes):

Public sdevices As String


Public Sub SaveOps_Click()

  Settings["Options/CCompCLine"] = TextBox1.Text
'to fix the crash
  Settings["Options/stmDevice"] = ComboBox1.Text
  Settings.Save()
  Me.Close
End

Public Sub Form_Open()
 Dim d As String

   TextBox1.Text = Settings["Options/CCompCLine"]
   Shell "stm8flash -l" To sdevices
'  fill combobox with devices
'trim gets rid of the trailing "\n"
'moving Split into the loop saves an intermediate, unneeded string creation
   For Each d In Split(Trim(sdevices), " ", "", True)
 ComboBox1.Add(d)
   Next
'index = find selects the saved device
  ComboBox1.Index = ComboBox1.Find(Settings["Options/stmDevice"])
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


Re: [Gambas-user] Shell command formating

2017-08-07 Thread T Lee Davidson

On 08/06/2017 09:52 PM, Shane wrote:

So again on the shell command I have this code

Dim result As String
Dim command As String

path = File.SetExt(file_name, "ihx")

  command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path

Shell command To result

FMain.TextArea1.Text = result

but the output is going to stdout and not the result String i know it to do 
with the command string

but now do you set it up ?

Thanks Shane..



Perhaps the output is actually going to stderr for some silly reason. Maybe try 
redirecting stderr to stdout:

command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path & " 2>&1"


--
Lee

--
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] Shell command formating

2017-08-06 Thread Shane

So again on the shell command I have this code

Dim result As String
Dim command As String

path = File.SetExt(file_name, "ihx")

 command = "stm8flash -c stlinkv2 -p " & stmdevice & " -w " & path

Shell command To result

FMain.TextArea1.Text = result

but the output is going to stdout and not the result String i know it to 
do with the command string


but now do you set it up ?

Thanks Shane..


--
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] Shell command

2017-08-06 Thread Shane

here is all the code

Public sdevices As String


Public Sub SaveOps_Click()

  Settings["Options/CCompCLine"] = TextBox1.Text
  Settings["Options/stmDevice"] = ComboBox1.Current
  'Settings.Save()
  Me.Close
End

Public Sub Form_Open()
 Dim devices As String[]
 Dim d As String
'
   'TextBox1.Text = Settings["Options/CCompCLine"]
   Shell "stm8flash -l" To sdevices
   'sdevices = Replace(sdevices, "\n", "")
'  fill combobox with devices
   devices = Split(sdevices, " ", "", True)
   For Each d In devices
 ComboBox1.Add(d)
   Next
'   ComboBox1.Find(Settings["Options/stmDevice"])
  Print "end"
End



Public Sub Button1_Click()

  Me.Close

End


and system info

[System]
Gambas=3.10.90
OperatingSystem=Linux
Kernel=4.4.0-45-generic
Architecture=x86_64
Distribution=Linux Mint 17.2 Rafaela
Desktop=MATE
Theme=Gtk
Language=en_AU.UTF-8
Memory=3805M

[Libraries]
Cairo=libcairo.so.0.0.0
Cairo=libcairo.so.2.11301.0
Curl=libcurl.so.4.3.0
DBus=libdbus-1.so.3.7.6
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.204.0
GTK+2=libgtk-x11-2.0.so.0.2400.23
GTK+3=libgtk-3.so.0.1000.8
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.44.0.0
QT4=libQtCore.so.4.8.6
QT5=libQt5Core.so.5.2.1
QT5=libQt5Core.so.5.8.0
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-o3iPH8ksHu,guid=7e7674d387bd0d61a1434e3e5987a82c
DEFAULTS_PATH=/usr/share/gconf/mate.default.path
DESKTOP_SESSION=mate
DISPLAY=:0.0
GB_GUI=gb.qt4
GDMSESSION=mate
GDM_XSERVER_LOCATION=local
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-NMrGUV
GNOME_KEYRING_PID=2227
GPG_AGENT_INFO=/run/user/1000/keyring-NMrGUV/gpg:0:1
HOME=
KICAD_PATH=/usr/share/kicad
KIGITHUB=https://github.com/KiCad
LANG=en_AU.UTF-8
LOGNAME=
MANDATORY_PATH=/usr/share/gconf/mate.mandatory.path
MATE_DESKTOP_SESSION_ID=this-is-deprecated
MDMSESSION=mate
MDM_LANG=en_AU.UTF-8
MDM_XSERVER_LOCATION=local
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=
SESSION_MANAGER=local/:@/tmp/.ICE-unix/1540,unix/:/tmp/.ICE-unix/1540
SHELL=/bin/bash
SSH_AGENT_PID=2046
SSH_AUTH_SOCK=/run/user/1000/keyring-NMrGUV/ssh
TEXTDOMAIN=im-config
TEXTDOMAINDIR=/usr/share/locale/
TZ=:/etc/localtime
USER=
USERNAME=
WINDOWPATH=8
XAUTHORITY=/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
XDG_CURRENT_DESKTOP=MATE
XDG_DATA_DIRS=/usr/share/mate:/usr/local/share/:/usr/share/:/usr/share/mdm/
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_COOKIE=139d2632112d070b9e811bbc561842ce-1502062630.656915-940133850
XDG_SESSION_DESKTOP=mate
XDG_SESSION_ID=c1
XDG_VTNR=8


On 07/08/17 11:29, Jussi Lahtinen wrote:

Is that all the code in the form? Can you give your system information?


Jussi

On Mon, Aug 7, 2017 at 3:35 AM, Shane  wrote:


Hi Jussi

I gave that a try by commenting that line out still the same result so
that not the problem




On 06/08/17 22:17, Jussi Lahtinen wrote:


I guess settings component can't handle saving of arbitrary object. In
this
case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you want
to
save ComboBox1.Current.Text?
However there shouldn't be segfault.


Jussi

On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:

I have this in a sub form

Public sdevices As String


Public Sub SaveOps_Click()

Settings["Options/CCompCLine"] = TextBox1.Text
Settings["Options/stmDevice"] = ComboBox1.Current
'Settings.Save()
Me.Close
End

Public Sub Form_Open()
   Dim devices As String[]
   Dim d As String
'
 TextBox1.Text = Settings["Options/CCompCLine"]
 Shell "stm8flash -l" To sdevices
'  fill combobox with devices
 devices = Split(sdevices, " ")
 For Each d In devices
   ComboBox1.Add(d)
 Next
'   ComboBox1.Find(Settings["Options/stmDevice"])

End

but when I exit this form and then the main form i get s Seg fault

but with the shell part commented out it is ok what am i doing wrong ?

any ideas

Thanks Shane




--
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



--
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




--
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.

Re: [Gambas-user] Shell command

2017-08-06 Thread Shane

Same thing here is a file with the output


On 07/08/17 11:10, Tony Morehen wrote:
what is the output of the shell line?  If you could post the complete 
output, we could properly test your code.


You could try this line:

devices = Split(sdevices, " ", "", True)


On 2017-08-06 08:35 PM, Shane wrote:

Hi Jussi

I gave that a try by commenting that line out still the same result 
so that not the problem




On 06/08/17 22:17, Jussi Lahtinen wrote:
I guess settings component can't handle saving of arbitrary object. 
In this
case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you 
want to

save ComboBox1.Current.Text?
However there shouldn't be segfault.


Jussi

On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:


I have this in a sub form

Public sdevices As String


Public Sub SaveOps_Click()

   Settings["Options/CCompCLine"] = TextBox1.Text
   Settings["Options/stmDevice"] = ComboBox1.Current
   'Settings.Save()
   Me.Close
End

Public Sub Form_Open()
  Dim devices As String[]
  Dim d As String
'
TextBox1.Text = Settings["Options/CCompCLine"]
Shell "stm8flash -l" To sdevices
'  fill combobox with devices
devices = Split(sdevices, " ")
For Each d In devices
  ComboBox1.Add(d)
Next
'   ComboBox1.Find(Settings["Options/stmDevice"])

End

but when I exit this form and then the main form i get s Seg fault

but with the shell part commented out it is ok what am i doing wrong ?

any ideas

Thanks Shane




--
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

-- 


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



-- 


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




-- 


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


stlux???a stm8af526? stm8af528? stm8af52a? stm8af6213 stm8af6223 stm8af6223a 
stm8af6226 stm8af624? stm8af6266 stm8af6268 stm8af6269 stm8af628? stm8af62a? 
stm8al313? stm8al314? stm8al316? stm8al3l4? stm8al3l6? stm8l051f3 stm8l052c6 
stm8l052r8 stm8l101f1 stm8l101?2 stm8l101?3 stm8l151?2 stm8l151?3 stm8l151?4 
stm8l151?6 stm8l151?8 stm8l152?4 stm8l152?6 stm8l152?8 stm8l162?8 stm8s003?3 
stm8s005?6 stm8s007c8 stm8s103f2 stm8s103?3 stm8s105?4 stm8s105?6 stm8s207c8 
stm8s207cb stm8s207k8 stm8s207m8 stm8s207mb stm8s207r8 stm8s207rb stm8s207s8 
stm8s207sb stm8s207?6 stm8s208c6 stm8s208s6 stm8s208?8 stm8s208?b stm8s903?3 
stm8splnb1 stm8tl5??4 stnrg???a 
--
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] Shell command

2017-08-06 Thread Jussi Lahtinen
Is that all the code in the form? Can you give your system information?


Jussi

On Mon, Aug 7, 2017 at 3:35 AM, Shane  wrote:

> Hi Jussi
>
> I gave that a try by commenting that line out still the same result so
> that not the problem
>
>
>
>
> On 06/08/17 22:17, Jussi Lahtinen wrote:
>
>> I guess settings component can't handle saving of arbitrary object. In
>> this
>> case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you want
>> to
>> save ComboBox1.Current.Text?
>> However there shouldn't be segfault.
>>
>>
>> Jussi
>>
>> On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:
>>
>> I have this in a sub form
>>>
>>> Public sdevices As String
>>>
>>>
>>> Public Sub SaveOps_Click()
>>>
>>>Settings["Options/CCompCLine"] = TextBox1.Text
>>>Settings["Options/stmDevice"] = ComboBox1.Current
>>>'Settings.Save()
>>>Me.Close
>>> End
>>>
>>> Public Sub Form_Open()
>>>   Dim devices As String[]
>>>   Dim d As String
>>> '
>>> TextBox1.Text = Settings["Options/CCompCLine"]
>>> Shell "stm8flash -l" To sdevices
>>> '  fill combobox with devices
>>> devices = Split(sdevices, " ")
>>> For Each d In devices
>>>   ComboBox1.Add(d)
>>> Next
>>> '   ComboBox1.Find(Settings["Options/stmDevice"])
>>>
>>> End
>>>
>>> but when I exit this form and then the main form i get s Seg fault
>>>
>>> but with the shell part commented out it is ok what am i doing wrong ?
>>>
>>> any ideas
>>>
>>> Thanks Shane
>>>
>>>
>>>
>>> 
>>> --
>>> 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
>>>
>>> 
>> --
>> 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
>>
>
>
> 
> --
> 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
>
--
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] Shell command

2017-08-06 Thread Tony Morehen
what is the output of the shell line?  If you could post the complete 
output, we could properly test your code.


You could try this line:

devices = Split(sdevices, " ", "", True)


On 2017-08-06 08:35 PM, Shane wrote:

Hi Jussi

I gave that a try by commenting that line out still the same result so 
that not the problem




On 06/08/17 22:17, Jussi Lahtinen wrote:
I guess settings component can't handle saving of arbitrary object. 
In this
case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you 
want to

save ComboBox1.Current.Text?
However there shouldn't be segfault.


Jussi

On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:


I have this in a sub form

Public sdevices As String


Public Sub SaveOps_Click()

   Settings["Options/CCompCLine"] = TextBox1.Text
   Settings["Options/stmDevice"] = ComboBox1.Current
   'Settings.Save()
   Me.Close
End

Public Sub Form_Open()
  Dim devices As String[]
  Dim d As String
'
TextBox1.Text = Settings["Options/CCompCLine"]
Shell "stm8flash -l" To sdevices
'  fill combobox with devices
devices = Split(sdevices, " ")
For Each d In devices
  ComboBox1.Add(d)
Next
'   ComboBox1.Find(Settings["Options/stmDevice"])

End

but when I exit this form and then the main form i get s Seg fault

but with the shell part commented out it is ok what am i doing wrong ?

any ideas

Thanks Shane




--
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

-- 


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



-- 


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




--
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] Shell command

2017-08-06 Thread Shane

Hi Jussi

I gave that a try by commenting that line out still the same result so 
that not the problem




On 06/08/17 22:17, Jussi Lahtinen wrote:

I guess settings component can't handle saving of arbitrary object. In this
case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you want to
save ComboBox1.Current.Text?
However there shouldn't be segfault.


Jussi

On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:


I have this in a sub form

Public sdevices As String


Public Sub SaveOps_Click()

   Settings["Options/CCompCLine"] = TextBox1.Text
   Settings["Options/stmDevice"] = ComboBox1.Current
   'Settings.Save()
   Me.Close
End

Public Sub Form_Open()
  Dim devices As String[]
  Dim d As String
'
TextBox1.Text = Settings["Options/CCompCLine"]
Shell "stm8flash -l" To sdevices
'  fill combobox with devices
devices = Split(sdevices, " ")
For Each d In devices
  ComboBox1.Add(d)
Next
'   ComboBox1.Find(Settings["Options/stmDevice"])

End

but when I exit this form and then the main form i get s Seg fault

but with the shell part commented out it is ok what am i doing wrong ?

any ideas

Thanks Shane




--
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


--
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



--
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] Shell command

2017-08-06 Thread Jussi Lahtinen
I guess settings component can't handle saving of arbitrary object. In this
case "Settings["Options/stmDevice"] = ComboBox1.Current". Maybe you want to
save ComboBox1.Current.Text?
However there shouldn't be segfault.


Jussi

On Sun, Aug 6, 2017 at 7:18 AM, Shane  wrote:

> I have this in a sub form
>
> Public sdevices As String
>
>
> Public Sub SaveOps_Click()
>
>   Settings["Options/CCompCLine"] = TextBox1.Text
>   Settings["Options/stmDevice"] = ComboBox1.Current
>   'Settings.Save()
>   Me.Close
> End
>
> Public Sub Form_Open()
>  Dim devices As String[]
>  Dim d As String
> '
>TextBox1.Text = Settings["Options/CCompCLine"]
>Shell "stm8flash -l" To sdevices
> '  fill combobox with devices
>devices = Split(sdevices, " ")
>For Each d In devices
>  ComboBox1.Add(d)
>Next
> '   ComboBox1.Find(Settings["Options/stmDevice"])
>
> End
>
> but when I exit this form and then the main form i get s Seg fault
>
> but with the shell part commented out it is ok what am i doing wrong ?
>
> any ideas
>
> Thanks Shane
>
>
>
> 
> --
> 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
>
--
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] Shell command

2017-08-05 Thread Shane

I have this in a sub form

Public sdevices As String


Public Sub SaveOps_Click()

  Settings["Options/CCompCLine"] = TextBox1.Text
  Settings["Options/stmDevice"] = ComboBox1.Current
  'Settings.Save()
  Me.Close
End

Public Sub Form_Open()
 Dim devices As String[]
 Dim d As String
'
   TextBox1.Text = Settings["Options/CCompCLine"]
   Shell "stm8flash -l" To sdevices
'  fill combobox with devices
   devices = Split(sdevices, " ")
   For Each d In devices
 ComboBox1.Add(d)
   Next
'   ComboBox1.Find(Settings["Options/stmDevice"])

End

but when I exit this form and then the main form i get s Seg fault

but with the shell part commented out it is ok what am i doing wrong ?

any ideas

Thanks Shane



--
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] Shell command not working

2013-03-07 Thread Jesus
El 07/03/13 13:40, Jose Monteiro escribió:
> text = "cd ~/.relat_bact && rm -rf Modelo*.odt && zip -r " & "MA" & 
> Mid$(ListBox1.Text, 1, 9) & ".odt  ."
>Shell text Wait
>
> 1 - navigating to ~/.relat_bact directory and deleting the odt file is 
> working fine.
>
> 2 - generating the "zipped" odt file (MA.odt) using the files and 
> directories inside ~/.relat_bact is not working. The error message is: "zip 
> I/O error: No such file or directory
> zip error: Could not create output file (MA04/12.odt)"
>
> 3 - If I type these commands directly on a terminal it works fine.

>
> Thanks in advance

There is an extra slash "/" in your final string. Check that in the Mid 
function. BUT...

Why do you use shell command? Gambas have its own commands to do what 
you want. See "working with files" in the manual wiki and the 
gb.compress component.

Regards

-- 
Jesus Guardon

--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Shell command not working

2013-03-07 Thread Jose Monteiro
text = "cd ~/.relat_bact && rm -rf Modelo*.odt && zip -r " & "MA" & 
Mid$(ListBox1.Text, 1, 9) & ".odt  ."
  Shell text Wait

1 - navigating to ~/.relat_bact directory and deleting the odt file is working 
fine.

2 - generating the "zipped" odt file (MA.odt) using the files and 
directories inside ~/.relat_bact is not working. The error message is: "zip I/O 
error: No such file or directory
zip error: Could not create output file (MA04/12.odt)"

3 - If I type these commands directly on a terminal it works fine.

My system information: 
[System]
OperatingSystem=Linux
Kernel=3.5.0-25-generic
Architecture=i686
Memory=1025808 kB
DistributionVendor=Ubuntu
DistributionRelease="Ubuntu 12.10"
Desktop=Gnome

[Gambas 3]
Version=3.3.3
Path=/usr/local/bin/gbx3

[Libraries]
Qt4=libQtCore.so.4.8.3
GTK+=libgtk-x11-2.0.so.0.2400.13

Thanks in advance
--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-29 Thread Tobias Boege
On Tue, 29 Jan 2013, John Rose wrote:
> Tobias,
> 
> Thanks for that useful reply.
> 
> I have a quick question (it doesn't seem worth asking on the Mailing List):
> Using Dialog.OpenFile(), the resulting Dialog.Path shows the full path 
> to the file (e.g. /home/john/x.txt). Given that the runtime user might 
> change to a different directory (from that specified in Dialog.Path - 
> /home/john/ - as a prior command to Dialog.OpenFile()) how can I obtain 
> the new directory (e.g. /home/john/abc/) easily? I thought of using a 
> string function to select characters before the final slash character 
> but then the filename might contain a slash

Mmm. I hope I understood you correctly: you want to get the directory part
of a path? The File class has some useful static functions for path
manipulation.

The right one for this case could probably be File.Dir(). Try out if it fits
your needs. Especially your last sentence makes me wonder...

Regards,
Tobi

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-29 Thread John Rose
Tobias,

Thanks for that useful reply.

I have a quick question (it doesn't seem worth asking on the Mailing List):
Using Dialog.OpenFile(), the resulting Dialog.Path shows the full path 
to the file (e.g. /home/john/x.txt). Given that the runtime user might 
change to a different directory (from that specified in Dialog.Path - 
/home/john/ - as a prior command to Dialog.OpenFile()) how can I obtain 
the new directory (e.g. /home/john/abc/) easily? I thought of using a 
string function to select characters before the final slash character 
but then the filename might contain a slash

Regards,
John

On 24/01/13 21:08, Tobias Boege wrote:
> On Thu, 24 Jan 2013, John Rose wrote:
>> I have written a GUI to execute a command which involves selecting
>> filenames (e.g. sCombinedPath below) to be used in a Shell command
>> (as part of a Process). It works OK generally. However, if any
>> filename includes a quote, it goes wrong.
>>
>> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
>>  "'" & sVideoPath & "' " &
>>  "'" & sAudioPath & "' " &
>>  ">/dev/null 2>'" & sLogFilename & "'"
>>Print sCommand
>>hProcess = Shell sCommand
>>
>> I read about using the Shell$ command to create a quoted string but
>> I couldn't make that work. I've also tried a Replace$ command to
>> replace a quote by a backslash followed by a quote. I couldn't get
>> that to work.
> Use it like
>
> sCommand = "mplex ... " & Shell$(sCombinedPath) & etc.
>
> This will result in
>
> mplex ... /path/with/\"quotes\"
>
> which is totally valid. But then you must not enclose the path within ''
> single quotes.
>
> Regards,
> Tobi
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-24 Thread Rob Kudla
On 01/24/2013 12:59 PM, John Rose wrote:
> I have written a GUI to execute a command which involves selecting
> filenames (e.g. sCombinedPath below) to be used in a Shell command (as part
> of a Process). It works OK generally. However, if any filename includes a
> quote, it goes wrong.
> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
> ...
>   hProcess = Shell sCommand

If you use Exec (which is not the same as Unix exec()), you can eliminate
quoting altogether.

http://gambasdoc.org/help/lang/exec

It takes an array, not a single string, and there's no shell redirection
because it doesn't invoke a shell. But you can just ignore the Read events
the process raises, and handle writing the log file (or doing something
fancier, I can't remember whether mplex provides useful progress
notifications and I don't seem to have any mpeg streams around that are old
enough for it to handle... ffmpeg definitely does, though) in the Error
event handler. So in your case it would be something like:

Dim mplex as Process
mplex = Exec [ "mplex", "-f", "8", "-o ", sCombinedPath, sVideoPath,
sAudioPath ]

Public Sub mplex_Error(output)
' append output to the log file, or parse it for use in a progress bar 
or
whatever
End

I haven't tested this code, but you get the idea.

Rob


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-24 Thread John Rose
Thanks Tobias. It worked.

Regards,
John

On 24/01/13 21:08, Tobias Boege wrote:
> On Thu, 24 Jan 2013, John Rose wrote:
>> I have written a GUI to execute a command which involves selecting
>> filenames (e.g. sCombinedPath below) to be used in a Shell command
>> (as part of a Process). It works OK generally. However, if any
>> filename includes a quote, it goes wrong.
>>
>> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
>>  "'" & sVideoPath & "' " &
>>  "'" & sAudioPath & "' " &
>>  ">/dev/null 2>'" & sLogFilename & "'"
>>Print sCommand
>>hProcess = Shell sCommand
>>
>> I read about using the Shell$ command to create a quoted string but
>> I couldn't make that work. I've also tried a Replace$ command to
>> replace a quote by a backslash followed by a quote. I couldn't get
>> that to work.
> Use it like
>
> sCommand = "mplex ... " & Shell$(sCombinedPath) & etc.
>
> This will result in
>
> mplex ... /path/with/\"quotes\"
>
> which is totally valid. But then you must not enclose the path within ''
> single quotes.
>
> Regards,
> Tobi
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-24 Thread Tobias Boege
On Thu, 24 Jan 2013, John Rose wrote:
> I have written a GUI to execute a command which involves selecting
> filenames (e.g. sCombinedPath below) to be used in a Shell command
> (as part of a Process). It works OK generally. However, if any
> filename includes a quote, it goes wrong.
> 
> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
> "'" & sVideoPath & "' " &
> "'" & sAudioPath & "' " &
> ">/dev/null 2>'" & sLogFilename & "'"
>   Print sCommand
>   hProcess = Shell sCommand
> 
> I read about using the Shell$ command to create a quoted string but
> I couldn't make that work. I've also tried a Replace$ command to
> replace a quote by a backslash followed by a quote. I couldn't get
> that to work.

Use it like

sCommand = "mplex ... " & Shell$(sCombinedPath) & etc.

This will result in

mplex ... /path/with/\"quotes\"

which is totally valid. But then you must not enclose the path within ''
single quotes.

Regards,
Tobi

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Shell command including string containing a quote

2013-01-24 Thread M. Cs.
I guess you will need Chr$(39) as ASCII code for ', or if you need double
quote just use  Chr$(34).


2013/1/24 John Rose 

> I have written a GUI to execute a command which involves selecting
> filenames (e.g. sCombinedPath below) to be used in a Shell command (as part
> of a Process). It works OK generally. However, if any filename includes a
> quote, it goes wrong.
>
> sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
> "'" & sVideoPath & "' " &
> "'" & sAudioPath & "' " &
> ">/dev/null 2>'" & sLogFilename & "'"
>   Print sCommand
>   hProcess = Shell sCommand
>
> I read about using the Shell$ command to create a quoted string but I
> couldn't make that work. I've also tried a Replace$ command to replace a
> quote by a backslash followed by a quote. I couldn't get that to work.
>
> Any ideas please?
>
> Project attached.
>
> --
> Regards,
> John
>
>
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Shell command including string containing a quote

2013-01-24 Thread John Rose
I have written a GUI to execute a command which involves selecting 
filenames (e.g. sCombinedPath below) to be used in a Shell command (as 
part of a Process). It works OK generally. However, if any filename 
includes a quote, it goes wrong.


sCommand = "mplex -f 8 -o " & "'" & sCombinedPath & "' " &
"'" & sVideoPath & "' " &
"'" & sAudioPath & "' " &
">/dev/null 2>'" & sLogFilename & "'"
  Print sCommand
  hProcess = Shell sCommand

I read about using the Shell$ command to create a quoted string but I 
couldn't make that work. I've also tried a Replace$ command to replace a 
quote by a backslash followed by a quote. I couldn't get that to work.


Any ideas please?

Project attached.

--
Regards,
John



CombineAV.tar.gz
Description: GNU Zip compressed data
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-12 Thread Benoît Minisini
> Benoît Minisini ha scritto:
> > Query to Benoit ... is there a way to define 'NOT NULL' entry via
> > gambas code ?
> 
>  You have to define the default value. What's the point of having a
>  mandatory field (NOT NULL) without a default value?
> >>>
> >>> just say i want something ... but i can't say what because there is
> >>> not default rules.
> >>> and then advise the user that he need to say someting by himself
> >>>
> >>> for example my age can't be 0
> >>
> >> A default value does not imply that a value is required, and a "not
> >> null" clause does not imply a default value.
> >
> > Mmm. You may be right. :-) But that needs some change in the gb.db
> > component and in all database drivers.
> 
> A general idea could be to add a further optional argument "Flags".
> Those bit-mask flags could have a name like "db.bNotNull" for flags
> valid for every database, and names like MySql.bAutoincrement, for
> example, for flags only valid for certain databases. If, in code,
> someone uses a feature with the wrong backend, an error is generated by
> the compiler (unknown symbol). The definition of a field would be, for
> example:
> 
>   htable.Fields.Add("AFM", MySql.SpecialInteger, 18, db.bNotNull +
>  MySql.bAutoIncrement)
> 
> Just an idea.
> Regards,
> Doriano
> 

The gb.db interface is database independent, so no database specific flag 
please. 

And if there are only one flag (Not Null), auto-increment being just a special 
integer field, I will add just an extra boolean argument, after the default 
value. 

Regards,

-- 
Benoît Minisini

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-12 Thread Doriano Blengino
Benoît Minisini ha scritto:
>>
>
> Query to Benoit ... is there a way to define 'NOT NULL' entry via
> gambas code ?
>   
 You have to define the default value. What's the point of having a
 mandatory field (NOT NULL) without a default value?
 
>>> just say i want something ... but i can't say what because there is
>>> not default rules.
>>> and then advise the user that he need to say someting by himself
>>>
>>> for example my age can't be 0
>>>   
>> A default value does not imply that a value is required, and a "not
>> null" clause does not imply a default value.
>>
>> 
>
> Mmm. You may be right. :-) But that needs some change in the gb.db component 
> and in all database drivers.
>
>   
A general idea could be to add a further optional argument "Flags". 
Those bit-mask flags could have a name like "db.bNotNull" for flags 
valid for every database, and names like MySql.bAutoincrement, for 
example, for flags only valid for certain databases. If, in code, 
someone uses a feature with the wrong backend, an error is generated by 
the compiler (unknown symbol). The definition of a field would be, for 
example:

htable.Fields.Add("AFM", MySql.SpecialInteger, 18, db.bNotNull + 
MySql.bAutoIncrement)

Just an idea.
Regards,
Doriano


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Fabien Bodard
2010/2/11 Vassilis K :
> I 'll use the Gambas Mysql commands to make a table ! it works !
> The reason that I asked you is that the code for creating a Mysql table
> in Gambas is less accurate than the code of python.
no at same...
but the gambas code way allow you to change the database server
without changing one line of code.

just the connection definition

>
>
> --
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Benoît Minisini
> Fabien Bodard ha scritto:
> > Le 11 février 2010 15:23, Benoît Minisini
> >
> >  a écrit :
> >>> sql = "CREATE TABLE Aplianikis ("
> >>> "aa BIGINT(20) NOT NULL auto_increment,"
> >>> "Eponimia VARCHAR(40) NOT NULL,"
> >>> "AFM  VARCHAR(18) NOT NULL,"
> >>> "Hmerominia DATE NOT NULL,"
> >>> "Checkbox TINYINT(1) NOT NULL,"
> >>> "primary key(aa)"
> >>> ")"
> >>> "DEFAULT CHARSET=utf8"
> >>>
> >>> DB.Exec(sql)
> >>>
> >>> gambas version :
> >>>
> >>>  Dim htable As Table
> >>>   htable = db.Tables.Add("Aplianikis")
> >>>
> >>>   htable.Fields.Add("aa", db.Serial, 10)
> >>>   htable.Fields.Add("Eponimia", db.String, 40)
> >>>   htable.Fields.Add("AFM", db.String, 18)
> >>>   htable.Fields.Add("Hmerominia", db.Date)
> >>>   htable.Fields.Add("Checkbox", gb.Boolean,, False)
> >>>   htable.PrimaryKey.Add("aa")
> >>>
> >>>   htable.Update
> >>>
> >>> Query to Benoit ... is there a way to define 'NOT NULL' entry via
> >>> gambas code ?
> >>
> >> You have to define the default value. What's the point of having a
> >> mandatory field (NOT NULL) without a default value?
> >
> > just say i want something ... but i can't say what because there is
> > not default rules.
> > and then advise the user that he need to say someting by himself
> >
> > for example my age can't be 0
> 
> A default value does not imply that a value is required, and a "not
> null" clause does not imply a default value.
> It seems, indeed, very reasonable: all the four cases have a useful
> meaning, and any simplification, I think, would be limiting. Another
> example, after the one from Fabien, is the Name field of a private
> person. I am sure I want the name of the person, but which name would be
> a suitable default? John Smith? And a default value with no "not null"
> clause makes sense too in many cases.
> 
> Just a thought... regards,
> Doriano
> 

Mmm. You may be right. :-) But that needs some change in the gb.db component 
and in all database drivers.

-- 
Benoît Minisini

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Vassilis K
I 'll use the Gambas Mysql commands to make a table ! it works !
The reason that I asked you is that the code for creating a Mysql table
in Gambas is less accurate than the code of python.


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Doriano Blengino
Fabien Bodard ha scritto:
> Le 11 février 2010 15:23, Benoît Minisini
>  a écrit :
>   
>>> sql = "CREATE TABLE Aplianikis ("
>>> "aa BIGINT(20) NOT NULL auto_increment,"
>>> "Eponimia VARCHAR(40) NOT NULL,"
>>> "AFM  VARCHAR(18) NOT NULL,"
>>> "Hmerominia DATE NOT NULL,"
>>> "Checkbox TINYINT(1) NOT NULL,"
>>> "primary key(aa)"
>>> ")"
>>> "DEFAULT CHARSET=utf8"
>>>
>>> DB.Exec(sql)
>>>
>>> gambas version :
>>>
>>>  Dim htable As Table
>>>   htable = db.Tables.Add("Aplianikis")
>>>
>>>   htable.Fields.Add("aa", db.Serial, 10)
>>>   htable.Fields.Add("Eponimia", db.String, 40)
>>>   htable.Fields.Add("AFM", db.String, 18)
>>>   htable.Fields.Add("Hmerominia", db.Date)
>>>   htable.Fields.Add("Checkbox", gb.Boolean,, False)
>>>   htable.PrimaryKey.Add("aa")
>>>
>>>   htable.Update
>>>
>>> Query to Benoit ... is there a way to define 'NOT NULL' entry via gambas
>>>  code ?
>>>
>>>   
>> You have to define the default value. What's the point of having a mandatory
>> field (NOT NULL) without a default value?
>> 
> just say i want something ... but i can't say what because there is
> not default rules.
> and then advise the user that he need to say someting by himself
>
> for example my age can't be 0
>   
A default value does not imply that a value is required, and a "not 
null" clause does not imply a default value.
It seems, indeed, very reasonable: all the four cases have a useful 
meaning, and any simplification, I think, would be limiting. Another 
example, after the one from Fabien, is the Name field of a private 
person. I am sure I want the name of the person, but which name would be 
a suitable default? John Smith? And a default value with no "not null" 
clause makes sense too in many cases.

Just a thought... regards,
Doriano

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Fabien Bodard
Le 11 février 2010 15:23, Benoît Minisini
 a écrit :
>> sql = "CREATE TABLE Aplianikis ("
>>         "aa BIGINT(20) NOT NULL auto_increment,"
>>         "Eponimia VARCHAR(40) NOT NULL,"
>>         "AFM  VARCHAR(18) NOT NULL,"
>>         "Hmerominia DATE NOT NULL,"
>>         "Checkbox TINYINT(1) NOT NULL,"
>>         "primary key(aa)"
>>         ")"
>>         "DEFAULT CHARSET=utf8"
>>
>> DB.Exec(sql)
>>
>> gambas version :
>>
>>  Dim htable As Table
>>   htable = db.Tables.Add("Aplianikis")
>>
>>   htable.Fields.Add("aa", db.Serial, 10)
>>   htable.Fields.Add("Eponimia", db.String, 40)
>>   htable.Fields.Add("AFM", db.String, 18)
>>   htable.Fields.Add("Hmerominia", db.Date)
>>   htable.Fields.Add("Checkbox", gb.Boolean,, False)
>>   htable.PrimaryKey.Add("aa")
>>
>>   htable.Update
>>
>> Query to Benoit ... is there a way to define 'NOT NULL' entry via gambas
>>  code ?
>>
>
> You have to define the default value. What's the point of having a mandatory
> field (NOT NULL) without a default value?
just say i want something ... but i can't say what because there is
not default rules.
and then advise the user that he need to say someting by himself

for example my age can't be 0

>
> --
> Benoît Minisini
>
> --
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Benoît Minisini
> sql = "CREATE TABLE Aplianikis ("
> "aa BIGINT(20) NOT NULL auto_increment,"
> "Eponimia VARCHAR(40) NOT NULL,"
> "AFM  VARCHAR(18) NOT NULL,"
> "Hmerominia DATE NOT NULL,"
> "Checkbox TINYINT(1) NOT NULL,"
> "primary key(aa)"
> ")"
> "DEFAULT CHARSET=utf8"
> 
> DB.Exec(sql)
> 
> gambas version :
> 
>  Dim htable As Table
>   htable = db.Tables.Add("Aplianikis")
> 
>   htable.Fields.Add("aa", db.Serial, 10)
>   htable.Fields.Add("Eponimia", db.String, 40)
>   htable.Fields.Add("AFM", db.String, 18)
>   htable.Fields.Add("Hmerominia", db.Date)
>   htable.Fields.Add("Checkbox", gb.Boolean,, False)
>   htable.PrimaryKey.Add("aa")
> 
>   htable.Update
> 
> Query to Benoit ... is there a way to define 'NOT NULL' entry via gambas
>  code ?
> 

You have to define the default value. What's the point of having a mandatory 
field (NOT NULL) without a default value?

-- 
Benoît Minisini

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Fabien Bodard
sql = "CREATE TABLE Aplianikis ("
"aa BIGINT(20) NOT NULL auto_increment,"
"Eponimia VARCHAR(40) NOT NULL,"
"AFM  VARCHAR(18) NOT NULL,"
"Hmerominia DATE NOT NULL,"
"Checkbox TINYINT(1) NOT NULL,"
"primary key(aa)"
")"
"DEFAULT CHARSET=utf8"

DB.Exec(sql)

gambas version :

 Dim htable As Table
  htable = db.Tables.Add("Aplianikis")

  htable.Fields.Add("aa", db.Serial, 10)
  htable.Fields.Add("Eponimia", db.String, 40)
  htable.Fields.Add("AFM", db.String, 18)
  htable.Fields.Add("Hmerominia", db.Date)
  htable.Fields.Add("Checkbox", gb.Boolean,, False)
  htable.PrimaryKey.Add("aa")

  htable.Update

Query to Benoit ... is there a way to define 'NOT NULL' entry via gambas code ?


2010/2/11 Vassilis K :
> I am using python because it executes the table creation commands with
> the same type like in terminal mode. For example in python we write:
>
> sql = """CREATE TABLE Aplianikis (
>         aa BIGINT(20) NOT NULL auto_increment,
>         Eponimia VARCHAR(40) NOT NULL,
>         AFM  VARCHAR(18) NOT NULL,
>         Hmerominia DATE NOT NULL,
>         Checkbox TINYINT(1) NOT NULL,
>         primary key(aa)
>         )
>         DEFAULT CHARSET=utf8
>         """
>
> cursor.execute(sql)
>
> Because of this I assume that there is less possibility of errors.
>
> Do you suggest to use the Gambas code for table and database creation?
>
>
>
> --
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Vassilis K
I am using python because it executes the table creation commands with
the same type like in terminal mode. For example in python we write:

sql = """CREATE TABLE Aplianikis (
 aa BIGINT(20) NOT NULL auto_increment,
 Eponimia VARCHAR(40) NOT NULL,
 AFM  VARCHAR(18) NOT NULL,
 Hmerominia DATE NOT NULL,
 Checkbox TINYINT(1) NOT NULL,
 primary key(aa)
 )
 DEFAULT CHARSET=utf8
 """
 
cursor.execute(sql)

Because of this I assume that there is less possibility of errors.

Do you suggest to use the Gambas code for table and database creation?



--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Doriano Blengino
Fabien Bodard ha scritto:
>
>>>
>>> I am using the following code for the creation of a table in a Mysql DB:
>>>
>>>
>>> SHELL"python
>>>  /home/delphi/Documents/Apodeixi/dimiourgiaTableMYSQLmePython1.py" IF ERROR
>>>  THEN
>>> Message.Error(DConv(Error.Text))
>>>   ENDIF
>>>
>>> The command works perfectly and it creates the table.
>>>
>>> When I use the same command on a second project it does not execute!
>>> With:
>>>   python dimiourgiaTableMYSQLmePython1.py it does !
>>> (from terminal)
>>>
>>> Any ideas?
>>>   
A reason could be that the second command is more slow than the first, 
and you don't WAIT for it to finish.
Put a WAIT clause in the SHELL statement and see if it works.

Regards,
Doriano


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Fabien Bodard
and why are you using python to create your table ???

Le 11 février 2010 12:35, Benoît Minisini
 a écrit :
>> Hello again,
>>
>> I am using the following code for the creation of a table in a Mysql DB:
>>
>>
>> SHELL"python
>>  /home/delphi/Documents/Apodeixi/dimiourgiaTableMYSQLmePython1.py" IF ERROR
>>  THEN
>>         Message.Error(DConv(Error.Text))
>>       ENDIF
>>
>> The command works perfectly and it creates the table.
>>
>> When I use the same command on a second project it does not execute!
>> With:
>>       python dimiourgiaTableMYSQLmePython1.py it does !
>> (from terminal)
>>
>> Any ideas?
>>
>
> None. You need to give more information about your project, its running
> context, the source code...
>
> --
> Benoît Minisini
>
> --
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Benoît Minisini
> Hello again,
> 
> I am using the following code for the creation of a table in a Mysql DB:
> 
> 
> SHELL"python
>  /home/delphi/Documents/Apodeixi/dimiourgiaTableMYSQLmePython1.py" IF ERROR
>  THEN
> Message.Error(DConv(Error.Text))
>   ENDIF
> 
> The command works perfectly and it creates the table.
> 
> When I use the same command on a second project it does not execute!
> With:
>   python dimiourgiaTableMYSQLmePython1.py it does !
> (from terminal)
> 
> Any ideas?
> 

None. You need to give more information about your project, its running 
context, the source code...

-- 
Benoît Minisini

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] SHELL command with python does not execute!

2010-02-11 Thread Vassilis K
Hello again,

I am using the following code for the creation of a table in a Mysql DB:


SHELL"python /home/delphi/Documents/Apodeixi/dimiourgiaTableMYSQLmePython1.py"
  IF ERROR THEN 
Message.Error(DConv(Error.Text))
  ENDIF 

The command works perfectly and it creates the table.

When I use the same command on a second project it does not execute! 
With:
python dimiourgiaTableMYSQLmePython1.py it does !
(from terminal)

Any ideas?




--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user