text:
Q: how to uncompress a folder with with extension gzip I'm having a problem with a folder with an extension .gz in the client side which contains xml files in it. I have to download the folder into local directory then i need to extract the folder.
I was able to download the .gz folder into local, but I'm unable to extract the folder.
I tried using the
ZipArchive::extractto($targetfolder);

But it is not accepting the .gz.
When i search through stack overflow i found only answers for .gz files not for .gz folders.

A: Try using PHP's built-in gzfile() function.
This will uncompress the file in 4kB chunks:
function uncompress($srcName, $dstName) {
    $sfp = gzopen($srcName, "rb");
    $fp = fopen($dstName, "w");

    while ($string = gzread($sfp, 4096)) {
        fwrite($fp, $string, strlen($string));
    }
    gzclose($sfp);
    fclose($fp);
}

A: The documentation for ZipArchive doesn't say anything about being able to open gz format files (zip and gz are not the same). You may need to use Zlib to decompress your gz file, and if it's a tar.gz or tgz file, you'll also need something to untar the file.
This question and this newer question discuss how to extract a tar.gz file in PHP.


text:
Q: Is a closed set with orbit capacity zero automatically thin? Let $G$ be a countably infinite amenable group. Let $\alpha: G\curvearrowright X$  be a continuous group action. (Mostly free and minimal, though!)
Definition 1:  Let $A\subset X$ be closed and $U\subset X$ open. We say that $U$ $\alpha$-dominates $A$, and write $A\lesssim U$, if there exist open sets $V_1,\dots,V_M$ and group elements $g_1,\dots,g_M\in G$ such that $A\subset\bigcup_{i=1}^M V_i$ and $\alpha^{g_i}(V_i)$ are pairwise disjoint subsets of $U$.
A closed set $A\subset X$ is called $\alpha$-thin, if $A\lesssim U$ for all non-empty open $U\subset X$.
Definition 2: Let $E\subset X$ be some subset. Choose some Folner sequence $F_n$ for $G$. Then the orbit capacity of $E$ is defined as
$$\operatorname{ocap}(E) = \limsup_{n\to\infty} \frac{1}{|F_n|} \sup_{x\in X} \sum_{g\in F_n} \mathbb{1}_E(\alpha^g(x)).$$
(This notion was introduced and studied a bit here , where it is also shown that this is well-defined)
For closed $E\subset X$, one can in fact show that $\operatorname{ocap}(E)$ is the supremum over all $\alpha$-invariant measures evaluated at $E$. Particularly, $\operatorname{ocap}(E)=0$ means that $E$ vanishes under all $\alpha$-invariant measures.
My question is:

If $\alpha$ is free and minimal and $E\subset X$ is closed, does $\operatorname{ocap}(E)=0$ imply that $E$ is thin?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to induce native ListView scrolling [android] I have a problem with my ListView after I have overriden onInterceptTouchEvent in my parent view. The ListView just won't scroll.
I've tried dispatching MotionEvent to the ListView but it doesn't seem to be handled in any way.
boolean done = mListView.dispatchTouchEvent(event);
Log.d("listView dispatch", String.valueOf(done));

done is always true, so I guess the event is received correctly.
I've also tried scrolling the ListView by offset and by position but these produced a very artificial experience.
Is there a way to get my ListView to scroll in the default way?


text:
Q: Where is the topology hiding in this theorem on entire functions? There is a standard theorem that says if $f$ is analytic in the whole complex plane and never zero, then it has the form $e^g$ where $g$ is analytic in the whole plane; i.e. we can define a function $\log f$ that is analytic in the whole plane and satisfies $f=e^{\log f}$.  The argument is easy: $f$ is entire and never zero, so $f'/f$ is entire, so $g(z)=\int_0^z f'(\zeta)d\zeta/f(\zeta)$ is well-defined and entire, and then computation shows that $fe^{-g}$ has derivative zero, so is constant, so $f$ is a constant multiple of $e^g$, and the constant can be absorbed into $g$.
The argument does not mention the topology of the situation, and this bugs me a little.  By the Little Picard theorem, the image of $f$ is the whole complex plane minus zero.  In general, of course, a continuous single-valued branch of $\log$ cannot be defined on this set. That's why the proof involved the integral of the logarithmic derivative of $f$, rather than merely the composition of $f$ with the right branch of $\log$.  That said, if we obtained a different function $h$ by picking some branch of $\log$ defined on $\mathbb{C}$ minus some ray from the origin (call this set $S$), and then defining $h(z)=\log f(z)$ on $f^{-1}(S)$, then of course $h$ would satisfy $f=e^h$ where it is defined, and then $1=e^{h-g}$, so that on each connected component of $f^{-1}(S)$, since $h,g$ are defined and continuous they must differ by a constant multiple of $2\pi i$. If I allow myself to use a different branch of $\log$ for each connected component of $f^{-1}(S)$, I could end up with $h$ exactly equaling $g$ and therefore being extendable by continuity to all of $\mathbb{C}$. What this adds up to is that I have the strong feeling that the theorem (in spite of the easy calculation-based proof) has some nontrivial topological content and I am trying to isolate this content.
At this point, I was originally going to ask for help isolating the topological content.  But over the course of composing the question, I think I may have answered it. So, following is what I believe to be an alternative proof of the original result that makes the topological content explicit. My question is now, is the following proof correct? I would also be interested in your thoughts about (soft-question) where is the topology hiding in the original proof?
Theorem: If $f$ is entire and never zero it has the form $f=e^g$ for $g$ entire.
Proof: Let $f$ be an entire function that is never zero.  Then $f:\mathbb{C}\rightarrow\mathbb{C}\setminus\{0\}$ is continuous, so induces a homomorphism $f_*:\pi_1(\mathbb{C})\rightarrow\pi_1(\mathbb{C}\setminus\{0\})$, which is trivial because $\mathbb{C}$ is simply connected.  Therefore, $f$ lifts to a continuous function $\hat{f}$ from $\mathbb{C}$ to $\mathbb{C}\setminus{0}$'s universal cover $U$. But $U$ is the Riemann surface of the $\log$ function; in particular, the logarithm is well-defined and single-valued on $U$; so let $g=\log \hat{f}$; and then $g$ is such that $f=e^g$. $\hat{f}$ is actually holomorphic to $U$, so the $g$ thus defined is entire.
EDIT: When I wrote this proof I was a little uncomfortable with speaking of $\hat{f}$ being holomorphic to $U$ and the log being holomorphic on $U$, since my understanding of covering space theory is strictly topological. Subsequently I realized that we can actually take $U$ to be $\mathbb{C}$, with the covering map given by $z\mapsto e^z$, and then the "logarithm on $U$" is just the identity on $\mathbb{C}$. I think the argument goes through, but can be made even shorter:
By the lifting theorem, any function $f$ from a simply connected domain to $\mathbb{C}\setminus\{0\}$ has a lift $\hat{f}$ to $\mathbb{C}\setminus{0}$'s universal cover, $\mathbb{C}$, that factors through the covering map $z\mapsto e^z$. Then $f=e^{\hat{f}}$ and $\hat{f}$ is the desired $g$. Since the covering map is holomorphic, $f$ and $\hat{f}$ are simultaneously holomorphic. Done!
Thanks to Jonas Meyer for highlighting that the key feature of the original argument is also the simple-connectedness of the domain, on which rests the invocation of Cauchy's theorem to show the integral is well-defined.

A:
Where is the topology hiding in the original proof?

It is hiding in the phrase "is well-defined," or, equivalently, in Cauchy's theorem.  In a domain that is not simply connected, this "definition" of $g$ in general depends on the path taken from your base point to $z$. (For example, if there are isolated singularities, then different paths could wind around the singularities differently and pick up residues.) The well-definedness depends on Cauchy's theorem for simply connected domains.


text:
Q: WooCommerce edit order privilledge Hello i made a new role using Ultimate Member named stock_user
i want all users in the stock_user role only thing they can do
  is to   change the order status in wooCommerce admin page from processing to shipped only
i tried plugins but nothing worked im sorry i don't have any code but i don't know  where to start
can anyone tell me where to start to make this work ?

  i want to limit this dropdown menu options to processing & shipped only when a user with privildge stock_user is logged in
EDIT 2:  Its now working as it should thank to IndexTwo Answer but the problem is that inventory role is a custom role made by Ultimate Member plugin how can i make the status work with it ? here is the code of Indextwo
    function vnm_remove_woo_statuses($statuses) {
    $currentUser = wp_get_current_user();

    $removeStatusesArray = array('pending', 'completed', 'cancelled', 'refunded', 'failed', 'refund-issued', 'shipping-progress', 'on-hold');

    //  If it's inventory user role

    if ( in_array('inventory', $currentUser->roles)) {

        foreach ($removeStatusesArray as $status) {
            if (isset($statuses['wc-' . $status])) {
                unset($statuses['wc-' . $status]);
            }
        }
    }

    return $statuses;
}

add_filter('wc_order_statuses', 'vnm_remove_woo_statuses');

i mean it works when i change inventory to administrator just fine but how to get it working with the custom role (inventory) ? thank you

A: There are a couple of ways to approach the logic on this, but here's the function first:
function vnm_remove_woo_statuses($statuses) {
    $currentUser = wp_get_current_user();

    $removeStatusesArray = array('pending', 'completed', 'cancelled', 'refunded', 'failed', 'refund-issued', 'shipping-progress', 'on-hold');

    //  If it's any role other than administrator, remove the status

    if (!in_array('administrator', $currentUser->roles)) {

        foreach ($removeStatusesArray as $status) {
            if (isset($statuses['wc-' . $status])) {
                unset($statuses['wc-' . $status]);
            }
        }
    }

    //  ALWAYS need to return the status array regardless

    return $statuses;
}

add_filter('wc_order_statuses', 'vnm_remove_woo_statuses', 5, 1);

