Re: [Gambas-user] why this could not be? error in runtime?

2017-07-29 Thread Christof Thalhofer
Am 28.07.2017 um 22:55 schrieb PICCORO McKAY Lenz:

> in the following code:
> 
> strinchar = Mid(strinchar, 1, InStr(strinchar, ")", -1) - 1)
> 
> IDE said error invalid argument, but if i do:

No, the IDE says nothing:

Public Sub Test()

  Dim strinchar As String
  Dim psotionlen As Integer

  ' - 1
  strinchar = "strat)edn1"

  strinchar = Mid(strinchar, 1, InStr(strinchar, "u", -1) - 1)

  Print strinchar

  ' - 2
  strinchar = "strat)edn1"

  psotionlen = InStr(strinchar, ")", -1) - 1
  strinchar = Mid(strinchar, 1, psotionlen)

  Print strinchar

  ' - 3
  ' but the only thing this does is (AFAIK)

  strinchar = "strat)edn1"

  Print Left(strinchar, Len(strinchar) - 1)

End

Result is:

strat)edn
strat)edn
strat)edn

:-)

Maybe you should write and code a little slower. ;-)


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur



signature.asc
Description: OpenPGP digital signature
--
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] Serialization Database query result

2017-07-29 Thread Hans Lehmann

Hello.

What is the possibility to serialize the result of a database query 
(data type result)?

Every idea and approach is welcome.

Sincerely
Hans
--
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] why this could not be? error in runtime?

2017-07-29 Thread Matti

YOU complainig-shouting about a typo!


Am 29.07.2017 um 05:53 schrieb PICCORO McKAY Lenz:

HEY TONY; ITS PICCORO; NOT PICARO! GR

in the playground wprks perfectly, i not have 3.10, but in the job i have
3.1 and at my home 3.5
its a bug in 3.9 and 3.8, *with 3.1 works perfectly in debian squeeze (very
older but better)*

2017-07-28 21:02 GMT-04:00 Adrien Prokopowicz 
:


Actually, his original code is correct. For me it runs without error in
the IDE using
the 3.10 development version, but the editor is indeed having trouble
matching the
parentheses.


me too, the edtor has some problems, when the ide made a word wrap, and i
have thesame behaviour, parentheses does not matching correctly..



I also tried it on the playground (which also uses 3.10) and it works
fine : https://gambas-playground.proko.eu/?gist=97ed16795393aa3b689
13025e5d2b83c .


tested, me too..



However the playground's editor does match the parentheses correctly. :)


jajaja excelent work!



Which Gambas version are you using ? There may be an old bug here.


3.9.1 with some git patches..

in the job i have 3.1 and at my home 3.5

its a bug in 3.9 and 3.8, with 3.1 works perfectly in debian squeeze (very
older but better)



Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-07-28 23:46 GMT-04:00 Tony Morehen :


It's difficult to say for sure what's happening without Piccaro's test
strings.  However, 2 things do come to mind.

First, according to Gambas doc, InStr(strinchar, ")", -n) does a left to
right search for ")", starting at -n  characters from the end of
strinchar.  So if Instr doesn't find ")", it will return 0, which, in
conjunction with the second -1, will cause mid to drop the last character
of strinchar.  So to get the answer you want, use RInstr(strinchar,")").
which will do a right to left search for ")", starting at the end of
strinchar.

Second, there may be a bug in gambas, or the documentation needs to make
clear what end of string means.  This is best explained by example:

Instr("(foo)",")",-1) returns 5
Instr("(foo)f",")",-1) returns 5
Instr("(foo)ff",")",-1) returns 0

This means that Instr(s1,s2,-1) begins its search one character before the
last character of the string.  So end of string actually means last
character of the string and the docs should make that explicit or there is
a bug if the intended meaning of end of string is the position after the
last character of the string.



On 2017-07-28 09:31 PM, Fernando Cabral wrote:


Piccoro, sorry for my previous information. Something was missing.
In fact, both versions work the same:












*  strinchar = "test )after)r"positionlen = (InStr(strinchar, ")", -1)
- 1)Print strincharPrint positionlenstrinchar = Mid(strinchar,
1, positionlen) Print strincharstrinchar = "test )after)r"
strinchar = Mid(strinchar, 1, (InStr(strinchar, ")", -1) - 1))Print
strinchar *
Both print  "test )after"

- fernando

2017-07-28 22:02 GMT-03:00 Adrien Prokopowicz <
adrien.prokopow...@gmail.com>
:

Le Sat, 29 Jul 2017 02:40:44 +0200, Jussi Lahtinen <

jussi.lahti...@gmail.com> a écrit:

No... again. My initial mail was correct. It should be:


strinchar = Mid(strinchar, 1, (InStr(strinchar, ")", -1) - 1))

But the IDE makes highlighting bug with the brackets.


Jussi

On Sat, Jul 29, 2017 at 3:33 AM, Jussi Lahtinen <
jussi.lahti...@gmail.com
wrote:

Hmmm... sorry, no mistake... I will look closer.


Jussi

On Sat, Jul 29, 2017 at 3:33 AM, Jussi Lahtinen <
jussi.lahti...@gmail.com>
wrote:

