How to see object/class/context browser in GNU Smalltalk? - browser

I run get and now I'm seeing blank screen. I expected object browser, but there isn't. I think there is some command for that.
How can I see those object/class/context browser in GNU Smalltalk?

In the REPL, there are a couple of tools to inspect code and objects. For instance:
anObject inspect
will show you the internals of anObject.
If you need to retrieve the code of a particular method, you can do:
(MyClass >> #myMethodSelector) methodSourceString
As for a browser... well, you're in a text-based REPL, there is no such thing as a code browser. Still, you can give gst-browser a try, it's a GUI for GNU-Smalltalk that includes a Browser, Transcript, Workspace, Debugger, Inspector, etc. Take in account it's still in beta though!
Cheers.

Related

Visual Studio extension- Interactive error popup

I've got a Visual Studio extension that I am working on. I have implemented some error tagging, which works just fine. However, some of the errors reference other locations in the code. I would like that the user can click on these locations and be taken there. The definition for ErrorTag permits an Object as the tooltip, which is not terrifically helpful, and the documentation seemed quite resistant as to what this should actually be. So far I have only been able to use a String as a tooltip.
In addition, the error popup is destroyed when the user leaves the error text span. I would need it to remain whilst the user is still on the text span or the popup content. I have discovered a PopupStyles enumeration which can control this behaviour, but I am unsure how to apply it. I would need to use the DismissOnMouseLeaveTextOrContent member to set the appropriate behaviour.
How can I implement an interactive error tooltip?
Edit: I discovered that a UIElement is a valid argument here- I replaced the String with a Label, for example. Some formatting issues aside, I still need to know how to change the popup style.
The error popup is intended to be a static tooltip and nothing more. It's not supposed to be interactive.
The PopupStyles enumeration appears to be used for the ISpaceReservationManager and IToolTipProvider -- there's no real connection to the tagging API at all. What you might be able to do is listen for the IWpfTextView.MouseHover event, and then use one of these APIs to trigger the tooltip that can be interacted with.

Writing a Chrome extension that highlights "current" line

I have an idea for a useful tool but I have no idea where to start. (I apologize for the vague nature of the question, but I do think it can be answered in a specific way and therefore is appropriate for SO.)
Here's what I'm after in a nutshell: a Chrome extension that darkens/shades the whole viewport except for the "current" line, i.e. the line you're reading. (I explain momentarily how the "current" line is determined.)
Pretend the line outlined in red is the highlighted line and everything above and below is grayed out. (My mockup sucks but I'm working with limited tools right now.)
When the page loads and you turn on the extension, the "current" line is the first line of paragraph text. To go to the next line, press the down arrow. Ideally, your highlighted line is in the exact middle and the rest of the page "slides underneath" to the extent that it can so your eyes don't have to move.
So here's my question: if you knew HTML/CSS/JavaScript well enough but you'd never written a browser extension, where and how would you start this? Do a plain JS POC first? Build the POC as an extension?
To be clear, this isn't a "plz how i write ecomerce site" question where I'm asking you to spoon feed me the whole thing. I'm just asking what you'd do as the first step. I realize this is a non-trivial undertaking. Thanks in advance.
If you know HTML/CSS/Javascript well enough to get the effect you after, then getting started with a Chrome extension shouldn't be hard. Just read the Chrome extension developer documentation. There are loads of example extensions as well.
You basically need to make a package directory, containing a manifest.json, and specifying a single "content script" which would contain all your code.
It could make sense to start out developing based on a bookmarklet that injects a script tag (with file:///path/to/yourscript.js) because I think that would be slightly faster wrt loading new code, resulting in a slightly faster development cycle. You could also set up a dummy page to always include this particular script tag so you only have to reload that page to see your change. Even fancier: Use http://livereload.com/
Otherwise you need to instruct chrome to reload the extension manually after each change in your code.
You may like to use Extensions Reloader for easier reloads.
I like the idea by the way!

Sahi: Cannot execute scripts recorded in a browser in multiple browsers

Our web application is designed such that the text transform is picked from CSS.
There are multiple links on a webpage; hence i will take example of a Next link.
When i hover the mouse over Next link in FF, it shows the below code:
_click(_link("Next"));
Similarly when i hover the mouse over the same link in Chrome, it shows the below code:
_click(_link("NEXT"));
When the script is recorded in FF and executed in chrome, it fails at the location because "Next" link is unavailable. This is one example of a link and there are multiple links and multiple pages. For this scenario, do i need to verify the text for each link or is there a universal way i.e. toLowercase method that can help me.
Thanks.
As Kshitij pointed out, you can get this working by using a regular expression as your accessor... but you might also check the Alternatives pulldown in the Controller. Perhaps there's an alternative accessor that is better suited for both browsers.
I think, the question should be how can Sahi identify the element with text by ignoring the case-sensitivity.
Any tool can only record the attributes which is available on the browser at that time.
You can use the following code to achieve the functionality:
_click(_link("/Next/i"));

How to make Google Chrome extension sample work?

Recently I decided to write a very simple Google Chrome extension. All it's going to do is to hide some DOM-elements from the web-page using JavaScript when user presses the extension's button.
Since I knew nothing about Chrome extensions, I started reading tutorials, and I came across this Google's sample: A browser action with no icon that makes the page red
This sample is really close to what I want to make. The problem is that I can't make it work. Whenever I load the extension in Chrome, I can see the button of this extension, but when I press it - nothing happens. Sample doesn't work, probably I should know something I don't know yet.
And before you started asking me:
Yes, I tried restarting the browser;
I use the newest version of Chrome.
Thanks for help.
If you open up the sample zip... find backgrond.js... edit.
Find the line that says:
null, {code:"document.body.style.background='red !important'"});
and remove the "!important". so it should read:
null, {code:"document.body.style.background='red'"});
That is it. just save and reload the extension, should work (unless the page has an !important flag set to the background).
I am afraid I don't know why the "!important" tag doesn't work but I have never been able to get it to work in an extension. Hopefully someone else here will be able to give an explanation and maybe a work around.
I think I can help bring some clarification to the "!important" override attribute causing the extension to break. Though I am not 100% I believe that this attribute is not allowed for issues involving security complications. I have a link to another SO thread that may help clarify this as well.
My CSS is not getting injected through my content script
I'm assuming from reading this article that you must either use the !important override when content scripts specified in the manifest file. Otherwise if the css is being injected !important is not required. Again not 100% on this.

Intercepting chrome-extension://*/?q=<input> in chrome extension

So I am using the omnibox in my extension, and after a user enters something in the omnibox, it becomes part of the extensions "history" (which would be a nice feature). However, when the history entry is clicked on, it goes to "chrome-extension//?q=, and that returns an Error 6 (net::ERR_FILE_NOT_FOUND). Is there any way to remedy this situation, either by allowing this to act as it did the first time, or just by disabling the history?
EDIT: so it turns out one cannot inject content scripts into chrome-extensions (even though the documentation says you can (they're fixing this hopefully)
Any other advice is still appreciated, but I've become less hopeful that this can be done.

Resources