text:
Q: SWRL rules don't infer new Object and Data Property Assertions I have created this ontology which contains two classes: Blood-Sugar and Services. Blood-Sugar has two data properties: hasValu with range xsd:int, and hasStatut with range xsd:string. The object property triggerService has Blood-Sugar as domain and Service as range.
I want to infer a data property assertion with this rule:

Blood_Sugar(?x) ∧ hasValue(?x, ?y) ∧ swrlb:greaterThan(?y, 126) ∧ swrlb:lessThan(?y, 500) →  hasStatut(?x, "High")

Then I want to infer a new object property with this rule:

Blood_Sugar(?x) ∧ hasStatut(?x, "High") ∧ Service(?s) →  triggerService(?x, ?s)

However, the reasoner does not give me the result that I want when I create individuals to which the rules should apply.  Here is an ontology that demonstrates this behavior:
<?xml version="1.0"?>

<!DOCTYPE rdf:RDF [
    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
    <!ENTITY swrl "http://www.w3.org/2003/11/swrl#" >
    <!ENTITY swrlb "http://www.w3.org/2003/11/swrlb#" >
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
    <!ENTITY protege "http://protege.stanford.edu/plugins/owl/protege#" >
    <!ENTITY xsp "http://www.owl-ontologies.com/2005/08/07/xsp.owl#" >
    <!ENTITY swrla "http://swrl.stanford.edu/ontologies/3.3/swrla.owl#" >
    <!ENTITY sqwrl "http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#" >
]>

<rdf:RDF xmlns="http://www.owl-ontologies.com/Ontology1391620136.owl#"
     xml:base="http://www.owl-ontologies.com/Ontology1391620136.owl"
     xmlns:swrla="http://swrl.stanford.edu/ontologies/3.3/swrla.owl#"
     xmlns:sqwrl="http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
     xmlns:swrl="http://www.w3.org/2003/11/swrl#"
     xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
     xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:owl="http://www.w3.org/2002/07/owl#">
    <owl:Ontology rdf:about="">
        <owl:imports rdf:resource="http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl"/>
        <owl:imports rdf:resource="http://swrl.stanford.edu/ontologies/3.3/swrla.owl"/>
    </owl:Ontology>
    <swrl:Variable rdf:ID="s"/>
    <swrl:Variable rdf:ID="x"/>
    <swrl:Variable rdf:ID="y"/>
    <owl:Class rdf:ID="Blood_Sugar"/>
    <swrl:Imp rdf:ID="Rule-2">
        <swrl:body>
            <swrl:AtomList>
                <rdf:first>
                    <rdf:Description>
                        <rdf:type rdf:resource="&swrl;ClassAtom"/>
                        <swrl:argument1>
                            <rdf:Description rdf:about="#x"/>
                        </swrl:argument1>
                        <swrl:classPredicate rdf:resource="#Blood_Sugar"/>
                    </rdf:Description>
                </rdf:first>
                <rdf:rest>
                    <swrl:AtomList>
                        <rdf:first>
                            <rdf:Description>
                                <rdf:type rdf:resource="&swrl;DatavaluedPropertyAtom"/>
                                <swrl:argument2 rdf:datatype="&xsd;string">High</swrl:argument2>
                                <swrl:argument1>
                                    <rdf:Description rdf:about="#x"/>
                                </swrl:argument1>
                                <swrl:propertyPredicate rdf:resource="#hasStatut"/>
                            </rdf:Description>
                        </rdf:first>
                        <rdf:rest>
                            <swrl:AtomList>
                                <rdf:first>
                                    <rdf:Description>
                                        <rdf:type rdf:resource="&swrl;ClassAtom"/>
                                        <swrl:argument1>
                                            <rdf:Description rdf:about="#s"/>
                                        </swrl:argument1>
                                        <swrl:classPredicate rdf:resource="#Service"/>
                                    </rdf:Description>
                                </rdf:first>
                                <rdf:rest rdf:resource="&rdf;nil"/>
                            </swrl:AtomList>
                        </rdf:rest>
                    </swrl:AtomList>
                </rdf:rest>
            </swrl:AtomList>
        </swrl:body>
        <swrl:head>
            <swrl:AtomList>
                <rdf:first>
                    <rdf:Description>
                        <rdf:type rdf:resource="&swrl;IndividualPropertyAtom"/>
                        <swrl:argument2>
                            <rdf:Description rdf:about="#s"/>
                        </swrl:argument2>
                        <swrl:argument1>
                            <rdf:Description rdf:about="#x"/>
                        </swrl:argument1>
                        <swrl:propertyPredicate rdf:resource="#triggerService"/>
                    </rdf:Description>
                </rdf:first>
                <rdf:rest rdf:resource="&rdf;nil"/>
            </swrl:AtomList>
        </swrl:head>
    </swrl:Imp>
    <swrl:Imp rdf:ID="Rule-1">
        <swrl:body>
            <swrl:AtomList>
                <rdf:first>
                    <rdf:Description>
                        <rdf:type rdf:resource="&swrl;ClassAtom"/>
                        <swrl:argument1>
                            <rdf:Description rdf:about="#x"/>
                        </swrl:argument1>
                        <swrl:classPredicate rdf:resource="#Blood_Sugar"/>
                    </rdf:Description>
                </rdf:first>
                <rdf:rest>
                    <swrl:AtomList>
                        <rdf:first>
                            <rdf:Description>
                                <rdf:type rdf:resource="&swrl;DatavaluedPropertyAtom"/>
                                <swrl:argument2>
                                    <rdf:Description rdf:about="#y"/>
                                </swrl:argument2>
                                <swrl:argument1>
                                    <rdf:Description rdf:about="#x"/>
                                </swrl:argument1>
                                <swrl:propertyPredicate rdf:resource="#hasValue"/>
                            </rdf:Description>
                        </rdf:first>
                        <rdf:rest>
                            <swrl:AtomList>
                                <rdf:first>
                                    <rdf:Description>
                                        <rdf:type rdf:resource="&swrl;BuiltinAtom"/>
                                        <swrl:arguments>
                                            <rdf:List>
                                                <rdf:first>
                                                    <rdf:Description rdf:about="#y"/>
                                                </rdf:first>
                                                <rdf:rest>
                                                    <rdf:List>
                                                        <rdf:first rdf:datatype="&xsd;long">126</rdf:first>
                                                        <rdf:rest rdf:resource="&rdf;nil"/>
                                                    </rdf:List>
                                                </rdf:rest>
                                            </rdf:List>
                                        </swrl:arguments>
                                        <swrl:builtin>
                                            <rdf:Description rdf:about="&swrlb;greaterThan"/>
                                        </swrl:builtin>
                                    </rdf:Description>
                                </rdf:first>
                                <rdf:rest>
                                    <swrl:AtomList>
                                        <rdf:first>
                                            <rdf:Description>
                                                <rdf:type rdf:resource="&swrl;BuiltinAtom"/>
                                                <swrl:arguments>
                                                    <rdf:List>
                                                        <rdf:first>
                                                            <rdf:Description rdf:about="#y"/>
                                                        </rdf:first>
                                                        <rdf:rest>
                                                            <rdf:List>
                                                                <rdf:first rdf:datatype="&xsd;long">500</rdf:first>
                                                                <rdf:rest rdf:resource="&rdf;nil"/>
                                                            </rdf:List>
                                                        </rdf:rest>
                                                    </rdf:List>
                                                </swrl:arguments>
                                                <swrl:builtin>
                                                    <rdf:Description rdf:about="&swrlb;lessThan"/>
                                                </swrl:builtin>
                                            </rdf:Description>
                                        </rdf:first>
                                        <rdf:rest rdf:resource="&rdf;nil"/>
                                    </swrl:AtomList>
                                </rdf:rest>
                            </swrl:AtomList>
                        </rdf:rest>
                    </swrl:AtomList>
                </rdf:rest>
            </swrl:AtomList>
        </swrl:body>
        <swrl:head>
            <swrl:AtomList>
                <rdf:first>
                    <rdf:Description>
                        <rdf:type rdf:resource="&swrl;DatavaluedPropertyAtom"/>
                        <swrl:argument2 rdf:datatype="&xsd;string">High</swrl:argument2>
                        <swrl:argument1>
                            <rdf:Description rdf:about="#x"/>
                        </swrl:argument1>
                        <swrl:propertyPredicate rdf:resource="#hasStatut"/>
                    </rdf:Description>
                </rdf:first>
                <rdf:rest rdf:resource="&rdf;nil"/>
            </swrl:AtomList>
        </swrl:head>
    </swrl:Imp>
    <Blood_Sugar rdf:ID="Blood_Sugar_1">
        <hasValue rdf:datatype="&xsd;int">150</hasValue>
    </Blood_Sugar>
    <owl:DatatypeProperty rdf:ID="hasStatut">
        <rdfs:domain rdf:resource="#Blood_Sugar"/>
        <rdfs:range rdf:resource="&xsd;string"/>
    </owl:DatatypeProperty>
    <owl:DatatypeProperty rdf:ID="hasValue">
        <rdfs:domain rdf:resource="#Blood_Sugar"/>
        <rdfs:range rdf:resource="&xsd;int"/>
    </owl:DatatypeProperty>
    <owl:Class rdf:ID="Service"/>
    <Service rdf:ID="Service_1"/>
    <owl:ObjectProperty rdf:ID="triggerService">
        <rdfs:domain rdf:resource="#Blood_Sugar"/>
        <rdfs:range rdf:resource="#Service"/>
    </owl:ObjectProperty>
