text:
Q: Disable or hide EasyAdmin crud search bar I have developped an online learning website with EasyAdmin as backend. Everything works fine, but I'd like to hide or disable the search bar on top of the crud pages. I have not overridden any templates, just created crud based on my entities with fields and a custom query builder to only index content created by the logged in user.
Can't seem to find any info on how to do it online or in the doc. Is it possible to add an option to hide or disable the default search bar? Thank you!

A: https://symfony.com/doc/3.x/EasyAdminBundle/crud.html#search-order-and-pagination-options
In your Dashboard:
# App\Controller\Admin\DashboardController

public function configureCrud(): Crud
{
    $crud = Crud::new();
    return $crud
        // ...
        ->setSearchFields(null); // hide the search bar on all admin pages
}

That's what you asked for. But you can go further:
-> Hide the search bar only on a specific CrudController:
# App\Controller\Admin\PostCrudController

public function configureCrud(Crud $crud): Crud
{
    return $crud
        // ...
        ->setSearchFields(null); // hide the search bar on admin pages related to the Post entity
}

-> Add conditions for granular control:
# App\Controller\Admin\PostCrudController

public function configureCrud(Crud $crud): Crud
{
    if (
        $_GET['crudAction'] === Action::EDIT // if this is the 'edit' page
        || !in_array('ROLE_ADMIN', $this->getUser()->getRoles()) // or if the user is not an admin
    ) {
        $crud->setSearchFields(null); // then hide the search bar
    }
    return $crud;
}


text:
Q: Firewalld rule to allow Java to connect with other servers in a network A web application running Java on a CentOS 7 server in a private network needs to use Java to make connections with other servers in the same network.  Java may automatically choose random ports when making outbound connections from the CentOS 7 server.
What specific syntax would be required to write a Firewalld rule on server 10.0.8.1 that would enable a Java web app running in IP 10.0.8.1 to use any port to establish connections with other servers in the 10.0.8.x network?
The other servers are able to receive connections with rules set up on specific ports, but the web app server's Java needs to be able to use any port.
@garethTheRed's suggestions:
Per @garethTheRed's suggestion, I restarted firewalld and typed firewall-cmd --list-all-zones on the CentOS 7 virtual machine whose Java installation is not able to make outbound database connections to another virtual machine on the same network.  The results are as follows:
[root@localhost ~]# firewall-cmd --list-all-zones
work
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

drop
  target: DROP
  icmp-block-inversion: no
  interfaces:
  sources:
  services:
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

internal
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client mdns samba-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

external
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: ssh
  ports:
  protocols:
  masquerade: yes
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

trusted
  target: ACCEPT
  icmp-block-inversion: no
  interfaces:
  sources:
  services:
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

home
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client mdns samba-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

dmz
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

block
  target: %%REJECT%%
  icmp-block-inversion: no
  interfaces:
  sources:
  services:
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

[root@localhost ~]#

redpajama_set_name: RedPajamaStackExchange


text:
Q: I can't write anything to second partition. Only root partition appears on file system Thanks for all suggestions. I have reinstalled ubuntu and put a single partition for all disk. I hope answers under this question helps someone else in future. For me, it was hard to understand as a newby Ubuntu user :) Thanks again.
I have installed Ubuntu 20.04 LTS on my new internal SSD 240 GB.
I have created partitions manually when I start installation as:
swap 512MB,
root 40 GB ext4,
EFI 1 GB,
Other (around) 190 GB fat32.
When installation has enden I didn't see my "other" partition on file browser. Somehow it seen when I open Disks app or Gparted app.
I thought that it has happened because I partitioned as fat32. So I have deleted that partition by using Gparted and I create a new partition with same size as ext4.
After sudo parted -l, I get:

So the problem part is number 4
How can I see and write on my 198 GB partition?
TIA

A: You will need to tell the OS where to mount that partition; check /etc/fstab to see if there is an entry for it. If there isn't then create a mount point for it on the root filesystem, check that you can mount it with the mount command and when it works and add an entry in /etc/fstab to mount it automatically at boot.  The man pages for the mount command and the format of /etc/fstab will help you. See also the Ubuntu help wiki page on fstab.

A:
So I have deleted that partition by using Gparted and I create a new partition with same size as ext4.

GParted always runs as root therefore the partition you created is owned by root.
You can either chown user:user mountpoint -R (please note that "user" and "mountpoint" are placeholders and "-R" means recursive) or, considering that you have nothing there, simply use Disks instead of Gparted. Disks runs as your own user therefore the partitions it creates are owned by you. Simply select, remove and create another with the right-click menu.


text:
Q: jQuery custom events not working I wanted to have to JS files communicate to each other via jQuery events and thought it would be pretty straight forward but have run into a problem that I think I need help with.
Basically I'm using a DOM element with an ID of '#nav-controller' to act as the messenger between the two JS files. The first file -- and I have checked that it is the first one to execute -- listens for two custom events:
function external_command_listener () {
    // Click Handling
    $( '#nav-controller' ).on( 'clickhandler' , function ( e , param ) {
        alert ("registering clicks to: " + param );
        register_qs_click_handler ( param );
    });
    // Menu Control handling
    $( '#nav-controller' ).on( 'controlframework' , function ( e , param ) {
        alert ('registering menu handling to: ' + param );
        register_qs_control_framework ( param );
    });
}

