text:
Q: Should composer.lock be committed to version control? I'm a little confused with composer.lock used in an application with a repository.
I saw many people saying that we should not .gitignore composer.lock from the repository.
If I update my libraries in my dev environment, I will have a new composer.lock but I will not be able to update them into production, will I ?
Won't it generate conflicts on this file ?

A: After doing it both ways for a few projects my stance is that composer.lock should not be committed as part of the project.
composer.lock is build metadata which is not part of the project. The state of dependencies should be controlled through how you're versioning them (either manually or as part of your automated build process) and not arbitrarily by the last developer to update them and commit the lock file.
If you are concerned about your dependencies changing between composer updates then you have a lack of confidence in your versioning scheme. Versions (1.0, 1.1, 1.2, etc) should be immutable and you should avoid "dev-" and "X.*" wildcards outside of initial feature development.
Committing the lock file is a regression for your dependency management system as the dependency version has now gone back to being implicitly defined.
Also, your project should never have to be rebuilt or have its dependencies reacquired in each environment, especially prod. Your deliverable (tar, zip, phar, a directory, etc) should be immutable and promoted through environments without changing.

A:
You then commit the composer.json to your project and everyone else on your team can run composer install to install your project dependencies.
The point of the lock file is to record the exact versions that are installed so they can be re-installed. This means that if you have a version spec of 1.* and your co-worker runs composer update which installs 1.2.4, and then commits the composer.lock file, when you composer install, you will also get 1.2.4, even if 1.3.0 has been released. This ensures everybody working on the project has the same exact version.
This means that if anything has been committed since the last time a composer install was done, then, without a lock file, you will get new third-party code being pulled down.
Again, this is a problem if you're concerned about your code breaking. And it's one of the reasons why it's important to think about Composer as being centered around the composer.lock file.

Source: Composer: It's All About the Lock File.

Commit your application's composer.lock (along with composer.json) into version control. This is important because the install command checks if a lock file is present, and if it is, it downloads the versions specified there (regardless of what composer.json says). This means that anyone who sets up the project will download the exact same version of the dependencies. Your CI server, production machines, other developers in your team, everything and everyone runs on the same dependencies, which mitigates the potential for bugs affecting only some parts of the deployments. Even if you develop alone, in six months when reinstalling the project you can feel confident the dependencies installed are still working even if your dependencies released many new versions since then.

Source: Composer - Basic Usage.

A: If you update your libs, you want to commit the lockfile too. It basically states that your project is locked to those specific versions of the libs you are using.
If you commit your changes, and someone pulls your code and updates the dependencies, the lockfile should be unmodified. If it is modified, it means that you have a new version of something.
Having it in the repository assures you that each developer is using the same versions.

A: *

*You shouldn't update your dependencies directly on Production.

*You should version control your composer.lock file.

*You shouldn't version control your actual dependencies.

1. You shouldn't update your dependencies directly on Production, because you don't know how this will affect the stability of your code. There could be bugs introduced with the new dependencies, it might change the way the code behaves affecting your own, it could be incompatible with other dependencies, etc. You should do this in a dev environment, following by proper QA and regression testing, etc.
2. You should version control your composer.lock file, because this stores information about your dependencies and about the dependencies of your dependencies that will allow you to replicate the current state of the code. This is important, because, all your testing and development has been done against specific code. Not caring about the actual version of the code that you have is similar to uploading code changes to your application and not testing them. If you are upgrading your dependencies versions, this should be a willingly act, and you should take the necessary care to make sure everything still works. Losing one or two hours of up time reverting to a previous release version might cost you a lot of money.
One of the arguments that you will see about not needing the composer.lock is that you can set the exact version that you need in your composer.json file, and that in this way, every time someone runs composer install, it will install them the same code. This is not true, because, your dependencies have their own dependencies, and their configuration might be specified in a format that it allows updates to subversions, or maybe even entire versions.
This means that even when you specify that you want Laravel 4.1.31 in your composer.json, Laravel in its composer.json file might have its own dependencies required as Symfony event-dispatcher: 2.*.
With this kind of config, you could end up with Laravel 4.1.31 with Symfony event-dispatcher 2.4.1, and someone else on your team could have Laravel 4.1.31 with event-dispatcher 2.6.5, it would all depend on when was the last time you ran the composer install.
So, having your composer.lock file in the version system will store the exact version of this sub-dependencies, so, when you and your teammate does a composer install (this is the way that you will install your dependencies based on a composer.lock) you both will get the same versions.
What if you wanna update? Then in your dev environment run: composer update, this will generate a new composer.lock file (if there is something new) and after you test it, and QA test and regression test it and stuff. You can push it for everyone else to download the new composer.lock, since its safe to upgrade.
3. You shouldn't version control your actual dependencies, because it makes no sense. With the composer.lock you can install the exact version of the dependencies and you wouldn't need to commit them. Why would you add to your repo 10000 files of dependencies, when you are not supposed to be updating them. If you require to change one of this, you should fork it and make your changes there. And if you are worried about having to fetch the actual dependencies each time of a build or release, composer has different ways to alleviate this issue, cache, zip files, etc.

A: For applications/projects: Definitely yes.
The composer documentation states on this (with emphasis):

Commit your application's composer.lock (along with composer.json) into version control.

Like @meza said: You should commit the lock file so you and your collaborators are working on the same set of versions and prevent you from sayings like "But it worked on my computer". ;-)
For libraries: Probably not.
The composer documentation notes on this matter:

Note: For libraries it is not necessarily recommended to commit the lock file (...)

And states here:

For your library you may commit the composer.lock file if you want to. This can help your team to always test against the same dependency versions. However, this lock file will not have any effect on other projects that depend on it. It only has an effect on the main project.

For libraries I agree with @Josh Johnson's answer.

A: If you're concerned about your code breaking, you should commit the composer.lock to your version control system to ensure all your project collaborators are using the same version of the code. Without a lock file, you will get new third-party code being pulled down each time.
The exception is when you use a meta apps, libraries where the dependencies should be updated on install (like the Zend Framework 2 Skeleton App). So the aim is to grab the latest dependencies each time when you want to start developing.
Source: Composer: It's All About the Lock File
See also: What are the differences between composer update and composer install?

A: Yes obviously.
That's because a locally installed composer will give first preference to composer.lock file over composer.json.
If lock file is not available in vcs the composer will point to composer.json file to install latest dependencies or versions.
The file composer.lock maintains dependency in more depth i.e it points to the actual commit of the version of the package we include in our software, hence this is one of the most important files which handles the dependency more finely.

A: There's no exact answer to this.
Generally speaking, composer shouldn't be doing what the build system is meant to be doing and you shouldn't be putting composer.lock in VCS. Composer might strangely have it backwards. End users rather than produces shouldn't be using lock files. Usually your build system keeps snapshots, reusable dirs, etc rather than an empty dir each time. People checkout out a lib from composer might want that lib to use a lock so that the dependencies that lib loads have been tested against.
On the other hand that significantly increases the burden of version management, where you'd almost certainly want multiple versions of every library as dependencies will be strictly locked. If every library is likely to have a slightly different version then you need some multiple library version support and you can also quickly see the size of dependencies needed flair out, hence the advise to keep it on the leaf.
Taking that on board, I really don't find lock files to be useful either libraries or your own workdirs. It's only use for me is in my build/testing platform which persists any externally acquired assets only updating them when requested, providing repeatable builds for testing, build and deploy. While that can be kept in VCS it's not always kept with the source tree, the build trees will either be elsewhere in the VCS structure or managed by another system somewhere else. If it's stored in a VCS it's debatable whether or not to keep it in the same repo as source trees because otherwise every pull can bring in a mass of build assets. I quite like having things all in a well arranged repo with the exception of production/sensitive credentials and bloat.
SVN can do it better than git as it doesn't force you to acquire the entire repo (though I suspect that's not actually strictly needed for git either but support for that is limited and it's not commonly used). Simple build repos are usually just an overlay branch you merge/export the build tree into. Some people combine exernal resources in their source tree or separate further, external, build and source trees. It usually serves two purposes, build caching and repeatable builds but sometimes keeping it separate on at least some level also permits fresh/blank builds and multiple builds easily.
There are a number of strategies for this and none of them particularly work well with persisting the sources list unless you're keeping external source in your source tree.
They also have things like hashes in of the file, how do that merge when two people update packages? That alone should make you think maybe this is misconstrued.
The arguments people are putting forward for lock files are cases where they've taken a very specific and restrictive view of the problem. Want repeatable builds and consistent builds? Include the vendor folder in VCS. Then you also speed up fetching assets as well as not having to depend on potentially broken external resources during build. None of the build and deploy pipelines I create require external access unless absolutely necessary. If you do have to update an external resource it's once and only once. What composer is trying to achieve makes sense for a distributed system except as mentioned before it makes no sense because it would end up with library dependency hell for library updates with common clashes and updates being as slow as the slowest to update package.
Additionally I update ferociously. Every time I develop I update and test everything. There's a very very tiny window for significant version drift to sneak in. Realistically as well, when semantic versioning is upheld, which is tends to be for composer, you're not suppose to have that many compatibility issues or breakages.
In composer.json you put the packages you require and their versions. You can lock the versions there. However those packages also have dependencies with dynamic versions that wont be locked by composer.json (though I don't see why your couldn't also put them there yourself if you do want them to be version locked) so someone else running composer install gets something different without the lock. You might not care a great deal about that or you might care, it depends. Should you care? Probably at least a little, enough to ensure you're aware of it in any situation and potential impact, but it might not be a problem either if you always have the time to just DRY run first and fix anything that got updated.
The hassle composer is trying to avoid sometimes just isn't there and the hassle having composer lock files can make is significant. They have absolutely no right to tell users what they should or shouldn't do regarding build versus source assets (whether to join of separate in VCS) as that's none of their business, they're not the boss of you or me. "Composer says" isn't an authority, they're not your superior officer nor do they give anyone any superiority on this subject. Only you know your real situation and what's best for that. However, they might advise a default course of action for users that don't understand how things work in which case you might want to follow that but personally I don't think that's a real substitute for knowing how things work and being able to properly workout your requirements. Ultimately, their answer to that question is a best guess. The people who make composer do not know where you should keep your composer.lock nor should they. Their only responsibility is to tell you what it is and what it does. Outside of that you need to decide what's best for you.
Keeping the lock file in is problematic for usability because composer is very secretive about whether it uses lock or JSON and doesn't always to well to use both together. If you run install it only uses the lock file it would appear so if you add something to composer.json then it wont be installed because it's not in your lock. It's not intuitive at all what operations really do and what they're doing in regards to the json/lock file and sometimes don't appear to even make sense (help says install takes a package name but on trying to use it it says no).
To update the lock or basically apply changes from the json you have to use update and you might not want to update everything. The lock takes precedence for choosing what should be installed. If there's a lock file, it's what's used. You can restrict update somewhat but the system is still just a mess.
Updating takes an age, gigs of RAM. I suspect as well if you pick up a project that's not been touched for a while that it looked from the versions it has up, which there will be more of over time and it probably doesn't do that efficiently which just strangles it.
They're very very sneaky when it comes to having secret composite commands you couldn't expect to be composite. By default the composer remove command appears to maps to composer update and composer remove for example.
The question you really need to be asking is not if you should keep the lock in your source tree or alternatively whether you should persist it somewhere in some fashion or not but rather you should be asking what it actually does, then you can decide for yourself when you need to persist it and where.
I will point out that having the ability to have the lock is a great convenience when you have a robust external dependency persistence strategy as it keeps track of you the information useful for tracking that (the origins) and updating it but if you don't then it's neither here not there. It's not useful when it's forced down your throat as a mandatory option to have it polluting your source trees. It's a very common thing to find in legacy codebases where people have made lots of changes to composer.json which haven't really been applied and are broken when people try to use composer. No composer.lock, no desync problem.

