text:
Q: postgresxl failed to acquire conncetion from datanode all.
we are using postgres-xl as our mpp database.
where we excecute a sql throug jdbc,the server will have low probability  to success excecution.
most time,server will response a error,like below:
Caused by: org.postgresql.util.PSQLException: ERROR: pooler: failed to acquire connection from datanode 16416 for thread 140129612068608
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2262) ~[gsjdbc4.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1987) ~[gsjdbc4.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:348) ~[gsjdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:564) ~[gsjdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:408) ~[gsjdbc4.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:288) ~[gsjdbc4.jar:na]

pls help.thanks.


text:
Q: Can sum of two (co)type $p$ subspaces fail to have the same (co)type? Type and cotype are very pleasant invariants of Banach spaces. However answer to the following question seems to be missing from the literature.
Let $X$ be a Banach space and suppose that $Y,Z$ are closed subspaces of $X$ both having type (resp. cotype) $p$. Is the same true for $\overline{Y+Z}$?
Since having type/cotype is a local property I guess we can assume wlog that $Y$ and $Z$ are finite dimensional, so that we can get rid of the closure but even then I don't know how to proceed.

A: As was indicated by Bill Johnson, one can construct examples of $Y,Z$ such that both $Y$ and $Z$ are isomorphic to a Hilbert space, but $X$ has no nontrivial cotype or type. This can be done on the following lines. Let $X$ be a separable Banach space with no type or cotype, which contains a Hilbert space $Y$ as a subspace (for example $X=\ell_2\oplus c_0$). Let $\{e_i\}$ be an orthonormal basis in $Y$ and $\{x_i\}$ be a dense sequence in the unit sphere of $X$. Let $Z$ be the linear span of the sequence $\{e_i+\frac1{2^{i+1}}x_i\}$. It is standard to check that $Z$ is isomorphic to a Hilbert space (see Lindenstrauss-Tzafriri, volume 1, Proposition 1.a.9 if needed). On the other hand, we have $X=\overline{Y+Z}$ since $Y+Z$ contains all $\{x_i\}$. So we constructed a space with no nontrivial type and cotype, which is a closure of the sum of two subspaces isomorphic to a Hilbert space (and thus having type $2$ and cotype $2$)..

redpajama_set_name: RedPajamaStackExchange


text:
Q: Drawing table borders in libgdx (Table.drawDebug()) I tried using this method to show debug lines:
table.debug();
Table.drawDebug(stage);
except Table.drawDebug expects a parameter of type: ShapeRenderer.
any direction would be great

A: You may just use a new ShapeRender() as parameter if your code doesn't contain one.

A: You don't need to call table.drawDebug(), just table.debug() is enough

A: I think you're looking for this?
Table table;
Stage stage;

public void show() {
    table = new Table();
    table.debug();

    ...

    stage = new Stage(...);

    stage.add(table);
}

public void render(float delta) {
    Table.drawDebug(stage);
}

You debug draw the entire stage, but only the elements where debug() was called initially to mark them for debugging.
I hope this helps you.
P.S. btw this is from the official TableLayout docs here which is a must read if you're gonna mess around with Tables (if you haven't done so already).


text:
Q: Cocoapods: group pod libraries under a company name If I want to publish a set of public pods, is there a way to group them under a company name to prevent collision with other pods and to be clear these pods are from the expected company?
I see Firebase is able to do this https://cocoapods.org/pods/Firebase but I don't see anything different in their .podspecs that would distinguish this unless it's all based on the spec.author name or the name we set up when we register with trunk?
If we can do this, how do we add maintainers to this group?

A: CocoaPods trunk is a flat namespace and has no grouping mechanism other than strings, which are really only a convention.
The Firebase is an umbrella pod with a set of subspecs that reference other pods that are by convention prefixed with the "Firebase" string. For example the Firebase/Storage subspec depends on the FirebaseStorage pod.


text:
Q: Php upload image to directory Ive been experimenting with the upload capability of php, I have been looking at this tutorial on w3school.
http://www.w3schools.com/php/php_file_upload.asp

I installed this script on MYDOMAIN.com/New.html

<form action="upload_file.php" method="post"
enctype="multipart/form-data">
Filename:
<input type="file" name="file" id="file">

<input type="submit" name="submit" value="Submit">
</form>

And then I put this snippet on MYDOMAIN.com/upload_file.php
<?php
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "
";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "
";
    echo "Type: " . $_FILES["file"]["type"] . "
";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
  }
else
  {
  echo "Invalid file";
  }
?>

Now there is a very high chance that im just a really confused person but what I assume that is suppose to do is take the file I put into the New.html file and if it is a image file upload it onto my directory but instead its just outputting Invalid file  Im not sure what to do any help is great hope to hear back soon thank you

A: best way to upload images i think would be to copy an image and store inside a folder and then store the new location of image into a databse.
to move the file we can use move_uploaded_file function
$oldpath = $_FILES['image']['tmp_name'];
$newpath ="new_folder_location/".$_FILES['image']['name'];
move_uploaded_file($oldpath, $newpath);

A: The problem of your script is that you are probably trying to upload a file higher that your limit is! You specified a really low max filesize! Print out your $_FILES var to get information about what's wrong ;)
However, in order to move the file to your folder you still need to use move_uploaded_file:
$allow = array("jpg", "jpeg", "gif", "png");

$todir = 'uploads/';

if ( !!$_FILES['file']['tmp_name'] ) // is the file uploaded yet?
{
    $info = explode('.', strtolower( $_FILES['file']['name']) ); // whats the extension of the file

    if ( in_array( end($info), $allow) ) // is this file allowed
    {
        if ( move_uploaded_file( $_FILES['file']['tmp_name'], $todir . basename($_FILES['file']['name'] ) ) )
        {
            // the file has been moved correctly
        }
    }
    else
    {
        // error this file ext is not allowed
    }
}

A: Your validation code is checking the extension, mime type and file size.
You are probably uploading a file with uppercase characters in the extension. When you check the extension, you checking it case sensitive, .JPG is a valid image file extension, so you should make your check case insensitive:
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array(strtolower($extension), $allowedExts))
         // ^ added strtolower()

If that isn't the immediate problem then the file is too big or has the wrong mime type. To debug, view the files array with:
print_r($_FILES);

A: I would say the problem is in that If, a lot of conditions there (also "invalid file" is the Else part of that if), try to simplify it to track the problem, at first glance I would say it's because of the size checking:
&& ($_FILES["file"]["size"] < 20000)

that's around 20Kb, quite small for an image if you are uploading a photo, try to put a higher value or to take out that condition and see if the script works

