text:
Q: Find $\int \frac{e^{2x} dx}{1+e^x} $ My attempt. Rewriting it as
$$
\frac{e^x e^x}{1+e^x} \text{ then } u = e^x \text{ and } du = e^x dx
$$
Substitute to get $u/(1+u)$ and now integrate + Plug in
$$
\int \frac{e^{2x}dx}{1+e^x} = \frac{e^{2x}}{2} + x
$$

A: You made a mistake somewhere, possibly by integrating with respect to $x$ rather than $u$, in any case, $$\int\dfrac{u}{1+u}\,\mathrm{d}u=\int\dfrac{u+1}{1+u}\,\mathrm{d}u+\int\dfrac{-1}{1+u}\,\mathrm{d}u=u-\ln(1+u)+\mathrm{C}.$$


text:
Q: Wordpress : Child-theme CSS weird behavior I am currently customizing a wordpress theme.
Here my case, through a widget, I generate a div which has several classes :

...

The parent theme and bootstrap stylesheet already apply respectively properties on focus-box and col-lg-3 classes.
Well, I added to my child-theme stylesheet (which works well for many others things) this :
.item-1 { background-color: orange; }

And this does not work... nothing happen but I tried to do this in my child-theme CSS :
.col-lg-3 (or focus-box) { background-color: orange; }
.item-1 { background-color: orange; }

This way works... I really don't understand anything to what is happening here.
My Child-theme stylesheet is the last one to be load, so It should override all others, isn't it ?
If anyone has a clue, I would appreciate to get it :-)
Thanks in advance for your help.
Sommy

A: Thanks for your answers.
First, I already tried to use !important it didn't work, it was the same using stronger selector.
I know how to inspect code with my browser, and that's why I told you that my child-theme css was the last one to be loaded because I checked it.
The thing really weird, according to me, is that the result is different if I put col-lg-3 in my stylesheet or not.
I have similar issues with others HTML elements in my code.
To sum up :

*

*My Child-Theme CSS is loaded after the parent-one

*I checked it in my browser development tool

*I also notice that the place where my CSS properties is change the result, if I put it at the end of my child-theme css it sometimes work example :

{
/* IF I PUT THE SELECTOR .focus-box .service-icon here It doesn't work */
/* SEE THE LAST ELEMENT BELOW */

.focus-box:nth-child(4n+1) .service-icon:hover {
    border: 5px solid #e96656;
}

.focus-box:nth-child(4n+2) .service-icon:hover{
    border: 5px solid #34d293;
}
.focus-box:nth-child(4n+3) .service-icon:hover {
    border: 5px solid #3ab0e2;
}
.focus-box:nth-child(4n+4) .service-icon:hover{
    border: 5px solid #f7d861;
}
.focus-box:nth-child(4n+1) .red-border-bottom:before {
    background: #e96656;
}
.focus-box:nth-child(4n+2) .red-border-bottom:before {
    background: #34d293;
}
.focus-box:nth-child(4n+3) .red-border-bottom:before {
    background: #3ab0e2;
}
.focus-box:nth-child(4n+4) .red-border-bottom:before {
    background: #f7d861;
}
.focus-box h5 {
    margin-bottom: 15px;
    color: #404040;
    position: relative;
    display: inline-block;
    text-transform: uppercase;
    margin-bottom: 30px;
    font-weight: bold;
    font-size: 17px;
    float: none;
    width: 100%;
    background-color: rgba(224,82,6,0.2);
}

.other-focuses {
    background: url(images/lines.png) repeat-x center;
    margin-bottom: 25px;
}
.other-focuses .section-footer-title {
    padding: 0 15px;
    color: #404040;
    font-weight: bold;
}
.other-focus-list {
    padding-top: 5px;
    margin-bottom: -17px;
}
.other-focus-list ul li {
    display: inline-block;
    margin-right: 50px;
    padding-bottom: 15px;
    text-transform: uppercase;
}
.other-focus-list ul li:last-child {
    margin-right: 0;
}
.other-focus-list ul li i {
    margin-right: 8px;
}

.item-dashboard {

    padding: 20px 0 20px 0;

}

.focus-box p {
    font-size: 14px;
    color: black;

}

/* IF I PUT IT THERE THEN IT WORKS */
.focus-box .service-icon {
    margin-bottom: 30px;
    width: 145px;
    height: 145px;
    margin: auto;
    border-radius: 50%;
    border: 0px solid #ececec;
    margin-bottom: 20px;
    position: relative;
    -webkit-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}

Focus Box HTML Code :

The question is why my child-theme CSS doesn't correctly override the parent one ? Why the place of my css element affect the result (I know the place affect if you override a property, but here it doesn't look like this...)
Thansk again for you help.

A: I finally overcame this issue by reviewing my style sheet loading priority and so on.
Thanks everyone.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Laravel 5.3 inner join not working properly I'm having two tables as 'jobs' and 'desired_skills'.
Table structure is as follows.
jobs table
jobs Table
desired_skills table
desired_skils table
where desired_skills.job_id refers to jobs.job id
In controller I have (I am getting $id as an argument from the url, and I can confirm the argument grabs the desired value)
$jobs = DB::table('jobs')->where(function ($query) use ($id) {
    $query->Join('desired_skills', 'desired_skills.job_id', '=', 'jobs.job_id')
    ->where('jobs.employer_id', '=', $id);
    ->select('*')
})->get();

when I dump and die $jobs it only returns values from jobs table.
but when I run the query
SELECT * FROM jobs INNER JOIN desired_skills ON desired_skills.job_id = jobs.job_id it returns the desired value set.
What am I doing wrong? Any help will be greatly appreciated.

A: I think it has to do with wrapping your join inside of a where clause.  I don't think it's giving you your desired query with that there.
$jobs = DB::table('jobs')
    ->join('desired_skills', 'desired_skills.job_id', '=', 'jobs.job_id')
    ->where('jobs.employer_id', '=', $id)
    ->get();

A: Try this:
$jobs = DB::table('jobs')
                ->join('desired_skills', 'desired_skills.job_id', '=', 'jobs.job_id')
                ->select('jobs.*', 'desired_skills.*')
                ->get();

A: The query SELECT * FROM jobs INNER JOIN desired_skills ON desired_skills.job_id = jobs.job_id
is not the same has what you are trying to do in the function. In this query there is not
mention of 'employer_id' in the table 'jobs'.
An alternative would be to use eloquent relationships, as refered in a comment.
You need 3 classes in models:
Employer
Job
DesiredSkill
Between Employer and Job -> one-to-many relation (an employer can have multiple jobs).
Between DesiredSkill and Job -> one-to-one relation.
I'm not sure what you are trying to get from the join, but i think that if you implement
the methods that allow the relationships i believe you solve whatever.
class Job extends Model
{

    public function employer()
    {
        return $this->hasOne('App\Job');
    }
}

class Employer extends Model
{

    public function jobs()
    {
        return $this->hasMany('App\Employer');
    }

    public function desiredSkill()
    {
        return $this->hasOne('App\DesiredSkill');
    }
}

class DesiredSkill extends Model
{

    public function job()
    {
        return $this->hasOne('App\DesiredSkill');
    }
}


text:
Q: Evaluate the Limit $\lim_{x\to 0} {\left((e^x - (1+x)) \over x^n\right)}$ Evaluate the Limit:
$$\lim_{x\to 0}  {\left((e^x - (1+x)) \over x^n\right)}$$
I am trying to understand how to do this. I have to use series expansion and not L'Hospital. Any help would be great.
Thanks!
Steve

A: If you can use L'Hospital, it is straightforward. Remember you must differentiate both numerator and denominator separately. If $n > 2$: $$\lim_{x \to 0}\frac{e^x-(1+x)}{x^n} = \lim_{x \to 0}\frac{e^x-1}{nx^{n-1}} = \lim_{x \to 0}\frac{e^x}{n(n-1)x^{n-2}},$$which gives $+\infty$ coming from the right, and can be $+\infty$ or $-\infty$ from the left, depending on the parity of $n$. If $n = 2$ L'Hospital gives $1/2$ as a result.
If $n = 0$ the result is trivially $0$. If $n = 1$ you can break the limit in $$\lim_{x \to 0}\frac{e^x-1}{x} - 1,$$ which is zero by one of the fundamental results.

A: Hint: Use series expansion of $e^x$.
Note that $e^x= 1+x + \frac{x^2}{2!}+\cdots +\frac{x^n}{n!}+\frac{x^{n+1}}{(n+1)!}+\cdots$

A: L'Hospital's Rule:
$$\lim_{x\to 0}  {e^x - (1+x) \over x^n}= \lim_{x\to 0}  {e^x - (1+x) \over x^2}.x^{2-n}=\lim_{x\to 0}  {(e^x - (1+x))' \over (x^2)'}\lim_{x\to 0} x^{2-n}= $$$$=\lim_{x\to 0}  {e^x - 1 \over 2x}\lim_{x\to 0} x^{2-n}= \lim_{x\to 0}  {(e^x - 1)' \over 2(x)'}\lim_{x\to 0} x^{2-n}= \frac{1}{2}\lim_{x\to 0} x^{2-n}.$$
Conclusion:
$0$, for $n<2$;
$\frac{1}{2}$ for $n=2$;
$ \infty$ for $n>2$ even;
there is no limit, for $n>2$ odd .

A: first let us get rid of the easy case of $n \le 0.$ in that case the limit is zero. for the case $n > 0,$ we will make a change of variable $x^n = t, x = t^{1/n}$  so
$$\lim_{x\to 0}  {\left((e^x - (1+x)) \over x^n\right)} =
\lim_{t\to 0}  {\left((e^{t^{1/n}} - (1+t^{1/n})) \over t\right)}
= \lim_{t\to 0}  {\left( t^{2/n} + \cdots\over t\right)}
= \lim_{t\to 0}  t^{(2-n)/n}
$$
so the limit does not exist for $n > 2,$ is $1$ when $n = 2$ and zero for $0 < n < 2$

A: Using the series expansion,
$e^x
=1+x+x^2/2+x^3/6+...
$.
Therefore
$e^x-(1+x)
=x^2/2+x^3/6+...
$
so that
$\frac{e^x-(1+x)}{x^2}
=1/2+x/6+...
$.
From this,
$\lim_{x \to 0}\frac{e^x-(1+x)}{x^n}
=\begin{cases}
0 & n < 2\\
1/2 & n=2\\
\infty & n > 2\\
\end{cases}
$


text:
Q: Can parentheses be used for order of operations in Regex? I think I have my Regex working, but I'm not completely sure.
The regex is:
/(\n([ \t]*)){2,}/

The goal originally is to capture two or more new-lines together, so if someone types \n\n\n\n\n, I can do something with that.
However, I don't want interference between the consecutive new lines like trailing spaces and tabs...
So I still want to be able to catch \n   \t   \n\n  \n.
I'm not sure if the parentheses are overkill.
The outer parenthesis are to signify that I want everything inside:
(\n([ \t]*))

to happen two or more times.
Then, the inner parentheses:
([ \t]*)

are to signify that I want any combination of spaces and tabs ranging from none to infinity trailing a \n to be included in that group. The reason for the inner parentheses is because I don't want it to be interpreted as (\n[ \t])* where the \n is grouped into potentially happening zero to infinity times.
My confusion stems from the fact that parentheses are used for certain things in regex, right? Not sure if it is like math.

A: Disclaimer: "Regex" is not a single thing; rather, it's a family of related notations supported by many different languages and tools. The below explanation pertains to the most widespread forms of regex, such as those of Perl, Java, JavaScript, Python, and PHP.

