text:
Q: SQL Merging 4 Queries to one Im having a slight issue merging the following statements
    declare @From DATE
SET @From = '01/01/2014'

declare @To DATE
SET @To = '31/01/2014'

--ISSUED SB

SELECT
      COUNT(pm.DateAppIssued) AS Issued,
      pm.Lender,
      pm.AmountRequested,
      p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE CaseTypeID = 2
AND (CONVERT(DATE,DateAppIssued, 103)
Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103))
And Lender >  ''
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

--Paased

SELECT
      COUNT(pm.DatePassed) AS Passed,
      pm.Lender,
      pm.AmountRequested,
      p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE CaseTypeID = 2
AND (CONVERT(DATE,DatePassed, 103)
Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103))
And Lender >  ''
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

--Received

SELECT
      COUNT(pm.DateAppRcvd) AS Received,
      pm.Lender,
      pm.AmountRequested,
      p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE CaseTypeID = 2
AND (CONVERT(DATE,DateAppRcvd, 103)
Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103))
And Lender >  ''
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

--Offered

SELECT
      COUNT(pm.DateOffered) AS Offered,
      pm.Lender,
      pm.AmountRequested,
      p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE CaseTypeID = 2
AND (CONVERT(DATE,DateOffered, 103)
Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103))
And Lender >  ''
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

Ideally I would like the result of theses query's to show as follows
Issued, Passed , Offered, Received,
All in one table
Any Help on this would be greatly appreciated
Thanks
Rusty

A: You could either as Dan Bracuk states use a union, or you could use a case-statement.
declare @From DATE = '01/01/2014'
declare @To DATE = '31/01/2014'

select
  sum(case when (CONVERT(DATE,DateAppIssued, 103) Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103)) then 1 else 0 end) as Issued
, sum(case when (CONVERT(DATE,DatePassed, 103)    Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103)) then 1 else 0 end) as Passed
, sum(case when (CONVERT(DATE,DateAppRcvd, 103)   Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103)) then 1 else 0 end) as Received
, sum(case when (CONVERT(DATE,DateOffered, 103)   Between  CONVERT(DATE,@From,103) and CONVERT(DATE,@To,103)) then 1 else 0 end) as Offered
, pm.Lender
, pm.AmountRequested
, p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE CaseTypeID = 2
And Lender >  ''
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

Edit:
What I've done is looked at your queries.
All four queries have identical Where Clause, with the exception of the date comparison. Therefore I've created a new query, which selects all your data which might be used in one of the four counts.
The last clause; the data-comparison, is moved into a case statement, returning 1 if the row is between the selected date-range, and 0 otherwise. This basically indicates whether the row would be returned in your previous queries.
Therefore a sum of this column would return the equivalent of a count(*), with this date-comparison in the where-clause.
Edit 2 (After comments by Clockwork-muse):
Some notes on performance, (tested on MS-SQL 2012):
Changing BETWEEN to ">=" and "<" inside a case-statement does not affect the cost of the query.
Depending on the size of the table, the query might be optimized quite a lot, by adding the dates in the where clause.
In my sample data (~20.000.000 rows, spanning from 2001 to today), i got a 48% increase in speed by adding.
or (DateAppIssued BETWEEN @From and @to )
or (DatePassed    BETWEEN @From and @to )
or (DateAppRcvd   BETWEEN @From and @to )
or (DateOffered   BETWEEN @From and @to )

(There were no difference using BETWEEN and ">=" and "<".)
It is also worth nothing that i got a 6% increase when changing the @From = '01/01/2014' to @From '2014-01-01' and thus omitting the convert().
Eg. an optimized query could be:
declare @From DATE = '2014-01-01'
declare @To DATE = '2014-01-31'

select
  sum(case when (DateAppIssued >= @From and DateAppIssued < @To) then 1 else 0 end) as Issued
, sum(case when (DatePassed    >= @From and DatePassed    < @To) then 1 else 0 end) as Passed
, sum(case when (DateAppRcvd   >= @From and DateAppRcvd   < @To) then 1 else 0 end) as Received
, sum(case when (DateOffered   >= @From and DateOffered   < @To) then 1 else 0 end) as Offered
, pm.Lender
, pm.AmountRequested
, p.CaseTypeID
FROM  BPS.dbo.tbl_Profile_Mortgage AS pm
        INNER JOIN BPS.dbo.tbl_Profile AS p
            ON pm.FK_ProfileId =  p.Id
WHERE 1=1
and CaseTypeID = 2
and Lender >  ''
and (
      (DateAppIssued >= @From and DateAppIssued < @To)
   or (DatePassed    >= @From and DatePassed    < @To)
   or (DateAppRcvd   >= @From and DateAppRcvd   < @To)
   or (DateOffered   >= @From and DateOffered   < @To)
)
GROUP BY  pm.Lender,p.CaseTypeID,pm.AmountRequested;

I do however really like Clockwork-muse's answer, as I prefer joins to case-statements, where posible :)

A: I'm fairly certain in this case the query can be written without the use of any CASE statements, actually:
DECLARE @From DATE = '20140101'
declare @To DATE = '20140201'

SELECT Mortgage.lender, Mortgage.amountRequested, Profile.caseTypeId,
       COUNT(Issue.issued) as issued,
       COUNT(Pass.passed) as passed,
       COUNT(Receive.received) as received,
       COUNT(Offer.offered) as offered
FROM BPS.dbo.tbl_Profile_Mortgage as Mortgage
JOIN BPS.dbo.tbl_Profile as Profile
  ON Mortgage.fk_profileId = Profile.id
     AND Profile.caseTypeId = 2
LEFT JOIN (VALUES (1, @From, @To)) Issue(issued, rangeFrom, rangeTo)
       ON Mortgage.DateAppIssued >= Issue.rangeFrom
          AND Mortgage.DateAppIssued < Issue.rangeTo
LEFT JOIN (VALUES (2, @From, @To)) Pass(passed, rangeFrom, rangeTo)
       ON Mortgage.DatePassed >= Pass.rangeFrom
          AND Mortgage.DatePassed < Pass.rangeTo
LEFT JOIN (VALUES (3, @From, @To)) Receive(received, rangeFrom, rangeTo)
       ON Mortgage.DateAppRcvd >= Receive.rangeFrom
          AND Mortgage.DateAppRcvd < Receive.rangeTo
LEFT JOIN (VALUES (4, @From, @To)) Offer(offered, rangeFrom, rangeTo)
       ON Mortgage.DateOffered >= Offer.rangeFrom
          AND Mortgage.DateOffered < Offer.rangeTo
WHERE Mortgage.lender > ''
      AND (Issue.issued IS NOT NULL
           OR Pass.passed IS NOT NULL
           OR Receive.received IS NOT NULL
           OR Offer.offered IS NOT NULL)
GROUP BY Mortgage.lender, Mortgage.amountRequested, Profile.caseTypeId

(not tested, as I lack a provided data set).
... Okay, some explanations are in order, because some of this is slightly non-intuitive.
First off, read this blog entry for tips about dealing with date/time/timestamp ranges (interestingly, this also applies to all other non-integral types).  This is why I modified the @To date - so the range could be safely queried without needing to convert types (and thus ignore indices).  I've also made sure to choose a safe format - depending on how you're calling this query, this is a non issue (ie, parameterized queries taking an actual Date type are essentially format-less).
       ......
       COUNT(Issue.issued) as issued,
    ......
LEFT JOIN (VALUES (1, @From, @To)) Issue(issued, rangeFrom, rangeTo)
       ON Mortgage.DateAppIssued >= Issue.rangeFrom
          AND Mortgage.DateAppIssued < Issue.rangeTo
.......

What's the difference between COUNT(*) and COUNT(<expression>)?  If <expression> evaluates to null, it's ignored.  Hence the LEFT JOINs; if the entry for the mortgage isn't in the given date range for the column, the dummy table doesn't attach, and there's no column to count.  Unfortunately, I'm not sure how the interplay between the dummy table, LEFT JOIN, and COUNT() here will appear to the optimizer - the joins should be able to use indices, but I don't know if it's smart enough to be able to use that for the COUNT() here too....
          (Issue.issued IS NOT NULL
           OR Pass.passed IS NOT NULL
           OR Receive.received IS NOT NULL
           OR Offer.offered IS NOT NULL)

