text:
Q: Edit & Continue only works when using "Start external program" but not Attach to Process I have an Excel-DNA project in C# using .NET 4.0 using Visual Studio 2010/2015.
If I start Debug and use the "Start external program" feature to launch EXCEL.exe I am able to pause the debugger and Edit & Continue works perfectly fine.
However, if I try to attach to a running EXCEL.exe process I get an error message saying Edit & Continue is not supported for one of various reasons. When selecting to attach to a process I only have "Managed (v4.6, v4.5, v4.0)" selected.
The error message states:
Changes are not allowed in the following cases:
- Attached to a process that does not support Edit and Continue on attach.
- The code being debugged was optimized.
- The assembly being debugged is loaded as domain-neutral.
- The assembly being debugged was loaded through reflection.
- Intellitrace events and call information is enabled.
- The .NET Runtime this program is running does not support edit and continue.

What is the difference between these two scenarios? What does "Start external program" do differently than manually attaching?

A: This is well documented:

Edit and Continue is not available in the following debugging scenarios:

*

*Debugging an application with Attach to rather than running the application with Start from the Debug menu.

The workaround you found by using the "Start external program" option is the correct approach.


text:
Q: Need to replace SCNLight property caused changed target from iOS 10 to 9 I have to decrease target version from iOS 10 to 9. And one of my problems is how to appropriately replace this code :
if #available(iOS 10.0, *) {
    target.light?.intensity = intensity
} else {
    // Replace
}

What is similar to property intensity from SCNLight in older iOS versions?

A: I've investigated this topic last time. I found the answer. Before SDK 10, you can set an intensity of white color
So:
target.light?.color = UIColor(white: intensity/1000.0, alpha: 1.0)

has effect the same as
target.light?.intensity = intensity

Problem is solved. Maybe someone in future will use my solve :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: how can I grant usage on all Snowflake databases (inlcuding future) to a role? I would like to create a role that would have permissions to clone any database, present and future.
Something like
GRANT CREATE DATABASE ON ACCOUNT TO ROLE CLONE_ADMIN;

Followed by
GRANT USAGE ON FUTURE DATABASES TO ROLE CLONE_ADMIN;

Is it possible?

A: Future grants can only be applied to schema objects.
From the documentation"When a database is cloned, the schemas in the cloned database copy the future privileges from the source schemas. This maintains consistency with the regular object grants, in which the grants of the source object (i.e. database) are not copied to the clone, but the grants on all the children objects (i.e. schemas in the database) are copied to the clones."
Future grants cannot be applied to databases.

*

*USE ROLE ACCOUNTADMIN;

*USE DATABASE ANALYTICS;

*CREATE OR REPLACE ROLE DATA;

*GRANT USAGE ON DATABASE ANALYTICS TO DATA;

*GRANT CREATE DATABASE ON ACCOUNT TO ROLE DATA;

*GRANT ROLE DATA TO USER NEW_USER1;

*USE ROLE DATA;

*CREATE  DATABASE Z_NEW_USER1_TEST CLONE ANALYTICS;

A: The feature of future grant at database level is in the roadmap.  It is currently in private preview with selected customers to gather feedback from early users.
Stay tune from update from Snowflake when this feature will become accessible to wider audience.


text:
Q: Error running React app
I can't run my React app. What should I do?

A: In react native getstarted https://facebook.github.io/react-native/docs/getting-started.html
maybe you should download Android sdk like this image:

And if you have install Android sdk you can try setup home environment, the way is Open the System pane under System and Security in the Control Panel, then click on Change settings.... Open the Advanced tab and click on Environment Variables.... Click on New... To create a new ANDROID_HOME user variable that points to the path to your Android SDK:

The SDK is installed, by default, at the following location:

c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk


text:
Q: Contradiction Between Multiple Left Joins I am trying to understand the following query which is automatically produced by some software library:
SELECT DISTINCT `t`.* FROM `teacher` AS `t`
LEFT JOIN `rel` AS `rel_profile`
    ON `rel_profile`.`field_id` = 2319 AND `rel_profile`.`item_id` = `t`.`id`
LEFT JOIN `teacher_info` AS `profile`
    ON `profile`.`id` = `rel_profile`.`related_item_id`
LEFT JOIN `rel` AS `rel_profile_city`
    ON `rel_profile_city`.`field_id` = 2320 AND `rel_profile_city`.`item_id` = `profile`.`id` WHERE `rel_profile_city`.`item_id` = 1

There are three left joins. I understand the first and second one. What I don't understand is the third left join:
LEFT JOIN `rel` AS `rel_profile_city`
    ON `rel_profile_city`.`field_id` = 2320 AND `rel_profile_city`.`item_id` = `profile`.`id` WHERE `rel_profile_city`.`item_id` = 1

The table rel has already been used in the first left join:
LEFT JOIN `rel` AS `rel_profile`
    ON `rel_profile`.`field_id` = 2319

Now, the same table is left joined again but this time the value of the joined field is different:
LEFT JOIN `rel` AS `rel_profile_city`
    ON `rel_profile_city`.`field_id` = 2320

How come that these two joins do not contradict?

A: The query is using aliases:
`rel` AS `rel_profile`

Says to pretend that the table rel is actually a table called rel_profile. That alias is then used throughout the rest of the query. I'm not sure of MySQL, but on some other database systems, it's an error to refer to the table as rel from then onwards(*) (unless there's another join that re-introduces the table and doesn't provide an alias).
And joining to the same table multiple times is allowed - provided that the names (or aliases) are unique. This is useful when you're trying to construct a result that relies on the content of multiple rows from the same table, where the result should occupy a single row.

(*) "Then onwards" being in the order in which the clauses are processed, not the text order. E.g. you should use the alias in the SELECT clause because, even though it occurs earlier textually, it's (conceptually) processed after the FROM clause.

A: This query will show teacher rows that have associated rows in rel with field_id = 2319 OR field_id = 2320

A: The are not "contradicting" each other. Imagine you have a table of users, wich have the demographic and personal data of your users. And another table with the "relation" between users. So, in this "relations" table, you have columns UserId1 and UserId2. If you want a query that returns the data of those two users, you'll need to do two JOINS with the table Users, once per each User column. This doesn't mean that they are contradicting each other.


text:
Q: Dozer nulls fields existing only in the dest instead of ignoring I have a Pojo:
class Pojo{
   String name;
   String surname;
}

and a jpa/hibernate entity:
class Entity{
     Long id;
     String code;
     List<EntityPojo> ep;
}

finally the entity pojo
class EntityPojo{
    Long id;
    String name;
    String surname;
}

In my code I do:
//I receive a pojo from the rest call and I want to update
Entity entity = repo.findByCode("aCode");

//at this point my entity pojo IDs are correctly filled!

dozerMapper.map(pojo, entity);

//after the map the IDs are null!!
repo.save(entity); //BAM!

As you can see the mapping just deletes the IDs and this brings me to the constraint exception in hibernate...why is that?

A: You didn't provide a code that isolates and reproduce the problem.
From what you provided, at least things to check:
1) What id is in pojo instance? If it's null - here your result. Could be useful: Exclude Mapping Null Values
2) Check access levels. I'm not sure how Dozer currently working if fields are not public and have no public access methods.
3) Did you verify that fields are in the entity are null, not in a database? If you do - why this question has spring-data-jpa tag and code related to persistency level? If you don't - why are you sure that something wrong with Dozer, not with your database mapping?
In general - you don't seem to work on the question by yourself at all, because if you do - you would at least make an example with cleaned up database persistence layer after checking that it's not a place where you lose your fields. It's really hard to answer a question with mix of technologies and problem could be anywhere.


text:
Q: how to match right and left nodes with cypher and neo4j I try to use a Neo4J graph database in my project, and I'll try to explain you my problem.
I would like to have the longest path, within the limit of 8 nodes, on right and left of each result. But I don't know the last node of each end of my graph
The following diagram is a basic example. My graph is built like a chain, like this :
My DB - Neo4j diagram
My problem is to find the left and right nodes.
With this dummy query, I have duplicate results
MATCH p=((nl)<-[:PREV*0..8]-(i)-[:NEXT*0..8]->(nr)) RETURN nodes(p);
This returns too much duplicate results. Here some samples of results :
i
h | i
g | h | i
...
i | j
i | j | k
...
h | i | j
h | i | j | k
...
a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q

The last result is the only one that interests me.
It seems that Neo4j returns all possible combinations of nodes to the left and to the right within the limit of 8.
Additional information:

*

*There can be several "middle nodes" ('i' in the example)

*I want 8 nodes to the left, 8 to the right or less, but always the max number of nodes on both sides

Is it possible to perform this with Cypher?

A: If you only need one, then order by the length of the path and limit to a single result:
MATCH p=((nl)<-[:PREV*0..8]-(i)-[:NEXT*0..8]->(nr))
WITH p
ORDER BY length(p) DESC
LIMIT 1
RETURN nodes(p);

Alternately you can match and gather on each side:
MATCH p=(nl)<-[:PREV*0..8]-(i)
WITH i, nl
ORDER BY length(p) DESC
WITH i, collect(nl) as nodes
MATCH p = (i)-[:NEXT*1..8]->(nr)
WITH nodes, i, nr
ORDER BY length(p) ASC
WITH i, nodes + collect(nr) as nodes
RETURN nodes;


text:
Q: UITabBarController icons not showing up I have an app that has a UITabBarController with four view controllers embedded.
I've created icons for both normal and selected states and set them via the interface builder. The sizes of the individual icons vary slightly according to the new design guidelines. Also the icons are PDFs. I initially set it's Render As property to Template Image.
The titles of the tab bar icons show up but not the icons.

But they do show up in the interface builder though.

Then I set the Render As to both Original and Default but neither worked.
I'm using Xcode 10.1. What am I missing here?

A: It seems problem with image you are using. try setting different insets to image and tab bar icon will appear.
i have set some inset for icon and icon appeared in simulator.so you will need proper icon image for asset or would required proper inset for icons.


text:
Q: I am having trouble with my form redirecting to a specific URL based on user input I have a form where I am trying to redirect the user to a different URL based on the input in the text field. So if they put "string1" it will redirect them to "./string1.html" if they put "string2" it will redirect them to "./string2.html" and if they put "string3" it will redirect them to "./string3.html"
When I click on the "submit-form" button it takes me to the "./default.html" page instead of going to its corresponding page with the input from the form.
Here is the Code:

