Getting filemaker error "specified field is not found" during enter find and set field

Question: I'm using the code to perform a find in filemaker and getting an error message that the specified field is not found. Does anyone see what I'm missing?
<code>Enter Find Mode []

Set Field [Contact Data::car ; "--" ]

Set Error Capture [on]

Perform Find[]
</code>
Comment: The script looks right. When does the error appear and what is the exact wording of the error?
Comment: The error is 'The specified field can not be found' . I'm putting the code into the custom privileges and limited view of our customers database. The error appear when saving the code.
Answer: There is nothing wrong with find step as the error capture set on just before this script step, so it should not produce an error message.
I think there is a problem with the related field (Contact Data::car) and it is not directly related to the current layout relationship.
The simplest way to check it is to run the same query manually.
Comment: go to View /"Find Mode" menu, type your search criteria in the Contact Data::car field and press Enter
Comment: Yes this does work when searching for the type of car or county in the field
Comment: Do you run your script from the same layout?


Tile/Paver interlocked design patterns -dimensions do not add -what am I missing?

Question: Take this pattern for example, the three pieces circled there won't align at the edges if you want to maintain the same gap between the tiles/pavers.
For he horizontal 6x12 the width is 12 +2x1/4 gaps at each end =12.5"
The two pieces below it have three gaps there so the width is 6+6+3x1/4=12.75"
What am I missing ?
Comment: Are the tile exact 6x12 or nominal size like a 2x4 stud?  Bet the tile size takes the gaps in mind.
Comment: found the design pattern here https://digitalassets.daltile.com/content/dam/Daltile/website/resources/products/pattern-guides/interlocked.pdf
Comment: It looks like they use nominal sizes(as with most construction material).  The actual tile size is probably closer to 5 7/8(1/8 plus 1/8 equals 1/4 inch gap) than 6 inch.
Comment: even if it is I do not see that difference disappearing and it amplifies as you go east west in the picture. I mean the 12" wide tile is not 12" either so ...the same problem different dimensions
Comment: I am just going by guessing here and to be sure would have to measure the tiles, but imagine the tiles are sized so that pattern works to give straight lines.  Just because a label says 6x12 does not mean it will measure 6x12, might be 5 7/8 x 12 1/8(whatever).  Imagine if you go to that site, they might have a page with actual sizes.
Answer: This may help.
The blocks include an allowance for the seams.
Comment: Please re draw the above for the tiles that I encircled, geometrically it is impossible to maintain the same grout space for all the the tiles
Comment: the blocks are 6x6 and 12x6 when measured to the center of the grout gap
Comment: Got this reply from a tile expert: "Mini, for what is called a "modular" layout (what you have depicted there), the pattern will work only if the manufacturer has sized the tiles for such a layout. And there is only one grout joint size that will work.

The tiles must be sized such that two short sides + one grout joint equals one long side. If your tiles won't permit that, your layout is not gonna work. And whatever grout joint it takes to make that true is the only grout joint you can use with the entire layout.
"
Comment: In other words that won't work with just any tiles
Comment: @MiniMe it doesn't work if the tiles are exactly 6 or 12 inches.  They aren't. Unless you have them in your hand and measured them, expect them to work if the manufacturer is telling you they do.


Problem storing a hash in DB using Storable::nfreeze in Perl

Question: I want to insert a hash in the db using Storable::nfreeze but the data is not inserted properly.
My code is as follows:
%rec=();
$rec{'name'} = 'my name';
$rec{'address'} = 'my address';

my $order1 = new Order();
$order1->set_session(\%rec);
$self->createOrder($order1);

sub createOrder {
my $self  = $_[0];
my $order = $_[1];

# Retrieve the fields to insert into the database.
my $st = $dbh->prepare("insert into order (session,.......) values(?,........)");

my $session   = %{$order->get_session()};
$st->execute(&Storable::nfreeze(\%session),.....);
$st->finish();

}

sub getOrder
{
     ...

    my $session = &Storable::thaw( $ref->{'session'} );
    .....
}

The thaw is working fine because I tested it withe some rows that have been inserted correctly, but when I try to get a row that was inserted using the createOrder subroutine, I get an error saying:

Storable binary image v36.65 more recent than I am (v2.7) at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 415

The error comes from the line that have thaw. The nfreeze did not store the hash properly.
Can someone point me to what I'm doing wrong in the createOrder subroutine?
I know the module version have nothing to do with the problem.
Comment: @Sam => You have a number of open questions without accepted answers.  Assuming there is a good answer, click the check mark next to that answer to mark it as accepted.
Answer: Your problem is probably improper dereferencing here:
my $session   = %{$order->get_session()};
$st->execute(&Storable::nfreeze(\%session),.....);

This should fix it:
my $session   = $order->get_session();
$st->execute(&Storable::nfreeze($session),.....);

Since ->get_sessionreturns a hash reference, when you dereferenced it in scalar context it was turning into a string that contains statistics on the hash.  The hash %session is the empty package variable %main::session which you would have caught if you were running with use strict; use warnings;.


Trigonometry road question

Question: A road is at a constant gradient for 400m.  If the angle from the horizontal is 32°, at what height does the road climb?
Im a little confused at this so help would be great :)
Answer: Let the Height of the road be $h$ metres . Then the road and the horizontal forms a right angle triangle with Height $h$ and hypotenuse $400$ metres.
Using trigonometry  :
$$\begin{align} \sin \theta & = \frac{\text{Height}}{\text{Hypotenuse}}
\\ \sin 32^o & = \frac h{400} \\
h &= \sin 32 \times 400 \\
h & = \boxed {\color{blue}{220.571 \text { metres }}} \end{align}
$$
Comment: Fallen Prince, I think you might have broken your calculator when you fell. You need to purchase a new calculator! $\sin 32^\circ \times 400=211.9677...$

Trigonometry road question


How can I use my Xbox One S controller via bluetooth?

Question: I got an Xbox One S controller as a gift for Christmas and I found out that it can connect to a PC with Bluetooth. It's supposed to work on Windows 10 but it doesn't work on my Ubuntu PC. It shows up as an option in the Bluetooth settings but when I connect to it it just instantly loses connection. How can I use the controller via Bluetooth on my Ubuntu 17.10 PC? I would like to use it for emulators and maybe even Steam games.
Comment: For those looking for an up to date solution (as of January 2022) see this answer https://superuser.com/a/1653276/518572
Answer: To solve your problem:

Install sysfsutils
sudo apt install sysfsutils

Edit /etc/sysfs.conf (as admin), add this line at the end of the file:
/module/bluetooth/parameters/disable_ertm=1

Save changes and restart

Reference:

https://ubuntuforums.org/showthread.php?t=2339212
Comment: Thanks. I actually tried doing everything that you said to do in your answer again and now it works 100% correct! Thank you so much! This will be really helpful!
Comment: It still doesn't connect to the controller. The light on the controller never stops flashing and the PC always disconnects from the controller immediately.
Comment: Okay, this half worked. After trying a few times the controller did finally pair. The problem is that it doesn't show up as a controller in the emulator. Also, I tried running my Blender Game that I made that supports Xbox One controller input and even that didn't recognize my controller. How do I get programs to recognize the controller as a controller?
Comment: Check [this](https://www.maketecheasier.com/set-up-xbox-one-controller-ubuntu/) link, hope it works.
Comment: The solution for arch based distros: "edit /etc/default/grub and add the kernel flag 'bluetooth.disable_ertm=1' to the GRUB_CMDLINE_LINUX line. Then run 'sudo grub-mkconfig -o /boot/grub/grub.cfg' and reboot." After this, you should be able to pair your gamepad.
Comment: You can do `echo 1 |sudo tee /sys/module/bluetooth/parameters/disable_ertm` and disable/enable bluetooth to immediately apply the change until the reboot.
Comment: @CadenMitchell Had the same problem after disabling ertm, figured out that if you tried to setup the controller before disabling ertm, you will have to remove the controller completely (ubuntu settings -> bluetooth -> click on controller -> remove device) and set it up again, otherwise it will continue to disconnect.


Is it true that if $X(t)$ is a martingale then $X^{2}(t)-E[X^{2}(t)]$ is also a martingale?

Question: I'm assuming that $X^{2}(t)-E[X^{2}(t)]$ is integrable.
Comment: This is true for a Brownian Motion...
Answer: No, not in general.
For a discrete time example, let $S_n$ be a simple random walk, and let $Z = 0$ or $1$ with probability $1/2$ and independent of $S_n$.  Set $X_n = Z S_n$; this is a martingale.  Intuitively, $X_n$ corresponds to the following gambling game: flip a coin at time 0.  If it comes up tails, bet $1 on coin flips forever.  If it comes up heads, never play at all.
If you set $Y_n = X_n^2 - E[X_n^2] = X_n^2 - \frac{1}{2}n$, and consider for example the event $A = \{Y_1 = -\frac{1}{2}\} = \{Z=0\}$ which is $\mathcal{F}_1$-measurable, you can easily observe $E[Y_2 - Y_1 \mid A] = -\frac{1}{2} \ne 0$.  So $Y_n$ is not a martingale.  (Intuitively, by observing $Y_1$ you can see whether the coin $Z$ came up heads or tails.  Conditionally on the coin having been tails, $Y_n$ is going to strictly decrease forever, which a martingale cannot do.)


How can I find surface data points?

Question: I'm currently working on getting my ratship fully engineered, which means I need to gather materials. I have a good grasp on how to gather raw and manufactured materials, and some of the data (ones obtained by shield and wake scans are easy), but I'm not sure how to find encryption file and encoded firmware type data. INARA says that I can get these from missions, signal sources, and surface data points. How do I look for surface data points to gather these materials?
Answer: Do surface scanning missions. They generate random outposts with a data point for you to scan, and even give you a waypoint to the place once you honk your discovery scanner.
Obviously, you're gonna need an SRV and a discovery scanner (or scan the nav beacon, but that's inefficient). Also, a lot of these missions will get you a fine/bounty for trespass and private point access, so, preferably, do it in a cheap ship.
Quince used to be a great system if you're farming lots of those missions, and will give you some empire rank too while you're at it, but how many missions spawn depends on the state of the factions, so YMMV. If you get there, and see nothing good, try again in a couple of days.
Answer: Go to The Bug Killer.
On HIP 16613 1, in the Pleiades Sector, you can find the remains of The Bug Killer, a crashed Anaconda with 2 surface data points that can be scanned for high grade data, and 3 cargo racks that can be shot for high grade raw materials. In order to find it, perform a surface scan of the planet, or take a heading of 270 until you spot a greenish glow on the surface, where the remains of The Bug Killer's SRV can also be found. The ship itself is only a few km from there.
Once you scan these two data points, and liberate the raw materials from the doomed ship, log out to main menu and log back in. This will respawn and reset everything. This process can be repeated until you fill up on the two data types that The Bug Killer provides.