This is essentially telling it to ignore rows that don't have at least one of the columns.  They wouldn't be "counted" in any case (well, they'd likely have 0) - there's no data for the function to consider - but they would show up in the results, which probably isn't what you want.  I'm not sure if the optimizer is smart enough to use this to restrict which rows it operates over - that is, turn the JOIN conditions into a way to restrict the various date columns, as if they were in the WHERE clause too.  If the query runs slow, try adding the date restrictions to the WHERE clause and see if it helps.

A: The all-in-one queries here in other answers are certainly elegant, but if you are in a rush to get something working as a one-off, or if you agree the following approach is easy to read and maintain when you have to revisit it some time down the road (or someone else less skilled has to work out what's going on) - here's a skeleton of a Common Table Expression alternative which I believe is quite clear to read :
WITH Unioned_Four AS
( SELECT .. -- first select : Issued
    UNION ALL
  SELECT .. -- second : Passed
    UNION ALL
  SELECT .. -- Received
    UNION ALL
  SELECT .. -- Offered
)
SELECT
  -- group fields
  -- SUMs of the count fields
FROM Unioned_Four
GROUP BY .. -- etc

Obviously the fields have to match in the 4 parts of the UNION, requiring dummy fields returning zero in each one.
So you could have kept the simple approach that you started with, but wrapped it up as a derived table using the CTE syntax to allow you to have the four counts all on one row per GROUPing. Also if you have to add extra filtering to specific queries of the four, then it's easier to meddle with the individual SELECTs - the flipside being (of course) that further requirements for all four would need to be duplicated!


text:
Q: I can't install NodeJS 8 because when it tries to update chrome-gnome-shell doesn't have an artful release Whenever i try to use the command curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - it stops when it tries to do an update because chrome-gnome-shell (http://ppa.launchpad.net/ne0sight/chrome-gnome-shell/ubuntu) doesn't have an artful release. How do I remove it?

A: If you search for Software & Updates , go to the Other Software tab, you can locate the chrome-gnome-shell PPA and untick it, or just remove it completely.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Coding an application so that it runs properly on windows 7...? I have a flash drive which has an application whose code is written VC++ 2008 , the application works fine in xp , but the problem arises when i plug in the drive to a windows 7 machine , it doesn't run properly. is there any way that i can make it compatible to windows by writing a code.
i dont want to set the compatibility tab in windows 7 to run the program..
i want to code it in the program , more like a patch.

A: You can use the Microsoft Application Compatibility Toolkit, which will tell you exactly which Windows XP compatibility shims are used by your code when you run your application under Windows XP mode.
You simply run your application and disable various shims until your code once again behaves incorrectly. The last shim you disabled is the cause of the incorrect behavior. You can then research the exact consequences of each shim as well as exactly what your code will have to do to fix the bugs it has that force it to run in Windows XP Compatibility Mode.

A: You probably need to add an Application Manifest to your application to request the appropriate security permissions to allow your application to do what it needs to do.
This may cause a UAC prompt to be shown to the user if elevated permissions are needed, but then your code will be allowed to do whatever Windows 7 is currently blocking.

A: If you know that the problem exists and know that UAC / etc ... / Manifest on Win7 don't solve your problem and that it's not connected with 32/64 bit issues, try a different approach.
I guess you know what goes wrong with your app on Windows 7. If you're not sure exactly, at least you should know where (in which logical block) your problem is located (e.g IO block, Disk read/write block, Gui, etc.
Now stick to the debugger. Hope your program isn't that big that you can't analyze it and find the source of your problem. You could have your problems because of some functions working not as expected or something like that.
Then, I guess, you could rethink / remanage your code and change it the way it works on both platform. If there is no universal solution, use #ifdefs to determine your current platform (the worst case actually, because you would have to have different binary files for different windows versions).


text:
Q: While loop jumps unexpectedly while reading XML I am reading an XML file using XMLDocument and XmlNodeReader.I do not know what happens to the while loop that it fails to run several parts of the code.
Here is my C# code:
    public string TitleXml;
    public string NameXml;
    public string TypeXml;
    public string ValueXml;
    public Guid GuidXml;
    public string DataString;

        XmlDocument xdoc = new XmlDocument();
        xdoc.LoadXml(MyParent.xmlstring);
        XmlNodeReader xreader = new XmlNodeReader(xdoc);
        while (xreader.Read())
        {
                    switch (xreader.Name)
                    {
                        case"GUID":
                            GuidXml = Guid.Parse(xreader.ReadInnerXml());
                            //after this break the name of the xreader changes.
                            break;

                        case "Type":
                            TypeXml = xreader.ReadInnerXml();
                            break;

                        case "Name":
                            NameXml = xreader.ReadInnerXml();
                            break;

                        case "Title":
                            TitleXml = xreader.ReadInnerXml();
                            break;

                    }
            }
        xreader.Close();
        }

Here is my XML:
    <Item>
       <GUID>9A4FA56F-EAA0-49AF-B7F0-8CA09EA39167</GUID>
       <Type>button</Type>
       <Title>Save</Title>
       <Value>submit</Value>
       <Name>btnsave</Name>
       <MaxLen>5</MaxLen>
    </Item>

A: It doesn't exactly answer your question, but an (at least according to me) easier way of solving this would be:
XDocument doc = XDocument.Load("test.xml");

string TitleXml = doc.Descendants("Title").Single().Value;
string NameXml = doc.Descendants("Name").Single().Value;
string TypeXml = doc.Descendants("Type").Single().Value;
string ValueXml = doc.Descendants("Value").Single().Value;
Guid GuidXml = Guid.Parse(doc.Descendants("GUID").Single().Value);

A: I also think you should use Linq-to-XML, but for your example I'd explicitly list the elements, like so (compilable example program):
using System;
using System.Xml.Linq;

namespace ConsoleApplication1
{
    internal class Program
    {
        static void Main()
        {
            string xml =
@"<Item>
    <GUID>9A4FA56F-EAA0-49AF-B7F0-8CA09EA39167</GUID>
    <Type>button</Type>
    <Title>Save</Title>
    <Value>submit</Value>
    <Name>btnsave</Name>
    <MaxLen>5</MaxLen>
</Item>";
            XElement elem = XElement.Parse(xml);

            Guid GuidXml = Guid.Parse(elem.Element("GUID").Value);
            Console.WriteLine(GuidXml);

            string TypeXml = elem.Element("Type").Value;
            Console.WriteLine(TypeXml);

            string NameXml = elem.Element("Name").Value;
            Console.WriteLine(NameXml);

            string TitleXml = elem.Element("Title").Value;
            Console.WriteLine(TitleXml);
        }
    }
}


text:
Q: How can I use the bing api from rails I am working in a rails 5 app and I would like to use the bing api from my app. I can't find a gem for Bing, so I added Savon gem to use soap. I don't know how should I use the savon and soap. For example, I want to get this information:
https://msdn.microsoft.com/en-us/library/bing-ads-campaign-management-getcampaignsbyaccountid.aspx#request_soap
Is there an example using the Bing API?

A: What about starting from the following gems:

*

*https://github.com/jonahb/bing-search

*https://github.com/rcullito/searchbing
You could fork them or inspire yourself to write "fresh" code!


text:
Q: T-cyclic subspaces: If $m_v$ is irreducible, show that $C_T(v) = C_T(w)$ for all $w\in C_T(v)$ We consider a linear transformation $T\in$ End$(V)$ and $V$ vector space (not necessarly finite).
Notation:
$\mathcal{C} = v, T(v), T^2(v), ...$
$C_T(v)$ = Span$(\mathcal{C})$
$m_v$ is the minimal polynomial of $v$ related to $T$.
The question itselft is:

Let $p\in F[x]$ be a irreducible polynomial and suppose that $m_v = p$ for some $v\in V$. Prove that $C_T(w)=C_T(v)$ for all $w\in C_T(v)$.

The only idea that i had was to take $w\in C_T(v)$ and try to relate $f\in F[x]$ s.t $f(T)= w$ with $m_v$. But i dunno exactly how.
Any hint?

A: You must assume, that w is non-zero, otherwise the result is false.
By definition:$w=Q(T)(v)$, with $Q$ some polynomial. We may assume without loss of generality, that $deg(Q)<deg(p)$, simply by taking a long division of $Q$ by $p$. Since $p$ is irreducible, either $Q=0$ or $p,Q$ are coprime.
$Q$ cannot be zero, since by assumption $w\neq 0$. Hence $p$ and $Q$ are coprime, therefore there exist polynomials $U,V$ such that $pU+QV=1$, therefore $pU(T)(v)+QV(T)(v)=v$. $pU(T)(v)=0$ by definition of $p$ and $Q(T)(v)=w$, hence $V(T)(w)=v$.
From this it followis trivially that $C_T(w)=C_T(v)$.


text:
Q: How is the phrase "When your program breaks, you get to keep both pieces." commonly used? One such example in source code files open-sourced by Apple:
/*
 * WARNING  DANGER  HAZARD  BEWARE  EEK
 *
 * Everything in this file is for Apple Internal use only.
 * These will change in arbitrary OS updates and in unpredictable ways.
 * When your program breaks, you get to keep both pieces.
 */

The warning basically means the source code is internal to Apple and is subject to change. Software developers who use these files should not expect the 'interface' to stay the same between version. If the interface is indeed changed, any program that depends on the file will be broken.
What I do not quite understand are:

*

*Is the phrase When <something> breaks, you get to keep both pieces a common one? If so, how is it usually used?

*Does 'both pieces' means 'two pieces' here?

*Is it supposed to be playful in tone? Is there any other implied meaning based on the context?

A: *

*I have read this phrase before. I'd say it's common among programmers who are writing their own warnings or licenses for software.

*Yes. I believe the metaphor relates to an object that is broken in two, as if software could break in this manner.

*Yes, it is playful. It's terse and sarcastic: it seems it may be a criticism of the verbosity of legalese in software licenses.

A: As far as I've been able to determine, the canonical appearance of "if it breaks, you get to keep both pieces" in software development comes from the manual page of the BSD chat program, a tool for communicating with modem hardware. The earliest version of that manual page I could find was from 1994 in the FreeBSD 2.0 distribution:

COPYRIGHT
The chat program is in public domain. This is not the GNU public license.  If it breaks then you get to keep both pieces.

The statement was a clear dig at the GNU tools from the Free Software Foundation, which were infamous for having long copyright sections in their manual pages dotted with ALL CAPS warranty disclaimers, for example this is the equivalent section from the man page of GNU make:

COPYRIGHT
Copyright  (C)  1992,  1993,  1996, 1999 Free Software Foundation, Inc. This file is part of GNU make.
  GNU make is free software; you can redistribute   it  and/or  modify  it under  the  terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or  (at  your  option)  any later version.
GNU make is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with  GNU  make; see the file COPYING.  If not, write to the Free Software  Foundation,  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

These days, the standard GNU copyright section is much shorter, if it appears at all, but at the time the GNU General Public Licence was legally novel and untested, and the FSF felt it best to be careful.
Since the userland of OS X is based on BSD, it's very likely the term made its way into some Apple developer's vocabulary through that tradition.

A: It's just another way of saying that we are not responsible of anything, but in a funnier way.
A variation of the sentence above is "you get to keep both halves", as seen in https://launchpad.net/~gnome3-team/+archive/ubuntu/gnome3-staging:

If they break your system, you get to keep both halves.

A: I'm an open source software developer with many years of experience. This phrase is used a lot in open source, IT, and specifically computer support.

1) Is the phrase "When  breaks, you get to keep both pieces" a common one? If so, how is it usually used?

It is a common phrase between professional geeks in IT. It is used to indicate that certain combinations of software/hardware/equipment are incompatible, and may lead to irreversible damage. It is also an indication that one doesn't want to provide support for something that is deemed unstable / unsupportable.
I think the closest non-geeky way to say the same thing would be: "If you go down this path, you are on your own."

Alice: Will all of our company internal software still work for me, if I upgrade to Windows 10?
  Bob: If it breaks, you'll get to keep both pieces.

2-days later

Alice: I've upgraded to Windows 10, and also upgraded Office, and now any documents I edit cannot be later opened by anybody else on the team with older laptops. I have a deadline, can you fix this?
Bob: No, I told you, if it breaks, you'll get to keep both pieces.

What Bob is trying to say is "I told you so", "go away", "you are on your own", and "it's not my problem". Thus it's a generic excuse. Sometimes it comes across as patronizing, especially when it later turns out that it's a real problem which should have been supported/working, instead it was dismissed by Bob. That would be called a bug denial.

2) Does 'both pieces' means 'two pieces' here?

It means all the pieces that are broken, kind of equivalent of "don't do that" when asking a doctor why it hurts when you do a particular action.

3) Is it supposed to be playful in tone? Is there any other implied meaning based on the context?

Well, it can be used in any tone one likes from nice to angry. The phrase is informal by nature, but it's not a joke. One seriously means it as a caution / warning. This can go on:

Carol: Bob, did anybody upgrade to windows 10 yet?
Bob: Only Alice, and it broke Office for her. But you know, she got to keep both pieces.
Carol: Well, I don't use that. Here be dragons.

Carol heard the warning, accepts responsibility for any fallout, and goes ahead with the upgrade to see what happens (and breaks).


text:
Q: $wpdb->get_row returns column name instead of column value Below is my Code
global $wpdb;
$table_name = $wpdb->prefix.'aorborc_session';
$wpdb->query("INSERT INTO wp_aorborc_session (session_str) VALUES (UUID())");
$last_id = $wpdb->insert_id;
$session = $wpdb->get_row( "SELECT 'session_str' FROM ".$table_name."  WHERE id = ".$last_id);
return $session->session_str;

The output is session_str instead of the mysql UUID value. What am I doing wrong here?


text:
Q: Error when trying to log in with Auth0 in Cypress tests Our application is only accessible to authenticated users and we use Auth0 for the authentication.
We have started writing Cypress tests and we try to log in using Auth0 JavaScript client before each test. The first test always passes without any problems but all other tests fail with the following error:

NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://ourdomain.eu.auth0.com/co/authenticate': Document is already detached.

Do we need to make all API calls manually using cy.request() in order to prevent such errors or is there any way how to make Auth0 client work?

