text:
Q: Two almost identical php mail scripts. One goes to junk, and the other doesn't I have two almost identical mail scripts which sends a user a confirmation email after he has completed an order. The first one pasted below goes straight to outlook's junk e-mail folder while the second one goes straight to inbox as it is supposed to. I've been tearing my hair out because of this and I can't see anything that should send the first one to the junk folder.
1: The script that goes straight to junk
$to  = $epost . ', ';
$to .= 'mail@mail.mail';
$subject = 'Ny bestilling fra url.com';
$headers = "From: mail@mail.mail\n";
$headers .= "Reply-To: mail@mail.mail\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$message = '
Ordrebekreftelse url.com

Ordre ID: '.$ordre_id.'

Takk for din bestilling. Oblatene vil normalt leveres innen 1-3 dager.

Nedenfor vil du se hva din bestilling inneholder:

Oblater: '.$antall_oblat.' stk.

Følgende rekvisita er valgt:

Futteral: '.$antall_futteral.' stk.

Plastlommer: '.$antall_reflekslomme.' stk.

Lanyards: '.$antall_lanyard.' stk.

Dersom du har spørsmål eller har bestilt feil, vennligst send oss en e-post med ordre IDen som emnefelt.';

2: The script that goes straight to inbox as supposed.
$to  = $epost . ', ';
$to .= 'mail@mail.mail';
$subject = 'Ny bestilling fra url.com';
$headers = "From: mail@mail.mail\n";
$headers .= "Reply-To: mail@mail.mail\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$message = '
Ordrebekreftelse url.com

Ordre ID: '.$ordre_id.'

Takk for din bestilling. Kortene er sendt til produksjon og vil leveres innen 1 - 3 dager etter at godkjente filer er mottatt.

Nedenfor vil du se hva din bestilling inneholder:

Korttype: '.$korttype.' (1 = Uten magnetstripe, 2 = Magnetstripe, 3 = Mifare/berøringsfritt med magnetstripe)

Med de bestilte kortene følger det samme antall oblater med gyldighet for gjeldene periode.

Følgende rekvisita er valgt:

Futteral: '.$antall_futteral.' stk.

Plastlommer: '.$antall_reflekslomme.' stk.

Lanyards: '.$antall_lanyard.' stk.

Dersom du har spørsmål eller har bestilt feil, vennligst send oss en e-post med ordre IDen som emnefelt.';

A: The only major difference I see is that the Content-type differs, the first one is text/plain the second one text/html. Try to change the first one.
If that doesn't solve it you have something in the printed variables that gets recognised as spam.

A: In your first email you have HTML even though your header says that it is text/plain get rid of the HTML in text/plain as it will not be displayed anyways in user's email boxes.

A: The email is being rejected because the email client/receiving server is set to drop html emails. In most antispam software html type emails get higher probability of being spam


text:
Q: Excel 2016 conditional statement in combination with an OR? Is it possible to combine a conditional statement w/ BOOLEAN OR, like:
=IF(x=1 OR 2) do x o/w do y
?

A: Yes, you can use this syntax
=IF(OR(A1=1,A1=2),TRUE,FALSE)
or.....
=IF(OR(A1={1,2}),TRUE,FALSE)
replace TRUE and FALSE with the required outcomes

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use multiple options for dropdown select value in Rails? <%= f.collection_select :sportist_id, Sportist.order("CREATED_AT DESC"),:id,:name, include_blank: true %>
I'd like to be able to select a sportist by name AND surname, but as far as I can figure out, only one option for the dropdown value can persist. Is it possible to somehow combine :name + :surname so that they work?

A: You could create a full_name attribute in your model class:
def full_name
  "#{first_name} #{last_name}".strip
end

and use it in your select:
<%= f.collection_select :sportist_id, Sportist.order("CREATED_AT DESC"),:id,:full_name, include_blank: true %>


text:
Q: Arduino callback stops working when there is a new connection to MQTT broker First time posting on here, I am hoping somebody will be able to give me some help with an annoying problem I a having.
I am trying to control an Arduino through MQTT with websockets this all works fine until a new connection to the broker is made, the Arduino then does not respond to the callbacks.
    #include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>

// Update these with values suitable for your network.
byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 123);
const char* server = "192.168.0.30";
char message_buff[100];

// defines and variable for sensor/control mode
#define MODE_OFF    0  // not sensing light, LED off
#define MODE_ON     1  // not sensing light, LED on
#define MODE_SENSE  2  // sensing light, LED controlled by software
int senseMode = 0;
unsigned long time;

