text:
Q: Deleting a row with Php & MySQL I am new to php and SQL and just toying around with a project for my own understanding of accessing, updating and deleting data from my Database.
I have managed to show the selected data, create a button to delete a specific Id but really needing some assistance with deleting the selected row or record instead of hard coding in the ID in my delete php script.
Here is an example of my script:
<?php

    $sql = "SELECT id, firstname, lastname, joinDate FROM customers";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // output data of each row

        while($row =  $result->fetch_assoc()) {
            echo
                "
" .
                $row["id"]. ": " .
                $row["firstname"] . " " .
                $row["lastname"]. " " .
                $row["joinDate"]. " " .
                "
                    <form action='deleteMember.php' method='POST'>
                        <button type='submit'>Delete</button>
                    </form>
                " . " " .
                "Edit" .
                "

";
        }

    } else {
        echo "0 results";
    }

    $conn->close();

?>

Here is the delete.php
<?php

    // sql to delete a record
    $sql = "DELETE FROM customers WHERE id='6' ";

    if ($conn->query($sql) === TRUE) {
       header("Location: index.php");
    } else {
        echo "Error deleting record: " . $conn->error;
    }

    $conn->close();

?>

what I would like it to do is, delete the row from which you hit the delete button from and not just delete the row I have specified in the delete.php script. I understand HOW it should work by posting the id but not sure how to do it.

A: in place of your form use this
<a href="deleteMember.php?id=<?php echo $row['id'];?>">DELETE

and in your delete query must be like below
$sql = "DELETE FROM customers WHERE id='".$_GET['id']."' ";

A: Do like this
<?php

    // sql to delete a record
    $sql = "DELETE FROM customers WHERE id='".$_GET['id']."' ";

    if ($conn->query($sql) === TRUE) {
       header("Location: index.php");
    } else {
        echo "Error deleting record: " . $conn->error;
    }

    $conn->close();

?>

<?php

    $sql = "SELECT id, firstname, lastname, joinDate FROM customers";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // output data of each row

        while($row =  $result->fetch_assoc()) {
            echo
                "
" .
                $row["id"]. ": " .
                $row["firstname"] . " " .
                $row["lastname"]. " " .
                $row["joinDate"]. " " .
                "Delete" .
                "Edit" .
                "

";
        }

    } else {
        echo "0 results";
    }

    $conn->close();
?>

A: No need to add extra form element for Delete or Edit purpose. Try this way to pass the id of row for Eelete or Edit operation
while($row =  $result->fetch_assoc())
       {
            $id=$row['id'];// capture your row id & pass to your delete & edit
            echo
             "
" .
                 $row["id"]. ": " .
                 $row["firstname"] . " " .
                 $row["lastname"]. " " .
                 $row["joinDate"]. " " .
                 "
                    <a href='deleteMember.php?id=<?=$id;?>'>Delete
                 " . " " .
                 "
                     <a href='editMember.php?id=<?=$id;?>'>Edit
                 " .
                 "

";
        }

EDIT:
Then catch the id on your relevant page for your operation.
//deleteMember.php
<?php
    $id=$_GET['id'];
    // sql to delete a record
    $sql = "DELETE FROM customers WHERE id='".$id."'";

    if ($conn->query($sql) === TRUE) {
       header("Location: index.php");
    } else {
        echo "Error deleting record: " . $conn->error;
    }

    $conn->close();

?>

Note: Please Use Prepared Statements of PDO or MYSQLi instead to avoid SQL Injection and manual escaping.

A: or stay in your post form with:
 while($row =  $result->fetch_assoc()) {
            echo
                "
" .
                $row["id"]. ": " .
                $row["firstname"] . " " .
                $row["lastname"]. " " .
                $row["joinDate"]. " " .
                "
                    <form action='deleteMember.php' method='POST'>
                        <input type='hidden' name='myid' value='".$row['id']."' />
                        <button type='submit'>Delete</button>
                    </form>
                " . " " .
                "Edit" .
                "

";
        }

And in your delete.php :
<?php
    $id=(int) $_POST['myid'];

    // sql to delete a record
    $sql = "DELETE FROM customers WHERE id=".$id;

    if ($conn->query($sql) === TRUE) {
       header("Location: index.php");
    } else {
        echo "Error deleting record: " . $conn->error;
    }

    $conn->close();

?>


text:
Q: Error importing pygame I'm using python 3.3, on a windows 8 system, and have tried downloading all of the available python3.3 versions of pygame from bitbucket.
During the "Select Python Installation" page, it doesn't seem to be able to find my python installation, defaulting to "Python from another location".  When this is chosen, "import pygame" returns the common error of "module not found".
When I choose "feature will be installed on local hard drive", I can then type in the file path of my python, and then it seems to actually succeed, and it gets installed in what I think (but obviously don't know) is the correct location.  But, when I try to import it after after this, I get the following error message:
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "C:\Python33\lib\site-packages\pygame\__init__.py", line 127, in <module>
    from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application

I cannot find any fixes for this error online, so any help that I can get from people on here how to fix it would be hugely appreciated.  I apologize if anything is unclear and for my lack of experience.  Thank you in advance!

A: What has probably happened is you installed a 64-bit version of pygame when your base Python installation is 32-bit. Assuming that your machine is 64-bit-capable, and you're running a 64-bit version of Windows, download the 64-bit Python installer of Python 3.3 from python.org and install it. It will overwrite the 32-bit version of Python 3.3 you already have. Then, get the Python 3.3 amd64 version of Pygame (pygame-1.9.2a0.win-amd64-py3.3.exe) from here, Christoph Gohlke's Python Extension Packages for Windows respository. While unofficial and not supported, I've never had an issue with any of the packages here, as long as any prerequisites are also installed. I'd also recommend downloading the amd64-py3.3 version of NumPy from the same place, as it can speed up pygame in some instances.
In the future, make sure you know exactly what version and bitness of Python you're running before blindly downloading and trying to run module installers from the internet. Secondly, if you need a third-party module, check Gohlke's repository first.

A: Try downloading and installing the 2.7 version alongwith it downloadand install the pygame 2.7.msi it works on installing

redpajama_set_name: RedPajamaStackExchange


text:
Q: Evaluating $\int \frac{x^a}{(bx-1)^2} dx$ through hypergeometric function How may one integrate the function
$\frac{x^a}{(bx-1)^2}$ with respect to x?
I have attempted to evaluate the function with Mathematica and it gives the solution in the form of:
$\frac{x^{a+1}._2F_1(1, 2; 2-a; \frac{1}{1-bx})}{(a-1)(bx-1)^2}$
But I have no idea what substitutions have to be made for one to obtain the above solution.
Thanks in advance for the help

A: This is another possible evaluation of that integral. For $|bx|<1$
\begin{align*}\int \frac{x^a}{(bx-1)^2} dx&=\int x^a\sum_{k=1}^{\infty}k(bx)^{k-1} dx=\sum_{k=1}^{\infty}kb^{k-1}\int x^{a+k-1}\,dx
=\sum_{k=1}^{\infty}\frac{kb^{k-1} x^{a+k}}{a+k}+c\\
&=x^{a+1}\sum_{k=1}^{\infty}\frac{k(bx)^{k-1}}{a+k}+c
=x^{a+1}\sum_{k=1}^{\infty}(bx)^{k-1}-\frac{ax^{a}}{b}\sum_{k=1}^{\infty}\frac{(bx)^{k}}{a+k}+c\\
&=\frac{x^{a+1}}{1-bx}-\frac{ax^{a}}{b}\Phi(bx,1,a)+\frac{x^{a}}{b}+c\\
&=\frac{x^{a}}{b(1-bx)}-\frac{ax^{a}}{b}\Phi(bx,1,a)+c
\end{align*}
where $\Phi(z,s,a)$ is the Lerch Transcendent.


text:
Q: What are we Doing when we Connect to SQL Server? My apologies if this is simple, or off-topic for this site:
  I just wanted to know what goes on in the background when one connects to
SQL Server, say, within Management Studio. Just what is it we are connecting to,
is it a virtual machine, or some server somewhere?
Thanks for any explanations, refs. etc.

A: Usually, you are making a TCP connection to a remote host.
SSMS would ask your DNS server for the IP address associated with the hostname of the server, then initiate a TCP connection to that address on remote port 1433.
SSMS and MS SQL Server would then begin a conversation using the binary Tabular Data Stream protocol (TDS).
You type a query. SSMS encodes this query into TDS. SQL Server gets it, parses it, runs it, returns some data (encoded in TDS), back to SSMS, which decodes it and displays it on screen.
However, you can also connect to SQL Server installed on the same OS as SSMS, or running in a virtual machine on the same box.

A: In simple terms you connect to a Sql Server instance which runs on a Windows machine. This instance may be hosted on the same machine from where you are accessing it or on a remote windows server.


text:
Q: Combining an image and shapefile in MATLAB I've been trying to combine an image produced from a deforestation database called Hansen and a shapefile created in ArcGIS to make a georeference image. The script I've written so far is below but unable to figure out how to combine the two (I've tried several scripts including http://uk.mathworks.com/help/map/examples/creating-maps-using-mapshow.html?searchHighlight=overlay%20maps). Any assistance would be helpful!
Thank you,
Michelle
% Read in thresholded Hansen data
Data_FrenchGuiana = imread('FrenchGuiana_GFC_extract_thresholded.tif');
LossYear_FrenchGuiana = Data_FrenchGuiana(:,:,2);
LossYear_FrenchGuiana = double(LossYear_FrenchGuiana);
figure('color','white');
image(LossYear_FrenchGuiana)
imwrite(A,'LossYear_FrenchGuiana.tif')
country = shaperead('FrenchGuiana.shp');
figure mapshow(country);
xlabel('easting in meters')
ylabel('northing in meters')


text:
Q: ETL architecture I've been asked to make an ETL-style application that transfers information from one data source to another. At the moment, I've decided to use a three-layer architecture but I would like to find out more about the best practices as well as the life cycle described on this wikipedia page:
http://en.wikipedia.org/wiki/Extract,_transform,_load
Four-layered approach for ETL architecture design

*

*Functional layer: Core functional ETL processing (extract, transform, and load).

*Operational management layer: Job-stream definition and management, parameters, scheduling, monitoring, communication and alerting.

*Audit, balance and control (ABC) layer: Job-execution statistics, balancing and controls, rejects- and error-handling, codes management.

*Utility layer: Common components supporting all other layers.

Real-life ETL cycle
The typical real-life ETL cycle consists of the following execution steps:

*

*Cycle initiation

*Build reference data

*Extract (from sources)

*Validate

*Transform (clean, apply business rules, check for data integrity, create aggregates or disaggregates)

*Stage (load into staging tables, if used)

*Audit reports (for example, on compliance with business rules. Also, in case of failure, helps to diagnose/repair)

*Publish (to target tables)

*Archive

*Clean up

A: I don't know what your situation is or what your requirements are, but you're likely over thinking the problem.
The name alone is "the" architecture:

*

*Extract

*Transform

*Load

Exporting a DB table to a CSV can be considered "ET" while loading the CSV is the "L". Most ETL problems are simply not complicated.
Beyond that, you should grab any of the 1 or 2 million ETL and ESB packages already available in Java, free and commercial, libraries and full boat processing systems, and simply adopt one of them that you like best.
Get a white board, string some bubbles together with lines and turn that in to code.

A: To answer the question, "What's the best practice?" the answer depends on what you are trying to accomplish.
To simplify let's assume you are doing one of the following:

*

*You are building a data warehouse that will restructure the data in some way

*You are moving data from point A to point B, but you are not restructuring the data

When I use the word "restructuring", I mean changing the grain or lowest level of detail of a table.
For 1.  The ten steps outlined in your question is generally followed.  General best practices:

*

*As much transformation logic as possible is pushed onto database resources, not ETL software (ETL software is generally slower)

*Validate, Transform, and Audit steps are used to employ whatever Master Data Management (MDM) standards your organization uses

For 2.  This is much more straightforward so either method outlined in your question can be used.


text:
Q: How can I increase the time a Javascript drop-down menu remains on-screen? Is there any way to increase the time a drop-down menu created stays on screen?  The drop down menu just appears and disappears as I touch the cursor.  The drop-down was created using Prototype.

A: Use a different drop down menu:
Here's over 25 that might better suit your needs:

*

*http://www.noupe.com/css/multilevel-drop-down-navigation-menus-examples-and-tutorials.html
Or mention what drop down menu you are using so we can at least discover the option for you!

A: Whatever function you have attached to the rolloff of the menu to make it disappear, add that code to another function and use a setTimeout() call to pause for a time before removing the menu.
Example:
Old Code
var closeMenu = function() {
    $('menu').hide();
};

New Code
var hideMenu = function() {
    $('menu').hide();
};

var closeMenu = function() {
    setTimeout(hideMenu, 5000);
};

With that change, you've now delayed the menu's disappearing act for 5 seconds. Probably don't want to take that long but you get the idea.


text:
Q: Java ResultSet nex() return false I'm new here, I looked for something similar, but I have not found.
Here is my code to get List of mPessoas, however it's returning only 1 record, but there are more records.
public class PessoasDAO {

public static List<ObjectsBD> getAll(String sql) {
    Connection conn = null;
    PreparedStatement ps = null;
    List<ObjectsBD> mPessoasList = new ArrayList<>();
    try {
        conn = Conexao.getConnection();
        ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();

        Pessoas mPessoas = new Pessoas();
        Logradouro mLogradouro = new Logradouro();
        Bairro mBairro = new Bairro();
        Cidade mCidade = new Cidade();
        Estado mEstado = new Estado();
        Pais mPais = new Pais();

        while (rs.next()) {
            mPessoas.setId(rs.getInt(1));
            mPessoas.setNome(rs.getString(2));
            mLogradouro.setId(rs.getInt(3));
            mBairro.setId(rs.getInt(4));
            mCidade.setId(rs.getInt(5));
            mEstado.setId(rs.getInt(6));
            mPais.setId(rs.getInt(7));
            mLogradouro.setNome(rs.getString(8));
            mBairro.setNome(rs.getString(9));
            mCidade.setNome(rs.getString(10));
            mEstado.setNome(rs.getString(11));
            mPais.setNome(rs.getString(12));

            mPessoas.setLogradouro(mLogradouro);
            mPessoas.setBairro(mBairro);
            mPessoas.setCidade(mCidade);
            mPessoas.setEstado(mEstado);
            mPessoas.setPais(mPais);

            mPessoasList.add(mPessoas);

        }
    } catch (SQLException e) {
        System.out.println("ERRO: " + e.getMessage());
    } finally {
        if (ps != null) {
            try {
                ps.close();
            } catch (SQLException ex) {
                System.out.println("ERRO: " + ex.getMessage());
            }
        }
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException ex) {
                System.out.println("ERRO: " + ex.getMessage());
            }
        }
    }
    return mPessoasList;
}
}

