How to get the Speed Dial and Trash bookmark folders - opera-extension

Is there any reliable way to get the Speed Dial and Trash bookmark folders?
Are the ids of the system bookmark folders the same for all installations?
I could do a loop though with an id match but I'm not sure if the ids are the same for all Opera users.
EDIT: Just tested, the ids are not the same. One Opera instance in English and the Speed Dial folder id is 7 another Opera instance with language set to Chinese and the Speed Dial Folder id is 8.
I could do a loop through with a name match but what if the user uses another language? The system bookmark folders' names are automatically translated rendering the name match failed.
No id match and no name match, anyone has any ideas?

You can try to use chrome.bookmarks.getRootByName(string rootName, function callback), where:
rootName is "speed_dial", "trash", "unsorted", "bookmarks_bar", "other", "mobile", "user_root", "shared",
callback is a function that will return BookmarkTreeNode via a parameter - just simply function(BookmarkTreeNode results) {...};
As an example (I've never tested it but I infer it should work OK):
chrome.bookmarks.getRootByName("speed_dial", function(result) {
console.log("Name: " + result.title);
});

Related

How to clear a cluttered workspace in Pharo?

In the Pharo MOOC there is a proposed challenge (section 2.15.2) that consists in taking a email address and getting the associated gravatar image, as a Morph object. I was able to do it, by running the following code in the playground:
| url email |
email := 'stephane.ducasse#inria.fr'.
url := 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email) hex asString , '.jpg'.
(ZnEasy getJpeg: url) asMorph openInHand.
Now the problem is, I could not figure out how to properly clean my workspace of all the objects downloaded:
As you can see, now I have the image from the url (from a previous botched attempt where I did url asMorph openInHand without getting the jpg with ZnEasy first), and several lighthouse images (as every time I open the inspector a new one is generated).
I say properly clean because you can just exit Pharo without saving, and then open it again to have a clean workspace, but this is probably not ideal.
So far I tried to inspect the created objects, seeing they are instances of ImageMorph. Then in the associated methods I searched something including "erase", "del", "delete" or "clear", but could not find anything similar. These were the available methods for ImageMorph:
{ImageMorph>>#prepareForRotating.
ImageMorph>>#grabFromScreen.
ImageMorph>>#forwardDirection:.
ImageMorph>>#adoptPaneColor:.
ImageMorph>>#drawOnAthensCanvas:.
ImageMorph>>#extent:.
ImageMorph>>#setOptimalResizing.
ImageMorph>>#form:.
ImageMorph>>#shouldFlex.
ImageMorph>>#forwardDirection.
ImageMorph>>#resize:.
ImageMorph>>#areasRemainingToFill:.
ImageMorph>>#heading.
ImageMorph>>#imageExport.
ImageMorph>>#defaultImage.
ImageMorph>>#rotationDegrees.
ImageMorph>>#borderStyle:.
ImageMorph>>#opacityString.
ImageMorph>>#setDirectionFrom:.
ImageMorph>>#rotationDegrees:.
ImageMorph>>#borderWidth:.
ImageMorph>>#isOpaque.
ImageMorph>>#image:.
ImageMorph>>#readFromFile.
ImageMorph>>#drawOn:.
ImageMorph>>#basicExtent:.
ImageMorph>>#form.
ImageMorph>>#withSnapshotBorder.
ImageMorph>>#wantsRecolorHandle.
ImageMorph>>#changeOpacity.
ImageMorph>>#initialize.
ImageMorph>>#addCustomMenuItems:hand:.
ImageMorph>>#isOpaque:.
ImageMorph>>#releaseCachedState.
ImageMorph>>#color:}
I also tried to execute garbageCollect, and just click the images and press Delete.
After opening them in the hand, you have positioned them in the world. If you inspect the world, you'll see there are a number of ImageMorphs. You want to exclude the Pharo logo. If you inspect that, its extension tells you the logo is locked.
World submorphs select: [ :m |
m class = ImageMorph and: [
m isLocked not ] ]
thenDo: [ :m | m delete ]
Another way, which is not so practical in this case, but is unique to smalltalk, is to use #allInstances. You can do
ImageMorph allInstances inspect
which returns all those images. in the raw view of the inspector, you can then send them #delete. Here that is not so practical, as the icons in the windows are also ImageMorphs, so you'll get a long list
Based on the above I used Playground to inspect the World subMorphs. This allows you to identify the unwanted images.
I then used (work SubMorphs at: n) delete to remove them individually. You need to track the indices as they may change each time an image is deleted.
To find all messages an object will understand, have a look at its class and at its superclasses. You will find delete in the Morph class, a superclass of ImageMorph.
Try executing this line by line:
| url email morph |
email := 'stephane.ducasse#inria.fr'.
url := 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email) hex asString , '.jpg'.
morph := (ZnEasy getJpeg: url) asMorph.
morph openInHand.
morph delete.

Getting the name of a process in VB.NET