Note the last line of the function: you always need to return the value of a filter, regardless of the logic therein - otherwise things go wonky. I've also set a high priority of 5 just in case anything else was hooking in.
The conditional logic is currently set to remove statuses if ANY role other than administrator tried to edit an order:
if (!in_array('administrator', $currentUser->roles)) { /* Do stuff */ }

In your example, you were removing the statuses only for administrators. You could switch that around so that it only happens for stock_user users:
if (in_array('stock_user', $currentUser->roles)) { /* Do stuff */ }

...however, be aware that if you have the ability to add multiple roles to a user and add Stock User to an administrator, their access to ordser statuses would also be restricted here.


text:
Q: Import CSV file with partial name into excel I've got many CSV files and I want to use macro to import them (and manipulate them) into a existing excel file.
The thing is that I only know a part of the files. They are like :

*

*"ThisIsTheFirstFile-01234564893.csv"

*"ThisIsTheSecondFile-015648942314.csv" ...

So I used this code to import my file :
Sub LoadFromFile()
    Dim fileName As String, folder As String

    folder = "C:\FolderPath\"
    fileName = "ThisIsTheFirstFile-*"

    Dim file As String
    file = Dir$(folder & fileName & ".*")

    ActiveCell.Offset(0, 0).Range("A1").Select

    With ActiveSheet.QueryTables _
        .Add(Connection:="TEXT;" & file, Destination:=ActiveCell)
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 850
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
End Sub

But it doesn't seem to match the filename. For now I just wish to load one file, I'll then manipulate it, exctract data, supress all data loaded to load others files after.

A: As per this, file will only contain the file name, you have to concatenate the folder.


text:
Q: On plugging in my iPhone to the car stereo, music plays automatically I have a Sony head unit in my car that has a USB socket and no Bluetooth. When I plug in my iPhone 5C running iOS 10.3.3 into the USB, it starts playing music from my iTunes library automatically.
I do not have a iTunes Match or Apple Music subscription. Neither do I have my credit card linked to the iTunes Store, which could cause accidental subscription to the service.
I do not have any songs synced to the device from my iTunes Library.
I haven't used iTunes Wi-Fi Sync in a long while.

I have a 4G data connection active on my iPhone while in the car.
I have turned off automatic Music download from iTunes Store.
Mobile Data is turned off for music and there is Zero KB of download music.

But as soon as I plug in my iPhone, it starts playing some random song. I fail to understand how this could be happening?

Where is the iPhone getting the music track from? There is no Wi-Fi connection as I am in the car. It sometimes plays a random track from my iTunes library. How do I tell the phone to delete whatever information it has about my iTunes library without screwing up the link between it and my Mac for everything else?


text:
Q: Formik pass customized Props to custom Field Component Good evening everyone,
I am having a small issue with custom Formik Fields..
I am using an own custom Field such as:
<Field name="pdfFile" component={FileUpload} />

FileUpload Props look like:
interface FileUploadProps {
    field: FieldInputProps<any>; //These props should probably be derived from Formik
    form: FormikProps<any>;
    width: string;
    height: string;
}

field and form are correctly passed into the component, but how can I pass width and height into the component? Tried it like, but without success.
<Field
    name="pdfFile"
    component={(props: any) => (
        <FileUpload
            field={props.field}
            form={props.form}
            width={pdfWidth}
            height={pdfHeight}
        />
    )}
/>

Formik API unfortunately doesn't mention how to solve this problem. Has anyone experienced similar issues and knows how to resolve this?
Thanks a lot for your help!

A: If you pass a prop to Field that isn't used in Field, it will be passed to the component in the component prop.
So you can do it like
<Field
    name="pdfFile"
    width={pdfWidth}
    height={pdfHeight}
    component={FileUpload}
/>

and get the value in the component props
const FileUpload = (props) => {
    // props.width
    // props.height
    return ( /* ... */ )
}


text: Q: Make Webpack 1.13 work with ES6 vendor I am trying to add some external dependency cryptowatch-embed js to my webpack project (of version 1.13.3) as vendor. The concern is that this dependency is written in ES6 style and js file ends with something like export default Embed;. When I run my webpack-dev-server and open the browser the console shows me Uncaught SyntaxError: Unexpected token export on this line. I suppose that webpack does not bundle ES6 vendor properly, but I dot'n have any ideas what should be done to fix this error. So the main question is how can I make webpack work with /node_modules/cryptowatch-embed/src/main.js that is written in ES6?


text:
Q: Comparing values of lists Another list comparing question. I now want to compare a quantity of an item to another quantity, and if the quantity of the first item is greater than or equal to the second item, return true.
public bool Equals(Item item1, Item item2)
{
    if (item1.ItemName.Equals(item2.ItemName) && item1.ItemCount >= item2.ItemCount)
    {
        return true;
    }

But no matter what the quantity of the first item, it always returns true. Is there a problem with this block of code or it the problem elsewhere?
var commonItems = Items.Intersect(Inventory.Items, new ListComparer()).ToList();

if (commonItems.Count() == Items.Count())
{
    return Output;
}

This is where I'm comparing the lists. Items would have 3 objects of class Item. 1 rock, 1 twig, and 2 vines. This is being compared against my inventory, and even if I only have 1 vine it returns true.
Forgot to add that the first block of code is in a class called
public class ListComparer :IEqualityComparer<Item>

A: So you have a "recipe" like [1 rock, 1 twig, 3 vine], and you want to know if your inventory has all items with at least the required quantities.
Here's one way you could use:
if (Recipe.All(r => Inventory.Any(i =>
    i.Name == r.Name && i.ItemCount >= r.ItemCount))))

So, "if every recipe item matches an inventory item with at least the required quantity". This is assuming there won't be multiple stacks of anything in either list.
What you shouldn't do is redefine Equals to mean anything except "equals". A lot of framework code works under the assumption that Equals will work consistently - for example, the result of a.Equals(b) will be the same as b.Equals(a). This is probably what is tripping you up currently, because your code does not provide this, and the Intersect method will be relying upon it.


text:
Q: How to query the containing partition of a file with KDE/Qt4? I'm using KDE, and I'm toying with the idea of hacking the code for Dolphin File Manager (and potentially Konqueror if necessary) to get context-sensitive drag and drop behaviour (i.e. files are moved within the same partition, or copied if they're moved across partitions or the source is read only).
To do this, I think I'd need to find out the containing partition of the source and destination (easy enough on Windows using the drive letter, but on Linux, as mount points can be almost anywhere, it can't be reliably derived from the file path), and compare them.
Does anyone know how I can find out the partition that contains a given file?
It must be possible - I know Nautilus provides this sort of behaviour, but I'm not familiar enough with GTK to track down the appropriate section in the source code to see how its done...

A: Qt doesn't provide API for this. For POSIX, have a look at stat.

A: For KDE, you can use KIO::stat() to get mostly the same info as POSIX' stat function but asynchronously.
The device id should be in the field UDS_DEVICE_ID of the result.


text:
Q: Can't import Gradle project to Eclipse I have a libGDX project that I can compile and run on PC and am trying to get it to run on a mac.  I've been following the setup on https://github.com/libgdx/libgdx/wiki/Setting-up-your-Development-Environment-%28Eclipse%2C-Intellij-IDEA%2C-NetBeans%29
I've checked out my project from my version control and am trying to import it into Eclipse by selecting File/Import..., Gradle Project and then pressing the 'build model' button.  This results in the error
failed to find Build Tools revision 21.1.1
I've updated my android project to include the 21 distribution, but am still getting this error.  Any idea what I'm doing wrong?
java.lang.reflect.InvocationTargetException
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:112)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: org.eclipse.core.runtime.CoreException: failed to find Build Tools revision 21.1.1
    at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.coreException(ExceptionUtil.java:40)
    at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.coreException(ExceptionUtil.java:51)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.BuildResult.get(BuildResult.java:85)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleProjectModelManager.getModelInternal(GradleProjectModelManager.java:145)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleProjectModelManager.getModel(GradleProjectModelManager.java:100)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleModelManager.getModel(GradleModelManager.java:77)
    at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:669)
    at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:499)
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:104)
    ... 1 more
Caused by: org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'HierarchicalEclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-2.4-all.zip'.
    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:59)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
    at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:48)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.ToolinApiUtils.buildModel(ToolinApiUtils.java:103)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.DefaultModelBuilder.doBuild(DefaultModelBuilder.java:30)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:40)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.HierarchicalProjectBuildStrategy.buildReferenceModel(HierarchicalProjectBuildStrategy.java:179)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.HierarchicalProjectBuildStrategy.buildModels(HierarchicalProjectBuildStrategy.java:65)
    at org.springsource.ide.eclipse.gradle.core.modelmanager.GradleProjectModelManager.getModelInternal(GradleProjectModelManager.java:141)
    ... 6 more
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':android'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:58)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: failed to find Build Tools revision 21.1.1
    at com.android.builder.sdk.DefaultSdkLoader.getTargetInfo(DefaultSdkLoader.java:93)
    at com.android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.java:90)
    at com.android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.groovy:462)
    at com.android.build.gradle.BasePlugin.access$2(BasePlugin.groovy)
    at com.android.build.gradle.BasePlugin$_createTasks_closure13.doCall(BasePlugin.groovy:386)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1015)
    at groovy.lang.Closure.call(Closure.java:423)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:87)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
    ... 39 more

A: Looks like I had to edit my android/build.gradle file and change the buildToolsVersion to 21.1.2


text:
Q: Is it possible to prove empty set uniqueness in FOL directly (without proof by contradiction) So I have a partial proof of uniqueness of the empty set in FOL:

*

*$\exists x \forall z(z \notin x)$ (ZF2)

*$z_1 \notin e_1 $ (Universal & Existential Instantiation of (1))

*$z_1 \notin e_2 $ (Same)

*$z_1 \in e_1 \rightarrow z_1 \in e_2$ (Tautology $\neg A \rightarrow (A \rightarrow B)$)