Here mySQL Query;
SELECT p.*, l.nome AS logradouro, b.nome AS bairro, c.nome AS cidade, e.nome AS estado, pa.nome AS pais FROM pessoas AS p INNER JOIN logradouro AS l ON p.logradouroIdLogradouro = l.idLogradouro INNER JOIN bairro AS b ON p.bairroIdBairro = b.idBairro INNER JOIN cidade AS c ON P.cidadeIdCidade = c.idCidadeINNER JOIN estado AS e ON p.estadoIdEstado = e.idEstado INNER JOIN pais AS pa ON p.paisIdPais = pa.idPais ORDER BY p.nome ASC;

I Already tried, create a new Statement like,
PreparedStatement stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);

but doesn't work.
I would appreciate it if anyone knows explain why this is happening.
thank you


text:
Q: Android Contact Check if a contact has an email id I got the way to check if a contact has a phone number by using
HAS_PHONE_NUMBER
ContentResolver ContntRslverVar = getContentResolver();
Cursor ContctCorsorVar = ContntRslverVar.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

while (ContctCorsorVar.moveToNext())
{

    if (Integer.parseInt(ContctCorsorVar.getString(ContctCorsorVar.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0)
    {

    }
}

Similary is der a way to check email ? like
HAS_EMAIL
if (Integer.parseInt(ContctCorsorVar.getString(ContctCorsorVar.getColumnIndex(ContactsContract.Contacts.HAS_EMAIL))) > 0)
{

}

A: As a workaround, you can run a single query to get all the contact-ids that have emails, store those ids in a set, and use that as an "HAS_EMAIL" reference:
Set<Long> hasEmail = new HashSet<>();
// The Email class should be imported from CommonDataKinds.Email
Cursor cursor = getContentResolver().query(Email.CONTENT_URI, new String[] { Email.CONTACT_ID }, null, null, null);
while (cursor != null && cursor.moveToNext()) {
    hasEmail.add(cursor.getLong(0));
}
if (cursor != null) {
    cursor.close();
}

// now you can check if a contact has an email via:
if (hasEmail.contains(someContactId)) {
    // do something
}

// or iterate over all contact-ids that has an email
Iterator<Long> it = hasEmail.iterator();
while(it.hasNext()) {
    Long contactId = it.next();
    // do something
}


text:
Q: moving average in python I've tried to create a generator function which can find simple moving average of the list, but it doesn't work at all. I think the root of the problem might be in finding sum
def gen(lst, n):
    s = 0
    for i, _ in enumerate(lst):
        if lst[i] < n:
            s += lst[n - (n-i)]

my code does nothing when i play it. What should I do?

A: if lst[i] < n:

You do not define i
but I guess i is a index of lst so try:
for i, _ in enumerate(lst):
  if lst[i] < n:
    s += lst[n - (n-i)]

EDIT:
def gen(lst, n):
    if n > len(lst):
        print("Sorry can't do this")
    try:
        for i, _ in enumerate(lst[:-(n-1)]):
            s = sum(lst[i:i+n])
            yield s/n
    except ZeroDivisionError:
        print("Sorry can't do this")

A: You may have some issues with this code snippet because you did not include some relevant variables and how they are used.
Below is an example of how you can calculate a moving average of list_of_numbers, given a position p with a period of n.
def mAverage(list_of_numbers, p, n):
    if n < p:
        return sum(list_of_numbers[p-n:p])/n
    else:
        return sum(list_of_numbers[0:p])/(p + 1)

Note: At the beginning of the list this function will only calculate the moving average with a period equal to the position in the list.


text:
Q: Question about spectral sequences associated to filtered complexes with unbounded filtrations All references below are from McCleary's book, second edition.
Suppose that we have a filtered complex where the filtration is unbounded. Suppose that the associated spectral sequence is weakly convergent, as per Theorem 3.2. Then the spectral sequence converges to the filtered quotients of the cohomology, but this convergence is not unique as stated in the second last paragraph on page 64.
My question is that suppose the filtered complex is weakly convergent and that the induced filtration on the cohomology is Hausdorff, can we then construct the cohomology uniquely up to extension problems? In the book it seems as if the spectral sequence uniquely determines a target only after we take a completion as per Definition 3.11. Basically I don't understand why the completion condition is necessary.
Thanks!

A: Suppose we have $\bigoplus_\mathbb{N}\mathbb{Z}$ and $\prod_\mathbb{N}\mathbb{Z}$. Both modules hava a canonical decreasing filtration where the $k$-th filtration step consists of all elements whose first k coordinates vanish. Both filtrations have the same subquotients. From this information you cannot distinguish $\bigoplus_\mathbb{N}\mathbb{Z}$ and $\prod_\mathbb{N}\mathbb{Z}$, you can only say that their completions are the same.


text:
Q: Changing member types in inheritance Given a base class Base that has two derived classes, DerA and DerB, can the derived classes have a member variable that is used in a Base member function, but is a different type for each class?
class Base {
    * a // Declare a as *something*, so it can be used by "doWork"

    template <typedef T>
    void doWork(T b) { // Add another value to "a" which is of its same type
        a += b; // For example; an operation that works on "a", no matter what numeric type it is
    }
}

class DerA : public Base {
    // Make "a" an int
}

class DerB : public Base {
    // Make "a" a float
}

In practice, a will be a base struct, while DerA and DerB will have derived versions of the base struct (derivative classes will each have a derived form of the struct specific to their purpose, but each must do a simple operation on a, so it seems pointless to copy/paste that simple function for each derivative when I can just use a template function).  I would just type a as the base struct type, but then I lose access to the various specialized member functions and variables that each derived struct has (if I understand inheritance correctly).
I apologize if this question is a repeat, but I don't know what this quality would be called, so Googling proved fruitless.

A: What you might want is the CRTP.
template<class D>
struct Base {
  D* self() { return static_cast<D*>(this); }
  D const* self() const { return static_cast<D*>(this); }
  template<class T>
  void doWork(T b) {
    self()->a += b;
  }
};
struct DerA : public Base<DerA> {
  int a;
};
struct DerB : public Base<DerB> {
  double a;
};

Here we pass the derived type to our base class.  Within the base class, you can use self()-> to access fields in the derived type.  This allows basically full access to the derived type, while letting us share code in the base class.
Note that you cannot pass DerA and DerB around as a Base this way.  If you want that, you need a virtual method doWork, and virtual template methods don't exist.
CRTP stands for the curiously repeating template pattern, which I imagine is named because it is strange, it involves repeating a type, and it keeps on showing up in strange corners as being useful.

Type erasure probably won't work either, as you want to dispatch the type erasure from two different spots in the code base (the double dispatch problem: you need a centralized list of types supported to do the type Cartesian product on).
To expand on that, in order to support a+=b where both a and b are arbitrary types, you would have to expand over all types twice over, including types that are never mutually visible at the same spot in a compilation unit.  That isn't possible.

If you need a common base, and there are only some types you pass to doWork, here is how you do it:
struct Base {
  virtual void doWork( double ) = 0;
  virtual void doWork( int ) = 0;
  virtual void doWork( long long ) = 0;
};

template<class D>
struct Base_helper:Base {
  D* self() { return static_cast<D*>(this); }
  D const* self() const { return static_cast<D*>(this); }
  template<class T>
  void doWork_impl(T b) {
    self()->a += b;
  }
  void doWork( double x ) override { doWork_impl(x); };
  void doWork( int x ) override { doWork_impl(x); };
  void doWork( long long x ) override { doWork_impl(x); };
};
struct DerA : public Base_helper<DerA> {
  int a;
};
struct DerB : public Base_helper<DerB> {
  double a;
};

note that every version of doWork must be valid to call on each of the Ders, as the Base_helper instantiates all of them.
If the kind of type passed to doWork is unbounded, yet the types of Der is bounded, you can do something like the above only backwards.  It gets awkward, however.  Your best bet in that kind of situation is to use a boost::variant type solution.

A: I guess you want to achieve something like this:
template<typedef T>
class Base {
    T a;
    void doWork(T b) { // Add another value to "a" which is of its same type
        a += b; // For example; an operation that works on "a", no matter what numeric type it is
    }
}

class DerA : public Base<int> {
}

class DerB : public Base<float> {
}

Or you can dump classes DerA and DerB entirely and use typedefs instead:
typedef Base<int> DerA;
typedef Base<float> DerB;

A: This can be easily solved with a CRTP-like pattern:
template<class D> // Base class is templated
class Base {
public:
    D a;
    void doWork(D b) {
        a += b;
    }
};

class DerA : public Base<int> {};

class DerB : public Base<float> {};

Live Example
Edit: in case you need only one common base (Base<int> is a completely different type from Base<float>) you might use an interface class and have Base inherit from it.


text:
Q: Is there any way to stop the extra new line after a print statement in t-sql? This is a petty question, but is such a pain for me.  Often, I will write store procedures with multiple queries in them.  To make debugging easier, I write it like so:
print 'Some notes about query 1'
select * from someTable

print 'some notes about query 2'
update sometable set column = null

then I get results like this:
Some notes about query 1

(8 row(s) affected)
Some notes about query 2

(8 row(s) affected)

They way it spaces itself makes it hard to read.  I'd want the results to look like this:
Some notes about query 1
(8 row(s) affected)

Some notes about query 2
(8 row(s) affected)

I know its petty, but it irks me.  Anyone have any thoughts?

A: Setting NOCOUNT ON will remove the space, but will also remove the (8 row(s) affected), not sure if that is viable for you.

A: Putting together the answers you get:
--Set up test data
DECLARE @someTable AS TABLE(id int identity, somevalue int)

INSERT INTO @someTable (somevalue) VALUES (1)
INSERT INTO @someTable (somevalue) VALUES (2)
INSERT INTO @someTable (somevalue) VALUES (3)
INSERT INTO @someTable (somevalue) VALUES (4)
INSERT INTO @someTable (somevalue) VALUES (5)
INSERT INTO @someTable (somevalue) VALUES (6)
INSERT INTO @someTable (somevalue) VALUES (7)
INSERT INTO @someTable (somevalue) VALUES (8)

--Here's the method.
SET NOCOUNT ON  --As kd7 said this will get rid of spaces. Along with the rowcount.

print 'Some notes about query 1'
select * from @someTable
print '(' + CONVERT(varchar,@@rowcount)  +' row(s) affected)'--This adds the row count back in

print '' --Formatting row to add the space you require.

print 'Some notes about query 2'
update @sometable set somevalue = null
print '(' + CONVERT(varchar,@@rowcount)  +' row(s) affected)'

A: If you need rowcounts in output - then in SSMS there is no any decision, otherwise use set nocount on
BUT
you always may write your own application to run these queries with its own output including rowcounts


text:
Q: raphael js Pan functionality using raphael-pan-zoom more than 9 I love your plugin! the zoom worked perfectly, but I need more than 9 times zoom, is it possible?
Thanks,
Julio

A: Did you mean to post this somewhere more specific? I'm guessing it hasn't reached whoever you expected to be talking to.


text:
Q: Pulling a vec out of a vec of structs I'm working on a compiler for a toy language and I want to be able to check for errors on each file. I have a MooFile struct that has a Vec<anyhow::Error> where I put errors when they are encountered. Now I want to go through the files, get the errors, and flatten that into a single vec to return from the compiler but I'm running up against the borrow checker. I'm going to post my various attempt but they keep running into similar issues.
fn compile(&mut self) -> Result<(), Vec<Error>> {
    ...
    // Check for errors
    let has_errors = self.files
        .iter()
        .map(|file| file.has_errors())
        .reduce(|acc, value| acc | value)
        .unwrap_or(false);

     if has_errors {
        let mut errors = vec![];
        self.files
            .iter()
            .for_each(|&mut file| errors.append(&mut file.errors));

        Err(errors)
    } else {
        Ok(())
    }
}

error[E0596]: cannot borrow `file.errors` as mutable, as it is behind a `&` reference
  --> src\lib.rs:62:48
   |
62 |                 .for_each(|file| errors.append(&mut file.errors));
   |                            ----                ^^^^^^^^^^^^^^^^ `file` is a `&` reference, so the data it refers to cannot be borrowed as mutable
   |                            |
   |                            help: consider changing this to be a mutable reference: `&mut MooFile`

fn compile(&mut self) -> Result<(), Vec<Error>> {
    ...
    // Check for errors
    let has_errors = self.files
        .iter()
        .map(|file| file.has_errors())
        .reduce(|acc, value| acc | value)
        .unwrap_or(false);

    if has_errors {
        let mut errors = vec![];
        self.files
            .into_iter()
            .for_each(|mut file| errors.append(&mut file.errors));

        Err(errors)
    } else {
        Ok(())
    }
}

error[E0507]: cannot move out of `self.files` which is behind a mutable reference
   --> src\lib.rs:63:13
    |
63  |             self.files
    |             ^^^^^^^^^^ move occurs because `self.files` has type `Vec<MooFile>`, which does not implement the `Copy` trait
64  |                 .into_iter()
    |                  ----------- `self.files` moved due to this method call

fn compile(&mut self) -> Result<(), Vec<Error>> {
    ...
    // Check for errors
    let errors: Vec<Error> = self.files
        .iter()
        .map(|file| file.errors)
        .flatten()
        .collect();

    if errors.len() > 0 {
        Err(errors)
    } else {
        Ok(())
    }
}

error[E0507]: cannot move out of `file.errors` which is behind a shared reference
  --> src\lib.rs:54:25
   |
54 |             .map(|file| file.errors)
   |                         ^^^^^^^^^^^ move occurs because `file.errors` has type `Vec<anyhow::Error>`, which does not implement the `Copy` trait

For more information about this error, try `rustc --explain E0507`.
error: could not compile `moo2` due to previous error

I feel like there has to be some kind of idiomatic way of doing this kind of thing that I'm missing.

A: Most of these errors come from how you create your iterators. If you assume x is a Vec<Y>:

*

*x.iter(): Consumes &x and creates an iterator of &Y.

*x.iter_mut(): Consumes &mut x and creates an iterator of &mut Y.

*x.into_iter(): Consumes ownership of the entire Vec<Y> and creates an iterator of owned Y.

The first version uses .iter() when you want a mutable reference (.iter_mut()). The second uses .into_iter() when you want a mutable reference (.iter_mut()). And the third uses .iter() when you attempt to claim ownership of the errors by disposing of the files (.into_iter(), but you can't drop self.files without issues).
Here is one way you could Clone the errors without moving them out of each file.
let mut errors = Vec::new();

self.files.iter()
    .filter(|file| file.has_errors())
    .foreach(|file| errors.extend_from_slice(&file.errors));

if has_errors {
    return Err(errors)
}
Ok(())

Or you could drain them into a new Vec using extend. This version also uses any to look a bit cleaner, but is not as efficient.
if self.files.iter().any(|f| f.has_errors()) {
    let mut errors = Vec::new();

    for file in &mut self.files {
        errors.extend(file.errors.drain(..));
    }

    return Err(errors)
}

Ok(())


text:
Q: Calculating range ratios of projectiles with or w/o lift for set time sub-intervals The question is as follows:
Ignoring drag, a golf ball launched with neutral spin can be expected to follow a curve given by:
r(t) = (Vcos$\theta$t, Vsin$\theta$t - g$t^2$/2)
where V: launch speed, theta: launch angle, g: acc due to gravity, t: time
A simple model to incorporate lift force on the ball mass due to backspin is proposed as:
$F_{lift}$ = m$a_1$
....which switches off when t exceeds half the flight time (TOF) for the spin shot to simulate the ball slowing down. a1 is assumed constant.
How much will the length of the golf shot be changed when backspin is considered?
My answer was :  $\frac{2}{1 - \frac{a_1}{2g}}$ however I'm not sure if it's correct.
My procedure:
Derived a composite function for the vertical y displacement of the ball w/spin for the first half (see bottom) then w/o spin for the second half.
Into each equation, subbed in $\frac{TOF_{spin}}{2}$, summed the displacements and set = 0. (Overall y displacement is 0). Solved for $TOF_{spin}$.
Solved for $TOF_{nospin}$ then found ratio of TOFs and thus ratio of ranges as range=u.TOF
Any input would be greatly appreciated!

*

*ð $r_{y-spin}$(t) = Vsin$\theta$t + $\frac{1}{2}$($a_1$-g)$t^2$

Calculations:
Calculations
However I think that I cannot sum the formulae as I have done here:
Highlighted Step

A: Your approach is generally correct, but there's one problem: your flight path is discontinuous. For the $y$-coordinate of the ball, you wrote
\begin{equation}
 y(t) = \left\{ \begin{array}{rcl} V\sin \theta\,t + \frac{1}{2}(a_1-g)t^2 & \text{if} & 0 < t \leq \frac{1}{2}T, \\ V\sin \theta\,t -\frac{1}{2}g t^2 & \text{if} & \frac{1}{2}T < t \leq T\end{array}\right. .
\end{equation}
However, at $t=T/2$, the ball suddenly drops from height $V \sin \theta T + \frac{1}{2}(a_1 - g) T^2$ to height $v \sin \theta T - \frac{1}{2} g T^2$. In other words, the second half of your flight path is not correct.
To remedy this, consider this question: what would the flight path be of a golf ball, starting at the coordinate $(x_0,y_0)$, launched with initial speed $W$ at an angle $\phi$? Note that your 'neutral' flight path belongs to a golf ball launched from the origin (i.e. $(x_0,y_0) = (0,0)$), at an angle $\theta$ with initial speed $V$.


text:
Q: Ubuntu Touch Apps Is there a "native" Skype, Facebook, Google Maps, Google Hangouts, eBook Reader Apps being developed for Ubuntu Touch? If yes, whats their status? And if no, why? Thank you!

A: Current status (Sept 2015)

*

*Skype: A web app exists and provides Skype's original implementation available from web.skype.com, with messaging working but no voice and video calls yet. Skype/Microsoft are working on it. As soon as their web version fully works on Linux desktops it will work on Ubuntu Touch too. (Say hello to convergence!)

*Hangouts: A native app is fresh in the making, it's called "Ubuntu Hangups" and uses an Open Source library to access Google's proprietary protocol for instant messaging (no voice, no video calls). Messaging already works fine. Google's own implementation is available as a terrible, mostly useless web app. Google doesn't even care to make the web version responsive. (Shame on them!)

*Facebook: No native app yet, but the web app by Mitchell Reese (not the one by Canonical) works great. Most of the kudos must go to Facebook, of course.

*Google Maps and other mapping apps: They work fine as web apps on Ubuntu Touch. Not bad, really, GPS flawlessly included. Just as in your web browser on the desktop.

*eBook Readers: There's a native app that has quite a few fans, and convincing screenshots.

A: You're asking about some specific apps. Most of which have not yet been implemented. Why they haven't been imeplemented is largely due to connecting qml and javascript in with the apis that is provided by skype, googlemaps, facebook, twitter ect.
Firstly you can find out how to install the Ubuntu Touch core-apps and run them from here and track their progress on the wiki
Based on your question, I dont think Ubuntu Touch is at the stage you want it to be yet. It is still interesting to play around with the SDK and try out some of the other apps users have created though.


text:
Q: how to init system's path variable in python projects in projects There are so Many Directories ,and i want each .py file in separate directory an import other file correctly.
I tried This
PREFIX = normpath(dirname(dirname(dirname(abspath(__file__)))))
if PREFIX not in sys.path:
    sys.path = [PREFIX] + sys.path

when i want to import the other directories' variables ,i just import this file.but it may be too verbose.
is there a better way to solve it in a better way(except the way that export the project's path to the global system's path)?

A: you could use python modules and import them like:
import MyModule.MySubModule.myclass

ex:
from pixie.libs.setup import Setup

the folders are:
/
|-pixie
   |- __init__.py
   |- libs
     |- __init__.py
     |- setup.py
   |- models

Like: https://github.com/masom/Puck/blob/master/client/pixie/controllers/configuration.py#L2

A: The import statement includes support for packages - files (modules) arranged in directories with __init__.py markers.
Support for relative package hierarchy (using leading dots) is provided,
so that absolute module reference is not necessary.

When specifying what module to import you do not have to specify the absolute name of the module. When a module or package is contained within another package it is possible to make a relative import within the same top package without having to mention the package name. By using leading dots in the specified module or package after from you can specify how high to traverse up the current package hierarchy without specifying exact names. One leading dot means the current package where the module making the import exists. Two dots means up one package level. Three dots is up two levels, etc. So if you execute from . import mod from a module in the pkg package then you will end up importing pkg.mod. If you execute from ..subpkg2 import mod from within pkg.subpkg1 you will import pkg.subpkg2.mod. The specification for relative imports is contained within PEP 328.

You can arrange the projects as sub-packages, and use relative imports similar to
from ..subpkg2 import mod to use variables from mod in subpkg2
(from any other sub-package in the same level).


text:
Q: mock method with generic and extends in return type Is it possible to mock (with mockito) method with signature Set<? extends Car> getCars() without supress warnings? i tried:
XXX cars = xxx;
when(owner.getCars()).thenReturn(cars);

but no matter how i declare cars i alway get a compilation error.
e.g when i declare like this
Set<? extends Car> cars = xxx

i get the standard generic/mockito compilation error
The method thenReturn(Set<capture#1-of ? extends Car>) in the type OngoingStubbing<Set<capture#1-of ? extends Car>> is not applicable for the arguments (Set<capture#2-of ? extends Car>)

A: Use the doReturn-when alternate stubbing syntax.
System under test:
public class MyClass {
  Set<? extends Number> getSet() {
    return new HashSet<Integer>();
  }
}

and the test case:
import static org.mockito.Mockito.*;

import java.util.HashSet;
import java.util.Set;

import org.junit.Test;

public class TestMyClass {
  @Test
  public void testGetSet() {
    final MyClass mockInstance = mock(MyClass.class);

    final Set<Integer> resultSet = new HashSet<Integer>();
    resultSet.add(1);
    resultSet.add(2);
    resultSet.add(3);

    doReturn(resultSet).when(mockInstance).getSet();

    System.out.println(mockInstance.getSet());
  }
}

No errors or warning suppression needed


text:
Q: Gurobipy: How to add a constraint that limits the number of times a certain tupledict value can appear in the optimal solution? To explain myself with code, this is the data I'm using:
name, position, pp90, value = gp.multidict({
     ('Jordan'): [0, 3.68, 5.0],
     ('Bird'): [0, 3.61, 5.0],
     ('Johnson'): [1, 6.82, 6.0],
     ('Drexler'): [1, 6.61, 7.0],
     ('Olajuwon'): [1, 6.56, 7.5],
     ('Drexler'): [3, 5.03, 7],
     ('Ewing'): [3, 4.99, 5.5],
     ('Payton'): [3, 4.86, 7.5],
     ('Kemp'): [3, 4.75, 0],
     ('Stockton'): [3, 4.65, 0],
})

Here's my decision variable, maximizing objective function, and one of the constraints:
#Add the decision variable
player = m.addVars(name, obj=value, vtype=GRB.BINARY, name="player")

# Set Objective since we are maximizing points the last argument here is GRB.MAXIMIZE
m.setObjective(quicksum(pp90[i]*player[i] for i in name), GRB.MAXIMIZE)

#Add the constraints
#the sum of player value cannot exceed 100 million
total_value = 100
m.addConstr(quicksum(value[i]*player[i] for i in name) <= total_value, name="total value");

Now the next constraint I want to add is that, the optimal solution can only consist of 2 names with the first value being 1 (i.e. out of Johnson, Drexler, Olajuwon, only 2 of them can be in the optimal solution).
Could anyone please help here?
Thank you!

A: If I understand you correctly, you only need to sum over all the players with value 1 and impose the constraint that this sum is less-equal than 2:
P1 = [name for name, value in position.items() if value == 1]
m.addConstr(quicksum(value[i]*player[i] for i in P1) <= 2)

PS: There are two 'Drexler' in your multidict. Because keys inside a dict are assumed to be unique, you are overwriting the first 'Drexler' entry with the second one.


text:
Q: Does CKDIV8 save battery life when programmed? On ATmega328P there is a CKDIV8 fuse bit that when programmed divides clock by 8.
I'm wondering if the power consumption is equal on these two setups:

*

*micro with 8MHz external crystal and CKDIV8 fuse bit programmed

*micro with 1MHz external crystal and CKDIV8 fuse bit not programmed

In both cases I get 1MHz clock which is sufficient for my application.
The reason is I can't find any cheap 1MHz crystals, for some reason they are incredibly expensive $15+ Digikey Store 1MHz crystals.
Comparing to 8MHz crystals with better ppm (+/- 10ppm) for less than $0.50 Digikey Store 8MHz crystals

A: The datasheet has a graph that shows the standby current at different clock frequencies and supply voltages.
The difference is around 160uA. So yes, it consumes slightly more power, but the difference is much smaller than the difference of running the MCU at 1MHz or 8MHz.

A: It's possible that lowering your clock wouldn't give you a lower consumption. It depends on how heavy your peripheral use is. If it were to be only the CPU, you would be doing the same work in less time, so perhaps the consumption is lower at 8 MHz, provided you use your power saving modes wisely. But if you're using peripherals that need to be constantly running (e.g. counters) or if you don't use sleeps modes at all (i.e. do idle loops instead) you'll probably benefit from a slower clock.

A:
I'm wondering if the power consumption is equal on these two setups

The CKDIV8 Fuse determines the initial value of the CLKPS bits. These bits just define the division factor between the selected clock source and the internal system clock. The power consumption is (almost) proportional to the internal system clock, not the clock source frequency. So we can ignore this factor.
It seems to make a small difference if the clock source fuses are set to either "Full Swing Crystal Oscillator" or "Low Frequency Crystal Oscillator". However, the data sheet diagrams do not allow a good comparison.
Further (as jeroen74 pointed out), the oscillator circuit may require slightly more power with increasing frequency (about 150uA from 1MHz to 8MHz). But the data sheet values refer to the standby characteristics, so its not clear if that translates to the active mode. If that is the case, it is clearly relevant with respect to the 900uA active supply current (@5V).


text:
Q: Modificar la configuración de correo masivo dinámicamente en Laravel 5.7 Tengo un sistema desarrollado en Laravel que cuenta con un conjunto de departamentos. Dependiendo del departamento, necesito utilizar una cuenta de correo u otra para enviar los mensajes de correo masivo.
Tengo una tabla donde guardo las diferentes cuentas de correo que registren los usuarios.
$email_account = EmailAccount::find($id);

Cuando se envían un correo a todos los clientes, utilizo:
Mail::to()->queue(new MassiveMail($email_account, $data));

El problema se origina cuando se intenta procesar la cola, Muestra el siguiente error:
[2019-05-16 19:16:47] local.ERROR: Failed to authenticate on SMTP server with username "example@mail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted.

Si en cambio utilizo:
Mail::to()->send(new MassiveMail($email_account, $data));

Los correos se envían!
Creo que el problema es que no logro que el procesamiento de la cola detecte la cuando te correo que le estoy enviando.
Alguien puede ayudarme?
Actualización 19/05/2019
Archivo .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=xxx
MAIL_USERNAME=example@example.com
MAIL_PASSWORD=xxxx
MAIL_ENCRYPTION=xxx

Archivo config/mail.php
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Mail Driver
    |--------------------------------------------------------------------------
    |
    | Laravel supports both SMTP and PHP's "mail" function as drivers for the
    | sending of e-mail. You may specify which one you're using throughout
    | your application here. By default, Laravel is setup for SMTP mail.
    |
    | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
    |            "sparkpost", "log", "array"
    |
    */

    'driver' => env('MAIL_DRIVER', 'smtp'),

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Address
    |--------------------------------------------------------------------------
    |
    | Here you may provide the host address of the SMTP server used by your
    | applications. A default option is provided that is compatible with
    | the Mailgun mail service which will provide reliable deliveries.
    |
    */

    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Port
    |--------------------------------------------------------------------------
    |
    | This is the SMTP port used by your application to deliver e-mails to
    | users of the application. Like the host we have set this value to
    | stay compatible with the Mailgun e-mail application by default.
    |
    */

    'port' => env('MAIL_PORT', 587),

    /*
    |--------------------------------------------------------------------------
    | Global "From" Address
    |--------------------------------------------------------------------------
    |
    | You may wish for all e-mails sent by your application to be sent from
    | the same address. Here, you may specify a name and address that is
    | used globally for all e-mails that are sent by your application.
    |
    */

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],

    /*
    |--------------------------------------------------------------------------
    | E-Mail Encryption Protocol
    |--------------------------------------------------------------------------
    |
    | Here you may specify the encryption protocol that should be used when
    | the application send e-mail messages. A sensible default using the
    | transport layer security protocol should provide great security.
    |
    */

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    /*
    |--------------------------------------------------------------------------
    | SMTP Server Username
    |--------------------------------------------------------------------------
    |
    | If your SMTP server requires a username for authentication, you should
    | set it here. This will get used to authenticate with your server on
    | connection. You may also set the "password" value below this one.
    |
    */

    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    /*
    |--------------------------------------------------------------------------
    | Sendmail System Path
    |--------------------------------------------------------------------------
    |
    | When using the "sendmail" driver to send e-mails, we will need to know
    | the path to where Sendmail lives on this server. A default path has
    | been provided here, which will work well on most of your systems.
    |
    */

    'sendmail' => '/usr/sbin/sendmail -bs',

    /*
    |--------------------------------------------------------------------------
    | Markdown Mail Settings
    |--------------------------------------------------------------------------
    |
    | If you are using Markdown based email rendering, you may configure your
    | theme and component paths here, allowing you to customize the design
    | of the emails. Or, you may simply stick with the Laravel defaults!
    |
    */

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Log Channel
    |--------------------------------------------------------------------------
    |
    | If you are using the "log" driver, you may specify the logging channel
    | if you prefer to keep mail messages separate from other log entries
    | for simpler reading. Otherwise, the default channel will be used.
    |
    */

    'log_channel' => env('MAIL_LOG_CHANNEL'),

];

Archivo config/queue.php
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Queue Connection Name
    |--------------------------------------------------------------------------
    |
    | Laravel's queue API supports an assortment of back-ends via a single
    | API, giving you convenient access to each back-end using the same
    | syntax for every one. Here you may define a default connection.
    |
    */

    'default' => env('QUEUE_CONNECTION', 'sync'),

    /*
    |--------------------------------------------------------------------------
    | Queue Connections
    |--------------------------------------------------------------------------
    |
    | Here you may configure the connection information for each server that
    | is used by your application. A default configuration has been added
    | for each back-end shipped with Laravel. You are free to add more.
    |
    | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
    |
    */

    'connections' => [

        'sync' => [
            'driver' => 'sync',
        ],

        'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 90,
        ],

        'beanstalkd' => [
            'driver' => 'beanstalkd',
            'host' => 'localhost',
            'queue' => 'default',
            'retry_after' => 90,
        ],

        'sqs' => [
            'driver' => 'sqs',
            'key' => env('SQS_KEY', 'your-public-key'),
            'secret' => env('SQS_SECRET', 'your-secret-key'),
            'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
            'queue' => env('SQS_QUEUE', 'your-queue-name'),
            'region' => env('SQS_REGION', 'us-east-1'),
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => env('REDIS_QUEUE', 'default'),
            'retry_after' => 90,
            'block_for' => null,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Failed Queue Jobs
    |--------------------------------------------------------------------------
    |
    | These options configure the behavior of failed queue job logging so you
    | can control which database and table are used to store the jobs that
    | have failed. You may change them to any database / table you wish.
    |
    */

    'failed' => [
        'database' => env('DB_CONNECTION', 'mysql'),
        'table' => 'failed_jobs',
    ],

];


text:
Q: Python and Selenium error "Exception has occurred: NoSuchElementException" I am creating a web automation using the Selenium library in Python language but when it comes to Username or email, I get this error(I do not get the error in the Password section). I researched in the forum but I could not find a solution. I'm new to Python and selenium so I'm waiting for your help.
Code:
#Get Url
browser.get('https://mail.protonmail.com/create/new?language=en')
time.sleep(5)

#Choose Username
browser.find_element_by_id('username').send_keys('usernameForUser')
time.sleep(5)

Error:
Exception has occurred: NoSuchElementException
Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="username"]"}

(Session info: chrome=86.0.4240.75)

Code to ScreenShot:

An iframe code appears in Div. Could the problem be caused by this?

A: Yes the iframe needs to be switched to.
WebDriverWait(browser, 5).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, '.top')))