A: This has been fully answered here in the tread.
TL;DR
Definitely, You should vc the composer.lock
but what I am about to tell is the Why
composer.json role
composer.json is the entry point of the dependency manifest for the php packages.
it has been prescribing for package developers to follow semantic versioning.
so in this way if the api version (x) in x.y.z has been changed, you will be understand that there are things you have to be take care of or you could lock your version to some "~x" version.
not all packages following semversion
But, there were a lot of packages which didn't following the rule (5.3 & 5.4 api levels changed or broken)  :

*

*doesn't respect this semversioning principle (api level change)

*the new packages were not compatible with the oldest ones api (were not well tested and broken)

solution composer.lock
composer has came up with a solution. another file for locking the package versions. (composer.lock)
it holds the exact packages versions, so if any one want to have the same dependency versions can benefit from it.
keep the manifest the same between all deploys
its worth to mention one of the 12 factor modern web development principles is to keep the dependencies the same along all deploys, so every deploy can test it.
and there would be no contraction between them.
for this:

you have to keep the composer.lock under version control

and on the production just:
composer install --no-dev

install everything from your vc controlled lock file.
the deps you have been tested completely before.
end users of composer.json & composer.lock
the composer.json is a lean file for the developers to make conclusion about the deps and version.
while the composer.lock is intended to be used byt the deploys (machine) to install the exact version numbers on the deploy.
Analogy
its like the analogy for the ip & domains :
ip (lock file) intended to be used by machines
domain (json) intended to be used by humans
however both human (devs) and machines (deploys) can read and benefits from both but there is a more preferable version for each those.

A: For anyone on Heroku, the answer is clear "yes, it should be committed":

If composer.json specifies dependencies of any kind in its require section, the corresponding composer.lock that gets generated by running composer update must also be committed to the repository, or the push will be rejected.

Source: Heroku PHP Support: Activation.


text:
Q: Passing a function to a parameter in elisp I added the following code to my .emacs file.
(defun delete-right-window ()
  (interactive)
  (windmove-right)
  (delete-window))

(defun delete-left-window ()
  (interactive)
  (windmove-left)
  (delete-window))

(defun delete-below-window ()
  (interactive)
  (windmove-down)
  (delete-window))

(defun delete-above-window ()
  (interactive)
  (windmove-up)
  (delete-window))

