How to avoid AppBuilder removing pieces of code - editor

I'm working on a Progress-4GL programming environment, based on AppBuilder release 11.6.
Until now I've been changing already existing *.w and *.p files, but now I wanted to created my *.w file from scratch.
I've created a window and I've put a browse, a fill-in field and a button. Now I would like to add an event to that button. In order to do that, I add following lines to the *.w file:
ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.
However, when I save the *.w file, re-open it in the AppBuilder and save the file there again, those lines of code get removed.
I've already understood that, in order to avoid this, I need to "wrap" those lines of code by Scoped-define or Analyze:suspend/resume lines, something like this:
&Scoped-define SELF-NAME btn-Start_Query
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-Start_Query C-Win
ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.
&ANALYZE-RESUME
However, this seems not to be working.
Can you explain me what exactly I have to do in order avoid my lines of code to be removed?
By the way: I know that I'm working with extremely outdated technology, but I only work here for two weeks, so I don't have the authority to force my boss to change his development environment, just for me.

The recommended approach is to use the Wizards of the AppBuilder to create the trigger block with the required AppBuilder markup for you.
Add the button to the Window
Select the button on the design canvas
Choose the "Edit code" button in the AppBuilder main window (the pencil)
This will create an empty default trigger block (in case of a button, that's the CHOOSE). To create a different event, use the "New..." button in the section editor window.

Related

VFP font size in command window

In the VFP development environment both the command window and any code windows which are open display characters in Courier font, possible 10 pt. I would like to reduce the size of these characters, to see more lines on the screen.
Have tried going into Tools | Options | IDE and have changed several font specifications (for Desktop, Program files, Code Windows, Procedures), clicked on 'Apply' in an attempt to reduce the size of these character on the screen. This has not been successful.
How can I reduce the font size used for code when I am editing it, please?
Check the Override individual settings checkbox on the Options | IDE tab. Otherwise, if you've previously edited a particular PRG, you'll see the font you used then.
For the Command Window, right-click, Properties to set the font.
Most of the time, I use the default, but occasionally I change it by right-clicking within the MODIFY COMMAND window I'm working in, going into "Properties...", and changing the font size. It only applies when editing that filename, though. Many years ago I think I tried changing it globally, as you seem to have, and remember it not 'sticking', so henceforth I always changed it on a file-by-file basis when I needed to.
I think what you are looking for is under Tools / Options / EDITOR tab, and save whatever defaults you want and set as Default.
Additionally, another thing I have done this in the past and created my own master settings resource file. By default when you start VFP, a "resource" file is set to ex: C:\Program Files\VFP\blah\FoxUser.dbf (and the corresponding .fpt file)
What I would do is this. Use the resource file and make an EMPTY copy of it to a new location, such as the working folder of your project.
use ( sys(2005)) again alias tmpResource
copy structure to MyVFPResource
set resource to MyVFPResource
close tables all
The resource file keeps track of almost every thing you open / work with and retains settings such as window area, position, etc. Some things I like to have as a "default", such as when editing snippet methods in screen or class designer. Such as to always have the row/column of a file displayed, have other settings.
An example of common .prg files. Do a simple MODI COMM MyTest.prg. Then once a simple .prg file is open, go to Edit, then Properties. Click on all the settings you want (including font size, line/column, syntax coloring, tabs vs space preferences, etc. Click the checkbox for "Apply to .PRG files". and click ok.
Now, open your resource file AGAIN so you can see what is stored.
use ( sys(2005)) again alias tmpResource
BROWSE
You will see many rows, but at the bottom will be the most recent entries. You should see 3 records listed as "WINDMODIFY" which represents the "MODIFY COMMAND" of whatever prg file. Now, open the "Name" memo field. One will be listed as .prg, another will be "DEFAULT", and the last will be the actual "mytest.prg" you started with. Get on the "DEFAULT" version record. Now you can change the "READONLY" column from FALSE to TRUE (F/T) and it will lock these settings for ALL .prg files. You can then delete the other rows.
You can apply these same principles to modifying form code snippets. Open a form, double-click on any method, then EDIT / Properties, do the same, but checkbox for "Apply to method code".
Browse the resource file and look at the "WINDSNIP" rows. Again, look for "DEFAULT" and mark that readonly as .T. and you can delete the other. The resource file will literally save every snippet window specific to the form, object, method, etc.
Do the same for visual class file editing too.
Similarly can be done for toolbars and more as you browse and see. When you are done making all the changes you want, purge out all the other fluff, close the resource file and set it to read-only so no additional garbage gets pulled into it.
If you need to change in the future, make the table editable again, make changes, then readonly the table again.
Then, all you have to do is at VFP start, do
set resource to MyVFPResource

attempt to index field '' (a nil value)

I was trying to run this script done by SethBling, but it gives me this error:
LuaInterface.LuaScriptException: DP1.state
LuaInterface.LuaScriptException: [string "main"]:337: attempt to index field 'neurons' (a nil value)
This is the code
In case this didn't solve your problem try this:
"If you are using a version of BizHawk that is over 2.0, go into the menu and Click Config then follow as such: Customize > Advanced > Lua Core > Lua+LuaINterface. This is why I wasn't able to load." from JaRetroYT over on reddit.
A flamanis posted this comment on youtube. I followed the instructions and got it working.
HOW TO GET IT TO WORK! THIS ALL TAKES PLACE INSIDE THE FOLDER YOUR BIZHAWK EMULATOR IS IN.
Execpt this part: Before EVER opening the lua console on BizHawk,
(If you have, instructions on how to reset your stuff will be at the
bottom) go onto the level you want to have it learn, and when the
level starts up, click on file. Go down and open the menu of save
state, at the bottom click the create named state, and then finally
name it DP1, however put it after all the slashes and whatever so just
delete the gamestate.whatever jargon that it auto names it. After
doing that, either move that file from the SNES/State folder to where
you have your lua file, or the other way around. and then load up the
lua file into the console, and boom you're good.
IF YOU ALREADY TRIED TO RUN THE LUA FILE AND IT ERRORS: You either need to delete your save, or edit the lua file slightly. If you want to do the delete save approach, then go into the SNES folder and then into the SaveRAM
folder and delete your file for the game. THIS DOES NOT DELETE THE
EMULATION, just the save. If you want to edit the lua file, then at
the top, the very top line, (create a new one if you want to, just
make sure it's before any other text) add this: pool = nil that's it.
It will reset the data so that it can run again. You still need that
save state though. You will probably want to edit the file again after
you've started running it and remove that line or it will restart
every time you turn it on.
Alrighty, I said I'd answer this better, and sometimes people do just google randomly for their solutions.
Soo, Bizhawk emulator has a way to run Lua scripts, which is nice.
So Seth's program assumes a few things about how the game is set up, and how the user (that is you) has done certain things beforehand.
The main thing that you need to do beforehand is create what is known as a save state. This is a point in the game that you can instantly reload back to, and how the program restarts the level so that each 'run' is essentially the exact same. This differs slightly from normal games where you 'load' the game, because games back around SMB weren't as 'random' as games now. So saving the game and loading it should give the same exact result with the same inputs every time.
You should create the save state right at the very start of the level. To create this illustrious save state you want to click on the file button at the top of your screen to open the drop down, and then select save state and create a new one. This should create a save state that you can then load to return to that exact moment in the game.
To have the program be able to load your save state to run you can do one of two things
1: Rename the actual save state file name to be just DP1.savestate
2: Modify the Lua file and change the DP1.savestate part to be the name of your save state
Then you just need to move them into the same folder, and you should be golden.
If you attempted to run the file before making a save state, it will have tried to run and errored with attempt to index field 'neurons' (a nil value) or something similar. (It's been a while, it could have stopped on the first run because it couldn't find the save state, so this might just only happen on the 2nd and further runs)
What this means is that it essentially created it's "brain" but left it completely empty. Which is bad. There's two ways to fix this, and they're fairly straightforward.
1: You need to delete the actual game save, otherwise known as the SaveRAM. The file that you need to delete can be found in the folder for whatever console you're running, in Seth's video he was using the SNES, so that's the folder you'd want to go into. Inside that folder is then the SaveRAM folder, you can either just delete that folder, or go into it and delete the one for the game you were running.
2: You need to edit the Lua file to reset itself, all this requires is putting the text pool = nil at the very top. This will then delete the "brain" before anything else happens, which will let the program create a new one. Fair warning: This is not just a one time effect, if you restart the program at this point you will lose your entire progress. What you need to do is after it starts running, stop it and edit the file again, and remove the line you just added. This will stop it from deleting it's "brain" every time the program starts, and you should be able to freely run the game.
I do hope that there are still people who look at Seth's video and wants to make it run themselves, good luck to you guys, and happy gaming.
"If you are using a version of BizHawk that is over 2.0, go into the menu and Click Config then follow as such: Customize > Advanced > Lua Core > Lua+LuaINterface. This is why I wasn't able to load."
from JaRetroYT over on reddit.
Move the savestate and lua script to the main folder for the emulator (where EmuHawk.exe is)

Detecting unused methods iOS

Very simple question and hopefully isn't duplicated :).
The situation is following:
Project has been developing more then a year and by many developers.
From time to time I'm facing with unused methods (which are defined in .h and .m) obviously I'm not getting any warnings.
This is not critical, but I would like to have project cleared from all unnecessary staff. Of course I can search for all methods and define which are unused in project but I wonder if there is more elegant way?!
Thanks
A quick way to check while browsing your source code is the View > Standard Editor > Show Related Items menu (shortcut key: ^1). Place your cursor within a method body and then view the Callers.
AppCode (http://www.jetbrains.com/objc) can tell you if a method or an import is unused.
It's works in real time, but you can also inspect a whole project (menu code > inspect Code)
I don't think xCode can do it.
AppCode is not free, but it has a trial version.
Might I suggest adding an NSLOG to these methods. For example, if you have a View Controller called Home, you can go into the .m file for the Home View Controller and at the top of the function, write the following:
NSLOG(#"Method 1, has 3 buttons);
then watch the readout as you progress through the actions on that View Controller. The log should say something that would best describe the method in question. Step 2 would be to take the methods that you feel aren't showing up on the output and comment them out. That can be done by highlighting the method and then hitting Command + '/' on the keyboard. This will place '//' in front of each highlighted line commenting it out. Test your view controller again and if still no errors, you can delete that method. That's a free way to do it, but it does take some time.

How to display line numbers by default in SciTE?

I am using the lightweight SciTE Text editor and I like it very much.
I would like to configure it in order to see the line numbers displayed when I open it.
I don't want to check the "View\Line Number" menu every time.
I think that I can do it but I don't see the entry in my global options file. Does anybody know how to do it?
Try this in SciTEGlobal.properties:
# Sizes and visibility in edit pane
line.margin.visible=1
line.margin.width=5
# Sizes and visibility in edit pane
line.margin.visible=1
line.margin.width=2+ # + will expand if needed
Having seen the other answers i would say it is more "clean" to save to User options file, because it is a user setting and you might also transfer this setting together with your home directory f.e. when you migrate or copy it for other reason. Also in this cases your scite would still behave like YOU (and possibly other users) expect.
add this line to User options file ".SciTEUser.properties":
line.margin.visible=1
line.margin.width=0+ # + will expand if needed
additional comment:
for my taste the font of scite in linux is too small and therefore i also added these lines to .SciTEUser.properties:
magnification=1
output.magnification=1

Does Texniccenter or any other tex editor auto-complete references in Latex?

I want to use a latex editor that has auto completion feature for existing references in a latex file. Do you know any good ones? I am trying to find this feature in texniccenter, but I guess it doesn't exist or I could't find it yet.
Update:
Ok, I found how to enable auto completion in Texniccenter. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Texlipse does this, also with Ctrl+Space.
Inlage includes such a function, too. New commands and new environments will also appear in the auto completion list. If you use extern BibTex files the \cite{} command will open a list with your articles and books from you .bib file.
Ok, I found it. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Kile has reference completion. If you type Ctrl+Space inside of a \ref{}, you get a list of all the references (that existed last time you compiled, of course).
LEd presents a click list of them when in a \ref{}
The RefTeX mode for Emacs will do what you're asking for: the shortcut C-c ) activates the "insert a \ref" mode (of course, you can customize which type of reference: fancyref, hyperref, etc) and pressing TAB will allow you to start typing and autocomplete by tabbing again after typing some characters.
It also figures out (or asks if it can't) what sort of ref you're inserting and shows a list of all the defined \labels in your document, selectable with the arrow keys or C-n / C-p.
Now we just need a Vi user to come along and tell us how to do it there...
Now texmaker does, not need any special key.

Resources