Android: strange button layout with Ice Cream

Question: I built a layout with this custom bar at the top:

The bar illustrated, contains three example buttons (one at left and two at right), with an image background (ic_delete) contained in the default android drawable.
This is the XML code:
<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical"
    android:orientation="vertical" >

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="44dp"
        android:background="@drawable/bg_gradient_top_bar" >

        <Button
            android:id="@+id/button_swype_left"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="3dp"
            android:layout_marginBottom="3dp"
            android:background="@android:drawable/ic_delete"
            android:text="" />

        <ImageView
            android:id="@+id/bar1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="1dp"
            android:layout_marginRight="1dp"
            android:layout_marginTop="1dp"
            android:layout_toRightOf="@+id/button_swype_left"
            android:maxWidth="1dp"
            android:src="@android:drawable/status_bar_item_app_background" />

        <TextView
            android:id="@+id/municipality"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/bar1"
            android:layout_toLeftOf="@+id/bar2"
            android:layout_marginLeft="3dp"
            android:layout_marginRight="3dp"
            android:gravity="center"
            android:text="Some Text"
            android:textColor="#FFF"
            android:textSize="16dp"
            android:typeface="sans" />

        <ImageView
            android:id="@+id/bar2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="1dp"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="1dp"
            android:maxWidth="1dp"
            android:layout_toLeftOf="@+id/button_menu"
            android:src="@android:drawable/status_bar_item_app_background" />

        <Button
            android:id="@+id/button_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentTop="true"
            android:layout_toLeftOf="@+id/bar3"
            android:layout_margin="3dp"
            android:background="@android:drawable/ic_delete" />

        <ImageView
            android:id="@+id/bar3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="1dp"
            android:layout_marginTop="1dp"
            android:maxWidth="1dp"
            android:layout_toLeftOf="@+id/button_swype_right"
            android:src="@android:drawable/status_bar_item_app_background" />

        <Button
            android:id="@+id/button_swype_right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="3dp"
            android:layout_marginBottom="3dp"
            android:background="@android:drawable/ic_delete"
            android:text="" />

    </RelativeLayout>

    <LinearLayout ... >

        <ListView .... />
    </LinearLayout>

</LinearLayout>
</code>
All is right when I try my app in devices with Android version < 4.0 (API 14), as shown below:

but in devices with Android version >= 4.0 (API 14, 15, 16), the width dimensions of buttons are strange:

what wrong?
Comment: Try replacing `Button` with `ImageButton`
Comment: i try to use ImageButton instead Button as suggested by @Waqas and IT WORKS!!!!
Comment: @GrahamSmith: no, it isn't an action bar
Comment: Try changing to `android:layout_width="wrap_content"` `in TextView`
Answer: it looks like the size of the android system images change beetween those versions, in particular i mean the width @android:drawable/ic_delete, try using a custom image you make


Is this limit equal to 1?

Question: Let $x\in R^{n}$ be fixed ($x\neq 0$) and $r>0$. Evaluate the limit:$$\lim_{r\rightarrow \infty}\frac{V(B(x,r)\cap B(0,r))}{V(B(0,r))}$$
where $V$ stands for volume and $B(x,r)$ is the ball with center x and radius $r$.
Thanks in advance.
Comment: Do you consider euclidian norm?
Answer: The volume of $B(x,r)$ is $ar^n$ for some constant $a$ which dependends on $n$, but whose exact value will not concern us.
Let $d=||x||$ be the distance between the two centers $0$ and $x$. If $r>d$ then the triangular inequality implies that $$B_{r-d}(0)\subset B(x,r)\cap B(0,r)$$
Hence
$${V(B(x,r)\cap B(0,r))\over V(B(0,r))}>{V(B_{r-d}(0))\over V(B(0,r))}={a(r-d)^n \over ar^n}=\Bigl(1-{d\over r}\Bigr)^n$$
When $r\to\infty$ then the last expression will $\to 1$.
Comment: Don't you need also an upper bound?
Comment: Yes, but the ratio between the volumes is obviously $<1$, since one set is contained in the other.
Comment: You're right, thanks.
Comment: I really liked your solution Per Manne. Thanks.
Answer: Yes if we work with euclidian norm. Let $I(r):=V(B(x,r)\cap B(0,r))$. Then
$$\left|\frac{I(r)}{|B(0,r)|}-1\right|=\frac 1{|B(0,r)|}\int_{\Bbb R^n}\chi_{\{||x-y|>r\}}\chi_{\{y\leq |r\}}dy.$$
In the set on which we integrate, we have $|x|²-2\langle x,y\rangle+|y|^2\geq r^2\geq |y|^2$ hence $2\langle x,y\rangle\leq |x|^2$. This is a bounded set, hence the integral is uniformly bounded by an universal constant (independent of $r$). By the way, it gives a speed of convergence.
Answer: All Euclidean balls have the same volume, so we may as well use $V(B(\frac{x}{2},r))$ in the denominator.  Now draw a picture to see that:
$$V\bigg(B\bigg(\frac{x}{2},r-\frac{|x|}{2}\bigg)\bigg)\leq V(B(x,r)\cap B(0,r))\leq V\bigg(B\bigg(\frac{x}{2},\sqrt{r^2 - \frac{|x|^2}{4}}\bigg)\bigg).$$
(enzotib points out below that it's easier to use a second radius of $r + |x|/2 > \sqrt{r^2 - |x|^2/4}$.)
Since the volume of a ball of radius $r$ is $Cr^n$, $|x|$ is fixed, and the radii of both the first and last balls are order $1$ in $r$, their volumes go as $Cr^n$.  So when we divide through by $Cr^n$, we have that both the first and last expression go to $1$, forcing the middle to go to $1$ as desired.
Comment: The including ball can also have, more simply, $R=r+|x|/2$?
Comment: Oh yes, that's simpler.  I drew a picture of two intersecting circles, with centers $0$ and $x$.  The midpoint between the centers is $x/2$, and the two radii come from the largest circle centered at $x/2$ contained in the intersection and the smallest circle centered at $x/2$ which contains the intersection.  This latter has radius $\sqrt{r^2 - |x|^2/4}$.
Comment: My estimate comes from thinking of the union instead of the intersection, my fault.
Comment: Not a problem!  The union is bigger than the intersection and $r + |x|/2$ still grows with order $1$ in $r$. :)
Answer: Yes. Use zooming $x\mapsto \displaystyle\frac1r\cdot x$. Then volume is shrinked by $\displaystyle\frac1{r^n}$, both in the enumenator and dominator, so the quotient is fix, $0$ stays, $r$ is constantly 1, and $x$ goes to $x/r \to 0$.

Is this limit equal to 1?


What are skulls for?

Question: I found a Blue Skull! It looks special! Whats it for? Are there others? In what Acts can I find each of any of the others?
Do not tell me where the skulls are beyond the Acts they are located in please, I like a good treasure hunt.
Answer: Skulls can be found throughout the game.  For each skull, there is a corresponding altar.  When you place the skull on the altar, you will unlock a special crafting recipe.
Skulls

Orange Skull: Act II.
Green Skull: Act I.
Purple Skull: Act II
Blue Skull: Act II
Brown Skull: Act I

Altars

Orange Skull Altar: Act II
Green Skull Altar: Act II
Purple Skull Altar Act II, during the quest Uninvited Guests.(Note: once the quest is completed, the Purple Altar becomes locked off.)
Blue Skull Altar: Act I
Brown Skull Altar
Comment: fwiw most of the recipes are pretty useless imo.  And you should put which act the skull is found in and which act the altar is in, since they can be from different acts.

What are skulls for?


Solving equation $A_1XB_1 = A_2XB_2$ on $X$ subject to constraint on $X$

Question: I have a system of equation on the $n \times n$ variable $X$ of the form:
$$A_1XB_1 = A_2XB_2$$
where $A_1, A_2 \in \mathbb{R}^{m \times n}$, with $m>n$ and $B_1, B_2 \in \mathbb{R}^{n \times p}$ with $n > p$.We can assume that $A_i, B_i$ are full column-rank.
I would like to solve the system of equation with the constraint on $X$ to be different from the trivial solution $X=0$, as well as det$(X)\neq 0$. Other constraints on $X$ might also be possible. How to proceed?
By defining $x= \operatorname{vec}(X)$ we can rewrite the system of equation as
$$\underbrace{(B_1^\top \otimes A_1 - B_2^\top \otimes A_2)}_{Q}x=0.$$
In order for the system to be solvable, matrix $Q$ needs to have a nullspace different from the $0$ vector alone. For instance, by adding the constraint $\|x\|=1$ I can solve (or at least approximate) the system by taking $x$ as the right singular vector of matrix $Q$ associated to the smallest singular value. But what if I would like to enforce the $X$ to have a determinant different from zero?
Comment: I was wrong, that actually is fine
Comment: Perhaps you should approach this as a generalized eigenvalue problem
$$
M_k = B^T_k\otimes A_k \quad\implies\quad
M_1x = \lambda M_2 x
$$
where you are interested in all eigenvectors associated with $\lambda=\tt1$. If more than one such eigenvector exists you can linearly combine them to create an $X$ matrix which has the desired properties.
Answer: Similar to your previous question, we cannot achieve $\det X\neq 0$ in general.
For example, take $m=4$, $n=2$, $p=1$.
$$
A_1= \begin{bmatrix} 1&0\\0&1\\0&0\\0&0\end{bmatrix}, B_1=\begin{bmatrix}1\\0\end{bmatrix}
$$
and
$$
A_2= \begin{bmatrix} 2&0\\0&2\\0&0\\0&0\end{bmatrix}, B_2=\begin{bmatrix}1\\0\end{bmatrix}
$$
Then $$X=\begin{bmatrix} x_1&x_3\\ x_2&x_4\end{bmatrix}$$ in the equation
$$
A_1XB_1=A_2XB_2
$$
satisfies
$$
x_1=x_2=0.
$$
This is because
$$
A_1XB_1=A_1\begin{bmatrix}x_1\\ x_2\end{bmatrix} = \begin{bmatrix} x_1\\ x_2 \\ 0 \\ 0\end{bmatrix}, \ \ A_2XB_2=A_2\begin{bmatrix}x_1\\ x_2\end{bmatrix} = \begin{bmatrix} 2x_1\\ 2x_2 \\ 0 \\ 0\end{bmatrix}
$$
Thus, any solution to the above equation satisfies $\det X=0$.
Comment: Thank you for your answer. Do you have possible suggestions in how to solve this problem in an optimization based approach to at least approximate the solution?
Comment: Also, this is just one example. So it might not generalize I guess
Comment: My example shows this is impossible in general. If you want $\det X\neq 0$, you need to impose some more conditions on matrices $A_i, B_i$.
Comment: And I would like to know what optimization problem that you are interested in by solving this problem.
Comment: The context of the optimization problem is really specific, that would not help. I can tell something more on the matrices involved, if you think you might have time to look at them