*

*Yes, parentheses result in grouping, just as in mathematics.

*In addition, parentheses normally "capture" the text they match, allowing the text to be referred to later. For example, /([a-z])\1/ matches a lowercase ASCII letter, followed by the same letter again. (So, it matches ee, but not ef.) You can disable this capturing by writing (?:...) instead of just (...).

*However, just as in mathematics, you don't always need parentheses, because sometimes the default "order of operations" is appropriate. Just as we don't usually write (2x) + 3, because it's equivalent to 2x + 3, we don't usually write \n([ \t]*), because it's equivalent to \n[ \t]*.

A: The inner parens is not necessary. The Kleene star only works on the last match. In this case it is [ \t] not \n[ \t]. Note that in regexp every single non-special character is one match operation. Only when you need multiple characters to be counted as a single match operation would you need to use parens.
So, if you want to do "match newline followed by zero or more whitespace" you do:
\n[ \t]*

But if you want to do "match zero or more newline followed by one whitespace" you do:
(\n[ \t])*


text:
Q: (on the phone) It's Ann you want to speak to. Just one minute, please. I will call her I don't understand the full meaning of below phrase. Could you help me to understand it?
I suggest that the first sentence is about the speaker name who does a call back, isn't it? On the other side another person says: "Just one minute, please. I will call her." And it means that the call back from Ann is waiting some other person: "she". Am I right?

(on the phone) It's Ann you want to speak to. Just one minute, please. I will call her.

Thank you for explanation.

A: This is just my guess.
Suppose that Ann and Betty are sisters and live in the same house. Someone calls that house, and Betty answers the phone. The caller begins speaking to Betty about some matter that ought to be said to Ann instead. Betty tells the caller that he should not say these things to her; he should say them to Ann. "It's Ann you want to speak to."
This could happen because the caller does not know that he should speak to Ann, or because he mistakenly thinks that he is speaking to Ann.
With the next words Betty asks the caller to wait while she brings Ann to the phone. "Just one minute, please. I will call her." She's not calling Ann by making a telephone call; she's just shouting into the hallway "Ann, pick up the telephone, there's a call for you!"

A: To add to Chaim's answer, this happens often in business settings. Ann had called and ordered a new vacuum cleaner to be delivered. They call the number they were given, to say that they don't have it in red, would she like it in blue.
When the phone rings, Betty answers. The man says, "I'm calling about the vacuum you ordered." Betty replies, "Oh, I didn't order a vacuum, Ann did. It's Ann you want to talk to, I will call her."
Which absolutely means, "I will put down the phone and yell for her to pick it up."
(American English interpretation)


text:
Q: Append Jquery Ajax result to existing table I need to place ajax request result to existing table, how can it be done? here is my ajax request
$("input#order").click(function(){
    var idmenu  = $("#idmenu").val();
    var menu    = $("#idmenu :selected").text();
    var qty     = $("#qty").val();

    $.ajax({
        type    :'POST',
        url     :'<?php echo base_url();?>index.php/welcome/process',
        data    :'idmenu='+idmenu+'&menu='+menu+'&qty='+qty,
        beforeSend:function(){
            $("#result").html('<img src="<?php echo base_url();?>assets/loading.gif"/>');
        },
        success:function(result){
            //result is json format
        }
    });

});

here is the json format from ajax request
{"itemname":"product1","qty":"3","prices":"4500"}

and here is my table format

        order
        qty
        price

    //how to append ajax result here

        <input type="submit"  size="25" id="process" value="Proses"/>

i want to append the result from ajax like

and Not inside the  tag, like

   result is not here

final result look like this one

        order
        qty
        price

        product1
        2
        	4500

        <input type="submit"  size="25" id="process" value="Proses"/>

A: Without knowing the exact format of your JSON, it's hard to give a definitive answer. However, assuming you have a JSON array of objects that represent your rows, you'd need to iterate over that array and for each object do the following:

*

