text:
Q: How to specify a package source for nuget We are currently using SyncFusion for our solution at work for one of our solutions. In local every package are restoring but in VSTS it seem that it's having some difficulties to mix both syncfusion packages with official nuget packages.
I posted the entire log of the nuget restore on a gist here : https://gist.github.com/erickgirard/844f57d0f98f0cbea13d6ad4ddbde7e0
What I believe is that for every package in packages.config it's trying all sources (is there a possibility to specify a source for one package?)
Not quite sure of what are the solution here beside commiting the syncfusion dlls in the source control.
Here is the nuget.config file of the solution:
<configuration>
    <solution>
        <add key="disableSourceControlIntegration" value="true" />
    </solution>
    <packageSources>
        <add key="sync fusion nuget feed" value="http://nuget.syncfusion.com/aspnetmvc" />
    </packageSources>
    <packageRestore>
        <add key="enabled" value="True" />
    </packageRestore>
</configuration>

Here is an excerpt of the logs:
[...]
2017-10-16T16:10:33.6063822Z Acquiring lock for the installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:33.6123760Z Acquired lock for the installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:33.6123760Z Installing Swashbuckle.Core 5.5.3.
2017-10-16T16:10:33.6173723Z   NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='System.IdentityModel.Tokens.Jwt',Version='5.1.4') 97ms
2017-10-16T16:10:33.6173723Z   GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='System.IdentityModel.Tokens.Jwt'
2017-10-16T16:10:33.6453473Z   NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='Microsoft.Net.Compilers',Version='2.2.0') 562ms
2017-10-16T16:10:33.6453473Z   GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Microsoft.Net.Compilers'
2017-10-16T16:10:33.6913056Z   OK https://api.nuget.org/v3-flatcontainer/system.identitymodel.tokens.jwt/5.1.4/system.identitymodel.tokens.jwt.5.1.4.nupkg 143ms
2017-10-16T16:10:33.6913056Z Acquiring lock for the installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:33.6923050Z Acquired lock for the installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:33.6923050Z Installing System.IdentityModel.Tokens.Jwt 5.1.4.
2017-10-16T16:10:33.6923050Z   NotFound http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/Packages(Id='Unity.AspNet.WebApi',Version='4.0.1') 103ms
2017-10-16T16:10:33.6923050Z   GET http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Unity.AspNet.WebApi'
2017-10-16T16:10:33.6943020Z   OK http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Microsoft.Net.Compilers' 49ms
2017-10-16T16:10:33.7092888Z   OK http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id='Unity.AspNet.WebApi' 44ms
2017-10-16T16:10:33.7312690Z   OK https://api.nuget.org/v3-flatcontainer/unity.aspnet.webapi/4.0.1/unity.aspnet.webapi.4.0.1.nupkg 170ms
[...]
2017-10-16T16:10:41.1345069Z Completed installation of System.IdentityModel.Tokens.Jwt 5.1.4
2017-10-16T16:10:41.1395038Z Adding package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.1425014Z Added package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.1455002Z Added package 'System.IdentityModel.Tokens.Jwt.5.1.4' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
2017-10-16T16:10:41.3558804Z Completed installation of Swashbuckle.Core 5.5.3
2017-10-16T16:10:41.3578871Z Completed installation of Microsoft.TeamFoundationServer.Client 15.115.0-preview
2017-10-16T16:10:41.3578871Z Adding package 'Microsoft.TeamFoundationServer.Client.15.115.0-preview' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.3588793Z Adding package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages'
2017-10-16T16:10:41.4116910Z Added package 'Swashbuckle.Core.5.5.3' to folder 'd:\a\3\s\Projets\packages' from source 'https://api.nuget.org/v3/index.json'
[...]
2017-10-16T16:10:56.8833741Z Running restore with 2 concurrent jobs.
2017-10-16T16:10:56.8853733Z Reading project file d:\a\3\s\Projets\DobermanHub.GFI.Functions\DobermanHub.GFI.Functions.csproj.
2017-10-16T16:10:56.9003673Z Restoring packages for d:\a\3\s\Projets\DobermanHub.GFI.Functions\DobermanHub.GFI.Functions.csproj...
2017-10-16T16:10:56.9153620Z Restoring packages for .NETFramework,Version=v4.6.1...
2017-10-16T16:10:57.0043336Z   GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.0203252Z   GET https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/index.json
2017-10-16T16:10:57.0992975Z   OK https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/index.json 85ms
2017-10-16T16:10:57.1122942Z   InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 111ms
2017-10-16T16:10:57.1162923Z Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''.
2017-10-16T16:10:57.1162923Z Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:57.1162923Z   GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.1332855Z   GET https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/1.0.2/microsoft.net.sdk.functions.1.0.2.nupkg
2017-10-16T16:10:57.1442827Z   OK https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.functions/1.0.2/microsoft.net.sdk.functions.1.0.2.nupkg 10ms
2017-10-16T16:10:57.1762708Z   InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 59ms
2017-10-16T16:10:57.1762708Z Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''.
2017-10-16T16:10:57.1762708Z Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:57.1762708Z   GET http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions'
2017-10-16T16:10:57.3411621Z   InternalServerError http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions' 165ms
2017-10-16T16:10:59.6996347Z System.AggregateException: One or more errors occurred. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'Microsoft.NET.Sdk.Functions' from remote source 'http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id='Microsoft.NET.Sdk.Functions''. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
2017-10-16T16:10:59.6996347Z    at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
2017-10-16T16:10:59.6996347Z    at NuGet.Protocol.HttpSource.<>c__DisplayClass12_0`1.<<GetAsync>b__0>d.MoveNext()
2017-10-16T16:10:59.6996347Z --- End of stack trace from previous location where exception was thrown ---
2017-10-16T16:10:59.7006128Z    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-10-16T16:10:59.7006128Z    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-10-16T16:10:59.7006128Z    at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__2`1.MoveNext()

A: In our NuGet Server, we are maintaining multiple Feeds based on platforms and in NuGet site we are displaying friendly feed URLs. If you copy and paste those friendly URLs in any browser, it will redirect to actual Feed Link.
Friendly Feed URL:
http://nuget.syncfusion.com/aspnetmvc/
Actual Feed URL:
http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/
Your given below URL is incorrect hence it's return 500 error while resorting the ASPNET MVC package.
http://nuget.syncfusion.com/aspnetmvc/FindPackagesById()?id=%27Microsoft.NET.Sdk.Functions%27
In your case, you must use actual feed URL instead of friendly URL.
http://nuget.syncfusion.com/nuget_aspnetmvc/nuget/getsyncfusionpackages/aspnetmvc/FindPackagesById()?id=%27Microsoft.NET.Sdk.Functions%27
Please follow the steps given in the below link.
https://www.syncfusion.com/kb/7609/how-to-install-syncfusion-nuget-packages-in-visual-studio-2017
Thanks,
Mathan Kumar


text:
Q: Why is a simple query on larger table much slower? I run a simple update query on a table:
UPDATE table_x SET col_a = (col_b AT TIME ZONE 'UTC') AT TIME ZONE col_tz;

When table_x consists of 100 entries, the query takes some milliseconds.
-> 100'000 entries = 2 seconds.
-> 1'000'000 entries = 20 seconds.
So far so good. But when the table consists of 20M entries, the query runs forever! Does anybody know the reason for this? And what can be done to overcome this?
Maybe I should add that I have only around 13 GB free disk space on my computer.

A: It is the normal behaviour, that update performance degrades. The problem is, that the index needs to be updated after every update. If you import data into the database, you should use a batch feature of your database, which disables the index temporarily and rebuilds it afterwards.
Same for Sqlite for example: Sqlite appending data performance linear degradation, is this solvable?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Pytorch datasets.ImageFolder flag FileNotFoundError: [Errno 2] No such file or directory: '\u2068/ Trying to load data from the local directory in Pytorch using dataset.ImageLoader but getting FileNotFoundError...

import torch
from torchvision import datasets, transforms

data_dir = '/Users/Desktop/Udacity/AI for Trading/deep-learning-v2-pytorch/intro-to-pytorch/data/Cat_Dog_data/train'

transform = transforms.Compose([transforms.Resize(255),
                                transforms.CenterCrop(224),
                                transforms.ToTensor()])

dataset = datasets.ImageFolder(root=data_dir, transform=transform)
dataloader = torch.utils.data.DataLoader(dataset, batch_size=32, shuffle=True)

FileNotFoundError: [Errno 2] No such file or directory: '\u2068/Users/Desktop/Udacity/AI for Trading/deep-learning-v2-pytorch/intro-to-pytorch/data\u2069/Cat_Dog_data\u2069/\u2068train\u2069'
Answer: Retyping the Image Dir Path manually instead of copy-pasting solved the problem.

A: This error is not related to pytorch or dataset library, it seems getting reported by python's OS library..
I tried loading the simple path like
import os

data_dir = '/Users'
os.chdir(data_dir)

Even above code failed, post researching it seems, the error is because of the below reasons:
There are some invisible 'LEFT-TO-RIGHT MARK' (u200e) and 'FIRST STRONG ISOLATE' (u2068) characters in the st
And retyping the path manually (instead of copy-pasting) solved the problem
This stackoverflow helped me fix the problem, I still thought to post it again, as a problem in the context of pytorch was not reported and hopefully, this help folks connects the dots.


text:
Q: Rails how to access attr_name inside other loop? Column method My loop:
<% @products.first.attributes.except('name', 'created_at','updated_at','id').each do |attr_name, attr_value| %>

    <%= t(attr_name) %>
    Pr. x
    <%= @products.each do |f| %>
    <%= f.attr_name %> ,-
    <% end %>

<% end %>

Then I get this error: undefined method attr_name for #<Product:0x3adc850
How do I use the column method with attr_name? I have tried things like f."#{attr_name}" without luck.

A: Use send
<%= @products.each do |f| %>
   <%= f.send attr_name %> ,-
<% end %>

And you should rename f into product (f is generally used for form builders)