*$z_1 \in e_2 \rightarrow z_1 \in e_1$ (Same)

*$\forall z (z \in e_1 \rightarrow z \in e_2)$ (Uni Generalization)

*$\forall z (z \in e_2 \rightarrow z \in e_1)$ (Same)

*$\forall z (z \in e_1 \rightarrow z \in e_2) \land \forall z (z \in e_2 \rightarrow z \in e_1)$ (Conj Intro)

*$\forall z (z \in e_1 \rightarrow z \in e_2 \land z \in e_2 \rightarrow z \in e_1)$ (Identity)

*$\forall z (z \in e_1 \leftrightarrow z \in e_2)$ (Biconditional Intro)

*$e_1 = e_2$ (Eq Intro)

So far, so good. But what I actually want to prove is:
$$\forall x \forall y [(\forall z (z \notin x) \land \forall z (z \notin y)) \rightarrow x = y] .....P$$
As hard as I try, I can't go from (1)-(11) to $P$.
Basically where I'm struggling is turning the $e$'s into $\forall$ statements. Since $e$'s are constants, we can only do existential generalization, not universal generalization. I guess my question boils down to whether there is some theorem that allows us to go from constants/existential quantifiers to universal ones. My suspect is "$(\exists x P(x))\rightarrow Q$ is equivalent to $\forall x (P \rightarrow Q)$ (as long as $x$ is not in $Q$)", but I can't seem to put the pieces together in the right way. ;)
Everyone seems to agree that it is possible to prove empty set uniqueness directly (e.g. [1]), but I can't find a proof myself...

A: I think I got it!
I'm going to write a bunch of implications and then join the first and last:
$\quad \forall z (z \notin x) \land \forall z (z \notin y)$
$\rightarrow \forall z (z \notin x), \forall z (z \notin y)$ (Conj Elim)
$\rightarrow z \notin x, z \notin y$ (Univ Inst)
$\rightarrow z \in x \rightarrow z \in y, z \in y \rightarrow z \in x$ (Tautology $\neg A \rightarrow (A \rightarrow B))$
$\rightarrow z \in x \rightarrow z \in y \land z \in y \rightarrow z \in x$ (Conj Intro)
$\rightarrow \forall z (z \in x \rightarrow z \in y \land z \in y \rightarrow z \in x)$ (Univ Gen)
$\rightarrow \forall z(z\in x \leftrightarrow z\in y)$ (Biconditional Intro)
$\rightarrow x=y$ (Eq Intro/Axiom of Ext)
Hence:
$$(\forall z (z \notin x) \land \forall z (z \notin y)) \rightarrow x=y$$
So, by universal generalization
$$\forall x \forall y [(\forall z (z \notin x) \land \forall z (z \notin y)) \rightarrow x=y]$$


text:
Q: Nginx cloudflare 502 bad gateway I'm using cloudflare. My site is working good but not loading any images, css files and js files.

My server details;

ubuntu 12.04
nginx/1.1.19
php5-fpm
mysql

You can check live here
Check with www and without www.
I think that problem is related to proxy (cloudflare)

/etc/nginx.conf

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

server conf
server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www/sorbakalim.co;
    index index.html index.htm index.php;

    # Make site accessible from http://localhost/
    server_name sorbakalim.co;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html
        try_files $uri $uri/ /index.php;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        deny all;
    }

    # Only for nginx-naxsi : process denied requests
    #location /RequestDenied {
        # For example, return an error code
        #return 418;
    #}

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #error_page 500 502 503 504 /50x.html;
    #location = /50x.html {
    #   root /usr/share/nginx/www;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        # With php5-cgi alone:
        fastcgi_pass 127.0.0.1:9000;
    #   # With php5-fpm:
    #   fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}

A: A 502 gateway generally indicates a temporary issue in a datacenter and you should contact us if you see this.
Things that are helpful in the report:
Traceroute to the domain
And the output from: http://yourdomain.com/cdn-cgi/trace (replace yourdomain.com with your actual domain).


text:
Q: cordova build 3.6.3 error After update cordova to 3.6.3 when I do cordova build I get this error:
H:\Android\Workspace\its>cordova build

Running command: H:\Android\Workspace\its\platforms\android\cordova\build.bat

H:\Android\Workspace\its\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error: ENOENT, no such file or directory 'H:\Tizen\Dodatki\adt-bundle-windows-x8
6-20140702\tools\lib\build.template'
    at Object.fs.openSync (fs.js:438:18)
    at Object.fs.readFileSync (fs.js:289:15)
    at H:\Android\Workspace\its\platforms\android\cordova\lib\build.js:93:40
    at _fulfilled (H:\Android\Workspace\its\platforms\android\cordova\node_mo
dules\q\q.js:798:54)
    at self.promiseDispatch.done (H:\Android\Workspace\its\platforms\android\
cordova\node_modules\q\q.js:827:30)
    at Promise.promise.promiseDispatch (H:\Android\Workspace\its\platforms\an
droid\cordova\node_modules\q\q.js:760:13)
    at H:\Android\Workspace\its\platforms\android\cordova\node_modules\q\q.js