Now that that's setup. The second file uses trigger() to effectively call the function in first file. Here's the code:
function Initialise_Navigation () {
    navTemplate = Template_File_Name ( 'navigation' );
    $.get( navTemplate , function (data) {
        $( '#page-nav-system' ).html(data);
        $( '#nav-controller' ).trigger( 'clickhandler' , ['#application li'] ); // register a click handler
        $( '#nav-controller' ).trigger( 'controlframework' , ['.quicksand-cntrl'] ); // register a control framework

I have tested using Chrome's debugger that it does execute the Initialise_Navigation() function and in turn apparently runs both trigger statements but the listeners setup in the first file never activate. I tried it also with just a generic 'click' event but that too failed.
Any ideas? I'm at the end of my rope.

A: I might be over simplifying this - but, why exactly do you need to implement "communication" between two JS files?  Are they in some sort of OO pattern?  Do they run in different scopes?
In any case, you could simply bind the event handler to the document object (or any other encompassing parental object you have in your DOM tree.
// Even binding
$('#parentalElement').bind('customEventString', function(event, params... ) {
  // Handle the event
});

// Trigger
$('#foo').trigger('custom', params );


text:
Q: How to deal with object deletion in continuous allocation? I've recently found benefits of Data Oriented Design. It looks very impressive. One of points is grouping data by type and access, not all together in objects, but in arrays, to prevent cache misses and for better processing.
So in game we still have instances and user is able to destroy any of them (not only last in array). I can't figure out how to effectively deal with object deletion in middle of array.
I have one idea: to have isAlive value, but that will will cause quite big impact on number of conditions, because every objects get checked many times in processing, drawing,...
Another idea is to shift whole array to fill space that has to be deleted, but this will consume much resources at deletion.
How can man deal with this in DOD?
So put up the requirements:

*

*it has to be array(s) in order to reduce cache misses destribed in DOD

*it has to have fast random position object deletion, max o(log n)

*objects can't move since they were created, because they could be referenced at unknown places, so it will cause program misbehavior

A: It's actually quite easy, don't use direct references. Use a layer of indirection such as IDs. For example:
Let's say you have a FooManager that manages all your Foo "objects" (not objects in the OOP sense, a collection of arrays for each Foo property). As I understand it, what you do right now is just return an index. Let's say Foo #42 is the Foo which data is located at index 42 of all the arrays. Now you want to delete Foo #42, which blows a hole in your array. You could move all other array entries but then Foo #43 no longer points at the actual index 43.
So we add an ID table and instead of returning the index, you return an ID. When you create a new Foo, you add its data to the first free index in the arrays (let's say 42). Then you generate an new unused ID (let's say 1337). Now you can update the ID table (a (hash)map is great for this) to say ID 1337 points to index 42. Now you can return the ID 1337 to the calling function. (Notice how the calling function never finds out where the data is actually stored, that's irrelevant information)
Next time the Foo needs to be updated from another piece of code, the ID is used. So the FooManager's setBar function is called with ID 1337 and the new Bar value as arguments. FooManager looks up 1337 in its ID table, finds out it's still located at index 42 and updates the Bar array index 42 with the new Bar value.
Now this is where this system gets it's value, let's remove Foo 1337. FooManager's removeFoo is called with ID 1337 as argument. It looks up 1337, it's located at index 42. However, in the mean time, 10 new Foos have been added. So what we can now do is just replace the values at index 42 with the values at 52, effectively moving 52 to 42. This would cause a big problem in the old system, but now, we only need to update the index table. So we look up which ID points to 52 (let's say it's 1401) and update it to 42. Next time someone tries to update the Foo with ID 1401, it looks it up in the index table and finds it is located at index 42.
So we've kept the data in continuous memory, a remove only costs a very low number of data copies operations (one copy for each property of Foo) and the code "outside" of FooManager never even realizes something happened. It even solves dead refence issues. Suppose some code still has the deleted 1337 ID (dangling refence, this is bad!), when it tries to access/change it, FooManager looks it up, sees 1337 doesn't exist (any more) and can generate a nice clean warning/error and callstack, which allows you to directly identify which code still has the dangling reference!
There is only one disadvantage, which is an extra lookup in the ID table. Now a hash table can be really fast, but it's still an extra operation for each time you modify a Foo object. However, in most cases, access from outside of a manager happens far less than access inside of a manager. When you have a BulletManager, it will update each bullet every frame, but accessing a Bullet to change/request something and calls to create/remove bullets are faaaar less likely to occur.
If this is the other way around though, you should probably update your data structures to optimize for that situation. Then again, in such a situation, it doesn't matter that much any more where data is located in memory so you could live with either "holes" in your arrays or even using completely different data layouts.

A: it depends on the constraints and workload, but one approach is to swap the deleted element with the last element in the array, then remove the deleted element from the end (pop_back). this assumes the order of the array isn't particularly important. another approach is a sparse array, which might work in environments where the memory budget is fixed.
EDIT: if you're maintaining external pointers into the array, they can be managed using smart pointers whose underlying addresses are updated (shared_ptr::reset) when an array element is moved. you would end up with 2 parallel arrays of the same length:
typedef std::vector<thing> thingVec;
thingVec things;

// smart pointers for each object
std::vector<boost::shared_ptr<thingVec::iterator>> references;

in your createThing function, you'd return a shared_ptr with a custom deleter (which would automagically do the array update once all references have been extinguished):
http://www.boost.org/doc/libs/1_51_0/libs/smart_ptr/sp_techniques.html#static
the smart pointers can point to structures with multiple fields that are ultimately stored in different arrays, as long as the custom deleter knows which arrays to compact when an element is deleted.


text:
Q: If quadratic variation of a local martingale is zero then it is itself zero Let $M$ be a local martingale, if we need it, we can assume that $M$ is continuous. We know that $\langle M\rangle =0$. This implies that $M$ and $M^2$ are local martingale. Can we conclude that $M=0$? If so, how?

A: Hint: Suppose $M$ is a martingale such that $\langle M \rangle = 0$. Then $M^2$ is a martingale, thus
$$\mathbb{E}(M_t^2-M_0^2) = 0$$
Now use that $$\mathbb{E}(M_t^2 - M_s^2) = \mathbb{E}((M_t-M_s)^2)$$ for all $s \leq t$.


text:
Q: RTC equivalent for 'git pull' What is the equivalent command for accomplishing the use case of a git pull command (update to the tip and do auto resolve conflicts) ? I'm looking for the scm command which accomplishes the functionality of a git pull operation.

A: That would be, as shown in accept example a:
lscm show status
lscm accept changesetId

That is using:

*

*The lscm show status command to list the incoming change sets,

*The lscm accept command will integrate a change set from  astream into your repo and local workspace, and make automatic merge (unless there is conflicts or unless you specify --no-merge).


text:
Q: Write a function as $\sum _{n=0} ^{\infty} a_n x^n$ We have $f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4$.
Now I want to write this as $\sum _{n=0} ^{\infty} a_n x^n$.
What I got:
$f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4 = x^4 (1+ x + x^2 + x^3 + x^4 + x^5)^4$
We know: $\frac{1}{1-x} = \sum _{n=0} ^{\infty} x^n$.
Note that $\displaystyle \frac{d^3}{dx^3} (\frac{1}{1-x})= \frac{6}{(1-x)^4}$.
Then $\frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n-3}$, what gives
$x^4 \frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n+1} = \frac{1}{6} \sum  (n-1) (n-2) (n-3) x^{n}$
If I look now on Wolfram Alpha at the expanded form, this expression is only correct for $4 \leq n \leq 9$. For $n \geq 10$ it gives other values of the coefficients. What goes wrong?

A: We can write $$x+x^2+\cdots+x^6=\frac{x-x^7}{1-x}$$ and then we can expand the numerator with a binomial expansion:
$$(x+x^2+\cdots+x^6)^4 = \frac{(x-x^7)^4}{(1-x)^4} = (1-x)^{-4} \sum_{k=0}^4 {4 \choose k} (-1)^k x^{6k+4}$$
$$=\left( \frac16 \sum_{n=0}^\infty (n+3)(n+2)(n+1) x^{n} \right) \left( \sum_{n=0}^4 {4 \choose n} (-1)^n x^{6n+4} \right)$$
$$=\left( \frac16 \sum_{n=0}^\infty (n+3)(n+2)(n+1) x^{n} \right) \left( x^{4} - 4 x^{10} + 24 x^{16} - 4 x^{22} + x^{28}\right).$$
We can call $(n+3)(n+2)(n+1)=b_n$, for the sake of brevity.
$$=\frac16 \left( \sum_{n=0}^\infty b_n x^{n+4} - \sum_{n=0}^\infty 4b_n x^{n+10} + \sum_{n=0}^\infty 24 b_nx^{n+16} - \sum_{n=0}^\infty 4b_n x^{n+22} + \sum_{n=0}^\infty b_n x^{n+28}\right)$$
$$= \frac16 \left( \sum_{n=4}^\infty b_{n-4} x^{n} - \sum_{n=10}^\infty 4b_{n-10} x^{n} + \sum_{n=16}^\infty 24 b_{n-16}x^{n} - \sum_{n=22}^\infty 4b_{n-22} x^{n} + \sum_{n=28}^\infty b_{n-28} x^{n}\right)$$
Finally we have $$\frac16
\left(\sum_{n=4}^{9} (n-1)(n-2)(n-3) x^n +\sum_{n=10}^{15} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9)\right] x^n + \sum_{n=16}^{21} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)\right]x^n +
\sum_{n=22}^{27} \left[(n-1)(n-2)(n-3) -  4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21)\right]x^n
+\sum_{n=28}^{\infty} \left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21) + (n-25)(n-26)(n-27)\right]x^n\right).$$
However, we know that the resulting polynomial has a degree of $24$, thus all of the coefficients for the last series must be zero, and the coefficients of $x^{25}$, $x^{26}$ and $x^{27}$ are zero. This can be verified by expanding the polynomials in $n$. Thus:
$$
\sum_{n=4}^{9} \frac{(n-1)(n-2)(n-3)}{6} x^n + \sum_{n=10}^{15} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9)\right]}{6} x^n + \sum_{n=16}^{21} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)\right]}{6}x^n + \sum_{n=22}^{24} \frac{\left[(n-1)(n-2)(n-3) - 4 (n-7)(n-8)(n-9) + 24(n-13)(n-14)(n-15)-4(n-19)(n-20)(n-21)\right]}{6} x^n$$

