text:
Q: i used recylerview now i want when any item of recylerview is clicked then a fragment popup on full screen i still have stuck here and i need help i want to know when i clicked on recyclerview item then new fragment popup on full screen and i'm using latest version of android studio and also tell me how can i fast my android app on different devices.
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;

 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.RecyclerView;

    public class Listadapter extends RecyclerView.Adapter<Listadapter.ListViewHolder>{

        String[] CourseTitle={"English - Lilly section", "English - Lilly section", "English - Lilly section",
                "English - Lilly section", "English - Lilly section", "English - Lilly section",
                "English - Lilly section",
                "English - Lilly section"};

        String[] Section={"Section (A)",
                "Section (A)","Section (A)", "Section (A)",
                "Section (A)","Section (A)","Section (A)","Section (A)"};

        String[] Coursedec={"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
                "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum"};

        @NonNull
        @Override
        public ListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.myrecylce_data,parent,false);
            return new ListViewHolder(view);

        }

        @Override
        public void onBindViewHolder(@NonNull ListViewHolder holder, int position) {
            holder.txt1.setText(CourseTitle[position]);
            holder.txt2.setText(Section[position]);
            holder.txt3.setText(Coursedec[position]);
        }

        @Override
        public int getItemCount() {
            return CourseTitle.length;
        }

        public class ListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
            TextView txt1,txt2,txt3;
            public ListViewHolder(@NonNull View itemView) {
                super(itemView);
                txt1=itemView.findViewById(R.id.tv_onetxt);
                txt2=itemView.findViewById(R.id.tv_twotxt);
                txt3=itemView.findViewById(R.id.tv_dsc_course);
            }

            @Override
            public void onClick(View view) {

            }
        }
    }

nothing happened and i don't know how i do this

A: I believe you want to perform some action when your recycler view item is clicked.
For that get a reference to your recyclerview_data layouts root element.
Do as this:
public class Listadapter extends RecyclerView.Adapter<Listadapter.ListViewHolder>{

    String[] CourseTitle={"English - Lilly section", "English - Lilly section", "English - Lilly section",
            "English - Lilly section", "English - Lilly section", "English - Lilly section",
            "English - Lilly section",
            "English - Lilly section"};

    String[] Section={"Section (A)",
            "Section (A)","Section (A)", "Section (A)",
            "Section (A)","Section (A)","Section (A)","Section (A)"};

    String[] Coursedec={"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum",
            "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.The point of using Lorem Ipsum"};

    @NonNull
    @Override
    public ListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.myrecylce_data,parent,false);
        return new ListViewHolder(view);

    }

    @Override
    public void onBindViewHolder(@NonNull ListViewHolder holder, int position) {
        holder.txt1.setText(CourseTitle[position]);
        holder.txt2.setText(Section[position]);
        holder.txt3.setText(Coursedec[position]);

       holder.root.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //Perform your action here. In your case write code to pop your
              fragment
        }
    });
    }

    @Override
    public int getItemCount() {
        return CourseTitle.length;
    }

    public class ListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        TextView txt1,txt2,txt3;
        LinearLayout root; //Assuming your root tag is linear layout.
        public ListViewHolder(@NonNull View itemView) {
            super(itemView);
            txt1=itemView.findViewById(R.id.tv_onetxt);
            txt2=itemView.findViewById(R.id.tv_twotxt);
            txt3=itemView.findViewById(R.id.tv_dsc_course);
             root=itemview.findViewById(R.id.root);
        }

    }
}

On a side note, it would be better to use an interface callback to pop your fragment from your parent activity.
Hope this helps you


text:
Q: Concatenate multiple row into single row SELECT
   RESVID, VEHTYPE
FROM
   (SELECT
       dbo.T_VEH_VEHRESERVATION.RESVID,
       TABLEVEHICLE.VEHTYPE, TABLEVEHICLE.VEHREGID
    FROM
       (SELECT
            dbo.T_VEH_VEHCATEGORY.VEHBRANDNAME + N' ' + dbo.T_VEH_VEHCLASS.VEHCLASSNAME AS VEHTYPE,
            dbo.T_VEH_VEHREGISTRATION.VEHREGID
        FROM
            dbo.T_VEH_VEHCATEGORY
        WHERE
            (dbo.T_VEH_VEHREGISTRATION.DELIND = 0)
       ) AS TABLEVEHICLE
    INNER JOIN
       dbo.T_VEH_VEHRESERVATION ON TABLEVEHICLE.VEHREGID = dbo.T_VEH_VEHRESERVATION.VEHREGID )
    GROUP BY
       dbo.T_VEH_VEHRESERVATION.RESVID
   ) AS TABLERESV

I would like to concatenate the RESVID: 33 (duplicate row) into 1.
This is just an example, of course what I Want is every duplicate row with this situation will be solved.
I try the XML PATH function, but does not work at all, and I have no idea what goes wrong, i will be appreciate if any help me on my code, and give me explanation on that.
My desire result:
RESVID   |  VEHTYPE
-------------------
  33     |  Proton Economic, Toyota Mid-size SUV

and i have only one table on my view

Thanks

A: Try like this....
Select Distinct  RESVID ,Stuff((Select ','+VEHTYPE from TabelName A where A.RESVID =B.RESVID
 For Xml Path('')),1,1,'') as VEHTYPE from TabelName B

A: Try with STUFF()
SELECT RESVID ,
    STUFF((
    SELECT ','+ VEHTYPE
    FROM TABLERESV b
    WHERE a.RESVID = b.RESVID
    FOR XML PATH('')
    )
    ,1,1,'') AS VEHTYPE
FROM TABLERESV  a
GROUP BY a.RESVID

A: trY this:

SELECT B.resvid, STUFF(
(SELECT ',' + A.vehtype
FROM TABLE_NAME A
WHERE A.resvid=B.resvid
FOR XML PATH('')),1,1,'') AS CSV
FROM TABLE_NAME B
GROUP BY B.resvid

redpajama_set_name: RedPajamaStackExchange


text:
Q: case when for getting a scalar value using linq to sql I want to do this with Linq:
select when name<>'' then name else username end displayname from users where id = 1

I know how to select a scalar value with linq
   string name = from u in users
               select new {u.name}.SingleOrDefault();

but how can I implement case when to it?

A: I think this should help:
 string name = (from u in users
               select new
               {
                  Name = u.name != "" ? u.name : u.username
               }).SingleOrDefault();

You can also use string.IsNullOrWhiteSpace()

A: var resul = users.Where(x => new { Name = u.name != "" ? u.name : u.username });


text:
Q: java.lang.NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration I've created a web dynamic project, and want to use Hibernate with it.
Then, I used the Hibernate Code Generation to generate classes code, and I created a class HibernateUtil where I initialize SessionFactory.
public class HibernateUtil {
    private static final SessionFactory sessionFactory = buildSessionFactory();

    private static SessionFactory buildSessionFactory(){
        try{
            SessionFactory sessionFactory =
                    new AnnotationConfiguration().configure().buildSessionFactory();
            return sessionFactory;
        }catch(Exception ex){
            ex.printStackTrace();
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public static void shutdown() {
        getSessionFactory().close();
    }
}

And another class HibernateSessionFactoryListener :
public class HibernateSessionFactoryListener implements ServletContextListener{

    @Override
    public void contextInitialized(ServletContextEvent arg0) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        System.out.println("\n Context Initilaise \n");
    }

    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        HibernateUtil.shutdown();
        System.out.println("\n Context Detruit \n");
    }

}

When I run my project I get this error message :
java.lang.NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration
    at com.hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:28)
    at com.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:11)
    at com.hibernate.HibernateSessionFactoryListener.contextInitialized(HibernateSessionFactoryListener.java:12)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.AnnotationConfiguration
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
    ... 12 more

How can I solve this problem ?
Edit 1 :
This is my Java Build Path :

A: In Hibernate 3.6, "org.hibernate.cfg.AnnotationConfiguration" is deprecated, and all its functionality has been moved to "org.hibernate.cfg.Configuration".
So , you can safely replace your "AnnotationConfiguration" with "Configuration" class
Source: http://www.mkyong.com/hibernate/hibernate-the-type-annotationconfiguration-is-deprecated/


text:
Q: React native flatlist item stay checked; props changed I have a really big problem and I don't know what I'm doing wrong. I also tried to debug everything and I didn't find any solution.
First of all lets say I have 2 components. FROM component A I send some props (array) to component B. I component B I load that props into my state and than I change some data in flatlist and store it on my state in that component. When I go back to previous screen, where is component A and going back to B, that flatlist is still the same and also PROPS stays the same.
Initial props from screen A: (when I firstly go to B component)
"listOfStudents":[{"key":"Suana Kristovski","id":"1358","checked":false,"o":false,"n":false}]

When I change item in flatlist and going back this is the props that arrived into component B:
listOfStudents":[{"key":"Suana Kristovski","id":"1358","checked":true,"o":false,"n":false}]

checked from false -> true,
Problem is that everything I do, I only change my state when item is changed in my flatlist.
Code in screen B:
componentDidMount() {

        //console.log('Izvedem se vedno');
        console.log('List of students Diary hours: ' + JSON.stringify(this.props.listOfStudents));

        this.setState({
            data: this.props.navigation.state.params.props.listOfStudents,
            textOpombe: this.props.navigation.state.params.props.notes,
            textVsebinaUre: this.props.navigation.state.params.props.lesson,
            finished: this.props.navigation.state.params.props.finished,
            absent: parseInt(this.props.navigation.state.params.props.apsent.substring(0,1)),
        });

        if(this.props.navigation.state.params.props.listOfStudents.length >= 2) {

            this.setState({
                height: 130
            });
        }

        this.props.navigation.addListener('willBlur', (playload)=>{

        });
      }