*Create a new
 element - var $tr = $('
');

*For each item of information (I assume one item per ), create a  element and set its content - var $td = $('').html(x.y) (x is your current object, y is a field in the object) then append it to the row - $tr.append($td);.

*Append the row before the last row in the existing table - $('.list-order tr:last').before($tr);
Following from the additional information provided in the question, the following code should do what you need to do:
success: function(result) {
    //result is json format
    var $tr = $('
');
    $tr.append($('').html(result.itemname));
    $tr.append($('').html(result.qty));
    $tr.append($('').html(result.prices));
    $('.list-order tr:last').before($tr);
}

A: In your ajax success function:
success:function(result){
            //create new tr
            var $tr = $('
');
            //extract value from result and put in tr
            $tr.html(result.someVal);
            //find first
 and append new tr after it
            $('table.list-order tr:first').after($tr);
         }


text:
Q: Error in installing OpenInviter [gmail, yahoomail contacts importer] How to define stats username and password in sqlite3?
I am using the sqlite3 database and openinviter tool. While installing the tool, I encounter the following error.

SQLite is installed. Stats enabled. Please define a stats username and password in config.php

*

*Checking username and private key...   OK

*Checking PHP version... OK

*Checking DOMDocument support... OK

*Checking transport method... libcurl is installed. Using cURL to handle
requests

*SQLite is installed. Stats enabled. Please define a stats username and
password in  config.php

*Checking   write permisions... /tmp
is writable. Using /tmp to store
cookie files and  logs

A: You have to nano config.php from the director for OpenInviter (the same directory where you ran postinstall.php to get the results above.
In config.php you'll see the config options for sqlite username and password.
Hope that helps even though it's way late!


text:
Q: copy image to many folder I wrote a tested working code on reduction of image size which copy from one folder to another, as the image is uploaded. it reduce the image size to width of 300 and height 300.
I will like also to reduce the same image size to  width of 100 and height 100, so I can use the smallest image as profile picture and email inbox image. while the other on image of 300 and height 300 on user album.
I want uploaded image to copy to 2 different size of width 300 and height 300 and of 100 and height 100.
Please help me.
            if(move_uploaded_file($this->tem_path, $terger_path)){
                $exe = explode(".", $this->filename);
                $ext = $exe[1];
                $w = 300;
                $h = 300;
                $target = SITE_ROOT.DS.$this->img_path.DS.$this->filename;
                $newcopy = SITE_ROOT.DS.$this->resize.DS.$this->filename;
                list($w_orig, $h_orig) = getimagesize($target);
                $scale_ratio = $w_orig / $h_orig;
                if (($w / $h) > $scale_ratio) {
                   $w = $h * $scale_ratio;
                } else {
                   $h = $w / $scale_ratio;
                }
                $img = "";
                $ext = strtolower($ext);
                if ($ext == "gif"){
                     $img = imagecreatefromgif($target);
                } else if($ext =="png"){
                     $img = imagecreatefrompng($target);
                } else {
                  $img = imagecreatefromjpeg($target);
                }
                $tci = imagecreatetruecolor($w, $h);
                imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
                if(@imagejpeg($tci, $newcopy, 80)){
                //  return true;
                    $terger_path = SITE_ROOT.DS.$this->img_path.DS.$this->filename;
                    return unlink($terger_path) ? true : false;
                }

            }

A: Well, that's pretty easy:

*

*Do first resize, copy it to first location. Do not delete uploaded file.

*Do second resize, copy to other location.

*Finish with cleaning (if necessary)


text:
Q: Get names of column with max value for each row i need your help, i have a data frame like this
int x  y  z
1   0  1  0
2   1  0  0
3   0  0  1

and the result that i need must be like this
int letter

1    y
2    x
3    z

my code is:
for (i in 1:nrow(samples))
    for(j in 1:ncol(samples))
        if(samples[i,][,j] == 1) print(c(i,names(samples[i,j])))

but it is not showing the second column and i need save in a new data.frame, any suggestion? thanks.

A: You can use max.col:
dat$newcol <- names(DF)[-1][max.col(DF[-1])]

This gives
  int x y z newcol
1   1 0 1 0      y
2   2 1 0 0      x
3   3 0 0 1      z

A: I'm sure there are plenty of ways, but here's one:
samples <- read.table(text="int x  y  z
1   0  1  0
2   1  0  0
3   0  0  1",
header=TRUE)

#  int x y z
#1   1 0 1 0
#2   2 1 0 0
#3   3 0 0 1

data.frame(
 samples[1],
 letter=colnames(samples[-1][apply(samples[-1],1,which.max)])
)

#  int letter
#1   1      y
#2   2      x
#3   3      z

A: A solution to this similar question.
tdf <- data.frame(
  A = c(1,1,0,0),
  B = c(0,0,1,0),
  C = c(0,0,0,1)
)

library(magrittr)

tdf %>%
  lapply(sum) %>%
  (function(x){
    a <- c()
    for(i in 1:length(x)){
      a <- c(a, rep(names(x[i]), x[i]))
    }
    return(a)
  })


text:
Q: How to get Authorization header from response in React with CORS, Spring boot In my project when logging a user in a jwt token gets returned in the response header but I cannot access this header, can anybody tell me how ?
this is my login function
   const username = useRef();
     const password = useRef();
     const navigate = useNavigate();

     function loginHandler() {
               axios.post("/auth/login", {
                    username: username.current.value,
                    password: password.current.value
               })
               .then((response) => {
                    console.log(response.headers)
                    window.localStorage.setItem("token", response.headers.get("Authorization"))
                    navigate("/shoes/mens")
               });
     }

here is the Authorization header of my response so you can see that it does indeed return a jwt token

Security configuration:
@Override
protected void configure(HttpSecurity http) throws Exception {

    http = http.csrf().disable().cors().and();

    http = http.sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and();

    http = http.exceptionHandling()
            .authenticationEntryPoint((request, response, ex) -> {
                response.sendError(HttpServletResponse.SC_UNAUTHORIZED, ex.getMessage());
            }).and();

    http.authorizeRequests()
            .antMatchers("/auth/**").permitAll()
            .antMatchers("/storage/**").hasAuthority("ROLE_EMPLOYEE")
            .anyRequest().authenticated();

    http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);

}

This used to work for me but now when enabline cors.and() in backend it stopped working for me. thanks in advance for you help!

A: I managed to find out how to fix it after hours of searching, for someone with the same problem
create a configuration file that implements WebMvcconfigurer
and overide the addCorsMappings method then in the exposed headers u put the headers u want to expose eg Authorization `
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .exposedHeaders("Authorization");
    }
}


text:
Q: How can I create a pie chart in a report combining two datasets in Visual Studio? My question is exactly the one I used for title. I've got an .rdl file with two datasets that are really hard to combine in one script, so I want to create a pie chart using both of them as individual datasets. I need to find the percentages of an addition of two things (one from the first dataset and one from the second), so basically i need this addition and then a division like the next one:
(first_thing+second_thing)/(sum(first_thing)+sum(second_thing))
for example I have dog_sales in the one table and cat_sales on the other and I need to do a pie chart with the percentages of the sales of both dogs and cats for this month.
How can I do it?

A: I don't know of a way to join two datasets together in one pie chart.  Instead I would recommend joining your datasets into one new dataset that can be used by the pie chart.
Using your example of cat vs dog sales by month I have created an example of how to join 2 datasets together.
You can use the "total_sales" column in the final query to populate your pie chart values and you can use "month_of_sale" as the series group.
-- Create temp table to store Cat sales data
DECLARE @catSales TABLE(
        Sales INT
        , MonthOfSale INT);

-- Create temp table to store Dog sales data
DECLARE @dogSales TABLE(
        Sales INT
        , MonthOfSale INT)

--Populate cat sales table with data
INSERT INTO @catSales
        ( Sales, MonthOfSale )
VALUES  ( 50, -- Sales - int
          1  -- MonthOfSale - int
          )
INSERT INTO @catSales
        ( Sales, MonthOfSale )
VALUES  ( 100, -- Sales - int
          2  -- MonthOfSale - int
          )
INSERT INTO @catSales
        ( Sales, MonthOfSale )
VALUES  ( 75, -- Sales - int
          3  -- MonthOfSale - int
          )

--Populate dog sales table with data
INSERT INTO @dogSales
        ( Sales, MonthOfSale )
VALUES  ( 150, -- Sales - int
          1  -- MonthOfSale - int
          )
INSERT INTO @dogSales
        ( Sales, MonthOfSale )
VALUES  ( 80, -- Sales - int
          3  -- MonthOfSale - int
          )
INSERT INTO @dogSales
        ( Sales, MonthOfSale )
VALUES  ( 200, -- Sales - int
          4  -- MonthOfSale - int
          )

--View data in cat sales table (note that months 1, 2, and 3 are all populated with data, but not month 4.
SELECT Sales
    , MonthOfSale
FROM @catSales

--View data in dog sales table (note that months 1, 3, and 4 are all populated with data, but not month 2.
SELECT Sales
    , MonthOfSale
FROM @dogSales

--Join the data from Cat and Dog sales together based on the month
SELECT cs.sales AS 'cat_sales'
    , ds.sales AS 'dog_sales'
    , ISNULL(cs.sales, 0) + ISNULL(ds.sales, 0) AS 'total_sales' -- Use ISNULL to convert missing data into 0 so that it adds correctly
    , ISNULL(cs.MonthOfSale, ds.MonthOfSale) AS 'month_of_sale' -- If there are not cat sales, then the cs.MonthOfSale will be null and ds.MonthOfSale should be used instead
FROM @catSales cs
    FULL OUTER JOIN @dogSales ds ON cs.MonthOfSale = ds.MonthOfSale --   Use full outer join to include all data from both tables


text:
Q: Java slack sdk client how to make the call async I'm trying to make a call by using slack's sdk client in java in order to get user's id by using the email name. The slack client returns CompletableFuture object. I can get the user_name if i use get() method but as far as i understand, it's a synchronous function and it will make the application slower. Is there another way to make this call asynchronous?
public static String lookUpUserId(String email) throws ExecutionException, InterruptedException {

       CompletableFuture<UsersLookupByEmailResponse> response = slackClient.usersLookupByEmail(r -> r
        .email(email));

       UsersLookupByEmailResponse data = response.get();

       return data.getUser().getId();
}

I tried using supplyFunc and thenApply like this but it gives an error saying 'missing return statement' although i return a value. I'm just concerned about the performance and curious if there's a a better way to handle this. Thanks
response.thenApply(r->r.getUser().getId());

A: Since the call returns CompletableFuture, it is alredy asynchronous. Yes, get() method is a synchronous function. Using it will NOT make the application slower, it will make application consume more memory. Asynchronous access like
   response.thenApply(r->r.getUser().getId());

looks correct.
The reason of error message is that the method lookUpUserId is declared as returning String and so must have a return staement. If you want to make it asynchronous, then declare it as returning CompletableFuture<String> and add return statement
 return response.thenApply(r->r.getUser().getId());

A: I don't know much specifically about the slack api but some information can be found in this answer with regards to housing your function in a class that implements Runnable.
Make your `CompletableFuture` in the constructor and run your gets in `run()`.

In my opinion it is a best practice to process all of your api requests off of the main thread but you should know that running some single thing in a separate thread on one line and joining that thread back on the next is only going to add a little overhead without any performance advantages. If you are processing a batch of requests you should start each on independent threads with a for loop and join them all together after.

I'm also noticing that my referenced answer doesn't really cover thread joins for retrieving your results sooo you will probably also find this informative.  And if you havn't learned about object oriented programming yet that's ok! you'll be writing your own classes in no time.
Edit: Ask for code if you need it, It's better if you write it yourself.


text:
Q: stream_socket_client - php_network_getaddresses: getaddrinfo failed: Name or service not known function drupal_http_request($url, array $options = array()) {
  // Allow an alternate HTTP client library to replace Drupal's default
  // implementation.
  $override_function = variable_get('drupal_http_request_function', FALSE);
  if (!empty($override_function) && function_exists($override_function)) {
    return $override_function($url, $options);
  }

  $result = new stdClass();

  // Parse the URL and make sure we can handle the schema.
  $uri = @parse_url($url);

  if ($uri == FALSE) {
    $result->error = 'unable to parse URL';
    $result->code = -1001;
    return $result;
  }

  if (!isset($uri['scheme'])) {
    $result->error = 'missing schema';
    $result->code = -1002;
    return $result;
  }

  timer_start(__FUNCTION__);

  // Merge the default options.
  $options += array(
    'headers' => array(),
    'method' => 'GET',
    'data' => NULL,
    'max_redirects' => 3,
    'timeout' => 30.0,
    'context' => NULL,
  );

  // Merge the default headers.
  $options['headers'] += array(
    'User-Agent' => 'Drupal (+http://drupal.org/)',
  );

  // stream_socket_client() requires timeout to be a float.
  $options['timeout'] = (float) $options['timeout'];

  // Use a proxy if one is defined and the host is not on the excluded list.
  $proxy_server = variable_get('proxy_server', '');
  if ($proxy_server && _drupal_http_use_proxy($uri['host'])) {
    // Set the scheme so we open a socket to the proxy server.
    $uri['scheme'] = 'proxy';
    // Set the path to be the full URL.
    $uri['path'] = $url;
    // Since the URL is passed as the path, we won't use the parsed query.
    unset($uri['query']);

    // Add in username and password to Proxy-Authorization header if needed.
    if ($proxy_username = variable_get('proxy_username', '')) {
      $proxy_password = variable_get('proxy_password', '');
      $options['headers']['Proxy-Authorization'] = 'Basic ' . base64_encode($proxy_username . (!empty($proxy_password) ? ":" . $proxy_password : ''));
    }
    // Some proxies reject requests with any User-Agent headers, while others
    // require a specific one.
    $proxy_user_agent = variable_get('proxy_user_agent', '');
    // The default value matches neither condition.
    if ($proxy_user_agent === NULL) {
      unset($options['headers']['User-Agent']);
    }
    elseif ($proxy_user_agent) {
      $options['headers']['User-Agent'] = $proxy_user_agent;
    }
  }

  switch ($uri['scheme']) {
    case 'proxy':
      // Make the socket connection to a proxy server.
      $socket = 'tcp://' . $proxy_server . ':' . variable_get('proxy_port', 8080);
      // The Host header still needs to match the real request.
      $options['headers']['Host'] = $uri['host'];
      $options['headers']['Host'] .= isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';
      break;

    case 'http':
    case 'feed':
      $port = isset($uri['port']) ? $uri['port'] : 80;
      $socket = 'tcp://' . $uri['host'] . ':' . $port;
      // RFC 2616: "non-standard ports MUST, default ports MAY be included".
      // We don't add the standard port to prevent from breaking rewrite rules
      // checking the host that do not take into account the port number.
      $options['headers']['Host'] = $uri['host'] . ($port != 80 ? ':' . $port : '');
      break;

    case 'https':
      // Note: Only works when PHP is compiled with OpenSSL support.
      $port = isset($uri['port']) ? $uri['port'] : 443;
      $socket = 'ssl://' . $uri['host'] . ':' . $port;
      $options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
      break;

    default:
      $result->error = 'invalid schema ' . $uri['scheme'];
      $result->code = -1003;
      return $result;
  }

  if (empty($options['context'])) {
    $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout']);
  }
  else {
    // Create a stream with context. Allows verification of a SSL certificate.
    $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_CONNECT, $options['context']);
  }
  var_dump($fp);

  // Make sure the socket opened properly.
  if (!$fp) {
    // When a network error occurs, we use a negative number so it does not
    // clash with the HTTP status codes.
    $result->code = -$errno;
    $result->error = trim($errstr) ? trim($errstr) : t('Error opening socket @socket', array('@socket' => $socket));
    print_r($result);
    exit();

    // Mark that this request failed. This will trigger a check of the web
    // server's ability to make outgoing HTTP requests the next time that
    // requirements checking is performed.
    // See system_requirements().
    variable_set('drupal_http_request_fails', TRUE);

    return $result;
  }

  // Construct the path to act on.
  $path = isset($uri['path']) ? $uri['path'] : '/';
  if (isset($uri['query'])) {
    $path .= '?' . $uri['query'];
  }

  // Only add Content-Length if we actually have any content or if it is a POST
  // or PUT request. Some non-standard servers get confused by Content-Length in
  // at least HEAD/GET requests, and Squid always requires Content-Length in
  // POST/PUT requests.
  $content_length = strlen($options['data']);
  if ($content_length > 0 || $options['method'] == 'POST' || $options['method'] == 'PUT') {
    $options['headers']['Content-Length'] = $content_length;
  }

  // If the server URL has a user then attempt to use basic authentication.
  if (isset($uri['user'])) {
    $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : ':'));
  }

  // If the database prefix is being used by SimpleTest to run the tests in a copied
  // database then set the user-agent header to the database prefix so that any
  // calls to other Drupal pages will run the SimpleTest prefixed database. The
  // user-agent is used to ensure that multiple testing sessions running at the
  // same time won't interfere with each other as they would if the database
  // prefix were stored statically in a file or database variable.
  $test_info = &$GLOBALS['drupal_test_info'];
  if (!empty($test_info['test_run_id'])) {
    $options['headers']['User-Agent'] = drupal_generate_test_ua($test_info['test_run_id']);
  }

  $request = $options['method'] . ' ' . $path . " HTTP/1.0\r\n";
  foreach ($options['headers'] as $name => $value) {
    $request .= $name . ': ' . trim($value) . "\r\n";
  }
  $request .= "\r\n" . $options['data'];
  $result->request = $request;
  // Calculate how much time is left of the original timeout value.
  $timeout = $options['timeout'] - timer_read(__FUNCTION__) / 1000;
  if ($timeout > 0) {
    stream_set_timeout($fp, floor($timeout), floor(1000000 * fmod($timeout, 1)));
    fwrite($fp, $request);
  }

  // Fetch response. Due to PHP bugs like http://bugs.php.net/bug.php?id=43782
  // and http://bugs.php.net/bug.php?id=46049 we can't rely on feof(), but
  // instead must invoke stream_get_meta_data() each iteration.
  $info = stream_get_meta_data($fp);
  $alive = !$info['eof'] && !$info['timed_out'];
  $response = '';

  while ($alive) {
    // Calculate how much time is left of the original timeout value.
    $timeout = $options['timeout'] - timer_read(__FUNCTION__) / 1000;
    if ($timeout <= 0) {
      $info['timed_out'] = TRUE;
      break;
    }
    stream_set_timeout($fp, floor($timeout), floor(1000000 * fmod($timeout, 1)));
    $chunk = fread($fp, 1024);
    $response .= $chunk;
    $info = stream_get_meta_data($fp);
    $alive = !$info['eof'] && !$info['timed_out'] && $chunk;
  }
  fclose($fp);

  if ($info['timed_out']) {
    $result->code = HTTP_REQUEST_TIMEOUT;
    $result->error = 'request timed out';
    return $result;
  }
  // Parse response headers from the response body.
  // Be tolerant of malformed HTTP responses that separate header and body with
  // \n\n or \r\r instead of \r\n\r\n.
  list($response, $result->data) = preg_split("/\r\n\r\n|\n\n|\r\r/", $response, 2);
  $response = preg_split("/\r\n|\n|\r/", $response);

  // Parse the response status line.
  $response_status_array = _drupal_parse_response_status(trim(array_shift($response)));
  $result->protocol = $response_status_array['http_version'];
  $result->status_message = $response_status_array['reason_phrase'];
  $code = $response_status_array['response_code'];

  $result->headers = array();

  // Parse the response headers.
  while ($line = trim(array_shift($response))) {
    list($name, $value) = explode(':', $line, 2);
    $name = strtolower($name);
    if (isset($result->headers[$name]) && $name == 'set-cookie') {
      // RFC 2109: the Set-Cookie response header comprises the token Set-
      // Cookie:, followed by a comma-separated list of one or more cookies.
      $result->headers[$name] .= ',' . trim($value);
    }
    else {
      $result->headers[$name] = trim($value);
    }
  }

  $responses = array(
    100 => 'Continue',
    101 => 'Switching Protocols',
    200 => 'OK',
    201 => 'Created',
    202 => 'Accepted',
    203 => 'Non-Authoritative Information',
    204 => 'No Content',
    205 => 'Reset Content',
    206 => 'Partial Content',
    300 => 'Multiple Choices',
    301 => 'Moved Permanently',
    302 => 'Found',
    303 => 'See Other',
    304 => 'Not Modified',
    305 => 'Use Proxy',
    307 => 'Temporary Redirect',
    400 => 'Bad Request',
    401 => 'Unauthorized',
    402 => 'Payment Required',
    403 => 'Forbidden',
    404 => 'Not Found',
    405 => 'Method Not Allowed',
    406 => 'Not Acceptable',
    407 => 'Proxy Authentication Required',
    408 => 'Request Time-out',
    409 => 'Conflict',
    410 => 'Gone',
    411 => 'Length Required',
    412 => 'Precondition Failed',
    413 => 'Request Entity Too Large',
    414 => 'Request-URI Too Large',
    415 => 'Unsupported Media Type',
    416 => 'Requested range not satisfiable',
    417 => 'Expectation Failed',
    500 => 'Internal Server Error',
    501 => 'Not Implemented',
    502 => 'Bad Gateway',
    503 => 'Service Unavailable',
    504 => 'Gateway Time-out',
    505 => 'HTTP Version not supported',
  );
  // RFC 2616 states that all unknown HTTP codes must be treated the same as the
  // base code in their class.
  if (!isset($responses[$code])) {
    $code = floor($code / 100) * 100;
  }
  $result->code = $code;

  switch ($code) {
    case 200: // OK
    case 304: // Not modified
      break;
    case 301: // Moved permanently
    case 302: // Moved temporarily
    case 307: // Moved temporarily
      $location = $result->headers['location'];
      $options['timeout'] -= timer_read(__FUNCTION__) / 1000;
      if ($options['timeout'] <= 0) {
        $result->code = HTTP_REQUEST_TIMEOUT;
        $result->error = 'request timed out';
      }
      elseif ($options['max_redirects']) {
        // Redirect to the new location.
        $options['max_redirects']--;
        $result = drupal_http_request($location, $options);
        $result->redirect_code = $code;
      }
      if (!isset($result->redirect_url)) {
        $result->redirect_url = $location;
      }
      break;
    default:
      $result->error = $result->status_message;
  }

  return $result;
}

I'm getting the below mentioned message by doing var_dump of $fp as mentioned above on my VM machine hosted with Ubuntu 14.04
stdClass Object
(
    [code] => 0
    [error] => php_network_getaddresses: getaddrinfo failed: Name or service not known
)

When I'm implementing the same thing on my localhost which is XAMPP based in Windows 7 I'm getting this:
Resource id #8

Due to this I'm unable to use the drupal_http_request
As per your suggestion I've tried dns_get_record()
$dns_get_record = dns_get_record("www.google.com");
print_r($dns_get_record);

and got this as the output:
Array
(
    [0] => Array
        (
            [host] => www.google.com
            [class] => IN
            [ttl] => 243
            [type] => A
            [ip] => 216.58.220.4
        )

    [1] => Array
        (
            [host] => www.google.com
            [class] => IN
            [ttl] => 257
            [type] => AAAA
            [ipv6] => 2404:6800:4009:805::2004
        )

)

I've also checked the stream_socket_client()
var_dump(stream_socket_client());

and it returned me bool(false)

A: Since you've not put any proper error handling in the code, we can't tell which function is being executed. You haven't provided the parameters you are passing, so we can't tell what the cause is, but the most likely issue is that you are trying to establish a network connection and the host where the code is running is unable to resolve the hostname inside $socket.
You can very this with dns_get_record() or speak to your hosting provider.


text:
Q: Enabling and Disabling Radio Buttons Depending on User Selection I'm looking to write jQuery to only enable radio buttons depending on which radio buttons are currently selected in accordance with some business logic.
Essentially there are 3 groups of 3 radio buttons, which end up looking something like (my apologies for being verbose with this example HTML, but hoping this will show what I mean):

  Group One

      Choice One

      <input checked="checked" id="choice_one" type="radio" value="1" />

      Choice Two

      <input id="group_one_choice_two" type="radio" value="2" />

      Choice Three

      <input id="choice_three" type="radio" value="3"/ >

  Group Two

      Choice One

      <input checked="checked" id="choice_one" type="radio" value="1" />

      Choice Two

      <input id="group_two_choice_two" type="radio" value="2" />

      Choice Three

      <input id="choice_three" type="radio" value="3"/ >

  Group Three

      Choice One

      <input checked="checked" id="choice_one" type="radio" value="1" />

      Choice Two

      <input id="group_three_choice_two" type="radio" value="2" />

      Choice Three

      <input id="choice_three" type="radio" value="3"/ >

Where it gets tricky is the logic needed to determine which radio buttons to display and which to enable. A user must select one choice from each group, but cannot repeat the same choice from one group to another.
Ideally when the user gets to the page, all of the radio buttons would be available but unselected.
If the user were to first select (for example) Choice Two in Group Three, the script should then disable Choice Two in both Group One and Group Two. If the user then selects Choice Three in Group Two, it should then only enable Choice One in Group One, and so on.
Any help would be very, very much appreciated. I would post the jQuery I've been attempting to write to solve this problem but I don't think I've been going about this very well and would love any help working through it.  Thanks!

A: I'd skip the special classes.
$("input[type=radio]").click(function() {
  $("input[type=radio][value=" + $(this).val() + "]").attr("disabled", "disabled");
  $(this).removeAttr("disabled");
});

Depending on your requirements you might not need the last line - it just re-enables the current radio. Your html is also missing names for your radio buttons.

A: You might be able to use something like (I haven't tested this, it's just to get the ball rolling...)
The idea is: whenever you click on a radio, disable all the radios in all the groups with that value, except the one that was just clicked.
$(document).ready(function() {
    $("input[type=radio]").click(function() {
        var val = $(this).val();
        var $all_radios = $("input[type=radio]").filter("[value=" + val + "]");
        $all_radios.not($(this)).attr('disabled', 'disabled');
        return true;
    });
});

A: Done & tested, here's the jQuery:
$(document).ready(function() {
    $('input:radio').click(function() {
       //reset all the radios
       $('input:radio').removeAttr('disabled');
       if($(this).is(':checked')) {
           var val = $(this).val();
           //disable all the ones with the same value
           $('input:radio').each(function() {
               if(val == $(this).val()) {
                   $(this).attr('disabled',true);
               }
           });
           //let's not disable the one we have just clicked on
           $(this).removeAttr('disabled');
       }
    });
});

and the modded markup:

  Group One

      Choice One

      <input checked="checked" name="group_one" type="radio" value="1" />

      Choice Two

      <input name="group_one" type="radio" value="2" />

      Choice Three

      <input name="group_one" type="radio" value="3"/ >

  Group Two

      Choice One

      <input checked="checked"  name="group_two"  type="radio" value="1" />

      Choice Two

      <input name="group_two" type="radio" value="2" />

      Choice Three

      <input name="group_two" type="radio" value="3"/ >

  Group Three

      Choice One

      <input checked="checked" name="group_three" type="radio" value="1" />

      Choice Two

      <input name="group_three" type="radio" value="2" />

      Choice Three

      <input name="choice_three" type="radio" value="3"/ >

Changes to the markup:

*

*Got rid of the inner DIV IDs.

*Changed the ID attributes of the
radios to NAME, so they behave like
radio buttons.

A: Firstly, you really shoudln't have duplicate ids in your code.
I would make all the IDs unique, and then give your radioboxes a class name - class="choice_three" for example.
You can give your divs an id, selecting by an id is faster than class, so id="group_three" for example.
Then to select a radio button, simply use the following code:
$("#group_three .choice_three").attr("disabled", "disabled");

Note, the space between #group_three and .choice_three is important.
Or even faster:
$("#group_three input:radio.choice_three").attr("disabled", "disabled");

Another thing to note as well, the label "for" should be for the radio button, not the div.

A: If you add speial classes to same choices, e.g. class="choice_one", and then in your event handler you can:
if ($this).hasClass("choice_one") { $(".choice_one").attr("disabled", "disabled"); }
else if ($this).hasClass("choice_two") { ... }
...


text:
Q: Play/Ebean not fetching all attributes of ManyToOne related object I have a Play 2.2 application, and I'm using ebean 3.2.2.
I have two tables: UserModel and Schedule.  A UserModel can have one Schedule, and a Schedule can have many UserModels.
Here is what the classes look like:
@Entity
public class UserModel extends Model {
    @Id
    public String email;
    public String other, attributes;

    @ManyToOne
    public Schedule defaultSchedule;

    @OneToMany
    public List<Task> tasks;
}

@Entity
public class Schedule extends Model {

    @Id
    public Long id;

    @OneToMany
    public List<UserModel> owners;

    public String other, attributes;
}

I'll do an update to the UserModel like so:
userModel.defaultSchedule = newSchedule;
userModel.update();

And when I run a query:
UserModel.find.where().eq("email", email).findUnique()

I look inside UserModel.defaultSchedule and find that only the Id is populated.  The rest of the fields are all null, and this is the problem I'm trying to solve.
The reason this is particularly baffling to me, is that I have another class:
@Entity
public class Task extends Model {

    @Id
    public Long taskId;
    public Boolean completed;

    @ManyToOne
    public UserModel assignedTo;

}

When I do a query for this type of object like so:
Task.find.where().eq("assignedTo.email", email).eq("completed", false).findList();

I'm finding that all of the fields of Task.assignedTo are populated (not just the Id).
Why are the fields populated in this case, but not the first case?

A: The solution is in how I was doing the query.  I was able to retrieve all of the attributes of the related object by adding a fetch to the query:
UserModel.find.fetch("defaultSchedule").where().eq("email", email).findUnique();


text:
Q: How to store a value in Android? I'm developing some apps, I need store the count of absents student for last day. I don't want to mess up with database. I need a way to store a integer and retrieve it after its next launch. Kindly help me

A: You can use android SharedPreferences
For more details see below links:
SharedPreferences
Android - Shared Preferences - tutorialspoin


text:
Q: "assertEquals is not defined" in WebDriverJS compiled I've a problem with the webDriverJS library.
I've downloaded the project and built the js file "webdriver.js" as explained in the wiki and in this post Selenium WebDriverJS Using in Browser
But my problem is I can't use the function "assertEquals".
I've the error
"assertEquals is not defined"

Did you know how include the units testing functions in the build file?
Thx

A: You could get inspiration from the following code that shows an example of WebDriverJS with Jasmine for the assertion: https://github.com/ericminio/webdriverjs-with-jasmine
Hope it helps

A: I believe the assertEquals function referenced in the WebDriverJS documentation is simply used for demonstration purposes. It isn't part of the webdriverJS library and is something you need to either implement yourself or replace with an assertion library. Hence the error message that it is not defined.
Here is a pretty exhaustive list of assertion libraries you can use: standalone assertion libraries?


text:
Q: Modify columns using stored procedure in SQL Server I wish to modify strings in several columns (for example all columns containing the 'sound' string), for example replacing ',' by '.'. Further to this post, I understand I have to use dynamic SQL. I created the following procedure:
USE [myDB]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[RemoveStringInColumn] (@colName varchar(50), @tableName varchar(50), @to_remove varchar(50), @to_add varchar(50))
AS

DECLARE @sql nvarchar(4000)
SET @sql = 'UPDATE ' + @tableName + ' SET ' + @colName + ' = REPLACE(' + @colName + ',' + @to_remove + ','+ @to_add + ');'
PRINT @sql
EXEC sp_executesql @sql

Which is called by:
EXEC dbo.RemoveStringInColumn 'COL_1', 'TABLE_1', ',', '.'

1) The problem is the @sql command does not contain the little hyphen arond the comma and the dot. How can I solve this?
2) In this post they use a SELECT command to fetch all column names. So far, I managed to fetch column names containing 'sound'.
select COLUMN_NAME AS my_cols
from INFORMATION_SCHEMA.COLUMNS
where table_name = 'TABLE_1' AND COLUMN_NAME LIKE '%sound%'

How can I put column names into a list and use a for loop to go through them calling the RemoveStringInColumn procedure?
Thanks

A: Just double the single quotes around @to_remove and @to_add
DECLARE @sql NVARCHAR(4000)

SET @sql = 'UPDATE ' + Quotename(@tableName) + ' SET ' + Quotename(@colName)
           + ' = REPLACE(' + Quotename(@colName) + ',''' + @to_remove + ''','''
           + @to_add + ''');'

PRINT @sql

EXEC Sp_executesql
  @sql

Update : To do the replace for more than one column
DECLARE @sql       NVARCHAR(4000),
        @col_list  VARCHAR(8000)= ''

SET @col_list = (SELECT ',' + Quotename(COLUMN_NAME) + ' = REPLACE('
                        + Quotename(COLUMN_NAME) + ',''' + @to_remove
                        + ''',''' + @to_add + ''')'
                 FROM   INFORMATION_SCHEMA.COLUMNS
                 WHERE  table_name = 'TABLE_1'
                        AND COLUMN_NAME LIKE '%sound%'
                 FOR xml path(''))
SET @col_list = Stuff(@col_list, 1, 1, '')

SELECT @col_list

SET @sql = 'UPDATE ' + Quotename(@tableName) + ' SET '
           + @col_list

PRINT @sql

EXEC Sp_executesql
  @sql


text:
Q: Swift Package minimum ios version I've created my package which I would like to use in my projects. In the package, I'm using UIStackView. When I adding the package to the project and running it I get errors 'UIStackView' is only available in iOS 9.0 or newer.
Why I get this error if my project iOS target sitting set to 9.0? How can I solve this problem without making iOS 8 support in the package?

A: Supported platforms and their versions can be added by platforms parameter of Package initializer inside the Package.swift file:
let package = Package(
    name: "Package Name",
    platforms: [.iOS(.v13)]
    // ...
)

A: UIStackView introduced in iOS 9 so if your project supports iOS 8 too then UIStackView will be not available for iOS 8. So add check like below
if #available(iOS 9, *) {
         //UIStackView code
} else {
         // any other alternative
}


text:
Q: count consecutive occurrences of discrete value I have below table and I want to count the consecutive days for each name and each flag.
Name        Date            Flag
-------------------------------------
Alberta    01-01-2018       B

Alberta    02-01-2018       B

Alberta    03-01-2018       B

Alberta    04-01-2018       L

Alberta    05-01-2018       L

Ambelos    01-01-2018       B

Ambelos    02-01-2018       B

Ambelos    03-01-2018       L

Ambelos    04-01-2018       B

I want the below
Name          Date            Flag     CountDays
----------------------------------------------------
Alberta      03-01-2018        B          3

Alberta      05-01-2018        L          2

Ambelos      02-01-2018        B          2

Ambelos      03-01-2018        L          1

Ambelos      04-01-2018        B          1

How can I do this?

A: You could use TABIBITOSAN technique
SQL Fiddle
PostgreSQL 9.6 Schema Setup:
CREATE TABLE t
    (Name varchar(7), dt timestamp, Flag varchar(1))
;

INSERT INTO t
    (Name, dt, Flag)
VALUES
    ('Alberta', '2018-01-01 00:00:00', 'B'),
    ('Alberta', '2018-02-01 00:00:00', 'B'),
    ('Alberta', '2018-03-01 00:00:00', 'B'),
    ('Alberta', '2018-04-01 00:00:00', 'L'),
    ('Alberta', '2018-05-01 00:00:00', 'L'),
    ('Ambelos', '2018-01-01 00:00:00', 'B'),
    ('Ambelos', '2018-02-01 00:00:00', 'B'),
    ('Ambelos', '2018-03-01 00:00:00', 'L'),
    ('Ambelos', '2018-04-01 00:00:00', 'B')
;

Query 1:
SELECT name,
       Max(dt) AS "Date",
       flag,
       Count(*) As CountDays
FROM   (SELECT t.*,
               row_number()
                 over (
                   PARTITION BY name
                   ORDER BY dt ) - row_number()
                                     over (
                                       PARTITION BY name, flag
                                       ORDER BY dt ) AS seq
        FROM   t) s
GROUP  BY name,
          flag,
          seq
ORDER  BY name,"Date"

Results:
|    name |                 Date | flag | countdays |
|---------|----------------------|------|-----------|
| Alberta | 2018-03-01T00:00:00Z |    B |         3 |
| Alberta | 2018-05-01T00:00:00Z |    L |         2 |
| Ambelos | 2018-02-01T00:00:00Z |    B |         2 |
| Ambelos | 2018-03-01T00:00:00Z |    L |         1 |
| Ambelos | 2018-04-01T00:00:00Z |    B |         1 |


text:
Q: I can't get vertical scrolling on my flexdashboard I'm trying to set up a flexdashboard to convey some information and am having some problems with scrolling. Putting vertical_layout: scroll in the header does no good, it leads to the flexdashboard cutting off halfway down the page. When I set vertical_layout fill, I can see more info, but it still goes off the page. In neither case is a vertical (or horizontal) scrollbar available to enable the user to see the cut-off information.
Although I have more text than below, this is illustrative of the problem. Does anyone know why this may be happening or if there might be any ways around it? I'm using a tablet currently but have tried using standard columns with no success. The problem is on Page 2. Thanks.
---
title: "title"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
---

Introduction
===

Column
---

* some text

Page 2
===

Column {.tabset}
---

### h3
* test

#### h4
* text

#### h4
* text

### h3

#### h4
* some text

#### h4
* some text


text:
Q: How to preven flutter desktop app the first launch it will show the Native Style of windows for a second When I launch a flutter desktop app it always show the Native Style of windows for a second,and then show the style I expected, how can I pretend the action
the Native Style window

the expected first window


text:
Q: Continuous image of a locally compact space is not necessarily locally compact
A topological space is said to be locally compact if each point $x\in X$ has at least one neighbourhood which is compact.
  Prove continuous image of a locally compact space is not necessarily locally compact.

Attempted solution:
I was able to find a counter example I believe:
$g:(X',\tau')\to(Y',\tau'')$ where $\tau$ is the discrete topology and $\tau_2$ is the indiscrete topology where $Y'$ is infinite, hence it is not compact(there is no finite open set but $\emptyset$).
However I am striving to see why the image is not necessarily locally compact.
Admitting $f:(X,\tau)\to (Y,\tau_1)$ is a continuous function. Then if $y\in Y$ then $f^{-1}(y)=x$ since $(X,\tau)$ is locally compact then  $x\in U$ such that $U$ is compact. Them image of a compact set is a compact set so $y\in f(U)$ so that $f(U)$ is compact. So the image is locally compact.
Question:
1) Since the author states not "necessarily compact". What am I missing?
2) Is my counterexample right?
Thanks in advance!

A: Your counterexample is wrong because the indiscrete topology is locally compact in your definition, but it can be fixed:
If $\tau_d$ is the discrete topology on a set $X$ then $f(x)=x$ is continuous
as a map between $(X,\tau_d)$ to $(X,\tau)$ where $\tau$ is any topology on $X$ we like. This observation does hold.
Also, $(X,\tau_d)$ is locally compact as every point $x$ has the compact neighbourhood $\{x\}$ in $\tau_d$.
So let $(X,\tau)$ be any non-locally compact topology. (Like $\mathbb{Q}$ in the standard topology inherited from $\mathbb{R}$ (or its order)) and use that special case. The same "example template" can also be used for metrisable spaces, locally connected spaces etc.
So you then have shown that the continuous image of a locally compact space is not necessarily locally compact (you have at least one concrete example where this is not the case). E.g. the continuous image of a compact space is "necessarily compact", because there is a theorem that says so.

A: Your example is wrong because every subset is compact in indiscrete topology. Also in the proof that follows $f(U)$ is compact but it need not be a neighborhood of $y$.


text:
Q: Seleccionar primera pantalla con api google Buen día
Un cliente me ha solicitado que ha la captura de la pantalla en full screen del navegador , estoy usando la librería RecordRTC.js que tiene integrado el uso de la api de google para compartir pantalla, pero lo que quiere el cliente es que por defecto seleccione la primer pantalla y no aparezca el cuadro de dialogo siguiente:

Como comento quiero que inmediatamente capture la pantalla 1 es decir en este caso que esta integrada a la computadora
Vi en Internet que se puede hacer uso del atributo deviceId pero como se obtiene o se integra lo tengo de esta manera
function invokeGetDisplayMedia(success, error) {

   if(navigator.mediaDevices.getDisplayMedia) {
    var displaymediastreamconstraints = {
        video: {
          "aspectRatio": 1.7777777777777777,
          "deviceId": "screen:0:0",
          "frameRate": 30,
          "height": 1080,
          "resizeMode": "crop-and-scale",
          "width": 1920,
            displaySurface: 'monitor',
            logicalSurface: true,
            "frameRate": 30,
            cursor: 'always',
        }
    };

    displaymediastreamconstraints = {
        "aspectRatio": 1.7777777777777777,
      "deviceId": "screen:0:0",
      "frameRate": 30,
      "height": 1080,
      "resizeMode": "crop-and-scale",
      "width": 1920,
      "cursor": "always",
      "displaySurface": "monitor",
      "logicalSurface": true,
        video: true,
    };

        navigator.mediaDevices.getDisplayMedia(displaymediastreamconstraints).then(success).catch(error);
    }
    else {
        navigator.getDisplayMedia(displaymediastreamconstraints).then(success).catch(error);
    }
}

Gracias y buen día :D

A: Buen día ya se me respondió mejor en la versión de ingles de esta pagina , y la respuesta es que no se puede ya que la ventana esta solicitando al usuario permiso de compartir la venta, para mas detalles dejo el link donde se me pudo responder esta duda:
https://stackoverflow.com/questions/63564370/select-first-monitor-api-google


text:
Q: Specify width and height of an image in php I created a variable in PHP where I store HTML code:
$success = (
"
Result:

        Option1:

        ".
        (100*round($option1/($option1+$option2+$option3),2))." %" ."

        Option2:

        ".
        (100*round($option2/($option1+$option2+$option3),2))." %" ."

        Option3:

        ".
        (100*round($option3/($option1+$option2+$option3),2))." %" ."

This code is shown as a result of a poll and seems to be working so far. The width of 'block.gif' is equivalent to its according value. My problem is that for some reason the height is also rendered the same way, although I set its value to 20px.
I assume the error lies somewhere in the syntax but I just can't find it.

A: This is your code,
width= ".(100*round($option1/($option1+$option2+$option3),2)).
    "height='20px'>".

if the value of that big expression is 10, it'll create,
width= 10height='20px'>

This is the problem. Correct form is,
width='10px' height='20px'>

So you need to change the code accordingly. Just move the space  and add two single quotes.
width='".(100*round($option1/($option1+$option2+$option3),2)).
    "px' height='20px'>".


text:
Q: Codeigniter JQuery Ajax I'm a heavy Codeignitor user and currently I have to build a page with extensive AJAX bits and pieces. I have been using JQuery all along the website and it's AJAX handling was perfect up until now. There is something that just doesn't feel right when i use a MVC with JQuery.
For example:
in Jquery I setup the callback URL easily that point to the controller, the controler then calls a view page and the AJAX is displayed but this view page is very small PHP code.
So now I have about 40 ajax function to do in my page, would that mean I would have to make 40 views?? that doesn't seem right to me.
Is there any better way to handle/manage the views created for the AJAX in MVC Frameworks
Thank you.

A: You could create one view, e.g. ajax.php and set the content accordingly in the methods of the controllers. All methods can use the same view.
The above is only true for similar views, but if the methods are similar as well, then you should think about refactoring your code to using uri parameters, see my answer to a question on how to get parameters from the url.
But all that depends on the nature of the controllers, their methods and the related views.
EDIT:
I do not advise you to use HTML in the controller, but lay out your controller like this:
Class My_Controller
{
    // some other methods
    public function edit_via_ajax($type, $value)
    {
        /* do some stuff with $type and $value,
           sanitize user input etc.
           set $status to TRUE or FALSE */
        $data['type'] = $type;
        $data['value'] = $value;
        if ($status === TRUE)
        {
            $this->load->view('success.php', $data);
        }
        else
        {
            $this->load->view('error.php', $data);
        }
    }
}

Create views like success.php
<?=$type;?> was successfully set to <?=$value;?>

And call it via $.get('/index.php/my_controller/edit_via_ajax/name/John_Doe'); in jquery to edit the name. In that way, lots of similar AJAX requests can share the same method and methods can share views.

A: There is no requirement that an AJAX request must use a view in CI.  Your controller methods do not have to return a view whatsoever, merely some form of echoed data.  If some of your views are very small, or only require a minimum amount of HTML (you can decide what minimum might be), you could simply do one of the following:
public function controllerMethod1() {
    $str = 'some html
';
    $str .= '
and some more
';
    die($str);
}

You can still go about your usual, handling post requests in the model and simply use string identifiers to determine whether database updates are successful or erroneous:
public function controllerMethod2() {
    if ($this->model->addToDatabase(...)) {
        die('success');
    }
    die('error');
}

A: This is what I have reached so far to have one controller and one view.
Is there anything better that could be done?
    /*Controller*/
class C_ajax extends Controller {

    function fn_name(){
        $data['ajaxType'] = __FUNCTION__;
        // write any code here to be passed

        $this->load->view('news/v_news_ajax', $data);
    }
}
/*View*/

<?php
    switch($ajaxType):
        case 'fn_name':?>
            //write HTML here

        <?php break;?>
        <?php case '':?>
            // write HTML for another view here
        <?php break;?>

    <?php endswitch;?>


text:
Q: how to read specific values from text file using c++? I have a textfile as follows:
Value1 = windows
Value2 = Processor
Value3 = pwower plug

Right now i am retrieving complete file as follows:
std::ifstream myfile;
myfile.open( "D:\\values_user.txt", std::ios::in );

if( !(myfile.is_open()) )
{   std::cout << "Error Opening File";
std::exit(0);   }

std::string firstline;

while( myfile.good() )
{
    std::getline( myfile, firstline);
    std::cout<< "\n" << firstline <<"\n";
}

I want to  retrieve window, processor and pwower plug i.e. just want to have values after '='.
So, suggest me how can i achieve this.

A: Just Tokenize your string (firstline) basedd on  the delimeter character (=, in your case).
Here is the example.
strtok


text:
Q: Swagger PHP annotation for object of array I want to include Array of objects in api/doc view. But I am unable to get that.
From the code below:
@SWG\Schema(
  @SWG\Property(property="project-name", type="string"),
  @SWG\Property(property="project-detail", type="array",
    @SWG\Items(type="object",
        @SWG\Property(property="name", type="string", ),
        @SWG\Property(property="category", type="string",),
    ),
    @SWG\Items(type="object",
        @SWG\Property(property="new_name", type="string", ),
        @SWG\Property(property="new_category", type="string",),
    ),
  ),
),

I get the output:
{
  "project-name": "string",
  "project-detail": [
     {
       "name": "string",
       "category": "string"
     }
   ]
}

But I want below one:
{
  "project-name": "string",
  "project-detail": [
     {
       "name": "string",
       "category": "string"
     },
     {
       "new_name": "string",
       "new_category": "string"
     },
   ]
}

Please help me out for this.

A: You can only display one object on the array of objects. Because Swagger has been created to explain what you have to give to the API and what is returned (not required).
When you're looking an array and an object inside, of course you're understanding this isn't an array with 1 object.
Hope it helps !
Lord'

A: Modify your project detail property by adding example ex.
example="{
         {
          "name": "String",
          "category": "String"
         },
         {
          "name": "String",
          "category": "String"
         }
        }"


text:
Q: Deduce that there exists a prime $p$ where $p$ divides $x^2 +2$ and $p≡3$ (mod 4) I am revising for a number theory exam and have a question that I am struggling with, any help would be greatly appreciated.
First I am asked to show that for an odd number $x$, $x^2+2 ≡3$(mod 4).
I can do this part of the question, but next I am asked to deduce that there exists a prime $p$ where $p$ divides $x^2 +2$ and $p≡3$ (mod 4)
I am struggling to see how to attempt the second part and how the first part relates.
My thoughts so far are that I want to show $x^2≡-2$(mod p) ?
 And perhaps Fermat's Little Theorem could be of use here somehow?
Not sure if I'm barking up the wrong tree though.
Thanks in advance.

A: Our number $x^2+2$ is odd, and greater than $1$, so it is a product of odd not necessarily distinct primes. If all these primes were congruent to $1$ modulo $4$, their product would be congruent to $1$ modulo $4$. But you have shown that $x^2+2\equiv 3\pmod{4}$.

A: Consider the prime factorization of $x^2+2$. Since $x$ is odd, $x^2+2$ is odd implying $2$ will not show up in the factorization. Now consider the primes that DO show up in the prime factorization. If they are all $1$ in modulo 4, then their product will also be one in modulo $4$. This is not true though, since you know that $x^2+2$ is $3$ modulo $4$. Therefore, there must be a prime that in the prime factorization of $x^2+2$ s.t. it is not $1$ modulo 4. Since primes other than 2 that are not $1$ modulo 4 are $3$ modulo $4$, this completes the reasoning.

A: The question, as asked, has been answered.  Nevertheless, I'll show how quadratic residues can help in problems like these, and show that moreover $x^2+2$ ($x$ odd) has a prime factor congruent to $3 \!\!\!\mod 8$:
Suppose that $x$ is odd.  If $p$ divides $x^2+2$, then $p$ is odd and $x^2 \equiv -2 \!\!\mod p$.  In particular, $-2$ is a square mod $p$, hence
$$1=\left(\frac{-2}{p}\right)=\left(\frac{-1}{p}\right)\left(\frac{2}{p}\right)=(-1)^{(p^2-1)/2} (-1)^{(p-1)/2}=(-1)^{(p^2+p-2)/2}.$$
This implies $p \equiv 1,3 \!\!\mod \!8$.  If each prime $p$ dividing $x^2+2$ were congruent to $1 \!\!\mod 8$, then $x^2+2$ would be congruent to $1\!\! \mod 8$.  This is a contradiction, hence there exists some $p \mid x^2+2$ congruent to $3 \!\!\mod 8$.  (In fact, there must be an odd number of such primes.)
Of course, any one of the primes is congruent to $3 \!\!\mod 4$, which gives your result.
We can ignore quadratic residues in your particular problem because there are only two odd residues mod $4$.  In more difficult questions, looking at quadratic residues can give more information.


text:
Q: WPF - check resource exists without structured exception handling Is there any way to check if a resource exists in an assembly without having to use exception handling?  I'm currently loading images from several assemblies, and if they don't exist then I'm handling the IOException, which causes quite a bit of overhead.

A: Would something like this work for you?
// Member Variable
string [] resourceNames;

// Function
Boolean ResourceExists(string resourceName)
{
    if (resourceNames == null)
    {
        resourceNames =
            Assembly.GetExecutingAssembly().GetManifestResourceNames();
    }

    return resourceNames.Contains(resourceName);
}

A: Copied answer from here:
public static bool ResourceExists(string resourcePath)
{
    var assembly = Assembly.GetExecutingAssembly();

    return ResourceExists(assembly, resourcePath);
}

public static bool ResourceExists(Assembly assembly, string resourcePath)
{
    return GetResourcePaths(assembly)
        .Contains(resourcePath);
}

public static IEnumerable<object> GetResourcePaths(Assembly assembly)
{
    var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
    var resourceName = assembly.GetName().Name + ".g";
    var resourceManager = new ResourceManager(resourceName, assembly);

    try
    {
        var resourceSet = resourceManager.GetResourceSet(culture, true, true);

        foreach(System.Collections.DictionaryEntry resource in resourceSet)
        {
            yield return resource.Key;
        }
    }
    finally
    {
        resourceManager.ReleaseAllResources();
    }
}


text:
Q: How to Generate Password with compulsory one special character , one Upper case, one lower case In JAVA? Suppose I am taking input parameter as int and I want to return in String. How can I do this? I want compulsory one special character, one upper case, one lower case every time after generating password. How can I do this?
I wrote this code below and I get a solution but it does not add upper case, lower case, special characters in the generated output every time.
public int GeneratePassword(int length) {
    String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu vwxyz0123456789~`!@#$%^&*()-_=+[{]}\\|;:\'\",<.>/?";

    String pwd = RandomStringUtils.random(length , characters );
    System.out.println("pwd:="+pwd );

    return 0;
}

A: Jose Martinez has provided an excellent method to do achieve already this is a code snippet from his method
   public static String getPassword(int length) {
        assert length >= 4;
        char[] password = new char[length];

        //get the requirements out of the way
        password[0] = LOWERCASE[rand.nextInt(LOWERCASE.length)];
        password[1] = UPPERCASE[rand.nextInt(UPPERCASE.length)];
        password[2] = NUMBERS[rand.nextInt(NUMBERS.length)];
        password[3] = SYMBOLS[rand.nextInt(SYMBOLS.length)];

        //populate rest of the password with random chars
        for (int i = 4; i < length; i++) {
            password[i] = ALL_CHARS[rand.nextInt(ALL_CHARS.length)];
        }

        //shuffle it up
        for (int i = 0; i < password.length; i++) {
            int randomPosition = rand.nextInt(password.length);
            char temp = password[i];
            password[i] = password[randomPosition];
            password[randomPosition] = temp;
        }

        return new String(password);
    }

if you want to check out the whole method surely check out his answer all credits to him.
https://stackoverflow.com/a/51823845/6895166

A: Here is one approach using SecureRandom and StringBuilder
private static String generateRandomString(int length)
{
    StringBuilder sb = new StringBuilder();
    SecureRandom rnd = new SecureRandom();
    String uppercaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    String lowercaseChars = "abcdefghijklmnopqrstuvwxyz";
    String specialChars = "0123456789~`!@#$%^&*()-_=+[{]}\\\\|;:\\'\\\",<.>/?";

    boolean nextIsUppercase = false;
    boolean nextIsLowercase = false;
    boolean nextIsSpecial = true;

    for (int i = 0; i < length; i++) {

        if (nextIsSpecial) {
            sb.append(specialChars.charAt(rnd.nextInt(specialChars.length())));
            nextIsUppercase = true;
            nextIsSpecial = false;
            continue;
        }

        if (nextIsUppercase) {
            sb.append(uppercaseChars.charAt(rnd.nextInt(uppercaseChars.length())));
            nextIsUppercase = false;
            nextIsLowercase = true;
            continue;
        }

        if (nextIsLowercase) {
            sb.append(lowercaseChars.charAt(rnd.nextInt(lowercaseChars.length())));
            nextIsLowercase = false;
            nextIsSpecial = true;
            continue;
        }

    }

    return sb.toString();
}

Sample output:
System.out.println(generateRandomString(1)); -> 7
System.out.println(generateRandomString(2)); -> :Q
System.out.println(generateRandomString(3)); -> 8St
System.out.println(generateRandomString(4)); -> =Lv%
System.out.println(generateRandomString(16)); ->  %Uf-Hs<Ea|Wp;Rt}

A: This is the solution of your problem:
public static String GeneratePassword(int length) {

    String[] characters = {"0123456789","~!@#$%^&*()-_=+[{]}|;:\'\",<.>/?","ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"};
    Random rand = new Random();
    String password="";
        for(int i=0;i<length;i++) {
            int random = rand.nextInt(4);//choose a number from 0 to 3(inclusive)
            int string_size = characters[random].length();//get length of the selected string
            int random1 = rand.nextInt(string_size);//choose a number from0 to length-1 of selected string
            char item = characters[random].charAt(random1);//selects the character
            password=password+item;//Concatenates with the password
        }
    return password;
}


text:
Q: RF via impedance calculation with NFP removal I'm trying to match the impedance of a RF via from bottom layer to top layer in a 6-layer PCB design. GNSS signal. Unused pad (NFP) removal activated.
The selected via size is 0.9mm pad and 0.5mm drill. No antipad defined so applying copper-to-drill default clearance (0.2mm) at inner ref planes. This results in a 0.9mm ref plane opening.
I'm using Saturn PCB tool and I wonder what data should I fill to get the correct calculation. Internal pad diameter is supposed to be the same as drill diameter? Any help/suggestion will be appreciated.

A: The tool shows a calculated via impedance of almost 50 ohms in the figure above. If your traces on top or bottom have 50 ohms, too, then you have a pretty good impedance match.


text:
Q: Can I force pip to install a package even with a version conflict? During an installation, pip is throwing an error due to version conflicts
ERROR: Could not find a version that satisfies the requirement XXX==1.2.1

This is due to a package made by the company for witch I work ( not open source work ).
The reason for witch it is blocking is because it is locked in python version 3.6 and I am attempting to use python 3.9
Is it possible or not to ask pip to force install a package even though it was not built / tested for this specific version of python ?
To be clear, I am fully aware that this is normally not a good idea. I however have little alternatives as the team that manages that specific package no longer exists. It is a dependency we are attempting to remove but until we can, we need to use it
Can I ask pip to use the latest version of the package even though it may break ? I'll add that there are no other package conflicts, just this one with python version so I should - in theory - be the only issue

A: I haven't tried it myself yet, but according to the documentation, pip install has the following argument that may help to bypass it:
--ignore-requires-python
Ignore the Requires-Python information.

https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-ignore-requires-python


text:
Q: Use case of using Big Query or Big table for querying aggregate values? I have usecase for designing storage for 30 TB of text files as part of deploying data pipeline on Google cloud. My input data is in CSV format, and I want to minimize the cost of querying aggregate values for multiple users who will query the data in Cloud Storage with multiple engines. Which would be a better option in below for this use case?
Using Cloud Storage for storage and link permanent tables in Big Query for query or Using Cloud Big table for storage and installing HBaseShell on compute engine to query Big table data.
Based on my analysis in below for this specific usecase, I see below where cloudstorage can be queried in through BigQuery. Also, Bigtable supports CSV imports and querying. BigQuery limits also mention a maximum size per load job of 15 TB across all input files for CSV, JSON, and Avro based on the documentation, which means i could load mutiple load jobs if loading more than 15 TB, i assume.
https://cloud.google.com/bigquery/external-data-cloud-storage#temporary-tables
https://cloud.google.com/community/tutorials/cbt-import-csv
https://cloud.google.com/bigquery/quotas

So, does that mean I can use BigQuery for the above usecase?

A: The short answer is yes.
I wrote about this in:

*

*https://medium.com/google-cloud/bigquery-lazy-data-loading-ddl-dml-partitions-and-half-a-trillion-wikipedia-pageviews-cd3eacd657b6
And when loading cluster your tables, for massive improvements in costs for the most common queries:

*

*https://medium.com/google-cloud/bigquery-optimized-cluster-your-tables-65e2f684594b
In summary:

*

*BigQuery can read CSVs and other files straight from GCS.

*You can define a view that parses those CSVs in any way you might prefer, all within SQL.

*You can run a CREATE TABLE statement to materialize the CSVs into BigQuery native tables for better performance and costs.

*Instead of CREATE TABLE you can do imports via API, those are free (instead of cost of query for CREATE TABLE.

15 TB can be handled easily by BigQuery.


text:
Q: Fast way for python declare variable (convert Dataframe to numpy array) Any way to reduce these code below? This code to declare variable base on number_inputs
if number_inputs == 1:
    data_input = data[['t-1']].values
elif number_inputs == 2:
    data_input = data[['t-2', 't-1']].values
elif number_inputs == 3:
    data_input = data[['t-3', 't-2', 't-1']].values
elif number_inputs == 4:
    data_input = data[['t-4', 't-3', 't-2', 't-1']].values
elif number_inputs == 5:
    data_input = data[['t-5', 't-4', 't-3', 't-2', 't-1']].values
elif number_inputs == 6:
    data_input = data[['t-6', 't-5', 't-4', 't-3', 't-2', 't-1']].values
elif number_inputs == 7:
    data_input = data[['t-7', 't-6', 't-5', 't-4', 't-3', 't-2', 't-1']].values
elif number_inputs == 8:
    data_input = data[['t-8','t-7', 't-6', 't-5', 't-4', 't-3', 't-2', 't-1']].values
elif number_inputs == 9:
    data_input = data[['t-9','t-7', 't-6', 't-5', 't-4', 't-3', 't-2', 't-1']].values

A: x = ['t-'+str(i) for i in range(1, 10)]
for i in range(1, 10):
    if number == i:
        data_input=data[x[i-1::-1]].values


text:
Q: UITableView and heightForHeaderInSection, best practice? I'm using an UITableView to display cells that can contain a certain amount of text. This amount can vary depending on the dynamic cell. Because I have 2 UILabel, I'm not sure what is the best way to achieve the cell height calculation.
Here are the conditions:

*

*UILabel *title = a label that can have from 1 to 4 lines

*UILabel *subtitle = a label that can have from 0 to 2 lines (font is smaller than *title)

*title + subtitle should be centered vertically (occurs when *subtitle have 0 line)

Do I have to create 2 dummies UILabel, fill them with cell contents, sizeToFit them adin finally get their height? Or is there an other, smarter, way to do that?
big thanks.

A: With collection views you have to do as you suggest, and keep a static cell around to fill then resize after applying content to it.
If you use a dell with autolayout (constraints) you can get attractive cells with any content.
Also if your cell content is static while the user is using it, add a new property 'height' in the array managing content, so as to cache the size when you measure it the first time. That way you'll only need to determine the height once per entry.


text:
Q: Woocommerce change product variation via JS Here's a working example of where we are: http://fpusa.drunk.kiwi/product/ship-your-idea-2/
I am trying to create 'swatches' for a user to click, which would than change the value of the hidden select box woocommerce uses to grab the variation data.
Is there a specific way to tell woocommerce to read the value of the select box?
Everything works as expected but the javascript event which changes the variation id and gets everything ready to add to cart never happens.
Note: I hide the wc_dropdown with d-none because I thought it would minimize a custom solution.
Variable.php - Calls fpusa_product_attribute_button();
<?php foreach ( $attributes as $attribute_name => $options ) : ?>

    <label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?>

            <?php
              fpusa_product_attribute_button( $options, $attribute_name, $product );

              wc_dropdown_variation_attribute_options( array(
                'options'   => $options,
                'attribute' => $attribute_name,
                'product'   => $product,
                'class'         => 'd-none',
              ));

            echo end( $attribute_keys ) === $attribute_name ? wp_kses_post( apply_filters( 'woocommerce_reset_variations_link', '' . esc_html__( 'Clear', 'woocommerce' ) . '' ) ) : '';

            ?>

<?php endforeach; ?>

fpusa_product_attribute_button()
function fpusa_product_attribute_button( $options, $attribute_name, $product ){
    if( ! empty( $options ) ) : ?>

            <?php foreach( $options as $option ): ?>
                <button type="button" class="d-flex btn justify-content-center align-items-center border mx-1" data-key="<?php echo $attribute_name ?>" data-value="<? echo $option ?>">
                    <?php echo $option; ?>
                </button>
            <?php endforeach; ?>

 <?php
    endif;
}

Functions.js

$('#var_btn button').click(function(){
   let attribute = $(this).attr('data-key');
   let option = $(this).attr('data-value');
   console.log( attribute, option );
   $('#' + attribute).val( option );
});

A: All I had to do is simply trigger the change event on the <select> was passing the selected option to.
$('#var_btn button').click(function(){
    let attribute = $(this).attr('data-key');
    let option = $(this).attr('data-value');
    console.log( attribute, option );
    $('#' + attribute).val( option ).change();
  });


text:
Q: what does my html not render on the page? I have this page at
http://kornar.co.uk/example.html
But it doesnt render HTML. I know its there because when I check view source the HTML code is there, on my localhost it works perfectly, thanks for your help!!

A: Well to start, js/jquery.js is missing so none of your js is going to run...  all the tabs are hidden so without the js the code in the tabs won't be come visible...

A: Its works correctly for me.
There is possibily two explanation why it do not works for you :
- Your Browser cache need to be cleared
- Your DNS cache need to be cleared.
Try both and let us now if it works

A: Line 90 in your layout.css file says:
.tab {
    padding: 16px;
    display: none;
}

If you remove the "display:none" bit, you'll see more.
Try to use Firebug when debugging stuff like this, it's awesome!

A: You have .colorpicker set to display:none in the css file.


text:
Q: What is the purpose in using infinity rather than finite in set union? In measure theory (and also in probability theory): I came across the third rule, which is countable union and can be written as follows
if $A_i \in A$ for all i $\in \mathbb{N}$ then $\bigcup\limits_{i=1}^{\infty} A_{i} \in A$
Although I understood technically, I cannot able to get an intuition of defining the property in the way mentioned above. What is the issue if I define it in the countable/finite sense as follows?
If $A_1,A_2 \in A$ then $A_1 \cup A_2 \in A$
If I am correct, the latter way of writing can be naturally extended to the former one. I may be surely missing something. What is it?


text:
Q: How to restrict all users to delete Image from Picture Library when it is referring in site We are referring Images from an Image Library and showing them in web parts. In case, if a user deletes any Image from back end, our web part will show empty.
Of course we can show an alternate image, but I want to restrict all the users to delete images from library while they are being referred.
Kindly help me on how to do this.

A: Navigate to the Picture Library in question, and select the Shared With Button

On the modal dialogue, follow the advanced link

Click the button Stop Inherit Permissions

When you hav broken permission, you kan have the exact permission you want to have for this picture library. Select the group that you want to remove permission for (and make sure they already have read permissions from the Visitor group). Click Remove User Permission.

When you have removed all groups that have permission to delete images, you can safely add images here which you use in your webpart, without ever losing them again.


text:
Q: something is going wrong when using 'try & except' in PYCHARM . 'except' is not workig. it give me 'f is not definded' try:
  f = open("demofile.txt")
  f.write("Lorum Ipsum")
except:
  print("Something went wrong when writing to the file")
finally:
  f.close()

A: Please try to run the below code. You have not passed the mode type. If any exception occurs, comment here.
try:
    f = open("demofile.txt", "w")
    f.write("Lorum Ipsum")
except Exception as e:
    print(e)
finally:
    f.close()

You can also use 'with' here. Because this method will automatically close the opened file after file operations are done.
with open("demofile.txt", "w") as f:
    f.write("Lorum Ipsum")


text:
Q: Can I create a clone of a clone? I have done some homework with John Zelle's Textbook "Python Programming". I use a graphics library provided as additional material to the book.
My question: Can I create a clone of a Point, then move that clone, after that create a clone (from that clone) again and move that one?
Or is "cloning of clones" forbidden and I have to create a second clone from the original point?
Thanks for help!
Source code:
from graphics import *      # import methods from graphis library
import math                 # import math library

def main():

    # Create GraphWin, display instructions
    win = GraphWin("Five-click house", 400,400)             # Make sure GraphWin is large enough
    win.setCoords(0,0,10,10)                            # The coordinate system should allow negative x and y values

    # Draw the frame of the house
    message = Text(Point(5,0.5), "Click at two point to define house frame")
    message.draw(win)

    P1 = win.getMouse()
    P1.draw(win)
    P2 = win.getMouse()
    frame = Rectangle(P1,P2)
    frame.draw(win)

    # Draw door
    MP = win.getMouse()
    MP.draw(win)
    width_frame = P2.getX() - P1.getX()
    P3 = MP.clone()
    P3.move(-((0.1)*width_frame),0)
    P4 = MP.clone()
    P4.move((0.1)*width_frame,0)
    P5 = P4.clone()
    h = P4.getY() - P1.getY()
    P5.move(0,-h)
    door = Rectangle(P3,P5)
    door.draw(win)

    # Draw Window
    WC = win.getMouse()         # WC: Window Center
    P6 = WC.clone()
    P6.move(-0.05*width_frame,0.05*width_frame)
    P7 = WC.clone()
    P7.move(0.05*width_frame,-0.05*width_frame)
    wind = Rectangle(P6,P7)
    wind.draw(win)
    message.setText("Click to place the roof top")

    # Draw top
    HT = win.getMouse()
    P8 = Point(P1.getX(), P2.getY())
    top = Polygon(HT,P8,P2)
    top.draw(win)
    top.setFill("black")

    # Exit with mouse click
    win.getMouse()
    win.close()

main()

A: There's absolutely no problem doing that, but obviously when you move your cloned point, the original will still be present on its original location.


text:
Q: Delete confirmation moves images in UITableViewCell, but nothing else I have a subclassed UITableViewCell that adds an image to the contentView, as well as two custom UILabels. When the table goes into editing mode everything shifts to the right correctly, but if I click on the delete control it nudges the frame of the image (which uses its own variable 'thumbnail') to the left. The labels stay in place, even though they're also subviews of contentView - so the image frame is being redrawn and contentView and the label frames are not.
I've tried overriding layoutSubviews but that doesn't seem to help, or I'm not doing it in the right way.
Does anyone know how to ensure contentView is treated as a single object, and prevent its individual subviews being moved? I'm not using IB and would prefer to keep it that way.
Thanks!


text:
Q: CSS Background Image Doesn't Appear in Safari I have the following CSS which sets the background image, but it doesn't work in Safari. It doesn't even set the background color, even though that should be a fallback. I can't install Safari on Windows so I can't even test it!
.oops-body {
    background: url('/img/oops-bg.jpg') center/cover no-repeat #1b1d37;
    min-height: 100vh;
    overflow: hidden;
}

And the HTML

.oops-body {
 background: url('http://placehold.it/500') center/cover no-repeat #1b1d37;
 min-height: 100vh;
 overflow: hidden;
}

This was the screen shot from a co-worker who has Safari:

By the way, it does work in mobile Safari. I tested on my iPhone.

A: replace your background css with this
{
   background-image: url("image.png");
   background-repeat: no-repeat;
   background-attachment: fixed;
   -o-background-size: cover;
   -moz-background-size: cover;
   -webkit-background-size: cover;
}

A: Can you try this,
background-image: url("http://placehold.it/500");
background-repeat: no-repeat;
background-position: center top;

instead of just using background.


text:
Q: How to get sender ID for GCM I need sender id for Google Cloud Messaging(GCM).
However I couldn't find the one .
I have already experienced in making application using GCM, at that time I could find the sender id in addressbar or somwehere not so difficult.
But now, I couldn't, It is because of Firebase cloud messaging replacement?? or is there still a way to get sender id??
You might recommend me to use FCM though,
I am using titanium. it might be too eary to switch new service.
I would like to use this ti.goosh

A: Login to Google Developer Console and go to your Dashboard.
If you have multiple projects on GDC, identify the applications whose GCM Sender ID you want to use.
Click on the project, in Project info ** Project number** there is your GCM Sender ID.
For more details visit this link.
Hope it helps!


text:
Q: Is it possible to use OpenCV module in PyScript? I want to use opencv module but I can't import OpenCV. So how can I solve this problem?
By the way, Pyodide supports OpenCV.
Example Code

A: OpenCV is not supported yet.
At this time, OpenCV requires pypi-json. Loading that package via Pyscript micropip throws a CORS error. Once that is fixed, I am not sure which other problems will surface.
This means some OpenCV dependencies must be corrected first.
[UPDATE]
This link infers that the Pyodide dev branch now supports openCV. I have not verified that information.

A: Have you loaded it as a module in your HTML?
  <py-env>
  - bokeh
  - numpy
    ....
  - OpenCV
  </py-env>


text:
Q: ActionScript3 gotoAndPlay not finding frame. I am new to ActionScript 3, but I have a pretty good idea how to jump frames. However, I have nested frames inside a movieclip symbol and my code cannot find them. I am making a simple platforming game.
 ArgumentError: Error #2109: Frame label Stand Front Frame not found in
scene Stand Front Frame.
at flash.display::MovieClip/gotoAndStop()
at menutest_fla::MainTimeline/frame813()
at flash.display::MovieClip/gotoAndPlay()
at menutest_fla::MainTimeline/fl_ClickToGoToScene_3()

Here is my code, it is pretty simple. There are no typing errors that I have noticed. I cannot figure out why it is not working. Any help would be deeply appreciated, thanks!
stop();
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;

var upPressed:Boolean = false;
var downPressed:Boolean = false;
var leftPressed:Boolean = false;
var rightPressed:Boolean = false;

movieClip_5.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey_3);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed_3);
stage.addEventListener(KeyboardEvent.KEY_UP, fl_UnsetKeyPressed_3);