(global-set-key (kbd "C-s-<right>") 'delete-right-window)
(global-set-key (kbd "C-s-<left>") 'delete-left-window)
(global-set-key (kbd "C-s-<down>") 'delete-below-window)
(global-set-key (kbd "C-s-<up>") 'delete-above-window)

As you can see, most of the codes are repetitive.
I read How do I pass a function as a parameter to in elisp? and tried to refactor the code to passing windmove-* function as follow:
(defun delete-other-window (callback)
  (interactive)
  (funcall callback)
  (delete-window))
...

(defun delete-right ()
  (delete-other-window 'windmove-right))

And I bound keystroke like this:
(global-set-key (kbd "C-s-<right>") 'delete-right)

But when I hit C-s-<right> it doesn't work, only display Wrong type argument: commandp, delete-right in the mini buffer.
What am I missing or what should I do to work the code correctly?

A: Here's a fix:
(defun delete-after (fn)
  `(lambda () (interactive)
      (,fn)
      (delete-window)))

(global-set-key (kbd "C-s-<right>") (delete-after 'windmove-right))
(global-set-key (kbd "C-s-<left>") (delete-after 'windmove-left))
(global-set-key (kbd "C-s-<down>") (delete-after 'windmove-down))
(global-set-key (kbd "C-s-<up>") (delete-after 'windmove-up))

A: To make a function into a command, you need to add the special form interactive to it:
(defun delete-right ()
  (interactive)
  (delete-other-window 'windmove-right))

A: The problem with your code is that it's the function bind to the key that should be interactive. Not one of the function it call:
(defun delete-other-window (callback)
  (funcall callback)
  (delete-window))

(defun delete-right ()
  (interactive)
  (delete-other-window 'windmove-right))

You could also use a macro:
(defmacro defun-delete-other-window (direction)
  `(defun ,(intern (concat "delete-" direction)) ()
     (interactive)
     (,(intern (concat "windmove-" direction)))
     (delete-window)))

(defun-delete-other-window "right")

redpajama_set_name: RedPajamaStackExchange


text:
Q: Child elements wrapping when animating I want to stop child elements from wrapping when animating. I want that they should stay as it is and not dance on the screen by wrapping. Here is my jsfiddle:
https://jsfiddle.net/DTcHh/39734/
This is my CSS:
body {
    font-family: "Lato", sans-serif;
}

.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
}

.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;

}

.sidenav a:hover {
    color: #f1f1f1;
}

.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}

@media screen and (max-height: 450px) {
  .sidenav {padding-top: 15px;}
  .sidenav a {font-size: 18px;}
}

Do you know how could I potentially fix this?
Edit: I don't want hacks by compulsorily aligning all content in my sidenav as display:block
Here is the updated fiddle: https://jsfiddle.net/DTcHh/39738/
I want the UL to show up inline-block. Is this possible?

A: Display block on your anchors should do it.
@media screen and (max-height: 450px)
(index):82
.sidenav a {
    font-size: 18px;
    display: block;
}

Edit - following comments
Further to the OP's requirements where the anchors should stay inline and not 'dance' I animated the position of the sidebar instead of the width.
function openNav() {
  document.getElementById("mySidenav").style.left = "0";
}

function closeNav() {
    document.getElementById("mySidenav").style.left = "-250px";
}

A: You just need to add display:block to the anchor's style
.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display:block; //this is added
}

Or you can add it those which are direct descendants of .sidenav
.sidenav > a {
    display:block; //this is added
}

Demo for I don't want hack

document.getElementById("open").onclick = openNav;

document.getElementById("close").onclick = closeNav;

function openNav() {
  document.getElementById("mySidenav").style.width = "250px";
}

function closeNav() {
  document.getElementById("mySidenav").style.width = "0";
}
body {
  font-family: "Lato", sans-serif;
}

.sidenav {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #111;
  overflow-x: hidden;
  transition: 0.5s;
  padding-top: 60px;
}

.sidenav a {
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 25px;
  color: #818181;
  display: block;
}

ul {
  display: block;
  white-space: nowrap;
}

ul li {
  display: inline-block;
}

.sidenav a:hover {
  color: #f1f1f1;
}

.sidenav .closebtn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  margin-left: 50px;
}

@media screen and (max-height: 450px) {
  .sidenav {
    padding-top: 15px;
  }
  .sidenav a {
    font-size: 18px;
  }
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />

I

don't

want

hack

  ×
  About
  Services
  Clients
  Contact

Animated Sidenav Example

Click on the element below to open the side navigation menu.

☰ open

Edit
Just add this line to your ul's css
ul {
  white-space: nowrap;
}


text:
Q: Sequence Diagrams ARGOUML Im having trouble using argoUML to draw  my squence diagrams. Does anyone know how I can generate a sequence diagram in argouml?

A: The best tool for sequence diagrams I ever found is Quick Sequence Diagram Editor - check it out: http://sdedit.sourceforge.net/index.html

A: If you are willing to use other tools, I used http://www.websequencediagrams.com/ which gave me what I needed.
I liked the fact that I don't have to download an executable, it generate the images in real time and I can save the text that generated the diagram (I can also right click and save the generated image as well).

A: If you are talking about the webstart version of argouml. And if you problem is not even able to create a sequence diagram. Please try download one instead of start it via webstart.
My locally installed copy have no trouble creating sequence diagram, while the webstarted one can't.

A: In my case the zipped binary package worked correctly, so that I could create a sequence diagram, though the setup and Java Web Start versions didn't work.
Here's the link to a binary package of the latest stable version.
Here's a link to the page with all available downloads for the last stable version


text:
Q: How to remove duplicate value in an salesforce custom object KYC is a custom object, Kyc is having a lookup with account and lead. I have written 2 triggers to create KYC records one on the lead and another on the account. Now when the lead is created KYC record is generated and after converting the lead to an account it's creating another KYC record.
A lead/account can have only one KYC record.
**For Lead to account conversion, the lead's additional Information record will be migrated account's additional information record.
How do overcome this challenge?


text:
Q: How to plot torsion prismatic beam I dont know why dont work but I want to animate torsion prismatic beam.
a = 1; b = 2; L = 10; G = 1; dx = dy = dz = 0.25; J = 2.1849801331564294`;
Clear[x, y, z, T]; k = T/( G J);
phi = (32 G k a)/Pi^3 Sum[1/n^3 (-1)^((n - 1)/2) (1 - Cosh[n Pi y/(2 a)]/
Cosh[n Pi b/(2a)]) Cos[(n Pi x)/(2 a)], {n, 1, 10, 2}];
tauyz = -D[phi, x]; tauxz = D[phi, y];
gammayz = tauyz/G;
gammaxz = tauxz/G;
Rotate[{x_, y_, z_}, Theta_] := {x Cos[Theta] - y Sin[Theta],
x Sin[Theta] + y Cos[Theta], z};
Off[Graphics3D::"gprim"];
Do[Show[Graphics3D[Table[alpha = 0.5 k z;
p1 = p2;
p2 = Map[({x, y} = #;
Rotate[{x + 0 gammaxz/2,
y + 0 gammayz/2,
z + (x gammaxz + y gammayz)/
  2}, alpha]) &,
Flatten[{Table[{x, -b/2}, {x, -a/2, a/2 - dx, dx}],
Table[{a/2, y}, {y, -b/2, b/2 - dy, dy}],
Table[{x, b/2}, {x, a/2, dx - a/2, -dx}],
Table[{-a/2, y}, {y, b/2, dy - b/2, -dy}]}, 1]];
n = Length[p2];
If[z == 0, Polygon[p2],
  Table[Polygon[{p1[[i]], p2[[i]], p2[[Mod[i, n] + 1]],
     p1[[Mod[i, n] + 1]]}], {i, 1, n}]], {z, 0, L, dz}],
ViewPoint -> {-1, 1, 1}, ViewVertical -> {0, 1, 0}, Axes -> True,
AxesLabel -> {"x", "y", "z"},
PlotRange -> {{-a, a}, {-b, b}, {0, L}}]], {T, 0, 1, 0.1}];
SelectionMove[
EvaluationNotebook[], All, GeneratedCell];
FrontEndTokenExecute["CellGroup"];
FrontEndTokenExecute["OpenCloseGroup"];
FrontEndTokenExecute["SelectionAnimate"];

A: I think this code might be old version. You made some mistake so I changed your code like this.

*

*Rotate -> rotate

*Do -> Table

*SelectionAnimate -> Manipulate or Animate
We can give change variable T in Manipulate but that computation time is so long. Thus I set the Graphics3D-s to frames and apply Manipulate or Animate.
Have try like this.
a = 1; b = 1; L = 10; G = 1; dx =
 dy = dz = 0.25; J = 2.1849801331564294`;
Clear[x, y, z, T];
k = T/(G J);
phi = ((32*G*k*a)*Sum[((-1)^((n - 1)/2)*(1 - Cosh[(n*Pi*y)/(2*a)]/
                      Cosh[(n*Pi*b)/(2*a)])*Cos[(n*Pi*x)/(2*a)])/
       n^3, {n, 1, 10, 2}])/Pi^3;
tauyz = -D[phi, x]; tauxz = D[phi, y];
gammayz = tauyz/G;
gammaxz = tauxz/G;
rotate[{x_, y_, z_}, Theta_] := {x Cos[Theta] - y Sin[Theta],
   x Sin[Theta] + y Cos[Theta], z};
Off[Graphics3D::gprim];

frames = Table[
   Graphics3D[
    Table[alpha = 0.5 k z; p1 = p2;
     p2 = (({x, y} = #1;
          rotate[{x + (0 gammaxz)/2, y + (0 gammayz)/2,
            z + 1/2 (x gammaxz + y gammayz)}, alpha]) &) /@ Flatten[{
         Table[{x, -(b/2)}, {x, -(a/2), a/2 - dx, dx}],
         Table[{a/2, y}, {y, -(b/2), b/2 - dy, dy}],
         Table[{x, b/2}, {x, a/2, dx - a/2, -dx}],
         Table[{-(a/2), y}, {y, b/2, dy - b/2, -dy}]}, 1];
     n = Length[p2];
     If[z == 0, Polygon[p2],
      Table[Polygon[{p1[[i]], p2[[i]], p2[[Mod[i, n] + 1]],
         p1[[Mod[i, n] + 1]]}], {i, 1, n}]], {z, 0, L, dz}],
    ViewPoint -> {-1, 1, 1}, ViewVertical -> {0, 1, 0}, Axes -> True,
    AxesLabel -> {"x", "y", "z"},
    PlotRange -> {{-a, a}, {-b, b}, {0, L}}],
   {T, 0, 1, 0.1}];

You can manipulate motion with this code.
Manipulate[frames[[i]], {i, 1, Length[frames], 1}]

or
Animate[frames[[i]], {i, 1, Length[frames], 1},
 AnimationRunning -> False]


text:
Q: swift - Optional to Bool Conversion Causes Error I'm having trouble checking if an optional exists or not in swift.
var myString:String? = "Hello"

if myString {
    println(myString)
}

When I use this code in a playground I get

note: optional type 'String?' can not be used as a boolean; test for '!= nil' instead
  if myString {
     ^
     (        != nil)

and

error: type 'String?' does not conform to protocol 'BooleanType.Protocol'
  if myString

The error suggests I use
myString != nil

but the documentation says this current code should be OK. Am I doing something wrong here?

A: From Xcdoe6-beta5 release notes

Optionals no longer conform to the BooleanType (formerly LogicValue)
protocol, so they may no longer be used in place of boolean
expressions (they must be explicitly compared with  v != nil). This
resolves confusion around Bool? and related types, makes code more
explicit about what test is expected, and is more consistent with the
rest of the language.
Note that ImplicitlyUnwrappedOptional still
includes some BooleanType functionality. This  issue will be resolved
in a future beta. (17110911)

So use myString != nil as it suggested. And always refer to latest documentation because Swift still in beta stage.


text:
Q: Making a matplotlib line plot of a multindexed Dataframe with different lines per row and whose index serves as X-axis I have this dataframe.

I've tried using ax.plot in order to make a line plot where the Year column is the x axis, and where each country serves as a different line in the plot.
I've attempted using reset_index, to no avail:

A: Please check this snippet. You can also achieve your result using Matplotlib

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
idx = pd.MultiIndex.from_product([['Albania', 'Zimbabwe'],[2016,2017,2018,2019,2020]],names=['Country', 'Year'])
col = ['Score']
df = pd.DataFrame('-', idx, col)
df['Score']=[28.4,28.9,30,30.3,27.1,20,21.8,23.1,22.3,20]
fig, ax = plt.subplots(figsize=(5, 4))
df.reset_index().pivot('Year','Country','Score').plot(ax=ax, title='MultiIndex Plot', grid=True)
ax.legend(bbox_to_anchor=(0.675, 1.175),loc='upper left')
years = np.arange(2016, 2021)
ax.set_xticks(years)
plt.show()

A: Here is a way to create such a lineplot using seaborn. First some toy data are created with a similar format.
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns

years = np.arange(2016, 2021)
num_countries = 10
num_years = len(years)

df = pd.DataFrame({'Country': np.repeat([f'country {i}' for i in range(1, num_countries + 1)], num_years),
                   'Year': np.tile(years, num_countries),
                   'Score': np.random.uniform(20, 50, num_years * num_countries)})
df.set_index(['Country', 'Year'], inplace=True)
df.reset_index(inplace=True)

fig, ax = plt.subplots(figsize=(12, 4))
sns.lineplot(x='Year', y='Score', hue='Country', data=df.reset_index(), ax=ax)
ax.set_xticks(years)
ax.legend(loc='upper left', bbox_to_anchor=[1.02, 1.02], ncol=2)
plt.tight_layout()
plt.show()


text:
Q: Returning HTML with Azure Serverless Function req.body I've got some TIF files in Azure Blob Storage. I'd like to display them in the browser via a link embedded in a spreadsheet. The simplest way to do this should be to take the file code as a request parameter and return the properly formatted HTML, right?
So right now I've got it returning a req.body with some HTML. Unfortunately, the HTML just shows up as a string in the browser. How do I make it render as HTML with minimal rigamarole?
Here's my code:
if (req.query.blob) {
    let blob = req.query.blob;
    context.res = {
        // status: 200, /* Defaults to 200 */
        body: `<object width=200 height=200
                data="<baseaddress>/${blob}.tif" type="image/tiff">
                <param name="src" value="<baseaddress>/${blob}.tif">
                <param name="negative" value="yes">
                </object>`
    };
}

A: You need to set the headers to specify the content type to HTML and the response must be a full valid HTML page (with the  tag and the rest).
Example:
module.exports.hello = (event, context, callback) => {

  const html = `
    <!doctype html>

        <title>The Page Title</title>

Hello

    `;

  const response = {
    statusCode: 200,
    headers: {
      'Content-Type': 'text/html'
    },
    body: html
  };

  callback(null, response);
};


text:
Q: what is the useragent to add in .htaccess detection file to detect webos devices? I am currently using detection .htaccess file from detectmobilebrowsers.com to detect most mobile devices but it doesn´t work on webos browsers.
Code I'm using:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|mobile.+firefox|netfront|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-) [NC]
RewriteRule ^$ http://m.website.com [R,L]

A: You need to add the condition:
RewriteCond %{HTTP_USER_AGENT} (webOS/[12]|wOSBrowser) [NC,OR]

to the top of your list of conditions.

A: I think besides webOS user-agent missing another problem is in your rule:
RewriteRule ^$ http://m.website.com [R,L]

Which will only redirect your home page. It should be replaced with:
RewriteRule ^ http://m.website.com [R,L]

To make this mobile redirection only dependent on user agent strings.


text:
Q: How to automatically capture \prevgraf value (inside xparse environment) every time text ends with \par? I need to declare an environment with \NewDocumentEnvironment such that every \par provided by the user inside that environment would automatically set an integer variable (inside environment-declaration code) to \prevgraf value. But for some reason \prevgraf is always zero when it's inside \everypar (in environment-declaration code). Of course I can do \par\int_set:Nn\myNum{\prevgraf} (in user-text provided to the environment) but I cannot have anything else there following \par (user is not allowed to directly use code in the text to set internal \myNum value).
\documentclass[varwidth]{standalone}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{xcolor}
\begin{document}
\ExplSyntaxOn

\int_new:N\myNum % THIS SHOULD HOLD LAST \prevgraf
\NewDocumentEnvironment{myEnv}{+b}
  { \parbox{\hsize}
      { \everypar
          { % simply display \prevgraf value (in red)
            \textcolor{red}
              { \bf\the\prevgraf\newline
              }
             % capturing prevgraf here doesn't work because prevgraf is always zero
             \int_set:Nn\myNum{\prevgraf}
          }
        #1 % DISPLAY ENVIRONMENT CONTENTS
      }
  } {}

\ExplSyntaxOff

\begin{myEnv}
  When PNG development started in early 1995, developers decided
   not to incorporate support for animation, because the majority
    of the PNG developers felt that overloading a single file type
     with both still and animation features is a bad design.
      \par % WE CAN CAPTURE HERE MANUALLY BUT WE WON'T,
       %  BECAUSE WE NEED TO CAPTURE AUTOMATICALLY WITH \par ALONE
  PNG supports palette-based images (with palettes of 24-bit RGB or
   32-bit RGBA colors), grayscale images (with or without alpha channel
    for transparency), and full-color non-palette-based RGB/RGBA images
     (with or without alpha channel).
      \par % WE CAN CAPTURE HERE MANUALLY BUT WE WON'T,
       %  BECAUSE WE NEED TO CAPTURE AUTOMATICALLY WITH \par ALONE
\end{myEnv}

\end{document}

Both \prevgraf values after \par are actually 4, not 0. Why are they zeros, and how to capture the real values without adding any code after \par?

A: There are two problems: First, \everypar is executed at the beginning of every paragraph, after the paragraph already started.
Because the paragraph already started, \prevgraf is no longer set.
Instead you can redefine \par to save the value. Then you have to save the value first before adding any output, otherwise your \textcolor starts a new paragraph and resets \prevgraf.
Independent from the actual problem you shouldn't use \bf with LaTeX. Use \textbf{...} or \bfseries instead.
For example:
\documentclass[varwidth]{standalone}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{xcolor}
\begin{document}
\ExplSyntaxOn

\int_new:N\l__my_int % THIS SHOULD HOLD LAST \prevgraf
\NewDocumentEnvironment{myEnv}{+b}
  { \parbox{\hsize}
      { \cs_set_eq:NN \__bp_preserved_par: \par
        \cs_set:Npn \par {
          \__bp_preserved_par:
          \int_set:Nn \l__my_int { \prevgraf }
          \textcolor{red}
            { \textbf
              { \int_use:N \l__my_int \newline
              }
            }
        }
        #1 % DISPLAY ENVIRONMENT CONTENTS
      }
  } {}

\ExplSyntaxOff

\begin{myEnv}
  When PNG development started in early 1995, developers decided
   not to incorporate support for animation, because the majority
    of the PNG developers felt that overloading a single file type
     with both still and animation features is a bad design.
      \par % WE CAN CAPTURE HERE MANUALLY BUT WE WON'T,
       %  BECAUSE WE NEED TO CAPTURE AUTOMATICALLY WITH \par ALONE
  PNG supports palette-based images (with palettes of 24-bit RGB or
   32-bit RGBA colors), grayscale images (with or without alpha channel
    for transparency), and full-color non-palette-based RGB/RGBA images
     (with or without alpha channel).
      \par % WE CAN CAPTURE HERE MANUALLY BUT WE WON'T,
       %  BECAUSE WE NEED TO CAPTURE AUTOMATICALLY WITH \par ALONE
\end{myEnv}

\end{document}

In case you are wondering why there is a 5 instead of a 4 for the second paragraph: The line containing the 4 counts as an additional line in the second paragraph.


text:
Q: Python - TypeError: generateID() takes 3 positional arguments but 4 were given My script contains 4 classes and 1 interface. I have a method generateID which generate an ID according to outputmode, a mode (modeCB) and a dataframe (data_h_f). When I execute my class I have this error :

TypeError: generateID() takes 3 positional arguments but 4 were given

I'm beginner in python especially objected oriented programming, I don't know if the design of my script is good. I have 3 arguments for my method generateID() and 3 parameters everywere.
class OutputMode(object):
    def __init__(self,name,startTime,intervalSeconds,timezone):
    ...

class IDCalculation_I:
    def generateID(outputMode,modeCB,data_h_df):
        pass

class IDCase1(IDCalculation_I):
    def generateID(outputMode,modeCB,data_h_df):
    ...

class Fingerprinter(object):
    def __init__(self,outputMode,modeCB=CONST_MODE_CONT):
        self._modeCB     = modeCB
        self._outputMode = outputMode

    def generateID(outputMode,modeCB,data_h_df):
        pass

    def run(self):
        return self.generateID(outputMode,modeCB,data_h_df)

def main():
    outputMode = OutputMode('EEA','06:00',8*3600,pytz.timezone('Europe/Paris'))
    f1 = Fingerprinter(outputMode, CONST_MODE_CONT)
    t = f1.generateID(outputMode,CONST_MODE_CONT,data_h_df)

if __name__ == '__main__':
    main()

A: class IDCalculation_I:
    def generateID(self,outputMode,modeCB,data_h_df):
        pass

class IDCase1(IDCalculation_I):
    def generateID(self, outputMode,modeCB,data_h_df):
    ...

class Fingerprinter(object):
    def __init__(self,outputMode,modeCB=CONST_MODE_CONT):
        self._modeCB     = modeCB
        self._outputMode = outputMode

    def generateID(self,outputMode,modeCB,data_h_df):
        pass

    def run(self):
        return self.generateID(outputMode,modeCB,data_h_df)

You forgot to add self. Or use @staticmethod decorator if you don't want to add self.
class IDCalculation_I:
    @staticmethod
    def generateID(outputMode,modeCB,data_h_df):
        pass

class IDCase1(IDCalculation_I):
    @staticmethod
    def generateID(outputMode,modeCB,data_h_df):
    ...

class Fingerprinter(object):
    def __init__(self,outputMode,modeCB=CONST_MODE_CONT):
        self._modeCB     = modeCB
        self._outputMode = outputMode

    @staticmethod
    def generateID(outputMode,modeCB,data_h_df):
        pass

    def run(self):
        return self.generateID(outputMode,modeCB,data_h_df)


text:
Q: Use SQL Server 2012 Express LocalDB in Visual Studio 2015 I need to create a Database in Visual Studio 2015 with SQL Server 2012 Express LocalDB for compatibility issues with previous versions of Visual Studio.
From what I found, if I need to connect a table from previous versions of Visual Studio, I just need to change the Data Source from (localdb)\v11.0 to (LocalDB)\MSSQLLocalDB.
Now I want to know if I can make the opposite, changing the Data Source from the Database that I created in Visual Studio 2015 to (localdb)\v11.0, will it work without problems and without lost of data if I use it in previous versions of Visual Studio?

A: Tested with a friend how only has Visual Studio 2013 installed and it appear that it doesn't work..


text:
Q: How to customize facebook share dialogue in Qualtrics I'm making a survey on Qualtrics and would like to distribute it via facebook. Is there a way to add open graph tags (meta tags) to my qualtrics survey so the shared post includes a image? I see that qualtrics automatically saves the survey title and description as meta tags, but I do not know how to either a) remove the blank image preview that is automatically generated when sharing the link or b) add a meta tag to display an image. Thanks for any advice!!

A: I don't know if it will work, but you could try putting the meta tags in the survey header under Look&Feel/Advanced.


text:
Q: Xamarin iOS only crash physical iPhone when you open an app I'm facing a strange error. App only crashes on physical device. But iOS simulator does not. It working fine.
The strange thing is it crashes when you open an app and FinishedLaunching(UIApplication app, NSDictionary options) method does not call at all.
What possibilities might have this issue?

A: One of the third-party iOS library (nuget package) was configured to iOS-Simulator. not physical iOS.
After the package author released hot-fix, it resolved.

A: try to change the linker Behaviour  use the SDK-Only
go to Xamarin.iOS solution select ios build choose linker behaviour and change it


text:
Q: Flutter widgets are not getting laid out correctly The ListView widget which is getting generated as part of the CourseStream Stream Builder isn't getting laid out correctly, as shown in the picture below. I don't see any errors within the Debug Console.

Below is the code for the CourseStream which contains the ListView.
final coursesCollection = FirebaseFirestore.instance.collection('courses').limit(10).where('courseLive', isEqualTo: true);

class CourseStream extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return StreamBuilder<QuerySnapshot>(
      stream: coursesCollection.snapshots(),
      builder: (context, snapshot) {
        if (!snapshot.hasData) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return Center(
              child: CircularProgressIndicator(backgroundColor: kBrandColor),
            );
          }
        }

        final courseListStream = snapshot.data!.docs.map((course) {
          return CourseData.fromDocument(course);
        }).toList();

        List<BadgedCourseCard> courseCards = [];

        for (var course in courseListStream) {
          final courseDocID = course.courseDocID;
          final courseID = course.courseID;
          final courseTitle = course.courseTitle;
          final courseDescription = course.courseDescription;
          final courseSubTitle = course.courseSubTitle;
          final courseBadge = course.courseBadge;
          final courseLevel = course.courseLevel;
          final coursePaid = course.coursePaid;
          final courseImage = course.courseImage;
          final courseBgColor = hexToColor(course.courseBackgroundColor.toString());
          final courseBgColor1 = hexToColor(course.courseBgColor1.toString());
          final courseBgColor2 = hexToColor(course.courseBgColor2.toString());
          final courseFgColor = hexToColor(course.courseFgColor.toString());
          final courseDeliveryFormat = course.courseDeliveryFormat;
          final courseLive = course.courseLive;

          final badgedCourseCard = BadgedCourseCard(
            courseTitle: courseTitle.toString(),
            courseTitleTextColor: courseFgColor,
            cardBackgroundColor: courseBgColor,
            courseImage: courseImage.toString(),
            courseCardTapped: () => print("Course Card Tapped"),
            courseBookmarkTapped: () => print("Course Bookmark Tapped"),
          );

        return ListView(
            physics: BouncingScrollPhysics(),
            scrollDirection: Axis.horizontal,
            children: courseCards,
        );
      },
    );
  }
}

Below is the code where the ListView is getting consumed.
class AppHome extends StatefulWidget {
  @override
  _AppHomeState createState() => _AppHomeState();
}

class _AppHomeState extends State<AppHome> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0.0,
        leading: Padding(
          padding: EdgeInsets.only(left: 2.5.w),
          child: IconButton(
            onPressed: () => Navigator.of(context).push(ScaledAnimationPageRoute(AppDrawer())),
            icon: Icon(
              Icons.sort,
              color: Theme.of(context).iconTheme.color,
              size: 6.5.w,
            ),
          ),
        ),
        actions: <Widget>[
          Padding(
            padding: EdgeInsets.only(right: 2.5.w),
            child: IconButton(
              onPressed: null,
              icon: Icon(
                Icons.search,
                color: Theme.of(context).iconTheme.color,
                size: 6.5.w,
              ),
            ),
          ),
        ],
      ),
      body: Padding(
        padding: EdgeInsets.symmetric(horizontal: 5.w),
        child: Column(
          children: [
            CardHeader(
              leadingText: "Courses",
              trailingText: "View All",
            ),
            SizedBox(height: 1.h),
            Expanded(child: CourseStream()),
            SizedBox(height: 2.h),
          ],
        ),
      ),
    );
  }
}