</rdf:RDF>

A:
But the reasonner does not give me the result that i want when I creat instances !!!

A bit more detail would be helpful here.  How do you know that the reasoner (and which reasoner are you using, by the way?) isn't inferring the desired properties?  Did you enable the reasoner?  Did you run a query to check whether the inferences were present?  Did you set the configuration in Protégé to show all the appropriate inferences?
At any rate, thank you for providing an ontology to reproduce your results.  I was able to load it into Protégé, run the Pellet reasoner, and I can get the following inferences:
Blood_Sugar_1 triggerService Service_1
Blood_Sugar_1 hasStatut "High"^^string
Blood_Sugar_1 hasStatut "150"^^int

While Pellet is able to compute all of these inferences, Protégé only shows inferences for object properties by default;  you have to go into the Reasoner > Configure… menu and makes sure that under the "Displayed Individual Inferences" section the "Data Property Assertions" option is checked.  Turning on the Pellet reasoner and setting this option is described in more detail in my answer to Ontology property definition in Protégé-OWL / SWRL.

A: Based on your comment, perhaps an example of SWRL rules being used to infer a new object property assertion will get you on track. Some OWL 2 reasoners support SWRL rules, so I'm using Protégé 4.x and Pellet. SWRL rules can be used to infer new object property assertions.  For instance, in the following ontology, there is a class Person with individuals Alice, Bill, Carl, and Raymond, an object property likes, and a rule:

Person(?x) → likes(?x,Raymond)

After enabling the Pellet reasoner (Reasoner > Pellet, then Reasoner > Start Reasoner), we get the expected results.  E.g., Bill likes Raymond:

Here's the ontology:
@prefix :      <http://example.org/swrl-example#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix swrl:  <http://www.w3.org/2003/11/swrl#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix swrlb: <http://www.w3.org/2003/11/swrlb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://example.org/swrl-example>
        a       owl:Ontology .

:Person  a      owl:Class .

:Raymond  a     owl:NamedIndividual , :Person .

:Alice  a       owl:NamedIndividual , :Person .

[ a          swrl:Imp ;
  swrl:body  [ a          swrl:AtomList ;
               rdf:first  [ a                    swrl:ClassAtom ;
                            swrl:argument1       <urn:swrl#x> ;
                            swrl:classPredicate  :Person
                          ] ;
               rdf:rest   ()

             ] ;
  swrl:head  [ a          swrl:AtomList ;
               rdf:first  [ a                       swrl:IndividualPropertyAtom ;
                            swrl:argument1          <urn:swrl#x> ;
                            swrl:argument2          :Raymond ;
                            swrl:propertyPredicate  :likes
                          ] ;
               rdf:rest   ()

             ]
] .

:Bill   a       owl:NamedIndividual , :Person .

:likes  a       owl:ObjectProperty .

:Carl   a       owl:NamedIndividual , :Person .

<urn:swrl#x>  a  swrl:Variable .


text:
Q: Is there a way to validate strings that represent nested object keys in Joi? I'm using joi@^17.4.0 and have a schema that looks like this:
settings: Joi.object({
  isHidden: Joi.boolean(),
  payoutData: Joi.object({
    email: Joi.string().email(),
  }),
}),

I would like to input the string 'settings.isHidden' or 'settings.payoutData.email' without hard coding each of these strings in the schema. Is there a way that I can make joi know that these strings are valid based on the object schema I already have? Currently, when I try to validate these strings I get a validation error that says those keys are not allowed.
Example object to validate:
{ 'settings.isHidden': false }

A: Your Joi schema:
settings: Joi.object({
  isHidden: Joi.boolean(),
  payoutData: Joi.object({
    email: Joi.string().email(),
  }),
}),

says that settings (presumably a property of an object) is an object that has two properties:

*

*isHidden, a boolean, and

*payoutData, an object with the property email, a string

Your example object
{ 'settings.isHidden': false }

is an object with a single property settings.isHidden and it so fails validation.
Ergo, your object fails validation against the schema.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there any other way passing lookup parameters in django I'm trying to pass a lookup parameter to my views.py to render to the templates
model.py
class Category(models.Model):
    name = models.CharField(max_length=20)
    slug = models.SlugField(max_length=200, blank=True, unique=True)

