regarding include-exclude links in user-scripts - userscripts

Question regarding include-exclude links in user-scripts :
Type of pages I like to exclude:
http://www.stumbleupon.com/stumbler/samira-reddy/likes/interest
Type of pages I like to include:
http://www.stumbleupon.com/stumbler/samira-reddy
Note : I am a regular guy , don't know any coding stuff
what I tried but ain't work:
// ==UserScript==
// #name run imacro shortcut which click stumble button on pages
// #namespace udit
// #include http://www.stumbleupon.com/interest/*
// #include http://www.stumbleupon.com/channel/*
// #include http://www.stumbleupon.com/stumbler/*
// #exclude http://www.stumbleupon.com/stumbler/*likes/interest
// ==/UserScript==

// #exclude http://www.stumbleupon.com/stumbler/*/likes/interest/*

Related

Calling C function with Bitmap data from Flutter

My mission is to take a picture using the camera, send the pixels to C function, and provide a message to the user if the function returns an indication of a problematic image (e.g.: poor focus, picture too dark, etc).
I want to call a C function and send a pointer to the function which includes the pixels (and other parameters like image width/height). The idea is to use the C code and check the image quality.
The C code is ready. I found samples how to bind it into Flutter. But I do not know how to get the Bitmap data and pixels and send them to the C function.
You can do that binding to native code using dart:ffi.
Imagine that you have a C function that returns the sum of two numbers with this code:
#include <stdint.h>
extern "C" __attribute__((visibility("default"))) __attribute__((used))
int32_t native_add(int32_t x, int32_t y) {
return x + y;
}
And this C Makefile
cmake_minimum_required(VERSION 3.4.1) # for example
add_library( native_add
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
../native_add.cpp )
Now you need to encapsulate this CMake file into the externalNativeBuild inside build.gradle, this could be an example:
android {
// ...
externalNativeBuild {
// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "CMakeLists.txt"
}
}
// ...
}
Now that you have the library and you have encapsulated the code you can load the code using the FFI library like this:
import 'dart:ffi'; // For FFI
import 'dart:io'; // For Platform.isX
final DynamicLibrary nativeAddLib = Platform.isAndroid
? DynamicLibrary.open("libnative_add.so")
: DynamicLibrary.process();
And with a handle to an enclosing library you can resolve the native_add symbol as we do here:
final int Function(int x, int y) nativeAdd =
nativeAddLib
.lookup<NativeFunction<Int32 Function(Int32, Int32)>>("native_add")
.asFunction();
Now you could use it on your application calling the nativeAdd function, here you have an example:
body: Center(
child: Text('1 + 2 == ${nativeAdd(1, 2)}'),
),
You can learn how flutter native code binding works in the following url: flutter docs c-interop

Big gaps in Menu using GMenu

When creating a menu using GMenu (Gnome/Gtk) there is a huge gap left to the labels of the menu items(-> Picture). Any thoughts how to fix this?
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
//....
//....
if(title && (action || submenu))
{
GMenuItem *item;
if(submenu)
{
item = g_menu_item_new_submenu (title, G_MENU_MODEL(submenu));
}
else
{
item = g_menu_item_new(title, action);
if (icon != NULL)
{
g_menu_item_set_attribute (item, "icon", "s", icon);
}
}
//.....
//....
Picture
Unfortunately that's the way it's intended to be.
You can stick to the deprecated GtkImageMenuItem which is not problem until you port your app to GTK 4. If you really want to avoid deprecated components, it's possible to wrap an image + label in a GtkBox as suggested by the documentation, although it's not so straightforward, there are some needed quirks to get a decent solution:
You need to use gtk_menu_set_reserve_toggle_size on the menu and set that to FALSE.
Then you need to create the label and image for each menu item, however for items without icons it's necessary to create an image that will act as a filler, i.e. gtk_image_new_from_icon_name ("", GTK_ICON_SIZE_BUTTON)
You can find a fully working sample here.
Note: there is no guarantee this will properly work on GTK 4.

notepad++ function list multi comment

All
My code (C file) has comment formats as below:
/* ... */
/* ...
* ...
*/
In order to use Function list, I tried to modify functionList.xml as below:
<parser
displayName="C"
id ="c_function"
commentExpr="(?x)
| (?s:\x2F\x2A(.|\0x0A)*?\x2A\2F) # regex - /\*(.|\n)*?\*/
But it doesn't work.
I tried the reg with find command on notepad++, and it worked.
I have no clue what happen.
Is there anyone who is kind to give me suggestion?
Thanks.

Stylus - set url() prefix for cli compiles

I'm using Stylus CSS preprocessor, console compiler not javascript middleware. I'm looking for some kind of path prefix configuration.
So when I write (in foo.styl):
#lolipop
background: url(images/lolipop.png)
and set prefix static/, I want it to compile into:
#lolipop {
background: url("static/images/lolipop.png");
}
Is this possible with stylus's console compiler only?
Edit: Since you use the stylus executable, here is your solution. It seems totally undocumented, but you can actually --use url and pass along the options as a string, like this:
stylus --use url --with "{ paths: [ './static' ] }"
This feature works similar to url from the stylus url() documentation and takes the same options:
For example if our images live in ./public/images and we wish to use url(images/tobi.png), we can pass paths with our public directory, which will become part of the lookup process. Like-wise if we wanted url(tobi.png) instead, we would pass paths: [__dirname + '/public/images'].
stylus(str)
.set('filename', __dirname + '/css/test.styl')
.define('url', stylus.url({ paths: [__dirname + '/public'] }))
.render(function(err, css){
});
prefix = 'static/'
#lolipop
background: url(prefix + images/lolipop.png)
Maybe there is a better solution, but this works.

cakephp code completion in Netbeans with "$this->" before a Helper

Code completion works only if I use:
/* #var $html HtmlHelper */
$html->link...
but I want it to work while using
$this->Html->...
any idea?
This won't be possible with the current setup. If you want code completion like that, you could put the following at the top of your class (in the constructor maybe).
if (false) {
$this->Html = new HtmlHelper();
}
This will give you autocompletion, and since the IF condition never evaluates to TRUE it won't mess up your code.

Resources