skimage.transform.resize is slower than scipy.misc.imresize

Question: I am training a neural network, while training I came across errors in a data preparation section. where this line:
img = np.double(scipy.misc.imresize(img, [height, width, channels], interp='bilinear', mode = 'RGB'))

and this line:
img2 = np.double(scipy.misc.imresize(img2, [height, width], interp='bilinear'))

showed errors, as scipy.misc.imresize is deprecated in newer versions of scipy. What I did is I used skimage.transform.resize instead of scipy.misc.imresize, that's what is recommended, as:
img = np.double(resize(img, (height, width, channels)))

and
img2 = np.double(resize(img2, (height, width)))

It worked.
But the problem is the data reading process has become very slow as compared to the scipy.misc.imresize. I had tested it before on old version of scipy.misc.imresize.
Any help in this regard would be very much appreciated. Thanks!
P.S. I am training the model on Google Colab.
Comment: How much slower is it? Maybe it doing a higher order interpolation (cubic maybe)?
Comment: @Trilarion It takes around two hours in the reading process. With the scipy it takes around ten minutes.
Answer: You can just copy-paste the source of imresize:
https://github.com/scipy/scipy/blob/v1.1.0/scipy/misc/pilutil.py#L513
Comment: Didn't get it, sir @ev-br. Should I copy/paste this file's code in a  cell of my jupyter notebook before the execution of the mentioned code's cell?
Comment: Thank you so much it worked, I did paste it in a cell before the code cell.


Irreducible subfactor inclusion and von Neumann type

Question: Let $M$ and $N$ be factors and $N\subset M$ be an irreducible subfactor inclusion, i.e., $N$ has trivial relative commutant in $M$.
Does it follow that $M$ and $N$ have the same type?
Answer: Maybe the discrete decomposition of a type III$_{\lambda}$ factor $M$, $0<\lambda<1$, provides an example of an infinite-index, irreducible inclusion of II$_{\infty}$ in III$_{\lambda}$, i.e., we have:
$M = M^{\phi}\rtimes_{\alpha}\mathbb{Z}$,
where $\phi$ is a generalized trace on $M$, $M^{\phi}$ its centralizer (a II$_{\infty}$ factor), and $\alpha$ is the automorphism scaling the trace by $\lambda$.
Since $\alpha$ is outer, the inclusion of $M^{\phi}$ in $M$ should be irreducible by the relative commutant theorem(?).
Comment: As it's currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: Yes.

if $M$ is type I then $M=B(H)$ and no subfactor can be irreducible.

if $M$ is type II$_1$ it cannot have neither II$_\infty$ nor III subfactors (as these are infinite). And a type I subfactor cannot be irreducible: if $\{e_{kj}\}_{k,j=1}^n$ are matrix units in for $N$, then $\sum_ke_{k1}xe_{1k}\in N'\cap M$ for all $x\in M$.

if $M$ is type II$_\infty$ then $N$ cannot be type III. If $N$ is type I then $N'\cap M$ is non-trivial as in the previous case. And if $N$ is II$_1$ then we can embed $N\otimes B(H)$ in $M$, and so $N'\cap M\supset 1\otimes B(H)$.