My flatlist:
<FlatList
                                    ref={(list) => this.myList = list}
                                    style={[styles.flatList,{height: this.state.height}]}
                                    data={this.state.data}
                                    scrollEnabled = {this.state.scrollingChild}

                                    contentContainerStyle={{ padding: 15 }}
                                    renderItem={({ item }) => (

                                          <View style={styles.listItemStyle}>
                                            <View style={{flexDirection: 'row', marginBottom: 7, }}>

                                                {
                                                    item.checked &&
                                                    <TouchableOpacity
                                                        onPress={this.changeCheckedToFalse.bind(this,item)}>
                                                        <View style={styles.checked} />
                                                    </TouchableOpacity> ||
                                                    <TouchableOpacity
                                                        onPress={this.changeCheckedToTrue.bind(this,item)}>
                                                        <View style={styles.unchecked} />
                                                    </TouchableOpacity>
                                                }

                                                <Text style={{color: '#000', opacity: 0.6}}>{item.key}</Text>
                                                {
                                                    item.checked &&
                                                    <View style={{position: 'absolute', right: 0 }}>
                                                        <View style={{flexDirection: 'row'}} >
                                                        {
                                                            item.o &&
                                                            <TouchableOpacity
                                                                style={[styles.touchable1Ch,styles.iconStyle1]}
                                                                onPress={this.changeSelectionO.bind(this,item)}>

                                                                <Text style={{color: '#fff', fontSize: 18, alignSelf: 'center' }}>O</Text>
                                                            </TouchableOpacity> ||
                                                            <TouchableOpacity
                                                                style={[styles.touchable1,styles.iconStyle1]}
                                                                onPress={this.changeSelectionO.bind(this,item)}>

                                                                <Text style={{color: '#fff', fontSize: 15, alignSelf: 'center' }}>O</Text>
                                                            </TouchableOpacity>
                                                        }
                                                        {
                                                            item.n &&
                                                            <TouchableOpacity
                                                                style={[styles.touchable2Ch,styles.iconStyle1]}
                                                                onPress={this.changeSelectionN.bind(this,item)}>
                                                                <Text style={{color: '#fff', fontSize: 18, alignSelf: 'center' }}>N</Text>
                                                            </TouchableOpacity> ||
                                                            <TouchableOpacity
                                                                style={[styles.touchable2,styles.iconStyle1]}
                                                                onPress={this.changeSelectionN.bind(this,item)}>
                                                                <Text style={{color: '#fff', fontSize: 15, alignSelf: 'center' }}>N</Text>
                                                            </TouchableOpacity>
                                                        }

                                                        </View>
                                                    </View>
                                                }
                                            </View>
                                            {
                                                this.props.navigation.state.params.props.listOfStudents !== undefined && this.props.navigation.state.params.props.listOfStudents.length >= 2 ?
                                                <View style={styles.line} /> : <Text></Text>
                                            }

                                          </View>

                                    )}
                                    keyExtractor={item => item.id}
                                />

Methods for flatlist change item:
changeSelectionO(item) {
        var data2 = this.state.data;

        var itemIndex = data2.map(function (x) { return x.key; }).indexOf(item.key);

        if(data2[itemIndex].o) {
            data2[itemIndex].o = false;
        } else {
            data2[itemIndex].o = true;
            if(data2[itemIndex].n) {
                data2[itemIndex].n = false;
            }

        }

        this.setState({
            data: data2
        });
        //this.props.listOfStudents

    }

    changeSelectionN(item) {
        var data2 = this.state.data;

        var itemIndex = data2.map(function (x) { return x.key; }).indexOf(item.key);

        if(data2[itemIndex].n) {
            data2[itemIndex].n = false;
        } else {
            data2[itemIndex].n = true;
            if(data2[itemIndex].o) {
                data2[itemIndex].o = false;
            }

        }

        this.setState({
            data: data2
        });
        //this.props.listOfStudents

      }

Can you please tell me why props is changing?


text:
Q: At what size will self-gravitation contribute more to stability than surface tension? The governments of Earth have embarked on an experiment to place a massive ball of water in orbit. (umm... special water that doesn't freeze)
Imagine this to be a fluid with a given density, $\rho$ ($kg/m^3$), surface tension, $\sigma$ ($J/m^2$), and formed in a sphere of radius $R$ ($m$).  I think that the viscosity $\mu$ is not needed for this question, but correct me if I'm wrong.
At what size will the restorative forces from gravity (after some small perturbation) become more significant than that from surface tension?  Would the type of perturbation make a difference?
Just for fun, here's a video of a ball of water stabilized by surface tension.

A: Let us do a quick estimation.
Let $R_{cr}$ be a critical radius of the ball so that the condition of stability for the ball is expressed as $$R<R_{cr}$$ What can $R_{cr}$ depend on?  The most important properties are inertia, gravity and surface tension, which are characterized by the density $\rho$, the gravitational constant $G$  and surface tension coefficient $\sigma$. So $R_{cr}$ can be a function only of mentioned parameters: $$R_{cr}=f(\rho , \sigma , G)$$ By dimensional analysis, the dimension of $R_{cr}$ is meter. The combination $\left (\frac{\sigma}{\rho^2 G}\right)^{1/3}$ has also the dimension of meter. Therefore we can write:
$$R_{cr}=C\left(\frac{\sigma}{\rho^2 G}\right)^{1/3}$$ where $C$ is a dimensionless constant of orders of magnitude close to 1.
For water, $\sigma=0.07\frac{J}{m^2}$, $\rho=10^3\frac{kg}{m^3}$ and also $G=6.67\cdot10^{-11}\frac{Nm^2}{kg^2}$
So, a rough estimation:$$R_{cr}\approx\left(\frac{\sigma}{\rho^2 G}\right)^{1/3}=10m$$

A: The answer by Martin is good, but I still want to continue along the thought path I had in mind.  I hope I can give a different physical basis for confirmation of the number.
I'm sure there are better ways to do this, but I want to do it using only the information I have.  I want to consider the transfer of some amount of mass ($m$ for now) from near the surface of the sphere to the inside of the sphere (fully integrating it).  In both cases we can asses some amount of energy difference between the spherical blob of mass $M+m$ and the state of the sphere with mass $M$ with the $m$ mass hovering just above the surface.  So the two states under consideration are:

*

*State 1: (M+m) big ball

*State 2: (M) ball next to (m) ball

I have no problem assuming $m \ll M$.  Now, I want to write expression for both the gravitational binding energy as well as the surface binding energy of a ball.  I'll do this for a generic sphere with a mass of $M$ and uniform density.
$$E_g(M) = - \frac{3 G M^2}{5 R(M)}$$
$$E_s(M) = - 4 \pi R(M)^2 \sigma$$
I'm leaving it in this form because we'll all agree that given the mass and the density, finding $R(M)$ isn't a problem.  Now I want to write expressions for the difference in energy from state 2 to state 1.  This is straight forward for the surface tension energy because the bodies are non-interacting.  However, for the gravitational binding energy, there is still a binding energy between the large ball and the small ball that must be included.  Keep in mind that state 1 is the lower energy state.
$$\Delta E_s = E_s(M) + E_s(m) - E_s(M+m)$$
$$\Delta E_g = E_g(M) + E_g(m) - \frac{G M m}{R(M)} - E_g(M+m)$$
Now, obviously, the idea would be to set these equal, assume that $m$ is small, and then find the $M$ as a solution to that equation.  But that doesn't work!  I think I have a major conceptual flaw in this approach, where the scaling of the surface area of the small $m$ blob just doesn't follow a scaling that works.  I didn't know what to do, so I just removed the $E_s(m)$, abandoning all logical reasoning behind my work.  But when I did this and used Martin's values, I obtained the following:
$$M=1.05 \times 10^6 kg$$
This was assuming $m=0.1 kg$.  If I change that value it doesn't change $M$ very much, which is encouraging.  This is a satisfying answer for me, because Martin's answer comes out to around 0.5 million kg.


text:
Q: Unable to change Table Header Border Codeigniter Bootsrap I have one site which is built with codeignitor and bootstrap. I have one page in which I have table with below class.

                    #
                    Image
                    First Name
                    Last Name
                    Gran Id

                    Action

I am trying to change color of table header with style adding in my html code like below

But its not working. I have tried lot but not able to do it. Let me know if someone can help me for solve the issue. Thanks!
Edit:
Solution of @failedCoder is changing color but its not useful for gradient background. Its looking like below image, Let me know if someone can improve it.

Thanks!

A: Quick and dirty solution is to use inline styling

                    // style attribute added
                    #
                    Image
                    First Name
                    Last Name
                    Gran Id

                    Action

You can also try to use !important to over-ride any other styling on the element
th {
    background-color: blue !important;
    color: white !important;
}

Edit:
You can try to apply your styling to entire first row, instead of just targeting th element

 // id added to first row
                    #
                    Image
                    First Name
                    Last Name
                    Gran Id

                    Action

CSS:
  #first-row   {
      ... do your stuff here
  }


text:
Q: Excel VBA Saving autofilter settings with dates I have a part of a macro that stores the autofilter settings before clearing the filter, so it can reapply them later. The code is as follows:
Dim FilterArray()
With FrontPage.AutoFilter.Filters
    ReDim FilterArray(1 To .Count, 1 To 3)
    For f = 1 To .Count
        With .Item(f)
            If .On Then
                FilterArray(f, 1) = .Criteria1
                If .Operator Then
                    FilterArray(f, 2) = .Operator
                    If .Operator = xlAnd Or .Operator = xlOr Then
                        FilterArray(f, 3) = .Criteria2
                    End If
                End If
            End If
        End With
    Next f
End With

This works fine in every situation I have come across except for date fields. In the case of date fields, Criteria1 and Criteria2, cause errors (Application-defined or object-defined error), while Operator returns a value of 7. This happened in Excel 2007 and is still happening in Excel 2013.
I assume the reason this doesn't work is due to the nested way the autofilters treat date fields, but is there a way to make this work with dates? I have seen other problems to do with applying filters to dates, but surely storing them in the first place should be easier?
And a secondary question - what does the value of 7 mean for Operator? I can only find the translation of values 0-2.