Where are all of the barns located in Forza Horizon 5?

Question: I have just unlocked the 'Barn finds' feature but only one is showing on the map. How can I find the others?
Answer: There are 14 Barn Finds in total throughout the whole map. In order to unlock them, you have two options:

Complete different activities throughout the game to unlock them
Purchase the 'Treasure Map' DLC which will unlock all except 1 of them (£2.50 in the UK on Steam)

It's personal preference but I bought the map as I don't have as much time to invest in the game as I would like. It is worth noting that just playing the game as intended and completing activities/objectives/story missions will eventually lead to you unlocking these anyway. Also worth noting is that the treasure map will not unlock those that require specific objectives to be completed as mentioned in the spoilers below.
I will list a number followed by a spoiler tag containing info on how to unlock that barn find. At the bottom of my answer will be a screenshot of all of the locations containing those numbers.

 This location unlocks randomly during gameplay

 Complete the Wilds Expedition objection 'Find the lost notes'

 Complete the Apex Expedition objective 'Reach the top of the central ruin'

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 This location unlocks randomly during gameplay

 Complete the Baja Expedition objective 'Hot spring lake sample'

 This location unlocks randomly during gameplay

Screenshot of all barn locations:


Laravel eloquent inserting data only in Pivot table

Question: Backround information
Using Laravel I'm building an application where I want to link a Company profile to a Station.
Company.php
namespace App;

use Illuminate\Database\Eloquent\Model;

class Company extends Model
{
    protected $guarded = [];

    protected $table = 'companies';

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

    public function station()
    {
        return $this->belongsToMany('App\Station')->withPivot('company_stations');
    }

    public function line()
    {
        return $this->belongsToMany('App\Line');
    }
}

Station.php
namespace App;

use Illuminate\Database\Eloquent\Model;

class Station extends Model
{
    protected $guarded = [];

    protected $table = 'stations';

    public function lines()
    {
        return $this->belongsToMany('App\Line');
    }

    public function company()
    {
        return $this->belongsToMany('App\Company')->withPivot('company_stations');
    }
}

company_stations migration
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCompanyStationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_stations', function (Blueprint $table) {
            $table->id();
            $table->integer('company_id')->unsigned();
            $table->integer('station_id')->unsigned();
            $table->boolean('following')->default(false);
            $table->boolean('completed')->default(false);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('company_stations');
    }
}

I also have a migration company_stations, but no Model for it.
The question
I want to create a checkbox on the station view where the currently logged in Company ID is linked to the Station ID in the pivot table to keep track of which stations the company is following and wether the company has completed that station or not.
What would be the easiest and most clean approach to this? Do I make a new Model CompanyStation + controller or can this be filled in from the Company or Station controller?
Answer: You can use sync method of belongsTomany relationship.
$station = Station::find($stationid);

$station->company()->sync([1,2,3]); //1,2,3 is the company ids which you're selection through checkbox.

//this will drop all the existing companies except the companies with id 1,2,3. If these ids don't exist it will attach them (still dropping the existing ones).

Answer: if you add a column to your piviot table company_stations  example: 'completed'  you can access it with
foreach ($company->stations as $station) {
    dd($station->pivot->completed);
}

you can add that data via
$company->stations()->attach($station->id, ['completed' => true]);

Query it
//only show me completed company stations. (from piviot)
Company::whereHas('stations', function($q) {
    $q->where('company_stations.completed', true);
})
->get();


Find coefficient of static friction if given initial velocity and distance?

Question: I'm trying to work a physics problem about how to find the coefficient of static friction between two objects when given the initial velocity and distance. Specifically, the problem I am working is as follows:

A crate is carried in a pickup truck traveling horizontally at 14.2 m/s. The truck applies the brakes for a distance of 25.8 m while stopping with uniform acceleration. What is the coefficient of static friction between the crate and the truck bed if the crate does not slide?