:574:44
    at flush (H:\Android\Workspace\its\platforms\android\cordova\node_modules
\q\q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: H:\Android\Workspace\its\platforms\android\cordova\build.bat: Command
failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Mix\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

I try reinstall and install and nothing help....any suggestions ?
This directory exists:

Error: ENOENT, no such file or directory
  'H:\Tizen\Dodatki\adt-bundle-windows-x8
  6-20140702\tools\lib\build.template'

SOLUTION:
set ANDROID_HOME to H:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools;
remember at the end add ;


text:
Q: How can I define the touchUpInside action for KCFloatingActionButton? I want to define action for my KCFloatingActionButton. UITapGestureRecognizer is defined for the fab button in ViewController, but I want to do this action in manager class or on another page. I got the KCFloatingActionButton view, but I can't give it a click action.When I click on KCFloatingActionButton I don't want to define a new UITapGestureRecognizer with addGestureRecognizer ,I want it to take the action it is defined.
I can do this for UIButton or UIBarButtonItem as follows
button.sendActions(for: .touchUpInside)
barButtonItem.target?.perform(barButtonItem.action, with: nil)
How can I do this action for KCFloatingActionButton ?

A: You can try something like this:
button.addTarget(self, action: #selector(handleButtonAction), for: .touchUpInside)

@objc func handleButtonAction(){
    //Put your logic here
}

The self in addTarget refers where will be the action to be executed, in this case will be in the current ViewController.
The #selector(handleButtonAction) is the function that will be executed when the user touch the button, in this case will be an Objective-C function (that's why is use the "#selector").
The .touchUpInside is the event that has to be triggered to execute the function.
And finally the function itself @objc func handleButtonAction() {  } will execute all the actions that you define for the touch up event.
the @objc attribute comes in: when you apply it to a class or method it instructs Swift to make those things available to Objective-C as well as Swift code.


text:
Q: How to access an int inside of a array in a JSON file I have a JSON file holding students name, id, and grades. I managed to print the name and id, but cannot figure out how to access the grades ("score").
Part of my JSON file (3 other students) :
"Name": "Abstract Data Types",
  "CRN": "14607",
  "Capacity": 24,
  "Code": "cs241",
  "Time": "13:50",
  "Number of Sections": 1,
  "Students": [
    {
      "name": "David",
      "id": "987654321",
      "course works":[
        {
          "name": "q1",
          "score": 2
        },{
          "name": "q2",
          "score": 10
        },{
          "name": "q3",
          "score": 10
        },{
          "name": "midterm",
          "score": 89
        },{
          "name": "final",
          "score": 95
        }
      ]
    }

So, I managed to print "name" and "id" with :
for (JsonValue value : studentsArray) {
            String name = value.asJsonObject().getString("name");
            String id = value.asJsonObject().getString("id");

            if (value.asJsonObject().getString("name").equalsIgnoreCase(commandInput)) {
                System.out.println("Name: " + name + " | " + "ID: " + id + " | ");
            }
        }

I cannot figure out how to now print q1-final grades. I keep receiving errors saying the value is null.
I have tried just doing something like:
int q1 = value.asJsonObject().getInt("score");

hoping it would at at least print all of the grades (and not just quiz 1, like I need), but instead gave the error:
Cannot invoke "javax.json.JsonNumber.intValue()" because the return value of "org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl.getJsonNumber(String)" is null


text:
Q: Unable to retrieve result from httpRequest in Parse Cloud function I am running a Parse httpRequest inside a Cloud function, which I am calling from a different Parse job. I cannot figure out how to retrieve the result value / success value from the Cloud function from where I called it within the Cloud job.
Here's the code for the cloud function:
Parse.Cloud.define("maps_request", function(request, response) {
  var maps_url = 'http://maps.googleapis.com/maps/api/directions/json';
  var origin = request.params.origin;
  var destination = request.params.destination;
  var waypoint = "via:" + request.params.waypoint;
  Parse.Cloud.httpRequest({
    url: maps_url,
    params: {
      origin: origin,
      destination: destination,
      waypoints: waypoint,
      optimizeWaypoints: true,
      durationInTraffic: true
    },
    success: function(directions) {
      var time = directions.data['routes'][0]['legs'][0]['duration']['value']
      time = time / 60.00
      response.success(time)
    },
    error: function(error) {
      response.error("Shit broke.")

    }
  })
});

And the code for the call in the Cloud job:
var promise = Parse.Promise.as();
      promise = Parse.Cloud.run('maps_request', {
        origin: String(driverOriginAddress + " " + driverOriginZip),
        destination: String(driverDestinationAddress + " " + driverDestinationZip),
        waypoint: String(driverDestinationAddress + " " + driverDestinationZip)
      }, {
        success: function(results) {
          console.log("Results: " + results)
        },
        error: function(){
          console.log("Error")
        }
      })
      console.log(promise)

The Parse logs show the exact results I want from the Cloud function, but I get this:
"{"_resolved":false,"_rejected":false,"_resolvedCallbacks":[],"_rejectedCallbacks":[]}
I've tried about 50 different version to fix this. Any help would be MUCH appreciated.
This is another version of the code for cloud function:
Parse.Cloud.define("maps_request", function(request, response) {
  var maps_url = 'http://maps.googleapis.com/maps/api/directions/json';
  var origin = request.params.origin;
  var destination = request.params.destination;
  var waypoint = "via:" + request.params.waypoint;
  var test = []
  Parse.Cloud.httpRequest({
    url: maps_url,
    params: {
      origin: origin,
      destination: destination,
      waypoints: waypoint,
      optimizeWaypoints: true,
      durationInTraffic: true
    },
    success: function(directions) {
      var time = directions.data['routes'][0]['legs'][0]['duration']['value']
      time = time / 60.00
      test.push(time)
    },
    error: function(error) {
      console.log("Error")
    }
  }).then(function() {
    response.success(test[0])
  }, function (error) {
    response.error("Error2")
  })
});

And the call:
var test = Parse.Cloud.run('maps_request', {
        origin: String(driverOriginAddress + " " + driverOriginZip),
        destination: String(driverDestinationAddress + " " + driverDestinationZip),
        waypoint: String(driverDestinationAddress + " " + driverDestinationZip)
      })
      console.log("Test: " + test)

The httpResponse shows the right value, but still not able to access them or assign to a variable.

A: There's no need to wrap Parse.Cloud.run() in a promise, as it already returns a promise.
Also in your second example you're calling the cloud function as if it is a sync call instead of async and looking at the promise instead of the result you want.
Try this:
Parse.Cloud.run('maps_request', {
  origin: String(driverOriginAddress + " " + driverOriginZip),
  destination: String(driverDestinationAddress + " " + driverDestinationZip),
  waypoint: String(driverDestinationAddress + " " + driverDestinationZip)
}).then(function (result) {
  // we have the result of the cloud function here, just log it for now
  console.log("Test:", result);
}, function (error) {
  // uh oh!
  console.log(error);
});

A: That sounds about right - you're logging the value of 'promise' to the console. You have to actually resolve() the promise to have it call your Cloud Function and so on.


text:
Q: Flask-Login logout_user does not change is_authenticated I have a test for register/login/logout endpoints and it fails when I register a user, logout and try to login as registered user. For some reason in endpoint current_user.is_authenticated is still True after logout.
Endpoints code:
from flask import Blueprint, Response, request, current_app
from flask_security.core import current_user
from flask_security.utils import logout_user, login_user, verify_password
from flask_api import status
from core.database.user_models import User, USER_DATASTORE
from utils.responses import SUCCESS, BAD_REQUEST, NOT_FOUND

ACCOUNT_BP = Blueprint("account", __name__)

EMAIL_IS_REGISTERED = Response("Email Is Registered", status=status.HTTP_401_UNAUTHORIZED)
USER_INACTIVE = Response("User Is Inactive", status=status.HTTP_403_FORBIDDEN)
WRONG_CREDENTIALS = Response("Wrong Credentials", status=status.HTTP_401_UNAUTHORIZED)

@ACCOUNT_BP.route("/register", methods=['POST'])
def register_endpoint() -> Response:
    """
    # TODO: Fill this docstring.
    """
    if current_user.is_authenticated:
        return NOT_FOUND

    if "email" in request.form and "password" in request.form:
        if USER_DATASTORE.create_new_user(request.form["email"], request.form["password"]):
            user = User.find_by_email(request.form["email"])
            login_user(user, remember=True)
            return SUCCESS

        return EMAIL_IS_REGISTERED

    return BAD_REQUEST

@ACCOUNT_BP.route("/signin", methods=['POST'])
def signin_endpoint() -> Response:
    """
    # TODO: Fill this docstring.
    """
    if current_user.is_authenticated: # IT SHOULD BE False
        return NOT_FOUND

    if "email" in request.form and "password" in request.form:
        user = User.find_by_email(request.form["email"])
        if user and verify_password(request.form["password"], user.password):
            if user.active:
                login_user(user, remember=True)
                return SUCCESS

            return USER_INACTIVE

        return WRONG_CREDENTIALS

    return BAD_REQUEST

@ACCOUNT_BP.route("/logout")
def logout_endpoint() -> Response:
    if current_user.is_authenticated:
        logout_user()
        return SUCCESS

    return NOT_FOUND

Code for test:
import unittest
from flask import Response
from flask.testing import FlaskClient
from flask_security.core import current_user
from main import SERVER

def register(client: FlaskClient, email: str, password: str) -> Response:
    """Fast method for using ``/account/register`` endpoint"""
    form_data = 'email=' + email +'&password=' + password
    return client.post('/account/register', data=form_data, content_type='application/x-www-form-urlencoded')

def signin(client: FlaskClient, email: str, password: str) -> Response:
    """Fast method for using ``/account/signin`` endpoint"""
    form_data = 'email=' + email +'&password=' + password
    return client.post('/account/signin', data=form_data, content_type='application/x-www-form-urlencoded')

def logout(client: FlaskClient) -> Response:
    """Fast method for using ``/account/logout`` endpoint"""
    return client.get('/account/logout')

class UsersAccountTestCase(unittest.TestCase):
    """
    # TODO: Fill this docstring.
    """

    __REGISTER_SUCCESS_EMAIL = 'success@example.com'
    __RANDOM_PASSWORD = 'RandomPassword'

    def test_register_success(self):
        """
        # TODO: Fill this docstring.
        """
        with SERVER.test_client() as client:
            register_result = register(client, self.__REGISTER_SUCCESS_EMAIL, self.__RANDOM_PASSWORD)
            self.assertEqual(register_result.status_code, 200)
            self.assertEqual(register_result.get_data(as_text=True), "Success")
            self.assertTrue(current_user.is_authenticated)
            self.assertEqual(current_user.email, self.__REGISTER_SUCCESS_EMAIL)

            logout_result = logout(client)
            self.assertEqual(logout_result.status_code, 200)
            self.assertEqual(logout_result.get_data(as_text=True), "Success")
            self.assertFalse(current_user.is_authenticated) # THIS PASSES!

            check_result = signin(client, self.__REGISTER_SUCCESS_EMAIL, self.__RANDOM_PASSWORD)
            self.assertEqual(check_result.status_code, 200) # THIS RETURNS 404
            self.assertEqual(check_result.get_data(as_text=True), "Success")
            self.assertTrue(current_user.is_authenticated)
            self.assertEqual(current_user.email, self.__REGISTER_SUCCESS_EMAIL)
            logout(client)

What can possibly lead to this behavior?
UPDATE:
Just tested endpoints with Postman - everything works as intended.

A: This is the strangest issue I have ever seen. I changed return SUCCESS in registration endpoint to something else and it just worked.


text:
Q: Angular Universal Express prerender using wrong path src/src instead of just src/ I am trying out the npm run prerender command in my Angular 11 project, but I get this error:
Generating browser application bundles...Error: ENOENT: no such file or directory, open '/home/xyz/edApp3b/src/src/main.server.ts'
    at Object.openSync (fs.js:476:3)
    at Object.readFileSync (fs.js:377:35)
    at NodeJSFileSystem.NodeJSReadonlyFileSystem.readFile (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/src/ngtsc/file_system/src/node_js_file_system.js:98:23)
    at EsmDependencyHost.DependencyHostBase.recursivelyCollectDependencies (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:81:40)
    at EsmDependencyHost.DependencyHostBase.processFile (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:136:22)
    at EsmDependencyHost.DependencyHostBase.collectDependenciesInFiles (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:56:26)
    at ProgramBasedEntryPointFinder.getInitialEntryPointPaths (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder.js:49:18)
    at ProgramBasedEntryPointFinder.TracingEntryPointFinder.findEntryPoints (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/tracing_entry_point_finder.js:45:41)
    at /home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/execution/analyze_entry_points.js:28:41
    at new ClusterMaster (/home/xyz/edApp3b/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:45:30)

As you can see in the first line of the error output, it is looking for main.server.ts in src/src/ instead of just src/ ... why is that?, and how do I fix it?
I just installed express engine with ng add @nguniversal/express-engine, that's it. So I didn't do any of the configuration myself. I've been looking around in config files but there is no obvious values related to prerender and a path.

A: The configuration is in tsconfig.server.json. There you can change the path to the required files (main.server.ts and server.ts are defaults). You might also need to update the path to servers.ts
  "files": [
      "main.server.ts",
      "../server.ts"
  ],


text:
Q: how can i divide grouped masked id by a value that is in another df (the df contains a value for each masked id ) df = pd.DataFrame([[1,'A', 4], [1,'B', 2], [2,'C', 5], [2,'A', 5], [3,'B', 2]],
                  columns=['maskedid ', 'test  ', 'value'])

    maskedid test  value
     1        A      4
     1        B      2
     2        C      5
     2        A      5
     3        B      2

I want to group by 'maskedid' and 'test' and run .describe () i order to find the count and divide the count output by a value from another dataframe. #each masked id has its own value .
df with the below values
maskedid value
 1        5
 2        6
 3        7

A: My understanding is that you want to generate the .describe() info and divide the data generated by the other dataframe (df2).  You can acheive it this way:
df.groupby(['maskedid', 'test']).describe()

              value
              count mean std  min  25%  50%  75%  max
maskedid test
1        A      1.0  4.0 NaN  4.0  4.0  4.0  4.0  4.0
         B      1.0  2.0 NaN  2.0  2.0  2.0  2.0  2.0
2        A      1.0  5.0 NaN  5.0  5.0  5.0  5.0  5.0
         C      1.0  5.0 NaN  5.0  5.0  5.0  5.0  5.0
3        B      1.0  2.0 NaN  2.0  2.0  2.0  2.0  2.0

Then, divide by df2 matching maskedid by:
df.groupby(['maskedid', 'test']).describe().div(df2.set_index('maskedid')['value'], axis=0, level=0)

Result:
                  value
                  count      mean std       min       25%       50%       75%       max
maskedid test
1        A     0.200000  0.800000 NaN  0.800000  0.800000  0.800000  0.800000  0.800000
         B     0.200000  0.400000 NaN  0.400000  0.400000  0.400000  0.400000  0.400000
2        A     0.166667  0.833333 NaN  0.833333  0.833333  0.833333  0.833333  0.833333
         C     0.166667  0.833333 NaN  0.833333  0.833333  0.833333  0.833333  0.833333
3        B     0.142857  0.285714 NaN  0.285714  0.285714  0.285714  0.285714  0.285714

Input Used
df = pd.DataFrame([[1,'A', 4], [1,'B', 2], [2,'C', 5], [2,'A', 5], [3,'B', 2]],
                  columns=['maskedid', 'test', 'value'])

   maskedid test  value
0         1    A      4
1         1    B      2
2         2    C      5
3         2    A      5
4         3    B      2

df2 = pd.DataFrame({'maskedid': [1, 2, 3], 'value': [5, 6, 7]})

   maskedid  value
0         1      5
1         2      6
2         3      7


text:
Q: WPF & C# [Mahapps.Metro] Animating Controls I'm starting to learn a little bit of WPF and Mahapps.metro, so I'm pretty new with those ones; here the question:
I have a button and two textboxes, the textboxes visibility is hidden when the forms loads, so when the user clicks the button, the textboxes visibility will be visible, but I want the textboxes to appear with that "slide" animation of the form load that Mahapps provides with the MetroWindow.
I tried using TransitioningContentControl but I couldn't make it happen. I would really appreciate your help, thanks.
My XAML:
<Controls:MetroWindow x:Class="practicas.nuevo"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:practicas"
        mc:Ignorable="d"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="Reporte Nuevo" Height="300" Width="574.444" Loaded="formload">
    <Controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Purple.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Controls:MetroWindow.Resources>
    <Grid>
        <Controls:TransitioningContentControl x:Name="transitioning" Transition="Down"/>
        <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="238,89,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
            <TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="95" Margin="345,51,0,0" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" Width="211" Controls:TextBoxHelper.Watermark="Hi Im a watermark" Background="#FF7400FF"/>
            <TextBox x:Name="textBox2" HorizontalAlignment="Left" Height="95" Margin="0,51,0,0" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" Width="211" Controls:TextBoxHelper.Watermark="Hi im another watermark" Background="#FF7400FF"/>
    </Grid>

</Controls:MetroWindow>

EDIT: This method gave me the solution, the only difference is that the control that I used was ContentControl instead of StackPanel, here is my xaml for anyone who wants to make something like this:
P.S: Marked as an answer, thanks man.
 <Controls:TransitioningContentControl x:Name="transitioning" Transition="Left">
    </Controls:TransitioningContentControl>
    <Controls:TransitioningContentControl x:Name="transitioning2" Transition="Up">
    </Controls:TransitioningContentControl>
    <Controls:TransitioningContentControl x:Name="transitioning3" Transition="Up">
    </Controls:TransitioningContentControl>
    <ContentControl x:Name="panel" Margin="-10,0,0,0" Visibility="Hidden">
        <Canvas x:Name="canvas">
            <Label x:Name="label" Content="Reporte Recibido:" Canvas.Left="10" Canvas.Top="41" Width="112"/>
            <Label x:Name="label2" Content="Acciones a tomar:" Canvas.Left="600" Canvas.Top="41" Background="{x:Null}" RenderTransformOrigin="0.497,0.551"/>
            <Controls:ToggleSwitch x:Name="ToggleSwitch" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}"  Canvas.Left="284" Canvas.Top="122" OnLabel="Confirmado" OffLabel="Por Confirmar" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" Width="140" Checked="switched" Unchecked="unswitched" />
            <Image x:Name="accion" Height="25" Width="33" Canvas.Left="671" Canvas.Top="218" Source="Imagenes/Add-New.png" MouseDown="accionagregar"/>
            <RichTextBox x:Name="RichTextbox1" HorizontalAlignment="Left" Height="154" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" Width="284" Canvas.Left="438" Canvas.Top="64" TextChanged="textchanged" RenderTransformOrigin="0.815,0.541" Background="#FF7400FF" GotFocus="focus">
                <xctk:RichTextBoxFormatBarManager.FormatBar >
                    <xctk:RichTextBoxFormatBar />
                </xctk:RichTextBoxFormatBarManager.FormatBar>
                <FlowDocument/>

            </RichTextBox>

            <RichTextBox x:Name="RichTextbox2" Background="#FF7400FF" Canvas.Top="64" GotFocus="reportefocus" Height="154" Width="274" Canvas.Left="5">

                <xctk:RichTextBoxFormatBarManager.FormatBar >

                    <xctk:RichTextBoxFormatBar />

                </xctk:RichTextBoxFormatBarManager.FormatBar>

                <FlowDocument/>

            </RichTextBox>

            <Rectangle x:Name="reporteimagen" HorizontalAlignment="Left" Height="100" Margin="83,99,0,0" VerticalAlignment="Top" Width="100">

                <Rectangle.Fill>

                    <VisualBrush Visual="{StaticResource appbar_book_open_text}"/>

                </Rectangle.Fill>

            </Rectangle>

            <Rectangle x:Name="accionesimagen" HorizontalAlignment="Left" Height="100" Margin="536,99,0,0" VerticalAlignment="Top" Width="100" >

                <Rectangle.Fill>

                    <VisualBrush Visual="{StaticResource appbar_book_list}"/>

                </Rectangle.Fill>

            </Rectangle>

            <xctk:DateTimePicker x:Name="datetime" Width="162" Canvas.Left="504" Canvas.Top="218" Foreground="White" Format="Custom" FormatString="hh:mm tt" TimeFormat="Custom" TimeFormatString="hh:mm tt" CultureInfo="es-GT" ShowDropDownButton="False" Text="DefaultValue" IsReadOnly="True"/>

            <Image x:Name="image7" Height="27"  Canvas.Left="697" Canvas.Top="6" Width="33" Source="Imagenes/Repeat-All.png" RenderTransformOrigin="0.471,0.596" ToolTip="Reiniciar" MouseDown="reiniciar" Visibility="Hidden"/>

        </Canvas>

    </ContentControl>

    <ContentControl x:Name="panel2" Visibility="Hidden">

        <Canvas>

            <Label x:Name="label5" Content="Reporte Creado Por:" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Canvas.Left="18" Canvas.Top="329" Background="{x:Null}" RenderTransformOrigin="0.497,0.551" Width="128"/>

            <Label x:Name="label6" Content="Correlativo" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Canvas.Left="305" Canvas.Top="329" Background="{x:Null}" RenderTransformOrigin="0.497,0.551" Width="128"/>

            <Label x:Name="label7" Content="Creado En:" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Canvas.Left="592" Canvas.Top="329" Background="{x:Null}" RenderTransformOrigin="0.497,0.551" Width="128"/>

            <TextBox x:Name="textBox3" Height="23" HorizontalContentAlignment="Center" Canvas.Left="305" Canvas.Top="355" Width="128" IsReadOnly="True" Controls:TextBoxHelper.Watermark="Se genera al concluir."/>

            <TextBox x:Name="textBox4" Height="23" HorizontalContentAlignment="Center" Canvas.Left="18" Canvas.Top="355" Width="128" IsReadOnly="True"/>

            <TextBox x:Name="textBox5" Height="23" HorizontalContentAlignment="Center" Canvas.Left="592" Canvas.Top="355" Width="128" IsReadOnly="True"/>

            <Image x:Name="image1" Height="44" Canvas.Left="504" Canvas.Top="337" Width="51" Source="Imagenes/Mail-Send.png" MouseDown="enviar" Visibility="Hidden"/>

            <Image x:Name="image2" Height="44" Canvas.Left="225" Canvas.Top="337" Width="51" Source="Imagenes/User-Add.png"/>

            <Image x:Name="image3" Height="44" Canvas.Left="169" Canvas.Top="337" Width="51" Source="Imagenes/Recycle-Bin.png" MouseDown="cancelar"/>

            <Image x:Name="image5" Height="44" Canvas.Left="443" Canvas.Top="337" Width="51" Source="Imagenes/Lock.png"/>

            <Image x:Name="image4" Height="44" Canvas.Left="443" Canvas.Top="337" Width="51" Source="Imagenes/Lock-Open.png"/>

        </Canvas>

    </ContentControl>

Example

A: Animations in WPF are quite tricky to pull of. I've made a fade animation a while back and it was quite a lot of work. Such a slide animation would require a lot of code and debugging to get it right. My recommendation is use a free slide animation library, and if you are feeling up to the task, you might be able to get a hold of some source code that you can use for inspiration if you want.

A: You didn't place any content inside the transitioning content control.  Try this:
<Grid>
   <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="238,89,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
   <Controls:TransitioningContentControl x:Name="transitioning" Transition="Down">
      <StackPanel>
         <TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="95" Margin="345,51,0,0" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" Width="211" Controls:TextBoxHelper.Watermark="Hi Im a watermark" Background="#FF7400FF"/>
         <TextBox x:Name="textBox2" HorizontalAlignment="Left" Height="95" Margin="0,51,0,0" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" Width="211" Controls:TextBoxHelper.Watermark="Hi im another watermark" Background="#FF7400FF"/>
      </StackPanel>
   </Controls:TransitioningContentControl>
</Grid>

Plus, reading the documentation, you'll see TransitioningContentControl performs the animation when the content changes.  So you want to start with empty Transitioning Content Control, and then inside your Button click handler, set TransitioningContentControl Content dynamically to the two textboxes (need to be wrapped inside another control, like StackPanel, because transitioning control can only have a single child content.


text:
Q: Rewriting User standard model when customizing User class guys! I'm using standard User model from django.contrib.auth.models import User.
And I want to customize User model, expecially to add a field with ForeignKey. For example:
class User(models.Model):
    this_users_team = models.ForeignKey(Team, null=True, on_delete=models.SET_NULL)

If I wrote this code is the django will overwriting standard User model with my data in databases or will it cause the issues?
One more time, I haven't not any class User in my code. But I'm using User in other models, for example:
id_user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)

A: It's not recommended to customise the provided User model.
If you don't want a Custom User model (eg subclass from AbstractUser - which is a copy of the default user model designed to allow extension), then the simplest way to extend user is to create another model with a one to one relationship to it.
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile")
    team = models.ForeignKey(Team, null=True, on_delete=models.SET_NULL)

With the related name you can refer to user.profile.team
Plenty more on this subject in the docs


text:
Q: NSDate: Convert UTC value to Military Time Zone Value The military way of writing date and time, aka Military Date Time Group or DTG, has the following format:
DDHHMMZMONYY
where DD = Day
HH = Hour (24 hour)
MM = Minutes
Z = Military Time Zone
MON = Month
YY = Year
For example: Dec 27, 2015, 05:48 +0200 will, in the military format, be:
270548BDEC15
with B being equal to UTC+2 (+0200)  (see http://www.timeanddate.com/time/zones/military for UTC and corresponding Military Time Zones)
I am trying to accomplish this military style/formatting, and currently I have the following in Swift:
let StartDTG = NSDate()
let StartDTGDateFormatter = NSDateFormatter()

StartDTGDateFormatter.dateFormat = "ddkkmmZZZLLLyy"

let tempConvertedTAStartDTG = StartDTGDateFormatter.stringFromDate(StartDTG)

let UpperCaseTAStartDTG = tempConvertedTAStartDTG.uppercaseString

TAStartDTG.text = String(UpperCaseTAStartDTG)

This code will take the current date and time and display it in the text field as follows:
270548+0200DEC15

QUESTION:  How can I convert the ZZZ-value to represent the equivalent military value so that I can get this?
270548BDEC15

A: I speak swift with a stutter, but my advice would be to use a standard format...
StartDTGDateFormatter.dateFormat = "ddkkmm X LLLyy"

... the "X" will give hours from GMT +00...+12, -01..-11.  The spaces will be useful for parsing...
let UpperCaseTAStartDTG = tempConvertedTAStartDTG.uppercaseString
let components = UpperCaseTAStartDTG.componentsSeparatedByString(" ")

... which will provide an array like this...
(
    262050,
    "-08",  // California, USA
    DEC15
)

...the standard bit, the hours from GMT, and the remainder of the standard bit.  It should be straight-forward to develop a function that takes the second element of that array and answers the military zone.
Note that array responds to componentsJoinedByString() so it should be easy to put it back together.

A: You can create a dictionary with your custom key and values and just get the timezone property secondsFromGMT, divide it by 3600 to get the offset in hours and use it as your dictionary key to get the correspondent time zone values:
extension NSDate {
    struct Date {
        static let militaryZones: [Int:String] = {
            return [-12: "Y", -11: "X", -10: "W", -9: "V", -8: "U", -7: "T", -6: "S", -05: "R", -4: "Q", -3: "P", -2: "O", -1: "N", 0: "Z", 1: "A", 2: "B", 3: "C", 4: "D", 5: "E", 6: "F", 7: "G", 8: "H", 9: "I", 10: "K", 11: "L", 12: "M"]}()
        static let formatterMilitary: NSDateFormatter = {
            let formatter = NSDateFormatter()
            formatter.calendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierISO8601)
            formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
            formatter.dateFormat = "ddkkmm LLLyy"
            return formatter
        }()
    }
    var militaryTimeZone: String {
        return Date.militaryZones[NSTimeZone.localTimeZone().secondsFromGMT/3600] ?? ""
    }
    var militaryTime: String {
        return Date.formatterMilitary.stringFromDate(self)
            .componentsSeparatedByString(" ")
            .joinWithSeparator(militaryTimeZone)
            .uppercaseString
    }
}
NSDate().militaryTime      // "270455ODEC15"
NSDate().militaryTimeZone  // "O"


text:
Q: how to access mongodb using pem file I'm trying to access mongodb on remote server using ssl.  I followed the following tutorial [link].
I don't even know about the password part yet as I use ssh and the pem file without a password all the time.
Regardless, I used the following command:
mongod --sslOnNormalPorts <my pem file>

and got the following error:
Error parsing command line: unknown option sslOnNormalPorts

is there a simple way for me to access the remote mongodb database remotely?
EDIT Based on Comments
I read this link and tried the following:
mongo --host xx.xx.xxx.xxx/db-name --sslPEMKeyFile pemfileName.pem

I got the following error:
Error parsing command line: unknown option sslPEMKeyFile

What am I doing wrong?

A: You can try this command
ssh -i ~/my-aws-key.pem -N -f -L 8000:localhost:27017 ubuntu@ec2-54-252-168-106.ap-southeast-2.compute.amazonaws.com


text:
Q: Proof: mean value theorem Problem: Let $ f $ be a differentiable function on the real interval $[a,b]$.  Prove that there is a point $ x\in(a,b) $ at which $ f(b)-f(a)=(b-a)f'(x)$.

A: hint: Consider any arbitrary interval ti and ti - 1 in a Riemann sum instead of a,b


text:
Q: Unable convert a column from object to str I am playing around with my amazon purchase history and trying to clean up the data. One of the problems that I am having is converting my columns from object to string then float. The reason why is because I want to remove the $ from total money spent before I try to do any calculations. I tried something like this, but when I do new_ap.dtype it still list this column as an Object.
new_ap['money'] = new_ap['money'].astype('str')
new_ap = new_ap.apply(lambda x: x.str.strip('$'))
new_ap['money'] = new_ap['money'].astype('float64')

Picture to verify my problem

A: Try replacing dollar and comma and then convert to float
new_ap['money'] = new_ap['money'].str.replace('[\$,]', '', regex=True).astype(float)


text:
Q: Laravel 8 dd() limitations how can I increase the laravel 8  dd() limitations? I have lots of nested relationship and I cant view most of them due to many data. For example this
  #relations: array:4 [▼
    "activecourses" => Illuminate\Database\Eloquent\Collection {#1346 ▼
      #items: array:3 [▼
        0 => App\Models\Studentcourse {#1353 ▶}
        1 => App\Models\Studentcourse {#1354 ▼
          #guarded: []
          #connection: "mysql"
          #table: "studentcourses"
          #primaryKey: "id"
          #keyType: "int"
          +incrementing: true
          #with: []
          #withCount: []
          +preventsLazyLoading: false
          #perPage: 15
          +exists: true
          +wasRecentlyCreated: false
          #escapeWhenCastingToString: false
          #attributes: array:22 [ …22]
          #original: array:22 [ …22]
          #changes: []
          #casts: []
          #classCastCache: []
          #attributeCastCache: []
          #dates: []
          #dateFormat: null
          #appends: []
          #dispatchesEvents: []
          #observables: []
          #relations: array:1 [ …1]
          #touches: []
          +timestamps: true
          #hidden: []
          #visible: []
          #fillable: []
        }
        2 => App\Models\Studentcourse {#1355 ▶}
      ]
      #escapeWhenCastingToString: false
    }

I found this link Laravel dd function limitations but I think its outdated since the new dd function for laravel 8 is
this is from vendor folder.
use Symfony\Component\VarDumper\VarDumper;

if (!function_exists('dump')) {
    /**
     * @author Nicolas Grekas <p@tchwork.com>
     */
    function dump($var, ...$moreVars)
    {
        VarDumper::dump($var);

        foreach ($moreVars as $v) {
            VarDumper::dump($v);
        }

        if (1 < func_num_args()) {
            return func_get_args();
        }

        return $var;
    }
}

if (!function_exists('dd')) {
    /**
     * @return never
     */
    function dd(...$vars)
    {
        if (!in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !headers_sent()) {
            header('HTTP/1.1 500 Internal Server Error');
        }

        foreach ($vars as $v) {
            VarDumper::dump($v);
        }

        exit(1);
    }
}

Tried adding this lines before dd() but doesnt work
   ini_set('xdebug.var_display_max_depth', 100);
   ini_set('xdebug.var_display_max_children', 2000);
   ini_set('xdebug.var_display_max_data', 2000);

Is there any way or alternative in viewing nested data? I dont want to use var_dump or print_r since the browser becomes slow when there are lots of data. Thanks in advance.

A: This question has already been answered here: Laravel dd function limitations - EDIT: those still work but are not complete anymore (VarDumper overrides), and should not be used in production.
Override Laravel dump

The Dumper is using Symfony's VarCloner which is extending the AbstractCloner. This class has a $maxItems attribute set to 2500.

Basically, you need to override Laravel Dumper as explained in the post's answers. You can also create a new method like ddd() allowing larger outputs with a custom Dumper.
Note that a very large dataset can crash your browser tab/window as the DOM size will grow with it.
Alternatives
Alternatively, if you really need to view this data "live" (ex: an API route), you could return JSON and check them with Postman or Chrome debugger (network tab, parsed payload). They can parse and provide a "dynamic" data-view like Laravel dump does with HTML/CSS/JS.
Very large JSON (+50/100mo)
For very large JSON, I would recommend:

*

*Downloading it as a JSON file

*View it with a large JSON viewer/parser (I use the paid UltraEdit for 500mo+ JSON. Some freeware are enough for smaller files. Postman/Chrome are OK for 50mo I guess). Same, they can parse and provide a dynamic view like dd/dump.

EDIT:
I just tested "Lucas Martin" solution on Laravel 8.6.12 and it works as expected:
EDIT 2: works but is not complete, the dumper is more complex in 8.X than 5.x (server format). Logic is the same but provided the override is not complete anymore. I would only use it for this particular debug case. I would use this simple/old logic with a custom method.
Default (truncated):

VarDumper updated handler (full):

The limitation of this solution will be the browser. It'll crash with a huge dataset as DOM size becomes too much to store in memory. Also, I would only use it in development environments.
Laravel debugbar debug helper may be able to handle larger objects and dynamic view, but still limited to browser memory and DOM size.
credit: random JSON generator

A: There are three ways I use the dd() method.

*

*Printing to command line (either via written test or artisan tinker)

*Printing to browser. You can do this if you're making use of Blade.

*Printing to a Log file. Use the Log facade, for example Log::debug($activeForces)
Due to the large amount of data, it won't even be advisable to print out the content of your variable to screen. Try using the log file.
Alternatively, why don't you narrow down the content being die-dumped? For example: dd($activeForces[0])

A: So based on what you want, as well as what I've used. Tracy might be a better tool than dd() Visit their GitHub Here
This replaces the default debug system in Laravel with the Tracy PHP debugger created by the team at Nette.
This means instead of using dd($myArray) you would use bdump($myArray,"Active Courses") (The second Parameter is optional but useful when using multiple bdumps() on a single page so you know which is which)
This will also allow you to see the rendered page as well as the dump (And other useful features, such as the Route, Session and even the Laravel Terminal)

A: In this case the many data is not due to what is under the model. Just dd() each of the models you want to see.
dd($variable['activecourses'][0]);

Either way your reason for not using dump (Browser getting slow) makes no sense. cause DD or anything else with interactive javascript and styling of the same data is always gonna be way slower. Increasing your execution time and memory limit for php is not gonna change that.
Another option is to dump the data to a file and open it with something efficient like Sublime.


text:
Q: Get phone number while in call is there a way to retrieve the phone number of the other party in an ongoing call?
I know that I would be able to get it that moment that call comes in or goes out using an broadcast receiver and EXTRA_INCOMING_NUMBER or EXTRA_PHONE_NUMBER. But how do I get the number if the call is already ongoing?
Edit:
Currently I've this, but I want to be able to query the number of an call that is already active before my app is launched:
public class PhoneStateReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)
        intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER)
    }
}