A: I found out, to enable filter Date in Array.
Below setting must be disable (Enable by default)
ActiveWindow.AutoFilterDateGrouping = False

A: I've amended your code and it runs now well also with dates in my Excel 2013:
' .Criteria1/2 are read as strings with local decimal separator
' but for re-setting Criteria1/2 should be in American format ...
' so replace local decimal separator by dot - this seems to apply also for dates,
' because dates are also transformed internally to decimal numbers
FilterArray(f, 1) = Replace(.Criteria1, Application.International(xlDecimalSeparator), ".")

(similar for .Criteria2)
Regarding your secondary question: see code example in this post:
In Excel VBA, how do I save / restore a user-defined filter?

A: Note, this solution below is true of Excel 2010, I cannot find information on Excel 2013, but it is possible the same problem exists.
If you record a macro while running an auto date filter, you will notice the values are stored in the Criteria2 parameter, and Criteria1 is not used:
Range.AutoFilter Field:=2, Operator:=xlFilterValues, Criteria2:=Array(2, "8/10/2015", 2, "8/20/2015")

Trying to access the Criteria2 parameter from VBA causes an "Application-defined or object-defined error".
At the time of writing this answer, the only way I know of saving this autofilter information is by reading the XML data inside the xlsx file. Working code here:
Get Date Autofilter in Excel VBA


text:
Q: How to do live streamimg using Azure services Problem: Using OpenCV I am continuously capturing frames and performing some sort of manipulation. Using that manipulated frame I am trying to do live streaming using Azure services.
I go through the Microsoft docs but I didn't find out any relevant information to perform live streaming using the frame.

A: If your goal is to use some Azure Service, Azure Media Services is the right one. I'm not sure what / where you were searching, but here's the official doc for it:
https://learn.microsoft.com/en-us/azure/media-services/latest/stream-live-tutorial-with-api


text:
Q: Check If Entity in Datastore exists in GAE Python I'm trying to create (something like) an invoice number generator. But, since Invoices may be zero or more when starting a business, how do you know if an entity exists?
query = "SELECT loanNumber FROM Loans ORDER BY loanNumber DESC LIMIT 1"
loanNumbers = db.GqlQuery(query)

result = loanNumbers.get()

# for loanNumber in loanNumbers:
if loanNumbers is None:
  print "Print the first number"
else:
  print "Print the next number"

Error
KindError: No implementation for kind 'Loans'

A: Now there are some nice metadata helper functions documented here: https://developers.google.com/appengine/docs/python/datastore/metadataentityclasses#get_kinds
Here is an example of checking for Loans before continuing with your query and the rest of your code:
from google.appengine.ext.db import metadata

my_kinds = metadata.get_kinds() # Returns a list of entity kind names.

if u'Loans' in my_kinds:
    ...

Note that my_kinds will not contain Loans until a loan entity has actually been created.

If you require more control, or prefer to roll your own helper function there are examples of that here: https://developers.google.com/appengine/docs/python/datastore/metadataqueries#Kind_Queries


text:
Q: Apache PDFBox 2 Farsi/Arabic Text Extraction Issue with Some Characters (Wrong Output) I am using Apache PDFBox 2.0.11 to extract text out of some PDF documents using the PDFTextStripper class. Here is the code used for extraction:
String pdfFilePath = "path/to/file.pdf";
PDFTextStripper pdfStripper = null;
PDDocument pdDoc = null;
COSDocument cosDoc = null;
try {
    PDFParser parser = new PDFParser(new RandomAccessFile(new File(pdfFilePath), "r"));
    parser.parse();
    cosDoc = parser.getDocument();
    pdfStripper = new PDFTextStripper();
    pdDoc = new PDDocument(cosDoc);
    String parsedText = pdfStripper.getText(pdDoc);

    System.out.println(parsedText);
} catch (IOException e) {
    e.printStackTrace();
}

A big issue I've encountered is that PDFBox extracts some of the words incorrectly (mostly misplaced or totally missed characters). Especially, when it comes to "La" (in farsi: لا) it almost certainly goes wrong.
As a test case I've used a PDF file containing a few simple words (test-file.pdf). In the following table, the original words and PDFBox output is given:

So it would be quite helpful if anyone could provide some workaround for the described problem.


text:
Q: How to add bordered triangle over a full screen div tag I would like to have a div that is full screen on mobile view-port to have a bordered triangle, I have done this for desktop screens in works, but when I apply the same properties and tweak the numbers, I do get something close to what I want
The HTML is following and a Codepen here

     brand

        Item 1

        Dropdown3

Option1

Option2

Option3

        Item 1

  Mobile view

The one that works is the UL with class of tri, this will work on desktop screens, I have hidden it with a inline visibility: hidden for now
Here are the corresponding styles for both cases
.nav-items-wrapper {
  display: flex;
  justify-content: space-around;
}

.nav-ul {
  display: flex;
  flex-direction: row;
}

@media(max-width:767px) {
  .nav-items-wrapper ul li a{
    font-size: 13px;
  }

  .navbar-default {
    padding-top: 5px;
  }

  .nav-ul {
    width: 40vw;
    justify-content: center;
  }

}

.dem: hover > .tri {
    display:block;
}

.tri {
   // display: none;
    width: 300px;
    border-radius:2px;
    position: absolute;
    background-color: #000;
    top: 55px;
    padding: 10px 0;
    right: 0;
    left: auto;
    list-style: none;
}

.tri:after {
    position: absolute;
    left: 50%;
    margin-left: 70px;
    top: -8px;
    width: 0;
    height: 0;
    content:'';
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 20px solid #000000;
}

.tri li {
    white-space: nowrap;
    padding: 7.5px 15px;
}

.mdiv {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  background-color: #000;
  right: 0;
  left: auto;
  position: absolute;
}

.mdiv:after {
    position: absolute !important;
    left: 50% !important;
    margin-left: 25% !important;
    top: 30vh !important;
    width: 0 ;
    height: 0 ;
    content:'';
    border-left: 20px solid green;
    border-right: 20px solid red;
    border-bottom: 20px solid #000000;
    pointer-events: none;
}.navbar-header {
  padding: 10px 10px;
}

I am using the Bootstrap nav, I have overwritten the responsive style like the navbar collapse because I do not need them.
The class to look at is the mdiv class that I use for the full screen div

A: The div with class was starting from the top so some part of it was under the navbar, I have added a margin-top to the mdiv and adjusted the sizes accordngly and it works fine, thanks, here is the updated, codePen


text:
Q: Why does list insert, append and extend work like this? def append_arr(arr):
  t_arr = arr
  print('arr before',arr)
  t_arr.extend(arr)
  print('arr affter',arr)
arr = ['a','b','c']
append_arr(arr)

I had list a, assign b=a, and change list b by functions (append, insert, extend)
I didn't touch list a any more, but when b change, a is also change follow b.
How to change b by (append, insert, extend) and a not change
def test():
  arr_m = ['a','b','c']
  print('arr_m before', arr_m)
  append_arr(arr_m)
  print('arr_m affter', arr_m)
test()
arr_m before ['a', 'b', 'c']
arr before ['a', 'b', 'c']
arr affter ['a', 'b', 'c', 'a', 'b', 'c']
arr_m affter ['a', 'b', 'c', 'a', 'b', 'c']

I don't know why arr_m change too

A: You are expecting t_arr = arr to make a new list which has the same contents, but all it does is make a second name which refers to the same list.
It works like this because:

*

*A lot of programming languages were designed based on how computers work. It is normal to think of lists as things, but at the low level in a computer a list is more like a place - the spot in memory where all of the list's contents are stored. To this day many programmers are used to "place-oriented programming" (though almost nobody calls it that), and Python was written way back in 1991 or so.

*Until recently, languages where everything was immutable, or where assignment did a copy by default, were often far less efficient - it takes some tricky optimizations to turn code that semantically always makes a copy into machine operations that only copy the minimum of data only when they need to. So back when Python was new, it would've been a lot slower and would've used a lot more memory if it had been designed to make copies all the time.

*Programmer culture has not yet finished understanding "the value of values" (a great video by Rich Hickey, the creator of the language Clojure which unlike Python doesn't behave this way) - so we've still got a lot of place-oriented shared-mutable-state-by-default languages in widespread use and most people don't see it as a big deal or major problem.
But now you might be thinking "but why doesn't that happen with integers and strings!?" And you'd be right, if you did t_string = string and then t_string += string, it would just work exactly like you expected the list to work. And that's because:

*

*Integers were historically a special case because they're so small in a computer, and so fundamental to computer operations, that it was often more efficient, or in any case efficient enough, to implement them as immutable values. But perhaps also people had an easier time understanding intuitively that it would be insane if x = 0; y = x; x += 1 turned the zero in y into a one as well.

*Strings were deliberately made immutable, even though they're basically lists, because by the time Python was being made, the world of programming had seen so many pitfalls (and reactions like yours from new programmers) to strings being mutable that "strings should be immutable" managed to overcome the tradition of mutable state enough, especially for languages that were aiming to be more human-friendly like Python, despite the memory and speed costs.
The linked duplicate question will show you how to make it instead do what you want, and has some other decent elaborations on why it works this way.


text:
Q: Equivalence of two statements about Upper and Lower Sums I need some  help with an exercise for my analysis course.
Consider $Z=\{x_0,x_1,...,x_n\}$ as a Partition of the interval $[a,b]$ and upper and lower sum of a function $f: [a,b] \rightarrow ℝ$ are defined  as $$O(f,Z):=\sum_{i=1}^n sup[f(\zeta)](x_i-x_{i-1})$$ $$U(f,Z):=\sum_{i=1}^n inf[f(\zeta)](x_i-x_{i-1})$$
Show that the following statements are equivalent:
a) $\forall\varepsilon>0 \exists Z: O(f,Z)-U(f,Z)<\varepsilon$
b) $\forall\varepsilon>0 \exists\delta>0\forall Z: [|Z|<\delta \implies O(f,Z)-U(f,Z)<\varepsilon]$
The direction $b) \implies a)$ is trivial in my opinion. For the other direction it seems I have not enough information to prove it.