<!DOCTYPE html>

    <title>redirect</title>
    <meta content="noindex, nofollow" name="robots">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href='redirect_form.css' rel='stylesheet' type='text/css'>

            <form class="form-inline">

                    <input type="text">
                    <button id="submit-form" type="button">Go!</button>

            </form>

        <?php
            include "insert.php";
            include "autoload.php";
        ?>

A: You have to include JQuery in this file.

also need to be toLowercase()

A: Just remove .toUpperCase() call

var urlMapping = {
    "string1" : "./string1.html",
    "string2" : "./string2.html",
    "string3" : "./string3.html"
}

$("#submit-form").click(function(){
    var input = $("input").val().trim();
    if (urlMapping.hasOwnProperty(input)){
        console.log('IN REDIRECT');
        window.location = urlMapping[input];
    }
    else {
        //if url not found, redirect to default url
        window.location = "./default.html";
    }
});

<form class="form-inline">

         <input type="text" />
<button id="submit-form" type="button">Go!</button>
</form>

A: I tried your snippets on Codepen, the only thing I changed is toLowerCase() and remove the
 without the closing
 tag. And it runs as expected. So maybe there's some other code that affecting this code?
Check the snippets here
Check the console to see the input value when you click the button.


text:
Q: Proof of $\pi _2 (x)=\sum_{p \leq \sqrt{x}} \pi(\frac{x}{p}) + O(\frac{x}{(\log x)^2})$ I need to prove that $\pi _2 (x)=\sum_{p \leq \sqrt{x}} \pi(\frac{x}{p}) + O(\frac{x}{(\log x)^2})$ by using and showing that $\pi _2(x)=\sum_{p_1 \leq \sqrt{x}}\sum _{p_1 < p_2 \leq \frac{x}{p_1}}1$. Where $\pi_2(x)$ denotes the number of integers less than $x$ which is composed of presicely two destinct primes.
And regarding the second sum ($\pi _2(x)=\sum_{p_1 \leq \sqrt{x}}\sum _{p_1 < p_2 \leq \frac{x}{p_1}}1$), maybe someone can explain how it should be understood.
Lastly, maybe someone has encountered the function $\pi_2$ before, and know where I can read about it.


text:
Q: Why use $\ln x$ and not $\log x$ in most standard intergration formulaes I wish to understand why we use $\ln x$so much more excessively compared to $\log x$.(log to the base 10)
Taking the following example,
I wish to understand why is it so;
$$ ∫dx/(x^2-a^2 )= \frac{1}{2a} \ln|((x-a)/(x+a))| + c \neq \frac{1}{2a} \log_|(x-a)/(x+a)| + c $$
( logx implies logarithm  to the base 10 )
Thank you very much.

A: Due to the standard limit
$$
\lim_{x\to 0}\frac{\ln(1+x)}{x}=1
$$
we know that
$$
\frac{d}{dx}\ln(x)=\frac{1}{x}
$$
with the beautiful unity in the numerator. All other logarithms are proportional to $\ln$
$$
\log_a(x)=\frac{\ln(x)}{\ln(a)}=\text{const}\cdot\ln(x)
$$
and satisfy
$$
\frac{d}{dx}\log_a(x)=\color{red}{\frac{1}{\ln(a)}}\cdot\frac{1}{x}.
$$
It is less appealing in calculations to take care for this extra constant. It makes the logarithm with the base $e$ natural in most calculations in calculus. Moreover, the final conversion from the natural to your particular logarithm of interest is cheap.

A: Well:
$$\log_e\left(b\right):=\ln\left(b\right)$$
With $e$ is the base of natural logarithm and $e=2.718281828459045...$

A: In calculus, we use the natural logarithm because it's natural!
By this, I mean that any other choice of base would require to introduce a scaling constant in our formula. We can do this, but as a convention mathematicians don't (as it's more work for very little benefit).
An easy example of this isn't with logarithms, but with exponential (which are the inverse of the logarithim), where:
$$\frac{d} {dx} a^x = \ln(a)  a^x$$
This is just how the calculation works out. So, when we choose a base for the exponential, it makes sense to let $a = e$,  as $\ln(e) =1$ so the scaling factor disappears.
This is the heart of the matter. If we choose a non $e$ base, we need to keep track of coefficients more.

A: Convenience, basically; consider:

*

*$\frac{d}{dx}\log_{10}x=\frac{1}{\ln 10}\frac{1}{x}$

*$\frac{d}{dx}\ln x=\frac{1}{x}$

Effectively, the base-$e$ logarithm leads to neater, more natural calculations in the framework of differentiation and integration, and is thus favoured in this context. It's similar to how [if you've seen it] we use radians rather than degrees, when using trigonometric functions in calculus - calculations become far more natural through this choice.

A: It helps to simplify calculations some. The derivative of $log_a(x)$ is $\frac{1}{xln(a)}$. When the base is $a = e$, the natural log term becomes $1$, so we get that the derivative of $ln(x)$ is $\frac{1}{x}$. In the example you gave (as well as many others), you convert the integrand into something of the form $\frac{du}{u}$ using some form of u-substitution (and possibly partial fractions), so that the antiderivative is the natural logarithm of $u$. You could always choose to use $log_a(x)$ as well, but it carries a constant with it. It's simply standard notation (as well as vaguely nice for calculations) to use natural logarithm instead.


text:
Q: Setting pointer to arbitrary dimension array? When I want to initiate a multidimensional array, I usually just use pointers. For example, for two dimensions I use:
double **array

and for three I use:
double ***array

However, I'd like to set a multidimensional array based on a command line argument indicating the dimension. Is there are way to set an array of arbitrary size once you have a variable with the number of dimensions you'd like?

A: Even though this whole question is an indication of a design flaw, you can (sort of) accomplish this:
template<typename T>
class MultiArray
{
public:
    MultiArray(std::size_t dimen, std::size_t dimen_size) : _dimensions(dimen)
    {
        _data = new T[dimen * dimen_size];
    }

    // implment copy constructor, copy-assignment operator, destructor, and move constructors as well

    T* operator[](int i)
    {
        assert(0 <= i && i < _dimensions); // bounds check for your dimension
        return &_data[i];
    }
private:
    T* _data;
    std::size_t _dimensions;
};

int main()
{
    MultiArray<int> a(5, 2);
    a[4][1] = 3;
    std::cout << a[4][1] << std::endl;
    return 0;
}

If you want it jagged, you would have to do more math and maintenance regarding the bounds for each "dimension".
The problem you run into has making the dimensions mean something for your application.  Typically, a multi-dimensional array represents something (e.g. a 2D vector can represent Cartesian space, a  3D or 4D vector can be used for manipulating data for 3D graphics).  Beyond the 4th dimension, finding a valid meaning for the array becomes murky and maintaining the logic behind it becomes increasingly complex with each new dimension.

A: you may be interested in the following code which allow you to use any "dynamic" dimension:
#include <cassert>
#include <cstddef>

#include <vector>

template<typename T>
class MultiArray
{
public:
    explicit MultiArray(const std::vector<size_t>& dimensions) :
        dimensions(dimensions),
        values(computeTotalSize(dimensions))
    {
        assert(!dimensions.empty());
        assert(!values.empty());
    }

    const T& get(const std::vector<size_t>& indexes) const
    {
        return values[computeIndex(indexes)];
    }
    T& get(const std::vector<size_t>& indexes)
    {
        return values[computeIndex(indexes)];
    }

    size_t computeIndex(const std::vector<size_t>& indexes) const
    {
        assert(indexes.size() == dimensions.size());

        size_t index = 0;
        size_t mul = 1;

        for (size_t i = 0; i != dimensions.size(); ++i) {
            assert(indexes[i] < dimensions[i]);
            index += indexes[i] * mul;
            mul *= dimensions[i];
        }
        assert(index < values.size());
        return index;
    }

    std::vector<size_t> computeIndexes(size_t index) const
    {
        assert(index < values.size());

        std::vector<size_t> res(dimensions.size());

        size_t mul = values.size();
        for (size_t i = dimensions.size(); i != 0; --i) {
            mul /= dimensions[i - 1];
            res[i - 1] = index / mul;
            assert(res[i - 1] < dimensions[i - 1]);
            index -= res[i - 1] * mul;
        }
        return res;
    }

private:
    size_t computeTotalSize(const std::vector<size_t>& dimensions) const
    {
        size_t totalSize = 1;

        for (auto i : dimensions) {
            totalSize *= i;
        }
        return totalSize;
    }

private:
    std::vector<size_t> dimensions;
    std::vector<T> values;
};

int main()
{
    MultiArray<int> m({3, 2, 4});

    m.get({0, 0, 3}) = 42;
    m.get({2, 1, 3}) = 42;

    for (size_t i = 0; i != 24; ++i) {
        assert(m.computeIndex(m.computeIndexes(i)) == i);
    }
    return 0;
}


text:
Q: MYSQL select results from 3 tables with an array of ids Ok, so I have 3 mysql tables where I need to extract data from. Anything to do with joins really gets me stuck!
Table 1 = products (productid, name)
Table 2 = category (categoryid, name)
Table 3 = categoryproduct (categoryid, productid) - my join table
I have an array of product ids which I need to get a random selection of products that fall into the same categories as these products.
The idea is that the results of the query will display a section in my cart of similar/related products that the customer may like
So something like
SELECT name etc FROM table1
WHERE table2.categoryid of results of the query = table3.categoryid of current products
ORDER BY RAND()
LIMIT 3

How do I write that??

A: Assuming you're using PHP, following method will fetch 10 related products from database.
$productids = array(1002,789,999,203,321);

$sql = '
    SELECT * FROM
    products p JOIN categoryproduct pc
        ON p.productid = pc.productid
    WHERE pc.categoryid IN(
        SELECT DISTINCT(categoryid) FROM
        products inner_p JOIN categoryproduct inner_pc
            ON inner_p.productid = inner_pc.productid
        WHERE inner_p.productid IN('.implode(',',$productids).')
    )
    ORDER BY RAND()
    LIMIT 10';

A: If i have understood your problem correctly then this query may help. Here instead of subquery you can give comma separated string which contains categoryid of different products selected by the user.
    select p.name
    from products p,categoryproduct cp
    where p.productid=cp.productid
    and cp.categorid in(
    select categoryid
    from cartitems)
    order by RAND()