A: (can't leave a comment)
You'll want the multinomial series formula for this purpose:
$$\left(\sum_{j=1}^k a_j\right)^n=\sum_{\stackrel{n_j \geq 0}{\sum_{j=1}^k n_j=n}}\frac{n!}{\prod_{j=1}^k n_j!}\prod_{j=1}^k a_j^{n_j}$$
where the condition on the sum on the right means to sum all over the integer partitions of the power $n$.

A: You're mixing up finite sums with infinite sums.
Another problem is that anything calcualted using an infinite sum is likely to have limited validity. Why add that constraint to your solution?
You have that $f(x) = x^4 (1+ x + x^2 + x^3 + x^4 + x^5)^4$
Why not just expand that bracket?
$(1+ x + x^2 + x^3 + x^4 + x^5)^2$
$=1+ x + x^2 + x^3 + x^4 + x^5$
$..... + x + x^2 + x^3 + x^4 + x^5 +x^6$
$.........+x^2 + x^3 + x^4 + x^5 +x^6+x^7$
$..............+x^3 + x^4 + x^5 +x^6+x^7+x^8$
$...................+x^4 + x^5 +x^6+x^7+x^8+x^9$
$........................+x^5 +x^6+x^7+x^8+x^9+x^{10}$
$=1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}$
Then find $\left( 1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}\right)^2$
$= 1+ 2x + 3x^2 + 4x^3 + 5x^4 + 6x^5 +5x^6+4x^7+3x^8+2x^9+x^{10}$
$..... + 2x + 4x^2 + 6x^3 + 8x^4 + 10x^5 +12x^6+10x^7+8x^8+6x^9+4x^{10}+2x^{12}$
Coefficients are:
 1                                    =  1
 2+  2                                =  4
 3+  4+  3                            = 10
 4+  6+  6+  4                        = 20
 5+  8+  9+  8+ 5                     = 35
 6+ 10+ 12+ 12+ 10+  6                = 56
 5+ 12+ 15+ 16+ 15+ 12+  7            = 82
 4+ 10+ 18+ 20+ 20+ 18+ 14+  8        =112
 3+  8+ 15+ 24+ 25+ 24+ 21+ 16+  9    =145
 2+  6+ 12+ 20+ 30+ 30+ 28+ 24+ 18+ 10=180
 1+  4+  9+ 16+ 25+ 36+ 35+ 32+ 27+ 20=205
     2+  6+ 12+ 20+ 30+ 42+ 40+ 26+ 30=218
                                      =218
                                      =204
                                      =175
                                      =130
                                      = 90
                                      = 56
                                      = 29
                                      = 10

A: We know that for any Taylor series representation:
$$ \sum_{n=0}^{\infty} \frac{ f^{(n)}(a) } {n!} (x-a)^n $$
It looks like you want the series centered at a=0.
So to get the coefficient for terms 1,2,3,4,.... evaluate:
$$b_n=\frac{ f^{(n)}(a)}{n!}$$


text:
Q: facebook login Javascript SDK - button only works some of the time? I have the following simple code for facebook website login below. I tested the site in a mozilla browser and everything worked fine, opening up a prompt for me to login to facebook, but when I tried again on a windows OS with chrome, my button does not do anything. This is especially frustrating because it looks like the button works - but only sometimes, and I have no idea why. I am hosting my site through google app engine.
I've been trying to figure this out for ages, any help would be greatly appreciated!!
  // Additional JS functions here
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'xxx', // App ID
      channelUrl : '//http://www.XXX.com/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });
  };

function doLogin(){
    FB.getLoginStatus(function(response) {
      if (response.status === 'connected') {
         login();
      } else if (response.status === 'not_authorized') {
         login();
      } else {
         login();
      }
     });
}

function login() {
    FB.login(function(response) {
        if (response.authResponse) {
            testAPI();
        } else {
            // cancelled
        }
    }, {scope: 'email,user_education_history,user_work_history'}); //permissions
}

function testAPI() {
    FB.api('/me', function(response) {
        alert('Good to see you, ' + response.email + '.');
    });
}

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));

And my html button:
  <button style="position:absolute; margin-top: 4px;margin-left:600px;" onclick="doLogin();">Sign Up With Facebook</button>

EDIT:
When I check the console in my chrome browser where the button doesnt work, I receive the following message:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
Again, the button works perfectly fine when I am running it in my mozilla browser in my linux OS but not on my other computer. I am still not sure what is causing this difference?? Thanks again all for your help.


text:
Q: Specify response_type=token for SSO in Identity Server I am attempting to set up SSO from our ASP.NET Core Identity Server app to an external identity provider. Basically a user that is authenticated on our external partner's website but isn't authenticated on our website clicks a link to go to a certain page on our website. Since they aren't authenticated on our website then it redirects them to the external identity provider's authentication request url, then after verifying they are authenticated it redirects them back to our identity server to sign them in then redirects them to the original page that they requested.
This works great with the authorization code flow (response_type=code), it seems that this is the default in Identity Server. However, one of the external identity providers that we're trying to integrate with does not support the authorization code flow, when I try it they return an error: "The+authorization+server+does+not+support+obtaining+an+authorization+code+using+this+method". They only support response_type=token. It's not clear to me how you can specify this in Identity Server, it appends response_type=code into the authentication request url no matter what. Even if I specify ?response_type=token in my authentication request url it STILL appends response_type=code after that. And I don't see any property on the Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions class that can be used to configure it. What am I missing?
authenticationBuilder.AddOAuth(ssoIdentityProvider.SsoCode, options => SetOAuth2Options(ssoIdentityProvider, options));

private static void SetOAuth2Options(IdentityProvider ssoIdentityProvider, OAuthOptions options)
        {
            // Set standard options.
            options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
            options.AuthorizationEndpoint = ssoIdentityProvider.AuthenticationRequestUrl;
            options.CallbackPath = new PathString("/signin-oauth2");
            options.ClientId = ssoIdentityProvider.OAuth2ClientId;
            options.ClientSecret = ssoIdentityProvider.OAuth2ClientSecret;
            options.UsePkce = ssoIdentityProvider.OAuth2UsePkce;
            options.TokenEndpoint = ssoIdentityProvider.OAuth2TokenRequestUrl;
            options.UserInformationEndpoint = ssoIdentityProvider.OAuth2UserInformationRequestUrl;
            // Set requested scopes.
            ssoIdentityProvider.OAuth2RequestedScopesList?.ForEach(s => options.Scope.Add(s));
            // Set expected claims.
            ssoIdentityProvider.OAuth2ExpectedClaimsList.ForEach(c => options.ClaimActions.MapJsonKey(c.Key, c.Value));
            options.Validate();
        }


text:
Q: GAE - Any performace benefits storing shorter names for datastore fields? Do we get any performance benefits by naming the data-store fields with shorter names? As in while pulling the data from data-store we might get a benefit during data serialization and de-serialization?
Example:
Before
@Entity
public class Data
{
    // Id
    private int id;

    // Name
    private String name;

    // Marks
    private long marks;
}

After:
@Entity
public class Data
{
    // Id
    private int id;

    // Name
    private String n;

    // Marks
    private long m;

}

Mainly when we fetch multiple[max 1000] records out?