Import
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

A: The username textbox is inside the frame so to interact with that you need to switch frame.
frames = driver.find_elements_by_tag_name("iframe")
print(len(frames))

driver.switch_to.frame(0)
wait = WebDriverWait(driver, 20)
username = wait.until(EC.presence_of_element_located((By.ID, "username")))
username.send_keys("xyz")

The password textbox is not in the frame so you have to switch the control back to main page and excess the password textbox. Since password textbox takes some time to get ready to be accessed after switching from frame so use explicit wait here. Like,
driver.switch_to.default_content()

password = wait.until(EC.presence_of_element_located((By.ID, "password")))
password.send_keys("123")

One more thing, since the URL takes time to load, use implicitly wait instead of time.sleep().


text:
Q: Why neo4j docker container restart causes the container to hang and quit I created a custom docker image in order to launch a wrapper script to load initial data. The first time I launch the container I kinda works, sometimes fails but I guess there is something cached or I don't wait enough for neo4j to be up.
The problem comes when I stop the container and i restart it. It downloads the plugins then it seems to hang and it fails to bring the process to foreground.
./wrapper.sh: line 57: fg: job has terminated
In /logs/debug.log there is no log when i restart the container. So it is hard to understand what's going on. Some permission issue?
Here my wrapper file

#!/bin/bash