movieClip_5.gotoAndStop("Stand Front Frame")

 function fl_MoveInDirectionOfKey_3(event:Event)
{
    if (upPressed)
    {
        movieClip_5.y -= 0;
    }
    if (downPressed)
    {
        movieClip_5.y += 0;
    }
    if (leftPressed)
    {
        movieClip_5.x -= 5;

    }
    if (rightPressed)
    {
        movieClip_5.x += 5;
    }
}

function fl_SetKeyPressed_3(event:KeyboardEvent):void
{
    switch (event.keyCode)
    {
        case Keyboard.UP:
        {
            upPressed = true;
            break;
        }
        case Keyboard.DOWN:
        {
            downPressed = true;
            break;
        }
        case Keyboard.LEFT:
        {
            leftPressed = true;
            movieClip_5.gotoAndPlay("Walk Forward Frame");
            break;
        }
        case Keyboard.RIGHT:
        {
            rightPressed = true;
            movieClip_5.gotoAndPlay("Walk Backwards Frame");
            break;
        }
    }
}

function fl_UnsetKeyPressed_3(event:KeyboardEvent):void
{
    switch (event.keyCode)
    {
        case Keyboard.UP:
        {
            upPressed = false;
            break;
        }
        case Keyboard.DOWN:
        {
            downPressed = false;
            break;
        }
        case Keyboard.LEFT:
        {
            leftPressed = false;
            movieClip_5.gotoAndPlay("Walk Backwards Frame");
            break;
        }
        case Keyboard.RIGHT:
        {
            rightPressed = false;
            movieClip_5.gotoAndPlay("Walk Forward Frame");
            break;
        }
    }
}