EthernetClient ethClient;
PubSubClient mqttClient(ethClient);
void callback(char* topic, byte* payload, unsigned int length) {
  int i = 0;
  for (int i=0;i<length;i++) {
   message_buff[i] = payload[i];
  }

   String msgString = String(message_buff);
   Serial.println("Payload: " + msgString);
  if (msgString.equals("onn")){
      senseMode = MODE_ON;

    }else if(msgString.equals("off")){
     senseMode = MODE_OFF;

    }

}
void reconnect() {
  // Loop until we're reconnected
  while (!mqttClient.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (mqttClient.connect("arduinoClient")) {
      Serial.println("connected");
      // Once connected, publish an announcement...
      mqttClient.publish("test","AR1 Connected");
      // ... and resubscribe
      mqttClient.subscribe("test");
    } else {
      Serial.print("failed, rc=");

      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void setup()
{
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  mqttClient.setServer(server, 1883);
  mqttClient.setCallback(callback);

  Ethernet.begin(mac, ip);
  // Allow the hardware to sort itself out
  delay(1500);

}

void loop()
{
  if (!mqttClient.connected()) {
    reconnect();
  }
    switch (senseMode) {
    case MODE_OFF:
      // light should be off
      digitalWrite(7, LOW);
      break;
    case MODE_ON:
      // light should be on
      digitalWrite(7, HIGH);
      break;
    }
  mqttClient.loop();
}

Outputs:
Attempting MQTT connection...failed, rc= try again in 5 seconds
Attempting MQTT connection...connected
Payload: onn
Payload: off
Payload: JTPA.CONNECTED
Payload: onnA.CONNECTED
Payload: offA.CONNECTED

Any help would be much appreciated.
Thanks.

A: As thrashed out in the comments the problem here is that you are using the same MQTT client ID for all instances. This will not work as every client needs a unique id and the broker will disconnect duplicates.
You need a way to generate a unique id, this question on the Arduino site has some hints on how to do this.


text:
Q: How do I change the output in the debugger for a class? The ToString() method for a class outputs the class information in the debugger but it has the unfortunate side effect of changing the output for the User Interface (UI).  Is there an attribute that can be specified on the class?

A: Use the attribute DebuggerDisplay
[DebuggerDisplay("AnyString: {MyVar}")]

This code will have the debugger for your class display:

AnyString: 12

where MyVar has been assigned the value 12.


text:
Q: Not able to find juju charm mysql root password? I tried to follow the steps mentioned in mysql charm:
$ juju ssh <unit> mysql -u root -p
enter root password:

/var/lib/juju/mysql.passwd
But after installing mysql charm, /var/lib/juju/mysql.passwd file was not there.
Kindly help locating mysql root password.

A: It appears that the mysql.passwd file was moved to /var/lib/mysql/mysql.passwd but the README was not updated. I've submitted a patch to the charm to update the README. However, you should be able to juju ssh mysql/0 and cat /var/lib/mysql/mysql.passwd to get the current MySQL root password.

A: From the juju controller run the following command to get all mysql passwords
juju run --unit mysql/0 leader-get


text:
Q: Trace externally loaded XML data in Flash How do I trace all of the data from an XML file that was loaded into a flash file?  I am trying to debug, and part of my flash file gets updated from the XML file, but the other half acts like it isn't there.

A: External XML files are loaded with the URLLoader:
var loader:URLLoader = new URLLoader(new URLRequest("exteranl.xml"));
loader.addEventListener(Event.COMPLETE, onComplete);

function onComplete(event:Event):void
{
    externalXMLdata = new XML(event.target.data);
    trace(externalXMLdata.toXMLString());
}

A: I agree, you don't need to convert the XML to a string to trace it, that's just an extra step.


text:
Q: Why can I not copy a 4GB file to a brand new 32GB USB 3.0 Flash Drive? I was given a new 32GB USB 3.0 Flash Drive for Christmas. I have just downloaded a 4k version of a movie that is 4.53GB and I am trying to copy that file to the USB stick however whenever I try my laptop shows me a message saying the file is too large for my USB drive. However that is plainly not the case as it has 28.6GB free and should leave me with over 24GB after copying.
I am not sure what is using up the first 4GB on the drive as the existing SanSecureAccess folder and files are only 10MB or so. Therefore something hidden is using up the best part of 3GB on a brand new USB stick I have just popped out the wrapper. What I don't know but even so with 28GB I should be able to copy the file to my USB.
Is there some sort of limit on the size of a file you can "copy" and then "paste" from a folder to another drive in Windows or something, as that is the only thing I can think of as there is plenty of room so unless there is a process preventing the copy n paste I don't know what is going on.
I have had this issue many times before with files that are over a GB or so, when I have tried to copy them to USB sticks with plenty of space however the PC always shows me a message saying the file is too big for the USB drive when it isn't. However this is brand new USB stick just opened and nothing else has been copied to it.
I don't know if it's an issue with my PC, the file or the USB. I have got a new HP laptop for XMAS so I could try copying it once I have set that new laptop up but I am not sure why I would get issues on my current HP 64bit, laptop anyway.
Here is a screenshot of the folder, the message, and you can see how much space is on the drive as it's brand new.
Any help would be appreciated as I have no clue to why something that is only 4.5GB is too large for a 32GB drive.

A: Try to format your usb flash drive and you will see a choice of system file change it into NTFS
look like this

for USB Flash Drive ussualy the default setting was FAT32, there will be 2 option NTFS and FAT32, choose the Ntfs :)


text:
Q: Validate (and Query) XmlElement Content without OuterXML? I have a Web Method (within a SOAP Web Service) with a signature of:
public msgResponse myWebMethod([XmlAnyElement] XmlElement msgRequest)

I chose to use the XmlElement parameter after reading that it would allow me to perform my own XSD validation on the parameter.  The problem is that the parameter can be quite large (up to 80Mb of XML) so calling XmlElement.OuterXML() as suggested in the link isn't a very practical method.
Is there another way to validate the XmlElement object against an XSD?
More generally, is this an inappropriate approach for implementing a web service expecting large amounts of XML?  I've come across some hints at using SoapExtensions for gaining access to the input stream directly but am not sure this is the correct approach for my situation.
Note: Unfortunately, I'm chained to an existing WSDL and XSD that I have no power to alter which is why I went with a non-WCF implementation in the first place.

A: Here's a quick example. Just pass your XmlElement to this method:
private static void TheAnswer(IXPathNavigable inputElement)
{
    var schemas = new XmlSchemaSet();
    schemas.Add("http://foo.org/importvalidator.xsd",
                @"..\..\validator.xsd");
    var settings = new XmlReaderSettings
                       {
                           Schemas = schemas,
                           ValidationFlags =
                               XmlSchemaValidationFlags.
                                   ProcessIdentityConstraints |
                               XmlSchemaValidationFlags.
                                   ReportValidationWarnings,
                           ValidationType = ValidationType.Schema
                       };
    settings.ValidationEventHandler +=
        (sender, e) =>
        Console.WriteLine("{0}: {1}", e.Severity, e.Message);
    using (
        XmlReader documentReader =
            inputElement.CreateNavigator().ReadSubtree())
    {
        using (
            XmlReader validatingReader = XmlReader.Create(
                documentReader, settings))
        {
            while (validatingReader.Read())
            {
            }
        }
    }
}


text:
Q: Runtime Error 15 - Type Mismatch for code to change a password in MS Access database I get a Runtime Error 15 on the following line:
MyuserID = Me.txtfirstname.Value from the code below:
Option Compare Database
Option Explicit

Private Sub cmdchange_Click()
    On Error Resume Next
    If Trim(Me.txtnewpass & "") <> Trim(Me.txtconfirmpass & "") Then
    MsgBox "Passwords do not match", vbExclamation + vbOKOnly, ""
    Me.cmdchange.Enabled = False
    Else
    Me.cmdchange.Enabled = True
    Dim rs As DAO.Recordset
    Set rs = CurrentDb.OpenRecordset("Select' From[User Registration Details] where [UserID]=" & MyuserID)
    If Not rs.EOF And Not rs.BOF Then
        rs.Edit
        rs("Password") = txtconfirmpass
        rs.Update
        rs.Close
        Set rs = Nothing
        MsgBox "Your Password has been successfully changed", vbInformation, "Electporl"
        DoCmd.Close acForm, "frmnewpassword", acSaveNo
        DoCmd.OpenForm "frmlogin"
      End If
    End If

Given that I placed the code below on the button that takes the user to the changing password form.
Private Sub cmdproceed_Click()
       If IsNull(Me.txtfirstname) Or Me.txtfirstname = "" Then
       Me.mand1.Visible = True
       Me.txtfirstname.SetFocus
    End If
      If IsNull(Me.txtemail) Or Me.txtemail = "" Then
      Me.mand2.Visible = True
      Me.txtemail.SetFocus
    End If
      Dim rs As Recordset

    Set rs = CurrentDb.OpenRecordset("User Registration Details", dbOpenSnapshot, dbReadOnly)
    rs.FindFirst ("Firstname='" & Nz(Me.txtfirstname, "") & "'")

    If rs.NoMatch = True Then
        Me.lbl1.Visible = True
        Me.txtfirstname.SetFocus
        Exit Sub
    End If

    If rs!Username <> Nz(Me.txtemail, "") Then
        Me.lbl2.Visible = True
        Me.txtemail.SetFocus
        Exit Sub
    End If
    'MyuserID is publicly declared as Long in a module
    MyuserID = Me.txtfirstname.Value
    DoCmd.OpenForm " frmnewpassword"
    DoCmd.Close acForm, Me.Name

End Sub

the second code is assigned to the button that redirects the user to the form that will enable him or her change the password after verifying his or her first name and email.
The second one now is assigned to the button that will help the user change the password by overwriting the old password.

A: Please pass the UserID value in your procedure.
In your cmdproceed_Click() procedure update the following section:
'MyuserID is publicly declared as Long in a module
MyuserID = rs("UserID")

In your cmdchange_Click() procedure update the following line:
 Set rs = CurrentDb.OpenRecordset("Select * From [User Registration Details] where [UserID]=" & MyuserID)

From a logical point of view, you can have others with the same firstname, so doing the filter on the firstname only will introduce unexpected behaviors later in the life cycle of your application.
If you have two or more users with the first name 'Joshua' then your code will always select the first user with that first name. You need to update this logic to select a unique user.


text:
Q: Best kiosk/access control software? My kids have been messing around with my wife's computer. Changing icon file names, removing icons, duplicating icons, removing widgets, deleting bookmarks, etc.
I can't seem to find some sort of software to protect and secure the desktop without being destroyed by my highly active kids.
Your help is appreciated.
EDIT: I have Windows 7 on all machines, mainly for the new Homegroup network feature for reliable file sharing.

A: Create user accounts with limited rights for the kids so they can't do any damage (like uninstalling programs, deleting files, etc.) and make sure accounts with administrative rights are password protected.

A: You probably don't want to totally block them from other aspects of the computer, and limit them to a browser. It sounds like you need a program that can restore any changes made to the system very easily.
For this purpose, I'd highly recommend Faronics DeepFreeze. DeepFreeze can monitor any changes made to the computer, and revert them all with a simple reboot. There is also a free solution from Microsoft called SteadyState which works on XP and Vista.

A: Windows Steady State, After reboot goes back to its "original" state, kept my younger siblings' pc running for years.


text:
Q: Show that the asymptotes of an hyperbola are its tangents at infinity points In the projective plane sense, a (projective) hyperbola is just an elliptic cone in 3D with the projection point as its cone peak $O$, and with the "level plane" (onto which to project) tilted so that it intersects with both halves of the cone, where the projection image on the level plane is a hyperbola curve in the usual sense, as the following image illustrates:

Now I want to show that both the asymptotes of the hyperbola, in the projective plane, intersect the hyperbola (the cone) exactly once, ie they are both tangent to the hyperbola (the cone) at infinity.
I have shown that the cone has exactly two infinity points, both of which has exactly a projective tangent line (a tangent plane to the cone). Where I have trouble is I don't know why these two tangent lines (planes) will exactly project onto the asymptotes on the level plane. Sure, one thing to note that is they both intersect the hyperbola (the cone) exactly once at infinity and nowhere on the "ordinary plane" (the level plane), just as both the asymptotes don't intersect the hyperbola curve on the level plane. The problem is that there are unfortunately many other lines other than the asymptotes that don't intersect the hyperbola on the level plane, and it seems they can't be distinguished in this way.
edit just worked out a perturbation technique that can tell apart asymptotes and other lines that don't intersect the hyperbola, observing that asymptotes, if just perturbed a little bit, will intersect the hyperbola curve, whereas other lines are "stable" under perturbation. So this problem is basically solved, but new approaches are welcome and appreciated too.

A: Here's a different approach. Working in homogeneous coordinates, the equation of a conic can be written as $\mathbf x^TC\mathbf x=0$, where $C$ is a symmetric matrix. Using pole-polar properties it's not too difficult to show that all tangent lines $\mathbf l$ to a conic $C$ satisfy the dual equation $\mathbf l^T C^{-1} \mathbf l=0$ and that the point of tangency is the pole of the line, $C^{-1} \mathbf l$.
Since intersection and tangency are affine properties, w.l.o.g. we need only examine the standard rectangular hyperbola $x^2-y^2=1$. Its matrix is $C=\operatorname{diag}(1,-1,-1)$, which is its own inverse. The asymptotes of this hyperbola are the lines $x\pm y=0$, with corresponding homogeneous vectors $\mathbf l=[1:1:0]$ and $\mathbf m=[1:-1:0]$. We then have for the points of tangency $C^{-1}\mathbf l=[1:-1:0]$ and $C^{-1}\mathbf m=[1:1:0]$, both of which are points at infinity, as posited.
Coming at it from a different direction, the tangents through a point $\mathbf p$ to a nondegenerate conic $C$ are given by the degenerate conic $\mathcal M_{\mathbf p}^T C^{-1} \mathcal M_{\mathbf p}$.† Here, $\mathcal M_{\mathbf p}$ is the "cross-product matrix" of $\mathbf p$, i.e., $\mathcal M_{\mathbf p}\mathbf x = \mathbf p\times \mathbf x$. The tangents to our standard hyperbola through its center—in this case the origin $\mathbf p=[0:0:1]$—are then $$\begin{bmatrix} 0&1&0 \\ -1&0&0 \\ 0&0&0 \end{bmatrix} \begin{bmatrix} 1&0&0 \\ 0&-1&0 \\ 0&0&-1 \end{bmatrix} \begin{bmatrix} 0&-1&0 \\ 1&0&0 \\ 0&0&0 \end{bmatrix} = \begin{bmatrix} -1&0&0 \\ 0&1&0 \\ 0&0&0 \end{bmatrix},$$ which corresponds to the Cartesian equation $x^2-y^2=0$. Factoring this into $(x+y)(x-y)=0$, we find that the hyperbola's asymptotes are the tangents through its center. The points of tangency can then be found as above, or by homogenizing the two equations and solving the resulting system: $$\begin{align} x^2-y^2-w^2 &= 0 \\ x^2-y^2 &= 0 \end{align}$$ with solution $x=\pm y$, $w=0$, i.e., the points with homogeneous coordinates $[1:\pm1:0]$, as above.
Incidentally, all nondegenerate conics are projectively equivalent. Once you've chosen the line at infinity, they can then be distinguished by the number of intersections with this line: zero for ellipses, one for parabolas and two for hyperbolas. The center of a conic (if it has one) is the pole of the line at infinity, so from the above result we can find that the points of tangency of a hyperbola's asymptotes are precisely its intersections with the line at infinity.

†: This is a consequence of the dual conic equation above. A line through two points is given by their cross product, so every point $\mathbf x$ on a tangent through the point $\mathbf p$ satisfies the equation $$(\mathbf p\times \mathbf x)^T C^{-1} (\mathbf p\times\mathbf x) = (\mathcal M_{\mathbf p}\mathbf x)^T C^{-1} (\mathcal M_{\mathbf p}\mathbf x) = \mathbf x(\mathcal M_{\mathbf p}^T C^{-1} \mathcal M_{\mathbf p})\mathbf x = 0.$$


text:
Q: compare two multidimensional arrays of object and set new property true/false pending match on larger set I Have an array of objects example:
Larger Set:
Array(
    [0] stdClass Object(
                        [ID] => 1,
                        [name] => monkey,
                        [sub] => help
                       ),
    [1] stdClass Object(
                        [ID] => 1,
                        [name] => tooth,
                        [sub] => tip
                       ),
    [2] stdClass Object(
                        [ID] => 1,
                        [name] => who,
                        [sub] => knows
                       ),
    )

Smaller Set
Array(
    [0] stdClass Object(
                        [ID] => 1,
                        [name] => monkey,
                        [sub] => help
    )

Desired out come:
Array(
    [0] stdClass Object(
                        [ID] => 1,
                        [name] => monkey,
                        [sub] => help,
                        [selected] => yes
                       ),
    [1] stdClass Object(
                        [ID] => 1,
                        [name] => tooth,
                        [sub] => tip,
                        [selected] => no
                       ),
    [2] stdClass Object(
                        [ID] => 1,
                        [name] => who,
                        [sub] => knows,
                        [selected] => no
                       ),
    )

What I am trying to play with which doesn't seem to be working is
    foreach($result_static as $stock)
    {
        foreach($result_memb as $memb_choice)
        {
            $stock->selected = "false";
            //echo $stock->name .' == '. $memb_choice->name.'<br>';
            if($stock->name == $memb_choice->name)
            {
                $stock->selected = "yes";
            }
        }
        $output[] = $stock;
    }

This doesn't appear to be matching any of the actual results, and from what I gather my foreach logic is off cause either due to it relooping the second loop so many times or the first one withing the other this way, the names from each never match respectively the way I would hope. So I am trying to look for ideas on how to better tackle this, and hopefully something a bit more optimized would be nice, but Ill take what I can get currently.

A: Try This
foreach($result_static as $stock)
    {
        $stock->selected = "false";
        foreach($result_memb as $memb_choice)
        {
            if($stock->name == $memb_choice->name)
            {
                $stock->selected = "yes";
            }
        }
        $output[] = $stock;
    }

A: i was unable to find the bug in your code, maybe it is somewhere else?
I have tried to re-create it, and the following code runs and gives the desired output:
class Item
{
    public $Id;
    public $Name;
    public $Sub;
    public $Selected;

    public function __construct($id, $name, $sub)
    {
        $this->Id = $id;
        $this->Name = $name;
        $this->Sub = $sub;
    }
}

$result_static  = array(
    new Item(1, 'monkey', 'help'),
    new Item(1, 'tooth', 'tip'),
    new Item(1, 'who', 'known')
);

$result_memb  = array(new Item(1, 'monkey', 'help'));

$output = array();

foreach($result_memb  as $memb_choice)
{
    foreach($result_static  as $stock)
    {
        $stock->Selected = "false";

        if($stock->Name == $memb_choice->Name)
        {
            $stock->Selected = "yes";
        }
        $output[] = $stock;
     }
 }

 print_r($output);

This gives the output:
Array
(
    [0] => Item Object
        (
            [Id] => 1
            [Name] => monkey
            [Sub] => help
            [Selected] => yes
        )

    [1] => Item Object
        (
            [Id] => 1
            [Name] => tooth
            [Sub] => tip
            [Selected] => false
        )

    [2] => Item Object
        (
            [Id] => 1
            [Name] => who
            [Sub] => known
            [Selected] => false
        )
)


text:
Q: How to set up a DB2 linked server on a 64-bit SQL Server 2005? I need to create a linked server to a DB2 database on a mainframe. Has anyone done this successfully on a 64-bit version of SQL Server 2005? If so, which provider and settings were used?
It's important that the linked server work whether we are using a Windows authenticated account to login to SQL Server or a SQL Server login. It's also important that both the 4-part name and OPENQUERY query methods are functional. We have one set up on a SQL Server 2000 machine that works well, but it uses a provider that's not available for 64-bit SS 2005.

A: We had this same issue with a production system late last year (sept 2007) and the official word from our Microsoft contact was that they had a 64 bit oledb driver to connect to ASI/DB2 but it was in BETA at the time.
Not sure when it will be out of beta but that was the news as of last year.
We decided to move the production server onto a 32 bit machine since we were not comfortable using beta drivers on production systems.
I know this doesn't answer your question but it hopefully gives you some insight

A: What provider are you using for Sql 2000? I'm pretty sure MS has an x64 OLEDB driver for DB2 (part of Host Integration Server, but available as a separate download). IBM has x64 for .NET and ODBC, and possible OLEDB as well (though it's a PITA to find).
Once you get the linked server setup, I'm pretty sure all of your other requirements would be automatic....

A: From the Sql 2005 February 2007 Feature Pack:

The Microsoft OLE DB Provider for DB2 is a COM component for integrating vital data stored in IBM DB2 databases with new solutions based on Microsoft SQL Server 2005 Enterprise Edition and Developer Edition. SQL Server developers and administrators can use the provider with Integration Services, Analysis Services, Replication, Reporting Services, and Distributed Query Processor. Run the self-extracting download package to create an installation folder. The single setup program will install the provider and tools on x86, x64, and IA64 computers.


text:
Q: Supermicro: New NVMe is not detected properly We have a Supermicro SuperServer 2029U-TN24R4T with currently 8 U.2 NVMe drives (Samsung PM1725a 1.6 TB) running on CentOS 7 with kernel 5.0.10-1.el7.elrepo.x86_64. After adding a new one (PM1725b 1.6 TB), it shows up for a few seconds in /dev (but only the nvme8, not nvme8n1 as one would expect) and then "gets lost". This is reproducible with different SSD trays of the chassis and even with exactly the same drives we currently use (the new one is a newer model). Adding the drive produces the following in the kernel log:
Jul 5 21:54:25 nvme02 kernel: pciehp 10002:02:05.0:pcie204: Slot(37): Card present
Jul 5 21:54:27 nvme02 kernel: pcieport 10002:02:05.0: Data Link Layer Link Active not set in 1000 msec
Jul 5 21:54:27 nvme02 kernel: pciehp 10002:02:05.0:pcie204: Failed to check link status
Jul 5 21:54:31 nvme02 kernel: pciehp 10002:02:08.0:pcie204: Slot(136): Card present
Jul 5 21:54:31 nvme02 kernel: pciehp 10002:02:08.0:pcie204: Slot(136): Link Up
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: no space for [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: failed to assign [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: no space for [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: failed to assign [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pci 10002:07:00.0: BAR 6: assigned [mem 0xc2400000-0xc240ffff pref]
Jul 5 21:54:31 nvme02 kernel: pci 10002:07:00.0: BAR 0: assigned [mem 0xc2410000-0xc2413fff 64bit]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: PCI bridge to [bus 07]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: bridge window [mem 0xc2400000-0xc24fffff]
Jul 5 21:54:31 nvme02 kernel: nvme nvme8: pci function 10002:07:00.0
Jul 5 21:54:31 nvme02 kernel: nvme 10002:07:00.0: enabling device (0000 -> 0002)
Jul 5 21:54:31 nvme02 kernel: pciehp 10002:02:08.0:pcie204: Slot(136): Attention button pressed
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:00:00.0: can't derive routing for PCI INT A
Jul 5 21:54:31 nvme02 kernel: pciehp 10002:02:08.0:pcie204: Slot(136): Powering off due to button press
Jul 5 21:54:31 nvme02 kernel: nvme 10002:07:00.0: PCI INT A: not connected
Jul 5 21:54:31 nvme02 libvirtd: 2019-07-05 19:54:31.593+0000: 15899: error : virPCIDeviceNew:1774 : internal error: dev->name buffer overflow: 10002:07:00.0
Jul 5 21:54:34 nvme02 ipmievd: Unknown sensor ff
Jul 5 21:54:40 nvme02 kernel: nvme nvme8: failed to mark controller CONNECTING
Jul 5 21:54:40 nvme02 kernel: nvme nvme8: Removing after probe failure status: 0
Jul 5 21:54:44 nvme02 ipmievd: Unknown sensor ff

The BIOS is only one version behind and the changelog doesn't say anything about this issue. The IPMI lists the new drive without any problems and the locate function also works properly. I assume that a reboot could help, however the disks must be (and are in general) hot-swappable, although we haven't tested it yet as we didn't have any disk failures. Due to the mentioned behaviour we don't want to pull a productive disk just for testing.
Any ideas would be greatly appreciated.

A: This seems like it would be worth a call to the manufacturer if you suspect hardware.
Can you try this with a more stable kernel revision, or are you bound to that particular OS and kernel combination?

A: Given this
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: no space for [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: failed to assign [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: no space for [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 15: failed to assign [mem size 0x00200000 64bit pref]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: no space for [io size 0x1000]
Jul 5 21:54:31 nvme02 kernel: pcieport 10002:02:08.0: BAR 13: failed to assign [io size 0x1000]

Try adding pci=realloc to your kernel command line.


text:
Q: My website return HTTP error 500 when closed on browser and then re -open IIS 7.5 I used cookies formsauthentication on my mvc 4 project. When I successfully log in to my site,the cookie is stored on the browser as authentication ticket, and then i closed the tab and then i access again my site and returns http 500 error page not found. I have made my cookie authentication persistent on my code. to make my site able to acccess again i go to browser settings and remove the cookies stored and then its ok. how do make site auto remove cookie when tab is closed or when my site is close in browser so that i dont have to remove cookies all the time from my browser. I am using IIS 7.5 Asp.net mvc 4

A: You are getting 500 error because there is something wrong with your server side code.
And for clearing your cookie try this. detail
 <body onunload="deleteAllCookies()">

function deleteAllCookies() {
    var cookies = document.cookie.split(";");

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var eqPos = cookie.indexOf("=");
        var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
        document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
    }
}

A: I figured it out why it returns and error, just because i am using a static variable in my condition on layout page,there are no arguments that supports the condition when the second user happens to access my app.
else if ((RMIS.Models.Global.UserLogName != null && ViewBag.Active == "Main")
{
 @RenderBody()
}

Thanks for the help everyone!


text:
Q: Any way to prevent/disable CTRL + [key] shortcuts in the browser? I know a lot of people will be angry about this being asked but...
I have a game using WebGL and the Pointer Lock API. Due to the nature of a lot of games having 'crouch' on CTRL I was wondering if there was any possible way to stop browser shortcuts like CTRL + S and CTRL + W...
At the moment I'm having to harshly disallow controls to have any CTRL key in them. I have set 'crouch' to C which is also common but I also have ideas about making a MMORPG-style game where you would have several action bars of abilities and a lot of combinations wouldn't be possible due to CTRL not being viable.

A:
Note: In Chrome Ctrl+W is "reserved", use window.onbeforeunload
Note: Chrome requires event.returnValue to be set

In this code document.onkeydown is used for old browsers and window.onbeforeunload is used to Chrome and Firefox
Try this (disable Ctrl+W and Ctrl+S):
window.onbeforeunload = function (e) {
    // Cancel the event
    e.preventDefault();

    // Chrome requires returnValue to be set
    e.returnValue = 'Really want to quit the game?';
};

//Prevent Ctrl+S (and Ctrl+W for old browsers and Edge)
document.onkeydown = function (e) {
    e = e || window.event;//Get event

    if (!e.ctrlKey) return;

    var code = e.which || e.keyCode;//Get key code

    switch (code) {
        case 83://Block Ctrl+S
        case 87://Block Ctrl+W -- Not work in Chrome and new Firefox
            e.preventDefault();
            e.stopPropagation();
            break;
    }
};


text:
Q: how are stored procedure inserted/uploaded into database I have a stored procedure I've created for postgres. The app I'm developing has backend done in node and I've got to upload the stored procedure to our dev server. By upload I just mean to persist that stored procedure in the dev server by executing the CREATE PROCEDURE... .
How is this process usually done? I mean, I could just copy the code and paste it on our dev's pgadmin and that would work. But, creating a migration file for that would also work. Also, executing a CREATE OR REPLACE PROCEDURE raw query inside the code itself would also work.
How is the process of uploading a stored procedure on a postgres running server usually done?

A: There's no definite consensus on this. I've written a console task to do that in a PHP application to apply it, and with hindsight I think that was the wrong choice.
I quite often make other non-structural changes, such as updating or deleting existing records, in a migration, and that is the method I would be inclined to use now.


text:
Q: The Banach spaces $(\mathbb{R^2}, \Vert\cdot\Vert_1)$ and $(\mathbb{R^2}, \Vert\cdot\Vert_{\infty})$ are linearly isometric.(T/F) The Banach spaces $(\mathbb{R^2}, \Vert\cdot\Vert_1)$ and $(\mathbb{R^2}, \Vert\cdot\Vert_{\infty})$ are linearly isometric.(T/F)
i.e $\Vert Tx\Vert_{\infty}=\Vert  x\Vert_{1}$ but after that I can't think , please help.

A: The statement is true.
Let $\ell^1(2) = (\mathbb{R}^2,\|\cdot\|_1)$ and $\ell^\infty(2)=(\mathbb{R}^2,\|\cdot\|_\infty).$
Define $T:\ell^\infty(2) \to \ell^1(2)$ by
$$T \begin{pmatrix}
x \\
y
\end{pmatrix} = \frac{1}{2} \begin{pmatrix}
x-y\\
x+y
\end{pmatrix}.$$
We claim that $T$ is an onto linear isometry.
For any $\begin{pmatrix}
x \\
y
\end{pmatrix} \in \ell^\infty(2),$ we have
$$\left\Vert T \begin{pmatrix}
x \\
y
\end{pmatrix} \right\Vert_1 = \left\Vert\frac{1}{2} \begin{pmatrix}
x-y\\
x+y
\end{pmatrix}\right\Vert_1 = \frac{|x-y| + |x+y|}{2} = \max\{|x|,|y| \} = \left\Vert \begin{pmatrix}
x \\
y
\end{pmatrix} \right\Vert_\infty$$
where the second last identity is standard in any real analysis text.
Therefore, $T$ is an isometry.
Clearly $T$ is linear.
We claim that $S:\ell^1(2)\to\ell^\infty(2)$ given by
$$S\begin{pmatrix}
x \\
y
\end{pmatrix} = \begin{pmatrix}
x+y\\
-x+y
\end{pmatrix}$$ is the inverse of $T.$
Indeed,
$$(S \circ T)\begin{pmatrix}
x \\
y
\end{pmatrix} = S \left[ \frac{1}{2} \begin{pmatrix}
x-y\\
x+y
\end{pmatrix} \right] = \frac{1}{2} \begin{pmatrix}
2x\\
2y
\end{pmatrix} = \begin{pmatrix}
x\\
y
\end{pmatrix}, $$
$$(T \circ S) \begin{pmatrix}
x\\
y
\end{pmatrix} = T \left[ \begin{pmatrix}
x+y\\
-x+y
\end{pmatrix} \right] = \frac{1}{2} \begin{pmatrix}
2x\\
2y
\end{pmatrix} = \begin{pmatrix}
x\\
y
\end{pmatrix}.$$
Therefore, $T$ is a bijection.
Hence, $\ell^\infty(2) \cong \ell^1(2).$


text:
Q: Is it possible to upload a web referral app to the apple store? I want to create a very simple app and upload it to the apple store.
The app works as follow : when you click on the app it will open safari browser with a website URL, after that the app closes.
I heard from some developers that this app won't be approved to the apple store.
Is this true? I don't have a developer account at Apple so I can't check their official guidelines.

A: This will definitely be rejected:

2.12. Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected.
12.3. Apps that are simply web clippings, content aggregators, or a collection of links, may be rejected.

If you want a link to your web site as an application, you don't need to create an app for that. A user can add a link to your web site to their home screen from Safari: http://support.apple.com/kb/TI42


text:
Q: Scala filter and print a class So I have defined here a class:
class CsvEntry(val organisation: String, val yearAndQuartal : String, val medKF:Int, val trueOrFalse: Int, val name: String, val money:String){
  override def toString = s"$organisation, $yearAndQuartal, $medKF, $trueOrFalse, $name, $money"
}

Lets assume the value of "medKF" is wheter 2,4 or 31.
How can I filter all CsvEntries to only give me an output for these where the "medKF" is 2? (with foreach println)?

A: Creating two random entries:
val a = new CsvEntry("s", "11", 12, 0, "asdasd", "1")
val b = new CsvEntry("s", "11", 2, 0, "asdasd", "234,123.23")

Then filter:
List(a,b).withFilter(_.medKF == 2).foreach(println)

To sum those entries:
List(a,b).map(_.medKF).sum

To add the money:
 def moneyToCent(money: String): Long = (money.replace(",","").toDouble*100).toLong
 List(a,b).withFilter(_.medKF == 2).map(x => moneyToCent(x.money)).sum


text:
Q: Weird Wordpress / HTML / CSS Behavior So I'm hoping someone will be able to shed some light on this.  I have a mockup I did in HTML and CSS that allows for a menu treatment.  When you hover over a menu item (represented by a single image), it overlays the image with a slightly transparent div and some text that describes the option (for example an image of a question mark, when hovering over it, an overlay will appear that says "Information" or something to that effect).  This all works perfectly.
I've now imported this exact same HTML and CSS into a php template to use in Wordpress.  The CSS hasn't changed at all and the HTML output looks the same (obviously some of the HTML is dynamically generated by Wordpress but the output in the browser is the same).  However, now when you hover over the image, the div is appearing directly to the right of the image, rather than on top of the image.  Here's the HTML and relevant CSS:
HTML

View the Diary

Woodman Family

Historical Context

About the Project

CSS
#menu {
    width: 41%;
    position: relative;
    float: left;
}

#menu .tab {
    display: inline-block;
    height: 90px;
    width: 23%;
    border-left: 3px solid #ffffff;
    padding-bottom: 12px;
}

#menu .tab img {
    width: 100%;
    height: 100px;
    transition: all .2s ease-in-out;
}

.tab-content {
    top: 0;
    margin: 0 auto;
    max-width: 24%;
    height: 70px;
    padding-top: 30px;
    text-align: center;
    vertical-align: middle;
    position: absolute;
    color: #FFFFFF;
    background-color: rgba(86, 81, 65, .8);
    display: none;
    transition: all 1.2s;
    font-size: 14pt;
}

#menu .tab:hover > .tab-content {
    display: inline-block;
}

My theory is that there must be something in Wordpress that is interfering but I can't find anything via the element inspector in Chrome. Any ideas would be greatly helpful.  I'm completely stumped.


text:
Q: Cannot determine raw type of Enumeration in Slick GetResult extractor I've a lot of GetResult extractors which do convert string values to Enumeration types. This leads to a lot of boilerplate code and so I thought I can write a generic extractor for all Enumeration types.
implicit def stringToEnum[T <: Enumeration : ClassTag] = new GetResult[T#Value] {
  def apply(rs: PositionedResult) = {
    val c = implicitly[ClassTag[T]].runtimeClass
    val enum = c.getField("MODULE$").get(null).asInstanceOf[T]
    val value = rs.nextString()
    enum.toOpt(value).getOrElse(throw new Exception(
      "Unexpected value: " + value + " for enum: " + enum.getClass.getName)
    )
  }
}

The toOpt method converts a string value to an Enumeration value if possible.
implicit class StringToEnum[T <: Enumeration](enum: T) {
  def toOpt(action: String): Option[T#Value] = {
    enum.values.find(_.toString == action)
  }
}

The code compiles fine. But on runtime the Enumeration type is determined as scala.runtime.Nothing and therefore I cannot get a reference to the Enumeration type.
Can someone explain me why the type is scala.runtime.Nothing and not the type of the Enumeration. And is there an other solution to solve this problem.


text:
Q: Gradle Spring Boot project not working in Tomcat as a WAR I have a simple sample application written in Spring Boot using Gradle dependency. It says helloworld on calling localhost:8080/greetings. I packaged it as WAR and deployed it to a Tomcat as a myWebApp.war.
When i call localhost:8080/myWebApp/greetings i get 404. What am i supposed to infer from the below catalina.log
  Sep 17, 2014 1:43:09 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Sep 17, 2014 1:43:09 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive D:\C813507\Tomcat7\apache-tomcat-7.0.54\webapps\cftsample.war
Sep 17, 2014 1:43:09 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\C813507\Tomcat7\apache-tomcat-7.0.54\webapps\cftsample\WEB-INF\lib\tomcat-embed-core-7.0.54.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Sep 17, 2014 1:43:09 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\C813507\Tomcat7\apache-tomcat-7.0.54\webapps\cftsample\WEB-INF\lib\tomcat-embed-el-7.0.54.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Sep 17, 2014 1:43:13 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [138] milliseconds.
Sep 17, 2014 1:43:13 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive D:\C813507\Tomcat7\apache-tomcat-7.0.54\webapps\cftsample.war has finished in 4,385 ms

A: To run a Spring Boot application in a standalone servlet container you need to tell the container how to launch the application. You do so by extending SpringBootServletInitializer and overriding the configure method to provide the configuration classes for your application. This is described in the getting started guide on converting a jar to a war.
You typically end up with a class like this:
@Configuration
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer {

    // Used when launching as an executable jar or war
    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }

    // Used when deploying to a standalone servlet container
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}

A: In my case, the server used java 1.8 and compile with java 11, not working, when compile with java 1.8, it works!!


text:
Q: Make android application run on eclipse emulator using the extracted files from the apk I know how to extract source code and the xml from apk file, after doing that i am left with folders having the source code and xml , my question is , is there any easy way to make those source files run on the eclipse emulator because im really confused as to what goes where. I am struggling to rebuild the code on eclipse. A guidance would be really helpful.
Thank you in advance :)

A: I doubt you extracted source from an APK file. Apart from that, the only way to run android applications is to install their respective APK file on a device / on an emulator.
Even if there would be a way to run applications without previous installation of an APK file (e.g. hacking the file system and putting stuff where it should be), using such a way is highly discouraged.
Also, please note that it is not possible to modify the contents of an APK file after it has been build, since every APK file is digitally signed.


text:
Q: I am getting weird data as a response I am trying to get some details of mail that I have sended using google-api. I am using messageId that I have received after sending email. I am expection the data to be in json format.
Here is the Nodejs code for reading sended mail:
app.post("/readMail", async (req, res)=>{
  let messageId = req.body.messageId;

  try {
    const oAuth2Client = new google.auth.OAuth2(
      properties.GOOGLE_CLIENT_ID,
      properties.GOOGLE_CLIENT_SECRET,
    );

    oAuth2Client.setCredentials({ refresh_token: properties.REFRESH_TOKEN });
    const { token } = await oAuth2Client.getAccessToken();

    const generateConfig = (url, accessToken) => {
      return {
        method: "get",
        url: url,
        headers: {
          Authorization: `Bearer ${accessToken} `,
          "Content-type": "application/json",
        },
      };
    };

    const url = `https://gmail.googleapis.com/gmail/v1/users/Abhisek721@gmail.com/messages/${messageId}`;

    const config = generateConfig(url, token);
    const response = await axios(config);

    let data = await response.data;
    res.json(data);
  } catch (error) {
    res.send(error);
  }
})

And This the response:
"\u001f\ufffd\b\u0000\u0000\u0000\u0000\u0000\u0002\ufffd\ufffdUmo\ufffd:\u0014\ufffd\ufffd_a\ufffdu\ufffds\u0012^\ufffdN\ufffd\u0006\t/a\ufffd2\ufffd\ufffd\ufffdީr\u0012\ufffd\u0018\ufffd8rLB6\ufffd\ufffd_'P\ufffdݱ\ufffd^]\ufffd\ufffd\ufffd\ufffd\ufffd=\ufffd\ufffd\ufffd\u000e\ufffd\n\ufffd*\ufffd\ufffd\ufffd\ufffdu\ufffd:\\75\ufffd]C\ufffdrU\ufffdD\ufffd1\ufffdW4(r0\ufffd\ufffdDj\ufffd%\ufffd\ufffdd\ufffd\u0019\ufffd*\ufffd\ufffdR\ufffdD$\ufffd\ufffd(\u0000:!\"\u0014\ufffd8r\ufffd\ufffd\ufffd!\ufffd8\u0004$Nv!"

I was expecting to get something like json data.


text:
Q: Excel - elegant formula or IF function I'm trying to use Excel to calculate fees, and the fees in question are as follows:
Monthly Gross Income, Fee

*

*$0-$99.9 = 15%

*$100-$199.9 = 14%

*$200-$299.9 = 13%

*etc...

*$1400-$1499.9 = 1%

*$1500 or above = 0%

I can't work out a mathematical formula for taking x (Monthly Gross Income) and outputting y (Fee). Do I need to rely on the IF function here in Excel, and if so, is there a more elegant way to do it than just stacking 15 IF functions inside each other?
Many thanks.

A: With the amount in A1 try,
=MAX(0.15-FLOOR(A1/POWER(10, 4), 0.01), 0)

That produces the associated percentage; multiply by the original value in A1 for the fee.

A: You could try:
=MAX(0,15-INT(A1/100))

If your column is formatted as percentage:
=MAX(0,15-INT(A1/100))/100


text:
Q: Drupal 7: Data not appearing on block's .tpl file after being sent by hook_block_view() I am taking data from a config form and passing it to a .tpl file to display.
I am using hook_block_view() to take the data, put it into an array and send it to the .tpl file.
My code (on .module) is as such:
/**
 * Implements hook_block_info().
 */
function message_block_info() {
  return [
    'message_block' => [
      'info' => t('Message'),
      'cache' => DRUPAL_CACHE_GLOBAL,
    ],
  ];
}

/**
 * Implements hook_theme().
 */
function message_theme() {
  return [
    'message_block' => [
      'template' => 'templates/message-block',
      'variables' => [
        'settings' => NULL,
        'attributes' => [],
      ],
    ],
  ];
}

/**
 * Implements hook_block_view().
 */
function message_block_view($delta = '') {
  if ($delta !== 'message_block') {
    return;
  }

  $config = message_default_settings();

  dpm($config); // <- this shows correct data

  $block['content'] = array(
    '#theme' => 'message_block',
    '#config' => array(
      'message_text' => filter_xss($config['message_text']),
      'message_link' => filter_xss($config['message_link']),
      'message_button_text' => filter_xss($config['message_button_text']),
    ),
  );

  return $block;
}

And on the .tpl file:
   <?php dpm('test'); //<- This works ?>
   <?php dpm($config); //<- This does not work?>

    <?php print $config['message_text']; ?>
    <?php if (!empty($config['message_link']) && !empty($config['alert_button_text'])): ?>
      <a href="<?php print $config['message_link']; ?>" class="button">
        <?php print $config['message_button_text']; ?>

    <?php endif; ?>

I can place a dpm('test'); on the .tpl file and it will appear, so I know that the HTML is rendering. Obviously, I've tried clearing cache, too.
Would anyone know if I've missed a step to get this data appearing?

A: I found I was missing the config array initilisation in hook_theme:
function message_theme() {
  return [
    'message_block' => [
      'template' => 'templates/message-block',
      'variables' => [
        'config' => NULL, //<- Was missing
      ],
    ],
  ];
}


text:
Q: WCF - EndpointNotFoundException, There was no endpoint listening My WCF Service is hosted under Windows Service and in case it is not running when client makes a call to its methods, client gets the EndpointNotFoundException with this message:
There was no endpoint listening...
Is there a way I can check if the WCF service is up and running before making calls to the service methods?
Thank you!

A: Besides just calling it?
You could try pinging it, but that would just tell you that it exists and that its running, not that it's able to accept calls or anything.
UPDATE
To ping the web service you can use the Ping class from System.Net.NetworkInformation.

A: A solution may be to make a 1st 'dummy' call, if that exception is encountered conclude that it's not running.

A: You could expose the service contract as WSDL, if possible. If you can reach the WSDL page, then it's running, otherwise it's not.


text:
Q: how to interpolate string containing capture-group parentheses as regex in Raku? I want to match against a programmatically-constructed regex, containing a number of (.*) capture groups. I have this regex as a string, say
my $rx = "(.*)a(.*)b(.*)"

I would like to interpolate that string as a regex and match for it. The docs tell me <$rx> should do the trick (i.e. interpolate that string as a regex), but it doesn't. Compare the output of a match (in the perl6 REPL):
> 'xaybz' ~~ rx/<$rx>/
「xaybz」

vs the expected/desired output, setting apart the capture groups:
> 'xaybz' ~~ rx/(.*)a(.*)b(.*)/
「xaybz」
 0 => 「x」
 1 => 「y」
 2 => 「z」

Comments
One unappealing way I can do this is to EVAL my regex match (also in the REPL):
> use MONKEY; EVAL "'xaybz' ~~ rx/$rx/";
「xaybz」
 0 => 「x」
 1 => 「y」
 2 => 「z」

So while this does give me a solution, I'm sure there's a string-interpolation trick I'm missing that would obviate the need to rely on EVAL..

A: The problem is that things in <…> don't capture in general.
'xaybz' ~~ / <:Ll> <:Ll> <:Ll> /
# 「xay」

They do capture if the first thing after < is an alphabetic.
my regex foo { (.*)a(.*)b(.*) }

'xaybz' ~~ / <foo> /;
# 「xaybza」
#  foo => 「xaybza」
#   0 => 「x」
#   1 => 「y」
#   2 => 「za」

That also applies if you use <a=…>
'xaybz' ~~ / <rx=$rx> /;
# 「xaybza」
#  rx => 「xaybza」
#   0 => 「x」
#   1 => 「y」
#   2 => 「za」

Of course you can assign it on the outside as well.
'xaybz' ~~ / $<rx> = <$rx> /;
# 「xaybza」
#  rx => 「xaybza」
#   0 => 「x」
#   1 => 「y」
#   2 => 「za」

'xaybz' ~~ / $0 = <$rx> /;
# 「xaybza」
#  0 => 「xaybza」
#   0 => 「x」
#   1 => 「y」
#   2 => 「za」

Note that <…> is a sub-match, so the $0,$1,$2 from the $rx will never be on the top-level.

A: The result of doing the match is being matched when going outside the regex. This will work:
my $rx = '(.*)a(.*)b(.*)';
'xaybz' ~~ rx/$<result>=<$rx>/;
say $<result>;
# OUTPUT: «「xaybz」␤ 0 => 「x」␤ 1 => 「y」␤ 2 => 「z」␤»

Since, by assigning to a Match variable, you're accessing the raw Match, which you can then print. The problem is that <$rx> is, actually, a Match, not a String. So what you're doing is a Regex that matches a Match. Possibly the Match is stringified, and then matched. Which is the closest I can be to explaining the result

A: You could do the following to expose the inner regex result to an outside variable:
my $rx = "(.*)a(.*)b(.*)";
my $result;

'xaybz' ~~ / $<result>=<$rx> {$result = $<result>}/;

say $result;

# OUTPUT:

# 「xaybz」
# 0 => 「x」
# 1 => 「y」
# 2 => 「z」


text:
Q: Start Mysql/Mariadb in Fedora failed failed to start mysql in Fedora 17. I am using root account to run the below commands and selinux is disabled.
service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.

systemctl status mariadb.service
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled)
   Active: failed (Result: exit-code) since Tue 2014-09-23 11:29:32 SGT; 10s ago
  Process: 4251 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 4250 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)
  Process: 4222 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 4250 (code=exited, status=1/FAILURE)

Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: 140923 11:29:32 mysqld_safe WSREP: Running position recovery with --log_error='/var/...er.pid'
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: 140923 11:29:32 mysqld_safe WSREP: Failed to recover position:
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: ''
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Sep 23 11:29:32 acer-4930g systemd[1]: mariadb.service: control process exited, code=exited status=1
Sep 23 11:29:32 acer-4930g systemd[1]: Failed to start MariaDB database server.
Sep 23 11:29:32 acer-4930g systemd[1]: Unit mariadb.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

journalctl -xn
-- Logs begin at Sat 2014-04-26 15:18:22 SGT, end at Tue 2014-09-23 11:29:34 SGT. --
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: 140923 11:29:32 mysqld_safe WSREP: Failed to recover position:
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: ''
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Sep 23 11:29:32 acer-4930g systemd[1]: mariadb.service: control process exited, code=exited status=1
Sep 23 11:29:32 acer-4930g systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Sep 23 11:29:32 acer-4930g systemd[1]: Unit mariadb.service entered failed state.
Sep 23 11:29:34 acer-4930g PackageKit[4204]: daemon quit

getenforce
Permissive

Then I changed ownership of the mariadb log file from root to mysql but still failed:
[root@acer-4930g ~]# ls -ld /var/log/mariadb/
drwxr-x---. 2 mysql mysql 4096 Sep 23 11:02 /var/log/mariadb/
[root@acer-4930g ~]# ls -l /var/log/mariadb/mariadb.log
-rw-rw----. 1 root root 554 Sep 23 11:02 /var/log/mariadb/mariadb.log
[root@acer-4930g ~]# chown -R mysql:mysql /var/log/mariadb -chR
[root@acer-4930g ~]# systemctl restart mariadb.service
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.

[root@acer-4930g ~]# systemctl status mariadb.service
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled)
   Active: failed (Result: exit-code) since Tue 2014-09-23 14:58:09 SGT; 3min 4s ago
  Process: 6890 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 6889 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)
  Process: 6861 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 6889 (code=exited, status=1/FAILURE)

Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:08 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade ...ate it.
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:08 [ERROR] Aria engine is not enabled or did not start. The Aria engine...-tables
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:08 [ERROR] Aborting
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:08  InnoDB: Starting shutdown...
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:09  InnoDB: Shutdown completed; log sequence number 1597945
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:09 [Note] /usr/libexec/mysqld: Shutdown complete'
Sep 23 14:58:09 acer-4930g systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Sep 23 14:58:09 acer-4930g systemd[1]: mariadb.service: control process exited, code=exited status=1
Sep 23 14:58:09 acer-4930g systemd[1]: Failed to start MariaDB database server.
Sep 23 14:58:09 acer-4930g systemd[1]: Unit mariadb.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