text:
Q: Fill a image view or bitmap with color in Android dynamically and sequentially I have a bitmap in android which can be used with either imageview or via canvas. I have a heart shaped bitmap and I need to fill it with color dynamically, I have to fill the inner part of the heart with color. Only the inner part of the heart has to be filled and the outer part has to be neglected. I have already dealt with a issue of same kind but I was using Canvas to draw the heart and now I need to use a bitmap of a heart shaped structure to fill the heart with color.
My previous question is here
For example, consider the following image :

The shape of the heart image is actually a perfect square and there are white backgrounds on either side of the heart outline. So, my question is how do I find the inner part of the heart in this image. In my previous question, there was canvas and it was ok to get an idea and achieve but in this case, I don't have much idea to figure this out.
Any help or reference will be highly appreciated.
Update :
When I started with this question, I had a white background for the heart but now I have a semi-transparent layer with background color to heart.
Here is what I have
Code :
            <RelativeLayout
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:id="@+id/first_heart_beat"
                android:layout_centerInParent="true"
                android:layout_below="@+id/member_name_heart_beat"
                >

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="40dp"
                    android:id="@+id/first_heart_beat_filled_relative"
                    android:background="@color/heart_filled_color"
                    android:layout_alignLeft="@+id/first_heart_imageview"
                    android:layout_alignRight="@+id/first_heart_imageview"
                    android:layout_alignParentBottom="true">

                </RelativeLayout>

                <ImageView
                    android:layout_width="180dp"
                    android:layout_height="150dp"
                    android:src="@drawable/heartwhite2"
                    android:id="@+id/first_heart_imageview"
                    android:layout_alignParentBottom="true"
                    />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="0 %"
                    android:padding="2dp"
                    android:id="@+id/heart_filled_percentage_text"
                    android:textSize="9sp"
                    android:gravity="center"/>

            </RelativeLayout>

Using this code, I am increasing the height of first_heart_beat_filled_relative dynamically according to the amount of data filled by the user. But as the background is also semi-transparent, I am not able to achieve what I want. Any workarounds for this ?

A: If the inner part of the heart is transparent (and you say the outer elements of the heart square are white), then put the image in a container (RelativeLayout or LinearLayout with same dimensions as your image) and set the background colour of that container programatically.


text:
Q: Dúvida na consulta SQL "between" ou "in" Estou gerando um relatório entre data, conforme a figura abaixo:

Porém, quando entro com a data inicial:
Ano inicial: 2014 Mês inicial: 6
e
Ano final: 2015  Mês final: 5
não traz os dados, a consulta interpreta que mês inicial 6 é maior que mês final 5.
Caso eu utilizar a cláusula IN a consulta retorna apenas os meses 6 e 5 e não retornando o mês 4, porém quando utilizado o BETWEEN não retorna nenhum dado.
Segue a consulta.
BETWEEN
WHERE v.verba_ano BETWEEN $ano AND $ano_fnal AND v.verba_mes BETWEEN $mes AND $mes_fim

IN
$WHERE= "WHERE v.verba_ano IN($ano,$ano_fnal) AND v.verba_mes IN($mes,$mes_fim)";

A: O BETWEEN espera que o primeiro parâmetro seja menor que o segundo, o que causa o seu problema.
Utilizar o IN também não resolve seu problema porque ele não trabalha com intervalos, mas sim com valores isolados. Ex: data IN (3,8) não irá trazer o intervalo 3 a 8, mas sim exatamente os valores 3 e 8
Solução
Altere sua consulta para selecionar a data completa, no formato AAAA-MM-DD.
Procure sempre armazene no seu banco colunas de datas com o tipo DATE.
O dia você pode gerar dinamicamente a partir da query:
SELECT * FROM tabA
WHERE verba_data BETWEEN '{$ano}-{$mes}-01' AND last_day('{$ano_fnal}-{$mes_fim}-01');

Segue um exemplo no sqlfiddle.

A: Faz assim (se for php e mysql)
WHERE STR_TO_DATE(CONCAT_WS('-', v.verba_ano, v.verba_mes), "%Y-%m") BETWEEN STR_TO_DATE('{$ano}-{$mes}', "%Y-%m") AND STR_TO_DATE('{$ano_fim}-{$mes_fim}', "%Y-%m")

A: Tenta algo assim, comigo funcionou.
WHERE (v.verba_ano BETWEEN $ano AND $ano_fnal) AND (v.verba_mes BETWEEN $mes AND $mes_fim)

A: Comparar datas fica fácil se você inverter mes/ano para ano/mes em um único valor inteiro: No seu exemplo, 06/2014 a 05/2015 você compararia se a data está entre 201406 e 201505.
where (verba_ano * 100 + verba_mes) between 201406 and 201505

Onde 201406 = $ano*100+$mes e 201505 - $ano_fim*100+$mes_fim
Se precisar do dia também a formula fica
ano * 10000 + mes * 100 + dia

A: Deu certo aqui, segue o código abaixo:
AND STR_TO_DATE(CONCAT_WS('-',i.func_ano,i.func_mes,'01'),'%Y-%m-%d')
BETWEEN STR_TO_DATE('$ano-$mes-01','%Y-%m-%d')
AND STR_TO_DATE('$ano_fnal-$mes_fim-01','%Y-%m-%d')


text:
Q: How to color 3D point cloud with camera image?
*

*Purpose: to paint (or apply color) the corresponding points in a point cloud with image pixel

*Given: 3D point cloud, thermal images with extrinsic info (position, direction) and FOV

I have a 3D laser scanner which can generate a 3D point cloud. This scanner has a panoramic camera so it automatically generates a colored point cloud. What I wanna do is to change this color information into thermal image to check the object's 3D thermal information.
I thought there might be plenty of libraries or tools but I couldn't find exactly what I wanted. The point cloud is pcd or txt format and the file size is more than a GB (this also is a problem...), and I'm implementing the codes using python but if unavoidable to use C++ than I'll try to.
What would be the best way to approach this problem? Any comments or helps would be great!

A: Texture mapping is a more appropriate word rather than coloring.
The pcl method - textureMeshwithMultipleCameras - can be used in this situation.

*

*One of examples using this method

*

*https://github.com/PointCloudLibrary/pcl/issues/2830

*standalone texture mapping code

*

*https://github.com/otherlab/pcl/blob/master/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp

*python example - wrapper of this method

*

*https://github.com/iory/texture-mapping


text:
Q: How does facebook know what image to use when you post a link?
Possible Duplicate:
How does Facebook detect images when adding a link?

hi all, curious how facebook is able to pull an accurate image when you post a link. I know they first look for a meta tag with the image the site owner wants them to use but if that doesn't exist what logic do you think they do to get what image should be presented if you link to a blog article let's say.

A: They most likely grab the source of the page and analyze it to extract the biggest images. They probably look for images close to the center of the page, images that are prominent. It's also possible that they analyze other similar pages on the site to determine unique images that aren't common across pages (this would help FB rule out images used for navigation, headers, decoration, etc.) Not sure how it determines how many perspective images to grab, though.


text:
Q: twitter link issue (the same link inserted by different ways give different tweet lenght) I want to insert link in text:
TWTweetComposeViewController *composeController = [[TWTweetComposeViewController alloc] init];
composeController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[composeController setInitialText:NSLocalizedString(kTwitterText, nil)];
[composeController addURL:[NSURL URLWithString:link]];

but first I tried to insert big links, and I had 4 extra characters (I need to remove them to post a tweet), then I used bit.ly and created short links, but never the less I have 4 extra characters.
1) So the link width is not important and twitter always replace it with its own link?
2) OK, but why when I add these links in  [composeController setInitialText:NSLocalizedString(kTwitterText, nil)]  (not in [composeController addURL:[NSURL URLWithString:link]];)  everything is ok. So do twitter add some extra characters (hidden), when we use  [composeController addURL:[NSURL URLWithString:link]];  ?
Update:
But when I use goo.gl shorter (which I really only 2 charachters shorter than link from lit.ly), it gives me 15 extra symbols (I can write in addition to text and link will be posted). It seems that twitter don't change goo.gl links, but do change others.