I'm not sure from where exactly the space is getting added below the Courses row. How can I fix it?

A: As discussed in the chat, this may be a solution for it.
Remove Expanded from Column() and wrap ListView with SizedBox so that you can limit height.
return SizedBox(
       height: 20.5.h,
       child: ListView(
         physics: BouncingScrollPhysics(),
         scrollDirection: Axis.horizontal,
         children: courseCards,
      ),
);


text:
Q: Count the number of whitespaces in a file File test
musically us
challenged a goat that day
spartacus was his name
ba ba ba blacksheep

*

*grep -oic "[\s]*" test

*grep -oic "[ ]*" test

*grep -oic "[\t]*" test

*grep -oic "[\n]*" test
All give me 4, when I expect 11
grep --version -> grep (BSD grep) 2.5.1-FreeBSD
Running this on OSX Sierra 10.12
Repeating spaces should not be counted as one space.

A: If you are open to tricks and alternatives you might like this one:
$ awk '{print --NF}' <(tr -d '\n' <file)
11

Above solution will count "whitespace" between words. As a result for a string of 'fifteen-->               <--spaces' awk will measure 1, like grep.
If you need to count actual single spaces you can use this :
$ awk -F"[ ]" '{print --NF}' <<<"fifteen-->               <--spaces"
15
$ awk -F"[ ]" '{print --NF}' <<<"  2  4  6  8  10"
10
$ awk -F"[ ]" '{print --NF}' <(tr -d '\n' <file)
11