A: I had similar issues with Auth0, but I don't remember getting the error you are getting. In a before block I log in. I call this method in a before() block. Not sure this will help you but it was worth a shot. There should be a better way of doing it and I tried calling their API to do it, but I could never get it to work.. so I hacked this up
Cypress.Commands.add('loginAuth0', () => {
    cy.visit('');
    cy.get('#log-in').click();
    cy.get('[type="email"]').type('MYEMAIL@DOMAIN>COM');
    cy.get('[type="password"]').type('MYPASSWORD');
    cy.get('.auth0-label-submit').click();
    cy.url().should('include', '/callback');
})

in a beforeEach() block I call this method
var accessToken = null; ** this is a global variable at top of file
Cypress.Commands.add('resetLocalStorage', () => {
    if (!accessToken) {
        accessToken = localStorage.getItem('access_token');
    }
    window.localStorage.setItem('access_token', accessToken);

}

in my cypress.json file I turn off chromeWebSecurity
"chromeWebSecurity": false

My spec file you will see something like this
 before(() => {
        cy.loginAuth0();
        cy.wait(2000);
    })

    beforeEach(() => {
        cy.resetLocalStorage();
    })


text:
Q: Display google maps inside a fragment I am using kotlin and I want to implement the google maps into my androidx application inside a fragment.

I've tried mapView and it doesnt display any map when i run the app.

A: you can use mapView inside your activity and the implement the fragment as
    public class SomeFragment extends Fragment {

MapView mapView;
GoogleMap map;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)          {
    View v = inflater.inflate(R.layout.some_layout, container, false);

    // Gets the MapView from the XML layout and creates it
    mapView = (MapView) v.findViewById(R.id.mapview);
    mapView.onCreate(savedInstanceState);

    // Gets to GoogleMap from the MapView and does initialization stuff
    map = mapView.getMap();
    map.getUiSettings().setMyLocationButtonEnabled(false);
    map.setMyLocationEnabled(true);

    // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
    try {
        MapsInitializer.initialize(this.getActivity());
    } catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
    }

    // Updates the location and zoom of the MapView
    CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(43.1, -87.9), 10);
    map.animateCamera(cameraUpdate);

    return v;
}

@Override
public void onResume() {
    mapView.onResume();
    super.onResume();
}

@Override
public void onDestroy() {
    super.onDestroy();
    mapView.onDestroy();
 }

 @Override
 public void onLowMemory() {
    super.onLowMemory();
    mapView.onLowMemory();
  }

}


text:
Q: Java email and password validation I am quite new in java programming, ive tackling this problem for almost an hour and i am unsure why my validation for my password keep stating " Passsword contain space" & and my validation for email states " Invalid Email address"
ive look throughout my codes several times but i am unable to detect any error. Any help would be greatly appreciated.
public boolean validate() {

    if (email == null) {
        message = "no email address set";
        return false;
    }

    if (password == null) {
        message = "no password set";
        return false;
    }

    if (!email.matches("\\w+@\\.\\+")) {
        message = "Invalid Email address";
        return false;
    }

    if (password.length() < 8) {
        message = "Password must be at least 8 characters";
        return false;
    }

    //
    else if (!password.matches("\\w*\\s+\\w*")) {
        message = "Password cannot contain space";
        return false;
    }
    return true;
}

A: You need to change your below email & password validation:
if (!email.matches("\\w+@\\.\\+")) {
    message = "Invalid Email address";
    return false;
}
// And below
else if (!password.matches("\\w*\\s+\\w*")) {
    message = "Password cannot contain space";
    return false;
}

To,
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
        Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);

public boolean validateEmailId(String emailId) {
    Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(emailId);
    return matcher.find();
}

public boolean validate() {
  //...other conditions as it is

  //Invalid Email address
  if(!validateEmailId(email)){
        message = "Invalid Email address";
        return false;
  }

  //Password cannot contain space
  else if(!Pattern.matches("[^ ]*", password)){
     message = "Password cannot contain space";
     return false;
  }

}


text:
Q: How to add suffix in a line using regex? How to add suffix in a line using regex? This is my regex:
https://regex101.com/r/vV4zX8/1
The result should be like this:
My sample input is:
one

two

three

four

five

six

seven

So far all I've been able to come up with to use is:
\n replace with - digit \n
But I need the output of:
one - digit

two - digit

three - digit

four - digit

five - digit

six - digit

seven - digit

A: You can try the regex \b$ which ensures there's a match where a 'word' ends, and replace with  - digit (or \b(\n|$) with a replacement of  - digit$1 if you don't want to use multiline)
regex101 demo

A: You could also use ([^\r?\n])$

A: Regex:
(.+)$

or
(.)$

And don't forget to enable mulitine modifier m.
Replacement string:
\1 - digit

DEMO

A: You can try like this : check below image

For DEMO


text:
Q: What is the word that describes a person trying to sell stuff persistently? I am trying to remember the word to describe a person trying to sell stuff persistently. I can't seem to figure it out.
-
It can be a verb, noun or adjective. Anything around "Selling stuff persistently".

A: You can call this person a peddler or a hawker.  Those terms make the sales person seem a little shady, hustler even more so.

A:

Haven't you seen those? You can happen upon them in just about every populated area.

A: Pushy or pushful
marked by aggressive ambition and energy and initiative; a pushful insurance agent

A pushy door-to door salesman OR a pushy salesman

Aggressive

This is one of the most common misconceptions about business today.
  The reason that people think of salespeople as being pushy and
  aggressive is because for the last 60 years, they have been pushy and
  aggressive. Most sales people today still are.

Insistent
making continual and persistent demands
pertinacious
continuing to believe something or to do something in a very determined way [= tenacious]
This is more formal, has a more positive spin, but really means the same as insistent, and persistent.

A: I've been trying to remember it too. I think it's

High Pressure Salesman.

Found it on thesaurus.com along with

hard sell.


text:
Q: Create a 1-element array from a random element in a String array I am trying to write a swift function that returns a single element array from a randomly-selected element of a String array (allFruits).
Goal:
let allFruits:[String] = ["Apples", "Oranges", "Pears", "Grapes", "Bananas"]

randomFruit = ["Apple"]

My progress:
let allFruits:[String] = ["Apples", "Oranges", "Pears", "Grapes", "Bananas"]

func randomFruit(arraySource:[String]) -> [String]{
    let randomItem = arraySource.randomElement()
    var singleArray:[String] = []
    return singleArray.append(contentsOf: randomItem)
}

I would then call this with randomFruit(arraySource: allFruits) to get ["Pears"]
The above return statement is giving me the error of:

Cannot convert return expression of type '()' to return type
'[String]'

How can I return a random 1-element array from allFruits?

A: randomItem in your code is an optional since .randomElement can return nil. This is confusing the .append() call at the end.  The following should solve that issue.
func randomFruit(arraySource:[String]) -> [String]{
    if let item = arraySource.randomElement() {
        return [item]
    } else {
        return []
    }
}


text:
Q: Symmetries of the Julia sets for $z^2+c$ The julia set seems to have symmetries roughly corresponding to translation, rotation and scaling.
In the following image

*

*You can see the horizontal translation, which leaves the extremal left and right endpoints fixed is a symmetry.