A: What you need is this geometric lemma.
Lemma. Given $\epsilon>0$ and a partition $\mathbf{P}$ of $[a,b]$, there is a $\delta>0$ such that if $\mathbf{Z}$ is another partition with $|\mathbf{Z}|<\delta$, then the total length of the subintervals of $\mathbf{Z}$ that are not contained in a subinterval of $\mathbf{P}$ is less than $\epsilon$.
Proof. If $N$ is the number of points in $\mathbf{P}$, take $\delta=\epsilon/N$ $\qquad\square$.
Now, when comparing the sums with respect to $\mathbf{P}$ and $\mathbf{Z}$, there are two types of subintervals of $\mathbf{Z}$:

*

*Those containing points of $\mathbf{P}$, but whose total length is less that $\epsilon$.

*Those contained in subintervals of $\mathbf{P}$, what allows one to make estimates on $U(f,\mathbf{Z})-O(f,\mathbf{Z})$.

Split $U(f,\mathbf{Z})-O(f,\mathbf{Z})$ into two sums. Let $M$ be a bound of $f$. On subintervals of type 1. the sum is bounded by $2\,M\,\epsilon$. Let $I$ be a subiberval of $\mathbf{Z}$ of type 2. and let $J$ be a subinterval of $\mathbf{P}$ containing $I$. Then
$$
0\le\sup_{I}f-\inf_{I}f\le\sup_{J}f-\inf_{J}f.
$$
This should be enough to allow you to finish the proof.


text:
Q: NSMutableArray always empty NSMutableArray *experienceValues;
experienceValues = [NSMutableArray alloc] initWithObjects:0,83,174,276,nil];

NSLog(@"%@", [experienceValues objectAtIndex:3]);

Why does this always throw -[__NSArrayM objectAtIndex:]: index 3 beyond bounds for empty array when it is clearly allocated and initialised in the line just before?

A: You need to wrap integer values like @0, @83, @174, ..., as primitive integers are no objects.