text:
Q: How can I get the GPS week number given a date in C? I have a date like: 171115 183130 (17-11-15 18:31:30).  I using an API that required me to supply the date based on the week number but since it's for a GPS service it needs to be the week number counting from 1980 (first epoch)
I couldn't find any library in C that takes into consideration leap days/seconds. Any ideas?
For example, week 1873 should be 2015 11 30.

A: By using difftime() no need to assume Jan 1, 1970 epoch.  difftime() returns the difference in the 2 time stamps as a number of seconds (double).  The return value is independent of the number type and epoch used for time_t.
Use mktime() to convert YMD to time_t.
Open question: timezone not mentioned in OP's post.
#include <stdio.h>
#include <time.h>

time_t TimeFromYMD(int year, int month, int day) {
  struct tm tm = {0};
  tm.tm_year = year - 1900;
  tm.tm_mon = month - 1;
  tm.tm_mday = day;
  return mktime(&tm);
}

#define SECS_PER_WEEK (60L*60*24*7)

int GPSweek(int year, int month, int day) {
  // See update below
  double diff = difftime(TimeFromYMD(year, month, day), TimeFromYMD(1980, 1, 1));  // See update
  return (int) (diff / SECS_PER_WEEK);
}

int main(void) {
  printf("%d\n", GPSweek(2015, 11, 30));
  return 0;
}