*The 21-fold rotational symmetry about any one of the 'whorls' is visible also - (I think that the number 21 corresponds to the denominator of the mandelbrot bulb the julia set comes from but I don't yet know how to compute this).

*There is also a twofold rotation about the center (and any other part similar to it)

*The scales are more difficult to describe and I don't think I have found them all so I will just avoid going into detail on this unless someone would like me to do so.

Do these have a mathematical interpretation, for example as automorphisms of the Julia set in some appropriately understood sense? Or is there some other way to describe these kinds of symmetries in mathematical terms?
Thank you.

A: Many Julia sets are known to be quasi-self-similar.  This means that there is a quasi-conformal map (thus of bounded distortion) which maps parts of the Julia set to the whole.  In fact, given any compact subset $K$ of a Julia set $J$, there is a finite iterate of $f_c(z) = z^2+c$ such that $K=J$.  So $J$ is similar to essentially all parts of itself, up to some amount of distortion.  There are all sorts of theorems (based on Yoccoz puzzles, amongst other things) which help quantify the various amounts of distortion you get.
A good place to start (if you are serious about understanding how this really works!) is
ADRIEN DOUADY. JOHN HAMAL HUBBARD. On the dynamics of polynomial-like mappings. Annales scientifiques de l'É.N.S. 4e série, tome 18, no 2 (1985).

A: Yes, there is an explanation, but not in all cases.
Rotational symmetries of polynomial Julia sets are explained in the paper
MR0951972. For the case of rational functions, see also MR1092156.
And also MR1625697 about translational symmetries.
And several papers of Beardon, titled Symmetries of Julia sets.


text:
Q: Ubuntu does not recognize Windows 10 for installation I want to dual boot Windows 10 and Ubuntu 14.04.3. I just installed Windows 10 on my 1TB hard drive. No other drives in the machine.
Made an ~400gb unallocated partition of space on the drive. Started Ubuntu installation from a flash drive.
It says that it appears there are no other operating systems on the computer and provides me only with options to completely wipe the drive and install Ubuntu, or do something else (bringing me to a panel from which I can make new partitions and whatnot).
Ubuntu only recognizes my hard drive as 1TB of entirely unallocated space, though it clearly has Windows 10 successfully booting and functioning on half of it.
Suggestions? Help?

A: Choose "Something else"
Select the free space and divide it into two partitions. One around 4-5GB and the other for Ubuntu.
Format the smaller partition as Swap.
Format the partition designated for Ubuntu preferably as ext4.
Select that partition and Install Ubuntu.
Choose / as mount point for bootloader.
Follow On-screen steps for completing the installation.
After the installation, you will be asked to choose from Ubuntu or Windows recovery partition. Windows recovery partition is actually your windows 10 installation.
Make sure you backup important files first in case something goes wrong.


text:
Q: Proving equivalence of Axiom of Choice I am working on the following question concerning the axiom of choice and one of its many equivalences. Advice as to whether I am on the right track would be appreciated.
As a preface, I have looked at most of the other 'axiom of choice' posts on math.stackexchange already so referencing me to them may not help me a whole lot as I am asking this question $after$ having read those posts. In any case, I may have missed something in these posts so please do recommend a post if you think it will help me. Thank you very much for your time, in advance.

We show that the following statement is equivalent to the axiom of choice: For any set $A$, there is a function $F$ with $dom \ F = \bigcup A$ such that $x \in F(x) \in A$ for all $x \in \bigcup A$. Call this statement $S$.
To prove that $S$ is equivalent to the axiom of choice, we show that $S$ holds iff version 4 of the axiom of choice holds (p.151): Let $A$ be a set such that (a) each member of $A$ is a nonempty set, and (b) any two distinct members of $A$ are disjoint. Then there exists a set $C$ containing exactly one element from each member of $A$ (i.e., for each $B \in A$, the set $C \cap B$ is a singleton $\{x\}$ for some $x$. Call this version $S'$.
First, we show that $S \ \implies \ S'$. Assume that $S$ holds and that $A$ is a set such that each member is a nonempty set and any two members of $A$ are disjoint. Then, there is a function $f$ such that $dom \ f = \bigcup A$ and $\forall x \in \bigcup A$ ($x \in f(x) \in A$). We now have $dom \ f \subseteq ran \ f \in A$, and so  $ran \ f  \neq \emptyset$ by the definition of $A$. Further, we have $ran \ f \ \cap \ B = \{f(x)\}$, for some $x \in A$ and for any $B \in A$. So $ran \ f = C$, and $S'$ holds where $C \cap B$, for any $B \in A$ is a singleton.

A: I'm not sure why you have that $\operatorname{dom}(f)\subseteq\operatorname{ran}(f)$. Note that $x\in\operatorname{dom}(f)$ means that $x\in X\in A$, and $F(x)\in A$. Therefore $\operatorname{dom}(f)\subseteq\bigcup A$ and $\operatorname{ran}(f)\subseteq A$.
So you can't quite use $\operatorname{ran}(f)$ to define $C$.
Instead, consider $A'=\{\{A\times X,x\}\mid x\in X\in A\}$, and apply $S$ to $A'$, you get a function which chooses for each $X\in A$ and each $x\in X$ a pair that exactly one element of it is an element of $X$, so you can cook up $C$ as wanted.


text:
Q: Optimization: Biggest possible square in a sphere I thought of a problem, and would like to know your approach. As hinted at in the title already, what the biggest square possible to fit in the standard sphere $S^1$. I calculated it basically mechanincally. It is basically the square with length $2*\sin\pi/4=\frac{2}{\sqrt2}$. But i would like to approach it more technically. What I have done is, to think of the radius of the sphere and then using trigonometric identities to show it is $\sin\pi/4$

A: No need for trig identities. To fit a maximal square inside the unit circle, half of the diagonal must be equal to the radius. If $x$ is half of the sidelengths of the square we must thus have $2x^2 = 1$, so $x = \frac{1}{\sqrt{2}}$ and the sidelengths are $\frac{2}{\sqrt{2}}$.


text:
Q: php - json response returns empty I'm using slim in my rest api, this is a get method. When it is echoed the json array is empty.
$app->get("/users", function () {

$response = array();
$db = new DbHandler();

// fetching all users
$result = $db->getAllUsers();

$response["error"] = false;
$response["users"] = array();

// looping through result and preparing users array
while ($user = $result->fetch_assoc()) {
    $tmp = array();
    $tmp["id_user"] = $user["id_user"];
    $tmp["name"] = $user["name"];
    array_push($response["users"], $tmp);
}
//var_dump($tmp);
//var_dump($response);

echoRespnse(200, $response);
});

The var_dump show me perfectly the array, the problem is in the json_encode
EDIT: here is the code of the echoResponse
function echoRespnse($status_code, $response) {
    $app = \Slim\Slim::getInstance();
    $app->status($status_code);

    // setting response content type to json
    $app->contentType('application/json');

    echo json_encode($response);
}

EDIT 2: the var_dump of the $response
array(2) {
  ["error"]=>
  bool(false)
  ["users"]=>
  array(8) {
    [0]=>
    array(2) {
      ["id_user"]=>
      int(1)
      ["name"]=>
      string(14) "Pedro Gonzalez"
    }
    [1]=>
    array(2) {
      ["id_user"]=>
      int(2)
      ["name"]=>
      string(14) "Juan Marcano"
    }
    [2]=>
    array(2) {
      ["id_user"]=>
      int(3)
      ["name"]=>
      string(12) "Ana Maria"
    }
    [3]=>
    array(2) {
      ["id_user"]=>
      int(4)
      ["name"]=>
      string(13) "Eduado Perez"
    }
    [4]=>
    array(2) {
      ["id_user"]=>
      int(5)
      ["name"]=>
      string(12) "Gilberto Perez"
    }
    [5]=>
    array(2) {
      ["id_user"]=>
      int(6)
      ["name"]=>
      string(12) "Roberto Perez"
    }
    [6]=>
    array(2) {
      ["id_user"]=>
      int(7)
      ["name"]=>
      string(12) "Juan Perez"
    }
    [7]=>
    array(2) {
      ["id_user"]=>
      int(8)
      ["name"]=>
      string(15) "Juanito Alimaña"
    }
  }
}

EDIT 3: I've solved the problem. Was something about the charset of the database, i've added this code to my connect function and its work now like a charm.
function connect() {
    include_once dirname(__FILE__) . './Config.php';

    // Connecting to mysql database
    $this->conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);

    // magic trick
    if (!$this->conn->set_charset("utf8")) {
         printf("Error cargando el conjunto de caracteres utf8: %s\n", $mysqli->error);
         exit();
    } else {
         printf("Conjunto de caracteres actual: %s\n", $this->conn->character_set_name());
    }

    // Check for database connection error
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    // returing connection resource
    return $this->conn;
}


text:
Q: Hadoop Mapreduce MultipleOutputs Output Console I see a discrepancy between the console log when i run a mapreduce with and without multipleOutputs.
I have a mapper only job that outputs to a text file.
Without the MultipleOutputs configured,
Code Snippet in my Mapper:
context.write(null,new Text(value));

Console output excerpt
Map-Reduce Framework
       Map input records=2
       Map output records=2

With the MultipleOutputs,
Code Snippet in my Mapper:
multipleOutputs.write(null,new Text(value),FileOutputFormat.getOutputPath(context).toString() +  Path.SEPARATOR + "v");

Console output excerpt
Map-Reduce Framework
       Map input records=2
       Map output records=0

Driver code to avoid empty part file
LazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class);

Note the number of output records. Although, its showing as 0 in the second case, i still see the correct output in the file. The file name generated is v-m-00000.
Am i missing something?

A: Map output records counts the number of key-value pairs that the mappers emit (using context.write()). This is the only way to pass records from mappers to reducers and that is the reason why this counter exists.
If you want to count the number of records written from any other method, or actually, if you want to count anything else, you have to define your own custom counter, which I recommend in your case.


text:
Q: HAProxy - how to append client ip in X-Client-IP and X-Forwarded-For headers? I have a problem with HAProxy server. I want to forward in header a client IP. I almost done it, but there is interesting case and I can't figure it out. I need to write client IP in 2 places in header, in X-CLIENT-IP and X-FORWARDED-FOR tag's.
The problem is: When I use
option http-server-close
option forwardfor

On target server I see in header X-FORWARDED-FOR=xxx.xxx.xxx.xxx(client ip) but there is no x-client-ip header.
When I use:
option forwardfor header X-Client-IP
option http-server-close

On target server I see header X-CLIENT-IP=xxx.xxx.xxx(client IP) but X-FORWARDED-FOR=xxx.xxx.xxx.xxx(HAProxy ip)
I need to see on target header where X-CLIENT-IP and X-FORWARDED-FOR has value of client IP.
I try to mix configurations like
 option forwardfor
 option forwardfor header X-Client-IP
 option http-server-close