A: A typical put operation takes about 50 to 100 msec, a get 10 to 20 msec and a query 20 to 100 msec. (You can check it with Appstat https://developers.google.com/appengine/docs/java/tools/appstats.) Most of this time is spend waiting for network or disk. What affects performance more is the number of properties that require indexing. The size of the whole entity is unimportant in the performance. Considering that the slowest instances run at 600Mhz, reducing few characters in the name of a field is negligible.


text:
Q: What is the centroid of an image? I am currently reading up on image moments, and I see image centroid begin described as the center of the mass in the image but that is not very intuitive to me.
So my question is:
In the context of image analysis with image moments, what are centroids and what relevance do they have (what information do they give me,how can I repurpose them?).

A: Please read https://en.wikipedia.org/wiki/Centroid

In mathematics and physics, the centroid or geometric center of a
  plane figure is the arithmetic mean position of all the points in the
  shape.

If you want to find the centroid of a group of pixels in a binary image you calculate the average coordinate. In case of a grayscale image you can use the pixels' gray values to calculate the weighted average position.
Applications: anything where you need the centroid of a shape. How do you describe the position of something in your image for example?


text:
Q: Combining Excel's AND and OR within an IF statement I'm trying to combine 'AND' and 'OR' into an IF statement which looks at two cells, and 3 'OR' criteria, but I'm not sure if it's possible. Logic below:
IF cell M2 = "P4", AND cell AB2 = "P3" OR cell AB2 = "P2" OR cell AB2 = "P1", "Elevated", "Not Elevated"
This is as far as I got with regard to an actual formula which doesn't yet incorporate the 'OR' portion:
=IF(AND(M2="P4",(AB2="P3")),"Elevated","Not Elevated")

Any advice would be greatly appreciated. Thanks in advance.

A: Try this:
= IF(OR(AND(M2 = "P4",AB2 = "P3"),AB2 = "P2",AB2 = "P1"), "Elevated", "Not Elevated")

EDIT
Based on your comment:
= IF(M2<>"P4","N/A",IF(OR(AB2={"P1","P2","P3"}),"Elevated","Not Elevated")


text:
Q: Solution of polynomial equation $g(x)\cdot g(y) = g(x)+g(y)+g(xy)-2\;\forall x,y\in \mathbb{R}$
If $g(x)$ is a polynomial function satisfying $g(x)\cdot g(y) = g(x)+g(y)+g(xy)-2\;\forall x,y\in \mathbb{R}$
and $g(2)=5\;,$ Then $g(5) = $

$\bf{My\; Solution::}$ Given $$g(x)\cdot g(y)=g(x)+g(y)+g(xy)-2.................(\star)$$
$\forall x,y\; \in \mathbb{R}$ and and Given $g(2) = 5\;,$ Then $g(5)=$
Now Put $x=y=1$ in $(\star)\;,$ We get $$\left(g(1)\right)^2=3(g(1))-2$$
So we get $g(1)=1$ or $g(1) = 2$
Now put $\displaystyle y = \frac{1}{x}$ in $(\star)\;,$ We get $$g(x)\cdot g\left(\frac{1}{x}\right) = g(x)+g\left(\frac{1}{x}\right)+g(1)-2.....................(\star\star)$$
Now If we take $g(1) = 2\;,$ We get $$g(x)+g\left(\frac{1}{x}\right) = g(x)\cdot g\left(\frac{1}{x}\right)$$
So we Get $g(x) = 1+x^n.$
Now When we take $g(1)=1\;,$ Then $\displaystyle g(x)\cdot g\left(\frac{1}{x}\right)=g(x)+g\left(\frac{1}{x}\right)-1$
Now can I solve above functional equation, Help me, Thanks

A: Define $v(x) =g(x) -1 $ then we have $$v(x) v(y) -v(xy) =(g(x)-1)(g(y) -1) -g(xy) +1 = g(x) g(y) - g(x) -g(y) -g(xy) +2 =0$$
Thus the function $v$ satisfies the functional equation $$v(x) v(y) =v(xy) $$ and therefore $$v(x) =x^c $$ and since $$v(2) =4 $$ therefore $$v(x) =x^2$$ and $$g(x) = x^2 +1 $$ so $$g(5) =26 ,$$


text:
Q: When and how is generated the /etc/ssh/ssh_known_hosts file? I read the following tutorial

*

*How to use ssh-keyscan on Ubuntu
I confirmed that ssh-keyscan 192.168.1.X scan and prints all the public keys values of the server/host - that output comes from the following files from the server/host
/etc/ssh/ssh_host_ecdsa_key.pub
/etc/ssh/ssh_host_ed25519_key.pub
/etc/ssh/ssh_host_rsa_key.pub

I can filter them through the -t option such as:

*

*ssh-keyscan -t key_type 192.168.1.X
Where key_type can be rsa, ecdsa and ed25519 and even mixed such as: rsa,ecdsa
For example:

*

*ssh-keyscan -t rsa 192.168.1.X
Until here I understand all these 2 variations of the command. I confirmed that behavior in my PC
Now, the reason of this post, after to do a research of this command - according with:

*

*ssh-keyscan(1) - from man.openbsd.org

*ssh-keyscan(1) - from linux.die.net
Both do mention of the /etc/ssh/ssh_known_hosts file, exists the

If an ssh_known_hosts file is constructed using ssh-keyscan without
verifying the keys, users will be vulnerable to man in the middle
attacks. On the other hand, if the security model allows such a risk,
ssh-keyscan can help in the detection of tampered keyfiles or man in
the middle attacks which have begun after the ssh_known_hosts file was
created

is not clear if the ssh_known_hosts is created/constructed automatically or using some option, such as -c for example - I know that option does not exist.
Well that file does not exist in the client - I assumed that after of the command executions that file should be generated or created automatically - that path and file name exists for some explicit reason, right? - something similar how the .ssh/known_hosts file is created/updated when the ssh username@hostname command is used and is accepted the server's fingerprint by the client

A: The file /etc/ssh/ssh_known_hosts normally does not exist in a typical installation.  It exists specifically to provide a way to provide an equivalent to ~/.ssh/known_hosts that works for all users for a system.  It isn't updated automatically because (a) most users will not have privileges to modify it and (b) just because one random user approves a key does not mean that that decision should apply to the entire system.
For example, at my work, this file is generated automatically such that every internal host's SSH key is provided so that users can log into hosts as needed without being prompted for keys.  This is done by a trusted automated process that gathers the data when each server is provisioned.
The warning is essentially just telling you that all ssh-keyscan does is tell you what keys you get when you scan that server, not whether those keys are the correct, trusted keys for that server.  For example, if you have a machine on your network that intercepts all connections to port 22, doing an ssh-keyscan github.com will give you the keys for the intercepting machine, not the real keys for GitHub.  To know whether the keys are legitimate, you need some sort of out-of-band information, which could be a human-to-human communication, an email, a web page, or an SSHFP record validated with DNSSEC.


text:
Q: Drag the inner html of an element and drop it in another element while mouse is down I have a grid where I have a start node. How can I make this a draggable object. I don't want to move the HTML element itself because it contains information about that node (position, state, etc). I just want to move the inner html of it to another HTML element, this is so that HTML element information such as x and y coordinates don't move.
This is what I want to achieve:

How can I achieve that effect?

I have the following function for event handling:
const events = () => {
  for (let i = 0; i < 16; i++) {
    for (let j = 0; j < 45; j++) {
      const node = board[i][j];
      node.DOMElement.addEventListener("click", function () {
          // Click events ocurr here for a Node in a specific x and y position in the board
      });
    }
  }
};

A: The following did the trick! Just added/removed the stuff that I need when mouse enters or leaves the tile.
let mouseDown: boolean = false;
let startNodeSelected: boolean = false;
let targetNodeSelected: boolean = false;

document.addEventListener("mousedown", () => {
  mouseDown = true;
});

document.addEventListener("mouseup", () => {
  mouseDown = false;
});

export const events = () => {
  for (let i = 0; i < 16; i++) {
    for (let j = 0; j < 45; j++) {
      const node: Node = board[i][j];
      const nodeElement: HTMLElement = board[i][j].DOMElement;

      nodeElement.addEventListener("mouseleave", () => {
        removeStartNodeOnDrag(node, nodeElement);
      });

      nodeElement.addEventListener("mouseenter", () => {
        addStartNodeOnDrag(node, nodeElement);
      });

      nodeElement.addEventListener("mouseleave", () => {
        removeTargetNodeOnDrag(node, nodeElement);
      });

      nodeElement.addEventListener("mouseenter", () => {
        addTargetNodeOnDrag(node, nodeElement);
      });
    }
  }
};

const removeStartNodeOnDrag = (node: Node, nodeElement: HTMLElement) => {
  if (node.type === "start" && mouseDown) {
    nodeElement.classList.remove("start");
    node.type = "empty";
    node.state = "unvisited";
    startNodeSelected = true;
  }
};

const addStartNodeOnDrag = (node: Node, nodeElement: HTMLElement) => {
  if (node.type === "empty" && mouseDown && startNodeSelected) {
    nodeElement.classList.add("start");
    node.type = "start";
    node.state = "visited";
    startNodeSelected = false;
  }
};

const removeTargetNodeOnDrag = (node: Node, nodeElement: HTMLElement) => {
  if (node.type === "target" && mouseDown) {
    nodeElement.classList.remove("target");
    node.type = "empty";
    targetNodeSelected = true;
  }
};

const addTargetNodeOnDrag = (node: Node, nodeElement: HTMLElement) => {
  if (node.type === "empty" && mouseDown && targetNodeSelected) {
    nodeElement.classList.add("target");
    node.type = "target";
    targetNodeSelected = false;
  }
};


text:
Q: Set computer to suspend after a certain time when not logged in? I realize that you can set the power preferences for when to shutdown, suspend, and spin down hard disks and so on.
However, I find that seems to only work when I've logged in and then leave the computer - the power will suspend after the specified time, for example.
If I just turn on the computer and not log in, then it stays on indefinitely.
Is there a way to set the power preferences for the computer when no one is logged in?
The reason I keep the power on without logging in is to use this particular computer as my file server. I'd like it to suspend at night when I go to bed, but, each morning when I check on it, my computer is still on.
I'm using LMDE2.


text:
Q: Comparison inside if statement? Can someone tell me is it possible to have an if statement similar to this?
I want to check is the first list item with class FIRST really first li tag.
My firebug console throws me no errors but this code is not working...
Thank you!!

One

two

three

A: You can try using the .is traversal method:
if($('ul li.first').is(":first")){
    $('ul').css({'display':'none'}); // you can use `.hide()` here instead
}

you can also test the index:
if($('ul li.first').index() === 0){
    ...
}

A:
if($('ul li.first').is(':first')){
    $('ul').hide();
}


text:
Q: How did Padmé not recognize Jar Jar was a Gungan? In the Phantom Menace, Padmé is cleaning R2-D2 when Jar Jar walks in, and she asks him

"you're a Gungan, aren't you?"

Why would she not realize that he was one, considering that she lives on the same planet and that and she's the queen? Did the Naboo not get taught about the other civilization on their planet?

A: It's entirely possible that all of Padme's knowledge of the Gungan race was purely academic, and has never actually seen/met a Gungan in person.
According to Boss Nass's bio, the Gungans maintained a policy of isolationism.

He kept a tight rein on Gungan affairs, continuing a longstanding custom of isolationism.

The archived version of his bio expand on this slightly, mentioning that the isolationism dates far back to the days of human colonization on the planet.

He kept a tight rein on Gungan affairs, continuing a longstanding custom of isolationism. Ages ago, a cultural misunderstanding led to a rift between the Gungan and the Naboo colonists. This tension was perpetuated by stubbornness and ignorance on both sides.

Given that there are two species of Gungans (Anakura like Boss Nass, and Otolla like Jar Jar), the Gungan cities are underwater, far from the humans of Naboo, the Gungans and humans don't interact, and the fact that Padme is only 14, it's entirely possible that Jar Jar was the first Gungan she'd ever actually met.

A: It seems deeply unlikely that Queen Amidala wouldn't know exactly what a Gungan is. In this scene she's trying to cement the idea that her alter-ego, (the palace handmaiden Padmé) isn't especially worldly and perhaps a little bit naive.

"Mesa JaJa Binkssss," Jar Jar said.
"I'm Padmé," the girl told him. "I attend Her Highness." She looked at him curiously. "You're a Gungan, aren't you?"
  Jar Jar nodded. Most Naboo didn't like Gungans any more than Gungans liked them, but this girl seemed nice. And she not yelling over little mistakings, like everybody else.
Star Wars: The Phantom Menace - Official Novelisation

As far as the charade is concerned, the novel also makes it clear that Naboobians and Gungans don't typically mix. They live in different climes and have very little in common. Trade between the two races is solid, but conducted largely through intermediaries and it, presumably wouldn't have been unheard of for a Naboobian to never see, let along meet a real life Gungan.
On top of that, there's the fact that most trade contact is done by the ruling Ankura Gungans (of which Boss Nass is a prime example) rather than the majority Otolla Gungans (such as Jar Jar). Even if you'd ever met an Ankura Gungan, you might not recognise an Otolla Gungan as being from the same species.


text:
Q: Connecting pieces of wires- algorithm I'm using C#, but in the future I might need to use it on other languages.
Many games have such puzzles. There is a group of wires (there are 2 types of wires: straight and curved.), there is a place from where a signal comes and there is a place from where the signal must leave. But the arrangement of the wires doesn't allow that to happen. You must turn some of the wires in order to create a path for the signal.
Yeah, I'm trying to find the continent America again, in order not to try finding it more than once in the future.
Somewhere in the future I will also try the same thing but this time with wires that split the signal to 2 or 3 signals.
Problem is that I can't think of an algorithm that I can imagine how to turn it into a code. I have been thinking for some time and I can't think of anything good.
So, can you help me? I will be able to understand the algorithm as "what does the program has to do", but I basically need help with understanding the algorithm as "how to write the code".
Thanks!

A: Take a look at some maze generation algorithms -- they do the same thing you're looking for, and as such are what you'll need to create the grid. Pick a simple 'cell-carver' from the ones I linked to; randomly rotate all of the wire-pieces, et voilà!
A comment on your question notes that turning an algorithm into code involves breaking it down bit by bit -- so that's what we'll do:
You'd start with a grid of potential wire locations (probably 2D, but a 3D game would be amazing).
To produce a solvable level, you could do a couple things -- produce a level, and see if it is solvable (bad), or produce a solved level, then "unsolve" it (better). As I alluded to above, producing a solved level involves algorithms very similar to maze generation -- a solved level would have many traversable "paths", just like a maze. Unsolving the level would just loop through all wire pieces, and rotate them a bit.
But what of maze generation? The resource I linked to contains some algorithms that would be perfect for your use -- a simple randomized DFS should be plenty for your needs.
You'll note that I covered the general case involving branching wires -- as it is, excluding branching means you have to do more coding, to "prune" branches intelligently -- that is, backtracking when your one true path gets stuck, say in a corner, due to the random movement probably necessary to make an interesting level.
You should also note that a solution for such a game would, if I understood correctly, require use of all given wire (I know some games like this). Otherwise, the game would probably be a lot simpler to play given the above generation tactics.

A: The Union-Find algorithms (that answer my problem) are explained in this PDF file: http://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf
I don't think I would have ever thought of this algorithm, let alone making it fast.


text:
Q: What would be some implications of Schanuel's conjecture being proven wrong? Schanuel's conjecture is an important conjecture in transcendental number theory, which is:
Given any $n$ complex numbers $z_1, z_2, ..., z_n$ that are linearly independent over the rational numbers $\Bbb Q$, the field extension $\Bbb Q(z_1, ... z_n, e^{z_1}, ..., e^{z_n})$ has transcendence degree at least $n$ over $\Bbb Q$.
Wikipedia lists some consequences of this being true. It would strengthen both the Lindemann–Weierstrass theorem and Baker's theorem by showing that linearly independent logarithms of algebraic numbers are also algebraically independent, which would in turn make it easy to settle the transcendence of $\pi+e$, $e^e$, and so on, as well as that $e$ and $\pi$ are algebraically independent.
My question: what would be some of the results if this conjecture were instead false? How would that change transcendental number theory?


text:
Q: IObservable<> missing .Subscribe extension methods I'm using RX extensions and WF4 to create a workflow which reacts to observable messages to progress the workflow. To do this, I bring in an object containing an IObservable (ModuleMessage being my abstract class.) The problem I'm having is that .Subscribe fails to recognize any of its extension methods, namely the one for lambda extpressions/method groups. In the following code, I have references:
using System.Activities;
using System.Activities.Hosting;
using System.Collections.Generic;
using System.Reactive.Linq;

And also the following line of code:
    internal void AddModuleCallback(IModule module)
    {
        if (!addedCallback)
        {
            addedCallback = true;
            module.Messages.Where(m => m is MemberLeftModuleMessage || m is MemberRemovedModuleMessage).Subscribe(m => this.OnMemberExit(m)); // This line errors
        }
    }

    internal void OnMemberExit(ModuleMessage message)
    {
        // Gizmo was fired, resume the bookmark
        this.instance.BeginResumeBookmark(
            new Bookmark(ModuleVisit.BookmarkName),
            message is MemberLeftModuleMessage,
            r => this.instance.EndResumeBookmark(r),
            null);
    }

With the compile-time error of:
Error   1   Cannot convert lambda expression to type 'System.IObserver<Components.Messages.ModuleMessage>' because it is not a delegate type    <Removed>\WaitForModuleVisitExtension.cs    34  119 Components

Please note, this code is adapted from a sample and has not been factored out to my liking, I'm purely concerned in the problem at hand. I'm no pro with RX or WF4, but have used subscribe in this way elsewhere in the very same solution. I've added RX to this project via NuGet.
Edit: the following error if I use as a method group (instead of lambda):
Error   2   Argument 1: cannot convert from 'method group' to 'System.IObserver<Components.Messages.ModuleMessage>' <removed>\WaitForModuleVisitExtension.cs    34  119 Components

A: You're missing this:
using System;

That's the namespace containing the ObservableExtensions static class with all the Subscribe extension methods.
Extension methods are "discovered" via using directives (as well as the namespace hierarchy of the code trying to use them).


text:
Q: Doctrine2 Paginator skip offset in phpunit test Doctrine2 paginator can have offset and limit as follows:
$query = $entityManager->createQuery($dql)
                   ->setFirstResult(0)
                   ->setMaxResults(100);

$paginator = new Paginator($query, $fetchJoinCollection = true);

It works fine, however same situation as unit tested in phpunit fails to set offset,
i tried $query->getResult instead of Paginator and offset was applied,
in both cases the sql has the offset, but paginator just starts from the beginning


text:
Q: basic async call on @click event in template vuejs I would like to set data of a vue.js component with a button template and @click event.
This event call a method component which call a async function with promise.
When I click on my button the result of paragraph tag html appear correctly but in a same time it generated a error into my inspector browser electron like this :

vue.runtime.esm.js:620 [Vue warn]: Error in v-on handler: "TypeError: foo.then(...).bind is not a function"
found in
--->  at src/views/TestDb.vue
 at src/App.vue

Very strange to understand why throw error and in same time do the job....
I now the trick of copy the context this into another variable and call this variable for change data component but it seems to be not advise by esLint process analyse file. It exist a specific rule just for that.
How can work of basic async promise for change data with a click button template on vuejs ?
This is my component file :
<template>

        <Menu />

Test DB operation

        create Operation

{{ returnValue1 }}

</template>

A: Since you're using an arrow function there's no need to add bind(this) :
 foo.then(() => {
                this.returnValue1 = "bar"
            })

or
 foo.then(function(){
                this.returnValue1 = "bar"
            }.bind(this))

A: Remove the bind ' the arrow function already did the binding.
foo.then(() => {
                this.returnValue1 = "bar"
            })

FYI
You could have done this before
foo.then(() => {
                this.returnValue1 = "bar"
            }.bind(this))


text:
Q: misra 19.10 with array initialiser MISRA 19.10:
In the definition of a function-like macro each instance of a parameter shall be enclosed in parentheses unless it is used as the operand of # or ##.
I have a struct defined like this:
typedef struct
{
  SUint_t        affValueIndex;
  const SFloat_t affLoSaturation;
  const SFloat_t affHiSaturation;
  const SFloat_t affCoeffTab[SDEF_ANALOG_FLOAT_FILTER_LEN];
  SFloat_t       affValueTab[SDEF_ANALOG_FLOAT_FILTER_LEN];
} SAnalogFloatFilter_t;

Then I do:
#define DEF_ANALOG_FILTER_COEFF_LIST {0.0287421759f, \
                                      0.1225311874f, \
                                      0.2123775504f, \
                                      0.2726981726f, \
                                      0.2123775504f, \
                                      0.1225311874f, \
                                      0.0287421759f}

#define SMK_ANALOG_FLOAT_FILTER_HANDLE(__name__, __coeff_list__, __hi_sat__, __low_sat__) \
SAnalogFloatFilter_t (__name__)[1] = {{0u, (__low_sat__), (__hi_sat__), __coeff_list__ , {(SFloat_t)0,}}}

static SMK_ANALOG_FLOAT_FILTER_HANDLE(CurrMonFilter,
                                      DEF_ANALOG_FILTER_COEFF_LIST,
                                      (SFloat_t)DEF_ANALOG_FILTER_HI_SAT,
                                      (SFloat_t)DEF_ANALOG_FILTER_LO_SAT);

The problem is that the __ coeff_list __ parameter cannot have a parenthesis as it then expands to ({...}) (an array initialilser), to which the gcc complains:
foo.c:45:9: error: statement-expressions are not allowed outside functions nor in template-argument lists

Is there a clever way to keep the MISRA 19.10 check AND have an array initialiser in the SMK_ANALOG_FLOAT_FILTER_HANDLE macro?

A: This compiles for me:
typedef int SUint_t;
typedef float SFloat_t;

#define SDEF_ANALOG_FLOAT_FILTER_LEN 8

typedef struct
{
  SUint_t        affValueIndex;
  const SFloat_t affLoSaturation;
  const SFloat_t affHiSaturation;
  const SFloat_t affCoeffTab[SDEF_ANALOG_FLOAT_FILTER_LEN];
  SFloat_t       affValueTab[SDEF_ANALOG_FLOAT_FILTER_LEN];
} SAnalogFloatFilter_t;

#define DEF_ANALOG_FILTER_COEFF_LIST (const SFloat_t[SDEF_ANALOG_FLOAT_FILTER_LEN]) \
                                     {0.0287421759f, \
                                      0.1225311874f, \
                                      0.2123775504f, \
                                      0.2726981726f, \
                                      0.2123775504f, \
                                      0.1225311874f, \
                                      0.0287421759f}

#define SMK_ANALOG_FLOAT_FILTER_HANDLE(__name__, __coeff_list__, __hi_sat__, __low_sat__) \
SAnalogFloatFilter_t (__name__)[1] = {{0u, (__low_sat__), (__hi_sat__), (__coeff_list__) , {(SFloat_t)0,}}}

#define DEF_ANALOG_FILTER_HI_SAT 0.0f
#define DEF_ANALOG_FILTER_LO_SAT 0.0f

static SMK_ANALOG_FLOAT_FILTER_HANDLE(CurrMonFilter,
                                      DEF_ANALOG_FILTER_COEFF_LIST,
                                      (SFloat_t)DEF_ANALOG_FILTER_HI_SAT,
                                      (SFloat_t)DEF_ANALOG_FILTER_LO_SAT);

Tested on Ubuntu 12.04.03 LTS with commands:
gcc-4.6 -c -o foo.o foo.c

and
gcc-4.8 -c -o foo.o foo.c


text:
Q: How to implement recursive function in While loop Module, calling on other functions I am trying to implement a module such that it " takes a distance matrix, Q, and iterates
the corresponding "Bellman operator" module written above until a final cost-to-go
function (i.e. J) is found." [i.e. relaxing edges in shortest path problem with J converging from 0 to a final cost-to-go]. However, I cannot seem to get it to work, having tried a variety of methods (While, NestWhile, MapThread). Below is my best attempt
findCostToGo2[Q_, bellmanOperator_] := Module[{J, i},
  J[1] = bellmanOperator;
  J[2] = bellmanIteration[Q, bellmanOperator];
  J[i_] := J[i] = bellmanIteration[Q, J[i - 1]];
  While[{J[i - 1] != J[i - 2]}, J[i]]]

where Q is a 100x100 array with various edge-weights as entries [EDIT: bellmanOperator in the above code is actually the list output by running bellmanIteration[Q,(list of 100 zeroes)]]. When I run this Module, however, this is the output
findCostToGo2[Q, startingpoint]

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of -1019+i$49205.

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of -1019+i$18840.

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of -1019+i$18840.

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of bellmanIteration[{{\[Infinity],0.04,\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],11.11,\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],20.59,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],2.06,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.73,\[Infinity],1.02,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.33,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.72,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.15,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},<<90>>},J$18166[i$18166]].

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of bellmanIteration[{{\[Infinity],0.04,\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],11.11,\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],20.59,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],2.06,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.73,\[Infinity],1.02,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.33,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.72,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.15,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},<<90>>},J$18150[i$18150]].

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of bellmanIteration[{{\[Infinity],0.04,\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],11.11,\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],20.59,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],2.06,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.73,\[Infinity],1.02,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.33,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.72,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.15,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},<<90>>},J$18137[i$18137]].

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of bellmanIteration[{{\[Infinity],0.04,\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],11.11,\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],20.59,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],2.06,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.73,\[Infinity],1.02,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.33,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.72,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.15,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},<<90>>},J$18121[i$18121]].

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of bellmanIteration[{{\[Infinity],0.04,\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],11.11,\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],20.59,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],2.06,\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.73,\[Infinity],1.02,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.33,\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],0.72,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],3.15,<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},{\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],\[Infinity],<<90>>},<<90>>},J$18107[i$18107]].

