I'm trying to install the Darker Google userscript in Tampermonkey 4.7 (for Safari 12), but it's not working.
Since I'm a total newbie on Tampermonkey I don't really know where to put my hands on.
In the Tampermonkey's dashboard I see that this userscript does not match any particular website, while for example Darker Facebook shows "*.facebook.com" and it works, but perhaps this is just a bad guess.
The beginning of the userscript is:
(function() {var css = "";
css += [
"/* Darker Google by Zigboom Designs */",
"",
"#namespace url(http://www.w3.org/1999/xhtml);"
].join("\n");
if (false ||
(document.location.href.indexOf("http://blogsearch.google") == 0) ||
(document.location.href.indexOf("http://books.google") == 0) ||
(document.location.href.indexOf("http://209.85.165.104") == 0) ||
(document.location.href.indexOf("http://translate.google") == 0) ||
(document.location.href.indexOf("http://video.google") == 0) ||
(document.location.href.indexOf("https://encrypted.google") == 0) ||
(document.location.href.indexOf("https://translate.google") == 0) ||
(document.location.href.indexOf("http://scholar.google") == 0) ||
(document.location.href.indexOf("https://scholar.google") == 0) ||
(document.location.href.indexOf("http://images.google") == 0) ||
(document.location.href.indexOf("https://images.google") == 0) ||
(document.location.href.indexOf("https://www.google.com/fonts") == 0) ||
(new RegExp("^https?://www\\.google\\.[a-z.]*/(?!calendar|nexus|adsense|analytics|maps).*$")).test(document.location.href))
which makes me thing it should match any *.google.com website... but it doesn't.
Its because the userscript is not running in the page. Add the following line, save it and reload the page.
// #match *://*.google.com/*
The above makes the userscript to run on Google sites.
For match-patterns, refer here
Related
I use Pcre2 lib that can be found here.
As you can see here Pcre2 \w matches only L and N categories and underscore and not matches M - marks (see here). However .Net Regex matches marks (see here).
I want to change the source code of PCRE2 to behave like .Net Regex, only I'm not sure I'm doing right.
What I want to do is find in the code where PT_WORD is referenced, like this:
case PT_WORD:
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
fc == CHAR_UNDERSCORE) == (Fop == OP_NOTPROP))
And add another line like that:
case PT_WORD:
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
PRIV(ucp_gentype)[prop->chartype] == ucp_M || // <-- new line
fc == CHAR_UNDERSCORE) == (Fop == OP_NOTPROP))
Is it right to do so? Are there other things to consider? What else do I need to change elsewhere in the code?
A .NET \w construct matches
Category Description
Ll Letter, Lowercase
Lu Letter, Uppercase
Lt Letter, Titlecase
Lo Letter, Other
Lm Letter, Modifier
Mn Mark, Nonspacing
Nd Number, Decimal Digit
Pc Punctuation, Connector. This category includes ten characters, the most commonly used of which is the LOWLINE character (_), u+005F.
Note the differences: .NET \w does not match all numbers, only those from the Nd category, and as for the M category, it only matches Mn subset.
Make sure you match these Unicode categories within your code and \w will behave as in .NET regex.
Use
case PT_WORD:
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Ll ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Lu ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Lt ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Lo ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Lm ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Mn ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Nd ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Lm ||
PRIV(ucp_gentype)[prop->chartype] == ucp_Pc) == (Fop == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
break;
Note you do not need to care about fc == CHAR_UNDERSCORE as it is part of \p{Pc} and you can't use just ucp_L as it also includes \p{LC}.
I'm using the libxml2 XMLTextWriter API (of which an official example is provided here) to output XML, but can't find any examples or see how to produce an element with both attributes and content, like so:
<MyElement myAttrib="x">Content</MyElement>
Surprisingly, I'm not seeing any questions on SO that address this. Maybe because people just output XML themselves rather than using a library.
The C code I have so far is:
if (xmlTextWriterStartElement(writer, BAD_CAST "MyElement") < 0
|| xmlTextWriterWriteAttribute(writer, BAD_CAST "myAttrib", "x") < 0
|| somehow print out content < 0
|| xmlTextWriterEndElement(writer) < 0)
{
// Handle error
}
It looks like xmlTextWriterWriteFormatString or xmlTextWriterWriteString will do the trick. Somehow I missed those at first
when looking through the API details.
Rather than delete, I'll leave here as this info might be useful for others looking for this info quickly.
Example:
if (xmlTextWriterStartElement(writer, BAD_CAST "MyElement") < 0
|| xmlTextWriterWriteAttribute(writer, BAD_CAST "myAttrib", "x") < 0
|| xmlTextWriterWriteString(writer, "Content") < 0
|| xmlTextWriterEndElement(writer) < 0)
{
// Handle error
}
Update: Tested and confirmed this works.
I have been using angular-google-maps for sometime. I have not faced any major issues till now. But one of my colleagues had upgraded angular to 1.3.8 recently. And since then I am getting the following errors while instantiating the and directives and I do not see any markers. Here are the errors I get. Any inputs or directions to debug will be awesome. Thanks in advance.
Here is the first error:
Error: this.mapCtrl.getMap is not a function
this.MarkersParentModel</MarkersParentModel.prototype.createMarkers#http://localhost/scripts/1b3f05c4.modules.js:2637:75
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2569:16
this.MarkersParentModel</MarkersParentModel.prototype.onTimeOut#http://localhost/scripts/1b3f05c4.modules.js:2612:16
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2569:16
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2234:16
IMarkerParentModel/<#http://localhost/scripts/1b3f05c4.modules.js:2290:11
timeout/timeoutId<#http://localhost/bower_components/angular/angular.js:16205:28
completeOutstandingRequest#http://localhost/bower_components/angular/angular.js:4902:7
Browser/self.defer/timeoutId<#http://localhost/bower_components/angular/angular.js:5282:7
http://localhost/bower_components/angular/angular.js
Line 11594
And here is the second error:
Error: this.linked.ctrls[0].getMap is not a function
this.WindowsParentModel</WindowsParentModel.prototype.createChildScopesWindows#http://localhost/scripts/1b3f05c4.modules.js:2860:21
__bind/<#http://localhost/scripts/1b3f05c4.modules.js:2726:16
WindowsParentModel/<#http://localhost/scripts/1b3f05c4.modules.js:2785:18
timeout/timeoutId<#http://localhost/bower_components/angular/angular.js:16205:28
completeOutstandingRequest#http://localhost/bower_components/angular/angular.js:4902:7
Browser/self.defer/timeoutId<#http://localhost/bower_components/angular/angular.js:5282:7
http://localhost/bower_components/angular/angular.js
Line 11594
Line 2860:
var markersScope, modelsNotDefined, _this = this;
this.isIconVisibleOnClick = true;
if (angular.isDefined(this.linked.attrs.isiconvisibleonclick)) {
this.isIconVisibleOnClick = this.linked.scope.isIconVisibleOnClick;
}
>>>> this.gMap = this.linked.ctrls[0].getMap();
markersScope = this.linked.ctrls.length > 1 && this.linked.ctrls[1] != null ? this.linked.ctrls[1].getMarkersScope() : void 0;
modelsNotDefined = angular.isUndefined(this.linked.scope.models);
if (modelsNotDefined && (markersScope === void 0 || markersScope.markerModels === void 0 && markersScope.models === void 0)) {
this.$log.info('No models to create windows from! Need direct models or models derrived from markers!');
return;
}
Line 2637:
this.gMarkerManager = new directives.api.managers.MarkerManager(this.mapCtrl.getMap());
I'm doing a homework of my course using Allegro, as ordered.
I need to catch the key up events on keyboard, for this I used the follow code:
al_wait_for_event(evento, &ev);
if(ev.type == ALLEGRO_EVENT_KEY_UP){
if (ev.keyboard.keycode==ALLEGRO_KEY_A || ev.keyboard.keycode==ALLEGRO_KEY_LEFT)
cmd='a';
else if (ev.keyboard.keycode==ALLEGRO_KEY_W || ev.keyboard.keycode==ALLEGRO_KEY_UP)
cmd='w';
else if (ev.keyboard.keycode==ALLEGRO_KEY_D || ev.keyboard.keycode==ALLEGRO_KEY_RIGHT)
cmd='d';
else if (ev.keyboard.keycode==ALLEGRO_KEY_S || ev.keyboard.keycode==ALLEGRO_KEY_DOWN)
cmd='s';
}
But this event return the value 6 times at once!
On the code I have included (previously) this commands:
al_install_keyboard();
[...]
al_register_event_source(evento, al_get_keyboard_event_source());
Where am I wrong?
Before the ALLEGRO_EVENT_KEY_UP event, there will be the ALLEGRO_EVENT_KEY_DOWN.
Just change UP to DOWN and it'll do.
for my word game i'm comparing chars in words, 6 in the first word, 6 in the random word.
Now I want it to do things when certain letters are on there place.
for example if
(aChar1 == aChar7 && aChar2 == aChar8){
//do something
}
but later in my code there is
(aChar1 == aChar7 && aChar2 == aChar8 && aChar3 == aChar9){
//do something
}
Now I just want the second code line to happen and not the first since that is only if the first 2 are in place. I need to add code like :
(aChar1 == aChar7 && aChar2 == aChar8 && aChar3 isnotequalto aChar9){
//do something
}
What code should I use for saying not equal?
use this and tell me if it works
achar3!=achar9