if $M$ is type III, then $N$ cannot be type I nor type II$_1$ for the same reasons as in the previous case. And it cannot be II$_\infty$ either, because as you noted the inclusion $M'\subset N'$ would be an irreducible inclusion of a type III inside a type II.
Comment: If we cannot have a irreducible type III factor inside type II factor inclusion that we also cannot have one the other way round, right? Just because $N \subset M$ irreducible implies $M' \subset N'$ irreducible.
Comment: I'll try to find a good argument (I don't have one  right now), but here is my intuition: $M=R\otimes B(H)$, with $R$ a II$_1$-factor. If $N$ is type III, then it has to be contained in the $B(H)$ "side", and so it cannot be irreducible.
Comment: Thanks Martin! Do you know of a good reference for learning about this? The material that I know focuses on subfactor inclusions of type II.
Comment: Many years ago I would have had a better answer, I guess, but I've never been a specialist and I've forgotten lots of stuff. From the Takesaki/Connes/Haagerup days in the 70s there have been many papers about type III factors, though not so many specifically dealing with inclusions. Longo's papers from the 90s could be a place to look, but there are others, too.
Comment: Why finite von Neumann algebras cannot contain infinite von Neumann algebras?
Comment: Because by definition a finite von Neumann algebra cannot have infinite projections.
Comment: How to show that if $M$ is type II$_\infty$, then $N$ can not be type III?  Is it correct that $N$ must not be $II_\infty$ when M is type III? Can we have following conclusion: If $N\subset M$ is the inclusion of factors, then type $N$ $\leq$ type $M$?
Comment: If $M$ is type $III_1$,  $N$ Can be type III$_{\lambda}$ or $(\lambda\in[0,1))$ type $III_1$?
Comment: You can definitely put a type III factor inside a II$_\infty$, since the latter contains a copy of $B(H)$; but not in a irreducible way. No idea about type III$_\lambda$ inside III$_\gamma$.
Comment: Neat! I should have thought of that.
Comment: You wrote "if $M$ is type II$_\infty$ then $N$ cannot be type III". I don't really understand this part, could explain why this is?
Comment: What do you think of the following: Assume $N$ is a type III factor contained in a type II$_\infty$ factor $M=R\otimes B(H)$. If $N$ were to contain a projection that is finite in $M$ it would also be finite in $N$ which cannot be because of type III. Thus $N$ only contains the infinite projections of $M$. Can't this be used to show that the relative commutant is non empty?
Comment: But it doesn't have to be. $N$ could be of the form $1\otimes S$ or $R\otimes S$ with $S$ a type III factor. In both cases there are no finite-projections in $N$. In both cases, the relative commutant is non-trivial: $R\otimes S'$ and $R'\otimes S'$. But I don't see any reason to discard that $N$ might be inside $M$ in such a way that it is not a tensor product of subfactors of $R$ and $B(H)$.
Comment: Yes. You're right, that cannot work. There is a Theorem by Tomiyama that for subfactor inclusions of finite-index the types of $M$ and $N$ are equal. (I cou But not all irreducible inlcusions have finite index (right?). I think I'll post the II_infty, III case as a question on mathoverflow. Thanks for your help!
Comment: No, but at the same time not every finite-index inclusion is irreducible. Most likely in MO someone will be able to give you the (I'm fairly sure obvious) answer.
Comment: Yes of course. What's your take on Alexanders answer suggesting an irreducible II$_\infty$ in III$_\lambda$ inlcusion?


Info regarding Disk/Drive partition in Ubuntu

Question: I am just starting to use Ubuntu. I have already installed it in VM.I am general user and not tech expert. So my question is

In windows generally there is one disk and then we partition them into different partitions which are label as C,D,E,F etc.What is equivalent of that in Ubuntu. As in windows OS we can see different drives graphically .IS it same possible in Ubuntu

During its installation its ask to create one account. Does that account have admin rights ??Are there any other account which is created automatically having admin rights
Comment: You use sudo for temporary admin rights. https://xkcd.com/149/ With Linux you can give more usable names to partiitons like Data, Games etc. If regularly using partition, better to permanently mount using fstab. You create mount point, add entry to fstab and give yourself ownership & permissions. If only used occasionally I like to label partition and then it automounts under the label, not an UUID which I do not know.https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting Data partition can be on same HDD or SSD as system.
Answer:
In other operating systems than Windows we create mountpoints. A mountpoint can be a directory, but also a partition. The root filesystem has / as its mountpoint. You can have /home/ as a mountpoint on the same disk and you can have a /discworld/ as a mountpoint for a complete 2nd hard disk (a hdd for instance where / is on an sdd).
Mountpoints are shown in lots of ways. From command line you could have this:
$  df -H
Filesystem      Size  Used Avail Mounted on
/dev/sda1        25G    8G   17G /
/dev/sdb        900G  300G  600G /u

It will also be possible to see this from the desktop. Disk Usage Analyzer for instance (google images).

Yes, that is the admin account. And no; All other users (and that can be a 2nd, or 3rd admin) need to be created after installation.
Comment: Hi thanks for reply but by graphically i mean like when we open "this PC" or "file explorer" in  windows we can see drives .Is same/equivalent possible in ubuntu/linux?


fill an array with variables with a loop

Question: I have converted a log file to an array, some elements in array contain the keyword Messages. I want a new array that only contains elements with that keyword.
I tried the following:
$Logfile_array = Get-Content "C:\temp\logfiles\complete_log.txt"
foreach ($array_element in $Logfile_array)
{
    if ($array_element -match 'Messages')
    {
        foreach ($array_element in $Logfile_array)
        {
          $i++
          echo $i
          $array_message[$i] = $array_element
        }
    }
}

Comment: So you add the first message once, the second twice and so on. Is that what you intended?
Comment: What is `$array_element` supposed to be in the inner loop, when you also use it in the outer loop?
Answer: Instead of using foreach to loop through the array and then checking each item, you can use Where-Object to do this for you:
$Logfile_array = Get-Content "C:\temp\logfiles\complete_log.txt"
$array_message = $Logfile_array | Where-Object { $_ -match 'Messages' }

or a one liner:
$array_message = Get-Content "C:\temp\logfiles\complete_log.txt" | Where-Object { $_ -match 'Messages' }


GSuite Appmaker - how to set default value in table using button

Question: I am trying to put together a mock up for a data collection app for a local nonprofit using GSuite's AppMaker.  So far I really like the tool.
One thing I need to be able to do is streamline the data entry for the site representatives.  In my app, I display a list of students in a table, where one of the columns is a boolean value which represents attendance.  The desired result is for the teachers to be able to input the date field one time using the date input button at the bottom of the page.  Then they can quickly point and click down the Present column to log attendance.
My question is: how would I link the date selector dropdown so that the date field pre-populates with the selected date from the input field?  I don't want them to have to enter the field over an over again since its the same for each row and I don't want the user experience to feel clunky.
Screenshot of the App for reference:
Answer: Using client script, you can add the following to the onValueEdit event handler of the date widget at the bottom.
var items = widget.root.descendants.<YourTable>.datasource.items;
items.forEach(function(item){
    item.<DateField> = newValue;
});

The only thing to take into account is that when using client scripting, you will only update the records loaded in the table at the moment; i.e, if your table has paging, it will only update the current page. If you are using paging, then you will need to add the following code to the onPreviousClick and the onNextClick event handlers of the pager widget:
var selectedDate = widget.root.descendants.<YourDatePicker>.value;
var items = widget.root.descendants.<YourTable>.datasource.items;
items.forEach(function(item){
    item.<DateField> = selectedDate;
});

Comment: I changed the spelling of descendants as per your edit and now it works!
Comment: Should  refer to the datasource or the panel name?
Comment: Right now I'm getting `Cannot read property 'Table1Panel' of undefined
at Attendance.DateBox1.onValueEdit:1:38`.  Perhaps I should mention that I have two pages in this app.  Do I have to reference that as part of `widget.root.descendants.`...?
Comment: @Sledge `<YourTableName` refers to the name of the table widget in your page. Having two pages makes no difference as long as both widgets are on the same page.


Why do we use limit and long division to figure out the Oblique and Horizontal Asymptote?(rational function)

Question: Well, we use long division to find the quotient and use the concept of limit to make x -->+-∞ to ignore the remainder and the rest(quotient) is the asymptote we are trying to find. But why this quotient is the asymptote? why do we use "long divison" to find it?
Answer: The point is that polynomial long division will break your rational function into a polynomial (which might go to zero, or to a nonzero constant, or blow up, it depends) plus a rational function which will go to zero at $\pm \infty$ (because the degree of the denominator will be higher than that of the numerator). The first piece is the quotient; the second piece is the remainder divided by the divisor. The second piece will not contribute to the asymptotic behavior at $\pm \infty$, so to study that behavior we isolate the first piece from the second by doing the long division.


Pyspark Java java.lang.NullPointerException

Question: from pyspark.sql.functions import lit
from pyspark.sql import functions as F

df_customer_account_statement = df_current_balance.select\
    (
        col('last_statement_close_balance').alias('beginBalance'),
        col('current_statement_close_balance').alias('closeBalance')
    )\
    .withColumn('documentType',lit('RewardAccountStatement'))\
    .withColumn("statementBeginAt",  lit(current_statement_begin_date.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]+'Z'))\
    .withColumn('statementCloseAt', lit(current_statement_close_date.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]+'Z'))\
    .withColumn("uuid", F.expr("uuid()"))

The last withColumn throws null pointer exception.
Is there anything wrong with this?
Comment: is it possible that "current_statement_begin_date" or "current_statement_close_date" are null?
Comment: The problem appears to be with 'current_statement_begin_date' or 'current_statement_close_date'. Please provide additional information regarding the same so that we can proceed further.
Answer: The 'z' and 'Z' are used to represent the time zone in date time format. Use the below code block
strftime("%Y-%m-%dT%H:%M:%S%z")

instead of
strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]+'Z'


AWS OpsWorks: Successful Ruby on Rails default layer deployment shows 404 error in browser

Question: Didn't deployed Rails application in AWS OpsWorks. Totally confused how to do this! Could anyone tell me how many instance required to deploy a RoR application?
I have created "Rails App Server" instance and it's looks fine. And here I used nginx and Unicorn as Rails Stack.
After that I've added a application from a git repo. Then deployed that application. And logs showing it's deployed successfully.
But in Public IP it's showing 404 Not Found Error - nginx!
Any help would be appreciable.
Answer: I had this issue, and it turned out that the default virtual host /etc/nginx/sites-enabled/000-default symbolic link was not getting removed during deployment.
The 404 was actually nginx looking for a public root of whatever was in the default virtual host, as seen in /var/logs/nginx/error.log
2015/12/23 21:46:05 [error] 3839#0: *15 "/var/www/nginx-default/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: rails-app1, request: "GET / HTTP/1.1", host: "localhost"

Worse, it comes back after every OpsWorks deployment. Removing that link fixed the problem for me.
To make the fix sustainable and automated, I added a custom recipe to the Deploy lifecycle event for the Rails App Server layer, called custom-cookbook::delete-default-site. The recipe looks like this:
file '/etc/nginx/sites-enabled/000-default' do
    action :delete
end

service 'nginx' do
    action :reload
end

Answer: Check process list for unicorn and its log files. Deployment doesn't fail for some reason if unicorn master process doesn't start.


How should I stop pocket doors from scraping on the jamb?

Question: I have pocket doors that occasionally scrape on the inside on their frame which scuffs them up.
How should I protect against this?
I was thinking of using the soft side of velcro strips inside the frame.
Comment: Velcro is a fair short-term solution, but over time it will peel off, and Murphy's Law says it will stick deep in the door pocket interfering with the mechanism.  Best not to.
Comment: Not a bad idea, but I would guess that weatherstripping will cost less than velcro and provide the same function. There's also a question of "why sometimes" - if the door is swelling with humidity, it may bind on the soft padding and stick when it would have scraped.
Answer: There is a missing guide at the bottom of the door, much like a closet sliding door. Install one and it will prevent the door from moving side to side and it will stay centered and not rub.
Comment: @Olivier I've added another picture to show the pieces up close to show what you point out about the shape. Would you believe that I couldn't find a picture of them properly installed. This also moves the rub / contact to the bottom/face edge and away from the face so that here won't be an obvious wear pattern over time.
Comment: Correct answer but that picture is showing the wrong location to install the guides. The bottom of the guides should be below the bottom of the door. Because the guides are thicker at their bottom, the slots for the screws allow adjustment. Higher will hold the door tighter, lower will give it some space and rub less.
Answer: Sometimes the guides can be hidden behind the trim, depending on how the door was trimmed out. This makes for a far neater looking installation.
Comment: Hello, and welcome to Home Improvement. Thanks for the answer and keep them coming. And, you should probably take our [tour](https://diy.stackexchange.com/tour) so you'll know the details of contributing here
Answer: Image that shows proper installation of door guide.  Because of the angle, the rubbing will not be on the surface, but on the bottom edge of the door.  There also hidden door guides, but these may be specific to your brand.


What are the best antivirus soloutions for scannining USB drives for Malyware and Viruses?

Question: I have an old Win XP computer that was made in 2001 that can't connect to the internet and has no anti virus. Still works fine but I am wondering what the best way is to scan USB drives and files in Ubuntu for Windows Viruses and Malware before I connect them to the computer. I have tried a Windows alternative using wine but I had to reload Ubuntu trying to uninstall it.
So how can I scan for Windows malware using Ubuntu?
Comment: See also: "[How do I scan for viruses with ClamAV?](http://askubuntu.com/q/250290/38585)"
Answer: Install ClamAV - this AntiVirus and AntiMalware tool is available in the Ubuntu repositories.
ClamAV® is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats.
Open a terminal and execute :
sudo apt-get update
sudo apt-get install clamav clamtk clamtk-nautilus

clamav is the anti-virus toolkit.
clamtk is the graphical front-end, a graphical user interface for clamav.
clamtk-nautilus is a Nautilus file manager plugin to allow
right-click support for scanning.
Comment: ClamAv produces false positives.


How do I use a opensource Android project (no jar available) in my Eclipse Android project?

Question: Using Eclipse I've started an Android Project.
I wanted to create a FlowLayout but noticed that Android doesn't provide one in a native manner.
I've found two opensource projects in Github that provide a FlowLayout:

https://github.com/ApmeM/android-flowlayout
https://github.com/blazsolar/FlowLayout

I want to use any of those in my project but they don't provide a compiled jar.
I'm trying to compile the code so I can get that jar and plug it into my project (in /libs and in the build path) but I can't import them as projects in Eclipse.

Question is:
How do I get/build the jars of any of those projects?
If the answer is "with gradle" or "with maven", can you guide me a little bit more? like:
"Install maven, run cmd, run this, run that, go and find the jar at ..."

When I've used third party code in my projects in the past I've always found the jars, eg:

android-async-http-1.4.4.jar
ocpsoft-pretty-time-1.0.7.jar
joda-time-2.4.jar
android-support-v7-appcompat.jar

So a second question is:
Is it a bad practice when open source projects don't provide a jar?
Comment: No, is not a duplicate, because here THERE IS NO JAR. Read the question before trying to close it.
Answer: If it is a library project, here's what to do:

Import the library project into your workspace
Right click on your project, go to Properties
Click on Android
At the bottom, there is a Library section for you to add libraries. Click Add.
Select your library project, click OK
Done!

Source: Referencing a library project
Comment: when I import to eclipse the "library project" and then add it as library to my project, I see that a jar is generated, but when I expand that jar I don't see the classes... just a META-INF


Initialization Issue Starting Emacs 27.1 in Daemon Mode on Windows 10

Question: After following instructions from https://www.emacswiki.org/emacs/EmacsMsWindowsIntegration
on starting emacs 27.1 as daemon in windows 10 where path\to\emacs is
"c:\emacs-27.1\bin\runemacs.exe --daemon , see here:

You can also open Explorer, type in shell:startup in the address bar, and press enter. In this startup >folder, create a shortcut by right clicking and selecting new->shortcut. When asked for location, put >the following: "X:\path\to\emacs\bin\runemacs.exe" --daemon where you have substituted the proper path >to runemacs.exe. This shortcut will run at startup. You can double click on the shortcut to start the >Emacs server if it is not already running.

Emacs daemon loads initialization file in c:/emacs-27.1/.config/emacs/init.el and properly so far defines ever function, only there are key-bindings initialized in the init and listed under describe-personal-keybindings that don't work when emacsclientw.exe starts.
They are bindings that were initially reserved for windows and decoded then recoded in the init.
This guy, for example, doesn't play nicely (nothing happens after C-m) in a client connected to a daemon, but works just fine when emacs is started with a frame.
(define-key input-decode-map [?\C-m] [C-m])

; translate it as synonymous with <apps> key
(define-key key-translation-map (kbd "<apps>") (kbd "<C-m>"))

;create a prefix command
(define-prefix-command 'super-keymap)

;set C-m as the prefix-command (note s- is also enabled now, so all C-m can be run with s-)
(global-set-key (kbd "<C-m>") super-keymap)

The same bug occurs after rebinding these guys C-[ and C-]
;rebind C-] keys
;rebind abort-recursive-edit, ESC will work on windows
(global-unset-key (kbd "C-]"))
(define-key input-decode-map (kbd "C-[") [control-bracketleft])
(bind-key [control-bracketleft] 'sp-backward-sexp)
(global-unset-key (kbd "C-]"))
(define-key input-decode-map (kbd "C-]") [control-bracketright])
(bind-key [control-bracketright] 'sp-forward-sexp)

The daemon doesn't of course open up a frame when it launches, hence likely it's in terminal mode. Maybe those keys on windows are not accessible from the same commands in terminal mode? Or is something else going on here?
Any takers?
Answer: Solution for me was to run the client with arguments.
pathTo/emacsclientw.exe -n -c -a "" -e "(rebind-keys)"
(defun rebind keys ()
(progn
(bind "C-x"   'bound-function-x')
(bind "C-y"   'bound-function-y')))


Google Maps 3.0 - Sometimes after removing markers, they stay around

Question: Sometimes when I remove markers they stay around in a "ghost" fashion -- they are clickable but there's no more icon.  This is not every time and usually only happens when I remove more than one at a time.
Here's my code for removing markers:
<code>    for(var i in markers) {
       google.maps.event.clearListeners(markers[i], "click");

       markers[i].setMap(null);
       markers[i] = null;

       delete markers[i];
    }
</code>
The only way to guarantee that they get removed 100% of the time is to move the map to another position.  Then when I move it back they are gone 100% of the time.
Thanks for your help.
Answer: Ah here we go.  What was happening actually had nothing to do with Google Maps API.  The markers were getting readded at a different location based on presence XMPP updates.  I took this out of my application and it works fine.


What is this fabric tape made out of?

Question: Any ideas what is this fabric tape on my cool air return ductwork?

High res close-up
Some of it is separating or worse falling off of the duct work on the cool air return to my forced-air gas furnace. The furnace itself was installed in 1994; the house at some time has a coal-burning furnace, so I'm assuming this ductwork was installed during the retrofit from coal to gas. I'm not sure if this is the first or second gas furnace since the retrofit, but that at least tells us that the fabric tape was applied sometime before 1994.
It occurred to me that this fabric might have asbestos in it, which is a horrifying considering that it's all over the ductwork inside and out. For what it's worth, I was wearing a half-mask p100 respirator when I cleaning it up.
Comment: And ignore the reverse installed fiberglass.. I can't believe this house passed inspection.
Answer: I would treat it as it is asbestos. Old coal heater is my clue. It really needs to be removed or encapsulated at least. It can be tested, but I bet the results would be positive for asbestos, remediation can be costly...

What is this fabric tape made out of?


Implicit formula for the Levi-Civita connection

Question: Let  $(M, g)$ be a Riemannian manifold and $X, Y, Z$ smooth vector fields on $M$. Let $\theta_X$ be the $1$-form defined as $\theta_X(Y) = g(X,Y)$ and let $d\theta_X$ be its exterior derivative. Let $L_X$ denote the Lie derivative. Let $\nabla$ be the Levi-Civita connection, i.e. the unique torsion free connection on $(M,g)$ which is also compatible with the metric. I want to prove that:
$$
2 g(\nabla_Y X, Z) = (L_Xg)(Y,Z) + (d \theta_X)(Y,Z).
$$
Is there a quick way to see that?
EDIT: I'm stuck with the $2$-form $d\theta_X$. I don't know how to deal with it. Can I express it just using the metric and the Lie derivative (without working in local coordinates)?
Comment: Possible duplicate of [Most succinct proof of the uniqueness and existence of the Levi-Civita connection.](http://math.stackexchange.com/questions/140884/most-succinct-proof-of-the-uniqueness-and-existence-of-the-levi-civita-connectio)
Comment: See the [relevant paragraph](https://en.wikipedia.org/wiki/Levi-Civita_connection#Formal_definition) from the Wikipedia article on the Levi-Civita connection.
Comment: Thanks for the help. But my problem is to deal with $d\theta_X$. I edited my question!
Answer: Using the invariant formula for the exterior derivative, we have that
$$\textrm d \theta_X (Y, Z) = Y \cdot \theta_X (Z) - Z \cdot \theta_X (Y) - \theta_X ([Y, Z]) = Y \cdot g(X, Z) - Z \cdot g(X, Y) - g(X, [Y, Z]) .$$
Similarly, using the properties of the Lie derivative, we have
$$(L_X g) (Y, Z) = X \cdot g(Y, Z) - g([X, Y], Z) - g(Y, [X, Z]) .$$
Putting all these together we obtain
$$(L_X g) (Y, Z) + \textrm d \theta_X (Y, Z) = X \cdot g(Y, Z) + Y \cdot g(Z, X) - Z \cdot g(X, Y) - g([X, Y], Z) - g([Y, Z], X) - g([X, Z], Y) .$$
This last expression is known to be equal to $2 g (\nabla_Y X, Z)$ by Koszul's formula (warning: the link to Wikipedia points to formulae that obtain $\nabla_X Y$, not $\nabla_Y X$, so a sign will differ!).
Comment: Thank you! Sorry, but differential forms are a very new thing to me. ;)


How do I resolve recent earth works around my future fence line?

Question: I'm looking to install a fence but a month ago I had some pipe work done in the yard and it left my backyard in shambles. The ground is still unstable and not compacted where the fence line is going to be.
I'm not going to spend a ton of money fixing that, so should I wait until next year when the ground is settled before installing the fence and posts or is it fine now?
Answer: You just need to compact the soil properly around your posts or footings. It's don't on almost any construction site. The nuances of that depend on specific conditions, but here are some tips:

Use a pole, such as a piece of lumber, to pound the soil.
Rent a compactor. Several types are available. "Jumping Jack" units are far more effective than vibrating plates.
Use water. If you have good drainage, water can very quickly settle soil to a nearly undisturbed state. If you don't have good drainage, however, you'll have a mess for days.
Work in layers, or "lifts". Soil does a great job of bridging, so attempting to compact too deep a lift results in poor compaction below the surface.
Comment: You certainly don't want to use water AND a compactor.  In my neck of the woods we have a lot of clay soils, terrible drainage.  A contractor friend of mine had to remove several dump truck loads of wet soil and replace with crushed rock so the project could proceed.   And even if you dig up clay and put it back, it doesn't compress worth a damn.
Comment: Yeah, a little spritz can really help settle _some_ soils, but not much at all and not clay.
Answer: Patience will indeed pay off, unless you would rather pay money to be in a hurry.
If you can live without the fence until next year, waiting costs pretty much nothing while expending effort on compacting costs money, time, or both. Freeze/thaw cycles do a fine job without you lifting a finger. You might want to tidy the shambles a bit before the freezing starts, but waiting on the fence will save you money and effort.
It's not uncommon to see things that have supposedly been compacted settle further after a winter. If you do tidy up, leave a bit of a mound over any trenches.
Comment: Freeze/thaw cycles don't work in places where it never gets cold enough. Time will probably still help, but you can't rely on the same processes in Ecuador that you can in Canada. And we don't know where the asker lives.
Comment: One season would get soil roughly 50% of the way back to where it started. I wouldn't consider it adequate for supporting a fence against the breeze.
Answer: We can't really tell you if you should do it now or wait until next year, because we don't know how urgent it is that you get the fence installed.
However, if you want to do it now, where I am, rental of a small plate compactor (first pic) goes for under $100 per day, as does a vibratory rammer or "jumping jack" (second pic).
Images courtesy of UnitedRentals.com. No endorsement intended or implied.
While it won't be perfect, running that back and forth along the area where the fence is to be installed will go a long way toward creating a solid foundation into which you could drill holes & place fence posts.
Comment: Plate compactors are relatively ineffective on deeper soils because of their large surface area and weak impact force. They'd need to be used in lifts of no more than few inches. They're mostly for _flattening_ soil, not compacting it deeply.
Comment: Noted. Updated.
Comment: Gotta agree with @isherwood  .   They best way would be to remove some of the soil over the pipes, compress it, add back a few more inches and compress again, do again until you get to grade.   But not all soil is compressible, esp if it's wet. You may have to get some crushed rock to replace some of the soil and compact it, then top coat it with soil.
Answer: The best way would be to remove some of the soil over the pipes, compress it, add back a few more inches and compress again, do again until you get to grade. But not all soil is compressible, esp if it's wet. You may have to get some crushed rock to replace some of the soil and compact it, then top coat it with soil.


How would you determine $\sin(x) = -\cos(x)$

Question: I can pretty much look at the equation and say the answer is $\frac{3\pi}{4} + 2\pi k$ and $\frac{7\pi}{4} + 2\pi k$ (where $k \in \mathbb N$) but how can I show work for this?
Comment: Note that your two cases can be condensed into just one : $\frac{3\pi}{4} + k \pi$.
Answer: Divide both sides by $\cos x$ to get $\tan x = -1$.
Comment: You're tacitly using the fact that $\sin(x)$ and $\cos(x)$ are never simultaneously zero.
Comment: Oh wow I should have seen that. Thank you
Comment: @DavidJones No problem :)
Comment: I find it best practice to avoid dividing by functions to solve equations. It can lead to a lot of mistakes.
Comment: @Almentoe I also agree with you as sometimes division may eliminate solutions so I would normally advocate for factoring, but in this case, as the Guest above mentioned, the functions do not share a root so the equations solutions are "conserved".
Answer: This may be overkill, but it could be useful in different situations, for instance something like $\sin x=-\cos3x$.
Recall that $-\cos x=\sin(x-\pi/2)$ so your equation becomes
$$
\sin x=\sin\left(x-\frac{\pi}{2}\right)
$$
This amounts to saying that either
$$
x-\frac{\pi}{2}=x+2k\pi
$$
(which has no solutions) or
$$
x-\frac{\pi}{2}=\pi-x+2k\pi
$$
that becomes
$$
2x=\pi+\frac{\pi}{2}+2k\pi
$$
and, finally,
$$
x=\frac{3}{4}\pi+k\pi
$$
Answer: or we divide by $\sin(x)$ and we get $$\cot(x)=-1$$
Comment: I'm not sure this adds to the discussion, it is similar in content to Jeevan's answer.
Answer: Good question, so +1. Joel Cohen's idea is good, it is always a good idea to reduce the amount of work one needs to do.
Another way of answering it (that shows understanding of the periodic properties of trig functions) is by noting $$\sin(x + k\pi) = (-1)^k \sin(x)$$ and $$ \cos(x + k\pi) = (-1)^k \cos(x).$$
The above facts mean that we only need to seek solutions (to your equation) $a$, where $ 0 \leq a < \pi$. The only solution in this range is $\frac{ 3\pi}{4}$.
So some solutions are: $ \frac{3\pi}{4} + k \pi $, for any $k$, an integer. They are in fact all the solutions, as the trig functions are $2\pi$ periodic.


Is it possible to auto greed when greed and pass are the only options?

Question: Is it possible to have Wow auto select "greed" when "greed" and "pass" are the only two options?
Answer: It is possible however there is no in-game function that allows you to do this so you'll have to use an add on (a good example of one that can auto select greed is 'PassLoot' which you can find here.
Hope this helps.


No Persistence provider for EntityManager Hibernate 5

Question: I have the following project structure which is a multi-module maven project. My issue is in the persistence configuration (located in the model module). It generates my war without returning errors but when it comes to instanciate the EntityManager, it throws a javax.persistence.PersistenceException: No Persistence provider for EntityManager named myPersistence
PARENT
|
|-DATABASE
| └ src/main/
| └ pom.xml
|
|-MODEL
| |- src/main
| |  └ java/
| |    └ .../JPAUtil.java
| |  └ ressources
| |    └ META-INF
| |      └ persistence.xml
| └ pom.xml
|
|-WS
| └ src/main/
| └ pom.xml
|
└ pom.xml

persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

    <persistence-unit name="myPersistence" >
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/mySchema" />
            <property name="javax.persistence.jdbc.user" value="user" />
            <property name="javax.persistence.jdbc.password" value="password" />
        </properties>
    </persistence-unit>

</persistence>

PARENT - pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group.id</groupId>
    <artifactId>parent</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <modules>
        <module>modele</module>
        <module>database</module>
        <module>WS</module>
    </modules>

    <properties>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java-version>1.7</java-version>

        <war-plugin-version>2.4</war-plugin-version>
        <compiler-plugin-version>3.1</compiler-plugin-version>

        <javaee-api-version>7.0</javaee-api-version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit-version}</version>
            </dependency>
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>2.0</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>5.3.1.Final</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>5.3.1.Final</version>
            </dependency>

            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-json</artifactId>
                <version>1.8</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.37</version>
            </dependency>
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>3.9</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>javax.persistence-api</artifactId>
                <version>2.2</version>
            </dependency>

            <dependency>
                <groupId>my.group.id</groupId>
                <artifactId>database</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>my.group.id</groupId>
                <artifactId>modele</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>my.group.id</groupId>
                <artifactId>WS</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${compiler-plugin-version}</version>
                    <configuration>
                        <source>${java-version}</source>
                        <target>${java-version}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${war-plugin-version}</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>

    </build>

</project>

MODELE - pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>my.group.id</groupId>
        <artifactId>parent</artifactId>
        <version>1.0</version>
    </parent>
    <artifactId>modele</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
    </dependencies>

</project>

I have explored several solutions including:

changing persistence.xml file's location
changing the provider (org.hibernate.jpa.HibernatePersistenceProvider)
using c3p0 provider
including target/modele-1.0.jar into persistence.xml
including  into persistence.xml
Answer: I solved my problem: I was using Hibernate 5.3 with JPA 2.1. According to Hibernate documentation you can use either Hibernate 5.3 with JPA 2.2 or Hibernate 5.2 with JPA 2.1. So I migrated to Hibernate 5.2 and I no longer have this error.


Getting undefined when accessing array element even though it exists

Question: I am sending a HTTP request using Axios inside an asynchronous action creator. The arguments I want to use to call the synchronous action creator are stored in an array. For some reason, when I try to console.log(args) (the array), I get the array displayed correctly, but when I try to console.log(args[0]) (the first element), I get undefined. I don't know what this issue is linked to. Here is my code snippet:
const initIngredients_Sync = (ingredientsData, error) => {
    console.log("sync args", ingredientsData, error);
    return({
        type: actionTypes.INIT_INGREDIENTS,
        initialState: ingredientsData,
        error
    });
};

export const initIngredients = () => {
    const args = [];
    return dispatch => {
        axiosInstance.get('/ingredients_prices.json')
            .then((response) => {
                const INGREDIENT_PRICES = response.data;

                const INGREDIENTS = (() => {
                    let ingredients = {};
                    for (const key in INGREDIENT_PRICES) {
                        if(key !== "base_price")
                        ingredients[key] = 0;
                    }
                    return ingredients;
                })();

                const ingredientsData = {
                    ingredients_prices: INGREDIENT_PRICES,
                    ingredients: INGREDIENTS,
                    totalPrice: INGREDIENT_PRICES.base_price
                };

                args.push(JSON.parse(JSON.stringify(ingredientsData)));
            })
            .catch((error) => {
                args.push(error);
            });

        console.log("args[0]", args[0]);

        args.length === 2
            ? dispatch(initIngredients_Sync(args[0], args[1])) // [ingredientsData, error]
            : dispatch(initIngredients_Sync(args[0], false)); // no error
    }
};

Output with console.log(args):
[]
   0: {ingredients_prices: {...}, ingredients: {...}, totalPrice: {...}}
   length: 1

Output with console.log(args[0]):
undefined

Comment: Can you edit your question with output of console.log?
Comment: You try to console.log before return, you need to return args into a variable then use it outside, if you create a sandbox we can help you better
Answer: Your console log statement in the code snippet is outside .then callback. You should check this once/after your api call is resolved, i.e. below this line...
args.push(JSON.parse(JSON.stringify(ingredientsData)));
console.log(args[0]) // should print

Answer: Axios is a promise based HTTP client for the browser and Node.js.
So its methods like .get() will resolve asynchronously.

An asynchronous model allows multiple things to happen at the same time. When you start an action, your program continues to run. When the action finishes, the program is informed and gets access to the result (for example, the data read from disk).

Resource - https://eloquentjavascript.net/11_async.html
That's why your console.log does not output the result as you expect. You can fix this by dispatching actions with args in then method.
const initIngredients_Sync = (ingredientsData, error) => {
  console.log("sync args", ingredientsData, error);
  return {
    type: actionTypes.INIT_INGREDIENTS,
    initialState: ingredientsData,
    error,
  };
};

export const initIngredients = () => {
  const args = [];
  return (dispatch) => {
    axiosInstance
      .get("/ingredients_prices.json")
      .then((response) => {
        const INGREDIENT_PRICES = response.data;

        const INGREDIENTS = (() => {
          let ingredients = {};
          for (const key in INGREDIENT_PRICES) {
            if (key !== "base_price") ingredients[key] = 0;
          }
          return ingredients;
        })();

        const ingredientsData = {
          ingredients_prices: INGREDIENT_PRICES,
          ingredients: INGREDIENTS,
          totalPrice: INGREDIENT_PRICES.base_price,
        };

        args.push(JSON.parse(JSON.stringify(ingredientsData)));

        // These lines moved to `then` method
        console.log("args[0]", args[0]);

        args.length === 2
          ? dispatch(initIngredients_Sync(args[0], args[1]))
          : dispatch(initIngredients_Sync(args[0], false));
      })
      .catch((error) => {
        args.push(error);
      });
  };
};


Find all constants where a matrix is symmetric

Question: I have a matrix like below:
$$M = \begin{bmatrix} 2 && a-2b+c && 2a+b+c \\ 3 && 5 && -2 \\ 0 && a+c && 7\end{bmatrix}$$
In order for the matrix to be symmetric, the following constraints on $a$, $b$, and $c$ must hold:
$$a-2b+c = 3 \\ 2a+b+c = 0 \\ a+c = -2$$
How would I find the domain of $a$, $b$, and $c$? The set of equations above can form a matrix, and solving the system would give an individual value for each, but this gives a lone example of values that work, how would I find the range?
Am I reading too much into the question? Are the set of equations I've provided the ranges?
Comment: The term "domain" and "range" are not really applicable in this situation.  What you will find are the set of all such $a,b,c$ such that your matrix is symmetric.  As you say, you can form a system of equations and solve using your favorite method.  $\left[\begin{smallmatrix}1&-2&1\\2&1&1\\1&0&1\end{smallmatrix}\right] \left[\begin{smallmatrix}a\\b\\c\end{smallmatrix}\right]= \left[\begin{smallmatrix}3\\0\\-2\end{smallmatrix}\right]$.  The solution set of this system of equations (equivalently matrix equation) will be *all* solutions.  Possibly one or infinitely many, depending on the result.
Comment: The coeffiicient of $c$ in your first equation does not match what is in the matrix. Which one is the typo?
Answer: I guess that you are overthinking it. You've found that system correctly. In fact: $$\begin{cases} a-2b+c = 3 \\ 2a+b+c = 0 \\ a+c = -2 \end{cases} \implies \begin{bmatrix} 1 & -2 & 1 \\ 2 & 1 & 1 \\ 1 & 0 & 1 \end{bmatrix} \begin{bmatrix} a \\ b \\ c \end{bmatrix}  = \begin{bmatrix} 3 \\ 0 \\ -2\end{bmatrix}, $$
and since the determinant of that matrix is non zero, we have an unique solution $(a,b,c)$ for that system. In other words, we have only one choice of $a,b$ and $c$ to make the initial matrix symmetric.
Comment: Is this system indeed correct? OP's 1,2 position has $a-2b+2c$, but the first equation OP wrote (and that this answer uses) has $a-2b+c$.
Comment: Since the last equation reads $a+c=-2$, the lower right entry of your matrix should be $1$.
Comment: Fixed , thanks!
Answer: Hint:
$$a-2b+c = 3 \\ 2a+b+c = 0 \\ a+c = -2$$
Rank of coefficient matrix is full i.e. $3$, Hence system has a unique solution.
Now eliminate $b$ from 1),2) then you will get a new equation in $a,c$ then solve equation with 3). you will get the value of $a,b,c$.
Answer: Just for variety, avoiding explicit linear algebra:
It is suggested to me to subtract $a+c$ from $a-2b+c$, because that simultaneously eliminates $a$ and $c$. By the symmetry, the result should be $3-(-2)$. So $$(a-2b+c)-(a+c)=5$$ $$-2b=5$$ $$b=-\frac{5}{2}$$
Now subtracting two expressions like $$(2a+b+c)-2(a+c)=0-2(-2)$$ $$b-c=4$$ so $c=b-4=-\frac{13}{2}$. And solving for $a$ is now trivial.
Comment: Math questions are often worded that way so as to not give away any extra information. It's up to you to establish there is exactly one solution, instead of zero, or more than one.
Comment: Yes, finding a unique solution to the system of equations provided in OP seemed trivial, I'm not sure why the question asked me to find *all* a, b, and c where the matrix is symmetric. It makes it sound like there's more than one solution.


Can you assign named settlers to anything specific?

Question: Read in a different thread that you can't assign a named settler to a Supply Line. (Can't remember her name right off, but the gripey/crabby one.)
However, I tried to assign a different, named one to a Guard Post and that didn't work either.
Can you assign 'named settlers' to anything specific?
Comment: Nothing concrete enough, but definetly. There is a particular settler I am specifically aware of, as they can be assigned to harvest crop, and will harvest more then an unnamed settler.
Comment: Odd that you couldn't assign them to a guard post... named settlers seem to usually be ok with being assigned to basically anything in the same settlement. I even have Mama Murphy assigned to a scavenging workbench.
Comment: @Timelord64 elaborate?
Comment: Usually you can assign them to tasks, however I had some troubles with people in Covenant and guard posts. The assignation worked, but he never walked to it.
Comment: @tubes, IIRC it is the Vault Tec rep; however, I could be mistaking this for a different unique I had 'enlisted'. I could not say how reliable my sourve was, either. I was more concerned with plot then harvesting.
Answer: From personal experience, I can tell you that it is possible to assign at least some of the named settlers to at least some duties.
For example, here's a few assignments I have done before. A couple of these are still in place on my current game:

Marcy Long: Farming (By the way, she's probably the "gripey one" you're talking about.)
Jun Long: Defense
Preston Garvey: Scavenging
Sheffield: Farming

 - Vault-Tec Representative: Trading Emporium (This is actually recommended, as he will become a "Tier 4" vendor here.)

Personally, I haven't encountered (or just cannot recall) a case where I've been unable to assign any settler to a duty of my choosing. But, I haven't really experimented much with it either.
It is conceivable that there may be some rules in place, affecting certain critical NPCs, in order to protect the story flow. But it would take a good deal of thorough playtesting to enumerate all those rules (determining which named NPCs can or cannot do which jobs).
The first case you give seems to be one of the most likely ones to get blocked in general though. You're trying to assigned a named NPC as a Provisioner (that's what people running the Supply Lines are called - more on that shortly). That's something you generally wouldn't want to do to a named NPC - both in gaming terms and in programming terms - for two reasons:

Provisioners are unavailable to the player, or at least difficult to locate, most of the time as they are constantly physically traveling between the endpoints of their assigned Supply Line. This is fine for generic NPCs, but most named NPCs need to be readily accessible to the player (and at a player-predictable - sometimes even mission-specific - location) at certain points in the game.
Provisioners actually get renamed to "Provisioner". That's okay for generic NPCs who would just be named "Settler" to begin with. Not so much for named NPCs. It may just be easier or more efficient to program named NPCs so that they're excepted from selection for the job role, rather than to program their exception from the rename. Or this may not have even come into consideration, given that #1 above is a pretty strong reason to block them from the role on its own.

At this point though, I'm just speculating. I have not yet tested assigning a named NPC to a Supply Line. If I get the chance, I'll update this answer. (Or someone else who already has is welcome to.)
Tip: If you can, you probably want to avoid assigning named NPCs (especially companions) to stores unless they're "Tier 4" vendors. Otherwise, their normal dialog options tend to get in the way of trading a bit. Even some of the "Tier 4" vendors have this problem (The one mentioned in spoiler text above still makes me wait through his rather long ambient ramblings before I can actually Barter with him.) but at least they make it worthwhile.
Comment: +1. I usually have Marcy assigned to guard duty. She constantly complains about security, might as well have her deal with it herself.
Comment: @DCShannon One of my favorites is when she says I'd better not be telling anybody about this place... while she's surrounded by over a dozen other NPCs that have joined the settlement after her.
Comment: @DCShannon exactly
Comment: You can assign Codsworth to scavenging aswell
Comment: @Iszi Well that wasn't me. That was the recruitment beacon. Yell at the recruitment beacon. Or Preston. Yeah, yell at Preston.
Comment: If you take the Covenant settlement and you let the people in their related hideout live, there are 5 or 6 people you can't assign to anything and only 2 of those are doing something useful, Penny in the general store and the doctor. So there are some who can't be assigned.
Comment: @DimFre4kske I say kill the useless lot of 'em. A Recruitment Beacon can repopulate the settlement quickly enough.


Facebook login page renders improperly when zoomed in Firefox

Question: I have reported this to Mozilla in a bug report:
https://bugzilla.mozilla.org/show_bug.cgi?id=843767
They said that this is a Facebook problem.
Here is what the log in page looks like on 130% zoom:
https://bug843767.bugzilla.mozilla.org/attachment.cgi?id=716721
I was told that, "It's up to FB to change its code."
Is there anyway that Facebook can fix this?
Comment: Should you ask FB that?
Answer: Yes, but why do you ask this here? Report it to FB here under the category "Facebook Home":
http://www.facebook.com/help/326603310765065/
Comment: To which category would I report it?
Comment: I would probably choose "Facebook Home", but they can always move it to the right category in case they don't think it fits where it was entered.


Values of FULL OUTER JOIN appearing in 2 different fields

Question: here is my query:
SELECT
COALESCE ([dbo].[RSA_BIRMINGHAM_1941$].TOS,
[dbo].[RSA_CARDIFFREGUS_2911$].TOS,[dbo].[RSA_CASTLEMEAD_1941$].TOS,
[dbo].[RSA_CHELMSFORD_1941$].TOS) AS [TOS Value]

,RSA_BIRMINGHAM_1941$.Percentage            AS [Birmingham]
,RSA_CARDIFFREGUS_2911$.Percentage          AS [Cardiff Regus]
,[dbo].[RSA_CASTLEMEAD_1941$].Percentage    AS [Castlemead]
,[dbo].[RSA_CHELMSFORD_1941$].Percentage    AS [Chelmsford]

FROM [dbo].[RSA_BIRMINGHAM_1941$]
FULL OUTER JOIN [dbo].[RSA_CARDIFFREGUS_2911$]
ON [dbo].[RSA_BIRMINGHAM_1941$].TOS = [dbo].[RSA_CARDIFFREGUS_2911$].TOS

FULL OUTER JOIN [dbo].[RSA_CASTLEMEAD_1941$]
ON [dbo].[RSA_BIRMINGHAM_1941$].TOS = [dbo].[RSA_CASTLEMEAD_1941$].TOS

FULL OUTER JOIN [dbo].[RSA_CHELMSFORD_1941$]
ON [dbo].[RSA_BIRMINGHAM_1941$].TOS = [dbo].[RSA_CHELMSFORD_1941$].TOS

And here is the output:
TOS Value        Birmingham   Cardiff Regus   Castlemead    Chelmsford
default (DSCP 0)   61.37%       61.74%         99.48%         79.78%
af11 (DSCP 10)     15.22%       4.63%          0.00%          6.16%
af33 (DSCP 30)     11.49%       15.44%         NULL           7.33%
af31 (DSCP 26)     8.86%        13.85%         0.01%          5.59%
ef (DSCP 46)       1.91%        3.72%          0.49%          0.91%
af41 (DSCP 34)     0.70%        0.03%          0.01%          0.05%
cs4 (DSCP 32)      0.15%        0.20%          NULL           0.10%
af12 (DSCP 12)     0.12%        NULL           NULL           NULL
cs3 (DSCP 24)      0.06%        0.11%          0.01%          0.04%
af21 (DSCP 18)     0.05%        0.05%          0.00%          0.02%
cs6 (DSCP 48)      NULL         0.23%          NULL           NULL
cs6 (DSCP 48)      NULL         NULL           0.00%          NULL
af32 (DSCP 28)     NULL         NULL           NULL           0.02%

If you have a look at the TOS column and look at value cs6 (DSCP 48) you will see that it has been duplicated.
there should be only 1 cs6 (DSCP 48) row but for some reason the Castlemead value (0.00%) for cs6 (DSCP 48) has been created as a separate column.
there should be only one row per TOS value if that makes sense so please tell where did I go wrong?
Comment: That is values is repeated in one of join table.  And that would be a lot more readable with aliases.
Comment: @Paparazzi what i want to do is get rid of the repeated values.. that was stated on my question.
Comment: But values are not repeated.  Those rows are different.
Comment: Did any of the answers fit your needs? Could you leave a comment?
Answer: The results you get are as expected. This is because the joins are all relative to the first table. If there is a TOS in the second table that has no match with the first table that will generate a  new record. If there is a TOS in the third table that has no match with the first table that will again generate a new record. There is no clue for the engine to know that such instances should be combined
into one result.
There are probably several ways to resolve this. I will suggest one where you introduce a UNION sub select that will combine all TOS values, and then an INNER JOIN to each of the four tables.
SELECT       REF.TOS AS [TOS Value]
            ,RSA_BIRMINGHAM_1941$.Percentage    AS [Birmingham]
            ,RSA_CARDIFFREGUS_2911$.Percentage  AS [Cardiff Regus]
            ,RSA_CASTLEMEAD_1941$.Percentage    AS [Castlemead]
            ,RSA_CHELMSFORD_1941$.Percentage    AS [Chelmsford]

FROM       ( SELECT TOS FROM RSA_BIRMINGHAM_1941$   UNION
             SELECT TOS FROM RSA_CARDIFFREGUS_2911$ UNION
             SELECT TOS FROM RSA_CASTLEMEAD_1941$   UNION
             SELECT TOS FROM RSA_CHELMSFORD_1941$
           ) AS REF
INNER JOIN RSA_BIRMINGHAM_1941$   ON REF.TOS = RSA_BIRMINGHAM_1941$.TOS
INNER JOIN RSA_CARDIFFREGUS_2911$ ON REF.TOS = RSA_CARDIFFREGUS_2911$.TOS
INNER JOIN RSA_CASTLEMEAD_1941$   ON REF.TOS = RSA_CASTLEMEAD_1941$.TOS
INNER JOIN RSA_CHELMSFORD_1941$   ON REF.TOS = RSA_CHELMSFORD_1941$.TOS

Comment: Hi @trincot your query does what i want it to do but i have a few fiels missing from the TOS table: TOS Value
     af12 (DSCP 12)
     af32 (DSCP 28)
     af33 (DSCP 30)
     cs4 (DSCP 32)
     cs6 (DSCP 48)
Comment: Hi Mate, i found a way to get the results that i wanted thanks to your initial answer! instead of using INNER JOIN i replaced it with a FULL OUTER JOIN and that lists all the fields from the TOS table as expected. what i was missing was to use a UNION as you mentioned so thanks for your help!
Answer: Queries are so much easier to write and to read with table aliases.  The problem is the matching in the second FULL OUTER JOIN.  The FROM clause needs to look like this:
FROM [dbo].[RSA_BIRMINGHAM_1941$] b FULL OUTER JOIN
     [dbo].[RSA_CARDIFFREGUS_2911$] cr
     ON b.TOS = cr.TOS FULL OUTER JOIN
     [dbo].[RSA_CASTLEMEAD_1941$] cm
     ON cm.TOS IN (b.TOS, cr.TOS) FULL OUTER JOIN
     [dbo].[RSA_CHELMSFORD_1941$] cf
     ON cf.TOS IN (b.TOS, cr.TOS, cm.TOS)

In other words, by comparing to only one TOS field in the later joins, you might be joining to an unmatched column -- and hence getting a duplicate.  One FULL OUTER JOIN is fine.  Multiple FULL OUTER JOINs are tricky.  I often use UNION ALL queries instead.
Comment: thanks for your answer but i get a whole list of new errors when i run the query. i am new to SQL Querying so it could be just me not undestanding the answer propperly. however the answer that trincot gave has produced the results that i wanted so thanks for your help anyway1
Answer: Thanks to @trincot as he is the one who layed the fondation to the outcome that i was looking for. here is the query that has solved my issue:
SELECT       REF.TOS AS [TOS Value]
        ,RSA_BIRMINGHAM_1941$.Percentage    AS [Birmingham]
        ,RSA_CARDIFFREGUS_2911$.Percentage  AS [Cardiff Regus]
        ,RSA_CASTLEMEAD_1941$.Percentage    AS [Castlemead]
        ,RSA_CHELMSFORD_1941$.Percentage    AS [Chelmsford]

 FROM
         (SELECT TOS FROM RSA_BIRMINGHAM_1941$   UNION
         SELECT TOS FROM RSA_CARDIFFREGUS_2911$ UNION
         SELECT TOS FROM RSA_CASTLEMEAD_1941$   UNION
         SELECT TOS FROM RSA_CHELMSFORD_1941$) AS REF

       FULL OUTER JOIN RSA_BIRMINGHAM_1941$   ON REF.TOS =
       RSA_BIRMINGHAM_1941$.TOS
       FULL OUTER JOIN RSA_CARDIFFREGUS_2911$ ON REF.TOS =
       RSA_CARDIFFREGUS_2911$.TOS
       FULL OUTER JOIN RSA_CASTLEMEAD_1941$   ON REF.TOS =
       RSA_CASTLEMEAD_1941$.TOS
       FULL OUTER JOIN RSA_CHELMSFORD_1941$   ON REF.TOS =
       RSA_CHELMSFORD_1941$.TOS

       ORDER BY [TOS Value]

and the result is the following as expected:
TOS Value      Birmingham   CardiffRegus    Castlemead  Chelmsford
af11 (DSCP 10)  15.22%      4.63%           0.00%        6.16%
af12 (DSCP 12)  0.12%       NULL            NULL         NULL
af21 (DSCP 18)  0.05%       0.05%           0.00%        0.02%
af31 (DSCP 26)  8.86%       13.85%          0.01%        5.59%
af32 (DSCP 28)  NULL        NULL            NULL         0.02%
af33 (DSCP 30)  11.49%      15.44%          NULL         7.33%
af41 (DSCP 34)  0.70%       0.03%           0.01%        0.05%
cs3 (DSCP 24)   0.06%       0.11%           0.01%        0.04%
cs4 (DSCP 32)   0.15%       0.20%           NULL         0.10%
cs6 (DSCP 48)   NULL        0.23%           0.00%        NULL
defau(DSCP 0)   61.37%      61.74%          99.48%       79.78%
ef (DSCP 46)    1.91%       3.72%           0.49%        0.91%


Installing GFCI into a box that feeds two other outlets

Question: I have a kitchen that has three countertop outlets all on the same branch circuit, and no GFCIs as the house was built prior to that code requirement. My plan was to replace the "first" outlet in the chain with a GFCI and have the other two outlets come off the load terminals so that way all three outlets were covered via the usual setup. Other than having to sort out which was the "first" one in the chain, no big problem.
To my surprise once I pulled off the covers, the setup is slightly different: the power from the panel goes to one outlet, and then it has two "forks" that branch to the other two outlets. So one outlet has three 12/2 cables coming in, two of which go to the other outlets. I suspect this is because one of the outlets was installed later and it meant running less cable. It happens that the receptacle that's doing the branching is wired with backstabs only -- three hots and three neutrals adding up to six wires being backstabbed into it. (The wisdom of that I won't question here...)
Looking at the instruction sheet for the Leviton GFCI to see if there were any hints for this sort of a setup, instead it simply says:

DO NOT install the GFCI receptacle in an electrical box containing (a) more than four wires (not including grounding wires) or (b) cables with more than two wires (not including the ground wire). Contact a qualified electrician if either (a) or (b) is true.

So why the "don't do this"? Is this just a "this isn't the easy case and the lawyers didn't want to get sued" or is there some code problem here? My plan was just to pigtail the two loads feeding the other outlets together and attach that to the load terminals of the GFCI. The only particular problems I can think of is either the box just getting too full to work with, or in this case since these are 20A small appliance circuits that a 12 gauge pigtail wire is also required.
Update: So the box appears to be stamped as 16 cubic inches, which means this was far to small even for the existing install. The box does appear deeper than the rest of the kitchen outlets but it's not crazy deep. Ultimately the plan was to replace that box with one to add a switch for a garbage disposal circuit, so I'll probably defer the GFCI install and let the electrician handle that one...and make sure they get an extra deep box.
Comment: Are you implying that you would make pigtails out of a smaller gauge wire than the gauge of the wires in the cables entering and leaving the electrical box?
Comment: Can you post photos of the inside of the box in question?
Comment: @MichaelKaras: nope, but it would have been easy to grab my spool of 14 gauge wire without thinking for the pigtails. I wasn't sure if the writers of the GFCI instructions just didn't want anybody else making similar mistakes.
Comment: @ThreePhaseEel: photos added, but Ed's answer seems already on the money: this box is too small.
Answer: You are correct the number of wires for box fill is limited by code. I would be feeding the GFCI on the line side and pigtail the load with #12 wire. You are kind of stuck with what you have it's going to be a tight fit hopefully it is a deep box. I have replaced boxes that were two small with old work boxes and in some cases used a 4 square box with a single device mud ring, this provides the most room but requires a bit of Sheetrock work to close it back up. Each box has the cubic inches allowed stamped on it. To calculate how much you need it's 2.25 for #12 wire, we only count 1 ground the 3 hot,  the 3 neutrals is 7 a 2x for the the receptacle 9  plus if the box has clamps another for a grand total of 10 x 2.25  so the box would need to be 22.5 cu inches to meet code. Hope that helps I believe this is the reason they say no more because standard boxes are not that large and a GFCI device is larger than most receptacles but the same full calculation is used.
Comment: Maybe a GFCI breaker in the main panel.
Comment: @JACK, thats possible, but working inside the breaker box is a different comfort level than replacing an outlet.  If it's a newer panel, that could be a very good option.
Comment: This whole thing started with me just wanting to replace that outlet by the floor after repainting the wall, discovering it was a MWBC, figuring out what was all going on, and then thinking "well, since I have the breakers off, I had been meaning to GFCI this countertop" only to discover more fun. So much for "let me replace this outlet before dinner".
Comment: @JPhi1618  So very true. I always hate recommending going into the panel but the OP might have a box fill  problem.
Comment: Probably most contractors use the smallest cheapest boxes available. The panel may be an option depending on type and how full it is now.
Comment: It's an older ITE panel, which I'm guessing dates to the mid to 70s since it would have been replaced when an addition was done. Some work in the panel is required no matter what: the other discovery working on this was the two small appliance circuits are a multiwire branch circuit with no tie between the breakers. So replacing the breakers might be happening no matter what.
Comment: Also, no matter what, the box is going to get expanded at some point: the house also has no outlet for a garbage disposal, and my plan was to have an electrician replace the box with a 2-gang box to keep the outlet and add the switch. That of course requires a bigger box still, but is a bit easier than an extra deep 1 gang box.
Comment: This otherwise looks on the money: the box is labeled at just 16 cubic inches. Looked a lot deeper than the rest in the house, but still not deep enough.
Comment: Are there ANY outlets between this one and the panel? *Could there be*?
Comment: @Harper: good question: yes. This whole setup starts as a MWBC from the panel to an outlet by the floor that is not close to a countertop, and that point splits into two regular chains of outlets with each chain having just a single branch in it. As much as I would like to GFCI that, that box is absolutely too small to fit the GFCI in in it's current form. (It's probably violating box fill as it is too.)
Answer: In your case you should either

Use a box extender to give you more cubic inches (remember, the wall is proud of the box, and that counts); you could use

a $2 metal "handy-box" extension box; not pretty but will fit.
a Legrand Wiremold Surface Conduit Starter Kit, which is designed to sit 1-2" proud of the wall and give you a place to launch off surface conduit.  You attach 0 conduits :)

obtain a 2-pole GFCI breaker for an ITE panel.  Apparently Siemens Q series is the direct descendant and is UL-listed for ITE panels.  Eaton's CL (not BR) is UL-CLassified for ITE panels, but they don't sell a 2-pole GFCI.
Find a location between MWBC split and kitchen where there's already an outlet and fit the GFCI there;
Create a location between panel and kitchen to fit a 2-pole deadfront GFCI.

I suspect it's because of NEC 110.3(B), which requires you install according to the labeling and instructions, and the fact that UL approves the labeling and instructions as part of obtaining the UL listing. (or CSA, ETL, BSI, whatevs.)
More than four wires
There are probably two problems here.
Top of the pops is Box fill.  There are both practical issues with box fill, and statutory ones.

On the practical side, a GFCI outlet takes a lot of space, and can physically "cube out" smaller boxes.  On the other hand, larger deeper boxes, such as a 4x4" with a 1-gang mud ring or any of the new-work in-wall boxes metal or plastic, won't have any trouble at all, and this warning would be in error.
On the "statutory" side of box fill, you need 2.25 cubic inches per #12 wire and 2.00 cubic inches per #10. All grounds together count as 1 wire, all cable clamps count as 1, and any yoke counts as 2 wires (of the largest size).  So a 4-wire situation needs 8 "wires" (16 or 18 c.i.).  With 2 more wires you now need 20 or 22.5 c.i.

The second problem with "more than 4 wires" is the ability to use the GFCI itself as a splice point.  Most GFCIs I see use an attachment method called "Screw-to-clamp", where the screw acts as a clamp to grip 2 back-feed wires.  (not backstabs).  That's fine if you have 2 Lines and 1 Load, or 1 Line and 2 Loads - but if you have 3 Lines, you need to pigtail.  Pigtailing is beyond the scope of the UL-approved instructions.   It's also possible this GFCI doesn't provide screw-to-clamp, and can only accept 1 screw per terminal.
It is common for GFCI instructions to tell you to always attach the onward power cable to LOAD, which I consider a mistake. One should attach nothing to load unless you mean to protect it, because many problems follow if you do not.
3-wire cables
You are warned off of these because these are either
- multi-wire branch circuits, which require very special handling of neutral (GFCI or not), and all but forbid use of the LOAD terminals; or
-  they are switched/split outlets, and GFCI outlets cannot be split.
Comment: @JasonMalinowski You can see from the link how Leviton does screw-to-clamp.  If it looks *obviously* like it's intended to work that way, you should be fine. The proof of the pudding will be in the firm tug you give it.
Comment: Aactually, it appears for an ITE panel, a Siemens Q series breaker is UL-listed, and an Eaton CL is UL-classified for that panel.  CL doesn't come in 2-pole GFCI, but [Siemens Q does](https://www.homedepot.com/p/Siemens-20-Amp-Double-Pole-Type-QPF2-GFCI-Circuit-Breaker-US2-QF220AP/206965328).
Comment: This GFCI is this one: https://www.homedepot.com/p/Leviton-15-Amp-125-Volt-Duplex-SmarTest-Self-Test-SmartlockPro-Tamper-Resistant-GFCI-Outlet-White-4-Pack-M42-GFTR1-04W/305340161 It appears to me you could push in two wires and clamp both down. The instructions are silent on this not saying you can nor can't -- the ominous warning aside.
Comment: @JasonMalinowski You can't install it contrary to labeling or instructions, NEC 110.3b (the "stop if you see 3 wires or 3 cables" notwithstanding).  But the photo looks like it's made for screw-to-clamp, check the labeling.  A Leviton certainly ought to be; *they invented the thing*.  https://www.handymanhowto.com/electrical-outlets-side-wire-versus-back-wire/  If not, take it back.
Comment: Yeah, I agree it _looks_ like it. The GFCI has no physical markings prohibiting screw-to-clamp with two loads, and the "about wire connections" section doesn't say anything special. The only thing that would imply a prohibition is the "contact a professional" warning which as you have well confirmed could be a warning for any number of reasons.
Comment: Indeed, until I found that warning my question on Stack Exchange was just going to be a picture of the GFCI terminal asking if that is supported since the instructions are silent. And whereas it's now also established the box is to small _even for the existing installation_, there's the practical question of "what's the best thing to do today?" leave everything untouched for now or screw-to-clamp with two wires in the load and make an already tight box even tighter.
Comment: @JasonMalinowski I edited the top of my post to say.  Either fit a GFCI deadfront just past the panel, or fit a box extension on top of the existing box. A "Handy-box" extension is under $2 but a little ugly.  For a neater appearance use a Legrand Wiremold Surface Conduit Starter Kit.
Comment: Yeah, Siemens inherited the ITE QP line
Comment: Thanks for all the info and far more options than I was imagining. The Handy-box is ugly but might actually be right: we were planning on doing some bigger remodeling here maybe come spring, so right now I want to right as many wrongs as I can at once -- any fancier work is just something being ripped out later.


I need a bower alternative

Question: I am working on a project with dotnet core, in Linux and it is using MVC.
I am reading a book for learning how to put things together. The book advises installing Bower. But the last time I researched bower I believe they were advising towards using something else for new projects.
I would like to know what alternative I can use for front end management. I need to be able to use Bootstrap, Jquery, Popper and Datatables on my page. And of course, I should be able to use it in Linux.
Comment: [NPM](https://en.wikipedia.org/wiki/Npm_(software)) is the defacto these days (Yarn is an alternative NPM client, but does mostly the same thing)
Answer: Thanks for the help francium. NPM is working just fine.It is in the official Ubuntu repository. You have to install popper the following way though: npm install popper.js --save
If you don't specify the .js extension it will give you a warning saying that bootstrap requires a popper installation but it was not installed. You also have to install git on your machine to make it work. I did not do it the first time I ran it and it gave me an error asking me if it was installed. Thanks for the suggestion, It was relatively easy to do get things working.
Answer: Yarn is now the alternative to Bower, but to install Yarn you need to use NPM
Comment: So NPM = IE? :D

I need a bower alternative


Documents4J: Kerning in Word to PDF conversion

Question: So I have put together an implementation of Documents4J using it's standalone executable server jar on one dedicated system with MS Word, and I call it with a web service using the client jars that they also provide.  It seems to be working as expected.
The problem is that the client is noticing kerning in the final PDF product.  It is commonplace when using an assortment of fonts...uneven spacing between letters.  This kind of keen observation was something that our development staff did not notice at first glance....we just noticed that the PDFs now looked much better from our old implementations using word2pdf open source APIs that did not involve MS Word.  This issue is duplicated when just opening Word and using "Save As..." and saving as PDF.  In other words, this is an MS Word issue at heart.
However, when the Adobe Plugin is present in MS Word, and you use "Export" or "Print", they get the desired product.
Is there any way to either configure the RemoteServer or the Builder to use this alternate method of conversion within Documents4J?
Answer: Effectively, documents4j wraps a VBS script that triggers MS Office APIs. The script of the MS Word converter already uses exporting for PDF/A generation:
wordDocument.ExportAsFixedFormat outputFile, _
                                       WdExportFormatPDF, _
                                       False, _
                                       , , , , , , , , , , _
                                       True

but not for standard PDFs where the (faster) save-as-PDF function is used. In order to use the plugin, you would probably need the export function as well.
Have you tried PDF/A generation to see if this improves quality? In this case, you would need to change the last True of the call to a False for disabling PDF/A if you want to avoid the latter.


Crafting with synthweave in 4.0

Question: I'm a bit confused with all the changes that have been made to crafting in 4.0.
For augments i understand that it works like it did before except there are no greens anymore?

Buy blue schematic
Craft blue augment
RE blue augment till you get purple schematic
Craft purple augment

But for armoring and gear i don't really get it completely.
The best armoring schematic we can buy is a 36 one, which is barely as good as 60 end gear.
You cant RE gear or armorings from the green/blue crystals vendor.
So is the only way to get a schematic for a good armoring then from Ops?
Same for the gear, i understand that you need story mode gear to RE to get a schematic, then craft that gear and RE it to a Hard mode gear piece.
Does gear from HM FP qualify for this aswell?
Answer: Some mods can be learned from the crystal-bought gear. A friend of mine was able to learn the 220 Versatile hilt from an offhand on his Artificer.
Otherwise you are correct about augments, and yes it's Ops gear that you want in order to learn the end-game mods.  I am not sure about HM FP gear though,  maybe someone else can chime in.

Crafting with synthweave in 4.0


Bitwise Not - Flash AS3?

Question: I have a hex number: 0x01F4
I need the one's complement - which should be FE0B. But I can't seem to get what I need.
I do:
var n:int = 0xF4;
n = ~n;
trace(n.toString(16));

And get -F5 instead of 0B.
Anyone know what I can do?
Comment: it's math. I don't know AS3, but I can argue: int is a signed int, your **positive** number F4 is bitwise negated (bitwise not), and the result interpreted again as an integer signed number, which has -F5 as the correct hex signed representation. In the vars, from the bit point of view, there's the right things. If you want to see it, you should cast the int into unsigned int, if it makes sense in AS3 - don't forget: doing 1's complement the "width" is important: how many bits make an int in AS3? (e.g. 32, not 16)
Comment: Ah, that was it! Thank you! All I needed to do was: var n:uint and I get the result I was after.
Answer: One's complement works on all the bits. In Flash, an int is 32 bits (or 8 hex digits). So ~0x01F4 is 0xFFFFFE0B (because 0x01F4 is 0x000001F4). If you want just the last 2 bytes' worth, simply do a mask after: ~n & 0xFFFF.
The reason you get -F5 as output is that int is a signed type -- so whenever the highest bit is set (as it is with your example), Flash thinks it's a negative 2's complement number and gives you that output. The bits are correct, but the formatted representation is unexpected because you're not asking for what you think you are. Change the type to uint and the output should become (the expected) FFFFFE0B.

Bitwise Not - Flash AS3?


Preloading Animation hides all the cool slider intro animations

Question: I coded a website in HTML5 recently. Its slider have some cool intro animations (used slider revolution plugin for slider intro animations). Then I installed a preloading animation on the website (this one - ihatetomatoes[dot]net/demos/css3-preloader-transition). All works perfectly. But the cool and awesome animations of the slider are already over when the preloader finishes and takes us the to website.
Code to slider animations: http://pastebin.com/HTVGxpCz
Code to the preloader: http://pastebin.com/14JPCX1n
Please help me so that site loads perfectly -- preloader loads, then when it ends, only then do the slider intro animations start.
Answer: I think you can do the that by initializing revolution slider once you execute the code to remove
loader from screen.
Hopefully this should work for the loader issue.


How to sort query results by date then specific column values in mysql

Question: I'm trying to sort my query results by date, then within each timeframe by if the status is 'sold', then if the status is 'contingent', then if the status is 'canceled'.  Nothing I do to the ORDER BY clause seems to work.  I would really appreciate some insight into what I'm doing wrong.  Here's my query as it is now:
            SELECT
                subdivision community
            ,  lot_number lot
            ,  homeowner buyer
            ,  agent_initials agent
            ,  date_sold date
            ,  sales.plan plan
            ,  sales.inv_pre type
            ,  sold_price price
            ,  'sold' status
            ,  SUBSTRING_INDEX(SUBSTRING_INDEX(date_sold,'-',2),'-',-1) month

            FROM
                sales

            JOIN
                third_party_sources
                ON sales.job_id = third_party_sources.job_id

            WHERE
                sales.is_contingent is null
            AND sales.date_sold BETWEEN :startDate AND :endDate
            OR  sales.is_contingent = 0
            AND sales.date_sold BETWEEN :startDate AND :endDate

            UNION

            SELECT
                subdivision community
            ,  lot_number lot
            ,  homeowner buyer
            ,  agent_initials agent
            ,  date_sold date
            ,  sales.plan plan
            ,  sales.inv_pre type
            ,  sold_price price
            ,  'contingent' status
            ,  SUBSTRING_INDEX(SUBSTRING_INDEX(date_sold,'-',2),'-',-1) month

            FROM
                sales

            JOIN
                third_party_sources
                ON sales.job_id = third_party_sources.job_id

            WHERE
                sales.is_contingent
            AND sales.date_sold BETWEEN :startDate AND :endDate

            UNION

            SELECT
                subdivision community
            ,  lot_number lot
            ,  buyer_name buyer
            ,  agent_initials agent
            ,  date_canceled date
            ,  null plan
            ,  null type
            ,  null price
            ,  'canceled' status
            ,  SUBSTRING_INDEX(SUBSTRING_INDEX(date_canceled,'-',2),'-',-1) month

            FROM
                cancellations

            JOIN
                third_party_sources
                ON cancellations.job_id = third_party_sources.job_id

            WHERE
                cancellations.date_cancelled BETWEEN :startDate AND :endDate

            ORDER BY
                date
            ,  status = 'sold'
            ,  status = 'contingent'
            ,  status = 'canceled'

Comment: See https://meta.stackoverflow.com/questions/333952/why-should-i-provide-a-minimal-reproducible-example-for-a-very-simple-sql-query
Answer: I think you want:
ORDER BY date, FIELD(status, 'sold', 'contingent', 'canceled')

This assumes that these are the only three values.  If there are more values, then your method would work . . . with DESC:
ORDER BY date, (status = 'sold') DESC, (status = 'contingent') DESC, (status = 'canceled') DESC


How to obtain border edges (CGAL) after deleting some faces?

Question: I have a Cdt from constrained delaunay triangulation. I need to obtain border edges which should be trivial: edges which have one face only but I don't know how to obtain these in CGAL:
for(Cdt::Finite_edges_iterator eit = cdt.finite_edges_begin(); eit != cdt.finite_edges_end(); ++eit)
{
    CD_Cdt::Edge ed = *eit;

    ???
}

red lines are the borders

Also one thing, using is_constrained() is useless because I already delete some faces before.
======== EDIT ========
user3146587's answer actually works but since I have deleted some faces I cannot detect the borders anymore:
std::vector<CDT::Face_handle> invalid_fhs;

// ... add faces to invalid_fhs

// I delete all face handles in invalid_fhs

for(int a = invalid_fhs.size() - 1; a >= 0; a--)
{ cdt.delete_face(invalid_fhs[a]); }

Comment: See the documentation for the advanced modifiers of a 2D triangulation data structure: "The following modifiers are required for convenience of the advanced user. They do not guarantee the combinatorial validity of the resulting triangulation." After deleting a face, you would need to triangulate the hole.
Comment: Instead of deleting the faces you are not interested in, you may want to label them as "removed" (the face type needs to be augmented with this information). The 2D triangulation data structure would then keep its integrity. And you could propagate the border of the complete constrained Delaunay triangulation to the subset of valid faces you want to keep.
Comment: thanks man, it's a big help!
Answer: Simply check whether the edge is adjacent to an infinite face. If so, then it is a boundary edge. Reminder: an edge is a pair of a handle to a face adjacent to the edge and the index of the other adjacent face as a neighbor of the first one.
for (CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(); eit != cdt.finite_edges_end(); ++eit)
{
    const CDT::Face_handle& fh = eit->first;

    if (cdt.is_infinite(fh) || cdt.is_infinite(fh->neighbor(eit->second)))
    {
        // Border edge
    }
}

Answer: OK I get it,
I found my mistake: Deleting face is a very very bad thing. Since it makes the cdt invalid and mess up everything.
So What I do:
(1) Instead of delete faces I just mark them to be outside the domain :
fit->set_marked(false);

(2) A border edge has one face is in the domain, another isn't :
for (Cdt::Finite_edges_iterator eit = cdt.finite_edges_begin(); eit != cdt.finite_edges_end(); ++eit)
{
    const Cdt::Face_handle& fh = eit->first;

    int ctr = 0;
    if(fh->is_in_domain())
    {
        ctr++;
    }
    if(fh->neighbor(eit->second)->is_in_domain())
    {
        ctr++;
    }

    if(ctr == 1)
    {
        Cdt::Segment s = cd_cdt.segment(eit);
        // yeah, I get my border !!
    }
}


printf gives a question mark when trying to locate a hex mem location

Question: I have tried to print out a hex memory location on linux (linux mint, kali linux, and ubunutu) using the following command :
printf "\xaa"
?

and all I get as an output is a question mark which means as I understand that the hex memory is not recognized ?
Comment: What is your locale settings and how is your terminal's encoding configured?
Comment: unidecode(utf-8)
Comment: please provide a link to the paper describing this vulnerability.
Comment: it's a simple c code : char buffer[8] with 8 words and i am using the gets fucntion and providing more than 8 word => smashing the stack.
Comment: You have to pipe the `printf` shell command's output into the program you're attacking, otherwise it just prints the output on the terminal.  There's no memory or asm involved in anything you posted in this question, just a `bash` command.
Answer: printf "\xaa" prints the character that corresponds to the hex code "aa" (170 in decimal), it has nothing to do with memory locations.
What you see depends on the encoding settings of your terminal. If your terminal is configured to display UTF-8, you probably see the question mark in a diamond:
�

It means the byte sequence aa doesn't correspond to any UTF-8 character.
You can also use a hexdump tool (e.g. xxd) to display the hex representation of the output:
$ printf '\xaa' | xxd
0000000: aa                                       .

For example, the sequence c2 a1 encodes LATIN SMALL LETTER A WITH ACUTE:
$ printf '\xc3\xa1\n'
á

Comment: `printf "\xaa"` doesn't load a real memory location.
Comment: the thing is that i'm trying to exploit a buffer overflow in my own created code and while executing the payload it gives the same thing, that's why i am trying to see the output of \xaa abd it should gives a balnk space or nothing as an output and not a question mark, when could i configure my terminal  ?
Comment: It depends on what terminal you're using.
Comment: i am on linux mint and using Gnome terminal 3.18.3 configured on Unicode(UTF-8) what do you suggest as a config ?
Comment: I still don't understand what you're trying to accomplish.
Comment: trying to exploit a buffer overflow vulnerability by loading a real memory location from the stack
Comment: @user3717888 when you type man printf (on the same command line)  do you see anything like this in there?        \xHH   byte with hexadecimal value HH (1 to 2 digits)
Comment: @old_timer yes i do see it  (\xaa) is just to test if hex are working with printf)


Azure DevOps Pipeline - ExtractFiles - multiple zips, to multiple extract folders

Question: I'm looking for a way to extract multiple tar files into their own folders with a single step in my pipeline.
I have a mono-repo pipeline that builds multiple Remix applications.  Each application packages their deployment as a TGZ file.  I have an artifact folder called bundles, that contains just the tgz files, each in its own subfolder.
ie:
bundles
\app1
---\app1.tgz
\app2
---\app2.tgz
In a later stage, I need to extract these tgz files so that I can run some scans.
My pipeline has the following steps.  The first pulls down the above folder into the job's working folder, bundles.  The second is intended to extract the TGZ.
<code>      - task: DownloadPipelineArtifact@2
        displayName: "Download Artifact: bundles"
        inputs:
          artifact: bundles
          path: bundles

      - task: ExtractFiles@1
        displayName: Test Extract
        condition: always()
        inputs:
          archiveFilePatterns: 'bundles/**/*.tgz'
          destinationFolder: 'bundle_extracts'
          cleanDestinationFolder: false
          overwriteExistingFiles: false
</code>
I do not ever know which apps will have a tgz in this folder, so I cannot reference any by full name.  Sometimes there will only be one tgz file.  Other times it could be more, but each will be in its own folder.
When there is only one tgz, the above 2nd step works fine.  But with multiple tgz files, i get errors because they both are extracting into the same destination folder, bundle_extracts.
So my ask is this...  How do I build this so that each tgz extracts into its own directory tree?
Ideally, the bundle_extracts folder would look something like below...
bundle_extracts
\app1
---{ all the contents from app1.tgz}
\app2
---{ all the contents from app2.tgz}
I have tries to put wildcards in the destinationFolder argument, but that didn't do anything.
I have attempted bash and powershell scripts but never seem to get the command lines correct.
Answer: Based on the documentation it seems to be not possible with this task.
But you can try command
<code>mkdir -p bundle_extracts && find bundles -type f -name "*.tgz" -exec sh -c 'ls $0 && mkdir -p "bundle_extracts/${0%.tgz}" && tar -xzf "$0" -C "bundle_extracts/${0%.tgz}"' {} \; </code>
It will

create bundle_extract directory if doesn't exist
find archives
extract them into individual directories in bundle_extract
Comment: Thank you.   It didn't work out of the box.  I needed to change the args from $1 to $0 to get it to work.  But I wouldn't have gotten close without your example.

Here is what worked for me (using bundles as my source directory).

mkdir -p bundle_extracts && find bundles -type f -name "*.tgz" -exec sh -c 'ls $0 && mkdir -p "bundle_extracts/${0%.tgz}" && tar -xzf "$0" -C "bundle_extracts/${0%.tgz}"' {} \;
Comment: Thanks. I updated my reply with your code.


HDMI-1 not connecting to monitor after update to 20.04 LTS

Question: Before the update from 18.04 to 20.04, I could connect to my old HANNS-G HSG1078 monitor with HDMI, now all connection is lost! The monitor still works fine with other computers.
Below all the background info I could find:
First, the result from xrandr -q --verbose:
HDMI-1 disconnected (normal left inverted right x axis y axis)
Identifier: 0x43
Timestamp:  787662
Subpixel:   unknown
Clones:
CRTCs:      0 1 2
Transform:  1.000000 0.000000 0.000000
            0.000000 1.000000 0.000000
            0.000000 0.000000 1.000000
           filter:
HDCP Content Type: HDCP Type0
    supported: HDCP Type0, HDCP Type1
Content Protection: Undesired
    supported: Undesired, Desired, Enabled
max bpc: 12
    range: (8, 12)
content type: No Data
    supported: No Data, Graphics, Photo, Cinema, Game
Colorspace: Default
    supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
aspect ratio: Automatic
    supported: Automatic, 4:3, 16:9
Broadcast RGB: Automatic
    supported: Automatic, Full, Limited 16:235
audio: auto
    supported: force-dvi, off, auto, on
link-status: Good
    supported: Good, Bad
CONNECTOR_ID: 92
    supported: 92
non-desktop: 0
    range: (0, 1)

And lspci | grep VGA gives:
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)
00:1f.5 Non-VGA unclassified device: Intel Corporation Device 9d24 (rev 21)

There seems to be 2 kernel drivers in use:
 lspci -nnk | grep -i vga -A3 | grep 'in use'
 Kernel driver in use: i915
 Kernel driver in use: ath9k

I tried specifying the resolution, using values from the HANNS-G manual (https://manualsbrain.com/en/manuals/1288455/?page=14) like so:
xrandr --addmode HDMI-1 "1680x1050"

But it still doesn't connect. Hoping that someone here can see what might be wrong.
Comment: I tried the screen and cable with a Windows machine and it worked, so this is not a hardware issue on that side.
Answer: Finally managed to restore the connection! Basically following these steps:
https://unix.stackexchange.com/questions/227876/how-to-set-custom-resolution-using-xrandr-when-the-resolution-is-not-available-i
gtf 1920 1080 60

# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
xrandr --addmode HDMI-1 "1920x1080_60.00"
xrandr --output HDMI-1 --mode "1920x1080_60.00"


How come C++11's ranged for loop has no allowance for iterating maps?

Question: This answer to this popular question gives the idiomatic use of a range-for loop with a map:
for (auto& kv : myMap) {
    // do stuff, where kv.first is the key and kv.second is the value
}

the thing is, it's usually the case that we want to have meaningful names for the key and the value (and not so much for their pair). That means writing, for example:
for (auto& kv : myMap) {
    auto planet_name = kv.first;
    auto distance_from_sun = kv.second;
    // do stuff with planet_name and distance_from_sun
}

and, well, you know - I don't want to write those entire three lines, especially since I don't care about kv (usually). I would expect something like
for (auto& {planet_name, distance_from_sun} : myMap) {
    // do stuff with planet_name and planet_distance_from_sun
}

or
for (tie{auto& planet_name,auto& distance_from_sun} : myMap) {
    // do stuff with planet_name and planet_distance_from_sun
}

or some other similar construction to work. If we can assign pairs, and if we can construct pairs when emplacing them in maps, why not be able to define pairs in a ranged for loop?
... or maybe C++11/14/17 does have some kind of trick for achieving this effect somehow?
Comment: You might be interested in [P0144R0](http://wg21.link/P0144R0).
Answer: C++17 will allow Structured Bindings:
for (auto&& [planet_name, distance_from_sun] : myMap) {
    // do stuff
}

Comment: Umm, is the use of double-reference after the auto something that's new to C++17? Also, do you know why the committee opted for square brackets? (blech)
Comment: It already exists in c++11 and are called rvalue-references. You could use `const auto&` too, however, auto&& would collapse to the appropriate type, making it more generic..
Comment: I know about rvalue references, I was just wondering if they had some special significance w.r.t. structured bindings.
Comment: Not necessarily. You can do it pretty much the same as you usually would, e.g. non-references (copying), const and non-const references, etc. Using rvalue-references in this case is simply the concisest (and i think most general) way to write it down. Ofcourse and as always, use it with caution.
Comment: Well, I've never used &&'s in ranged for loops, and [this answer](http://stackoverflow.com/a/13130795/1593077) suggests we probably shouldn't do it except when it's really necessary.
Comment: Like I said, use it with caution. Also, that answer does not really say that you should not do it based on disadvantages, other than that it may raise questions because auto&& is not yet familiar with programmers. This only fixes itself by exposing people to it and its workings.

In the end, whether you want to use it or not is up to your preference and (more importantly) the use-case. Using const auto& is perfectly fine if the situation allows for it, which is generally the case (or at least in my code).