How to disable access to development environment when releasing a GUI application - smalltalk

I have made a GUI application using Squeak, which I want to make available to the public without them necessarily knowing that the program was made using Squeak. I want to disable all the Smalltalk development tools in the Squeak image that I release. How can I do this? Pharo has openWorldWithSpec. Is there something similar in Squeak 5.3?

There was once a package called Lockdown which is now impossible to download.
However, it seems that it has been, at least partially, included in Squeak itself. To disable programming facilities you should run at Workspace or from the World menu (if you customize it):
Preferences disableProgrammerFacilities
Which does:
disableProgrammerFacilities
"Warning: do not call this lightly! It disables all access to menus, debuggers, halos. There is no guaranteed return from this, which is to say, you cannot necessarily reenable these things once they are disabled -- you can only use whatever the UI of the current project affords, and you cannot even snapshot -- you can only quit.
You can completely reverse the work of this method by calling the dual Preferences method enableProgrammerFacilities, provided you have left yourself leeway to bring about a call to that method.
To set up a system that will come up in such a state, you have to request the snapshot in the same breath as you disable the programmer facilities. To do this, put the following line into the 'do' menu and then evaluate it from that 'do' menu:
Preferences disableProgrammerFacilities.
You will be prompted for a new image name under which to save the resulting image."
Beeper beep.
(self
confirm: 'CAUTION!!
This is a drastic step!
Do you really want to do this?')
ifFalse:
[Beeper beep.
^self inform: 'whew!'].
self disable: #cmdDotEnabled. "No user-interrupt-into-debugger"
self compileAccessorForPreferenceNamed: #cmdGesturesEnabled value: false. "No halos, etc."
self compileAccessorForPreferenceNamed: #cmdKeysInText value: false. "No user commands invokable via cmd-key combos in text editor"
self enable: #noviceMode. "No control-menu"
self disable: #warnIfNoSourcesFile.
self disable: #warnIfNoChangesFile.
Smalltalk saveAs

Related

Is there a way to make IDEs (IntelliJ, PyCharm, VS Code) have fewer popups but still have completion?

I learned to program 30 years ago with Emacs. I'm starting to learn moderns IDEs such as "IntelliJ IDEA", "PyCharm", and "VS Code".
It's hard to adjust to how visually "busy" they are, with constant pop-up menus appearing every character I type.
Of course I want to be able to get suggestions for completion or parameter hints or other popups when necessary. I just don't want them to appear by default.
Some people are asking why popups are annoying. The main problem is that popups cover code above or below where I'm typing.
Emacs has completion. But it doesn't need a popup. For instance, dynamic completion works just fine 90% of the time, even though it's not smart enough to parse syntax or look up function and method definitions.
So I'd like to know if there are settings in JetBrains or VS Code IDE's that would help.
I'm aware of two kinds of popups.
(1) An offer to complete my typing, which appears below.
(2) Annotation of argument names and definitions, which appears above.
There may be other popups as well.
I'm aware that a popup can be dismissed with ESC. But often they just come back the moment you type another character.
What would be great is if the popup would not appear by default, but I could cause it to appear with a single keystroke. Or I could dismiss it and it would stay dismissed.
For PyCharm You can also try writing in "Disctraction Free Mode"
View -> Enter Distraction Free Mode
Which should give you a little screen of calm which will feel a lot more like emacs to you.
It's possible to adjust the behaviour via "Settings".
In IntelliJ IDEA, goto Menu File --> Settings ... , then navigate to Editor --> General --> Code Completion , or type something in the search field (upper left).
Perhaps you find more settings when you browse through Settings dialog.
To be honest, I didn't make a lot of tests with these settings, because I find the helper popups very useful.
Another option to get rid of some "noise" is to adjust settings for displaying parameter names in the code editor.
I switched this off completely.
Go to Settings --> Editor --> General --> Appearance
The new IDEs are really busy looking for libraries, checking/auto closing balanced parentheses, indenting, surrounding methods/functions/procedures/classes as you type. Sometimes I feel the same, but these IDEs are not plain text editors anymore. Every key stroke triggers something which can be time consuming. When the project gets larger and when it has lots of libraries, it can get even slower. Some IDEs have options to turn some of these options off. Every feature turned off will have some positive effect on responsiveness to some degree
But I think, instead of turning these features off, the best way to have these features on a responsive modern IDE is to use a computer with a fast cpu, an ssd drive and sufficient memory.

Highlight things marked as obsolete

I recently did some refactoring in our code and marked some widely-used functions as obsolete. The problem now is, that I get not visual indicator when I use an obsolete function right away. I have to hover over the function call to get the popup with further information about that function, and even there the "deprecated" warning is not very prominent. As these functions are to widely-used and cause no real treat, setting the isError property is not an option.
I know that somewhere I saw obsolete functions that were highlighted with some kind of underlining, but I can not find an option that does that. Where is that option, or how else can I achieve a more eye-catching indication?
I have created a simple toy VB.Net console application in MSVS, as you can see in the image the items marked obsolete are underlined in green where they are used.
If you are not seeing this then you will need to provide some more details on your solution's settings - what type of project is it, what version of visual studio are you opening it in, is it the same version it was created in, do you have any third party code linter (eg ReSharper) in use... etc
EDIT: As you mention in your comment, the project's properties, including the Code Analysis settings, will affect whether this underlining show's correctly or not; you will need to ensure the correct rule-set is selected there.

Why is GnuRadio companion not allowing me to add blocks?

I have installed GNU Radio and GRC 3.7.2.2 on a 32bit XP machine following the instructions from Ettus. It starts without any messages, I can open an existing flowgraph, delete blocks, edit block properties, but I cannot add new blocks. Double click on the block has no effect. Nor does dragging it, right clicking it or any other gesture I could think of. Can anyone think of a problem that might be causing this?
Update: it turns out that Return works, not double-click
It sounds like you are having issues with the installed graphics libraries. Did you install the whole list of dependencies in those instructions?
You should e-mail the GNU Radio mailing list with what's going on: https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Is it possible to enforce the declaration of local variables?

I have defined a local variable
local tSuppressLines
I would like to make sure that local variables are checked so that if I have a typo like
if not tSuppessLines then
-- do something
end if
I get a warning.
Yes, switch on "strict compilation mode" under "script editor" in preferences.
When in the script editor, there is also an item under the "Edit" menu, "Variable Checking", which toggles the same setting, but doesn't make the change persistent - on next launching the IDE, the value set in preferences will be restored.
This can be useful because sometimes you need to edit a script in which variables haven't been consistently declared (and literals haven't been quoted); and don't have time to make and test those changes. So you can temporarily toggle this checking off; and even if you forget to set it back, the corruption won't spread too far.
(This is an improvement on previous behaviour - before version 6, the menu item toggled the preference item, and vice versa)