A: It seems I found out the answer (I suppose that it's true base on my 2 hour investigation, but anyway it works) (I dublicated the answer because at first I chose community wiki):
when you post link to twitter, twitter tries to shorten your link, but it does it in a clever way.
twitter's shorten url is 15 characters in length. So if you url is larger it will be shorten.
but if your url is smaller twitter text will be filled by your shorter url (but anyway when you try to get the link at twitter account, you will see that url is changed anyway, but in fact that changed url doesn't influence your tweet length, the length will be filled only with your shorter link url).
I got shorter link at bit.ly (14 characters), but that wasn't enough for me, because I need 12, but then I found that I can change domain to j.mp (at the settings of my bit.ly account) and that gave me 12 characters length.
update:
on iOS 5 if your link width is more then 12, you can face different issues (populated text can not be long, by the way, if your link width is 15 you should reduce text length by 15 characters, strange, but it is so)


text:
Q: how to install grub on installed ubuntu disk? I have installed ubuntu, and somehow my grub is not detected because my 1st disk has a bad sector, I have tried using this command:
sudo grub-install /dev/sdb1 --recheck --force-lba
and it didn't work. It prompted a message like:
/dev/loop0 does not have any corresponding BIOS drive.
How to install grub on current running partition?

A: Try boot-repair by booting into ubuntu from live USB.
Install boot repair --> For this, open a terminal and do the following:
sudo add-apt-repository ppa:yannubuntu/boot-repair

sudo apt-get update

sudo apt-get install -y boot-repair

Run boot-repair -->
sudo boot-repair

Click on "Recommended repair". Write on a paper the new URL that will appear.
Reboot your PC

A: Normally you install grub to the whole drive ( /dev/sdb ), not a partition on it, but in your case, you seem to be using WUBI, so you can't use grub-install.  My recommendation would be to stop using WUBI and do a real install of Ubuntu, since wubi is no longer supported.


text:
Q: Foundry-workshop : sorting capabilities I build a chart with 2 layers in Workshop, the only difference is the date bucket. As far as segmentation is the same, I would like each layer being displayed with the same color.

In the chart above, you'll see 2 series: one to display the monthly evolution of a property, the second one to display the yearly average. Each series is segmented by the same object (listed in the table above, coming from an hidden filter).  This is achieves by defining 2 layers, with exactly the same definition, except the X-axis: the date is bucked either monthly or yearly. The property is calculated on a monthly basis, so the monthly average bucket displays the input value, and the second chart dynamically calculates the yearly average.
The main issue is that the 2 blue lines are not related to the same object.
I also would like, as far as possible, to have only one legend, instead of one per layer. Currently, my workaround is to display in one case the code, in the second one the description.
Maybe I missed something, but I did not find any way to define precisely the chart colors: am I wrong?
Thus, I was wondering if there was any way to sort input data. The filter is based on the object's primary key, is is possible to sort the queryset accordingly ? Maybe the segmentation would be displayed in the same order and the colors match this order.
Or is there any other way to proceed?

A: The answer to the title's question is quite easy: actually, the segmentation is not exactly the same. In the first layer, the segmentation is based on a code, the second one on the object's name. Thus, the order is slightly different.
Then solution is: use exactly the same segmentation.
I still wonder how to manage the display: view the legend for only one layer, choose lines' colors... But it looks like it's another subject and I'll probably open a new topic.


text:
Q: Vue Watch not Triggering on Page Refresh/Reload I have a component which is hid based on the route which is active, it kicks off a function which is stored using vuex store.
It works as intended, the sidenav is hidden on login, logout, and register.
However, I noticed when I am on an authenticated page such as admin panel, or dashboard, etc, the component displays correctly, but when/if someone reloads the webpage, the component disappears, only to be displayed when clicking a link to another page.
App.Vue
<template>

        <navbar />
        <sidenav v-show="sidenav_toggle" />

                <router-view/>

</template>

A: Your watcher is not called if you land directly on the admin page because the $route property never changes (and watchers only watch for changes).
What you could do is move your watcher function in a method, and call this method in the created hook and in your watcher.
An even better way to do this would be to use vue-router navigation-guards
Example:
export default {
  // ...
  methods: {
    adaptSidebar(path) {
      if (['/login', '/logout', '/register'].includes(path)) {
        store.commit('hide_sidenav')
      } else {
        store.commit('show_sidenav')
      }
    },
  },
  beforeRouterEnter(from, to, next) {
    // As stated in the doc, we do not have access to this from here
    next(vm => {
      vm.adaptSidebar(to.path)
    })
  },
  beforeRouteChange(from, to, next) {
    this.adaptSidebar(to.path)
  },
}


text:
Q: Oracle SQL Syntax: V$ views I've noticed that Oracle comes with some special tables/views (e.g. V$SESSION) that are not contained in dba_tables nor in dba_views.
Why is that?
Can someone explain when tables or views are part of dba_tables / dba_views and when not?

A: All views are listed in DBA_VIEWS.
Oracle's V$ objects are actually public synonyms (and they do appear in DBA_SYNONYMS).  V$SESSION is a synonym for SYS.V_$SESSION which does appear in DBA_VIEWS.  In general, the V$ objects are public synonyms for views in the SYS schema with the prefix V_$ and the GV$ are public synonyms for views in the SYS schema with the prefix GV_$.

A:
Throughout its operation, Oracle
  Database maintains a set of virtual
  tables that record current database
  activity. These views are called
  dynamic performance views because they
  are continuously updated while a
  database is open and in use. The
  views, also sometimes called V$ views

...I'll let Oracle explain ;)  Also see here.


text:
Q: Integration in solving coin toss problem via Bayesian appoach The following is taken from here:

You have a coin that when flipped ends up head with probability $p$ and
  ends up tail with probability $1−p$. (The value of p is unknown.)
Trying to estimate $p$, you flip the coin $14$ times. It ends up head $10$
  times.
Then you have to decide on the following event: "In the next two
  tosses we will get two heads in a row."
What is the probability the event will happen?

In attempting to solve this via a bayesian approach, the author first derives a distribution for $p$, whose plot is below:

He then states that to find the probability of two heads, the following needs to be computed:
$$Pr\left(HH|\text{data}\right) = \int_0^1 Pr\left(HH|p\right) \cdot Pr\left(p|\text{data}\right) dp$$
I'm unclear on how the integrand was arrived at though.
I understand that you need to need to sum up $Pr(HH|p)$ across all $p$ from 0 to 1, but why do you multiply this by the other terms?


text:
Q: Restart of an Android activity after a long time of idleness -> NullPointerException I get a NullPointerException in my onCreate method in some activities. It's hard to debug because it happens only after a long time of idleness.
It's probably because the activity has ended and the garbage collector has destroyed some shared objects but I'm not sure.
What should I do to handle that in a proper way ?
Thank's

A: Activities do not "end" after a period of idleness, and they do not get reclaimed by the garbage collector. What happens is that the operating system kills your whole process. Then, when the user returns to the activity, the operating system recreates the process and recreates only the top activity on the activity stack. So if you have any static (class) variables that may have been set up by other activities, all those things are long gone.
Post the code in your onCreate() and indicate where the NullPointerException happened (look at your logcat).


text:
Q: Fontspec/xeCJK AutoFakeBold and copyable Chinese characters in PDF I'm writing a document in mixed English and Chinese (with the xeCJK package. I want to add some fake bold headlines using the font Kaiti SC. When I do this using the AutoFakeBold option, this makes it unable to copy the characters in the resulting PDF. How can I fix this?
It seems like xeCJK is loading fontspec behind the curtains, so the issue might be related to it.
Here's a MWE.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt, a4paper]{article}

\usepackage{xeCJK}
\setCJKmainfont[Scale=1.2, AutoFakeBold=true]{Kaiti SC} % removing the bold makes the output copyable

\begin{document}

\textbf{你好}

宋代大{\color{red}文学家}苏东坡常常一个人出去旅行。他特别喜欢参观寺庙。

\end{document}

A: Malipivo provided a solution using \pdfliteral, and that technique works for XeTeX too. This technique is used in zhmCJK package. You can read the documented source code of zhmCJK if you are interested in it.
However, it is quite tricky to apply this technique properly in xeCJK:
% !TeX program = XeLaTeX
% !TeX encoding = UTF-8
\documentclass{article}
\usepackage{xeCJK}

\setCJKmainfont{SimSun}

% value > 0
\def\xeCJKembold{0.4}

% hack into xeCJK, you don't need to understand it
\def\saveCJKnode{\dimen255\lastkern}
\def\restoreCJKnode{\kern-\dimen255\kern\dimen255}

% save old definition of \CJKsymbol and \CJKpunctsymbol for CJK output
\let\CJKoldsymbol\CJKsymbol
\let\CJKoldpunctsymbol\CJKpunctsymbol

% apply pdf literal fake bold
\def\CJKfakeboldsymbol#1{%
  \special{pdf:literal direct 2 Tr \xeCJKembold\space w}%
  \CJKoldsymbol{#1}%
  \saveCJKnode
  \special{pdf:literal direct 0 Tr}%
  \restoreCJKnode}
\def\CJKfakeboldpunctsymbol#1{%
  \special{pdf:literal direct 2 Tr \xeCJKembold\space w}%
  \CJKoldpunctsymbol{#1}%
  \saveCJKnode
  \special{pdf:literal direct 0 Tr}%
  \restoreCJKnode}
\newcommand\CJKfakebold[1]{%
  \let\CJKsymbol\CJKfakeboldsymbol
  \let\CJKpunctsymbol\CJKfakeboldpunctsymbol
  #1%
  \let\CJKsymbol\CJKoldsymbol
  \let\CJKpunctsymbol\CJKoldpunctsymbol}

\begin{document}

正常汉字。\CJKfakebold{可复制"伪粗体"汉字。English unchanged. 粗体汉字。}正常汉字。

\end{document}

Note that the non-CJK characters are unchanged in \CJKfakebold command. This is a feature by design. You should use \textbf or \bfseries as usual for English.
And note that the code above is not at all complete for xeCJK, puctuation kerning is wrong for example. It should be implemented more carefully (maybe in a very different way) if we add this feature into the package.

A: This is a know XeTeX bug, I don't think there is currently a way to fix it.


text:
Q: Using Octopus Deploy with EPiServer to handle database upgrades Since EPiServer 7 upgrading to a newer version has involved:

*

*Updating all EPiServer.* NuGet packages

*Running PM > Update-EPiServer - to upgrade the local database

*Running PM > Export-EPiServer - to produce a set of database upgrade script files that can be run on other servers.

However if only the upgraded EPiServer solution is built and deployed by Octopus Deploy, the database will not be upgraded meaning the site will not run.
Currently I run the EPiServerPackage manually on a server in each of our environments after a deployment.
I'm trying to decide on the cleanest way to include the /EPiUpdatePackage folder and contents running the Export-EPiServer command produces so that it will:

*

*Checked into source control

*Turned into a NuGet package on the build server

*Be deployed by Octopus Deploy so that it can be remotely executed on the server the script is deployed to

A: As per Eric Herlitz suggestion, I have simply used the <episerver.framework updateDatabaseSchema="true"> in the web.config transforms for the environments I wish to have the database automatically upgraded on.
I'm unsure it this will present a problem if the SQL connection string user does not have the required level of permissions. However in my case, this is working correctly.


text:
Q: how to adjust date constructor in substr javascript if you look at my date validation when i come to test if it is in the past it works although the date constructor expects a zero date month so how do i subtract one from the substring value representing the month (one from the result, not the position)
//start of datefield
var dateformat=/^(?:(?:31\/(?:0[13578]|1[02])|(?:29|30)\/(?:0[13-9]|1[012])|(?:0[1-9]|1\d|2[0-8])\/(?:0[1-9]|1[0-2]))\/[2-9]\d{3}|29\/02\/(?:[2-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[3579][26])00))$/;
if (!date.match(dateformat))
{
      errors.push("format incorrect use dd/mm/yyyy make sure you are entering correct days to the month remember 30 days have september, april, june & november, only 28 days in february unless leap year next is 2016");

}
var today = new Date();

var courseYear =date.substr(6,4) // use substr or substring to capture the last four digits
var courseMonth =date.substr(3,2) // use substr or substring to capture the four and fifth digits
var courseDay = date.substr(0,2)//e the first and second digits

var dateToCompare = new Date(courseYear, courseMonth, courseDay);

if (dateToCompare < today) {
  errors.push("this date is in the past");

}

A:
so how do i subtract one

With the subtraction operator "-" and the number literal "1". It also has the benefit of converting the string to a number before. For year and day, you might use the unary plus to do that conversion explicitly (though the Date constructor does it implicitly):
new Date(+courseYear, courseMonth-1, +courseDay);


text:
Q: HTML aside tag vs div tag What is the difference between the div tag and the new HTML5 aside tag?
W3Schools has a very similar description for the two -

*

*Aside

*Div
I have also seen many sites use the aside tag where a div tag would be perfectly fine.
Although, when I put them both into practise, they behave the same way, like so:

This is a heading

This is a very short paragraph.

This is a heading

This is a very short paragraph.

WORKING EXAMPLE
So my question is, what is the main difference between the two? When should one be used over the other?

A: Similarities:

*

*Both of them also supports the Event & Global Attributes in HTML.

* and
 elements have no default rendering (and presentation qualities). So you will need to make them a block element and adjust their appearance and layout with style sheet rules. By default, browsers always place a line break before and after them. However, this can be changed with CSS. Most browsers will display these elements with the following default values:
div {
  display: block;
}

Differences

*

*The  element identifies content that is related but tangential to the surrounding content. In print, its equivalent is a sidebar, but they couldn't call the element sidebar, because putting something on the "side" is a presentational description, not semantic.

*According HTML5,  element is a Sectioning Content, so its content defines the scope of headings and footers. Each Sectioning Content element potentially has a heading and an outline. When a browser runs across a sectioning element in the document, it creates a new item in the document's outline automatically.

*The
 element is used to create a logical grouping of content or elements on the page. It indicates that they belong together in some sort of conceptual unit or should be treated as a unit by CSS or JavaScript.

*It is a difference between HTML 4.01 and HTML5, The  tag is new in HTML5.

*All versions of every browser support
 element.

A: The only practical difference (for now at least) is that old browsers do not recognize aside at all. They will treat it as undefined, not as a block element like div. Old versions of IE do not even let you style an aside element, though there are JavaScript-based ways to fix this.
The theoretical difference is explained in HTML5 drafts such as the current HTML5 LC. Note that w3schools.com is not an authority of any kind; see http://w3fools.com.

A: Short answer:

 tag defines a general division or section in HTML.
 tag has the same representations as a div, but contains content that is only related to the main page content.

Difference

Both have the same behavior but have a different meaning logically.

A: A div tag has no semantic weight and can contain any type of content. In HTML5 you can advantageously use section tags instead to add semantic weight. The aside tag should be used for content that is not related to the main content of a page

A: The main use that I see for

is that this is giving more clarity to the HTML code. You might recognize the link between a main text and a subordinate text.

A: All HTML5 new elements intention is to make it easier to index your data.
With  tag, it's very easy for program to identify that it is a aside data of the page.


text:
Q: Some admin users can not see all the products We have come across a strange issue.
We are 3 people with admin privileges in our Magento admin site.
When we search for a specific SKU in filter, 2 of us get the same result and 1 get a totally different result.
2 of us get 2600 records and we can go to the next page etc, but the last one he only gets 1 record found but is showing 999 records but are not able to go to next page. When i uses the tick boxes on the left side to tick 1 box then all the boxes gets ticked.
We have made sure that we are using the same filters etc.
Anyone that had the same issue knows how to fix this?
thanks.

A: In the ui_bookmark table, try deleting any entries related to the user that doesnt see all the products. Possibly some filter or something invisible is bookmarked. You wont break anything by deleting rows from that table.


text:
Q: Can't calculate end address of the section at linker script I need to make firmware image with 8K size. Firmware image should have a version word at the end. Area between data section and version section must be filled with 0xFF.
This linker script works fine if test and data sections not too big.
MEMORY
{
    PM_RAM (rwx): ORIGIN = 0x00000000, LENGTH = 20K
    DM_RAM (rwx) : ORIGIN = 0x0001E000, LENGTH = 6K
    PM_ROM (rx)  : ORIGIN = 0x00080000, LENGTH = 256K
    PM_OTP (rx): ORIGIN = 0x000C0000, LENGTH = 8K - VERSION_SIZE
    PM_OTP_VER (rx): ORIGIN = 0x000C0000 + 8K - VERSION_SIZE, LENGTH = VERSION_SIZE
}
SECTIONS {
    .text :
    {
        *(.text*)
        . = ALIGN(4);
    } >PM_OTP

    _etext = .;

    .data : {
        _sdata = .;
        _ldata = LOADADDR(.data);
        *(.data .data.*)
        *(.sdata .sdata.*)
        . = ALIGN(4);
    } >DM_RAM AT>PM_OTP

    . = ALIGN(4);
    _edata = .;

    .fill : {
        BYTE(0xFF)
        FILL(0xFF)
        . = LENGTH(PM_OTP) - SIZEOF(.text) - SIZEOF(.data) - 1;
    } > PM_OTP = 0xFF

    .version : {
        . = ALIGN(4);
        __version_start__ = .;
        KEEP(*(.version .version*))
        __version_end__ = .;
    } > PM_OTP_VER

    .bss : {
        _sbss = .;
        *(.bss .bss.*)
        . = ALIGN(4);
        *(.sbss .sbss.*)
        . = ALIGN(4);
    } >DM_RAM

    . = ALIGN(4);
    _ebss = .;
    _end = .;

    .stack ORIGIN(DM_RAM) + LENGTH(DM_RAM) - STACK_SIZE : {
        PROVIDE(__STACK_START__ = .);
        . += STACK_SIZE;
        PROVIDE(__C_STACK_TOP__ = .);
    } >DM_RAM
}

But if text + data close to 8K I get the error:
cannot move location counter backwards (from 00000000000c2095 to 00000000000c1ffb)

If change this string:
. = LENGTH(PM_OTP) - SIZEOF(.text) - SIZEOF(.data) - 1;

by hardcoded value like:
. = 0x3f;

Build completes successfully and all OK.
What is wrong with LENGTH(PM_OTP) - SIZEOF(.text) - SIZEOF(.data) calculations?
In listing file it corresponds to 0x3f.
UPDATE
I have linker script
STACK_SIZE = 1024;
TEST_MEMORY_SIZE = 4;
VERSION_SIZE = 4;

MEMORY
{
    PM_RAM (rwx): ORIGIN = 0xFD000000, LENGTH = 120K
    DM_RAM (rwx) : ORIGIN = 0xFD01E000, LENGTH = 6K
    PM_ROM (rx)  : ORIGIN = 0xFD080000, LENGTH = 256K
    PM_OTP (rx): ORIGIN = 0xFD0C0000, LENGTH = 8K - VERSION_SIZE
    PM_OTP_VER (rx): ORIGIN = 0xFD0C0000 + 8K - VERSION_SIZE, LENGTH = VERSION_SIZE
}

SECTIONS {

    .init ORIGIN(PM_OTP):
    {
        . = 0x000;
        *(.init.startup)
        . = ALIGN(4);
        *(.init.traphandler)
        . = ALIGN(4);
    } >PM_OTP

    .text :
    {
        *(.text*)
        . = ALIGN(4);
        *(.text.emulate*)
        . = ALIGN(4);
        *(.rodata .rodata.*)
        . = ALIGN(4);
    } >PM_OTP

    _etext = .;

    .data : {
        _sdata = .;
        _ldata = LOADADDR(.data);
        *(.data .data.*)
        *(.sdata .sdata.*)
        . = ALIGN(4);
    } >DM_RAM AT>PM_OTP

    . = ALIGN(4);
    _edata = .;

    .fill :
      {
        BYTE(0xFF)
        FILL(0xFF)
      } > PM_OTP = 0xFF

    .version :
      {
        . = ALIGN(4);
        __version_start__ = .;
        KEEP(*(.version .version*))
        __version_end__ = .;
      } > PM_OTP_VER

    .bss : {
        _sbss = .;
        *(.bss .bss.*)
        . = ALIGN(4);
        *(.sbss .sbss.*)
        . = ALIGN(4);
    } >DM_RAM

    . = ALIGN(4);
    _ebss = .;
    _end = .;

    .stack ORIGIN(DM_RAM) + LENGTH(DM_RAM) - STACK_SIZE : {
        PROVIDE(__STACK_START__ = .);
        . += STACK_SIZE;
        PROVIDE(__C_STACK_TOP__ = .);
    } >DM_RAM

    _test_memory = ORIGIN(DM_RAM) + LENGTH(DM_RAM);
    _loader_descr = _test_memory + TEST_MEMORY_SIZE;
}

Build terminates successfully and I get:
text       data     bss     dec     hex
7700        321    1056    9077    2375
Binary look:
00001f10  94 05 0c fd 98 05 0c fd  9c 05 0c fd a0 05 0c fd  |................|
00001f20  a4 05 0c fd a8 05 0c fd  00 00 00 00 00 00 00 00  |................|
00001f30  00 00 00 00 ac 05 0c fd  00 00 00 00 00 00 00 00  |................|
00001f40  00 00 00 00 00 00 00 00  00 00 00 00 01 01 00 00  |................|
00001f50  ff 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001f60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001ff0  00 00 00 00 00 00 00 00  00 00 00 00 60 b8 ee 61  |............`..a|
00002000

There are zeros here from 00001f60 to the end. But I need 0xFF.
I added line:
. = LENGTH(PM_OTP) - SIZEOF(.init) - SIZEOF(.text) - SIZEOF(.data);`

In setion .fill after FILL(0xFF) and got error:
cannot move location counter backwards (from 00000000fd0c2025 to 00000000fd0c1ffc)

Very strange. But ok. I gradually reduce my code volume. And at a certain code decrease, the build begins to be successful.
text       data     bss     dec     hex
7656        536    1056    9248    2420
Binary look:
00001ef0  a0 05 0c fd a4 05 0c fd  a8 05 0c fd 00 00 00 00  |................|
00001f00  00 00 00 00 00 00 00 00  ac 05 0c fd 00 00 00 00  |................|
00001f10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00001f20  01 01 00 00 ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00001f30  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001ff0  ff ff ff ff ff ff ff ff  ff ff ff ff 50 bb ee 61  |............P..a|
00002000

There is a lot of 0xFF in the end. And offset is correctly calculated, because 0xFF goes up to version. But other side 0xFF is empty area that could be filled with useful code.

A: 0x00000000000c2095 is apparently beyond PM_OTP (rx): ORIGIN = 0x000C0000, LENGTH = 8K - VERSION_SIZE. Your firmware is too large.


text:
Q: Loading native library with WildFly 10 So I have a web service that contains code that uses native library code. I have a module set up based on this article https://docs.jboss.org/author/display/MODULES/Native+Libraries:
com
   myco
      mymodule
         main
            myjar.jar
            myjar2.jar
            myjar3.jar
            module.xml
            lib
               linux-x86_64
                  libTimeFunc.so

Here is my module.xml file:
<module name="com.myco.mymodule" xmlns="urn:jboss:module:1.3">
    <resources>
        <resource-root path="myjar.jar"/>
        <resource-root path="myjar2.jar"/>
        <resource-root path="myjar3.jar"/>
    </resources>
</module>

myjar.jar depeonds on myjar2.jar which depends on myjar3.jar. myjar3.jar makes some native library calls using libTimeFunc.so. That article said to have lib/linux-x86_64 for 64-bit Linux, which is what I'm running on.
When the service tries to make the call, I get an UnsatisfiedLinkError: Unable to load library 'TimeFunc': Native library (linux-x86-64/libTimeFunc.so) not found in resource path (/jboss/wildfly-10.0.0.CR2/jboss-modules.jar).
I noticed that it seemed to be looking for linux-x86-64/libTimeFunc.so, instead of linux-x86_64/libTimeFunc.so, but when I tried changing the folder name to have a dash, I still got the same error.
My pom.xml file for my service has the following to depend on the module (there are other entries within the plugin, this was just the relevant portion):
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <archive>
            <manifestEntries>
                <Dependencies>
                    com.myco.mymodule
                </Dependencies>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

Why would it not be able to find the libTimeFunc.so file? From what I understand I should just be able to put it under lib/linux-x86_64 and it should automatically look there for it.

A: Since this is running in the context of an application server, you should load your shared library using the class loader used to load your application.  That way the native library gets unloaded when your application does.
Map options = new HashMap();
options.put(Library.OPTION_CLASSLOADER, loader);
Native.loadLibrary("libTimeFunc", options);

You then need to move the linux-x86-64 directory to the root of your archive so the class loader can find it there.
Alternatively, you can specify an absolute path to your library, e.g.
Native.loadLibrary("/com/myco/mymodule/main/lib/linux-x86-64/libTimeFunc.so", options);

Note that your application server may not be particularly happy with your app copying a resource to disk and then attempting to load it.  Your SecurityManager mileage may vary.
You may also encounter a version of JNA already loaded by your application server.


text:
Q: How to use onkeyup event multiple times on same input field in jquery? I am working on form where i want to make some calculations. i am using jquery for this.Below is html code and jquery function for the same.
function sum(param,id)
        {
            var daysWork = document.getElementById('days_work_'+id).value;
            var rateReceived = document.getElementById('rateReceived_'+id).value;
            var percPaid = document.getElementById('perc_paid_'+id).value;
            var paidFrmUk = document.getElementById('paidFrmUk_'+id).value;
            var paidFrmIndia =  document.getElementById('paid_from_india_'+id).value;
            var remaining =  document.getElementById('remaining_'+id).value;

            var totalDisplay = rateReceived * daysWork;
            var total = totalDisplay.toFixed(2);
            document.getElementById('total_'+id).value = total;

            var toBePaidDisplay = (totalDisplay * percPaid)/100;
            var toBePaid = toBePaidDisplay.toFixed(2);
            document.getElementById('tobe_paid_'+id).value = toBePaid;

            var paidFrmIndiaDisplay = toBePaid - paidFrmUk;
            var paidFrmIndia = paidFrmIndiaDisplay.toFixed(2);
            var paidFrmIndia = document.getElementById('paid_from_india_'+id).value = paidFrmIndia;

            var addUkIndiaSal = Number(paidFrmIndia) + Number(paidFrmUk);
            var remainingDisplay = toBePaid - addUkIndiaSal;
            var remaining = remainingDisplay.toFixed(2);
            document.getElementById('remaining_'+id).value = remaining;

        }

<?php echo $RATE_RECEIVED;?>
<?php echo $CURRENCY_CODE;?>
<?php echo $PERC_PAID;?>
<input type="text" onkeyup="sum(this,<?php echo $srNo;?>)"   id="days_work_<?php echo $srNo;?>"  value="<?php echo $DAYS_WORKED;?>" />
<input type="text"  id="total_<?php echo $srNo;?>"  value="<?php echo $TOTAL;?>"  />
    <input type="text"    id="tobe_paid_<?php echo $srNo;?>"  value="<?php echo $PER_TO_BE_PAID; ?>"  />
<input type="text" onkeyup="sum(this,<?php echo $srNo;?>)"  id="paidFrmUk_<?php echo $srNo;?>"  value="<?php echo$SAL_PAY_FRM_UK;?>" />
<input type="text" onkeyup="sum(this,<?php echo $srNo;?>)"  id="paid_from_india_<?php echo $srNo;?>"  value="<?php echo $SAL_PAY_FRM_INDIA;?>"  />
<input type="text" onkeyup="sum(this,<?php echo $srNo;?>)"   id="remaining_<?php echo $srNo;?>"  value="<?php echo$REMAINING;?>"  />

My code is working fine as per my function. but i have some other conditions that i can't able to done with this code.
As you can see last 3 inputs in td paidFrmUk_, paid_from_india_, remaining_ .
My calculation is like paidFrmIndia = = toBePaid - paidFrmUk;

its working. but if i want to edit  paidFrmUk after calculation it
  wont allow me to edit that input box. what is the solution for this.
  to edit input box once calculated by function.


text:
Q: Как в Delphi проверить, что строка равна одной кавычке (')? Если задать так: if s=''' то воспримет как пара кавычек(открытие и закрытие) и новая открытая кавычка. А нужно чтоб проверилось что строка равна кавычке. Двойные кавычки не подойдут, нужно чтоб именно одинарной строке равнялась строка.
Как в Delphi можно задать проверку на то что строка равна одинарной кавычке (')?

A: Можно попробовать сравнить с кодом кавычки.
S := '''';
if S = #39 then //если только один символ
//или
if S[i] = #39 then //если несколько символов в строке

В ином же случае, используйте экранирование - дублированная одинарная кавычка (две подряд идущие одинарные кавычки S := ''''; -> в результате дает одну одинарную кавычку в строке).
S := '''';
if S = '''' then ...


text:
Q: Trouble starting rails server Webrick Just starting to get into RoR development and I am struggling with getting the Webrick server to start. I am in my rails project's folder. Then I enter rails server or rails s and it looks like the server is going to start then it says Exiting with a bunch of other stuff listed below it. Anyone know what is wrong?? Here is what terminal spits out...
wyep:simple_cms designer1$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout' from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Applications/MAMP/htdocs/simple_cms/config/environment.rb:5:in `<top (required)>'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `require'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `block in <main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `new'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `<main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

A: Error is in the message there:
Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)

In your config/database.yml you need to specify a valid host, user and password


text:
Q: Using firebase Idtoken instead of custom token without compromising security I have following use cases:

*

*I have cloud functions which are accessible with HTTP endpoint and they use authorization using custom token because the app is only accessible with certain IPs stored in RTDB so I have created one cloud function with will generate a custom token after signing in user using firebase client SDK and then it will create a custom token using admin SDK after checking IPs which are stored in RTDB.

*Now with every subsequent call client will send token and functions will serve the request.

*I have event listeners bound with the RTDB on a client and use file upload using client SDK  which client initialize with firebaseApp.auth().signInWithCustomToken(custom token).

*On the function side I use the same sign in the method that also utilizes my firebase SDK and then I serve that request. The problem here is this sign in the method is very slow like it is taking generally more than 1 second only in sign in.

Alternative
Now alternative is I can use id token which can be created using currentUser.getIdToken() on the client side itself and it takes barely few ms to decode that token but I cannot initialize SDK with that token. so I have to use admin SDK but my IP node in RTDB is not accessed by the normal user and can only be accessed with admin SDK, so if I use ADMIN SDK with Control Access with Custom Claims and Security Rules to give admin SDK similar access that the authorized user has then IP node will not be accessible.
Issues with id token
Id token can be refreshed on the client side so once a client has a custom token, It can generate as many tokens it wants and that is not desirable. Apart from that validating IP everytime is not the operation that I wanted to do so with custom token I only use that in generating a custom token and then for a refreshing token but with id token, this would not be possible as the client can generate it with SDK.
Basically, I have to use firebase SDK on the client side which will need custom token(for additional authorization check) to initialize and at the same time I call the clound function from the similar app so what is the best way to implement this use case.


text:
Q: List comprehension with dynamic value changing I have 2 variables. They stay in a reverse connection and form a list with 2 values which sum equals to 1. The example is shown below:
[0.1, 0.9], [0.2, 0.8], ..., [0.9, 0.1]

Is it possible to create a list generator that is able to do this?
So I want the following list of lists as a result:
[[0.1, 0.9], [0.2, 0.8], ..., [0.9, 0.1]]

I know, I can use a for loop for it, however, I'd like to know about this opportunity.

A: You can do something like
[[z / 10, (10 - z) / 10] for z in range(1, 10)]

This formulation attempts to reduce rounding error as much as possible.

A: You can zip the lists:
z=[[j/10,i/10] for i,j in zip([x for x in range(10)],[y for y in range(10,-1,-1)])]


text:
Q: using passport-jwt in nest with secretOrKeyProvider option keep responsing http 401? I am a new coder with nestjs, I want to use passport-jwt , nestjs/passport and firebase to build my app's authetication part, below are my codes. But I just got http 401 response, how can i fix it ?
here is my strategy:
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { getAuth } from 'firebase-admin/auth';

@Injectable()
export class FirebaseStrategy extends PassportStrategy(Strategy, 'firebase') {
  constructor() {
    super({
      jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
      ignoreExpiration: false,
      secretOrKeyProvider: async (request, rawJwtToken, done) => {
        try {
          const decodedToken = await getAuth().verifyIdToken(rawJwtToken);
          done(null, decodedToken);
        } catch (error) {
          done(error);
        }
      },
    });
  }

  async validate(payload: any) {
    console.log('validate');
    return payload;
  }
}

here is my guard:
import { Injectable } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';

@Injectable()
export class FirebaseAuthGuard extends AuthGuard('firebase') {}

here is my auth.module.ts:
import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { UsersModule } from '../users/users.module';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { FirebaseStrategy } from './firebase.stragety';
import { AuthController } from './auth.controller';

@Module({
  controllers: [AuthController],
  imports: [UsersModule, PassportModule, JwtModule.register({})],
  providers: [AuthService, FirebaseStrategy],
  exports: [AuthService],
})
export class AuthModule {}

and here is my controller:
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
import { AuthService } from './auth.service';
import { FirebaseAuthGuard } from './firebase.guard';

@Controller('auth')
export class AuthController {
  constructor(private authService: AuthService) {}

  @UseGuards(FirebaseAuthGuard)
  @Get('login')
  async logIn(@Request() req) {
    return 'login';
  }
}

I just found my validate method in FirebaseStrategy not invoked, it should be invoked everytime when secretOrKeyProvider verified jwt in http header, isn't it ?

A: If you're getting a 401 with no call of the validate method of your JwtStrategy that means that for some reason passport is reading the JWT you send as invalid. To find the specific reason for it you can modify your FirebaseAuthGuard to have the following handleRequest method, which will log out extra details
handleRequest(err, user, info, context, status) {
  console.log({ err, user, info, context, status });
  return super.handleRequest(err, user, info, context, status);
}

As mentioned, this will print out what error or info passport is reading and throwing for, and will allow you to properly adjust your JWT/know to refresh it/change it because of invalid signature/whatever else.


text:
Q: Failed to start Load Kernel Modules at Boot on Raspberry Pi 3B+ I have installed ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img on my Raspberry Pi 3 B+.  I have no problem to login, but there is a message during bootup the Pi3B+:
[FAILED] Failed to start Load Kernel Modules
See 'systemctl status systemd-modules-load.service' for details

Does anyone know how to fix it?  Thanks.


text:
Q: any rss feed lib for gae i want enable rss for gae on my site .
and did you know the simple way to do this  ?
thanks
this is a example i searched:
class FeedHandler(BaseRequestHandler):
    def get(self,tags=None):
        blogs = Weblog.all().filter('entrytype =','post').order('-date').fetch(10)
        last_updated = datetime.datetime.now()
        if blogs and blogs[0]:
            last_updated = blogs[0].date
            last_updated = last_updated.strftime("%Y-%m-%dT%H:%M:%SZ")
        for blog in blogs:
            blog.formatted_date = blog.date.strftime("%Y-%m-%dT%H:%M:%SZ")
        self.response.headers['Content-Type'] = 'application/atom+xml'
        self.generate('atom.xml',{'blogs':blogs,'last_updated':last_updated})

any more simple  ?

A: Have a look to PyRSS2Gen.
You could find many examples of self-made python blogs on Google appengine that generate RSS 2.0 feed using PyRSS2Gen.
Here and Here some good examples.


text:
Q: Renaming a XML File from another server using T-SQL I'm looking for a way to rename an XML file from another server.
I'm currently able to do this locally with the code below but now need to rename the file from a different server.
DECLARE @Rename NVARCHAR(2000)

SET @Rename = 'ren "D:\Example\ExampleFolderPath\' + @OriginalFileName + '"' + '  "RENAMED_FILE.xml"'

EXEC master..xp_cmdshell @Rename


text:
Q: I am trying to create a procedure in oracle pl/sql but cant really put in the exact logic for what I am trying to do When it takes input , email is given and all other parameters are null it should show all records of that email. Similarly with other three input paramters.
If all inputs are null then it should show all records of the student table.
create or replace procedure get_student_records(
    pis_email in varchar2,
    pis_rollno in number,
    pis_dept in varchar,
    pi_class_id in number
)
IS
begin

end get_student_records;

Tables to be accessed :
CREATE TABLE student (
    s_id     NUMBER(10) NOT NULL,
    s_rollno NUMBER(10) NOT NULL,
    s_name   VARCHAR2(20) NOT NULL,
    s_dept   VARCHAR2(10),
    s_email  VARCHAR2(25),
    class_id NUMBER(10),
    CONSTRAINT student_pk PRIMARY KEY ( s_rollno ),
    CONSTRAINT fk_class FOREIGN KEY ( class_id )
        REFERENCES class ( class_id )
);

CREATE TABLE class (
    class_id   NUMBER(10) NOT NULL,
    class_name VARCHAR2(10) NOT NULL,
    dept_id    NUMBER(10),
    CONSTRAINT class_pk PRIMARY KEY ( class_id ),
    CONSTRAINT fk_depts FOREIGN KEY ( dept_id )
        REFERENCES dept ( dept_id )
);

CREATE TABLE dept (
    dept_id   NUMBER(10) NOT NULL,
    dept_name VARCHAR2(50) NOT NULL,
    CONSTRAINT depts_pk PRIMARY KEY ( dept_id )
);

A: There is a trick you can use -- lets say in_email, in_name are parameters and the fields are name and email -- the query looks like this:
 SELECT *
 FROM table as t
 WHERE COALESCE(in_name,t.name) = name AND COALESCE(in_email,t.email) = email

The way this works -- when the parameter is null the statement is true (so all are found -> it is a wildcard.  When there is a value, it only matches on the exact value.


text:
Q: Pandas Groupby but keep all the dataframe I have a dataframe which looks like:
|--------------|------------|------------|
|     User     |    Text    |   Effort   |
|--------------|------------|------------|
|    user122   |   TextA    |  2 Weeks   |
|--------------|------------|------------|
|    user124   |   TextB    |  2 Weeks   |
|--------------|------------|------------|
|    user125   |   TextC    |  3 Weeks   |
|--------------|------------|------------|
|    user126   |   TextD    |  2 Weeks   |
|--------------|------------|------------|
|    user126   |   TextE    |  2 Weeks   |
|--------------|------------|------------|

My goal is to group the table by Effort and get the unique count of each user per group. I am able to do that by:
df.groupby(['Effort']).agg({"User": pd.Series.nunique})

And this results into this table:
|--------------|------------|
|     Effort   |    User    |
|--------------|------------|
|    2 weeks   |     3      |
|--------------|------------|
|    3 weeks   |     1      |
|--------------|------------|

However, by doing so I am loosing my text column information. Another solution I tried is to keep the first occurrence of that column, but I am still unhappy because I loose something on the way.
Question
Is there any way in which I can keep my initial dataframe without loosing any row and column but at the same time still group by Effort?

A: The best option you have is using transform if you ask me. This way you keep the shape of your original data, but still get the results of a groupby.
df['Nunique'] = df.groupby('Effort')['User'].transform('nunique')

      User   Text   Effort  Nunique
0  user122  TextA  2 Weeks        3
1  user124  TextB  2 Weeks        3
2  user125  TextC  3 Weeks        1
3  user126  TextD  2 Weeks        3
4  user126  TextE  2 Weeks        3


text: Q: how to recover mysql data without binary logs I wanna recover some data that were deleted by accident, but mysql binary log is off. no bin-log file for recovering the history data. is there any other approach to solve the problem ?


text:
Q: Show Facebook user profile image to other users I managed to implement Facebook login into my android app and it displays the public profile picture when I provide the access token in the link:
https://graph.facebook.com/{userId}/picture?type=large&access_token={ACCESS_TOKEN}
But what about the other users? It's a social media application and I want other users to see the profile picture as well.
Is this even possible after the changes Facebook made in September 2020?
I saw that Zynga Poker has exactly what I want, you sign up with Facebook and everyone else can see your profile picutre as well.
Can I somehow request from the user to give me the permission to use the profile picture piblicly?


text:
Q: Create a left and right spacer in CSS around flash content in the body of a website Option 1
Below is a general layout of a site im trying to construct. The green regions are the sites header and footer. The blue region is flash content who's height changes depending on what is displayed. The red region are two spacers im trying to construct that bound the flash content and their sizes change according to the width of the browser however the width of the flash content stays static.

Where im getting hung up is how do i create these spaces in css. I assume that i would use CSS to solve this problem correctly.
For example, in the CSS file i need to set the background color and height as they as always going to be static, only the width changes.
#left spacer {
    background-color: #881E42;
    height: 46px;
    float: left;
}
#right spacer {
    background-color: #881E42;
    height: 46px;
    float: right;
}

How can i set the width of right and left spacer to (Browser width - Flash Content width)/2
Where the width of the flash content is static at 920px.
I'm not sure how to govern the width of the spacers.
Somehow the width of the spacers needs to be set to a size of (Browser width - flash content width)/2
In this example the static width of the flash content is 920px and the browser width is variable. so say the browser width is 1920px than the size of each spacer would be 500px per container. I would also set the minimum width of each spacer to 20px so they show up if the browser width is below a certain threshold.
Opetion 2
The other idea that i had was to create 1 container which housed the flashcontent

*Flash content scipt goes here

I dont know how to do this or even if its possible, but it would work
#Container{
        psudo code
        Color 1: #881E24
        Color 1 height: 25px
        Color 1 width: 100%
        background-color: #FFFFFF;
        height: auto;
        width: 100%;
        text-align: center;
    }

A: Here is a working JSFIDDLE
Updated code.
Example of code,

    CSS
    #header {
    width: 100%;
    height: 50px;
    background-color: green;
}