I do know that the formula that has to be used here is $F_F=µF_n$, but I am unsure as to how it should be applied. I really just need somewhat of a hint to get to where I can plug numbers into that formula, but I am unsure as to how I can get these numbers given the context of the problem. Thank you!
Edit: I'm not really needing the answer to this specific problem, but rather, how I can solve a question like the one above is all I really need. I'm just confused when given initial velocity and distance.
Comment: You know $|F_n| = g$.
Comment: @copper.hat: So, that means that you already have some of formula, being $F_F=µ(9.8)$. And would the force of friction be greater than the initial velocity because you're de-accelerating?
Comment: Well, you need to do some work, not just look for a formula. Given uniform acceleration (deceleration in this instance), you can figure out a formula relating initial, final speed, distance and acceleration. This gives the acceleration. Then the forward acceleration is related to force by mass and similarly the normal force is related to $g$ by mass. This will give $\mu_\text{static}$.
Answer: Since you have the physics tag, here is another approach:
The work done is $F_F d$, where $d$ is the distance travelled. The initial energy is $\frac{1}{2} m V_0^2$ (potential energy is constant here), where $m$ is the truck mass and $V_0$ the initial speed. The final energy is zero. We have $F_F = \mu F_N = \mu m g$, where $g$ is the acceleration due to gravity. This gives $\mu m g d = \frac{1}{2} m V_0^2$, or $\mu = \frac{1}{2} \frac{v_0^2}{dg}$.
Using the numbers you provided, $\mu = \frac{1}{2} \frac{(14.2)^2}{(25.8)(9.81)} \approx 0.4$.
Answer: You need to compare the force due to the truck's deceleration and the force due to friction. You know the force due to friction is (at most) $\mu m g$, so let's find the force due to deceleration.
You know, from kinematics, that
$$
v_f = v_0 + at_f
$$
and
$$
x_f = x_0 + v_0 t_f + \dfrac{1}{2}at_f^2
$$
where $x_0,v_0$ indicate initial position/velocity, and $x_f,v_f,t_f$ final position, velocity, time.
We want to know what acceleration the truck undergoes, and we know $v_0 = 14.2$, $v_f = 0$, $x_f = 25.8$ (if we take $x_0 = 0$).
So, in fact, we have
$$
0 = 14.2 + at_f
$$
$$
25.8 = 14.2t_f + \frac{1}{2}at_f^2.
$$
You can solve these equations for $t_f$ and $a$ ($a$ is what you're interested in), and the force from deceleration is $ma$.
(Note: there's also the formula $v_f^2 = v_0^2 + 2a(x_f - x_0)$, and you could simply start here to make the problem easier. The work we did above could be used to derive this formula).


Show that $\varphi \: : \: \mathbb{N} \times \mathbb{N}^{\ast} \to \mathbb{N} \; , \varphi(p,q)=p^2+q^2+2pq+p$ is injective.

Question: I started by assuming $\varphi(p,q)=\varphi(r,s)$ for some pairs of natural numbers. With some factorisation, I got :
\begin{equation}
(p+q+r+s)(p+q-r-s)+p-r=0
\end{equation}
I tried playing around with divisibility, but it didn't get me anywhere.
Any hints would be welcome.
Answer: For convenience let $a=p+q$ and $b=r+s$, and suppose that $a^2+p=b^2+r$. If $a\ne b$, assume without loss of generality that $a>b$. Then
$$r-p=a^2-b^2=(a+b)(a-b)\ge a+b\,,$$
i.e., $r-p\ge p+q+r+s$. But then $2p+q+s\le 0$, which is impossible, so we must have $a=b$. Then $a^2=b^2$, so $p=r$, and finally $q=s$.
Answer: Consider $(p+q+r+s)(p+q-r-s)$. Since the former factor is greater than $0$, the sign of this expression depends on the sign of $p+q-r-s$.
Suppose $p+q-r-s>0$. Can $(p+q+r+s)(p+q-r-s)+p-r=0$?
Suppose $p+q-r-s<0$. Can $(p+q+r+s)(p+q-r-s)+p-r=0$?
Comment: No we don't. For example, if $p+q-r-s > 0$, we have $(p+q+r+s)(p+q-r-s)+p-r \ge (p+q+r+s)+p-r=2p+r+s >0$.
Comment: I think in all cases, we'll need the sign of $p-r$ since the left side can be positive while $p-r$ is negative to give $0$, and vice versa.


What does the high VIF for the constant term (intercept) indicate?

Question: I am building a Linear regression model on a car dataset using RFE technique and statsmodels library. My  final model has p-value well within 5% and has high F-statistics. VIF values for the predictor variables are well below 5 but for the constant term(intercept) VIF is 8.18. I have used add_constant method to add constant to the model. Following are my doubts:

What does High variance for the constant indicate ?
Should i ignore the constant term while calculating VIF?

These are my results:

I am new to machine learning and also posting question on this site for the 1st time. Kindly let me know if any more information is needed to answer my question.
Answer: statistical question are better asked on stats.stackexchange. However, I just went through this for statsmodels, e.g. https://github.com/statsmodels/statsmodels/issues/2376
First, there is no multicollinearity problem in your model and data. p-values are low and confidence intervals are pretty narrow, so the parameters in the model should be a good estimates. A vif of 8 is not large.
A large vif in the constant indicates that the (slope) explanatory variables have also a large constant component. An example would be when a variable has a large mean but only a small variance. An example for perfect collinearity with the constant and rank deficiency  of the design matrix is the dummy variable trap, when we did not remove one of the levels of a categorical variable in dummy encoding and the dummies sum to 1 and, therefore, replicate a constant.
The purpose of including the constant in the vif computation is to discover this kind of problems with the design matrix exog provided by the user. It would not show up if we compute vif on demeaned or standardized explanatory variables.
There has been a long standing debate in statistics and econometrics about whether multicollinearity measures should include a constant or work only with demeaned explanatory variables.
I am currently preparing an extension to statsmodels that gives users the option to compute both versions, with and without constant.
In some cases reparameterization, demeaning and scaling, can improve numerical precision and prediction. So we want to have measures that check the actual design matrix provided by users, but also check a standardized version of the data to see whether demeaning and scaling might improve numerical precision.


When splicing neutral wires in junction boxes, can I use white electrical tape?

Question: In junction box splices, can I use black electrical tape for black wire (hot) and white electrical tape for the white neutral wire?
Many people use black electrical tape or just 1 color of electrical tape in the splices in the junction boxes. However, I just want to know if it is a better practice to match the color of the electrical tape with the color of the wires (e.g.: black electrical tape for black wire splice and white electrical tape for white wire splice).
UPDATE:
I plan to use the NASA-approved soldered "lineman splice" (http://makezine.com/wp-content/uploads/2012/02/western-union-or-linemans-splice.jpg). So I would use electrical tape to insulate the exposed wires in that case. So I am just asking if there are any common practices or best practices when it comes to the color of the electrical tape to use to insulate the exposed wires in the junction box.
Thanks!
Comment: Where in the world are you?
Comment: Why are you using electrical tape for splices?  A wirenut or push-in type connector works just fine without it....
Comment: Code seems to require either pressure connections (wirenuts, screws, etc.) or solder (NEC 110.14). Getting a permanent tight twist connection by itself is hard, especially on live wires that go through heat and cool cycles. Tape is superfluous over connectors, although sometimes used. It is now more commonly used to cover exposed screw terminals on switch and outlet devices.
Comment: *"I have seen those wirenut or push-in-type connector, however, in our area, we still use electrical tapes for splices. Nobody uses wirenut or push-in-type connectors here yet."* .............. If you *are* in the US there is no way I believe this.
Comment: I'm curious as to where you are in the world... that will help inform as to whether black and white tape are best practice. (FWIW, I'd call it completely useless, as white wires are white, and that's enough.)
Comment: Doesn't matter what "common practice" may be.  Use wire nuts.  Period.
Comment: @ThreePhaseEel, I have seen those wirenut or push-in-type connector, however, in our area, we still use electrical tapes for splices. Nobody uses wirenut or push-in-type connectors here yet.
Comment: Hi @ThreePhaseEel, may I know if you have idea about the tape color as I asked above? :D
Comment: What's "white tape"? There is white electrical tape (which would obviously be fine), and white surgical tape (which would obviously not), and an infinite variety between. And, why don't you just use electrical tape for everything; trying to save money?
Comment: Hi @DanielGriscom, I edited my question. Thanks for your comment. I often see many people use black electrical tape for all splices (live wire splice and neutral wire splice), is using black electrical tape for all splice a good practice or is it a better practice to match the electrical tape color with the color of the wire (e.g.: black electrical tape for black wire and white electrical tape for neutral wire)?
Comment: Thanks @AloysiusDefenestrate, assuming I'm from the United States, is there no such thing as "good practice" when it comes to the color of the electrical tape to use in the junction box? So you are actually saying that using black electrical tape both for the neutral wire splice and hot/live wire splice is perfectly fine?
Answer: Tape is not a thing for splices.  You should not be using tape as your primary way to splice, period.  That is illegal, unsafe and will get all your work flagged by the inspector.  Since you say you are in the USA, wire-nuts and splice blocks are readily available and dirt cheap, though you can solder if you really want to.
However, the solder method you want to use is not allowed inside conduit or conduit bodies, and if you do it inside a junction box, you still need to leave 6-8" of tail.  Part of your wire will be a stiff stick, so it'll be hard to stuff into the box.  4-11/16 boxes will help, those are much cheaper at real electrical supply.
Also, as far as taping after the solder -- that is not an afterthought.  It is complicated!  Electrical-grade soldering is serious business, and not least is the fairly complicated taping of insulation, that involves both friction tape and electrical tape.  You'd need to find an olllld timer that worked on K&T to educate you.
Shrink wrap might be a viable approach, but watch out for sharp points that wear and puncture the shrink wrap.  Part of the friction tape's job is to remove all possibility of that.
In any case I wouldn't depend too much on NASA guidance in that most of their vehicles are single use. I would wire the way NASA's facilities department wires their boring old office buildings. Call them up, they'd be gobsmacked that anyone cares about what they do.
That is not to say there's never a reason to use tape.  If you solder, it's an i,portant part of splicing, and you must do hots and neutrals.  Some people also use tape to over-wrap wire nuts to "keep them on", but they need to get better nuts and use the right size!  Older (20 year old) nuts are not nearly as good as today's.  Exception: nuts capping off a single wire need to be taped or they will fall off.
Work must be neat, workmanlike and consistent within your installation.  Nobody ever got fired for using black for everything. However that can make the wiring rather difficult to understand, which is why I own 10 colors of electrical tape.
By "consistent within your installation" I mean that if the previous work used colors a particular way, continue doing that if you are able.  If unable, use what you have, but make it plain you are doing that.
Do not use bad tape simply to get a color.  By "bad" I mean low quality or tape which is not UL/CSA listed for use as electrical tape.
Answer: To answer your questions...
Can I use white electrical tape?

yes, white electrical tape doesn't hurt.

Is it a better practice?

in my jurisdiction (North America), I've never seen this done. So, I'd say "no, this is not a better practice". There's no benefit that I can see to using different colors of tape.

To answer the question you didn't ask, and is getting play in the comments:
Is it appropriate to twist and tape wire together?

no, in my jurisdiction, this is not code compliant. Thanks @bib for citing chapter and verse in the comments: "Code seems to require either pressure connections (wirenuts, screws, etc.) or solder (NEC 110.14)." If you're looking for best practices (ie, ones that will reduce the risk of electrical fires), I suggest you think about wire joining strategies.
Comment: Thanks. You or the code mentioned "solder", so I updated my question to further clarify it. I am not looking for something that will reduce fire risks. I am just concerned about the colors of the electrical tape to use. I thought that using white color for the white-wire splices and black for black-wire splices would clarify or make it easy to identify what are the splices for (for "live/hot" or for neutral) when someone looks at the junction box. So I am looking for answers that will either refute that or support that so that I would know if what I am thinking makes sense or not.
Answer: To your primary question:
Yes, you can use white electrical tape to wrap properly spliced neutral wire connections.
To the second part of your question about common practice:
What you are asking about (soldered splice connections) is not common practice anymore across the United States and therefore no longer has a broad convention defined for tape colors used to insulate those connections that a majority of people will immediately understand better than just using black electrical tape for all connections.
If it truly is still common practice to solder in your area, I would recommend:

Check out a few existing connections in the rest of the house to see what convention is used and stick to that. Changing conventions would just be likely to add confusion.
Call your local building department and ask them what tape colors they commonly see used for this purpose. Since this is common in your area, there may be a common local convention that would be good to adhere to. Also, please check with the building department to see which permits and inspections are required for the work you are performing (if you have not already).


gulp sass is not compiling my .min file, yet no errors are thrown

Question: New to gulp, everything is installed and it runs properly
gulp --version
CLI version: 2.3.0
Local version: 4.0.2
when I change my scss file, nothing at all happens.. gulp is happily running in terminal
<code>[13:34:16] Starting 'compile_scss'...
[13:34:16] Starting 'compile_scss'...
[13:34:16] Finished 'compile_scss' after 12 ms
[13:34:16] Starting 'detect_change_scss'...
[13:34:16] Finished 'detect_change_scss' after 16 ms
[13:34:16] Finished 'compile_scss' after 32 ms*
</code>
this is my code
<code>'use strict';

 var gulp = require('gulp');
 var sass = require('gulp-sass');
 var minifyCSS = require('gulp-clean-css');
 var uglify = require('gulp-uglify');
 var renamed = require('gulp-rename');
 var changed = require('gulp-changed');

 var SCSS_SRC = './src/Assets/scss/**/*.scss';
 var SCSS_DEST = './src/Assets/css';

 function compile_scss (done) {
    gulp.src(SCSS_SRC)
    .pipe(sass().on('error', sass.logError))
    .pipe(minifyCSS())
    .pipe(renamed({ suffix: '.min' }))
    .pipe(changed(SCSS_DEST))
    .pipe(gulp.dest(SCSS_DEST));
    done();
   }

  function detect_change_scss (done) {
    gulp.watch(SCSS_SRC)
    done();
  }

 gulp.task("compile_scss", gulp.series(compile_scss, detect_change_scss, ));
</code>
Answer: You need to tell gulp what function to run when it detects a change.  So try this instead:
<code>function detect_change_scss (done) {
  gulp.watch(SCSS_SRC, gulp.series(compile_scss))
  done();
}
</code>


What's the name of this business model and what's the cognitive mechanism involved?

Question: The business model I'm referring to is quite common nowadays: SAAS businesses offer free access to their product or service without any barriers, except for limits on usage. Once they have amassed a large user base, they abruptly close off access to the free version, eliminating the free trial option entirely. Examples of companies following this model include Midjourney, Kaiber, and potentially Figma in the near future.
It's important to note that this model differs from freemium, as freemium continues to offer a free version alongside premium options. It's also distinct from a timed demo (or trialware), which typically imposes time restrictions and provides users with a clear countdown. Instead, what I'm describing involves an unknown duration of free access that is suddenly and unexpectedly terminated or given minimal warning.
I have seen it before but can't remember where and Google is not helping (maybe not using  the right search terms). The most similar name I have found is "Free-to-Paid Conversion Model", but it's not that, it was another name.
Additionally, I'm curious about the cognitive mechanism that plays a role in users accepting it in a significant proportion. I understand that it involves the Reward System, but I'm interested in knowing the exact specific mechanism among the various options of the Reward System.
Comment: While interesting, I think this is more a marketing question than a UX-specific issue. I'm voting to close it.
Comment: I think cognitive and behavioral psychology questions are on topic here, hence the tags. Furthermore, it's for an article I'm writing for a UX website
Answer: I haven't come across a term for an unexpected, unannounced conversion of a product from free to paid. It seems that companies generally do this under some form of keep-the-lights-on duress.
Some adjacent concepts that might lead to finding this term include:

Forced continuity, where a user signs up for a free level of a product and suddenly starts experiencing charges without expectation or notice. This seems to apply as a rolling deceptive pricing practice (each customer receives first charge after 90 days) vs. a big-bang, everyone-on-the-platform-gets-charged event.
Smoke testing, where a business tests product market viability by measuring interest through a task that customers perform that demonstrates interest, such as clicking a CTA button, or signing up. But that doesn't generally cover fully-baked products being used over time.
Walled gardens, where customers sign up for an (often free) platform that becomes difficult to leave later (Facebook, Apple/Google photos), so they're pressured into staying with whatever pricing changes are introduced. This concept isn't specific to pricing, though.

As for the cognitive system that leads users to accept this, I've heard it called the Reciprocity Principle.


How do I get my Mass Effect 3 save files back after Origin cloud sync ate them?

Question: I appear to be running a beta copy of Origin (I have no idea why, I'm not sure I asked for it) which offered to sync my Mass Effect 3 save games to the cloud.  Unfortunately, after a 12 hour playing session, it appears to have deleted my save game rather than syncing it.  Is there any way to recover my progress?
Answer: As it happens I was able to solve this problem because I store all of my game save files in Dropbox, which I have discovered gives me the ability to undelete deleted files and directories, so while this worked for me, it isn't of general usefulness.
I do, however, recommend storing save files on a cloud storage platform for easy transfer between machines, backup and now for precisely this sort of situation.  In the case of Dropbox, it is necessary to create symbolic links from the place where Windows expects the save files to be to the Dropbox.
To do this, one opens a command prompt Window with adminstrator privileges:
<code>mkdir c:\users\<username>\documents\dropbox\savefiles
move c:\users\<username>\documents\bioware c:\users\<username>\documents\dropbox\savefiles
mklink /d c:\users\<username>\documents\bioware c:\users\<username>\dropbox\savefiles\bioware
</code>
These instructions for Windows 7/Vista. Everything except the "mklink" command can of course be done using the GUI.
Directory locations may vary depending on your local setup.
Answer: I would recommend using Recuva to try and restore deleted files. Super User might have some more extensive advice regarding restoring deleted files. I am not an expert on Origin, but perhaps there is an option to manually trigger the sync to download the saves from the server, provided it did upload them there.


Deck footing close to the edge of a short retaining wall

Question: The middle of three deck posts will be within a few inches of the edge of a 24 inch retaining wall. This is in a temperate area (Seattle) and the ground basically never freezes more than an inch or two.   My thoughts:

County (permitting) should have no problem with the situation if I dig down 24 + 20 inches = 44 inches, put a few inches of gravel and then a full 48 inch tube of concrete - which puts us 4 inches above grade.  That's 44 inches of concrete below ground including 20 inches below the bottom of grade below the retaining wall.

I do believe based on a past discussion that the permitting officer will tell me flat out that is overkill. In any case lets consider this the safe/fallback approach.   It is a lot of concrete.

Alternatively: dig down the same depth, but place a few more inches of gravel, so that the concrete portion is maybe forty inches or high thirties instead of a full 48. In that case the concrete still reaches below the bottom of the retaining wall but only by single digit inches instead of 20.  I believe that should be plenty structurally but will be soliciting comments [and approval] for same.

Other thoughts?

** Update I did find this resource that shows that the IBC condones my thoughts of using a concrete "channel" wider than the post but narrower than the footer  to connect the post to the footer.
It is also the case that my solution references the specific footer calculations and thus is a carefully considered one.  It exceeds what the County Permitter has said would meet the requirements.
This question appears to have been closed in response to my questioning the need to go down 40+ inches below grade - suggested by another answerer in Minnesota - when Seattle area is relatively temperate and does not have 40 to 48 inch frostlines like they do.
Comment: @crip659  Think about it.  Retaining wall is constructed for a given load. If we just put a pier pad from 12 inches below grade to grade - and especially near the _edge_ of the wall thats potentially a large amount of additional lateral pressure . The wall *will* give way unless it were heavily over engineered to begin with.  The answers I am working on transfer the pressure to below the level of the retaining wall entirely
Comment: had my engineer want my deck footing to go to same grade as my house footings to avoid the lateral pressure - was going to be a lot of concrete - when I challenged him he backed down and decided there won't really be a lot of load on the deck and the lateral load on the 8" pour concrete rebar re-inforced foundation wall would easily handle it.  agree with your retaining wall could be crap but I'd take the alternate approach you suggest as the load is transferred lower than bottom of wall in that case too.
Comment: @crip659  Yes and I specified the local conditions about near to edge of a retaining wall. This does not follow a typical path to calculate the depth: the permitting office will not have a canned response on it.
Comment: Beside a retaining wall or beside a house foundation for an addition, should be almost the same.  It depends on how much you trust the retaining wall not to give way.
Comment: Is the distance to the retaining wall more, or less, than the depth requirement *sans* retaining wall?
Comment: In the "proposed solution"  the intention is for the outer edge of the post shaft  to be not more than several inches  from the retaining wall. I will be discussing with County permitting whether that is in fact allowed: but in any case it will be less than the *actual* depth of the footer, though not less than code requirement which is only six inches.
Comment: "Not more than several inches" probably means you need to drop your footing down below the frost line at the *bottom* of the wall.
Comment: @Huesmann that may be the case.   I wonder what the county will say. The frost guidelines of 12 inches here are from before the _significant_ climate change effects.  There has been less than one inch ground freezing for years here.  The permitting office may also consider the (boulder/gravel) wall itself provides some amount of insulation
Answer: Proposed solution
Rebar-reinforced concrete pillar connecting the deck post [above grade] to a full concrete /rebar footer located below the base level of the retaining wall
Details:

Post is attached to the pillar via the typical Steel bracket that provides the separation from the soil and thus slows the rotting
8" or 10" concrete pillar constructed using a sonatube
Pillar is seamlessly connected to the concrete footer 30 inches down. This puts the top of the footer six inches below the bottom of the retaining wall
Footer is 18 inch diameter 12 inch thickness with 2x2 rebar mesh. Note: code is actually just six inches, but let's be generous
Footer rests atop four inches of hardscrabble.
Single [concrete] pour for the pillar and the footer

Fill 'er up!

Calculations [if anyone cares]

Deck is 130sqft, so the tributary sqft is 33 per each of the 3 posts.

Post is 6x6 The required depth of the pier depends on the soil bearing capacity and whether using square or cylindrical piers.  Let's determine the first part:

Soil bearing capacity.  I will use a very thick layer of hardscrabble gravel. A conservative number is 2100 pounds/sq inch but might easily exceed 3K.  I will use the lower number that leaves a large safety margin. Reference:  http://www.geotechdata.info/parameter/bearing-capacity

the Cylindrical Base Footing

Six inches is thin for a pier, i'll be going with 12 inches
instead.
Some additional thoughts  The 24 inches of soil in the retaining wall may not count much for strength but they do count for frost protection. More generally it is helpful to understand the engineering and materials actually necessary (and then do a bit more).  In all of my proposed solutions the footer below the base of the retaining wall is already double the amount required by code. The differences is in how much more concrete is being used given the extra condition of being on a the retaining wall
Footer calculation:  https://apps.leg.wa.gov/wac/default.aspx?cite=51-51-0507
Answer: Your original plan (footing depth below the lower grade) is fine. The only problem is your psychological barrier, meaning that you seem to think 48" is absurdly deep. It isn't. In my region frost footings are to 42". Just to my north they're 48", and a bit further they're 60".
Get over that line of thinking and the path becomes clear. One 48" hole is not a big hurdle. A post-hole digger (two-handled contraption) makes it fairly easy.
Comment: The perspective is less about how much digging to do and instead  "how much material and engineering is needed to meet the need/requirement at hand."  Meeting the need and then over-engineering _a bit_ but not excessively is the point of the question and my proposed solutions. That does depend on locale. If you're in the Upper Midwest or Plains states as it seems the need is different.
Comment: I have added details in the question supporting my approach and that this approach is too much concrete.


I want to create 5 random numbers between 2 numbers and display in my textbox

Question: Im just learning C# at uni and seem to be struggling to get this random number to out put in a textbox. I havnt learnt a language before this so apologies if its a simple question.
I want to create 5 random numbers, between two different numbers specified by the user. Then print the 5 numbers generated into a textbox to display them.
private void button1_Click(object sender, EventArgs e)
        {
        int firstnum = Int32.Parse(txtboxnum.Text);
        int secondnum = Int32.Parse(txtboxnum2.Text);

        Random random = new Random();
        int randomNumber = random.Next(firstnum, secondnum);

        Int32 loop = 0;
        do
        {
            loop++;
        }
        while (loop > 5);

        string myString = randomNumber.ToString();

       string  txtboxanswer = myString;

I would be much appreciative of any suggestions where im going wrong. As i just cant seem to get the answer to appear in my textbox. I know i must be close. I hope :)
Thanks for all help in advance.
Comment: you need all the 5 values in same text box  altogether at a time?
Comment: THis seems like homework, maybe it should have that tag?
Answer: You are close enough. With minimum editing of your code, it should be pretty much like this
int firstnum = Int32.Parse(txtboxnum.Text);
    int secondnum = Int32.Parse(txtboxnum2.Text);

    Random random = new Random();

    Int32 loop = 0;
    do
    {
       int randomNumber = random.Next(firstnum, secondnum);
       string myString = randomNumber.ToString();
       TextBox t= new TextBox();
       t.Text=myString;
       t.Left=0;t.Top=loop * 20;
       this.Controls.Add(t);

       loop++;
    }
    while (loop < 5);

For more on adding controls dynamically check this
Comment: It should be while(loop < 5);
Comment: Also you should put the code for generating new random number inside the loop. For each iteration there should be new generated random number.
Answer: by the way, this is how I'd do it
        int firstnum = 0;
        int secondnum = 1;
        Random random = new Random();

        int[] randomnums = new int[5];

        for (int i = 0; i < randomnums.Length; i++)
        {
            randomnums[i] = random.Next(firstnum, secondnum);
        }

and then you can do something like
string myString = randomnums[1].ToString()

to get the string representation of a particular number.
Answer: Try this :
Random rand = new Random();
for (int i = 0; i < 5; i++)
{
    int a = rand.Next(Min, Max);
    textBox1.Text =  textBox1.Text + string.Format(" {0} ", a.ToString());
}

Comment: What's the use of for loop here? You are overwriting last value after every iteration.
Answer: you are on the right track, I think the only thing you are missing is to assign the string to a textbox. Just place another textbox (let's say answertxtbox) and write in the end of your loop the following:
answertxtbox.Text += txtboxanswer + ", ";

Answer: Simply, you did not set the Text property of the TextBox to the result.
txtBoxName.Text= myString

Comment: string  txtboxanswer.Text = myString; This gives me a red line under the txtboxanswer.Text am i missing something else?
Comment: got it. take the string out at the start. Thanks
Comment: @user1735367 I assume that you have a TextBox called txtBoxName
Answer: Just because everyone seems to be answering...
 int firstnum = Int32.Parse(txtboxnum.Text);
 int secondnum = Int32.Parse(txtboxnum2.Text);
 Random random = new Random();

 List<int> results = new List<int>();
 for (int i =0; i < 5; i++)
 {
     results.Add(random.Next(firstnum, secondnum));
 }

 answertxtbox.Text = String.Join(",", Array.ConvertAll<int, String>(results.ToArray(), Convert.ToString));

Note: I wouldn't actually do it this way but it does illustrate that there are many, many ways of solving the same problem.


Xcode 8 localization import crash

Question: Xcode (8.1) is crashing when I import the localizations for my project.
It also crashes when I export and then import the same xliff file whithout modification.
Here is the xliff file: http://ge.tt/7J5UY3i2
Here is the full crash report http://pastebin.com/JsJFeCqB.  Any tips or workarounds for this?
Application Specific Information:
ProductBuildVersion: 8B62
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[Xcode3VariantGroup addToTargetDefaultResourcesBuildPhase:]: unrecognized selector sent to instance 0x7fe69615cba0
UserInfo: (null)
Hints: None

Backtrace:
  0   __exceptionPreprocess (in CoreFoundation)
  1   DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2   objc_exception_throw (in libobjc.A.dylib)
  3   -[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
  4   ___forwarding___ (in CoreFoundation)
  5   _CF_forwarding_prep_0 (in CoreFoundation)
  6   __81+[IDELocalizationWork fileReferenceStreamForName:directoryPath:superitem:target:]_block_invoke (in IDEFoundation)
  7   __33-[IDEStream(IDEStreamMonad) map:]_block_invoke (in IDEFoundation)
  8   __24-[_IDEStreamMap onNext:]_block_invoke_4 (in IDEFoundation)
  9   -[_DVTTimeSlicedMainThreadOrderedUniquingWorkQueue _processWorkItemsWithDeadline:] (in DVTFoundation)
 10   -[DVTTimeSlicedMainThreadWorkQueue _processWithDeadline:] (in DVTFoundation)
 11   -[_DVTTimeSlicedMainThreadActiveWorkQueues _processWorkQueuesOnDeadline] (in DVTFoundation)
 12   __NSFireDelayedPerform (in Foundation)
 13   __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation)
 14   __CFRunLoopDoTimer (in CoreFoundation)
 15   __CFRunLoopDoTimers (in CoreFoundation)
 16   __CFRunLoopRun (in CoreFoundation)
 17   CFRunLoopRunSpecific (in CoreFoundation)
 18   RunCurrentEventLoopInMode (in HIToolbox)
 19   ReceiveNextEventCommon (in HIToolbox)
 20   _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
 21   _DPSNextEvent (in AppKit)
 22   -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
 23   -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
 24   -[NSApplication run] (in AppKit)
 25   NSApplicationMain (in AppKit)
 26   start (in libdyld.dylib)

Comment: Im having same issue. Did you find anything yet?
Answer: This issue kills me. The tool could/should work and make your life so much easier, but it just doesn't. I had this problem over the summer and fixed it with the info.plist tip in the first bullet, but I've recently updated the project and I'm back in xliff exception hell again. On the bright side, my current crash seems to be happening after it finishes doing the work so I am able to keep working.
There are a bunch of things that can go wrong and cause the import to crash. Usually Xcode just blinks out of existence. If you want to see some info before the crash, use xcodebuild:
xcodebuild -verbose -importLocalizations -localizationPath "lang.xliff" -project ./myProject.xcodeproj

When you localize, don't add a language directly to an info.plist. Instead add a InfoPlist.Strings file to your project and add the language to that. You may need to manually create the file in each lang.lproj folder. Make sure you don't have an info.plist file in any lang.lproj folder other than base.lproj.
When localizing Settings.bundle, create your lang.lproj folders. When you create the Root.strings file, capitalization matters. It must be "Root.strings" otherwise it might work on iOS, but it won't work on the iOS Simulator.
Look around in your project structure. After you work with the crashing tool you end up with a bunch of files in the wrong place. You can have a Localized.Strings file in the root group of your project. Remove those.
Only use base.lproj instead of en.lproj so manually remove en.lproj files if you find them in the project.
the XLIFF file does need to be well formatted, but I don't think that causes a crash.
not for you, but supposedly there was a specific crash fixed in Xcode 7 so make sure you are on the latest to avoid that one, at least.

I have some python scripts for living with xliff. They need source path's updated in some of the scripts, but they may help out in the long run: https://github.com/danloughney/xliffHell
Comment: There must be something wrong with my project file or workspace. I have a new app which does not crash when importing XLIFFs. if you get this crash, maybe completely recreating the project will help.
Comment: Using the command line approach allowed the import to work for me without any  further changes. Xcode 10.1 would crash every time.
Comment: This works great for me but XCode still crash when I import, guess I have to save this snippet.
Answer: One of your strings contains double quotes. Try replacing them by " in your untranslated XLIFF file and see if you can re-import that file. This is just a wild guess, and I do not have XCode 8.1 at hand to try and reproduce this myself, but this is the only thing I noticed in your XLIFF file that looked dodgy.
Comment: Sorry...
Next wild guess: your translated XLIFF does not validate against the XLIFF 1.2 strict schema. Some `` elements occur before their ``. I assume that this is not the case with the untranslated file, though. And the `build-num` attribute is not allowed in the `` element.

You could also try prefixing those double quotes with a backslash: it seems strange, but for some people plain XML is not complicated enough, so they mix it with .properties syntax.
Answer: Another hint: Make sure you do not translate CFBundleName and CFBundleDisplayName. XCode will crash during the last step of the import. This issue still exist in XCode 10.3.

Xcode 8 localization import crash


Wire brackets blocking circuit brakers from tripping

Question: I set my oven to self clean. When it was complete it would not light up. I checked the breaker and found a wire bracket blocking the trip. This type of bracket was also on my other bigger appliance breakers....except my AC. . I am wondering if the bracket should have been removed when the breaker panel was operational. The panel was installed 18 months ago.
The bracket is show in the photo. It does not link the switches it acts as a block.
Comment: Can you post a picture of the breaker panel, showing the wire brackets?
Comment: Most modern breakers will trip even if the handle can't move or is locked with a locking tab.  Please post a pic and/or the model number of your breaker panel.
Comment: George, please [take the tour](http://diy.stackexchange.com) to understand how to respond to answers.
Answer: As Tyson pointed out modern breakers are "Trip Free" meaning they can trip even if their handles are locked on.
The "wire bracket" you refer to is a breaker handle lock that is used just to keep people from inadvertently turning a breaker on or off that you want to stay off or on.
I put one on my sump pump circuit. There should also be one on your smoke detector circuit.
Answer: It's more likely you are describing a handle TIE BAR that makes two single pole breakers act as a 2 pole breaker. It is not "blocking" the breaker from tripping, it's the other way around. Usually only one side trips, then this is supposed to make both sides open. But at the very least, it forces you to reset BOTH sides to make it work again. So make sure you move BOTH breaker handles all the way to the fully OFF position, then you can move them both back to the ON position.
By the way, THESE are "legal" tie bars on breakers:

If yours looks like this, it is ILLEGAL / hackwork:


Using dynamic filter from Variable on Prepared Statements

Question: I have problem with MYSQLI query prepared statements, I would like to filter out code based on post value.
Here is my code
    $arrfilter = array();
    if(!empty($_POST['website'])){
        $website = $conn->real_escape_string($_POST['website']);
        array_push($arrfilter,"website='$website'");
    }
    if(!empty($_POST['gamename'])){
        $gamename = $conn->real_escape_string($_POST['gamename']);
        array_push($arrfilter,"gamename='$gamename'");
    }
    if(!empty($_POST['action'])){
        $action = $conn->real_escape_string($_POST['action']);
        array_push($arrfilter,"action='$action'");
    }
    if(count($arrfilter) > 0){
        $filter = implode(' and ',$arrfilter);
    }
    $fdate= "%$date%";
    $sql = "SELECT url,referrer,ip,user_agent,action,date FROM cpa_track WHERE date LIKE ? and ? ORDER BY date DESC";
        $process = $conn->prepare($sql);
        $process->bind_param('ss',$fdate,$filter);
        $process->execute() or die("Error: ".$conn->e

rror);
    $process->store_result();

My achievement is to use $filter as dynamic filter on Mysqli prepared statements. How can I do this as I received this

Fatal error: Call to a member function bind_param() on a non-object
Comment: `SELECT url,referrer,ip,user_agent,action,date FROM cpa_track WHERE date LIKE ? %$date% ORDER BY date DESC` is not valid sql
Comment: @bassxzero Also, not using prepared statements properly at all.
Comment: @bassxzero. I have put %$date% as bind_param anyway. I just need to fill out $filter value in the conditional.
Comment: how about this

$sql = "SELECT url,referrer,ip,user_agent,action,date FROM cpa_track WHERE date LIKE ? and ? ORDER BY date DESC";
 $process = $conn->prepare($sql);
 $process->bind_param('ss',$fdate,$filter);

I just got an empty data.
Comment: That's because your entire `$filter` string is going to be quoted when you bind it like that
Comment: @PatrickQ is there anything I can do to achieve this. My achievement is to use filter based on the post input. If it is not empty, then the filter would be included on $sql.
Comment: You could use the bind_param method like this: `$stmt->bind_param($types, ...$params);`
Source: https://stackoverflow.com/a/36457865/1461181
Answer: I put this together using the code at the end of this comment on the manual page for bind_param().  I use PDO, not mysqli, so I haven't actually tested this.  The logic seems to be sound though.  The concept is that you incrementally build the parameters that will be sent to bind_params() and then use reflection to apply the constructed values.  Just FYI, I find doing this far less complicated with PDO thanks to the ability to use named parameters and call bindValue() multiple times.
$conditions = "";
$types = "s";
$values = array($fdate);

if(!empty($_POST['website'])){
    $conditions .= " AND website = ?";
    $types .= "s";
    $values[] = $_POST['website'];
}
if(!empty($_POST['gamename'])){
    $conditions .= " AND gamename = ?";
    $types .= "s";
    $values[] = $_POST['gamename'];
}
if(!empty($_POST['action'])){
    $conditions .= " AND action = ?";
    $types .= "s";
    $values[] = $_POST['action'];
}

$bindArray = array($types);

foreach($values as $value)
{
    $bindArray[] = $value;
}

$fdate= "%$date%";
$sql = "SELECT url,referrer,ip,user_agent,action,date FROM cpa_track WHERE date LIKE ? $conditions ORDER BY date DESC";
$process = $conn->prepare($sql);

$refClass = new ReflectionClass('mysqli_stmt');
$refMethod = $refClass->getMethod("bind_param");
$refMethod->invokeArgs($process,$bindArray);

$process->execute() or die("Error: ".$conn->error);
$process->store_result();

Comment: Do I have to use `mysqli_real_escape_string` if I bind parameters?
https://stackoverflow.com/a/2284327/1461181
Comment: @DanielO. No.  I was just copying what OP had.  I wouldn't do both.  I _would_ suggest maybe doing some sort of requirements-based sanitization/validation of the inputs, but from a technical standpoint, the binding is all you need.
Comment: @mickmackusa What specifically would you like to see? Considering this only has 1 upvote, wasn't accepted as an answer, and is 3+ years old, I can't imagine there's a whole lot of people clamoring to use this as a dupe target.
Comment: @mickmackusa  I removed the calls to `mysqli_real_escape_string()`


How to Change the Background colour of a table-column in html and css?

Question: How to Change the Background colour of a table-column in html and css? I know how to change row colour. But I just can't seem to do this.
Comment: You could also style a [colgroup](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup).
Answer: Use the :nth-child pseudo  selector or with :first-child (in your specific case of first column)

td:nth-child(1) {
  background: red;
}

a	1

b	2

In your specific case it's also doable with:
td:first-child {
   background: red;
}

Comment: Thanks, you saved the day
Comment: @AnantaDevDatta glad to hear :)
Answer: You can target the first cell (td element) in each row and set the background to red:

* {
  margin: 0;
  padding: 0;
}
table {
  border-collapse: collapse;
}
table tr td:first-child {
  background-color: red;
}

cell col1	cell col2

cell col1	cell col2

cell col1	cell col2

Comment: Thanks, you saved the day too :D


Should I add a return vent to a pantry that doesn't have an a/c vent?

Question: I recently added a door to close off a walk in pantry room.  It doesn't have an a/c vent to bring cool air into it.  I didn't realize how hot the room would get.  The pantry shares a wall with the a/c inside unit.  Would adding a return air vent in the wall under the a/c unit encourage cool air into the room?  The new air vent would open up into the same area where the other a/c return vents are,  There is about 1.5 inches open at the bottom of the door.  Is that enough?
Comment: Welcome to StackExchange!  But I am confused. What would the two air paths be (conditioned and return)?
Comment: Please [edit] your post to include some pics (with your proposed modifications drawn on) or drawings (nothing fancy or to scale, just a rough drawing with dimensions written on and proposed changes).
Answer: I don't think you want to rely on encouraging cold air into the room.
I have a walk-in closet that had the same problem and I solved it with a through the wall fan similar to the one below. Mount it between a room with AC and the pantry. Cold air will blow into the pantry and the space under the door will act as a return.
Answer: You could add a return vent to pull air out, but it might not work to use the underdoor gap for conditioned air to enter the pantry. The underdoor gap on a pantry is often reduced to a bare minimum to exclude rats, mice, and other undesirable critters. This can be accomplished by the placement of a threshold across the entry of the pantry. The gap between our pantry door and the threshold is 1.5 mm (0.06 inch).
If your pantry is a walk-in, then any threshold has to be designed to avoid being a tripping hazard and to allow easy movement of a wheeled cart through the doorway.
This means air balancing of a pantry will normally require a screened vent, either in the door or in the wall. If you have a 1.5 inch gap under your door, this might be sufficient, but might not be.
Depending on the size of your pantry and how cool you want to keep it, you may find that it is necessary to have a conditioned air supply duct into the pantry.
EDIT If you would add ducting for conditioned air into the pantry, you would need either a return vent or a large vent in the door or a wall connecting to the space outside the pantry. With conditioned air going into the pantry you could keep the pantry cooler than the rest of the house in summer and in winter by adjusting the flow restriction on the incoming air. If you have a large pantry, keeping it cooler than the living space would allow storage of some fresh fruits and root vegetables out of the way, but not in the refrigerator.
EDIT2
About 5 years ago we replaced all the original doors in our 1970 build tract house. For the small pantry (2 ft deep x 3 ft wide) we used a custom made solid oak screen door. From the mfgr's options we chose old fashioned copper screening. If you search online for pantry doors, you see many offerings with a glass panel, but these don't allow air flow.


ngAnimate parent vs child in AngularJS 1.2

Question: In AngularJS 1.2, if I use a parent animation, the child animation doesn't work.
If I comment out app.animation('.parent', function () { .. }, then the child animation starts correctly.
How to get both parent and child animations working at the same time?
Plunker of my code
HTML:
<button ng-click="anim.toggleParent()">reveal parent</button>
<button ng-click="anim.toggleChild()">reveal child</button>

JS:
app.animation('.parent', function () {
    return {
    // ...
    };
});

// this doesn't work with parent animation =(

app.animation('.child', function () {
    return {
    // ...
    };
});

Answer: Just insert ng-animate-children to the parent (Angular 1.2+).
<button ng-click="anim.toggleParent()">reveal parent</button>
<button ng-click="anim.toggleChild()">reveal child</button>

Check the ngAnimate documentation:

Keep in mind that, by default, if an animation is running, any child elements cannot be animated until the parent element's animation has completed. This blocking feature can be overridden by placing the ng-animate-children attribute on a parent container tag.

             ...

When the on expression value changes and an animation is triggered then each of the elements within will all animate without the block being applied to child elements.
Answer: Not sure whether this thread is closed. If so recommendation would be very helpful.
Facing the same issue here.
Angular animate has the below lines indicating that the child animations will not be triggered if parent has animation.
Not sure whether this is an issue or works as expected.
    //skip the animation if animations are disabled, a parent is already being animated,
    //the element is not currently attached to the document body or then completely close
    //the animation if any matching animations are not found at all.
    //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found.
    if (animationsDisabled(element, parentElement) || matches.length === 0) {
      domOperation();
      closeAnimation();
      return;
    }

Have raised a thread in Angular google group referenced the issue back here.
Answer: Also not sure if this thread is closed, but you could always edit the angular-animate.js file.  Function animationsDisabled is where angular looks for the parent element to see if it will allow the child to animate. At the top of this function I added a check to see if the parent element has a class of animation-override (can be whatever you define). This way you can override the default functionality when needed.
function animationsDisabled(element, parentElement) {
    if (parentElement[0].classList.contains('animation-override')) return false;

    if (rootAnimateState.disabled) return true;

    if(isMatchingElement(element, $rootElement)) {
      return rootAnimateState.disabled || rootAnimateState.running;
    }

    do {
      //the element did not reach the root element which means that it
      //is not apart of the DOM. Therefore there is no reason to do
      //any animations on it
      if(parentElement.length === 0) break;

      var isRoot = isMatchingElement(parentElement, $rootElement);
      var state = isRoot ? rootAnimateState : parentElement.data(NG_ANIMATE_STATE);
      var result = state && (!!state.disabled || !!state.running);

      if(isRoot || result) {
        return result;
      }

      if(isRoot) return true;
    }
    while(parentElement = parentElement.parent());

    return true;
  }
}]);


Give specific name for uploadable files

Question: I have this code, to upload multiple files.
I would like to add a custom name for each file, beacuse i will store them in sql like this:
filename-1-2017-05-02-12:30:00 (1 is the actual array index, and after a date time)
<code>    if(isset($_POST['submitButton']))
{
    if(isset($_FILES['gallery']))
    {
        if($_FILES["gallery"]["size"] > 0 )
        {
            foreach($_FILES['gallery']["name"] AS $key=>$file)
            {
                if($_FILES['gallery']['size'][$key]  != 0 )
                {
                    $target_path = "../documents/";
                    $target_path = $target_path . $_FILES['gallery']['name'][$key];

                    printr($_FILES['gallery']);
                    die();

                    if(move_uploaded_file($_FILES['gallery']['tmp_name'][$key], $target_path))
                    {
                        //$file_name = basename($_FILES['dok_file']['name']);
                        header("Location: ".$host."/".$admin_folder."/feltoltott-fajlok.php?new=1");
                    }
                    else
                    {
                        $error[] = "A fájl feltöltése nem sikerült, próbálja újra.";
                    }
                }
            }
        }
    }
}
</code>
Comment: Not really connected to OP's question, but don't you think that one should avoid `:` or any special character in a file name ?
Comment: this is as simple as concatenating the date to the filename(s). Surely you can Google that.
Answer: http://php.net/manual/en/function.date.php
<code>$target_path = "../documents/" . $_FILES['gallery']['name'][$key] . "-$key-" . date( "Y-m-d-H:i:s" );
move_uploaded_file( $_FILES['gallery']['tmp_name'][$key], $target_path );
</code>
Comment: This doesnt add that the files name. If i print_r the files array, i get the same name, as the file name is.
Comment: And how can i give a variable for each files? I want to save them into an sql table.

Give specific name for uploadable files


ordering 4 events per year into absolute numbers

Question: I have a quite simple problem, but for some reason I just can't wrap my head around the solution. I'm trying to do this in R, but really, this is more of a math/mind gymnastics question..
I have data which is organised in this way: - notice the Year 3 event 3 missing
<code> Year    event
  1        1
  1        2
  1        3
  1        4
  2        1
  2        2
  2        3
  2        4
  3        1
  3        2
  3        4
  3        4
</code>
And I am trying to obtain a column in which i have a unique number that will go from 1 to 12 (let's call it occasion for every occasion you had since t1 to capture an animal). the result should look like this:
<code> Year    Event       Occasion
  1        1             1
  1        2             2
  1        3             3
  1        4             4
  2        1             5
  2        2             6
  2        3             7
  2        4             8
  3        1             9
  3        2            10
  3        4            12
  3        4            12
</code>
I also need to do this in a way that if there is a line missing (e.g. no year 3-event 3 in my above example), I will skip the event(absolute values) for this 'occasion' as well and still have 12 as the occasion for event 4 in year 3. I obviously can't simply line them up and count the number of lines since I have multiple lines that will need to be associated to the same occasion (e.g. 2 lines with year3/event4/occasion12)
Thanks for the help!
Comment: Please first try to solve the problem yourself. If you have a specific question about why your solution (code!) doesn't work as expected, ask here.
Answer: you could use a simple formula, as below:
<code>library(tidyverse)
df <- tribble(
  ~year, ~event,
  1,        1,
  1,        2,
  1,        3,
  1,        4,
  2,        1,
  2,        2,
  2,        3,
  2,        4,
  3,        1,
  3,        2,
  3,        4,
  3,        4
)
df %>%
  mutate(occasion = ((year - 1) * 4) + event)
</code>
Output:
<code>    year event occasion
   <dbl> <dbl>    <dbl>
1      1     1        1
2      1     2        2
3      1     3        3
4      1     4        4
5      2     1        5
6      2     2        6
7      2     3        7
8      2     4        8
9      3     1        9
10     3     2       10
11     3     4       12
12     3     4       12
</code>
Comment: Yes! I think it might just work. I was playing around with the *4, but for some reason didn't manage to get this down! Thanks a lot! I'll let you know how it works


Should font styles used on a website be the same as logo?

Question: I have been given a professionally created Brand Standards Manual that defines two fonts in the brand. When I am designing the website, should I just use the fonts defined in this standard for my headings and body?
In case you are wondering, the logo is composed of Futura Bold and Myriad regular, which is what I was thinking of using for heading (Futura) and body (Myriad), which I think go well together paired.
Comment: You should be asking that question of the company. It's up to them if you're allowed to use fonts outside brand standards manual. It would seem reasonably to use the fonts in the standards if the standards apply to website design. On the other hand the standards might be just something to go by as inspiration for what the brand looks like.
Comment: Even considered from the branding point of view, it is not a good idea to let the logo's fonts proliferate. From the user point of view, it would have the effect of not helping the logo stand out distinctively in its environment. Finally from the designer's angle, the criteria for selection of fonts suitable for the logo and the text body are as different as can be.
Comment: @Chris You should post that as an answer. :-)
Answer:
if you know of a better place that I should be asking questions like this, please let me know.

Yes, you should be asking the brand stewards (aka, typically the marketing folks) at the company you got the style guide from.
Typically typography is part of the style and brand guidelines and is separate (though related) to the logomark itself.
Comment: The designer got back to me and these are his words (I am prarpharsing)

*"The fonts on the logo will have more emphasis if they  are unique on the site. Using the same fonts as the  logo will reduce the strength of the logo."*

This is been a great learning experience for me, I agree with what he is saying and I am glad that I asked him (thanks @DA01). I guess at the end of the day, the brand is extremely important (to branding experts at least) and the rest of the site should be designed in such a way that compliments (not competes, or copies) the brand of the site.
Comment: Yes I agree, I think I will run it by the designer. The designer is definetly more skilled then I am at this and would like say, 'Yes that is a good idea', or 'No, try this'.
Comment: -1 All said it is still relevant to UX and also the relevant perspective here is of UX. Pl also see my comment at OP.
Comment: @Kris did I say it wasn't?
Comment: The quote you referred to has been edited off. That said, "you should be asking the brand stewards" has the implication of "this is not the right place, or, at least, not the best place."
Comment: @kris yes it's relevant to UX, but we're not the ones to tell someone how to implement a particular brand. I'm not saying they shouldn't have asked this question here, but rather I'm answering their question of who they should be asking.
Comment: @Kelly Hays glad I could help!
Comment: @KellyHays: I have stated essentially the same thing as "Using the same fonts as the logo will reduce the strength of the logo." in my answer [see below]. Anyone into UX should be able to say that much from experience.
Answer: First of all, you can't actually use Myriad for a website, at least not without embedding it using CSS font-face, and you would have to pay for the appropriate font license (if it is not a free font).
The manual is a reference, but a logo design can be something very different from a website design. I would consider the website a product by itself, but always keeping in mind that there has to be a consistency between it and the identity. In the case of fonts, there are 'safe' ones that are usually picked because:
a) Most computers have them (so you don't need to host them), and / or,
b) They are proven to render good across browsers and ios.
Now it's quite easy to have a more personalised choice of types, mainly because of web services. But I think your focus should be on the products requirements. And about fonts, these are: Be readable, look nice. Except if your whole logo is based on a particular font, but if it's not the case, I'd use Futura or similar for headings and a standard sans-serif for body.
Here are a couple of fonts for live testing: http://charlesmoir.com/fonts/
Comment: Why would it render horribly? Font-face is quite a common standard used across all current browsers, and has been for several years.
Comment: This advice would be useful in 2008, but not in 2012, where custom font faces are increasingly the norm.
Comment: @JonW maybe not horribly, but quite badly. I've tried lots of fonts, and it depends on the ios apart from the browser, but if you want to be as ample as possible, the differences are huge. font-face has been around for quite some time now, but the results haven't really changed.
Comment: Thanks for the response @yisela, I have found the rending Myriad pro to be very nice through type-kit, even on Windows Chrome (which seems to do a poor job of rendering every other embeded font) and IE7.
Answer: Even considered from the branding point of view, it is not a good idea to let the logo's fonts proliferate.
From the user point of view, it would have the effect of not helping the logo stand out distinctively in its environment.
Finally, from the designer's angle, the criteria for selection of fonts suitable for the logo and the text body are as different as can be.
Comment: @DA01 cf my answer, "it would have the effect of not helping the logo stand out distinctively in its environment." and "Using the same fonts as the logo will reduce the strength of the logo."
Answer: You should also consider typographic contrast; it may strengthen the power of a logo and enhance the readability of a site. Read about the Seven principles of typographic contrast
But it depends on the Brand Guidelines if you have any leeway in using them.
Answer: Although, I agree with @DA01. I would have to say that for a design it is always very good idea to incorporate as much branding into the website as possible. I would not go the extreme and use only the brand fonts on the site. My suggestion along with working with the client/marketing department would be to include the brand fonts in an attention grabbing way. Such as headings and call to action areas.


comparing structure variable with a string

Question: I have to compare 2 strings, one is from a structure member and the other is "Empty".
I use strcmp like so:
if (strcmp(e[n]->seat[seat/5][(seat%5)-1], "Empty")==0)

I am getting the error Invalid conversion from char to const char*.
Can someone please help me out with this?
Comment: Just *try* a `&` before `e[n]`. Difficult to know for sure without more code.
Answer: It sounds like e is an array of structures each containing a 3 deminsional character array. You should probably be using a two deminsional char pointer array unless you /know/ the string length won't change but if you don't just use the address like chnossos said.
if (strcmp(&(e[n]->seat[seat/5][(seat%5)-1]), "Empty")==0)


Passing and copying arrays?

Question: I am trying to create two Arrays in main then call a method where the values of the first array(which I randomized) are copied to the second array,I am getting stuck at calling the method and passing. I am lost on how to call and pass arrays
any help would be appreciated.
class C9hw5

 {

   public static void main(String[] args)
     {

        int[] ar = new int[10]; // random array

        int[] at = new int[10]; // array two

        Random r = new Random();

        for(int i = 0; i < ar.length; i++) // initializing it to random

         ar[i] = r.nextInt();

        System.out.println("The random array displays");

        for(int i = 0; i < ar.length; i++)

         System.out.println( ar[i]);

        copyArray();
     }

   public static void copyArray(int ar[], int at[])

     {

        for (int i = 0; i < at.length; i++)

            at[i] = ar[i];

     }
  }
}

Comment: You are not passing any arguments to the copyArray() function. You should pass both of your arrays like `copyArray(ar, at)`
Answer: You didn't passed your arrays to the method, replace copyArray(); by copyArray(ar, at);.
Answer: the code is cleaned up a bit to make it work.  Coder gave the essence of the answer above.  a reference to some options (e.g., System.arraycopy) is: Is there any reason to prefer System.arraycopy() over clone()?
import java.util.Random;

class C9hw5 {
    public static void main(String[] args) {
        int[] ar = new int[10]; // random array
        int[] at = new int[10]; // array two

        Random r = new Random();

        for(int i = 0; i < ar.length; i++) // initializing it to random
            ar[i] = r.nextInt();

        System.out.println("The random array displays");

        for(int i = 0; i < ar.length; i++)
            System.out.println(ar[i]);

        copyArray(ar, at);

        System.out.println("The second array displays");

        for(int i = 0; i < at.length; i++)
            System.out.println(at[i]);
    }

    public static void copyArray(int ar[], int at[]) {
        for (int i = 0; i < at.length; i++)
            at[i] = ar[i];
    }
}

Passing and copying arrays?


How to start/approach the Scorchers DLC?

Question: Scorchers DLC for RAGE has just been released and I am planning to buy it and take the chance to finish the game.
My last savegame was immediatly after "The Big Boss" fight. Are the new DLC mission before or after that mission? Can I use my existing savegame to play the new contents added with this DLC?
Answer: The new Scorchers DLC gives you access to a variety of new areas and quest chains. There is a post over at the Bethesda forums which shows how to start the new DLC content:

To begin the new quests, you'll first need to complete the Ghost Hideout mission for the Hagar Settlement. After finishing the first Main Story Mission, you'll be able to take on the optional DLC quest
If you've already left the Hagar Settlement, or are further in the game, you will instantly gain the quest information, pointing you toward a new cave in the starting zone of Rage
If your save happens to be in Capital Prime, you will be able to finish the area, then load into the Eastern Wasteland. From there you can journey back to the first Wasteland and reach the caves near the Hagar settlement


Open files limit not reflecting config changes

Question: I'm trying to increase the max open files hard (and soft) limit indicated by ulimit -Hn. But no matter what configuration I change, it stays on 4096 even after rebooting.
In my /etc/security/limits.conf, I have the following entries (everything else is commented out):
* soft nofile 10000
* hard nofile 50000

My /etc/pam.d/common-session looks as follows:
session [default=1] pam_permit.so
session requisit    pam_deny.so
session required    pam_permit.so
session optional    pam_umask.so
session required    pam_unix.so
session required    pam_limits.so
session optional    pam_systemd.so
session optional    pam_cgfs.so -c freezer,memory,name=systemd

Why isn't the hard limit changed to 50000, i.e. are there any other mechanisms affecting it?
Update:
Weirdly enough, it behaves differently when suing to myself first, i.e.
$ whoami && ulimit -Hn
jdoe
4096
$ su - jdoe
$ whoami && ulimit -Hn
jdoe
50000

How is this possible?
Answer: After a long time, I found out you need to add
DefaultLimitNOFILE=65535

to /etc/systemd/system.conf and /etc/systemd/user.conf as well.
Comment: That's the answer only worked
Comment: Spent 3 hours figuring that out on my own. Thanks man, that really helped!!
Answer: You should also use prlimit and update the value of the current session (Bash) you are in. Try running the below script.
echo "add openfiles limit..........................."
sudo cp /etc/security/limits.conf  /etc/security/orig_limits.conf
sudo cat <<EOT >> /etc/security/limits.conf
*               hard    nofile          33000
*               soft    nofile          33000
root            hard    nofile          33000
root            soft    nofile          33000
EOT

sudo echo "session required pam_limits.so" > /etc/pam.d/common-session
sudo ulimit -n 33000
ulimit -u unlimited

update_ulimit_per_pid(){
    sudo echo "prlimit for pid "$pid" before updating is "$(ulimit -n)
    sudo echo "Updating ulimit for pid: "$pid
    sudo prlimit --pid $pid --nofile=33000:33000
    sudo echo "prlimit for pid "$pid" after updating is "$(ulimit -n)
}

for pid in `ps -ef | grep 'bash' | awk '{print $2}'` ; do update_ulimit_per_pid ; done

This should work. This will not only update ulimit when you relogin, but also the in the bash session you are in.


Using a Generic Table in Linq Join Query

Question: I have various list type tables in the Db that populate dropdowns. I writing a Linq query to get the list data when joined to a translation table. The list type tables could be any one:
The query so far:
var listType = (from t1 in _context.Translations
               join s in _context.Set<T>() on t1.TranslationCode equals s.GetType().GetProperty("TranslationCode").GetValue(s, null)
               select s).FirstOrDefault();

I'm struggling to set the generic type property on the join.
Error:
{ error = The LINQ expression 'DbSet<Translation>()
    .Join(
        inner: DbSet<Status>(),
        outerKeySelector: t => t.TranslationCode,
        innerKeySelector: s => s.GetType().GetProperty("TranslationCode").GetValue(
            obj: s,
            index: null),
        resultSelector: (t, s) => new TransparentIdentifier<Translation, Status>(
            Outer = t,
            Inner = s
        ))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https: //go.microsoft.com/fwlink/?linkid=2101038 for more information. }

Which I'm guessing is saying Linq can't convert into SQL. Thanks
Comment: You can't use a generic context.Set ... probably you should write a query for each of your list types here.
Comment: Your expression needs to be something that could be translated to SQL, which your expression is not. As the message says, get your result to local first using something like AsEnumerable and then do the join on local data.
Answer: Linq doesn't know how to translate .GetType()... to SQL. Get your data to local using something like AsEnumerable() and make the join there. ie:
var listType = (from t1 in _context.Translations.AsEnumerable()
               join s in _context.Set<T>().AsEnumerable() on t1.TranslationCode equals s.GetType().GetProperty("TranslationCode").GetValue(s, null)
               select s).FirstOrDefault();


Error while updating google event

Question: I am trying to update google calendar event but it is not working with default calendar .. i mean when i use 'primary' default calendar it is not working
this is my code

const USER_EVENT_TYPE='primary';
const CLASS_EVENTS='Events';
 if ($googleClient->getAccessToken())
        {
            if(!class_exists(self::CLASS_EVENTS))
            {
                $includeApplicationFiles=Mage::getBaseDir(self::LIBRARY_PATH);
                foreach (glob($includeApplicationFiles.self::INCLUDE_ALL_FILES) as $retrieveFiles)
                {
                    include $retrieveFiles;
                }
                $allCalendarEvents = $googleCalendar->events->listEvents(self::USER_EVENT_TYPE);
                foreach ($allCalendarEvents->getItems() as $getSingleEvent) {
                    if($selectedEventValue==$getSingleEvent->summary)
                    {
                        $getSingleEvent->setSummary($selectedEventValue);
                        $addEventGuests = new Google_EventAttendee();
                        $addEventGuests->setEmail($selectGuestValue);
                        $invitedGuests = array($addEventGuests);
                        $getSingleEvent->attendees = $invitedGuests;
                        $updatedEvent = $googleCalendar->events->update(self::USER_EVENT_TYPE, $getSingleEvent->getId(),$getSingleEvent);
                    }
                }
            }
        }

Having error like this

Fatal error:  Uncaught exception 'Google_ServiceException' with message 'Error calling PUT https://www.googleapis.com/calendar/v3/calendars/primary/events/5vmet3i6mmak81utnj2p0ebv8g?key=900220817963%40developer.gserviceaccount.com: (403) Forbidden' in C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php:61
Stack trace:
#0 C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php(35): Google_REST::decodeHttpResponse(Object(Google_HttpRequest))
#1 C:\xampp\htdocs\magento\lib\google-api-php-client\src\service\Google_ServiceResource.php(152): Google_REST::execute(Object(Google_HttpRequest))
#2 C:\xampp\htdocs\magento\lib\google-api-php-client\src\contrib\Google_CalendarService.php(591): Google_ServiceResource->__call('update', Array)
#3 C:\xampp\htdocs\magento\app\code\local\Social\Google\Model\Google.php(360): Google_EventsServiceResource->update('primary', '5vmet3i6mmak81u...', Object(Google_Event))
#4 C:\xampp\htdocs\magento\Connectors\google\AutoCompleteCalendarEvents.php(16): Social_Goog in C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php on line 61

Comment: (403) Forbidden:  Something is wrong with your authentication you don't have access if you are seeing that.
Answer: Without seeing all your code I would make two suggestions:
You can update your key and check your settings in the developer console. If you have changed your project namespace and used the same key, you can have problems.
The other thing is if you have set your developer key anywhere to delete that:
$googleClient->setDeveloperKey('insert_key');

If you have a read through the following link, it shows a range of similar problems.
https://code.google.com/p/google-api-php-client/issues/detail?id=218
I should add, that 403 Forbidden indicates that you are communicating with the server successfully, but you lack permission for that action/operation.
Which is why it leans towards:
1. the key being invalid, or
2. if the key is valid, and you have overridden the valid key value in  your code.   Thus presenting a new value, which (of course) is an invalid key.
Let me know if you need more help.

Error while updating google event


Does ZFC decide every question about finitely generated groups?

Question: In ZFC, we can easily say when a triple $\mathscr{G}=\left\langle G,\cdot,1 \right\rangle $ is a group. Furthermore, we can say when a group is finitely generated: First define a "canonical" finitely generated group on $n$ generators by taking the set  of all finite ordered tuples of elements from a fixed set of size $n$ ("words in these elements"), and defining the usual equivalence relation that will make the set of equivalence classes into a group. Second, a f.g. group will be a group isomorphic to some quotient of that canonical f.g. group (I believe we can say all this in ZFC, please correct me if I'm mistaken).
So now the question is - will every statement about f.g. groups be decidable in ZFC? Put differently - can any statement about these groups be independent of ZFC?
What about finitely presented groups (where the the group in the quotient is itself f.g.)?
For reference, I think of Whitehead's problem that was shown by Shelah to be independent of ZFC. The main difference is that here we are dealing with things that have some finiteness in them, so it is less clear to me whether they can be so manipulated.
Comment: I think this depends on what counts as a "statement about f.g. groups". Arguably one could disguise every arithmetical statement (such as "ZFC is consistent") as one about finitely generated free abelian groups -- with group product playing the role of addition and the [tensor product of abelian groups](http://groupprops.subwiki.org/wiki/Tensor_product_of_abelian_groups) playing the role of multiplication.
Comment: Nice question...
Comment: To begin, P vs NP [*might* be independent of ZFC](http://www.scottaaronson.com/papers/pnp.pdf). But then P vs NP can be formulated as a group-theoretic problem. Specifically, (I am quoting [Sapir on MO](http://mathoverflow.net/a/57750/35478) here): "Sapir, Birget and Rips, *Isoperimetric and isodiametric functions of groups* Ann. of Math. (2) 156 (2002), no. 2, 345–466, proved that P=NP if and only if the word problem in every group with polynomial Dehn function can be solved in polynomial time by a deterministic Turing machine...
Comment: @HenningMakholm, that's probably a better way of doing it than what I tried in my answer.
Comment: ..."Thus to show that P=NP one "only" needs to find an algebraic description of finitely presented groups with polynomial Dehn functions (similar to Gromov's description of groups with polynomial growth functions)."
Comment: (More generally, many questions in logic are related to questions about groups. A good example is the original proof that there exist finitely presented groups with insoluble word problem. The trick is often to create a Turing machine that halts if and only if [(property you are after)](http://cstheory.stackexchange.com/q/20984), then use this machine to create a group with e.g. word problem linked to this machine.)
Answer: You're not very concrete about what you consider a "statement about f.g. groups", but presumably we can speak about the property of being a finitely generated free abelian group.
If $G_1$ is a free abelian group on $n$ generators and $G_2$ is a free abelian group on $m$ generators, then the direct product $G_1\times G_2$ is a free abelian group on $n+m$ generators, and the tensor product $G_1\otimes G_2$ is a free abelian group on $nm$ generators.
Therefore, if you allow speaking about direct products and tensor products of abelian groups, then you can speak about addition and multiplication of natural numbers, and then you can express every arithmetical sentence. Among these is "ZFC is consistent", which is undecidable by ZFC itself (unless ZFC is, in fact, not consistent).
Answer: I am not sure I understood your question correctly, so let me state my interpretation:

Are there questions about groups which are undecidable (in ZFC)?*

The answer to this question is "yes". This is particularly interesting for finitely presented groups, due to the notion of a Markov property (see Lydon and Schupp, Section IV.4, p192). Let $\mathcal{P}$ be a property of finitely presented groups which is preserved under isomorphism. The property $\mathcal{P}$ is said to be a Markov property if:

There is a finitely presented group $G_1$ with $\mathcal{P}$, and
There is a finitely presented group $G_2$ which cannot be embedded in any finitely presented group which has $\mathcal{P}$.

Theorem (Aidan-Rabin). Let $\mathcal{P}$ be any Markov property of finitely presented groups. Then there is no algorithm which decides whether or not a given finitely presented group has the property $\mathcal{P}$.

Examples of Markov properties, and hence of properties of finitely presented groups which are not recursively recognizable, are:

being the trivial group;
being finite;
being abelian;
being nilpotent;
being solvable;
being free;
being torsion-free;
being residually finite;
having a solvable word problem;
being simple;
being automatic.

Incidentally, the property of being "being a group" for a set under an operation is undecidable (you state otherwise in your question). To see this, it helps to know that Markov properties were originally defined for semigroup presentations, and Markov proved the analogous result to the Aidan-Rabin theorem, above. Then "being a group" is a Markov property for finitely presented semigroups (because there exist semigroups which do not embed into groups), and hence is recursively undecidable.
I doubt, but am unsure how to prove, that "being finitely generated" is decidable for groups.
*This is quite different to your re-statement: "can any statement about (f.g.) groups be independent of ZFC?"
Comment: It seems that I myself might be a bit confused about what exactly does it mean "undecidable by ZFC". Could you please state exactly what do you mean when you say that, to avoid confusion?
Comment: I think that maybe what I was aiming for was more in the spirit of:
"Can there be some property P of finitely generated groups s.t. (assuming ZFC is consistent) there is a model of ZFC where every f.g. group has P, and a model where there is a f.g. group without P".
Is this the same?