A: Permissions?
You're showing the command service mysqld start but are you prefixing that with a sudo? I suspect you do not have permissions to start this service based on the fact that you're getting these "permission denied messages" in the output you've included in your Q.
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: 140923 11:29:32 mysqld_safe WSREP: Failed to recover position:
Sep 23 11:29:32 acer-4930g mysqld_safe[4250]: ''

If you are in fact using sudo then I'd move my attention to the directory & files mentioned in the logs messages above. Focus on this directory/file:
$ ls -ld /var/log/mariadb
$ ls -l /var/log/mariadb/mariadb.log

I found these commands in this AskFedora Q&A titled: mariadb service don't start: permission denied, which should fix your issue:
$ sudo chown mysql:mysql /var/log/mariadb -chR

followed by:
$ sudo systemctl restart mariadb.service && \
    sudo systemctl status mariadb.service

It appears that the MariaDB log files do not allow the user, mysql access to them, the above commands will fix this problem.
DB corrupt?
If you still continue to have problems and are confronted with errors such as:
Sep 23 14:58:09 acer-4930g mysqld_safe[6889]: 140923 14:58:08 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade ...ate it.

You can also confirm now that the permissions problem above has been resolved, in the MariaDB log file for messages like so:
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
FATAL ERROR: Upgrade failed