# THANK YOU! Special shout-out to @marcellodesales on GitHub
# https://github.com/marcellodesales/neo4j-with-cypher-seed-docker/blob/master/wrapper.sh for such a great example script

# Log the info with the same format as NEO4J outputs
log_info() {
  # https://www.howtogeek.com/410442/how-to-display-the-date-and-time-in-the-linux-terminal-and-use-it-in-bash-scripts/
  # printf '%s %s\n' "$(date -u +"%Y-%m-%d %H:%M:%S:%3N%z") INFO  Wrapper: $1"  # Display UTC time
  printf '%s %s\n' "$(date +"%Y-%m-%d %H:%M:%S:%3N%z") INFO  Wrapper: $1"  # Display local time (PST/PDT)
  return
}

# Adapted from https://github.com/neo4j/docker-neo4j/issues/166#issuecomment-486890785
# Alpine is not supported anymore, so this is newer
# Refactoring: Marcello.deSales+github@gmail.com

# turn on bash's job control
# https://stackoverflow.com/questions/11821378/what-does-bashno-job-control-in-this-shell-mean/46829294#46829294
set -m

# Start the primary process and put it in the background
/docker-entrypoint.sh neo4j &

# Wait for Neo4j
log_info "Checking to see if Neo4j has started at http://${DB_HOST}:${DB_PORT}..."
wget --quiet --tries=20 --waitretry=10 -O /dev/null http://${DB_HOST}:${DB_PORT}
log_info "Neo4j has started "
log_info "Importing data with auth ${NEO4J_AUTH}"

