I've written a GNOME shell extension for gnome3.30-3.32 using:
const ExtensionUtils = imports.misc.extensionUtils;
...
ExtensionSystem.disableExtension(ExtensionUtils.extensions['extension-uuid'].uuid);
Updating to 3.34 version, ExtensionUtils does not provide the 'extension' property, and I don't know to find the documentation about it.
How can I fix the issue?
The code you're looking for, the map of loaded extensions, is also a part of the ExtensionSystem module, whereas the ExtensionUtils module is mostly utilities for extension authors like GSettings and Gettext helpers.
The functions you are looking for are a part of the class ExtensionManager in 3.34+. You can get the ExtensionManager instance from the Main import:
// >= 3.34
const Main = imports.ui.main;
const ExtensionManager = Main.extensionManager;
ExtensionManager.disableExtension(uuid);
// <= 3.32
const ExtensionSystem = imports.misc.extensionSystem;
ExtensionSystem.disableExtension(uuid);
// Handling both versions
const Config = imports.misc.config;
if (Config.PACKAGE_VERSION.split('.')[1] >= 34) {
let manager = imports.ui.main.extensionManager;
manager.disableExtension(uuid);
} else {
let extSystem = imports.misc.extensionSystem;
extSystem.disableExtension(uuid);
}
Sources:
https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/misc/extensionUtils.js
https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/extensionSystem.js
You can use the branch selector on the left of the GitLab page to select the version, or the history button on the right to view a list of changes to a given file.
Related
I'm trying to make a simple program checking execution times on two different branches of the same rust project.
I wanted to have my .toml look something like this
[dependencies]
cron_original = { git = "https://github.com/zslayton/cron" }
cron_fork = { git = "https://github.com/koenichiwa/cron", branch = "feature/reimplement-queries"}
And my program look something like this:
fn main() {
let expression = String::from("0-59 * 0-23 ?/2 1,2-4 ? *");
let schedule_orig = cron_original::Schedule::from_str(expression);
let schedule_fork = cron_fork::Schedule::from_str(expression);
// Check difference in execution times on these structs
}
but I'm getting no matching package named 'cron_fork' found. Is there anyway to import a package with a specific alias? I was thinking about creating something that would automate checks like this.
You need to specify package keys for those dependencies so cargo knows that you really want those packages even though you specify a different name:
[dependencies]
cron_original = { git = "https://github.com/zslayton/cron", package="cron" }
cron_fork = { git = "https://github.com/koenichiwa/cron", branch = "feature/reimplement-queries", package="cron" }
See the Renaming dependencies in Cargo.toml section in Specifying Dependencies documentation for details.
I'm trying to get a development environment going for Haskell, using Nix. I have a default.nix that just refers to my .cabal file for the list of packages. But one package I want to use, numhask-space, won't build, because the tests are failing. So I'm trying to override it and skip the tests.
Here's my default.nix:
# default.nix
let
pkgs = import <nixpkgs> { };
in
pkgs.haskellPackages.developPackage {
root = ./.;
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
[ cabal-install
ghcid
]);
source-overrides = {
numhask-space = pkgs.haskell.lib.dontCheck pkgs.haskellPackages.numhask-space;
};
}
But I must not be doing this right, because I get the error:
cabal2nix: user error (Failed to fetch source. Does this source exist? Source {sourceUrl = "/nix/store/w3pcvlj7b0k44v629k00kw2b0k86fcyj-numhask-space-0.3.0", sourceRevision = "", sourceHash = Guess "", sourceCabalDir = ""})
In short, how can I override this haskell package so that it doesn't run the tests, and I can install it in my development environment?
source-overrides overrides sources of the packages, that is, literally, the src attributes, rather than packages as a whole. You should use the overrides argument instead:
overrides = self: super: {
numhask-space = pkgs.haskell.lib.dontCheck super.numhask-space;
};
I have the following dependencies in my Cargo.toml file:
[package]
name = "api-client-tutorial"
version = "0.1.0"
authors = ["Supercomputing Systems AG <info#scs.ch>"]
edition = "2018"
[dependencies]
substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git" }
codec = { package = "parity-scale-codec", features = ["derive"], version = "1.0.0", default-features = false }
[dependencies.primitives]
git = "https://github.com/paritytech/substrate"
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5"
package = "substrate-primitives"
[dependencies.keyring]
git = "https://github.com/paritytech/substrate"
rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5"
package = "substrate-keyring"
I am unsure of the difference between dependencies section and dependencies.primitives section, but the package substrate-primitives is included in the primitives section.
I have seen that substrate_primitives has the module sr25519 I need to use, but when I try to import it in my code:
use substrate_api_client::{Api, node_metadata};
use substrate_primitives::sr25519;
fn main() {
// instantiate an Api that connects to the given address
let url = "127.0.0.1:9944";
// if no signer is set in the whole program, we need to give to Api a specific type instead of an associated type
// as during compilation the type needs to be defined.
let api = Api::<sr25519::Pair>::new(format!("ws://{}", url));
let meta = api.get_metadata();
println!("Metadata:\n {}", node_metadata::pretty_format(&meta).unwrap());
}
I get the following error:
unresolved import `substrate_primitives`
use of undeclared type or module `substrate_primitives`rustc(E0432)
main.rs(2, 5): use of undeclared type or module `substrate_primitives`
How do I import sr25519 so that I can use the following line in my code?
let api = Api::<sr25519::Pair>::new(format!("ws://{}", url));
The difference between tables under [dependencies] and the [dependencies.primitives] table is that the table for the primitives dependency is not inlined. You could also just inline the primitives dependency and put it under [dependencies] like that:
primitives = { git = "https://github.com/paritytech/substrate", rev = "3bf9540e72df5ecb3955845764dfee7dcdbb26b5", package = "substrate-primitives" }
The toml documentation can give you more details on tables and inline tables.
Regarding your problem. You cannot import the crate like that, because it is renamed to primitives. The package field specifies the real name of the dependency and the table name defines the new name which is used to import it inside your project. For details have a look at the cargo documentation.
Your import should therefore look like this: use primitives::sr25519;
I'm actually working on a .Net Core blueprint for JHipster. The file tree is not the same as for the Java version and the needles don't work anymore. I need to override the needles in order to modify the paths in it.
How to make the generator using the blueprint's needles and not the original ones ?
I tried to extends the needles and to modify the paths in it but they are not taken into consideration. The JHipster's needles are always used. I also tried to see how the others blueprints as ViewJS and Kotlin manage the problem but no one override the needles. I also tried to find a documentation on the needle API but there is none.
For example, the client's entities are no longer generated at the same path. So I tried to override the needle-client-angular.js.
const chalk = require('chalk');
const _ = require('lodash');
const needleClientAngular = require('generator-jhipster/generators/client/needle-api/needle-client-angular');
const constants = require('generator-jhipster/generators/generator-constants');
const dotnetConstants = require('../../generator-dotnetcore-constants');
const jhipsterUtils = require('generator-jhipster/generators/utils');
const toPascalCase = require('to-pascal-case');
const CLIENT_MAIN_SRC_DIR = `${dotnetConstants.SERVER_SRC_DIR}${toPascalCase(this.baseName)}/ClientApp`;
module.exports = class extends needleClientAngular {
...
addEntityToMenu(routerName, enableTranslation, entityTranslationKeyMenu) {
const errorMessage = `${chalk.yellow('Reference to ') + routerName} ${chalk.yellow('not added to menu.\n')}`;
const entityMenuPath = `${CLIENT_MAIN_SRC_DIR}app/layouts/navbar/navbar.component.html`;
const entityEntry =
// prettier-ignore
this.generator.stripMargin(`|<li>
| <a class="dropdown-item" routerLink="${routerName}" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
| <fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
| <span${enableTranslation ? ` jhiTranslate="global.menu.entities.${entityTranslationKeyMenu}"` : ''}>${_.startCase(routerName)}</span>
| </a>
| </li>`);
const rewriteFileModel = this.generateFileModel(entityMenuPath, 'jhipster-needle-add-entity-to-menu', entityEntry);
this.addBlockContentToFile(rewriteFileModel, errorMessage);
}
...
}
Currently, I get this error, proof that the needle override is not used :
Unable to find
src/main/webapp/app/layouts/navbar/navbar.component.html or missing
required jhipster-needle. Reference to bank-account not added to the
menu
Currently, the only way I found to do it is to replace needles paths from the blueprint client subgenerator directly into the generator-jhipster node module. I know it's not clean but it's not a priority and we will certainly make something better in the future.
The related issue :
https://github.com/jhipster/jhipster-dotnetcore/issues/11
I have a custom Node.js module fooModule that has a private variable foo and public getter and setter to modify this variable.
I have another two modules: zooModule depends on the fooModule#^1.0.1 and cannot use pre-release so far and barModule that depends on the fooModule#^1.0.2-0 (pre-release patch version that contains some fix) and zooModule at the same time.
The barModule firstly sets the foo variable value and then zooModule reads the value of foo.
I have noticed that when the version of the fooModule dependency is the same, then it works as expected, in other words the foo variable is shared between two modules. However, using different versions results in undefined when accessing foo from zooModule.
Here is a small pseudo example to demonstrate the logic. Each of the modules is a standalone npm package.
// fooModule.js
let foo;
export const getFoo = () => foo;
export const setFoo = (newFoo) => foo = newFoo;
// zooModule.js uses v.1.0.1 of the fooModule
import { getFoo } from './fooModule.js'
export const zooFunc = () => {
const zoo = getFoo();
if(!zoo) return;
...
return zoo; //result depends on zoo
};
// barModule.js uses v.1.0.2-0 of the fooModule
import { setFoo } from './fooModule.js'
import { zooFunc } from './zooModule.js'
setFoo('foo');
zooFunc(); // What is the output?
As far as I am concerned, in case of different versions of the fooModule, we become two different instances of the module and accordingly of the variable foo?
I tried to explain the question best I could, but it was hard to explain what I mean, sorry if it is still unclear.
Could give me some hints where to read more about this or give some explanation on how this is supposed to work. Thanks for your time.
EDIT:I forgot to mention that I have this use case in a frontend project bundled by a webpack.