.clear {clear: both;}

#one {
    width: calc((100% - 250px)/2);
    height: 10px;
    background-color: red;
    float: left;
}

#two {
    width: 33%;
    height: 970px;
    background-color: blue;
    float: left;
}

#three {
    width: calc((100% - 250px)/2);
    height: 10px;
    background-color: red;
    float: left;
}
#footer {
    width: 100%;
    height: 50px;
    background-color: green;
}

A: One way to do this would be make the three DIVs float:left and size them as you want, then between the end of the content you'd use a clear and end with the floating area.
If you do it that way, you'll have:
left_spacer | flash_content | right_spacer
The spacers are really only needed if you want to put content in them (otherwise you could use only margins to put #flash_content wherever you want, and not need to make anything float).
To size your DIVs, you would have to size left_spacer and flash_content with a certain amount of pixels or percentage, and right spacer should fill the rest of the space.
You might want to put the three divs in a container if you're using fixed width, too.
edit: actually, I think you won't need to make the last of the three divs (right_spacer) float:left, since it is the last one on the row.


text:
Q: How to Preserve the input Value in HTML  How can i possibly preserve the value of the <input> field if submitted wrong? I have a form that will be submitted to a php page. The PHP page will then check if that is correct or not.
Ex. if the user input google the PHP page says it is wrong. I want google sent back to the input field.

A: You can access the value using the $_POST or $_GET super-global. Depending upon the form submit method, you can do:
<input type="text" value="<?= (isset($_POST['field'])) ? strip_tags($_POST['field']) : '' ?>" name="field" />

If your method="get", you'll need:
<input type="text" value="<?= (isset($_GET['field'])) ? strip_tags($_GET['field']) : '' ?>" name="field" />

A: If you have your input element:
<input id="myInput" name="myInput" value="<?php if(isset($_POST['myInput'])){ print $_POST['myInput']; } ?>" />

I believe this should work but if it doesn't let me know and I'll edit it.

A: use $_POST[fieldname] like this
<input type="text" name="name" value="<?php if(isset($_POST['name'])) echo strip_tags($_POST['name']);  ?>"/>

A: You can return the result and the value entered by user.
for ex if user input "google"
Then in your case return an array as
array('result' => 'error', 'val' => );
or it its right
array('result' => 'success', 'val' => );
with this array you can check whether the 'result' variable is success or error. And if it is an error then take the "val" value and put it inside your input


text:
Q: Error with google maps api3 I am trying to embed a google map with markers in my webpage. But I am getting an undefined alert message if I use the following code
var infowindow = null;
var geocoder;
$(document).ready(function () { initialize();  });

function codeAddress(address) {
    geocoder = new google.maps.Geocoder();
    geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            //alert(results[0].geometry.location);
            return (results[0].geometry.location);
        }
    });
}