No efect. I can not also install any modules. The target is IIS.
Any ideas? :(

A: If you want to use both, you'll need to add the second with an http-request keyword.
# add X-FORWARDED-FOR
option forwardfor
# add X-CLIENT-IP
http-request add-header X-CLIENT-IP %[src]

A: You can try setting up custom header, like this:
http-request set-header X-Client-IP %[src]

Or, you can even copy it from X-Forwarded-For header, I think syntax would go something like:
http-request set-header X-Client-IP req.hdr_ip([X-Forwarded-For])

A: Suggested answer above that did not work for KacproSo just needed to read the value by adding &[...], so this should work fine:
http-request set-header X-Client-IP %[req.hdr_ip([X-Forwarded-For])]

A: Trying on HAproxy 1.7 this is the correct syntax that makes this work, without the square brakets around X-Forwarded-For
   http-request set-header X-Client-IP %[req.hdr_ip(X-Forwarded-For)]

A: this one works best for me:
backend example
    mode http
    option forwardfor
    http-request set-header X-Forwarded-For %[src]

A: Your can install a module called mod_rpaf on your backend server(s). This copies the X-FORWARDED-FOR IP to the X-CLIENT-IP. For more information see this. On Windows you should have similar modules, something like X-Forwarded-For ASAPI filters.


text:
Q: How to use a bash script to repeatedly feed a string into a program? I have a program that receives input through stdin.
It's something like "1 10".
What I want to do is a script that gives the "1 10" string thousands of times, because I need to make sure the program doesn't fail with big quantities of data.
I can't seem to be able to do this... Any help would be appreciated.

A: You can use a for loop in bash, and pipe the result to your program:
for i in {1..1000}
do
    echo "My input"
done | ./my_program

Or as one line which can be used directly from the command line:
for i in {1..1000}; do echo "My input"; done | ./my_program

A: This is an endless loop:
while :; do echo "1 10"; done | consumer

Or a less aggressive version:
while sleep 1; do echo "1 10"; done | consumer

A: yes does that.
$: yes 1 10 | head
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10

So for an infinite input,
yes 1 10 | myProg

Or if you want a limit,
yes 1 10 | head -99999 | myProg


text:
Q: Require in react can't resolve path I'm trying to use tracking-js library in my project I'm using react but I dont know if I'm doing anything wrong but keep showing that the module is not found, I already check my package.json and the module install. So this is how I require the module:
const tracking = require("tracking");

what am I doing wrong?

A: For node, including node-based build tools, first make sure that the module is present. Keep in mind that require does not care about the package.json of your app, only about the module files being present.

*

*Check if node_modules/tracking is present.

*Make sure the "main" JS file can be found. If there's a node_modules/tracking/package.json file, see if it has a main property and if the file it references exists. If there is no main property, make sure there's an index.js in the root of the module directory.

*If all this is fine and you're getting the module not found error at runtime in client-side JavaScript, then your bundling config may be incorrect, and your webpack/browserify/whatever config will have to be scrutinized for bugs.


text:
Q: Code thesis' title page I want to make my thesis' title page like the one in the image below but I'm not able to reproduce it. Can somebody help me?

MWE:
\documentclass[11pt,a4paper,twoside,openright]{book}

\usepackage{tabularx}
\usepackage{subfigure}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage[scriptsize]{caption}
\graphicspath{ {images/} }
\usepackage{graphicx}
\hyphenation{a-gen-tiz-za-zio-ne}
\begin{document}
\thispagestyle{empty}
%\begin{titlepage}
\vspace*{-4.5cm} \mdseries{
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=5cm]{logo.png}
% \psfig{file=./pictures/logopm.jpg,width=3.5cm}
\end{center}
\end{figure}
\begin{center}
\Large
\textsc{Universit\`a di Firenze}\\
Scuola di Ingegneria\\
\vspace*{0.5cm}
\normalsize
Corso di Laurea Triennale in \textsc{Ingegneria Elettronica e delle Telecomunicazioni}\\
Dipartimento di \textsc{ Ingegneria dell'Informazione}\\
\vspace*{2cm} \LARGE

\textmd{TITOLO DELLA TESI}\\

\vspace*{1.5truecm} \small
Tesi di \\
\large
\vspace*{0.3cm}
Nome Candidato \\
\end{center}
\vspace*{2.0cm} \large
\begin{flushleft}
\small
Relatori:\\
\normalsize
\vspace*{0.5cm}
Ing. Nome Cognome \\
\vspace*{0.08cm}
Prof. Nome Cognome \\

\end{flushleft}
\vspace*{1.0cm}
\begin{flushleft}
\small
Candidato:\\
\normalsize
\vspace*{0.5cm}
Nome Cognome \\

\end{flushleft}
\vspace*{3cm}
\begin{center}
\small

Sessione di Laurea 16 Luglio 2018\\
Anno Accademico 2017/2018
\end{center} \clearpage
}
\end{document}

A: In the follwing MWE I have added the horizontal lines as well as the dotted lines. Some vertical spaces might need further improvement, but this might give you some ideas.
\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{graphicx}

\begin{document}

\thispagestyle{empty}

\vspace*{-4.5cm}
\mdseries{

\begin{center}
\includegraphics[width=5cm]{example-image}

{\Large
\textsc{Universit\`a di Firenze}\\
Scuola di Ingegneria}\\
\rule{7cm}{1pt}

\vspace*{0.5cm}

Corso di Laurea Triennale in \textsc{Ingegneria Elettronica e delle Telecomunicazioni}\\
Dipartimento di \textsc{ Ingegneria dell'Informazione}\\
\vspace*{2cm}

{\LARGE
\textmd{TITOLO DELLA TESI}
}

\vspace*{1.5truecm}

{\small
Tesi di
}

{\large
\vspace*{0.3cm}
Nome Candidato
}
\end{center}

\vspace*{2.0cm}

\begin{tabular}{@{}ll}
\small
Relatori:\\[0.5cm]
\normalsize
\quad Ing. Nome Cognome & ..............................\\[0.1cm]
\quad Prof. Nome Cognome & ..............................\\[1cm]
\small
Candidato:\\[0.5cm]
\normalsize
\quad Nome Cognome & ..............................\\
\end{tabular}

\vfill

\begin{center}
\rule{3cm}{1pt}

\small
Sessione di Laurea 16 Luglio 2018\\
Anno Accademico 2017/2018
\end{center}

\clearpage
}
\end{document}


text:
Q: Why is it that I cannot run or debug html on safari I am new and learning html using VsCode on Mac, I have written my first html code but before I could run, I was given only two options, chrome and Edge, why is it that I cannot run it on safari

A: You can open your html file in Safari. Just right click on it and choose "open with Safari". Or second solution, you open safari and you drag your file in.
Nevertheless, it is recommended to use Chrome or Firefox to do debugging. You can also use Brave which is great !


text:
Q: Is javax.swing.SwingUtilities.invokeLater nesessary? So I have seen countless different GUI tutorials, and all of them have said to use this code:
   public static void main(String[] args) {
     javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });

}

And although I may not quite understand what this exactly does, since I'm somewhat new to GUI, I do understand the basics of what it does... or so I thought. But then I, as an experiment, cut it all out, and just left:
   public static void main(String[] args) {
     createAndShowGUI();
   }

And it appeared to work. So now I have a question: what is the purpose of keeping the first piece of code I had, rather than just using the second, when it seemed like the second worked just as fine? If it is necessary, what will happen if I don't use it?

A: In short, yes, it is necessary whenever you make changes to any Swing object (unless the API says they are thread safe).
Any changes you make to the GUI must be made on the Event Dispatch Thread (EDT) because the Swing objects are not thread safe. From the Event Dispatch Thread Tutorial

Swing event handling code runs on a special thread known as the event
  dispatch thread. Most code that invokes Swing methods also runs on
  this thread. This is necessary because most Swing object methods are
  not "thread safe": invoking them from multiple threads risks thread
  interference or memory consistency errors. Some Swing component
  methods are labelled "thread safe" in the API specification; these can
  be safely invoked from any thread. All other Swing component methods
  must be invoked from the event dispatch thread. Programs that ignore
  this rule may function correctly most of the time, but are subject to
  unpredictable errors that are difficult to reproduce.

Calling SwingUtilities.invokeLater ensures that the code int he runnable is invoked on the EDT and you don't get weird errors. That is why when you removed that code it looks like everything is working, because in the situations you tested it probably did. But it might not always and you don't want to have code that works sometimes or has timing issues.


text:
Q: Is it possible to play Playstation Network games on my phone without owning a Playstation system? I want to play the games I own on PSN on my Android. I had to sell my PS4. Is this possible?

A: If they are playable on Android, yes. If not, no. It's that straightforward.
Most of the games offered on PSN cannot be played on an Android device.
PSN is the Playstation Network, a gaming platform similar to Steam and Uplay. While they mainly distribute games for Playstation consoles, I'm sure some of them can be played on an Android device (whether through emulation or not).


text:
Q: Failure starting Wlan connection with wpa_supplicant? I'm brand new to server configuration. I'm just a developer, so forgive me if I don't understand what you're talking about, if I haven't posted enough information, or if I don't understand your terminology.
You should know that my SSID is hidden. I have confirmed both the SSID and passkey are correct on a computer that is connected to the network.
What I've done so far:

*

*Installed Debian (Jessie) to an i386 "server."

*Installed wpa_supplicant.

*Read the "README.modes" file associated with wpa_supplicant

*Attempted to use the non-roaming method by changing my "interface" file in the "network" directory.

My attempt at #4 on that list was guided by this post. I did the following...

*

*Change the "interface" file permissions.

*Run the "wpa_passphrase" command.

*Copy the hashed PSK to the "interface" file.

My "interface" file now contains...
auto wlan0
iface wlan0 inet dhcp
     wpa-ap-scan 1
     wpa-scan-ssid 1
     wpa-ssid mySSID
     wpa-psk myHashedPSK

I have confirmed that my device is recognized by using "iwconfig" and that it is indeed defined as "wlan0."
The Problem:
"ifup wlan0" returns the following...
run-parts: failed to stat component /etc/network/if-pre-up.d/wpasupplicant: No such file or directory
Failed to bring up wlan0.

I have navigated to "/etc/network/if-pre-up.d/" and found something there named "wpasupplicant." When I open it in the text editor using "pico" I am greeted with what I assume is a completely empty file.
What is wrong with my configuration, and how do I fix it?

A: You are missing the wpasupplicant package. You need to install it properly first.
You can do it with apt-get as below:
apt-get install wpasupplicant
Make sure it is properly installed.
And then to be on the safe side, put double quotes around the values like following and try again:
wpa-ssid "mySSID"
wpa-psk "myHashedPSK"


text:
Q: Finding a 3-embedded subgroup. I have the group of order $108$, $$G=(((\mathbb{Z}_3 \times \mathbb{Z}_3)\ltimes \mathbb{Z}_3)\ltimes \mathbb{Z}_2) \ltimes \mathbb{Z}_2$$ obtained from an algorithm in GAP, but I need to prove that it has a $3$-embedded subgroup (a subgroup $H\leq G$ such that $p\mid \ \vert H\vert $ and for any $x\in G-H$, $p \nmid\ \vert H\cap {}^xH \vert$ where $^{x}H=xHx^{-1}$). Does anyone have an idea of how to attack it without using GAP algorithms?
If it helps, it's the group with Id $[108,17]$.


text:
Q: My app runs fine but the TextView won't show up I'm making this front page of my app. Unfortunately, only the TextView won't show. The button and the background run just fine. I have even added it to the relative layout but using the addView() function. Can someone please help?
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //layout
    RelativeLayout mainLayout = new RelativeLayout(this);
    mainLayout.setBackgroundColor(Color.BLUE);

    //button
    Button mainButton = new Button (this);
    mainButton.setText("Next");
    mainButton.setBackgroundColor(Color.RED);

    //textview
    TextView mainTextView = new TextView(this);
    mainTextView.setText("Juliet Daniel Lab Molecular Biology Cancer Research Center");
    mainTextView.setTextSize(30);
    mainTextView.setBackgroundColor(Color.GREEN);

    //sizing the button
    RelativeLayout.LayoutParams btnDetails = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT
    );
    //sizing the textview
    RelativeLayout.LayoutParams textViewDetails = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT
    );

    //give id's to position relatively...note it is preferable to do this in the res folder to avoid errors
    mainButton.setId(1);
    mainTextView.setId(2);

    //give rules to position widgets relatively
    textViewDetails.addRule(RelativeLayout.ABOVE, mainButton.getId());
    textViewDetails.addRule(RelativeLayout.CENTER_HORIZONTAL);
    textViewDetails.setMargins(0,0,0,50);

    //adding the button as a part of the RelativeLayout (ADDING THE BUTTON WIDGET TO LAYOUT)
    mainLayout.addView(mainButton, btnDetails);
    //adding the textview as a part of the relative Layout
    mainLayout.addView(mainTextView, textViewDetails);

    //setting the view as out layour
    setContentView(mainLayout);

}
}

A: It's because you set textview above button where the button is first top of root layout that's why it's not showing try to set textview below button and it's work
textViewDetails.addRule(RelativeLayout.BELOW, mainButton.getId());


text:
Q: Python, the status_code showed 404 I want to download some audio files from a website:
def downloadAudio(audioURL):
    response = requests.get(audioURL)
    if response.status_code == requests.codes.ok:
        temp_file = tempfile.NamedTemporaryFile(suffix='.mp3')
        temp_file.write(response.content)
        return temp_file
    else:
        print 'Download error: ', response.status_code
        return False

And I use it in this way:
temp_file = downloadAudio('http://www.izaodao.com' + audioLink)

Say the path is

http://www.izaodao.com/app/zdword/burouti95.mp3

in past two days, it worked and returned mp3 file, but today it didn't and returned status_code 404
But I can still open this website, which means it exists.
I don't know what happened? Is that because I requested too frequently therefore my IP was blocked but why I can still open it through Chrome?
And how can I fix this?


text:
Q: Executable Python Code - Repeated Null Outputs I am relatively new to the world of coding, attempting to do something slightly beyond my ken.
coming to the code, I am trying to run has two parts. The first part is -
import datetime
import time
import pandas as pd
import numpy as np
d1 = datetime.datetime.strptime('01/01/2016 11:59:57 AM','%m/%d/%Y %I:%M:%S %p')
d2 = datetime.datetime.strptime('01/31/2016 11:59:53 PM','%m/%d/%Y %I:%M:%S %p')
odtd = datetime.timedelta(seconds=05)
a = []

def tint():
    x = d1
    while  x < d2:
        x = x + odtd
        a.append(x.strftime('%m/%d/%Y %I:%M:%S %p'))
    return a

a= tint()
df3 = np.asarray(a)
np.savetxt("Check2.csv",df3,delimiter = ",", fmt = "%s", header = "Date Format")

The above code creates a .csv file which has indexed column's row entries every 5 seconds from a start to end date (d1,d2). You can save this file in your working directory and check the output.
Now the 2nd part of the code uses a .csv file (obtained from another source called UCA1) which have index column (%Y-%m-%dT%H:%M:%S) format and a random value in it's 2nd column. In an attempt to run a lookup from "Check2.csv" to "UCA1 Ticks" and store in a column in "Check2.csv", I write the below code -
#2nd Part
df1 = pd.read_csv("UCA1 Ticks.csv")
pd.read_csv("UCA1 Ticks.csv",names = ['UCA1 Curncy','Bid/Ask','Value'], parse_dates= ["UCA1 Curncy"])
df3 = pd.read_csv("Check1.csv")
pd.read_csv("Check2.csv")
u = list()
v = list()
w = list()
z = list()
t1 = datetime.timedelta(seconds=01)
len1 = len(df1.index)
len3 = len(df3.index)
r1 = df3.ix[:,0].tolist()
f1 = df1.ix[:,0].tolist()
f2 = df1.ix[:,0].tolist()

def main(z):
    i = 1
    global u
    while i <= len3:
        j = 1
        while j <= len1:
            if time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_year == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_year and time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_mon == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_mon and time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_mday == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_mday and time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_hour == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_hour and time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_min == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_min and time.strptime(r1[i],'%m/%d/%Y %I:%M:%S %p').tm_sec == time.strptime(f1[j],'%m/%d/%Y %I:%M:%S %p').tm_sec :
                u.append(f2[j])
        #Above if statement compares year, month, day, hour, min, sec and AM/PM
            j = j +1
        for k in u:
            v.append(k)
            w = pd.DataFrame({'v'})
            z.append(w[w.v>0].sum()/w[w.v>0].count())
        i = i + 1
    return z

So the final output from 2nd part of the code values from "UCA1 Ticks" is in the 2nd column of "Check2.csv" file. When I run this code (which is running, you can check it out) I get a null output for list z. Wante to know why this is always happening? I checked my indents and code again, but can't seem to figure out. Please help.
PS - There might be multiple entries in "UCA1 Ticks.csv" and hence added a for loop taking an average between all the values.


text:
Q: Drupal - adding square ads to the body of articles I need to insert a google adsense square box in the middle of all articles on the site.
What is the best approach?
The site is in drupal, so I figures I can hook to the view node function. this way the ad won't be saved together with the article. does that make sense? If so, than the question is how do I ensure I won't have image on the other side of the ad (the ad is aligned to the left and should take 50% of the article width)?
should I be using a block? but how will I know to place the block in inside the block.
So in short, I really have no idea where to start to implement it... How is this thing implemented in all the news sites?

A: I'd approach it by implementing a custom input filter that would insert the AdSense code (or the AdSense module shortcode, if you want) into the processed text. Once you have that custom filter implemented, you'll have to enable it in the text format you're using for the content type.
For implementing a custom filter, take a look at filter_example here.

A: This solution is for Drupal 7. The solution which worked for me is that I used the adsense tags format and then used this format to show ads on the site. Note that this line doesnot need any js inclusion or script tags. You just need to enable the Adsense tags format(I mean shortcode). Actually I was getting Ads disabled for admin and for other users i was getting the empty ad with space occupied on page but nothing shown. After different tweaks and experiments I got the following code working for me
[adsense:336x280:XXXXXXXXXX]
2nd parameter is width x height
3rd parameter: XXXXXXXXXX denotes the google ad slot/id.
I hope this will help others.
Ata ul Mustafa

A:
I need to insert a google adsense square box in the middle of all articles on the site. What is the best approach?

From my experience:
On some drupal sites I used simply node editor to put box with adsense into content. For websites with not many nodes its best solution because of:
1) Box perfect fits in rest of content - you can change it manually.
2) Total control of viewed boxes - images, flash, text adds etc.
Etc.

But for websites with many nodes, this solution looks like stupid suicide.
Better option will be change node.tpl file in your theme folder. But there is some trouble. In this file, you have $content variable, with contains all of content in this node. This situation gives you ability to put box up or down of this node. But no in the middle. Perhaps solution will be to divide $content into 2x variables which will contains a half of contents. But question is - how do to it? Or maybe while content from node is saved into database, then you can put some html code with adsense box? And search best position to put box by regular expressions? Or maybe change all of nodes by adding html box directly in database?

should I be using a block? but how will I know to place the block in
  inside the block.

As I remember, you cannot put block inside another block.


text:
Q: Does Telerik require RadControls to be installed for development? Here's the situation:
I'm on a team developing a large WinForms application.  When Telerik released the 2013 Q2 release, we upgraded.  Some of the changes caused errors in our program.  So we rolled back to the Q1 installation and decided to upgrade in a controlled environment.  So we got an extra computer, installed the new RadControls release and fixed all the issues.  Now we're attempting to test on another computer, and we're getting errors.  Everything works fine on the computer with the new version installed.  When you try it on a computer with out the latest version, it crashes.
We're using TFS for source control, and the references are pointing to DLLs included in the source control, so I know that the references are pointing to the Q2 DLLs.  Also, if I move C:\Program Files (x86)\Telerik, the program works fine (on the same computer where it was already working).  Therefore, I know that there are no hidden references to the DLLs in Program Files.
My question boils down to this:  in order for those DLLs to work properly, is it required that RadControls be installed on a machine and for the installed version of RadControls to be the same version as the one in the build?
Maybe RadControls is pointing to some system thing that happens when you install the Q2 stuff.  I really don't know how it all works behind the scenes.  I'm just shooting in the dark now.

A: No, installation is not needed for the assemblies to be working and simply referencing the correct assemblies should allow you to run the project. Basically, setting the CopyLocal to true of the Telerik assemblies and copying the bin folder to another machine without installation should work with no issues.


text:
Q: Зачем в Python при выполнении команды print() пишется буква f? Вот пример:
print(f'Hi, {name}')

Для чего эта f?

A: Это называется F-strings(ф-строки), служит для более удобного форматирования строки, как на вывод текста, так и при вывода различных вычислений, понятно оформив их.
name = 'Alex'
print(f'Hello, my name is {name}') ### Hello, my name is Alex

print(f'2 x 2 = {2*2}') ### 2 x 2 = 4

whi

Более подробно тут!

A: f - format только в сокращенном виде, он нужен для того чтобы можно
было что-то вставить в таких скобках {} попробуйте также вывести текст но без этого f
Пример:
name = "World"
print(f"Hello, {name}")
out: "Hello, World"
# Теперь без f
print("Hello, {name}")
out: Hello, {name}
# Теперь при помощи просто format
print("Hello, {}".format(name))
out: "Hello, World"
# Но можно сделать и по другому
print("Hello, %s" % name)
out: "Hello, World"

Подробнее тут

A: Таким образом выполняется форматирование текста (или же базовое форматирование). То есть вместо:
print('Hi + str(name)!')

Мы можем написать:
print('Hi {name}!')

Обычно это используется когда приходится работать со множеством переменных при их выводе или составлении sql запроса к примеру. Также можно форматировать числа (и еще много чего дургого):
print("The number is:{:b}".format(123))

В такой записи в местах куда нужно вставить числа и/или переменнные остаются пустые {} (фигурные скобки). И уже в .format() в скобках записываются сами эти числа и/или переменные.
В данном примере в фигурных скобках сделана запись {:b} таким образом я указал что чсило 123 будет выведено в двоичном формате т.е. 110001 110010 110011. Таких типов форматирования чисел ещё очень много.
Более подробно познакомится с форматированием Вы можете здесь:
https://pythonworld.ru/osnovy/formatirovanie-strok-metod-format.html


text:
Q: Mask an input on appcelerator I have a phone input on my app:
<TextField id="FieldTelefone" class="textArea"></TextField>

I want to creat a telephone mask, preferably with REGEX, but I am having a hard time to do so on appcelerator.
I need it to be:
(xx)_xxxx-xxxx
or
(xx)_xxxx-xxxxx
the brazilian phone numbers pattern.
but I am not being able to do it with only javascript, I could however validate it, could anyone help me ?

A: This git repo will help you: https://github.com/Nyvra/titanium-appcelerator-fields-mask
You surely have to extend the script, but there you'll see how it works


text:
Q: how can i vertically align an element with twitter bootstrap? i know that this question has been asked many time but none of the solution is working for me. i simply want to align one label inside one div that is associated with a twitter-bootstrap class. but it is not being aligned. I have tried horizontal alignment with this and it was working fine. without bootstrap it was working fine but with bootstrap it stopped working.
any idea how it will work ?

A: Address the label instead
.center{
    width: 100px;
    height: 100px;
    border: 1px solid red;
    display: table;
}
.center label {
    display: table-cell;
    vertical-align: middle;
}

forked jsFiddle http://jsfiddle.net/s5dJH/

A: You can use line-height to your label and set it the same height as your div. This will align it perfectly.
See this demo.

A: Here you go
with the use of
display:table;

and
display:table-cell;
vertical-align:middle;

This way the label will always be centered, even if you resize the box
http://jsfiddle.net/s7Wb4/2/

A: try this
http://jsfiddle.net/s7Wb4/9/
.center{
width : 100px;
height : 100px;
display : table-cell;
float:none !important;
vertical-align : middle;
border : 1px solid red;
}


text:
Q: CAML Query for two reference fields that point to the same SharepointID I've got a SP2007 list (List A) with two reference-fiels (Column 1; Column 2) that reference items from a different list (List B). For some Opalis automation I need a CAML Query that gives me the results of where Column 1 = Column 2.
Any Ideas?

A: I'm assuming you are using a Lookup choice field. You'll need a query to run against List A like:
<Where>
   <And>
      <Eq><FieldRef Name="ColumnOne" LookupId="TRUE" /><Value Type="Integer">3</Value></Eq>
      <Eq><FieldRef Name="ColumnTwo" LookupId="TRUE" /><Value Type="Integer">3</Value></Eq>
   </And>
</Where>

Where the integer value of 3 is the ID of the choice in List B.
If you don't know the ID of the choice in list B, you'll have to look it up manually or with another query.


text:
Q: Count users according to custom meta_key tags In wordpress, I created a custom user field called profession by ACF. It includes names of the professions for the subscriber to choose. I now want to count the number of users who selected each of those professions and print their number on screen. The custom meta key is stored in user_meta table.
How can I do that by using a PHP Snippet and inserting a shortcode on the page to show it?
I found and used the code below, but I get O.
I don't know php as you can see.
Thanks for the help
<?php
$args  = array(
    'meta_key' => 'profession',
    'meta_value' => 'Doktor'
);
$users= new WP_User_Query( $args );
echo $users->get_total();
?>

A:

<?php
    // Download user list
    $users = get_users();
    foreach ($users as $user) {
        echo '
' . esc_html( $user->display_name ) . '
';
    }
?>

This code displays all users. You can call var_dump and check if it exists:
$user['meta_key'];

if so, just add conditions
if ($user['meta_key'] == 'Doctor') {
 ...
} else if ...


text:
Q: Static IP and netplan stop working a couple days after fresh install Ubuntu Server 18.04 LTS Having some major issues with networking on Ubuntu 18.04 LTS. Fresh install. I set a static IP during install which worked for a couple days and remained set after multiple reboots. Now the interface shows no IP. It seems when I set that IP it did generate a netplan that appears correct however netplan apply does nothing.
This happened to me previously as well on the previous install. I had been messing with some DNS stuff so I figured I'd just reimage the machine and not touch any of the network utilities this time and I still am having the issue.
The issue occurs about a day and a half after install seemingly randomly. Was not using the machine when the issue began and the only thing I have done so far on this install is set up a couple docker containers with samba and SFTP.
Contents of my 50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    renderer: networkd
    ethernets:
        enp0s25:
            dhcp4: no
            addresses: [192.168.0.32/24]
            gateway4: 192.168.0.1
            nameservers:
                addresses: [1.1.1.1,8.8.8.8]

Terminal output from netplan --debug apply
** (generate:2227): DEBUG: 23:11:19.520: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:2227): DEBUG: 23:11:19.520: starting new processing pass
** (generate:2227): DEBUG: 23:11:19.520: enp0s25: setting default backend to 1
** (generate:2227): DEBUG: 23:11:19.520: Generating output files..
** (generate:2227): DEBUG: 23:11:19.520: NetworkManager: definition enp0s25 is not for us (backend 1)
DEBUG:netplan generated networkd configuration exists, restarting networkd
DEBUG:no netplan generated NM configuration exists
DEBUG:enp0s25 not found in {}
DEBUG:Merged config:
network:
  bonds: {}
  bridges: {}
  ethernets:
    enp0s25:
      addresses:
      - 192.168.0.32/24
      dhcp4: false
      gateway4: 192.168.0.1
      nameservers:
        addresses:
        - 1.1.1.1
        - 8.8.8.8
  vlans: {}
  wifis: {}

DEBUG:Skipping non-physical interface: lo
DEBUG:Skipping non-physical interface: docker0
DEBUG:Skipping non-physical interface: br-98e8ea9c70cb
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for enp0s25
DEBUG:netplan triggering .link rules for docker0
DEBUG:netplan triggering .link rules for br-98e8ea9c70cb

My ifconfig
br-98e8ea9c70cb: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:51:a6:a3:66  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:d5:d6:46:8e  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s25: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:24:7e:00:e0:30  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xfc500000-fc520000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 7926  bytes 592108 (592.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7926  bytes 592108 (592.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

A: Have you configured the static IP in a correct manner? See This tutorial. Remeber, configuring static IP in 18.04 is different from 16.04.
Other than that i would recommend to see if any other host in the network has "stole" the IP, maybe try with an other static IP for the host. Make sure to ping the new static IP in order to make sure it is available.
Finally make sure you run sudo netplan apply, or sudo netplan --debug apply in order to run the new configurations.
My best guess is that /etc/netplan/50-cloud-init.yaml is configured wrong so go through it carefully one more time.
Good luck.


text:
Q: Removing part of string after specific character (from right to left) I want this to happen:
(left side is the full string. on the right side, after the "---->" is the output I want to get)
3.4.2.12 -----> 3.4.2
3.4.2.1-------? 3.4.2

I'm getting this:
3.4.2.12-----> 3.4.2.  (note the '.' in the end)
3.4.2.1-----? 3.4.2 (this is good for me)

I used this:
select
LEFT( column_name, len( column_name) - charindex('.',   column_name))
from table_name

A: If I understood your problem right, you want this:
select left( column_name, len(column_name) - charindex('.', reverse(column_name)) ) from table_name

Proof with hard-coded values:
select left( '3.4.2.12', len('3.4.2.12') - charindex('.', reverse('3.4.2.12'))) -- 3.4.2
select left( '3.4.2.1', len('3.4.2.1') - charindex('.', reverse('3.4.2.1'))) -- 3.4.2

A: If you want everything left of the last '.', you could use this code:
USE TEMPDB

SELECT SUBSTRING ('3.4.2.12', 1, LEN ('3.4.2.12') - (CHARINDEX ('.', REVERSE ('3.4.2.12'))))

A: DECLARE
    @var VARCHAR(20) = '3.4.2.12'

SELECT
    LEFT(@var, LEN(@var) - CHARINDEX('.', REVERSE(@var)))

SET @var = '3.4.2.1'

SELECT
    LEFT(@var, LEN(@var) - CHARINDEX('.', REVERSE(@var)))

We turn the word over, look for the dot, then subtract the position of the last dot from the length.


text:
Q: Why does my data not fit into a CUDA Texture Object? I'm trying to fill a CUDA Texture Object with some data but the call to cudaCreateTextureObject fails with the following error (edit: on both a GTX 1080TI and a RTX 2080TI):

GPU ERROR! 'invalid argument' (err code 11)

It works if I put less data into my texture so my guess is that my computation about how much data I can fit into a texture is off.
My thought process is as follows:
(executable code follows below)
My data comes in the form of (76,76) images where each pixel is a float. What I would like to do is to store a column of images in a Texture Object; as I understand it, cudaMallocPitch is the way to do this.
When computing the number of images I can store in one texture I'm using the following formula to determine how much space a single image needs:

GTX_1080TI_MEM_PITCH * img_dim_y * sizeof(float)

Where the first argument should be the memory pitch on a GTX 1080TI card (512 bytes). The number of bytes that I can store in a 1D texture is given as 2^27 here. When I divide the latter by the former I get 862.3, assuming this is the number of images I can store in one Texture Object. However, when I try to store more than 855 images in my buffer the program crashes with the error above.
Here's the code:
In the following the main function (a) sets up all the relevant parameters, (b) allocates the memory using cudaMallocPitch, and (c) configures and creates a CUDA Texture Object:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <cassert>

#define GTX_1080TI_MEM_PITCH   512
#define GTX_1080TI_1DTEX_WIDTH 134217728 // 2^27

//=====================================================================[ util ]

// CUDA error checking for library functions
#define CUDA_ERR_CHK(func){ cuda_assert( (func), __FILE__, __LINE__ ); }
inline void cuda_assert( const cudaError_t cu_err, const char* file, int line ){
    if( cu_err != cudaSuccess ){
        fprintf( stderr, "\nGPU ERROR! \'%s\' (err code %d) in file %s, line %d.\n\n", cudaGetErrorString(cu_err), cu_err, file, line );
        exit( EXIT_FAILURE );
    }
}

// CUDA generic error checking (used after kernel calls)
#define GPU_ERR_CHK(){ gpu_assert(__FILE__, __LINE__); }
inline void gpu_assert( const char* file, const int line ){
    cudaError cu_err = cudaGetLastError();
    if( cu_err != cudaSuccess ){
        fprintf( stderr, "\nGPU KERNEL ERROR! \'%s\' (err code %d) in file %s, line %d.\n\n", cudaGetErrorString(cu_err), cu_err, file, line );
        exit(EXIT_FAILURE);
    }
}

//=====================================================================[ main ]

int main(){

    // setup
    unsigned int img_dim_x = 76;
    unsigned int img_dim_y = 76;
    unsigned int img_num   = 856;  // <-- NOTE: set this to 855 and it should work - but we should be able to put 862 here?

    unsigned int pitched_img_size = GTX_1080TI_MEM_PITCH * img_dim_y * sizeof(float);
    unsigned int img_num_per_tex  = GTX_1080TI_1DTEX_WIDTH / pitched_img_size;

    fprintf( stderr, "We should be able to stuff %d images into one texture.\n", img_num_per_tex );
    fprintf( stderr, "We use %d (more than 855 leads to a crash).\n", img_num );

    // allocate pitched memory
    size_t img_tex_pitch;
    float* d_img_tex_data;

    CUDA_ERR_CHK( cudaMallocPitch( &d_img_tex_data, &img_tex_pitch, img_dim_x*sizeof(float), img_dim_y*img_num ) );

    assert( img_tex_pitch == GTX_1080TI_MEM_PITCH );
    fprintf( stderr, "Asking for %zd bytes allocates %zd bytes using pitch %zd. Available: %zd/%d\n",
        img_num*img_dim_x*img_dim_y*sizeof(float),
        img_num*img_tex_pitch*img_dim_y*sizeof(float),
        img_tex_pitch,
        GTX_1080TI_1DTEX_WIDTH - img_num*img_tex_pitch*img_dim_y*sizeof(float),
        GTX_1080TI_1DTEX_WIDTH );

    // generic resource descriptor
    cudaResourceDesc res_desc;
    memset(&res_desc, 0, sizeof(res_desc));
    res_desc.resType = cudaResourceTypePitch2D;
    res_desc.res.pitch2D.desc = cudaCreateChannelDesc<float>();
    res_desc.res.pitch2D.devPtr = d_img_tex_data;
    res_desc.res.pitch2D.width  = img_dim_x;
    res_desc.res.pitch2D.height = img_dim_y*img_num;
    res_desc.res.pitch2D.pitchInBytes = img_tex_pitch;

    // texture descriptor
    cudaTextureDesc tex_desc;
    memset(&tex_desc, 0, sizeof(tex_desc));
    tex_desc.addressMode[0] = cudaAddressModeClamp;
    tex_desc.addressMode[1] = cudaAddressModeClamp;
    tex_desc.filterMode     = cudaFilterModeLinear;  // for linear interpolation (NOTE: this breaks normal integer indexing!)
    tex_desc.readMode       = cudaReadModeElementType;
    tex_desc.normalizedCoords = false;  // we want to index using [0;img_dim] rather than [0;1]

    // make sure there are no lingering errors
    GPU_ERR_CHK();
    fprintf(stderr, "No CUDA error until now..\n");

    // create texture object
    cudaTextureObject_t img_tex_obj;
    CUDA_ERR_CHK( cudaCreateTextureObject(&img_tex_obj, &res_desc, &tex_desc, NULL) );

    fprintf(stderr, "bluppi\n");
}

This should crash when cudaCreateTextureObject is called. If the img_num parameter (at the start of main) is changed from 856 to 855, however, the code should execute successfully. (edit: The expected behavior would be that the code runs through with a value of 862 but fails with a value of 863 since that actually requires more bytes than the documented buffer size offers.)
Any help would be appreciated!

A: Since you're working with a 2D texture here, the number of bytes you can store in a 1D texture (the "width") is of no relevance here.
2D textures may have different characteristics depending on the type of memory that provides the backing for the texture.  Two examples are linear memory and CUDA Array.  You have chosen to use a linear memory backing (that which is provided by cudaMalloc* operations other than cudaMallocArray).
The primary problem you are running into is the maximum texture height.  To discover what this is, we could refer to the table 14 in the programming guide, which lists:
Maximum width and height for a 2D texture reference bound to linear memory  65000 x 65000
You are exceeding this 65000 number when going from 855 to 856 images, for an image height of 76 rows.  856*76 = 65056, 855*76 = 64980
"But wait" you say, that table 14 entry says texture reference, and I am using a texture object.
You are correct, and table 14 doesn't explicitly list the corresponding limit for texture objects.  In that case, we have to refer to the device properties readable from the device at runtime, using cudaGetDeviceProperties().  If we review the data available there, we see this readable item:
maxTexture2DLinear[3] contains the maximum 2D texture dimensions for 2D textures bound to pitch linear memory.

(I suspect the 3 is a typo, but no matter, we only need the first 2 values).
This is the value we want to be sure.  If we modify your code to obey that limit, there are no problems:
$ cat t382.cu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <cassert>

#define GTX_1080TI_MEM_PITCH   512
#define GTX_1080TI_1DTEX_WIDTH 134217728 // 2^27

//=====================================================================[ util ]

// CUDA error checking for library functions
#define CUDA_ERR_CHK(func){ cuda_assert( (func), __FILE__, __LINE__ ); }
inline void cuda_assert( const cudaError_t cu_err, const char* file, int line ){
    if( cu_err != cudaSuccess ){
        fprintf( stderr, "\nGPU ERROR! \'%s\' (err code %d) in file %s, line %d.\n\n", cudaGetErrorString(cu_err), cu_err, file, line );
        exit( EXIT_FAILURE );
    }
}

// CUDA generic error checking (used after kernel calls)
#define GPU_ERR_CHK(){ gpu_assert(__FILE__, __LINE__); }
inline void gpu_assert( const char* file, const int line ){
    cudaError cu_err = cudaGetLastError();
    if( cu_err != cudaSuccess ){
        fprintf( stderr, "\nGPU KERNEL ERROR! \'%s\' (err code %d) in file %s, line %d.\n\n", cudaGetErrorString(cu_err), cu_err, file, line );
        exit(EXIT_FAILURE);
    }
}

//=====================================================================[ main ]

int main(){

    cudaDeviceProp prop;
    cudaGetDeviceProperties(&prop, 0);
    size_t max2Dtexturelinearwidth = prop.maxTexture2DLinear[0];  // texture x dimension
    size_t max2Dtexturelinearheight = prop.maxTexture2DLinear[1]; // texture y dimension
    fprintf( stderr, "maximum 2D linear texture dimensions (width,height): %lu,%lu\n", max2Dtexturelinearwidth, max2Dtexturelinearheight);

    // setup
    unsigned int img_dim_x = 76;
    unsigned int img_dim_y = 76;
    //unsigned int img_num   = 856;  // <-- NOTE: set this to 855 and it should work - but we should be able to put 862 here?
    unsigned int img_num = max2Dtexturelinearheight/img_dim_y;
    fprintf( stderr, "maximum number of images per texture: %u\n", img_num);

    unsigned int pitched_img_size = GTX_1080TI_MEM_PITCH * img_dim_y * sizeof(float);
    unsigned int img_num_per_tex  = GTX_1080TI_1DTEX_WIDTH / pitched_img_size;

    fprintf( stderr, "We should be able to stuff %d images into one texture.\n", img_num_per_tex );
    fprintf( stderr, "We use %d (more than 855 leads to a crash).\n", img_num );

    // allocate pitched memory
    size_t img_tex_pitch;
    float* d_img_tex_data;

    CUDA_ERR_CHK( cudaMallocPitch( &d_img_tex_data, &img_tex_pitch, img_dim_x*sizeof(float), img_dim_y*img_num ) );

    assert( img_tex_pitch == GTX_1080TI_MEM_PITCH );
    fprintf( stderr, "Asking for %zd bytes allocates %zd bytes using pitch %zd. Available: %zd/%d\n",
        img_num*img_dim_x*img_dim_y*sizeof(float),
        img_num*img_tex_pitch*img_dim_y*sizeof(float),
        img_tex_pitch,
        GTX_1080TI_1DTEX_WIDTH - img_num*img_tex_pitch*img_dim_y*sizeof(float),
        GTX_1080TI_1DTEX_WIDTH );

    // generic resource descriptor
    cudaResourceDesc res_desc;
    memset(&res_desc, 0, sizeof(res_desc));
    res_desc.resType = cudaResourceTypePitch2D;
    res_desc.res.pitch2D.desc = cudaCreateChannelDesc<float>();
    res_desc.res.pitch2D.devPtr = d_img_tex_data;
    res_desc.res.pitch2D.width  = img_dim_x;
    res_desc.res.pitch2D.height = img_dim_y*img_num;
    res_desc.res.pitch2D.pitchInBytes = img_tex_pitch;

    // texture descriptor
    cudaTextureDesc tex_desc;
    memset(&tex_desc, 0, sizeof(tex_desc));
    tex_desc.addressMode[0] = cudaAddressModeClamp;
    tex_desc.addressMode[1] = cudaAddressModeClamp;
    tex_desc.filterMode     = cudaFilterModeLinear;  // for linear interpolation (NOTE: this breaks normal integer indexing!)
    tex_desc.readMode       = cudaReadModeElementType;
    tex_desc.normalizedCoords = false;  // we want to index using [0;img_dim] rather than [0;1]

    // make sure there are no lingering errors
    GPU_ERR_CHK();
    fprintf(stderr, "No CUDA error until now..\n");

    // create texture object
    cudaTextureObject_t img_tex_obj;
    CUDA_ERR_CHK( cudaCreateTextureObject(&img_tex_obj, &res_desc, &tex_desc, NULL) );

    fprintf(stderr, "bluppi\n");
}
$ nvcc -o t382 t382.cu
$ cuda-memcheck ./t382
========= CUDA-MEMCHECK
maximum 2D linear texture dimensions (width,height): 131072,65000
maximum number of images per texture: 855
We should be able to stuff 862 images into one texture.
We use 855 (more than 855 leads to a crash).
Asking for 19753920 bytes allocates 133079040 bytes using pitch 512. Available: 1138688/134217728
No CUDA error until now..
bluppi
========= ERROR SUMMARY: 0 errors
$


text:
Q: i3 messed up after Ubuntu update So after updating my packages today, i3 is messed up. As far as I can tell all my config files are still in the correct place / present, I am not sure why and what on gods green earth is happening. Can't find anything in i3 error logs.
None of my hotkeys work, in fact no keys seem to work at all. The bar does get loaded with the correct fonts but appears at the bottom of the screen instead of top as specified, the background does not get changed by the ~/.i3/config script (with feh), making me believe that it is no longer being called. The bar may be called by the default and load the bar's presets. Why?
I'm not sure what more detail to provide. Here is .i3/config, i3 status config.
What can I do to fix this and prevent it from ever wasting my time again? Is it recommended to avoid installing i3 from the package manager?

A: I had an old/default config file at ~/.config/i3/config as well and somehow the priority of loading changed during the update. Deleted it, fixed.
i3 --moreversion | grep config may be of debugging help for others in similar cases.


text:
Q: vim replace after failed replace in macro I have a big sequence of find and replace's in a macro
:let@m=':%s/√/\\sqrt/g
:%s/∫/\\int/g
:%s/∑/\\sum/g
:%s/∏/\\prod/g
:%s/⋃/\\bigcup/g
:%s/⋂/\\bigcap/g
:%s/∪/\\cup/g
:%s/∩/\\cap/g
:%s/∂/\\partial/g
:%s/–/\--/g
:%s/—/\---/g
:%s/•/\\bullet/g
:%s/·/\\cdot/g
:%s/◦/\\circ/g
:%s/±/\\pm/g
:%s/∓/\\mp/g
<more stuff/>
'

If any one of these find and replace's fails (for instance if there is no ∫ in the file), the subsequent ones don't get run.  How can I make :%s///g fail quietly and nondestructively?

A: From :help :s_flags:
[e]    When the search pattern fails, do not issue an error message and, in
       particular, continue in maps as if no error occurred.  This is most
       useful to prevent the "No match" error from breaking a mapping.

so:
%s/√/\\sqrt/ge
%s/∫/\\int/ge
…


text:
Q: Repeatedly Iterating Through a List I have a list like such:
List<Thing> foo = new List<Thing>();
foo.PopulateWithFourThings();

And I want to iterate through it over and over, such as 0123012301230123...
Foreach is not what I am looking for, because I do not want everything all at once.  I have been messing with Queues, and am wondering if Queues are appropriate here?  Or if there is something better than Queues for this.
I am looking for the best code practice in this situation (repeatedly iterate through a list).
So is there a better option than:
    if (nextElementIsNeeded)
    {
        Thing thing = foo[0];
        foo.RemoveAt(0);
        foo.Add(thing);
        return thing;
    }

Or the following code using a Queue:
    Queue<Thing> foo = new Queue<Thing>();
    foo.PopulateWithForThings();
    //////////////////////////////////////
    if (nextElementIsNeeded)
    {
        Thing thing = foo.Dequeue();
        foo.Enqueue(thing);
        return thing;
    }

A: Instead of constantly adding and removing the same Items to/from a collection (no matter which type), simply use a circular index to access the list you have.
int currentElementIndex = 0;
//..

if (nextElementIsNeeded)
{
  currentElementIndex = (currentElementIndex + 1) % foo.Count;
  thing = foo[currentElementIndex];
}

A: Not sure of the practicality, but here's an extension method that would do it:
public static IEnumerable<T> SelectForever<T>(this IEnumerable<T> source)
{
    while(true)
        foreach(T item in source)
            yield return item;
}

or to add a projection:
public static IEnumerable<TResult> SelectForever<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
{
    while(true)
        foreach(TSource item in source)
            yield return selector(item);
}

usage would be:
foreach(Thing item in foo.SelectForever())
{
    ...hopefully break at some point
}

or
foreach(string s in foo.SelectForever(item => item.ToString()))
{
    ...hopefully break at some point
}

Note that this is only possible because of deferred execution - calling foo.SelectForever().ToList() would run until it ran out of memory.


text:
Q: Simple div container for map not displaying correctly in FF or chrome I'm attempting to display a map using the ARCGis javascript API and dojo inside a dot net nuke module. In IE9 this works fine, however in firefox and chrome The map centers offscreen and only half of it can be seen within the div. The other half of the div has the zoom in and out segment placed correctly, but its just a white backdrop for that half. I can drag the map to fill the area, but as soon as I let go it slides back to a random point closer to the middle. Objects added in additional layers don't render correctly either.
Using the debugger in chrome I get the following errors:
XMLHttpRequest cannot load . Origin http://localhost:63579 is not allowed by Access-Control-Allow-Origin.
XMLHttpRequest cannot load http://server.arcgisonline.com/ArcGIS/rest/info?f=json. Origin http://localhost:63579 is not allowed by Access-Control-Allow-Origin.
Resource interpreted as Script but transferred with MIME type text/pl

My primary code in the ascx file is as follows.
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dijit/themes/claro/claro.css" />
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" />
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/grid/resources/Grid.css" />

<telerik:RadCodeBlock runat="server" ID="RadScriptBlock1">

</telerik:RadCodeBlock>

Here is the container

My research thus far says that I need to handle the httpcontext in page load, but that did nothing, and implies the web service is the problem. But as these services show fine in an iframe in other pages in all browsers, I am skeptical. Doubly so since that would be a base map from esri, I suspect they have their products working.
One other thing to note, this was not a problem when I was using the API version 1.6.
Any thoughts on why this is misbehaving?


text:
Q: Unable to load the service index for source https://api.nuget.org/v3/index.json in vs2022 I reinstalled Visual Studio 2022 after reinstalling Windows, and when I reopen my project written with .NET Core 6, I get this error when building the project.
Error image


text:
Q: RegEx (.net) to remove first character and everything after the last underscore I have this Regex that breaks if there is a - or ~ or = or any special character(s) in the string. Basically, I want to remove the first letter (which is a) and remove everything after the last underscore. (RegEx must be one liner) For example, Tester link http://regexstorm.net/tester?p=%28%3f%3c%3da%29%5b%5cw+%5d%2b%28%3f%3d_%29&i=aPersonal+Protective+Equipment_REV2.docx%0d%0aaFreight+Forwarder+Standard+Operating+Procedure+-++Armenia_REV1.docx&o=i
(?<=a)[\w ]+(?=_)

aPersonal Protective Equipment_REV2.docx - Works for this string (outcome is Personal Protective Equipment)
However fails for following string
aFreight Forwarder Standard Operating Procedure -  Armenia_REV1.docx (outcome is rmenia)

A: Changing the pattern to this appears to address the issue of the dash:
(?<=a)[\w\-=~ ]+(?=_)

My test cases:

aPersonal Protective Equipment_REV2.docx
  aFreight Forwarder Standard Operating Procedure - Armenia_REV1.docx
  aFreight Forwarder~~ Standard Operating= Procedure - Armenia_REV1.docx

\w matches words.  A dash is a word boundary.. to preserve it you have to match on it as well.
You might consider
(?<=^a).+?(?=_.+?$)

instead.  You would need multiline mode on if you were going to match more than one item at a time.
This one will match any character between the 1st character and the last underscore.

A: (^.*?(?=a)a)|_[^_]*$

The RegEx above worked (Replace and Ignore Cases)
asomefile_(rw_340-v4) follow up by_ver2.xlsx

result: somefile_(rw_340-v4) follow up by