class Post(models.Model):

    """"
    created_on = models.DateTimeField(auto_now_add=True)
    cover = models.ImageField(null=True, blank=True )
    categories = models.ManyToManyField(Category, related_name='posts', blank=True)

views.py
def index_category(request, category):
    posts = Post.objects.filter(categories__name__contains=category).order_by('-created_on')
    context = {
        "category": category,
        "posts": posts,
    }
    return render(request, "blog/index_category.html", context)

index_category.html
{% extends "base.html" %}
{% block content %}

{% block title %}{{ category | title }}{% endblock title %}

    {% for post in posts %}

{{ post.title }}

            {{ post.created_on.date }} |
            Categories:
            {% for category in post.categories.all %}

                {{ category.name }}

            {% endfor %}

{{ post.body | slice:":200" }}...

    {% endfor %}

{% endblock %}

When i refresh my localhost on my category page, it's returning nothing except the block title.
Is there any other way to filter the many-to-many relationship between the post and the category???

A: To avoid future problems with similar category names change this:
posts = Post.objects.filter(categories__name__contains=category).order_by('-created_on')

to relation call: (for which you have related_name='posts' in Post.category field)
category = Category.objects.get(name__iexact=category)
posts = category.posts.all().order_by('-created_on')

For more help, show urls.py.
How do you pass the category variable into the function index_category?


text:
Q: What architecture for a tool based application with Godot I'm currently developing an application that can create and export battle maps for my DnD (and other RPGs) groups. I use Godot as a foundation because it brings a lot of features that support this use case like sprite rendering, polygons, shaders, an amazing UI framework etc.
I have a scene tree that looks roughly as follows:

*

*Window

*

*Menu

*

*...

*ToolWindow

*

*SelectionTool

*Polygon Tool

*...

*Canvas

*

*ToolSpecificNodes

*

*SpritePreview

*MapRoot

*

*Polygon1

*Sprite1

Whenever another tool is selected I discard all nodes under "ToolSpecificNodes" and let the selected tool add it's own nodes. Every tool has a select() and deselect() lifecycle-method and a reference to canvas. Every tool also comes with a property window that it manages itself.
My question is how I would integrate the different tools in a way that allows them to be loosely coupled and exchangeable. The planned tools are "select tool", "polygon tool", "line tool", "sprite tool". I'm struggling especially with the "select tool" as it kind of relies on the other tools for handling stuff like polygon deformation, line deformation and sprite scaling.
Is there a well known architecture pattern that covers this use case? Or maybe an example project that shows this without too much added complexity? None-Godot solutions are also welcome as I should be able to apply them to my context.

A: In general,

*

*If you reference other classes (or nodes, in this case) directly, you have tightly coupled code.

*If you use dependency injection (or means for code to find each other, such as reflection, or a service locator), and interfaces (or use duck typing) you have loosely coupled code.

*If you use an infrastructure to pass messages between objects (i.e. signals), you have decoupled code.

Thus, if you want your tools to be decoupled, use signals.
When a tool is available, it connects to the whatever signals it needs. When the tools is no longer available it disconnects.
Note: freeing an object automatically disconnects it.
Then other code (e.g. where you handle input) can emit signals, without worrying which tool or tools ara available at the moment.
This, combined with the fact that an object can emit signals of other objects, would also allow for communication between tools. However, it does not allow a tool to communicate to one other particular tool specifically (such references from one tool to another would couple them).
Addendum: You can use a Signal Bus to decouple to code further, as I describe elsewhere.

And if you want your tools to be loosely coupled, but not decoupled…
Wherever you need to, keep a reference to the current tool. So you can call into it. Changing the current tool is changing that reference.
Addendum: Perhaps you would benefit from a stack. Where the top of the stack is the current tool. So you can push tools on the stack when you select them. And pop them when you deselect them. Which returns the user to the tool they were previously using.
You, of course, don't want tools to have references to each other, but you want them to be able to find each other. A simple mechanism for this would be looking in the scene tree, and if the desired tool is not there, load it. So, let us put that logic into an autoload (sigleton). It will be our service locator.
To do that, create a scene with only the root node. And add it as an autoload, with some name, let us say "ToolLocator". Give the root node a script, we need to add a method that will give us a reference to a tool:
func get_tool(name:String) -> Node:
    return null # TODO

It will check if it has the tool loaded. We will use the scene tree for that. And if it is loaded, return it:
func get_tool(name:String) -> Node:
    var result := get_node_or_null(name)
    if result != null:
        return result

    return null # TODO

Otherwise, it will attempt to load it. For that, it will attempt to construct a resource path from the name of the tool. And, of course, it has to keep it (in the scene tree) for future requests.
const tool_resource_root := "res://tools/"
const extension := ".tscn"

func get_tool(name:String) -> Node:
    var result := get_node_or_null(name)
    if result != null:
        return result

    var packed_scene := load(tool_resource_root + name + extension) as PackedScene
    if packed_scene != null:
        result = packed_scene.instance()
        result.name = name
        add_child(result)
        return result

    return null

In this case, we are looking for the tool scenes at "res://tools/" and with the extension ".tscn".
Being this an autoload, you can use it from any scene, like this:
var polygon_tool := ToolLocator.get_tool("polygon")

And yes, that would include the tool scenes. That is, tool scenes would be able to find each other like that. Thus, this is a way that they can communicate without hard-coding references or their type. In other words, they are loosely coupled.
Note: you need to handle the case when the tool is not available (get_tool returns null). Consider adding push_error at the end of get_tool, before returning null.

You may also want to have a look at  https://softwareengineering.stackexchange.com, this question would be on topic there.


text:
Q: Use Jensen's inequality to show that $e^{\frac{\sum^3_{i=1} X_i}{3}}$ is not an unbiased estimator of $e^{\theta}$ My problem:
Let $X_{1}, X_{2},X_{3}$ be I.I.D. Poisson variables with common mean $\theta > 0$.
Use Jensen's inequality to show that $e^{\frac{\sum^3_{i=1}X_i}{3}}$ is not an unbiased estimator of $e^{\theta}$ and then use moment generating functions to compare this result.
My work so far:
With Jensen's inequality, I know I am trying to show that
$$E(h(x)) \geq h(E(x)).$$
I have also noted that for $e^{\frac{\sum^3_{i=1}X_i}3}$, the sum of three independent Poison variables will be an independent Poisson variable.
I also know that $E\left(e^{\frac{\sum^3_{i=1}X_i}3}\right)=e^{ \lambda(e-1)}$
From here I start to get lost. I am having quite some trouble with this one. I appreciate the help.

A: To show that your estimator is biased it is very simple. In fact, using Jensen's inequality you get that
$$\mathbb{E}\left[e^{\overline{X}_3}\right]\ne e^{\mathbb{E}[\overline{X}_3]}=e^{\theta}$$
...it is not necessary to identify if your expectation is greater or lower than $e^{\theta}$


text:
Q: What is the difference between IOT and a normal index? Please help me in getting the diff between IOT and a normal index

A: An IOT is a table stored in a variation of a B-tree index structure. In a heap-organized table, rows are inserted where they fit. In an index-organized table, rows are stored in an index defined on the primary key for the table. Each index entry in the B-tree also stores the non-key column values. Thus, the index is the data, and the data is the index. Applications manipulate index-organized tables just like heap-organized tables, using SQL statements.
For an analogy of an index-organized table, suppose a human resources manager has a book case of cardboard boxes. Each box is labeled with a number—1, 2, 3, 4, and so on—but the boxes do not sit on the shelves in sequential order. Instead, each box contains a pointer to the shelf location of the next box in the sequence.
Folders containing employee records are stored in each box. The folders are sorted by employee ID. Employee King has ID 100, which is the lowest ID, so his folder is at the bottom of box 1. The folder for employee 101 is on top of 100, 102 is on top of 101, and so on until box 1 is full. The next folder in the sequence is at the bottom of box 2.
In this analogy, ordering folders by employee ID makes it possible to search efficiently for folders without having to maintain a separate index. Suppose a user requests the records for employees 107, 120, and 122. Instead of searching an index in one step and retrieving the folders in a separate step, the manager can search the folders in sequential order and retrieve each folder as found.
Index-organized tables provide faster access to table rows by primary key or a valid prefix of the key. The presence of non-key columns of a row in the leaf block avoids an additional data block I/O. For example, the salary of employee 100 is stored in the index row itself. Also, because rows are stored in primary key order, range access by the primary key or prefix involves minimal block I/Os. Another benefit is the avoidance of the space overhead of a separate primary key index.
For more, read Overview of IOT

A: An IOT is not an index into a table, it is the table.
It has the same structure as a (B-tree) index, but instead of containing a rowid that points into the table, it contains the whole row.
This has the side-effect that there are no permanent rowids for the records in that table (because they get moved around as the index is re-organized). This is a bit of a problem if you want to build additional indexes on the IOT. It is solved by using extended rowids: The secondary index contains a rowid, but in case it is not valid anymore, it also contains the primary key so that you can still identify the row.


text:
Q: VM Tracker empty in Instruments VM Tracker in Instruments is empty when trying to profile a certain app. I can analyze all other apps but this one is just showing empty.
I have the automatic snapshot on & doing a manual snapshot is not working.
I can't remember if there were any specific changes to this project that could make VM Tracker stop working.
Any ideas?
Thanks!

A: Ok, it's working now. In schemes, I had the Release mode set for Profiling. Changed to Debug and now it works.


text:
Q: BeanCreationException: Error creating bean with name servletContainer I work with a Spring Boot project that I could build properly. However, at the time of running the project with the command e.g
mvn spring-boot:run I get the following error stack with BeanCreationException provided below,
2017-12-04 17:07:03.210 ERROR 2764 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletContainer' defined in com.quotecrunchers.email.HubSpotEmailApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at com.quotecrunchers.email.HubSpotEmailApplication.main(HubSpotEmailApplication.java:58) [classes/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
        at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:527) [spring-boot-maven-plugin-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletContainer' defined in com.quotecrunchers.email.HubSpotEmailApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:199) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
        ... 14 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        ... 25 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:227) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:84) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:61) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:527) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at com.quotecrunchers.email.KeystoreDetailReader.createKeystoreDetails(KeystoreDetailReader.java:17) ~[classes/:na]
        at com.quotecrunchers.email.HubSpotEmailApplication.servletContainer(HubSpotEmailApplication.java:70) [classes/:na]
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424.CGLIB$servletContainer$0(<generated>) ~[classes/:na]
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424$$FastClassBySpringCGLIB$$a6492ef3.invoke(<generated>) ~[classes/:na]
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424.servletContainer(<generated>) ~[classes/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
        ... 26 common frames omitted

[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:527)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletContainer' defined in com.quotecrunchers.email.HubSpotEmailApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
        at com.quotecrunchers.email.HubSpotEmailApplication.main(HubSpotEmailApplication.java:58)
        ... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletContainer' defined in com.quotecrunchers.email.HubSpotEmailApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:199)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
        ... 14 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 25 more
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"
        at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
        at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
        at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236)
        at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
        at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:227)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:84)
        at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:61)
        at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:527)
        at com.quotecrunchers.email.KeystoreDetailReader.createKeystoreDetails(KeystoreDetailReader.java:17)
        at com.quotecrunchers.email.HubSpotEmailApplication.servletContainer(HubSpotEmailApplication.java:70)
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424.CGLIB$servletContainer$0(<generated>)
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424$$FastClassBySpringCGLIB$$a6492ef3.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
        at com.quotecrunchers.email.HubSpotEmailApplication$$EnhancerBySpringCGLIB$$da41a424.servletContainer(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        ... 26 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.367 s
[INFO] Finished at: 2017-12-04T17:07:03+06:00
[INFO] Final Memory: 33M/490M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) on project HubSpotEmail: An exception occurred while running. null: InvocationTargetException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletContainer' defined in com.quotecrunchers.email.HubSpotEmailApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.embedded.EmbeddedServletContainerFactory]: Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}" -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The relevant portion of the code is provided below with the servletContainer method mentioned in the error stack,
@Slf4j
@Configuration
@SpringBootApplication
public abstract class HubSpotEmailApplication
        implements ApplicationListener<ApplicationReadyEvent>, ApplicationContextAware {

    @Autowired
    private Environment env;

    @Autowired
    private KeystoreDetailReader keystoreDetailReader;

    private boolean hasCertificate = false;

    private ConfigurableApplicationContext applicationContext;

    private KeystoreFacade keystore;

    public static void main(String[] args) {
        SpringApplication.run(HubSpotEmailApplication.class, args);
    }

    /**
     * This bean configures either an http or an https Tomcat Connector.
     * Whether an http or https connector is configured depends on
     * whether a valid SSL certificate is available.
     *
     * @return
     */
    @Bean
    public EmbeddedServletContainerFactory servletContainer() {
        KeystoreDetails keystoreDetails = keystoreDetailReader.createKeystoreDetails();
        keystore = new KeystoreFacade(keystoreDetails);

        TomcatEmbeddedServletContainerFactory tomcat = null;

        try {

            hasCertificate = isValidCertificateAvailable();

            log.info("SSL Certificate in place: " + hasCertificate);
            log.info("Https protocol requested: " + useHttps());
            if (useHttps() && hasCertificate) {
                tomcat = new TomcatEmbeddedServletContainerFactory() {
                    @Override
                    protected void postProcessContext(Context context) {
                        SecurityConstraint securityConstraint = new SecurityConstraint();
                        securityConstraint.setUserConstraint("CONFIDENTIAL");
                        SecurityCollection collection = new SecurityCollection();
                        collection.addPattern("/*");
                        //collection.removePattern("/.well-known/acme-challenge/*");
                        securityConstraint.addCollection(collection);
                        context.addConstraint(securityConstraint);
                    }
                };
                tomcat.addAdditionalTomcatConnectors(createSslConnector(keystoreDetails));

            } else {
                tomcat = new TomcatEmbeddedServletContainerFactory();
            }
        } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) {
            log.error(e.getMessage());
        }

        return tomcat;
    }

 // more code goes

}

The application.yml file is provided below with the modified keys,
hubspot:
  url: http://api.hubapi.com/
  fileUpload: filemanager/api/v2/files
  createFolder: filemanager/api/v2/folders
  key: c1488a5b-4c9a-4f80-bb1e-some_key
  emailId: some_id
  singleSendApi: email/public/v1/singleEmail/send
  pdfTemplateUrl:https://ddddrtrt.hubererespot.net/hubfs/3955925/mobile-calc-resources/eclipx-email.pdf

logging:
  level: debug
domain: test.api.thescene.co
keystore-folder: ${BASE}
admin-username: bravo
admin-password: bravo
server.port: 80
server.protocol: http

ssl:
  key-store: lets-encrypt-keystore.jks
  key-store-password: flexigroup
  key-password: flexigroup
  key-alias: test.api.thescene.co
  # below value can be staging or production. Let's encrypt only issue 5 production certs per week so use them carefully
  lets-encrypt: production

spreadsheet:
  user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11
  url: https://cdn2.hubspot.net/hubfs/439943/LoanCalculatorTX/{0}.xls?update={1}
  suffix: .xls

It seems that the issue started from the keystore-folder: ${BASE} line and the relevant part of the error stack,
Factory method 'servletContainer' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'BASE' in value "${BASE}"

Do you know how to fix this?

A: I's obvious that  a key named BASE should be provided.You can refer to this


text:
Q: What is the need of JSF, when UI can be achieved with JavaScript libraries such as jQuery and AngularJS I was reading about JSF that it's a UI framework and provides some UI components. But how is it better or different from number of components that are available from jQueryUI, AngularJS, React, Vue.js, Svelte, ExtJS, or even plain HTML, CSS and JavaScript.
Why should someone learn JSF?

A: I strongly disagree that jsf adds anything. It only adds overhead. Doing ui stuff on the server is the most ridiculous thing ive ever heard. And javascript on large teams works great - its called reusing code.
Just wrap the jquery in some jsp tags, thats all you need and youre done, and dont endure the.shackles and scalability issues with.jsf and richfaces.

A: Having worked with JSF, Spring MVC, Struts, Grails, JQuery, and ExtJS my opinion is that Grails + ExtJS is one powerful combination.
I would pick Grails over JSF any day.  I like the completeness of ExtJS as the client side framework and library, but it comes with a steeper learning curve than JQuery.

A: Here are the biggest differences between jQuery & JSF:

*

*no MVC architecture

*no state control (store date in session or conversation, auto-clean up, etc.)

*no (default) validation library

*no templating library

*no advanced navigation/routing

*client side

jQuery was never intended to be used as a full stack webframework. It was more intended for replacing low-level JS code so that writing JS becomes easier and more powerfull in less lines of code.
And it should thus mostly be used to add behaviour on HTML elements.

A: JSF was created to make it so that java shops didn't have to learn stuff like jQuery and build complex JS but instead focus on a purely Java stack. In a world where time is money and lots of places already focusing on Java development, one less language/piece in the stack makes training and maintaining faster and thus cheaper.
I'll add that JavaScript is easy to become a maintenance nightmare on large teams, especially if some of the developers on the project are not highly web savvy.

A: With Javascript and frameworks such as jQuery you have full flexibility and full control . With ext's etc you lose much control and must adapt to the framework. With JSF you totally lose control and must totally adapt to the framework. You're invoked in lifecycles etc. and finally you have no control when the call to the server can be made and where not. If you are to do something considered 'special', you're in very hard position. And in JSF world even such basic things as multicolumn table sort or fields where you can type only limited set of characters (such as number field) are considered 'special'.
However, the more flexibility you have, the more errors or bad practices you can made. High flexibility works only with highly intelligent programmers, others will turn the project into unmanagable nightmare.
But, with JSF and its limited flexibility, there's always only a few (or even only one) correct way to do something. You are very limited, you can't make shortcuts, you must write more XML etc. - but when adapting to standard, there's better control on the code the unexperienced or low-skilled programmers will produce. As a result, big corporations love JSF because it is 'safer' for them.
When I moved from GWT to JSF, I was shocked, how many things, that was natural to me, was considered highly untypical and how much simple things were so hard to achieve. What's more, even making the smallest changes, such as adding ':' sign after label, which in GWT/jQuery powered app would be changing one function generating label, required changing dozens of files with localized properties, which wasn't even considered by anyone except me strange...

A: Having used ExtJS framework for a large web application, I know how easy it is to use. The ExtJS (Schena) is best suited for (Oracle 11g) database interactions in MVC architecture.  The View was for the visual / user interactions. The controller specified the 'processing' and the triggers that needed to be used form the PLSQL packages (the API for the CRUD, SQL select queries etc.). The Model and the store files were used to 'map' the data items to the Viewer / inputs.
ExtJS is not suitable for non database intensive web interfaces - where Angular JS may be a better fit.

A: JSF to plain JSP/Servlet/HTML/CSS/JS is like as jQuery to plain JS: do more with less code. To take PrimeFaces (jQuery + jQuery UI based) as an example, browse through its showcase to see complete code examples. BootsFaces (jQuery + Bootstrap UI based) has also a showcase with complete code examples. If you study those examples closely, then you'll see that you basically need a simple Javabean class as model and a XHTML file as view.
Note that you should not see JSF as replacement of alone HTML/CSS/JS, you should also take the server side part into account (specifically: JSP/Servlet). JSF removes the need of all the boilerplate of gathering HTTP request parameters, converting/validating them, updating the model values, executing the right Java method to do the business stuff and generating the HTML/CSS/JS boilerplate code. With JSF you basically end up with a XHTML page as view definition and a Javabean class as model definition. This greatly speeds up development.
As with every component based web MVC framework, you have in JSF less fine-grained control over the rendered HTML/CSS/JS. Adding custom JS code isn't that easy as you have to take the JSF view state in the server side into account as well (e.g. enabling a disabled button in JS side won't enable the button in JSF side, which is in turn a huge security advantage). If that is however a major showstopper, then rather look for an action based web MVC framework like Spring MVC. You'll only take into account that you have to write all that HTML/CSS/JS code (and prevention against XSS, CSRF and DOM-manipulation!) yourself. Also if you fall back from Facelets to JSP, you'll miss advanced templating capabilities as well.
On the other hand, if you have a big JSP/Servlet/HTML/CSS/JS/jQuery based website and you'd like to refactor the repeated JSP/Servlet/HTML/CSS/JS/jQuery boilerplate code into reusable components, then one of the solutions would be JSF. Custom templates, tagfiles and components can aid in this. In that perspective, JSF stands above JSP/Servlet/HTML/CSS/JS/jQuery (and that's also why it's pretty important to understand those basics before diving into JSF).
You can find a real world kickoff JSF based project here: Java EE Kickoff App. You'll see that it contains next to JSF as good HTML5, CSS3 and jQuery.
See also:

*

*Difference between Request MVC and Component MVC

*Difference between JSP, Servlet and JSF

*What are the main disadvantages of JSF 2.0?

*Is it possible to use JSF+Facelets with HTML 4/5?

*When to use <ui:include>, tag files, composite components and/or custom components?

A: The benefits of using JSF are not only in generating xhtml + css + js. Sometimes JSF imposes a restriction on the markup you can generate, like any component based framework. But JSF is not just for that, its lifecyle helps greately. After validating the input it can update the model and sync your server side beans without any effort. you just say "whatever the user types here, check if it's a number, if yes then store it in the property YY in object XX" and JSF will do all that.
So yes, you can still use JQuery, JS, etc. But JSF provides many benefits when it comes to writing server side code and saves you from a lot of boiler plate.


text:
Q: javascript promise not async I want to only resolve and return promise once an http get request is set to a few conditions.
var getPromise = function(url) {
    // Return a new promise.
    return new Promise(function(resolve, reject) {
        // Do the usual XHR stuff
        var req = new XMLHttpRequest();
        req.open('GET', url, true);

        req.onload = function() {
            // This is called even on 404 etc
            // so check the status
            if (req.status == 200) {
                console.log(req);
                if (req.response === '"1"') {
                    // Resolve the promise with the response text
                    resolve(req.response);
                    console.log(req.response);
                }
            } else {
                // Otherwise reject with the status text
                // which will hopefully be a meaningful error
                reject(Error(req.statusText));
                console.log(Error(req.statusText));
            }
        };

        // Handle network errors
        req.onerror = function() {
            reject(Error("Network Error"));
        };

        // Make the request
        req.send();
    });
}

window.promise = getPromise(url);
window.promise.then(function(response) {
    // Execute code after agent leg is connected
    console.log("Connected!!!!!");
}, function(error) {
    console.error("Failed!", error);
});

The problem I am having is that the HTTP get request only resolves 1 time and sets the promise to a pending state. in order to see the changed state i need to run this code again in the console.
It was my understanding that setting req.open(,,true) would make this async.
I want it to only set the promise object when req.response = '"1"'
thanks in advance


text:
Q: Insert into sqlite3 a null date from pyramid framework using sqlalchemy python 2.7
pyramid 1.3a4
sqlalchemy 7.3
sqlite3.7.9

from sqlite prompt > I can do:
insert into risk(travel_dt) values ('')
also
insert into risk(travel_dt) values(Null)

Both result in a new row with a null value for risk.travel_dt but when I try those travel_dt values from pyramid, Sqlalchemy gives me an error.
In the first case, I get sqlalchemy.exc.StatementError:

SQLite Date type only accepts python date objects as input

In the second case, I get Null is not defined. When I use "Null", I get the first case error
I apologize for another question on nulls: I have read a lot of material but must have missed something simple. Thanks for any help
Clemens Herschel

A: While you didn't provide any insight into the table definition you're using or any example code, I am guessing the issue is due to confusing NULL (the database reserved word) and None (the Python reserved word).
The error message is telling you that you need to call your SQLA methods with valid python date objects, rather than strings such as "Null" or ''.
Assuming you have a Table called risk containing a Column called travel_dt, you should be able to create a row in that table with something sort of like:
risk.insert().values(travel_dt=None)

Note that this is just a snippet, you would need to execute such a call within an engine context like that defined in the SA Docs SQL Expression Language Tutorial.


text:
Q: find first blank input in form by name I want to add focus to the first blank input in form "#reg" containing 100 inputs all named "Player_Name" and other inputs with different names.
<form id = "reg">
<div>
<input id = "P1' name = "Player_Name" />
<input id = "P1' name = "Player_Name" />
<input id = "P2' name = "Player_Name" />
<input id = "P3' name = "Player_Name" />
</form>

I also have an array of objects used frequently which stores the inputs above.
myArray =
[{"name":"Ahmed, Simon","uscf":"2022-02-28"},
{"name":"Beh, Ryan Paul",""uscf":"2021-11-30"}
]

I'm not even close to a solution:
form = document.getElementById('reg'); // grab the form
nameArray = form.Player_Name.value; // grab the values of PlayerName
console.log (nameArray);
//nameArray.sort(); // sort those values with the idea getting blank inputs to show first;
//alert (JSON.stringify(nameArray));
//nameArray = _.orderBy(nameArray, '??, 'asc'); // or use lowdash, but not needed.

Anybody have any solutions?

A: Many ways to do it, but you basically need to loop over them and find the first one that has no value.

var firstBlank = Array.from(document.querySelectorAll('[name="Player_Name"]'))
  .find(function(elem) {
    return elem.value === ""
  });
// var firstBlank = [...document.querySelectorAll('[name="Player_Name"]')].find(elem => elem.value === "");
if (firstBlank) {
  firstBlank.focus();
}
<form id="reg">
  <input id="P1" name="Player_Name" value="111" />
  <input id="P2" name="Player_Name" />
  <input id="P3" name="Player_Name" />
</form>


text:
Q: Problem reading audio file recorded with AudioKit into an AVPlayer intsance I'm in a situation where I need to export an audio file recorded with AudioKit, and then reimport it later for use some processing via AVAudioPCMBuffer.
Below is the code I'm using for exporting from AudioKit:
    tape = recorder.audioFile!
    player.load(audioFile: tape)

    if let _ = player.audioFile?.duration {
        recorder.stop()
        tape.exportAsynchronously(name: "TempTestFile",
                                  baseDir: .documents,
                                  exportFormat: .caf) {_, exportError in
                                    if let error = exportError {
                                        AKLog("Export Failed \(error)")
                                    } else {
                                        AKLog("Export succeeded")
                                    }
        }

    }

And here is where I'm trying to read back that audio file into my macOS app later, and fill an AVAudioPCMBuffer (where file is the audio file I'm trying to read):
            let format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: Double(sampleRate), channels: AVAudioChannelCount(channels), interleaved: interleaved)

            if let buffer = AVAudioPCMBuffer(pcmFormat: format!, frameCapacity: AVAudioFrameCount(file.length)){
                if ((try? file.read(into: buffer)) != nil) {

                    let arraySize = Int(buffer.frameLength)

                    switch type {
                    case is Double.Type:
                        let doublePointer = UnsafeMutablePointer<Double>.allocate(capacity: arraySize)
                        vDSP_vspdp(buffer.floatChannelData![0], 1, doublePointer, 1, vDSP_Length(arraySize))
                        return Array(UnsafeBufferPointer(start: doublePointer, count:arraySize)) as? [T]
                    case is Float.Type:
                        return Array(UnsafeBufferPointer(start: buffer.floatChannelData![0], count:arraySize)) as? [T]
                    default: return nil
                    }
                }
            }

However, I'm consistently getting an error of the following:

EXCEPTION (-50): "wrong number of buffers"
[avae] AVAEInternal.h:103:_AVAE_CheckNoErr:
  [AVAudioFile.mm:445:-[AVAudioFile readIntoBuffer:frameCount:error:]:
  (ExtAudioFileRead(_imp->_extAudioFile, &ioFrames,
  buffer.mutableAudioBufferList)): error -50

This is regardless of the file format used when exporting and importing the audio.
However, it does work fine if I'm using this .wav file that is read from directly inside the app.
Does anyone have any insights into why I can't seem to read the data from the audio file into an AVPCMBuffer.

A: In this line:
let format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: Double(sampleRate), channels: AVAudioChannelCount(channels), interleaved: interleaved)

try settings the properly to interleaved to false and don't forget to treat the resulting data as non-interleaved (please read below for more on this).
For some reason, it works with a non-interleaved buffer but I can't get it to work with the interleaved one :(
If somebody knows how to do it, please leave a comment :)
Interleaved vs non-interleaved
This is an excerpt from Mike Ash's blog on working with audio data.
...You may have noticed that most people have two ears. Because of this, sound recorded as two separate streams sounds nicer to most people than a single stream. Conceptually, this audio can be thought of as two separate functions of pressure over time.
To represent stereo sound in data, those two functions have to be represented simultaneously. The most common way is to simply interleave the two channels, so that the first value in a buffer would be the left channel, the second value the right channel, then left again, etc. In memory, it would look like:
LRLRLRLRLRLRLRLRLR

It's also possible to simply use two completely different buffers, which just looks like:
buffer 1: LLLLLLLLLL
buffer 2: RRRRRRRRRR

Deinterleaved data like this can be more convenient to work with, but the interleaved representation is more commonly used simply because it keeps everything in one place.


text:
Q: Get the `id` of gitlab project via gitlab api or gitlab-cli Is there any way to get an id of the project via GitLab API .
I created a project using GitLab API providing the project name -
curl -kX POST --header "PRIVATE-TOKEN: <access_token>" https://gitlab.example.com/api/v4/projects/my_app&visibility=internal
It returns expected result with project information like links, id, user, namespace etc.
Now I want to create issue or create a branch. I need the project id now.
So how can I retrieve the id of my project my_app. (Not from UI).
I didn't find any API query that I can create issue or branch without using project id.
I always need id Issues API
POST /projects/:id/issues
As well I didn't find any API query that I can retrieve the id using the project name
Only thing I can use by Search API and use project name
curl -kX GET --header "PRIVATE-TOKEN: <access_token>" https://gitlab.example.com/api/v4/search?scope=projects&search=my_app
But it provides whole lot of information. I only need to retrieve project id. No idea how to get the project id?
There is python-gitlab lib by which I can do, similar stuff like using curl.

*

*Get projects ( gives most recent 20 projects' name and id in yaml format)

*

*gitlab project list

*Create project

*

*gitlab -o yaml project create --name "my_app_cli" --visibility "internal"

*Create Issue of a project

*gitlab -o yaml project create-issue --id ID Here also I need to provide id.

But in this library also, there is no option to retrieve project id.
Same as the API, to create any branch, issue etc, I need to use id of the created project. I don't want to put manually the id in the api or while using cli
Is there any workaround to get the id via api or cli using project name?
Or Is there any workaround to create issue, branch etc. without using the id via api or cli?

A: You can use the Get single project endpoint. But more generally, you are not limited to using the numerical ID, you can actually use the project name in API calls:
id: The ID or URL-encoded path of the project
In your particular case, this should work as both an example of getting the ID and to demonstrate that you don't necessarily need the ID :)
GET /api/v4/projects/my_namespace%2Fmy_app

A: Why don't you read the ID from results of project create call? You can do it easly for example with https://stedolan.github.io/jq/

A: Use the search API with the projects scope, it is described here:  https://docs.gitlab.com/ee/api/search.html#scope-projects

A: In Python we have modules which uses the Gitlab APIs to get the details.
You can get the id of the projects using the below python code.Here we are using the gitlab module for making the call.
import os
import gitlab

gl = gitlab.Gitlab('http://gitlab_hostname.com', 'your_private_token')
all_projects = gl.projects.list(all=True)
print("All projects id are:",all_projects)


text:
Q: Estimate progression rate of an number array Suppose I have an array of numbers [1,2,3,4,5] or [1,2,3,4,5...1000] both of these arrays have a progression rate of +1 regardless of the array size.
Is there a way of estimating a progression value for an array that doesn't contain consecutive numbers but yet are still progressive like [1,3,4,6,8,9].
I need this value because I want to compare two or more arrays and find out which one has a faster progression.
Thanks.


text:
Q: Terraform-Cloudformation- aws instance provider: Provided Arn is not in correct format I am creating a cloudformation stack to generate aws instance scheduler in aws gov cloud via TF. The goal is to start/stop ec2 based on tags. Many way to achieve it but I have to use terraform and cloudformation.  Here is the repo --> https://github.com/Vinod1908/TestTerraform/blob/master/instanceScheduler.tf
Below is the part of the code where I think I am blocked:
        "InstanceSchedulerEncryptionKey": {
            "Type": "AWS::KMS::Key",
            "Properties": {
                "Description": "Key for SNS",
                "Enabled": true,
                "EnableKeyRotation": true,
                "KeyPolicy": {
                    "Statement": [
                        {
                            "Sid": "default",
                            "Effect": "Allow",
                            "Principal": {
                               "AWS": {
                                    "Fn::Sub": "arn:$${AWS::Partition}:iam::$${AWS::AccountId}:root"
                                }
                            },
                            "Action": "kms:*",
                            "Resource": "*"
                        },
                        {
                            "Sid": "Allows use of key",
                            "Effect": "Allow",
                            "Principal": {
                                "AWS": {
                                    "Fn::GetAtt": [
                                        "SchedulerRole",
                                        "Arn"
                                    ]
                                }
                            },
                            "Action": [
                                "kms:GenerateDataKey*",
                                "kms:Decrypt"
                            ],
                            "Resource": "*"
                        }
                    ]
                }
            }
        },

              "Code": {
                    "S3Bucket": {
                        "Fn::Join": [
                            "-",
                            [
                                "solutions",
                                {
                                    "Ref": "AWS::Region"
                                }
                            ]
                        ]
                    },
                    "S3Key": "aws-instance-scheduler/v1.3.1/instance-scheduler.zip"

The error :

Error: error waiting for CloudFormation Stack creation: failed to create CloudFormation stack, rollback requested (ROLLBACK_COMPLETE): ["The following resource(s) failed to create: [InstanceSchedulerEncryptionKey, SchedulerRule]. Rollback requested by user."
"Resource creation cancelled" "Parameter arn:aws:lambda:us-gov-west-1:###########..:function:Schedule-InstanceSchedulerMain is not valid. Reason: Provided Arn is not in correct format. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException; Request ID: 37adac0c-6758-4b4f-ac86-0d0140742c80; Proxy: null)"]

Not sure if it's doable in gov cloud but I am looking for potential solutions and found this https://github.com/awslabs/aws-instance-scheduler/issues/11. I am testing it but no success yet.. please help !!
Adding a new line:
Thank you all for the response. My issue was using the correct arn arn:aws-us-gov
I just apply the code and it's going through. Now I am getting this below and I am sure it's related to the policy/role on my s3. Please let me know what is wrong in my code below. Any thoughts?
the s3 code part:
      "SchedulerPolicy": {
            "Type": "AWS::IAM::Policy",
            "Metadata": {
                "cfn_nag": {
                    "rules_to_suppress": [
                        {
                            "id": "W12",
                            "reason": "All policies have been scoped to be as restrictive as possible. This solution needs to access ec2/rds resources across all regions."
                        }
                    ]
                }
            },
            "Properties": {
                "PolicyName": "SchedulerPolicy",
                "Roles": [
                    {
                        "Ref": "SchedulerRole"
                    }
                ],
                "PolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Action": [
                                "logs:CreateLogGroup",
                                "logs:CreateLogStream",
                                "logs:PutLogEvents",
                                "logs:PutRetentionPolicy"
                            ],
                            "Resource": [
                                {
                                    "Fn::Join": [
                                        ":",
                                        [
                                            "arn:aws-us-gov:logs",
                                            {
                                                "Ref": "AWS::Region"
                                            },
                                            {
                                                "Ref": "AWS::AccountId"
                                            },
                                            "log-group",
                                            {
                                                "Ref": "SchedulerLogGroup"
                                            },
                                            "*"
                                        ]
                                    ]
                                },
                                {
                                    "Fn::Join": [
                                        ":",
                                        [
                                            "arn:aws-us-gov:logs",
                                            {
                                                "Ref": "AWS::Region"
                                            },
                                            {
                                                "Ref": "AWS::AccountId"
                                            },
                                            "log-group:/aws/lambda/*"
                                        ]
                                    ]
                                }
                            ]
                        },
                        {
                            "Effect": "Allow",
                            "Action": [
                                "s3:GetObject",
                                "s3:PutObject",
                                "s3:*"
                            ],
                            "Resource": {
                                "Fn::Join": [
                                    ":",
                                    [
                                        "arn:aws-us-gov:s3:::instanceschedulertest",
                                        "arn:aws-us-gov:s3:::instanceschedulertest/*"
                                    ]
                                ]
                            }
                        },
                        {
                            "Effect": "Allow",
                            "Action": [
                                "rds:DeleteDBSnapshot",
                                "rds:DescribeDBSnapshots",
                                "rds:StopDBInstance"
                            ],
                            "Resource": {
                                "Fn::Join": [
                                    ":",
                                    [
                                        "arn:aws-us-gov:rds:*",
                                        {
                                            "Ref": "AWS::AccountId"
                                        },
                                        "snapshot:*"
                                    ]
                                ]
                            }
                        },
                        {
                            "Effect": "Allow",
                            "Action": [
                                "rds:AddTagsToResource",
                                "rds:RemoveTagsFromResource",
                                "rds:DescribeDBSnapshots",
                                "rds:StartDBInstance",
                                "rds:StopDBInstance"

The error:
Error: error waiting for CloudFormation Stack creation: failed to create CloudFormation stack, rollback requested (ROLLBACK_COMPLETE): ["The following resource(s) failed to create: [Main]. Rollback requested by user." "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for solutions-us-gov-west-1/aws-instance-scheduler/v1.3.1/instance-scheduler.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: AWSLambdaInternal; Status Code: 403; Error Code: AccessDeniedException; Request ID: 95db6874-d4ad-4499-95f7-f73777a6d4db; Proxy: null)"]

Thank you all for all the pointers I really appreciate your input.

A: The reason why it is failing is because you are forming the wrong ARN in your Terraform Code.
In your repo,
link
Replace these following lines with respect to Lambda: 1047, 1358, 1420 as "arn:aws-us-gov:lambda" instead of "arn:aws:lambda".
As per the documentation of aws: The ARN should be in this format arn:aws-us-gov:lambda:account-id:function:function-name.
The answer to your question is to update the above-mentioned line. But I am sure you will get errors with respect to other resources as all resources which you are creating are in the Us-Region. So please update all the necessary Joining Function Arn lines which your forming in your code. :)


text:
Q: Best ASP.NET reporting engine with custom reports creation ability We need to choose the reporting engine for our ASP.NET application. The main functional requirement is an ability for end users (not programmers, just normal users) to create custom reports. We will be using SQL Server as a database so I am aware of some options: SQL Server Reporting services, Crystal Reports, Active Reports, even WindwardReports.
But frankly speaking I've never used any of those except Reporting services and it's quite difficult to choose which one suits the best to customer needs of custom reports creation. Is it possible to get some pros and cons for these options or at least your advice on what would be better to use in this case. Thanks a lot.

A: DevExpress XtraReports Suite.
A report is simply a class, no web services or rpt files involved.
http://www.devexpress.com/Products/NET/Reporting/

A: If you have Microsoft SQL Server as Database, so you don't need to purchase License for support of SQL Reporting Services, but there is an issue with SQL Reporting Services, SQL Reporting services only Compatible with IE. check these links ...
http://msdn.microsoft.com/en-us/library/ms156511.aspx
SQL Reporting Services - Print Button not shown in Mozilla
On the other hand, If you use other than Reporting Services, You need to purchase License.

A: You can try jsreport. It's free, open sourced, has .net client, cross platform (nodejs), does not require any compilation and it's safe to let your users to modify their reports. Reports are designed using javascript templating engines that should give you maximum flexibility for your report layout.
CONS

*

*does not currently support excel and word

*in preview

*does not talk directly with sql db, but you should anyway send data from your BL unless
you are searching for BI reporting

You can try it without any authentication in jsreport playground

A: Reporting Services is the one I am most familiar with and it is the one most tightly ingrained in SQL Server, which is something that I prefer. I also happen to like the "feel" of RS a lot more than Crystal.
The other two options I am not familiar on at all, and I imagine they have a much smaller market share (and therefore much smaller community when it comes to finding help) than RS or Crystal.

A: I've worked with all the major reporting tools and each has their plusses and minuses.  About the only "plus" on SQL Report Services side is that there's no additional $$ expenditure above the SQL Server license.  The downside is that the report designer is probably the most child-like of all.
Crystal has been around forever, some love it, many hate it, it does the job, but has a serious price tag involved if you want to use it for anything other than personal use.  And the web reporting server for it is VERY expensive.
ActiveReports, XtraReports, Telerik all have good products and all are being actively improved (at different speeds, of course).  Each has a web viewer, but they don't include the rest of the things you might want from a web reporting server.
And if you find you really want an enterprise-class web server option for Crystal, ActiveReports, XtraReports or Telerik reporting (or any other report designer, for that matter), that's now available from www.versareports.com.

A: One suggestion would be for you to do at least some evaluation of all these options. The primary reason would be so that you could learn just enough about them to judge how to keep them playing well together.
That way, if you either need to switch reporting engines, or perhaps to use a different engine for some particular requirements, you'll know how to do that.

A: SQL Reporting Services.  They have a web tool to build ad-hoc reports that is as good as any other.
The general problem with ad hoc reporting is that the "thing" the user is trying to do is either beyond the tool or beyond the user and you have to do it any ways, and as a programmer SSRS is a better environment.

A: First off, thank you for the up-front mention of Windward. It's nice to see we're on the default short list :)
It really depends on what report desing approach works best for you. If you prefer a programming type approach inside an IDE, then it's Crystal, SSRS, etc. If you prefer an approach where you can design the reports in Microsoft Word, Excel, or PowerPoint (which IMHO makes report design and editing fast & easy), then take a close look at Windward Reports. (Disclaimer, I'm the CTO at Windward.)
For general information, I suggest dotnet-reports and reporting-software. The key to a system that works well for you is one where the design tool is a natural fit for your style - so try several.

A: Crystal Report which can be easily integrated with .net


text:
Q: Android slide out view I am wondering how to achieve some kind of draggable view. I am not speaking about the navigation drawer!
Several other applications implement this kind of views, for example the new stock Android Lollipop Calculator application. There you can drag out the extended symbols view from the right hand corner.
Another application is Google maps. When checking out a location, it's possible to extend the location information by dragging up the bottom information view.
It appears that there are two points where the view is able to lock in, meaning that when pulling the view up to a specific point and releasing, will result in the drawer not closing entirely but to align to the specific locking points.
How is that achieved or is a library required?
Thanks in advance

A: The stock calculator app appears to use ViewPager to achieve the slideout numberpad. It's a part of android, no libraries so that would be a good starting point.
Here's the class in question (Rest of the code to the left)


text:
Q: Modelling RDF item features as subclasses or as references to other individuals I'm wondering what are the implications (i.e., benefits and drawbacks) of modelling RDF item features as:

*

*classes (i.e., individuals belonging to a subclass)

*individuals referring to another abstract individual representing a feature.

I don't want to use data properties. I need to represent clear concepts with their IRIs.
Example type 1
@prefix : <http://example.org#> .

:Car a rdfs:Class .
:Subaru rdfs:subClassOf :Car .
:Mercedes rdfs:subClassOf :Car .
:Ferrari rdfs:subClassOf :Car .

:c1 a :Subaru .
:c1 a :Mercedes .
:c1 a :Ferrari .

Example type 2
@prefix : <http://example.org#> .

:Car a rdfs:Class .
:CarModel a rdfs:Class .

:Subaru a :CarModel .
:Mercedes a :CarModel .
:Ferrari a :CarModel .

:c1 a :Car ;
    :model :Subaru .
:c2 a :Car ;
    :model :Mercedes .
:c3 a :Car ;
    :model :Ferrari .

Excuse me if this question could sound too broad. I'm aware there is any silver bullet in those cases and I'm trying to understand what are the implications of such different modelling strategies.

A: This is a conceptual modeling question that is not unique to RDF or OWL but applies very generally. As you say yourself, there's no single correct answer. However, there are some criteria that may help you decide one way or the other.
First, ask yourself if the property being modeled is an intrinsic property of the individual? Phrased slightly differently: is it necessary for any individual to have this property, or can there be individuals that don't have it?  If the property is intrinsic, this is a point in favor of using sub-classes. In your example, arguably the property is intrinsic: no car can exist without being some model. Or to take a different example: no mammal can exist without being one of its specific sub-types (giraffe, mouse, dog, and so on).
Second, and closely related: is the property immutable? That, can the value of this property change over time for any individual? If it can change, that's a point in favor of using properties instead of subclasses. In your example, the car's model is likely immutable (so this is another point in favor of using subclasses), but if you were to add, say, the color of each car, that's possible to change (with a decent paint-job), which makes that a candidate for using properties (along with the fact that color is perhaps not an intrinsic property, if you consider that a car without a coat of paint is still a car).
Both of these criteria are entirely conceptual, and mostly deal with questions around how well your ontology reflects "the real world". Arguably this is important in terms of reusability and understandability of your domain ontology. Other considerations may be more practical and deal with things such as the kinds of queries you're likely to ask, which of the two modeling approaches results in the smallest possible dataset (in terms of number of statements), etc.


text:
Q: jQuery $.post not sending form data...? I have this jQuery code:
var strURL = "svcs/mapHelper.aspx";
var strPost = "action=add&mapId=<%= getCurrentMapId() %>&coordX=" + fltX + "&coordY=" + fltY + "&coordName=" + strCoordName + "&ipRanges=" + strIPRanges;

$.post(strURL, strPost, function(data) {
    strResponse = data;
    console.log(strResponse);
    if (data == 'Added') {
        //$('#postResult').text(strResponse);
        $('#inp_coordName').val('');
        $('#spn_addIPwarnings').val('');
        $('#addCoordinate').dialog('close');
        location.reload();
    } else {
        $('#spn_addIPwarnings').text('Error when adding region');
    }
});

and it works fine on most browsers, but I have a client, using chrome, and it appears that the form data in strPost doesn't post, I don't see it in the network Form Data in the chrome debug window...
What can it be ???


text:
Q: How can I transform a Discriminate Union into a DU where each Case is an Array of the Initial DU cases is it possible to transform this DU using mappend/conditional types
type MyDU =
| {kind: 'foo'}
| {kind: 'bar'}

type Transformed = DU2Array<MyDU>

such that we get the folllowing result
type Transformed =
| {kind: 'foo'}[]
| {kind: 'bar'}[]

Thx

A: Hmm. that was easier than I thought
type DU2Array<T> = T extends {} ? T[] : never


text:
Q: How can I reorder the bytes of an integer? My task is to convert a data file from big endian to little endian & vice versa using C. I have been looking online for about 3 hours now for other examples and reading my text book, however I am so stuck on how to even start this function.
So far I have the order of events correct (1 through 4) but inside my convert_and_save function do I have to create a char array using → char buffer[4];?
Can someone please help me? even if you just give me clues on what to look up, I would greatly appreciate it.
I need to write a function called:
void convert_and_save(struct record item, FILE * output_handle, int number);

inside this function I do the following series of steps:

*

*Convert the integer into an array of chars using:
int integer_to_characters(int number, char * buffer)
{
   memcpy(buffer, &number, 4);
}

*Reverse the order of the chars in that array.

*Convert the array of chars back to an integer using:
int characters_to_integer(char * buffer)
{
   int result;
   memcpy(&result, buffer, 4);
   return result;
}

*write the converted record on the output file using:
void save_record(FILE * file_handle, struct record a)
{
   char output_buffer[size_of_record];
   integer_to_characters(a.age, &(output_buffer[0]));
   memcpy(&(output_buffer[4]), a.name, 12);
   integer_to_characters(a.department, &(output_buffer[16]));
   fwrite(output_buffer, sizeof(char), size_of_record, file_handle);
}

A: These are not standard function (these are gcc extensions), but you may be able to use them:

— Built-in Function: uint16_t __builtin_bswap16 (uint16_t x) Returns x
  with the order of the bytes reversed; for example, 0xaabb becomes
  0xbbaa. Byte here always means exactly 8 bits.
— Built-in Function: uint32_t __builtin_bswap32 (uint32_t x) Similar
  to __builtin_bswap16, except the argument and return types are 32 bit.
— Built-in Function: uint64_t __builtin_bswap64 (uint64_t x) Similar
  to __builtin_bswap32, except the argument and return types are 64 bit.

If you can use these, chances are it will result in more optimal code for your platform, if not, good job, submit a patch to gcc :)
Clang also has __builtin_bswap16() __builtin_bswap32() __builtin_bswap64()
Visual Studio
unsigned short _byteswap_ushort (
   unsigned short val
);
unsigned long _byteswap_ulong (
   unsigned long val
);
unsigned __int64 _byteswap_uint64 (
   unsigned __int64 val
);

ICC has _bswap16, _bswap and _bswap64 *need further reference

A: This one of the functions I wrote for the Parrot VM, you can download byteorder.c from parrotcode.org. There are probably shorter ways to do it, but this works for different size integers, and we had a macro to detect the byteorder of the platform in PARROT_BIGENDIAN, you can discard all that. Also, as mentioned above, you can search out htonl() which is a nop on bigendian hardware, but converts on little endian (just grab a Linux x86 implementation)
INTVAL
fetch_iv_le(INTVAL w)
{
    ASSERT_ARGS(fetch_iv_le)
#if !PARROT_BIGENDIAN
    return w; // No-op on little endian hardware
#else
#  if INTVAL_SIZE == 4
    return (w << 24) | ((w & 0xff00) << 8) | ((w & 0xff0000) >> 8) | (w >> 24);
#  else
#    if INTVAL_SIZE == 8
    INTVAL r;

    r = w << 56;
    r |= (w & 0xff00) << 40;
    r |= (w & 0xff0000) << 24;
    r |= (w & 0xff000000) << 8;
    r |= (w & 0xff00000000) >> 8;
    r |= (w & 0xff0000000000) >> 24;
    r |= (w & 0xff000000000000) >> 40;
    r |= (w & 0xff00000000000000) >> 56;
    return r;
#    endif
#  endif
#endif
}

A: Take a look at this answer: https://stackoverflow.com/a/105339/1461424

If you're using Visual C++ do the following: You include intrin.h and call the following functions:
For 16 bit numbers:
unsigned short _byteswap_ushort(unsigned short value);

For 32 bit numbers:
unsigned long _byteswap_ulong(unsigned long value);

For 64 bit numbers:
unsigned __int64 _byteswap_uint64(unsigned __int64 value);

8 bit numbers (chars) don't need to be converted.
Also these are only defined for unsigned values they work for signed integers as well.
For floats and doubles it's more difficult as with plain integers as these may or not may be in the host machines byte-order. You can get little-endian floats on big-endian machines and vice versa.
Other compilers have similar intrinsics as well.
In GCC for example you can directly call:
   uint16_t __builtin_bswap16 (uint16_t x)
   uint32_t __builtin_bswap32 (uint32_t x)
   uint64_t __builtin_bswap64 (uint64_t x)

A: This is my sample. It reverses the endianess of an integer. Notice that C doesn't specify the size of int. It could be 16, 32, 64 ... Using the (uint_16t, uint_32t, uint_64t) instead if you want to ensure the size,
void reverse_endianess(int* number)
{
    char byte_arr[8] = {0};
    int i;

    for (i=0; i < sizeof(int); i++) {
        byte_arr[i] = (*number & 0xFF);
        *number = *number >> 8;
    }

    *number = 0;

    for (i=0; i < sizeof(int); i++) {
        *number |=  byte_arr[i];
        *number = *number << 8;
    }
}

A: You may want to have a look at this answer, which shows how to convert both ways, also with different byte sizes.
This is one way to do it, but more efficient ways are discussed in the thread linked.
uint32_t num = 9;
uint32_t b0,b1,b2,b3,b4,b5,b6,b7;
uint32_t res = 0;

b0 = (num & 0xf) << 28;
b1 = (num & 0xf0) << 24;
b2 = (num & 0xf00) << 20;
b3 = (num & 0xf000) << 16;
b4 = (num & 0xf0000) << 12;
b5 = (num & 0xf00000) << 8;
b6 = (num & 0xf000000) << 4;
b7 = (num & 0xf0000000) << 4;

res = b0 + b1 + b2 + b3 + b4 + b5 + b6 + b7;

printf("%d\n", res);


text:
Q: Please Explain SSRS SQL statement when dealing with date parameters ranges and null Could someone please help me understand what each line in the WHERE clause of the SQL statement means? There are two parameters that can either be null or a valid date. How does the where clause work? Thank you in advance!
SELECT * from t1

WHERE

((@StartDate IS NULL AND @EndDate IS NULL)
OR (t1.date >= @StartDate AND t1.date <= @EndDate)
OR (t1.date >= @StartDate AND @EndDate IS NULL)
OR (@StartDate IS NULL AND t1.date <= @EndDate))

A: Return all entries if where is no range provided at all
((@StartDate IS NULL AND @EndDate IS NULL)

OR there is a date range and t1.date lies within that range
OR (t1.date >= @StartDate AND t1.date <= @EndDate)

OR the date range has no end and t1.date is after the start
OR (t1.date >= @StartDate AND @EndDate IS NULL)

OR the date range has no start and t1.date is before the range's end
OR (@StartDate IS NULL AND t1.date <= @EndDate))

In simple words select all entries if no range is given or select only those entries that are within the given range while allowing open ranges.

As for the example in your comment:
(SomeParameter = 'N' and t1.name IN (Name)) OR
(SomeParameter = 'Y' and t1.name IN (Name) OR t1.name is null)

Your question is:

If SomeParameter was equal to 'N', then "and t1.name IN (Name)" would get appended to the where clause, else If SomeParameter was equal to 'Y', then "and t1.name IN (Name) or t1.name is null))" would get appended to the where clause. Is that correct?

No. The WHERE clause is always what it is. It is not changed, but it is evaluated. Let's see how it works for both cases:
Case 1: SomeParameter = 'N'
(SomeParameter = 'N' and t1.name IN (Name)) OR
(SomeParameter = 'Y' and t1.name IN (Name) OR t1.name is null)

=>

(TRUE and t1.name IN (Name)) OR
(FALSE and t1.name IN (Name) OR t1.name is null)

If t1.name in (Name) is also true, the record is included in the result set, because
(TRUE and TRUE) OR (FALSE AND TRUE OR FALSE) =
 TRUE           OR (FALSE          OR FALSE) =
 TRUE           OR  FALSE                    =
 TRUE

If t1.name in (Name) is false, the record is not included in the result set, because
(TRUE and FALSE) OR (FALSE AND FALSE OR FALSE) =
 FALSE           OR (FALSE           OR FALSE) =
 FALSE           OR  FALSE                     =
 FALSE

Case 2: SomeParameter = 'Y'
(SomeParameter = 'N' and t1.name IN (Name)) OR
(SomeParameter = 'Y' and t1.name IN (Name) OR t1.name is null)

=>

(FALSE and t1.name IN (Name)) OR
(TRUE and t1.name IN (Name) OR t1.name is null)

If t1.Name in (Name) is also true, the record is included in the result set, because
(FALSE and TRUE) OR (TRUE AND TRUE OR FALSE) =
 FALSE           OR (TRUE AND TRUE)          =
 FALSE           OR  TRUE                    =
 TRUE

If t1.Name in (Name) is false, the record is not included in the result set, because
(FALSE and FALSE) OR (TRUE AND FALSE OR FALSE) =
 FALSE            OR (TRUE AND FALSE)          =
 FALSE            OR  FALSE                    =
 FALSE