function initialize() {
    default_location = codeAddress("<?php echo $location;?>");
    alert(default_location);
}

Instead of that If i am doing the alert with in the codeAdress function as below it is correctly showing the latitude and longitude.
var infowindow = null;
var geocoder;
$(document).ready(function () { initialize();  });

function codeAddress(address) {
    geocoder = new google.maps.Geocoder();
    geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            alert(results[0].geometry.location);

        }
    });
}

function initialize() {
    codeAddress("<?php echo $location;?>");
}

Can somebody Identify whats the problem? I am new to javascripts

A: The geocoder call is asynchronous, meaning that it takes some time to return and does not follow the sequential order as written. It also means that in the first bit, the function finishes before it gets to your return (results[0].geometry.location) statement. So alert has nothing to display.
Other than inserting statements inside the geocode request, you can write a callback pattern to separate the script logic. The callback, which passes the location as the parameter, executes when the geocode call is successful.
http://jsfiddle.net/3KXKm/
  var infowindow = null;
  var geocoder = new google.maps.Geocoder();

  $(document).ready(function () { initialize();  });

  function codeAddress(address, callback) {
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        callback(results[0].geometry.location);
      }
    });
  }

  function initialize() {
    codeAddress("Chicago, IL", function(default_location) {
      var map = new google.maps.Map(document.getElementById("map_canvas"),
        { center: default_location,
        zoom: 3, mapTypeId: google.maps.MapTypeId.ROADMAP });

      locations = ["Los Angeles", "Davis", "Truth or Consequences",
        "Ann Arbor", "Massachusetts"];

      for (var i = 0; i < locations.length; i++) {
        codeAddress(locations[i], function(latLng) {
          new google.maps.Marker({map:map, position:latLng});
        });
      }
    });
  }

