Unable to display object alias as object header inside a frame or package - alias

Using plantuml I would like to create an object with an alias, so I can manipulate the object by means of it's actual name/ID (bar and baz in my example), but its header will show the alias ("Foo"). Also, I would like to group objects in some frame or package.
Here's my sample code.
#startuml
allowmixing
skinparam backgroundcolor transparent
!theme vibrant
frame "workflow" {
package "batch" as p {
object bar
}
object "Foo" as bar {
+ x
}
object "Foo" as baz {
+ x
}
}
#enduml
And this is the result:
You can see how the object that is outside the package has the expected "Foo" alias as header (instead of its name/ID baz), whereas the other object inside the "batch" package shows its bar name/ID in the header instead of the expected "Foo" alias.
How can I achieve a "Foo" header for the bar object also? Thanks.
I'm using the following configuration:
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
PlantUML version 1.2022.14 (Tue Dec 06 19:24:13 CET 2022)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: GB
PLANTUML_LIMIT_SIZE: 4096
Dot version: dot - graphviz version 7.1.0 (0)
Installation seems OK. File generation OK

Aliases are used on associations, I think.
If I define the object inside the package, I get this:
#startuml
allowmixing
skinparam backgroundcolor transparent
!theme vibrant
frame "workflow" {
package "batch" as p {
object "Foo" as bar {
+ x
}
}
object "Foo" as baz {
+ x
}
}
#enduml

Related

Cloudflare Wrangler "No KV Namespaces configured!"

I'm new to Cloudflare/Wrangler, but it seems like the documentation is missing something as
following the directions don't seem to work.
Starting from here:
https://developers.cloudflare.com/workers/wrangler/workers-kv/
I run the first command as wrangler kv:namespace create apikeys
🌀 Creating namespace with title "emailvalidator-apikeys"
✨ Success!
Add the following to your configuration file in your kv_namespaces array:
{ binding = "apikeys", id ="4818.........aa2c" }
I have a wrangler.toml file, and I add it to the kv_namespaces array:
kv_namespaces = [
{ binding = "apikeys", id = "4818.........aa2c" }
]
I attempt to add a key/value entry with Wrangler: wrangler kv:key put --binding=apikeys "MYKEY" "MYKEYVALUE"
✘ [ERROR] No KV Namespaces configured! Either use --namespace-id to upload directly or add a KV namespace to your wrangler config file.
What am I missing? I already validated in the Cloudflare platform that the namespace does exist, named as expected from the documentation as emailvalidator-apikeys.
Do you have your full wrangler.toml available? TOML has table inheritance which can cause issues where your kv_namespaces key isn't actually top-level or under an environment.
As an example:
name = "foo"
[triggers]
cron = ["* * * * *"]
kv_namespaces = [
{...}
]
This wouldn't work as kv_namespaces is now apart of the triggers table, so you would want to move it above or instead use the [[kv_namespaces]] syntax.
[[kv_namespaces]]
binding = "..."
id = "..."

Reference a class' static field of the same internal module but in a different file?

