text:
Q: How to make div with round corner totally opaque inside, but colored outside (between round border line and original border-box line)? Let's say I have an image as the background of a parent (green) element.

In child (grid) elements I want to partially "cover" it. Given a child element with rounded corners:

*

*I want NOT to "cover" the image inside the border (orange), but

*I WANT to "cover" outside (yellow): between the border line to original border-box line.

By "cover" I mean filling with some color with 0% opacity, and by not covering I mean the orange part should be totally opaque. (If the green part would represent the image itself, the user should see the same green instead the orange.)
Introducing a new element between the green parent and orange childs to fill the yellow/outer part with some color would make the orange/inside part also colored, so thats not a solution.
I suspect this can be done with SVG, but I do not know how - and maybe there is another way to do it.

A: You can consider a radial-gradient coloration for your element to achieve this.
Here is an example:

.wrapper {
  padding:50px;
  display:inline-block;
  font-size:0;
  background:url(https://picsum.photos/id/1069/1000/800) center/cover;
}
.wrapper > div {
  width:150px;
  height:150px;
  display:inline-block;
  background:
    radial-gradient(farthest-side at bottom right,transparent 98%,yellow 100%) top left,
    radial-gradient(farthest-side at bottom left ,transparent 98%,yellow 100%) top right,
    radial-gradient(farthest-side at top    left ,transparent 98%,yellow 100%) bottom right,
    radial-gradient(farthest-side at top    right,transparent 98%,yellow 100%) bottom left;
  background-size:30px 30px;
  background-repeat:no-repeat;
}


text:
Q: In RC circuit, what exactly does the unit impulse input represent? Let \$v\$ be the voltage across capacitor, and
\$a=\frac{1}{RC}\$, then the differential equation representing RC circuit with input \$f(t)\$ is
$$\frac{dv}{dt}+av = af(t)$$
When \$\mathcal{f(t) = u(t)}\$,
I know the input is a constant dc voltage source of \$1V\$ turned on at \$t=0\$. All good here.
However when  \$\mathcal{f(t) = \delta(t)}\$,
I don't seem to understand what exactly the input is:
Is it an infinite voltage acting for \$0\$ seconds?
What does the integral of input represent? voltage? energy?

My thinking:
From high school physics, Impulse is Force x time. This is identical to change in momentum:
$$F = \frac{\Delta p}{\Delta t} \Rightarrow \Delta p = F\Delta t$$
So unit impulse when acted on an object, essentially changes the momentum of the object by 1 Newton Second. How to interpret impulse input in an RC circuit?

A: The impulse, i.e. dirac delta, isn't really a function.
With that said, integrating I dt or V dt still works as it should, dimensionally speaking. If we have input voltage \$1 [V]\delta(t)\$ into an uncharged capacitor, we produce a current of \$1 [V]\delta(t)/R\$ (amperes). Integrating that with respect to time gives us \$1 [V*s]/R\$, (coulombs); we use V = Q/C to determine that the voltage ends up 1 volt-second/(RC) immediately after the impulse.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Image of a small open disk under $f(z)= \exp (1/z)$ In Conway's Functions of One Complex Variable I, the function $f(z)= \exp (1/z)$ has an essential singularity at $z=0$. But what would the image of a small punctured open disk $\{z:0<|z|< \delta\}$ be under this function? I'm having a hard time visualizing it.

A: Take $z = \epsilon e^{i \theta}$ to be an arbitrary point in the open disk (with $0 < \epsilon < \delta$).  We note that
$$
\exp(1/z) = \exp(\epsilon^{-1} \exp(-i\theta)) =
\exp(\epsilon^{-1} [\cos \theta - i\sin \theta]) =\\
\exp[\epsilon^{-1}\cos \theta]\exp[-i\epsilon^{-1}\sin \theta]
$$
Now, suppose we have an arbitrary non-zero complex number $z' = re^{i \theta'}$.  Then $z'$ is in the image of the disk if there is a solution to the system
$$
\cos \theta = \epsilon \ln(r)\\
\sin \theta = -\epsilon[\theta' + 2 \pi k]\\
\epsilon < \delta, \quad k \in \mathbb{Z}
$$
That is, $z'$ will be in the image of the disk as long as we can select an $\epsilon < \delta$ and $k \in \mathbb{Z}$ such that
$$
\epsilon^2\left([\ln(r)]^2 + [\theta' + 2\pi k]^2\right) = 1
$$
From here, it should be clear that every non-zero $z'$ will be in the image.  In particular, we may prove it as follows:
Fix $k > 1/\delta^2$.  It is clear that $\left([\ln(r)]^2 + [\theta' + 2\pi k]^2\right) > 1/\delta^2$.  Define
$$
f(\epsilon) = \epsilon^2\left([\ln(r)]^2 + [\theta' + 2\pi k]^2\right)
$$
We note that $f(0) = 0 < 1$, and $f(\delta) > 1$.  By the intermediate value theorem, $f(\epsilon) = 1$ has a solution with $\epsilon \in (0,\delta)$.


text:
Q: How a character array is stored if initialized as Array[] = "testit" I have a character array initialized as follows
int main()
{
   char ptr1[] = "testit";
}

has an assembly equivalent
main:
        push    rbp
        mov     rbp, rsp
        mov     DWORD PTR [rbp-7], 1953719668   ; These lines form the string "testit"
        mov     WORD PTR [rbp-3], 29801         ; These lines form the string "testit"
        mov     BYTE PTR [rbp-1], 0             ; These lines form the string "testit"
        mov     eax, 0
        pop     rbp
        ret

I would like to know how the the character array is stored? What are these numbers(in assembly 1953719668   , 29801, 0) referencing to (or how these numbers are calculated) ?

A: The first number, 1953719668, is also 0x74736574 converted to hex.
Written as separate bytes, in little endian ordering, we have 0x74, 0x65, 0x73, 0x74.
Using ascii we have t, e, s, t.
The 2nd number encodes "it" similarly but in only 16 bits for the 2 characters:
29801 = 0x7469, converted to hex, and to bytes little endian: 0x69, 0x74: i, t.
The last byte is the null terminating byte used by C strings.

http://www.asciichars.com/_site_media/com_photogallery/ascii-chars/xl/ascii-chars-table-landscape.jpg


text:
Q: EXTJS: change visited link I am new to ExtJS.
We are using ExtJs client side and struts, spring at server side. In our application all links used to appear in color blue. Somehow due to few changes the visited links are unable to change to different color.
Can someone suggest me a way to change visited links color?

A: Apply css
a:visited
{
     color : red !important
}

Somewhere a rogue css style for a:visited has been applied. You need to find it and remove it. Until then the above css can be used. The !important will give this higher priority unless the rogue css style also has the !important applied to it.


text:
Q: how to navigate to a page by clicking back button on camera open in ionic2 I have a HomePage and in ionViewWillEnter() I have added camera code. So that when HomePage get trigger it opens the Camera first
I want to customize the back button behavior that when I press the back button, after opening the camera it should navigate to SecondPage,by default it is navigating to HomePage.
ionViewWillEnter() {
   this.captureVideo();
 }

 captureVideo() {
    platform.registerBackButtonAction(() => {
      this.navCtrl.push(SecondPage)
       });
    let options: CaptureVideoOptions = { limit: 1 };
    this.mediaCapture.captureVideo(options)
     .then((videodata: MediaFile[]) => {
      var i, path, len;
     for (i = 0, len = videodata.length; i < len; i += 1) {
      path = videodata[i].fullPath;

      }

      this.flag_play = false;
      this.flag_upload = false;

     this.file.resolveLocalFilesystemUrl(path).then((newUrl) => {
     alert(JSON.stringify(newUrl))
     let dirPath = newUrl.nativeURL;
     let dirPathSegments = dirPath.split('/')
     dirPathSegments.pop()
     dirPath = dirPathSegments.join('/')
     this.file.readAsArrayBuffer(dirPath, newUrl.name).then(async (buffer)
        => {
        await this.upload(buffer, newUrl.name);

          })

        })
        })
     .then(() => {

       var videoFileName = 'video-name-here';

       this.videoEditor.createThumbnail(

        {
         fileUri:'abc',// this.videoId,
         outputFileName: videoFileName,
         atTime: 2,
         width: 320,
         height: 480,
         quality: 100
        }
       ).then(result => {

     this.result = result;
     this.base64.encodeFile(result).then((base64File) => {
      this.base64Thumbnail = base64File.replace("*;charset=utf-8", "jpg")

       }, err => {

       alert("Unable to create thumbnail")
      })

       })
       })

       }

A: The hardware back button works as default behaviour of cancel ...so to customize it put your specific code in the error...
  takePicture(){
    this.camera.getPicture({
       destinationType: this.camera.DestinationType.DATA_URL,
      targetWidth: 1000,
      targetHeight: 1000
     }).then((imageData) => {
  // imageData is a base64 encoded string
       this.base64Image = "data:image/jpeg;base64," + imageData;
    }, (err) => {
   this.navCtrl.pop();

   });
  }
  }


text:
Q: setInterval returns undefined OR scope of returned value wrong I try to store Date.now() after a setIntervall invoked a callback. After that, I'd like to clear the intervall, so it only fires once. All that in a class.
But the variable I store the intervalID in and I hoped would be available "class-wide"  keeps "undefined". I am pretty sure I am doing sth awfully wrong with JS scope, but I cannot find out what.
class Signal {
    t : number;
    private intervallId : number | undefined;

    constructor(t : number) {
        this.t = t;

    }

    wait() {

        this.intervallId = setInterval(this.signalTriggered, this.t)
        console.log("Never executed.")
    }

    signalTriggered() {
        const triggerTime : number = Date.now()
        console.log(this.intervallId) /* always undefined */
        if (this.intervallId) {clearInterval(this.intervallId)
        console.log(triggerTime); }
    }
}

var timer = new Signal(2000)
    timer.wait()
    console.log("Done.") /* Never printed out. */

A: The problem is the reference of the this, you are losing the original reference of it when passing the method as an argument to setIterval.
You could use an arrow function to wrap the method:
setInterval(() => this.signalTriggered(), this.t)

Or use Function.prototype.bind to assign the reference of this:
setInterval(this.signalTriggered.bind(this), this.t)


text:
Q: Periodicity in Galois Cohomology Let $k$ be a field which is not of characteristic $\ell$ and $\nu \geq 1$. Suppose for a moment that $\ell$ is odd. Even without $\ell$-th roots of $1$, then we have isomorphisms $H^*_{et}(k, \mu_{\ell^{\nu}}^{\otimes i}) \simeq H^*_{et}(k, \mu_{\ell^{\nu}}^{\otimes i+(\ell-1)(\ell^{\nu-1})})$ for all $i \in \mathbb{Z}$. This boils down to the fact that the Galois group of $k(\mu_{\ell^{\nu}})/k$ is injects into the units of $\mathbb{Z}/\ell^{\nu}$.
When $\ell^{\nu}$ is even, the Galois group is not cyclic except for $\nu=1,2$.
What is the analogue of such "periodicity" for this case?


text:
Q: How to reuse sudo for a series of commands in a bash script I have script that opens several terminal windows running iftop for observing various ports activities.
Each terminal that opens asks me for the sudo password ... which is a bit of a pain considering that there are 5 terminals overall.
So my question is, how do I type in sudo password once and have all the windows run using that permission rather than typing it in per window?
#!/bin/bash

TITLE="${USER}@${HOSTNAME}"' iftop (h=help, L=lin/log scales, t=line display mode, T=line totals, p=port display)'
gnome-terminal --title "$TITLE" -e 'sh -c "sudo iftop -P -f \"port 22\""' --hide-menubar --zoom=0.85

TITLE="${USER}@${HOSTNAME}"' iftop (h=help, L=lin/log scales, t=line display mode, T=line totals, p=port display)'
gnome-terminal --title "$TITLE" -e 'sh -c "sudo iftop -P -f \"port 33 or port 44\""' --hide-menubar --zoom=0.85

TITLE="${USER}@${HOSTNAME}"' iftop (h=help, L=lin/log scales, t=line display mode, T=line totals, p=port display)'
gnome-terminal --title "$TITLE" -e 'sh -c "sudo iftop -P -f \"(port 55) or (port 66)\""' --hide-menubar --zoom=0.85

I did try running the entire script as sudo and that results in all the terminals being opened also being a sudo terminal. What I need is a regular terminal running the sudo iftop instead.

A: Is timestamp_type in /etc/sudoers or /etc/sudoers.d/* set to tty or ppid?  tty is the default according to sudo's man page:

timestamp_type - sudoers uses per-user time stamp files for
  credential caching.  The timestamp_type option can be used to
  specify the type of time stamp record used.  It has the following
  possible values:
global A single time stamp record is used for all of a user's
  login sessions, regardless of the terminal or parent process ID.
  An additional record is used to serialize password prompts when
  sudo is used multiple times in a pipeline, but this does not affect
  authentication.
ppid A single time stamp record is used for all processes with
  the same parent process ID (usually the shell).  Commands run from
  the same shell (or other common parent process) will not require a
  password for timestamp_timeout minutes (15 by default).  Commands
  run via sudo with a different parent process ID, for example from a
  shell script, will be authenticated separately.
tty One time stamp record is used for each terminal, which
  means that a user's login sessions are authenticated separately.
  If no terminal is present, the behavior is the same as ppid.
  Commands run from the same terminal will not require a password for
  timestamp_timeout minutes (15 by default).
The default value is tty.
This setting is only supported by version 1.8.21 or higher.

If it is set to tty or ppid, then that explains why you're being asked for a password every time.  Each sudo command you're running is being executed in a separate gnome-terminal, and thus a separate tty AND a different parent PID.
Looks like global is the only setting that will allow what you want.

If that doesn't help, what's your timestamp_timeout setting?  Is it set to 0?   The default should be 15 minutes.
Also check the other timestamp* settings (timestampdir, timestampowner).  They could cause this problem if timestampdir (the default on my debian sid system is /run/sudo/ts) doesn't exist or is not rwX by timestampowner (default root).
sudo will log a descriptive error message via syslog and email the administrator (root) if these settings result in an error.

One other option is to edit /etc/sudoers so that your user can run iftop without needing to enter your password.  e.g.
yourusernamehere ALL= NOPASSWD: /usr/sbin/iftop

See How to run a specific program as root without a password prompt? for more details on this.


text:
Q: What is the analogy of $|x\rangle$ in quantum field theory? Let me start from path integral formulation in quantum mechanics and quantum field theory.
In QM, we have
$$ U(x_b,x_a;T) = \langle x_b | U(T) |x_a \rangle= \int \mathcal{D}q  e^{iS}  \tag{1} $$
$|x_a \rangle$ is an eigenstate of position operator $\hat{x}$.
In QFT we have
$$ U(\phi_b,\phi_a;T) = \langle \phi_b | U(T) |\phi_a \rangle= \int \mathcal{D}\phi  e^{iS}  \tag{2} $$
$| \phi_a \rangle $ is an eigenstate of field operator $\hat{\phi}(x)$.
By analogy with QM, it is tempting to relate
$$|\phi  \rangle \leftrightarrow |x  \rangle \tag{3} $$
However, in Peskin and Schroeder's QFT, p24, by computing it is said

$$ \langle 0 | \phi(\mathbf{x}) | \mathbf{p} \rangle = e^{i \mathbf{p} \cdot \mathbf{x}} \tag{2.42} $$
  We can interpret this as the position-space representation of the single-particle wavefunction of the state $| \mathbf{p} \rangle$, just as in nonrelativistic quantum mechanics $\langle \mathbf{x} | \mathbf{p} \rangle \propto e^{i \mathbf{p} \cdot \mathbf{x}} $ is the wavefunction of the state $|\mathbf{p}\rangle$.

Based on the quoted statement, seems
$$\hat{\phi}(x) | 0 \rangle \leftrightarrow | x \rangle \tag{4} $$
If relations (3) and (4) are both correct, I should have
$$\hat{\phi} ( \hat{\phi} | 0 \rangle ) = \phi(x)  (  \hat{\phi}| 0 \rangle ) \tag{5}$$
seems Eq. (5) is not correct. At least I cannot derive Eq. (5).
How to reconcile analogies (3) and (4)?

A: *

*No $\hat\phi|0\rangle$ is not an eigenvector of $\hat\phi$. You can see this, for example, by writing out $\hat\phi$ in terms of creation and annihilation operators, then compare  $\hat\phi|0\rangle$ against  $\hat\phi^2|0\rangle$, and observe that one is not a scalar multiple of the other. So as you suspected, eq. 5 is not correct

*To obtain some analogy of $| x\rangle$, you can just take a fourier transform of  $a^\dagger(p)$ to get $a^\dagger(x)$, and $a^\dagger(x)|0 \rangle \equiv |x \rangle$ is the best analogy of $|x \rangle$ that I can think of

A: You can utilize the construction of the $Q$ space, as described in Reed and Simon vol.2, page 228-230.
Oversimplifying, you can make the analogy $\lvert \phi\rangle \sim \lvert x\rangle$, but the associated momentum is not $\hat{p}$, but $\hat{\pi}$ (the canonical conjugate momentum of the field $\hat{\phi}$).
With slightly more precision: the Fock space is isomorphic to an $L^2$ space where $\hat{\phi}$ acts as the multiplication by the function $x$ (is a "variable" of the $L^2$ space), and $\hat{\pi}$ as the (functional) derivative $-i\frac{\delta}{\delta x}$; and in this context you can define the "eigenfunctions" (they do not belong to the $L^2$ obviously) $\lvert\phi\rangle$ and $\lvert\pi\rangle$ with the usual meaning as (infinite dimensional) position and momentum eigenfunctions. The precise construction is detailed in the reference above.


text:
Q: Embedding an HTML Image in a mail? I have a requirement where i have to embed an image in a mail and when the user would click over the image it would redirect him to the new site. I seriously have no idea as to what should i provide in the image src. Is it possible only through html. Require guidance. Thanks.
This is my trial HTML

<title>trial</title>

A:
INLINE EMBEDDING (Base64 Encoding)
Inline embedding is much more simple, mostly because you don't have to
  completely roll your own emails and dig around in MIME to use it.
Embedding an image in an email first requires that you have a version
  of said image as a base64 encoded string. There are lots of web based
  tools to do this, such as ImageToBase64Converter by Web Coder Tools.
Once your image is encoded, jump into your template, or whatever HTML
  you're sending out, and embed it using a standard HTML image tag:

Then you're done! Send away.
Pros
Much simpler to achieve Much faster to do Requires much less deep dive
  into MIME and application code
Cons
Can really increase size of emails especially if you use more than one
  image Most likely blocked by default in many webmail services Blocked
  completely in Outlook

REFERENCES: "Sendgrid Blog - Embedding Images"

EXTERNAL REFERENCE LINK
link the image from another site.

A: Replace the img src with an absolute url and you're done - if the reader is connected to the internet when reading, otherwise your pic will not be loaded.


text:
Q: Vertical direction in images Mathematica's relatively new Image structure and related functions are very useful, but it is a great disappointment that they adopted the convention that the first row is at the top of the image. This means, among many other confusing things, that the column indexes run in a positive cartesian direction, but the row indexes run in a negative cartesian direction. I expect I will have to live with this, but I wondered if there was any global variable that could customize this, sort of like FourierParameters?

A: No, this doesn't exist as far as I know. There is one thing that might help you in certain situations when you work with the pixel data of images: ImageData has an option DataReversed which you can set to true, if you would like to extract the pixel matrix upside down so that the coordinates are correct again.


text:
Q: UIWebView ScrollView Content Half-Drawn This problem is best explained with a screenshot or three!
Somehow, I have a UIWebView that is not rendering its content fully...or is it?  I can certainly tap on and select the text in the webView, even if I can't see it!  What is going on here?

To be clear, this only happens sometimes when I'm displaying content in a webView.  It's random, not easily reproducible.
I have a UIPageViewController, with each "page" viewController having a UIWebView in it.  To populate with content I inject HTML, and when webViewDidFinishLoading: returns I run a JS function that does some mangling and finishes the population.  (Mangling done in JS for cross-platform-ability.)
The way it's set up, you can tap on a link in the HTML and a new page is created in the PageViewController, which is then animated to, and fresh content is loaded into this new page.  Think "dictionary app".
But as I say, randomly I get this phenomenon, where the content is definitely there and touchable, but not visible.
Here are some more revealing screenshots:

You can see that the UIWebView, flattened, looks to Reveal just the same as the iPad device screenshot.  But if I go into the tree and explode the UIWebBrowserView (content view for the UIScrollView that's in the UIWebView) you can see the whole HTML page!
I'm not familiar enough with the inner workings of drawing views to be able to isolate this issue and solve it, so I would appreciate any help.
P.S. One potentially related thing is that I called setViewControllers:animated: on my UIPageViewController, which creates the new UIWebView and starts the loading process, and then in the completion: block of that call, I call it again but without animation, to trick the UIPageViewController into getting "lost" and forcing it to re-query the datasource next time the user attempts to pan.  See this post for details.  Anyway, might not be relevant, but had to mention it.

A: You need 2 things:

*

*to have correct layout, (Autolayout since iOS 6.0)

*it's needed to put UIWebView on scrollview and than set scrollview size in webview delegate (after HTML rendering is finished)


text:
Q: how to get Tabcontrol's Tab focus in WPF I am New in WPF
I have one form on which I put one datagrid as well as there is one "Add New" button to add new item in grid
so is there any way to know about tab lost focus when click on Add new button and again get focus on tab control ? Lostfocus event of tab control does not work.
Thanks

A: You can make use of the TabControl.SelectionChanged Event
void TabControl_TabSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (e.Source is TabControl)
    {
        // do something
    }
}


text:
Q: Question on finding a contour integrals Here is the question: Let $f$ be holomorphic on $\mathbb{C} -\{0 \}$. Let $s_{1}, s_{2} > 0$. Prove that if $c_{1}$ and $c_{2}$ are counterclockwise oriented squares of center $0$, and side length $l_{1}, l_{2},$ respectively, then
$$ \frac{1}{2\pi i} \oint_{c_1}f(w) dw = \frac{1}{2 \pi i}\oint _{c_2} f(w) dw $$. We are not assuming that the sides of these squares are parallel to the coordinate axes.
The book gives me a hint which says the following: The function f has a holomorphic anti-derivative on the upper half plane and the lower half plane. These are the planeThe thing is that I want to apply the cauchy integral formula. The problem is how to come up with the closed contour. How do you come up with any closed contour with the two squares? I have an idea on how to draw out the closed contour but I have no idea how to put it on latex.
Please only give me hints. Try not to solve the problem completely. Thank you for your help!!!!

A: Assume $l_1 < l_2$ so that $c_1$ is the inner square. Say $d_k$ is the right upper corner of $c_k$ and let $e$ be the straight line that goes from $d_1$ to $d_2$. Now consider the curve $\gamma$ given by $c_1$ (with initial and end points given by $d_1$), followed by $e$, then followed by $-c_2$ ( that is, $c_2$ with reverse orientation) and finally followed by $-e$. You should now be able to show, using Cauchy's thm, that $\int_\gamma f =0$ and conclude the desired result.


text:
Q: GNU GRUB exit mac os I have a Macbook Air. I installed Ubuntu with dual boot. But I wanted to delete it. I deleted rEFInd. Then I restarted and I got to GNU GRUB. When I write command exit it froze. When I try to access to recovery mode I cannot see anything --  there is no Mac OS X disk. How can I get back to Mac OS?

A: Try holding down the Option (or Alt) key as you power on the computer and it sounds its chime. This should bring up the computer's built-in boot manager.
If that fails, and if the computer boots to Ubuntu, you could do one or more of three things:

*

*Use efibootmgr -- The efibootmgr tool controls the computer's boot order. Typing sudo efibootmgr shows the entries. There should be an entry for ubuntu, which you can delete with sudo efibootmgr -b #### -B, where #### is the boot number; or you can use -o to set a new boot order, as in sudo efibootmgr -o 80,81,82 to set Boot0080 first, Boot0081 second, and so on. (OS X generally uses 0080 and above for itself.)

*Delete GRUB -- Ubuntu installs GRUB in the /boot/efi/EFI/ubuntu directory (EFI/ubuntu on the EFI System Partition [ESP]). Deleting this directory, or at least the grubx64.efi and shimx64.efi files it contains, will prevent it from running. The computer should then try the next available boot entry, which should be OS X; or enter an automatic recovery tool.

*Reset the NVRAM -- See this official Apple page for information on how to reset the computer's NVRAM. I'm not 100% sure of this, but I believe that doing so will reset the boot order options, thus solving your problem. (Note that this should work even without access to Ubuntu.)


text:
Q: Density of Air in a balloon
A balloon with volume 2800 m³ is heated up to 60 °C.
  If the outer temperature is 12 °C and the air has a pressure of 960 hPa, what is
  the density of the air inside the balloon and on the outside?

In the solutions they used the following formula: $ \rho_1 = \rho_0 \cdot \frac{P_1}{P_0} \cdot \frac{T_0}{T_1} $
However, I have no clue on how to get to this fomula. It is neither in my fomulary nor was I able to derive it from another formula.
My approach was to calculate the molar mass of the air which is $28.96 \frac{g}{mol}$ and then use it in this formula (which I derived from the $p\cdot V = n \cdot R \cdot T $):
$$ \rho = \frac{p\cdot M}{R\cdot T} $$
But that doesn't seem to be correct, since I get extremly high numbers and the correct value should be $1.17 \frac{kg}{m^3}$. Also, this approach only works for the outer density - I do not have the pressure inside the baloon.

A: $$\rho=\frac{n*M}{V}$$
With $n$ the number of moles of the gas, $M$ the molar mass of the gas, and $V$ the volume of the gas. $n$ and $M$ are constant, so:
$$\rho_1=\rho_0*\frac{V_0}{V_1}$$
For $V$ we have:
$$V=\frac{n r T}{p}$$
$n$ and $R$ are constant, so:
$$V_1=V_0*\frac{T_1}{T_0}*\frac{p_0}{p_1}$$
So:
$$\rho_1=\rho_0*\frac{T_0}{T_1}*\frac{p_1}{p_0}$$
Which is exactly the expression given in the solution.


text:
Q: macbook pro 15 inch retina, keyboard shortcut for desktop display I have the latest MacBook Pro 15 inch with Retina display, OS 10.8.4. Not wanting to use the standard Fn keys but use them as Apple has assigned them.
Is there a keyboard shortcut to display the desktop? I find the finger drag on the trackpad literally a drag!
Thanks, Carin

A: cmd-F3 works for me.  If you have Use all F1, F2, etc. keys as standard function keys turned on in System Preferences > Keyboard, then it would have to be fn-cmd-F3.

A: *

*Go to System Preferences -> Mission Control

*Assign your own keyboard shortcut to Show Desktop.

A: Just press command + F3
And repeat the same command to bring the windows back.


text:
Q: jnlp suddenly broken with java web start I am seeing a problem with Web App Start running the same old jnlp.
I have been running on Mac, Darwin Kernel Version 10.8.0, forever. All of a sudden, I am not able to run the app from web start.
java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-10M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

from the console, I run
javaws ./my.jnlp
Java Web Start splash screen process exiting .....
    Bad installation. No JRE found in configuration file

the jnlp file contains:
<security>
    <all-permissions/>
</security>
<resources>
<j2se version="1.4+" initial-heap-size="128m" max-heap-size="256m" />

Not sure what is going on? Any ideas anyone?

A: Should your problem reappear, or should somebody else run into the same problem... Oracle's Mac Java FAQ states: "Apple disables the Java plug-in and Webstart applications when the Java update is done using Software Update."  You can download Java 7 for the Mac from Oracle and use it for Webstart.  See https://www.java.com/en/download/mac_download.jsp
Apple has been intermittently issuing software updates which disable Java applets and Webstart for awhile, so the problem may indeed resurface later.

A: I ran the software update for Java on my Mac and the problem disappeared.
It came as a mystery, only fair for it to go away in mystery also.


text:
Q: how can i combine these 3 matlab graphs to a single one? hello i have these three polar plots:

*

*polar(a,(V1).^(-1),'-r')

*polar(a,(V2).^(-1),'-g')

*polar(a,(V3).^(-1),'-m')

where V1,V2,V3 are matrices , how can i combine these 3 graphs to a single one (not like subplot , more like copyobj)?
Note: The axes remain the same in every graph.
Thank you

A: You can use hold on as you would for any other types of graphs.
Example:
clear
clc
close all

figure;

theta1 = 0:0.01:2*pi;
rho1 = sin(2*theta1).*cos(2*theta1);

theta2 = 0:0.1:2*pi;
rho2 = cos(2*theta2).*cos(2*theta2);

theta3 = 0:0.1:2*pi;
rho3 = cos(2*theta2).*tan(2*theta2);

polar(theta1,rho1,'--r')

hold on

polar(theta2,rho2,'-b')
polar(theta3,rho3,'-g')

output:

A: Use hold on. It will "hold" every plot you make and put the others on top. If you want to stop holdin, then hold off.

A: thanks guys, solved it with:
 figure;
   b=polar(a,(V3).^(-1),'-m')
   hold on
   c=polar(a,(V2).^(-1),'-g')
   hold on
   a=polar(a,(V1).^(-1),'-r')
   hold off;

for some reason when i change the series that i write the polars (for example a,b,c) the method doesn't work... But now it's ok, so never mind :)


text:
Q: QMetaObject::invokeMethod returns true but doesn't execute the solt I'm trying to run a public slot in another thread using invokeMethod:
QMetaObject::invokeMethod(m_manager, "onEventRequest", Qt::QueuedConnection, Q_ARG(int, 0));

Now, invokeMethod returns true and no error message are reported, but the slot onEventRequest is never called. I added a breakpoint in onEventRequest which is never triggered.
m_manager is created in the main thread, this class inherits QObject and uses the Q_OBJECT macro invokeMethod is executed in another thread created by QThread::run().
I would appreciate any help on this, or on how to check why the method is not being called.


text:
Q: In pint, how do I redefine the micro- symbol to be µ-, not u-? In pint, how do I redefine the micro- prefix to be spelt µ- rather than u-?  Both are aliases when defining units, but when obtaining the short symbol such as with the {:~} format specification, pint reverts to u- even when I try to redefine micro- = 1e-6 = µ-:
In [155]: ureg.define("micro- = 1e-6 = µ-")
WARNING  2016-01-06 15:19:07,017 unit._adder:563: Redefining 'micro' (<class 'pint.definitions.PrefixDefinition'>)
WARNING  2016-01-06 15:19:07,017 unit._adder:563: Redefining 'µ' (<class 'pint.definitions.PrefixDefinition'>)

(Note that these warnings are apparently issued through the logging module and show up due to a rule in my .pythonrc, logging.basicConfig(format=("%(levelname)-8s %(asctime)s %(module)s.%(funcName)s:%(lineno)s: %(message)s"), level=logging.DEBUG))
In [156]: x = 3 * ureg.micrometre

In [157]: ureg._get_symbol("micrometer")
Out[157]: 'um'

In [158]: "{:~}".format(x)
Out[158]: '3 um'

How do I redefine the micro- entry in the registry such that "{:~}".format(x) will give me 3 µm rather than 3 um?
Edit
I'm using pint from the latest git repository:
In [161]: print(pint.__version__)
0.7.dev0

Edit 2
The situation appears to occur only if there exist previously defined quantities that use the u- prefix:
In [3]: ureg = pint.UnitRegistry()

In [4]: q = 12 * ureg.um

In [5]: ureg.define("micro- = 1e-6 = µ-")
WARNING  2016-01-06 15:41:25,477 unit._adder:563: Redefining 'micro' (<class 'pint.definitions.PrefixDefinition'>)
WARNING  2016-01-06 15:41:25,477 unit._adder:563: Redefining 'µ' (<class 'pint.definitions.PrefixDefinition'>)

In [6]: x = 3 * ureg.micrometre

In [7]: "{:~}".format(x)
Out[7]: '3 um'

But (new session):
In [7]: x = 3 * ureg.micrometre

In [8]: "{:~}".format(x)
Out[8]: '3 µm'

So I suppose redefining the default needs to be done before using the u- alias.

A: You need to redefine the µ- prefix before using the (admittedly convenient for somewhat easier to type) u- prefix:
In [2]: ureg = pint.UnitRegistry()

In [3]: ureg.define("micro- = 1e-6 = µ-")

In [4]: x = 3 * ureg.um

In [5]: print("{:~}".format(x))
3 µm

But (other session):
In [3]: x = 3 * ureg.um

In [4]: ureg.define("micro- = 1e-6 = µ-")

In [5]: print("{:~}".format(x))
3 um


text:
Q: Use local button styles during forwarded X11 session over SSH Is it at all possible to have a forwarded X11 session be styled with something other than the default X button styles? It doesn't even appear to use my server's actual styles seeing as both computers are running Ubuntu 10.10. However, the window on the left is from the local machine, and window on the right is forwarded via ssh -X.
Is there any way to change this behavior to mimic the native button style or change it at all? Thanks.

A: This has apparently been discussed on SuperUser as well;
Suppressingfire's answer looks to me like the correct one:

*

*Install your favorite Ubuntu GTK theme on the remote host as well;

*Create a ~/.gtkrc-2.0 on the remote host, and include the theme's own gtkrc from it; e.g., if you're running Ubuntu with the ClearLooks theme on the remote host, you can add use this line:
include "/usr/share/themes/ClearlooksClassic/gtk-2.0/gtkrc";

Update from comments
The GUI way:
sudo apt install lxappearance gnome-themes-extras
lxappearance

With this method you also can change other properties like icons


text:
Q: Socket Programming using java I am sent simple chat messages from client to server using threads and tcp protocol. But when i look into the details of the packet using wireshark i saw that my data getting divided for eg.. my MSS=1460, if i am sending a data of 780 bytes..1st few bytes goes into 1st segment and the rest in 2nd..number of bytes going in the packets is random. what should i do inorder to utilize my network's full capacity??. At first i thought i was getting this since i was using DataInputStream/OpStream but when i changed it to bufferedreader the problem remains the same.
PLEASE HELP!!

A: Use a BufferedOutputStream or BufferedWriter to send, and only flush when you really need to, e.g. before reading.


text:
Q: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token Estoy tratando de mapear un JSON a un objeto en java, el JSON es algo asi:
{
    "usage": {
        "text_characters": 22,
        "features": 1,
        "text_units": 1
    },
    "entities": [{
        "count": 1,
        "text": "pisos",
        "disambiguation": {
            "subtype": ["NONE"]
        },
        "type": "Producto"
    }, {
        "count": 1,
        "text": "No hay",
        "disambiguation": {
            "subtype": ["NONE"]
        },
        "type": "Quiebre_Stock"
    }, {
        "count": 1,
        "text": "madera",
        "disambiguation": {
            "subtype": ["NONE"]
        },
        "type": "Producto"
    }],
    "language": "es"
}

Estoy tratando de mapear el JSON con este metodo
parsedJsonObj = mapper.readValue(result, NLUEntitiesRelations.class);

y NLUEntitiesRelations.class es asi
public class NLUEntitiesRelations {
    private UsageNLU usage;
    private List<EntityNLU> entities;
    private String language;

    //getter and setter
}

public class UsageNLU {
    private int text_characters;
    private int features;
    private int text_units;
    //getersand setter
}

public class EntityNLU {
    private int count;
    private String text;
    private DisambiguationNLU disambiguation;
    private String type;
    //getter and setter
}

public class DisambiguationNLU {
    private List<String> subtype;
    //getter and setter
}

pero cuando ejecuto esto, obtengo el siguiente error, y cree las nuevas clases para los JSON dentro de los JSON

Error: com.fasterxml.jackson.databind.JsonMappingException: Can not
  deserialize instance of java.lang.String out of START_OBJECT token at
  [Source: { "usage": { "text_units": 1, "text_characters": 22,
  "features": 1 }, "language": "es", "entities": [ { "type": "Producto",
  "text": "pisos", "disambiguation": { "subtype": [ "NONE" ] }, "count":
  1 }, { "type": "Quiebre_Stock", "text": "no hay", "disambiguation": {
  "subtype": [ "NONE" ] }, "count": 1 }, { "type": "Producto", "text":
  "madera", "disambiguation": { "subtype": [ "NONE" ] }, "count": 1 } ]
  } ; line: 2, column: 12] (through reference chain:
  cl.sodimac.watson.alchemy.json.NLUEntitiesRelations["usage"])


text:
Q: Redirect & consecutive POST request I'm submitting a login form via:
$loginRequest = array(
                      'Username' => 'myUsername'
                      'Password' => 'myPassword'
);
$request = new HTTP_Request2($url, HTTP_REQUEST2::METHOD_POST);
$request->addPostParameter($loginRequest);
$response = $request->send();

The POST is successful and the output of $response is

Loading...

which (at least when manually logging through Chrome) redirects to another form with input
 <FORM name="autologin" method=POST action="https://homepage/AccountSettings">
 <input type="hidden" name="Z" value="0,0">

I'm not sure how to have PHP programmatically handle refresh_url and redirect to /homepage Also, how can I force PHP to submit this last form as well?
EDIT
There's also the following meta tag on the intermediate page
<meta http-equiv="Refresh" content="0; URL=/vdesk/?langchar=en.iso-8859-1&ui_translation=off&gbrowsertype=">

A: Actually you can't redirect and then POST.
See the Post/Redirect/Get pattern: that's how you should try to implement a login page.

A: If you are capturing the post (username/password) then you would normally load the page using PHP like this:
header("Location: /homepage");

But from your example you seem to be confusing client-side and server-side for processing the login.  Take a look a the simple code here:
http://php.thedemosite.co.uk/logincode.php
it should help.

A: You want to do two things:
1) You want to go to the "next page." You can do this by looking for the meta refresh tag, and going to the target URL. You can get the URL from the contents of the meta refresh tag using a simple regular expression.
2) You want the next page to recognize that you have logged in. If this is a normal webapp, then you need to parse the Set-Cookie: headers that come in the original request, and turn them into Cookie: headers that you send along when you request the next page.
If you want to further follow links from the next page, you may also need to look for cross-site request forgery security tokens, that many web application frameworks put in the page data, and you have to provide back when posting, to defend against certain browser-based session hijacking attacks.
Note that not every site will have a meta refresh after logging in -- credentials for HTTP applications are not standardized in reality (as the web authorization headers are not generally used.) If you want to do a whole lot with a bunch of different sites, you'd better hope those sites have programmatic APIs of some sort, rather than resorting to HTTP web page scraping.


text:
Q: Error: Can't convert from 'Microsoft.Office.Interop.MSProject.Task' to 'System.Action' I am taking a file with an .mpp extension so I can read it with Microsoft.Office.Interop.MSProject
But it shows me the following error

Can't convert from 'Microsoft.Office.Interop.MSProject.Task' to 'System.Action'

public new string Load(string fileName)
    {
        MSProject.ApplicationClass app = null;
        string retVal = "";
        ArrayList tasks = new ArrayList();

        try
        {
            // execute the Microsoft Project Application
            app = new MSProject.ApplicationClass();

            // Do not display Microsoft Project
            app.Visible = false;

            // open the project file.
            if (app.FileOpen(fileName, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSProject.PjPoolOpen.pjPoolReadOnly, Type.Missing, Type.Missing, Type.Missing, Type.Missing))
            {
                // go through all the open projects--there should only be one
                foreach (MSProject.Project proj in app.Projects)
                {
                    // go through all the tasks in the project
                    foreach (MSProject.Task task in proj.Tasks)
                    {
                        // add Microsoft Project Task to arraylist
                        tasks.Add(new Task(task));
                    }
                }
            }
            else
            {
                retVal = "The MS Project file " + fileName + " could not be opened.";
            }
        }
        catch (Exception ex)
        {
            retVal = "Could not process the MS Project file " + fileName + "." + System.Environment.NewLine + ex.Message + System.Environment.NewLine + ex.StackTrace;
        }

        // close the application if is was opened.
        if (app != null)
        {
            app.Quit(MSProject.PjSaveType.pjDoNotSave);
        }
        return retVal;
    }

I am working with WindowsForm and where the error marks me is:
foreach (MSProject.Task task in proj.Tasks)
                    {
                        // add Microsoft Project Task to arraylist
                        tasks.Add(new Task(task)); <= Error
                    }

Can anyone support me with this


text:
Q: Combobox Running Code/Query throwing "Recordset is not updateable" When I click the Combobox, the dropdown list is populated, yet when I try to click on an option it says "Recordset is not updateable".. I have tried to read up on this error yet can't identify the issue behind this. The joins aren't complicated and it has worked before. The query source for the AwardsSubFrm is attached:

Anyone know how to fix this?

A: The image of the query design indicates your record source is a GROUP BY query.  The recordset from any GROUP BY query is never updateable.  You can verify that point by opening the query in Datasheet View of the query designer and confirm Access won't let you change any of the values.
I don't know what the fix is for your situation, but you need something other than just a GROUP BY query.  Perhaps a subform whose record source contains the table rows you want to update, and link it to the main form so it displays those records which are related to the current main form row.


text:
Q: What is the intuition and motivation behind a norm on a space? I have a question regarding norms. I am looking for an intuitive understanding of what norms do. From what I know so far, in any arbitrary space, if I have a norm, then it appears that it allows me to define distances. That is, if I have two points in the space, I know where they are in relation to one another. Is the motivation then that I can sort of "classify" and discriminate where things are once I have a metric or norm on the space? Also, if a space doesnt have a metric or norm, what would that mean? Thank you

A: Considering $\mathbb R^n$ with its standard linear structure and inner norm given by $x\cdot y=\sum _k x_ky_k$ the Cauchy-Schwarz ($|x\cdot y|\le \|x\| \|y\|$) inequality allows one to define angles between vectors and relate the angle to the norms. Here the norm $\|x\|$ is defined to be $\sqrt {x\cdot x}$, i.e., it is derived from the inner product.
Now the whole idea of defining the inner product the way it is is coming from the law of cosines, so it is entirely geometric. So, one can say that a vector space with an inner product is an axiomatization of angles and lengths.
The idea behind a normed space is to axiomatize lengths, but not angles. This is important for two reasons. The first is that it allows one to ignore angles when these are irrelevant. Secondly, and somewhat more importantly, quite often a given vector space of interest, such as the $\ell_p$ spaces for $p\ne 2$, does not have a notion of angles, but does have a perfectly good norm defined on it.
A norm is sufficient to define a metric function and thus obtain a topology on the space, which is why having a norm is important.
A very healthy way to think of a normed space is as a fusion between a vector space and a metric space, as follows. A metric on a vector space $V$ is translation invariant when $d(x+z,y+z)=d(x,y)$ for all vectors $x,y,z$. The metric is homogenous when $d(\alpha x, \alpha y)=|\alpha |d(x,y)$ for all vectors $x,y$ and scalars $\alpha$. Now it is trivial to verify that the metric induced by a normed space is translation invariant and homogenous. The interesting fact is that any translation invariant and homogenous metric defines a norm on the vector space. There is thus a bijective correspondence between norms on a vector space $V$ and metrics on $V$ which are translation invariant and homogenous.

A: Consider the $l_{\infty}$ metric on $\mathbb{R}^2$ which arises from a norm:
$$d:\mathbb{R}^2 \times \mathbb{R}^2 \rightarrow \mathbb{R}$$
$$((a_1,a_2),(b_1,b_2))\mapsto max\{|a_1-b_1|,|a_2-b_2|\}$$
This metric might be applied to a lathe/CNC machine for instance.
Suppose you have an automated manufacturing machine which would move a drill around over the top of a flat sheet of metal. The machine can move the drill in two dimensions over the sheet metal before dipping and drilling into the metal. Suppose also  that this movement is controlled by two motors in the $x$ and $y$ direction which each have the same maximum speed.
If you have a particular design you want this machine to drill and you're trying to minimize the time taken to manufacture it, then you want to know how long the drill will take to get from hole to hole. In this case, if both of the movement motors can move at the same time, then the limiting factor that slows down the automated drill is not the euclidean distance from one hole to another, but the greater of the $x$ and $y$ distances-- whichever motor takes longer to move the drill in its direction.
So in this case, to weigh up in which order you should have the machine drill the holes, you would not worry about the euclidean distance but instead measure the distance from one hole to the next using the $l_\infty$ metric.
This is one application of a metric.

A metric which arises from a norm also has the two properties:
$$d(x+c,y+c)=d(x,y)$$
$$d(\lambda x, \lambda y)=|\lambda|\cdot d(x,y)$$
The first property, translational invariance, means that no matter where the drill currently is, its distance to a hole which is, say, $2$cm forward and $1$cm right will always be the same. It wouldn't make sense in this case if the distance to a hole which is $2$cm forward and $1$cm right depended on where the drill head currently was!
The second property means that a hole which is $4$cm forward and $2$cm right would be exactly twice as far away.

I hope this gives you some intuition about the properties and applications of metrics and norms.


text:
Q: Handling Long-Running Processes in an ASP.net Web API 2 Service I created a REST service using ASP.net Web API 2.  The service allows a client to POST records which are stored in a SQL Server database.  At this point some other process needs to pull the records from the database, process them, and send the results to another, separate REST service.
Since the processing of the records will be time-consuming, I don't want to perform this step as part of the POST action, but I'm trying to figure out the best approach to designing this other process.
Is there a way to integrate this functionality into the ASP.net REST API project, or is something like a Windows Service the best solution?

A: You could write your web service asynchronously. So that,
public async Task<HttpResponseMessage> PostRecords(Records records)
{
    await [POST data to db]

    // process records asynchronously without awaiting

}

You can also perform the post operation synchronously and at the same time track the completion of the post in your database. And as you mentioned, have a job or windows service process the completed posts separately.

A: You can use Quartz.NET scheduling library within the asp.net mvc or web api. Define a job which executes your query and fire the job from your post action.


text:
Q: Selenium Drivers I am initiating on browser automation tests using Selenium WebDriver, and while reading the tutorial I got blocked in a point.
In the Selenium WebDriver's Drivers topic where it explains the pros and cons of each WebDriver implementation , it says the following about the HtmlUnit driver:

HtmlUnit is a java based implementation of a WebBrowser without a GUI

So this means that this driver is equal to a browser application (like Mozzila,Opera or Chrome) without the GUI, we can only interact with it through methods
Firefox Driver

Runs in a real browser and supports JavaScript
Controls the Firefox browser using a Firefox plugin. The Firefox
Profile that is used is stripped down from what is installed on the
machine to only include the Selenium WebDriver.xpi (plugin). A few
settings are also changed by default (see the source to see which
ones) Firefox Driver is capable of being run and is tested on Windows,
Mac, Linux. Currently on versions 3.6, 10, latest - 1, latest

What does this mean? To use this driver, do I have to install Firefox on my machine ?
When it says that it "runs in a real browser," does it mean that the multiple commands that we
use with the WebDriver interface are sent to the browser installed in our machine ?
If my assumption is correct, if we run the test on the Selenium-Server should the machine where the server is installed have Firefox installed?

A: Your assumption in correct, If are using Selenium then you need to install the browser whereas HtmlUnit is Gui less (no GUI need to install)

A: Yes absolutely your assumption is correct. You need to install Firefox browser to use FirefoxDriver where as for HtmlUnitDriver no browser needed.
See below link to see basic programs using HtmlUnitDriver & FirefoxDriver
https://code.google.com/p/selenium/wiki/GettingStarted
In the same way you can run your tests in IE using InternetExplorerDriver.
Chrome, Opera drivers also available but not developed by seleniumhq
You can download all types of driver from below link
http://docs.seleniumhq.org/download/


text:
Q: Adding Border Around Bootstrap Tabs I'm using the Bootstrap tab markup as seen below:

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content {
    &.tab-content-alt {

    }
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

Call Us

Email Us

...

...

However, I'd like it if a border enclosed the entire tab as seen below, but in my example, the border isn't fluid and there is a break in it. Any ideas how to achieve this result?

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content.tab-content-alt {
        border-right: 1px solid #ddd;
        border-left: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        border-top-color:transparent;
        border-radius: 4px;
    }
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

Call Us

Email Us

...

...

A: Im not sure if i got the idea, i just changed the border-radius to zero, and this creates the efect of fluid container

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content.tab-content-alt {
        border-right: 1px solid #ddd;
        border-left: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        border-top-color:transparent;
        border-radius: 0px;
    }
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

Call Us

Email Us

...

...


text:
Q: CustomRenderer for Button background color transition I have made a customrenderer for changing the TitleColor and BackgroundColor when an user click my button.
For some reason, when the button is focused, the TitleColor is turning more or less transparent, and my background doesn't animate like my TitleColor.
This is my code:
public class BtnRendereriOS : ButtonRenderer
{

    protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
    {
        base.OnElementChanged(e);

        if (Control != null)
        {
            Control.Layer.CornerRadius = 0;

            BackgroundNormalState(Control);

            Control.TouchUpInside += (object sender, EventArgs c) =>
            {
                BackgroundNormalState(sender);
            };
            Control.TouchUpOutside += (object sender, EventArgs c) =>
            {
                BackgroundNormalState(sender);
            };
            Control.TouchDragOutside += (object sender, EventArgs c) =>
            {
                BackgroundNormalState(sender);
            };
            Control.TouchDragInside += (object sender, EventArgs c) =>
            {
                BackgroundChangedState(sender);
            };

            Control.TouchDown += (object sender, EventArgs c) =>
            {
                BackgroundChangedState(sender);
            };
            void BackgroundNormalState(object sender)
            {
                Action a = () => Control.SetTitleColor(UIColor.FromRGB(255,255,255), UIControlState.Normal);
                UIView.PerformWithoutAnimation(a);

                (sender as UIButton).BackgroundColor = UIColor.FromRGB(3, 169, 244);

            }
            void BackgroundChangedState(object sender)
            {
                Action a = () => Control.SetTitleColor(UIColor.FromRGB(0,0,0), UIControlState.Highlighted);
                UIView.PerformWithoutAnimation(a);

                (sender as UIButton).BackgroundColor = UIColor.FromRGB(104, 206, 253);
            }
        }
    }
}

Currently, I have removed the animation from the TitleColor.
My questions are:

*

*How do I add the same transition to my BackgroundColor similar to the default transition on my TitleColor?

*How do I remove the "transparency" from the TitleColor when the button is being focused?

A:
How do I remove the "transparency" from the TitleColor when the button
  is being focused?

This is the feature of system button, if you don't like this try to use Custom style to avoid it:
UIButton btn = new UIButton(UIButtonType.Custom);
btn.SetTitle(Control.TitleLabel.Text, UIControlState.Normal);
SetNativeControl(btn);
// Pay attention to that the title color just needs to be set once
btn.SetTitleColor(UIColor.FromRGB(255, 255, 255), UIControlState.Normal);
btn.SetTitleColor(UIColor.FromRGB(0, 0, 0), UIControlState.Highlighted);

Then you can use UIView.Animate() to change your button's background color with "transition":
void BackgroundNormalState(object sender)
{
    UIView.Animate(0.2, () =>
    {
        (sender as UIButton).BackgroundColor = UIColor.FromRGB(3, 169, 244);
    });

}
void BackgroundChangedState(object sender)
{
    UIView.Animate(0.2, () =>
    {
        (sender as UIButton).BackgroundColor = UIColor.FromRGB(104, 206, 253);
    });
}

A: You can either use UIView.Animate|Async or UIView.TransitionNotify|Async depending upon the end result you are looking for. The key is to place all the changes within the same animation block so they occur at the same time via Core Animation (CA).
Here is an example using UIView.TransitionNotifyAsync using a TransitionCrossDissolve between the color changes.
// Set intial values
var normalTextColor = UIColor.FromRGB(255, 255, 255);
var normalBackgroundColor = UIColor.FromRGB(3, 169, 244);
var highlightTextColor = UIColor.Black;
var highlightBackgroundColor = UIColor.FromRGB(104, 206, 253);
Control.SetTitleColor(normalTextColor, UIControlState.Normal);
Control.BackgroundColor = normalBackgroundColor;

async Task NormalColorState(UIButton button)
{
    await UIView.TransitionNotifyAsync(button, .25, UIViewAnimationOptions.TransitionCrossDissolve, () =>
    {
        button.BackgroundColor = normalBackgroundColor;
        button.SetTitleColor(normalTextColor, UIControlState.Normal);
    });
}
Control.TouchDown += async (object sender, EventArgs e) =>
{
    var button = sender as UIButton;
    await UIView.TransitionNotifyAsync(button, .25, UIViewAnimationOptions.TransitionCrossDissolve, () =>
    {
        button.BackgroundColor = highlightBackgroundColor;
        button.SetTitleColor(highlightTextColor, UIControlState.Highlighted);
    });
};
Control.TouchUpInside += async (object sender, EventArgs e) =>
{
    await NormalColorState(sender as UIButton);
};
Control.TouchUpOutside += async (object sender, EventArgs e) =>
{
    await NormalColorState(sender as UIButton);
};


text:
Q: How to get all regex matches from substrings only with regex I'm trying to get all hex colors from styles attributes in html, but not another hex color values.
Really it is a common task I want to understand so I don't want to get other solution, regex only.
In other words I need to get substrings with a regex pattern (hex color in this case) from a substring limited by know start and end patterns (style="substring to get values here")
My pattern
(?<=style=").*(#[A-F0-9]{6}).*(?=")

My test html:
This shouldn't be in result #FFFF99
This shouldn't be in result #FFFF99

I can get only last entry with this pattern, but I need to get all. (so in my example I should get 4 color values: 2 from first span and 2 from second one). How can I achieve it?
Thanks in advance!

A: If a quantifier in a positive lookahead is supported:
(?<=\bstyle="[^"]*)#[A-F0-9]{6}\b(?=[^"]*")

*

*(?<=\bstyle="[^"]*) Positive lookbehind, assert style=" followed by 0+ occurrences of any char except " to the left

*#[A-F0-9]{6}\b Match # and 6 times any of the listed chars followed by a word boundary to prevent an empty match

*(?=[^"]*") Positive lookahead, assert a 0+ times any char except " and then match a " at the right.

Regex demo
Note that this matches the word style and is not bounded to an element.
There are brittle ways to match brackets, but this can easily break.
(?<=<[^<>]*\bstyle="[^"]*)#[A-F0-9]{6}\b(?=[^"<>]*"[^<>]*>)


text:
Q: Why is a bug report about Stack Overflow's search functionality considered "off-topic"? A bug report I posted earlier today (Search fails to find matching issues) was just closed due to being "off-topic".
This is despite the fact that it is a very clear, easy to reproduce bug affecting a core feature of this site, for which I have outlined clear reproduction steps.
This bug affects search, and can potentially prevent users from finding questions that have already been asked. This will lead to an increase in the number of duplicate questions, which is a frustrating experience for the poster, and a waste of time for question reviewers.
So what exactly is it about this bug report that makes it off-topic? What justification is there for closing a bug report on an issue that affects core functionality of this site, and prevents users from finding questions that have already been asked?

A: It happens because we get a lot of blatantly off-topic questions on this site from new users. I've chronicled several reasons as to why this might happen in that post, but the most common reason is that one follows a link to this site (e.g. from a help page), and doesn't realize that they've been directed to a different site before asking their question.
We tend to moderate those quickly, in part to reduce their visibility on the site. Unfortunately, sometimes, an on-topic question will mistakenly be lumped into the wrong category, for various reasons.
I've voted to reopen the question as it's on-topic. (Update: A Stack Exchange employee has reopened the question.)


text:
Q: Product images not load PWA setup magento 2.3 I had done a PWA setup on my local machine.
I am facing product and category images issue.

Images path :
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAFCAQAAADIpIVQAAAADklEQVR42mNkgAJGIhgAALQABsHyMOcAAAAASUVORK5CYII="

src="/img/resize/300?url=%2Fmedia%2Fcatalog%2Fproduct%2Fv%2Fs%2Fvsk12-la_main_3.jpg"

A: Try this issue by copying the contents of vendor/magento/sample-data-media-venia/catalog to pub/media/catalog. Hope this helps.
Reference :
https://github.com/magento-research/pwa-studio/issues/413

A: Open this file
/var/www/html/magento231/pwa-studio/packages/venia-concept/.env

Remove comment and replace path like
# MAGENTO_BACKEND_MEDIA_PATH_PRODUCT="/media/catalog/product"
# MAGENTO_BACKEND_MEDIA_PATH_CATEGORY="/media/catalog/category"

To
MAGENTO_BACKEND_MEDIA_PATH_PRODUCT="/pub/media/catalog/product"
MAGENTO_BACKEND_MEDIA_PATH_CATEGORY="/pub/media/catalog/category"


text:
Q: creating a user control with three datasource , displaymember and valuemember i want to create a custom user control and i need to get three datasource, displaymember and value member in design time.
i can get datasource with below code:
private BindingSource dataSource;

[TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design")]
[Category("Data")]
[RefreshProperties(RefreshProperties.Repaint)]
[AttributeProvider(typeof(IListSource))]
[DefaultValue(null)]
public BindingSource DataSource
{
    get
    {
        return this.dataSource;
    }
    set
    {
        if (this.dataSource != value)
        {
            this.dataSource = value;
        }
    }
}

i don't know how i must get valuemember and displaymember of related datasource

A: This is a tutorial on how to do what you are asking
http://msdn.microsoft.com/en-us/library/ms233787.aspx

A: I have a property that supports Lookup Databinding instead custom control, here the code:
    private System.Windows.Forms.ListBox dropdownsource = new ListBox();

    [Category("Data")]
    [Browsable(true)]
    [DefaultValue(null)]
    [System.ComponentModel.Bindable(true)]
    [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design")]
    [Editor("System.Windows.Forms.Design.DataSourceListEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))]
    public object DataSource
    {
        get
        {
            return this.dropdownsource.DataSource;
        }
        set
        {
            if (this.dropdownsource.DataSource != value)
                this.dropdownsource.DataSource = value;
        }
    }

databindinglookupbindabledatasource


text:
Q: Mongo Replica internal SSL issue I have setup mongo replica set in Amazons AWS. It has one Primary and two secondary instances.I want SSL secure connection between mongo instances(pri to sec or sec to pri).
I have config mongo to use SSL by adding below settings in mongod.conf
net:
  port: 27017
  bindIp: 0.0.0.0
  ssl:
    mode: requireSSL
    PEMKeyFile: /etc/ssl/mongodb.pem
    PEMKeyPassword: password
    clusterFile: /etc/ssl/mongodb.pem
    clusterPassword: password
    weakCertificateValidation: false
    allowInvalidCertificates:  false

After restarting mongo, replicas are communicating but I am not sure is connection between them is secured by SSL or not.
How I can check connection between primary and secondary are secure or not?

A: You could use a packet sniffer to check the actual data being sent and received; that would show whether it is going out plain or encrypted.


text:
Q: Haxe + real-time network i try to find a good combination of libraries for managing a real-time communication (client/server) using Haxe (only Haxe, not openfl or other framework base on Haxe) targeting flash (swf) for the client and no preference for the server except don't use neko.
The goal is to make a simple tchat and put a display representation of all clients on an aera. Each client can move his representation in this area, and the other sees the movement.
I find some Lib to make this :

*

*https://github.com/soywiz/haxe-ws

*https://github.com/MattTuttle/hxnet

*haxe-js-kit

But I'm not sure of the best way to adopt.
Do you have any suggestion/remarks/tips to choose the better way ?

A: Disclaimer: I wrote the library that I am sharing here.
My somewhat new library mphx may be able to help you. It can manage 'rooms' of connections, allows client to server and server to client messaging in the form of events, and best of all, is cross platform. It also works in the web with websockets.
It was originally an extention of HxNet, however I wanted it to be easier to use. Connecting and sending a 'message' with data just takes a few lines.
I have a few examples in the github repository, the simplest being the 'basic' example. One of your requests you have is that it doesn't rely on one of the big libraries (open fl, etc) and mphx doesn't. The basic example proves that, and only runs in terminal. That being said, it can be used with haxeflixel, for that you can see the other examples.
It sounds like your main goal is to have simple, graphic multiplayer. For that you can look at the 'movement' haxeflixel example.
Documentation is still a little skim, and the code is alpha, so it might change or break. That can probably be said for most of the library's you listed though. The best way to install it is like this
haxelib git mphx https://github.com/5Mixer/mphx.git
That will not install the examples though. To run them, either download the repository as a zip, or just git clone it, and go into the examples folder.
Library: https://github.com/5Mixer/mphx
Old video's I made. A little outdated, most likely.
Video 1: https://www.youtube.com/watch?v=07J0wLXwH0g
Video 2: https://www.youtube.com/watch?v=MUx2CUtsnTU


text:
Q: In Blazor, how can I create an interface with EventCallback? In Blazor, the EventCallback struct is a bit different from standard events, being single-cast instead of multi-cast, etc. For that reason, I don't think this is a duplicate.
I am trying to create a set of components that all have the same [parameter] EventCallback, and it seems reasonable to use an interface to enforce that... So far this doesn't seem to be possible.
Things I've tried:
Treating this like EventHandler
public interface IResolver
{
    event EventCallback Done;
}

This raises the error: Event must be a delegate type.
...And other variations on trying to make this work like an EventHandler.
Trying to use IEventCallback
EventCallback implements IEventCallback, so this seemd promising. However, it is an internal interface,  and is not available to me.
Using a base class instead
This seems like it might work, but I am curious why I can't do this with an interface.
Also found:

*

*Event must be of delegate type?

*Various articles about implementing event-like constructs using interfaces, or help with EventHandler, which is not the same thing.

None of that seems to be related to this problem.

A: Declare the Callback using the correct syntax and it will work.
Here's my test code.
using Microsoft.AspNetCore.Components;

namespace TestBlazorServer
{
    public interface ICallbackComponent
    {
        public EventCallback MyCallBack { get; set; }
    }
}

// TestCallback.razor
@namespace  TestBlazorServer

@implements ICallbackComponent

TestCallback

<button class="btn btn-danger" @onclick="() => this.CallCallback()">Test Me</button>

We now declare MyCallBack with [Parameter].
using Microsoft.AspNetCore.Components;

namespace TestBlazorServer
{
    public partial class TestCallback : ComponentBase, ICallbackComponent
    {
        [Parameter] public EventCallback MyCallBack { get; set; }

        private void CallCallback()
        {
            MyCallBack.InvokeAsync();
        }
    }
}

And we can declare multiple instances in index.razor.
// index.razor
<TestCallback MyCallBack="Callback1"></TestCallback>

<TestCallback MyCallBack="Callback2"></TestCallback>

<TestCallback MyCallBack="Callback3"></TestCallback>

Test:@called

@code {
    private string called;

    private void Callback1()
        => called = "First";

    private void Callback2()
        => called = "Second";

    private void Callback3()
        => called = "Third";


text:
Q: Can't get inner text of a attribute element As the title says, i'm trying to get the inner text of an attribute element.
Essentially, I can get the attribute href from it, but when using inner text on a   element, it returns a null value.
Is there some way around this issue? I'm not sure what is causing it .
        brand = item.querySelector("div>div>div>div>div>div>a").innerText;

Is the code in question,
and what I'm trying to get the value of.
Yin Yam - Asian Grocery

also tried this.
          brand = item.querySelector("div>div>div>div>div>div>a").textContent;

A:           brand = item.querySelector("div>div>div>div>div>div>a[class*='merchant-name']").innerText;

This answer, based on a comment below the question, worked like a charm :)


text:
Q: Evaluating Z Score from Log Transformed Data Lets say I have a set of data as below
set.seed(1075)
n <- 10000
x <- rnbinom(n, 1000, .5)
mean(x)
-> 1000.1
sd(x)
-> 45.167

If I wanted to get a Z-score on this data, I would use the regular formula:
Z = (X - MU) / SD

However, If I was to transform my random variables is the interpretation of the Z score the same?
lx <- log(x)
mean(lx)
-> 6.906834
sd(lx)
-> 0.04519972

Is still 68% percent of the transformed data still between:
xbar +/- (1 * SD)

Or does the evaluation and computation of the Z score change with log transformed data?
Thanks,

A: You could reason this out and get to a "yes" answer, or you could just compute it.  Add the following to your code:
# proportion within 1 sd on original scale
sum(x > (mean(x)-sd(x)) & (x < mean(x)+sd(x)))  #6837

# proportion within 1 sd on log scale
sum(lx > (mean(lx)-sd(lx)) & (lx < mean(lx)+sd(lx)))  #6837

and they are identical.


text:
Q: Content assist with javaCompletionProposalComputer for Eclipse not working Content assist with org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer for Eclipse not working.
'Code and Me' proposal is not visible
Content Assist View Eclipse
I make same as described here but without success
http://codeandme.blogspot.com/2014/05/extending-jsdt-adding-your-own-content.html
As same as described at above link I do this
        <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
    <plugin>
       <extension point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer"
       id="codeandme_category"
       name="Code and me proposals">
       <proposalCategory/>
     </extension>

 <extension
       id="codeandme_proposal"
       point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer">
   <javaCompletionProposalComputer
      class="com.codeandme.jsdt.contentassist.CustomCompletionProposalComputer"
      categoryId="com.codeandme.jsdt.contentassist.codeandme_category"
      activate="true">
   </javaCompletionProposalComputer>
 </extension>

</plugin>

    package com.codeandme.jsdt.contentassist;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext;
import org.eclipse.wst.jsdt.ui.text.java.IJavaCompletionProposalComputer;

public class CustomCompletionProposalComputer implements IJavaCompletionProposalComputer {

 @Override
 public void sessionStarted() {
 }

 @Override
 public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {

  ArrayList<CompletionProposal> proposals = new ArrayList<CompletionProposal>();

  proposals.add(new CompletionProposal("codeandme.blogspot.com", context.getInvocationOffset(), 0, "codeandme.blogspot.com".length()));
  proposals.add(new CompletionProposal("<your proposal here>", context.getInvocationOffset(), 0, "<your proposal here>".length()));

  return proposals;
 }

 @Override
 public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
  return null;
 }

 @Override
 public String getErrorMessage() {
  return null;
 }

 @Override
 public void sessionEnded() {
 }
}

Eclipse plugin view
Anything missing or wrong?


text:
Q: Bootstrap conflict causes small elements My overrides at the bottom seem to cause a conflict in the bootstrap.min.css files and result in my elements being very small as seen here:
http://all41web.co.za/bootstrap1/index_Auth.html
How do i keep both bootstrap.min.css but increase the element size to be bigger:
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

<script src="http://code.jquery.com/jquery-3.2.1.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<script src='https://www.google.com/recaptcha/api.js'></script>

<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom fonts for this template -->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="css/grayscale.min.css" rel="stylesheet">


text:
Q: Правильность оформления условия в if Всем привет, если в конструкции с условием это самое условие очень большое и не помещается на экране в одной строке, будет ли правильным это условие разбить на несколько строк? Пример будет ниже
if (view->isChecked(this->x() + 100, this->y() + 100) &&
        view->getFigureTeamByCoords(this->x() + 100, this->y() + 100) == "BLACK" &&
        !view->isChecked(this->x() + 200, this->y() + 200)) {
        return true;
    } else if (view->isChecked(this->x() - 100, this->y() + 100) &&
               view->getFigureTeamByCoords(this->x() - 100, this->y() + 100) == "BLACK" &&
               !view->isChecked(this->x() - 200, this->y() + 200)) {
        return true;
    } else if (view->isChecked(this->x() + 100, this->y() + 100) &&
               view->getFigureTeamByCoords(this->x() + 100, this->y() + 100) == "BLACK" &&
               !view->isChecked(this->x() + 200, this->y() + 200)) {
        return true;
    } else if (view->isChecked(this->x() - 100, this->y() + 100) &&
               view->getFigureTeamByCoords(this->x() - 100, this->y() + 100) == "BLACK" &&
               !view->isChecked(this->x() - 200, this->y() + 200)) {
        return true;
    } else {
        return false;
    }

сразу извиняюсь если что-то говорю не так

A: Если все же надо третье +100/-100, а четвертое -100/-100, то можно:
for(int i = -1; i < 2; i+=2) for(int j = -1; j < 2; j+=2)
{
    if (!view->isChecked(this->x() + 100*i, this->y() + 100*j)) continue;
    if (view->isChecked(this->x() + 200*i, this->y() + 200*j)) continue;
    if (view->getFigureTeamByCoords(this->x() + 100*i, this->y() + 100*j) == "BLACK")
        return true;
}
return false;

Всяко короче...


text:
Q: Crash course in simple threading? I am testing out the idea of threads, but only in very key spots right now.  Threads add a pretty fascinating level of complexity to just about anything, but with .NET, it seems there are many choices for threads within System.Threading.  I'm looking to know which is the best for handing string operations.
Consider a complex string being fed to a custom object.  That object currently splits the string at some point, and feeds part one to a function, then when that function completes, feeds the other half of the string to a second function.  The two functions have no dependencies on each other, so should be good candidates for threading so that both functions can work concurrently on each piece of the string.
Example before theading:
Public Sub ParseString(ByVal SomeStr As String)
    If String.IsNullOrWhitespace(SomeStr) Then
        Throw New ArgumentNullException("SomeStr")
    End If

    ' Assume that ParsedFirstString is a boolean that is set to
    ' True if the call to ParseFirstString completes successfully.
    ' Ditto for ParsedSecondString.

    Dim MyDelimiter As Char = "|"c
    Dim SomeStrArr As String() = SomeStr.Split({MyDelimiter}, 2)

    Call Me.ParseFirstString(SomeStrArr(0))

    If Me.ParsedFirstString = False Then
        Throw New ArgumentException("Failed to parse the first part of the string.")
    End If

    Call Me.ParseSecondString(SomeStrArr(1))

    If Me.ParsedSecondString = False Then
        Throw New ArgumentException("Failed to parse the second part of the string.")
    End If
End Sub

This works fine, and testing inside a timing loop on my multicore system, I can execute it 1,000 times in ~140ms-170ms (avg ~1,200ms+ if 10,000 times).  This is an acceptable speed and if I can't get threading to play nice, then I'll move on.  But I tried one threading approach after looking at one threading example and an SO question on invoking a thread with parameters and wound up with code similar to the following:
Public Sub ParseString(ByVal SomeStr As String)
    If String.IsNullOrWhitespace(SomeStr) Then
        Throw New ArgumentNullException("SomeStr")
    End If

    Dim MyDelimiter As Char = "|"c
    Dim SomeStrArr As String() = SomeStr.Split({MyDelimiter}, 2)

    Dim FirstThread As New Thread(Sub() Me.ParseFirstString(SomeStrArr(0))
    Dim SecondThread As New Thread(Sub() Me.ParseSecondString(SomeStrArr(1))

    FirstThread.Priority = ThreadPriority.Highest
    SecondThread.Priority = ThreadPriority.Highest

    Call FirstThread.Start()
    Call SecondThread.Start()

    If Me.ParsedFirstString = False Then
        Throw New ArgumentException("Failed to parse the first part of the string.")
    End If

    If Me.ParsedSecondString = False Then
        Throw New ArgumentException("Failed to parse the second part of the string.")
    End IF
End Sub

The problem with this is parsing of either the first or second parts of the string can complete before both are done, which trips up one of the two exceptions.  So I looked around further and found that I could use the Join method to wait for both threads to complete.  This solves the tripping up of the exceptions, but it drastically increases the execution time.  Executing the above function 1,000 times and timing it now yields an average runtime of up to ~3,700ms.  It almost seems like threading is just not suitable for this kind of task.
But it appears that there are other mechanisms for threading, including ThreadPools and BackgroundWorkers.  Probably others I haven't looked up yet (I just started messing with this a few hours ago).
What is the community's opinion on threading for this kind of task?  What is wrong with my first attempt at threading?
FYI, I am not updating any UI components nor writing results out to any kind of storage medium.
Conclusion:
It appears my string parsing functions are a lot better than I thought.  Having tried both the Parallel Class and the Task Class, if I test a 10,000 iteration loop, then single threaded, my test data comes out to about ~1,220ms-1,260ms.  If I implement even the basic Parallel.Invoke() to split the parsing into two parallel threads, I pad that timing loop up to an additional ~300ms (likely due to the overhead of the anonymous delegate, but it seems that there is no way around this).  This is on a Core2 Q9550 Yorkfield, not overclocked, 95W processor, for comparison.
The winning choice is to remain single-threaded for this specific area of code.  Thanks to all who participated!

A: Threading (or parallelization in general) is beneficial when the work being executed takes up more CPU cycles than is taken up by the overhead of creating/managing/joining multiple threads.
If you're parsing code & strings are relatively simple, multithreading will actually make things slower.
Threads creation is a relatively expensive operation.  .NET 4 introduced the concept of "Tasks".  A Task is a block of code that you want executed in parallel with other code.  The .NET Framework has lots of smarts built in to split all of your tasks up amongst an ideal number of threads (generally the same as the number of CPU cores you have) and to reuse the same threads for multiple tasks.
Tasks still have a non-trivial amount of overhead but much less so than raw threads.  So in many cases Tasks will still make things slower than serial code but those cases are fewer.  Without seeing your input strings and parsing methods, we can't say where your specific scenario fits on this spectrum.

A: I suggest using TPL classes like Parallel and Task.
Whether your code benefits from parallel execution or not, you need to benchmark on particular machine and find out. This is the best approach to take. The same code can slow down execution on one machine, but expedite a lot on another. Basically depends on CPU (number of cores, hyper-threading, etc.), algorithm and number of parallel tasks.
If you use TPL your code would look as simple as:
    Call Parallel.Invoke(
        Sub()
            Me.ParseFirstString(SomeStrArr(0))
        End Sub,
        Sub()
            Me.ParseFirstString(SomeStrArr(1))
        End Sub)

I'm sorry, I'm not good at VB.NET syntax. There might be a way to make it shorter.

A: To me, offloading any calculations away from the UI thread, is the best option. Especially if for any reason it could be time consuming, either in quantity of complexity, or, the mother of both.
As you found, there are a number of ways to do it. A lot depends on what kinds of information you want after/during.
While my .net choice is c#, the premise is the same.
You can use tasks, which seem to work quite nicely as you can give them options easily
Parallel.Invoke allows for options
A background worker to me, unless you know exactly how many you're going to have, I found them lesser to work with, because if you used the component from the toolbox, you had to premake them, you also needed to work out if they were busy or not before sending them work to do. Personally, I wanted something I could say "Here, go do this" like a bunch of minions waiting in a queue for jobs to do.
Threads also can work, but, I found it a little more involved if (like I was) you're sending it around 10k emails, and asking it to parse them.
By the looks of it, you have the best idea, take the code you want, and then try each of the methods, see which one fits you, your way of thinking and works out in speed. If you find one is significantly slower than either any other, or the UI thread performing it, chances are there was a way to improve it.
MS of course have a bunch of examples for each kind to get you going if you are stuck on examples.


text:
Q: Simulation of the product If $f$ is a $d$-variate density that we know how to simulate from, and $g$ is a $d$-variate positive function not necessarily bounded such that $0<\int_{\mathbb{R}^{d}} f(t)g(t)d \lambda_{d}(t)< \infty$. Then we know that the function $h$ defined on $\mathbb{R}^{d}$ by
\begin{align}
    h(t)&=\frac{(g.f)(t)}{\int_{\mathbb{R}^{d}} f(t)g(t) d\lambda_{d}(t)}&, \forall t \in \mathbb{R}^{d},
\end{align}
is a density. Is there a way to simulate from $h$?


text:
Q: MassTransit saga/statemachine not returning the request response to the controller I feel like I'm so close to getting this working but can't seem to get it over the line...
I have a .NET Core ASP application with saga/state machine that seems to work well for the most part. It:

*

*Receives a request

*Publishes an event that is picked up by a routing slip

*When the routing slip completes it publishes an event

*The event is picked up the saga

*The saga then sends a Request to a request/response consumer

*The response comes back to the saga

*BUT THEN I then use RespondAsync to attempt to send a response back to the original calling controller but alas nothing goes back

My controller looks like:
private readonly IRequestClient<IRequestLink, IRequestLinkCompleted> _client;

public async Task<IActionResult> CreateLinkAsync([FromBody]CreateLinkRequest request)
{
        var requestLink = new RequestLink            {

            GroupName = $"{request.Name} Group",
            Name = request.Name,
            LinkId = Guid.NewGuid()
        };

        var result = await _client.Request(requestLink).ConfigureAwait(false);

        return Ok();
}

A cut down version of my saga looks like:
Request(() => LinkRequest, x => x.RequestId, cfg =>
        {
            cfg.ServiceAddress = new Uri($"rabbitmq://localhost/request_end_point_name");
            cfg.SchedulingServiceAddress = new Uri($"rabbitmq://localhost/request_end_point_name");
            cfg.Timeout = TimeSpan.FromSeconds(30);
        });

During(RequestReceived,
                When(LinkCreatedEvent)
                    .Request(LinkRequest, context => new SelectUrlByPublicId(context.Data.DatabaseId, context.Data.LinkId))
                    .TransitionTo(LinkRequest.Pending));

            During(LinkRequest.Pending,
                When(LinkRequest.Completed)
                    .ThenAsync(context => context.RespondAsync(new RequestLinkCompleted
                    {
                        CorrelationId = LinkRequest.GetRequestId(context.Instance),
                        DatabaseId = context.Data.DatabaseId
                    }))
                    .Finalize());

And finally in my start up code I configure the request/response as such:
services.AddScoped<IRequestClient<IRequestLink, IRequestLinkCompleted>>(x => new MessageRequestClient<IRequestLink, IRequestLinkCompleted>(_bus, new Uri($"{messageBusSettings.Host}/create_link_saga"), TimeSpan.FromSeconds(30)));

I'm guessing that the RespondAsync call isn't using the right/original requestId but I've got no idea how I check or change that. can anyone help?

A: Since the context of the original request is lost, you need to do essentially what was being done in RespondAsync yourself.

*

*Save the ResponseAddress from the request message context

*Save the RequestId from the same context

In your saga, when it's time to respond, you need to use context.GetSendEndpoint(context.Instance.SavedResponseAddress) and then call Send setting the RequestId in the delegate to match the saved RequestId from the original context.
Now, you might need to save these in routing slip variables since your saga doesn't get the command, just the subsequent events, but the net effect is the same, the original request message is gone and never seen by the saga.

A: For those looking for a little clearer picture of some code snippets to get this working, here's what we did to get up and running with the saga returning a response to the initial requester.  I marked the answer above as correct, but it still took us a few hours to get our implementation working since we are still fairly new to sagas and couldn't figure out where to get access to the original context instead of just our message due the way we implemented our saga structure. Hopefully this saves someone else some time in the future.
Initial Saga setup:
 public PaymentStateMachine()
        {
            InstanceState(x => x.CurrentState);

            this.ConfigureCorrelationIds();
.....
//Saga workflow registration
.....

            this.During(ValidationSucceeded
                , SetPaymentGatewaySubmissionHandler());

            SetCompletedWhenFinalized();
        }

We had to register our initial event such that we saved some information off of the initial message into the saga table.  The key pieces to note are the context.responseAddress and context.RequestId being saved into the Saga Factory.
private void ConfigureCorrelationIds()
{
Event(() => PaymentSubmittedEvent,
                x =>
                {

                    x.CorrelateBy<int>(pay => pay.OrderId, context => context.Message.Order.Id)
                    .SelectId(c => c.Message.CorrelationId);

                    x.InsertOnInitial = true;

                    x.SetSagaFactory(context => new PaymentSagaState()
                    {
                        ResponseAddress = context.ResponseAddress.ToString(),
                        CorrelationId = context.CorrelationId.Value,
                        RequestId = context.RequestId,
                        OrderId = context.Message.Order.Id,
                        Created = DateTime.Now,
                        Updated = DateTime.Now,
                        CurrentState = Initial.Name
                    });
                });
....
//Other events registered
}

From there, we then used the answer marked above to send back the response to the original message's response address when we were done processing our saga.  The new PaymentSubmittedResponse is just a private implementation within the saga of our message contract that the client is waiting for on the front end.
private EventActivityBinder<PaymentSagaState, IPaymentGatewaySubmittedEvent> SetPaymentGatewaySubmissionHandler() =>
            When(PaymentGatewaySubmittedEvent)
                .Then(c => this.UpdateSagaState(c, PaymentGatewayComplete.Name))
                .Then(c => Console.Out.WriteLineAsync(
                    $"{DateTime.Now} PaymentGatewayComplete: {c.Data.Status} to {c.Instance.CorrelationId}"))
                .ThenAsync(async c =>
                {
                    //Send response back to orignial requestor once we are done with this step
                    var responseEndpoint =
                            await c.GetSendEndpoint(new Uri(c.Instance.ResponseAddress));

                    await responseEndpoint.Send(new PaymentSubmittedResponse(c.Data), callback: sendContext => sendContext.RequestId = c.Instance.RequestId);
                })
            .TransitionTo(ClientPaymentSubmissionResponded);

private void UpdateSagaState(BehaviorContext<PaymentSagaState> sagaContext, string status)
        {
            sagaContext.Instance.CurrentState = status;
            sagaContext.Instance.Updated = DateTime.Now;
        }

private class PaymentSubmittedResponse : IPaymentSubmittedEvent
        {
            public string Status { get; set; }

            public OrderDto Order { get; set; }

            public Guid CorrelationId { get; set; }
            public DateTime TimeStamp { get; set; }

            public PaymentSubmittedResponse(IPaymentBase paymentMessage)
            {
                Order = paymentMessage.Order;
                CorrelationId = paymentMessage.CorrelationId;
                Status = paymentMessage.Status;
                TimeStamp = paymentMessage.TimeStamp;
            }
        }

Not sure if it's entirely needed or if it's just due to how we implemented it, but we had to introduce one more saga state of ClientPaymentSubmissionResponded to handle the response message event being sent back to the original request.


text:
Q: SpriteComponent positioning with Flame UPDATE: I created a smaller example that probably better illustrates the problem in this issue: https://github.com/flame-engine/flame/issues/200
short version:
I'm instantiating SpriteComponents at the positions (50, 50), (50, 100), (100, 50), (100, 100).
However, when rendered they look like this:

What is producing this strange offset? How do I correctly render SpriteComponents?
longer version (with code):
I would like to test the performance of flame by implementing something like bunnymark.
As a first attempt at saving performance, I'm loading a single Sprite and using it to produce many SpriteComponents.
The SpriteComponent is wrapped in a Bunny class. For now it does nothing, eventually it will handle movement:
import 'dart:ui';

import 'package:flame/components/component.dart';
import 'package:flame/sprite.dart';

class Bunny {
  SpriteComponent bunny;

  Bunny(Sprite bunnySprite, double x, double y, double w, double h)
      : this.bunny =
            SpriteComponent.fromSprite(w, h, bunnySprite) {
    bunny.x = x;
    bunny.y = y;
  }

  void render(Canvas c) {
    bunny.render(c);
  }

  void update(double t) {}
}

The bunnies are instantiated in my game class:
import 'dart:ui';

import 'package:bunnymark/components/bunny.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/sprite.dart';
import 'package:flutter/cupertino.dart';

class BunnyMark extends Game {
  Size screenSize;
  List<Bunny> bunnies;
  Sprite bunnySprite;

  BunnyMark() {
    initialize();
  }

  void initialize() async {
    resize(await Flame.util.initialDimensions());

    bunnies = List<Bunny>();
    bunnySprite = Sprite('rabbitv3_tron.png');

    bunnies.add(Bunny(bunnySprite, 50, 50, 30, 30));
    bunnies.add(Bunny(bunnySprite, 50, 100, 30, 30));
    bunnies.add(Bunny(bunnySprite, 100, 100, 30, 30));
    bunnies.add(Bunny(bunnySprite, 100, 50, 30, 30));
  }

  void render(Canvas canvas) {
    Rect bgRect = Rect.fromLTWH(0, 0, screenSize.width, screenSize.height);
    Paint bgPaint = Paint();
    bgPaint.color = Color(0xff000000);
    canvas.drawRect(bgRect, bgPaint);

    bunnies.forEach((bunny) {
      bunny.render(canvas);
    });
  }

  void update(double t) {
    bunnies.forEach((bunny) => bunny.update(t));
  }

  void resize(Size size) {
    screenSize = size;
    super.resize(size);
  }
}

The game is started from main.dart:
import 'package:bunnymark/bunnymark.dart';
import 'package:flame/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Util flameUtil = Util();
  await flameUtil.fullScreen();
  await flameUtil.setOrientation(DeviceOrientation.portraitUp);

  BunnyMark game = BunnyMark();
  runApp(game.widget);
}

A: Since you are using Game and not BaseGame (which would do that for you), you are responsible on your render implementation to reset the canvas every sprite.
Components are allowed to make any modifications they desire on the Canvas, and BaseGame (or in your case, Game) is required to reset.
So when you do
bunnies.forEach((bunny) {
  bunny.render(canvas);
});

You probably want to do something like:
bunnies.forEach((bunny) {
  canvas.save();
  bunny.render(canvas);
  canvas.restore();
});

Or, as an alternative, take a look at the BaseGame class that solves a lot of those problems for you :)


text:
Q: chromium-browser version 28 for Ubuntu 12.04 recently chromium-browser package in Ubuntu 12.04 was updated to version 30.0.1599.114 for my installation. Before that update I had version 28.0.1500.52 installed on my system. Together with this system I was running a VLC plugin in my chromium-browser and with the new version 30 this plugin crashes all the time.
The best way to go is of course to make the plugin work with version 30 of chromium-browser but right now I do not have the time for that. The way forward for me right now is to revert the chromium-browser to version 28 again in order to get my system up and running again with my VLC plugin.
I can't figure out where to find the package chromium-browser 28.0.1500.52-0ubuntu1.12.04.2, can anyone help me? What is the proper way to install an old version of chromium-browser?
Thanks,
/Peter

A: Install It with
sudo apt-get install --reinstall google-chrome-stable=28
From your terminal