One step forward, to count single spaces and tabs:
$ awk -F"[ ]|\t" '{print --NF}' <(echo -e "  2  4  6  8  10\t12  14")
13

A: tr is generally better for this (in most cases):
tr -d -C ' ' <file | wc -c

The grep solution relies on the fact that the output of grep -o is newline-separated — it will fail miserably for example in the following type of circumstance where there might be multiple spaces:
v='fifteen-->               <--spaces'

echo "$v" | grep -o -E ' +' | wc -l

echo "$v" | tr -d -C ' ' | wc -c

grep only returns 1, when it should be 15.
EDIT: If you wanted to count multiple characters (eg. TAB and SPACE) you could use:
tr -dC $'[ \t]' <<< $'one \t' | wc -c

A: The -c option counts the number of lines that match, not individual matches. Use grep -o and then pipe to wc -l, which will count the number of lines.
grep -o ' ' test | wc -l

A: Just use awk:
$ awk -v RS=' ' 'END{print NR-1}' file
11

or if you want to handle empty files gracefully:
$ awk -v RS=' ' 'END{print NR - (NR?1:0)}' /dev/null
0


text:
Q: Tomcat understands amq:broker but Eclipse marks errors in schema When working with ActiveMQ in Eclipse, you might sometimes get a schema parsing error as such:
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The matching wildcard is strict, but no declaration can be found for element 'amq:broker'.

However, the project deploys successfully in Tomcat.

A: To fix this, you must associate the ActiveMQ XSD URL with the schema.
Go to XML->XML Catalog in Preferences, and add a User Specified Entry.
Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Namespace Name
Key: http://activemq.apache.org/schema/core

Then add a second one:
Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Schema Location
Key: http://activemq.apache.org/schema/core/activemq-core.xsd

Hit OK.
If you have this same error and Tomcat fails, open the applicationContext-jms.xml file which triggers the error and replace:
http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd

with
http://activemq.apache.org/schema/core/activemq-core.xsd


text:
Q: Spacy : apply pipeline to each row of a dataframe I have a big dataframe (over 20 000 rows) and I want to apply Spacy (v3) to it. I need all the components of the spacy pipeline. I already tried with apply (row-wise) but it takes forever:
df = pd.read_csv(f, sep='\t', encoding='utf-8')
df['Text_spacy'] = df['Text_initial'].apply(lambda x: nlp(x))

display(df)

The column Text initial contains something like :

Text_initial

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Ut enim ad minim veniam.Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Sunt in culpa qui officia deserunt mollit anim id est laborum.

Pharetra magna ac placerat vestibulum lectus. Nec feugiat nisl pretium fusce id velit ut. Amet justo donec enim diam vulputate ut pharetra.Nibh venenatis cras sed felis eget velit aliquet sagittis id.

Notice that in every row, the phrases are already separated by a \n. The segmentation will be made based on the \n. Thus, my question is:
Is there a faster way to apply spacy to each row of the df in a loop ? Iterrows() is even slower. Would a batch (e.g. the first 100 rows, then the next 100 ... till the end) be faster ?

A: nlp.pipe() expects an iterable of strings, so try this:
df = pd.read_csv(f, sep='\t', encoding='utf-8')
df['Text_spacy'] = [d for d in nlp.pipe(df['Text_initial'])]

Although the question is what do you want to get from SpaCy (Tokenization, Lemmatization, POS etc.). Because applying it like this will just put the Doc objects into your DataFrame (which are then represented as the tokens string tuples for printing).


text:
Q: Thymeleaf: Detect hardcoded text Is there a chance to automate the search for non-localized text on startup in Thymeleaf Templates and log occurrences?
My Infrastructure: Ant, Spring, Thymeleaf.

A: Unfortunately there is no clean documented way in which to do it (that I know of).
Having said that, I have done something similar where I wanted to check the template for something and log an occurrence, however the implementation is ugly.
I have to warn you that this is beyond horrible and because it is not standard is likely to break in future releases so I would use sparingly, and definitely not use in any production code.
This requires for you template resolver to be cacheble to be true - org.thymeleaf.templateresolver.TemplateResolver#setCacheable(true) the default is true.
I was able to do it by extending org.thymeleaf.cache.StandardCacheManager (you need to set the cache manager on the org.thymeleaf.TemplateEngine) and overriding initializeTemplateCache() that returned a custom version of org.thymeleaf.cache.StandardCache. My implementation of the cache override the put(..) method which passed in a org.thymeleaf.Template as the value.
That then has org.thymeleaf.dom.Document accessible via getDocument() and from there you can recursivly iterate through the children (some of which will be org.thymeleaf.dom.AbstractTextNode). In your case you may also want to iterate through all the attributes on element nodes as well.
For you, you will then have to write some logic to determine if the text is not going to be localised, working out whether the #{} expression is not being used or if that expression in not in a th:...="#{}" tag or being inline [[#{}]]
Ugly I know but it works for me. If anyone has a cleaner solution I'm all ears.


text:
Q: Sendgrid Always Sends Text Email I have an HTML sendgrid template and am sending it via Node.js using the npm package 'sendgrid'. Problem is that I always receive the email as text format not HTML even though the template has HTML.
Code:
var email = new sendgrid.Email({
    to      : 'me@here.com',
    from    : 'you@there.com',
    subject : 'Saying Hi with HTML Template',
    text    : 'Body'    //This is required
});

email.addFilter('templates', 'enable', 1);
email.addFilter('templates', 'template_id', '12131331.....');
email.addSubstitution('{{TOKEN1}}', 'value');

sendgrid.send(email, function(err, json) {
    if (err) { console.error(err); }
    console.log(json);
});

Template

<title></title>

This is a test

{{TOKEN1}}

There

<%body%>

Is there a code parameter I'm supposed to set? Or a setting on the template itself to allow HTML?

A: According to the documentation. You only use the text property if you're sending plain-text. Instead, use the html property to create an HTML message. You can use the built in setHtml method like the following:
var email     = new sendgrid.Email();
email.setHtml('
Some html
');
sendgrid.send(email, function(err, json) { });

A: In case you are not using SendGrid API but System.Net.Mail classes with sendgrid below setting will do it:
EmailMessage.IsBodyHtml = true;


text:
Q: Excel (or) Power BI, Rolling Sum Is there any way in Excel Pivot or Power BI to do the rolling sum of the given data (let say monthly)?
Let say I have a list of cases, each row represent case count and amount. The project start date and end date varied as follows.

For, simplicity, if I demonstrate the data graphically, would be as follows.

What I'm try to do is to aggregate how much case counts and amounts in total for each chunk of month.
My goal is to produce below list using Pivot (if Pivot is not possible, then by Power Query) directly.

I could produce monthly aggregates using Filter function and Sum, then pivot that data to produce above result.
If there is a direct way of producing that aggregates in one step, that would be better. Please suggest it for me.
Please see sample data in below link
https://docs.google.com/spreadsheets/d/1vAKElb2-V_If-MMlPwHk_VGhYr8pkOg_gQfRYRrkbtc/edit?usp=share_link
Excel file in Zip
https://drive.google.com/file/d/1QqgNUrJlBuvin7iecsxsvexrGZXFIt-g/view?usp=share_link
Thank you in advance
LuZ

A: You can load the data into powerquery and transform from left to data table on right

code for that is
let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Custom1" = Table.AddColumn(Source, "Date", each List.Generate(()=>[x=[Start Date],i=0], each [i]<12, each [i=[i]+1,x=Date.AddMonths([x],1)], each [x])),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom1", "Date"),
#"Added Custom" = Table.AddColumn(#"Expanded Custom", "Year", each Date.Year([Date])),
#"Added Custom2" = Table.AddColumn(#"Added Custom", "Month", each Date.Month([Date])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"Start Date", "End Date", "Date"})
in  #"Removed Columns"