Anyone able to write a module that gets this to run? Below is my bellmanIteration module, which, when I edit it to output J[n+98], gives the output I want from my above module. However this is a somewhat arbitrary number of iterations and I'd rather use a While loop condition.
bellmanIteration[Q_, Jguess_] := Module[
  {J, n, v, w},
  J[n] = Jguess;
  J[i_] :=
   J[i] = Table[
     Min[Table[Q[[v, w]] + J[i - 1][[w]], {w, Length[Q]}]], {v,
      Length[Q]}];
  J[n + 1]]


text:
Q: What distribution has these properties? There is a 2D continuous distribution from an actual physical process which I want to model mathematically. I have 40k samples. You can see a histogram here and here.

This can be summarized as 4 properties, listed in order of prevalence. Further down the list needs more samples to be apparent. I use $f(x,y)$ to denote the probability density function.

*

*It is symmetric: $f(x,y)=f(-x,y)=f(y,x)$

*It is centered on $(0,0)$: $|(x_1,y_1)|<|(x_2,y_2)|\implies f(x_1,y_1)>f(x_2,y_2)$

*Near the axes is more likely

*Near the diagonals is slightly more likely

I can't come up with a clean mathematical description for axes/diagonal, but in words, for a fixed $|(x,y)|$, the global maximum $A_1=f(x,y)$ is where $x=0$ or $y=0$, there is a local maximum $A_2$ where $x=y$ or $x=-y$, and compared to the global minimum $B$, $A_2-B$ is much less than $A_1-B$.
Properties #1 and #2 are immediately obvious, and #3 shows up with a small number of samples. The diagonals being more likely is only barely visible with 40k samples. I don't think other lines will be more probable, since the axes and diagonals are the special ones. If it does follow a half angle subdividing pattern or something, I'd think each $A_i-B$ will be exponentially smaller.
Since this is modelling a physical process, there is a bound, but it is high enough to not matter. We can assume it's unbounded.
So, what distribution has these properties?