A: The NSMutableArray class as most of the collection classes in cocoa, accepts only objects. So if you want to put numbers, you can't put primitive type, but only instances of NSNumber class, thus:
[[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInt:0]...etc

Or with literals:
[[NSMutableArray alloc] initWithObjects:@0,@83,@174,@276.. etc

A: The array is empty because the arguments are nil terminated and 0 is interpreted as nil.
The array should only contain objects (as opposed to primitives like ints). In you case you should create NSNumbers for all the numbers. You can do that with the number literal syntax @2.0.

A: Objective-C collection classes can only store objects; not primitives like int.
You need to wrap them in NSNumber objects.
If these are literal values then the answer provided by @Kirsteins demonstrates the syntax.

A: Try this
NSMutableArray *experienceValues = [[NSMutableArray alloc] initWithObjects:@0,@83,@174,@276,......., nil];

NSLog(@"%d", [experienceValues objectAtIndex:3]);

As initWithObjects: accepts only object you need to put only objects in it

A: You're trying to add integer value to NSArray.
NSMutableArray *experienceValues = [[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInteger:42],nil];

then convert it back to integer like,
NSLog(@"%@", [experienceValues objectAtIndex:0]);


text:
Q: Using the library generic classes without using its generic feature will make it raw type? I am learning java, and I have got around to the topic of Generics and raw types. I have found that I had been using some library classes in Java which are generic (didn't know it before), and I had been using them as if they are just normal classes (declaring them like a normal object). Will that lead to the raw types? And since raw types are said to be avoided, should I, before using any of the library classes or interfaces of Java, make sure whether they are generic or not? And if a class is generic then use it as it meant to (parameterized type)?

A: If a class is declared like this:
public class MyClass<T>

And you use it like this:
MyClass myVariable = new MyClass();

Then yes, it indeed is a raw type, and you shouldn't use it.
Collection classes (like ArrayList)
are generic on Java 5+, and you should always use the generic variant
when it's available. Watch the compiler warnings;
they notify about using generics, among other things.

A: Look at this sample class:
class Queue<T> {
   private LinkedList<T> items = new LinkedList<T>();
   public void enqueue(T item) {
      items.addLast(item);
   }
   public T dequeue() {
      return items.removeFirst();
   }
   public boolean isEmpty() {
      return (items.size() == 0);
   }
}

Which is a generic class with type T. you can build an instance of he class with any type needed to associate with the type needed to use internally.
you can instantiate the class as follows if you want to  use Integer type for example:
Queue<Integer> queue = new Queue<Integer>();

You can also use more than one type in a class as follows:
class Pair<T,S> {
   public T first;
   public S second;
   public Pair( T a, S b ) {
      first = a;
      second = b;
   }
}

And instantiate it like this:
Pair<String,Color> colorName = new Pair<String,Color>("Red", Color.RED);

Or like this:
Pair<Double,Double> coordinates = new Pair<Double,Double>(17.3,42.8);


text:
Q: How do I correctly ship licenses with my desktop app? I'm at the tail end of development of a desktop application and I'm wondering how I go about shipping the required libraries with the app.
I'm using node-webkit as my UI framework and in the wiki it states that I should ship the MIT License, the LGPL, the BSD, the Ms-PL and an MPL/GPL/LGPL tri-license. How exactly? Package them inside the executable? Provide them alongside?

A: Intel XDK (which uses node-webkit) provides them inside the "About" window (in the section "Attribution Notice").


text:
Q: How to Format Laravel Blade Code in Visual Studio Code? I have installed some Visual Studio Code extensions to handle Laravel Blade Code like

*

*KTamas.laravel-blade

*onecentlin.laravel-blade
But they are not helping me to format Laravel Blade Code [blade.php files]. I mean they are not auto indenting the code as I expected. But I have seen blade code online which are well indented in visual studio Code IDE.
Example :

Visual Studio Code Environment For Laravel
Is their any specific configuration or technique which I can use to make these extensions work or there is some other way?

A: Files>Preferences>Settings>Extensions>Blade Configurations

Then Enable format blade file (Follow Image).Then Restart Visual Studio Code.Now Use Shift+Alt+F To format. Now OK.

A: this solution works for me in 2021
First, install Laravel Blade after that update your settings.json file and add this section
"[blade]": {
  "editor.defaultFormatter": "amirmarmul.laravel-blade-vscode",
  "editor.formatOnSave": true
}

A: Add these lines to your VS Code settings.json file after installing Laravel Blade Formatter extension:
https://marketplace.visualstudio.com/items?itemName=shufo.vscode-blade-formatter
"editor.formatOnSave": true,
"[blade]": {
    "editor.defaultFormatter": "shufo.vscode-blade-formatter"
},

A: Update your VSCode. Go to Settings>Extensions and Enable Blade Format checkbox.
Use Shortcut for Window: Shift+Alt+F:

A: I would like to suggest vscode-blade-formatter for VSCode that support directive indentation and php code formatting in directives.
screenshot
This is based on my previous project blade-formatter.
The motivation I created this is I wanna format blade files with correct indentation programmatically via CLI.
Try if you would like to indent directives.

A: To use Blade with any extension that works with HTML use emmet.includeLanguages (Emmet Include languages) settings. Add item blade and value html.

    "emmet.includeLanguages": {
        "blade": "html" // Use HTML in Blade files
    },

Now HTML works in Blade associated files, you may use Blade and HTML snippets and other extensions.

A:
UPDATE 2022: this extension may no longer be maintained.

For me, this extension works perfect for auto indentation with the following settings:
"beautify.language": {
        "html": [
            "blade",
            "html"
        ]
    },

A: First install this extension, https://marketplace.visualstudio.com/items?itemName=onecentlin.laravel-blade
Open settings.json.
Add this lines.
"[blade]": {
    "editor.defaultFormatter": "onecentlin.laravel-blade",
    "editor.formatOnSave": true
}

A: *

*First go to "Visual Studio Code" Settings and search for the option "files.associations" If that option is not available in your settings. Please update your Visual Studio Code to latest version.

*In the settings overwrite panel past the following snippet
"files.associations": {
    "*.blade.php": "html",
    "*.tpl": "html"
}

It'll associate .blade.php and .tpl file extensions for html type
Save it and your are good to go. Happy formatting :)

Update: There are still some issues in formatting html with blade code, the formatter tend to bring blade code in a single line while executing format command. However, if your code grow that's won't be a problem. Moreover, you can easily manage those by putting a line comment in between your blade blocks. And commenting in code is always a good thing.

Update: Seems updated version adds an option to enable blade formatting in the user settings. To use that,

*

*Please make sure you are using the latest version and "Laravel Blade Snippets" Extension installed.

*Then Ctrl+Shift+P : type User
settings : Enter

3. In "User settings" > "Extensions" > "Blade Configaration" check the option Enable format blade file.

That's it.

A: The only solution I've found that will actually attempt to indent blade directives mixed with html in a blade file is a hack for the beautifier javascript from the Beautify extension, done by Faizal Nugraha.
Edit: This doesn't appear to support formatting of blade directives inside an html <script> tag, though. Beautify seems to format that as JavaScript.

*

*Install the Beautify extension

*Edit ~/.vscode/extensions/hookyqr.beautify-1.5.0/node_modules/js-beautify/js/src/html/beautifier.js (Linux/MacOS) or %USERPROFILE%\.vscode\extensions\hookyqr.beautify-1.5.0\node_modules\js-beautify\js\src\html\beautifier.js (Windows) and do the following:

*Look for the function Beautifier.prototype.beautify = function().

*Inside the function look for the line var source_text = this._source_text;

*After that line, paste in:

        // BEGIN blade-1of2
        source_text = source_text.replace(/\{\{(--)?((?:(?!(--)?\}\}).)+)(--)?\}\}/g, function(m, ds, c, dh, de) {
        if (c) {
            c = c.replace(/(^[ \t]*|[ \t]*$)/g, '');
            c = c.replace(/'/g, ''');
            c = c.replace(/"/g, '"');
            c = encodeURIComponent(c);
        }
        return "{{" + (ds ? ds : "") + c + (de ? de : "") + "}}";
    });
    source_text = source_text.replace(/^[ \t]*@([a-z]+)([^\n]*)$/gim, function(m, d, c) {
        if (c) {
            c = c.replace(/'/g, ''');
            c = c.replace(/"/g, '"');
            c = "|" + encodeURIComponent(c);
        }
        switch (d) {
            case 'break':
            case 'case':
            case 'continue':
            case 'default':
            case 'empty':
            case 'endsection':
            case 'else':
            case 'elseif':
            case 'extends':
            case 'csrf':
            case 'include':
            case 'json':
            case 'method':
            case 'parent':
            case 'section':
            case 'stack':
            case 'yield':
                return "<blade " + d + c + "/>";
            default:
                if (d.startsWith('end')) {
                    return "</blade " + d + c + ">";
                } else {
                    return "<blade " + d + c + ">";
                }
        }
    });
    // END blade-1of2

*Look for the line var sweet_code = printer._output.get_code(eol);

*After that line, paste in:

    // BEGIN blade-2of2
    sweet_code = sweet_code.replace(/^([ \t]*)<\/?blade ([a-z]+)\|?([^>\/]+)?\/?>$/gim, function toDirective(m, s, d, c) {
        if (c) {
            c = decodeURIComponent(c);
            c = c.replace(/'/g, "'");
            c = c.replace(/"/g, '"');
            c = c.replace(/^[ \t]*/g, '');
        } else {
            c = "";
        }
        if (!s) {
            s = "";
        }
        switch (d) {
            case 'else':
            case 'elseif':
            case 'empty':
                s = s.replace(printer._output.__indent_cache.__indent_string, '');
                break;
        }
        return s + "@" + d + c.trim();
    });
    sweet_code = sweet_code.replace(/@(case|default)((?:(?!@break).|\n)+)@break/gim, function addMoreIndent(m, t, c) {
        var indent = printer._output.__indent_cache.__base_string;
        c = c.replace(/\n/g, "\n" + indent + printer._output.__indent_cache.__indent_string);
        c = c.replace(new RegExp(indent + '@' + t, 'gi'), '@' + t);
        return "@" + t + c + "@break";
    });
    sweet_code = sweet_code.replace(/\{\{(--)?((?:(?!(--)?\}\}).)+)(--)?\}\}/g, function (m, ds, c, dh, de) {
        if (c) {
            c = decodeURIComponent(c);
            c = c.replace(/'/g, "'");
            c = c.replace(/"/g, '"');
            c = c.replace(/(^[ \t]*|[ \t]*$)/g, ' ');
        }
        return "{{" + (ds ? ds : "") + c + (de ? de : "") + "}}";
    });
    // END blade-2of2

*Save the file and restart VS Code.

Of course this has to be redone if the file is changed, by an update or otherwise.
Ref. https://gist.github.com/fzldn/a27973ff7e4c8e3738b0e06e525f7403#gistcomment-2693197

A: Add this in settings.json
"beautify.language": {
        "html": [
                "blade"
        ]
},

A: You're left to your own devices in finding the right extension here. You would want to use an extension because it has more power than the built-in formatting.
For a long time I was using Laravel Blade Snippets because at the time of this message it has 1.4 million installs. However, I've recently swapped over to Laravel Blade Formatter and although only 134K installs, I'm much happier now.
Once you've found your poison, Control-Shift-i is your friend.

A: I tried Blade Snippet By Winnie but it has multiple issue. Recently I started using the below on and its working perfectly.
Name: Laravel Blade
Id: amirmarmul.laravel-blade-vscode
Description: Snippets, Syntax Highlighting, and Formatting for VS Code
Version: 2.0.4
Publisher: amirmarmul
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=amirmarmul.laravel-blade-vscode

A: Right click anywhere in the document, select 'format document with' and than select laravel blade snippets. Install Laravel blade snippets extension first.


text:
Q: Lead status and custom field history does SFDC storage old status values of a Lead and of a custom field? If so, how can I find them? I need to query them.

A: Only if you've configured "History Tracking" for those fields, found under Setup > Customize > Leads > Fields. If you enable this feature, it won't backtrack historical changes, only new changes. That means that, in your particular case, you probably won't be able to restore these old values for reporting, but configuring this setting now will help you in the future.

A: Yes, you can query the old field values. The history tracking need to enabled for those fields. You can query the LeadHistory object to get the old and new values(it will not store values for all type of fields e.g., long text area). for more info you can check here http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_leadhistory.htm. But I should I also tell you that you cannot cover the part this code in the test class because when you insert data in test class, the history object will not be inserted during test execution. But there is a workaround, you will have to supply the test class with live data from your org and make sure that the live data satisfies your criteria.
Hope it helps!


text:
Q: How to increase limit for open processes and files using ansible I am setting up a MySQL server, and I was told to increase the ulimit for the number of open processes.
I ran
- name: "increase limit for the number of open files"
  shell: "ulimit -n 64000"
- name: "increase limit for the number of open processes"
  shell: "ulimit -u 64000"

on the ansible-playbook, but not only does it throw error "Illegal option -u", but also open files limit (-n) doesn't seem to get modified. (I ran ulimit -n on the server but it stays the same)
What is the recommended way of increasing these limits, and how should I do it in Ansible?
I saw pam_limits module. Should I use this module to modify nproc and nofile? If so, which domain?
Thank you.

A: Since Ansible 2.0.0, a new official module supports configuring PAM.
# Add or modify nofile soft limit for the user joe
- pam_limits:
    domain: joe
    limit_type: soft
    limit_item: nofile
    value: 64000

A: There's actually several things you'll need to do to bump the number of filehandles up permanently. What you're attempting here is a temporary measure and only exists for as long as the shell does, it won't do it.
I've found you need to fix three things for this to be applied correctly.
The first two are related to sysctl and the PAM limits.d configuration:
- name: Set sysctl File Limits
  copy:
    src: 50-fs.conf
    dest: /etc/sysctl.d

- name: Set Shell File Limits
  copy:
    src: 91-nofiles.conf
    dest: /etc/security/limits.d

The 50-fs.conf file looks like this:
fs.file-max=262144

The 91-nofiles.conf file looks like this:
 *     soft nofile 262144
 *     hard nofile 262144

That takes care of the system-wide configuration. If you have a distribution using systemd you will need to adjust that as well:
- name: Set MariaDB Filehandle Limits
  notify: Reload systemctl
  copy:
    src: limits.conf
    dest: /lib/systemd/system/mariadb.service.d

This requires reloading systemctl, so you may need to add a handler for that:
- name: Reload systemctl
  shell: systemctl daemon-reload

The file you're copying over looks like this:
[Service]
LimitNOFILE=infinity
LimitMEMLOCK=infinity

That's taken from the example in the default service configuration file.
The final thing to do is make sure my.cnf or whatever stores your configuration has this directive in it:
open_files_limit=16384

You may want to add this as well:
open_files_limit=16384
max_connections=16384

You can use whatever values you think are appropriate.


text:
Q: Auto shuffle between windows forms every after 5 min Experts
I would like to shuffle windows forms automatically every after 5 mins. windows forms contains Multiple querys , Multiple videos, Multiple powerpoints.
I am having three windows forms, as follows.
Forms 1 code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Daily_System {
  public partial class Form1: Form {
    public Form1() {
      InitializeComponent();
      timer1.Enabled = true;
      timer1.Interval = 5000;
      timer1.Tick += timer1_Tick;
      timer1.Start();
    }

    private void Form1_Load(object sender, EventArgs e) {
      this.WindowState = FormWindowState.Maximized;

      CenterToScreen();
    }

    private Timer timer1 = new Timer();

    private void button1_Click_1(object sender, EventArgs e) {
      this.WindowState = FormWindowState.Minimized;
      Form2 f = new Form2(); // This is bad
      timer2.Enabled = true;
    }
    private void timer2_Tick(object sender, EventArgs e) {
      button1.PerformClick();
    }
  }
}

Forms 2: Microsoft Powerpoint file
multiple powerpoint files from network folder(path)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Core = Microsoft.Office.Core;

namespace Daily_System {

  public partial class Form2: Form {

    public Form2() {
      InitializeComponent();

      this.WindowState = FormWindowState.Minimized;
      timer1.Enabled = true;
      timer1.Interval = 15000;
      timer1.Start();

    }

    private void Tick(object sender, EventArgs e) {
      Form3 Next = new Form3();
      Next.Show();
      this.Hide();
      timer1.Stop(); //Stop timer after tick once
    }

    protected override void OnLoad(EventArgs e)

    {

      base.OnLoad(e);

      this.BeginInvoke(new MethodInvoker(delegate() {
        button1.PerformClick();
      }));

    }

    private void button1_Click(object sender, EventArgs e) {
      Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
      Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
      Microsoft.Office.Core.MsoTriState otrue = Microsoft.Office.Core.MsoTriState.msoTrue;

      pptApp.Visible = otrue;
      pptApp.Activate();
      Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;

      var opApp = new Microsoft.Office.Interop.PowerPoint.Application();
      pptApp.SlideShowEnd += PpApp_SlideShowEnd;
      var ppPresentation = ps.Open(@ "C:\Users\ok\Downloads\Parks-WASD2017.pptx", ofalse, ofalse, otrue);
      var settings = ppPresentation.SlideShowSettings;
      settings.Run();
    }

    private void PpApp_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres) {
      Pres.Saved = Microsoft.Office.Core.MsoTriState.msoTrue;
      Pres.Close();

    }

    private void Form2_Load(object sender, EventArgs e) {

    }

    private void button2_Click(object sender, EventArgs e) {
      this.WindowState = FormWindowState.Minimized;
      Form3 f = new Form3(); // This is bad
      f.Show(); /// f.Show();
      timer1.Enabled = true;
      this.Hide();
      timer1.Stop(); //Stop timer after tick once

    }

    private void timer1_Tick_1(object sender, EventArgs e) {
      button2.PerformClick();
    }
  }
}

Forms 3: Multiple video files (MP4,FLV,MOV,etc)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Daily_System {

  public partial class Form3: Form {

    public Form3() {
      InitializeComponent();
      timer1.Enabled = true;
      timer1.Interval = 15000;
      timer1.Start();

    }

    private void Form3_Load(object sender, EventArgs e) {
      axWindowsMediaPlayer1.settings.autoStart = true;
    }

    private void axWindowsMediaPlayer1_Enter_1(object sender, EventArgs e) {

      axWindowsMediaPlayer1.URL = @ "C:\Users\ok\Downloads\ok.mp4";
    }

    private void button1_Click(object sender, EventArgs e) {

      this.WindowState = FormWindowState.Minimized;
      Form1 f = new Form1(); // This is bad
      f.Show(); /// f.Show();
      timer1.Enabled = true;
      this.Hide();
      timer1.Stop(); //Stop timer after tick once

    }

    private void timer1_Tick_1(object sender, EventArgs e) {
      button1.PerformClick();
    }
  }
}

Multiple video files from network folder(Path)
Requirement:
Each forms should change and display every after 5 min.
example :  first form1 should display then after 5 mins form1 should minimized and form2 should show the slideshow and then after 5 mins form2 should minimized and form3 should play the video and then after 5 mins form3 should minimized and pause the video then form1 should display.
It should keep doing the same steps as above.
Final condition: All forms should stop exactly at 6 pm(Everyday) and it should start automatically at 7 am (Everyday).
Please advise...

A: One way is to create base class for forms to control minimizing and maximizing of them and also finding out when the specific form being minimized or maximized by overriding OnStart() and OnStop() methods. This can be done as follow:
Define new base class named CustomForm:
public class CustomForm : Form
{
    public static List<CustomForm> AllForms = new List<CustomForm>();
    private static int CurrentFormIndex = 0;
    private static Timer SliderTimer = new Timer() { Interval = 5000 }; // { Interval = 5 * 60000 };

    public static void Start(params CustomForm[] forms)
    {
        AllForms.AddRange(forms);

        forms[0].Show();
        forms[0].WindowState = FormWindowState.Maximized;
        AllForms[0].OnStart(AllForms[0]);

        SliderTimer.Tick += SliderTimer_Tick;
        SliderTimer.Start();
    }

    private static void SliderTimer_Tick(object sender, EventArgs e)
    {
        SliderTimer.Stop();

        // Minimizing current form
        AllForms[CurrentFormIndex].OnStop(AllForms[CurrentFormIndex]);
        AllForms[CurrentFormIndex].WindowState = FormWindowState.Minimized;

        // Maximizing next form
        int NextFormIndex = (CurrentFormIndex + 1) % AllForms.Count;
        if (!AllForms[NextFormIndex].Visible)
            AllForms[NextFormIndex].Show();
        AllForms[NextFormIndex].WindowState = FormWindowState.Maximized;
        AllForms[NextFormIndex].OnStart(AllForms[NextFormIndex]);

        CurrentFormIndex = NextFormIndex;

        SliderTimer.Start();
    }

    // Application will exits when one of forms being closed
    protected override void OnFormClosed(FormClosedEventArgs e)
    {
        base.OnFormClosed(e);
        Application.Exit();
    }

    // For overriding in forms to Start something such as playing or etc
    protected virtual void OnStart(CustomForm Sender)
    {
    }

    // For overriding in forms to Stop something such as playing or etc
    protected virtual void OnStop(CustomForm Sender)
    {
    }
}

Change Program class as follow:
static class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        CustomForm.Start(new Form1(), new Form2(), new Form3());
        Application.Run();
    }
}

Change your forms to inherit CustomForm instead of Form as follow:
public partial class Form1 : CustomForm
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Shown(object sender, EventArgs e)
    {
        // axWindowsMediaPlayer1.URL = @"C:\Users\ok\Downloads\ok.mp4";
        WMPLib.IWMPMedia v1 = axWindowsMediaPlayer1.newMedia(@"d:\1.mp4");
        axWindowsMediaPlayer1.currentPlaylist.appendItem(v1);
        WMPLib.IWMPMedia v2 = axWindowsMediaPlayer1.newMedia(@"d:\2.mp4");
        axWindowsMediaPlayer1.currentPlaylist.appendItem(v2);
        WMPLib.IWMPMedia v3 = axWindowsMediaPlayer1.newMedia(@"d:\3.mp4");
        axWindowsMediaPlayer1.currentPlaylist.appendItem(v3);
    }

    // To start playing video and etc when form being maximized
    protected override void OnStart(CustomForm Sender)
    {
        axWindowsMediaPlayer1.Ctlcontrols.play();
    }

    // To stop playing video and etc when form being minimized
    protected override void OnStop(CustomForm Sender)
    {
        axWindowsMediaPlayer1.Ctlcontrols.pause();
    }
}