How can I find surface data points?


What is the scope of HttpServletRequest when being used in a controller (singleton)?

Question: I have this doubt... I have a singleton bean...and I want to set some parameters on the HttpServletRequest, on this way:
@RequestMapping(value = "/myUrl", method = RequestMethod.GET)
    public String myMethod(final ModelMap model, final HttpServletRequest req){
       req.getSession().setAttribute("myKey", "someValue");
       return "/myURL";
    }

So, if I set myKey, that value will be accessible only by the current user in that session? or because it is a singleton bean could be overriden by other user?
Comment: so you are adding singleton bean to the session?
Comment: Possible duplicate of [What is the lifecycle of a HttpServlet?](http://stackoverflow.com/questions/3894088/what-is-the-lifecycle-of-a-httpservlet)
Comment: I am using the controller, but by default it is singleton..
Answer: You're changing the session, not the controller. And the session is associated with the user making the request, so other users won't be able to see this value.
From getSession() documentation:

Returns the current session associated
  with this request, or if the request does not have a session, creates
  one.
Comment: Also - if accessing the session you're doing anyway with the servlet request - you can just as well use put the session as a parameter for your method, e.g. public String myMethod(final ModelMap model, final HttpSession session){ ... }


I can't solve this problem that I have with Telegram API bots

Question: I keep receiving this errors .
Jun 22, 2022 12:13:10 PM org. apache. http. imp l . exec chain .Retry Exec execute
INFO: I/O exception (java . net. Socket Exception) caught when processing request to {s}->https://api.telegram.org:443: Network is unreachable: no further information
Jun 22, 2022 12:13:11 PM org .apache .http .imp l .exec chain. Retry Exec execute
INFO: Retrying request to {s}->https://api.telegram.org:443
Jun 22, 2022 12:13:32 PM org. apache. http. imp l .exec chain. Retry Exec execute
INFO: I/O exception (java. net. Socket Exception) caught when processing request to {s}->https://api.telegram.org:443: Network is unreachable: no further information
Jun 22, 2022 12:13:32 PM org. apache. http. imp l. exec chain. Retry Exec execute
INFO: Retrying request to {s}->https://api.telegram.org:443

enter image description here
Answer: All you need is just to use tor proxy:
public class MyApplication {
    public static void main(String[] args) {
        System.getProperties().put("proxySet", true);
        System.getProperties().put("socksProxyHost", 127.0.0.1);
        System.getProperties().put("socksProxyPort", 9050);
    }
}

But previously you should install tor service:
sudo apt-get install tor


Two factor authentication in a single form

Question: We are working on implementing a Google two factor authentication in our app. Each customer can turn 2FA on and off for their users in app settings.
There was an idea to tweak this functionality. We would like to recognize a returning user with a flag about 2FA (if it's enabled or disabled) stored in cookie, and instead of displaying the Google code input in second step (after providing username and password) display it in the single form as {username, password, authentication code}.
I was trying to research this idea, but it seems nobody used it like that. Do you think it's a good idea? It makes the login process faster, limiting it to only one form.
Answer: This is a good opportunity to a/b test the options you're considering!
I've used single form, two-factor authentication logins. Here's what I've observed as an end-user of those systems.

If the user already has the 2nd factor when they begin the login process, use a single form.
If the 2nd factor is generated by completing the first step in an authentication process, use a multi-step form.

An example of the first situation is a user at an ATM. Their two factors of authentication are the ATM card and the PIN. Since they have both, there is a single form asking for the PIN (technically, the request for the PIN is triggered by them inserting the card into the reader so this could be viewed as two steps). Another example is people using a token generator like Authy. They'll have the token before they get to the login form.
An example of the second situation is authenticating to Gmail using a code received by text message as the 2nd factor. In that situation it isn't possible to know the code at the time the user name and password are entered because the code isn't sent until the first factor of authentication is verified.
If your situation allows for using a single form, then take extra care to make sure the form is clear about which data entry field is for each required piece of information. Consider putting a picture of the token generator (or app icon) to remind the user where to get their token.
Answer: Most systems, which use 2FA, use 2 steps of authentication: first the user's login and password are checked and then the user enters the OTP generated by token, sent via SMS or e-mail.
Two forms are commonly used as firstly the system checks if the login and password are correct. And only after this the user is forwarded to the second form to enter the OTP.
You can use the single form for the signing: with the login, password and one-time password. Some services have already used this idea as for example, Joomla.
Answer: It's counter intuitive > When a user gets 2 factored it means their username and password is already correct, thereby they've moved on from the login to the two factor and they are separate forms to enforce UX separation of concerns.
I haven't used the google 2FA, but I'd imagine it's got a password field, so you'd also wind up with two password fields on a single form as when entering the code they have to re-enter their password in typical setups, which wouldn't be ideal and probably wouldn't look good.


Is a weather resistant gfci required outside in a metal box with in use cover?

Question: I have a pool that is just off my deck. The gfci I have went bad so I need a new one. It was a 15 amp gfci in a metal box attached to 1/2 in emt conduit with a metal box and a non in-use cover. This is just under the lip of the deck, so it is slightly protected from weather but not completely. I plan on replacing the box and also getting a in-use cover mainly because the screw holes are stripped out. My question is: Do I need a Weather Resistant GFCI vs a Non Weather resistant GFCI? The current one was not weather resistant and went bad, it tripped and won't reset. Also if someone can explain what the difference is between a standard gfci and weather resistant? Is the weather resistant more sealed to handle more dampness from being outside? Thanks in advance.
Answer: A WR GFI uses stainless components and screws. GFI's are notorious for rusting, especially at the mounting screws. The one that went bad was probably older, before WR's were even available.
Yes, you need a WR GFI, and an in-use cover. In fact, I'd venture to bet that much of your installation is not up to code. IF it is that close to the pool the receptacle and plug must be of the locking type (twist-lock), and the circuit protected by an upstream GFI. The outside portion of the wiring to a pool motor must also be in conduit with individual insulated conductors. Older codes would allow this installation located between 5-10 feet from the pool, but NO closer than 5'. Also, the cord on the motor should be no longer than 3' and must be #12 or larger.
There are MANY codes involved with pool installations, I hope yours meets them.
Answer: Most definitely required in any outside branch circuit. It must also be installed in a weather proof box.
Comment: Just keep in mind that it's also possible to put the GFCI upstream of the outside outlet, in a more benign location :)


How to get the probability percentage of a model.predict() when clustering documents

Question: text = "Some random text string that I want to cluster"
Y = vectorizer.transform([text])
prediction = model.predict(Y)
print(prediction)

the above passes through a value which is a string and then it it returns the cluster group it thinks it belongs in (one of three).
How can I find out what the percentage of its prediction accuracy is. ie. this particular text is 90% consistent with group 1, the next text might be 45% consistent with group 2 but it will still go into group 2 none the less. I want to be able to catch items with a low accuracy.
Answer: Not at all, usually.
Even some (few) clusterers work with some probability inside, and may have a predict_proba function to get these values, these values rather capture a relative responsibility than an accuracy.
Comment: Nothing is preventing you from implementing such a logic yourself, though. For example Silhouette values work like that, have a look!
Comment: Hmm bummer. Is the distance of a data point to a centroid not a measurement of it's  probability to be in that cluster? ie. Closer to the centroid the more likely they are similar documents?
Comment: Well, it's not a probability. And in k-means there can be a far point that nevertheless clearly belongs to the cluster, and a much closer point that even is in a different cluster.


Bootstrap Navbar not working correctly: AngularCLI

Question: I included bootstrap into my angularcli project but when I try to include a navbar none of the elements are working correctly. I am using a standard boostrap navbar example from the website but it looks weird:

What is wrong with my project that is making the navbar not load correctly?
navbar.component.html

  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>
  Navbar

        Home (current)

        Link

        Disabled

    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="text" placeholder="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>

.angular-cli.json

"styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
        "styles.css"
      ],
Answer: The code below shows how to implement the navbar in Angular with ng-bootstrap and Bootstrap 4. You can see it at work in this plunker.

The ng-bootstrap library is developped for Angular, and does not require jQuery
Using Bootstrap 4, you should replace navbar-toggleable-md with navbar-expand-md
The ngbCollapse directive is used to show/hide the dropdown menu

  <button class="navbar-toggler navbar-toggler-right" type="button" (click)="isNavbarCollapsed = !isNavbarCollapsed" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>
  Navbar

        Home (current)

        Link

        Disabled

    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="text" placeholder="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>

Comment: I updated my answer to show how to use Bootstrap 4 navbar with Angular 5.
Answer: navbar.component.html:

         <button type="button" class="navbar-toggle" (click)="toggleNavbarCollapsing()">

         </button>
         Navbar

      ...

navbar.component.ts:
navbarCollapsed = true;

toggleNavbarCollapsing() {
    this.navbarCollapsed = !this.navbarCollapsed;
}

Comment: worked for me in angular 12, Thanks @Aleksander
Answer: There are some known issues in bootstrap 4 especially in navbar implemenation
Hence uou have to install bootstrap firstname.lastname@example.com
if you are using npm then the following libraries is best recommonded
 npm install firstname.lastname@example.com --save

npm install email@example.com tether jquery --save

In .angular-cli.json file  add the dependencies
"styles":[
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css"
],

"scripts":[
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],

Use the following HTML

    <button type="button" class="navbar-togglecollapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
    Togglenavigation

    </button>
    Angular5Website

 Home

About

Contact

Comment: It stil lhas a problem ill post a picture of the new look
Comment: Try the bootstrap 3.3.7 example navbar component. I have added the sample HTML for your kind reference.
Comment: that worked! Why is all of bootstraps documentation not working?
Comment: glad it helped!!. I was scratching my head to implement this. Not sure why the documentation was not up to date. But after three hours of scratching my head, I got the above solution.
Comment: like only one of the navbar elements
Comment: Including jQuery just to make collapse working... funny until it's my project.
Answer: Just add to index.html head  link to css and js
Bootstrap 5.2 Angular 13
link href="https://firstname.lastname@example.com/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous"
script src="https://firstname.lastname@example.com/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous" /script
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Prove that $a^2+b^2+c^2\geq [2(a-b)^2(b-c)^2(a-c)^2]^{1/3}$

Question: Mathematica seems to know that this statement is true, yet I am struggling to prove it. Possible useful inequalities are Minkowski and the geometric mean. Using the geometric mean inequality I can prove a less strict bound:
$$(a-b)^2+(b-c)^2+(a-c)^2 \geq 0 \implies 4 a^2+4 b^2+4 c^2 \geq (a-b)^2+(b-c)^2+(a-c)^2,$$
then the geometric mean inequality gives
$$ (a-b)^2+(b-c)^2+(a-c)^2 \geq 3[(a-b)^2(b-c)^2(a-c)^2]^{1/3} .$$
Combining the two we get
$$  a^2+b^2+c^2 \geq  \frac{3}{4}[(a-b)^2(b-c)^2(a-c)^2]^{1/3},$$
which is not strong enough.
Can anyone prove this for $2^{1/3}$ in place of $3/4$?
Answer: Hint:
WOLOG, suppose $a>b>c$. Let $b=c+y$ and $a=c+y+x$. One needs to show
$$
(c+x+y)^2+(c+y)^2+c^2 \ge (2x^2y^2(x+y)^2)^{\frac{1}{3}}.
$$
Notice that $(c+x+y)^2+(c+y)^2+c^2$ attains minimal when $c=-\frac{x+2y}{3}$. It remains to show
$$
(x+2y)^2+(x-y)^2+(2x+y)^2 \ge 9 (2x^2y^2(x+y)^2)^{\frac{1}{3}},
$$
or
$$
x^2+y^2+xy\ge 3 (xy\frac{x+y}{2})^{\frac{2}{3}}.
$$
for positive $x, y$. Finally, by rearranging we reach
$$
x^2 + \frac{y(x+y)}{2}+ \frac{y(x+y)}{2} \ge 3 (xy\frac{x+y}{2})^{\frac{2}{3}},
$$
which is true due to the geometric mean inequality.
Answer: Let $x=a-b$ and $y=b-c$. Then $a-c=x+y$. Thus, we are left with
$$
(x+y+c)^2+(y+c)^2+c^2\ge(2x^2y^2(x+y)^2)^{1/3}\tag{1}
$$
To find the minimum of the left-hand side of $(1)$, we set the derivative with respect to $c$ to $0$:
$$
2(x+y+c)+2(y+c)+2c=0\tag{2}
$$
$(2)$ says that $c=-\frac{x+2y}3$. Plugging this into the left-hand side of $(1)$ yields
$$
\begin{align}
(x+y+c)^2+(y+c)^2+c^2
&=\left(\frac{2x+y}3\right)^2+\left(\frac{\vphantom{2}y-x}3\right)^2+\left(\frac{x+2y}3\right)^2\\[6pt]
&=\frac23\left(x^2+xy+y^2\right)\tag{3}
\end{align}
$$
Thus, inequality $(1)$ is equivalent to the two variable inequality
$$
\frac4{27}\left(x^2+xy+y^2\right)^3\ge x^2y^2(x+y)^2\tag{4}
$$
$(4)$ is obvious if $y=0$, so let $z=\frac xy$ and divide $(4)$ by $y^6$. We then get that $(1)$ is equivalent to the one variable inequality
$$
\frac4{27}\left(z^2+z+1\right)^3\ge z^2(z+1)^2\tag{5}
$$
and
$$
\frac4{27}\left(z^2+z+1\right)^3-z^2(z+1)^2=\frac1{27}(2z+1)^2(z-1)^2(z+2)^2\ge0\tag{6}
$$
Thus, $(1)$ is true; and using $(2)$ and $(6)$, we can determine that equality holds precisely when
$$
\overbrace{a+b+c=0}^{\large c=-\frac{x+2y}3}\qquad\text{and}\qquad\frac{a-b}{b-c}\in\left\{-\frac12,1,-2\right\}\tag{7}
$$
which is when one of $a$, $b$, or $c$ is $0$ and the sum of the other two is $0$.
Comment: Thanks @robjohn. I've ticked your answer as it is more detailed.
Answer: Here is another approach that might shed a bit more light on the essence of the inequality.

The AM-GM inequality gives
$$
\begin{align}
a^2+b^2+c^2
&=\frac{(a-b)^2+(b-c)^2+(c-a)^2+(a+b+c)^2}3\\
&\ge\frac{(a-b)^2+(b-c)^2+(c-a)^2}3\\
&\ge\left[(a-b)^2(b-c)^2(c-a)^2\right]^{1/3}\tag{1}
\end{align}
$$
Equality is attained in the second inequality of $(2)$ only when $(a-b)^2=(b-c)^2=(c-a)^2$, which cannot happen since $(a-b)+(b-c)+(c-a)=0$. This indicates that a better inequality may be possible.

If we set $x=a-b$ and $y=b-c$, we can look for the maximum of
$$
\frac{x^2y^2(x+y)^2}{\left(x^2+y^2+(x+y)^2\right)^3}=\frac{z^2(z+1)^2}{\left(z^2+1+(z+1)^2\right)^3}\tag{2}
$$
where $z=x/y$ ($y=0$ is certainly not the maximum). The derivative of the log of $(2)$ is
$$
\frac{2(2z+1)}{z(z+1)}-\frac{6(2z+1)}{z^2+1+(z+1)^2}=\frac{(2+z)(1-z)(1+2z)}{z(1+z)(1+z+z^2)}\tag{3}
$$
which vanishes where $z=-\frac12$, $z=1$, and $z=-2$. Each gives a value of $\frac1{54}$ in $(2)$. Therefore,
$$
\left(x^2+y^2+(x+y)^2\right)^3\ge54x^2y^2(x+y)^2\tag{4}
$$
Substituting back for $x$ and $y$ in $(4)$ gives
$$
\frac{(a-b)^2+(b-c)^2+(c-a)^2}3\ge\left[2(a-b)^2(b-c)^2(c-a)^2\right]^{1/3}\tag{5}
$$

To get the best inequality, we can use $(5)$ instead of the AM-GM:
$$
\begin{align}
a^2+b^2+c^2
&=\frac{(a-b)^2+(b-c)^2+(c-a)^2+(a+b+c)^2}3\\
&\ge\frac{(a-b)^2+(b-c)^2+(c-a)^2}3\\[6pt]
&\ge\left[2(a-b)^2(b-c)^2(c-a)^2\right]^{1/3}\tag{6}
\end{align}
$$


how can we draw column chart with stacked column chart in a single high chart?

Question: How to draw a stacked chart and column chart in a single highchart
Answer: Yes, all you have to do is set the appropriate x value.
series: [{
  data: [
    [0, 1],
    [1, 3],
    [2, 5]
  ]
}, {
  data: [
    [0, 2],
    [1, 2],
    [2, 4]
  ]
}, {
  data: [
    [3, 8]
  ]
}]

Live demo: http://jsfiddle.net/BlackLabel/6m4e8x0y/4992/
API Reference: https://api.highcharts.com/highcharts/series.column.data


operator != cannot be applied to double, null

Question: I am getting an error on this code below:
  HashMap map = new HashMap();
  map.put("driver", userId);
  map.put("customer", customerId);
  map.put("rating", 0);
  map.put("timestamp", getCurrentTimestamp());
  map.put("destination", destination);
  map.put("location/from/lat", pickupLatLng.latitude);
  map.put("location/from/lng", pickupLatLng.longitude);
  map.put("location/to/lat", destinationLatLng.latitude);
  map.put("location/to/lng", destinationLatLng.longitude);
  map.put("distance", rideDistance);
  historyRef.child(requestId).updateChildren(map);

They said to add:
do if( pickupLatLng.latitude != null &&  pickupLatLng.longitude != null && destinationLatLng.latitude != null && destinationLatLng.longitude != null) before creating the hashMap, or for each latitude and longitude.
But when i try this i am getting the following error: operator != cannot be applied to double, null
Can someone help me please ?
Comment: A `double` is a primitive type, so you can't check it for `null`. Instead check it whether it's `0` or below for instance.
Comment: Since double is a primitive and not an Object you cannot compare it with null. Compare it with number (zero). See [here](https://stackoverflow.com/questions/50711708/error-operator-cannot-be-applied-to-double-null-how-to-fix?noredirect=1&lq=1)
Comment: This might be useful https://stackoverflow.com/questions/9090077/how-to-check-if-a-double-is-null
Comment: pls share NPE log ! i guess latitude or longitude is fine
Answer: double is a primitive type, it cannot be null, instead you can use Double and then compare it to null
Answer: I guess latitude or longitude is fine and your pickupLatLng or destinationLatLng is null and give you NPE so i think you must use this code instead
if (pickupLatLng != null && destinationLatLng != null) {}

Answer: Firstly, a Java double cannot be null, and cannot be compared with a Java null. (The double type is a primitive (non-reference) type and primitive types cannot be null.)
Try this,
if( pickupLatLng.latitude != 0 && pickupLatLng.longitude != 0 && destinationLatLng.latitude != 0 && destinationLatLng.longitude != 0)

Comment: This doesn't add any explanation as to why OP get's this error and so the answer isn't helpful at all. Rephrase your answer or delete it.


How to set value of button from model?

Question: I have the following Knockout model:
var searchButtonModel = {
    name: 'Name',
    search: function () {
        //do something
    }
}

and the template:
<button data-bind="click: search"></button>

I want to value of model name property('Name') in value property of button. Could I do it?
Comment: I'm confused. Do you just want ``?
Answer: <button data-bind="click: search,text:name"></button>

How to set value of button from model?


Wireless network lost

Question: I think I have auto updates enabled, but I'm not sure.
Today, I lost my wireless connection icon I had in the panel and also lost my wireless network connect capabilities.
I have Windows as a back up but have found it is way too unreliable to use anymore and would love to get this working again.
Not sure why it would disappear but it is no longer auto connecting to the wireless network.
Comment: Take a look at System>Network Connections and post a screenshot of the "Wireless tab" so we can see what your current settings are.
Answer: It sounds like a common bug, it was missing on my machine too so I'm betting a bad upgrade has done something and I think it'll be fixed soon too. In the mean time you can get it back by using the following instructions:
Press Alt+F2, in the box that pops up type: killall nm-applet and press Run. This will shutdown any existing network manager icons that aren't showing up. Then
Press Alt+F2 again and this time type: nm-applet This will launch a fresh network manager applet and on my machine this worked to bring it back.
Answer: You can set NetworkManager to have a default connection. For me I need this to be ppp0.
So in order to do this, first go first into System/Preferences/Network Connections and open the "Wired" tab, and untick the "Connect Automatically" box.  Next, go into "Mobile Broadband", in this case edit Verizon connection, and tick the "Connect Automatically" box.
At this point as soon as the default user logs in (assuming you have set a null password for the key ring) NetworkManager fires off this connection.
The problem arises when the connection is dropped.  NetworkManager dosen't keep checking the wireless connection to see if it becomes available again. So, issue the command "killall NetworkManager". To test this disconnect from your default wireless connection and issue this command from the prompt, you'll see that NetworkManager automatically reconnects.
So, I wrote the following script to be run from CRON every 10 minutes to have networkmanager autoreconnect;
#!/bin/bash
#This script will restart network manager if it is down.
#It should be attached to a cron job to run every 15 minutes
#determine if we have a non-local IP address. If we do, returns a 1.
isup=`ifconfig | grep inet\ addr | grep -v 127.0.0.1 | wc -l`;
#if no IP, then refresh the connection.
if [ $isup -lt "1" ]; then
{
    echo "disconnected...restarting connection";
    killall NetworkManager
}
else
{
    exit;
}
fi

exit;

Wireless network lost


getting mutual id without intersect sql query

Question: I need a select query for getting mutual R_ID for L_IDs based on input
L_ID | R_ID|
-----|-----|
 1   |  1  |
 2   |  1  |
 3   |  1  |
 1   |  2  |
 2   |  2  |
 4   |  2  |
 2   |  3  |
 3   |  3  |
 4   |  3  |
 5   |  3  |
 ..

for example if I pass 1,2,3 : it returns 1
SELECT R_ID FROM table WHERE L_ID in (1,2,3)

R_ID |
-----|
 1   |

for example if I pass 2,3,4,5 : it returns 3
SELECT R_ID FROM table WHERE L_ID in (4,2,3,5)

R_ID |
-----|
 3   |

note: all the combinations of L_ID like (1,2,3) are unique with a common R_ID
Answer: You can use group by and having.  I think this does what you want:
SELECT R_ID
FROM table
WHERE L_ID in (1, 2, 3)
GROUP BY R_ID
HAVING COUNT(*) = 3;  -- this value is the number of matches

Note that an R_ID with 1, 2, 3, and 4 will match.  If this is undesirable, then:
SELECT R_ID
FROM table
GROUP BY R_ID
HAVING SUM(L_ID IN (1, 2, 3)) = 3 AND
       COUNT(*) = 3;


MySQL: Getting current row ID in update

Question: So I'm working on this trigger that updates an account balance as soon as one of the transaction types logged on it is changed. Here is the query:
BEGIN

    IF (OLD.debit != NEW.debit) THEN

        UPDATE account,

      (SELECT accountid,
      sum(accountentry.amountaccountentry) AS total
      FROM accountentry
      WHERE accountentry.typeid = NEW.idaccounttype
      AND accountentry.accountid = account.idaccount
      GROUP BY accountentry.accountid) AS s
      SET account.balanceaccount = IF(NEW.debit = 1, IF(s.total IS NOT NULL, balanceaccount - s.total * 2, balanceaccount), IF(s.total IS NOT NULL, balanceaccount + s.total * 2, balanceaccount));

    END IF;

END

Now, this query does work if I remove the "AND accountentry.accountid = account.idaccount" part. Since I'm in some kind of "sub query", how would I go about retrieving the id of the account I'm currently updating?
Thanks a lot :)
Comment: Stop and just **don't**. Data should be kept redundancy free to avoid the possibilities of inconsistencies. So writing a sum over one table into another isn't a good thing to do. If you need the sum, you can always query it and get the **right** result. For convenience you can create a view that stores such a query so you don't have to repeat it every time.
Comment: When you update in SQL, you can access the record you're updating just like in SQL SELECT. So, for example `UPDATE t1 SET c1 = x WHERE t1.c2 = y;` Not sure that answers your question though.
Answer: I agree with the goal of keeping redundant data out of the database but I also understand that this is not always practical.  In this case, retrieving the balance by aggregating the transactions should be very low cost if appropriate indices are in place.  I do not know the details of your specific scenario but, at the very least, you should be very cautious when introducing redundant data.  It will almost certainly become inconsistent at some point.
Having this update in a trigger, as opposed to plainly visible in a transaction in your application's code, is a likely source of hard to track bugs in the future.
You have not included enough information (CREATE TABLE statements, sample data, desired outcome) in your question for me to answer with confidence but I will have a go.
Your update query appears to be attempting to handle the scenario where the transaction type for one entry is being changed from debit to credit or vice versa but it does not allow for the amountaccountentry changing at the same time.  I do not understand why you are using GROUP BY and SUM when you are only dealing with a change to one accountentry.  Surely you could use -
BEGIN

    IF (OLD.debit != NEW.debit AND OLD.amountaccountentry = NEW.amountaccountentry) THEN

        UPDATE account
        SET account.balanceaccount = IF(NEW.debit = 1, IF(NEW.amountaccountentry IS NOT NULL, balanceaccount - (NEW.amountaccountentry * 2), balanceaccount), IF(NEW.amountaccountentry IS NOT NULL, balanceaccount + (NEW.amountaccountentry * 2), balanceaccount))
        WHERE idaccount = NEW.accountid;

    END IF;

END

or if amountaccountentry could change at the same time -
BEGIN

    IF (OLD.debit != NEW.debit) THEN

        UPDATE account
        SET account.balanceaccount = IF(NEW.debit = 1, IF(NEW.amountaccountentry IS NOT NULL, balanceaccount - (OLD.amountaccountentry + NEW.amountaccountentry), balanceaccount), IF(NEW.amountaccountentry IS NOT NULL, balanceaccount + (OLD.amountaccountentry + NEW.amountaccountentry), balanceaccount))
        WHERE idaccount = NEW.accountid;

    END IF;

END

If I have completely misunderstood your issue, please update your question with the additional details mentioned above.

MySQL: Getting current row ID in update


How to set min and max time for Materialize Time Picker

Question: I am using materializecss for my project. I have inserted Time Picker. Here i want to set the min and max time dynamically using JS.
For Datepicker
$('.datepicker').pickadate({
    selectMonths: true,
    selectYears: 15,
    today: 'Today',
    clear: 'Clear',
    close: 'Ok',
    min: new Date(2017,9,20),
    max: new Date(2017,10,10),
    closeOnSelect: false
});

Is working fine.
For TimePicker
$('.timepicker').pickatime({
    fromnow: 0,
    twelvehour: true,
    donetext: 'OK',
    canceltext: 'Cancel',
    minDate: new Date(2017,9,20,12,0),
    maxDate: new Date(2017,10,10,18,0),
    aftershow: function(){}
});

Also i tried
  min: [7,30],
  max: [14,0]

But didn't helped.
Answer: Well, i faced the same issue in my project, and found out that materialize doesn't have this feature yet,
So the only way possible is to edit the official Materialize CSS and JS files
    <input type="text" class="timepicker" id="modified-timepicker">

Refer this pen for timepicker : Materialize Timepicker min/ max CodePen by Dev Sware

     <input type="date" id="start1" class="datepicker-start" />
     Start Date

     <input type="date" id="end1" class="datepicker-end" />
     End Date

Refer this pen for datepicker : Materialize Datepicker range CodePen by Dreamh
replace/ add these CSS and JS from the pen to your project, and do change the min/ max time and date range.
Hope this solves your problem.


USRP N210 connection

Question: I am trying to set up OpenBTS on Ubuntu 16.04 LTS. I have built the master version of RangeNetworks script. Since the transceiver did not start, I tried to check whether the USRP N210 board was even being detected by the system:
This is the actual IP address of the device and ping works fine with this IP address, however, uhd_find_devices does not find any devices attached.
I have tried disabling any firewall (sudo ufw disable).
Answer: For first, make sure uhd drivers are installed. If not already installed, hit the following:
sudo apt-get install libuhd-dev libuhd003 uhd-host

Then hit
uhd_find_devices

If the USRP is not found yet, hit the following for update firmware with default images:
uhd_images_downloader
uhd_image_loader --args="type=usrp2,addr=<IP address>"

At the end of the procedure, your USRP is reachable at default ip. Then run
uhd_find_devices

to check if the USRP is found.

USRP N210 connection


How to still have space-between when middle element wraps

Question: here is a demo i've created: https://stackblitz.com/edit/flex-layout-angular-material-fgconc
steps to reproduce:

"Open in New Window" and drag it to full size.
drag right border and make window smaller.
when the middle element starts wrapping -> problem

When it starts wrapping the space left is gone and all space is on the right.
How can I have the same space "left and right" when the middle element wraps?

@Akber Iqbal 's suggestion style="text-align:center" already does a good job.
How ever is it possible to have the elements wrap in the below style (green)?
Answer: Using your existing stackblitz, make one change in your app.component.html, just add: style="text-align:center" to the 2nd div
Final app.component.html to be:

  <app-many-buttons [N]="10"></app-many-buttons>

      <button mat-button class="materialIconButton">lol_1</button>

      <button mat-button class="materialIconButton">lol_1</button>

      <button mat-button class="materialIconButton">lol_1</button>

Comment: that works, thank you. Is there a way that the wrapping 2. 3. (and so on) row-elements start directly under the first row element. Ill add an image if unclear.
Comment: please add an image... do you mean that one button on each row ?
Comment: added a foto to my question
Comment: I don't think that we can get it for a free flowing CSS [means that the screen can get as big or as small as we want]... as a workaround, we can however restrict that a particular row to to have X number of buttons and then once the width decreases, we decrease the number of buttons that can exist...
Comment: thank you for your help so far. You solution already improved my problem significantly. Ill wait a little bit for another solution. And then could mark this as answer.
Comment: you got it, Thanks :)