A: geocode does not return the result instantly. This is why you get nothing in the first version of your code. So if you want to do something with the geocode result you should do it in the callback function like in the second version of your code.

A: Your
return (results[0].geography.location);

Only return the value of the nested function, not that of codeAddress function. Maybe if hou tell us what you're trying to do we can help.


text:
Q: Usar htaccess para hacer las url mas amigables Anteriormente usaba mi url de la siguiente manera
http://www.nombredelaweb.com/rubro.php?id=juguetes-magicos

Obtengo el valor de la variable asi:
$variable = trim($_GET["id"]);

Ahora me actualice y en el archivo htaccess agrege las siguientes lineas
Options +FollowSymLinks
RewriteEngine on
Rewriterule ^rubro/([a-zA-Z0-9_-]+).php rubro.php?id=$1

Formato de mi nueva url
Ver nombre

Obtengo el valor de la variable asi:
$variable = trim($_GET["id"]);

De esta forma consigo que mi url sea mas amigable.
Mi pregunta: Es necesario crear una carpeta dentro de mi hosting con el nombre (rubro) y dentro de esta el archivo (juguetes-magicos.php) ya que mi web quedaria asi (www.nombredelaweb.com/rubro/juguetes-magicos.php)
Anteriormente no era necesario ya que la variable estaba en el archivo que si existia seguido de la variable y era rubro.php?id=juguetes-magicos.
Espero que me entiendan. Muchas gracias.