Afterwards, load the powerquery back into excel as pivot report and generate your table

Alternatively, just use use
let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Custom1" = Table.AddColumn(Source, "Date", each List.Generate(()=>[x=[Start Date],i=0], each [i]<12, each [i=[i]+1,x=Date.AddMonths([x],1)], each [x])),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom1", "Date"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Start Date", "End Date"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Date"}, {{"Amount", each List.Sum([Amount]), type number}, {"Case Count", each List.Sum([Case Count]), type number}}),
#"Changed Type" = Table.TransformColumnTypes(#"Grouped Rows",{{"Date", type date}, {"Amount", type number}, {"Case Count", type number}})
in   #"Changed Type"

to generate this table, then graph it

EDIT:  Use the End Date instead of assuming end date is 12 months after start date
let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],

#"Added Custom" = Table.AddColumn(Source,"Date", each
    let
        begin = Date.StartOfMonth([Start Date])
    in
        List.Accumulate(
            {0..(Date.Year([End Date])-Date.Year([Start Date]))*12+(Date.Month([End Date])-Date.Month([Start Date]))},
            {},
            (a,b) => a&{Date.AddMonths(begin,b)}
        )
),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Date"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Start Date", "End Date"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Date"}, {{"Amount", each List.Sum([Amount]), type number}, {"Case Count", each List.Sum([Case Count]), type number}}),
#"Changed Type" = Table.TransformColumnTypes(#"Grouped Rows",{{"Date", type date}, {"Amount", type number}, {"Case Count", type number}})
in   #"Changed Type"


text:
Q: Interpreting sophos static file analysis score Is there an explanation anywhere for what the score field from the sophos static/dynamic file analysis report means?
The schema simply states: Maliciousness score of the analyzed file (0 = malicious, 100 = benign).
I expected this to be interpreted the same way as the file hash lookup reputationScore:
The following ranges are defined:

[0-19]: Malware
[20-29]: PUA (potentially unwanted application)
[30-69]: Unknown/suspicious
[70-100]: Known good