What is the labeling scheme on these outlets?

Question: This is in a hotel, where there are obviously many, many circuits to manage. Can we tell what information is encoded in these labels?
Comment: Not an answer (can new users not leave 'comments'?) but... If I read bottom labels on the telecom connectors correctly, one contains a 'V' and the other a 'D' - I bet that's 'Voice' (telephone) and 'Data' (computer networking).
Answer: On the first plug, the GLD is the panel name, and the 15,17,19 is the breaker spaces that it takes.  It is a 3 phase receptacle, but I cannot tell you what NEMA configuration it is.
Same goes for the 20 amp receptacle next to it, 1LB is the panel name and the 11 is the space in the panel the breaker is in.
The telcom labeling probably leads you the same way.
Comment: Panel names, I'm not sure about.  They were given before the hotel was built but would make sense if you had the plans, looking at the main feeds and locations.  I don't think the labels are code, just a smart hotel engineer.
Comment: Awesome. Can you guess what the GLD and 1LB stand for?
Comment: Also, are those labels required by code, or just a common convention?
Comment: GLD = ground level, D; 1LB = first level, B


How does Rockstar expire your online character/save game? (Are they in control?)

Question: Where is my online character (appearance, experience level, inventory, weapons, horses, ...) stored? (I talk about Red Dead Online, but long term experience with GTA Online is probably helpful, too.)