# Import data
log_info  "Loading and importing Cypher file(s)..."
  for cypherFile in /var/lib/neo4j/import/*.data.cypher; do
      [ -f "$cypherFile" ] || break
      log_info "Running cypher ${cypherFile}"
      cat  ${cypherFile} | bin/cypher-shell -u ${NEO4J_USER} -p ${NEO4J_PASSWORD} --fail-fast --format plain
      log_info  "Renaming import file ${cypherFile}"
      mv  ${cypherFile}  ${cypherFile}.applied
  done

log_info  "Finished loading data"

log_info  "Running startup cypher script..."
  for cypherFile in /var/lib/neo4j/import/*.startup.cypher; do
      [ -f "$cypherFile" ] || break
      log_info "Running cypher ${cypherFile}"
      cat  ${cypherFile} | bin/cypher-shell -u ${NEO4J_USER} -p ${NEO4J_PASSWORD} --fail-fast --format plain
  done
log_info  "Finished running startup script"

# now we bring the primary process back into the foreground
# and leave it there
fg %1

And here my dockerfile
FROM neo4j

ENV NEO4J_USER=neo4j
ENV NEO4J_PASSWORD=s3cr3t
ENV NEO4J_AUTH=${NEO4J_USER}/${NEO4J_PASSWORD}
ENV NEO4JLABS_PLUGINS='["apoc", "graph-data-science"]'
ENV NEO4J_HOME='/var/lib/neo4j'
ENV DB_HOST='localhost'
ENV DB_PORT=7474
ENV NEO4J_dbms_logs_debug_level='DEBUG'
ENV NEO4J_dbms_logs_user_stdout__enabled='true'

EXPOSE 7474 7473 7687

COPY initial-data/ /var/lib/neo4j/import/

COPY ./docker-scripts/wrapper.sh wrapper.sh

ENTRYPOINT ["./wrapper.sh"]

Any idea how to solve this issue or at least to understand what's wrong?

A: It seems to happen with the latest version, when I switched to neo4j:4.2 then it started to work correctly.
I tried to run the clean images and both work, but using the wrapper script it seems to me that 4.4.10 has some issues in shutting down, maybe leaving some inconsistent state


text:
Q: Drools - Error creating field accessor for TypeDeclaration I created a simple project using Drools and Java basing on this tutorial. It worked perfectly, so I adapted it to what I wanted to do. My DRL files use mvel dialect (instead of Java dialect) and initializing takes place in rule "initial" inside DRL file. You can see this project (source code as well as libraries and DRL file) here. My DRL file looks more less like the following:
package omd
dialect "mvel"
declare ocenaKwalifikacji
    value : Double
end
declare ocenaKandydata
    value : Double
end
declare ocenaTestow
    value : Double
end
declare ocenaRozmowy
    value : Double
end

rule "ocenakandydata/1 "
when
$ocenaRozmowy : ocenaRozmowy(value==5.0000)
$ocenaKwalifikacji : ocenaKwalifikacji(value==5.0000)
$ocenaTestow : ocenaTestow(value==5.0000)
then
  insert(new ocenaKandydata (5.0000))
  System.out.println("ocenaKandydata setting to 5.0000)");
end
rule "ocenakandydata/2 "
when
$ocenaRozmowy : ocenaRozmowy(value==5.0000)
$ocenaKwalifikacji : ocenaKwalifikacji(value==4.0000)
$ocenaTestow : ocenaTestow(value==5.0000)
then
  insert(new ocenaKandydata (5.0000))
  System.out.println("ocenaKandydata setting to 5.0000)");
end

...

rule "ocenakandydata/64 "
when
$ocenaRozmowy : ocenaRozmowy(value==2.0000)
$ocenaKwalifikacji : ocenaKwalifikacji(value==2.0000)
$ocenaTestow : ocenaTestow(value==2.0000)
then
  insert(new ocenaKandydata (2.0000))
  System.out.println("ocenaKandydata setting to 2.0000)");
end

rule "initial"
when
then
/*DATA*/
insert(new ocenaKwalifikacji(5.0));
    insert(new ocenaRozmowy(2.0));
    insert(new ocenaTestow(2.0));