Form2:
public partial class Form2 : CustomForm
{
    Microsoft.Office.Interop.PowerPoint.Presentation ppPresentation;
    Microsoft.Office.Interop.PowerPoint.SlideShowSettings settings;
    Microsoft.Office.Interop.PowerPoint.Application opApp;
    int StartingSlide = 1;

    public Form2()
    {
        InitializeComponent();
    }

    protected override void OnStart(CustomForm Sender)
    {
        Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
        Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
        Microsoft.Office.Core.MsoTriState otrue = Microsoft.Office.Core.MsoTriState.msoTrue;

        pptApp.Visible = otrue;
        pptApp.Activate();
        Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;

        opApp = new Microsoft.Office.Interop.PowerPoint.Application();
        opApp.SlideShowNextSlide += OpApp_SlideShowNextSlide;
        ppPresentation = ps.Open(@"c:\a.pptx", ofalse, ofalse, otrue);
        settings = ppPresentation.SlideShowSettings;

        settings.RangeType = Microsoft.Office.Interop.PowerPoint.PpSlideShowRangeType.ppShowSlideRange;
        settings.StartingSlide = StartingSlide;

        settings.Run();
    }

    private void OpApp_SlideShowNextSlide(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn)
    {
        StartingSlide = Wn.View.CurrentShowPosition;
    }

    protected override void OnStop(CustomForm Sender)
    {
        ppPresentation.Close();
        //opApp.Quit();
        Process.Start("cmd", "/c taskkill /im POWERPNT.EXE");
    }
}

A: There are a lot of possible ways to do this.  Winforms is a Lego box and lets you snap the pieces together any way you want.  Deriving your own class from one of the built-in winforms classes is a basic strategy.  What you need is a little controller that takes care of the form switching.  Best kind of class to override is ApplicationContext.  The default one you get is a very simple one that merely ensures that the main form is shown and terminates the app when you close it.
Let's derive our own.  This is a potentially heavy-weight app, these are not cheap forms.  So we want to specify the forms to switch by their Type instead of their instance, creating and destroying them when the forms gets switched.  You'll want the app to terminate whenever the current one is closed by the user.  Copy/paste this code into the Program.cs file:
class FormSwitcher : ApplicationContext {
    Timer switcher;
    Type[] forms;
    int formIndex;
    Form currentForm;
    bool switching;

    public FormSwitcher(params Type[] forms) {
        this.forms = forms;
        switcher = new Timer() { Enabled = true };
        switcher.Interval = System.Diagnostics.Debugger.IsAttached ? 3000 : 5 * 60000;
        switcher.Tick += SwitchForm;
        formIndex = -1;
        SwitchForm(this, EventArgs.Empty);
    }
    private void SwitchForm(object sender, EventArgs e) {
        switching = true;
        formIndex += 1;
        if (formIndex >= forms.Length) formIndex = 0;
        var newform = (Form)Activator.CreateInstance(forms[formIndex]);
        newform.FormClosed += delegate { if (!switching) this.ExitThread(); };
        if (currentForm != null) {
            newform.StartPosition = FormStartPosition.Manual;
            newform.Bounds = currentForm.Bounds;
        }
        newform.Show();
        if (currentForm != null) currentForm.Close();
        currentForm = newform;
        switching = false;
    }
}

Hopefully it is obvious what it does, if not then let me know and I'll add comments.  Now you can modify the Main() method in that same file, you pass an instance of this class to the Application.Run() method.  I'll copy/paste the code I tested:
    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new FormSwitcher(typeof(Form1), typeof(Form2)));
    }

A: Here is sample code that creates the 3 forms, then every 5 seconds switches which is maximized (others are minimized).  The application exits when any form is closed.  I've put comments throughout, and following it is code you can use to pause playback on forms:
internal static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    private static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        //here we create our 3 forms.  note, you can create and show as many as you want here
        //the application will automatically loop through them
        new Form1().Show();
        new Form2().Show();
        new Form().Show();

        //minimize all forms, and set a close handler
        foreach (Form form in Application.OpenForms)
        {
            form.WindowState = FormWindowState.Minimized;
            form.FormClosed += Form_FormClosed;
        }

        //start a thread to manage switching them
        Task.Run((Action)Go);

        //start the main UI thread loop
        Application.Run();
    }

    private static void Go()
    {
        while (true)
        {
            //loop through all forms
            foreach (Form form in Application.OpenForms)
            {
                //show it (send execution to UI thread)
                form.Invoke(new MethodInvoker(() =>
                {
                    form.Show();
                    form.WindowState = FormWindowState.Maximized;
                }));

                //wait 5 seconds
                Thread.Sleep(5000);

                //minimize it (send execution to UI thread)
                form.Invoke(new MethodInvoker(() =>
                {
                    form.WindowState = FormWindowState.Minimized;
                }));
            }
        }
    }

    private static void Form_FormClosed(object sender, FormClosedEventArgs e)
    {
        Application.Exit();
    }
}