I'm using TypeScript and require.js to resolve dependencies in my files. I'm in a situation where I want to reference a static field of a class in an other file, but in the same internal module (same folder) and I am not able to access it, even if the Visual Studio pre-compiler does not show any error in my code.
I have the following situation :
Game.ts
class Game {
// ...
static width: number = 1920;
// ...
}
export = Game;
Launcher.ts
/// <reference path='lib/require.d.ts'/>
import Game = require("Game");
var width: number = Game.width;
console.log(width); // Hoping to see "1920"
And the TypeScript compiler is ok with all of this. However, I keep getting "undefined" at execution when running the compiled Launcher.ts.
It's the only reference problem I'm having in my project, so I guess the rest is configured correctly.
I hope I provided all necessary information, if you need more, please ask
Any help is appreciated, thanks !
Your code seems sound, so check the following...
You are referencing require.js in a script tag on your page, pointing at Launcher (assuming Launcher.ts is in the root directory - adjust as needed:
<script src="Scripts/require.js" data-main="Launcher"></script>
Remove the reference comment from Launcher.ts:
import Game = require("Game");
var width: number = Game.width;
console.log(width); // Hoping to see "1920"
Check that you are compiling using --module amd to ensure it generates the correct module-loading code (your JavaScript output will look like this...)
define(["require", "exports", "Game"], function (require, exports, Game) {
var width = Game.width;
console.log(width); // Hoping to see "1920"
});
If you are using Visual Studio, you can set this in Project > Properties > TypeScript Build > Module Kind (AMD)
If you are using require.js to load the (external) modules, the Game class must be exported:
export class Game {}
If you import Game in Launcher.ts like
import MyGame = require('Game')
the class can be referenced with MyGame.Game and the static variable with MyGame.Game.width
You should compile the ts files with tsc using option --module amd or the equivalent option in Visual Studio

Invalid config, must be a valid config object - Sencha Touch 2.1

When I'm trying to open new Panel after button tap I always get this error:
Uncaught Error: [ERROR][Ext.Container#factoryItem] Invalid config, must be a valid config object
Here is the function (Located in custom controller):
push : function(navigationView, viewClass) {
navigationView.push(viewClass);
}
And this is how it's called (Located in controller class that extends custom controller):
push(this.getNvw_main(), 'First.view.HomePage');
Thanks for help in advance.
Well, view must be instatiated in order to pushed:
push : function(navigationView, viewClass) {
var view = Ext.ClassManager.instantiate(viewClass);
navigationView.push(view);
}
For your second argument you should probably pass an object with the configs like so: {xtype:'homepage'}. That is assuming that your First.view.Homepage has an alias widget.homepage.

AMD and Dojo 1.7 questions

Simple question.
Does AMD DOJO implementation support these type of declarations?
text!./plain.html
define(["../Widget","text!./plain.html"],
function(Widget,plain){
return new Widget({name:"mainApp",template:plain});
});
Load non-modules, let's say underscore.js
require(['dir/underscore.js'], function(){
_.reduce ...
});
Yes, but the precise syntax is different to that used in the question.
The Dojo Loader (1.7)
Plugins
dojo/text
The plugin for loading character data is dojo/text.
The extension should not be used when loading a JavaScript library and the location of the file is set via either a relative of the dojotoolkit base or a packages location declaration in dojoConfig:
require(['underscore'], function( _ ){
_.reduce ...
});
Configure the namespace in the Dojo configuration to avoid messy import paths - see dojoConfig in the loader documentation.
Also, consider using the dojo/global module and/or defining a Dojo module as a wrapper for Underscore.js:
//_.js
define(['dojo/global', 'underscore'], function(global){
return global._
});
With the above consideration, you must have loaded the actual .js file manually. If in conjunction with the dojo/text plugin, one would create a wrapper which also loads the required JS and evaluates it, following could do the trick.
/var/www/dojo-release-1.7/ext_lib/_.js - this sample file is hierachially placed in a library namespace, alongside dojo, dijit, dojox
define(['dojo/global', 'dojo/text!./Underscore.js'], function(global, scriptContents){
global.eval(scriptContents);
return global._ // '_' is the evaluated reference from window['_']
/**
* Alternatively, wrap even further to maintain a closure scope thus hiding _ from global
* - so adapt global.eval to simply eval
* - remove above return statement
* - return a dojo declared module with a getInstance simple method
*/
function get_ () { return _ };
var __Underscore = declare('ext_lib._', [/*mixins - none*/], {
getInstance: get_
});
// practical 'static' reference too, callable by 'ext_lib.getInstance' without creating a 'new ext_lib._'
__Underscore.getInstance = get_;
return __Underscore;
});
A sample of defining own modules using declare here
Note: this code is untested; feel free to add corrections.

Android studio | Dependency Management

Can anyone suggest, how can we add a dependency at build time in android gradle based on some condition like:
dependencies{
if(someCondition){
// add dependency
}
}
Thanks in advance!!
I found a solution for this:
Step1: Declare a boolean variable in gradle at root level.
like: def someDependencyEnabled = true //This could be dynamically set.
Step2: Using this boolean variable we can apply a check like:
if(someDependencyEnabled){
//Add some dependency
}
else
{
//Add some other dependency
}
Step3: Define Different source set for different situations:
android.sourceSets {
main {
java.srcDirs = ['src/main/java', someDependencyEnabled ? 'src/dependency_enabled_src' : 'src/dependency_disabled_src']
}
}
where:
'src/main/java' : is the common src file which contain common code.
'src/dependency_enabled_src': is the source folder that contain dependency specific code. which is further used by 'src/main/java'.
'src/dependency_disabled_src': is the source folder that contain alternate code when particular dependency is disabled.
In my case I wrote same name classes, methods & package name in both folders (dependency_enabled & dependency_disabled src) and wrote methods with desired implementation in dependency_enabled_src & empty methods for dependency_disabled_src.