Someone might say if it's a physical process, why not analyze that to find the distribution? That would require understanding the physical process, and it's too complicated for that. It's hard to even know all the variables. The result is a 2D point for each measurement, and that's easy to analyze. It is indeed only an approximation, but in practice an accurate approximation is good enough.

It is possible that the diagonals is just a fluke since the difference is so small. Perhaps the histogram bins were biased in a way that made diagonals look slightly more probable. Or the measurements had too large of a granularity. I'll have to go back and collect more samples to confirm.


text:
Q: Toroidal implicit region looks weird I have the following toroid surface:
tt = ParametricRegion[{Cos[u] (10 + 0.2 Sin[v]),
    Sin[u] (10 + 0.2 Sin[v]), Cos[v]}, {{u, 0, 2 Pi}, {v, 0, 2 Pi}}];
ParametricPlot3D[Evaluate[tt[[1]]], {u, 0, 2 Pi}, {v, 0, 2 Pi},
 PlotRange -> {-11, 11}]

I want to build the solid region of the toroid (for the purposes of building a region difference and solving Laplace equation over that boundary)
I proceed by turning the torus
$\{Cos[u](R+r_f Sin[v]), Sin[u](R+r_f Sin[v]), Cos[v]\}$
into the implicit expression
$(\frac{\sqrt{x^2+y^2}-R}{r_f})^2 + z^2 \le 1$
ttSolid =
 ImplicitRegion[((Sqrt[x^2 + y^2] - 10.0)/0.2)^2 + z^2 <= 1, {x, y,
   z}]