NSToolbar looks different in Leopard and Snow Leopard

I have a Cocoa app I'm working on and I get a different result in appearance for the NSToolbar I am using for the main window.
Specifically, I'm using a search field as the last NSToolbarItem and, whereas under Snow Leopard it is displayed correctly:
it is cut under Leopard:
Looking at those two versions it appears that the spaces I put between the items are not respected under Leopard. I also saw that sometimes, after I make some update at the toolbar in Interface Builder, these changes are not mirrored in the running application even under Snow. I have to drag the default bar from the customizing menu in order to see them.
UPDATE
The reason for the NSToolbar not always mirroring what is in the .nib file resides in the autosave mechanism that was enabled for me, as NSGod suggested.
What can be the cause of this misbehavior?
Is there something about constraints, (minimum and maximum) sizes that I should have taken into account?
Feel free to point some documentation to me
UPDATE 2
Is there a way to programmatically introduce item and spaces into a NSToolbar or check the consistency (at run time) of those entered with Interface Builder?
While I do recall having a couple of oddities with search fields in NSToolbars, I've never seen the behavior where the right side of it is cut off.
Are the NSToolbarItems that are spaces the fixed one-unit space, or the flexible spaces?
"I also saw that sometimes, after I
make some update at the toolbar in
Interface Builder, these changes are
not mirrored in the running
application even under Snow. I have to
drag the default bar from the
customizing menu in order to see them."
You need to keep in mind that if you've enabled user customization and autosave behavior in the toolbar, then when the user explicitly makes a change, it will be saved to user defaults. If you then re-arrange your toolbar in IB and run the app, it's possible that the configuration saved in user defaults is overriding the default configuration you've specified in the nib file.
What I usually do is during testing, delete the prefs file for my app so changes can't be overridden. (FWIW, I usually use an AppleScript saved as an application that I keep in my Dock. It just runs a do shell script command which deletes the prefs file. Being a GUI-oriented type of person, it's easier for me to just click it to have it run right before debugging. This version of the script asks for the prefs file to delete, though it can also be customized: http://www.markdouma.com/developer/DeleteAppPrefs.zip. If you've never run it before, you get the choose file dialog, and the chosen file is saved as an alias inside the actual AppleScript, so you're not asked again. You can drag the icon onto AppleScript Editor to take a look at the script or change it).
Anyway, then, if I'm going to release a new version of an app that uses a new toolbar layout, and want to prevent the config from being overridden, I'll change the toolbar's identifier (or autosave name) to something like "docToolbar2.0".