I have the following code form Dolphin Smalltalk:
digitalClockProcess := [[
Processor sleep: 1000.
(View desktop canvas)
font: (Font name: 'Arial' pointSize: 36) beBold;
text: Time now printString at: 10#10;
free
] repeat] fork.
which shows a digital clock on the desktop. Can this code be run on GNU Smalltalk? I tried gst and gst-blox on Fedora on a VirtualBox VM and it didn't work, and gst-blox doesn't exist on Ubuntu, and gst-browser on both Fedora and Ubuntu gave a
Object: CFunctionDescriptor new: 1 "<0x7ffb3a010dc0>" error: Invalid C call-out g_date_get_type
when starting up the app. How is it done in GNU Smalltalk?
I am not familiar with GNU Smalltalk (I use Pharo), so maybe there is better way to write the code, but regardless.
Installation
gst installed from package manager doesn't need any GUI (it's a CLI), and even though it offers them, it doesn't pull the necessary system libraries to run them, so you have to install them manually:
for gst-browser (new ui): libgtk2.0 libcairo2 (tested on ubuntu)
for gst-blox (old ui): tcl tk (not tested)
Code
I see two problems with the code: GST doesn't support Process>>sleep:, and it uses GUI.
As for GUI, Smalltalks have very different UI libraries, Dolphin is geared towards MS Windows, GNU Smalltalk uses GNU stuff (GTK for the newser gst-browser, and TK/TCL for older gst-blox it seems), Pharo uses Athens, etc. Even if they share some concepts (such as MVC pattern), they do not really share API.
In fact it seems that GNUSmalltalk has "new" UI --- VisualGST (gst-browser) and that gst-blox is deprecated.
In any case, after some digging I end up with the following code. It creates a GTK window (UI used by gst-browser), and then it continuously updates the text.
window := GTK.GtkWindow new: GTK.Gtk gtkWindowToplevel.
window setTitle: 'Time'.
window resize: 400 height: 300.
label := GTK.GtkLabel new.
label setText: Time now printString.
label show.
window add: label.
window show.
digitalClockProcess := [[
(Delay forSeconds: 1) wait.
label setText: Time now printString.
] repeat] fork.
The code for gst-blox would have to use tcl/tk instead, which I am not familiar with.
Running the code
To run the code in gst-browser, from top menu select 'Tools > Bottom Pane', and then paste the code to a 'Workspace' that will be in the bottom pane (you can add more workspaces via 'File > New Workspace'.
Instructions how to download and build GNU smalltalk can be found here. This should solve your problem with the availability of gst-blox (GNU smalltalk with GUI) on ubuntu.
Related
Environment:
MacOS
Intellij IDEA Terminal
oh-my-zsh
While trying to execute a backwards or forwards word jump using the alt-<back arrow> or alt-<front arrow> combination, I get OD or OC instead. I've tried:
A picture of my settings in IDEA
"shell integration" in idea terminal settings on and off. This seems to only remove the O from the output.
"Override IDE shortcuts", as well as various others on this screen
sourcing a new .inputrc to include the jumping keystrokes. this doesn't really make sense, however since if I switch to bash the jumping motion works.
Additional notes:
alt-<backspace> works
In older versions of Pharo when you double-click a class name or any word in a text container, it it highlighted. However in Pharo 5, under Windows, this does not work anymore.
Is there any way to revert to older behavior?
Smalltalk vm version. 'CoInterpreter VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May 4 2016
StackToRegisterMappingCogit VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May 4 2016
https://github.com/pharo-project/pharo-vm.git Commit: b8ec25a570d7539653e1d793e97609adb509aaed Date: 2016-05-04 11:14:22 +0200 By: Esteban Lorenzano Jenkins build #589
'
I'm sorry, I cannot reproduce the behaviour you are reporting.
I can double-click on a word and word clicked is properly selected (tested under win XP and win 10)...
how did you downloaded it?
is that a "clean" image?
Which vm version are you using? (Smalltalk vm version will answer that)
Can you try zeroconf? (wget -O- get.pharo.org | bash && ./pharo-ui Pharo.image)
I have this problem in Windows 10 with Pharo 6.1 (and remember also having it with Pharo 5). Digging around with Google I found that this number is hard-coded to 350ms in the HandMorph class initialize method:
initialize
"HandMorph initialize"
PasteBuffer := nil.
DoubleClickTime := 350.
NormalCursor := CursorWithMask normal asCursorForm.
In a Playground, I entered:
HandMorph doubleClickTime: 500
and this seems to help.
I'm using Kate as the editor for some programs (Octave and sometimes MySQL).
I really like Kate's functionality, at the moment I've really exploited the link between the editor and the terminal.
I have changed some shortcuts to fit my needs as I replicate the behavior from other programs (it's not a big difference but I mention RStudio, which I also use).
The relevant shortcuts are: Show, Focus, Pipe and Synchronize Terminal. Since I modified Focus Terminal (Ctrl+Volume Off -F1 key-, strange choice but effective because of mentioned similarity with RStudio), it only works one way but it doesn't take me back to the editor. In addition, I noticed that the shortcut name changed to Defocus Terminal.
I'm using Kate version 5.0.0 on KDE Frameworks 5.9.0 and Ubuntu 15.04.
You should set a shortcut to View > Tool Views > Show Terminal, this then works as expected. You may have to save the current session to make it persistent (probably a bug). Invoking the shortcut will then toggle this action.
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
A keyboard shortcut to comment/uncomment out a piece of code is common in other programming IDE's for languages like Java, .Net. I find it a very useful technique when experimenting through trial and error to temporarily comment out and uncomment lines, words and parts of the code to find out what is and isn't working.
I cannot find any such keyboard shortcut on the Mathematica front end in version 7. I know that it is possible to comment out code by selecting the code, right mouse click and select Un/Comment from the menu that appears but this is too slow while coding.
I tried to access this using the menu key Menu on the keyboard but Mathematica frontend doesn't respond to or recognise this key unlike other applications, this could have allowed a key combination for commenting. Can someone else verify that this isn't unique to my machine and that the key isn't recognised by mathematica. I looked at this question and looked in the KeyEventTranslations.tr file but I don't think there is any way to create a shortcut to do this(?). Should I just live with it?
Any other suggestions?
(I have seen there is an Emacs version of mathematica, I have never tried Emacs or this Mma version and imagine that it would have this ability but would prefer not to go to the trouble and uncertainty of installing it. Also I would guess that the Wolfram Workbench could do this, but that may not be worth the investment just for this.)
You can install the shortcut in Mathematica 7.0.x if you are willing to edit the Mathematica system file MenuSetup.tr. You can find it in the same location as the KeyEventTranslations.tr file (i.e. in the installation under "SystemFiles/FrontEnd/TextResources/platform"). In MenuSetup.tr, locate the following line under the definition of the Edit menu:
MenuItem["Check &Balance", "Balance", MenuKey["B", Modifiers->{"Control", "Shift"}]],
Immediately below that line, insert the following:
MenuItem["Un/C&omment Selection", KernelExecute[FE`toggleComment[]], MenuKey["/", Modifiers->{"Command"}], MenuEvaluator -> Automatic, Method -> "Queued"],
The Un/Comment Selection command is now available under the Edit menu, with the keyboard shortcut Cmd-/ or Alt-/ depending on your platform -- just like in Mathematica 8 where this command comes pre-installed.
Please take as read the usual disclaimers about hacking the Mathematica installation files -- no warranty is offered :)
I do not know of any way to map this function to some shortcut involving the Menu key.
Shortcut Key, No Menu
The preceding steps mimic what Mathematica 8 does by installing a new menu item. If you prefer to leave the menus unchanged, then you can install the shortcut in KeyEventTranslations.tr instead. Add the following line:
Item[KeyEvent["/", Modifiers->{Command}], KernelExecute[ToExpression["FE`toggleComment[]"]], MenuEvaluator -> Automatic, Method -> "Queued"]
You'll need a comma on the end of that line if it is not the last item in the list.
Select the code and press one of the following:
Alt+/
Alt-E-O
Alt+E+O
Notes:
Tested only on Windows, using Mathematica 8.
On my non-US keyboard (ABNT Brazil), the shortcut Alt+/ doesn't work, instead I use Alt+E+O.
Here is code for your KeyEventTranslations.tr file that will comment out code. I am still working on the other half.
Item[KeyEvent["/", Modifiers -> {Command}],
FrontEndExecute[{
NotebookApply[FrontEnd`InputNotebook[],
"(*\[SelectionPlaceholder]*)"
]
}]
],
This binds it to Alt+/ as it is in Mathematica 8.