RegionPlot3D[ttSolid]

But the implicit region doesn't look like a torus

Any idea what is the problem, and further, how to properly define a toroid region for NDSolve?

A: You have too few PlotPoints.  Try
RegionPlot3D[((Sqrt[x^2 + y^2] - 10.0)/0.2)^2 + z^2 <= 1,
 {x, -10, 10}, {y, -10, 10}, {z, -10, 10}, PlotPoints -> 100]


text:
Q: How to get process stack size from kernel mod I'm developing a kernel mod driver and I need to get all the stack sizes of some process.
I use ZwQuerySystemInformation to find the process
and then I use ZwQuerySystemInformation to get the THREAD_BASIC_INFORMATION
and then I read memory from TebBaseAddress to NT_TIB struct
then I have the tib.StackLimit, tib.StackBase
if (NT_SUCCESS(PsLookupProcessByProcessId((HANDLE)process_id, &process))) {
        if (NT_SUCCESS(MmCpy(process, (PVOID)info.TebBaseAddress, PsGetCurrentProcess(), &tib, sizeof(NT_TIB)))) {
            //DbgPrintEx(0, 0, "StackLimit: %#010x to StackBase: %#010x \n", tib.StackLimit, tib.StackBase);

            tempStackArea = { 0 };
            tempStackArea.Base = (uintptr_t)tib.StackBase;
            tempStackArea.Limit = (uintptr_t)tib.StackLimit;
            memcpy((PVOID)((ULONG_PTR)StackAreaList + (i * sizeof(StackArea))), &tempStackArea, sizeof(StackArea));
        }
    }

but I don't know if the size is
tib.StackBase - tib.StackLimit