Now for forms that need to take action when minimized/maximized, add a Resize handler like this into the code on the form:
    private void Form1_Resize(object sender, EventArgs e)
    {
        if (WindowState == FormWindowState.Minimized)
        {
            //stop any playback
        } else
        {
            //start any playback
        }
    }


text:
Q: Inserting DB name into Sqlite3 command I'm using python 2.7.3 and Sqlite3 to save some data in a small db. I have the following sql command:
thedb = "allpeople"
cursor.execute("INSERT INTO %s VALUES (?,?,?,?,?,?,?,?,?,?,?,?)" % (thedb, data))
conn.commit()

But its throwing the following error:
TypeError: not all arguments converted during string formatting

A: You are trying to insert the table name (not the database). You appear to be mixing that up with SQL parameters; string templating and providing SQL parameters for your query are two entirely separate operations.
You'd have to use string formatting separately to build the query string:
cursor.execute("INSERT INTO %s VALUES (?,?,?,?,?,?,?,?,?,?,?,?)" % thedb, data)

or perhaps a little clearer to illustrate what is going on:
query = "INSERT INTO %s VALUES (?,?,?,?,?,?,?,?,?,?,?,?)" % thedb
cursor.execute(query, data)

Note that this opens you up to a possible SQL injection vector. Perhaps you should look into a decent SQL library instead; SQLAlchemy lets you build SQL queries from Python calls (among other tasks).


text:
Q: How can I remove the rounded edges and transparent border from a metacity theme? I have a problem with my current theme. When windows top border close to top panel, there's a transparent background at the top corner (please take a look at the attached image).

So, how could I :

*

*remove it?

*change the rounded corners (I love the less rounded corners - like MAC OS X)

Thanks in advance.

A: To change the corners, you will have to edit the theme, or choose a different one. Also, you should ensure compositing is enabled, if you want rounded corners. You can do this by using compiz instead, or by running gconf-editor, opening the /apps/metacity/general item in the tree, and enabling the compositor_effects option in the list on the right. With that on, you should not see this artifact in the theme.


text:
Q: Reading from a file into a List using C++ I'm a little new to using file input/output so bear with me.
I've got a function called RunList(filename), that takes the name of the file as input and returns nothing. The file will have the format of having one line that is useless and I plan on using ignore() on and then the next line which is important has the format
"i 1 2 3 4 5 ...."
where the numbers go on for a very long way, about 250000 or so.
So what I want to do is to open this file, ignore the first line, and then for each number in the file I want to use the function void insert(x, p) which is a function I have defined to insert x after the current iterator position p. The end result is that I want to have my list contain all of the numbers in the file after the "i" and be in the same order. I have also defined the functions ListItr find(x) and ListItr first() which will return the iterator to the position that views x and to the first potion respectively.
Could anyone provide me with a means of doing this? I was thinking of using a for() loop and taking in each word at a time from the file and using my function to insert each element, but I'm a little lost as to how to do this, as I said I'm very new to using file input/output.
So, my RunList function currently looks something like this, although obviously its not finished nor does it really work, hence me needing some help on it.
    void Runlist(filename){
        ifstream in;
        in.open(filename);
        in.ignore(1000, '\n');         //this is me trying to ignore the first line
        for (int i, i < 250000, i++){
            int number;
            in >> number
            void insert(number, i)
        }

}
But the plan was, I select the file, ignore the first line, then set up a for loop where i can use my void insert(number, i) to insert each number, but then i don't really understand how to read in each word at a time, or to preserve the order because if I just kept using the function on each number over and over then the list would have the numbers in the reverse order I believe.

A: There are several issues in your code:

*

*You do not specify void for the return type of the function.

*Instead of ignore, you could just drop the first line when reading by using getline once.

*Your for loop usage is also pretty invalid: commas instead of semi-colons

*No initialization of i, and so on.

*insert is not shown, but you could probably use append anyway since that is what you seem to be doing.

*i is not an "iterator" either, so probably you meant index.

*You are having a function declaration in the middle of the function rather than calling it.
This pseudo code should get you going about understanding the input file stream class and its usage for this in C++:
void Runlist(filename)
{
    ifstream in(filename, ifstream::in);
    in.getline(0, 1024);
    int number;
    while (in >> number)
        append(number);
    in.close();
}

Disclaimer: this pseudo code is missing proper error checking, and so on.


text:
Q: Android app 1.0.71 started crashing again Exactly when the crash occurs is not as predictable as the crashes with the prior versions, but it crashes much more frequently, often when just upvoting.
Restored 1.0.63 and it works fine.
Android 4.2.2 on Azpen A727


text:
Q: Range symbol over character How can I put a range symbol over a character?
The symbol I am looking for is similar to this:
\overleftrightarrow{T}

But instead of using an arrow at each end, I want to put a black dot at each end.

A: Here's an extensible version.
\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\range}{\mathpalette{\overarrow@\range@}}
\newcommand{\range@}{%
  \arrowfill@\leftrangebullet\relbar\rightrangebullet
}
\newcommand{\leftrangebullet}{\mathrel{\smallbullet}\joinrel\relbar}
\newcommand{\rightrangebullet}{\relbar\joinrel\mathrel{\smallbullet}}
\newcommand{\smallbullet}{%
  \vcenter{\hbox{$\m@th\scriptscriptstyle\bullet$}}%
}
\makeatother

\begin{document}

$\range{T}+\range{ABCD}$

\end{document}

Now also \leftrange and \rightrange:
\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\range}{\mathpalette{\overarrow@\range@}}
\newcommand{\leftrange}{\mathpalette{\overarrow@\leftrange@}}
\newcommand{\rightrange}{\mathpalette{\overarrow@\rightrange@}}
\newcommand{\range@}{%
  \arrowfill@\leftrangebullet\relbar\rightrangebullet
}
\newcommand{\leftrange@}{%
  \arrowfill@\leftrangebullet\relbar\relbar
}
\newcommand{\rightrange@}{%
  \arrowfill@\relbar\relbar\rightrangebullet
}
\newcommand{\leftrangebullet}{\mathrel{\smallbullet}\joinrel\relbar}
\newcommand{\rightrangebullet}{\relbar\joinrel\mathrel{\smallbullet}}
\newcommand{\smallbullet}{%
  \vcenter{\hbox{$\m@th\scriptscriptstyle\bullet$}}%
}
\makeatother

\begin{document}

$\range{T}+\range{ABCD}$

$\leftrange{T}+\leftrange{ABCD}$

$\rightrange{T}+\rightrange{ABCD}$

\end{document}

A: \documentclass{article}
\usepackage{amsmath}
\usepackage{fdsymbol}
\begin{document}
$\overset{\leftrightblackspoon}{T}$ or
$\overset{\leftrightblackspoon}{\text{T}}$
\end{document}

A: How does that look?
\documentclass[]{standalone}

\usepackage{amsmath}

\begin{document}
$\overset{\cdot - \cdot}{T}$
\end{document}


text:
Q: Why is my downloaded file corrupted in Javascript? I am trying to download a file from my nodeJS server, however opening the files afterwards is not possible. For example: The original 15kb JPG file will be 24kb when downloaded and impossible to show.
upload:
        if (fs.existsSync(filePath)) {
            res.download(filePath);
            readStream.pipe(res);
        } else {
            return res.status(404).json({msg: "Failed to load file"});
        }

download:
import fileDownload from "js-file-download";

    const getFile = async (filename) => {
        const headers = {
            'responseType': 'blob',
            'x-access-token': JSON.parse(localStorage.getItem('user')).token
        }

        await axios.post(getFileRoute, {
                filename: filename
            }, {headers: headers})
                .then((response) => {
                    fileDownload(response.data, filename);
                });
            }

The picture preview is also shown in the network tab of google chrome's inspect. Thank you for your help!


text:
Q: Zombie.js Error: Timeout: did not get to load all resources on this page I'm having a problem where Zombie.js is throwing an error Error: Timeout: did not get to load all resources on this page.
It's always super random and always seems to happen on a different test.
I used to have the following line of code to prevent this issue.
Browser.waitDuration = '60s';

Problem is recently Stripe.js was causing this problem where my unit tests took an extra 55 seconds. See this question.
So Stripe advised me to remove that line. And sure enough my tests started running faster again.
But I had forgotten that I added that line to prevent this timeout error.
Any ideas on how to fix this while making sure my unit tests don't take an unreasonably long time?

A: I have never used Zombie.JS, but I've used PhantomJS quite a bit, and I ran into similar issues.  My solution was to block unnecessary resources which reduced my request / response times to milliseconds -- for the most part -- during testing.
There is a discussion in another zombie.js-related question where the OP wants to block external resources like Google Analytics:
Prevent zombie.js from loading only external resources
There are two answers provided.  One -- the Chosen Answer -- pertains to pre-3.1 zombie.js and the second (non-chosen answer) explains how you might use the 'nock' npm module to stub external resources.
Sorry, but I don't have time to work out any examples.  However, I do have a gist with an example of blocking resources in PhantomJS: https://gist.github.com/mootzville/15af584e626b365d2664
Maybe that can give you some ideas.
Good luck.
EDIT (Jun 3, 2017):
I played around with the code you provided in your comment.  Below is a sample of some code that should work for you using zombie and nock together:
nock('https://js.stripe.com')
  .get('/v2')
  .replyWithFile(200, __dirname + '/stripev2.js');