A: This happens because the following expression evaluates to false:
(($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts)

Which means that either

*

*The file type is incorrect (it is not a GIF/JPEG/PNG/PNJPEG file)

*The file is bigger than 20000 bytes

*The file extension is incorrect (it is not any of "jpg", "jpeg", "gif", "png")

My guess would be the file size - increase it drastically. Change it to the following to allow sizes up to 10 MB:
&& ($_FILES["file"]["size"] < 10485760)

The best way to see the problem is to add this line to the beginning of your script:
var_dump($_FILES);

A: I agree with answer of Ivo but I think that you may make change of next
piece of code like this:
$typePicture = array('jpg','png','jpeg','gif');

// Allow certain file formats

if($typePicture[0] != "jpg" || $typePicture[1] != "png" || $typePicture[2] != "jpeg" || $typePicture[3] != "gif" )
{
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}


text:
Q: how can use this load page plugin (only for js) when my php codes are working? how can use this loading page plugin (only for js) when my php codes are working?
I don't know java script/ajax! but I understand php/css/html :)
this plugin named "PACE" only load progress bar for javascript works (automatically) but I want use it for my php codes when they're running. example my thumb generator takes 30s.
gethub link for pace: https://github.com/HubSpot/pace
Documentation of pace (that I don't know how works!): http://github.hubspot.com/pace/
my time-consuming PHP code in the page:
dothumbgen($a,$b);

how can use PACE for this function?

A: To use this plugin, follow steps bellow:

*

*Download this PACE jQuery plugin in: http://github.hubspot.com/pace/docs/welcome/

*Include the plugin in your page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/HubSpot/pace/v0.5.6/pace.min.js"></script>

*Put this code in this your footer document:
<script type="text/javascript">
$(document).ajaxStart(function() {
    Pace.restart();
}).ajaxStop( function() {
    Pace.stop();
}).ajaxError( function(event, request, settings) {
    Pace.stop();
}).ajaxComplete( function(event, request, settings) {
    Pace.stop();
});
</script>


text:
Q: Cannot get a message on the service bus queue I've a small java web app in which I send messages on a service bus queue when a user click on a button. I want to display the messages on my jsp page. But when I make the call
resultQM = service.receiveQueueMessage(queueName, opts);

I get the following exception. Thanks in advance for your help.
 java.lang.IllegalArgumentException: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.util.Date from String value 'Sun, 03 Jun 2012 13:54:40 GMT': not a valid representation (error: Can not parse date "Sun, 03 Jun 2012 13:54:40 GMT": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))
 at [Source: [B@8719e; line: 1, column: 70] (through reference chain: com.microsoft.windowsazure.services.serviceBus.implementation.BrokerProperties["LockedUntilUtc"])
    com.microsoft.windowsazure.services.serviceBus.implementation.BrokerPropertiesMapper.fromString(BrokerPropertiesMapper.java:41)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusRestProxy.receiveMessage(ServiceBusRestProxy.java:187)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusRestProxy.receiveQueueMessage(ServiceBusRestProxy.java:151)
    com.microsoft.windowsazure.services.serviceBus.implementation.ServiceBusExceptionProcessor.receiveQueueMessage(ServiceBusExceptionProcessor.java:108)
    messaging.QueueListener.getMessage(QueueListener.java:22)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:116)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

A: I think the exception is clear enough? There is a message that holds a string containing a date, and the library can't parse the string to a valid date.
"Sun, 03 Jun 2012 13:54:40 GMT": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd")

A: I suggest you to check if your local machine's clock is correct. Also try to create a SimpleDateFormat, as described on Jersey + Jackson deserialization failure with date object (a similar exception).

A: Set the default system locale to US before calling receiveQueueMessage:
Locale.setDefault(Locale.US);

Cause:
The Windows Azure SDK for Java uses Jackson, which uses the default system locale when creating SimpleDateFormat objects for parsing dates. Windows Azure Service Bus returns dates formatted to string using RFC-1123 and ENGLISH locale. RFC-1123 date format contains day of the week and the parser fails when your default locale is not ENGLISH and has different day of week names.
Source: Alexander Racheev's answer in the MSDN Forum.

A: In the latest version of Windows Azure SDK for Java, Version 0.4.2. This should have been fixed, let us know if anyone can still repro this.


text:
Q: Check whether list of custom objects have same value for a property in Java 8 I am new to Java 8. I have a list of custom objects of type A, where A is like below:
 class A {
      int id;
      String name;
 }

I would like to determine if all the objects in that list have same name. I can do it by iterating over the list and capturing previous and current value of names. In that context, I found How to count number of custom objects in list which have same value for one of its attribute.  But is there any better way to do the same in java 8 using stream?

A: You can map from A -->  String , apply the distinct intermediate operation,  utilise limit(2) to enable optimisation where possible and then check if count is less than or equal to 1 in which case all objects have the same name and if not then they  do not all have the same name.
boolean result = myList.stream()
                       .map(A::getName)
                       .distinct()
                       .limit(2)
                       .count() <= 1;

With the example shown above, we leverage the limit(2) operation so that we stop as soon as we find two distinct object names.

A: One way is to get the name of the first list and call allMatch and check against that.
String firstName = yourListOfAs.get(0).name;
boolean allSameName = yourListOfAs.stream().allMatch(x -> x.name.equals(firstName));

A: One more option by using Partitioning. Partitioning is a special kind of grouping, in which the resultant map contains at most two different groups – one for true and one for false.
by this, You can get number of matching and not matching
String firstName = yourListOfAs.get(0).name;

Map<Boolean, List<Employee>> partitioned =  employees.stream().collect(partitioningBy(e -> e.name==firstName));

Java 9 using takeWhile  takewhile will take all the values until the predicate returns false. this is similar to break statement in while loop
String firstName = yourListOfAs.get(0).name;

        List<Employee> filterList =  employees.stream()
                                               .takeWhile(e->firstName.equals(e.name)).collect(Collectors.toList());
        if(filterList.size()==list.size())
        {
            //all objects have same values
        }

A: another way is to calculate count of distinct names using
boolean result = myList.stream().map(A::getName).distinct().count() == 1;

of course you need to add getter for 'name' field

A: Or use groupingBy then check entrySet size.
boolean b  = list.stream()
             .collect(Collectors.groupingBy(A::getName,
             Collectors.toList())).entrySet().size() == 1;


text:
Q: Removing jQuery from a document (garbage collection) I'd like to know if it's possible to remove executed JS code from a document. Let's say I've loaded jQuery, but I no longer need it, is it viable to simply run delete window.$ and such or is there a proper way to do this?
Why would I want to do this?
I'm running some performance tests, at the moment they're inside an <iframe> to allow a clean slate for each suite, but this isn't very feasible as some of the devices I'm testing don't support <iframes> (yep, magic).
So what I'd like to do is essentially load some library based code within a container of some sort, test it and then clear it ready for garbage collection, if this is at all possible within the current state of JS.
Note: I've used jQuery as an example since it's a big library with its 100% coverage and all.


text:
Q: cp --archive / -a in Ruby Ruby have FileUtils with cp, cp_r, having options like verbose, noop etc. Is there any way to do cp -a in a clean way like that? I want to preserve attributes, especially dates.

A: Try using it with the preserve option set:
FileUtils.cp_r(source, dest, preserve: true)


text:
Q: Error referencing EnvironmentObject in view initializer I'm trying to reference an environment object in a SwiftUI view initializer to set up a state value, but I'm getting an error 'self' used before all stored properties are initialized. Is there a way to do this at all as you need to reference self to access the environment object? I feel like referencing an inherited value is something you should be able to do in a view's construction.
struct Example: View {

  @EnvironmentObject var object: Items
  @State var ints: Array<Int>

  init() {
    self._ints = State(initialValue: Array(repeating: 0, count: self.object.items.count))
  }
}

A: Environment object is injected after init, so we should update state later, most often it is used onAppear:
struct Example: View {

  @EnvironmentObject var object: Items
  @State var ints = Array<Int>()         // << just empty

  var body: some View {
    Text("Some view here")
     .onAppear {
        self.ints = Array(repeating: 0, count: self.object.items.count)
     }
  }
}

as alternate it can be used subview, by same approach like in https://stackoverflow.com/a/59368169/12299030


text:
Q: Motorola MC55 Unique ID In Motorola MC55, I'd like to get the factory or unique id or serial no of the scanner. How to code it in vb.net?

A: Since its a piece of mobile equipment it will have an IMEI number, so how about that?  You can retreive it with ATD*#06# or AT++CGSN.

A: You could P/Invoke to get the DeviceUniqueID of the device
 //DeviceID for Win Mobile >= 5.0
    [DllImport("coredll.dll")]
    private extern static int GetDeviceUniqueID([In, Out] byte[] appdata, int cbApplictionData, int dwDeviceIDVersion,
                                                [In, Out] byte[] deviceIDOuput, out uint pcbDeviceIDOutput);

  private static string getDeviceID()
    {
            string appString = "Your App Name";
            byte[] appData = new byte[appString.Length];
            for (int count = 0; count < appString.Length; count++)
            {
                appData[count] = (byte)appString[count];
            }

            int appDataSize = appData.Length;
            byte[] DeviceOutput = new byte[20];
            uint SizeOut = 20;
            GetDeviceUniqueID(appData, appDataSize, 1, DeviceOutput, out SizeOut);

            string idString = "";
            for (int i = 0; i < DeviceOutput.Length; i++)
            {
                if (i == 4 || i == 6 || i == 8 || i == 10)
                    idString = String.Format("{0}-{1}", idString, DeviceOutput[i].ToString("x2"));
                else
                    idString = String.Format("{0}{1}", idString, DeviceOutput[i].ToString("x2"));
            }
            return idString;

    }

EDIT: NOTE this is a C# solution sorry at first i did not see that you wanted VB solution, but for anyone wanting a C# solution, this should work for you.


text:
Q: On a theorem on Lie derivatives I am a little confused proving this theorem (for $p$-forms on $M^n$, $M^n$ is a smooth manifold):
$L_X\cdot i_Y-i_Y\cdot L_X=i_{[X,Y]}$ where $X,Y$ are smooth vector fields.
Now it is clear that both sides are anti-derivations, since $L_X$ is a derivation, $i_Y$ and $i_{[X,Y]}$ are anti-derivations.
Now this reduces the problem to proving that the theorem is true for $f\in C^\infty$ and $df$ for such $f$.
It seems to me the the L.H.S is zero for both $f$ and $df$.
For $f$:
L.H.S $=0$ is trivial since $i_Y$ for any zero-form is $0$
for $df$
$$i_Y \, df=df(Y)
\implies L_X(i_Y \, df)=L_X(df(Y))$$
And
$$L_X(df)=dL_X(f)
\implies i_Y(L_X(df))=L_X(df)(Y)$$
Hence L.H.S. $=0$
Have I made an error here ?
Thanks for any help or pointers.

A: Here's an alternative approach to this question.
Let $\alpha$ be a $p$-form, and let $\phi_t$ be the flow along $X$. By definition
$$L_X i_Y(\alpha) = \left\{ \dfrac{d}{dt}\phi_t^* (i_Y \alpha) \right\}_{t=0} =
\left\{ \dfrac{d}{dt} i_{\phi_t^* Y} (\phi_t^* \alpha) \right\}_{t=0}$$
so by the chain rule and linearity of $Y \mapsto i_Y$ we find
$$L_X i_Y(\alpha) = i_{ L_X Y } \alpha + i_Y L_X \alpha.$$
Since $L_X Y = [X,Y]$ this proves the claim.

A: As per my comment, $(L_X (df))(Y) \ne L_X (df(Y))$?  One way to prove what you want is to use the fact that Lie differentiation satisfies the Leibniz rule with respect to contraction:
$$
L_X(df(Y)) = (L_X df)(Y) + df L_X Y = i_Y L_X(df) + i_{[X,Y]} df.
$$
Subtracting off $i_Y L_X(df)$ gives the right hand side.


text:
Q: Openresty/Lua returns default error page instead of custom I'm currently trying to setup a WAF/DDOS protection using this script:
https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS/blob/master/lua/anti_ddos_challenge.lua
Everything is working pretty well except that openresty/nginx returns the default 500 error page instead of the custom error_page shown below if one of the WAF rules gets a hit. See "WAF_URI_Request_table" at the script above.
each time the request gets blocked by these WAF rules I also get the following entry at my log:
2020/07/27 09:20:29 [error] 150#150: *16 rewrite or internal redirection cycle while internally redirecting to "/403.html", client: 172.21.0.5, server: localhost, request: "GET /test.php HTTP/1.1", host: "localhost"

My nginx configuration looks like this (shortened):
...
http {
     upstream backend {
        server 127.0.0.1:8000 max_fails=3 fail_timeout=60s;
     }
...
 server {
        listen 80;
        access_by_lua_file ddos_challenge.lua;
        aio threads=default;
...
location @proxy_to_app {
            proxy_pass http://backend;
            aio threads;
            proxy_read_timeout     100s;
            proxy_connect_timeout  100s;
            proxy_http_version 1.1;
            proxy_redirect off;
            proxy_buffers 16 4k;
            proxy_buffer_size 2k;
            proxy_intercept_errors on;
            proxy_set_header Host $host;
            uwsgi_intercept_errors on;
            gzip on;
            gzip_min_length 1024;
            gzip_comp_level 3;
            gzip_vary on;
            gzip_disable msie6;
            gzip_proxied expired no-cache no-store private auth;
            gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml application/atom+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
            }

location / {
            try_files $uri @proxy_to_app;
            }
...
error_page 412 414 416 444 495 496 497 500 501 502 504 507 /custom_error.html;
        location = /custom_error.html {
            root /app/templates/;
            internal;
        }

A: Found the mistake, see:
https://groups.google.com/g/openresty-en/c/1XASYFeP61o?pli=1
I moved the access_by_lua line to the / location block, that's it.


text:
Q: 'arecord' works but FFMPEG 'cannot open audio device' On my Linux-based QNAP NAS, I can successfully record my Loopback audio device using:
# arecord -D default:CARD=Loopback test.wav

However, FFMPEG cannot use this same audio device. It returns:
    [alsa @ 0x5a45880] cannot open audio device hw:default:CARD=Loopback (No such file or directory)
hw:default:CARD=Loopback: Input/output error

I've also tried any number of hw: options in FFMPEG. For what it's worth, the arecord -l command returns:
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC262 Analog [ALC262 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

arecord -L returns:
[~] # arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=PCH
    HDA Intel PCH, ALC262 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    Front speakers
sysdefault:CARD=Loopback
    Loopback, Loopback PCM
    Default Audio Device
front:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    Front speakers
surround21:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback,DEV=0
    Loopback, Loopback PCM
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

FFMPEG command and response is:
[~] # /share/CACHEDEV1_DATA/.qpkg/ffmpeg/ffmpeg -f alsa -i hw:default:CARD=Loopback test.mp3
ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
ALSA lib ../../../src/pcm/pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM hw:default:CARD=Loopback
[alsa @ 0x5f64800] cannot open audio device hw:default:CARD=Loopback (No such file or directory)
hw:default:CARD=Loopback: Input/output error

FFMPEG -sources alsa gives:
[~] # /share/CACHEDEV1_DATA/.qpkg/ffmpeg/ffmpeg -sources alsa
ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Auto-detected sources for alsa:
ALSA lib ../../../src/control/control.c:1375:(snd_ctl_open_noupdate) Invalid CTL hw:0
Cannot list sources.

Can anyone shed some light on why this is impossible in FFMPEG and suggest what I'm doing wrong here? FFMPEG includes the ALSA module, and is version 4.2.1. Thanks!


text:
Q: Is there a need to train the model first before K fold cross validation or after train the model? I am implementing a neural network for classification purpose and now i am in trouble of cross validation my question is given below :
Do we need to train the model first and then cross validate it (K fold) , or we first cross validate the model ,then pick that model which performs well on unseen data and then train it , Could anybody guide me that how this whole procedure runs , it is getting confused because if training's
done before or after then what is the role of that training part which is in K Fold ?
    Thanks in advance .

A: The answer is yes.
After testing the model using K fold cross validation, it is recommended to train the model using whole data.


text:
Q: Show existence of algebraic integer unit none of whose powers are real. Let $L \mid \mathbb{Q}$ be Galois with Galois group
$S_3$. I want to show that if there are no real embeddings $L \to \mathbb{C}$, then there is some unit in the ring of integers whose non-zero powers are not real.
Should I try to look at the unit group of the ring of integers of the three degree 3 subextensions ? The unit ring for the extension of degree 2 has order 6, and consists of the 6th roots of unity. I assume the unit group for the degree 3 cases are going to be free of rank 1.
For the integer units of L, by Dirichlet's unit theorem the unit group has torsion-free rank 2. Can I use this to generate such and element?
I would prefer a simple elementary approach over one that uses Dirichlet's unit theorem.

A: A same idea of Phil.Z.
By  tracing the  proof of Dirichlet's  unit Theorem ,  we have for a Galois extension $L$, there is a unit $u$ such that $\{u^\sigma|\sigma \in \mathrm{Gal}(L/\mathbb{Q})/<\tau>\}$ generate a finite index subgroup in the unit group. Here $\tau$ is the complex conjugation and $\sigma$ runs over the representative elements of $\mathrm{Gal}(L/\mathbb{Q})/<\tau>$.
In your case, choose a such $u$, then $\mathbb{Q}(u,u^\sigma)=L$, since any nontrivial subfield does not admit a unit group with rank $2$. As $L$ is complex, $u,u^\sigma$ can't be both real.

A: *

*Let $K$ be a sub-extension of degree $3$. There must be a real place of $K$, so we assume that $K=\Bbb{Q}(\alpha)$ is a subfield of $\Bbb{R}$;

*Let $f$ be the minimal polynomial of $\alpha$. If $K$ is totally real, then all the roots of $f$ should be real, and hence the discriminant $D(f)=\prod (x_i-x_j)^2>0$. On the other hand, we have $L=K(\sqrt{D})$, so it indicates that $L$ is also totally real, a contradiction.

*Therefore $K$ can only possess one real place. Now by Dirichlet's theorem and some knowledge of the free abelian group, there is a non-torsion unit $u$ inside $L\backslash K$  that is linearly independent of any non-torsion unit $v$ in $K$(means $u^mv^n=1$ if and only if $m=n=0$).


text:
Q: trash and restore script - issue restoring #!/bin/bash
echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)"
read ans
case "$ans" in
        Yes) echo "$(readlink -f $1)" >> "$HOME/TrashLog" && mv "$1" "$HOME/my-documents/mydir01/Trash" ;;
        No) echo "File was NOT deleted and remains. ";;
esac

This script moves a file to a trash folder in which acts as a recycling bin. The 2nd script I'm trying to make should take the location of the original file (stored in TrashLog as a file path) and restore the file to its original location. Here's what I had so far (which isn't working).
#!/bin/bash
restore=$(find my-documents/* | grep $1)
filename=$(readlink -f $restore)
mv -i "$filename" "$(grep $1 $HOME/TrashLog)"


text:
Q: Connect, Insert and retrieve information from Postgresql in Javascript or JS I have connected and pull retrieve some data using PHP but I would like to know:

*

*It is PHP or Javascrip , JS better to interacts with Postgresql

*It is an easy way to do the same as my PHP code in Javascrip or JS? if so, how?

In my example: I'm inserting the name, last name and email and retrieving the country.
Thank you very much
<!DOCTYPE HTML>
<html>
<body>

<?php
// define variables and set to empty values
$nameErr = $emailErr = $surnameErr = $AddressErr = "";
$name = $email = $surname = $address = "";

<select name="countryselect" id="countryselect">
    <?php
    $db = pg_connect('host=localhost dbname=test user=myuser password=mypass');

    $query = "SELECT country FROM countries";

    $result = pg_query($query);
    if (!$result) {
        echo "Problem with query " . $query . "<br/>";
        echo pg_last_error();
        exit();
    }

    printf ("<option value=Select>Select a Country</option>");
    while($myrow = pg_fetch_assoc($result)) {

     printf ("<option value=$myrow[country]>$myrow[country]</option>");

}

    ?>
</select>

   <input type="submit" name="submit" value="SAVE">
</form>

<?php

if ($nameErr == '' && $emailErr == '' && $surnameErr == '')
{

   $db = pg_connect('host=localhost dbname=test user=myuser password=mypass');

    $firstname = pg_escape_string($_POST['name']);
    $surname = pg_escape_string($_POST['surname']);
    $emailaddress = pg_escape_string($_POST['email']);

    $query = "INSERT INTO host(firstname, surname, emailaddress) VALUES('" . $firstname . "', '" . $surname . "', '" . $emailaddress . "')";

    $result = pg_query($db, $query);
    if (!$result) {
        $errormessage = pg_last_error();
        echo "Error with query: " . $errormessage;
        exit();
    }
    //printf ("These values were inserted into the database - %s %s %s", $firstname, $surname, $emailaddress);
    pg_close();

 }
?>

</body>
</html>


text:
Q: How to install `Hat` I am trying to get the Hat debugger. When I try:
cabal install hat OR cabal install hat -v
At the end I get:
configure: error: in `/tmp/terminfo-0.4.0.0-17745/terminfo-0.4.0.0':
configure: error: curses headers could not be found, so this package cannot be built
See `config.log' for more details
Failed to install terminfo-0.4.0.0
cabal: Error: some packages failed to install:
haskeline-0.7.1.3 depends on terminfo-0.4.0.0 which failed to install.
hat-2.8.0.0 depends on terminfo-0.4.0.0 which failed to install.
terminfo-0.4.0.0 failed during the configure step. The exception was:
ExitFailure 1

So trouble shooting I try:
cabal install terminfo

And get:
configure: error: in `/tmp/terminfo-0.4.0.0-18341/terminfo-0.4.0.0':
configure: error: curses headers could not be found, so this package cannot be built
See `config.log' for more details
Failed to install terminfo-0.4.0.0
cabal: Error: some packages failed to install:
terminfo-0.4.0.0 failed during the configure step. The exception was:
ExitFailure 1

What do I do to install Hat?

A: Assuming you're on a Linux of some sort, there should be a system package like "libncurses5-dev" (that's the name in Ubuntu) that you can install to get the curses headers.

A: Once you have curses installed on your system,
cabal install terminfo --extra-include-dirs=/path/to/curses/include --extra-lib-dirs=/path/to/curses/lib

of course with the appropriate replacement of /path/to/curses.
Your platform's package manager might also be able to install terminfo directly, or you might use a separate package manager, i.e. the Nix package manager (which is particularly popular with Haskellers).


text:
Q: Group PHP ODBC results with common dataset? I'm using PHP to connect to and display data from an ODBC MS Access database. I'm able to display the necessary data with a select statement, but I'm failing to learn how to group this data based on another dataset.
Here is my code:
<?
$handle = odbc_connect("Potter","","");
$results = odbc_exec($handle, "SELECT DISTINCT prodModelNo, prodSubType, prodCAD FROM product WHERE prodType NOT LIKE 'Plus' AND prodType = 'Fire' AND prodCAD LIKE '%CAD Drawing%' GROUP BY prodSubType");

        // Results List
        odbc_fetch_row($results, 0);
        while(odbc_fetch_row($results)){
            $cadString1     = odbc_result($results, "prodCAD");
            $cadString2     = str_replace(' CAD Drawing (zip format)', '', $cadString2);
            echo "

 Download (zip format)

";
            echo odbc_result($results, "prodModelNo");
            echo "

";
        }
?>

This outputs a list of accurate data. What I'd like to do is group results that share a common category and have that category name displayed between each group. The column for category names in the database is called prodSubType.
How would I get this to display properly?

A: Instead of GROUP BY prodSubType use ORDER BY prodSubType - so you can grab all items.
Then, in your code, have a BEFORE and AFTER variable to output the header differences (I'm not good at explaining this). See example (untested):
<?php
$handle = odbc_connect("Potter","","");
$results = odbc_exec($handle, "SELECT DISTINCT prodModelNo, prodSubType, prodCAD FROM product WHERE prodType NOT LIKE 'Plus' AND prodType = 'Fire' AND prodCAD LIKE '%CAD Drawing%' ORDER BY prodSubType ASC");

// Results List
odbc_fetch_row($results, 0);
$oldHeader = "";
while(odbc_fetch_row($results)){
  $header = odbc_result($results, "prodSubType");
  if($header != $oldHeader) {
    $oldHeader = $header;
    echo "
$header
";
  }
  $cadString1     = odbc_result($results, "prodCAD");
  $cadString2     = str_replace(' CAD Drawing (zip format)', '', $cadString2);
  echo "

 Download (zip format)

";
  echo odbc_result($results, "prodModelNo");
  echo "

";
}
?>


text:
Q: Best way to start same activity and destroy the previous one I am making some webview activity which would be loaded from main activitiy. Is there a way to run, let say every 1h some method which would start webview activity #2 in the background, kill #1 webview activitiy and switch seamlessly as possible from #2 to #1 , maybe some white screen for a second or something, because there are some memory leaks in webview and I would need to destroy activitiy once in a while, but would like to transition everything as smooth as possible?
Thank you in advance!

A: Probably this code'll works for you. I use it to restart my App, when my users change the app's language.
Intent intent = new Intent(getActivity(), StartUpActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(
                                    getActivity(),
                                    123456,             //request code ??? some dummy numbers.
                                    intent,
                                    PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager manager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
manager.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
System.exit(0);

You can read about the PendignIntent class here: http://developer.android.com/reference/android/app/PendingIntent.html
I'm not completly sure, what the request code is. I'm using some dummy numbers, and it works.

A: If you absolutely have to do this, I would suggest wrapping your activity in a "parent" activity and every time you need to kill the "child" (i.e. current) activity, simply transition to parent (with the Intent.FLAG_ACTIVITY_CLEAR_TOP flag) and then have the parent spawn a new instance of your activity. This way you don't have to do anything funky and it's consistent with how android activities work.


text:
Q: My Image file from the database is not being displayed in my view(Laravel) Every time I try to retrieve my image from the database, my image is not being displayed.
Here is my controller:
<?php

namespace App\Http\Controllers;

use App\Models\County;
use App\Models\home_owners;
use App\Models\pricing;
use App\Models\property;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class ProController extends Controller
{
    public function viewProperties(){
        $allPros = property::paginate(7);
        //dd is the laravel version of var_dump() & die();
        //dd($allRoles);

             return view('HO.properties', ['properties'=>$allPros]);
    }

    public function addProperty(){
        return view('HO.addproperty');
    }

    public function saveProperty(Request $request){

            $prop = new property();
            $prop->National_id=$request->National_id;
            $prop->Plot_No=$request->plot_no;
            $prop->Property_Ad=$request->Property_Ad;
            $prop->Property_Photo=$request->Property_Photo;
            $prop->Property_features=$request->Property_features;
            $prop->county_id=$request->County;
            $prop->sc_id=$request->subCounty;
            $prop->town_id=$request->Town;
            $prop->type=$request->property_type;

            if($request->hasFile('Property_photo')){

                $file = $request->file('Property_photo');
                $extension = $file->getClientOriginalExtension();
                $filename = time().'.'.$extension;
                $file->move('uploads/properties/', $filename);
                $prop->Property_Photo = $filename;

            }
            $prop->save();
            return redirect('properties')->with('status',"New Property added.");
    }

    public function editProperty(){

    }

    public function viewPricing(){
        $allPrices = pricing::paginate(7);
        //dd is the laravel version of var_dump() & die();
        //dd($allRoles);

             return view('HO.pricing', ['prices'=>$allPrices]);
    }

    public function viewPropertyList(){
        $properties = property::paginate(7);
        //dd is the laravel version of var_dump() & die();
        //dd($allRoles);

             return view('viewProperties', compact('properties'));
    }

}

Here is my view page:
@extends('layout')
@section('headTitle', 'Available properties for sale/lease')
@section('pageTitle', 'Available properties for sale/lease')

@section('content')

    @foreach($properties as $property)

                Property_photo}}" width="70px" height="70px" alt="image">

    @endforeach

@endsection

Here is my route:
<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HOController;
use App\Http\Controllers\ProController;
use App\Http\Controllers\AjaxController;
use App\Http\Livewire\County;
use App\Http\Livewire\Subcounty;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('BOs', 'App\Http\Controllers\BOController@viewBO');
Route::get('your_properties', [ProController::class, 'viewProperties']);
Route::get('/', [ProController::class, 'viewPropertyList']);
Route::get('your_properties/pricing', [ProController::class, 'viewPricing']);
Route::get('your_properties/addproperty', 'App\Http\Controllers\ProController@addProperty');

Route::get('HO/register', [HOController::class, 'register']);
Route::post('HO/createNew', [HOController::class, 'createNew']);
Route::get('HO/ViewProfile', [HOController::class, 'ViewProfile']);
Route::get('HO/editProfile', [HOController::class, 'editProfile']);
Route::post('HO/saveChanges', [HOController::class, 'saveChanges']);
Route::get('HO/deleteHOaccount', [HOController::class, 'deleteHOaccount']);

Route::post('authRegister', [HOController::class, 'authRegister']);
Route::post('saveProperty', [ProController::class, 'saveProperty']);
Route::get('dashboard', County::class);
Route::get('HO/addproperty', Subcounty::class);

Route::post('fetch-subcounties', [AjaxController::class, 'getSubCounties']);
Route::post('fetch-towns', [AjaxController::class, 'getTowns']);

Route::get('register', function () {
    return view('register');
});

Route::get('login', function () {
    return view('login');
});

I tried this but it failed, what should I do. Even when adding a new property, my images are not moved to the "uploads/properties/" directory but it saves the image in the database.


text:
Q: Можно ли задать разный размер в двумерном массиве? Есть массив:
byte[][] A = new byte[10][];

Как задать отличающиеся размеры (если возможно вообще) для массива?
Например
 [0][20],[1][50], [2][10], [3][1000].

A: byte[] b1 = new byte[20];
byte[] b2 = new byte[50];
byte[] b3 = new byte[10];
byte[] b4 = new byte[1000];
byte[][] A = new byte[][]{ b1, b2, b3, b4 };

Если размер известен только в момент вычисления:
byte sizeY =  (byte) (Math.random() * 100 ); // размер внешнего массива
byte[] x = new byte[ sizeY ]; // размеры внутренних массивов

for( int i = 0; i < sizeY; i++ ){  // вычисление размеров внутренних массивов
    x[i] = (byte) (Math.random() * 100);
}

byte[][] A = new byte[ sizeY ][];
for( int i = 0; i < sizeY; i++ ){ // создание двумерного массива
    A[i] = new byte[ x[i] ];
}


text:
Q: configure netty to only have one selector thread? We are trying to debug a very nasty issue that appears to happen on netty 3.6.0, 3.6.7 and 3.8.0 on linux and MAC so far.  We can reproduce it pretty well(not extremely easy but pretty well).
What happens is we open a web page which then results in chrome sending around 15 requests for css files, js files, etc. etc.
One of the requests from chromes always hangs.  Digging in deeper, we see the request reach the server in wireshark, but we never see the request come into the playframework server.  All the other requests come in fine.
We literally have to fiddle around with websockets to get it into this weird state(not sure if something around websockets in netty is screwed up or not).
We would like to configure the netty pool to only have ONE worked thread to simplify debugging and see if the issue goes away.  Is it possible to configure the number of threads running on the selector?
This post How Netty uses thread pools? looks like it suggested executors upstream which is not what I want.
thanks,
Dean

A: Pass "1" in the the NioServerSocketChannelFactory constructor as last argument.


text:
Q: Align bottom in hgroup in Adobe Flex I have HGroup with two label like following:
<s:HGroup verticalAlign="bottom" gap="1">
    <s:Label text="12" fontSize="15"  />
    <s:Label text="14" fontSize="25"  />
</s:HGroup>

Both have different font size. So, second label display upper than first one. How can i make them bottom align?

A: Labels are already aligned at the bottom but they have a different internal offset depending on the font size so letters with a descent baseline (like "g" or "j") would still fit in.
So if you want to align your numbers you should align your text to the descent baseline:
<s:HGroup verticalAlign="bottom" gap="1">
    <s:Label text="12" fontSize="15" alignmentBaseline="descent" />
    <s:Label text="14" fontSize="25" alignmentBaseline="descent" />
</s:HGroup>

More about that here


text:
Q: The probability that an order statistic is a particular sample member? Suppose I have $X_i, \ldots, X_n$ sample members that are all iid and follow some variable $Y$.
If I seek to find the probability that $Y_k = X_m$ (the $k$th order statistic where $1 \leq m \leq n$), my textbook claims that since all members are iid, the chance that any one of them equals some statistic $=\frac 1 n$.
I'm not convinced by this explanation. What about the independence of these sample members implies that they're equally to be assumed by some order statistic?

A: To say that $X_1,X_2,X_3,X_4$ are i.i.d. and $X_1$ has a certain distribution is enough information to determine the joint distribution completely. In other words, if each of the random variables $W_1,W_2,W_3,W_4$ has the same distribution as $X_1$ and $W_1,W_2,W_3,W_4$ are independent then the whole sequence $(X_1,X_2,X_3,X_4)$ has the same distribution as $(W_1,W_2,W_3,W_4)$. That means, in particular, that permutations of $X_1,X_2,X_3,X_4$ have that same distribution, so that, for example, $(X_2,X_3,X_4,X_1)$ has the same distribution as $(X_1,X_2,X_3,X_4)$. Therefore, the probability that, for example, the third component of $(X_1,X_2,X_3,X_4)$ is in the second position after sorting into increasing order, is the same as the probability that the third component of $(X_2,X_3,X_4,X_1)$ is in the second position when sorted into increasing order. Thus $\Pr(X_3=X_{(2)}) = \Pr(X_4=X_{(2)}).$ And the same holds if some other pair than $3,4$ had been chosen as the indices and some other position than the second had been chosen. Consequently, every index among $1,2,3,4$ is equally likely to be the index of the random variable in the second position after sorting.  And similarly for other positions than the second.


text:
Q: Laravel 5 addClassMap Does anybody know, how I can do a similar thing in Laravel 5 version and where?
 $loader = require __DIR__ . '/../vendor/autoload.php';
    $loader->addClassMap(array(
        'Illuminate\Cookie\Guard' => __DIR__ . '/overrides/Illuminate/Cookie/Guard.php',
        'Illuminate\Session\Store' => __DIR__ . '/overrides/Illuminate/Session/Store.php'
    ));

This one was done in the Laravel 4 version in bootstrap.php file.
Exactly what I want to do is to override existing class.
Thanks in advance

A: Hello you can do this in
bootstrap/autoload.php
but better do this using composer.


text:
Q: MySQL 8.0.23 crashes with Segfault on Select query I hope someone might have additional ideas on what is going wrong and how we could solve it.
Our MySQL Database keeps crashing due to Signal 11 (Segfault) from the OS.
Quick overview of the server:
Centos 7
MySQL Server Community Edition 8.0.23 via the official mysql repository
4 cores
8GB RAM
100GB HDD with 85GB free space
We started to get crashes with the following log:
15:09:23 UTC - mysqld got signal 11 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x7f678c000d20
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f6800141c30 thread_stack 0x46000
/usr/sbin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x21e102d]
/usr/sbin/mysqld(handle_fatal_signal+0x313) [0x1009643]
/lib64/libpthread.so.0(+0xf5d0) [0x7f68181975d0]
/usr/sbin/mysqld() [0x24c7e0e]
/usr/sbin/mysqld(trx_undo_update_rec_get_update(unsigned char const*, dict_index_t const*, unsigned long, unsigned long, unsigned long, unsigned long, trx_t*, mem_block_info_t*, upd_t**, lob::undo_vers_t*, type_cmpl_t&)+0x7bb) [0x24c9d3b]
/usr/sbin/mysqld(trx_undo_prev_version_build(unsigned char const*, mtr_t*, unsigned char const*, dict_index_t const*, unsigned long*, mem_block_info_t*, unsigned char**, mem_block_info_t*, dtuple_t const**, unsigned long, lob::undo_vers_t*)+0x43d) [0x24cb7cd]
/usr/sbin/mysqld(row_vers_build_for_consistent_read(unsigned char const*, mtr_t*, dict_index_t*, unsigned long**, ReadView*, mem_block_info_t**, mem_block_info_t*, unsigned char**, dtuple_t const**, lob::undo_vers_t*)+0x279) [0x2476cb9]
/usr/sbin/mysqld(row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long)+0x2b34) [0x2462c14]
/usr/sbin/mysqld(ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function)+0x29a) [0x22c7e2a]
/usr/sbin/mysqld(handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function)+0x347) [0x11184e7]
/usr/sbin/mysqld() [0xe8c415]
/usr/sbin/mysqld(join_read_const_table(JOIN_TAB*, POSITION*)+0x87) [0xe8c4d7]
/usr/sbin/mysqld(JOIN::extract_func_dependent_tables()+0x4c3) [0xeaff03]
/usr/sbin/mysqld(JOIN::make_join_plan()+0x10e7) [0xec0fb7]
/usr/sbin/mysqld(JOIN::optimize()+0xbcb) [0xec247b]
/usr/sbin/mysqld(SELECT_LEX::optimize(THD*)+0xb6) [0xf1ebe6]
/usr/sbin/mysqld(SELECT_LEX_UNIT::optimize(THD*, TABLE*, bool)+0x7b) [0xf92dab]
/usr/sbin/mysqld(Sql_cmd_dml::execute_inner(THD*)+0x3d) [0xf1d63d]
/usr/sbin/mysqld(Sql_cmd_dml::execute(THD*)+0x525) [0xf272e5]
/usr/sbin/mysqld(mysql_execute_command(THD*, bool)+0x9f0) [0xecb7a0]
/usr/sbin/mysqld(dispatch_sql_command(THD*, Parser_state*)+0x42b) [0xecff7b]
/usr/sbin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x1ed6) [0xed22f6]
/usr/sbin/mysqld(do_command(THD*)+0x19c) [0xed302c]
/usr/sbin/mysqld() [0xffa6b8]
/usr/sbin/mysqld() [0x2782d4e]
/lib64/libpthread.so.0(+0x7dd5) [0x7f681818fdd5]
/lib64/libc.so.6(clone+0x6d) [0x7f6816575ead]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f678c009a68): SELECT job_project_id AS projectid, user_id_fk AS userid, job_name AS jobname      FROM job WHERE job_id=2463
Connection ID (thread ID): 9
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Reading through the logs it seems that the culprit is the following query:
SELECT job_project_id AS projectid, user_id_fk AS userid,
       job_name AS jobname
    FROM job
    WHERE job_id=2463

The table job has the following columns:
Columns:
job_id int AI PK
job_name varchar(50)
job_status json
job_fileset_list json
user_id_fk int
job_project_id int
job_start_time datetime
job_end_time datetime
job_pipeline json
job_task_blobs json
job_exe_blobs json

The my.cnf is:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 5500M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

max_connections=500

We have only ever seen this error with above query. This segfault occurs semi-regularly, where we can run the query fine a couple of times and then it segfaults. We tried running the queries sequentially, no difference. We tried running them with breaks of 1 seconds, no difference.
The server definitely does not go out of memory, there is enough around when the segfault comes along.
I am completely out of ideas and I also cannot find people with the same problem.
The closest I found was a bug report
however this is for a much older version of mysql, and did not offer any resolution.
If anyone has any ideas, hunches or even had this problem themselves before, I would very much appreciate your input!

A: So this is not really a solution to the bug/problem itself.
But thanks to Don we have narrowed the cause down to most probably be MySQL itself. We have switched to MariaDB and the problem does not occur anymore. We will stick with MariaDB for the forseeable future.


text:
Q: How to use shopify polaris css components? I want to use Polaris css components for my shopify app. I have go through their document https://polaris.shopify.com/components/get-started#navigation. As mentioned there I have include their css and html code for a component but some components are not working functionally like Date picker I have put html code on my page but I am not able to change month, select date etc.
I think I have to load js for get that working but I didn't found any js link in their document.
Can you please help me out?

A: If you are using the CSS-only version, we do not provide any JS. The CSS version is meant for someone who does not want to use React and is willing to write the scripts required for any interactive components. If you are using the React components, you will not find everything; as you've identified, this is not exactly like Bootstrap or similar frameworks. This is a more selective set of components that encompass patterns that have been established for Shopify's own applications. We will probably add more components in the future, though; if there's something you feel is obviously missing, please feel free to leave an issue.


text:
Q: CSS transition won't start on blur screen I'm using react js.
I try to run the simple code:
setTimeout(() => {
       setTimeout(() => {
         const element = document.getElementById('circle')
         element.style.backgroundColor = 'red'
       }, 3000)
     }, 3000)

The CSS of 'circle' is just:
width: 100px;
height: 100px;
border-radius: 50%;
background-color: blue;
transition: background-color 2s;

I run the code and immediate change tab or minimize the screen, waiting more then 6 seconds and go back to the page and then the transition start. For some reason the transition not run if screen not in focus.
Any help guys???

A: The behavior you describe depending on the browser because inactive tabs have low priority execution.
While you performing a "JS Animation" you may want to use requestAnimation.
A better approach may use a "CSS Animation" with transition-delay.

A: Use this code why are using Apostrophe mark in code.
    <script>
        setTimeout(() => {
               setTimeout(() => {
                 const element = document.getElementById('circle')
                 element.style.backgroundColor = 'red'
               }, 3000)
             }, 3000)
        </script>

A: Actually it is not really help me.
The solution i made is to listen to 'focus' and 'blur' and stop any animations process and timers on blur and continue from last point at focus.


text:
Q: Evaluation of a trace - how does it depend on the inner product being used? Let's say that I am looking at the space of matrices $M_{n\times n}(\mathbb{R})$. If I have some linear function $F : M_{n\times n}(\mathbb{R}) \to M_{n\times n}(\mathbb{R})$, then I can take it's "trace" by taking a basis $\{ E_{ab} \}_{a,b=1}^{n} \subset M_{n\times n}(\mathbb{R})$ and evaluating the following:
$$
\mathrm{Tr}(F) = \sum_{a,b=1}^{n} \left< E_{ab}, F(E_{ab}) \right>\ \ \ =?\ \ \  \sum_{a,b=1}^{n} \mathrm{Tr}\left[ F(E_{ab})^{T}E_{ab}\right]
$$
I'm assuming that the inner product on $M_{n\times n}(\mathbb{R})$ I should be using is $ \left< A,B \right> = \mathrm{Tr}(B^{T}A)$.
But here's my question: obviously $ \left< A,B \right>_{\prime} = \frac{\pi}{1789} \mathrm{Tr}(A^{T}B)$ is a valid inner product as well! But this different choice of inner product would change the value of $\mathrm{Tr}(F)$!
I would have liked to think that $\mathrm{Tr}(F)$ is invariant under the choice of our inner product for some reason...since this is not the case,  is the trace of a function like $F$ defined in terms the inner product $\left< A,B \right> = \mathrm{Tr}(B^{T}A)$? What's going on here?

A: One way to look at it: is $\{E_{ij}: i,j\in\{1,2,\ldots,n\}\}$ still an orthonormal basis with respect to your new inner product?

A: Let's say you have an operator $T \colon V \rightarrow V$ on a finite dimensional vector space over $\mathbb{R}$. Then you can calculate the trace of $T$ in two different ways:

*

*Choose some basis $\beta = (v_1,\dots,v_n)$ for $V$. Then $\operatorname{Tr}(T) = \sum_{i=1}^n ([T]_{\beta})_{ii}$ where $[T]_{\beta}$ is the matrix representing $T$ with respect to the basis $\beta$. By choosing a different basis $\beta'$, we will get a different matrix $[T]_{\beta'}$ with possibly different diagonal values but $\sum_{i=1}^n ([T]_{\beta})_{ii} = \sum_{i=1}^n ([T]_{\beta'})_{ii}$.

*Choose some inner product $\left< \cdot, \cdot \right>$ on $V$ and some orthonormal basis $(v_1,\dots,v_n)$ for $(V,\left< \cdot, \cdot \right>)$. Then $\operatorname{Tr}(T) = \sum_{i=1}^n \left< Tv_i, v_i \right>$. If you change the inner product or the orthonormal basis the summands will change but the sum will be independent of the inner product or the specific orthonormal basis used to calculate the sum (as long as it is orthonormal with respect to the chosen inner product).

In your case, if replace $\left< \cdot, \cdot \right>$ with $\frac{\pi}{1789} \left< \cdot, \cdot \right>$ then a basis $(e_1,\dots,e_n)$ that was orthonormal for $\left< \cdot, \cdot \right>$ will stay orthogonal for the new inner product but not orthonormal. If you modify the basis accordingly (by moving to $e_i' := \sqrt{\frac{1789}{\pi}} e_i$), you'll get the same result.


text:
Q: How to pass Object value to other component in Angular4? I need to pass object value to another component while navigating from one component to another without showing data in URL.
I m trying something like this, when clicking  it will redirect to secondComponent. in URL i will show /15  but i also i want to pass object to secondcomponent that should not visiable on url.
Could someone please tell me how to pass object at the time of navigation and how to capture it on second component
Is it possible to sent obj value inside  [routerLink]="15 passThisObj"
Eg:
{ path: ':id', component: SecondComponent }

Edit
Edit
Edit
Edit
Edit

A: What you are asking is not technically possible with angular, the only way to pass data as part of a routerLink is by modifying the URL. However if the data to be passed is related to the route parameter in a one-to-one relationship, you can store those objects in an object in a service, and in your component (the one being routed to) use that service to query the data object based on the route parameter.


text:
Q: Backbone app check internet connectivity in a generic way I am developing an phonegap  mobile application using backbone , require.js . I am doing number of ajax call for web service and  backbone model, collection fetch(), save(), destroy() in my application  . For all these web services i need to check internet connectivity in generic way .
I tried Phonegap online and offline events which are also not working . Here is my question
Offline and online events not getting Called in cordova 3.5.0
Please guide me a generic way to find internet connectivity in my phonegap application .

A: I was just looking for something similar and came across this: http://github.hubspot.com/offline/docs/welcome/
I haven't used it, but it seems to be what you're looking for. Hope it helps!


text:
Q: Laravel 5.6 Route This is the mean problem
I have controllers structures like this

And i am using this syntax to make routes which is worked good for me

And i calling url in this way

{{ route('admin.categories.show', [$category->id]) }}

i got this error

Any Solution ?? thanks in advance guys

A: When grouping routes, it is possible to namespace them by adding flag as:
Route::group(['prefix' => 'admin', 'as' => 'admin.'], function (){
    Route::resource('categories', 'Admin/CategoryController');
});

Now route('admin.categories.show') should be accessible.

A: the solution is

{{ route('categories.show', [$category->id]) }}

skip the admin thanks every one .


text:
Q: sql function statement w joins & calling specified records via variable assignment in php first time user of stack here.  Apologies for the long winded title, but i wasn't exactly sure on how to word it. So here's my setup.
Within my functions.php file i have the following sql:
function getCustomersTable() {
    $sql = "SELECT * FROM customers
                LEFT JOIN leads on customers.customer_id = leads.customer_id
                LEFT JOIN events on customers.customer_id = events.customer_id";
    return resourceToTwoDimensionalArray(query($sql));
}

I will be inserting certain data from my query into a html table.  My code for that is:
$customers = $getCustomersTable();

foreach($customers as $customer) {
        $id = $customer['customer_id'];
        $title = $customer['event_title'];
        $pickup = $customer['pickup_time'];
        $pickupLocation = $customer['pickup_instructions'];
        $totalPassengers = $customer['num_passengers'];

        // Print the data to the table
        echo "
        $title
        $pickup
        $pickupLocation
        $totalPassengers
        ";

When i run it. I get a fatal error "function name must be a string" on $customers = $getCustomersTable();
Any ideas?
Greatly appreciate it!

A: $customers = $getCustomersTable();
             ^----

You're trying to use a variable function, with an undefined variable. Since the variable's undefined, it's basically acting as the equivalent of
$customers = null();


text:
Q: Class variable initialization in python I have a class with a variable that should be an instance of this class. I can't create an instance at the declaration line because python interpreter does not know how to construct object at that moment. There is a possible workaround: initializing after the class declaration.
class A(object):
    static_variable = None

    def some_method(self, a=static_variable):
       print a

A.static_variable = A()

But I need to use that class variable as a default argument. It is possible to solve the problem this way:
def some_method(self, a=None):
    a = a if a else A.static_variable
    print a

However, it looks very nonpythonic to me. Any suggestion about how to use this kind of static variable as a default argument would be appreciated.

A: Python does not support 'static' variables in the sense that languages like C++ do. So in this case, 'static_variable' is actually a class variable which is why you are encountering this problem. I'm sure you already know this, but others may stumble here someday and see us calling it a static variable so it seems like we should clear that up for posterity.
I was thinking that since 'static_variable' is still a member of class A, then maybe there was a way around by not using it as an argument at all.
Can you use a keyword argument in some_method()?
instead of using it as a default argument to the function, you could just call the variable 'A.static_variable' if the kwarg was not used.
class A(object):
    static_variable = None

    def some_method(self, *, a=None):
        if a:
            print(a)
        else:
            print(A.static_variable)

A.static_variable = A()


text:
Q: It is essential to press 'make' after changing weights file? We should press 'make' after installing darknet.
(https://github.com/pjreddie/darknet)
Do I have to enter 'make' after changing weights file whenever I Learning something?

Whenever I change weights file, that error occur


text:
Q: Animated backround for my android activity using Eclipse and ADT I want to create a background that covers the whole screen of my Activity.
Just like:
 android:background="@drawable/background"

But I want this background to be animated (60 frames), looping and target as many device resolutions as possible.
I tried to do a drawble .jpg sequence, but the problem is that I use 1920x1080, and the logcat while trying to test it on the emulator, the application crashes, and LogCat gives me en error saying, not enough memory
Then I tried to import a video of my sequence and set it to play on the background. But I don't know where to put the video in my res folder and call it from there with SetVideoPath(),  in order to  play it.
What is the best approach for an animated background, that covers multiple devices with different resolutions?
@Arun C Thomas
I still get an error in logcat,
OutOfMemoryError
my code is this:
package combiolab.biolab;

import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Bundle;
import android.view.WindowManager;

public class MainActivity extends Activity {

    private Renderer graphicsRenderer;

    //public static String gl;
    AnimationDrawable anim;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
       getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

       GLSurfaceView myGLSurfaceView = (GLSurfaceView) findViewById(R.id.gl);
       myGLSurfaceView.setEGLConfigChooser(true);
       myGLSurfaceView.setRenderer(graphicsRenderer);
    }

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >

         <android.opengl.GLSurfaceView
            android:id="@+id/gl"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
        </android.opengl.GLSurfaceView>

    </RelativeLayout>

A: You need to create an OpenGL  view,
 then add it like
 <android.opengl.GLSurfaceView
        android:id="@+id/gl"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    </android.opengl.GLSurfaceView>

In onCreate() implement Renderer like
GLSurfaceView myGLSurfaceView = (GLSurfaceView) findViewById(R.id.gl);
    myGLSurfaceView.setEGLConfigChooser(true);
    myGLSurfaceView.setRenderer(graphicsRenderer);


text:
Q: Im trying to create a sign up page. Getting blank screen Im trying to create a sign up page. I followed a guide but its erroring and im presented with a blank screen when i run it. I think i may of misunderstood some code. any help would be greatly appreciated.
<?php

        if (isset($_POST['register'])){
            if (empty($_POST['email']) &&
                (empty($_POST['username']) &&
                (empty($_POST['password']) &&
                (empty($_POST['re-enter']) &&
                (empty($_POST['title']) &&
                (empty($_POST['first name']) &&
                (empty($_POST['second name']) &&
                (empty($_POST['address']) &&
                (empty($_POST['postcode']) &&
                (empty($_POST['contactnumber'])){
                    $email=$_POST['email'];
                    $username=$_POST['username'];
                    $password=$_POST[['password'];
                    $reenter=$_POST['re-enter'];
                    $title=$_POST['title'];
                    $firstname=$_POST['firstname'];
                    $secondname=$_POST['secondname'];
                    $address=$_POST['address'];
                    $postcode=$_POST['postcode'];
                    $contactnum=$_POST['contactnumber'];
                    if ($password == $reenter) {
                        $conn = mysqli_connect('127.0.0.1', 'i7266***', 'Winter****', 'i72*****');
                        $emailquery = "SELECT * FROM UserTable WHERE email = '$email'";
                        $r = mysqli_query($conn, $emailquery);
                        $count = mysqli_num_rows($r);
                            if ($count == 1) {
                                echo "Email already exists";
                            } else {
                                $query = "INSERT INTO UserTable VALUES ('$username', '$password', '$email', '$title', '$firstname', '$secondname', '$address', '$postcode', '$contactnum')";
                                $run = mysqli_query($conn, $query);
                                echo "Customer account has been created";
                            }
                    } else {
                    echo "Passwords did not match";
                    }
            } else {
                echo "please enter your details to register";
                }

        }else {
            echo "Please enter details to register";
            }

    ?>
    <form method="POST" action="">
    Email:
    <input type="email" name="email">

    Username:
    <input type="text" name="username">

    Password:
    <input type="password" name="password">

    Re-enter password:
    <input type="password" name="re-enter">

    Title:
    <input type="text" name="title">

    First name:
    <input type="text" name="firstname">

    Second name:
    <input type="text" name="secondname">

    Address
    <input type="text" name="address">

    Postcode:
    <input type="text" name="postcode">

    Contact number
    <input type="number" name="contactnumber">

    <input type="submit" name="register" value="Register">

A: You are not closing the '( )' in the second if in all the evaluations and you have one more of this '[' in $password=$_POST[['password'];
Try this:
<?php

        if (isset($_POST['register'])){
            if ((empty($_POST['email'])) &&
                (empty($_POST['username'])) &&
                (empty($_POST['password'])) &&
                (empty($_POST['re-enter'])) &&
                (empty($_POST['title'])) &&
                (empty($_POST['first name'])) &&
                (empty($_POST['second name'])) &&
                (empty($_POST['address'])) &&
                (empty($_POST['postcode'])) &&
                (empty($_POST['contactnumber']))){
                    $email=$_POST['email'];
                    $username=$_POST['username'];
                    $password=$_POST['password'];
                    $reenter=$_POST['re-enter'];
                    $title=$_POST['title'];
                    $firstname=$_POST['firstname'];
                    $secondname=$_POST['secondname'];
                    $address=$_POST['address'];
                    $postcode=$_POST['postcode'];
                    $contactnum=$_POST['contactnumber'];
                    if ($password == $reenter) {
                        $conn = mysqli_connect('127.0.0.1', 'i7266***', 'Winter****', 'i72*****');
                        $emailquery = "SELECT * FROM UserTable WHERE email = '$email'";
                        $r = mysqli_query($conn, $emailquery);
                        $count = mysqli_num_rows($r);
                            if ($count == 1) {
                                echo "Email already exists";
                            } else {
                                $query = "INSERT INTO UserTable VALUES ('$username', '$password', '$email', '$title', '$firstname', '$secondname', '$address', '$postcode', '$contactnum')";
                                $run = mysqli_query($conn, $query);
                                echo "Customer account has been created";
                            }
                    } else {
                    echo "Passwords did not match";
                    }
            } else {
                echo "please enter your details to register";
                }

        }else {
            echo "Please enter details to register";
            }

    ?>
    <form method="POST" action="">
    Email:
    <input type="email" name="email">

    Username:
    <input type="text" name="username">

    Password:
    <input type="password" name="password">

    Re-enter password:
    <input type="password" name="re-enter">

    Title:
    <input type="text" name="title">

    First name:
    <input type="text" name="firstname">

    Second name:
    <input type="text" name="secondname">

    Address
    <input type="text" name="address">

    Postcode:
    <input type="text" name="postcode">

    Contact number
    <input type="number" name="contactnumber">

    <input type="submit" name="register" value="Register">

Hope works for you.
The syntax are fine now but the logic is wrong, as @Niet the Dark Absol says: You are processing the form only if ALL of them ARE empty.


text:
Q: Javascript date acting strange Why does this give me september 30 rather than oct 1?

var dob = new Date("1999-10-01")
console.log(dob.toString())

A: You are creating a Date new Date("1999-10-01") and parsing it with the method toString() which is using your local timezone:

var dob = new Date("1999-10-01")

console.log(dob)
console.log(dob.toISOString())

console.log('My local time is different!')
console.log(dob.toLocaleString('es-AR', { timeZone: 'America/Buenos_Aires', timeZoneName: 'long'}))

console.log('Your local time is different?')
console.log(dob.toString())

A: The format you are using is a subset of ISO 8601
When no timezone designator is specified offset Zulu (UTC) is implied in the date constructor.
http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15

All numbers must be base 10. If the MM or DD fields are absent "01" is
  used as the value. If the HH, mm, or ss fields are absent "00" is used
  as the value and the value of an absent sss field is "000". The value
  of an absent time zone offset is "Z".

In other words, the format that you are using is valid and it denotes a date-time in UTC. What you are seeing in the console is that time represented in your timezone.

const date = new Date("1999-10-01");

console.log(date.toLocaleDateString('ar-EG'));
console.log(date.toString());
console.log(date.toISOString());


text:
Q: VS Code: "Unexpected end of JSON input" error when changing the default org When clicking the "Change Default Org" button in the VS Code status bar, rather than seeing a list of the orgs I was authorised against, I was seeing an error:
Unexpected end of JSON input

A: When checking the JSON files for the authorised orgs (on MacOS, this is in the ~/.sfdx directory), I noticed one of them was zero bytes. When that was deleted, everything was back working as normal.


text:
Q: Why not a simple division in this case? n represents total number of persons.
max represents the maximum number of persons by department.
To know the accepted number of persons by department, I would do:
personsPerDepartment = n / max

However, I read on a programming book:
personsPerDepartment = (n + (max - 1)) / max

I don't figure out what this formula means.
Is it a tip to round the result?
Indeed, it would be equals to:
n / max + (max - 1) / max  =  n / max + ~1

Any idea?

A: When using integer division, the formula (n + (max - 1)) / max is equivalent to $\Big\lceil\frac{n}{\max}\Big\rceil$.
These brackets mean ceiling, or in your words: "it is a tip to round the result upwards".

A: It is not immediately clear what you're trying to do here, but I suppose it is something like

If you have to distribute $n$ persons across departments, and each department can take at most $\mathit{max}$ of them, then how many departments do you need to involve?

Suppose you have $n=5$ and $\mathit{max}=4$. Obviously you need two departments for that. However if you simply divide $5$ by $4$, you get $1.25$, which is a quite strange number of departments.
So what you want to do is round the result of the division upwards to the nearest integer if it is not already an integer.
Most programming languages don't do that when you divide two integers and the result doesn't come out even. Instead they round down (actually, towards $0$). The alternative calculation
$$ (a+b-1)/b $$
is just a common trick to get the round-UP behavior when dividing $a$ by $b$, when all you have is a division operator that rounds down, without involving floating point which is seen as inefficient.
Adding $b-1$ to the numerator will change the numbers in the interval $5
\ldots 8$ (which are the ones you want to produce 2 departments) into the interval $8\ldots 11$ (which are what actually produce a result of $2$ departments with the division operator you have to work with). And similarly for all of the other possible intervals.


text:
Q: Django All-Auth Role Based Signup Having read many stack overflow questions, tutorials etc on all-auth I keep getting the impression that it only supports the registration of one type of user per project.
I have two usecases

*

*A business user authenticates and registers his business in one step.

*A developer user authenticates and just fills in the name of his employer (software company).
I do not want the developer to see the business fields when he signs up. i.e his signup form is different.
If, in fact signup should be common and the user specific details should be left to a redirect, how to accomplish this from social auth depending on user type?

A: @pennersr was kind enough to answer this on the allauth github page:

This truly all depends on how you model things, there is nothing in
  allauth that blocks you from implementing the above.
One way of looking at things is that the signup form is not different
  at all. It merely contains an additional switch that indicates the
  type of user account that is to be created. Then, it is merely a
  matter of visualizing things properly, if you select type=employer,
  then show a different set of fields compared to signing up using
  type=developer.
If you don't want such a switch in your form, then you can store the
  type of account being created somewhere in the session, and refer to
  that when populating the account.


text:
Q: How do I get the name of the current connected bluetooth device? I would like to make my android app detect if a Bluetooth headset (either by name or mac address) is connected and then run code based on whether it is connected or not. The problem is I've been hitting a brick wall in regards to how to get the name/mac address of the currently connected Bluetooth headset.
The following code simply gives me the hostname of the Android device:
  BA = BluetoothAdapter.getDefaultAdapter();
  String name = BA.getName();

When I used "getBondedDevices()", it usually just gives me the devices that the phone has been paired to, but not actually what is connected at the moment. In other words, it gives me the list of previously paired devices, but not the actual connected device.
I have no clue as to what I'm doing because this is the first time dealing with Bluetooth devices and the Google's developer site is great about telling what BluetoothDevice is capable of, but not necessarily of examples of how to use it.
So can someone please give me some helpful code that could get the name/mac address of the current connected bluetooth handset.
   Thanks in advance for any and all help

A: Once you re making a bluetooth connection that time you can save the connected device information(name and address) in shared preferences and get it when you want to get connected device info.


text:
Q: Remove a grid line created from custom ticks in a plot In first place, sorry for my English, and in the second place, sorry for my code skills.
All I want is to remove a grid line that is created automatically from my custom xticks and yticks lists. I need to notify a point in the plot and I have spent over 2 hours reading all kind of solutions that exceeds my knowledge by far. No solution I found yet.
[![The plot][1]][1]
All I did is create custom ticks for Y and X axis:
ticks_x=[0.2,Vc,0.4,0.6,0.8,1,1.2]
ticks_y=[-50,0,Pc,50,100,150,200]
xticks(ticks_x)
yticks(ticks_y)
grid(lw=0.2,color="k")

Could someone help me, please? Thanks a lot.

A: Solved! The key was to read slowly and try to do the same method in my code as it is shown here:
How to remove a particular grid line corresponding to a custom xtick on a log scale axis?
I managed to solve it by making a custom grid this way:
ticks_x=[0.2,Vc,0.4,0.6,0.8,1,1.2]
ticks_y=[-50,0,Pc,50,100,150,200]
xticks(ticks_x)
yticks(ticks_y)

for x1 in ticks_x:
    if x1!= Vc:
        axvline(x=x1, color = 'k', linestyle = '-', linewidth = 0.2)

for y1 in ticks_y:
    if y1!= Pc:
        axhline(y=y1, color = 'k', linestyle = '-', linewidth = 0.2)


text:
Q: How is my firewall making all websites look like a login page In the morning this question came across my mind. You would notice my poor knowledge on firewalls.
My office installed a new firewall. I am provided a new username and a password. And here we have a login interface. I've searched browser's cookies, HTTP headers and everything, But I cannot figure out where is this login interface hosted. All I can see is www.google.com in address bar of the browser. Whichever site i tried to access, (without having logged in through the firewall) I found this kind of URL www.google.com/abcd/ww/..
Previously we had a known firewall... And  t was obvious through the URL https://10.66.28.5:4100/wgcgi.cgi So I knew whats the technology behind that.
But this new One is troubling me. I cannot even guess how this one works. Could You please explain?

A: It looks like the new 'firewall' is doing more than just being a firewall.  Until you log in it is intercepting and directly answering all web requests with a page of its choosing so that all websites look like they are the login page.
Many internet cafe's and hotels wifi hotspots operate like this, so you can connect to their network for free but not receive internet until you are authorised.
As for general info about firewalls try this wikipedia article
A place to start looking for info on how your new system works try

*

*https://en.wikipedia.org/wiki/Captive_portal (thanks tombull89 for jogging my memory on the name of this).  This is exactly what I think is on your network and causing all websites to be the login page.

*https://stackoverflow.com/questions/11041682/setting-up-a-login-page-for-wireless-hotspot as it sounds like your system is doing something similar.

As for actually inspecting what the system is, before you login try doing what this page says to view the http headers
https://stackoverflow.com/questions/4423061/view-http-headers-in-google-chrome and google some of the phrases contained in the header that look to be different to normal websites.


text:
Q: Computing the genus of $y^2z=x^3$ using differentials In Vakil's Foundations of Algebraic Geometry, example 21.2.7 he takes the curve $y^2=x^3-x$ in $\Bbb{A}_k^2$ (with $\text{char}(k)\neq 2$) and defining $A:=k[x,y]/(y^2-x^3+x)$ he shows that $\widetilde{\Omega}_{A|k}$ is an invertible sheaf.
He writes $2ydy=3x^2dx$ and notices that $\Omega_{A|k}$ is generated by $dx$ when $y\neq 0$ and generated by $dy$ when $3x^2-1\neq 0$. Since $\{y\neq 0\}$ and $\{3x^2-1\neq 0\}$ cover the whole curve, that's enough.
It's nice to look at things this way and I wonder if I could do something like that for different purposes.
For example, could I find the geometric genus $p_g=\dim H^0(X,\Omega_{X|k})$ for a given projective curve $X\subset \Bbb{P}^2$?
I tried to take the curve $y^2z=x^3$ in $\Bbb{P}^2_{(x:y:z)}$. Taking each affine chart, we have:
\begin{align*}
z=1&:\,\,2y=3x^2dx\\
y=1&:\,\,dz=3x^2dx\\
x=1&:\,\,2yzdy+y^2dz=0
\end{align*}
I was expecting to find $p_g=0$ (since a singular plane cubic is rational), but I don't know how to see that by the equations above.


text:
Q: Upgrading to Ubuntu 18.04 LTS from an ISO image installed on a USB drive Hello everyone,
Hope you are all doing well.
Here I'm facieng some technical issues.

*

*I can't upgrade my system from terminal or from software updater due to unsolved problems in question: here.

*And now I can't access my user account in Ubuntu and the screen showed me nothing (just a blank) after entering my password successfully, and that's happend due to some failing tryouts to install and run OpenVPN in the system.

*I have dual boot (windows 10 and ubuntu 16.04.3 LTS).

*I don't want to lose any of my data on both systems.

And the big question is: is there any possibility to upgrade my Ubuntu 16.04 LTS to Ubuntu 18.04 LTS using my bootable USB flash drive without loosing any of my data or my Windows 10 or the dualboot system?
Kindly your feedback ASAP.
Your cooperation is highly appreciated.


text:
Q: Django admin raw_id_fields - 404 on admin/js/related-widget-wrapper.js I'm trying to use the admin raw_id_fields in my application and it works locally, but in production I get a 404 on admin/js/related-widget-wrapper.js.
I checked the folder (static/admin/js) and the file is there but, for some reason, I can't access it (when I try directly with the URL on browser, it shows the 404 error page).
Due to this error, it's not showing the search icon.
The django version is 1.8.2 and I use Nginx, gunicorn and HTTPS in production server.


text:
Q: How can I concatenate three layers in a Keras sequential model? I would like to concatenate three layers in my Keras sequential model. Is there a way to do so? I would like to concatenate them along axis=2.
Here is how the model summary looks like for now.
Here is the code.
model = Sequential()
model.add(keras.layers.InputLayer(input_shape=(seq_len, n_inputs)))
model.add(keras.layers.Conv1D(input_shape=(None, n_inputs,seq_len), filters=N_CONV_A, padding='same',kernel_size=F_CONV_A, strides=1, activation='relu'))
model.add(keras.layers.Conv1D(input_shape=(None, n_inputs,seq_len), filters=N_CONV_B, padding='same',kernel_size=F_CONV_B, strides=1, activation='relu'))
model.add(keras.layers.Conv1D(input_shape=(None, n_inputs,seq_len), filters=N_CONV_C, padding='same',kernel_size=F_CONV_C, strides=1, activation='relu'))

A: A sequential model cannot manage concatenation because the layers that are concatenated are computed in parallel with respect to its input.
In a sequential model the output of a layer becomes the input of the next layer, while the concatenation requires to use the same input for many layers.
In this situation you should use the Functional API or Model subclassing.
For example using the functional API the code becomes
inputs = keras.layers.Input(shape=(n_inputs, seq_len))
convA = keras.layers.Conv1D(input_shape=(None, n_inputs, seq_len),filters=N_CONV_A, padding='same',kernel_size=F_CONV_A, strides=1, activation='relu')
convB = keras.layers.Conv1D(input_shape=(None, n_inputs, seq_len),filters=N_CONV_B, padding='same',kernel_size=F_CONV_B, strides=1, activation='relu')
convC = keras.layers.Conv1D(input_shape=(None, n_inputs, seq_len),filters=N_CONV_C, padding='same',kernel_size=F_CONV_C, strides=1, activation='relu')
concat = keras.layers.Concatenate(axis=-1)
out = concat([convA(inputs), convB(inputs), convC(inputs)])

Attention: input_shape in the your code is not consistent with the expected ones.


text:
Q: Asymptotic for binary linear code Let $C=[n,k,d]$ is a binary linear code of length $n$, dimension $k$, and minimum distance $d$. Let us consider all possible binary linear codes with $k=d$ and $n\in \mathbb N$. Is it true that
$$A=\mathop{\lim }\limits_{k\to \infty } \frac{k}{n}=0\ ?$$
I look codetables.de and this assumption looks plausible. Are suitable boundaries or hypotheses known?

A: The Gilbert Varshamov bound shows the existence of a binary linear code of dimension $$k\geq n-\lfloor \log_2 V(n,d-1)\rfloor,$$
where $V(n,r)$ is the volume of the hamming sphere in the $n$ dimensional hypercube.
Let $d=k$, and find the maximal $k$ satisfying this equation, for each $n$. Along a subsequence of integers, something like the existence of codes with parameters
$$
[Ak_i,k_i,k_i]
$$
with $A=5,$ should hold.
More generally, let $n\rightarrow \infty$ and use the fact that for each $n$ the binomial coefficients $\binom{n}{k},$ are superincreasing in $k$ up to about $k<n/3,$ and the approximation
$$
V(n,k-1)\approx \binom{n}{k} \approx 2^{n (h(k/n)+o(1))},
$$
where $h$ is binary Shannon entropy (see here) to conclude that the solution $\theta=0.227\cdots$ to
$$
1-\theta=h(\theta)
$$
where $\theta=k/n,$ means that asymptotically there is a sequence of codes with parameters $[Ak,k,k]$ and $A=1/\theta.$


text:
Q: SPSS: generate 'fake' survey data using rv.uniform without losing value labels I have a pretty straightforward survey dataset. Each row is a respondent, and each column is a question. Responses have a value that is a whole number, and each number has a label.
Now, I need to replace all of those values with fake data to use in a training. I need something that looks and feels like the original dataset, but isn't actually client data.
I started by replacing my variables with random number values:
COMPUTE Q1=RV.UNIFORM(1,2).
EXECUTE.

COMPUTE Q2=RV.UNIFORM(1,36).
EXECUTE.

COMPUTE Q3=RV.NORMAL(50, 13).
EXECUTE.

(rv.normal/rv.uniform depending on what kind of data I'm trying to fake - age versus multiple-choice question, for example).
This works, but then when I try and generate crosstabs, export the dataset w value labels, etc., the labels aren't applied to the columns with fake data. As far as I can tell, my fake numbers are in the exact same format they were in before - numeric, no decimals, width of 2, nominal. The labels still appear in the variable view, but they aren't actually being applied.
I'd really prefer not to have to manually re-label every one of these columns, because there's quite a few of them. Any ideas for how to get around this issue? Or is there a smarter way to generate fake data?

A: Your problem is the RV.UNIFORM and the RV.NORMAL functions do not generate integers - they generate decimal numbers. You may have your display hide the decimal numbers by having 0 decimals in the variable view, but they are still there (you can check this by adding decimals in the variable view).
So you neen another step of turning your decimals into integers. For example, the following are two ways to get a random 1 or 2 (integers):
COMPUTE Q1=rnd(RV.UNIFORM(1,2)).

or
COMPUTE Q1=trunc(RV.UNIFORM(1,3)).

Once the numbers generated are integers corresponding to the value labels definition, you should be able to see the labels in the output.


text:
Q: Lightbox isn't working properly I'm currently trying to implement lightbox onto my website, but I cannot get it to work, I don't think there is anything conflicting with it, and I have placed all of the files in the correct locations and linked them how it tells you to on the lightbox 2 website. (http://lokeshdhakar.com/projects/lightbox2/)
Just to double check:

<link href="css/lightbox.css" rel="stylesheet">

is in the head tags,

Is at the bottom of the page, just before the closing body tag.
lightbox.css is in the css directory
   lightbox.js is in the js directory

and above is what all of my image tags look like.
I'm unsure why it isn't working. I have the files uploaded to a server, and it doesn't work on there either.
Thanks in advance

A: The problem is that you're using an img tag, and they explicity say to use an anchor a one.
For me, it's working like a charm:

<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.8.1/css/lightbox.min.css" rel="stylesheet" />

    Cute baby panda

    Another

    Last one

A: The documentation says to use  (anchor tag) to trigger the lightbox.


text:
Q: Use single quote or double quote for strings in EL <ui:repeat value="#{coreGridBean.heroBeanList}" var="hero"
    offset="0" step="1" size="#{hero.size}" varStatus="status">

        #{status.index}
        #{hero.id}
        #{hero.race}
        #{hero.name}

</ui:repeat>

I wonder whether the usage of class="#{status.even ? 'evenColumn' : 'oddColumn'}" is correct.
I feel a bit guilty of using single quotes instead of double quotes. But in this case, double quote fails, single quote wins.

A: It's perfectly fine. It's also the convention I use: single quotes for strings in EL. It's not only better readable, but it's also friendly for syntax highlighting.
Using double quotes is valid, but harder to interpret when nested in a HTML attribute which is by itself also double quoted.


text:
Q: How to replace escape character with a string I am trying to  replace escape character with a string but the query is giving me an irrelevant result
eg- char- '\'  replace with 'adfc' with below query
SELECT REPLACE("abcdefgh\i","\\", "adfc" );

output - abcdefghi
Desired output - abcdefghadfci
How can i achieve this in mysql?

A: in your my.ini add this line:
sql-mode="NO_BACKSLASH_ESCAPES"

then restart your mysql server, and replace your query with this:
SELECT REPLACE("abcdefgh\i","\", "adfc" );

reference here

A: use this:
SELECT REPLACE("abcdefgh\\i","\\", "adfc" );

single escape character will automatically escape character, so you need to put double escape character for remove escape character.


text:
Q: Why might debian become unresponsive with virtually 0% CPU usage? We have a problem with one of our (virtual) Debian servers failing in a strange way.  The server will stop responding to to the network (no SSH, no Ping response, no app response).  The only way we can gain access is through the virtual-host providers console login (which simulates keyboard access).  During this time the CPU usage is practically 0% (In fact I can see when it happened from the CPU usage graph - it goes from it's normal ~5% usage to 0%.)
This has happened a few times now seemingly randomly, and the server never experiences high load.  We are running Debian Squeeze.
I've ruled out problems with the virtual machines' physical host (we've moved to a different physical host, and are still seeing this problem).
Does anyone have any ideas about how to diagnose this problem?
Thanks