Output
1873

[edit 2022]
@Bianca offered the correction to use Jan 5, 1980 epoch.  Reviewed against this and determine Jan 6, 1980 is correct which also matches this.
int GPSweek(int year, int month, int day) {
  double diff = difftime(TimeFromYMD(year, month, day), TimeFromYMD(1980, 1, 6));
  return (int) (diff / SECS_PER_WEEK);
}

Pedantic: Should a TZ setting include an area that has gained/lost a day due to switching across the International dateline, mktime() may be problematic.
Week numbers before Jan 6, 1980 need additional code.

A: Since the date shows the day and time separately, you do not need to worry about leap seconds.
Use the C library API to convert from DDMMYY to the number of seconds since the C epoch (1/1/1970), subtract the number of seconds until 1/1/1980 and divide the result by 7*24*3600 to get the number of weeks elapsed from 1/1/1980.


text:
Q: Need mathematical steps for Hoeffding's Inequality applied to Bernoulli Distribution I am trying to understand Hoeffiding's Inequality in Machine Learning and I am referring to WikiPedia for it. Hoeffding's Inequality is defined as follows:
$ P(|\hat{\theta} - \theta)| \ge \epsilon) \le 2e^{-2n\epsilon^2} $
But when the inequality applied to Independent and Identically Distributed Bernoulli Random Variables, the inequality becomes as follows:

