Re: [Gambas-user] who to detect if are running inside IDE
so in short investigations i have Public Sub Main() print "running" #If Exec print "in ide" #Endif End so testing by normal steps to compile produce a exec (either a cgi or not) so works for cgi: $ gbc3 -ga $ gba3 $ ./test.gambas running but for other cases i see tha if gambas archiver for executables are not run for distribute, it fails: $ gbx3 /tmp/testexec running in the reference mail it fails, but for production detection are good.. due its only for set paths, vars and environment this due, another way its detecting the gambas runtime environment.. seem gambas create a lof of files in /proc, based on Application.Id.. and also in "/tmp" ... i'm very curious about how gambas made this in cygwin installations, and or in macos/freebsd flavors (if any) 2017-07-03 18:44 GMT-04:00 PICCORO McKAY Lenz : > 2017-07-03 14:40 GMT-04:00 Tobias Boege : > >> Exact same question here: https://sourceforge.net/p/gamb >> as/mailman/message/34204796/ > > its does work for scripts, gambas.cgi or normal excecutables? > > -- 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] who to detect if are running inside IDE
2017-07-03 18:51 GMT-04:00 Jussi Lahtinen : > > Coz it stops at a defined place, not just next time the eventloop runs. > i matters, due depends on their environment and focused target objectives.. seems gambas developers have lack of vision... some users mails and trick sound pretty rare.. but area prooff of variety of needs.. that comes from externa vendor domination.. like me.. that many things dont exits in gambas.. but i building.. > > > The eventloop needs to hit menu click for that to happen anyway... also I > don't get why that matters. But I guess it's up to your taste. > > > > Jussi > > -- > 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] who to detect if are running inside IDE
> Coz it stops at a defined place, not just next time the eventloop runs. The eventloop needs to hit menu click for that to happen anyway... also I don't get why that matters. But I guess it's up to your taste. Jussi -- 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] who to detect if are running inside IDE
On 04/07/17 08:12, Jussi Lahtinen wrote: I don't understand why you need stop menu to your project. Why can't you just use the stop button from the IDE? Jussi Coz it stops at a defined place, not just next time the eventloop runs. b -- 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] who to detect if are running inside IDE
2017-07-03 14:40 GMT-04:00 Tobias Boege : > Exact same question here: https://sourceforge.net/p/ > gambas/mailman/message/34204796/ its does work for scripts, gambas.cgi or normal excecutables? > answer. I still stand by my statement from two years ago: you shouldn't > care > where your program is run from in the first place. What problem are you > trying to solve by knowing that? > when run from ide i can take care of a local db , set local paths.. if run from NOT-ide so then must detect system behaviour and user right paths.. currenlty some things are not distro agnostic and/or are user specific or user-wide only... like the examples.. /gambas farm installation of programs.. > > Regards, > Tobi > > -- > "There's an old saying: Don't change anything... ever!" -- Mr. Monk > > > -- > 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] who to detect if are running inside IDE
I don't understand why you need stop menu to your project. Why can't you just use the stop button from the IDE? Jussi On Mon, Jul 3, 2017 at 11:38 PM, adamn...@gmail.com wrote: > On Mon, 3 Jul 2017 20:40:46 +0200 > Tobias Boege wrote: > > > > I'm convinced that no matter how you try to detect if you're run by the > IDE > > or not, someone can create an environment where your test gives the wrong > > answer. I still stand by my statement from two years ago: you shouldn't > care > > where your program is run from in the first place. What problem are you > > trying to solve by knowing that? > > > > Regards, > > Tobi > > > Since you asked :-) > > Laziness! > > Many times I have a menu item in a form that just "Stop"s the program i.e. > > Private Sub mnuDebug() > Stop > End > > then in the Form_Open() > > #If Exec > mnuDebug.Visible = False > #Endif > > So at development time, or when the customer has a problem, I almost > always have a way to stop the program when it's running in the IDE. > > All this does is "tidy up" the program automatically when run outside the > IDE. If a user wants to go to the extent of creating a non-x version of the > program just to see that menu item - which will do nothing anyway since the > Stop is ignored - then all I can say is "Good luck to them." > > There are probably trickier or even "more correct" ways to hide a menu > item at runtime, but hey! Three lines and "As Far As I Care" - problem > solved. > > b > > -- > B Bruen > > > -- > 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] who to detect if are running inside IDE
On Mon, 3 Jul 2017 20:40:46 +0200 Tobias Boege wrote: > I'm convinced that no matter how you try to detect if you're run by the IDE > or not, someone can create an environment where your test gives the wrong > answer. I still stand by my statement from two years ago: you shouldn't care > where your program is run from in the first place. What problem are you > trying to solve by knowing that? > > Regards, > Tobi Since you asked :-) Laziness! Many times I have a menu item in a form that just "Stop"s the program i.e. Private Sub mnuDebug() Stop End then in the Form_Open() #If Exec mnuDebug.Visible = False #Endif So at development time, or when the customer has a problem, I almost always have a way to stop the program when it's running in the IDE. All this does is "tidy up" the program automatically when run outside the IDE. If a user wants to go to the extent of creating a non-x version of the program just to see that menu item - which will do nothing anyway since the Stop is ignored - then all I can say is "Good luck to them." There are probably trickier or even "more correct" ways to hide a menu item at runtime, but hey! Three lines and "As Far As I Care" - problem solved. b -- B Bruen -- 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] who to detect if are running inside IDE
On Mon, 03 Jul 2017, Karl Reinl wrote: > Am Montag, den 03.07.2017, 20:40 +0200 schrieb Tobias Boege: > > On Mon, 03 Jul 2017, PICCORO McKAY Lenz wrote: > > > a piece of code to who to detect if are running inside IDE? any ideas how > > > to? > > > > > > > Exact same question here: > > https://sourceforge.net/p/gambas/mailman/message/34204796/ > > > > If I may add something to the things said in the above thread: you could try > > to get the parent PID of your Gambas process and determine if it's the IDE. > > > > If you always run on Linux you can probably use the /proc filesystem to get > > the path to the executable of your parent process or its command line. Then > > it depends on if you want to trust that the user always installs the IDE as > > "gambas3.gambas", for instance. Examining the parent process will probably > > not work anymore if you run your process *from the IDE* but through gb.httpd > > or through xterm (which are options in the IDE). > > > > I'm convinced that no matter how you try to detect if you're run by the IDE > > or not, someone can create an environment where your test gives the wrong > > answer. I still stand by my statement from two years ago: you shouldn't care > > where your program is run from in the first place. What problem are you > > trying to solve by knowing that? > > > > Regards, > > Tobi > > > > Salut Tobi, > > I use (since gambas1) the project Arguments from the IDE. I set a ISIDE. > > Sub chkIfIsIDE() > Dim nI As Integer > bIsIDE = False > For nI = 0 To Application.Args.Count - 1 > 'PRINT Application.Args[nI] > If InStr(UCase(Application.Args[nI]), "ISIDE") > 0 Then > bIsIDE = True > Endif > Next > End > > So if I don't call my project with a parameter called ISIDE, I can be > sure .I ran in the IDE. > > And the use is, I set the first key of my DB to that is my > Test-Mandant that's just a copy from one of my Mandants in my DB. > So no problems with crashing DB-data, that's the problem I solved with!. > > Sorry : Mandant = mandator > Yes, and, in my opinion, you solved it the right way, by introducing a proper interface which the user has to know and respect. Your program doesn't guess, it is instructed. Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk -- 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] who to detect if are running inside IDE
Am Montag, den 03.07.2017, 20:40 +0200 schrieb Tobias Boege: > On Mon, 03 Jul 2017, PICCORO McKAY Lenz wrote: > > a piece of code to who to detect if are running inside IDE? any ideas how > > to? > > > > Exact same question here: > https://sourceforge.net/p/gambas/mailman/message/34204796/ > > If I may add something to the things said in the above thread: you could try > to get the parent PID of your Gambas process and determine if it's the IDE. > > If you always run on Linux you can probably use the /proc filesystem to get > the path to the executable of your parent process or its command line. Then > it depends on if you want to trust that the user always installs the IDE as > "gambas3.gambas", for instance. Examining the parent process will probably > not work anymore if you run your process *from the IDE* but through gb.httpd > or through xterm (which are options in the IDE). > > I'm convinced that no matter how you try to detect if you're run by the IDE > or not, someone can create an environment where your test gives the wrong > answer. I still stand by my statement from two years ago: you shouldn't care > where your program is run from in the first place. What problem are you > trying to solve by knowing that? > > Regards, > Tobi > Salut Tobi, I use (since gambas1) the project Arguments from the IDE. I set a ISIDE. Sub chkIfIsIDE() Dim nI As Integer bIsIDE = False For nI = 0 To Application.Args.Count - 1 'PRINT Application.Args[nI] If InStr(UCase(Application.Args[nI]), "ISIDE") > 0 Then bIsIDE = True Endif Next End So if I don't call my project with a parameter called ISIDE, I can be sure .I ran in the IDE. And the use is, I set the first key of my DB to that is my Test-Mandant that's just a copy from one of my Mandants in my DB. So no problems with crashing DB-data, that's the problem I solved with!. Sorry : Mandant = mandator -- 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] who to detect if are running inside IDE
Am Montag, den 03.07.2017, 20:40 +0200 schrieb Tobias Boege: > On Mon, 03 Jul 2017, PICCORO McKAY Lenz wrote: > > a piece of code to who to detect if are running inside IDE? any ideas how > > to? > > > > Exact same question here: > https://sourceforge.net/p/gambas/mailman/message/34204796/ > > If I may add something to the things said in the above thread: you could try > to get the parent PID of your Gambas process and determine if it's the IDE. > > If you always run on Linux you can probably use the /proc filesystem to get > the path to the executable of your parent process or its command line. Then > it depends on if you want to trust that the user always installs the IDE as > "gambas3.gambas", for instance. Examining the parent process will probably > not work anymore if you run your process *from the IDE* but through gb.httpd > or through xterm (which are options in the IDE). > > I'm convinced that no matter how you try to detect if you're run by the IDE > or not, someone can create an environment where your test gives the wrong > answer. I still stand by my statement from two years ago: you shouldn't care > where your program is run from in the first place. What problem are you > trying to solve by knowing that? > > Regards, > Tobi > Salut Tobi, I use (since gambas1) the project Arguments from the IDE. I set a ISIDE. Sub chkIfIsIDE() Dim nI As Integer bIsIDE = False For nI = 0 To Application.Args.Count - 1 'PRINT Application.Args[nI] If InStr(UCase(Application.Args[nI]), "ISIDE") > 0 Then bIsIDE = True Endif Next End So if I don't call my project with a parameter called ISIDE, I can be sure .I ran in the IDE. And the use is, I set the first key of my DB to that is my Test-Mandant that's just a copy from one of my Mandants in my DB. So no problems with crashing DB-data, that's the problem I solved with!. -- Amicalement Charlie -- 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] who to detect if are running inside IDE
On Mon, 03 Jul 2017, PICCORO McKAY Lenz wrote: > a piece of code to who to detect if are running inside IDE? any ideas how > to? > Exact same question here: https://sourceforge.net/p/gambas/mailman/message/34204796/ If I may add something to the things said in the above thread: you could try to get the parent PID of your Gambas process and determine if it's the IDE. If you always run on Linux you can probably use the /proc filesystem to get the path to the executable of your parent process or its command line. Then it depends on if you want to trust that the user always installs the IDE as "gambas3.gambas", for instance. Examining the parent process will probably not work anymore if you run your process *from the IDE* but through gb.httpd or through xterm (which are options in the IDE). I'm convinced that no matter how you try to detect if you're run by the IDE or not, someone can create an environment where your test gives the wrong answer. I still stand by my statement from two years ago: you shouldn't care where your program is run from in the first place. What problem are you trying to solve by knowing that? Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk -- 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] who to detect if are running inside IDE
I don't know how this reacts to Gambas scripts, but for "normal" projects it works. #If Exec Print "Executable" #Else Print "IDE" #Endif Jussi On Mon, Jul 3, 2017 at 8:23 PM, PICCORO McKAY Lenz wrote: > a piece of code to who to detect if are running inside IDE? any ideas how > to? > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.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 > -- 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] who to detect if are running inside IDE
On 03/07/17 14:23, PICCORO McKAY Lenz wrote: > a piece of code to who to detect if are running inside IDE? any ideas how > to? > > Lenz McKAY Gerardo (PICCORO) > http://qgqlochekone.blogspot.com In the old days of VB6 I tried to print the result of 1/0 to the DEBUG pane. Since output to the debug pane is ignored in VB6 compiled, there would be no error in the final compiled app. I don't know if Gambas does the same, but try this: Function InIDE() As Boolean Dim retVal As Boolean = False Try Debug (1/0) retVal = (Error.Code <> 0) Error.Clear Return retVal End Hope it helps, zxMarce -- 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