However, I've received a score of 10 which would indicate malware, but I have used a safe PDF file, which seems unexpected.
Does Sophos think the file is malicious, if it responds with a report score of 10 for static file analysis?
This is the response from Sophos:
{
    "jobId": "3aee2c04a73bb64b3572271389cc2e95",
    "jobStatus": "SUCCESS",
    "report": {
        "analysis_subject": {
            "mime_type": "application/pdf",
            "sha1": "5b03ccec77b416805d6d8e270d33942aaedcc6dd",
            "sha256": "f6edcd8a1b4f7cb85486d0c6777f9174eadbc4d1d0d9e5aeba7132f30b34bc3e"
        },
        "analysis_summary": [
            {
                "description": "Document contains links to external domains",
                "name": "edr_contains_domain_links",
                "severity": 1
            },
            {
                "description": "Document file size is small",
                "name": "edr_info_file_size_small",
                "severity": 1
            },
            {
                "description": "Document has a small number of pages",
                "name": "edr_info_page_count_small",
                "severity": 1
            }
        ],
        "analysis_type": "static",
        "detection": {
            "permalink": "https://www.virustotal.com/gui/file/f6edcd8a1b4f7cb85486d0c6777f9174eadbc4d1d0d9e5aeba7132f30b34bc3e/detection/f-f6edcd8a1b4f7cb85486d0c6777f9174eadbc4d1d0d9e5aeba7132f30b34bc3e-1656684162",
            "positives": 0,
            "sophos": "",
            "sophos_ml": "",
            "total": 59
        },
        "document_analysis": {
            "meta_data": {
                "author": "Yukon Department of Education",
                "bytes": 20597,
                "content_type": "PDF",
                "encryption": "Standard V2.3 (128-bit)",
                "language": "EN-US",
                "last_saved_time": "2008-06-04T15:47:36Z",
                "num_pages": 1,
                "title": "PDF Test Page",
                "version": 1.6
            }
        },
        "linked_with_dynamic_analysis": false,
        "ml_aggregate_results": {
            "overall_score": 30
        },
        "ml_file": {
            "analyses": {
                "black_box": {
                    "benign": {
                        "raw": 0.39815810322761536,
                        "score": 30
                    },
                    "model_name": "dsml_model_pdf",
                    "model_version": "20211118"
                },
                "feature_intersections": [
                    {
                        "benign": 7120629,
                        "benign_fraction": 0.7120629263895423,
                        "category": "severity=1",
                        "description": "Feature NOT Observed: Document file size is large",
                        "indicator": "Feature NOT Observed: Document file size is large --> severity=1",
                        "malware": 9997092,
                        "malware_fraction": 0.9997092138044599,
                        "probability": 0.5840200283264096,
                        "scale_factor": 10000000
                    },
                    {
                        "benign": 617857,
                        "benign_fraction": 0.06178572053380388,
                        "category": "severity=1",
                        "description": "Feature Observed: Document has a small number of pages",
                        "indicator": "Feature Observed: Document has a small number of pages --> severity=1",
                        "malware": 5394909,
                        "malware_fraction": 0.5394909111791909,
                        "probability": 0.8972424383801834,
                        "scale_factor": 10000000
                    },
                    {
                        "benign": 537367,
                        "benign_fraction": 0.0537367720738131,
                        "category": "severity=2",
                        "description": "Feature NOT Observed: Document contains behaviour that executes on open",
                        "indicator": "Feature NOT Observed: Document contains behaviour that executes on open --> severity=2",
                        "malware": 5372856,
                        "malware_fraction": 0.5372856378987031,
                        "probability": 0.9090782833830074,
                        "scale_factor": 10000000
                    },
                    {
                        "benign": 536021,
                        "benign_fraction": 0.0536021766615527,
                        "category": "severity=2",
                        "description": "Feature NOT Observed: Document contains javascript",
                        "indicator": "Feature NOT Observed: Document contains javascript --> severity=2",
                        "malware": 5371043,
                        "malware_fraction": 0.5371043501402938,
                        "probability": 0.9092575175159124,
                        "scale_factor": 10000000
                    },
                    {
                        "benign": 509534,
                        "benign_fraction": 0.050953467474390626,
                        "category": "severity=1",
                        "description": "Feature NOT Observed: Document is possibly a phishing PDF",
                        "indicator": "Feature NOT Observed: Document is possibly a phishing PDF --> severity=1",
                        "malware": 5364929,
                        "malware_fraction": 0.5364929575695063,
                        "probability": 0.9132627839711798,
                        "scale_factor": 10000000
                    },
                    {
                        "benign": 428577,
                        "benign_fraction": 0.04285774978628207,
                        "category": "severity=2",
                        "description": "Feature NOT Observed: Field contains potentially suspicious content",
                        "indicator": "Feature NOT Observed: Field contains potentially suspicious content --> severity=2",
                        "malware": 5364293,
                        "malware_fraction": 0.5364293727421457,
                        "probability": 0.9260163947729065,
                        "scale_factor": 10000000
                    }
                ],
                "feature_maliciousness": {
                    "Document contains links to external domains --> severity=1": {
                        "benign": 1828421,
                        "benign_fraction": 0.18284217995357024,
                        "category": "severity=1",
                        "description": "Document contains links to external domains",
                        "indicator": "Document contains links to external domains --> severity=1",
                        "malware": 9869267,
                        "malware_fraction": 0.9869267695627242,
                        "probability": 0.8436937653122213,
                        "scale_factor": 10000000
                    },
                    "Document file size is small --> severity=1": {
                        "benign": 7120119,
                        "benign_fraction": 0.7120119817558322,
                        "category": "severity=1",
                        "description": "Document file size is small",
                        "indicator": "Document file size is small --> severity=1",
                        "malware": 9899084,
                        "malware_fraction": 0.9899084471664678,
                        "probability": 0.581642026468478,
                        "scale_factor": 10000000
                    },
                    "Document has a small number of pages --> severity=1": {
                        "benign": 4086919,
                        "benign_fraction": 0.40869198927301453,
                        "category": "severity=1",
                        "description": "Document has a small number of pages",
                        "indicator": "Document has a small number of pages --> severity=1",
                        "malware": 5416129,
                        "malware_fraction": 0.5416129670799382,
                        "probability": 0.569935959461394,
                        "scale_factor": 10000000
                    }
                },
                "genetic_analysis": {
                    "neighbor_info": {
                        "1f1006182c2e9b6e2b09b07f9be9e122fdc1e681577af68984ab63a076a15fed": {
                            "filepath": "1f1006182c2e9b6e2b09b07f9be9e122fdc1e681577af68984ab63a076a15fed",
                            "is_malware": false,
                            "match_percentage": 0.25,
                            "score": 66.06397
                        },
                        "672cfdffbc33f07c0ad65633cbf610c5ec4bb7787c72d84a5460266aaa9a2dfa": {
                            "filepath": "672cfdffbc33f07c0ad65633cbf610c5ec4bb7787c72d84a5460266aaa9a2dfa",
                            "is_malware": false,
                            "match_percentage": 0.21875,
                            "score": 62.829075
                        },
                        "6cdde8eee67aa38917dfa4249f91381ffa983f2ff95a84d0f6076a4ddecf3de8": {
                            "filepath": "6cdde8eee67aa38917dfa4249f91381ffa983f2ff95a84d0f6076a4ddecf3de8",
                            "is_malware": false,
                            "match_percentage": 0.21875,
                            "score": 63.53914
                        },
                        "9a0d27944893e40316037fd47fb4d9836c1518705b1baa4a0ebf0fe34b045c00": {
                            "filepath": "9a0d27944893e40316037fd47fb4d9836c1518705b1baa4a0ebf0fe34b045c00",
                            "is_malware": false,
                            "match_percentage": 0.1875,
                            "score": 58.78177
                        },
                        "a881bffc0893ae55112a9370f9cf693c3893d672b96c2160e341d9f20d47cd2f": {
                            "filepath": "a881bffc0893ae55112a9370f9cf693c3893d672b96c2160e341d9f20d47cd2f",
                            "is_malware": false,
                            "match_percentage": 0.8125,
                            "score": 234.79837
                        },
                        "add263021a636c93d1fd6f9d7ac880ac8afaacc917dca01dbb66d388c71d1e6c": {
                            "filepath": "add263021a636c93d1fd6f9d7ac880ac8afaacc917dca01dbb66d388c71d1e6c",
                            "is_malware": false,
                            "match_percentage": 0.1875,
                            "score": 59.46551
                        }
                    },
                    "neighbor_matrix": {
                        "1f1006182c2e9b6e2b09b07f9be9e122fdc1e681577af68984ab63a076a15fed": {
                            "0_6659": false,
                            "10_9152": false,
                            "11_4861": false,
                            "12_5543": false,
                            "13_3732": false,
                            "14_5431": false,
                            "15_5899": false,
                            "16_1078": false,
                            "17_2637": true,
                            "18_6885": false,
                            "19_8710": false,
                            "1_7974": false,
                            "20_6372": true,
                            "21_7672": false,
                            "22_8447": false,
                            "23_5023": false,
                            "24_7353": false,
                            "25_4809": false,
                            "26_7069": true,
                            "27_5993": false,
                            "28_2717": true,
                            "29_2739": true,
                            "2_7985": true,
                            "30_7482": true,
                            "31_5233": false,
                            "3_7524": false,
                            "4_6424": true,
                            "5_110": false,
                            "6_8324": false,
                            "7_6214": false,
                            "8_7332": false,
                            "9_8770": false
                        },
                        "672cfdffbc33f07c0ad65633cbf610c5ec4bb7787c72d84a5460266aaa9a2dfa": {
                            "0_6659": false,
                            "10_9152": false,
                            "11_4861": false,
                            "12_5543": false,
                            "13_3732": false,
                            "14_5431": false,
                            "15_5899": false,
                            "16_1078": false,
                            "17_2637": true,
                            "18_6885": false,
                            "19_8710": false,
                            "1_7974": true,
                            "20_6372": true,
                            "21_7672": false,
                            "22_8447": false,
                            "23_5023": false,
                            "24_7353": false,
                            "25_4809": true,
                            "26_7069": false,
                            "27_5993": false,
                            "28_2717": true,
                            "29_2739": false,
                            "2_7985": false,
                            "30_7482": false,
                            "31_5233": false,
                            "3_7524": false,
                            "4_6424": true,
                            "5_110": false,
                            "6_8324": false,
                            "7_6214": false,
                            "8_7332": false,
                            "9_8770": true
                        },
                        "6cdde8eee67aa38917dfa4249f91381ffa983f2ff95a84d0f6076a4ddecf3de8": {
                            "0_6659": false,
                            "10_9152": false,
                            "11_4861": false,
                            "12_5543": false,
                            "13_3732": false,
                            "14_5431": false,
                            "15_5899": false,
                            "16_1078": true,
                            "17_2637": false,
                            "18_6885": false,
                            "19_8710": false,
                            "1_7974": false,
                            "20_6372": true,
                            "21_7672": false,
                            "22_8447": false,
                            "23_5023": false,
                            "24_7353": false,
                            "25_4809": false,
                            "26_7069": true,
                            "27_5993": false,
                            "28_2717": true,
                            "29_2739": false,
                            "2_7985": true,
                            "30_7482": true,
                            "31_5233": false,
                            "3_7524": false,
                            "4_6424": true,
                            "5_110": false,
                            "6_8324": false,
                            "7_6214": false,
                            "8_7332": false,
                            "9_8770": false
                        },
                        "9a0d27944893e40316037fd47fb4d9836c1518705b1baa4a0ebf0fe34b045c00": {
                            "0_6659": false,
                            "10_9152": false,
                            "11_4861": false,
                            "12_5543": false,
                            "13_3732": true,
                            "14_5431": false,
                            "15_5899": false,
                            "16_1078": true,
                            "17_2637": false,
                            "18_6885": true,
                            "19_8710": false,
                            "1_7974": true,
                            "20_6372": false,
                            "21_7672": false,
                            "22_8447": false,
                            "23_5023": false,
                            "24_7353": true,
                            "25_4809": false,
                            "26_7069": false,
                            "27_5993": false,
                            "28_2717": true,
                            "29_2739": false,
                            "2_7985": false,
                            "30_7482": false,
                            "31_5233": false,
                            "3_7524": false,
                            "4_6424": false,
                            "5_110": false,
                            "6_8324": false,
                            "7_6214": false,
                            "8_7332": false,
                            "9_8770": false
                        },
                        "a881bffc0893ae55112a9370f9cf693c3893d672b96c2160e341d9f20d47cd2f": {
                            "0_6659": true,
                            "10_9152": true,
                            "11_4861": true,
                            "12_5543": true,
                            "13_3732": true,
                            "14_5431": true,
                            "15_5899": true,
                            "16_1078": true,
                            "17_2637": true,
                            "18_6885": false,
                            "19_8710": true,
                            "1_7974": false,
                            "20_6372": true,
                            "21_7672": true,
                            "22_8447": false,
                            "23_5023": true,
                            "24_7353": true,
                            "25_4809": true,
                            "26_7069": true,
                            "27_5993": true,
                            "28_2717": true,
                            "29_2739": true,
                            "2_7985": true,
                            "30_7482": true,
                            "31_5233": false,
                            "3_7524": true,
                            "4_6424": true,
                            "5_110": false,
                            "6_8324": true,
                            "7_6214": false,
                            "8_7332": true,
                            "9_8770": true
                        },
                        "add263021a636c93d1fd6f9d7ac880ac8afaacc917dca01dbb66d388c71d1e6c": {
                            "0_6659": false,
                            "10_9152": false,
                            "11_4861": false,
                            "12_5543": false,
                            "13_3732": false,
                            "14_5431": false,
                            "15_5899": false,
                            "16_1078": false,
                            "17_2637": false,
                            "18_6885": false,
                            "19_8710": false,
                            "1_7974": false,
                            "20_6372": true,
                            "21_7672": false,
                            "22_8447": false,
                            "23_5023": false,
                            "24_7353": false,
                            "25_4809": true,
                            "26_7069": false,
                            "27_5993": false,
                            "28_2717": true,
                            "29_2739": false,
                            "2_7985": true,
                            "30_7482": true,
                            "31_5233": false,
                            "3_7524": false,
                            "4_6424": true,
                            "5_110": false,
                            "6_8324": false,
                            "7_6214": false,
                            "8_7332": false,
                            "9_8770": false
                        }
                    }
                }
            },
            "analyzed_counts": {
                "black_box": {
                    "benign": 0,
                    "malware": 0
                },
                "feature_intersections": {
                    "benign": 2798922,
                    "malware": 6340055
                },
                "feature_maliciousness": {
                    "benign": 2798922,
                    "malware": 6340055
                },
                "genetic_analysis": {
                    "benign": 7701633,
                    "malware": 2298367
                }
            },
            "overall_score": 30,
            "overall_scores": {
                "black_box": 30,
                "feature_intersections": 15,
                "feature_maliciousness": 15,
                "genetic_analysis": 13
            }
        },
        "ml_filepath": {
            "analyses": {
                "neighbor_maliciousness": {
                    "most_similar": [],
                    "most_similar_benign": [],
                    "most_similar_malware": []
                }
            },
            "analyzed_counts": {
                "neighbor_maliciousness": {
                    "benign": -1,
                    "malware": -1
                }
            },
            "overall_score": -1,
            "overall_scores": {
                "neighbor_maliciousness": -1
            }
        },
        "ml_inputs": {
            "filepath": null
        },
        "object_type": "file",
        "reputation": {
            "first_seen": "2022-02-08T19:28:46",
            "last_seen": "2022-07-04T07:46:43",
            "prevalence": "Popular",
            "score": 62,
            "score_string": "Prevalent"
        },
        "schema_version": "1.1.0",
        "score": 10,
        "submission": "2022-07-04T08:43:34Z",
        "target": {
            "file_name": "pdf-test.pdf",
            "mime_type": "application/pdf",
            "object_id": "f6edcd8a1b4f7cb85486d0c6777f9174eadbc4d1d0d9e5aeba7132f30b34bc3e",
            "sha1": "5b03ccec77b416805d6d8e270d33942aaedcc6dd",
            "sha256": "f6edcd8a1b4f7cb85486d0c6777f9174eadbc4d1d0d9e5aeba7132f30b34bc3e"
        }
    },
    "requestId": "68db2f66-c63e-4a04-93f9-7067231e42e1"
}

File: https://www.orimi.com/pdf-test.pdf

A: There are a couple of interesting points in your question. Let's start with the scoring.
You are correct the API documentation is not entirely accurate. A score <20 is malicious and >70 is clean. You can see a sample implementation of processing the scores around line 139 here.
In the case of the report that you provided the ML analyzers are causing the file to be convicted. From the report it looks like the following file features (which are commonly seen in malicious files) are causing the ML model to believe the file is malicious:

*

*Document contains links to external domains

*Document file size is small

*Document has a small number of pages

Looking at the dynamic analysis results and the information from Virus Total etc. this could be a false positive and should be escalated to Sophos. The escalation path for FP / FN's is here:
https://support.sophos.com/support/s/filesubmission?language=en_US


text:
Q: How to block database from .accdb file I used a .accdb file as database to my Java desktop application. This file works as database but I can also open it and see the all data and I can also change it never use the program. There is some way to block the file and the user can't open the file directly with Access?

A: *

*Open MS Access

*Click File, Then Open

*Browse out to the DB IN FILE EXPLORER

*Click the arrow beside the open button, choose the option that says open exclusive

*Next go to Info, then select the encrypt with password option


text:
Q: How dose print() function impact sub process's life cycle in python? If I use print() function in subprocess, then subprocess will terminate as soone as the main process terminated.
The following programs terminate at the same time.
# main.py
import time
from subprocess import Popen

if __name__ == '__main__':
    proc = Popen(['python', 'sub.py'])

# sub.py
for i in range(10):
    time.sleep(1)
    print(i)

However if I comment the print() in sub.py, then sub process continues after main terminates.
Also, If I redirect it's stdout in main.py (see following) , the sub process continues as well.
# main.py
import time
from subprocess import Popen