Is it local? In a save game? (I don't think so.)
Is it on Sony PSN servers [I'm on PS4.]? (I don't think so either.)
Is it on Rockstar's servers? (Yes?)

So is it true that I could locally delete all from the game, including save games and meta settings, reinstall it and continue my online experience exactly where I left off? (Without using the save game backup function of PS Plus.)
Is my online character linked to my PSN account only?
How long does Rockstar save your character's data if you don't use it? Or how is it expired, if it expires at all? I guess they will do it like they do/did with GTA Online, so your experience with GTA Online is good enough for me. :-)
Comment: For GTA5 at least, they keep it server-side. They used to reset cheaters levels and cash now and then, back then when they still cared about the game.
Answer: Having played LA Noire and GTA5, they both had some major website component. For instance, you could take a picture in GTA5, and then it would show up on your RS profile on their website.
That leads me to think (since GTA5 and RDR2 have probably a very similar online architecture) that most of your character data might be on Rockstar Servers. You could also switch a GTA5 character from XB360/PS3 straight to XB1/PS4/PC when those consoles came out, so that pushes me too in that direction.
Also, I'm pretty sure PSN and XBL only give the matchmaking capabilities and connection. So that reinforces my theory.
So my best guess is data is on RS servers.
After that, do they delete characters? I never heard of RS doing a culling of old characters, and I'm pretty sure the server space it takes is probably so much little it's not gonna be for a while. Hell, I just connected in my Runescape account almost 20 years later and my character still existed.
If you don't want to lose your character, I guess keep an eye out if they say they will desactivate unactive accounts, but at that point, would you really want to pick back up a character you havent played for 5-6 years?
Comment: Any updates on the topic? And yes, I might want to continue my RDO character once a reasonable update goes live... in 5-6 years... once Rockstar revives the game... if they do at all.
Comment: Best we can do is guesswork. And frankly, if they havent updated RDO in 6 years, and with a follow up game having released, I would guess there is no update coming.


