text:
Q: MySQL / ASP.NET Stored Procedures Hopefully this is not a ServerFault question...
I'm working forward on migrating a project from storing data in XML Serialization to a MySQL  database. I'm using the example provided me from a previous question answered yesterday.
Connecting using phpMyAdmin and MySQL Workbench I've created a Stored Procedure called 'sprocOrderSelectSingleItem'. It seems to work well with MySQL for all I can tell. When I run the SHOW CREATE PROCEDURE sprocOrderSelectSingleItem it returns the following:
CREATE DEFINER=username@% PROCEDURE sprocOrderSelectSingleItem(IN orderID INTEGER)
BEGIN SELECT * FROM tblOrders WHERE ID=orderID; END

My cooperative ASP.NET code goes something like this:

public static Order GetItem(int ID)
{
    Order objOrder = null;

    using (OdbcConnection objConnection = new OdbcConnection(Utils.ApplicationConfiguration.ConnectionString))
    {
        OdbcCommand objCommand = new OdbcCommand("sprocOrderSelectSingleItem", objConnection);
        objCommand.CommandType = CommandType.StoredProcedure;
        objCommand.Parameters.AddWithValue("orderID", ID);
        objConnection.Open();

        using (OdbcDataReader objReader = objCommand.ExecuteReader())
        {
            if (objReader.Read())
            {
                objOrder = FillDataRecord(objReader);
            }

            objReader.Close();
        }

        objConnection.Close();
    }

    return objOrder;
}

When I view the page I get the following error message:
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sprocOrderSelectSingleItem' at line 1
Really not catching on to what could be missing or going wrong. Are there any additional tests I should/could be running to confirm things are working on the MySQL side? Am I missing a step to pass the Stored Procedure call correctly in ASP.NET? The code breaks at the line of:
using (OdbcDataReader objReader = objCommand.ExecuteReader())
Replacing the line of
OdbcCommand objCommand = new OdbcCommand("sprocOrderSelectSingleItem", objConnection);
with this instead
OdbcCommand objCommand = new OdbcCommand("SELECT * FROM tblOrders WHERE ID=" + ID + ";", objConnection);
and everything works as expected.
Thanks for any help you guys can provide.

A: Your can run an execute on sprocOrderSelectSingleItem in Mysql directly with the ID parameter.
It will show that your StoredProc run correctly.
Here is a sample code in C# that call a stored proc.
OdbcCommand salesCMD = new OdbcCommand("{ CALL SalesByCategory(?) }", nwindConn);
salesCMD.CommandType = CommandType.StoredProcedure;

OdbcParameter myParm = salesCMD.Parameters.Add("@CategoryName", OdbcType.VarChar, 15);
myParm.Value = "Beverages";

OdbcDataReader myReader = salesCMD.ExecuteReader();

Look at the "Call" in the OdbcCommand and the "?" for the parameter that is later supplied with a value.

A: Can you try something like below:
OdbcCommand cmd = new OdbcCommand();
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "{call LoadCustCliOrders(?,?,?,?)}";

    cmd.Parameters.Add("CUST_ID",OdbcType.Int);
    cmd.Parameters.Add("CLIENT_ID",OdbcType.Int);
    cmd.Parameters.Add("DATE_FROM",OdbcType.Date);
    cmd.Parameters.Add("DATE_TO",OdbcType.Date);

...

    cmd.Parameters["CUST_ID"].Value = _CustId;
    cmd.Parameters["CLIENT_ID"].Value =  _ClientId;
    cmd.Parameters["DATE_FROM"].Value = _DateFrom;
    cmd.Parameters["DATE_TO"].Value = _DateTo;

    cmd.ExecuteReader

A: Are you sure that you are using the same username or user with the same access privileges.
I think you need to add the word "CALL" before the stored proc.
It should be CALL sprocOrderSelectSingleItem and try.


text:
Q: Strange code for preventing false sharing I want to discuss the following structure in golang from this link
// Local per-P Pool appendix.
    57  type poolLocal struct {
    58      private interface{}   // Can be used only by the respective P.
    59      shared  []interface{} // Can be used by any P.
    60      Mutex                 // Protects shared.
    61      pad     [128]byte     // Prevents false sharing.
    62  }

The above structure can be accessed only one thread at a time as Mutex is used. The coder will Lock the structure in the beginning of a thread and unlock it when the thread completes. So the memory is not shared between threads. So no more than one core will have
access to the memory. So, by my understanding, false sharing cannot happen here. If false sharing cannot happen, why did the coder pad the structure
with extra bytes (pad [128]byte) ? Is my understanding wrong?

A: Memory locations on the same cache line are subject to false-sharing, which is very bad for performance.
Cache line size  ranges from 32 to 128 bytes, depending on processor model. 128 byte pad will reduce chance for same cache line being used by different processes and that improvesthe performace
as i see it, the following would be better as it would be more explicit
type poolLocal struct {
      _     [64]byte     // Prevents false sharing.
      private interface{}   // Can be used only by the respective P.
      shared  []interface{} // Can be used by any P.
      Mutex                 // Protects shared.
      _     [64]byte     // Prevents false sharing.
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to highlight all occurrences of a word in vim on double clicking When I'm on Windows, I use notepad++, and on Linux I use vim. I really like vim. But there is at least one thing I find really interesting in notepad++. You can double-click on a word and it highlights all occurrences of that word automatically. I was wondering if I could do something like that with vim? So the question is how to highlight all occurrences of a word when you double click on the word in vim.
Obviously, I don't want to search for that word, or change my cursor position, just highlighting. My :set hlsearch is also on.
probably you may want to avoid the mouse in vim, but I make an exception here :).
I know that * does the same job, but what about mouse?