import flash.events.Event;
import flash.geom.Rectangle;
stage.addEventListener(Event.ENTER_FRAME, cameraFollowCharacter);
function cameraFollowCharacter(evt:Event){
 root.scrollRect = new Rectangle(movieClip_5.x - stage.stageWidth/3, movieClip_5.y - stage.stageHeight/1.5, stage.stageWidth, stage.stageHeight);
}

A: Remove your spaces from your frame label (both in your code and the MovieClip's frame label).
and if not solved, try it once again with your frame number instead of label.
leftPressed = true;
movieClip_5.gotoAndPlay(23);
break;

A: Most of the time with this error, if you are certain there is not a typo in your frame label, the issue is one of scope.
Either the Timeline assigned to the variable/instance name movieClip_5 isn't the one you think it is, or you are in the wrong scene.
To double check it's not a typo, and to see all the frame labels of movieClip_5, do the following (example code from the documentation):
import flash.display.FrameLabel;

var labels:Array = movieClip_5.currentLabels;

for (var i:uint = 0; i < labels.length; i++) {
    var label:FrameLabel = labels[i];
    trace("frame " + label.frame + ": " + label.name);
}

This writes to the output window every frame label from movieClip_5's current scene.  If you don't see what you expect, it means when this code runs, you are not in the scene you expect, or movieClip_5 is not the timeline you think it is (perhaps you want a child of movieClip_5 like movieClip_5.someChildsInstanceName.gotoAndPlay("Walk Forward Frame")).

A: Thank you for your feedback!
It ended up being a symbol issue, where I did not have the frames nested properly within the symbol I was calling on. And it was not ultimately the code. I appreciate your help!