end

Everything works fine, but the package in the first line must be omd although all classes are in the com.sample package. When I changed the package name to com.sample, I got the following error:
Error creating field accessors for TypeDeclaration 'ocenaKandydata' for type 'ocenaKandydata'.

And now there is all the fun...
I created similar project for Android. I used the same code, but the libraries come from another example (the previous ones did put classes in java.* or javax.* packages, which is not allowed while programming for Android). You can see this project here. I put the psc-zatrudnienie-ocena_kandydata.drl file in the smartphone storage under /storage/emulated/0/drools/psc-zatrudnienie-ocena_kandydata.drl. When the package in the DRL file is pl.me.drools2tp (the same as all classes in Android app are placed in), I get following errors (similar to those ones above):

Error creating field accessors for TypeDeclaration 'ocenaKwalifikacji' for type 'ocenaKwalifikacji'
Error creating field accessors for TypeDeclaration 'ocenaKandydata' for type 'ocenaKandydata'
Error creating field accessors for TypeDeclaration 'ocenaTestow' for type 'ocenaTestow'
Error creating field accessors for TypeDeclaration 'ocenaRozmowy' for type 'ocenaRozmowy'

and when I change the package name in DRL file to something another, the errors are as following:
Class 'ocenaKwalifikacji' not found for type declaration of 'ocenaKwalifikacji'
Class 'ocenaKandydata' not found for type declaration of 'ocenaKandydata'
Class 'ocenaTestow' not found for type declaration of 'ocenaTestow'
Class 'ocenaRozmowy' not found for type declaration of 'ocenaRozmowy'

Could anybody give me some advice about this? What does exactly "field accessor for TypeDeclaration" mean? All the classes which are mentioned in declare part of the DRL file are also defined in Java, have value field and both getters and setters. The dekstop version uses Drools 5.3.0 (there is a huge sort of JAR files from http://download.jboss.org/drools/release/5.3.0.Final/ as it was said on TutorialsPoint site). There is also one question connected with mine: Integration of Drools (Expert System) with Android Projects
I will be very grateful for some help, tips or examples.
Best regards,
Peter.
BTW I use IntelliJ and Android Studio.

A: Do not compile with Java classes in com.sample and a DRL file in the same package with declare statements contradicting the Java classes.
From your question I assume that you have the same duplication of a class being declared in DRL in contrast or addition to some Java code.
Simply omit all the declare statements and stick with the Java classes or keep the declares and move the Java classes into another package.
BTW: make your class fields private.


text:
Q: Dropbox API - list all files filtered by mime type I want to list all images of my dropbox account.

*

*/delta
does show all files, but I can't filter by mime type or similar. With include_media_info I can filter AFTER getting all files, but that's too slow for me and results in unnecessary traffic

*/search this allows my to filter, but limits the number of results to a maximum of 1000, I need all images

Is there a way to do what I want?


text:
Q: Problem about mp inverse Show that $ABB^+(ABB^+)^+=AB(AB)^+$.
This is an exercise from Matrix Differential Calculus with Applications in Statistics and Econometrics. There are no other assumptions. I know if $|A|\neq 0$ , then $(AB)^+=B^+(ABB^+)^+$, and the above equation establishes.

A: What precisely is the question?
You provide that for $\mathbf{A}\ne\mathbf{0}$, then
$$
%
\left( \mathbf{AB} \right)^{+} =
%
\mathbf{B}^{+}
\left( \mathbf{ABB}^{+} \right)^{+}
%
\tag{1}
$$
You note an immediate consequence of $(1)$ is
$$
%
\left( \mathbf{AB} \right)
\left( \mathbf{AB} \right)^{+} =
%
\left( \mathbf{AB} \right)
\mathbf{B}^{+}
\left( \mathbf{ABB}^{+} \right)^{+} =
%
\left( \mathbf{ABB}^{+} \right)
\left( \mathbf{ABB}^{+} \right)^{+}
%
\tag{2}
$$
which seems to be the result you are looking for.

A: For any real matrix $X$, $XX^{+}$ is the orthogonal projection matrix onto the column space of $X$.
It follows consequently that the LHS is the orthogonal projection matrix on the column space of $ABB^{+}$ and the RHS is the orthogonal projection matrix on the column space of $AB$.
So it is enough to show that $ABB^{+}$ and $AB$ have the same column space.
Clearly column space of $ABB^{+}$ is contained in column space of $AB$.
Now $AB = ABB^{+}B$, so the column space of $AB$ is also contained in the column space of $ABB^{+}$. Hence $AB$ and $ABB^{+}$ have the same column space and the result follows.


text:
Q: Finding the square of a number without multiplication I'm a beginner in programming and trying to learn C++ by the book Programming principles and practice using C++. In some parts of the book there are little exercises that you can try to do, one of this exercises is about calculating the square of a number, here is what my book says :

Implement square() without using the multiply operator, that is, do the x * x by repetead addition (start a variable result to 0 and add x to it x times).

I've already found a solution for this program but my first tentative was something like this :
#include <iostream>

int main()
{
    int a = 0;
    std::cout << "Enter an integer value : ";
    std::cin >> a;

    while (a < a * a)
    {

        a += a;
        std::cout << a << "\n";

    }
}

I know this code is wrong but I can't understand the output of the progam, if I enter 5 the program prints 10 20 30 40 50 until 8000, why the for loop doesn't stop when a is greater than its square ? I'm just curious to undersant why

A: Using multiplication when trying to avoid multiplication seems broken. What about this:
int r = 0;

for (int n = 0; n < a; ++n) {
  r += a;
}

A:
why the for loop doesn't stop when a is greater than its square ?

Because it never is. If you compare the graph of y=x^2 against the graph of y=x, you will see that the only time y=x is above, is when 0 < x < 1. That's never the case for integers1. Now, since we're talking about computers with limited storage here, there is a thing called overflow, which will cause a very large number to become a very small number. However, signed integer overflow is undefined behavior in C++. So once your loop gets to the point where overflow would happen, you cannot rely on the results.
1. Note that your loop is not set to stop just when a is greater than its square, but when it is greater than or equal to its square. So, your loop will actually stop if a is 0 or 1.


text:
Q: c# - How could I handle multiple bitmap formats when loaded initially into a form? A single image can be initially loaded from an application subfolder into a Windows form to appear as the BackgroundImage by specifying name and image format by file extension.
However I can't figure out a way to support different image formats with identical names and effectively handle multiple images in my subfolder which have the same name, but different image file extensions.
I want that any supported Bitmap image called map_default(.) will be loaded initially as BackgroundImage if there is a single image with this name in the subfolder and that one image will be picked randomly if there are multiple images in the subfolder like this:

application1.exe
  defaultmap(folder):
  -map_default.png
  -map_default.gif
  -map_default.bmp
  -map_default.tiff
  -map_default.jpeg

I saw many methods to modify path expressions, but unfortunately there seems no way to define the name of an image and specify different file extensions for it in one path expression.
On the other side it seems that I must specify an extension for an image.
I need to know the right path expression and a way to check if there is only one image in the array or several images(in this case pick one item from the array).
How could I possibly solve this?
Well, I don't have an idea for the random picking, but I my problem is always that I don't know how to read the image without specifying an extension when I load it into the Form initially.
There are many working solutions with file selector and drag and drop, but I'm unsure what to do when I load the image automatically when the Form runs:
BackgroundImage = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"defaultmap\map_default.png"));