A: If you want to highlight the word under the cursor like *, but do not want to move the cursor then I suggest the following:
nnoremap <silent> <2-LeftMouse> :let @/='\V\<'.escape(expand('<cword>'), '\').'\>'<cr>:set hls<cr>

Basically this command sets the search register (@/) to the current word and turns on 'hlsearch' so the results are highlighted. By setting @/ the cursor is not moved as it is with * or #.
Explanation:

*

*<silent> - to not show the command once executed

*<2-LeftMouse> - Double click w/ the left mouse button

*@/ is the register used for searching with / and ?

*expand('<cword>') get the current word under the cursor

*escape(pattern, '\') escape the regex in case of meta characters

*\V use very-non-magic mode so everything meta character must be escaped with /

*\< and \> to ensure the current word is at a word boundary

*set hls set 'hlsearch' on so highlighting appears

If setting the @/ register is not your cup of tea than you can use :match instead like so:
nnoremap <silent> <2-leftMouse> :exe 'highlight DoubleClick ctermbg=green guibg=green<bar>match DoubleClick /\V\<'.escape(expand('<cword>'), '\').'\>/'<cr>

To clear the matches just use:
:match none

A: You can map * to double-click by a simple mapping:
:map <2-LeftMouse> *

If you want to use said functionality in insert-mode you can use this mapping:
:imap <2-LeftMouse> <c-o>*

Without  (Ctrl-o) the * would be printed
[EDIT]
As ZyX pointed out, it is always a good idea to use noremap respectively inoremap if you want to make sure that if * or <c-o> will be mapped to something else, that this recursive mapping won't be expanded.


text:
Q: How do I add a plugin to a Static placeholder in Django CMS I'm begining to use Static Placeholders in Django-CMS and I want to bootstrap a pace and create a "footer" static placeholder. Something like:
static_placeholder = StaticPlaceholder(
    name=static_placeholder_code,
    code=static_placeholder_code,
    creation_method=StaticPlaceholder.CREATION_BY_CODE
)
static_placeholder.save()

I tried adding a TextPlugin with the api.add_plugin but got an error
add_plugin(
    placeholder=static_placeholder,
    plugin_type='TextPlugin',
    language='en',
)

Since static_placeholder is not an instance of Placeholder add_plugin does not work.
in the add_plugin function: assert isinstance(placeholder, Placeholder)
What would be the best way to add a TextPlugin to this static placeholder?

A: StaticPlaceholder is a model that has two foreign key relationships to the Placeholder model, one is called draft, the other is called public. Both will give you a Placeholder instance.
You could just use:
add_plugin(
    placeholder=static_placeholder.draft,
    plugin_type='TextPlugin',
    language='en',
)

and it will work, but keep in mind that you should always use draft as the example above, this is because when you publish, all plugins from draft will be copied over to the public placeholder.
Last not sure on the specifics of your app, but should point out that when the staticplaceholder is rendered in a template, it's not necessary to create it before hand. You can just do:
{% load cms_tags %}

{% static_placeholder 'footer' %}

This will then get or create the footer static placeholder.


text:
Q: Why is $\mathbb{C}[x,y]$ not isomorphic to $\mathbb{C}[x] \otimes _{\mathbb{Z}} \mathbb{C}[y]$ as rings? I would like to know why $\mathbb{C}[x,y]$ is not isomorphic to $\mathbb{C}[x] \otimes _{\mathbb{Z}} \mathbb{C}[y]$ as rings.
Thank you! 1

A: To show that $1\otimes 1+i\otimes i$ is nonzero
in $\mathbb{C}[X]\otimes_{\mathbb{Z}}\mathbb{C}[X]$ note that it maps
to $1\otimes 1+i\otimes i$ in
$\mathbb{C}[X]\otimes_{\mathbb{R}}\mathbb{C}[X]$.
This is a tensor product over a field, so a basis as an
$\mathbb{R}$-vector space is got by tensoring togther bases
on each side. Now as the set of elements of the forms $X^n$
and $iX^n$ are bases of $\mathbb{C}[X]$ over $\mathbb{R}$
then $1\otimes 1$ and $i\otimes i$ are linearly independent
over $\mathbb{R}$.
As
$$(1\otimes 1+i\otimes i)(1\otimes 1-i\otimes i)=0$$
then $\mathbb{C}[X]\otimes_{\mathbb{Z}}\mathbb{C}[X]$
isn't an integral domain, unlike $\mathbb{C}[X]\otimes_{\mathbb{C}}\mathbb{C}[X]$.

A: Note that the two are not even isomorphic as $\mathbb{C}$-vector spaces, since the LHS has countable dimension, while for the RHS $\{1\otimes z|\;\bar{z}\in \mathbb{C}/\mathbb{Z}\}$ is an uncountable set that is linearly independent over $\mathbb{C}$.

Edit: another way to see that the rings are not isomorphic, which is just an addition to Matt's answer, is e.g. to note that there is a different number of elements of finite multiplicative order $n$ for any $n>2$. E.g. on the LHS, an element must clearly be a scalar to be of finite multiplicative order, so the only elements of order 4 are $i$ and $-i$. On the other hand, on the RHS, $i\otimes 1$, $-i\otimes 1$, $1\otimes i$ and $-1\otimes i = 1\otimes -i$ are all distinct elements of order 4.
To prove that two elements of the tensor product are really distinct (this applies to any tensor products), you have to construct a $\mathbb{Z}$-bilinear map from $\mathbb{C}[x]\times\mathbb{C}[y]$ to some other $\mathbb{Z}$-module that takes the two corresponding elements (in this case ($i$,1) and (1,$i$), say) to different images. To understand, why that is a necessary and sufficient condition for them to be distinct in the tensor product, go back to the definition of tensor product via a universal property.

A: Because $\mathbb C \otimes_{\mathbb Z} \mathbb C$ is not isomorphic to
$\mathbb C$.  (There is a natural map from the first to the second, with an
absolutely enormous kernel.)
Added: In light of the discussion below, it might help to add the remark that
this kernel is full of non-trivial zero-divisors (see e.g. Robin's answer).
One way to think of this is that $\mathbb C \otimes_{\mathbb Z} \mathbb C = \mathbb C \otimes_{\mathbb Q} \mathbb C$ contains $\overline{\mathbb Q}\otimes_{\mathbb Q} \overline{\mathbb Q}$, and this latter ring already is full of zero divisors.  (Robin's answer gives one explicit example.  More generally,
$\overline{\mathbb Q}$ is the union of all finite Galois extensions $L$ of $\mathbb Q$ lying in $\mathbb C$, and for any such $L$, the tensor product
$L \otimes_{\mathbb Q} L$ is isomorphic to a product of $[L:\mathbb Q]$ copies of $L$.)


text:
Q: Reading HTML table data / html tag I have some 50 pages of html which have around 100-plus rows of data in each, with all sort of CSS style, I want to read the html file and just get the data, like Name, Age, Class, Teacher. and store it in Database, but I am not able to read the html tags
e.g
space i kept to display it here

            Gauri Singh

            13

            VIII

            Praveen M

            3494

            3Star

A: For .NET you may try Html Agility Pack
You could "convert" HTML pages to XML documents with this:
        HtmlDocument doc = new HtmlDocument();
        doc.Load(@"..\..\your_page.htm");
        doc.OptionOutputAsXml = true;
        doc.Save("your_page.xml");

And then just parse a XML document.

A: Use Html Agility Pack. It provides an intuitive and robust .net API for parsing and otherwise toying with Html.


text:
Q: Time-Energy Uncertainty Relation when $A$ depends explicitly on $t$ There are several questions asking by the meaning of Time-Energy uncertainly relation and also by its derivation.
My problem is about the second. In all documents I have seen, the same is supposed alwas: Let $A$ an observable which does not depend explictly on $t$. (from John Baez's web page to Griffiths (p.113) and also in the original paper, formula 4). Then
$$\Delta T_A \Delta H \geq \frac{\hbar}{2} . $$
My question is: What happens if we allow $\langle \partial A/ \partial t \rangle \neq 0$?.
EDIT.
@ZoltanZimboras demands me to write the definition of $\Delta T_A$. The truth is I'm not sure how to answer him. Usually, $\Delta T_A$ is defined as
$$ \Delta T_A = \frac{\langle A \rangle}{\frac{d\langle A\rangle}{dt}}. $$
If we set the same definition, then the Heisenberg's inequality comes
$$\Delta T_A \Delta H \geq \frac{\hbar}{2}\left| 1-\frac{\langle\partial A/\partial t\rangle}{d\langle A\rangle /dt } \right|. $$
The advantage of this definition is physics understand very well the meaning of the quantity $\Delta T_A$, but then the above equation comes more difficult. On the other hand, if we set
$$\Delta T_A = \frac{\langle A \rangle}{\frac{d\langle A\rangle}{dt}-\left\langle \frac{\partial A}{\partial t}\right\rangle}, $$
Then the Heisenberg's principle takes its usual form, but we have to reinterpret the quantity $\Delta T_A$.

A: Following the argument in Introduction to Quantum Mechanics by Griffiths, $$\Delta H\Delta Q=\frac{1}{2i}\langle [H,Q]\rangle=\frac{\hbar}{2}\left|\frac{d\langle Q\rangle}{dt}-\left\langle\frac{\partial Q}{\partial t}\right\rangle\right|$$
Then, defining $\Delta E=\Delta H$, $$\left|\frac{d\langle Q\rangle}{dt}-\left\langle\frac{\partial Q}{\partial t}\right\rangle\right|\Delta t \equiv \Delta Q$$
Your first equation after the edit is what $\Delta t$ is defined as in the absence of explicit time dependence of $Q$. As for the interpretation of this new definition, it is the amount of time it takes for the expectation value of $Q$ to move a standard deviation away from the expectation value of its change. Informally, it is a measure of how quickly this operator will "misbehave" in the sense of how far its "average" value is from what one would expect just from the operator's changes.


text:
Q: Power Series of Function simplified vs unsimplified Find the power series representation of $xe^{2x+1}$.
I first found $e^x$ which is $1+x+\frac{x^2}{2}+\frac{x^3}{6}...$
So then $e^{2x+1}$ is $1+(2x+1)+\frac{(2x+1)^2}{2}+\frac{(2x+1)^3}{6}...$
And thus $xe^{2x+1}$ is $x+x(2x+1)+\frac{x(2x+1)^2}{2}....$
However, this is wrong and the answer is $ex+\frac{e(2x)^2}{2}+\frac{e(2x)^3}{6}$...
I see how they got that, they just brought down the one to make $exe^{2x}$.
Why is my answer wrong?

A: When they say find a power series expansion, they mean they want you to find the power series about the point zero. If you don't know what it means to find a power series about a point, say $x_0$, then this just means finding a power series of the form $$a_0+a_1(x-x_0)+a_2(x-x_0)^2+a_3(x-x_0)^3+...$$
What you have found is something of a mix between a power series about the point $-\frac{1}{2}$ (the $(2x+1)$ terms) and about $0$. You'll also notice that if you expand some of your brackets, you'll get extra terms which contribute to the lower-power-of-x terms, e.g. $(2x+1)^2=4x^2+\underbrace{4x+1}_{\text{these ones}}$.
So your power series also represents the same function, and summing all these extra terms would get you to the same answer as the one given. However they implicitly want you to find a power series of the form $a_0+a_1x+a_2x^2+a_3x^3+...$, and so the method they use with bringing down the $e$ is the best way to do it.


text:
Q: How do I select booting from a USB Flash drive to reinstall Kubuntu? I have Kubuntu 18.04 installed on my PC, but it is corrupted, soI want to reinstall. I plugged my USB and tried that, but instead of booting into the installer app, it always runs the prior installation of Kubuntu from the internal drive instead.
When I turn on the PC, the bios says the normal stuff about booting, like "Run Kubuntu", "Recovery mode", "advanced" and these stuff. Last time when I tried to install Kubuntu I selected the "Run Kubuntu" button, so this time around I'm selecting the same button but it doesn't load up the installation screen.
I can provide more info when needed.

A: You need to tell your PC, before it gets to where it asks for "Run Kubuntu" vs  "Recovery mode" vs "advanced", et al., that you need to boot from the USB Flash drive. When it gets to those prompts, it has already decided you have not told it to boot from your USB flash drive, so you need to get in there quicker.
You have not told us what kind of machine you have, and different manufacturers have different keystrokes to select booting from something other than the internat drive. For example, with Lenovo laptops, you press the blue button to redirect away from the internal drive. Some machines use F6, F10, F11, or F12. Look up the instructions from the PC manufacturer to find what the have programmed into the BIOS, and use that to redirect booting to the USB flash drive.


text:
Q: How to run a conditional step in Jenkins only when a previous step fails I'm trying to create a 2 step job in Jenkins.  I want the second step only to run if the first step fails.  (The first step executes a unit test to see if the code I'm compiling is good - if it is not then i want to run some diagnostics in the second step).
The conditional step plug seems a good choice for this.  However, I can't work out how to use the conditional step plug in to cause the second step to run when the first step fails.
The conditional step plug in offers a list of conditions such as 'Never', 'Boolean condition' ... and 'Current Build Status'.  I would have thought I should use a 'Current Build Status' condition and set the worst status to 'failed' and the best status to 'unstable'.   Then if the first step fails, the second step will run.
However there seems to be a problem with this.  When the first step fails, then Jenkin's stops the job at the point.  So the second step never has a chance to evaluate its condition and see whether or not it should run.
So I can't see how the use of a 'Current build status' of failed could ever be used in the conditional step plugin - as if the build has already failed, we never get to the Conditional Step.  How can one mark the build status as failed in step 1 but not have Jenkins then stop the job at that point?
many thanks
Dave Sinclair

A: An inelegant way out will be to use the "Post Build task plugin".
It can parse the build log. So you can set it to check for failure logs statements. Once found you can launch a script. Maybe you can trigger second build via this script.
I am sure that there will be some other elegant options out there in post build tasks ecosystem. I am watching this question to see Jenkins experts to answer it.

A: You can create a script build step that always succeeds. In that script you could create one file when everything is right, another when something went wrong. You can check for the existence of the files in two separate conditional build steps. For instance:
REM Clean up flags
del build_failed
del build_ok

REM This should be the actual buildstep

REM Foobar does not exist, so it will return an error. dir will always work. Exchange the     REM between the two lines to test both scenarios
dir foobar
REM dir

REM Set the flags based on the build step status
IF NOT %ERRORLEVEL% == 0 (
    echo  > build_failed
) ELSE (
    echo  > build_ok
)

REM Ensure that this step will always pass
EXIT 0

A: https://plugins.jenkins.io/postbuildscript/ should do the job. It allows to run a script if the build failed or even got aborted.


text:
Q: output.get breaking IDE
So I was making a dice roller by myself, and the IDE doesn't seem to detect a problem with my code. But when I run it, the code seems to fall apart at the very last line. I'm assuming there's something wrong with "output.get(numOfDice)" but I'm not sure. Does anyone know what I'm doing wrong?


text:
Q: query issue - query not pulling correctly So I'm having some issue wrapping my head around a query I should using for a feature I need to implement.
TABLE_A
ORDERS_ID  CUSTOMER_ID  CUSTOMER_NAME
11121      78125        David Garcia
11122      78126        Joe Smith
11123      78139        Vincent Lee
11124      78144        Howard Dorf

TABLE_B
ORDERS_ID  PRODUCTS_ID  BACKORDER_DATE
11121      245-A        NULL
11121      781-B        NULL
11121      777-K        NULL
11122      854-J        2014-06-29
11122      245-A        2014-07-05
11122      986-O        2014-07-01
11123      555-P        2014-06-28
11123      777-K        2014-06-28
11124      854-J        2014-07-11
11124      731-T        2014-06-30

SELECT o.BACKORDER_DATE
FROM TABLE_B o
JOIN TABLE_A q ON q.ORDERS_ID = o.ORDERS_ID
WHERE q.CUSTOMERS_ID = $customer_id_var

Now everything is being pulled correctly, I'm only running into one issue. If the order has multiple back order dates and they are not the same then it will pull the first one and stop. Now I have no problem with that but if the first back order date is further into the future than the next one, I run into issues.
Take for instance the last two rows in Table_B. The date the query will pick up is 2014-07-11. That is a huge issue because 2014-06-30 will come and go with out any notification. The system will believe that 2014-07-11 is the earliest back order date.

A: you mean you want to ORDER BY the backorder date?
"SELECT o.BACKORDER_DATE
FROM TABLE_B o
JOIN TABLE_A q ON q.ORDERS_ID = o.ORDERS_ID
WHERE q.CUSTOMERS_ID = $customer_id_var
ORDER BY o.BACKORDER_DATE ASC"


text:
Q: Algorithm for calculating number of ways to put a line of balls in boxes I'm thinking of an algorithm for calculating the number of ways to partition balls, here is the setup of the problem:

*

*The balls are in a line with numbers, i.e. 1, 2, 3, 4, 5,...N, we cannot change the order of the balls.

*We want to group the balls into boxes, and we can use any number of boxes but no box can be empty.

*Two groups are considered the same only if they are identical in number of boxes and the balls for corresponding boxes.

One example of grouping the balls is |1, 2|3, 4, 5|6| and it is (obviously) different from |1, 2, 3|4, 5|6|
I would like to calculate the number of ways of grouping the balls. Normally I would try a brutal force search but I don't even know where to start.
And here is some interesting extensions of the problem:

*

*What is we have the requirement that the number of balls in a latter box needs to be equal to or larger than the previous box? For example, we can do |1|2, 3|4, 5|6, 7, 8| but we cannot do |1, 2, 3|4, 5|6, 7, 8|

*What if the number of balls in a latter box needs to be at least k times of its previous box, where k is a given value and is at least 1?

A: This is the problem of integer compositions.
Formula is rather simple - there is 2^(n-1) compositions.
The first extension is the problem of integer partitions.
There is no closed-formula known.
Example of implementation of Euler's pentagonal number theorem
For the second extension it is possible to make recursive function like this (not checked, just idea)
def partsktimes(x, current, k)
    if x < 0:
        return 0
    if x == 0:
        return 1
    result = 0
    for i in range(current*k, x+1):
        result += partsktimes(x - i, i, k)


text:
Q: sales_quote_add_item - error on save quote I have the observer sales_quote_add_item in config.xml which run function below when item is added to cart:
    public function updatePrice( $observer ){

        $event = $observer->getEvent();

        $quote_item = $event->getQuoteItem();

        $new_price = 200;
        $quote_item->setOriginalCustomPrice($new_price);
        $quote_item->setTotalPrice(350);

        $quote_item->save();
}

It's working fine if user is registered but if we are as guest then this line
$quote_item->save();

give error in var/exception.log
2012-10-23T05:12:28+00:00 DEBUG (7): Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`bluning_mage`.`sales_flat_quote_item`, CONSTRAINT `FK_SALES_QUOTE_ITEM_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `sales_flat_quote` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE)

How can I solve it?

A: You should not save quote item object in observer, so just remove this line:
$quote_item->save();
It will save the object automatically, as it is being passed by reference.


text:
Q: How to filter an array by several params only if they are present I have a function to filter results by several params, such as name, status, type and date range (startDate and endDate). I would like to be able to filter results by these params together, but only if they are present, i. e. I can pass name and status, but don't pass type. I don't know how to do this with a date range. Now the filter is working only if I pass startDate and endDate, in all other cases, even if other params are present and there is corresponding data in the array, it returns null. How can I make startDate and endDate optional?
Here is my filter:
if (params.name || params.status || params.type || params.startDate && params.endDate) {
  const startDate = new Date(params.startDate).setHours(0,0,0);
  const endDate = new Date(params.endDate).setHours(23,59,59);
  dataSource = tableListDataSource.filter(
    (data) =>
      data.name.match(new RegExp(params.name, 'ig')) &&
      data.status.includes(params.status || '') &&
      data.type.includes(params.type || '') &&
      (
        new Date(data.createdAt).getTime() > startDate && new Date(data.createdAt).getTime() < endDate
      )
  );
}

Thank you for your help!
EDIT:
I'm using this filter inside a function on backend:
function getRule(req, res, u) {
  let realUrl = u;

  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
    realUrl = req.url;
  }

  const params = parse(realUrl, true).query;

  if (params.name || params.status || params.type || params.startDate && params.endDate) {
    const startDate = new Date(params.startDate).setHours(0,0,0);
    const endDate = new Date(params.endDate).setHours(23,59,59);
    dataSource = tableListDataSource.filter(
      (data) =>
        data.name.match(new RegExp(params.name, 'ig')) &&
        data.status.includes(params.status || '') &&
        data.type.includes(params.type || '') &&
        (
          new Date(data.createdAt).getTime() > startDate && new Date(data.createdAt).getTime() < endDate
        )
    );
  }

  const result = {
    data: dataSource,
    success: true,
  };

  return res.json(result);
}

A: By using your current approach, you can make the startDate and endDate optional by doing as following;
&& (
  (params.startDate && params.endDate) ?
    (new Date(data.createdAt).getTime() > startDate && new Date(data.createdAt).getTime() < endDate) :
    true
)

So, what above does is basically check if params.startDate and params.endDate have no falsy values;

*

*If they don't, then do your existing filter with the dates;

*Otherwise if one of them do have falsey value, ignore the date-related filter by returning true.

This is how your final code will look like;
if (params.name || params.status || params.type || params.startDate && params.endDate) {
  const startDate = new Date(params.startDate).setHours(0,0,0);
  const endDate = new Date(params.endDate).setHours(23,59,59);
  dataSource = tableListDataSource.filter(
    (data) =>
      data.name.match(new RegExp(params.name, 'ig')) &&
      data.status.includes(params.status || '') &&
      data.type.includes(params.type || '') &&
      (
        (params.startDate && params.endDate) ?
          (new Date(data.createdAt).getTime() > startDate && new Date(data.createdAt).getTime() < endDate) :
          true
      )
  );
}

Edit:
Normally, I'd suggest that filtering should not be done in FE, but rather in BE stack. Therefore you could only fetch the needed data along with pagination supports.
However, if you insist doing it in FE - I'd suggest that to encapsulate both filter function and handling params to filter data source.
Blacklist everything and whitelist only the accepted params, and scale along the way as needed.
The following is an example of how I'd do it.
Note that; the filterDataSource complexity increases with the amount of fields you would support to be filtered. The fields iteration inside it equals to stacking multiple if conditions with extra steps.

/**
 * @description Filters dataSource with provided fields
 * @param dataSource An array containing the data source
 * @param fields An key-value pair containing { [dataSourceField]: callbackFn(value) | "string" | number }
 */
const filterDataSource = (dataSource, fields) => {
  if (dataSource && dataSource.length) {
    return dataSource.filter((row) => {
      const rowFiltered = [];

      /**
       * @todo Scale the type of filter you want to support and how you want to handle them
       */
      for (const fieldName in fields) {
        if (Object.hasOwnProperty.call(fields, fieldName) && Object.hasOwnProperty.call(row, fieldName)) {
          const filter = fields[fieldName];

          if (typeof filter === 'function') {
            /** Call the callback function which returns boolean */
            rowFiltered.push(!!filter(row));
          }
          else if (typeof filter === 'object' && filter instanceof RegExp) {
            /** Predicate by regex */
            rowFiltered.push(!!row[fieldName].match(filter));
          }
          else if (typeof filter === 'string') {
            /** Exact match of string */
            rowFiltered.push(!!row[fieldName].match(new RegExp(filter, 'ig')));
          }
          else if (typeof filter === "number") {
            /** Exact match of number */
            rowFiltered.push(row[fieldName] === filter);
          }
        }
      }

      /** If this row is part of the filter, ONLY return it if all filters passes */
      if (rowFiltered.length > 0) {
        /** This will check if all filtered return true */
        return rowFiltered.every(Boolean);
      }
      else {
        /** If this row is NOT part of the filter, always return it back */
        return true;
      }
    });
  }

  return dataSource;
}

/**
 * @description Filter your datasource with pre-defined filter function for supported params
 * @param dataSource An array of object containing the data
 * @param params A set of object containing { [param]: value }
 * @todo Safely guard the wathched params here, encode them if needed.
 */
const filterDataByParams = (dataSource, params) => {
  const fieldsToFilter = {};

  if (params.name) {
    fieldsToFilter['name'] = new RegExp(params.name, 'ig');
  }

  if (params.status) {
    fieldsToFilter['status'] = params.status;
  }

  if (params.type) {
    fieldsToFilter['type'] = params.type;
  }

  if (params.startDate && params.endDate) {
    /**
     * Assuming createdAt is EPOCH
     * @todo What is the type of row.createdAt and params.startDate?
     * @todo Adjust the logic here and apply validation if needed.
     */
    const startMillis = new Date(params.startDate).getTime() / 1e3, // Millis / 1e3 = EPOCH
      endMillis = new Date(params.endDate).getTime() / 1e3; // Millis / 1e3 = EPOCH

    /** Should we give a nice warning if invalid date value is passed? */
    if (isNaN(startMillis) && isNaN(endMillis)) {
      console.error('Invalid date params passed. Check it!');
    }

    /** Random defensive - remove or add more */
    if (startMillis && endMillis && startMillis > 0 && endMillis > 0 && startMillis < endMillis) {
      fieldsToFilter['createdAt'] = (row) => {
        return row.createdAt >= startMillis && row.createdAt <= endMillis;
      };
    }
  }

  if (Object.keys(fieldsToFilter).length) {
    return filterDataSource(dataSource, fieldsToFilter);
  }
  else {
    return [...dataSource];
  }
}

/** 1k Set of mocked data source with createdAt between 1 Jan 2019 to 13 February 2021 */
fetch('https://api.jsonbin.io/b/6027ee0987173a3d2f5c9c3d/3').then((resp) => {
  return resp.json();
}).then((mockDataSource) => {
  mazdaFilteredData = filterDataByParams(mockDataSource, {
    'name': 'Mazda',
    'startDate': '2019-05-04T19:06:20Z',
    'endDate': '2020-08-09T19:06:20Z'
  });

  hondaFilteredData = filterDataByParams(mockDataSource, {
    'name': 'honda',
    'startDate': '2019-10-05T00:00:00Z',
    'endDate': '2020-12-09T23:23:59Z'
  });

  mercedezFilteredData = filterDataByParams(mockDataSource, {
    'name': 'merce',
    'startDate': '2020-01-01T00:00:00Z',
    'endDate': '2021-12-31T23:23:59Z'
  })

  console.log({mazdaFilteredData, hondaFilteredData, mercedezFilteredData});
});

A: function getPresentParams(param, checkList) {
  // we start with an empty Array
  let output = [];
  // for each item in checkList
  checkList.forEach(item => {

    // if the item is an array, multiple params are needed
    if (Array.isArray(item)) {
        // the item is an itemList
      let allItemsPresent = true;
      for (const itemListItem of item) {
        // if one of the list is not there
        if (!param.hasOwnProperty(itemListItem)) {
            allItemsPresent = false;
          // then stop the loop
            break;
          }
      }
      // else all are matching
      if (allItemsPresent) {
        // add all to our output
                output.push(...item);
      }
    }
    // else if the item is not an Array
    else {
        // simple check if the param is present
        if (param.hasOwnProperty(item)) {
        output.push(item);
      }
    }
  })
  return output;
}

const params = {type: "car", color:"red", tires:4};

// any of "type", "tires" or "windows" should be searched
console.log(getPresentParams(params, ["type", "tires", "windows"]));
// output is ["type", "tires"]

// only show matches with "color" AND "type"
console.log(getPresentParams(params, [["color", "type"]]));
// output is ["color", "type"]

// show matches with "color" or ["windows" AND "tires"]
console.log(getPresentParams(params, ["color", ["windows", "tires"]]));
// output is ["color"]

with this function you get an Array with all present params you are searching for. By passing 2 or more paramNames as Array it will only add them to the list if ALL of them are present.
Then you can simply check in your filter function if the param is present, make your check and if it fails return false.
const foundParams = getPresentParams(params, ["type", "status", ["startDate", "endDate"], "name"]);

And then in your filter function:
if (foundParams.includes("startDate") && foundParams.includes("endDate")) {
    // if your dates are not matching return false
}
if (foundParams.includes("name")) {
    // if your name isn't matching return false
}
// and so on

// at least if all checks have passed
return true;

Thats only one solution. There are some more like an object with key: arrow functions and some iteration. But I think with this solution you get an better idea what you are doing


text:
Q: Prove $p\land q \implies r \vdash p\implies ( q \implies r)$ I have this proof

I'm confused because from what I understand the $\vdash$ means that whenever the left-hand side is true, then the right hand side also is.
If I assume p and q are true and work my logic from there, doesn't that exclude other possibilities? For example what if p and r are true but q is false? Maybe I'm reading this wrong. Is the left hand side equivalent to $p\land (q \implies r)$?
My second question is, I have a different way of solving this but I don't know how to write it like a proof. Basically if the left hand side is true then $p$ and $q \implies r$ have to be both true. By modus ponens, this makes the right hand side true (if p is true then $p \implies (q \implies r)$ is equivalent to $q \implies r$ , and since p is also true then $1\implies 1$ is true, q.e.d). How do I write this like in the example?

A:
I'm confused because from what I understand the ⊢ means that whenever the left-hand side is true, then the right hand side also is.

That is the definition for semantic entailment, or models, $\models$.
Syntactic entailment, or derives, $\vdash$, means that the the right-hand-side can be infered from the left-hand-side, using the syntactic proof system you are using (the diagram indicates that is a natural deduction system).

If I assume p and q are true and work my logic from there, doesn't that exclude other possibilities? For example what if p and r are true but q is false?

The other possibilities are irrelevant to the prof.   You just want to show a derivation of $p\to(q\to r)$ from $(p\land q)\to r$ -- that the premise implies that an assumption of $p$ then of $q$ will let you infer $r$.   To do that, you need not care what happens when you assume other things, such as $p$ and $\lnot q$.
(The map says if I turn left here and there I will get to where I want to go.  Well the map does not say what happens if I turn right at either place, but really, I just want to know if following the map will get me where I want to go.)

A: Answering your first question about the right hand side, assuming $p$ is true, we are left to prove $q \implies r$. If $q$ was false, you can't conclude anything about $r$. It can be either true or false! That's why we assume $p$ is true in the first place: if the whole relation is indeed true, assuming $p$ is true should lead us to conclude that $q \implies r$ is true. Since this is also a conditional, we again assume the antecedent ($q$) is true and try to conclude the consequent ($r$). As for the left hand side, the $\land$ operator has higher precedence, so it reads as $(p \land q) \implies r$. That's why we can reach step 5 from 1 and 4 (using modus ponens).
By now, you should be able know the answer for your second question. What you have is not $p \land (q \implies r)$, but $(p \land q) \implies r$.


text:
Q: Как заставить процессы CRM Dynamics работать для старых записей? Проблема:
Настроил фоновый процесс в CRM Dynamics 365 Sales который запускается при изменении значения определенного поля. Но оказалось, процесс не запускается, если изменения вносятся в старые записи CRM (которые были созданы до запуска самого процесса).
Вопрос: есть ли какой-то метод как можно заставить CRM запускать процесс даже для старых записей?

A: Вопрос решен. Проблема была в области для которой применяется БП. Надо было проставить Организация вместо Пользователь


text:
Q: ArchiCAD GDL Stop parameters being changed multiple times in one operation If an integer parameter is increased by 1 in the parameter script, e.g.
parameters test = test + 1

the script may run multiple times during one user operation. A parameter that is assigned 1 to start with could then be 4 after one single user operation. Is there a workaround for this?

A: Seems I overlooked this in the gdl manual. I am guessing many may not know it is there as it is a little hidden away.
n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", isFirstRun)

if isFirstRun then ....


text:
Q: XPath issue in Maven replacer plugin I get the following error when trying to use XPath to replace in web.xml with the Maven replacer plugin
[ERROR] Failed to execute goal com.google.code.maven-replacer-plugin:replacer:1.5.2:replace (default) on project my-project:
Error during XML replacement: Content is not allowed in prolog. -> [Help 1]

And here's the Maven code
<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>replacer</artifactId>
    <version>1.5.2</version>
    <executions>
        <execution>
            <phase>prepare-package</phase> <goals>
                <goal>replace</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <file>src/main/webapp/WEB-INF/web.xml</file>
        <outputFile>target/web.xml</outputFile>
        <regexFlags>
            <regexFlag>CASE_INSENSITIVE</regexFlag>
        </regexFlags>
<replacements>
    <replacement>
        <xpath>/web-app/display-name</xpath>
        <token>.*</token>
        <value>${project.name}</value>
    </replacement>
</replacements>
</plugin>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     id="my-project"
     version="2.5">

    <display-name>My Project</display-name>
    ...
</web-app>

Any idea why?

A: You need to register the "http://java.sun.com/xml/ns/javaee" namespace, and choose a prefix, let's say "javaee", and then use /javaee:web-app/javaee:display-name as your XPath expression.
According to this link, you can do that in your plugin's <configuration> section:
<plugin>
    ...

    <configuration>
        <namespaceContexts>
            <javaee>http://java.sun.com/xml/ns/javaee</javaee>
        </namespaceContexts>
        ...

A: "Content not allowed in prolog" either means the XML parser has found something other than whitespace characters, comments or processing instructions before the opening tag of the root element, or that there's characters before the <?xml (the XML declaration must be the first thing in the file, not even whitespace is allowed before it).
Check that the XML file does not have a byte-order mark at the start - certain editors (notably Windows notepad) have a habit of adding one to UTF-8 text files and I know this causes the XML parser in some versions of Java to choke.

A: Select the text node you wish to replace entirely instead:
<replacement>
    <xpath>/web-app/display-name/text()</xpath>
    <token>^.*$</token>
    <value>${project.name}</value>
</replacement>

The replacer plugin does the following when working with xpaths that select a node:

*

*Select the node (<display-name>My Project</display-name>)

*Convert the entire node to a String ("<?xml version="1.0" encoding="UTF-8"?><display-name>My Project</display-name>")

*Replace the token (.*) in that String (String is now "${project.name}" - no more xml tags)

*Parse the replaced String back into an XML Node: this breaks because your String is not valid XML (because you replaced it entirely.)

Easiest solution to this problem is to select the text node of the node instead.
Bonus: in this case, if your token is .* it will match twice (I'm not sure why) so make sure to use ^.*$ instead.


text:
Q: how to get submit a foreign key into a form post? python /django actually I don't have a form, I am currently using the ViewSet to create API.
I have two models, one is a regular user model and a group model which uses a field named creator with ForeignKey to the user
I created a serializer then use it to validate the POST inputs, somehow I keep on getting the error saying
null value in column "creator_id" violates not-null constraint
Which I can understand and I tested too that it's because creator_id is null when I try to post, but I did enter the creator_id though.  Am I entering it in a wrong way or how do I get the foreign key in order to save it?
My group model is like this
class Group(Model):
    creator = ForeignKey(User,
                         null=True,  // I used this to test I am right with the error
                         blank=True,  // I used this to test I am right with the error
                         on_delete=CASCADE,
                         related_name="%(class)ss",
                         related_query_name="%(class)s")
    group_name = CharField(max_length=256, unique=True)
    created_at = DateTimeField(auto_now_add=True)

    def __unicode__(self):
        return self.group_name

again, I added null=True, blank=True is because I want to see if I am right that it's because of creator_id can't be null and yes I am right, after adding these two fields, I don't get the error anymore.
my GroupSerializer
class GroupSerializer(ModelSerializer):
    group_id = SerializerMethodField()
    creator_name = SerializerMethodField()
    creator_id = SerializerMethodField()

    class Meta:
        model = Group
        fields = ['group_id', 'group_name', 'creator_id', 'creator_name']

    def get_group_id(self, obj):
        return obj.id

    def get_creator_name(self, obj):
        return obj.creator.tutor_name

    def get_creator_id(self, obj):
        return obj.creator.id

    def create(self, validated_data):
        return Group.objects.create(**validated_data)

my view.py
    @csrf_exempt
    def create(self, request):
        data = GroupSerializer(data=request.data)  // this would return the `group_name` and `creator_id` I entered
        if data.is_valid():  // this would return true
            data.save()
            return Response({'status': True})
        return Response({'status': False, 'message': data.errors}, status=400)

I tried posting using...
    {
        "group_name": "bridge",
        "creator_id": 1
    }

tried "creator_id": "1" and "creator": "1"
still getting the same error...
How can I resolve this?
Thanks in advance

A: I think you are declaring your serializer wrong. You are using a ModelSerializer, but the fields you are declaring in the fields list don't match the model's fields. Also note that fields is a list, not an array. I think it should be something like this.
class Group(Model):
    creator = ForeignKey(User,
                         on_delete=CASCADE,
                         related_name="%(class)ss",
                         related_query_name="%(class)s")
    group_name = CharField(max_length=256, unique=True)
    created_at = DateTimeField(auto_now_add=True)

    def __unicode__(self):
        return self.group_name

class GroupSerializer(ModelSerializer):
    class Meta:
        model = Group
        fields = ('creator', 'group_name', 'created_at')

Also I know you were doing it to test, but its considered bad practice to declare both null=True and blank=True on the same field. It should be one or the other.
See the docs here: http://www.django-rest-framework.org/api-guide/serializers/#modelserializer


text:
Q: Append data frame in R to new columns Here is an example of sample data frames
data.frame1
col1  col2 col3 col4
1     2    3    4
2     3    4    4

data.frame2
col5  col6 col7 col8
 1    2    3     4
 3    3    5     9

data.frame3
col9  col10  col11
1      2     3

Desired output
data.frame.append
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11
1     2    3    4    NA  NA   NA   NA   NA   NA    NA
2     3    4    4    NA  NA   NA   NA   NA   NA    NA
NA   NA    NA   NA   1    2    3   4    NA   NA    NA
NA   NA    NA   NA   3    3    5   9    NA   NA    NA
NA   NA    NA   NA   NA   NA   NA  NA   1    2     3

What is the most efficient way of doing this that scales to any number of data frames created on the fly.
Thank you in advance.
Edit:
Thank you all; and efficiency is of your interest, brief discussion can be found here

A: The easier way is to use plyr::ldply:
ldply(list(df1, df2, df3))

  col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11
1    1    2    3    4   NA   NA   NA   NA   NA    NA    NA
2    2    3    4    4   NA   NA   NA   NA   NA    NA    NA
3   NA   NA   NA   NA    1    2    3    4   NA    NA    NA
4   NA   NA   NA   NA    3    3    5    9   NA    NA    NA
5   NA   NA   NA   NA   NA   NA   NA   NA    1     2     3

A: We can do this with bind_rows from dplyr
library(dplyr)
bind_rows(df1, df2, df3)
#    col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11
#1    1    2    3    4   NA   NA   NA   NA   NA    NA    NA
#2    2    3    4    4   NA   NA   NA   NA   NA    NA    NA
#3   NA   NA   NA   NA    1    2    3    4   NA    NA    NA
#4   NA   NA   NA   NA    3    3    5    9   NA    NA    NA
#5   NA   NA   NA   NA   NA   NA   NA   NA    1     2     3


text:
Q: Additional features for regression I want add to my regression additional features to complicate my model and lower bias, after searching around internet is seems a good idea is to add square features, that can help regression learn in coefficients more knowledge.
I want add to my regression model square of pairs of features $x * y$, i think that can help learn my model relationships between features variables that can be highly correlated.
Problem is when I see at interpretation of $x * y$ it seems incorrect, when i get $high * high = higher$ ex. $5 * 5 = 25$ that is good, but $low * low = higher$ seems strongly invalid ex. $-5 * -5 = 25$, should be $-25$ for my problem statement.
Same problems I have for $high * low = low$, ex. $5 * -5 = -25$, i think should be somewhere between $<-5; 5>$, for example in $0$.
That anyone have any thoughts about what equation I can use to get correct representation?
I will appreciate other ideas for new virtual calculated features.

A: I don't see this as a problem for linear regression.
If I understand you correctly then if all your data is between +/-5 then x_new=(x+10) y_new=(y+10) would solve your problems.  (ie that you want low * low = low, low * high = medium etc)
but adding a constant to your inputs doesn't change the potential models in any way:
w_new_xy * x_new *y_new = w_new_xy *x *y + w_new * 10 * x  + w_new * 10 * y + w_new * 100
in other words your existing model also handles this ( by having different weights for the linear terms and bias)


text:
Q: Does a WebMethod always return XML? ASP.NET [WebMethod], does it always return XML?
I know it can only return serializable data types however can it for instance return a JSON?

A: As I'm aware of, you can return XML or JSON.
To return JSON add this annotation or your method:
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]

And on your class allow ScriptService
[ScriptService]

An example:
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public Dictionary<string, object> Test()
{
    var ret = new Dictionary<string, object>();
    ret.Add("Test", 1);
    return ret;
}

// result:
{d:{Test:1}}


text:
Q: Replicating Maven "dependencyManagement" tag from inside Gradle build I am trying to follow this Spring Boot/Vaadin guide however I'm using Gradle, not Maven.
At the very top of that guide they say to use the following Maven XML:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>10.0.11</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

However I don't see a dependencyManagement task available via Gradle. So I ask: how do I replicate the same behavior as the <dependencyManagement/> XML element above over in "Gradle land"?
Update: current attempt
dependencyManagement {
     imports {
          mavenBom 'com.vaadin:vaadin-bom:10.0.11'
     }
}

Only problem with this is that when I add it to my build.gradle and then run ./gradlew clean I get the following Gradle error:

"Could not find method dependencyManagement() for arguments..."

A: This should give you a working build:
plugins {
    // the Gradle plugin which provides the "dependencyManagement" block
    id 'io.spring.dependency-management' version '1.0.6.RELEASE'
    // add Java build functionality to be able to follow the Vaadin guide
    id 'java'
}

dependencyManagement {
    imports {
        // the Maven BOM which contains a coherent set of module versions
        // for Vaadin dependencies
        mavenBom 'com.vaadin:vaadin-bom:10.0.11'
    }
}

repositories {
    // find dependency modules on Maven Central
    mavenCentral()
}

dependencies {
    // the dependency module you need according to the Vaadin with
    // Spring Boot guide; the version of the module is taken from the
    // imported BOM; transitive dependencies are automatically taken
    // care of by Gradle (just as with Maven)
    compile 'com.vaadin:vaadin-spring-boot-starter'
}

Run ./gradlew dependencies --configuration compileClasspath to see that all dependencies are available on your Java compile classpath now.

Edited to reply to the question in the comments: indeed, the import of the BOM leads to a slightly different set of dependencies than would be used without it. You can see the dependencies difference like so:

*

*./gradlew dependencies --configuration compileClasspath > with-BOM.txt

*Remove the dependencyManagement block and add a version to the single dependency: compile 'com.vaadin:vaadin-spring-boot-starter:10.0.11'

*./gradlew dependencies --configuration compileClasspath > without-BOM.txt

*diff -u with-BOM.txt without-BOM.txt
You can see slight differences like org.webjars.bowergithub.webcomponents:webcomponentsjs:1.2.6 being used with the BOM and version 1.2.2 without it. The reason for that can be found in the BOM where version 1.2.6 is defined and where the authors also mention the reason for that: "Transitive webjar dependencies, defined here for repeatable builds"

A: Generally maven dependencyManagement tag is used to import bom or control transitive versions.
Gradle does that with platform component, like below example.
dependencies {
  implementation platform('com.vaadin:vaadin-bom:10.0.11')
  implementation ('com.vaadin:vaadin-core')
}

This does not force you to depend on spring plugin for importing bom.


text:
Q: What is the difference b/w != and <> comparison operator in python? Look in the following website:
TutorialPoint
There under the heading of Python Comparison Operators:
You will see that it is written that != is similar to <> operator
and even I tested this thing.
So what is the main difference between these two comparison operators?
Also there are documents that say they are similar, and not the same. Is there different criteria for the comparison for these two comparison operators?

A: In 2.7, they're the same. From the documentation:

The comparison operators <> and != are alternate spellings of the same
  operator. != is the preferred spelling; <> is obsolescent.

In 3.X, <> no longer exists.

A: According to Expressions - Comparisons - Python 2.x documentation:

The forms <> and != are equivalent; for consistency with C, != is
  preferred; where != is mentioned below <> is also accepted. The <>
  spelling is considered obsolescent.

And, <> is gone in Python 3.x. Don't use <> if possible.

A: As described in the documentation, they are the same.<> is deprecated and was removed in Python 3, so you should use !=.


text:
Q: How come the default value of a variable stays the same in the first iteration even after using the ++ operator in a do-while PHP loop? Let's say I have this following code:
<?php
    $i = 1;
    $user_login = "some_name";

    do {
        $user_login_tmp = $user_login . "_" . ($i++);
        echo $user_login_tmp . "\n";
    } while ($i<10);
?>

As seen in this demo(clickable!), the first echo echoes some_name_1.
This seems kinda weird to me since there is $i++ there.
How come that the first output isn't ..._2? Am I missing something?
I tried looking for an answer in the PHP manual page of the do-while loop but I couldn't find my answer there...

A: $i++ does post-increment, which returns the variable, then increments by one.

http://php.net/manual/en/language.operators.increment.php

The behaviour you described can be achieved by using pre-increment: ++$i.

A: $i++ is a post-increment. That means the increment takes place after the value is taken. You can use ++$i for a pre-increment, where the increment takes place before the value is taken.
Generally, most programmers prefer to use a pre-increment except where a post-increment is required. They tend to be slightly cheaper because only one value is required. With a pre-increment, you have to keep the old value around while you do the increment, which makes it slightly more expensive.

A: With $i++, the ++ happens after getting the value of $i. Conversely, ++$i increments first, then "returns" the new value.

A: $i++ Post-increments, it means: return $i and then increments $i by one.
The demo's output will start with ..._2 if you change the code to (++$i) (new demo)
Check out the PHP.net's page about the incrementing operator:
http://php.net/manual/en/language.operators.increment.php
++$a    Pre-increment   Increments $a by one, then returns $a.

$a++    Post-increment  Returns $a, then increments $a by one.

--$a    Pre-decrement   Decrements $a by one, then returns $a.

$a--    Post-decrement  Returns $a, then decrements $a by one.

A: $i++ is using the post-operator. After $i is concatenated it is then evaluated.


text:
Q: Let iOS scroll source code properly Currently on iOS devices source code snippets have a very poor scrolling behavior. Adding
-webkit-overflow-scrolling: touch;

to the corresponding container should fix that problem and add "momentum scrolling".


text:
Q: Querying a RavenDB index against an external List I have the following RavenDB Index:
public class RidesByPostcode : AbstractIndexCreationTask<Ride, RidesByPostcode.IndexEntry>
{
    public class IndexEntry
    {
        public string PostcodeFrom { get; set; }
        public string PostcodeTo { get; set; }
    }

    public RidesByPostcode()
    {
        Map = rides => from doc in rides
                       select new
                       {
                           doc.DistanceResult.PostcodeFrom,
                           doc.DistanceResult.PostcodeTo
                       };

        StoreAllFields(FieldStorage.Yes);
    }
}

I also have a list of strings representing postcodes, and I want to get all the Rides for which the PostcodeFrom is in the list of postcodes:
var postcodes = new List<string> { "postcode 1", "postcode 2" };

var rides = _database.Query<RidesByPostcode.IndexEntry, RidesByPostcode>()
            .Where(x => postcodes.Contains(x.PostcodeFrom))
            .OfType<Ride>()
            .ToList();

But of course RavenDb says it cannot understand the .Contains expression.
How can I achieve such a query in RavenDb without having to call .ToList() before the where clause?

A: Ok, I found the answer: RavenDb's  .In() extension method (see the "Where + In" section of the docs).
Apparently I was thinking from the outside in, instead of from the inside out :)
This is the final query:
var rides = _database.Query<RidesByPostcode.IndexEntry, RidesByPostcode>()
            .Where(x => !x.IsAccepted && x.PostcodeFrom.In(postcodes))
            .OfType<Ride>()
            .ToList();


text:
Q: Android ListView StringArray my android project contains a listview which is filled by a xml-file.
xml file contains node:
<item ID=XXXX>VALUE</item>

I'm currently using an arraylist which stores node VALUE and its binded in my listview.
On ItemClick a new activity is called where I need the ID.
Now I don't really know how to achive this:

*

*get values from xml->

*bind only VALUE to listview->

*onItemClick get the id and give it as parameter to other activity (currently giving a parameter to other activity is working with ArrayList)

A: 1) Create object that holds id and value
2) Crate custom adapter based on ArrayDapter
3) Populate adapter with objects collection
4) Implement on item click and you be able to get your object
5) Get id from object and fire it
if you try to google with "android listview custom adapter" you will find many examples


text:
Q: Connecting to Mysql using Jhipster I have generated an spring boot + angular application . imported entities with jdl. working properly with h2 . I am newbie and want to use mysql.I have configured datasource in application-dev.yml with following code.
datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:mysql://localhost:3306/blogdb?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: name
    password:pass
h2:
    console:
        enabled: false
     hikari:
            data-source-properties:
                cachePrepStmts: true
                prepStmtCacheSize: 250
                prepStmtCacheSqlLimit: 2048
                useServerPrepStmts: true
    jpa:
        database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    database: mysql
    show-sql: true

2) I have updated my pom configuration from h2 to mysql with following code.
<plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase.version}</version>
            <configuration>
                <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
                <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                <driver>com.mysql.jdbc.Driver</driver>
                <url>jdbc:mysql://localhost:3306/blogdb</url>
                <defaultSchemaName>blogdb</defaultSchemaName>
                <username>name</username>
                <password>**</password>
                <referenceUrl>hibernate:spring:pt.farol.destfinder.domain?dialect=org.hibernate.dialect.MySQLInnoDBDialect&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy</referenceUrl>
                <verbose>true</verbose>
                <logging>debug</logging>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                    <version>${javassist.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.liquibase.ext</groupId>
                    <artifactId>liquibase-hibernate5</artifactId>
                    <version>${liquibase-hibernate5.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-jpa</artifactId>
                    <version>${project.parent.version}</version>
                </dependency>
                <dependency>
                    <groupId>javax.validation</groupId>
                    <artifactId>validation-api</artifactId>
                    <version>${validation-api.version}</version>
                </dependency>
            </dependencies>
        </plugin>

PROBLEM when i run my project i am getting following error .
    The Class-Path manifest attribute in C:\..\..\.m2\repository\org\liquibase\liquibase-core\3.5.3\liquibase-core-3.5.3.jar referenced one or more files that do not exist: C:\..\.\.m2\repository\org\liquibase\liquibase-core\3.5.3\lib\snakeyaml-1.13.jar
22:58:49.740 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
22:58:49.751 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
22:58:49.751 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/G:/Java%20Projects/target/classes/]
22:58:52.636 [restartedMain] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/G:/Java%20Projects/target/classes/]

Edit
git repository link
yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.beam"
    },
    "jhipsterVersion": "4.10.2",
    "baseName": "beam",
    "packageName": "com.beam",
    "packageFolder": "com/beam",
    "serverPort": "8080",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "rememberMeKey": "801a22f60c33f866035c634e04c3b5b096fdedc6",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}

A: This is not an answer but I needed more space than in comments.
I have generated an app using your .yo-rc.json file and jhipster 4.10.2, it works fine. I also have the Class-Path manifest warning but it's harmless and the application works.
[INFO] --- spring-boot-maven-plugin:1.5.7.RELEASE:run (default-cli) @ beam ---
[INFO] Attaching agents: []
The Class-Path manifest attribute in C:\Users\Gaël\.m2\repository\org\liquibase\liquibase-core\3.5.3\liquibase-core-3.5.3.jar referenced one or more files tha
t do not exist: C:\Users\Gaël\.m2\repository\org\liquibase\liquibase-core\3.5.3\lib\snakeyaml-1.13.jar
22:15:34.613 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
22:15:34.617 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/,

2017-11-13 22:15:57.237  INFO 20472 --- [  restartedMain] com.beam.BeamApp                         :
----------------------------------------------------------
        Application 'beam' is running! Access URLs:
        Local:          http://localhost:8180
        External:       http://172.27.112.1:8180
        Profile(s):     [swagger, dev]
----------------------------------------------------------

So, I guess you're not pasting the real error.
What exactly is the symptom?

A: Try to create a new jhipster application, and choose Mysql at the creation moment. It takes few minutes, and you can check and compare.

A: Normally in application-dev.yml spacing is considered so in password to be
yours,
datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:mysql://localhost:3306/blogdb?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: name
    password:pass
what to be done is,
datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:mysql://localhost:3306/blogdb?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: name
    password: pass
just check it out

A: When I tried to install a JHipster project with Mysql, I had the same problem, My problem got resolved when I Change
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/blogdb?useUnicode=true&characterEncoding=utf8&useSSL=false
username: name
password:pass

to
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/blogdb /*Removed the parameters*/
username: name
password:pass

A: I had the same error if you are using docker, so replace localhost to your docker IP
type: com.zaxxer.hikari.HikariDataSource
        url: jdbc:mysql://192.168.99.100:3306/library
        username: root


text:
Q: IE 6,7,8,9 CSS compatibility Stylesheet Developping for all browsers, then fighting for IE compatibility is a well know step in all web developement process.
Not being a web integrator, do you know any generic compatibility stylesheet that are good to include for IE ( In my case I'm only concerned about IE7, but I'll let the question open for all version )

A: normalize.css is a good reset that addresses a lot of cross-browser issues.
http://necolas.github.com/normalize.css/
Twitter Bootstrap is good if you want pre-made components. It is IE compatible.
If you decide to use Bootstrap, its reset is actually adapted from normalize.css (so you won't need both)
HTML5 Boilerplate may also help with some best-practice markup if you're getting started from scratch:
https://github.com/h5bp/html5-boilerplate
In particular, I'd recommend using the HTML5BP conditional comments to target specific IE versions, like this:
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

That means in your CSS you can address IE version specific issues with classes:
.lt-ie8 .awesome-component { ... }

Finally, I would recommend AGAINST using javascript polyfills like CSS3PIE. In my experience they just cause more hassle than they're worth, adding unnecessary markup.
Learn a bit about graceful degradation / progressive enhancement.
Another answer mentioned IE7.js which I believe is fine, though I can't remember how useful it is. You'll definitely need to shim missing JS functions (if you're using js) such as Array.indexOf in IE <= 8. I just found this ECMAScript5 shim which looks pretty good:
https://github.com/kriskowal/es5-shim

A: I generally use Eric Meyer's CSS reset (http://meyerweb.com/eric/tools/css/reset/) which is a good simple starting point.
You may also wish to consider using ie7js (http://code.google.com/p/ie7-js/), which uses JavaScript to get different versions of IE to behave better.


text:
Q: Trying to create a csv using python, and getting "list indices" error In my last question, I asked how to get python to assign a set of values to phrases in a csv files.  I was told to create a list of tuples, and this worked great.
Currently my list, called clean_titles looks like this:
[('a', 1),
 ('a', 1),
 ('a', 1),
 ('a', 1),
 ('a', 1),
 ('a', 1),
 ('a', 1),
 ('a', 1),
 ('b', 2),
 ('b', 2),
 ('b', 2),
 ('b', 2),
 ('b', 2),
 ('b', 2),
 ('c', 3),
 ('c', 3),
 ('c', 3),
 ('c', 3),
 ('c', 3)]

Now I want to take the list, and export it to as CSV file.  I want the name of the phrases in one column and the assigned number in another column.
with open("fiancee_wordfreq.csv" , "wb") as f:
     writer = csv.writer(f)
  for val in clean_titles:
     writer.writerow([val])

But I keep getting an error message that "list indices must be integers not unicode"
What am I doing wrong or what am I missing.  Thanks for your help.

A: (My answer is for Python3)
You are opening the file in "bytes" mode. It worked for me when I removed the "b" argument:
with open("testabc.csv" , "w") as f:
  writer = csv.writer(f)
  for val in clean_titles:
     writer.writerow(val)

Also, you can just use a built-in writerows function to be less verbose:
with open("testabc.csv" , "w") as f:
  writer = csv.writer(f)
  writer.writerows(clean_titles)


text:
Q: Converting column data into row in pl/sql Hi When i went for an interview they asked me this  question.
    Create table course(Name CHAR(10));

    insert into course values ('Java');
    insert into course values ('Oracle');
    insert into course values ('Python');
    insert into course values ('C');
    insert into course values ('C++');

     o/p:
        Java Oracle python c c++

Thanks in advance,
Sandhya.

A: You can use an aggregate function - LISTAGG as following:

SQL> SELECT
  2      LISTAGG(TRIM(NAME), ' ') WITHIN GROUP(
  3          ORDER BY
  4              NULL
  5      ) AS RESULT
  6  FROM
  7      COURSE;

RESULT
--------------------------------------------------------------------------------
C C++ Java Oracle Python

SQL>

Cheers!!

A: I presume that NAME column's datatype should have been VARCHAR2, not CHAR.
Anyway, another option (similar to Tejash's LISTAGG) which uses XMLAGG and is safer if the result is larger than 4000 characters.
SQL> SELECT RTRIM (
  2            XMLAGG (XMLELEMENT (e, name || ' ') ORDER BY null).EXTRACT (
  3               '//text()'),
  4            ',')
  5            result
  6  FROM course;

RESULT
------------------------------------------------------------
Java       Oracle     Python     C          C++

SQL>

Or, as you tagged the question with PL/SQL tag, then an anonymous PL/SQL block might look like this:
SQL> set serveroutput on
SQL>
SQL> declare
  2    l_result varchar2(100);
  3  begin
  4    for cur_r in (select name from course) loop
  5      l_result := l_result ||' '|| cur_r.name;
  6    end loop;
  7
  8    dbms_output.put_line(trim(l_result));
  9  end;
 10  /
Java       Oracle     Python     C          C++

PL/SQL procedure successfully completed.

SQL>

Or - similarly - a function:
SQL> create or replace function f_course
  2    return varchar2
  3  is
  4    l_result varchar2(100);
  5  begin
  6    for cur_r in (select name from course) loop
  7      l_result := l_result ||' '|| cur_r.name;
  8    end loop;
  9
 10    return trim(l_result);
 11  end;
 12  /

Function created.

SQL> select f_course from dual;

F_COURSE
--------------------------------------------------------------
Java       Oracle     Python     C          C++

SQL>

Or, a procedure with an OUT parameter:
SQL> create or replace procedure p_course (par_result out varchar2)
  2  is
  3    l_result varchar2(100);
  4  begin
  5    for cur_r in (select name from course) loop
  6      l_result := l_result ||' '|| cur_r.name;
  7    end loop;
  8
  9    par_result := trim(l_result);
 10  end;
 11  /

Procedure created.

SQL> declare
  2    l_out varchar2(100);
  3  begin
  4    p_course(l_out);
  5    dbms_output.put_line(l_out);
  6  end;
  7  /
Java       Oracle     Python     C          C++

PL/SQL procedure successfully completed.

SQL>

As you can see, quite a few options; use the one that most suits your needs.


text:
Q: Apache migration to Nginx - connect() failed (111: Connection refused) while connecting to upstream I recently migrated a php (codeigniter) site from apache to nginx, there is a nodejs and html site already running on my nginx server.
I am seeing this error in error log of apache
connect() failed (111: Connection refused) while connecting to upstream, client: X.X.X.X, server: contextsdk-api.semusi.com, request: "POST /v1/Data HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "sdk-api.XXX.com"

Here is my nginx configuration
upstream api {
    server 127.0.0.1:9000;
}
server {
        listen   80;

        root /home/azureuser/contextsdkapi;
        server_name contextsdk-api.semusi.com;

        location / {
                try_files $uri $uri/ /index.php;
            }

        location ~ .php$ { ## Execute PHP scripts
            if (!-e $request_filename) { rewrite / /index.php last; }
            expires off; ## Do not cache dynamic content
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param MAGE_RUN_CODE default;
            fastcgi_param MAGE_RUN_TYPE store;
            include fastcgi_params;
        }

         location ~/\.ht {
        deny all;
    }

}
Update -
I changed my nginx configuration, location section to
 location ~ .php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

Now i am getting the error as -
connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream


text:
Q: Taking data from graph api with node I am trying to connect with the facebook api to be able to get a feed of a certain page.
But I'm getting an access token error
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"DrEySZsEOOA"}}

I'm trying this:
Facebook.js:
var https = require('https');
exports.get = function(accessToken, apiPath, callback) {
    var options = {
        host: 'graph.facebook.com',
        port: 443,
        path: apiPath + '?access_token=' + accessToken,
        method: 'GET'
    };
     var buffer = '';
    var request = https.get(options, function(result){
        result.setEncoding('utf8');
        result.on('data', function(chunk){
            buffer += chunk;
        });
        result.on('end', function(){
            callback(buffer);
        });
    });
    request.on('error', function(e){
        console.log('error from facebook.get(): '
                     + e.message);
    });

    request.end();
}

app.js:
var facebook = require('./facebook');
var http = require('http');
var server = http.createServer(app);

facebook.get('121212', '/feed/', function(data){
    console.log(data);
});

server.listen(9999);

Yes, I passed the right token. I just modified it for obvious reasons hahaha
Would anyone have an idea or an example?
Thank you all

A: This would be the API call: https://graph.facebook.com/feed?access_token=xxx
...which is missing something important: the ID of a User, Page or Group.
For example: https://graph.facebook.com/[page-id]/feed?access_token=xxx
Keep in mind that you need different Tokens and permissions if it is about a User, Page or Group.


text:
Q: What am I missing for my remote RMI call? What am I missing?
I am trying to make a remote RMI call from a standalone java app to a server-app-ear deployed in a Jboss 6.4 EAP.
(I start the Jboss with standalone-full.xml)
In my server I get this logging during start:
07:47:56,928 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015973: Starting subdeployment (runtime-name: "se.testcompany.testapplication-server-0.0.1-SNAPSHOT.jar")
07:47:57,156 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named JournalCrudFacadeBean in deployment unit subdeployment "se.testcompany.testapplication-server-0.0.1-SNAPSHOT.jar" of deployment "app-0.0.1-SNAPSHOT.ear" are as follows:

java:global/app-0.0.1-SNAPSHOT/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean!se.testcompany.testapplication.rmi_interface.JournalCrudRemoteInterface
java:app/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean!se.testcompany.testapplication.rmi_interface.JournalCrudRemoteInterface
java:module/JournalCrudFacadeBean!se.testcompany.testapplication.rmi_interface.JournalCrudRemoteInterface
java:global/app-0.0.1-SNAPSHOT/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean
java:app/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean
java:module/JournalCrudFacadeBean

To me that sounds like I should be able to "look up" the JournalCrudFacadeBean using one of these "names", probably "global", right? I guess "app" is useful within the same app, and "module" within the same module, right? So global sounds more like it.
I also have add a application user in the server, "testapplication".
A snippet from JournalCrudFacadeBean looks like:
@Stateless
public class JournalCrudFacadeBean implements JournalCrudRemoteInterface {

    public String create(Date date) throws RemoteException
    {
        String id = "A id"
        System.out.println( id );
        return id;
    }

And a snippet from the interface looks like:
public interface JournalCrudRemoteInterface extends Remote
{
    public String create(Date date) throws RemoteException;

In my standalone app I make the call like:
private String create()
{
    String id = "Inget svar";
    try
    {
        final Hashtable<String, String> jndiProperties = new Hashtable<String, String>();

        jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        //jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");

        jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
        jndiProperties.put(Context.PROVIDER_URL, "remoting://localhost:4447");

        jndiProperties.put("remote.connection.default.username", "testapplication");
        jndiProperties.put("remote.connection.default.password", "!234qwer");

        final InitialContext ctx = new InitialContext( jndiProperties );

        JournalCrudRemoteInterface journalCrudRemoteInterface = (JournalCrudRemoteInterface) ctx.lookup( "java:global/app-0.0.1-SNAPSHOT/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean!se.testcompany.testapplication.rmi_interface.JournalCrudRemoteInterface" );
        //JournalCrudRemoteInterface journalCrudRemoteInterface = (JournalCrudRemoteInterface) ctx.lookup( "java:global/app-0.0.1-SNAPSHOT/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean" );
        id = journalCrudRemoteInterface.create(new Date());
        System.out.println(id);
    }
    catch (Exception e)
    {
        id = e.getClass().getName() + " " + e.getMessage();
        e.printStackTrace();

    }
    finally
    {
    }

    return id;
}

In the client I got these dependencies:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ rmi-client ---
[INFO] se.testcompany.testapplication:rmi-client:jar:0.0.1-SNAPSHOT
[INFO] +- org.wildfly:wildfly-naming-client:jar:1.0.14.Final:compile
[INFO] |  +- org.wildfly.common:wildfly-common:jar:1.2.0.Final:compile
[INFO] |  +- org.wildfly.client:wildfly-client-config:jar:1.0.0.Final:compile
[INFO] |  +- org.wildfly.security:wildfly-elytron:jar:1.1.0.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] |  +- org.jboss.marshalling:jboss-marshalling:jar:2.0.0.Final:compile
[INFO] |  +- org.jboss.marshalling:jboss-marshalling-river:jar:2.0.0.Final:compile
[INFO] |  +- org.jboss.remoting:jboss-remoting:jar:5.0.0.Final:compile
[INFO] |  +- org.jboss.xnio:xnio-api:jar:3.5.1.Final:compile
[INFO] |  +- org.jboss.xnio:xnio-nio:jar:3.5.1.Final:compile
[INFO] |  \- org.jboss.threads:jboss-threads:jar:2.2.1.Final:compile
[INFO] \- se.testcompany.testapplication:rmi-interface:jar:0.0.1-SNAPSHOT:compile

But when I call it I get:
INFO: JBoss Remoting version 5.0.0.Final
javax.naming.NameNotFoundException: global -- service jboss.naming.context.java.jboss.exported.global
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)

What do you think guys, do you see where I am doing it wrong?
Best regards
Fredrik

A: Check if your lookup name is correct. You can check it from your Jboss's admin console-> runtime tab -> JNDI view. Is there a JNDI with your lookup
java:global/app-0.0.1-SNAPSHOT/se.testcompany.testapplication-server-0.0.1-SNAPSHOT/JournalCrudFacadeBean!se.testcompany.testapplication.rmi_interface.JournalCrudRemoteInterface


text:
Q: SQL There is already an object named '#TEMP' in the database after updated to SAP PL-16 I am working with SQL 2008 R2 and we updated it today with a SAP update PL-16. After that we are getting issue in my previous developed application.
We are getting errors in #temp tables.
ERROR:

[SQL Server Native 10.0][SQL Server]There is already an object named
  '#TEMP' in the database] FMS

We tried with a solution, insert 'drop table #temp' in the beginning of every query...
IF (SELECT object_id('TempDB..#Temp')) IS NOT NULL
BEGIN
    DROP TABLE #Temp
END

It still prompts the same error. Any help?
The Big Query for reference :(
SELECT CASE
           WHEN (CONVERT(FLOAT,$[$38.11]) >0
                 AND convert(float,$[$38.11],2) >= convert(float,t0.[U_FQuantity],2)
                 AND convert(float,$[$38.11],2) <= convert(float,t0.[U_LQuantity],2)) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
           WHEN (CONVERT(FLOAT,$[rdr1.U_mishkal],2) >0
                 AND $[rdr1.U_mishkal] >= t0.[U_FWeight]
                 AND $[rdr1.U_mishkal] <= t0.[U_LWeight]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
           WHEN (CONVERT(FLOAT,$[rdr1.U_kmNsiaa],2) >0
                 AND $[rdr1.U_kmNsiaa] >= t0.[U_Fkm]
                 AND $[rdr1.U_kmNsiaa] <= t0.[U_Lkm]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
           WHEN (CONVERT(FLOAT,$[rdr1.U_Nefach],2) >0
                 AND $[rdr1.U_Nefach] >= t0.[U_FVolume]
                 AND $[rdr1.U_Nefach] <= t0.[U_LVolume]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
           WHEN (CONVERT(FLOAT,$[rdr1.U_Point],2) >0
                 AND $[rdr1.U_Point] >= t0.[U_FPoint]
                 AND $[rdr1.U_Point] <= t0.[U_LPoint]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
           WHEN (CONVERT(FLOAT,$[rdr1.U_Hamtana],2) >0
                 AND $[rdr1.U_Hamtana] >= t0.[U_FHamtana]
                 AND $[rdr1.U_Hamtana] <= t0.[U_LHamtana]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
       END AS 'price' INTO #TEMP
FROM [dbo].[@PRICELIST] T0
INNER JOIN [dbo].[OITM] T1 ON T0.[U_ItemCode]=T1.[U_ZPRICELIST]
WHERE T0.[U_Cardcode] = $[ORDR.U_PCARDCODE.0]
  AND T1.[ItemCode] = $[$38.1]
  AND T0.[U_SugMitan] =$[rdr1.U_SugMitan.1]
  AND T0.[U_SugRehev] = $[Rdr1.U_SugRehev.1]
  AND t0.U_SugHishuv='2'
  INSERT INTO #TEMP

  SELECT CASE
             WHEN (CONVERT(FLOAT,$[$38.11]) >0
                   AND convert(float,$[$38.11],2) >= convert(float,t0.[U_FQuantity],2)
                   AND convert(float,$[$38.11],2) <= convert(float,t0.[U_LQuantity],2)) THEN T0.[U_Price2]/(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_mishkal],2) >0
                   AND $[rdr1.U_mishkal] >= t0.[U_FWeight]
                   AND $[rdr1.U_mishkal] <= t0.[U_LWeight]) THEN T0.[U_Price2]/(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_kmNsiaa],2) >0
                   AND $[rdr1.U_kmNsiaa] >= t0.[U_Fkm]
                   AND $[rdr1.U_kmNsiaa] <= t0.[U_Lkm]) THEN T0.[U_Price2]/(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Nefach],2) >0
                   AND $[rdr1.U_Nefach] >= t0.[U_FVolume]
                   AND $[rdr1.U_Nefach] <= t0.[U_LVolume]) THEN T0.[U_Price2] /(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Point],2) >0
                   AND $[rdr1.U_Point] >= t0.[U_FPoint]
                   AND $[rdr1.U_Point] <= t0.[U_LPoint]) THEN T0.[U_Price2] /(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Hamtana],2) >0
                   AND $[rdr1.U_Hamtana] >= t0.[U_FHamtana]
                   AND $[rdr1.U_Hamtana] <= t0.[U_LHamtana]) THEN T0.[U_Price2] /(CONVERT(FLOAT,$[$38.11],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
         END AS 'price'
  FROM [dbo].[@PRICELIST] T0
  INNER JOIN [dbo].[OITM] T1 ON T0.[U_ItemCode]=T1.[U_ZPRICELIST] WHERE T0.[U_Cardcode] = $[ORDR.U_PCARDCODE.0]
  AND T1.[ItemCode] = $[$38.1]
  AND T0.[U_SugMitan] =$[rdr1.U_SugMitan.1]
  AND T0.[U_SugRehev] = $[Rdr1.U_SugRehev.1]
  AND t0.U_SugHishuv='1'
  INSERT INTO #TEMP

  SELECT CASE
             WHEN (CONVERT(FLOAT,$[$38.11]) >0
                   AND convert(float,$[$38.11],2) >= convert(float,t0.[U_FQuantity],2)
                   AND convert(float,$[$38.11],2) <= convert(float,t0.[U_LQuantity],2)) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_mishkal],2) >0
                   AND $[rdr1.U_mishkal] >= t0.[U_FWeight]
                   AND $[rdr1.U_mishkal] <= t0.[U_LWeight]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_kmNsiaa],2) >0
                   AND $[rdr1.U_kmNsiaa] >= t0.[U_Fkm]
                   AND $[rdr1.U_kmNsiaa] <= t0.[U_Lkm]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Nefach],2) >0
                   AND $[rdr1.U_Nefach] >= t0.[U_FVolume]
                   AND $[rdr1.U_Nefach] <= t0.[U_LVolume]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Point],2) >0
                   AND $[rdr1.U_Point] >= t0.[U_FPoint]
                   AND $[rdr1.U_Point] <= t0.[U_LPoint]) THEN T0.[U_Price2] /(CONVERT(FLOAT,$[$38.11],2))*(CONVERT(FLOAT,$[$38.U_KmNsiaa],2)) *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
             WHEN (CONVERT(FLOAT,$[rdr1.U_Hamtana],2) >0
                   AND $[rdr1.U_Hamtana] >= t0.[U_FHamtana]
                   AND $[rdr1.U_Hamtana] <= t0.[U_LHamtana]) THEN T0.[U_Price2] *(1-CAST($[$38.28] AS DECIMAL(18,6)) /100)
         END AS 'price'
  FROM [dbo].[@PRICELIST] T0
  INNER JOIN [dbo].[OITM] T1 ON T0.[U_ItemCode]=T1.[U_ZPRICELIST] WHERE T0.[U_Cardcode] = $[ORDR.U_PCARDCODE.0]
  AND T1.[ItemCode] = $[$38.1]
  AND T0.[U_SugMitan] =$[rdr1.U_SugMitan.1]
  AND T0.[U_SugRehev] = $[Rdr1.U_SugRehev.1]
  AND t0.U_SugHishuv='3'
  SELECT max(T0.PRICE)
  FROM #TEMP T0

  DROP TABLE #TEMP

A: This seems really strange to me.  Temp tables that start with a single # are local to the session.  So every session should be able to see it's own #temp table defined independently and have their own data in them.  Temp tables with ## prefix can be shared between sessions.  They are automatically removed when the last session that used it closes, if it's not dropped explicitly.
Are you creating the temp table, dropping it, and trying to create it again in the same batch?  The SQL Parser does not like that.  So for example, if i put the following code into management studio and then do a simple syntax check it gives me the same error you are getting even though it seems like it should be valid.
drop table #temp

select 1 x into #temp

select * from #temp

drop table #temp

select 2 x into #temp

select * from #temp

It doesn't like that second attempt at creating the temp table.
You could try making sure that your code that creates and drops the temp table is in it's own batch by surrounding it with the GO statement.  SQL seems to have no problem with this:
GO
drop table #temp
select 1 x into #temp

select * from #temp

drop table #temp

GO

select 2 x into #temp

select * from #temp
GO


text:
Q: Static member 'android.content.Context.MODE_PRIVATE' accessed via instance reference Sorry I didn't quite know how to rephrase the title cause the error isn't very clear.
I keep getting an error message saying Static member 'android.content.Context.MODE_PRIVATE' accessed via instance reference but the problem is the error is very unclear and I don't quite understand what the error means.It pops up twice in my NavigationDrawerFragment class file. Here is my code which it pops up in.
    public static void saveToPreferences(Context context, String preferenceName, String preferenceValue){
        SharedPreferences sharedPreferences= context.getSharedPreferences(PREF_FILE_NAME, context.MODE_PRIVATE);
        SharedPreferences.Editor editor=sharedPreferences.edit();
        editor.putString(preferenceName,preferenceValue);
        editor.apply();

    }

    public static String readFromPreferences(Context context, String preferenceName, String defaultValue){
        SharedPreferences sharedPreferences= context.getSharedPreferences(PREF_FILE_NAME, context.MODE_PRIVATE);
        return sharedPreferences.getString(preferenceName, defaultValue);
    }

What does the error mean and how can I resolve it?

A: This is a static field, so you need to access it via class reference:
Context.MODE_PRIVATE

instead of:
context.MODE_PRIVATE

because in the latter case context is an instance of Context in your example.

A: static variables and static method should be accessed through class name.
here MODE_PRIVATE is constant variable (static, final).
so you need to access as
Context.MODE_PRIVATE


text:
Q: "jumping" content in navbar in bootstrap Edit2:
Okay, the problem was, that I used a
 around the
 tag. Strange. Could someone explain why it is?

I'm pretty new to bootstrap and created a web page for learning purposes.
Everything is working pretty well so far, except the navbar.
This is  my nav code:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

                    <form class="navbar-form navbar-left">
                        <button class="btn btn-default">ENTDECKEN</button>
                        <button class="btn btn-default">FINDEN</button>
                        <button class="btn btn-default">PLANEN</button>

                             Zurück zur Hafenseite | Salsbury & Mysteriöses Stonehenge

                    </form>

                        <form action="#" style>

                                <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                                    Dropdown

                                </button>

Erste Aktion

Zweite Aktion

Noch eine Aktion

Ein Link

                        </form>

The problem is, if I use the navbar-fixed-top class, the content inside the navbar is jumping while I scroll.
Like the top margin is vanishing while I'm scrolling down and if I Scroll up, the margin (or whatever the problem is) just magically appears back.
Normal and scrolling up:

Scrolling down:

I hope you can see what I mean.
Does anybody know what I'm doing wrong?
(my css classes shouldn't be the problem. If I delete them, the content still keep "jumping")
Thank you
Edit:
I have an image as the first item (after the navbar) that seems to cause the problems.
If I delete it, the navbar is working as expected.
Css:
.topimage{
  height: 600px;
  width: 100%;
  align-self: center;
  background-image: url("./assets/testbild3.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  z-index: -1;

}

and how I implemented it:

   <headertest></headertest>

The fiddler link: (where it works without "jumping" navbar content)
https://jsfiddle.net/Biberium/g52cd6v8/


text:
Q: How does history work in fish shell? I'm a bash user, starting a new job at a place where people use fish shell.
I'm looking at the history command which I often use in bash. When I use it in fish I get a long list of my history which I can scroll up and down on with the arrow keys.
There are no numbers like in bash and pressing enter is the same as the down key.
How can I run a past command with fish shell's history?

A: The history command in the fish shell isn't bash-compatible, it's just displaying it in a pager (e.g. less).
To select an old command, you'll probably want to enter the part you remember right into the commandline, press up-arrow until you have found what you want and then press enter to execute.
E.g. on my system I enter mes, press up and rm -I meson.build appears (with the "mes" part highlighted). I then press enter and it executes.

A: It seems like this is by design, but you can mimic other shell's behavior with a pipe into the nl command (or setup an alias like alias history="history | nl"
However, if you were looking for numbers in order to do history expansion (ex. !123 to re-run command 123 in list), it seems that fish does not support this, but you may find some workarounds here: https://superuser.com/questions/719531/what-is-the-equivalent-of-bashs-and-in-the-fish-shell


text:
Q: Resizeable WPF ListBox / ItemsControl items I would like to have GridSplitter-like functionality in a WPF ListBox (or ItemsControl). The following code doesn't work but demonstrates what I want to achieve:
  <ListBox ItemsSource="{Binding MyCollection}">
     <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
           <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
     </ListBox.ItemsPanel>

     <ListBox.ItemTemplate>
        <DataTemplate>
           <Grid>
              <TextBlock Text="{Binding MyTextProperty}" Margin="0,0,10,0"/>

              <GridSplitter
                Width="5"
                Background="Red"
                HorizontalAlignment="Right"
                ResizeBehavior="CurrentAndNext"/>

           </Grid>
        </DataTemplate>
     </ListBox.ItemTemplate>
  </ListBox>

Does anyone have an idea on how to implement this?

A: Why not use ListView GridView?  GridView supports resizing columns.


text:
Q: compute sum of value in an rectangle area of array I have a very big array of many value and store it in an row-major 1d array.
ex:
   1 2 3
   4 5 6

will be store in int* array = {1,2,3,4,5,6};
what I have to do is given the row1, row2, column1, column2, then print out the area's sum, and it will request to caulate different area for many times.
what I have think about it is first use nested loop to traverse the array and store each row's sum in sum_row and store each column's sum in sum_column and store the total element's sum im totalSum.
Then totalSum - the row and the columns that surrond it + the elemnts that has been minus twice.
But it seems fast enough, is there any algorithm that can do faster or some coding style tips that can make the factor little?
Thx in advance.

A: It seems to me that you have replaced one double iteration with another. The problem is in subtracting "the elemnts that has been minus twice"; unless I'm mistaken, this involves iterating over those elements to sum them.
Instead, just iterate over the rectangular area that you need to sum. I doubt it will be any slower.
A more efficient algorithm can be obtained by generating the matrix of summed upper-left matrices. (See the Wikipedia article on summed area table.) You can then compute any submatrix sum by looking up four area sums.