A: no es necesario.
Si tu ruta en el .htaccess es:
Rewriterule ^rubro/([a-zA-Z0-9_-]+).php rubro.php?id=$1

Pues el servidor interpretará cualquier URL que cumpla con la expresión, por ejemplo:
www.tusitio.com/rubro/mi-rubro.php

como si tuviera accediendo a:
www.tusitio.com/rubro.php?id=mi-rubro

Otros ejemplo:
www.tusitio.com/rubro/rubro007.php  <= interpretará a =>  www.tusitio.com/rubro.php?id=rubro007
www.tusitio.com/rubro/el-rubro-editado.php  <= interpretará a =>  www.tusitio.com/rubro.php?id=el-rubro-editado
Y para mostrar un dato depende de la ID pasada seria asi:
<?php
    // Este es el archivo rublo.php que obtendrá las URL amigables

    $id = $_GET['id'];

    if( $id == 'juguetes-magicos' ){
        echo 'Estas en juguetes magicos';
    }
    elseif( $id == 'mi-rubro' ){
        echo 'Estas en mi rubro';
    }
?>

Siendo la URL asi:
www.nombredelaweb.com/rubro/juguetes-magicos.php

Salida:
Estas en juguetes magicos

No hay necesidad de crear carpetas. El .htaccess permite que el servidor interprete las URL amigables y pasarla al código PHP de forma que lo entienda... Espero haberte ayudado :)
Saludos!


text:
Q: OLS with AutoRegressive Errors on Non-Stationarised Data I'm working with some time series data (n=40) and trying to fit an OLS with AutoRegressive Errors to model the relationship between my dependent variable and a couple of predictors over time. I'm working in R.
Dependent variable looks like this:

Unit root tests suggest that there is indeed a root process.
I'm working through the process of fitting an OLS, inspecting the residuals and the (P)ACF plots, and then using the sarima function to add AR errors onto the model, fine turning the p, d, and q values in response to the model diagnostics.
Eventually, I am able to end up with a model producing output plots looking nice and healthy like this:

...with the AR term statistically significant in the model. There are other possible specifications with similar-looking plots and significance values, but they have higher AIC/AICc/BIC scores.
At no point however am I differencing the series.
My question is therefore: are my results (and the post-estimation plots) completely false and spurious (as I am using a non-differenced, non-stationary time series)? Or is it indeed possible to use ARIMA terms in an AR Error framework to 'fix' the spurious regression problem?
My confusion comes from the fact that the post-estimation plots would suggest that the autocorrelation has been dealt with. But I imagine that this could be a completely different issue (or non-issue) compared to non-stationarity.


text:
Q: Incompatible Gems on M1 Macbook I've faced an issue when trying to run a console on my Ruby on Rails project. It gives me the following error:
/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': dlopen(/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle, 0x0009): tried: '/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/msgpack.bundle' (no such file), '/usr/lib/msgpack.bundle' (no such file) - /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle (LoadError)
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `require'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `block in <top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/explicit_require.rb:45:in `rescue in with_gems'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache.rb:61:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache.rb:61:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap.rb:5:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap.rb:5:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/setup.rb:3:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/setup.rb:3:in `<top (required)>'
       from /Users/artemhb/scheduled_tweets/config/boot.rb:4:in `require'
       from /Users/artemhb/scheduled_tweets/config/boot.rb:4:in `<top (required)>'
       from bin/rails:3:in `require_relative'
       from bin/rails:3:in `<main>'
/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': dlopen(/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle, 0x0009): tried: '/Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/msgpack.bundle' (no such file), '/usr/lib/msgpack.bundle' (no such file) - /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle (LoadError)
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `require'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `block in <top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/explicit_require.rb:42:in `with_gems'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache/store.rb:5:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache.rb:61:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/load_path_cache.rb:61:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap.rb:5:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap.rb:5:in `<top (required)>'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/setup.rb:3:in `require_relative'
       from /Users/artemhb/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.1/lib/bootsnap/setup.rb:3:in `<top (required)>'
       from /Users/artemhb/scheduled_tweets/config/boot.rb:4:in `require'
       from /Users/artemhb/scheduled_tweets/config/boot.rb:4:in `<top (required)>'
       from bin/rails:3:in `require_relative'
       from bin/rails:3:in `<main>'

A few Gems that seem not to work with an ARM architecture: mgspack and bootsnap. I was able to solve an issue with one Gem however – bcrypt by installing the right version of it gem install bcrypt --platform arm-linux. Does anyone know how would I prevent this?
Thank you in advance!

A: *

*Uninstall msgpack

*Install unsupported version via gem installation
gem install msgpack -v 1.4.2
Then bundle will take this specific version

*For all incompatible gems ,follow the same steps as 3.


text:
Q: AssertionError using Joi schema definition with express-validation from a different module I'm trying to define my Joi schema in one module and include it in different modules (the base definition are meant to be shared in more modules to avoid code duplication). But seems like some definition works, other doesn't.
Module 1
import Joi from 'joi';

const working1 = Joi.string().alphanum().min(3).max(20).required();
const working2 = Joi.string().required().min(5);
const notWorking1 = Joi.number().default(0).min(0);

export default {
  working1,
  working2,
  notWorking1,
};

Module 2
import m from './module1';

export default {
  rule1: {
    body: {
      field1: r.working1,
      field2: r.working2,
    },
  },
};

Module 3
import m from './module1';

export default {
  rule2: {
    query: {
      field1: r.notWorking1,
    },
  },
};

Some validation schema are working well, while in other case I get a weird error (ex in module3). Something like this:
AssertionError [ERR_ASSERTION]: Invalid schema content: (rule2)
{"generatedMessage":false,"name":"AssertionError [ERR_ASSERTION]","code":"ERR_ASSERTION","actual":false,"expected":true,"operator":"==","path":"rule2"}

If I include the validation schema in the module3 file without importing it from the module1 it works as expected.
The schemas are included inside the ruotes using express-validation module.
import { Router } from 'express';
import validation from 'express-validation';
import v3 from './module3';
import v2 from './module2';

router.get('/x', validation(v2.rule1), (req, res, next) => ... ); // working
router.get('/y', validation(v3.rule2), (req, res, next) => ... ); // not working

I expect that it works in any case. Am I missing something?