Because the line makes no sense at all. Try to remove ")".


Jussi

On Fri, Jul 28, 2017 at 11:55 PM, PICCORO McKAY Lenz <
mckaygerh...@gmail.com> wrote:

in the following code:


  strinchar = Mid(strinchar, 1, InStr(strinchar, ")", -1) - 1)

IDE said error invalid argument, but if i do:

  psotionlen = InStr(strinchar, ")", -1) - 1
   strinchar = Mid(strinchar, 1, psotionlen)

works, why?

i wnat to remove the last occurence of a char but bybass some
possible
spaces/chars at the end of string

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

Actually, his original code is correct. For me it runs without error

in
the IDE using
the 3.10 development version, but the editor is indeed having trouble
matching the
parentheses.

I also tried it on the playground (which also uses 3.10) and it works
fine : https://gambas-playground.proko.eu/?gist=97ed16795393aa3b689
13025e5d2b83c .

However the playground's editor does match the parentheses correctly. :)

Which Gambas version are you using ? There may be an old bug here.

--
Adrien Prokopowicz



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

[Gambas-user] [Gambas Bug Tracker] Bug #1130: JSON.Encode serializes null objects as "undefined"

2017-07-29 Thread bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1130=L21haW4-

Adrien PROKOPOWICZ reported a new bug.

Summary
---

JSON.Encode serializes null objects as "undefined"

Type : Bug
Priority : Medium
Gambas version   : 3.9.90 (TRUNK)
Product  : Web components


Description
---

See example code here : 
https://gambas-playground.proko.eu/?gist=b70e4b4d0d25d56ba10b1d1ddb6ebfea

If I give JSON.Encode() a Null value (or Variant) it correctly serializes it as 
`null`.
However if I give it a Null object reference, it gets serialized as 
`undefined`. 

Which is surprising, but more importantly it is incorrect as there is no 
`undefined` in JSON.


System information
--

[System]
Gambas=3.9.90 r8147
OperatingSystem=Linux
Kernel=4.11.9-1-ARCH
Architecture=x86_64
Distribution=Arch Linux
Desktop=KDE5
Theme=Breeze
Language=fr_FR.UTF-8
Memory=15965M

[Libraries]
Cairo=libcairo.so.2.11400.10
Curl=libcurl.so.4.0.0
Curl=libcurl.so.4.1.0
Curl=libcurl.so.4.2.0
Curl=libcurl.so.4.3.0
Curl=libcurl.so.4.4.0
DBus=libdbus-1.so.3.14.11
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.1202.0
GTK+2=libgtk-x11-2.0.so.0.2400.31
GTK+3=libgtk-3.so.0.2200.16
OpenGL=libGL.so.1.0.0
Poppler=libpoppler.so.67.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.9.1
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
ANT_HOME=/usr/share/apache-ant
COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GB_GUI=gb.qt5
GEM_HOME=/.rvm/gems/ruby-2.3.3
GEM_PATH=/.rvm/gems/ruby-2.3.3:/.rvm/gems/ruby-2.3.3@global
GRADLE_HOME=/usr/share/java/gradle
GS_LIB=/.fonts
GTK_MODULES=canberra-gtk-module
HOME=
IRBRC=/.rvm/rubies/ruby-2.3.3/.irbrc
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=fr_FR.UTF-8
LANGUAGE=
LOGNAME=
MAIL=/var/spool/mail/
MAVEN_OPTS=-Xmx512m
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MY_RUBY_HOME=/.rvm/rubies/ruby-2.3.3
OLDPWD=
PATH=/.rvm/gems/ruby-2.3.3/bin:/.rvm/gems/ruby-2.3.3@global/bin:/.rvm/rubies/ruby-2.3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/.rvm/bin
PT5HOME=/opt/pt
PWD=
QSG_RENDER_LOOP=
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_NO_GLIB=1
QT_QUICK_CONTROLS_STYLE=org.kde.desktop
RUBY_VERSION=ruby-2.3.3
SESSION_MANAGER=local/:@/tmp/.ICE-unix/584,unix/:/tmp/.ICE-unix/584
SHELL=/usr/bin/zsh
SHLVL=1
TZ=:/etc/localtime
USER=
XAUTHORITY=/.Xauthority
XCURSOR_SIZE=0
XCURSOR_THEME=breeze_cursors
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/bin/kwrapper5
__GL_SYNC_TO_VBLANK=1
_system_arch=x86_64
_system_name=Arch
_system_type=Linux
_system_version=libc-2.25
rvm_bin_path=/.rvm/bin
rvm_path=/.rvm
rvm_prefix=
rvm_version=1.27.0 (latest)



--
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] textarea won't accept text

2017-07-29 Thread bill-lancaster via Gambas-user
Sorry, my mistake.
The textarea control works fine if I don't intercept key strokes. 
(Form_KeyPress())
Thanks again for the responses



--
View this message in context: 
http://gambas.8142.n7.nabble.com/textarea-won-t-accept-text-tp59911p59961.html
Sent from the gambas-user mailing list archive at Nabble.com.

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