Either message is basically telling you that there were issues in upgrading your MySQL DB to a Maria DB one. If it's a DB with nothing you care about in it, you can simply move it or remove it. This will require that you first remove the MariaDB package, and then re-install it.
Example
$ sudo yum remove mariadb-server

### To remove
$ sudo rm -rf /usr/lib/mysql

### To move
$ sudo mv /usr/lib/mysql /usr/lib/mysql.orig

$ sudo yum install mariadb-server

NOTE: Source for the above tip: Trouble starting mariadb service.
One thing with the above tip that I cannot confirm, is whether the directory to move/remove is /usr/lib/mysql. or /var/lib/mysql. I'm not sure if that' a typo in that tip or not. So I would do the above with /usr/lib/mysql first and if it doesn't work then repeat the steps but with /var/lib/mysql. I would use the remove method first, if things work OK, then come back and remove the corrupted directory.
NOTE: /var/lib/mysql is where the DB files live, the /usr/lib/mysql directory is where the various plugins live.


text:
Q: A question about axis in tensorflow.stack (tensorflow= 1.14) Using tensorflow.stack what does it mean to have axis=-1 ?
I'm using tensorflow==1.14

A: Using axis=-1 simply means to stack the tensors along the last axis (as per the python list indexing syntax).
Let's take a look at how this looks like using these tensors of shape (2, 2):
>>> x = tf.constant([[1, 2], [3, 4]])
>>> y = tf.constant([[5, 6], [7, 8]])
>>> z = tf.constant([[9, 10], [11, 12]])