text:
Q: Whats the probability for a change in the context to conditioning an experiment? Let's say that there is an event which is only happening with a (assumed) probability of $0.05$ and has been seen to not happen $100$ times in a row. On the $101$ time there is a modification in the experiment and the event happens. I'd like to know (if it's possible) how to calculate the probability of the modification on the experiment been the cause of the occurrence of the event on the $101$th try.

A: What you have described is a pretty bad experiment. The test for significance will be woefully underpowered, since your control group is size 100 and your treatment group is a sample of size 1: hence, even with a positive result for the first trial after changing the conditions, you will not be able to reject at the $\alpha=0.05$ level. You should opt for a balanced design: 50 for control, 50 for treatment. A sample size of 1 is useless unless the event is very rare (e.g., <1%).


text:
Q: SOAP Web service and C# Im required to listen requests from a web service in C# and respond to them ion C# .. whats the approach to this ?

A: I am presuming you already have a web service you wish to consume. There are several examples on consuming web services on the web (e.g.: Consuming web services from a WinForms app).
Adding a web reference
First, you need to add a web reference to your C# project. In VS2005, you can do this by right-clicking the project and selecting "Add web reference", and the providing the url of the web service. In VS2008 or newer, there are a couple of extra clicks as described here.
After you've done that, VS will generate all the necessary proxy classes for you, with methods for both synchronous and asynchronous invocation, which you can use as if the object was instantiated locally.
Viewing generated classes
For example, if your web service has a single method (DoSomething), and is located at www.example.com/MyService.asmx (and also named "MyService"), Visual Studio will create a class called `MyService" which will look something like this:
namespace MyNamespace // <-- this is the name you choose when you
{                     //     added the web reference

    public class MyService : SoapHttpClientProtocol
    {
         // synchronous execution
         public void DoSomething()
         {

         }

         // async execution
         public void DoSomethingAsync()
         {

         }

         // callback event for async execution
         public event DoSomethingCompletedEventHandler DoSomethingCompleted;
     }
}

To examine the contents of the generated namespace, double click your web reference in Solution Explorer (it should be inside a folder called "Web References"). This will open the Object browser.
Using generated classes synchronously
The simplest way to use your class is to create an instance, and invoke the method:
// create a new instance of the service
MyService service = new MyService();

// invoke the method
service.DoSomething(); // <-- this will block the thread until completed

Using generated classes asynchronously
To use the async version, you can attach an event handler:
// create a new instance of the service
MyService service = new MyService();

// attach the event handler
service.DoSomethingCompleted += MyEventHandler;

// invoke the method asynchronously
service.DoSomethingAsync(); // <-- this will be invoked on a background thread

A: I would suggest looking at This to get started.

A: If your question is: do Web Services have to be written in C#, the answer is "no". You can write Web Services in many languages, including Java, VB.NET and even COBOL.NET.
If your question is: do Web Services have to be written in the same language as the programs that consume them, the answer again is "no", as long as your Web Services are not in the same Visual Studio project as the client(s).

A: Choose "Add Service Reference" from the Solution Explorer (right click to your project) and than add the URL of your WebService you want to consume to the Adresss Bar and say "Go".
The client should be created automatically from Visual Studio.


text:
Q: Angular (1.5) JS Access Variable from Parent Component in Child Component? I am attempting to abstract a concept of a ticket list building into an angular app using 2 components.
1st component --> ("Smart Component") Uses $http in order to pull the data and put it inside an array called populatedList that is in the parent ("gather") components controller. This part works.
2nd component --> ("Dumb component") For each key value pair in the populatedList var from the parent component it should create a list item. However the onInit() function for the second component is never called even though I registered it to the same module. The HTML template code as does not instantiate when I view it through the browser. I am not getting any errors on my console so what am I doing wrong? Why is my second component not working, even though I used "require" to get info from the parent component.
I finally got my child component to see the data from the populated "tickets" variable of the pullTicketCtn controller (evinced by screen shots) but when I try to console.log(vm.parentComp.tickets) or console.log(vm.tickets) it gives me an empty array even though I just did console.log(vm.parentComp)  and console.log(vm) and SAW through the console the values in the array.

So now console.log(vm.parentComp.tickets)  and console.log(vm) both show my displayTicketsCnt and pullTicketsCnt controllers to both have the tickets var, yet I cannot access it in the child or console.log() it. What Am I doing wrong?
pullticketCtn has the data/array
displayticketCtn has the data/array
3rd pic shows those 2 empty arrays [] and [] for console.log(vm.parentComp) and
console.log(vm);
     /*COMPONENTS*/
     /*Parent/smart */
   var gather = {
    controller:pullTicketsCnt,
    controllerAs:'pullTicketsCntAs',
    bindings: {
        tickets: '=',
        client_id:'='
    }
};

/* Child/dumb component*/
var  list =  {
    transclude  : true,
    require:{
        /* Require the parent component (^ means its an ancestor)*/
        parentComp:'^gather'
    },
    template: [
        '
',
         '
',
        '{{key}}',
     '
',
        '
',
    ].join(''),
    controller:displayTicketsCnt,
    controllerAs:'displayTicketsCntAs',
};

/*CONTROLLERS */
function pullTicketsCnt($http){

        $http ...
        this.tickets=temp.slice(0); //Get the array of populated data
        ...
    }
}

 function displayTicketsCnt(){
  var vm = this;
        vm.$onInit = function(){
           console.log('LIST-DATA component initialized');
           console.log(vm.parentComp);
           console.log(vm);
           vm.populated= (vm.parentComp.tickets).slice(0);
           /*The two lines below print [] the empty arrays */
           console.log(vm.parentComp.tickets);
            console.log(vm.populated);
        }

}

function listCtrl(){
    this.tickets=[];
}

/*Declarations */

var app = angular.module('ticket', [])
.controller('listCtrl',listCtrl) /* Assume this is correct*/
.component('gather',gather)
.component('list',list);

/* HTML*/

           <gather tickets="vm.tickets">
             <list populated="pullTicketsCntAs.tickets"></list>
            </gather>

A: transclude  : true, should be part of gather not list.
You can access the parent controller using
require: {
    parent: '^^gather'
  },


text:
Q: How do I show that the two definitions of the curl of a vector field equal each other? The curl of a 3D vector field is a 3D vector itself and has two definitions - one in integral form and one in differential form.

*

*Definition 1: $$ \operatorname{curl}\vec{F}(x,y,z) \, \cdot \, \hat{n}
=\lim_{A_\hat{n} \to 0}
\frac{1}{A_\hat{n}} \oint{\vec{F} \, \cdot \, \vec{ds}} $$
Where $\hat{n}$ is an arbitrary unit normal vector (you would substitute $\hat{\imath}, \hat{\jmath}$ and $\hat{k}$ in to find the three components of the curl vector.  $A_\hat{n}$ is the magnitude of the area enclosed by the loop in the plane perpendicular to $\hat{n}$.

*Definition 2:  $$ \operatorname{curl} \vec{F}(x,y,z) = \vec{\nabla} \, \times \, \vec{F} = \left({\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}}\right) \cdot \hat{\imath} \, - \, \left({\frac{\partial F_z}{\partial x} - \frac{\partial F_x}{\partial z}}\right) \cdot \hat{\jmath} \, + \left({\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}}\right) \cdot \hat{k} \,  $$
I would like to know how you would show that these two equations are equal with respect to each component of the curl.
Thank you.

A: Let's just consider the $\hat k$ component of curl.
For the first definition, take a plane through $(x,y,z)$ parallel to the $x,y$ plane. Let the loop consist of the four directed segments
$(x+h,y-h)$ to $(x+h,y+h),$ $(x+h,y+h)$ to $(x-h,y+h),$
$(x-h,y+h)$ to $(x-h,y-h),$ and $(x-h,y-h)$ to $(x+h,y-h).$
Assuming that $\vec F$ is differentiable at $(x,y,z),$
the function $F_x$ is approximated by
$$ F_x(x+\Delta x, y+\Delta y, z) = F_x(x,y,z)
+ (\Delta x)\frac{\partial F_x}{\partial x}
+ (\Delta y)\frac{\partial F_x}{\partial y} \tag1$$
and the function $F_y$ is approximated by
$$ F_y(x+\Delta x, y+\Delta y, z) = F_y(x,y,z)
+ (\Delta x)\frac{\partial F_y}{\partial x}
+ (\Delta y)\frac{\partial F_y}{\partial y} \tag2$$
in a neighborhood of $(x,y,z).$
By making $h$ as small as needed we can make that approximation as good as we want in a neighborhood that includes the loop.
On the segment from $(x+h,y-h,z)$ to $(x+h,y+h,z),$
$\vec{ds}=\hat\jmath,$ so the $x$ and $z$ components of
$\vec F\cdot\vec{ds}$ are zero and $\vec F\cdot\vec{ds} = F_y.$
On that segment the value of $\Delta x$ in Equation $(2)$ is $h,$
so the value of $(\Delta x)\frac{\partial F_y}{\partial x}$ on the segment
is uniformly $h\frac{\partial F_y}{\partial x}.$
Meanwhile, the value of $\Delta y$ ranges from $-h$ to $h$ with mean value $0.$ Hence the mean value of $(\Delta y)\frac{\partial F_y}{\partial y}$ also is zero. That is, its contribution to the integral of
$\vec{F} \cdot \vec{ds} = F_y$ along that segment is zero.
So the mean value of $F_y$ along the segment is
$F_y(x,y,z) + h\frac{\partial F_y}{\partial x},$
meaning we get the integral of $F_y$ on that segment by multiplying this quantity by the length of the segment, $2h.$
On the opposite segment (from $(x-h,y+h,z)$ to $(x-h,y-h,z)$),
again the $x$ and $z$ components of
$\vec F\cdot\vec{ds}$ are zero, but now $\vec F\cdot\vec{ds} = -F_y$
(since the direction of the segment is opposite from $\hat\jmath$)
and the mean value of $F_y$ is
$F_y(x,y,z) - h\frac{\partial F_y}{\partial x},$
so the integral is $-2h$ times this last quantity.
Similarly, along the other two segments, two of the components of $\vec F$
contribute nothing to the product $\vec F\cdot\vec{ds},$
but this time it is the $y$ and $z$ components that drop out and we need look only at $F_x.$
The mean values of $F_x$ along the segments
$(x+h,y+h,z)$ to $(x-h,y+h,z)$ and $(x-h,y-h,z)$ to $(x+h,y-h,z)$ are
$F_x(x,y,z)  + h\frac{\partial F_x}{\partial y}$
and $F_x(x,y,z) - h\frac{\partial F_x}{\partial y}$, respectively,
and the integrands are equal to $-F_x$ and $F_x$ respectively.
Integrating along the four segments of the loop in sequence,
\begin{align}
 \oint\vec{F} \cdot \vec{ds} &\approx
2h\left(F_y(x,y,z) + h \frac{\partial F_y}{\partial x}\right)
- 2h\left(F_x(x,y,z) + h \frac{\partial F_x}{\partial y}\right)\\ &\qquad
- 2h\left(F_y(x,y,z) - h \frac{\partial F_y}{\partial x}\right)
+ 2h\left(F_x(x,y,z) - h \frac{\partial F_x}{\partial y}\right) \\
&= 4h^2 \left(\frac{\partial F_y}{\partial x}
    - \frac{\partial F_x}{\partial y}\right)
\end{align}
The area inside the loop is $4h^2,$ so
$$ \frac{1}{A_\hat{k}} \oint\vec{F} \cdot \vec{ds}
 \approx \frac{1}{4h^2} \left( 4h^2 \left(\frac{\partial F_y}{\partial x}
    - \frac{\partial F_x}{\partial y}\right)\right) =
\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}. $$
In the limit, this approximation becomes exact.
The other two components work similarly.
That's the general intuition, anyway.
You might be able to get a rigorous proof out of this by keeping track of the error terms in each approximation.

I'm not going to try to rewrite this just now, but it might help to observe that $\vec F$ is approximated by a constant ($\vec F(x,y,z)$) plus a linear term based on the components of the gradient of $\vec F$,
and that the integral of the constant term around the loop is zero so we can ignore it and look only at the integral of the linear term. That way
one might be able to completely avoid writing $F_x(x,y,z)$ and $F_y(x,y,z)$.


text:
Q: How to setup drop down list to update and save? I want to create a drop down list that allows the user to choose a Start and End "Year, Month, Day" as follows. When the page is updated, the choices are reverted to the "original" choices. How can I allow those selected values to save and remain when the page is updated?
<?php

if (isset($_POST['action']))
{
    $action = $_POST['action'];
    $startyear = $_POST['startyear'];
    $startmonth = $_POST['startmonth'];
    $startday = $_POST['startday'];
    $endyear = $_POST['endyear'];
    $endmonth = $_POST['endmonth'];
    $endday = $_POST['endday'];
}
else
{
    $action = "";
    if (!isset($_POST['startyear']) || !isset($_POST['startmonth']) || !isset($_POST['startday'])
        || !isset($_POST['endyear']) || !isset($_POST['startmonth']) || !isset($_POST['startday']))
    {
        $startyear = "";
        $startmonth = "";
        $startday = "";
        $endyear = "";
        $endmonth = "";
        $endday = "";
    }
    else
    {
        $startyear = $_POST['startyear'];
        $startmonth = $_POST['startmonth'];
        $startday = $_POST['startday'];
        $endyear = $_POST['endyear'];
        $endmonth = $_POST['endmonth'];
        $endday = $_POST['endday'];
    }

}

if ($action == "update")
{
    echo "
Start: $startyear-$startmonth-$startday | End: $endyear-$endmonth-$endday
";
}

else
{
    if ($startyear == "" || $endyear == "")
    {
    // something belongs here...not sure
    }
    echo "
Start: $startyear-$startmonth-$startday | End: $endyear-$endmonth-$endday
";
?>

Selections for start/end year,month,day are here:
<form name='update' action='testing.php' method='POST'>
Start: <select name='startyear'>
    <option value="1">2012</option>
    <option value="2">2011</option>
    <option value="3">2010</option>
    <option value="4">2009</option>
    <option value="5">2008</option>
    <option value="6">2007</option>
    <option value="7">2006</option>
    <option value="8">2005</option>
    <option value="9">2004</option>
    <option value="10">2003</option>
    <option value="11'>2002</option>
    <option value="12">2001</option>
    <option value="13">2000</option>
    <option value="14">1999</option>
    <option value="15">1998</option>
</select>
<select name='startmonth'>
    <option value="1">01</option>
    <option value="2">02</option>
    <option value="3">03</option>
    <option value="4">04</option>
    <option value="5">05</option>
    <option value="6">06</option>
    <option value="7">07</option>
    <option value="8">08</option>
    <option value="9">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
</select>
    <select name='startday'>
    <option value="1">01</option>
    <option value="2">02</option>
    <option value="3">03</option>
    <option value="4">04</option>
    <option value="5">05</option>
    <option value="6">06</option>
    <option value="7">07</option>
    <option value="8">08</option>
    <option value="9">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
</select>

End:<select name ='endyear'>
    <option value="1">2012</option>
    <option value="2">2011</option>
    <option value="3">2010</option>
    <option value="4">2009</option>
    <option value="5">2008</option>
    <option value="6">2007</option>
    <option value="7">2006</option>
    <option value="8">2005</option>
    <option value="9">2004</option>
    <option value="10">2003</option>
    <option value="11'>2002</option>
    <option value="12">2001</option>
    <option value="13">2000</option>
    <option value="14">1999</option>
    <option value="15">1998</option>
</select>
<select name='endmonth'>
    <option value="1">01</option>
    <option value="2">02</option>
    <option value="3">03</option>
    <option value="4">04</option>
    <option value="5">05</option>
    <option value="6">06</option>
    <option value="7">07</option>
    <option value="8">08</option>
    <option value="9">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
</select>
    <select name='endday'>
    <option value="1">01</option>
    <option value="2">02</option>
    <option value="3">03</option>
    <option value="4">04</option>
    <option value="5">05</option>
    <option value="6">06</option>
    <option value="7">07</option>
    <option value="8">08</option>
    <option value="9">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
</select>
<input type='submit' value='Compare'/>
</form>
 <?php
}
?>

A: You need to add a little more to the HTML that's generating your page, to set up a default selected value for your dropdowns.
You'll need something like this:
<option value="1" <?php if ($_POST["startyear"] = "1") echo "selected"; ?>>2012</option>

You'll need to do that for each option, to see if this option's value is the same as the one from $_POST; you might want to look into using a for loop to create the HTML, in that case.

A: Instead of having such large HTML let php render it for you, this also allows you to determine if the selected attribute is rendered in the option.
To keep the values selected in the form the form needs tobe posted back to the same php script its being rendered from action='', and a little logic is required on the posted values to check if the value equals itself, check the form below.
<?php
//Build an array of values for your forms
$year  = range(1998,2012);
$month = range(01,12);
$day   = range(01,31);

//Handle POST, just an example
if($_SERVER['REQUEST_METHOD']=='POST'){
    foreach($_POST as $key=>$value){
        if(is_numeric($value)){
            $$key = $value;
        }
    }
    /**
     * All POST keys like: startmonth ect will now be php variables like
     * $startmonth
     */

    //Do somthing with $startmonth ect
}

//A more tidy form
?>
<form name='update' action='' method='POST'>
Start: <select name='startyear'>
    <?php foreach(array_reverse($year) as $y):?>
    <option value="<?=$y?>"<?=((isset($startyear) && $startyear == $y)?' selected':null)?>><?=$y?></option>
    <?php endforeach;?>
</select>
<select name='startmonth'>
    <?php foreach($month as $m): $m = str_pad($m, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$m;?>"<?=((isset($startmonth) && $startmonth == $m)?' selected':null)?>><?=$m;?></option>
    <?php endforeach;?>
</select>
    <select name='startday'>
    <?php foreach($day as $d): $d = str_pad($d, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$d;?>"<?=((isset($startday) && $startday == $d)?' selected':null)?>><?=$d;?></option>
    <?php endforeach;?>
</select>

End: <select name='endyear'>
    <?php foreach(array_reverse($year) as $y):?>
    <option value="<?=$y?>"<?=((isset($endyear) && $endyear == $y)?' selected':null)?>><?=$y?></option>
    <?php endforeach;?>
</select>
<select name='endmonth'>
    <?php foreach($month as $m): $m = str_pad($m, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$m;?>"<?=((isset($endmonth) && $endmonth == $m)?' selected':null)?>><?=$m;?></option>
    <?php endforeach;?>
</select>
    <select name='endday'>
    <?php foreach($day as $d): $d = str_pad($d, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$d;?>"<?=((isset($endday) && $endday == $d)?' selected':null)?>><?=$d;?></option>
    <?php endforeach;?>
</select>
<input type='submit' value='Compare'/>
</form>


text:
Q: PHP: Use dynamic object keys For the purpose of my website, I need to dynamically produce object keys for my JSON tree structure, at runtime. My structure is nested, with each parent node containing an array of child nodes. This nested structure makes things quite complicated, and can make the key very long as the tree gets deeper. I cannot change this however, as it is needed for the tree drawing plug in that I'm using.
This is the sort of thing im looking for:
$tree->rootNode->{$varString}->title;

where $tree is the JSON and $varString can contain a single element (e.g. children[0]) all the way up to a longer path (e.g. children[0]->children[1]->children[1]). When I hardcode these keys in, everything works fine, but this wouldnt allow me to generate keys at runtime.
The problem seems to be due to the use of a string to store the key. I can use a variable to store a single object name, but not the index [0] or a path of multiple objects using the -> operator.
Is there a way of doing this, or will I have to take an entirely different approach?


text:
Q: Inline Textarea Style to override the CSS default I need your help with the textarea of my form fields. I have the CSS below to apply a general style for the texarea. But now i'll like to make some inline changes to some particular textarea because they are overlapping beyond the container.
Thanks for the help.
    textarea[type=text]{
    border:             2px solid #a9c6c9;
    vertical-align:         middle;
    padding:             9px;
    height:             129px;
    border-collapse:         collapse;
    margin:             2px;
    padding:             2px;
    space:             2px;
    width:             6.1in;
    z-index:             1;
    font-family: calibri;
   }

A: You can use :not to filter out the ones you don't want to change. Change your CSS selector to:
textarea[type=text]:not(#element1, #element2, ...)

A: If it's just a matter of ensuring nothing extends outside the container, try adding max-width:100%; to your textarea CSS. That should help you prevent it from going outside the container while still making all other textareas the same width.

A: Try just adding a class to the individual textarea
<!-- Original -->
textarea[type=text]{
    border: 2px solid #a9c6c9;
    vertical-align: middle;
    padding: 9px;
    height: 129px;
    border-collapse: collapse;
    margin: 2px;
    padding: 2px;
    space: 2px;
    width: 6.1in;
    z-index: 1;
    font-family: calibri;
}

then:
<!-- add this class to you individual textarea's -->
textarea[type=text].newclass{
    width: 200px;
}

or you can have it inside a div like so:
<!-- add this class to the <div> your individual textareas are inside of -->
.newclass textarea[type=text]{
    width: 200px;
}

or add this to your textarea in you html:
style="width:200px !important;"

Hope this helps


text:
Q: simple regex pattern not matching Hi I am writing a script that requires some regex pattern matching but I am unable to make matches.
here is a MCVE:
import re

sourceString= 'Hi I want pizza for lunch'

patternObject=re.compile('pi.*');
match=patternObject.match(sourceString);

if match:
     print("the match is:",match.group())
else:
     print("no matches found!");

Unfortunately output of the program is "no matches found!" despite "pizza for lunch" being the desired output. What did I understand wrong?


text:
Q: Is there a away of amount the on bits in of n binary length number in lognsteps? I'm trying to find out if there's away for evaluating the number of on bits in a binary number of length n using O(1)  space, in logn steps?
If so- How?

A: A lookup table will find this in constant time.


text:
Q: Border CSS, colour a certain percentage I want to achieve this effect:

You see that the orange colour is only 35% of the whole border. How can I do this?
HTML:

 hello

CSS:
h1 {
    line-height: 80px;
    font-size: 20px;
    font-family: Arial;
}

#test {
    margin: auto;
    text-align: center;
    border-radius: 50%;
    height: 80px;
    width: 80px;
    border: 5px solid black;
}

A: Here's one way to do it with svg and some trickery using stroke dash array offsets.
http://codepen.io/flurrd/pen/zZyrBx?editors=1100

50%

<svg
    x="0px"
    y="0px"
    viewBox="0 0 397.6 435.3"
    enable-background="new 0 0 397.6 435.3"
    xml:space="preserve"
    class="svg"
    >
      <circle
        class="circle-bg"
        cx="198.3"
        cy="217.3"
        r="139.2"
        transform="rotate(270 198.3 217.3)"
        />

      <circle
        class="circle"
        cx="198.3"
        cy="217.3"
        r="139.2"
        transform="rotate(270 198.3 217.3)"
        />
  </svg>

SCSS
body{
  display: flex;
  justify-content: center;
  align-items: center;
}

//circumference = 2πr
// svg circle radius is 139

$pi: 3.14159265358979;
$Twopi: $pi * 2;

$circumference: calc(#{$Twopi} * 139);
$arc-length-percent: 0.5;

.circle {
  fill: none;
  stroke-width: 10px;
  stroke: tomato;
  //0.5 - 50%
  stroke-dasharray: calc(#{$arc-length-percent} * #{$circumference}) $circumference;
}

.circle-bg {
  fill: none;
  stroke-width: 10px;
  stroke: grey;
}

//layout stuff

.container {
  width: 300px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

h1 {
  font-family: sans-serif;
}

svg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

Compiled CSS
body {
  display: flex;
  justify-content: center;
  align-items: center;
}

.circle {
  fill: none;
  stroke-width: 10px;
  stroke: tomato;
  stroke-dasharray: calc(0.5 * calc(6.28319 * 139)) calc(6.28319 * 139);
}

.circle-bg {
  fill: none;
  stroke-width: 10px;
  stroke: grey;
}

.container {
  width: 300px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

h1 {
  font-family: sans-serif;
}

svg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}


text:
Q: Ansible fortios_config backups not working I use Fortinet for firewall automation, but i get the error "Error reading running config" . I already followed this website: https://github.com/ansible/ansible/issues/33392
But do not find any solution. Please tell me what am I doing wrong ?

*

*Ansible version: 2.7.0

*Python version: 2.7.5

*Fortinet: 60E

*FortiOS version: 6.0.2

Here is what I am trying:
 FortiOS.yml playbook:
---
- name: FortiOS Firewall Settings
  hosts: fortiFW
  connection: local
  vars_files:
  - /etc/ansible/vars/FortiOS_Settings_vars.yml
  tasks:
    - name: Backup current config
      fortios_config:
        host: 192.168.1.99
        username: admin
        password: Password@123
        backup: yes
        backup_path: /etc/ansible/forti_backup

Here is what I get as error:

ok: [192.168.1.99] META: ran handlers Read vars_file
  '/etc/ansible/vars/FortiOS_Settings_vars.yml'
TASK [Backup current config]
  **************************************************************************************************************************************************************************************************************** task path: /etc/ansible/FortiOS_Settings_test.yml:8 <192.168.1.99>
  ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.1.99> EXEC /bin/sh
  -c 'echo ~root && sleep 0' <192.168.1.99> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226" && echo
  ansible-tmp-1539674386.05-16470854685226="echo
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226" ) &&
  sleep 0' Using module file
  /usr/lib/python2.7/site-packages/ansible/modules/network/fortios/fortios_config.py
  <192.168.1.99> PUT
  /root/.ansible/tmp/ansible-local-6154Uq5Dmw/tmpt6JukB TO
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226/AnsiballZ_fortios_config.py
  <192.168.1.99> EXEC /bin/sh -c 'chmod u+x
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226/
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226/AnsiballZ_fortios_config.py
  && sleep 0' <192.168.1.99> EXEC /bin/sh -c '/usr/bin/python
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226/AnsiballZ_fortios_config.py
  && sleep 0' <192.168.1.99> EXEC /bin/sh -c 'rm -f -r
  /root/.ansible/tmp/ansible-tmp-1539674386.05-16470854685226/ >
  /dev/null 2>&1 && sleep 0' The full traceback is: WARNING: The below
  traceback may not be related to the actual failure.   File
  "/tmp/ansible_fortios_config_payload_b6IQmy/main.py", line 132, in
  main
      f.load_config(path=module.params['filter'])   File "/usr/lib/python2.7/site-packages/pyFG/fortios.py", line 212, in
  load_config
      config_text = self.execute_command(command)   File "/usr/lib/python2.7/site-packages/pyFG/fortios.py", line 154, in
  execute_command
      output = output + self._read_wrapper(o)   File "/usr/lib/python2.7/site-packages/pyFG/fortios.py", line 120, in
  _read_wrapper
      return py23_compat.text_type(data)
fatal: [192.168.1.99]: FAILED! => {
      "changed": false,
      "invocation": {
          "module_args": {
              "backup": true,
              "backup_filename": null,
              "backup_path": "/etc/ansible/forti_backup",
              "config_file": null,
              "file_mode": false,
              "filter": "",
              "host": "192.168.1.99",
              "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
              "src": null,
              "timeout": 60,
              "username": "admin",
              "vdom": null
          }
      },
      "msg": "Error reading running config" }

A: When working with this module, I had the same issue. I looked into the source code of the module, and found that this error occurs when filter is set to "" -> empty string. You can get facts about the device when changing filter to something like "firewall address". But then you will only get back the options from exactly that, like if you would've typed "show firewall address" on the CLI of the device.
I'm currently working on a solution to use Ansible for FortiGate automation, but it's not looking good. E.g. FortiGates additionally do not support Netconf, so you can't use Netconf to send commands to the device.
So therefore, you're not doing anything wrong, but the modules is either not optimized, or I guessed that maybe the full-configuration is too big to be read by the module, so that you have to use the filter option to shrink it.


text:
Q: Buzztouch geo location not working compiled in xcode 6 I upgraded to xcode 6, compiled a new app, discovered that the geo location is not working, and am searching for a work around.
There is no option in the phone's settings for the newly compiled app to choose a privacy/location services option "Never" or "always.
The older apps compiled in xcode5 still have this option.
UPDATE
Problem solved. Compiled in BT 3.0
- Added this code in BT_screen_customURL.m under the //appDelegate comment (line 64)
if ([appDelegate.rootLocationMonitor.locationManager     respondsToSelector:@selector(requestAlwaysAuthorization)])
[appDelegate.rootLocationMonitor.locationManager requestAlwaysAuthorization];

*

*Added these as string messages to info.plist
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription

Additonal informaton:  https://www.buzztouch.com/forum/thread.php?tid=DA308929DBC29D1DB83B7A8&currentPage=1
Also, the link provided by Alberto below was helpful.

A: Your app is write in Objective C?
add the following lines:
kCLAuthorizationStatusAuthorizedAlways <- For background battery-killers.
kCLAuthorizationStatusAuthorizedWhenInUse <- For sensible apps.
in your plist
For more information: http://www.splinter.com.au/2014/09/14/ios8-corelocation/
Best,
Alberto


text:
Q: yard and links to classes/modules in the doc I'm currently switching from rdoc to yard for my ruby software documentaion.
In my doc I often reference some classes/modules from the comments, for instance :
## == Provides various utility features
##
## == Features
##
## Logging : logging is provided by the Mysoft::Mypackage::Utility::Logger class
##

Rdoc correctly creates a link to the Mysoft::Mypackage::Utility::Logger class documentation page, while yard ignores the tag and considers the class name as simple string.
I know that yard has the @see tag, however this will create a separate "See Also" section in the documentation, while I need to reference the class/modules with inside my description text.
I'm surely missing something, but if you have any examples on how this should be done with yard, I'd realy appreciate.
Thanks per advace,
dl

A: Quoth the documentation:

YARD supports a special syntax to link to other code objects or files. The syntax is {ObjectName#method OPTIONAL_TITLE}. This syntax is acceptable anywhere in documentation with the exception of the @see tag, which automatically links its data.

So, you want
## == Provides various utility features
##
## == Features
##
## Logging: logging is provided by the {Mysoft::Mypackage::Utility::Logger} class
##


text:
Q: Как сделать, чтобы обозреватель принял php код. У меня стоит Windows XP SP3. Когда я тестирую php в локальном сервере, в денвере, он не согласуется с браузером, он показывает только код, который я писал.
A: Для начала изучить как вообще работает серверный язык и понять, что к браузеру он не имеет никакого отношения. Если ваш код выводится в браузер без обработки, то это означает, что апач ничего не знает о .php расширении либо(и) о том как его обрабатывать...
A: Никак. Самый простой способ (на Windows точно) всё один раз быстро сделать, это установить XAMPP. Будет и работающая mysql и запущенный apache и всё-всё-всё. Весит около 400 мегов зато очень быстро и не надо разбираться. Раз уж вы начали писать, не разобравшись, как что работает.
В сети куча инструкций и видео по поводу того, как именно это делается.
A: Поскольку вы только начали учить PHP то задам вопрос - расширение у файла точно .php?
Это довольно частая ошибка начинающих, php код в файлах с форматом .html не отрабатывается.
А вообще - про nix чистая правда, разрабатывать стоит именно на нем.


text:
Q: Long options as static variables for getopt_long All the examples I've found in the net about the usage of getopt_long (for example
this here) declare the struct option with the long options as static.
I don't understand why all these examples declare a static variable, I don't see why this should be done and the man pages don't say anything about this either.
Should I declare this variable as a static variable? And why?

A: The reason is efficiency. If you declare the struct option long_options[] not static, it will be constructed at run time upon entry into the main function, but if it is declared as static, it will be constructed at compile time.
But it will work either way.


text:
Q: Is unix's 'cp' command declarative or imperative? I'm having a discussion with a coworker, who insists cp is declarative. To me, it seems very imperative. It's an instruction we are asking the computer to do, not a definition or declaration. For it to be declarative, instead of:
cp a.zip b.zip

you might have:
b.zip = a.zip

Does anyone have any opinions on this?

A: It seems like you are using those terms at a level where the two have little distinction. For instance, if I were making a user interface for a program and had some file saying
Logo:
  Title: Cool UI
  Color: Green

That is a declarative representation of my ui. It is data that represents what I want the computer to do. If I were to instead make my ui by using code like
l = Logo()
l.add(Title('Cool UI'))
l.add(Color('Green'))
ui.render(l)

That would be an imperative representation of my ui. I am telling the computer what to do each step of the way. When we talk about the cp command, its worth thinking about what the difference between an "imperative" and "declarative" version would be. On the one hand, you cant get more imperative than telling the computer to
 cp a.zip b.zip

Which from a certain perspective is just like saying "hey increment this register" or "hey move whats at this memory address to this memory address", which in assembly is just
mov r0, r1

That being said, if you were to describe in data what you wanted to do you would say something like
copy-paste: a.zip b.zip

Which, take out the colon and shorten the name and you get
cp a.zip b.zip

TL;DR at this level of specification, there is basically no difference between imperative and declarative

A: The cp(1) syntax itself is declarative because you define what you want to accomplish without specifying how it needs to be done. Which, by the way, means your both examples are declarative.
You may also want to take a look to a wider discussion.


text:
Q: D3.js Chord diagram - Have text appear/disappear when hovering over an arc I'm trying to add a small function to the Chord Diagram created by Mike Bostock. When I hover over a certain arc, say Group A, I want a piece of text that I've placed to the right of the chord diagram to update its text to explain some insights that are particular to Group A. When the user moves his/her mouse away from the arc/chord (so all the chords become visible again), I want the text to go back to what it said before (which in my case is a short explanation of how to understand a Chord Diagram)
However, I cannot get the text to change or even disappear using the mouse event functions.
I've tried copying the fade function at the end in: http://bl.ocks.org/mbostock/4062006 into a fadeOver and fadeOut and adjusting the event functions to
.on("mouseover", fadeOver(.1))
.on("mouseout", fadeOut(1));

Inside the fadeOver function I've tried to create a new piece of text to show when you hover over an arc and the chords not selected fade away. Just one line added to the original function fade
function fadeOver(opacity) {

  d3.select("#SideText").html("Updated piece of text");

  return function(d, i) {
    svg.selectAll("path.chord")
        .filter(function(d) { return d.source.index != i && d.target.index != i; })
        .transition()
        .style("stroke-opacity", opacity)
        .style("fill-opacity", opacity);
  };
}//fadeOver

And I added a similar piece of code to fadeOut
function fadeOut(opacity) {

  d3.select("#SideText").html("Standard text");

  return function(d, i) {
    svg.selectAll("path.chord")
        .filter(function(d) { return d.source.index != i && d.target.index != i; })
        .transition()
        .style("stroke-opacity", opacity)
        .style("fill-opacity", opacity);
  };
}//fadeOut

However, the text always appears to be "Standard text". Nothing happens when I hover over the chords, the text never seems to change into "Updated piece of text". Can anybody explain to me why not and/or help me how I can achieve what I am trying to do? (I expected to text to be 'empty' after refresh because I have not yet invoked a mouse event, but it says "Standard Text" right after refresh)
I know that the example above is not yet what I want in the end, but perhaps when I get the above to work I can work with chord indices to display a particular piece of updated text

A: The key thing here is that the fade functions return functions themselves. That is, there are two execution scenarios. First, the code of the function itself is executed when the event handlers are assigned (exactly once). Second, the code that actually changes things is executed when the event is triggered (and only then).
You've added your new code in the first execution context. This means that your code is executed exactly once when the handler functions are assigned, not when the events are actually triggered. To achieve what you want, you need to place this code inside the functions that are returned from the fade functions, i.e. below the return function(d, i) line.


text:
Q: Слайдер: клон изображение на фон размытием Дело в том что при листве фон изображение один и тотже остается как мне это сделать так чтобы изображение которое отображается клонировалась на фон с размытием?
Код:
.item:before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  z-index: -1;

  display: block;
  background-image: url('https://image-cc.s3.envato.com/files/33362626/wpthumbfx_preview_590x300.jpg');
  background-size:cover;
  background-repeat:no-repeat;
  background-position:center;
  width: 100%;
  height: 100%;

  -webkit-filter: blur(5px);
  -moz-filter: blur(5px);
  -o-filter: blur(5px);
  -ms-filter: blur(5px);
  filter: blur(5px);
}


text:
Q: check if not 00000000 or 11111111 or 22222222, etc I have problem with one regular expression to check if a (french) phone number is correct.
Phone number must start with one 0 continue with one 1 or 2 or 3 or 4 or 5 or 9 and continue with 8 numbers but theses numbers must not be the same like 00000000 or 11111111...
My current regular expression :
/^0(1|2|3|4|5|9){1,1}[0-9]{8,8}/i

Thanks in advance for help.

A: You can use the following regex:
/^0[1-59](?!(\d)\1{7}$)\d{8}$/i

Some points:

*

*{1,1} is as good as being removed.

*{8,8} is as good as {8}.

*(1|2|3|4..) can be replaced with character class - [1234]

*[12345] can be replaced by range in a character class - [1-5]
The above regex uses negative look-ahead assertion - (?!(\d)\1{7}) to assert that the 8 digits after first 2, are not all same. If the assertion is true, then it matches the next 8 digits.

*

*(\d) captures the first digit in group 1

*Then \1 backreferences the captured group to match the same digit that was matched by \d

*{7} matches the backreference 7 times. That means - (\d)\1{7} matches same digit 8 times.


text:
Q: Lightswitch HTML: error: value cannot be null. Paramater name: property has anyone come accross this issue before, all of a sudden one of my details pickers has started displaying this error:

within the database this particular field can be null, and also with the staff tablem which references it, this can also be null, Im not sure on what I should currently do... If i press on the plus symbol however the results are displayed, thankyou for any assistance in this.

A: I have done these steps to get it working again, however I do not know what caused this issue:

*

*Removed the foreign key between the 2 tables in question

*Updated the data source

*Re-added the foreign key

*Updated the data source

If any one know's what could have caused this error, or a better way of fixing this (as the above does mean the details between the 2 have to be put back on the screens they are on). I would be grateful.


text:
Q: Activity for locking android device Is it possible make an activity, that will lock the android device?

*

*That device would be unlocked only after entering right PIN number.

*During lock, user can't call,message, and can't view notifications,contacts,call logs,storage data,...

A: For this you can take advantage of the Device Administration API introduced in Android 2.2. This does require the user to accept that your application wants to have control of the device but obviously you would need to disclose that information anyway. Also it should be noted that on a phone (at least in the US) you must always have access to make emergency phone calls.
Using the API you can enforce a pin lock be set and also invoke the lock screen at will in addition to many other administration features.


text:
Q: React Native text script parsing Is there a way to dynamically inject react native script into code.
I have dynamically generated script like:
<Text><Text styles={{ fontSize: 30, fontWeight: 'bold'}}>Two Color Options</Text></Text><Text> <Text><Text styles={{ fontSize: 30, fontWeight: 'bold'}}>Stone Grey</Text>- Great for new...  </Text>

and need to show it like a Text components with styles in react-native application.
I tried react-jsx-parser but it doesn't work as expected.
Appreciate any help!


text:
Q: Why does sorted() not sort an array that contains nan values? It seems like when "nan" values are included in a Numpy array, the array cannot be sorted though sorted(). Here is an example:
import numpy as np

values = np.array([float('nan'),2,float('nan'),1],dtype=float)
valuesSorted = sorted(values)
print(valuesSorted)

The output is [nan, 2.0, nan, 1.0]. Whereas if you sort [2,1] with the same code, the output is [1.0,2.0].
Alternatively, if  you use values.sort():
import numpy as np

values = np.array([float('nan'),2,float('nan'),1],dtype=float)
values.sort()
print(values)

The output is: [ 1.  2. nan nan], meaning that sort() can sort arrays that include nan values.
My questions are: why does the function sorted() not sort an array containing nan values? Is it possible to use sorted() to sort an array containing nan values?


text:
Q: Unable to Autowire Component with Request Scope in Servlet Filter I have a request filter that sits in front of a controller. This filter retrieves a user profile and sets the properties on a userProfile Component with Request Scope and then passes on to the next filter.
When trying to access the userProfile from inside the filter, the property has not been successfully autowired.
I see the following exception when trying to autowire the userProfile from inside the filter:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.userProfile': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

When trying to access the userProfile from inside the controller however, the property has been successfully autowired.
How can I successfully autowire the userProfile Component inside the filter?
Request filter:
@Component
public class JwtAuthenticationFilter extends GenericFilterBean implements Filter {

    @Autowired
    public UserProfile userProfile;

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain next) throws IOException, ServletException {

        ....

        userProfile
            .username(authorizedUser.username())
            .email(authorizedUser.email())
            .firstName(authorizedUser.firstName())
            .lastName(authorizedUser.lastName());
    }
}

Controller:
@CrossOrigin
@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    public UserProfile userProfile;

    @GetMapping(
        path = "/current",
        produces = MediaType.APPLICATION_JSON_VALUE
    )
    @ResponseStatus(HttpStatus.OK)
    public String currentUser() throws ResponseFormatterException {

        System.out.println(userProfile.email());
    }
}

User Profile:
@Component
@RequestScope
public class UserProfile {

    @Getter @Setter
    @Accessors(fluent = true)
    @JsonProperty("username")
    private String username;

    @Getter @Setter
    @Accessors(fluent = true)
    @JsonProperty("email")
    private String email;

    @Getter @Setter
    @Accessors(fluent = true)
    @JsonProperty("firstName")
    private String firstName;

    @Getter @Setter
    @Accessors(fluent = true)
    @JsonProperty("lastName")
    private String lastName;
}

Security Config:
@Configuration
@EnableWebSecurity
public class SecurityConfigurator extends WebSecurityConfigurerAdapter {

    @Autowired
    private JwtAuthenticatingFilter jwtAuthenticatingFilter;

    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(getAuthenticator());
    }

    public void configure(WebSecurity web) throws Exception {
      web
        .ignoring()
           .antMatchers("/actuator/**")
           .antMatchers("/favicon.ico");
    }

    protected void configure(HttpSecurity http) throws Exception {
      http
        .csrf()
          .disable()
        .sessionManagement()
          .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
          .and()
        .authorizeRequests()
          .antMatchers("/actuator/**").permitAll()
          .antMatchers("/favicon.ico").permitAll()
          .and()
        .authorizeRequests()
          .anyRequest()
            .authenticated()
            .and()
          .addFilterBefore(getFilter(), SessionManagementFilter.class)
            .authenticationProvider(getAuthenticator())
            .exceptionHandling()
            .authenticationEntryPoint(new HttpAuthenticationEntryPoint());
    }

    protected AbstractAuthenticator getAuthenticator() {
        return new JwtAuthenticator();
    }

    protected AuthenticatingFilter getFilter() {
        return jwtAuthenticatingFilter;
    }
}

A: I believe the issue may be that you are attempting to inject a request-scoped bean (smaller scope) into a singleton-scoped bean (larger scope). There are a couple of reasons why this won't work:

*

*No request scope is active when the singleton is instantiated

*For the second request, the singleton would be working with the same stale bean that was injected for the first request.

You can get around this using a javax.inject.Provider to lazily inject the request-scoped bean on demand.
@Component
public class JwtAuthenticationFilter extends GenericFilterBean implements Filter {

    @Autowired
    public Provider<UserProfile> userProfileProvider;

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain next) throws IOException, ServletException {

        ....

        userProfileProvider.get()
            .username(authorizedUser.username())
            .email(authorizedUser.email())
            .firstName(authorizedUser.firstName())
            .lastName(authorizedUser.lastName());
    }
}

Spring has a similar interface org.springframework.beans.factory.ObjectFactory you can use if you are having trouble getting Provider's dependencies set up.
@Component
public class JwtAuthenticationFilter extends GenericFilterBean implements Filter {

    @Autowired
    public ObjectFactory<UserProfile> userProfileFactory;

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain next) throws IOException, ServletException {

        ....

        userProfileFactory.getObject()
            .username(authorizedUser.username())
            .email(authorizedUser.email())
            .firstName(authorizedUser.firstName())
            .lastName(authorizedUser.lastName());
    }
}

A: When Spring Boot detects a Filter in the ApplicationContext it will automatically register it in the chain of filters for the servlet container. However you don't want this to happen in this case as the filter is part of the Spring Security filter chain.
To fix do the following:

*

*Remove @Component from your filter

*Don't @Autowire the JwtAuthenticationFilter

*Create an @Bean method for the JwtAuthenticationFilter

*Create an @Bean method for a FilterRegistrationBean to disable the registration process.

@Bean
public JwtAuthenticationFilter jwtAuthenticationFilter() {
  return new JwtAuthenticationFilter();
}

@Bean
public FilterRegistrationBean<JwtAuthenticationFilter> jwtAuthenticationFilterRegistrationBean() {
  FilterRegistrationBean<JwtAuthenticationFilter> frb = new JwtAuthenticationFilter(jwtAuthenticationFilter());
  frb.setEnabled(false);
  return frb;
}

Then in your code instead of the getFilter  just reference the jwtAuthenticationFilter() method.


text:
Q: how to use subset with strings in R? I'm learning R and I am looking the way to remove all observations from my data frame that has varA == "Unknown" and varB == "".
This is what I am trying to do:
subset(dataFrame, varA != "Unknown" & varB != ""))

However this is obviously not working...
Any idea on how to get my subset done?

A: Negating a conjunct (&ed) logical condition creates a disjunction (|ed), according to De Morgan's laws:
subset(dataFrame, ! (varA == "Unknown" & varB == ""))

is the same as
subset(dataFrame, varA != "Unknown" | varB != "")

A: You could change the code slightly
 subset(dataFrame, !(varA =='Unknown' & varB==''))

data
    dataFrame <- data.frame(varA= c('Unknown', LETTERS[1:3], 'Unknown'),
          varB=c(LETTERS[1:4], ''))


text:
Q: Windows device manager and hardware IDs I'm curious how the windows device manager obtains the hardware IDs for a device, even though no device driver may be loaded for the device yet.  Anybody have a clue on how Windows goes on about this?
On a related note, I am interested in supporting language localization for the software we are writing; is it possible for a device and/or driver to report back its friendly name and description in a localized fashion?  Is there a common practice for this already?
Thanks for your time.

A: First, to understand the order of drivers being loaded, you're recommended to switch the Device Manager into View | Devices by Connection mode.
As you would notice, the devices are located below their bus driver. For PCI devices, it'll be "PCI bus". For USB devices, it would be their USB hub. Each bus driver has its own idea about how the identifier strings should be formatted:

*

*Device Instance Id

*Hardware Ids

*Compatible Ids

*Location, etc.

It returns them in response to IRP_MN_QUERY_ID (BusQueryInstanceID, BusQueryHardwareIDs, BusQueryCompatibleIDs) and IRP_MN_QUERY_DEVICE_TEXT (DeviceTextDescription, DeviceTextLocationInformation etc.)
Of course, since the bus driver enumerated the devices (i.e. created the child devices you're seeing) in the first place (through whatever standard interface appropriate for the bus; e.g. 'Get Device/String Descriptor' on USB), it knows their vendor ID, product ID etc.
The device's driver does not have to be loaded at this time. In fact, it can't be loaded. The device IDs are precisely what instructs the PnP system as to which driver matches the device.
As to localization:
Unlike IRP_MN_QUERY_ID, which provides opaque strings intended for device matching, the IRP_MN_QUERY_DEVICE_TEXT information was indeed intended to be localized. For that purpose, you receive the requested Locale ID (LCID) in the input data (Parameters.QueryDeviceText.LocaleId).
[As Alphaneo noted, a USB hub driver might pass this LCID onwards to the USB device (within a Get String Descriptor request), hoping that the USB device itself has localized strings.]

A: The top level process is called enumeration.  Most modern device buses support a mechanism that lets the OS query the buss and determine what devices are connected to the bus.
The PCI family of buses all support enumeration.  The PCI bus has a special enumeration space just for this.   This is where "Plug-n-Play" ID's come from.
The device id's uniquely identify a device on the bus and enable the OS to find the correct driver for that device.
Other buses, including USB and FireWire have enumeration strategies

A: Device ID, is a combination of information given from the device. For example, for a USB device, the string is based on the VID and PID (Vendor ID and Product ID). Now, this cannot happen if no driver is loaded. Atleast some driver, bus driver would have to be loaded for the OS to get the Device ID.
Now, for language support, I guess for WDM driver, there is a QUERY_LANG or something, I dont remember properly, alternatively some devices like USB, have Language ID support. This language ID determines the language of the Product descriptor string.

A: Please note that there is a difference between the hardware identifier/serial number and the true unique hardware ID. Maybe this will explain it better:
http://www.soft.tahionic.com/download-hdd_id/hardware%20ID%20programmer%27s%20DLL.html


text:
Q: Solr plugin for altering and adding synonyms to synonyms.txt Im searching for a Solr plugin for altering and adding synonyms to synonyms.txt?
Is there such a thing out there?

A: I'm not sure what you mean by 'adding synonyms to synonyms.txt'. However, if you're looking at adding synonyms while you index, those synonyms are usually taken from synonyms.txt (whatever you name)
Here's an out of the box feature to perform the same.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
    <fieldtype name="syn" class="solr.TextField">
       <analyzer>
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.SynonymFilterFactory" synonyms="syn.txt" ignoreCase="true" expand="false"/>
       </analyzer>
    </fieldtype>

A: I've been hunting this for a while as well.
No luck yet though.
I guess the main trouble in making a generally functional plugin for this would be filerights?


text:
Q: Extract file string data within a time range pattern I am trying to extract the data within a specific range of time from an input log file.
The input file, has the following pattern:
2023-01-31 00:00:21.354 FINE AS2SenderModule: Message sent and response received in 438 millisecondsms
2023-01-31 01:00:21.352 FINE AS2SenderModule: Message sent and response received in 479 millisecondsms
2023-01-31 09:00:23.368 FINE AS2SenderModule: Message sent and response received in 443 millisecondsms
2023-01-31 13:00:24.857 FINE AS2SenderModule: Message sent and response received in 393 millisecondsms
2023-01-31 14:00:26.758 FINE AS2SenderModule: Message sent and response received in 734 millisecondsms

I have tried the following ways but all have certain issues.
set /p start_time=Enter start time (HH:MM:SS):
set /p end_time=Enter end time (HH:MM:SS):
findstr /r "%start_time%.*%end_time%" input.txt > output.txt

This didn't work, it returned an empty output file.
The other workaround, which actually works, is no good to me. It is not dynamic, requiring user input, and only works for the same range pattern. What if the user input is like 08:00:00 to 13:00:00?
for /f "tokens=11 delims= " %%a in ('findstr " 1[3-4]:[0-5][0-9]:[0-5][0-9] " input.txt ^| findstr /r /c:"millisecondsms"') do @echo %%a>> output.txt

Range can be any between 00:00:00 to 23:59:59.
Please suggest a way.

A: @ECHO OFF
SETLOCAL

:: fixed start/end times for ease of testing

SET "start_time=09:00:23"
SET "end_time=13:00:25"

(
FOR /f "usebackqtokens=1,2,*delims=. " %%g IN ("q75568748.txt") DO IF "%%h" geq "%start_time%" (
 IF "%%h" gtr "%end_time%" GOTO done
 ECHO %%g %%h.%%i
)
)>"u:\sel.txt"

:done
GOTO :EOF

I've used fixed times and filenames that suit my system.
It all revolves around tokenising each data line using . and Space. The portion before the first space is assigned to %%g, that between the space and dot to %%h and the remainder to %%i (see for /? from the prompt, or many articles on SO for documentation)
Then test %%h for being greater than or equal to the start time, and then again for being greater than the end time, where a quick exit is taken if the time is after the end time.


text:
Q: External stylesheet not working for one div in safari but other divs work fine? I have a very obscure problem and I can't work out why it might be, I have a site i'm building and at the bottom of it i have a very simple footer with a link in it:

This is the link

I style this (alongside many other things) in the associated stylesheet like so:
#sitefooter {
float: right; width: 235px; margin: 10px 0 20px 0; text-align: center; font-size: 0.85em;
}

The page (using lots of CSS) displays absolutely perfectly on all browsers except Safari which works perfectly apart from this final div which shows up but ignores all the external styling. No matter what I do it just won't pick up styling for this one solitary div (it just uses the main body text styles), i've tried changing names in case there was a conflict and this doesn't fix it either. If i add inline styling then it works perfectly in safari as well. An additional thing i noticed: This is an addon domain (so the domain is mapped to /website/ folder on the server) and what's even more strange is when i view it from the root domain (www.rootdomain.com/website/index.php) and include the stylesheet relatively then it works fine in safari too.
I can't work out what to do as everything seems to be conflicting, safari can read the stylesheet as everything else is working on that page on safari and it works perfectly in all other browsers (and is about as simple as it gets) so i can't see there's anything wrong there. And when i include the same styling as inline styles then it works in safari too.
Any pointers or suggestions (or ideas of anything safari might be doing!) would be massively appreciated as i'm rather confused!
Thanks so much as ever everyone!
Dave

A: Validate the HTML, and the CSS, to check if there are any serious errors in the code.
As the code you are showing is perfectly fine, it's likely that the problem is somewhere else in the code, It could for example be an error in a previous rule in the style sheet, that keeps the #sitefooter rule from being parsed correctly.

A: This was a cache issue :)
you can disable safari cache here

*

*Delete the Safari cache folder. This should be in ~/Library/Caches/Safari/.

*Create an empty text document and save it as 'Safari' (no extension) and place in ~/Library/Caches/. I think just about any type
  of Document would work for this, just make sure the name of the file
  matches the name of the old folder, this way, a new folder can't be
  created by Safari when one is needed


text:
Q: How to Enable Deep-Linking on a WebView Application My app is a WebView Application and I've setup URL Intent Filters so when a link with the domain "riftacademy.org" is clicked, it opens my app.
Now I'm trying to implement deep-linking into the WebView application...
I saw something similar in the thread here How to enable deep-linking in WebView on Android app?
But unlike the above which uses a custom URI Scheme to open the application, I'd like to implement deep-linking in my WebView using my domain name "riftacademy.org"
In this scenario, when a link such as https://riftacademy.org/login or https://riftacademy.org/register is clicked, it should open the app and go to the pages that match the links. But in this case, it opens the app but only loads the homepage riftacademy.org...
I want the WebView app to be able to load links after the app has been opened, similar to how YouTube and Facebook handle links
Can Deep-Linking be achieved in WebView using Domain Names?
A snippet of where I'm guessing may be needed to edit
newWebView.setWebViewClient(new WebViewClient() {
                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        Intent browserIntent = new Intent(Intent.ACTION_VIEW);
                        browserIntent.setData(Uri.parse(url));
                        startActivity(browserIntent);
                        return true;
                    }
                });
                return true;
            }
        });

Thanks in advance

A: So I've been able to solve this with the help of Ron from https://webintoapp.com ... This was achieved using URI Intent Filters and placing the following code in the MainActivity.java and AndroidManifest.xml
I added this to the OnCreate Method in my MainActivity.java... The website name should be added just after the else{mWebView.loadUrL
SetWebView(mWebView);
        Intent intent = getIntent();
        Uri data = intent.getData();
        if(data != null) {
            //Load the deep-link url:
            String url = intent.getDataString();
            mWebView.loadUrl(url);
        }
        else
        {
            mWebView.loadUrl("https://riftacademy.org/");
        }

And this to my MainActivity.xml... The android:host should be the website URL as well
<activity android:name=".MainActivity">
            <intent-filter android:label="The Title">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:scheme="https"
                    android:host="riftacademy.org" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:scheme="http"
                    android:host="riftacademy.org" />

This would enable the WebView App to load all kinds of links as long as the links starts with the default URL of the website


text:
Q: Extension behavior for updated Postgrex version Elixir Phoenix I have this JSON module
defmodule EvercamMedia.Types.JSON do
  @behaviour Ecto.Type

  def type, do: :json

  def cast(term)
      when is_map(term)
        or is_binary(term)
        or is_list(term)
        or is_number(term),
    do: {:ok, term}

  def cast(_), do: :error

  def load(term), do: {:ok, term}

  def dump(term), do: {:ok, term}
end

defmodule EvercamMedia.Types.JSON.Extension do
  alias Postgrex.TypeInfo

  @behaviour Postgrex.Extension

  def init(_parameters, opts),
    do: Keyword.fetch!(opts, :library)

  def matching(_library),
    do: [type: "json", type: "jsonb"]

  def format(_library),
    do: :binary

  def encode(%TypeInfo{type: "json"}, map, _state, library),
    do: library.encode!(map)
  def encode(%TypeInfo{type: "jsonb"}, map, _state, library),
    do: <<1, library.encode!(map)::binary>>

  def decode(%TypeInfo{type: "json"}, json, _state, library),
    do: library.decode!(json)
  def decode(%TypeInfo{type: "jsonb"}, <<1, json::binary>>, _state, library),
    do: library.decode!(json)
end

I am getting many warnings as
warning: undefined behaviour function decode/1 (for behaviour Postgrex.Extension)
  lib/evercam_media/json.ex:20
warning: undefined behaviour function encode/1 (for behaviour Postgrex.Extension)
  lib/evercam_media/json.ex:20
warning: undefined behaviour function init/1 (for behaviour Postgrex.Extension

we are using it for the purpose of handling JSON. I just want to remove those warnings. I know it's for outdated postgrex version, But I want to get rid fo these warnings only.

A: Define the requested by Postgrex.Extension behaviour decode/1 (and encode/1, and init/1.) If you don't plan to use it, do e.g.:
def decode(_), do: :ok
def encode(_), do: :ok
def init(_), do: :ok

The issue here is the @behaviour declares a number of callbacks and this is the contract for any implementation. Unless the implementation implements all the callbacks, Elixir compiler issues a warning you get.


text:
Q: Eloquent "all()" method [Laravel 5.4] Eloquent is not returning me the data correctly (that's what I think).
I'm getting null variables here.
What should I do?
When i do dd(Productos::all());
it shows me what is showed below (the info I want lies in 'original' and 'attributes'):

Collection {#178 ▼
  #items: array:4 [▼
    0 => Productos {#179 ▼
      +id: null
      +id_categoria: null
      +nombre: null
      +precio: null
      +descripcion: null
      +created_at: null
      +udated_at: null
      #fillable: array:4 [▼
        0 => "id_categoria"
        1 => "nombre"
        2 => "precio"
        3 => "descripcion"
      ]
      #connection: null
      #table: null
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:7 [▼
        "id" => 1
        "id_categoria" => 1
        "nombre" => "Invitacion 1"
        "precio" => "75.000"
        "descripcion" => """
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ut ultrices quam. Phasellus eget magna in justo cursus posuere. Curabitur porta, purus eu co ▶
          \n
          """
        "created_at" => "2017-04-27 21:19:41"
        "updated_at" => "2017-04-27 21:19:41"
      ]
      #original: array:7 [▼
        "id" => 1
        "id_categoria" => 1
        "nombre" => "Invitacion 1"
        "precio" => "75.000"
        "descripcion" => """
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ut ultrices quam. Phasellus eget magna in justo cursus posuere. Curabitur porta, purus eu co ▶
          \n
          """
        "created_at" => "2017-04-27 21:19:41"
        "updated_at" => "2017-04-27 21:19:41"
      ]
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #events: []
      #observables: []
      #relations: []
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #guarded: array:1 [▼
        0 => "*"
      ]
    }
    1 => Productos {#180 ▼
      +id: null
      +id_categoria: null
      +nombre: null
      +precio: null
      +descripcion: null
      +created_at: null
      +udated_at: null
      #fillable: array:4 [▶]
      #connection: null
      #table: null
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:7 [▼
        "id" => 2
        "id_categoria" => 2
        "nombre" => "Invitacion 2"
        "precio" => "75.000"
        "descripcion" => """
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ut ultrices quam. Phasellus eget magna in justo cursus posuere. Curabitur porta, purus eu co ▶
          \n
          """
        "created_at" => "2017-04-27 21:20:09"
        "updated_at" => "2017-04-27 21:20:09"
      ]
      #original: array:7 [▼
        "id" => 2
        "id_categoria" => 2
        "nombre" => "Invitacion 2"
        "precio" => "75.000"
        "descripcion" => """
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ut ultrices quam. Phasellus eget magna in justo cursus posuere. Curabitur porta, purus eu co ▶
          \n
          """
        "created_at" => "2017-04-27 21:20:09"
        "updated_at" => "2017-04-27 21:20:09"
      ]
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #events: []
      #observables: []
      #relations: []
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #guarded: array:1 [▼
        0 => "*"
      ]
    }
  ]
}

Controller:
public function showAll(){
    return view('productos.index',[
                'productos' => Productos::all()
                ]);
}

View:

@foreach($productos as $producto)

{{ $producto->nombre }}

            {{ $producto->descripcion }}

 Añadir al carrito

@endforeach

A: I think you have declared properties in your model. Something like:
class Productos extends Model {
    public $id;
    public $id_categoria;
    // etc.
}

You do not need to do that in Laravel. There is some magic with attributes, so just remove all this properties and let Laravel build the object for you. You will be able to call your attributes from your view after calling all(). Simplified example:
public function showAll(){
    $ps = Productos::all();
    foreach($ps as $p) {
         dump($producto->nombre);
         dump($producto->descripcion); // <-- it displays what you wanted.
    }
}

If you were using public properties in your model (public $nombre, etc.) the magic system of Laravel attributes is broken, remove it.


text:
Q: Options for Linux OS executable archive files - self installers I am looking to create a web-project that is able to install with a program.  The user should be able to download an archive file or tar file, run it (executable), and the setup script would ask for paths and configurable values and then unpack its 'payload' and sorting out the contents for deployment.
This would be a Linux version of the MSI installer.  Is there such a thing for Linux operating systems?  This does not involve kernel level manipulations.  All it needs to do is copy directories and files on the filesystem, which should cover about 80% if not more of all the *nix distributions.
EDIT - I should mention also that this does not have to have a graphical UI - in fact it would be best if this whole process ran from the shell only.
What about BIN files?  Also is it possible to simply 'shove' a tar file into an executable script?

A: shar archives are self-extracting in most unixes (written in sh). http://en.wikipedia.org/wiki/Shar

A: Software "installers" for Linux are typically distributed as "packages."  This can vary from distribution to distribution, but Debian or Debian-based distributions (like Ubuntu) typically use .deb packages, Redhat and Fedora use .rpm packages (along with some other distributions).
I can't say much for any distribution but Ubuntu with the .deb packages, but these operate a lot like one would expect an installer to.  However, they do not typically allow one to select installation directories - they just put it in a standard location.  See http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html for more information on Debian packages or http://en.wikipedia.org/wiki/RPM_Package_Manager for more information on RPM.

A: There are some, e.g. InstallJammer http://www.linux.com/archive/feed/60380 or  AutoPackage http://www.autopackage.org/

A: Check out autopackage. Basically a user just has to download the .package file, which contains everything, make it executable, and then run it. It can be installed from the command line if desired but there is also a GUI option if the user double clicks from the desktop.

A: FreeArc from http://freearc.org/ claims to create SFX archives and installers.


text:
Q: Are there any theory about data clustering that relate to this intuition? Are there any theories or online papers about data clustering (with any clustering technique and data generated by any model) that relate to this intuition?
When the model parameters (including number of clusters k) are predetermined, the more the data points, the more accurate the data points can be accurately assigned to its respective true clusters using a certain clustering technique, or the posterior clustering results of the points more accurately match the true clusters they belong to.


text:
Q: UIImagePickerController Memory Leak I am seeing a huge memory leak when using UIImagePickerController in my iPhone app. I am using standard code from the apple documents to implement the control:
    UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

        switch (buttonIndex) {
            case 0:
                imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
                [self presentModalViewController:imagePickerController animated:YES];
                break;
            case 1:
                imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
                [self presentModalViewController:imagePickerController animated:YES];
                break;
            default:
                break;
        }
    }

And for the cancel:
-(void) imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [[picker parentViewController] dismissModalViewControllerAnimated: YES];
    [picker release];
}

The didFinishPickingMediaWithInfo callback is just as stanard, although I do not even have to pick anything to cause the leak.
Here is what I see in instruments when all I do is open the UIImagePickerController, pick photo library, and press cancel, repeatedly.  As you can see the memory keeps growing, and eventually this causes my iPhone app to slow down tremendously.

As you can see I opened the image picker 24 times, and each time it malloc'd 128kb which was never released. Basically 3mb out of my total 6mb is never released.
This memory stays leaked no matter what I do. Even after navigating away from the current controller, is remains the same.  I have also implemented the picker control as a singleton with the same results.
Here is what I see when I drill down into those two lines:

Any help here would be greatly appreciated! Again, I do not even have to choose an image.  All I do is present the controller, and press cancel.
Update 1
I downloaded and ran apple's example of using the UIIMagePickerController and I see the same leak happening there when running instruments (both in simulator and on the phone).
http://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40010196
All you have to do is hit the photo library button and hit cancel over and over, you'll see the memory keep growing.
Any ideas?
Update 2
I only see this problem when viewing the photo library.  I can choose take photo, and open and close that one over and over, without a leak.

A: It's a bug in the SDK. File a report with Apple. I have the samme isue. It is also documented here: http://www.cocoabuilder.com/archive/cocoa/285293-iphone-memory-leak-can-explain.html
and that was over a year ago and still no fix.

A: A few of our apps reuse the same UIImagePickerController due to a leak in 2.x (it makes me feel old...). I was under the impression that the leak was fixed, but I could be wrong.
It's a slightly horrible workaround, but sometimes that's the best you can do.

A: Try setting the UIImagePickerController.delegate to nil before releasing.
-(void) imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [[picker parentViewController] dismissModalViewControllerAnimated: YES];
    picker.delegate = nil;
    [picker release];
}

A: The "Mark Heap" button in Instruments has been, for me, the absolute best way of tracking down these sorts of issues.
This is an OK article on how to use it: http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/
But it will tell you, for sure, which objects are surviving longer than you expect... and, ultimately, what the source of the issue is.
You can also see a complete retain/release trace for each individual object which survived - allowing you to pinpoint where your problem is.
EDIT: I use a UIImagePickerControllers as well, and I can promise it doesn't leak (at lesat for me) the way you're suggesting - so, whatever is going on, it's almost surely fixable.

A: I used UIImagePickerController and after 40 capture images my application received a DidMemoryWarning message and stop, hidden all my views.
In my application I create 40 objects of
UIImagePickerController( new UIImagePickerController() )

To work correctly I create a unique instance shared to all application and with this all work correctly.
I supusose that control lost memory too, but only one time. My application can capture images from camera correctly:
private static UIImagePickerController picker = new UIImagePickerController();


text:
Q: Is there any complete real life Rails project with RSpec? I'm learning RSpec for a while and reading some articles, books and other resources. But I wonder if is there any complete real life Rails project, that using RSpec, with source codes available to examine. I study some gems and Ruby projects but still I think it would be better to see a Rails project's source code in action.

A: Discourse is a large, real world project you could take a look at.
They use RSpec and you can view all their testing code here.

A: Another huge open source rails app using rspec is spree commerce https://github.com/spree/spree


text:
Q: Adding a latex interpreter on a boxplot I have a box plot for which I want the label.
the variable on the x-axis in latex
the code works if I put this, however the the labels are not in latex
boxplot(a,'Labels',{'sigma = 10','sigma = 20','sigma = 30'})

to put it into latex I would write the following command
boxplot(a,'Labels',{'sigma = 10','sigma = 20','sigma = 30'} , 'interpreter' , 'latex')

However , this gives me an error
Invalid parameter name: interpreter.
How would I fix it?

A: Use
boxplot(a,'Labels',{'sigma = 10','sigma = 20','sigma = 30'})
set(gca, 'TickLabelInterpreter', 'latex')


text:
Q: Semantic UI dropdown lists displays 'undefined' I'm having difficultly getting a Semantic UI (v2.4.2) dropdown to work as expected.
If I click the down arrow, the dropdown displays a list of undefined items:

If I type the name of a tag, the dropdown displays the correct list of tags:

HTML:

  <input type="hidden" name="tags">

Tags

The JSON API returns a list of tags as an array:
[
  {
    "id": 5,
    "name": "mssql",
    "description": "Microsoft SQL Server is a relational, database-management system developed by [Microsoft](https://www.microsoft.com/)."
  },
  {
    "id": 6,
    "name": "oracle",
    "description": "Oracle's DBMS"
  },
  {
    "id": 8,
    "name": "plsql",
    "description": "[PL/SQL](https://en.wikipedia.org/wiki/PL/SQL) is Oracle Corporation's procedural extension for SQL and the Oracle relational database."
  }
]

Oddly, the onResponse callback only fires when a value is typed in the search box.
What am I missing?

A: you've set the minimum number of characters to initiate the search to 3 right here:
$("#myList").dropdown({
   minCharacters : 3,
   allowAdditons : true

simply add:

showOnFocus:true

to your configuration object. It should solve the problem.


text:
Q: Reading the JAR values out of a properties file in Perl and then compare it with the local version This might be a little too difficult to do with perl, but I'm hoping someone can at least help me find the correct direction to accomplish this.
Currently we have a Nexus server that is holding all of our .jar files. One of the applications needs to use 3rd party common jars that are being defined in a .properties file.
The properties file looks like this
commons-logging=commons-logging-1.1.1.jar
commons-io=commons-io-2.3.jar
httpcore=httpcore-4.2.1.jar

I am being asked to create a Perl script that will skim through this properties file, then compare that version(i.e. commons-logging-1.1.1.jar) with a version that is located elsewhere. If the version in the properties file is not the same, it will then copy the new .jar file to the common jar location.
An example
In C:\commons there is a commons-logging-1.1.0
In the properties file, it is specified that commons-logging=commons-logging-1.1.1.jar is needed. The perl script would then read the .properties file, determine that commons-logging-1.1.1 is not the same as the commons-logging-1.1.0 found in the commons folder and would replace it.
We can also use maven for something like this, but I'm not sure how we can make it so the developer can just define what jar is needed in a properties file and replace it in a specific folder.
Any help would be greatly appreciated.

A: It's hard to know what problems you are having with this. Perhaps this program will help?
use strict;
use warnings;

open my $fh, '<', '.properties' or die $!;

while (<$fh>) {
  if (/^([\w-]+)=\1-([\d.]+)\.jar$/) {
    my ($lib, $ver) = ($1, $2);
    print qq(Library "$lib" needs version $ver\n);
  }
  else {
    warn "Error in .properties line $.: $_";
  }
}

output
Library "commons-logging" needs version 1.1.1
Library "commons-io" needs version 2.3
Library "httpcore" needs version 4.2.1

A: Sounds like you've been asked to write a dependency management client.
I would suggest using Apache ivy, which has a convenient command-line client.
Example
This ivy command:
java -jar ivy.jar -ivy ivy.xml -retrieve "lib/[artifact]-[revision](-[classifier]).[ext]"

creates a "lib" directory populated with the jars listed in the ivy file:
├── ivy.xml
└── lib
    ├── commons-io-2.3.jar
    ├── commons-logging-1.1.1.jar
    └── httpcore-4.2.1.jar

The real advantage of this approach is that ivy will also download the transitive dependencies.
Additionally ivy will cache the files previously downloaded. This means it's simpler to just delete an older directory and get ivy to create a new directory containing the jars. (Rather than going to the effort of comparing files)
ivy.xml
<ivy-module version="2.0">
    <info organisation="myorg" module="mymodule" />
    <dependencies>
        <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="default"/>
        <dependency org="commons-io" name="commons-io" rev="2.3" conf="default"/>
        <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.2.1" conf="default"/>
    </dependencies>
</ivy-module>