How can I derive the second inequality from the first ineqaulity? I hope to get understandable mathematical steps from the first to the second inequality.

A: Let $X_1, \ldots X_n$ be iid Bernoulli random variables with parameter $p$ - think of this as a sequence of coin tosses, where $X_i = 1$ represents heads on the ith trial.
Then, let $H(n)$ be the number of heads in the previous sequence: in other words,
$$H(n) = \sum_{i=1}^n X_i.$$
Hoeffding's inequality states that
$$P(|\overline{X} - \mathbb{E}[\overline{X}]| \geq \epsilon) \leq 2e^{-2n\epsilon^2},$$
Where $\overline{X} = \frac{1}{n}\sum_i X_i = H(n) / n$ is the sample mean.
Next, note that $\mathbb{E}[\overline{X}] = p$.
Therefore, we have that
\begin{align*}
P(|H(n) / n - p| \geq \epsilon) &\leq 2e^{-2n\epsilon^2} \\
1 - P(|H(n) / n - p| \leq \epsilon) &\leq 2e^{-2n\epsilon^2} \\
1 - P(-\epsilon + p \leq H(n) / n \leq \epsilon + p) &\leq 2e^{-2n\epsilon^2} \\
1 - P(n(p - \epsilon) \leq H(n) \leq n(p + \epsilon)) &\leq 2e^{-2n\epsilon^2} \\
P(n(p - \epsilon) \leq H(n) \leq n(p + \epsilon)) &\geq 1 - 2e^{-2n\epsilon^2}
\end{align*}


text:
Q: cloning objects in JavaScript vs new keyword I'm reading through a textbook on Javascript and there is an example of shallow cloning vs deep cloning of objects.
Can anyone give me an example why I would want to clone an object instead of using the 'new' keyword ?
For example, in a simple game,if I have 10 enemy objects, I would create a constructor called 'enemy' and create new enemies with the 'new' keyword.

A: The new operator creates an instance of the object from the details mentioned in the class/function. Now say you have created an object and changed/added some property to it.
Next time you use the new keyword, you won't get the changes made above. Cloning would actually give you a new object with the changed values.
Lets take an example:
function Car() {}
myCar = new Car();
console.log(myCar.color);    // you'll get undefined
myCar.color = "red";
console.log(myCar.color);    // you'll get red

// now create another object
yourCar = new Car();
console.log(yourCar.color);    // you'll still get undefined

// if you clone
yourCar = clone(myCar) // assume you have some clone method
console.log(yourCar.color);    // Now you'll get red

In your case, if you have created 10 'enemies' object. At some point in the game you may have set some properties for those enemies object. If you use new operator, those changes won't reflect in the new object. However if you clone the enemies object, you will get a new object along with the changes made before.
If you are interested in shallow copy vs deep copy, it's answered at What is the difference between a deep copy and a shallow copy?


text:
Q: Reading audio file from socket inputstream in Windows Phone I'm trying to allow my computer to send music files to my app (Windows Phone 8). I use a socket to show a html file on my computer where I can select a file and upload it:
Upload music file:

<input type="file" id="musicfile"/>

<input type="button" onclick="sendFile()" value="send"/>

I read the filedata like so:
// handle request
private async void HandleRequest(StreamSocket socket)
{
    //Initialize IO classes
    DataReader reader = new DataReader(socket.InputStream);
    reader.InputStreamOptions = InputStreamOptions.Partial;

    // read request
    var stringHeader = await reader.LoadAsync(4);
    if (stringHeader == 0)
    {
        // disconnected
        return;
    }

    // get length
    int length = reader.ReadInt32();

    // initiate data
    byte[] data = new byte[length];

    // load and read data
    uint bytes = await reader.LoadAsync((uint)length);
    reader.ReadBytes(data);
}

I get a OutOfMemoryException when trying to create byte[] data. Not suprising as length = 1215263604.
I wonder how it could be that large, the music file is 7.68MB.
The content type of the request is "audio/mp3".

A: Why don't you use Content-Length header to get the size in the wp app? If it's returning an incorrect value, then make changes in the server so that the header value is available.
The OutOfMemoryException error will not arise then.


text:
Q: IdentityServer4 performance starting to degrade We recently started to experience issues with logging on to our apps. After troubleshooting we identified that latency to the IDServer via the load balancer had started to increase. We restarted our SQL server which hosts the IDServer and all returned to normal but after a few hours I can see that the latency has begun to rise again.
I have attached a graph showing the latency over the previous four weeks. The red arrow indicates where the restart took place.
We haven't made a change to the apps, the load balancer or the SQL server itself so there is nothing that we can immediately point to as the potential cause for the issue.
I am not an IDServer expert. Can anyone shed any light on what could potentially be behind such a situation ?
We reviewed all other elements of the application and could find no issues. There are no errors logged on relevant infrastructure elements - the only indication of any element at fault was identified as outlined above and shown on the attached image. The restart of the SQL server cleared the issue but only for a short period.
TIA