The default behavior for tf.stack as described in the documentation is to stack the tensors along the first axis (index 0) resulting in a tensor of shape (3, 2, 2)
>>> tf.stack([x, y, z], axis=0)
<tf.Tensor: shape=(3, 2, 2), dtype=int32, numpy=
array([[[ 1,  2],
        [ 3,  4]],

       [[ 5,  6],
        [ 7,  8]],

       [[ 9, 10],
        [11, 12]]], dtype=int32)>

Using axis=-1, the three tensors are stacked along the last axis instead, resulting in a tensor of shape (2, 2, 3)
>>> tf.stack([x, y, z], axis=-1)
<tf.Tensor: shape=(2, 2, 3), dtype=int32, numpy=
array([[[ 1,  5,  9],
        [ 2,  6, 10]],

       [[ 3,  7, 11],
        [ 4,  8, 12]]], dtype=int32)>


text:
Q: Powershell: Comparing Array (-notcontains) will not work I want to compare two Lists of Arrays and to display the Delta in a third array:
$ListOfVMs
$ListOfRunningVMs

$StoppedVMs = $ListOfVMs | { Where-Object $_.Name -notcontains $ListOfVMs.Name }

This Filter delivers still the complete Content of $ListOfVMs and not only the Delta. What I am doing wrong?