if __name__ == '__main__':
    with open('a.txt", 'w') as out:
        proc = Popen(['python', 'sub.py'],stdout=out)


text:
Q: Why does $|e^{ix}|^2 = 1$?
Why does $|e^{ix}|^2 = 1$?

The book said $e^{ix} = \cos x + i\sin x$, and square it, then $|e^{ix}|^2 = \cos^2x + \sin^2x = 1$.
But, when I calculated it, $ |e^{ix}|^2 = \left|\cos x + i\sin x\right|^2 = \cos^2x - \sin^2x + 2i\sin x\cos x$.
I can't make it to be equal $1.$ How can I do it?

A: If $x \in \mathbb{R}$,
$$\cos^2x - \sin^2 x= \cos(2x)$$
$$2 \sin x \cos x =\sin(2x)$$
$$|(\cos x + i \sin x)^2|=\cos^2(2x)+\sin^2(2x)=1$$

A: If $a,b$ are real then $\displaystyle \left| a+bi \right| = \sqrt{a^2+b^2\,\,} = \sqrt{(a+bi)(a-bi)\,}.$

A: you can first apply the modulus $$|e^{ix}|=\sqrt{\cos^2 x + \sin^2 x}$$ then square it whole you will get $$|e^{ix}|^2={\cos^2 x + \sin^2 x}=1$$

A: $|z|^2=z\bar{z}$
But the complex conjugate of ${e^{xi}}$ is $e^{-xi}$.
$|e^{xi}|^2=e^{xi}e^{-xi}=1$


text:
Q: How to Convert a Jupyter Notebook to an Academic Paper Format? I have a Jupyter notebook containing all of the content I would like to put in an academic paper (text, equations, and plots), together with code which I would like hidden.
Does there exist a way to programmatically convert the notebook into a form acceptable for journal submission? Ideally I would like something like knitr's functionality for creating academic-style papers, but for Jupyter rather than R-focused tools.
I've found pandoc templates for several journals (including the one I'd like to submit to), but it's not clear how well this integrates with Jupyter.
I also found this description of using Jupyter notebooks in the paper-writing process, but the author appears to simply use it for data analysis and generating plots; it might as well be a standard script.
If this doesn't exist yet, what would be necessary to make a reusable tool for this task? Would an nbconvert custom exporter be sufficient, or would I need a full Jupyter extension in order to specify bibliographies and plot/table locations from within the notebook interface?

A: Convert your notebook to markdown then use pandoc with filters (pandoc crossref and pandoc citeproc) to convert to Word.
You need title, sections, cross-referencing, citations, numbering, figures and tables with captionings…
Here is a workflow that works:
You can first convert your notebook into markdown which can easily be done using nbconvert:
jupyter nbconvert --to markdown --no-prompt your_notebook.ipynb

--no-prompt: will help get rid of code cell if you don't want in the manuscript. You can also use hidden cells among markdown cells that you don't want in the final output.
Then you need pandoc and two filters pandoc-crossref, and pandoc-citeproc. I'm using windows and anaconda 3 to install them:
https://anaconda.org/conda-forge/pandoc
https://anaconda.org/conda-forge/pandoc-crossref
Fortunately, installing pandoc through anaconda will also bring pandoc-citeproc. You need a pandoc-crossref compatible with the version of pandoc (currently pandoc 2.5 ).
So, when installing from conda, you can use:
conda install -c conda-forge pandoc=2.5

then you can simply run:
conda install -c conda-forge pandoc-crossref

The key thing in all will be the markdown syntax. You have to write your notebook using the markdown syntax which is the default anyway in Jupiter notebooks. Interesting examples are here, here and here also :) .
You will also need a reference file in .bib format for managing your citations.
Then by simply running the command:
pandoc -s your_notebook.md -o your_notebook.pdf -F pandoc-crossref -F pandoc-citeproc --bibliography=your_references.bib -f markdown

you can turn your entire notebook into a nice, clean manuscript
pandoc has many other options for customizations: colorlinks,  papersize, geometry, number-sections… (see pandoc –help)
So writing a custom Jupiter exporter you can combine the two commands and export your notebook as a manuscript.
Another interesting approach here https://github.com/chrisjsewell/ipypublish


text:
Q: Mysql Complex Object Hibernate Batch insert I need to insert an object to database which has multiple nested objects like:
class A{
    List<B> b;
}

class B{
    List<C> c;
    List<D> d;
    List<E> e;
}

Now I will have a single object of A to persist which will have multiple objects of type B and B in turn will have multiple C, D and E type objects.
There could be a total of 10,000 objects of B, C, D and E combined. I have configured batch inserts using the below additions to my hibernate.cfg.xml
<property name="hibernate.jdbc.batch_size">50</property>
<property name="hibernate.order_inserts">true</property>
<property name="hibernate.order_updates">true</property>
<property name="hibernate.jdbc.batch_versioned_data">true</property>

I have also added
rewriteBatchedStatements=true

in the connection.url property of hibernate.
I am using an increment generator for the id's.
I will receive a json of A along with nested list of B and inturn nested C, D and E in every B element. This is converted to an Object A and saved into db using
session.save(A);

Since, I've enabled cascading, all the nested objects are persisted into db. The total insertion time for 10,000 objects takes around 25 seconds.
I'm not sure if the batching is enabled or not because I see single insert statements like
insert into C(id, val) values(1,"val");
insert into C(id, val) values(2,"val2");

I referred the hibernate batch insert doc, it asks me to
session.flush();
session.clear();

after jdbc batch size inserts. I'm not sure how do I do this in my case, I also tried using Stateless session, I didn't see any improvements there either. Any suggestions as to how can I improve the performance would be great.

A: I think you might be able to improve the performance here if you change your approach slightly. So instead of a single cascaded save you could individually save the entities. This assumes you have bi-directional relationships declared which I think you'll need if you want this to perform.
So remove all the List<T> from A and then save A on its own.
Something like:
session.save(a)
session.evict(a)

This means A has been persisted but is not longer in the session. You can then individually save the associated entities:
for (B b : a.getListOfB()) {
  b.setA(a);
  session.save(b);
}

You can then flush and evict or use a stateless session if you'd prefer.


text:
Q: Count of Items in one row but not in another I have an access table that has in one column a list of groups and then another column that has a list of products.  I would like to run a report to show how many groups are in all products, how many groups are at least 1 of the products.  I have as many as 6 products in a given table and over 5,000 unique groups.
Below is an example of what I am looking for:
Table:
Group | Product
AAAA  | 123456
AAAA  | 234578
AAAA  | 456789
AAAA  | 789012
BBBB  | 123456
BBBB  | 234578
BBBB  | 456789
CCCC  | 123456
CCCC  | 234578
CCCC  | 456789
CCCC  | 789012

Expected Results:
Product 123456 and 234578 and 456789 and 789012 has 2 groups
Product 123456 or 234578 or 456789 or 789012 or has 3 groups

I tried the below query but it is only for when it is a product or another product not when in both.  I am looking for when a group is in product x and product y and product z but not in product a.
  SELECT group
  FROM GroupProducts
  WHERE
         product in ('123456','2345678','456789')
         and product not in ('789012')

A: Try to use Count and group by Product:
SELECT Count(group), Product
FROM GroupProducts
WHERE
product in ('123456','2345678','456789')
and product not in ('789012')
GROUP BY product

This assumes your table doesn't have duplicates, else you'll have to filter them out first

A:
I would like to run a report to show how many groups are in all products

Assuming no duplicate records, the following query should return the set of all groups which are associated with all products in the dataset:
select t.group from YourTable t group by t.group
having count(t.group) =
(
    select count(*) from (select distinct u.product from YourTable u)
)

You can count these groups by simply enclosing the above with a select count(*) query:
select count(*) from
(
    select t.group from YourTable t group by t.group
    having count(t.group) =
    (
        select count(*) from (select distinct u.product from YourTable u)
    )
)

how many groups are at least 1 of the products

This one is significantly easier, since you can simply select the number of distinct groups in the dataset:
select distinct t.group from YourTable t

Which can then be counted in the same manner as previously described:
select count(*) from
(
    select distinct t.group from YourTable t
)

In all of the above examples, replace all instances of YourTable with the name of your table.


text:
Q: Not able to see docker task in order to run gradle build docker getting error task docker not found Hi I am using gradle palantir plugin in order to build a docker image from dockerfile
when i run the gw build docker its throwing Task 'docker' not found in project ':hop-service'.
when i ran gw tasks  i m not able to see the docker tasks not sure what mistakes i have done build.gradle file below is my gradle file
    buildscript {
    repositories {
        mavenLocal()
        maven {
          url 'https://artifactory.codetest.com/artifactory/sf-microservices-hop'
        }
    }
    dependencies {
        classpath "com.codetest.platform.foundation:platform-build-template:1.0.37.BUILD"
    }
}
plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.7.RELEASE'
    id 'java'
    id 'com.palantir.docker' version '0.22.1'
}

ext{
    appProjects=['hop-service']
    mapstructVersion = '1.3.1.Final'
    annotationProcessVersion = '0.21'
}

apply from: project.buildscript.classLoader.getResource("scripts/build.gradle")

subprojects {
  version = '1.0.0-SNAPSHOT'
  group = 'com.xyz'
}
docker {
    name "mycoolapp"
    dockerfile file('Dockerfile')
    copySpec.from(jar).rename(".*","app.jar")
    buildArgs(['JAR_FILE': "app.jar"])
}

Dockerfile code
    FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

A: I have got a solution to this
Actually there are two build.gradle in project directory one is parent build gradle which i have mentioned above and another is child project build.gradle.
I have to mention these line of code in child project not in parent project after providing in child project build.gradle now i see docker tasks
plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.7.RELEASE'
    id 'java'
    id 'com.palantir.docker' version '0.22.1'
}
docker {
    name "mycoolapp"
    dockerfile file('Dockerfile')
    copySpec.from(jar).rename(".*","app.jar")
    buildArgs(['JAR_FILE': "app.jar"])
}


text:
Q: Regarding MS ajax client side javascript API i am not very much familiar of MS ajax client side javascript API so i search google but did not get any url from where i can have tutorial like sort of for MS ajax client side javascript API. as example Sys.WebForms.PageRequestManager.getInstance(). this piece of code is related with MS-Ajax client side API. if anyone knows then please refer me.
thanks

A: The reference for the client-side library is here. Code examples here and here.