Minimal number of edges in an directed graph that ensures the existence of a cycle

Question: I need to find the minimal number of edges in an directed graph with $n$ vertices, that ensures the existence of a cycle in the graph, and proof that for every directed graph with $n$ vertices and that number of edges (or more) there is a cycle.
I tried to find it for small values of $n$ and find a pattern, but even this didn't work.
Answer: Hint: show that you can put one edge between every pair of vertices without creating a cycle.
Answer: The number you are looking for is one more than the maximum number of arcs in an acyclic digraph.
A digraph $D$ is acyclic if and only if there is a total order on the vertices such that arcs go only from vertices earlier in the order to ones later in it. You can imagine putting all the vertices on a line and allowing arcs from left to right. Thus, we can put an arc between any pair of vertices as long as we respect this ordering, implying we can have $\binom{|V(D)|}{2}$ arcs at most in a directed acyclic graph. Hence, the answer to your question is $\binom{|V(D)|}{2}+1$.


How to slice off a certain number of bytes from a string in Python?

Question: I am trying to write a specific number of bytes of a string to a file. In C, this would be trivial: since each character is 1 byte, I would simply write however many characters from the string I want.
In Python, however, since apparently each character/string is an object, they are of varying sizes, and I have not been able to find how to slice the string at byte-level specificity.
Things I have tried:
Bytearray:
(For $, read >>>, which messes up the formatting.)
$ barray = bytearray('a')
$ import sys
$ sys.getsizeof(barray[0])
24

So turning a character into a bytearray doesn't turn it into an array of bytes as I expected and it's not clear to me how to isolate individual bytes.
Slicing byte objects as described here:
$ value = b'a'
$ sys.getsizeof(value[:1])
34

Again, a size of 34 is clearly not 1 byte.
memoryview:
$ value = b'a'
$ mv = memoryview(value)
$ sys.getsizeof(mv[0])
34
$ sys.getsizeof(mv[0][0])
34

ord():
$ n = ord('a')
$ sys.getsizeof(n)
24
$ sys.getsizeof(n[0])

Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    sys.getsizeof(n[0])
TypeError: 'int' object has no attribute '__getitem__'

So how can I slice a string into a particular number of bytes? I don't care if slicing the string actually leads to individual characters being preserved or anything as with C; it just has to be the same each time.
Answer: Make sure the string is encoded into a byte array (this is the default behaviour in Python 2.7).
And then just slice the string object and write the result to file.
In [26]: s = '一二三四'

In [27]: len(s)
Out[27]: 12

In [28]: with open('test', 'wb') as f:
   ....:     f.write(s[:2])
   ....:

In [29]: !ls -lh test
-rw-r--r--  1 satoru  wheel     2B Aug 24 08:41 test

Comment: @user124384 What `sys.getsizeof` tells you is the size of the `String` object, not that of the underlying byte array.
Comment: @user124384 Since string is just a byte array in Python 2, why not just use `len`
Comment: Wow. I did not realize write() and splitting a string like that could do that. What threw me off was that sys.getsizeof(s[:1]) was returning 34. Thank you!
Comment: I see. How is it possible to get the size of the underlying byte array? As I showed in my examples, just using `getsizeof()` on a bytearray doesn't seem to do it.
Comment: Ahh. I knew `len()` returned the number of characters, but I didn't realize a character was just one byte as in C. Thank you again!
Comment: @user124384 Practically it doesn't return the number of characters, as you can see in my example above.


Zero velocity field inside an ellipse

Question: I'm investigating the velocity field induced by a continuous distribution of 2D vortex points distributed along an ellipse $\{a\cos\theta,b\sin\theta\}$. I'm interested in the field inside the ellipse, and I need some help to prove whether this field is zero or not.
The intensity of each vortex point is proportional to $d\theta$ and not to the length along the ellipse. A vortex point located at a point $\boldsymbol{x'}$ induces a velocity field $\boldsymbol{u}(\boldsymbol{x})=\frac{d\theta}{2\pi |\boldsymbol{x}-\boldsymbol{x'}|} \boldsymbol{e}_\perp$ where ${e}_\perp$ is the unitary vector orthogonal to $(\boldsymbol{x}-\boldsymbol{x'})$ which is in 2D: $\boldsymbol{e}_z\times(\boldsymbol{x}-\boldsymbol{x'})/|\boldsymbol{x}-\boldsymbol{x'}|$.
The total velocity field at a point $(x,y)$ inside the ellipse is obtained by integration over $\theta$. Numerical experiments seem to show that the field is zero inside the ellipse, but I cannot prove it. Dropping the factor $2\pi$, the field is in cartesian coordinates:
$$\boldsymbol{u}=\int_0^{2\pi} \left\{\frac{-y + b \sin\theta}{(x - a \cos\theta)^2 + (y -
     b \sin\theta)^2}, \frac{x - a \cos\theta}{(x - a \cos\theta)^2 + (y -
     b \sin\theta)^2}\right\} d\theta \stackrel{?}{=}\{0,0\}$$
Is the field really zero?
Maybe there is no need for the integrals to prove it. Maybe complex analysis is of help?
I should mention that the following property is true in this problem: For any closed contour inside the ellipse the circulation is zero:
$$\oint \boldsymbol{u}\cdot\boldsymbol{dl} =0$$
Since we are in a simply connected region, the velocity is the gradient of a potential which is single valued. But then is this potential constant?...
I'm able to prove that the velocity is zero on both the $x$ and the $y$ axis. Also $u_x$ is an even function of $x$ and an odd function of $y$. The opposite applies for $u_y$. I'm able to prove the result for a circle $a=b$.
Can somebody help me for the ellipse? Any idea?
Answer: The answer was given by another user on another forum:
https://physics.stackexchange.com/questions/81300/velocity-field-induced-by-vortex-points-along-ellipse
The velocity field is zero inside the ellipse.

Zero velocity field inside an ellipse


`pip install -t` doesn't work with namespace packages

Question: When I install a package with pip install -t some_dir, I can usually then add some_dir to my PYTHONPATH when running python and import the package.  Like this:
~/dev/scratch [venv] » pip install -t some_dir pytest
...
Successfully installed py pytest
~/dev/scratch [venv]  » PYTHONPATH=some_dir python
...
>>> import pytest
>>>

However, I recently added the library "stompest" to my dependencies, which is apparently a "namespace package" (not entirely sure what that means).  It doesn't seem to work with this same pattern:
~/dev/scratch [venv]  » pip install -t some_dir stompest
...
Successfully installed stompest
~/dev/scratch [venv]  » PYTHONPATH=some_dir python
...
>>> import stompest.config
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named stompest.config

It works fine if I just install stompest normally (into a virtual environment, say):
~/dev/scratch [venv]  » pip install stompest
...
Successfully installed stompest-2.1.6
~/dev/scratch [venv]  » python
...
>>> import stompest.config
>>>

The problem seems to be that pip(?) lays down a .pth file that expects to be in the site-dir (notice f_locals['sitedir'] below):
~/dev/scratch [venv]  » cat some_dir/stompest-2.1.6-py2.7-nspkg.pth
import sys,types,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('stompest',)); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault('stompest',types.ModuleType('stompest')); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)

I tried also setting PYTHONUSERBASE=some_dir, but that didn't seem to make any difference.  It seems like a similar issue to this one, which suggests using --egg as a workaround.  I can't get --egg to work with -t, though, because I get an error that I am "attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from."  The problem is that I can't add the directory to PYTHONPATH because it seems to be trying to install to a temporary directory:
~/dev/scratch [venv]  » PYTHONPATH=some_dir pip install -t some_dir --egg stompest
Collecting stompest
  Using cached stompest-2.1.6.tar.gz
Installing collected packages: stompest
  Running setup.py install for stompest
    Complete output from command /home/nalderso/dev/scratch/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-Wc3oaO/stompest/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fZlXM2-record/install-record.txt --compile --install-headers /home/nalderso/dev/scratch/venv/include/site/python2.7/stompest --home=/tmp/tmpHNVOP0:
    running install
    Checking .pth file support in /tmp/tmpHNVOP0/lib/python/
    /home/nalderso/dev/scratch/venv/bin/python -E -c pass
    TEST FAILED: /tmp/tmpHNVOP0/lib/python/ does NOT support .pth files
    error: bad install directory or PYTHONPATH

    You are attempting to install a package to a directory that is not
    on PYTHONPATH and which Python does not read ".pth" files from.  The
    installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

        /tmp/tmpHNVOP0/lib/python/

    and your PYTHONPATH environment variable currently contains:

        'some_dir'

    Here are some of your options for correcting the problem:

    * You can choose a different installation directory, i.e., one that is
      on PYTHONPATH or supports .pth files

    * You can add the installation directory to the PYTHONPATH environment
      variable.  (It must then also be on PYTHONPATH whenever you run
      Python and want to use the package(s) you are installing.)

    * You can set up the installation directory to support ".pth" files by
      using one of the approaches described here:

      https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

    Please make the appropriate changes for your system and try again.

    ----------------------------------------