A: You may do the following:
$StoppedVMs = $ListOfVMs | Where-Object Name -notin $ListOfRunningVMs.Name

You need to pipe to Where-Object. Where-Object is what contains the script block (if you need to use it). You are also not comparing both lists here as you only reference $ListOfVMs.
Since you are comparing a single item against a collection, you will want to use -notin if the single item is on the left-hand side (LHS). -notcontains would be used if the collection is on the LHS.


text:
Q: Changing text of a Button in Unity upon loading I'm just trying to edit a Button's text on my Unity app whenever the game loads.
ArgumentException: GetComponent requires that the requested component 'Text' derives from MonoBehaviour or Component or is an interface.

Below is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.UI;

internal class Text
{
    internal string text;
}

public class Backend : MonoBheaviour
{

  void Start()
    {
        GameObject.Find("Option 1 Button").GetComponentInChildren<Text>().text = "Sdfsdfsd";

        PopulateHeadlines();
    }

What am I doing wrong?

A: Your definition of internal class Text hide the UnityEngine.UI.Text.
Delete your definition and try again.


text:
Q: Unable to export AWS RDS Postgres table to CSV in S3, using aws_s3.query_export_to_s3 function I followed closely the documentation regarding exporting AWS RDS Postgres tables to S3 as CSV and still could not make it work.
Documentation URL
More specifically, after creating the aws_s3 extension
CREATE EXTENSION IF NOT EXISTS aws_s3 CASCADE;

I tried to execute this function:
SELECT * from aws_s3.query_export_to_s3('select * from users limit 10', 'sample-s3-bucket', '/users_demo.csv');

which failed with the following error:

[42883] ERROR: function aws_s3.query_export_to_s3(unknown, unknown,
unknown) does not exist Hint: No function matches the given name and
argument types. You might need to add explicit type casts.

This error is not documented (or I could not find relevant documentation). It seems  the aws_s3.query_export_to_s3 function is actually missing from the extension!
I tried to see if this function aws_s3.query_export_to_s3 is actually missing. I have already tried:

*

*Listing the available extensions shows aws_s3 esxtension as installed:

SELECT * FROM pg_available_extensions where name like '%aw%';

Result:
    name     | default_version | installed_version |                   comment
-------------+-----------------+-------------------+---------------------------------------------
 aws_s3      | 1.0             | 1.0               | AWS S3 extension for importing data from S3
 aws_commons | 1.0             | 1.0               | Common data types across AWS services
(2 rows)

*Listing the extension functions does not show the query_export_to_s3 function:

SELECT e.extname, ne.nspname AS extschema, p.proname, np.nspname AS proschema
FROM pg_catalog.pg_extension AS e
         INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid)
         INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid)
         INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace)
         INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace)
WHERE d.deptype = 'e' AND e.extname like '%aws%'
ORDER BY 1, 3;

Result:
   extname   | extschema |        proname         |  proschema
-------------+-----------+------------------------+-------------
 aws_commons | public    | create_aws_credentials | aws_commons
 aws_commons | public    | create_s3_uri          | aws_commons
 aws_s3      | public    | table_import_from_s3   | aws_s3
 aws_s3      | public    | table_import_from_s3   | aws_s3
(4 rows)

*Finally, Dropping and recreating the extension aws_s3 did not work.

More info: PostgreSQL 12.3 on x86_64-pc-linux-gnu.
Can anyone please confirm that this function is actually missing? In other words, can anyone use this function?

A: Try upgrading to Postgres 12.4. I'm having a similar problem and that's what AWS support told me (response pasted below). [edited]
Update
Initially I hadn't fully got this working, but can confirm upgrading to Postgres 12.4, and dropping and recreating the extension worked.
DROP EXTENSION aws_s3 CASCADE;
DROP EXTENSION aws_commons CASCADE;
CREATE EXTENSION aws_s3 CASCADE;

Original response from AWS Support:
Based on output of describe-db-engine-versions[1] I can see that only
the below specific engine versions support s3Export feature. Hence
version 12.2 does not support export to S3 feature.
[
    {
        "Engine": "postgres",
        "EngineVersion": "10.14",
        "SupportedFeatureNames": [
            "s3Import",
            "s3Export"
        ]
    },
    {
        "Engine": "postgres",
        "EngineVersion": "11.9",
        "SupportedFeatureNames": [
            "s3Import",
            "s3Export"
        ]
    },
    {
        "Engine": "postgres",
        "EngineVersion": "12.4",
        "SupportedFeatureNames": [
            "s3Import",
            "s3Export"
        ]
    } ]

A: Upgrading the RDS instance to 12.4 and executing the following worked for me.
DROP EXTENSION aws_s3;
DROP EXTENSION aws_commons;
CREATE EXTENSION aws_s3 CASCADE;


text:
Q: What to use for hypothetically completed future actions I was talking to a friend where I had to make a hypothetical statement about an activity that was completed in the future. So I came up with the following statements.

If he continued college, he would have completed his college by 2013.
If he continued college, he would complete college by 2013.

The second statement doesn't work because it just talks about the action that happen in that unreal future. Not completed. I can't say the following either because it makes it more real:

If he continued college, he will have completed college by 2013.

So is the first one the right way of saying this?

A: A minor point, but "complete his college" sounds funny, so I'll say "complete his education".
For the hypothetical clause, there are two possibilities here. First,
he's either stopping now, or he's still going but has already decided to stop:

If he were to continue college ...

Second, he stopped going to college some time ago:

If he had continued college ...

If he hasn't yet decided whether or not to stop, you should use "If he continues college ..."
For the rest of the sentence, you can't use would have completed, because he hasn't graduated yet. However, English allows the use of the present for the future in this situation. For the first case, you get

If he were to continue college, he would complete his education by 2013.

Perfect.
Let's try the second case:

If he had continued college, he would complete his education by 2013.

This doesn't sound right to me, since I'm so used to "If he had ... he would have ...". Normally, I'd use the progressive in a situation like this.

If he had continued college, he would be completing his education by 2013.

However, I don't like using the progressive form with "by 2013". So let's use the "going to" form of the future with "would":

If he had continued college, he would be going to complete his education by 2013.

The verb form is a little long, but I think this is the best alternative.

A: For the first clause (continue college):

*

*If it is purely hypothetical (i.e. you wish to discuss the idea of continuing college, even if it is impossible) use the past tense.  Otherwise use the present tense.

*If the decision is in the past, use the perfect aspect.
For the second clause (complete college by 2013):

*

*Show that it takes place in the future by using will

*If the first clause is in the past tense, so is the second (will --> would).
So we have the following four possibilities:

*

*He might continue college in future.  Use present simple:

If he continues college, he will complete college by 2013.

*He might have decided to continue college in the past, but we don't know yet.  Use present perfect:

If he has continued college, he will complete college by 2013.