var Browser = require('zombie');
var browser = new Browser();
var url = 'https://js.stripe.com/v2';

browser.fetch(url)
  .then(function(response) {
    console.log('Status code:', response.status);
    if (response.status === 200)
      return response.text();
  })
  .then(function(text) {
    console.log('Document:', text);
  })
  .catch(function(error) {
    console.log('Network error');
  });

Just to clarify, the stripev2.js file should exist locally in the same directory as the entry point -- if you were following Node conventions, then it would be where your app.js or index.js file is (typically, the root dir of the app).


text:
Q: How to use mylatexformat to precompile headers with lualatex? I would like to use mylatexformat to precompile headers without having to put them into a separate preamble.tex.
This works fine with pdflatex - can I do the same with lualatex? This is what I have tried in bug.tex:
\documentclass{article}
\usepackage{datetime2}
% \usepackage{microtype}
% \usepackage{tikz}
\begin{document}
\DTMnow
\end{document}

I build this file using
lualatex -ini -jobname="bug" "&lualatex" mylatexformat.ltx bug.tex
lualatex --fmt="bug.fmt" bug.tex

This works fine.
However, enabling various packages leads to very different errors:

*

*microtype:

(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/microtype/mt-LatinModernRom
an.cfg[\directlua]:1: attempt to index a nil value (global 'microtype')
stack traceback:
        [\directlua]:1: in main chunk.
MT@ifstreq ...{microtype.if_str_eq([[#1]],[[#2]])}
                                                  endcsname
l.105    }

*

*tikz:

(/home/bers/opt/texlive/2020/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cf
g)) [1{/home/bers/opt/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.m
ap}]
! error:  (pdf backend): referenced object has wrong type others; should be obj

!  ==> Fatal error occurred, no output PDF file produced!


text:
Q: Excel: Finding max value based on two criteria, if max value has two identical results If we have a table of sports teams, that have all played against each other and two teams are on top equal with x points, the winner would be crowned with the highest average goal differential.
But how would you do that with a formula in Excel?

This is the formula I am using to find the team with the highest points total:
=INDEX($C$8:$C$11,MATCH(MAX($K$8:$K$11),$K$8:$K$11,0))
This formula would give me the result of Ecuador being highest (first result of max value).
But in reality Qatar should be on top based on same points total AND average goal difference being higher.
Any solutions?

A: I assume you want to sort in descending order first by column P, then by column GD. If that is not the case, you can adjust it accordingly. In cell A8 you can put the following formula:
=TAKE(SORT(A3:I6, {9,8}, -1),2,1)

Here is the output:

You can also select the columns of your interest first via CHOOSECOLS then SORT:
=TAKE(SORT(CHOOSECOLS(A3:I6,1,8,9), {3,2}, -1),2,1)

If you want to include the row title, then:
=HSTACK({"First Place";"Second Place"},TAKE(SORT(A3:I6, {9,8}, -1),2,1))

Note: MATCH/XMATCH is not appropriate in this context, because what you really need is to sort the result, not finding values that match certain conditions. You can do it, but at the end you will end up implementing a sort manually and Excel has a built-in function for that. The resulting formula will unnecessary more verbose.
With SORT function you can use more than one criteria indicating in an array the columns to consider as first and second criteria, etc.. For your example it would be: {9,8} indicating as first sorting criteria column 9 and then column 8, so if column P have the same value, then it sorts by GD. The third input argument is to specify ascending (1, default)/descending order(-1). If you want to have a different sorting criteria for each column, then instead of -1, you can use it {-1,1} which means sort in descending order the column 9 and in ascending order the column 8. For your case you can use also: {-1,-1}, but using -1 produce the same result.


text:
Q: Web service using NodeJS that simulates browser execution from html page with javascript I'm new to NodeJS and I'm needing to build a web service that will send a response with the result of a javascript script from an HTML page (the page is not local, it's from the web).
For example:
My web page has a javascript script that prints "hello world" (this is an example, the actual page has a lot of functions to calculate the response).
When I use Postman to get this page, the response that I get is the HTML without the javascript execution (without the hello world).
Is there a way to use Node.js to simulate the browser execution? I've done some tests with express, routes, and requests, but they don't execute descript. And I need to execute this script using the URL because it has a lot of os dependencies.
Thanks very much,

A: What I've done so far:
var express    = require('express');
var app        = express();
var port = process.env.PORT || 8080;

router = express.Router(),
request = require('request');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

app.use('/test', router);
router.get('/', function(req, res, next) {
     request({
         uri: 'http://qliksense.arysta.com.br/custom/extensions/teste4/teste4.html'
     }).pipe(res);

});

module.exports = router;
app.listen(port, function(){
    console.log('Magic happens on port ' + port);

});

I'll take a look at prerender.io, if someone has a example of how I can fit it to my code, I'll be thankful


text:
Q: how to start application with a ready sql database with active android I want to start my application with a pre made SQLite data base,
that i would be able to read and write to.
I'm currently using Active Android in my Application to read and write MySQL tables.
Is there a possibility to open an SQLite database table from file using Active android ?, or is there a better way of achieving it ?

A: You can read your db file(.sqlite) from assets folder in android. You can create your db file(.sqlite) online through this url and the java code to read this file are given below :-
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.freshstartappz.appusagetracker.dto.AppInfo;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;

public class DataBaseHelper extends SQLiteOpenHelper {

    // All Static variables
    // Database Version
    private static final int DATABASE_VERSION = 1;

    // Database Name
    private static final String DATABASE_NAME = "AppTracker.sqlite";

    private static final String DB_PATH_SUFFIX = "/databases/";
    static Context ctx;

    public DataBaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        ctx = context;
    }

    public void CopyDataBaseFromAsset() throws IOException {

        InputStream myInput = ctx.getAssets().open(DATABASE_NAME);

        // Path to the just created empty db

        String outFileName = getDatabasePath();

        // if the path doesn't exist first, create it
        File f = new File(ctx.getApplicationInfo().dataDir + DB_PATH_SUFFIX);

        if (!f.exists())

            f.mkdir();

        // Open the empty db as the output stream

        OutputStream myOutput = new FileOutputStream(outFileName);

        // transfer bytes from the inputfile to the outputfile

        byte[] buffer = new byte[1024];

        int length;

        while ((length = myInput.read(buffer)) > 0) {

            myOutput.write(buffer, 0, length);

        }

        // Close the streams

        myOutput.flush();

        myOutput.close();

        myInput.close();

    }

    private static String getDatabasePath() {

        return ctx.getApplicationInfo().dataDir + DB_PATH_SUFFIX

                + DATABASE_NAME;

    }

    public SQLiteDatabase openDataBase() throws SQLException {

        File dbFile = ctx.getDatabasePath(DATABASE_NAME);

        if (!dbFile.exists()) {

            try {

                CopyDataBaseFromAsset();

                System.out.println("Copying sucess from Assets folder");

            } catch (IOException e) {

                throw new RuntimeException("Error creating source database", e);
            }

        }

        return SQLiteDatabase.openDatabase(dbFile.getPath(), null, SQLiteDatabase.NO_LOCALIZED_COLLATORS | SQLiteDatabase.CREATE_IF_NECESSARY);

    }

    @Override

    public void onCreate(SQLiteDatabase db) {

    }

    @Override

    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        // TODO Auto-generated method stub

    }

    //add your public methods for insert, get, delete and update data in database.
    public ArrayList<AppInfo> getAppsInfo() {
        ArrayList<AppInfo> appInfos = new ArrayList<AppInfo>();
        String selectQuery;
        Cursor cursor;
        // Select All Query
        selectQuery = "SELECT  * FROM appinfo";
        SQLiteDatabase db = this.getReadableDatabase();
        cursor = db.rawQuery(selectQuery, null);

        // looping through all rows and adding to list
        if (cursor.moveToFirst()) {
            do {
                AppInfo appInfo = new AppInfo(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3));
                appInfos.add(appInfo);
            } while (cursor.moveToNext());

        }
        return appInfos;
    }
}

This is a sample code change sqlite file name and table name with your fields.


text:
Q: Multi-line list items on WinForms ListView control? Is there a way to display multi-line text in standard Winforms listview control?

A: Yes, but only in a owner-drawn listview.
EDIT
Check these links:
http://www.codeproject.com/KB/list/aa_listview.aspx
http://www.codeproject.com/Messages/2857480/Multiline-listview.aspx

A: If you want multi-line text in a ListView, have a look at ObjectListView (an open source wrapper around .NET WinForms ListView). This takes care of many of the problems involved with owner drawing (and other ListView annoyances).
In the following screenshot, the first column has WordWrap turned on:

Just remember that a ListView CANNOT have rows of different heights. In the above screenshot, I cannot make the first and third rows taller to show more text and the other rows shorter.  Every row has to be the same height.
If being able to have rows of different heights is essential to you, a ListView will not your solution. You may want to consider Matthew Hall's excellent XPTable and its update project, as well as Lee Paul Alexander's fantastic Outlook-style list.


text:
Q: Redirect non-existing subfolders with .htaccess I have a site where I have some links like this: http://mysite.com/search-RANDOM_WORDS.htm
The problem is that Google tries to index links like:
http://mysite.com/search-RANDOM_WORDS.htm/existing-link-on-the-site
http://mysite.com/search-WORD.htm/link-on-the-site/search-ANOTHER_WORD.htm

etc. etc. The site doesn't use subfolders in links, every link is on the root. I don't really understand from where Google is taking these links through, but I have to fix it somehow. I am using mod_rewrite already, but I did not found yet a working solution for my problem. It should work like this:

*

*If the link what is trying to access contains a subfolder which doesn't exist on the server

*reditect it to the root with 404 error.

How can be done this?
Thanks!

A: Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(search-.+?\.htm)/.*$ /$1 [L,R=301,NC]