I want to read all the stack memory from tib.StackLimit to tib.StackBase and search some value
Is it okay to use it this way or it's wrong, and there's another solution?


text:
Q: PHP foreach loop takes array element not in order I have an array I am building like this:
$acids = array();
foreach ($sortedArray as $h)
{
 $acids[] = $h['account_id'];
}
$uniqueAids = array_unique($acids);

When I then run through that array to output it, I expect this:
Array
(
 [0] => 353
 [1] => 176
 [2] => 9
)

but i get this :
Array
(
 [0] => 353
 [1] => 176
 [4] => 9
)

A: That's because values 2 and 3 contain the values 353 or 176. You can use array_values to resort the keys.
$uniqueAids = array_values(array_unique($acids));

A: Keys are preserved when you use array_unique(). So all you need to do is
$uniqueAids = array_values($uniqueAids)

to reorder the keys.


text:
Q: Nuxt is returning html instead of JSON that I got from the api I have a simple api returning a json object that I want to display unto the screen.
However when I display the $data property I'm getting html and not the json from the api.
However whenever I refresh the page with f5 or manually the data then shows up on the screen and not the html.
{
"data": {
"positions": 2,
"departments": 2,
"paygrades": 8
}
}
<template>
  <v-container>
    <v-row> {{ $data.dbData }}</v-row>
  </v-container>
</template>

<script>
export default {
  async asyncData({ $axios }) {
      const dbData = await $axios.$get('/dashboard')
      return  dbData
  },
  data() {
    return {
    }
  },
}
</script>

Edited code
<template>
  <v-container>
    <v-row> {{ dbData }}</v-row>
  </v-container>
</template>

<script>
export default {
  data() {
    return {
    dbData: null,
    }
  },
async fetch() {
      this.dbData = await this.$axios.$get('/dashboard')
  },
}
</script>


text:
Q: How to add elements to array of blocked tasks while performing another task I am making a simple multithreaded program, I have an array of strings representing the tasks. whenever I press on a button a string representing the task is created and added to the array and when I release the button the task that that has the turn is executed. However, For some reason the array always contains one element.
For example whenever I execute task close() and before it finishes execution I click on accelerate, Accelerate gets executed as soon as Close() is done but doesn't get added to the array until close() has finished execution.
// Add Accelerate Task To Array
btnNewButton_1.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                if (!running) {
                    label_1.setText("Click start to run Car");
                    return;
                }
                list.add("Accelerate2");
                DefaultTableModel model = (DefaultTableModel) table.getModel();
                String s = list.poll();
                model.addRow(new Object[] { s.substring(0, s.length() - 1) });

            }
        });

// Execute Accelerate Task
btnNewButton_1.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                try {
                    if (!running) {
                        label_1.setText("Click start to run Car");
                        return;
                    }
                    accelerate();
                } catch (InterruptedException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }
        });

// Task that takes some time to get executed
public void close() throws InterruptedException {
        while (true) {
            if (semaphore == 1) {
                semaphore--;
                DefaultTableModel model = (DefaultTableModel) table.getModel();
                if (table.getRowCount() > 0) {
                    model.removeRow(0);
                }
                for (int i = 4; i > 0; i--) {
                    label_1.setText("windows are closing .");
                    TimeUnit.MILLISECONDS.sleep(500);
                    label_1.setText("windows are closing ..");
                    TimeUnit.MILLISECONDS.sleep(500);
                    label_1.setText("windows are closing ...");
                    TimeUnit.MILLISECONDS.sleep(500);
                }
                label_1.setText("windows are closed");
                break;
            }
        }
        semaphore++;
    }


text:
Q: How to draw five pentagons from another pentagon? I can to draw a pentagon:
\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2.2]
\draw[ultra thick]
    (1,0)--(0.30,0.95)
    (0.30,0.95)--(-0.80,0.58)
    (-0.80,0.58)--(-0.80,-0.58)
    (-0.80,-0.58)--(0.30,-0.95)
    (0.30,-0.95)--(1,0);

\end{tikzpicture}
\end{center}
\end{document}

but I want to draw the following figure:

A: A PSTricks solution using the pst-poly package:
\documentclass{article}

\usepackage{pst-poly}

\begin{document}

\begin{pspicture}(-2.45,-2.6)(2.45,2.1) % size of the boundry box found manually
  \multido{\i = 270+72}{5}{\rput{36}(!1 36 cos mul dup add \i\space PtoC){\PstPentagon}}
\end{pspicture}

\end{document}

A: Use regular polygon from the shapes.geometric library. The idea is to first draw an invisible pentagon, and then draw five other, each (appropriately rotated) anchored at one side of the invisible pentagon.
Code
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2.2]
  \tikzset{pntgn/.style={regular polygon, regular polygon sides=5,draw,very thick,minimum size=2cm,anchor=south}}
  \node(n)[pntgn,draw=none,outer sep=0pt]{};
  \foreach\deg[count=\x] in{36,108,...,324}{\node[pntgn,rotate=\deg,at=(n.side \x)]{A};}
\end{tikzpicture}
\end{center}
\end{document}

Output

A: A MetaPost solution that generalizes this kind of picture to any regular polygons. I have integrated the MetaPost code in a LuaLaTeX program, for convenience. The number of sides is given by the n parameter which is of course supposed to be an integer value greater than 2.
\documentclass{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
  beginfig(1);
    u = 3cm; n = 5; angl = 360/n;
    % The regular polygon at the center
    z0 = u*dir(-90 - .5angl);
    path polygon;
    polygon = z0 for i = 1 upto n-1: hide(z[i] = z[i-1] rotated angl) -- z[i] endfor -- cycle;
    % Drawing the other polygons
    for i = 0 upto n-1: draw polygon rotatedaround (z[i], 180-angl); endfor;
  endfig;
\end{mplibcode}
\end{document}

Result with n = 3:

n = 4:

n = 5:

n = 6:

Beyond n=6, the polygons overdraw themselves and it becomes ugly!
Edit I've written too fast. For example, if you take n = 12 as in the following example, the result seems pleasant (to me at least)… and anyway there is more in these pictures than meets the eye and much more than I know. See Ethan Bolker's comment below!


text:
Q: Windows Phone , Install time method call Is there any way that we can call a method only once in the entire life of the application.
For Ex : If i want to display a terms and conditions screen.
If the user agrees, then for the entire life of the application, the screen should not be displayed there after.
Any suggestions ?


text:
Q: Show that $\mathrm{rank}(A)=n$ iff $\mathrm{rref} A$ has no zero columns.
Let $A$ be an $m\times n$ matrix. Show that $\mathrm{rank}(A)=n$ iff $\mathrm{rref}A$ has no zero columns, using only the definition of rank and reduced row echelon form ($\mathrm{rref}$).

My attempt: If $\mathrm{rref}A$ has no zero columns, suppose $\mathrm{rank}(A)< n$. For every row $i=1,\ldots,k$, let $j_i$ be the column in which he first non-zero entry of row $i$ appears. Note that $$\{j_1,...j_k\}\subset\{1,...,n\}.$$
This implies that there is at least one column $j_i$ in which there isn't a first non-zero entry of any row $i$. The problem is that I haven't proved that the previously mentioned column is a zero column.

A: It is much easier to think of this in terms of rows.
By definition, the rank is the number of pivots in the rref of $A$ (your definition may differ).  However, every row can have at most one pivot (by the definition of rref). If a row does not contain a pivot, then (again, by the definition of rref) it is a pivot row.
So, suppose that the rank of $A$ is $n$. There are $n$ rows, so every row must have a pivot.  So, there are no zero rows in the rref.
Conversely suppose that $A$ has a zero row.  Then there is a row that has no pivot.  So, there must be less than $n$ pivots overall, which means that the rank is less than $n$.