*You wish to discuss the idea of continuing college in future without referring to whether it is possible or not.  Use past simple:

If he continued college, he would complete college by 2013.

*You wish to discuss the idea that he might have continued college in the past, even though you know that he hasn't.  Use past perfect:

If he had continued college, he would complete college by 2013.

A:
If he continued college, he would have graduated by 2013.

Or

If he continued college, he would have been finished by 2013.

A: First, let rewrite the first sentence of your question to comply to the recommended practice required for the answer to your question.
"I was talking to a friend and I had to make a hypothetical statement about an activity that would be completed in the future."
Past hypothesis, present accomplishment

I could have been a singer and I should have a million dollars now.
I might have been a singer and I might have a million dollars now.
Were I to have been a singer, I would have a million dollars now.

Present hypothesis, future accomplishment

I could be a pilot now and then in twenty years' I will have flown a million miles.
I should be pilot now and then in twenty years' I shall have flown a million miles.
It is impossible for me to be a pilot due to my eye sight. Were I to be a pilot now, in twenty years' I would have flown a million miles.

Future hypothesis is similar to present hypothesis
Affirmative

He is deeply considering that if he continues college now (rather than next year), he will complete college in 2013.

Optative resulting in speculative outcome

He has quite a number of choices. He could continue college now, and then he would complete college in 2013.

Speculative with possible outcome

Despite his decision not to, if he continued college now, he will have completed college in 2013.

Unlikelyhood with impossible outcome

It is unfortunate that he died, but if he were to continue college now, he would have completed college in 2013.

Additions, in defence, due to comments

Concerning the comment that the last example should be "if he had continued" - it would not denote a past impossible situation, because it is a speculative rather than an impossibility subjunctive.
The impossibility subjunctive requires the narrator's view to be temporally displaced into the future of the event.
Therefore, if the narrative is the present, its impossibility subjunctive would have to use the past or past-perfect tense.
Even if the event is in future with respect to the current narrative, the impossibility subjunctive requires the temporal displacement of the narrator to be placed after that future event. (BTW, temporal does not mean "temporary", but "time-based".)
Need to differentiate between a future expectation, a future subjunctive, and a present subjunctive.
Future expected acquisition of state due to completion of event:
(He is graduating today.) Next year, he will have been a mathematician for a year.
Future subjunctive acquisition of state requiring temporal displacement of tenses:
(Were he to have continued school, he would graduate today.) Next year, he would have been a mathematician for a year.
Present subjunctive event (without acquiring state) requires temporal displacement of tenses:
(Were he to have continued school, he would graduate today.) Today, he would be a mathematician.
The classic example of Present Impossibility Subjunctive is

If I were a bird, I would sing all day.

I he were alive now he would continue college. If he were to continue college, he would graduate in 2013.
Past Speculative Subjunctive
He is a rather intelligent fellow and had a high chance of being a mathematician. He could have been a mathematician rather than a carpenter.
Future impossibility due to past speculative condition
If he had continued college, he would have graduated last year. If he had continued college, he would have been a mathematician for a year, next year.
Using or not using past-perfect tense for a future subjunctive is illustrated:
Future subjunctive to narrate acquisition of state due to completion of event:
Were he to pursue his Masters', he would have completed it next year.
Future subjunctive to narrate completing of an event without acquisition of a state:
Were he to pursue his Masters', he would be completing next year.
Future speculative:
He has started reading for his Masters'. If all goes well, he would complete it next year.
Future expected possibility due to past condition
Fortunately he had continued college. Next year, he will have been a mathematician for a year.
If you disagree with the aspect of temporal displacement of the narrative of a subjunctive, you need to tell me how to differentiate between narrating

*

*the completion of a future subjunctive event ("subjunctively" acquired a state).

*the completing of a future subjunctive event ("subjunctively" acquiring a state).

*a future subjunctive event (no state acquisition being narrated).

*the future completion of an expected event (expected acquisition of state).

Whatever you interpret from grammar books, even if you are a respected grammarian, first find out if your structure is able to make such a differentiation. If you can/could, let me know.
You cannot say that we have to use the future subjunctive in place of a perfected future subjunctive.
You cannot say that we have to restrict ourselves from being able to narrate a perfected future of a subjunctive. You cannot say that it is not possible to narrate a perfected future of a subjunctive.
You also cannot say that we have to restrict ourselves from being able to differentiate between future subjunctive, future perfected subjunctive and a future expectation.


text:
Q: Too much time difference between receiving response from server and writing it into log while reading file from Google Cloud Storage using HttpClient I need to download multiple files from GCS. For this I have used the code
public class GCSStorage
{
    static HttpClient httpClient;
    static GoogleCredential credential = GoogleCredential.FromFile(ConfigurationManager.AppSettings["GCPCredentials"]);
    if (credential.IsCreateScopedRequired)
    {
        credential = credential.CreateScoped(new[]
        {
           "https://www.googleapis.com/auth/devstorage.read_only"

        });
        httpClient = new Google.Apis.Http.HttpClientFactory()
                        .CreateHttpClient(
                        new Google.Apis.Http.CreateHttpClientArgs()
                        {
                            ApplicationName = "",
                            GZipEnabled = true,
                            Initializers = { credential },
                        });
        httpClient.Timeout = new TimeSpan(0, 0, 5);
    }

    public string ReadObjectData(string bucketName, string location)
    {
        string responseBody = "";
        bool isFetched = false;
        try
        {
            Stopwatch sw = new Stopwatch();
            string pathcode = System.Web.HttpUtility.UrlEncode(location);
            UriBuilder uri = new UriBuilder(string.Format(googleStorageApi, bucketName, pathcode));
            sw.Start();
            var httpResponseMessage = httpClient.GetAsync(uri.Uri).Result;
            var t = sw.ElapsedMilliseconds;
            if (httpResponseMessage.StatusCode == HttpStatusCode.OK)
            {
                responseBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
                log.Info($"Read file from location : {location} in Get() time : {t} ms , ReadAsString time :  {sw.ElapsedMilliseconds - t} ms, Total time : {sw.ElapsedMilliseconds} ms");
            }
            isFetched = true;
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return responseBody;
    }
}

And called that for multiple files using
GCSStorage gcs = new GCSStorage();
ParallelOptions option = new ParallelOptions { MaxDegreeOfParallelism = options };
    Parallel.ForEach(myFiles, option, ri =>
    {
        text = gcs.ReadObjectData(bucket, ri); ;
    });

I am recording the time taken for each individual file to download in ReadObjectData(). When I download the files using  MaxDegreeOfParallelism as 1, then each file is downloaded in about 100-150ms. But when I change MaxDegreeOfParallelism to 50, time varies between 1-3s. I am downloading a bunch of 50 files.
I have no idea why this is happening. Can anyone help me understand this behavior.
Also, I have tried doing the same with Amazon S3. S3 gives a constant download time of 50-100ms in both scenarios.
I profiled the GCS response using fiddler. For the requests that are taking time (~>200ms), Overall Elapsed is around 100-200 ms but the time to write the log is much higher. For others it is exactly at the same time.
Why would the time there would be so much time difference b/w some of the requests?
Fiddler Statistics
Request Count:   1
Bytes Sent:      439        (headers:439; body:0)
Bytes Received:  7,759      (headers:609; body:7,150)

ACTUAL PERFORMANCE
--------------
ClientConnected:    18:03:35.137
ClientBeginRequest: 18:04:13.606
GotRequestHeaders:  18:04:13.606
ClientDoneRequest:  18:04:13.606
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect: 0ms
HTTPS Handshake:    0ms
ServerConnected:    18:03:35.152
FiddlerBeginRequest:    18:04:13.606
ServerGotRequest:   18:04:13.606
ServerBeginResponse:    18:04:13.700
GotResponseHeaders: 18:04:13.700
ServerDoneResponse: 18:04:13.700
ClientBeginResponse:    18:04:13.700
ClientDoneResponse: 18:04:13.700

    Overall Elapsed:    0:00:00.093

Log file
INFO  2018-08-25 18:04:13,606 41781ms GCSStorage ReadObjectData -  Get() time : 114 ms
INFO  2018-08-25 18:04:14,512 42688ms GCSStorage ReadObjectData -  Get() time : 902 ms

I could see that
LogTime - ClientDoneResponse + Overall Elapsed is approximately equal to Total Time
18:04:14.512 - 18:04:13.700 + 0:00:00.093 = 905 ms

Why is there so much time difference b/w receiving the response from server and writing it into the log?

A: When you are doing parallel programming, with multiple threads you need to have a few things in mind. First of all it is true that parallelism improves performance, but it is not that infinite parallelilsm is better than sequential . There are many reasons for this. One is you are limited by t he number of your physical cores and also hyper threading in your OS. For example if you have 8 cores, the best performance you will get is with 8 threads, if hyperthreading is also active, then it might be that with 16 threads you get a good performance.
In your example changing number of threads from 1 to 50 is too much. Try it in steps, 2, 4, 6, 8 , 10 and see when you get the best performance (record the time as you have done so far).
That number then is the best number for your parallelism most likely.


text:
Q: Programmatically obtain Microsoft Band unique ID Is there a way to programmatically get the band ID using the SDK? ie the serial number or any other means to distinguish between one device and another?

A: A Band ID is not currently exposed by the SDK. Currently, only the Band Name is exposed that can be used to identify a Band. You can add a feature request for a future version at: http://microsofthealth.uservoice.com/


text:
Q: Changing joomla site address I've copied an existing joomla site from one domain to another, but when I hit the menu items it redirects to the old domain articles.  Where is the setting to change this?
Thanks

A: Set $live_site variable in your configuration.php file by adding this line:
$live_site = "http://www.example.com";

A: Narkoz's answer isn't correct, there isn't an option to set your site domain in the joomla backend.
The problem isn't that joomla doesn't know your site URL, it gets that from you server, but rather the menu links are probably hard coded. Check your menu links in the backend and make sure the point to an "internal" link of some kind.

A: Export the database to SQL file then open it with a text editor and do a search/replace
Search : old-site-url.com
and replace it by : new-site-url.com
Save your file and import it to the database.


text:
Q: Pros and cons of using [taxonomy name] in place of [category name]? We are currently in development on a new site. Categories (& tags) are pretty much meaningless for us because we've implemented custom posts & taxonomies.
By default, because I have enabled pretty permalinks, if I create a post titled, "Mubarak steps down" without selecting a category, Wordpress will give me this: domain.com/uncategorized/mubarak-steps-down.
Today, I installed the custom permalinks plugin which enables me to make the permalink virtually anything I want. I have a custom taxonomy called countries and one of the terms is Egypt so I re-wrote the above permalink to be domain.com/countries/egypt/mubarak-steps-down. domain.com/egypt/mubarak-steps-down would be better but there's nothing there & writing a re-direct for all countries would be a major pain.
The pros, as I see them, in doing this:
1) A reader may realize that by removing the post title and re-submitting the url in the browser that they will see more content on the parent subject most relevant to the individual post, in this case, Egypt. Of course, this can also be done by making a link to the Egypt section on the page easy to see.
2) I think* it could be an effective white hat SEO strategy for communicating something more relevant in the url than 'uncategorized' or something else generic like 'events' or 'news.'
What are the pros and cons of doing this with respect to WP database performance, etc.?