I've been looking around for how to find the name of a process object gotten using System.Diagnostics.Process.GetProcesses (for instance, for the process firefox, 'Firefox') , and haven't been able to find anything. I've tried using MainWindowTitle, but instead of returning 'Firefox' it returns the name of the current tab, as that's what Firefox names it's window. Is there any way to find the actual display name of a process?
For Each p As Process In Process.GetProcesses()
Debug.WriteLine(p.ProcessName)
Next
This might work, but is untested.
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.processname

EWS SearchFilter.ContainsSubstring to filter on Sender Email Address

I'm trying to filter emails on Exchange Web Services using SearchFilter.ContainsSubstring as follows:
sfilter = New SearchFilter.ContainsSubstring(EmailMessageSchema.Sender, EmailAddress, ContainmentMode.Substring, ComparisonMode.IgnoreCase)
MailItems = service.FindItems(Folder.Id, sfilter, view)
Unfortunately this doesn't work, and I don't want to use Queries, because I can't guarantee that I can use features of Exchange Server 2013.
Composing a variety of requests in Fiddler, I can observe that if I remove the last character of the email address, then the filter works, remove the first character instead, works - put them back, broken.
So perhaps it's pedantic, and it has to be a true substring to qualify, so if I change the Containment mode to FullString - it doesn't work, so I can't do anything like a collection with Substring OR FullString.
It looks like I'll be able to do (Substring with last char missing AND Substring with first char missing), but it surely can't be that broken can it?
What can I do to get this to work?
Note that my code is in VB.NET, but I can't imagine that this is the problem.
Cheers,
Mark
I worked out that the IsEqualTo filter works with From/Sender, and it doesn't care about case-sensitivity issues, so it's probably what I should have tried to begin with.
The code to match an email address is:
sfilter = New SearchFilter.IsEqualTo(EmailMessageSchema.From, New EmailAddress(Message.FromAddress))
MailItems = service.FindItems(FailureFolder.Id, sfilter, iv)
I still don't know how to find all emails from users at the same domain though.
More Info:
I really needed to filter by Sender Domain and did that by pulling the entire folder contents down and filtering in .Net code. Even that causes problems.
Basically to keep things quick and tight, I tried to pull all the data with a PropertySet:
New PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.Sender)
Filtering still didn't work, yet email addresses still showed in my list of items view. Well it turns out that the value of Message.Sender contains some kind of ActiveDirecty path in it until you call LoadPropertiesForItems. After LoadPropertiesForItems, it's an email address.
Note that my earlier attempt to filter at the server was scuppered because filtering would have to occur against the ActiveDirectory path style of string.
This is all highly confusing, and not at all user friendly.
If anybody has any idea on how to filter by email domain at the server, let me know!
Mark
What is your goal? Sender isn't a string property, so I'm not surprised that the results are odd with ContainsSubstring. I tried it against Office 365 and it worked, but older versions of Exchange may not be as "smart" about handling this kind of query. Depending on what you're trying to achieve, there may be a better filter.
if(emailSenderList.size() == 1) {
return new SearchFilter.IsEqualTo(EmailMessageSchema.From, emailSenderList.get(0));
}
return new SearchFilter.SearchFilterCollection(LogicalOperator.Or, emailSenderList.stream().map(em -> new SearchFilter.IsEqualTo(EmailMessageSchema.From, em)).toArray(SearchFilter.IsEqualTo[] :: new));

Best way to get a return tag from a sql SELECT command

I making a virtual assistant client for my University project and there is a slight problem in getting a tag return based on match string.
The system works like this:
1. The user speech input is converted into a string.
2. The string is then matched to column in table.
3. The matching column returns its id which then return two tags from another table.
The problem is for calling someone, how should I go around it?
I mean, the user will say something like this: "Call Arya", here I can't have predefined command for each person so I have to use "MATCH" or "LIKE" selectors in SQL.
But then if I use these selectors then it will return me the tag for say opening facebook app even if I just "facebook", as the commands for facebook will be "open facebook" or "run facebook".
So how to work around it. Please help.

sharepoint crawl rule to exclude AllItems.aspx , but get an item/document in search resu lts if queried in the search box

I followed this blog Tips 1and created a crawl rule http://.*forms/allitems.aspx and ran full crawl. I no longer get the results with AllItems.aspx. However, if there is any document with name Something.doc in a Document Library , it no longer gets pulled in the search results.
I think what I desire is a basic functionality, like the user should not get to see Allitems.aspx in the search results but should get the item/document with names entered in the search box.
Please let me know if I am missing anything. I have already put in 24 hours...googled the max I could.
It seems that an Index Reset is required. Here's the steps I did:
1. Add the following crawl rule to exclude: *://*allitems.aspx.
2. Index Reset.
3. Full Crawl.
I could not find a good way to do this using crawl rules. Instead, I opted to set up a restriction on the search results web part.
In the search results web part properties, select "Change Query"
Add a property filter to exclude anything with "AllItems" (and any other exclusions you want in place.
Used Steve Mann's blog as a reference and for the images: http://stevemannspath.blogspot.com/2013/04/sharepoint-2013-search-removing-junk.html