Conditional Configuration Framework - configuration

I'm searching for a configuration framework which handles key/values pairs based on conditions. The language and storage type doesn't matter.
Example with background color for Application XYZ:
Application has the background color
"red".
On Monday the background color should be green.
The background color for User XYZ on Monday should be orange.
The developer just ask for something like "application.background.color" and this should return the correct value based on the given conditions.

In Java, have a look at Commons Configuration. You will need to extend it somewhat, but you should be able to use the existing frameworks variable expansion, providing you can define your available context elements in advance.

Related

Sublime Text 3 Multiple Language code highlight

I just upgraded to Sublime Text 3.
I'm using my existing Color scheme from Sublime Text 2. But now multi language code highlighting no longer works.
Sublime Text 3
Sublime Text 2
Can someone help me comeup with the custom scope for my tmTheme.
Congratulations on upgrading, it was a good choice. I'm using ST3 Build 3120, the latest development build, so the language definitions may have changed somewhat, but not significantly, if you're using the public beta Build 3114. I also use the Neon Color Scheme (full disclosure: I'm the developer), which has a very large number of specific scopes compared to some other color schemes like Monokai or Solarized which reuse the same colors for a variety of different language features. Finally, since I'm a color scheme designer, I use tools like ScopeHunter and ScopeAlways to determine which scopes and theming elements are active at any point in the text.
So, here's a screencap of your code plus a couple of other test lines using Sublime's HTML syntax:
and here is the same code, moments later, captured using the PHP syntax:
What we can see is that, in the lower left corner, ScopeAlways is indicating that, at the position of the cursor, the base scope of the HTML file is text.html.basic, while the PHP one is embedding.php text.html.basic. So far, so good - this is normal. More importantly, however, we can see the obvious difference in highlighting between HTML and PHP, including the contents of the id attribute as compared to the other attributes, and the coloring (or lack thereof) of the embedded PHP code (yes, I know I'm missing a ; at the end of the isolated PHP code at the bottom - adding one in doesn't change anything).
So, my first suggestion would be, if you're not already using it, is to set the syntax of the file to PHP. You can either select from the menu on the far right side of the bottom bar, or by selecting View → Syntax → and choosing from the options available.
If you're already using the PHP syntax, you should know that since the beginning of this year (more or less), many of Sublime's language description syntax files have been significantly or completely rewritten, PHP and HTML among them. They were in sore need of modernization and speed-up in some cases, and with the advent of the sublime-syntax format (much more powerful than the old, but still supported, tmLanguage format), a better regex engine for .sublime-syntax files, and the hiring by Sublime HQ of Will Bond (of Package Control fame) to do a lot of things that Jon Skinner (Sublime's author) didn't have time or interest in doing, the development process of both Sublime itself as well as the syntax definitions (which were open-sourced at the same time) has increased substantially. That is a really long-winded way of saying that a lot of stuff has changed in a relatively short amount of time, and color schemes that were written with the old versions of the HTML and PHP syntaxes in mind may not be perfect for the new versions. So, you may want to either go through the new syntaxes and update your color scheme, if you're that kind of person, or you can try some other schemes like Neon, which have already been through that process.
Getting back to that weird id highlighting - I'm going to release a new version of Neon fairly soon that fixes that issue, and colors the contents of the id attribute just like class or any other attribute. I'll also try and find out why they did that.
I hope this helps. Good luck!

Setting custom colors in PhpStorm

I am trying to customize the color scheme in PhpStorm to my liking. What I would like to do is set a different color for words like 'public', 'private' or 'protected' and the actual word 'function' when inside a class.
However, if I go to Settings->Colors & Fonts->PHP, I can't figure out how to do that. It seems that all of these words are considered Keywords and therefore have to have the same color.
Is there are a way around this?
Such functionality is not supported ATM.
https://youtrack.jetbrains.com/issue/WI-22194 -- watch this ticket (star/vote/comment) to get notified on any progress. So far it's not scheduled for any specific future release .. plus it has only 2 votes.

Recoloring sql-injections in PhpStorm

The PhpStorm IDE comes with a feature called language injections. This feature assists the developer while writing in a sub language while in the context of a primary language. That is, writing JavaScript in HTML or SQL in PHP.
The feature is useful no doubt, but I find the visuals distracting. Is it possible to configure the background color of a language injection in PhpStorm?
Not good; the green tint is super annoying in this case.
It is possible to disable the language injection, but that disables column-name auto-completion and other snacks that the IDE would otherwise provide:
I want a nice "quiet" background and the language completion features.
Here you can remove or change background color.
Settings/Preferences | Editor
Colors & Fonts | General
Code | Injected language fragment
Based on your image (the fact that background color breaks under variables) -- your problem might be that it is overwritten by colors for actual SQL elements. If so -- check them at Colors & Fonts | SQL.

Sublime Text 2 color scheme - change object key color

I'm wondering if there is a way to change the default color of object keys in Sublime Text 2.
I looked at this SO Q: Sublime Text 2: How do I change the color that the row number is highlighted? and it didnt have quite what I was looking for; The Tm-Theme Editor suggested is pretty awesome but doesnt seem to do what I want.
So, for example, with:
var foo = {
key1 : 1,
key2 : 2
}
By default key1 and key2 are white. I'd like to make them a separate color. I cant find the right tag in the .thTheme file I am currently using.
Unfortunately, the standard JavaScript language definition that comes with Sublime does not include a scope for keys, so there's no way to color it differently. However, if you switch to using Java​Script​Next - ES6 Syntax, which is a much more detailed language definition, you'll be able to use the constant.other.object.key.js scope to color the keys. Here is the difference between using standard JS:
and JavaScriptNext:
Syntax highlighting is courtesy of my Neon Color Scheme, which has been designed to make as many languages as possible look as good as possible, using as many different scopes as possible. I've included several JavaScriptNext-specific items in it, including object names, Node keywords, constants, properties, and others. Please feel free to open an issue if you have any questions, concerns, feature requests, or other feedback. If you don't want to change over from your old color scheme, you can of course borrow whatever features you like from the source.
Hope this helps!

Comparing instances of concepts in Semantic Web?

I am new to Semantic Web, and don't quite know what is the terminology for having instances of the same concepts or same inherited concepts? Can we call the instances equal if they belong to the same concept or subconcept?
Two instances of the same concept are in the same class. You can't really say anything more than than that. Suppose you have a concept Colour, and two instances red and green. They (presumably) aren't equal, but they are both members the Colour class, and may jointly be members of other classes as well (e.g. PrimaryColours, TrafficLightColours).
Note that I say that red and green may not be equal. In the semantic web, we generally make the open world assumption, i.e. that we don't assume that we have all of the relevant information yet, and we don't make the unique name assumption - so things with different names may denote the same thing. So unless red and green are explicitly stated to be different (owl:differentFrom), it's possible that, under the open world assumption, new information could show up to say, or infer, that they actually denote the same resource (owl:sameAs)
The equals method on a Jena Resource works out whether one resource is the same as another, not the same type as another. To work this out something like this will suffice:
if (resource1.hasProperty(model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type"), model.createResource("http://typeUri")) && resource2.hasProperty(model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type"), model.createResource("http://typeUri"))) {
// both resources are the same type
}