A: For the SEO part you might get better answers on the Pro Webmasters Stack Exchange. I will focus on the performance.
From your example I assume your permalink structure was %category%/%postname%/. Because of the way WordPress parses the incoming URL, this will result in verbose page rules, which means that each page (not post) you create gets their own set of rewrite rules. If you don't have many pages this does not matter much, if you have a lot of pages (say, above 50), this can be a serious performance hit or even stop your site from working.
You use the Custom Permalinks plugin, but a quick look at the code makes me doubt it will scale well when you have a lot of posts. I'm not a MySQL expert, but I think the database can't use an index effectively to speed up that query it does at every URL request.
If you want to use the same structure for every post (%custom-taxonomy%/%postname%/), I suggest you modify the rewrite rules to match this. I believe you can even do this by setting the permalink structure to %category%/%postname%/ and filtering the post_rewrite_rules by replacing category with your custom taxonomy slug.
But if you don't use categories, wouldn't it be easier to re-use this taxonomy so it fits your needs? You can change the labels of the default taxonomies so they look like your custom taxonomies. The benefit is that categories have very strong support everywhere in WordPress, while the custom taxonomies are still new and can't always do everything (as easy) as categories can.


text:
Q: Hamiltonian circuit in a Hamming graph The problem is exactly what I have asked here:
Showing that a particular graph is Hamiltonian

Let $Q:=\{1,2,\ldots, q\}$. Let $G$ be a graph with the elements of
  $Q^n$ as vertices and an edge between $(a_1,a_2,\ldots, a_n)$ and
  $(b_1,b_2,\ldots, b_n)$ if and only if $a_i\ne b_i$ for exactly one
  value of $i$. Show that $G$ is Hamiltonian.

My question is whether my partial solution (given below) is correct and to complete the solution on similar lines?

We induct on $n$. For $n=1$, the graph $K_q$ is clearly Hamiltonian.
  Assume that for $n-1$ the corresponding graph on $Q^{n-1}$ vertices
  has a Hamiltonian circuit $x_1,x_2,\ldots,x_{q^{n-1}},x_1$. Now
  consider the graph $G$ and consider the case when $q$ is even.
The Hamiltonian circuit is:
  $$1x_1,2x_1,\ldots,qx_1,qx_2,(q-1)x_2,\ldots,1x_2,1x_3,2x_3,\ldots,1x_{q^{n-1}},1x_1.$$

Edit: I could not follow Henning Makholm's hint given below, but the following solution struck me as more simple. Is it correct?

We induct on $n$. For $n=1$, the graph $K_q$ is clearly Hamiltonian.
  Assume that for $n-1$ the corresponding graph on $Q^{n-1}$ vertices
  has a Hamiltonian circuit $x_1,x_2,\ldots,x_{q^{n-1}},x_1$. Now
  consider the following Hamiltonian circuit to complete the proof:
$$1x_1,1x_2,\ldots,1x_{q^{n-1}-1},2x_{q^{n-1}-1},x_{q^{n-1}-2},\ldots,2x_1,3x_1,\ldots,y,qx_{q^{n-1}},(q-1)x_{q^{n-1}},\ldots,1x_{q^{n-1}},1x_1$$
  where $y=qx_1$ or $y=qx_{q^{n-1}-1}$ depending on whether $q$ is even or odd respectively.

A: Yes, that looks like it will work.
In order to remove the dependency on $q$ being even, you can modify your solution such that next-to-last layer ends at an index between $1$ and $q-1$, which will allow the last layer to end at index $1$ no matter whether it's odd or even.
(This requires $q\ge 3$, but $q=2$ can be handled by your existing solution for even $q$).


text:
Q: Image & progress bar not loading in internet explorer, but loads in firefox, chrome etc I am using the latest IE, Firefox and chrome. When I am running my php code on my local server or even my main server. The images in the content slider & the progress bar doesn't load in Internet explorer alone. It shows up as a black image. Below is the code for my content slider and its css.
I have looked for solutions everywhere and don't seem to find the problem in my code. I have even checked that my images which are jpg are in the RGB format, which some people have faced before.

The css for the above is as given below.
/* LAYOUT */
.container {
margin:0 auto;
overflow:hidden;
width:960px;
}

/* CONTENT SLIDER */
#content-slider {
width:auto;
height:220px; /* 360px*/
margin:10px auto 0;
}
/* SLIDER */
#slider {
background:#000;
border:5px solid #eaeaea;
box-shadow:1px 1px 5px rgba(0,0,0,0.7);
height:193px;
width:155px;
margin:40px auto 0;
overflow:visible;
position:absolute;
top:150px;
left:800px;
float:right;
}
#mask {
overflow:hidden;
height:320px;
}
#slider ul {
margin:0;
padding:0;
position:relative;
}
#slider li {
width:680px;
height:320px;
position:absolute;
top:-325px;
list-style:none;
}

#slider li.firstanimation {
-moz-animation:cycle 25s linear infinite;
-webkit-animation:cycle 25s linear infinite;
}
#slider li.secondanimation {
-moz-animation:cycletwo 25s linear infinite;
-webkit-animation:cycletwo 25s linear infinite;
}
#slider li.thirdanimation {
-moz-animation:cyclethree 25s linear infinite;
-webkit-animation:cyclethree 25s linear infinite;
}
#slider li.fourthanimation {
-moz-animation:cyclefour 25s linear infinite;
-webkit-animation:cyclefour 25s linear infinite;
}
#slider li.fifthanimation {
-moz-animation:cyclefive 25s linear infinite;
-webkit-animation:cyclefive 25s linear infinite;
}
#slider:hover li,
#slider:hover .progress-bar {
-moz-animation-play-state:paused;
-webkit-animation-play-state:paused;
}

/* PROGRESS BAR */
.progress-bar {
position:relative;
top:-5px;
width:680px;
height:5px;
background:#000;
-moz-animation:fullexpand 25s ease-out infinite;
-webkit-animation:fullexpand 25s ease-out infinite;
}

A: You've not mentioned Keyframes you're using for animation. And also you've written animation property for two browsers only.
#slider li.firstanimation {
   -moz-animation:cycle 25s linear infinite;   /* This is Firefox prefix*/
   -webkit-animation:cycle 25s linear infinite;  /* This is Chrome/Opera prefix*/
}

IE don't understand above prefixes so add
#slider li.firstanimation {
   -moz-animation:cycle 25s linear infinite;   /* This is Firefox prefix*/
   -webkit-animation:cycle 25s linear infinite;  /* This is Chrome/Opera prefix*/
   animation:cycle 25s linear infinite; /* for IE */
}

Now what I can assume here is that animation is not happening due to prefix problem and your images are not being displayed. Please update you question with more details and add fiddle.

A: Additionally added the following then only it works
animation: fullexpand 10s ease-out infinite;
@keyframes fullexpand {
    0% {
        width: 0px;}
    100% {
        width: 100%;};
}


text:
Q: Problems with HTML/Javascript EPL trivia game I am having trouble getting this game to work. I want the dropdown menu to offer 20 EPL teams, and then by selecting each individual team, that team's facts will be displayed in a form. For whatever reason, I cannot get this code to work. Any suggestions would be great!
Code:
<!DOCTYPE HTML>

<title>EPL Trivia</title>

<form name=triviaform>

EPL Trivia

Just select a team below.

Select a team: <select name=teamList size=1 onChange="showInfo()">

<option value="">Select ---->
<option value="Arsenal FC">Arsenal FC
<option value="Aston Villa FC">Aston Villa FC
<option value="Burnley">Burnley
<option value="Chelsea FC">Chelsea FC
<option value="Crystal Palace FC">Crystal Palace FC
<option value="Everton FC">Everton FC
<option value="Hull City AFC">Hull City AFC
<option value="Leicester City FC">Leicester City FC
<option value="Liverpool FC">Liverpool FC
<option value="Manchester City FC">Manchester City FC
<option value="Manchester United FC">Manchester United FC
<option value="Newcastle United">Newcastle United
<option value="Queens Park Rangers">Queens Park Rangers
<option value="Southampton FC">Southampton FC
<option value="Stoke City FC">Stoke City FC
<option value="Sunderland FC">Sunderland FC
<option value="Swansea City AFC">Swansea City AFC
<option value="Tottenham Hotspur FC">Tottenham Hotspur FC
<option value="West Bromwich Albion FC">West Bromwich Albion FC
<option value="West Ham united FC">West Ham United FC
</select>

Location: <input type=text size=25 name=location>

Nickname: <input type=text size=20 name=nickname>

Stadium Name: <input type=text size=20 name=stadium>

Stadium Capacity: <input type=text size=23 name=capacity>

</form>

Thanks Again!

A: Try this. There were a few errors, easy to spot in the console. The variable team seemed to be missing and I changed the variable location to place as it a reserved word in HTML (see here: http://www.w3schools.com/js/js_reserved.asp). Hope that helps. I only tested in Safari, but you should definitely test in other browsers.
<!DOCTYPE HTML>

<title>EPL Trivia</title>

<form name=triviaform>

EPL Trivia

Just select a team below.

Select a team: <select name=teamList size=1 onchange="javascript:showInfo()">

<option value="">Select ---->
<option value="Arsenal FC">Arsenal FC
<option value="Aston Villa FC">Aston Villa FC
<option value="Burnley">Burnley
<option value="Chelsea FC">Chelsea FC
<option value="Crystal Palace FC">Crystal Palace FC
<option value="Everton FC">Everton FC
<option value="Hull City AFC">Hull City AFC
<option value="Leicester City FC">Leicester City FC
<option value="Liverpool FC">Liverpool FC
<option value="Manchester City FC">Manchester City FC
<option value="Manchester United FC">Manchester United FC
<option value="Newcastle United">Newcastle United
<option value="Queens Park Rangers">Queens Park Rangers
<option value="Southampton FC">Southampton FC
<option value="Stoke City FC">Stoke City FC
<option value="Sunderland FC">Sunderland FC
<option value="Swansea City AFC">Swansea City AFC
<option value="Tottenham Hotspur FC">Tottenham Hotspur FC
<option value="West Bromwich Albion FC">West Bromwich Albion FC
<option value="West Ham united FC">West Ham United FC
</select>

place: <input type=text size=25 name=place>

Nickname: <input type=text size=20 name=nickname>

Stadium Name: <input type=text size=20 name=stadium>

Stadium Capacity: <input type=text size=23 name=capacity>

</form>

A: There are two mistakes that are combining to cause you problems.  The first is that you are using the variable location and setting it to an array.  This is a variable used by window and resetting it will cause the browser to redirect to another page.  This can be fixed by renaming your location variable to something else (e.g. eplLocation)
The second problem is you declare a state variable, but then attempt to assign values to team.  Initializing state as team should resolve this.