text:
Q: Access variable from function to another function I have two function that separate from each other but I want to make these functions share variable.
in this example I have very basic function that print out variable I call it nameOutside
function nameOutside() {
    console.log(name);
}

in this example I have nameInside function and it has variable called name and I have in the bottom of the function another function nameOutside and I want this function to print out name without passing into the function ( because it inside the nameInside function)
function nameInside() {
    let name = "my name";
    nameOutside();
}

The problem is that nameOutside function doesn't have an access to name variable
How can I make it accessible to nameInside function without passing into it

A: If you want access to name variable, you have to define nameOutside() inside nameInside():
function nameInside() {
    let name = "my name";

    function nameOutside() {
        console.log(name);
    }

    nameOutside();
}

A: It would not be a good practice to do so. Pass name as variable another method and use so.

A: In object oriented programming, different methods (functions) of an object can share common variables using the 'this' keyword. Here in this example I declare a class called 'Context' with two methods 'nameOutside' and 'nameInside'. Then I instantiate an object from the class, storing the reference in the 'context' variable. Finally I call the nameInside() method of that object.

class Context {
  nameOutside() {
    console.log(this.name);
  }

  nameInside() {
    this.name = "my name";
    this.nameOutside();
  }
}

let context = new Context();
context.nameInside();

A: You can make the name variable global
let name;
function nameInside() {
  name = "my name"; // global variable
  nameOutside();
}

function nameOutside() {
  console.log(name);
}

nameInside();

https://www.w3schools.com/js/js_scope.asp for you reference on global variables(an undeclared variable is global in JS)
To get the variable in window object
window.name = "my name";

function nameInside() {
  nameOutside();
}

function nameOutside() {
  console.log(window.name);
  console.log(name); // both with give same output
}

nameInside();


text:
Q: AWS Media Converter creates new job for each file? I am working on AWS MediaConverter and trying to create a Node js API which converts .mp4 format to .wav format.
I have the api is working correctly, however it is creating a new job for each individual .mp4 file.
Is it possible to have one MediaConvert job and use that for every file in the input_bucket instead of creating a new job for every file?
I have tried going through AWS MediaConvert Documentation and various online articles, but I am not able to see any answer to my question.
I have tried to implement my api in following steps :

*

*create an object of class

AWS.MediaConvert()

*

*create a job template using

MediaConvert.createJobTemplate

*

*create a job using

MediaConvert.createJob

A: There is generally a 1 : 1 relationship between inputs and jobs in MediaConvert.
A MediaConvert job reads an input video from S3 (or HTTP server) and converts the video to output groups that in turn can have multiple outputs. A single media convert job can create multiple versions of the input video in different codecs and packages.
The exception to this is when you want to join more than one input file into a single asset (input stitching).
In this case you can have up to 150 inputs in your job. AWS Elemental MediaConvert subsequently creates outputs by concatenating the inputs in the order that you specify them in the job.
Your question does however suggests that input stitching is not what you are looking to achieve. Rather, you are looking to transcode multiple inputs from the source bucket.
If so, you would need to create a job for each input.
Job Templates (as well as Output Presets) work to speed up your job setup by providing groups of recommended transcoding settings. Job templates apply to an entire transcoding job whereas output presets apply to a single output of a transcoding job.
References:

*

*Step 1: Specify your input files : https://docs.aws.amazon.com/mediaconvert/latest/ug/specify-input-settings.html

*Assembling multiple inputs and input clips with AWS Elemental MediaConvert : https://docs.aws.amazon.com/mediaconvert/latest/ug/assembling-multiple-inputs-and-input-clips.html

*Working with AWS Elemental MediaConvert job templates : https://docs.aws.amazon.com/mediaconvert/latest/ug/working-with-job-templates.html

*Working with AWS Elemental MediaConvert output presets : https://docs.aws.amazon.com/mediaconvert/latest/ug/working-with-presets.html


text:
Q: What new geometric information about a matrix does eigendecomposition of the matrix tells us? Since we break the matrix down into eigenvectors and eigenvalues, I would presume that it has some sort of geometric information.
This video seems to suggest one https://youtu.be/9YtmGy-wfE4?t=793, however, I can't seem to relate the meaning explained with the components of the eigendecomposition.
Can someone kindly explain to me the geometric meaning of eigendecomposition?

A: Let $\varphi$ be an endomorphism of a vector space $V$.
If $v$ is an eigenvector of $\varphi$ corresponding to the eigenvalue $\lambda$, this simply means that $\varphi$ induces an homothety of ratio $\lambda$ on the line generated by $v$, i.e. every vector on this line is stretched out by $\lambda$.
Note that this can be extended to the case of an eigenspace $W$.
For instance, if $\varphi : \Bbb R^2\to \Bbb R^2$ is the linear map whose matrix in the canonical basis is
$$\begin{bmatrix} 2 & 0\\ 0& 3 \end{bmatrix}$$
then it corresponds to stretching out all the x-axis by a factor 2 and simultaneously all the y-axis by a factor 3.
Edit: (answer to your comment below)
Performing the eigendecomposition of a diagonalizable matrix $A$ gives you $A=PDP^{-1}$ where:

*

*$D$ is the diagonal matrix containing the eigenvalues of $A$

*$P$ is an invertible matrix whose columns form the coordinate vectors of a basis of $V$ which contains eigenvectors of $A$.
Geometrically, multiplying by $P$ on the left and by $P^{-1}$ on the right simply corresponds to a change of basis (cf. the change of basis formula): it gives you a set of new coordinate axes where the linear map acts as the diagonal matrix $D$ (stretchings as before).


text:
Q: How do i manage ArrayIndexOutOfBounds Below is a simple program which searches for sequential characters. However I get an exception because I'm searching outside of the array index. I understand why it occurs but unsure how do I manage this?
public static void main(String [] args)
    {
        String term = "Popeye's fishCat";
        String query = "P's SalmonCat";
        int score = 0;

        char [] termChar = term.toCharArray();
        char [] queryChar = query.toCharArray();

        if((queryChar[0]) == (termChar[0]))
        {
            score++;
        }

        for(int i = 0; i < queryChar.length; i++)
        {
            for(int j = 0; j < termChar.length; j++)
            {
                if(queryChar[i] == termChar[j] )
                {
                    if((queryChar[i + 1]) == (termChar[j + 1])) //Causes an exception
                    {
                        System.out.println((queryChar[i + 1]) + " " + (termChar[j + 1]));
                        score++;
                        break;
                    }
                }
            }
        }

        System.out.println(score);
    }

A: Adjust your loop conditions:
for(int i = 0; i < queryChar.length - 1; i++) {
            for(int j = 0; j < termChar.length - 1; j++)

Note the added -1
If you always look at the next item in the loop, you can't loop to the last item, because it doesn't have a next item.

A: Just remove i +1 or j+1 in this bit
if((queryChar[i + 1]) == (termChar[j + 1])){
    System.out.println((queryChar[i + 1]) + " " + (termChar[j + 1]));
    score++;
    break;

}
As legnth returns the size of the array, counting the first element as 1, but when getting elements from an array, the first is labeled zero. Using length - 1 ( the highest possible value in that loop, as when i = length the loop stops), and then adding 1, tries to refer to array[length], which doesn't exist. As it starts at zero, so the last element is array[length-1]


text:
Q: How Angular JS UI-Router changes url in navigation bar without reloading page I am learning Angular JS ui-router and I was wondering How ui-router manages to change url in navigation bar without reloading entire page?.
I have tried reading this blog and some stackoverflow questions, but couldn't find any proper explaination. Can some one explain properly?
Thanks in advance !

A: It's based on a simple fact that we can use hyperlinks(<a> tags) to jump to certain sections in a document and bring focus to that section. But if your  href attribute points to IDs that do not exist in your page, then the browser will not do anything but change the hash part in the URL.
In modern browsers, everytime, the hash part changes in the URL, a hashchange event will be fired. ui-router or any router can actually listen for this event, get the hash part and use the config to update the view section accordingly.
This works well as long as you trigger a state change by clicking on some link but there are cases where you change the state using methods like $state.go() or $location.path(). In this case, we need to resort to HTML5's History API. There's a pushState method that allows us to change the URL in the address bar without causing the browser to load that resource.


text:
Q: How to determine how unique a word is? I have a text file with around 300,000 words. Each word is 5 letters.
I'd like to be able to determine how unique each word is on the internet.
An idea I had was to Google the word and see how many results it yielded. Unfortunately, this is against their TOS.
I was trying to think of any other way but it would have to involve querying some website a lot and I doubt they would appreciate that much.
Anyone have any other ideas? Programming language doesn't matter that much but I would prefer C#.

A: If your words do not contain slang, I would recommend looking at public domain books.  The issue here is that most of these books will be older, so you really will be getting a snapshot in time of how popular a word is (or I guess was).  The plus side is that these books are freely available in text file format allowing you to easily mine them for data.
One thing to note, if you're in the US and plan on using Project Gutenberg to get the books, they have a rule that the website is intended only for human users.  There is a page that tells you how to get the same data via mirror.

A: To look up the frequency 'in books' you could use the Google Ngram dataset, but that's not 'for the internet'.  If this is for academic purposes the Bing alternative might work also and it is based on internet-frequencies.


text:
Q: Cannot Open xaml.cs File in Visual Studio 2012 I am attempting to open a .xaml.cs file in Visual Studio 2012, but double-clicking the file does nothing and right-clicking and selecting Open does nothing.
If I attempt to open any other .xaml.cs file, it works fine - so it is isolated to a single file.
For example...

*

*ImportUserControl.xaml - Opens fine

*ImportUserControl.xaml.cs - Won't open

*ExportUserControl.xaml - Opens fine

*ExportUserControl.xaml.cs - Won't open

I have also tried opening the .xaml file in Visual Studio and selecting View Code too.
What could cause this and how do I resolve it?

A: The resolution to this isn't great, but I guess it is obvious.
I closed Visual Studio and then re-opened it. This cleared the problem up.