Can I use System.IO.Directory.GetFiles path expression with any extension?

A: Something like this.
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                //declare path to images directory
                string path = @"C:\MyPath\images\";
                //fill an array with file names.
                string[] images = Directory.GetFiles(path);

                if (String.IsNullOrEmpty(images[0]))
                {
                   //set background to hex code color
                }
                else if (String.IsNullorEmpty(images[1]))
                {
                    //set background to images[0]
                }
                else
                {
                    //set background to random array value for images
                }

            }
        }

If you just refuse to have a dedicated directory for images you can check for each value in the array ends with .png, .jpg, .bmp, etc.


text:
Q: Explaining nodejs style of development to a PHP developer in a specific circumstance I'm a PHP web application developer that has built several large projects in PHP w/ CodeIgniter. PHP has always gotten the job done, but now I'm working on a new project that I'm building with the javascript extjs4 framework on the client-side. And I have some questions for experienced nodejs developers.
In my most recent PHP project, a user-login request required my server to make an API call to Facebook. The way I handled this, to improve scalability, was my client would make the initial login request, the server would pass the request to a 'gearman' job queing server, and a background worker process would grab the job and perform the API call. In the meantime, the server would reply to the client and then the client's browser would start polling the server with AJAX to see if the job had completed. (Oh, and I passed the results of the Facebook API call from the worker to the application server with memcached). I did this to free up my application servers to handle more concurrent requests from users since PHP is locking and a Facebook API call takes several seconds.
My question is, does this whole model of App servers, a gearman job queing server, and background workers make sense for nodejs development since nodejs is non-locking? Would I simply accept an ajax request from the client to login, call the facebook API from the application server and wait for it's response (while handling other user's requests since nodejs is non-locking) and then reply to the user?
I'm also considering getting into nodejs development for the sake of being able to take advantage of the awesome heroku environment.

A: The short answer is yes, the way you would typically handle this in a node system is exactly how you describe it.
Because node is non-blocking, the event-loop is constantly on the lookout for actionable requests.  Here's an example using node-facebook-client (one of many npm modules built to be used with facebook APIs)
  console.log('start');

  client.graphCall(path, params, method)(function(result) {
    // fires whenever request is completed
    console.log('facebook returned');
  });

  console.log('end');

Outputs
  start
  end
  facebook returned