Command "/home/nalderso/dev/scratch/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-Wc3oaO/stompest/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fZlXM2-record/install-record.txt --compile --install-headers /home/nalderso/dev/scratch/venv/include/site/python2.7/stompest --home=/tmp/tmpHNVOP0" failed with error code 1 in /tmp/pip-build-Wc3oaO/stompest

Am I doing something wrong, or is this an issue with pip?
Comment: I wanted to ask the same question. This is still true for me today with `pip 9.0.1` and Python 2.7. When I install `requests` with either `--target` or `--prefix` and add it to the `PYTHONPATH` I can import it just fine. But with namespace packages `zest.releaser` and `zope.interface` it fails. When I install those normally without target or prefix, all is well. Background [here](https://github.com/buildout/buildout/issues/319#issuecomment-271017185).
Comment: Interestingly, it fails for me with Python2.7, but works fine with Python 3.3.
Comment: Thanks for commenting. Perhaps we should raise the issue with `pip`?
Comment: I have found an existing issue in the pip tracker that talks about this and presents a solution. I have added an answer for that.
Answer: It works when you do this:
import site
site.addsitedir('some_dir')

See https://docs.python.org/2/library/site.html#site.addsitedir
I found this answer in a post by Matt Iversen (Ivoz) in this pip issue. Note that talk in this issue continues about some corner cases you might run into.
Comment: Awesome, thanks! We long ago moved on and used a different solution, so I can't really verify this fix, but I'll accept the answer.


Find the vector equation of the line AB and find the points where the line intersects the coordinate planes.

Question: The position vectors of the points A and B are (1,4,6) and (3,4,7), re- spectively. Find the vector equation of the line AB and find the points where the line intersects the coordinate planes.
The answer for the first part corresponds to (1,4,6) +t(2,0,1).However i cant figure out the answer for the second part.
Answer: First note that the equation is NOT $(1,4,6) +t(2,0,1)$, because this is not an equation.  The equation is
$$(x,y,z)=(1,4,6) +t(2,0,1)\ .$$
One of the coordinate planes is given by $z=0$.  Using this together with the equation of the line you can find the corresponding value of $t$ and then this gives you the point of intersection.  Do the same for the other coordinate planes.
Please try it for yourself now.
Hint.  One of the other cases is going to end up a bit differently.


How can I prevent spillage from my bathtub?

Question: Let's set the scene:
The horizontal surfaces of the bathtub in my apartment are flat. We have a double shower curtain (with the waterproof bit that hangs on the inside of the tub and the fabric bit that hangs on the outside of the tub) and are careful not to splash too much, but the flat top bits of the tub still get water on them when you reach for stuff. The floor in the bathroom is very slightly slanted, so the open side of the bathtub is slightly lower than the wall side of the bathtub. This means that any water that gets dripped onto the short end of the tub (the side with the showerhead) drips down to the floor, and then slowly flows across the bathroom floor to the opposite wall.
Not ideal.
We rent this apartment, so replacing or making major upgrades to the tub is not really an option. (We will have trouble convincing the management company that a few drops of water on the floor merit remodeling the bathroom, since there's no actual leak involved here.)
I need a way to catch the water that wants to drip off the edge of the bathtub and redirect it back down into the tub. (My current plan is to use some foam tubing and rubber sheeting to create a sort of ramp... thing... around the corner of the tub, but I bet this community can generate some ideas that will both look and work much better.)
Additional info: Turns out I'm sort of a natural at drawing bathtubs. A diagram, in case you're confused by my description:
Comment: It isn't so much a way to keep water IN the tub, but my wife and I have gotten in the habit of simply wiping up the area surrounding the tub after taking showers.  We keep some cheap small towels around for just this task.  If there is a specific path that the water typically takes, you can put a towel down in its path to stop it during the shower, then wipe up after you're done.
Comment: @Luke: that works well when you have a good, water-proof floor and moulding in your bathroom, but if some wretched soul decided that *carpeting* was a good idea you're in for a world of hurt (while I was moving in, I made the mistake of putting my foot next to the corner of the tub, and it... kinda went through).
Comment: Are there any small splash guards?
Answer: You can buy bathtub splash guards such as the ones found here.

You should be able to find similar ones at your local hardware store. Most versions install in seconds, using easy peel and stick adhesive backings. No tools, no mess, and usually no waiting for caulks and/or glues to dry.
Comment: Just ordered one of these. Will report back.
Answer: I had this problem in my last house, but rather than Jaydles' fancy putty, I just grabbed a cheap tube of silicone caulk and ran a bead around the outside of the tub wall. A couple seconds to squeegee it off after the shower, and things stayed nice and dry.

If you're not great at drawing straight lines, use good-quality masking tape to get those perfect edges on it.
Comment: Where did you run the caulk? On the outside edge of the tub? Also: it's cute that you think we own a squeegee.
Comment: I would do the outside edge, unless you're *really* confident in the stopping power of your inner curtain (mine let entirely too much water through during long showers). Of course, that does mean you'll have some wetness there until you wipe it off; if you don't have a squeegee, I'll be watching for the question on mildew removal...
Answer: Have you considered Sugru?

In the words of its maker:

It moulds like play-dough, bonds to almost anything and turns into a strong, flexible silicone rubber overnight.

Another way to think about it is that it feels like clay, then turns into stuff a lot like the  outside of an iphone charging cord. I think you could pretty easily use it to make something like a very thin ramp on the tub edge that guides water back into the tub (rather than splitting between in and out due to the currently flat surface).
One challenge is that it's designed for smaller patches, and is expensive when you start using a lot of it.  If you only need it in the corners where the curtain isn't, you're probably fine, but doing the whole length could get costly, depending on how much "ramp" you need.  It's also not super easy to remove when you move out, but you can cut off the bulk of it with a sharp knife, and then scratch of the remaining bits with your fingernail.
Comment: I used this method before finding this post. It has worked very well I used one sachet of white to build a dam at the corner of my bath. I then used another to create a very thin rolled out sausage which I ran from the dam back into the tub. There was no mess from this at all. I've previously attempted to use sealant with messy results.
Answer: If the water problem is primarily just right at the one end, you could cut a shallow triangular piece of plexiglass, with a nice stylish curve if you like, and glue it into the corner with silicone sealant. It will also stop splash water that seems to get around the curtain end. It looks more purposeful than some stuff gooped near the edge. It can be removed as much as any silicone can be removed.
Something like this should work...

You can cut plexiglass much as you'd cut thin plywood, and the edges can be sanded to be smooth and slightly rounded. Similar products might be found already manufactured, ready to be glued in place.
You'll still want to mop up any standing water or water mineral deposits will develop. Nice perspective drawing of your situation btw!
Answer: I have same puddle problem on bath edge after I had my bath and tiles resurfaced. Plumber said this is because the new surface is too rough and solution is to buy a spray to repell the water. I can't remember the name of the product but BigW sells water repellants. I've done some research and someone stated the water turns into round droplets and just slid off the bath edge and keeps everything cleaner for longer as well.
Comment: I don't see how this is going to prevent puddling and water running outside the tub.
Answer: Here is what I did in a similar situation.

purchase a 150 mm white acrylic curved corner shelf with its fittings from e-bay at £7.
fit this in a upright position, 20mm in from the corner of the bath
seal it with white silicone on the inside.
Comment: Can you add a quick sketch?  I'm having problems visualizing  this solution.  Post a link to a sketch (imgur?) in comments and one of us will link it in to your answer.


how to control tab key between buttons in react, javascript?

Question: I have 3 buttons Cancel, Back, Continue respectively. when press tab key that should be going to Continue, Cancel, Back buttons.  How can we do that in React, Javascript?
Please refer https://codesandbox.io/s/crazy-ishizaka-cnr5k?file=/src/App.js
export default function App() {
  return (

      <button tabIndex="2">submit 1</button>
      <button tabIndex="3">submit 2</button>
      <button tabIndex="1">submit 3</button>

  );
}

this above code is'nt working as I expected. Please suggest efficient solution for this.
Comment: _"Any tabindex greater than 0 jumps the element to the front of the natural tab order. If there are multiple elements with a tabindex greater than 0, the tab order starts from the lowest value that is greater than zero and works its way up. Using a tabindex greater than 0 is considered an **anti-pattern**."_ - https://developers.google.com/web/fundamentals/accessibility/focus/using-tabindex
Answer: The first thing about the tabIndex is it would act weird for use if you want to jump directly to the buttons and inputs.
After some researches about your problem, I have found out you have to do two things:

The first one is you have to add all:initial to the root in your project style. for example in your case that the project is React, you have to add this to the index.html and change that like this:

<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    />
    <meta name="theme-color" content="#000000" />

    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />

    <title>React App</title>

      You need to enable JavaScript to run this app.

I have changed the HTML tag and added the style in the second line

the second thing that you have to d is that you need to consider a side for the buttons that the index can go through it at first and then it can follow your order.
in my case, I have added this: (and know that the first tab would do nothing)

export default function App() {
  return (

      <button tabIndex={3}>submit 1</button>
      <button tabIndex={4}>submit 2</button>
      <button tabIndex={2}>submit 3</button>

  );

I have forked your codesandbox and you can access it with this link:
https://codesandbox.io/s/dawn-hill-1br66?file=/src/App.js


Ubuntu on low performance laptop

Question: My sister has always wanted a macbook, but I recently convinced her that Ubuntu is a great OS with much more similarity to Mac OS than Windows. She said I can install Ubuntu on her laptop but it is not really big on performance.
Specs:
1GB RAM
120GB harddrive
128MB graphics
I really like the look and feel of Ubuntu and don't want to install Lubuntu or something like that.
Is there a way to run Ubuntu in sort of a 'performance' mode rather than 'appearance' mode? And what other settings can I adjust to increase the performance of the OS?
Comment: With [Xubuntu](http://xubuntu.org/) you don't have all the trouble to enhance performance. I think its the better option for this old hardware. You can customize Xubuntu so it will look like similar to Ubuntu -> http://xfce-look.org/content/show.php/Ambiance+%26+Radiance+For+Xfce+%26+LXDE?content=146674
Comment: I'm running a regular Gnome3 on a laptop from 2006 (Thinkpad T60).  It runs beautifully with an SSD drive and a little extra RAM.  If you have those options available to you, this will not only make it run, but be zippy too. Of course heavy games are out of the question.
Comment: It won't really need to do anything heavy like gaming, might add a little more RAM, don't know about a SSD (-: $$
Comment: I agree on the ssd, if they want anything over 60gb then they'd be spending a pretty penny on a computer not really worth as much as the drive for it...
Comment: upgrading ram is the best way to go I think
Comment: NewEgg touts a 60G SSD for $50, a 120G is about $70. Laptop RAM might be in that range.
Comment: but ram is like 8 times faster than even ssd
Comment: OS X on a $1500 MacBook and Ubuntu (or Windows) on a 2004 laptop is not a fair comparison, and I hope both you and she are aware of this.
Comment: If the laptop is non-pae, a recent Ubuntu distro may not be available. You may need to use an older (also performance-wise better) Ubuntu release or (as i did on my Centrino chipset laptop) the dressed down CrunchBang distro.
Comment: @ntoskrnl obviously, but $1500 for a macbook is not an option and Ubuntu is a better choice than Windows.
Comment: @BarryStaes You can run Ubuntu on Pentium-M with "forcepae" option, see [Can I install Ubuntu 14.04 LTS on a laptop without pae?](http://askubuntu.com/questions/464376/can-i-install-ubuntu-14-04-lts-on-a-laptop-without-pae)
Answer: Here are some ways to optimize ubuntu for performance:
1. Optimize disk access with noatime:
Each file and folder on your linux system has a file-creation timestamp and a modification timestamp. Apart from that, linux tries to keep track of "access time" for each of these files. Now keeping track of the access time has its performance-cost, and if you want to remove this performance cost, you need to specify "noatime" attribute in the disk partition entries in your /etc/fstab file. Edit this file in your text-editor and add the noatime option for your disk partition:
UUID=97102801-14e3-9752-7412-d9c57e30981w / ext4 errors=remount-ro 0,noatime 1

2. Optimize Swappiness:
Swappiness is the tendency of the linux kernel to prefer disk-swapping vis-a-vis physical memory. The default swappiness value of 60 was kept considering server installations. If you are a desktop user having a machine with good RAM, you would normally prefer disk-swapping to be minimal. You can safely reduce this value to 10. To do so edit the file /etc/sysctl.conf and add the following:
vm.swappiness=10

(Just change the entry if it already exists, don't make a duplicate!)
3. Install preload:
If you typically use the same programs regularly, preload will help you by loading into memory, the programs that you use most frequently and thus speed them up. To install:
sudo apt-get install preload

4. Place your mission critical apps in /dev/shm:
Few weeks back, I was having performance issues with running Eclipse on ubuntu. After tweaking and optimizing various JVM settings in vain, the thing that really made the difference was placing the entire JDK folder on ramdisk. The /dev/shm folder is like a virtual ramdisk (on ubuntu and derivatives) where you can place your temporal, high-priority stuff to run them in "best performance" mode. Assuming you have to place your JDK folder on the virtual ramdisk, the command is:
cp -r jdk1.7.0_05/ /dev/shm/

5. Remove unwanted programs from startup:
Ubuntu comes loaded with a ton of baggage, and if you are someone like me, you might feel obliged to reduce some burden off your system by disabling unwanted software from startup. You can do this by going to "Startup Applications" in the System menu, but ubuntu hides the pre-installed apps by default. To overcome this limitation, open your terminal and issue the below command:
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop

Now you can go through the startup programs list and can disable the unwanted ones. Common sense will tell you that if you don't use bluetooth on your machine, you can get rid of the "Bluetooth Manager". Similar is the case with "Backup Monitor" in case you don't need to sync your backups in real-time. Here is the list of services that I've safely disabled without causing any issues:
Backup Monitor
Bluetooth Manager
Chat
Desktop sharing
Gwibber
Ocra screen reader
Personal file sharing
Screen saver
Ubuntu one
update notifier

6. Uninstall software that you don't use:
The next step is to remove those software that you don't use at all. Again, some common sense but with some caution is needed here. There are some programs (like empathy) that form the core part of ubuntu, so it won't allow you to apt-get remove.. them without removing unity itself. In such cases, we will disable such programs from starting up as services (next step). Some of the programs that you may safely remove are:
apt-get remove samba-common
apt-get remove cups
apt-get remove avahi-daemon avahi-autoipd

I typically uninstall all three after a new installation. The first one is needed for file-sharing in the local network if you have one. Second is the print daemon, and third is used to broadcast common network services across the local network and finding local hosts by using friendly names like "local.workstation".
7. Disable unwanted daemons:
In case you don't want to remove the cups program as you might need printing in future, you can disable it for the time being. To do so, issue the below command:
echo manual | sudo tee /etc/init/cups.override

You can disable any daemon in this manner by doing a manual override, just replace the "cups.override" with the daemon name that you want removed such as:
echo manual | sudo tee /etc/init/bluetooth.override
echo manual | sudo tee /etc/init/ufw.override
echo manual | sudo tee /etc/init/mysql.override
echo manual | sudo tee /etc/init/tty2.override
echo manual | sudo tee /etc/init/tty3.override
echo manual | sudo tee /etc/init/tty4.override
echo manual | sudo tee /etc/init/tty5.override
echo manual | sudo tee /etc/init/tty6.override

Later, if you want to enable that daemon, all you to do is delete the .override file.
8. Optimize Nautilus to behave in a speedy manner:
This is totally optional. Nautilus, by default, tries to show thumbnails of each and every file in a directory. If the directory contains a lot of files, this causes a noticeable delay. Now if you are in the habit of regularly previewing thumbnails of your images, don't do this optimization. Otherwise, if previewing thumbnails don't matter to you and all you are interested in is speed (like me), you can go to Edit->Preferences->Preview-tab and set the preview settings to Never.
9. Disable translation downloads in aptitude:
This setting is for speeding up the downloads from apt repositories rather than your machine. By default, ubuntu adds additional translation repos when you issue "apt-get update" command to update your repository settings. If you only need English, you can disable translation downloads by editing /etc/apt/apt.conf.d/00aptitude and adding this line to it:
Acquire::Languages "none";

Source: My blog post
Comment: 1. Ubuntu defaults is relatime, no atime so that counsel is useless. 2. Depending OP needs he should have more swappiness then less, ie. during high I/O operations. 3. Preload could actually slow down your system. [It isn't for everyone.](http://askubuntu.com/a/289474/169736) 4. would only work if you have tons of RAM or really commit intensive tasks. 5. 6. and 7. are all generic, nothing new here. 8. only is valid for directories you haven't visited or have new files, frequently used and stable directories are not affected. BTW, nautilus use a cache after the first run, subsequents runs
Comment: are faster. 9. would be a pain for people that don't use Ubuntu in english. Most of the time, these request takes a split of a second even in a slow connection since it only asks for headers. All in all, your counsel is good but is not appropriated for all cases.
Comment: Isn't #3 already taken care of by `ureadahead`? Also, careful, `ufw` is the firewall, you might not want to disable it.
Comment: @Braiam - What you say is true. Optimizations are not for all cases, hence the reason they had to be performed. Had that not been the case, they would have been ubuntu defaults. As for reducing swappiness, it improves responsiveness in general. I don't see how it can't help the OP's case.
Comment: As for the points 5,6,7 being generic, the point here is that when you apply all these optimizations, you will see a noticable performance difference. Any one, or few points may not make a difference, hence the entire list.
Comment: Also see this article on comparison between noatime and relatime: http://linux.koolsolutions.com/2009/01/30/installing-linux-on-usb-part-4-noatime-and-relatime-mount-options/. Whilst relatime is a good compromise between atime (worst-performance) and noatime (best performance), it isn't the same as noatime. Besides, I've myself experienced a noticeable performance increase after I configured noatime.
Comment: 4. is done pretty much automatically if you have enough RAM.
Comment: @nyuszika7h - preload does make a difference in scenarios where you are frequently using the same bunch of apps (as most of us do). As regards ufw, that is the first package I remove from my system. I prefer to manage my firewall using iptables rules directly as it gives more control.
Answer: Install ccsm, open terminal (Ctrl + Alt + T  or from the dash) and paste line below:
sudo apt-get install compizconfig-settings-manager

Run it from the dash or in terminal ccsm. Choose OpenGL in General category and change Texture Filter from Good/Best to Fast. Go back and choose Ubuntu Unity Plugin in Desktop category and change Dash Blur from Active Blur  to No Blur
Answer: I believe what you are looking for is ubuntu's 2d mode, but it was removed in 12.10.  I found an article that mentions a way to disables some of the additional eye candy.
I'm not sure if this is still available in 14.04, but you can try it by adding 'export UNITY_LOW_GFX_MODE=1' to the '.xprofile' in your 'home' folder.  If you want you can just run the following in the terminal

echo "export UNITY_LOW_GFX_MODE=1" >> ~/.xprofile

Answer: Overall unity is hard to configure performance wise, though on those specs it should run reasonably well. If you have a chance to upgrade the ram, I recommend it highly, though it should run just fine on that for normal use (just don't expect to be doing video editing/custom rom compiles/basically any modern games)
Comment: overall gimp would not run perfectly on it, but if they are thinking of simply using paintdotnet or something I'm sure they could do that. As for watching internet videos, I don't know how perfectly that would go but it would be possible. They might try using gnome 2 with cairo-dock for an experience visually identical to mac, and a bit better performance than unity. basically, if xp ran fine on it ubuntu will not have a single problem
Comment: Thanks @sbergson, won't be used for gaming. Just some image manipulation and watching series and basic stuff like that.
Comment: I will look into the cairo-dock. I am still very new to ubuntu, how would I go about 'downgrading' to gnome 2 and installing cairo-dock? Thanks in advance @sbergeron
Comment: it would be easy to do that. I currently have kde with cairo dock so I have a windows7-esque taskbar with lancelot launcher and cairo dock set to display when i hover over the "taskbar" I have set up. I ran this at first on a computer with 2gb of ram and it ran just fine, though i currently use a computer with 4gb of ram that lets it run without any hiccups whatsoever

Ubuntu on low performance laptop


css bottom border not working properly?

Question: This is my html file which stores some customer details

        <link rel="stylesheet" type="text/css" href="css/Home.css" />
        <title>Customer</title>

            <form id="formId" jwcid="formId@Form" success="ognl:listeners.addCustomer">

Customer Data

                             Customer Name:
                             <input type="text" jwcid="@TextField" id="customername" value="ognl:customerName"/>

                             Customer Address:
                                 <textarea rows="2" cols="20" jwcid="@TextArea" id="address" value="ognl:address"></textarea>

Select Gender

                                <Input type="radio" name="customerGender" jwcid="@Radio" value="0"/>Male
                                <Input type="radio" name="customerGender" jwcid="@Radio" value="1" />Female

Select Service

                         <Input type="checkbox" id="customerPrivilege" jwcid="customerPrivilege@Checkbox" value="1" selected="ognl:customerPrivilege"/>
                         Privileged Customer

Customer List

                             <select>

                                     <option jwcid="@Any" value='ognl:currentCustomerData.id'></option>

                             </select>

                             <input id="submitform" type="Submit" value="Add Customer" />

            </form>

 2. CSS code

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
body
{
    margin: 17% 25%;

    border-width: 1em;

    border-style: groove;
    border-color: orange;

    background-image:url('blue.BMP');

    background-repeat:no-repeat;
    background-position:50%;

    background-size:100%;

}
textarea {
    position: absolute;
    left: 48.2%;
    height: 5%;

    resize: none;
    width:12%;
    top: 34%;
}
#customerlabel1
{
    position: absolute;
    left: 34%;
    top: 30%;
    font-family:verdana;
    font-weight:bold;
}
#customerlabel2
{
    position: absolute;
    left: 34%;
    top: 34%;
    font-family:verdana;
    font-weight:bold;
}
#customername {
    position: absolute;
    left: 48%;
    top: 29.5%;
}
#customerGender
{
    position: absolute;
    left: 42%;
    top: 47%;
}
#customermale
{

    font-family:verdana;
    font-weight:bold;

}
#customerfemale
{

    font-family:verdana;
    font-weight:bold;

}
#customerPrivilege
{
    position: absolute;
    left:40%;
    top: 57%;

}
#privilegecustomer
{
    position: absolute;
    left: 42%;
    top: 57%;
     font-family:verdana;
    font-weight:bold;
}
#customerTab1 {
    position: absolute;
    left: 42%;
    top: 26%;
    background-color:fuchsia ;
    background-repeat: no-repeat;
    color: black;
    text-align: left;
    font-family: Arial;
    font-style:  normal;
    font-weight: 500;
    font-size: 1.5em;
}
#customerTab2 {
    position: absolute;
    left: 42%;
    top: 42%;
    background-color: fuchsia;
    background-repeat:  repeat-x;
    color: black;
    text-align: left;
    font-family: Arial;
    font-style:  normal;
    font-weight: 500;
    font-size: 1.5em;
}
#customerTab3 {
    position: absolute;
    left: 42%;
    top:  52%;
    background-color: fuchsia;
    background-repeat:  repeat-x;
    color: black;
    text-align: left;
    font-family: Arial;
    font-style:  normal;
    font-weight: 500;
    font-size: 1.5em;
}
#customerTab4 {
    position: absolute;
    top: 62%;
    left: 42%;
    background-color: fuchsia;
    background-repeat:  repeat-x;
    color: black;
    text-align: left;
    font-family: Arial;
    font-style:  normal;
    font-weight: 500;
    font-size: 1.5em;

}
select {
    position: absolute;
    left: 44%;
    top: 66%;
    font-family:verdana;
    font-weight:bold;
}
#submitform
{
    position: absolute ;
    left: 44%;
    top: 70%;

}

Comment: http://sscce.org/ should be provided
Comment: You are not setting border bottom separately at all, just border in all directions. You are not specifying which border should appear and how. The code is neither a working page nor a minimal document constructed to demonstrate a problem.
Comment: somebody pls answer this..its working in every browser except firefox and IE 8
Answer: It's not very clear from your question, but I'm guessing your problem is that the border is not properly wrapping the body of your html. This is happening because you are absolutely positioning all the elements inside your form inside the body. Since all the elements are absolutely positioned, no elements are actually inside the body's layout, so the browser is giving the body a height of 0.
I would recommend rewriting your css to avoid most of the absolute positioning of the form elements.
Comment: what if i position body absolute?
Comment: @surajR That wouldn't make any difference.
Answer: Your question is unclear (what elements border is in question - and only the css classes that apply to that element?), but in general, some browsers won't display a border if the object is empty (has no displayable content).
To get around this, put a "space" in empty objects, for example:

will become

Comment: but there are no empty objects..read code carefully...try on your machine..it work well an all browsers but not in firefox and IE
Comment: @surajR if you have IE9 installed you can press F12, look at the CSS applying to that specific object (by clicking that object) it will show all inherited CSS codes, you can also untick values to see how it changes
Comment: i am working on windows xp which dont support iE9..so pls tell me some reliable alternative

css bottom border not working properly?


Tensorflow C++ error while building with cmake on windows with GPU support

Question: I'm trying to get a tensorflow C++ build (or tensorflow lite) for Windows that runs on GPU (WITHOUT using CUDA, it should work on AMD). I decided to opt in for tensorflow lite with the -DTFLITE_ENABLE_GPU=ON flag to enable OpenCL.
The steps I followed:

Clone tensorflow github repo to tensorflow_src and checout to r2.14
Create a folder called tflite-opencl next to the cloned repo
Go to tflite-opencl and run cmake C:/Users/Asus/Desktop/tensorflow/tensorflow/lite -DTFLITE_ENABLE_GPU=ON
Run cmake --build . -j

When I try to run cmake --build . -j I get the following error:
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(313,20): error
 C2039: 'any_cast': is not a member of 'std' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]

...
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(313,1): error
C2065: 'any_cast': undeclared identifier [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(313,29): error
 C2275: 'tflite::gpu::ElementwiseAttributesBase<tflite::gpu::DataType::BOOL,T>': expected an expression instead of a
 type [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
          with
          [
              T=bool
          ]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(317,1): error
C3536: 'attr': cannot be used before it is initialized [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(317,17): error
 C2672: 'CreateElementwiseWithBroadcast': no matching overloaded function found [C:\Users\Asus\Desktop\tflite-opencl
\tensorflow-lite.vcxproj]

...

C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(321,17): error
 C2672: 'CreateElementwise': no matching overloaded function found [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-l
ite.vcxproj]

...

C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(313,29): error
 C2275: 'tflite::gpu::ElementwiseAttributesBase<tflite::gpu::DataType::INT32,T>': expected an expression instead of
a type [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
          with
          [
              T=int32_t
          ]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\selectors\operation_selector.cc(313,29): error
 C2275: 'tflite::gpu::ElementwiseAttributesBase<tflite::gpu::DataType::FLOAT32,float>': expected an expression inste
ad of a type [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]

...

C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\tasks\special\conv_pointwise.cc(129,12): error
 C2039: 'any_cast': is not a member of 'std' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\variant(30,1): message : s
ee declaration of 'std' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\tasks\special\conv_pointwise.cc(129,20): error
 C2065: 'any_cast': undeclared identifier [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\tasks\special\conv_pointwise.cc(129,21): error
 C2275: 'tflite::gpu::ReduceAttributes': expected an expression instead of a type [C:\Users\Asus\Desktop\tflite-open
cl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\delegates\gpu\common\tasks\special\conv_pointwise.cc(130): error C3
536: 'reduce_attr': cannot be used before it is initialized [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcx
proj]

But despite these errors it kept on compiling and eventually ended on:
...
 tensorflow_profiler_logger_shim.cc
  tflite_with_xnnpack_optional.cc
  minimal_logging_default.cc
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\minimal_logging_default.cc(37,9): warning C4068: unknown pragma 'cl
ang' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\minimal_logging_default.cc(38,9): warning C4068: unknown pragma 'cl
ang' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
C:\Users\Asus\Desktop\tensorflow\tensorflow\lite\minimal_logging_default.cc(40,9): warning C4068: unknown pragma 'cl
ang' [C:\Users\Asus\Desktop\tflite-opencl\tensorflow-lite.vcxproj]
  platform_profiler.cc
  root_profiler.cc
  profiler.cc
  sparsity_format_converter.cc
  schema_utils.cc
  Generating Code...

C:\Users\Asus\Desktop\tflite-opencl>

I think I'm getting the any_cast is not a member of std because my C++ standard version is below 14. But I've been coding in windows for a while and I'm pretty sure I'm above 17 as I use many modern features. I've updated g++ from Visual Studio Installer but I'm not sure how to properly update my C++ version on Windows.
I've tried adding SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
to cmake_install.cmake under tflite-opencl but it still generates the same error.
I'm sure this build has failed, but regardless I searched for the dll.
This failed build gave me a Visual Studio solution inside tflite-opencl. I need to import tflite into a huge project so I need either the dll files or the lib files. I tried looking under tflite-opencl/Release, tflite-opencl/Debug and tflite-opencl/x64 but found nothing. I'm also adviced to look under \bazel-bin\tensorflow\lite\kernels on my previous question, which I can find under tensorflow_src and I can't find any dll's in it.
How can I fix that error and change my C++ standard on Windows? How can I get these dll or lib files to use under my project? If I should build INSTALL how am I supposed to do it? I developed mainly on Linux environments so I don't know how to use Visual Studio propperly.
Update:
Apparently operation_selector.cc does not include #include <any> as it should, causing the aforementioned 'any_cast': is not a member of 'std' error. After including and building it, I get a .lib file under tflite-opencl/Debug (no .dll's found).
However, when I include it and try to use it on a project, I get many unresolved external symbol errors. Am I doing something wrong? Were there supposed to be a .dll file?
Comment: Instead of appending the CMAKE_CXX_FLAGS  with /std:c++17, could you try setting the variable CMAKE_CXX_STANDARD using `set(CMAKE_CXX_STANDARD 17)`. On a side note, to be sure your installation supports modern C++, just create a very small example with a C++17 example and try to compile it
Comment: @Martin I did try to create a project from scratch and use any_cast, and it works just fine as long as I set it above c++ 14+ in properties. I made sure the project uses c++ 20 but still the same error, I don't think it's about c++ standard anymore...
Answer: Apperently tensorflow do not include #include <any> under the files where it uses any_cast, causing the aforementioned problem. Adding the includes fixes the problems, however after getting a build with this approach I'm now getting unresolved external symbol errors, which is more detailed on this question:
Tensorflow lite C++ undefined symbol on windows with GPU support


How good is ApnsPHP?

Question: I want to build a push server that can handle a heavy load of push notifications that it needs to send. I was wondering if ApnsPHP (http://code.google.com/p/apns-php/) is the right chice for me, or if I should build it using some other language.
Any help or pointers would be highly appreciated!
Answer: APNS-PHP works out of the box on Snow Leopard! But I can't get it working on Ubuntu 8.04 or 10.04
Answer: It will work on Ubuntu 10.04 and PHP 5.3.2 after installing libssh2-php.
But only with Sandbox.
On Production i must increase Timeout and then I get, that message was send, but never reveived on my iPhone.
Aro

How good is ApnsPHP?