As you can imagine, this is basically what all the fuss is about with node (plus it's really really fast).  That said, it's also where the learning-curve is with node -- asyncronous execution.  If 'end' needs to come after 'facebook returns', then you'd have to put it in the callback
  console.log('start');

  client.graphCall(path, params, method)(function(result) {
    // fires whenever request is completed
    console.log('facebook returned');
    console.log('end');
  });

Additionally, it's elementary to integrate dynamic child processes into your application when it is needed, including additional node processes.  From the official docs for child_process.fork:

var cp = require('child_process');

var n = cp.fork(__dirname + '/sub.js');

n.on('message', function(m) {
  console.log('PARENT got message:', m);
});

n.send({ hello: 'world' });

And then the child script, 'sub.js' might look like this:
 process.on('message', function(m) {
   console.log('CHILD got message:', m);
 });

 process.send({ foo: 'bar' });

In the child the process object will have a send() method, and process will emit objects each time it receives a message on its channel.


text:
Q: How to create hexagonal view menu in android I am intended to create a hexagonal view menu with icons as mentioned in the image below. I have tried to use the library from github for imageview but it doesn't suits me for my requirement, what i all need is the hexagon view with the click events in a particular hexagon area. The library gives hexagonal view for single image target, but considered for the hexagonal menu it fails to give the hexagon output(i.e. i couldnt able to align it properly in my layout).
Please help me with your suggestions for the improvement in layout or through code. Thanks in advance.

A: i have tried to create the layout that u required, using ImageViews, LinearLayout and applying the negative margin.
I am not sure if it is the ideal way to use, but i guess you can give it try if don't want go for canvas.
Please go through the below example...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    android:orientation="vertical">

  <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>

        </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="-25dp">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:layout_marginLeft="12.5dp"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"
/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:layout_marginLeft="-25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="-25dp">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>

    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="-25dp">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:layout_marginLeft="12.5dp"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"
            />
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:layout_marginLeft="-25dp"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="-25dp">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"/>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/hexa"
            android:visibility="invisible"/>

    </LinearLayout>
</LinearLayout>

here drawable/hexa is single white hexagonal png image.
Hope it helps...

A: The below attached code for hexagon view. Change the button image for your convinence
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context="com.example.me.testapplication.Buttons">

<LinearLayout
    android:id="@+id/ll1"
    android:layout_width="211dp"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:orientation="vertical"

    >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:background="@drawable/cell"></Button>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="@drawable/cell" />

</LinearLayout>

<LinearLayout
    android:id="@+id/ll3"
    android:layout_width="216dp"
    android:layout_height="fill_parent"
    android:layout_alignParentTop="true"
    android:layout_gravity="right|top"

    android:layout_toEndOf="@+id/ll2"
    android:gravity="center"
    android:orientation="vertical">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:background="@drawable/cell"></Button>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="@drawable/cell" />
</LinearLayout>

<LinearLayout
    android:id="@+id/ll2"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_alignParentTop="true"
    android:layout_gravity="center_horizontal|top"

    android:layout_toEndOf="@+id/ll1"
    android:gravity="center"
    android:orientation="vertical">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/cell"
        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/cell" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/cell" />
</LinearLayout>

</FrameLayout>

A: here's how I have achieved the same UI using ConstraintLayout

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".fragment.MyFragment">

    <com.myapp.widget.CustomTextView
        android:id="@+id/iv_1"
        style="@style/tv_style"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/honey_comb_center"
        android:gravity="center"
        android:text="Total\nInvestment"
        app:fontName="@string/font_bold"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/iv_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/_5sdp"
        android:src="@drawable/honey_comb"
        app:layout_constraintBottom_toBottomOf="@id/iv_1"
        app:layout_constraintRight_toLeftOf="@id/iv_1"
        app:layout_constraintTop_toTopOf="@id/iv_1" />

    <ImageView
        android:id="@+id/iv_3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_5sdp"
        android:src="@drawable/honey_comb"
        app:layout_constraintBottom_toBottomOf="@id/iv_1"
        app:layout_constraintLeft_toRightOf="@id/iv_1"
        app:layout_constraintTop_toTopOf="@id/iv_1" />

    <ImageView
        android:id="@+id/iv_4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/honey_comb"
        android:translationY="@dimen/_20sdp"
        app:layout_constraintBottom_toTopOf="@id/iv_1"
        app:layout_constraintLeft_toLeftOf="@id/iv_2"
        app:layout_constraintRight_toRightOf="@id/iv_1" />

    <ImageView
        android:id="@+id/iv_5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/honey_comb"
        android:translationY="@dimen/_20sdp"
        app:layout_constraintBottom_toTopOf="@id/iv_1"
        app:layout_constraintLeft_toLeftOf="@id/iv_1"
        app:layout_constraintRight_toRightOf="@id/iv_3" />

    <ImageView
        android:id="@+id/iv_6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/honey_comb"
        android:translationY="@dimen/_minus20sdp"
        app:layout_constraintLeft_toLeftOf="@id/iv_2"
        app:layout_constraintRight_toRightOf="@id/iv_1"
        app:layout_constraintTop_toBottomOf="@id/iv_1" />

    <ImageView
        android:id="@+id/iv_7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/honey_comb"
        android:translationY="@dimen/_minus20sdp"
        app:layout_constraintLeft_toLeftOf="@id/iv_1"
        app:layout_constraintRight_toRightOf="@id/iv_3"
        app:layout_constraintTop_toBottomOf="@id/iv_1" />

</androidx.constraintlayout.widget.ConstraintLayout>

here is the screenshot


text:
Q: React-widgets DateTimePicker throwing error 'Cannot read property 'oneOfType' of undefined I am using redux-forms and their example has a date time picker from react-widgets.  Redux-Form react-widgets example
On the example on this page, it has a link to react-widgets. I pretty much followed the example on redux-forms site and I keep getting the following error:
TypeError: Cannot read property 'oneOfType' of undefined
./node_modules/react-widgets/lib/util/localizers.js
/node_modules/react-widgets/lib/util/localizers.js:23
Before anyone asks if Redux-Forms is setup correctly, I have this working with a couple of other render fields, I'm trying to add a date picker and it just crapped out on me.
// RenderDateTimePicker.jsx
import React from 'react';
import PropTypes from 'prop-types';
import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import moment from 'moment';
import momentLocaliser from 'react-widgets/lib/localizers/moment';
momentLocaliser(moment);

const RenderDateTimePicker = ({input: { onChange, value, name }, label, outercss, inputcss, showTime}) => {

    return (

            {label}
            <DateTimePicker onChange={onChange}
                            className={inputcss}
                            format={{ raw: 'MM/dd/yyyy'}}
                            defaultValue={new Date()}
                            time={showTime}
                            value={!value ? null : new DateTimePicker(value)}
            />

    )
}
export default RenderDateTimePicker

// Snippet of main compoent
import React, { Component } from 'react';
import { Field, reduxForm  } from 'redux-form';
import { connect } from 'react-redux';
import RenderTextField from '../common/RenderTextField';
import RenderDateTimeField from '../common/RenderDateTimePicker';

export class SearchBar extends Component {

    render() {
      const { handleSubmit } = this.props;

        return (
           <form onSubmit={handleSubmit}>
             <Field  name="startDt"
                     outercss="col-md-2"
                     inputcss="form-control form-control-sm"
                     label="Start Date"
                     component={RenderTextField}
            />

            <Field  name="endDt"
                    outercss="col-md-2"
                    inputcss="form-control form-control-sm"
                    label="End Date"
                    component={RenderDateTimeField}
            />

            <button className="btn btn-primary">Search</button>
      </form>

        )
    }
}
export default reduxForm({
    form: 'SerchAppDeploymentForm'
})(
        connect(mapStateToProps, mapDispatchToProps)(SearchBar)
);


text:
Q: What is an efficient alternative to iptables for bulk usage? Suppose I have a list of thousands of ip addresses to block. Right now I know how to iterate through the list and for each one run:
iptables -A INPUT -s XX.XX.XX.XX -j DROP

But this means I will have to run thousands of processes!
How can I do this more efficiently?

A: You're doing what you should be doing. Create the rules, save the rules, then load the rules on each host that should have them. A possible refinement when using iptables for large lists of rules would be IP Sets.


text:
Q: Msbuild createproperty I have done like this:
<Target Name="CreateProperties">
    <GetAssemblyFileVersionTask strFilePathAssemblyInfo="$(AssemblyInfo)">
        <Output TaskParameter="strAssemblyFileVersion" PropertyName="strAssemblyFileVersion" />
    </GetAssemblyFileVersionTask>
    <Message Text="AssemblyFileVersion = $(strAssemblyFileVersion)" />

    <CreateProperty
      Value="$([System.Text.RegularExpressions.Regex]::Replace( $(strAssemblyFileVersion), '^(\d+)\.(.+)\.\d+$', '$1_$2' ) )">
        <Output
            TaskParameter="Value"
            PropertyName="rev" />
    </CreateProperty>

    <CreateProperty
        Value="$(ProjName)">
        <Output
            TaskParameter="Value"
            PropertyName="proj" />
    </CreateProperty>
</Target>

When I run the msbuild I can see that both rev and proj are alive both inside the target CreateProperties and my other targets in the same msbuild file.
BUT....when I use another msbuild file that is importet in this file it is like they dont exist. The properites are empty. Any idea why?

A: You have to "pass" properties down to the "helper" proj file. ("SomeCommonLogic.proj" is my "helper" file in the below example)
Note how I pass properties from the "outside" proj file TO the "helper" proj file, via "Properties" in the below sample.
  <Target Name="SomeCommonLogicTarget">
    <Message Text="    " />
    <Message Text="    " />
    <MSBuild Projects="..\..\MSBuildCommonLogic\SomeCommonLogic.proj" Targets="SomeTargetInTheHelperFile" Properties="Configuration=$(Configuration);RevisionNumber=$(SubVersionRevision)" />
  </Target>

Also, the "helper" file does NOT like relative paths.
You have to convert any relative files to a full path.
<ItemGroup>
  <WorkingCheckoutItemGroupForParameterPassing Include=".\MyFile.txt" />
</ItemGroup>
<CreateProperty Value="%(WorkingCheckoutItemGroupForParameterPassing.fullpath)">
  <!-- Use the .fullpath value to get the full path to push it into the xsl(document function)  -->
  <Output TaskParameter="Value" PropertyName="WorkingCheckoutFullPath" />
</CreateProperty>
<Message Text=" WorkingCheckoutFullPath = $(WorkingCheckoutFullPath)" />


text:
Q: I've created a html content box but its not responsive, what should i do to convert it into responsive? its a simple html content box with logos. it looks good on desktop but not on mobile. it must be responsive. it i add meta viewport, it looks weird. here is my code. what I've to change here to convert these boxes into responsive

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  max-width: 100%;
}
html,
body {
  height: 100vh;
  background-color: #fff;
  font-family: 'Poppins', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}
.card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 450px;
  width: 300px;
  border-radius: 25px;
  background-color: #ffffff;
  box-shadow: 2px 0 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.card:nth-child(1) {
  margin-right: 40px;
}
.card:nth-child(2) {
  margin-right: 40px;
}
.card:nth-child(3) {
  margin-right: 40px;
}
body:hover .card {
  filter: blur(15px);
  transform: scale(0.9);
  opacity: 0.5;
  transition: 0.9s;
}
body .card:hover{
  filter:blur(0);
  transform: scale(1);
  opacity: 1;
  transition: 0.9s;
}

img{
  position:absolute;
  left:0;
  top:0;
  margin:20px 0px 0px 20px;
  float: left;
}
p {
  position: absolute;
  left: 0;
  bottom: 0;
  margin: 0 20px 60px 20px;
  font-size: 16px;
  color: #ffffff;
  mix-blend-mode: difference;
}
#circle {
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background-color: #000000;
  margin-top: 100px;
  margin-bottom: -330px;
  margin-left: 300px;
  margin-right: 200px;
}
#triangle {
  height: 100%;
  width: 100%;
  background-color: #000000;
  border-radius: 20px;
  transform: rotate(70deg);
  margin-top: -430px;
  margin-left: 200px;
}
.content a {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 20px;
  cursor: pointer;
  background-color: #000000;
  color: #ffffff;
  font-size: 14px;
  padding:6px 15px;
  border-radius: 30px;
  box-shadow: 10px 0 50px rgba(0, 0, 0, 0.1);
}

<!DOCTYPE html>

    <title>CSS Creative Product Card UI Design | E commerce Card Using Html5 & CSS3</title>
    <link rel="stylesheet" href="style.css">

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

what i've to change here to conver these boxes into responsive one.waiting for help...

A: Add flex-wrap:wrap; in your body selector

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  max-width: 100%;
}
html,
body {
  background-color: #fff;
  font-family: 'Poppins', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  height: 100vh;
}
.main-container{
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  height: 100%;

}
.card {
  position: relative;
  height: 450px;
  width: 300px;
  border-radius: 25px;
  background-color: #ffffff;
  box-shadow: 2px 0 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  margin: 20px;
}
body:hover .card {
  filter: blur(15px);
  transform: scale(0.9);
  opacity: 0.5;
  transition: 0.9s;
}
body .card:hover{
  filter:blur(0);
  transform: scale(1);
  opacity: 1;
  transition: 0.9s;
}

img{
  position:absolute;
  left:0;
  top:0;
  margin:20px 0px 0px 20px;
  float: left;
}
p {
  position: absolute;
  left: 0;
  bottom: 0;
  margin: 0 20px 60px 20px;
  font-size: 16px;
  color: #ffffff;
  mix-blend-mode: difference;
}
#circle {
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background-color: #000000;
  margin-top: 100px;
  margin-bottom: -330px;
  margin-left: 300px;
  margin-right: 200px;
}
#triangle {
  height: 100%;
  width: 100%;
  background-color: #000000;
  border-radius: 20px;
  transform: rotate(70deg);
  margin-top: -430px;
  margin-left: 200px;
}
.content a {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 20px;
  cursor: pointer;
  background-color: #000000;
  color: #ffffff;
  font-size: 14px;
  padding:6px 15px;
  border-radius: 30px;
  box-shadow: 10px 0 50px rgba(0, 0, 0, 0.1);
}

<!DOCTYPE html>

    <title>CSS Creative Product Card UI Design | E commerce Card Using Html5 & CSS3</title>
    <link rel="stylesheet" href="style.css">

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

A: Looks like you're not using the css library. If so, you should apply the responsive type using media queries as shown below.
@media screen and (max-width: 768px) { body { background-color: lightgreen; } }

A: That's happening because your body display is set to flex, you need to change it to block in mobile, so:
@media (max-width: 768px) {
   body {
      display: block;
   }
}

A: Try using bootstrap it will help you a lot to make responsive web pages. in this answer i am just providing you main div responsive other things you check here

<!DOCTYPE html>

    <title>CSS Creative Product Card UI Design | E commerce Card Using Html5 & CSS3</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More

        PrintAll is here to bring a new standard of quality and services for online commercial printing. It's a fast growing online printing and creative firm with a proven track record of delivering the best solutions to our customers. We can offer the best pricing, integrated dealing, finer quality and service.

        More