text:
Q: Form submission canceled because the form is not connected на внешнем сервере Суть проблемы в том, что имеется две копии проекта. Локальная и продакшн. В локальной эта форма всё успешно отправляет и информация обрабатывается, на продакшне выдает ошибку о том что форма не подключена.
Объявление формы

function addDeleteForms() {
    $('[data-method]').append(function () {
        if (! $(this).find('form').length > 0) {
            return "\n" +
                "

\n";
        } else {
            return "";
        }
    })
        .removeAttr('href')
        .attr('style', 'cursor:pointer;')
        .attr('onclick', 'submitFRM($(this).find(".frm"));');
        //.attr('onclick', '$(this).find("form").send()');
}

Вызов обработчика

 addDeleteForms();

    /**
     * Generic confirm form delete using Sweet Alert
     */
    $(document).on('submit', 'form[name=delete_perm],form[name=delete_item]', function(e){
        e.preventDefault();
        var form = this;
        /*title: "Warning",
            text: "Are you sure you want to delete this item?",
            type: "warning",
         confirmButtonText: "Yes, delete it!",*/
        if($(form).attr('name')=='delete_perm' || $(form).attr('name')=='delete_item'){
            swal({
                title: "Предупреждение",
                text: "Вы уверены, что хотите удалить этот элемент?",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "Да, удалить его!",
                cancelButtonText: "Отменить",
                closeOnConfirm: true
            }, function(confirmed) {
                if (confirmed)
                    form.submit();
            });
        }else{
            form.submit();
        }

    });

Ну и собственно добавление этих самых кнопок в табличку в которой отображается информация.

$('body').delegate('#<?=$grid->getConfig()->getName()?> .pagination a','click',function(e){
        e.preventDefault();
        var parent_form=$(this).parents('form'),
            key=parent_form.find('div.keys'),
            url=$(this).attr('href'),
            param=parent_form.serializeArray();
        $.each(param,function(i,val){
            var myRe = /<?=$grid->getConfig()->getName()?>\[page\]/ig;
            var myArray = myRe.exec(val['name']);
            if(myArray){
                delete param[i]
            }
        })
        var  gets=$.param(param);
        url=url+'&'+gets;
        key.prop('title',url);
        $.fn.yiiGridView.update('<?=$grid->getConfig()->getName()?>');
        setTimeout( function(){
            addDeleteForms()
        },2000);
    });

Господа, в какую сторону копать? Я уже как только мог так и сравнивал коды страниц - идентично за исключением адреса обращения ( что логично ). Почему один и тот же код на локальном сервере отрабатывает, а на внешнем выдает "Form submission canceled because the form is not connected"?


text:
Q: Socket Connection Exception while accesss external api in Pivotal Cloud Foundary When I try to connect to external api with https connection from local it's working fine without any need of certificate.
But when the same app deployed in pivotal cloud foundary and try to access the external api then it's giving socket connection exception: connection reset.

A: The message connection reset means that you are having network problems, specifically that a TCP packet with the RST flag set was received. It's impossible to say for sure with the given info, but it's likely that your external resource is not accessible from inside your PCF installation.
Access to resources that reside outside of CloudFoundry can be blocked by application security groups, which are a CloudFoundry concept. You can have platform-wide or space-scoped application security groups. The former is managed by your platform's operations team, the latter can be controlled by someone with the SpaceDev role for the given space.
Application security groups define the traffic that is allowed out of CloudFoundry (by default, nothing is allowed out and ASG's allow only the specified traffic).
Application security groups are specific to your environment, so you'd need to use these commands to view the ASG's for your environment and review to see if your connection is being blocked.
Beyond that, it is possible that the traffic is not routable at the network layer or blocked by firewalls on your network. Both of these problems would happen outside of CloudFoundry so you would not be able to change it with application security groups, and you would need to talk with your platform operations team or possibly your company's networking team to request access.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Insert and Check for Copies of Data using SQL and C# So I'm upgrading an old parser right now. It's written in C# and uses SQL to insert records into a database.
Currently it reads and parses a few thousand lines of data from a file, then inserts the new data into a database containing over a million records.
Sometimes it can take over 10 minutes just to add a few thousand lines.
I've come to the conclusion that this bottleneck in performance is due to a SQL command where it uses an IF NOT EXISTS statement to determine whether the row attempting to be inserted already exists, and if it doesn't insert the record.
I believe the problem is that it just takes way too long to call the IF NOT EXISTS on every single row in the new data.
Is there a faster way to determine whether data exists already or not?
I was thinking to insert all of the records first anyways using the SQLBulkCopy Class, then running a stored procedure to remove the duplicates.
Does anyone else have any suggestions or methods to do this as efficiently and quickly as possible? Anything would be appreciated.
EDIT: To clarify, I'd run a stored procedure (on the large table) after copying the new data into the large table
large table = 1,000,000+ rows

A: 1.  Create an IDataReader to loop over your source data.
2.  Place the values into a strong dataset.
3.  Every N number of rows, send the dataset (.GetXml) to a stored procedure.  Let's say 1000 for the heck of it.
4.  Have the stored procedure shred the xml.
5.  Do your INSERT/UPDATE based on this shredded xml.
6.  Return from the procedure, keep looping until you're done.

Here is an older example:
http://granadacoder.wordpress.com/2009/01/27/bulk-insert-example-using-an-idatareader-to-strong-dataset-to-sql-server-xml/
The key is that you are doing "bulk" operations.......instead of row by row.  And you can pick a sweet spot # (1000 for example) that gives you the best performance.


text:
Q: Returning a Formatted Number in PHP I am trying to get a number value that is pulled from a mysql database to be formatted differently in a php document.
        $oIteminfo = mysql_query("
    SELECT Items.PartID, Items.VendorCost, Items.ProductName, Sum(Sales.AmountSold) AS SumOfAmountSold
    FROM Items
    LEFT JOIN Sales
    ON Items.PartID = Sales.PartID
    GROUP BY Items.PartID, Items.VendorCost, Items.ProductName
    HAVING Items.PartID=$iPartID;

") or die(mysql_error());

while($row = mysql_fetch_array($oIteminfo))
    {
    ECHO "
WOWAuctionSales
";
    ECHO "";
    ECHO "
".$row['ProductName']."

";
    ECHO "Total Sold:".$row['SumOfAmountSold']."
";
    ECHO "Vendor Price:".$row['VendorCost']."
";

For example in one instance the result will pull the following number 162356 I want that number to be formatted to say 16g 23s 56c or 00g 00s 00c I have looked a fprintf, sprintf and printf, but they do not seem to do the trick. I have seen this formatting done before in php but I cannot seem to figure it out how to do it myself.

A: i can think of a dozen options here is one

//$number ="162356";
$number =$row['VendorCost'];
echo substr($number,0,2).'g '.substr($number,2,2).'s '.substr($number,4,2).'c';


text:
Q: Does ASP.NET Identity's UserManager need to be closed or disposed? I've been using ASP.NET Identity for a while now and I've followed tutorials and sites that always say to create the UserManager in my methods with this code:
var userManager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>()
All was working fine until, one day, I noticed that UserManager implements IDisposable. And on my quest to make sure everything I open gets closed properly, I added using to all these instances and suddenly everything stopped working. I started getting "Cannot access a disposed object." errors all over the place. From what I could research, apparently some instances were being closed while others were still being used.
Oddly enough, when I searched the web, there was very little to no info on whether one should close or dispose of UserManager or any of the other Managers (i.e. SignInManager, RoleManager).
So, what's the consensus on this? Should those Managers be closed/disposed or not? And if not, then where should we declare them if not inside a method? I've read they shouldn't be static.

A: I may have found my answer. After I kept digging around obscure links, I found this MSDN blog post which explains that these Managers should be single-instance and explains exactly how to declare them in a page or controller:
https://blogs.msdn.microsoft.com/webdev/2014/02/12/per-request-lifetime-management-for-usermanager-class-in-asp-net-identity/


text:
Q: Flutter: To put a circle image in a corner I would like to put an enter image description here image, that I want to round, in the top right corner. I've tried with the alignment, but it didn't work. Any suggestion?
This is what I've done so far:
import 'package:flutter/material.dart';

class Login extends StatefulWidget {
  @override
  _LoginState createState() => _LoginState();
}

class _LoginState extends State<Login> {

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(title: Text("Login"),),

      body: CircleImage(),
    );
  }
}

class CircleImage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ClipPath(
      child: Image.asset("images/login_img.png", alignment: Alignment(1.0, 1.0),),
      clipper: CircleClipper(),
    );
  }
}

class CircleClipper extends CustomClipper<Path>{

  @override
  getClip(Size size) {

    var path = Path();

    path.addOval(new Rect.fromCircle(center: new Offset(size.width/2, size.height/2), radius: size.width * 0.45));

    return Path();
  }

  @override
  bool shouldReclip(CustomClipper oldClipper) {
    return false;
  }

}

And this is what I want to achieve:
image

A: Use this code to get your expected result.
          class CornerCircle extends StatelessWidget{
      @override
      Widget build(BuildContext context) {
        return new Container(
          width: 200.0,
          height: 200.0,
          child: new Stack(
            alignment: Alignment.center,
            children: <Widget>[
            new Container(
              margin: EdgeInsets.all(25.0),
              decoration: new BoxDecoration(
                gradient: LinearGradient(colors: [Colors.yellow[700], Colors.redAccent],
                begin: Alignment.topRight, end: Alignment.bottomLeft),
                border: Border.all(color: Colors.red,width: 2.0)
              ),
            ),
            new Align(alignment: Alignment.topRight,
            child: new Container(
              width: 50.0,
              height: 50.0,
              decoration: BoxDecoration(
                color: Colors.red,
                shape: BoxShape.circle
              ),
              alignment: Alignment.center,
              child: new Text('50', style: new TextStyle(color: Colors.white, fontWeight: FontWeight.bold),),
            ),)
          ],),
        );
       }
      }

A: You can wrap your ClipPath inside a Container and an Align widget
  @override
    Widget build(BuildContext context) {
      return Container(
        child: Align(
          alignment: Alignment.topRight,
          child: ClipPath(
            child: Image.asset(
              "images/login_img.png",
              height: 80.0,
              width: 80.0,
            ),
            clipper: CircleClipper(),
          ),
        ),
      );
    }

And fix your getClip method , you are returning a new Path() instead the path created
    @override
    getClip(Size size) {

      var path = Path();

      path.addOval(new Rect.fromCircle(center: new Offset(size.width/2, size.height/2), radius: size.width * 0.45));

      return path;
    }


text:
Q: Custom footer using tikz I am trying to modify the footer of my article document using Tikz but I don't know where to start. My idea is to enclose the page number in a circle
and between lines at the footer:
-------------------------------- ( Number ) ---------------------------
I tried to use scrlayer but I keep getting the cannot define \newpagestyle error. Another way I think, would be to use titlesec but I haven't found a good example so far, for footers. I also thought on using fancyhdr but I saw that it is not very easy to edit.
EDIT:
Using the first answer I modified it to get this:

which is what I wanted, using this:
\documentclass{article}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[top=3cm, bottom=3cm, left=4cm, right=3cm]{geometry}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{%
\noindent%
\tikz[baseline]{\draw[color=back, line width=2pt] (-0.5, 0) -- (6, 0);}%
\protect\circled{\thepage}%
\tikz[baseline]{\draw[color=back, line width=2pt] (8, 0) -- (15, 0);}%
}

\newcommand*\circled[1]{%
\tikz[baseline]{\node[color=back, shape=circle,%
    draw, inner sep=4pt, line width=2pt] (char) {#1};}}

\begin{document}
\section{Section name}
\lipsum
\end{document}

I wanted this to match my Sections:

So, if someone has a better idea, I would appreciate it :) But the current answer is great so far

A: What about the following code with fancyhdr package and tikz
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\dotfill \protect\circled{\thepage} \dotfill}

\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline]{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

\begin{document}
\section{Section name}
\lipsum
\end{document}


text:
Q: Excel Queries and connection Fairly new to power queries and finding my feet largely by trial and error.
I have an Excel file with two tables, "ModelName" is one

and "Vendors" is the other.

Table "ModelName" column "Model" contains unique values (one to one)
Table "Vendor" column "Model" contains the same names as the above table, but it has duplicate values (marked in red above) because I could potentially have the same Model containing a different Vendor or Controller (one to many).
I have created Queries & Connections and loaded/ added them to the Data Model.
I have also created a relationship between the two data models

But apparently, this isn't working:

I was wondering if there is someone willing to point me in the right direction. What I am trying to do is to create one PivotTable from "ModelNames" which would contain "Model" and "12 Month Volume". Then I would use all these slicers from "Vendor" and be able to filter the data from "Vendor" (which works fine) as well as the data/ Pivot Table from "ModelNames".


text:
Q: A way to dynamically create variables in Matlab? The case I am working on is dividing a big three-dimensional array of data that I have collected using good coding practises (etc...) and now I need to segment the layers of this array into separate variables for individual processing elsewhere, I can't call my data like this BigData(:,:,n).
So I would like to create a loop where I create new variables like so
for i=1:n

createVariable('user_' i) = BigData(:,:,i);

end

How do I do this without writing n new variables by hand every time?
user_1 = BigData(:,:,1);
user_2 = BigData(:,:,2);
user_3 = BigData(:,:,3);
.
.
.

A: Your disclaimer sounds convincing :-) I'll get those downvotes too. But, to be clear: using separate variables for this is bad practice.
You can use assignin to create the variables and assign them values:
for ii = 1:n
    assignin('base', ['user_' num2str(ii)], BigData(:,:,ii));
end

And yes, using separate variables for this is bad practice.

A: Try using eval() - but as you said it is seen as a very bad practice. If you still want to use this, it is straight forward like:
for i = 1:n
    eval(['user_',num2str(i),' = BigData(:,:,',num2str(i),');']);
end


text:
Q: Using tf.keras.utils.Sequence with model.fit_generator with use_multiprocessing=True generated warning This is the warning I got:
WARNING:tensorflow:multiprocessing can interact badly with TensorFlow, causing nondeterministic deadlocks. For high performance data pipelines tf.data is recommended.

The Sequence subclass I wrote strictly perform load and read I/O jpg files. I guess as long as no 2 threads do it simultaneously on the same file, things should be ok.
I trained for a few epoch and so far, there's no error. But would like to get feedback if there's something potentially bad that could happen.

A: Initially in the TensorFlow 2.0 Version, there were issues with the keras.utils.Sequence with multiprocessing=True was causing a hang due to deadlock. Later in Tensorflow 2.1 this Warning was added to address this concern.
# use_multiprocessing=False works.
# use_multiprocessing=True hangs in a deadlock situation.
model.fit_generator(generator, use_multiprocessing=True, workers=2)

You can ignore this warning since you are not doing any processing which will create deadlock situation.

A: In general, a necessary condition for deadlocks is that a process has exclusive access to a resource, and is waiting for another (source)
That means that if your Sequence (or generator) class only holds access to a single resource (e.g. a .jpg image file), then no deadlock can occur. Also, if you are reading data from memory, with no locking (e.g. read-only data), no deadlock can occur (due to lack of exclusivity).
In other words: The warning probably does not apply, unless you are reading or modifying multiple data, in a thread-safe manner, in your Sequence, or generator.

A: I trained two models with the same hyper-parameteres, one is classifcation and the other is regression model. The classification model is trained with multi_processing=True without any warning, while training regression model with mse loss, it gives the warning and slowely consumes whole memory and systems hangs. So, I had to turn off multi_processing and it worked consuming almost 50% of the system memory. Note that the same batch size was used for traning both models although the classifcation model has more parameters than regression model.


text:
Q: Opengl Shader Basic Computation OS: Win7 VS 2012
Graphics Card: Inter HD 4000
I have no problem generating an image without any computation.
However, when I added p*vPosition for a prospective projection,
My window opened and closed immediately after I executed the program.
Could anyone point out what I have done wrong?
My vshsader.glsl code looks like this:
#version 150

in  vec4 vPosition;
in  vec4 vColor;
out vec4 color;

void main()
{
    float d = -10.0;
    mat4 p = mat4( 1.0, 0.0, 0.0, 0.0
                   0.0, 0.0, 1.0, 0.0
                   0.0, 0.0, 1.0, 0.0
                   0.0, 0.0, 1/d, 0.0);

  gl_Position = p*vPosition;
  color = vColor;
}

A: You are missing commas at the end of each line of parameters to the mat4 constructor.
It should be:
mat4 p = mat4( 1.0, 0.0, 0.0, 0.0, // <- end with comma
               0.0, 0.0, 1.0, 0.0, // <- end with comma
               0.0, 0.0, 1.0, 0.0, // <- end with comma
               0.0, 0.0, 1/d, 0.0);


text:
Q: How to use doctrine or symfony pager with different column selected from multiple table? How can I implement pagination using Doctrine_Pager or sfDoctrinePager while my query selects multiple columns from two or more tables ?

Edit1:

Ok, now I figured out that it can be done how Nathan has described below! I got confused as I couldn't retrieve certain data from the query! Let me describe it below:
This is my pager query:
        $pager = new sfDoctrinePager('sfGuardUser', '5');

        $q = Doctrine_Query::create()
                        ->select('u.id, u.username,  p.org_name,  g.name, l.status')
                        ->from('sfGuardUser u')
                        ->leftJoin('u.Profile p')
                        ->leftJoin('u.Groups g')
                        ->leftJoin('u.LicensedVendors l')
                        ->where('g.name = \'client\'');

        $pager->setQuery($q);
        $pager->setPage($request->getParameter('page', 1));
        $pager->init();

Now in my Template I can retrieve my sfGuardUser and Profile data like this:
 foreach ($pager->getResults() as $data) {

            echo $data->username ;  //outputs 'username' from sfGuardUser table
            echo '<br />' ;
            echo $data->Profile->org_name ; //outputs 'Organization name' from sfGuardUserProfile table

}

I was wrongly trying to retrieve the profile data by $data->org_name and not $data->Profile->org_name! Now its working for this part correctly, but there is still an issue !
I am still unable to retrieve the Groups & LicensedVendors data using $data->Groups->name or $data->LicensedVendors->status ! It does not show any error or any value either! looks like it outputs an empty string. Shouldn't it get the value just like Profile data ?
But when I hydrate the query by setting:
$q->setHydrationMode(Doctrine_Core::HYDRATE_SCALAR);
I can retrieve all data through:
foreach ($pager->getResults() as $data) {

      echo $data['u_username'];
      echo $data['p_org_name'];
      echo $data['g_name'];
      echo $data['l_status'];
}

How to get those data without setting **Doctrine_Core::HYDRATE_SCALAR** ? Where I'm doing wrong for retrieving those Groups and LicensedVendors table data?
Here is the schema definition of the tables described above:
License:
  actAs: [Timestampable]
  tableName: licenses
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    status:
      type: enum
      values: ['approved','pending_admin','pending_client','pending_vendor','rejected']
      default: 'pending'
    client_id:
      type: integer(8)
      notnull: true
    vendor_id:
      type: integer(8)
      notnull: true
    product_desc:
      type: clob(16777215)
    supplier_name:
      type: string(80)
    other_desc:
      type: string(50)
    financial_statement:
      type: clob
  relations:
    VendorUser:
      class: sfGuardUser
      local: client_id
      foreign: id
      foreignAlias: LicensedVendors
      onDelete: cascade
      foreignType: many
      owningSide: true
    ClientUser:
      class: sfGuardUser
      local: vendor_id
      foreign: id
      foreignAlias: LicensedClients
      onDelete: cascade
      foreignType: many
      owningSide: true

sfGuardUser:
      actAs: [Timestampable]
      columns:
        first_name: string(255)
        last_name: string(255)
        email_address:
          type: string(255)
          notnull: true
          unique: true
        username:
          type: string(128)
          notnull: true
          unique: true
        algorithm:
          type: string(128)
          default: sha1
          notnull: true
        salt: string(128)
        password: string(128)
        is_active:
          type: boolean
          default: 1
        is_super_admin:
          type: boolean
          default: false
        last_login:
          type: timestamp
      indexes:
        is_active_idx:
          fields: [is_active]
      relations:
        Groups:
          class: sfGuardGroup
          local: user_id
          foreign: group_id
          refClass: sfGuardUserGroup
          foreignAlias: Users

sfGuardUserProfile:
  actAs:
    Timestampable: ~
  columns:
    user_id:
      type: integer
      notnull: true
    email:
      type: string(80)
      notnull: true
      unique: true
    email_new:
      type: string(80)
      unique: true
    firstname:
      type: string(30)
    lastname:
      type: string(70)
    org_name:
      type: string(80)
      notnull: true

  relations:
    User:
      class: sfGuardUser
      foreign: id
      local: user_id
      type: one
      onDelete: cascade
      foreignType: one
      foreignAlias: Profile

sfGuardGroup:
  actAs: [Timestampable]
  columns:
    name:
      type: string(255)
      unique: true
    description: string(1000)
  relations:
    Users:
      class: sfGuardUser
      refClass: sfGuardUserGroup
      local: group_id
      foreign: user_id
      foreignAlias: Groups

Edit2: I posted my new issues which I described in first edit as a separate question here !

A: I guess as long as your query gives back a Doctrine_Collection object, you can use it with a pager, can't you?

A: Yeah, what greg0ire said.  This documentation is a bit old, but it shows what you'd need with Propel in the old days.  Updating to Doctrine would be like,
public function executeList ()
{
  $pager = new sfDoctrinePager('Comment', 2);

  $q = Doctrine_Core::getTable('Comment')
    ->createQuery('c')
    ->where('c.author = ?', 'Steve')
    ->leftJoin('c.Article a')
    ->andWhere('a.content LIKE ?', '%enjoy%')
    ->orderBy('c.created_at ASC');

  $pager->setQuery($q);
  $pager->setPage($request->getParameter('page', 1));
  $pager->init();

  $this->pager = $pager;
}

This blog post, "Symfony doctrine pager for two tables" has a more extended/convoluted example.  Oh, looks like that was the author's answer to his own SO question.


text:
Q: How can I turn off subtitles in Totem? In "videos" (e.g. totem player), under Ubuntu 15.04, how do you turn off subtitles on a video that has them in metadata? All subtitle options in the Preferences are unticked. Setting their font size to 1 is not a great solution.
How do you prevent the video from immediately repeating when it finishes? The Repeat option on the Edit menu is unticked.

A: Setting them to size 1 is not a great solution, but setting them to size zero works!
You have to do it via gsettings though, the GUI will not allow size zero. Use the following command:
gsettings set org.gnome.totem subtitle-font '[whatever your font is here], 0'

You can turn them off for the current video in the menu, but every time you start a new video they come back. As far as I can tell, this is the only way to set no subtitles as a default.


text:
Q: How to cancel a mouseclicker event in Java I have a mouseclicker event added to some JLabels and, after one of them will be clicked, I want to remove the link between that JLabel and the mouseclicker event.
To add the mouseclicker event to JLabel I use this code:
JLabel.addMouseListener(this);

There is a way to remove the JLabel from being clicked after the effect is solved? How can I do this?
I searched something but I'm not sure to how I can describe the problem and search about it, so i didn't found results.

A: This may seem trivial, but you could simply do:
myLabel.removeMouseListener(this);

Option two is to leave the MouseListener in place, but make it smarter -- i.e., give it logic that allows it to ignore input if need be. This could be a simple if block such as
@Override
public void mousePressed(MouseEvent me) {
    if (someBoolean) {
        return;
    }
    // here have your usual code
}

and then in your code, when you want to de-activate the MouseListener, simply change the listener's someBoolean field to false. This use of a boolean switch or flag is useful for when you need to turn the listener on and off repeatedly.
As a side note, you're usually better off not using this for your listeners as that is giving the main GUI class a bit too much responsibility. Instead use anonymous inner classes for simple few line code or named class for more involved listener code.
For example:
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.border.Border;

public class TurnListenerOnAndOff extends JPanel {
    private JLabel myLabel = new JLabel("My Label");
    private JCheckBox listenerEnabledCheckBox = new JCheckBox("Listener Enabled", true);

    public TurnListenerOnAndOff() {
        // make label bigger with a border
        Border outsideBorder = BorderFactory.createLineBorder(Color.black);
        Border insideBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
        myLabel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, insideBorder));

        // create and add MyMouseListener to my label
        myLabel.addMouseListener(new MyMouseListener());

        // add components to the GUI's main JPanel
        add(myLabel);
        add(listenerEnabledCheckBox);
    }

    private class MyMouseListener extends MouseAdapter {
        @Override
        public void mousePressed(MouseEvent e) {
            // if the JCheckBox isn't checked...
            if (!listenerEnabledCheckBox.isSelected()) {
                return;  // let's get out of here
            }

            // otherwise if the check box is checked, do following code
            System.out.println("myLabel pressed!");
        }
    }

    private static void createAndShowGui() {
        TurnListenerOnAndOff mainPanel = new TurnListenerOnAndOff();

        JFrame frame = new JFrame("On and Off");
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.getContentPane().add(mainPanel);
        frame.pack();
        frame.setLocationByPlatform(true);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGui();
            }
        });
    }
}


text:
Q: LinkedIn API auth permission for iOS I designed app for LinkedIn and I was used SDK: OAuth Starter Kit
I set API Key and Secret Key, and after log in I tried to post text but I couldn't because I haven't access... How to set permission???
About it: https://developer.linkedin.com/documents/authentication#granting


text:
Q: How to run "Rise of Nations" with wine? I can't install "Rise of Nations" expansion pack (2 CDs) with wine.
I see a message
pidgen.dll cannot load

If you have a solution, could you please explain it very clearly so that I can follow?

A: If you are using Ubuntu 13.10, install playonlinux instead of using Wine directly. That should make things significantly easier for you. If you are not using Ubuntu 13.04, you may download playonlinux here: http://www.playonlinux.com/en/

A: I fixed this error by installing MSXML4 / vcrun6 / corefonts / mfc42 / .NET 1.1 thru 3.5 (should be one of those) managed to get past that error and install the game, just not able run it now due to a msxml4 fatal error on launch.


text:
Q: Please help me check the actual size of my volume AWS I am using AWS EC2 instance and recently I tried extending my secondary volume and then connecting it back to my ec2 instance. I scaled it to 200 GB from 8GB. Though I have confirmed from the dashboard that its 200GB but I don't know why df . shows that my volume size is only 8GB?
df .  shows :
lsblk shows
whom should I trust ?
Which one is showing the actual size ?

A: The volume is 200 GB, but the filesystem is still only 8 GB.
You need to resize the filesystem bigger to occupy the entire volume.
Use the resizefs command to extend the filesystem to the full volume size.


text:
Q: How yarn application id is generated I kick off a yarn application, it gives the id as application_1560618551799_4465795
But, I am supprised to find that 1560618551799 means Sun Jun 16 01:09:11 CST 2019,which is about 3 months ago.
I have thought that the timestamp in the id will fall into today, I would ask whether I am able to figure out when the application kicks off from id?
Thanks

A: Unfortunately, application start time can't be deduced from the application ID itself. Source code for the ApplicationId provides the following narrative:

ApplicationId represents the globally unique identifier for an
  application. The globally unique nature of the identifier is
  achieved by using the
  cluster timestamp i.e. start-time of the  ResourceManager along with a monotonically increasing counter for the application

You'll probably need to getApplicationReport using YarnClient, and extract start time from there.


text:
Q: Prove $f: X \rightarrow Y$ is continuous if $A_a$ is closed and $f|A_a$ is continuous for any $a$ and $\text{{$A_a$}}$ is locally finite collection Let $f:\bigcup_{\alpha}A_{\alpha} \rightarrow Y$ be a function between the topological spaces Y and $X=\bigcup_{\alpha}A_{\alpha}$. Suppose that $f|A_{\alpha}$ is a continuous function for every $\alpha$ and that $\text{{$A_{\alpha}$}}$ is locally finite collection. Suppose that $A_{\alpha}$ is closed for every $\alpha$.
Show that: $f$ is continuous.
Any hints?

A: We denote  $f_{\alpha}:=f/A_{\alpha}$. Let $F$ be a closed subset of $Y$, we have
$f^{-1}(F)=\cup_{\alpha}f_{\alpha}^{-1}(F)$, now for each $\alpha$, $f_{\alpha}^{-1}(F)$ is a closed subset  $A_{\alpha}$ hence it is a closed subset (in $X$). To finish we want to show that $f^{-1}(F)$ is closed. Let $x\in \overline{f^{-1}(F)}$, and fix a neighborhood $V$ of $x$ which intersect only a finitely many of the sets  $A_{\alpha_1},\ldots,A_{\alpha_d}$, it is clear that each neighborhood $W$ of $x$ intersect $\cup_{i=1}^df_{\alpha_i}^{-1}(F)$, hence $x\in \overline{\cup_{i=1}^df_{\alpha_i}^{-1}(F)}=\cup_{i=1}^df_{\alpha_i}^{-1}(F)\subset f^{-1}(F)$.

A: Recall that a function $f:X \to Y$ between topological spaces is continuous iff $f^{-1}(A)$ is closed for every closed set $A$ of $Y$.
What are the closed sets of $X = \bigcup_\alpha A_\alpha$? Why is it necessary for $\{A_\alpha\}$ to be locally finite collection?

A: Lemma: Let $W\subset X$ be such that for all $\alpha\;W\cap A_\alpha$ is open in $A_\alpha$. Then $W$ is an open subset of $X$.
Proof: Let $p\in W$. Since $\{A_\alpha\}$ is locally finite, there is an open neighborhood $p\in O$, such that $O$ intersects only finitely many $A$'s, say $A_1,\ldots,A_n$. Of all those $A_1,\ldots,A_n$, say $p$ lies in $A_1,\ldots,A_m$ where $m\leq n$. Since $A_{m+1}\cup\ldots\cup A_n$ is closed in $X$ and does not contain $p$, there is an open $O'\subset O$ that contains $p$ and does not intersect $A_{m+1},\ldots,A_n$.
For $i=1,\ldots,m$, $W\cap A_i$ is open in $A_i$ and contains $p$, thus there is an open $V_i\subset X$ containing $p$, such that $V_i\cap A_i\subset W\cap A_i$. We claim that $$\left(\bigcap_{i=1}^mV_i\right)\cap O'\subset W.$$To see this, let $q$ be some point in LHS. Since $q\in O'$, we have $q\in A_i$ for some $i=1,\ldots,m$, thus $q\in A_i\cap V_i\subset W$.
This should be enough.

A: Let $C\subset Y$ be any closed set. To prove continuity of $f$, it is to be shown that $f^{-1}(C)$ is a closed set.
Note that $f^{-1}(C)=\cup_\alpha (f^{-1}(C)\cap A_\alpha)=\cup_\alpha f|A_\alpha^{-1},$ where each of the sets in union is a closed set in $X$ as $A_\alpha$'s are given to be closed.
Take any $t\in \rm cl$$(f^{-1}(C)).$  By locally finiteness property, there exists a neighbourhood $U_t$ of $t$ and finitely many indices $\alpha_i, i=1,2,...,n$ such that $U_t\cap A_\alpha=\emptyset$ for all $\alpha \notin \{\alpha_i: 1\le i\le n\}$. Note that $U_t=\cup_{k=1}^n (U_t\cap A_{\alpha_k})$.
For any neighbourhood $V_t$ of $t$, $V_t\cap U_t$ is also a neighbourhood of $t$. Also, $U_t\cap V_t\cap f^{-1}(C)=\cup_{k=1}^n (U_t\cap V_t\cap f|_{A_{\alpha_k}}^{-1}(C))=V_t\cap (\cup_k(U_t\cap f|_{A_{\alpha_k}}^{-1}(C)))\subset V_t\cap  (\cup_k f|_{A_{\alpha_k}}^{-1}(C))$.
Since $U_t\cap V_t\cap f^{-1}(C)$ is non empty (as $t$ is in closure of $f^{-1}(C)$), it follows that $V_t\cap(\cup_k f|_{A_{\alpha_k}}^{-1}(C)) $ is non empty. Since $V_t$ is arbitrary neighbourhood of $t$, it follows that $t\in \rm cl$$(\cup_k f|_{A_{\alpha_k}}^{-1}(C))$, which is a closed set by remark in the second paragraph. It follows that $\rm cl$$(\cup_k f|_{A_{\alpha_k}}^{-1}(C))= \cup_k f|_{A_{\alpha_k}}^{-1}(C)$. So $t\in \cup_k f|_{A_{\alpha_k}}^{-1}(C)\subset f^{-1}(C)\implies t\in f^{-1}(C).$ Since $t\in \rm cl$$(f^{-1}(C))$  was chosen arbitrarily, it follows that
$\rm cl$$(f^{-1}(C))=f^{-1}(C)\implies f^{-1}(C)$ is closed.


text:
Q: Debugging in Chrome Dev Tools a Hawtio plugin (AngularJS app) deployed in Karaf I am running an AngularJS project as a Hawtio plugin and this is deployed in Karaf (as a subcomponent of JBoss Fuse ESB) as a packaged war placed in the deploy folder of Fuse. When I try to debug in Chrome Dev Tools, I have trouble debugging (setting watches, breakpoints, etc.) my JavaScript source codes as these are not visible in the Sources tab. Additionally, my console.logs in my source files do not appear in the Console of Chrome Dev Tools as well as on the Hawtio console.
Is anyone have an idea how to do this?
Thanks.

A: So for logging, create an instance of Logger in your plugin:
var log = Logging.Logger.get("MyPlugin");
log.debug("Yay, I've got a logger!");

Though console.log normally is captured by the above.  You may need to set hawtio's logging to 'Debug' in the preferences if you're not seeing any logs in the console.
It's difficult to deal with breakpoints with an external plugin as dynamically loaded scripts aren't treated the same way in chrome, however you can manually set a breakpoint by putting:
debugger;

in your .js file, see Set a javascript breakpoint in code - in chrome?


text:
Q: How can I make the semicolon automatically jump to the end of the line In xcode I often find myself using the ; series of keys. Is there a way to make the ; jump to the end of the line and then insert a ;?

A: I found Keyboard Maestro Macros for Mac. It's handy.


text:
Q: How to filter by document attributes in couchdb? Could someone explain to me how I can filter documents with multiple attributes by using arrays and keys?
For example I have a document with the attribute a, b, c and d. I would like to filter by an user selected value from attribute "a". Later I would like to narrow the results with a value from the attribute "c" or maybe a value from the attribute from "d".
Does anyone have suggestions how to accomplish this task elegant?

A: Assuming your doc looks like:
{ 'a': 123, 'b': 456, 'c': 789, ... }

You can create a view like this:
function(doc){
   emit([doc.a, doc.b, doc.c], doc)
}

You can then use the startkey and endkey parameters to access the views, whilst restricting results to a specific subset:
...&startkey=[123,]&endkey=[123,{}] // Shows all results with doc.a=123
...&startkey=[123,]&endkey=[123,456] // Shows all results with doc.a=123 and doc.b<=456

However all elements will be sorted in a single list and all you can ever access is a subsection of this list. So if you want to access documents where 123 <= doc.a <= 456 and doc.b between 123 and 456, you'll have to create two separate views, one for doc.a and one for doc.b and then have your client app identify the documents returned by both views.


text:
Q: How can I tell if the user opened my app for the first time? I was wondering how would I determine on the launch of my application whether or not it was opened for the first time.
I was thinking that I need a bool instance variable. But after that I'm just not sure.

A: NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
BOOL haveused = [standardUserDefaults boolForKey:@"haveused"];

if(haveused)
{
    //NOT THEIR FIRST TIME
    //Handle scenario
}
else
{
    //THEIR FIRST TIME
    //Handle scenario
    [standardUserDefaults setBool:TRUE forKey:@"haveused"];
    [standardUserDefaults synchronize];
}

The only exception is if the user deletes and reinstalls your application. If they delete and reinstall, it wipes your applications memory clean, and it will see the user as a first timer. But this will remain functional throughout updates.

A: NSUserDefaults is of course the way to go for this, but I just want to point out that you could have just stat or fopen'd a file tell if this was the virgin use. Or even HTTP GET a URL the first time, then to file, or blah blah you get the idea.


text:
Q: Select from MySQL based on another table's total result of certain column match I have two tables in my DB
Genre contains: id, genre_id
Music contains: id, song_id, genre_id
I want to show the result of:
SELECT * FROM Genre WHERE total number of rows in Music
WHERE Genre.genre_id = Music.genre_id > 4

I have been scratching my head for hours trying to get it using JOIN but I couldn't get how logically to solve it then put it in mysql code.

A: Your desired output is only a couple of minor syntax changes off from a valid query:
SELECT *
  FROM Genre g
 WHERE (SELECT COUNT(*) FROM Music m WHERE g.genre_id = m.genre_id) > 4

While that's probably the most understandable way of doing it, a combination of LEFT OUTER JOIN, GROUP BY and HAVING may be more efficient:
SELECT g.id, g.genre_id
  FROM Genre g
  LEFT OUTER JOIN Music m ON m.genre_id = g.genre_id
 GROUP BY g.id, g.genre_id
HAVING COUNT(*) > 4


text:
Q: Java multi threading - Passing a data-structure to the thread The application, I am writing, generates an ArrayList of Characters at certain stage. At this stage, I am trying create a thread to process this ArrayList. The problem is how do I pass this ArrayList to the thread
Descriptive Code:
class thisApp {
    /* Some initial processing creates an ArrayList - aList */

    Runnable proExec = new ProcessList (); //ProcessList implements Runnable
    Thread th = new Thread(proExec);
}

Descriptive Code For ProcessList:
public class ProcessList implements Runnable {
    public void run() {
      /* Access the ArrayList - aList - and do something upon */
    }
}

My problem is: How do I pass and access aList in run()?

A: You can simply pass aList to the ProcessList's constructor, which can retain the reference until it's needed:
class thisApp {
    /* Some initial processing creates an ArrayList - aList */

    Runnable proExec = new ProcessList (aList);
    Thread th = new Thread(proExec);
}

public class ProcessList implements Runnable {
    private final ArrayList<Character> aList;
    public ProcessList(ArrayList<Character> aList) {
      this.aList = aList;
    }
    public void run() {
      /* use this.aList */
    }
}

N.B. If aList will be accessed concurrently by multiple threads, with one or more threads modifying it, all relevant code will need to be synchronized.

A: Add an argument to the ProcessList constructor.
public class ProcessList implements Runnable
{
    private final List<Foo> aList;

    public ProcessList(List<Foo> aList)
    {
        this.aList = aList;
    }

    public void run()
    {
      System.out.println(aList.size());
    }
}

You'll have to be careful about concurrent access to the list if any other threads have access to it.

A: You could make the List final, but it's better to pass it in to your Runnable object.
public class ProcessList implements Runnable {
    List<Character> list;
    public ProcessList(List<Character> list){
    this.list = list;
    }
    public void run() {
         this.list.size();
    }
}


text:
Q: What's wrong with my scraper? I want to scrape the agent_name its contact details by going into page into page.Sometimes this script return me with one entry,sometime different entry unable to figure out the cause.
import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from urlparse import urljoin

class CompItem(scrapy.Item):
    title = scrapy.Field()
    link = scrapy.Field()
    data = scrapy.Field()

class criticspider(CrawlSpider):
    name = "comp"
    allowed_domains = ["iproperty.com.my"]
    start_urls = ["http://www.iproperty.com.my/property/searchresult.aspx?t=S&gpt=AR&st=&ct=&k=&pt=&mp=&xp=&mbr=&xbr=&mbu=&xbu=&lo=&wp=&wv=&wa=&ht=&au=&sby=&ns=1"]

    def parse(self, response):
        sites = response.xpath('.//*[@id="frmSaveListing"]/ul')
        items = []

        for site in sites:
            item = CompItem()
            item['title'] = site.xpath('.//li[2]/div[3]/div[1]/div[2]/p[1]/a/text()').extract()[0]
            item['link'] = site.xpath('.//li[2]/div[3]/div[1]/div[2]/p[1]/a/@href').extract()[0]
            if item['link']:
                if 'http://' not in item['link']:
                    item['link'] = urljoin(response.url, item['link'])
                yield scrapy.Request(item['link'],
                                     meta={'item': item},
                                     callback=self.anchor_page)

            items.append(item)

    def anchor_page(self, response):
        old_item = response.request.meta['item']

        old_item['data'] = response.xpath('.//*[@id="main-content3"]/div[1]/div/table/tbody/tr/td[1]/table/tbody/tr[3]/td/text()').extract()
        yield old_item

A: Even if you open up the start URL in the browser and refresh the page multiple times - you'll get different search results.
Anyway, your spider needs adjustment since it doesn't extract all the agents from the page:
import scrapy
from urlparse import urljoin

class CompItem(scrapy.Item):
    title = scrapy.Field()
    link = scrapy.Field()
    data = scrapy.Field()

class criticspider(scrapy.Spider):
    name = "comp"

    allowed_domains = ["iproperty.com.my"]
    start_urls = ["http://www.iproperty.com.my/property/searchresult.aspx?t=S&gpt=AR&st=&ct=&k=&pt=&mp=&xp=&mbr=&xbr=&mbu=&xbu=&lo=&wp=&wv=&wa=&ht=&au=&sby=&ns=1"]

    def parse(self, response):
        agents = response.xpath('//li[@class="search-listing"]//div[@class="article-right"]')
        for agent in agents:
            item = CompItem()
            item['title'] = agent.xpath('.//a/text()').extract()[0]
            item['link'] = agent.xpath('.//a/@href').extract()[0]
            yield scrapy.Request(urljoin("http://www.iproperty.com.my", item['link']),
                                 meta={'item': item},
                                 callback=self.anchor_page)

    def anchor_page(self, response):
        old_item = response.request.meta['item']

        old_item['data'] = response.xpath('.//*[@id="main-content3"]//table//table//p/text()').extract()
        yield old_item

What I've fixed:

*

*using scrapy.Spider instead of CrawlSpider

*fixed the XPath expressions that makes it go through all of the agents on the page, follow the links and grab the agent's self-description/promotion


text:
Q: Sorting a dictionary but got "List Indices must be int, not tuple" error I'm trying to use the sorted() function as OrderedDict is not available for me (python 2.6.6). However I get this "List indices must be int, not tuple" error
I tried to just used sorted() function on a dictionary and it works fine when i try with some dummy values, but im not sure why it doesn't work on my specific code.
   venue_dict = {}
   for venues in venue_names:
       venue_dict[venues] = False
   venue_dict = sorted(venue_dict)

I get this TypeError: list indices must be integers, not str
so i create a dictionary with a value False for each venue. (venue_names is a list of all venue names) The false is just used as a flag value.
anyways I try to print the sorted dictionary but receive the tuple error.
Anyone know why? I tried googling this up but haven't found a solution yet.

A: The built-in sorted() function doesn't work on dictionaries with the default parameters, because the default sort key will be the (key, value) pair. This is a tuple, not a sortable item.
You can ensure that the dictionary key is used as a sort key via a lambda function:
mydict = sorted(mydict, key=lambda k: k[0])  # just the key from the (key, value) tuple

Alternatively, you can sort directly on the dictionary's items:
mydict = sorted(mydict.items())

The statements above will return lists of tuples however. If you want an actual ordered dictionary, you'll have to use an OrderedDict. As you're using Python 2.6 and this is only a thing in Python 2.7, you can install the ordereddict package via PIP by running pip install ordereddict. Then:
from ordereddict import OrderedDict

mydict = OrderedDict(sorted(mydict.items()))

A: If you create your dictionary from a sorted list, it will be in the right order right away:
venue_dict = {name:False for name in sorted(venue_names)}

Note that venue_dict = sorted(venue_dict) will change the venue_dict variable to a list because sorted(venue_dict) returns a list of keys, it does not sort the dictionary. This is probably why you are getting an error, on subsequent uses of venue_dict.
BTW, if you're using an old version of Python (e.g. 2.7) the dictionaries do not have a defined order so there is no way to sort them at all.  You should  update to a recent version of Python or use a double indirection: e.g. access sorted list of names-> use name as subscript to dictionary.
I can't actually check this but I believe the constructor for the old version of OrderedDict would work the same way:
venue_dict = OrderedDict( (name,False) for name in sorted(venue_names) )

If all else fails, you could always access the dictionary from sorted keys:
venue_dict = dict()
for name in venue_names: venue_dict[name] = False

for name in sorted(venue_dict):
    print(name, venue_dict[name])


text:
Q: Meteor MongoDB Error I have this issue with my meteor app. When I run this query on my chrome console, It returns the expected data
    Questions.find({}, {sort:{commentLength: -1}})
but when I run it in the console as db.questions.find({}, {sort:{commentLength: -1}})
it returns this error
error: {
  "$err" : "Can't canonicalize query: BadValue Unsupported projection option: sort: { commentLength: -1.0 }",
  "code" : 17287
}

Why does this error happen? Thanks

A: sort has a different syntax when executed in a mongodb shell. Try this instead:
db.questions.find().sort({commentLength: -1})


text:
Q: Consul : Health Check is failed to invoke: fork/exec but running manualy I run this command
/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root --password=123

and it says
mysqld is alive

but when I added it in heallth check
   "check": {
     "args": ["/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
     "interval": "3s"}
   }

the log says
[ERR] agent: Check "service:proxy2" failed to invoke: fork/exec /usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123: no such file or directory

how can i resolve this?

A: "args" - should be an array of strings. Consul sees your single string as a command to execute, ignoring spaces.
Your check should look something like this:
   "check": {
     "args": ["/usr/bin/mysqladmin", "ping", "--host=192.168.56.35", "--port=6033", "--user=root", "password=123"],
     "interval": "3s"}
   }

Optionally you can use following instead, since string is passed to /bin/sh it doesn't have to be divided into substrings. (most examples in for Consul Checks use this syntax, so it should definitively work):
   "check": {
     "args": ["/bin/sh", "-c", "/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
     "interval": "3s"}
   }

Also make sure that user under which Consul agent process is running is able to execute /usr/bin/mysqladmin otherwise you will get permission denied error.


text:
Q: How to disable text selection via jQuery? I know this question have been already asked (here), but all the answers I've found dealt with css
selector :selection (that is not yet too widely supported by browsers).
So, how can I disable text selection on my html page via jQuery, not relying on css tricks?

A: Include jQuery UI and use $(element).disableSelection().
However, disabling text selection is very user-unfriendly unless used in a context where accidental selections are likely (e.g. Drag&Drop or buttons where users are likely to doubleclick to perform multiple changes faster (e.g. in spinners))

A: Here is a simple one-liner to disable selecting text on your whole page.  (whether you should or not is another question)
$(document).bind('selectstart dragstart', function(e) {
  e.preventDefault();
  return false;
});

A: If you want to avoid plugins, you can extract the relevant parts from the jQuery UI source:
/*!
 * jQuery UI 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
$.support.selectstart = "onselectstart" in document.createElement("div");
$.fn.disableSelection = function() {
    return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
        ".ui-disableSelection", function( event ) {
        event.preventDefault();
    });
};

$("#somediv").disableSelection();

A: Try that http://code.jdempster.com/jQuery.DisableTextSelect/jquery.disable.text.select.js


text:
Q: Excel Highlight entie row when TWO similar name with specific similar number I want to Highlight entire row when TWO similar name with specific similar number. (Excel Screen shot attached )
Example ->
Excel file have A to J column, A10 and A11 both are with same name ASIANPAINT
and J10 and J11 are similar with specific number 3 so want to highlight entire row with GREEN
Example -> same file A16 and A17 both are with similar name BEML
and J16 and J17 are similar with specific number 2 so want to highlight entire row with YELLOW
Means:

*

*TWO Similar name with number 3 = GREEN HIGHLIGHT entire row

*TWO Similar name with number 2 = YELLOW HIGHLIGHT entire row

A:
How it works:

*

*Select entire data range.

*On Home Tab click Conditional Formatting.

*Select New Rule and apply following formula one by one.

N.B. This actions needs Two Rules to format.
Formula 1: =AND($A10="Asian Paint", $J10=3)
Formula 2: =AND($A10="Beml",$J10=2)

*Finally apply an appropriate color format and finsih with Ok.

Note,
1.This will apply color format to all rows which has Asian Paints & 3 also Beml & 2.
2.Adjust cell references in formula as needed.

A: The following can only be applied from row 2 down so if you don't have a header row, inset a blank row above your data.
You need conditional formats to check:

*

*Is column J = 2 or 3 in two separate CFs

*In both those CFs, also check if the number in column J is the same as the one in the row above it OR below it.  They will only be the same if they are in adjacent rows but the number itself doesn't matter.

*In both those CFs, also check if the name in column A is the same as the one in the row above it OR below it.  They will only be the same if they are in adjacent rows but the name itself doesn't matter.

The CF formula for green highlight will be:
    AND($J2=3,OR($J2=$J1,$J2=$J3),OR($A2=$A1,$A2=$A3))

Apply this to range A2:J13 or whatever your last row is.
For the yellow highlight, replace $J2=3 with $J2=2.


text:
Q: Gradle DSL - Eclipse Equivalent for IDEA Module Property Good localtime,
I am in the process of updating legacy (4.8.1) Gradle build files for a big-McLarge-huge,  multimodule project. We utilize an intellij.gradle file which has the following line (marked by comment):
idea {
    module {
        inheritOutputDirs = true // <-- HOW DO I DO THIS
        downloadJavadoc = true
        downloadSources = true
    }

    workspace.iws.withXml { provider ->
        def node = provider.asNode()
        def dynamicClasspath = node.component.find { it."@name" == "dynamic.classpath" }
        if (dynamicClasspath != null) {
            dynamicClasspath."@value" = "true"
    }
}

From the 4.8.1 DSL docs:

If true, output directories for this module will be located below the
output directory for the project; otherwise, they will be set to the
directories specified by IdeaModule.getOutputDir() and
IdeaModule.getTestOutputDir().

Any ideas on what the Eclipse DSL equivalent of inheritOutputDirs? Should this be handled using the eclipseClasspath API? Right now everything is building fine, but the Eclipse Java builder is is flagging things.
References:

*

*https://docs.gradle.org/4.8.1/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html

*https://docs.gradle.org/4.8.1/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html

A: Usually this would have been picked up through sourceSets but I can't see what your project looks like...
If your subproject uses Gradle to generate sources into /build/cxf/generated-sources directory, then you can tell Eclipse via Gradle DSL to include that as a source folder like this:
plugins { id 'eclipse' }

eclipse.classpath.file.whenMerged {
  // this is the brute-force approach; there is likely a better way to add a source folder
  entries << new org.gradle.plugins.ide.eclipse.model.SourceFolder('build/cxf/generated-sources', null)
}

Once this is run (via gradle eclipseClasspath) you should see a build/cxf/generated-sources folder under your project node in the Package Explorer or Project Explorer.  Sort of like this:

NOTE: This is untested because I don not have a sample project to work with.
There is more discussion here: How to add gradle generated source folder to Eclipse project?


text:
Q: Convert MSExcel date format to MM/YYYY
I am working on a spreadsheet where I want to have the date in the format MM/YYYY. I have tried using cell formatting but the date doesn't show the desired format. Data validation does not give me this option. Any assistance would be appreciated.

A: This is a culture issue. The cell value typed into the cell is 02/01/2012. In some countries when you type in those digits it means Jan 2, 2012. In the US it means Feb 1, 2012. My laptop is US format and my friend has a computer with foreign format.
The order in which you type the date into the cell varies by country (m/d/yyyy versus d/m/yyyy). This is set by the settings in the operating system not in Excel. Excel uses the operating system settings to determine how to interpret what you type into the cell.
The format that is displayed in the cell is a separate issue. That is controlled in cell formats in Excel. You can choose whichever format you want in Excel without affecting the underlying value.


text:
Q: highlights P tag with next and prev I want to allow the use to slide up and down when pressing up arrow and down arrow, I mean if "roma" is highlighted and I pressed down then "milan" should be highlighted. Here is my HTML:

roma

milan

napoli

I want to do this using Javascript, perhaps using onclick().
which javascript attribute should i used and how to hightlight something using css
thank you

A: You can append a CSS class to highlight the respective element upon clicking it. Using jQuery toggle will allow you to toggle the highlighting of an element. jsFiddle example coming soon...
jQuery Example:
http://jsfiddle.net/2NS5V/2/
JavaScript Example:
http://jsfiddle.net/GDEeW/1/


text:
Q: Spring Reactor Exception I get the following exception using Spring React.
My method:
public Mono<A> getA(
    @PathVariable(value = "id") Long id) {
    return <<some service call that returns Mono<A> >>;
}

Exception:

019-03-22 17:55:59,518 priority=ERROR app_name=sync
  thread=reactor-http-nio-1 location=DefaultErrorWebExceptionHandler
  line=218 Failed to handle request [GET
  http://localhost:10019/ext/stubhub/event/9874282/eventSectionZone]
    reactor.core.Exceptions$ReactorRejectedExecutionException: Scheduler
  unavailable   at
  reactor.core.Exceptions.failWithRejected(Exceptions.java:249)     at
  com.tu.sync.node.stubhub.remoterepository.EventRepository.lambda$getSectionZoneData$6(EventRepository.java:111)
    at
  org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec$StatusHandler.apply(DefaultWebClient.java:492)
    at
  org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.lambda$bodyToPublisher$5(DefaultWebClient.java:440)
    at java.util.Optional.map(Optional.java:215)    at
  org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.bodyToPublisher(DefaultWebClient.java:440)
    at
  org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.lambda$bodyToMono$0(DefaultWebClient.java:400)
    at
  reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)
    at
  reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67)

A: Your API-Method is missing a @RequestMapping().
That should fix it.


text:
Q: DevExpress Winform Tabheader background color I am using DevExpress 17.1.5 with Winforms.
I have been searching everywhere and I do not find the Docking Container for the element that holds the tabs in the Winform DexExpress framework. The goal is to set its color.

It should be the "Docking Container 3" but impossible to find how to set the background color of the element.

This is where I want to change the color of the element.


text:
Q: Change WP Child theme CSS for WP Bootstrap Starter Theme I am having trouble figuring out how to change styles for the WP Bootstrap Starter theme. I've created a functions file with the following:
<?php
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

I can change some parts of the theme css like blog post title font size. But I cannot change the sub header font size where it says "Wordpress + Bootstrap". I've tried:
#page-sub-header {
    font-size: 1rem;
}

That should have done it, but it doesn't do anything. Driving me crazy.
Anyone have any ideas?
Here's the example site: https://afterimagedesigns.com/wp-bootstrap-starter/


text:
Q: Button images don't show when wpf app is running I have a play and resume button in my wpf application. When I'm designing I see the buttons on my window but when I run the application, the images are gone. Why?

A: I provided the answer as a comment, but here it is in answer format:
Try setting the Build Action of the image to Resource.


text:
Q: Import pyffmpeg. Python 2.6, Windows 7 64 bit I have problem in connection with import pyyfmpeg library. I'm using a python 2.6 version. Apart from that I've installed ffmpeg for my Windows version - 64 bit. Of coruse I added path to ffmpeg to environment variable.
If I try to import, a pyyfmpeg to my project then I will get information that there is no module named a pyyfmpeg, although I copied whole content of pyyfmpeg to ...Lib/Site-packages
Any Ideas why it's not working?


text:
Q: Gradient Descent Problem with smallest/simplest data on planet Earth I want to implement the Gradient Descent Algorithm on this simple data but I am facing problems. It would be great if someone points me in the right direction. The answer should be 7 for x=6 but I'm not getting there.
X = [1, 2, 3, 4]
Y = [2, 3, 4, 5]
m_gradient = 0
b_gradient = 0
m, b = 0, 0
learning_rate = 0.1

N = len(Y)
for p in range(100):
    for idx in range(len(Y)):
        x = X[idx]
        y = Y[idx]
        hyp = (m * x) + b
        m_gradient += -(2/N) * x * (y - hyp)
        b_gradient += -(2/N) * (y - hyp)
    m = m - (m_gradient * learning_rate)
    b = b - (b_gradient * learning_rate)
print(b+m*6)

A: You are calculating the gradients incorrectly for all but the first iteration. You need to set both gradients to 0 in the outer for loop.
X = [1, 2, 3, 4]
Y = [2, 3, 4, 5]
m_gradient = 0
b_gradient = 0
m, b = 0, 0
learning_rate = 0.1

N = len(Y)
for p in range(100):
    for idx in range(len(Y)):
        x = X[idx]
        y = Y[idx]
        hyp = (m * x) + b
        m_gradient += -(2/N) * x * (y - hyp)
        b_gradient += -(2/N) * (y - hyp)
    m = m - (m_gradient * learning_rate)
    b = b - (b_gradient * learning_rate)
    m_gradient, b_gradient = 0, 0

print(b+m*6)

For example consider b_gradient. Before first iteration b_gradient = 0 and is calculated as 0 + -0.5*(y0 - (m*x0 +b)) + -0.5(y1 - (m*x1 +b)) + -0.5(y2 - (m*x2 + b)) + -0.5(y3 - (m*x3 + b)), where x0 and y0 are X[0] and Y[0], respectively.
After the first iteration the value of b_gradient is -7, this is correct.
The problem starts with the second iteration. Instead of calculating b_gradient as the sum of (-0.5(yn - (m*xn + b)) for 0 <= n <= 3, you calculated it as the previous value of b_gradient plus the sum of (-0.5(yn - (m*xn + b)) for 0 <= n <= 3.
After the second iteration the value of b_gradient is -2.6, this is incorrect. The correct value is 4.4, note that 4.4 - 7 = -2.6.

A: It seems you want coefficients for Linear Regression using Gradient Descent. Some more data points, a slightly smaller learning rate, training for more epochs by looking at the loss will help reduce error.
As input size gets larger the code below will give slightly off results. The above mentioned methods such as training for more epoch will give correct results for larger range of numbers.
Vectorized Version
import numpy as np

X = np.array([1, 2, 3, 4, 5, 6, 7])
Y = np.array([2, 3, 4, 5, 6, 7, 8])
w_gradient = 0
b_gradient = 0
w, b = 0.5, 0.5

learning_rate = .01
loss = 0
EPOCHS = 2000
N = len(Y)

for i in range(EPOCHS):

    # Predict
    Y_pred = (w * X) + b

    # Loss
    loss = np.square(Y_pred - Y).sum() / (2.0 * N)
    if i % 100 == 0:
        print(loss)

    # Backprop
    grad_y_pred = (2 / N) * (Y_pred - Y)
    w_gradient = (grad_y_pred * X).sum()
    b_gradient = (grad_y_pred).sum()

    # Optimize
    w -= (w_gradient * learning_rate)
    b -= (b_gradient * learning_rate)

print("\n\n")
print("LEARNED:")
print(w, b)
print("\n")
print("TEST:")
print(np.round(b + w * (-2)))
print(np.round(b + w * 0))
print(np.round(b + w * 1))
print(np.round(b + w * 6))
print(np.round(b + w * 3000))

# Expected: 30001, but gives 30002.
# Training for 3000 epochs will give expected result.
# For simple demo with less training data and small input range 2000 in enough
print(np.round(b + w * 30000))

Output
LEARNED:
1.0000349103409163 0.9998271260509328

TEST:
-1.0
1.0
2.0
7.0
3001.0
30002.0

Loop Version
import numpy as np

X = np.array([1, 2, 3, 4, 5, 6, 7])
Y = np.array([2, 3, 4, 5, 6, 7, 8])
w_gradient = 0
b_gradient = 0
w, b = 0.5, 0.5

learning_rate = .01
loss = 0
EPOCHS = 2000
N = len(Y)

for i in range(EPOCHS):

    w_gradient = 0
    b_gradient = 0
    loss = 0

    for j in range(N):

        # Predict
        Y_pred = (w * X[j]) + b

        # Loss
        loss += np.square(Y_pred - Y[j]) / (2.0 * N)

        # Backprop
        grad_y_pred = (2 / N) * (Y_pred - Y[j])
        w_gradient += (grad_y_pred * X[j])
        b_gradient += (grad_y_pred)

    # Optimize
    w -= (w_gradient * learning_rate)
    b -= (b_gradient * learning_rate)

    # Print loss
    if i % 100 == 0:
        print(loss)

print("\n\n")
print("LEARNED:")
print(w, b)
print("\n")
print("TEST:")
print(np.round(b + w * (-2)))
print(np.round(b + w * 0))
print(np.round(b + w * 1))
print(np.round(b + w * 6))
print(np.round(b + w * 3000))

# Expected: 30001, but gives 30002.
# Training for 3000 epochs will give expected result.
# For simple demo with less training data and small input range 2000 in enough
print(np.round(b + w * 30000))

Output
LEARNED:
1.0000349103409163 0.9998271260509328

TEST:
-1.0
1.0
2.0
7.0
3001.0
30002.0


text:
Q: How can I jump relative to the PC using the gnu assembler for AVR? I have a binary file that I've disassembled using avr-objcopy.  The interrupt vector table looks like:

00000000 :
    ; VECTOR TABLE
   0:   13 c0           rjmp    .+38        ;  0x28, RESET
   2:   b8 c1           rjmp    .+880       ;  0x374, INT0
   4:   fd cf           rjmp    .-6         ;  0x0
   6:   fc cf           rjmp    .-8         ;  0x0
   8:   fb cf           rjmp    .-10        ;  0x0
   a:   fa cf           rjmp    .-12        ;  0x0
   c:   f9 cf           rjmp    .-14        ;  0x0
   e:   f8 cf           rjmp    .-16        ;  0x0
  10:   f7 cf           rjmp    .-18        ;  0x0
  12:   c7 c1           rjmp    .+910       ;  0x3a2, TIMER1 OVF
  14:   f5 cf           rjmp    .-22        ;  0x0
  16:   f4 cf           rjmp    .-24        ;  0x0
  18:   f3 cf           rjmp    .-26        ;  0x0
  1a:   f2 cf           rjmp    .-28        ;  0x0
  1c:   2b c2           rjmp    .+1110      ;  0x474, ADC conversion complete
  1e:   f0 cf           rjmp    .-32        ;  0x0
  20:   ef cf           rjmp    .-34        ;  0x0
  22:   ee cf           rjmp    .-36        ;  0x0
  24:   ed cf           rjmp    .-38        ;  0x0
  26:   00 00           nop
  ; START
  28:   f8 94           cli
 (snip)
I want to reassemble this file with a few modifications.  I've reformatted it by removing the first 2 columns so that it is a regular assembly file. ie:

.org 0
    rjmp    .+38            ;  0x28, RESET
    rjmp    .+880           ;  0x374, INT0
(snip)
However, when I run
$ avr-as -mmcu=atmega8 test.asm
and then disassemble the generated file. (using objcopy -S a.out)  The output looks like:
00000000 :
   0:   00 c0           rjmp    .+0             ;  0x2
   2:   00 c0           rjmp    .+0             ;  0x4
   4:   00 c0           rjmp    .+0             ;  0x6
   6:   00 c0           rjmp    .+0             ;  0x8
   8:   00 c0           rjmp    .+0             ;  0xa
   a:   00 c0           rjmp    .+0             ;  0xc
   c:   00 c0           rjmp    .+0             ;  0xe
   e:   00 c0           rjmp    .+0             ;  0x10
  10:   00 c0           rjmp    .+0             ;  0x12
  12:   00 c0           rjmp    .+0             ;  0x14
  14:   00 c0           rjmp    .+0             ;  0x16
  16:   00 c0           rjmp    .+0             ;  0x18
  18:   00 c0           rjmp    .+0             ;  0x1a
  1a:   00 c0           rjmp    .+0             ;  0x1c
  1c:   00 c0           rjmp    .+0             ;  0x1e
  1e:   00 c0           rjmp    .+0             ;  0x20
  20:   00 c0           rjmp    .+0             ;  0x22
  22:   00 c0           rjmp    .+0             ;  0x24
  24:   00 c0           rjmp    .+0             ;  0x26
  26:   00 00           nop
  28:   f8 94           cli
(snip)

So how can I get avr-as to respect the PC-relative jumps?

A: I found the answer!
I was assembling but not linking.  So the assembler was filling in all relative jumps/calls/branches with .+0.
To fix this I needed to create a custom linker script I called linker.x which contains the following:

SECTIONS
{
  . = 0x0;
  .text : { *(.text) }
}

This tells the linker to start the .text section at address 0.
Then I could link the code using:
$ avr-ld -mavr4 -Tlinker.x a.out -o output.o

After linking using the above command all of the .+0's were filled in with their correct values!
The reason for this, is because until the linking stage, as/gcc don't know what else is going to be included in the binary file.  It is the linker that takes all the individual object files and combines them into one.  So if the linker stage is never run, there is no way to fill in the relative jumps with absolute jumps.
AVR's assembler does the both assembling and linking.  But the gnu assembler is more generic and so you need to link separately.

A: I'm assuming that rjmp PC+2 doesnt work in avr-as ? That's how I'd do it in AVR Studio...


text:
Q: Avoid responding JSON field with particular value I'm using Jersey and Jackson to build a web application. Responses will be returned by using logic similar to the code snippets below. (unrelated parts are deleted)
public Response toResponse() {
    String name = // some methods to get name
    Integer score = // some methods to get score
    final MyDTO dto = new MyDTO(name, score);
    return Response
        .ok()
        .encoding(StandardCharsets.UTF_8.toString())
        .type(MediaType.APPLICATION_JSON_TYPE)
        .entity(dto)
        .build();
}

And the MyDTO class:
@XmlRootElement
public final class MyDTO {
    @NotNull final private String name;
    @NotNull final private Integer score;
    // constructor, getters, setters...
}

And I'm allowed to have only non-null values in MyDTO.
What I want to achieve is to hide score field in the JSON response when the score exactly equals to 0.
I looked into questions like here and here, but cannot manage to find a usable answer.
Example:
when John's score was 1: {"name": "John", "score": 1}
when John's score was 0: {"name": "John"}

A: use the answer by @Henrik changing the annotation to JsonInclude.Include.NON_DEFAULT. Hope this is what you are expecting

A: Decided to try out @BalakrishnaAvulapati's proposal, and it definitely seems like the correct approach.
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Player {
    private String nick;
    private Integer score;

    // Omitting getter/setter for nick field

    public Integer getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score == 0 ? null : Integer.valueOf(score);
    }
}


text:
Q: If Statement with Boolean Condition I've got some really simple code in visual studio that, for whatever reason, is not working.  I've narrowed the problem down to my boolean condition in the if statement.  Here is a simplified version:
Dim bool As boolean

Protected Sub Button1Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
If bool = true Then
    bool = false
ElseIf bool = false Then
    bool = true
End If
Label1.Text = bool
End Sub

This is within a button click event.  If bool is initially set to true, when I click it, it goes to false, but then if I click it again the "bool = false" statement is not executed.
Edit: As asked, the full button click handler has been added to the code above. As asked, this is for an asp.net website.  The point of this code is to, on a button click, change the style of a header element on a button click.  However, this has no effect on the question, as I took that code out temporarily to reduce any potential problems and was left with the code above.

A: It seems like all you're doing is toggling the value of the boolean flag.
Assuming it is always either true or false, you can just invert the value:
booleanVar = Not booleanVar

A: The code you posted should obviously be working, taken by itself. Your problem might be that the value of bool is not saved between different web requests. You need to save that value. Try using the HttpContext's Session property like this:
Dim bool as Boolean
If Session.Item("bool") Is Nothing Then
    Session("bool") = True
End If
bool = DirectCast(Session("bool"), Boolean)

For more information see the MSDN Session State Overview and the linked "How to" articles about session information here.
Edit:
For making your code more readable and to not clutter your click event handler you can write the following to methods:
Private Function GetBoolValue() as Boolean
    If Session.Item("bool") Is Nothing Then
        Session("bool") = True
    End If
    Return DirectCast(Session("bool"), Boolean)
End Function

Private Sub SetBoolValue(value as Boolean)
    Session("bool") = value
End Sub


text:
Q: Wordpress contact plugin not working correctly in my website I use contact page 7 plugin for word press. I have configured it correctly from the admin panel. But in my website, when I click on submit then the following message appears.

Failed to send your message. Please try later or contact the
  administrator by another method.

What can be wrong here?

A: There could be two causes for this.
You are not using correct email in "from" or in "to" email, perhaps you are using [subject] which could be empty or empty shortcode (remove any shortcode in from,to,subjects fileds) in "from" or in "to".
The first is actual mail server trouble, where email cannot be sent, in this case you can use SMTP plugin to configure it properly or contact your server provider.


text:
Q: How can I Log Error in a generated apk file I have generated the apk for an android app but can't figure out how to keep track of the log files.
My app is running during build and run, however it's crashing when the apk file is generated.
I need help to track the error for the apk file.

A: You can write your logs and exceptions in a file and can check that file later
or can email/post on server that file
also you can add Log Events - Firebase - Google library inside your project thats a good approach to maintain the app in long term
https://firebase.google.com/docs/analytics/android/events

A: Also using crash reporting tools like Crashlitycs would be a good choice.
You need to create an Account and put your API key in your app. Then initilize Crashlitycs and now on, everytime your app crash it will send a report and you can track them all even they are grouped by API level and App Version.
According to this guide the way to go is:
Add the Kit to Your build.gradle
buildscript {
  repositories {
    maven { url 'https://maven.fabric.io/public' }
  }

  dependencies {
    // These docs use an open ended version so that our plugin
    // can be updated quickly in response to Android tooling updates

    // We recommend changing it to the latest version from our changelog:
    // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
    classpath 'io.fabric.tools:gradle:1.+'
  }
}

Then in your app level gradle:
// Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'

repositories {
  maven { url 'https://maven.fabric.io/public' }
}

And add the dependency:
  compile('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
    transitive = true;
  }

In your manifest, add INTERNET PERMISSION and add this meta with your API KEY:
  <meta-data
      android:name="io.fabric.ApiKey"
      android:value="<FABRIC_API_KEY>"
  />

Finally initialize Crashlitycs with:
  Fabric.with(this, new Crashlytics());


text:
Q: How to lock a document while updating Elasticsearch? I am using elasticsearch-dsl python library with my python code. I was trying to update the document, so to avoid the concurrency race conditions i  need to acquire and free lock on a document. How to do this using this library. I have already gone through it's documentation but didn't find anything to do that.

A: The proper way to avoid concurrency issues with elasticsearch is not locking but instead using the version metadata ([0]). To do that simply make sure that the document contains the proper version in its .meta dictionary. this is done by default if the document has been retrieved using the get API or when specifying .extra(version=True) on the Search object ([1]).
0 - https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_parameters_2
1 - https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-version.html


text:
Q: Misplaced QED symbol with \qedhere inside align* environment I have an align* environment finishing a proof. The environment has three columns. I tried to place the QED symbol using \qedhere,  but the symbol collides with the right column. Is this a bug, or should I proceed in an other way? Any hint toward a solution?
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}

\begin{proof}
The $\qedsymbol$ is misplaced.
\begin{align*}
A &= B\\
  &= C & = D\qedhere
\end{align*}
\end{proof}

\end{document}

I have Texlive 2016, amsmath 2016/03/10 v2.15b and amsthm 2015/03/04 v2.20.2.

A: It's undoubtedly a bug in amsthm; I checked with all TeX Live versions from 2012 on and it's exactly the same.
Workaround: add & somewhere in the affected line: for instance
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}

\begin{proof}
The $\qedsymbol$ is misplaced.
\begin{align*}
A &= B \\
  &= C && = D\qedhere
\end{align*}
\end{proof}

\end{document}

Depending on what the column is for you might need
  &= C & = D & \qedhere

(this will provide right alignment for the =D part).


text:
Q: Eclipse gives compiler warning that MingGW does not Somehting about how I initialize my private class memebers.  The warning messages do not makes sense...I tried to see if they were concatenated..but they do't appear to be..this is what Eclipse is saying.  Sorry I can't format it much better.
Here are the compiler message:
Description                               Resource  Path    Location    Type
'sl_list<int>::node_1* sl_list<int>::head'  test_a      line 13 C/C++ Problem
when initialized here                       test_a      line 18 C/C++ Problem
'sl_list<int>::count' will be initialized   test_a      line 14 C/C++ Problem

Relevant Code - call to linked_list
#include "c_include_list.cpp"
#include "c_linked_list.cpp"

using namespace std;

int main() {
    cout << "sl_list" << endl;
    sl_list<int> sl_list_object;
}

Relevant Code - linked_list implmentation
template <class T1> class sl_list
  {
  private:

      class node_1
      {
      public:
        T1 data;
        node_1 *next;
        node_1(T1 data, node_1 *next = NULL) : data(data), next(next) {}
      };

    node_1 *head;  // line 13
      int count; // line 14

  public:

    sl_list() : count(0), head(NULL){} // line 18

A: The answer is pretty simple: Initialize members in the order of declaration.
sl_list() : head(NULL), count(0){}

By default, this is only a warning, so Eclipse probably gave the -Wall and -Werror flags to the compiler.

A: MinGW should give you this warning as well with -Wall. Private members should be initialized in the order they are declared.
(more accurately, they ARE initialized in the order they are declared; so it warns you that the order of initialization will not be as you specified it in the intialization list, in case you depend on the side effects of those initializations)


text:
Q: Can someone help me fix this water level controller?
A, B and C are the prongs that stick into the water at 1/4, half and full respectively. D is used to provide the current to switch on each of the prongs as the come in contact with the water.
That all works fine but when the motor part is introduced it does not work as it should. When the water level is at A this is meant to be turn on the motor by turning on Q1 which should allow sufficient voltage to turn on the IRF3205 MOSFET. When C is turned on this should allow the power in the MOSFET to discharge and turn it off. But none of this happens, instead, D1 and D2 light up suggesting that something has gone wrong. Could someone please help?

Update:
I have added in the resistors and the BJTs are still BC635 and the MOSFET is still an IRF3205

Update 3:

I have changed where the base is connected and I think this would work @transistor

A: There are several problems:

*

*You have no current limiting resistors in the LEDs. They should burn out when Q3, 4 and 5 turn on.

*You have no current limiting resistors in the bases of Q1 and 2. This means that they are both turned on via D1 and D3 when the probes are dry and have almost no current limits other than the LEDs. This won't last long.

*If you were able to get Q1 and Q2 to turn off there is no discharge path for M1. You need to pull it high or low but not let it float.

*If both Q1 and Q2 are on what do you expect to happen to the gate of M1?

Fixes:

*

*Calculate the required current limiting resistor values for D1, 2 and 3 and add them in.

*Add base resistors for Q1 and 2. 1k would be fine.

*Figure out how you're going to prevent the gate of M1 from floating and do it!

That looks like a CircuitLab schematic. There's a button on the editor toolbar to allow you to embed a schematic. That makes it easy for us to copy and paste into our answers and modify.
Modify the design (leaving some history in your original post so future readers can make sense of comments and answers) and put it into your original post.

Update 1.

Figure 1. Current path when transistors A, B and C turned off. LEDs A and C turn on.
Draw a truth table of what you require:
Table 1. Logic for outputs based on inputs A, B and C.
| A | B | C || D1 | D2 | D3 | Motor |
=====================================
| 0 | 0 | 0 || Off| Off| Off| On    |
| 1 | 0 | 0 || On | Off| Off| On    |
| 1 | 1 | 0 || On | On | Off| On    |
| 1 | 1 | 1 || On | On | On | Off   |
=====================================


text:
Q: Is this a semantically correct SQLite search query? EDIT** Not sure if this additional info will help but tried to keep it simple.
Data is selected by the user via a html form (up to three options for 'gender', up to six for 'colour' and then a single price range can be selected), this data is then handled in a jquery function to construct the string below and save it in a variable. The variable is then used as the sql query, the query string displayed below is the output of this variable.
I'm debugging in chrome's developer tools, there are no errors showing  **

Is there anything wrong with this query string?
'SELECT * FROM flipflops WHERE colour="black" OR colour="brown" AND gender="mens" OR gender="womens" AND price<=20'

Values are correct in that they match with the db. To be honest it seems to return what ever it likes. I'm hoping that it's immediately obvious to somebody what I've done wrong as I'm a clueless newbie.
Any help would b greatly appreciated! :D

EDIT** above is now replaced with which works perfects when you copy it as it is!
'SELECT * FROM flipflops WHERE colour IN ("white","navy","blue") AND gender IN ("mens","juniors") AND price >= 20 AND price <= 30'

I'm having to use RegExp to create the string in jquery as below leaving out pricerange for now but it returns nothing from db and I'm getting no console errors
var regExp = /\(([^)]+)\)/;

var queryValue = regExp.exec("SELECT * FROM flipflops WHERE colour IN /(\'" + colourValues.join("','") + "/')\ AND gender IN /(\'" + genderValues.join("','") + "/')\"");

Output to console values are dependent on form value selection (sorry for complicating this, I'm so messy!)
    Array[2]
0: "('white','blue/')"
1: "'white','blue/'"
index: 41input:
"SELECT * FROM flipflops WHERE colour IN /('white','blue/') AND gender IN /('womens','juniors/')""
length: 2

A: Are you maybe missing a parentheses?
SELECT * FROM flipflops
WHERE
(
  colour="black"
  OR colour="brown"
)
AND
(
  gender="mens"
  OR gender="womens"
)
AND price<=20

if that is the case you could write it like this as well:
SELECT * FROM flipflops
WHERE colour IN ("black","brown")
AND gender IN ("mens","womens")
AND price<=20

A: The following code creates a dynamic query using Arions IN() operator example. The query is built depending on what boxes are clicked etc.
<form action="#" method="post">
<input type="checkbox" name="color[]" value="Red">Red

<input type="checkbox" name="color[]" value="Blue">Blue

<input type="checkbox" name="color[]" value="Brown">Brown

<input type="checkbox" name="gender[0]" value="Male">Male

<input type="checkbox" name="gender[1]" value="Female">Female

<input type="text" name="cost" >Cost

<input type="submit" name="submit" value="Submit"/>
</form>
<?php
// Set up stub of query
$sql = "SELECT * FROM flipflops ";
//Set initial WHERE clause
$clause ="WHERE ";

if(isset($_POST['submit'])){//to run PHP script on submit
//Color set up IN() operator
if(!empty($_POST['color'])){
    $sql .= $clause." colour IN (";
    // Loop to store and display values of individual checked checkbox.
    foreach($_POST['color'] as $color){
    $sql .= $color.",";
    }
    $sql = rtrim($sql, ",");
    $sql .= ")";
    //Set to AND after initial WHERE
    $clause =" AND ";
}
//Gender show only one gender, if 2 genders clicked  all 2 genders are selected
if(!empty($_POST['gender']) && count($_POST['gender']) == 1){
    // Loop to store and display values of individual checked checkbox.
    foreach($_POST['gender'] as $gender){
        $sql .= $clause. "gender = ".$gender;
    }
    $clause =" AND ";
}
//Cost
if(!empty($_POST['cost'])){
    $sql .= $clause." cost = ". $_POST['cost'];
    }
}
echo $sql;
?>


text:
Q: More than one instance of any JBOSS Product with oracle not working I am using jboss products like GateIn, JBPM, Drools Guvnor...etc. By default all of those products provide HSQL DB database. I migrated the HSQLDB database to Oracle db. Here what is the problem is when i create two instance of any product (eg: GateIn) in two machines and connect its JCR/IDM tables with same oracle by creating two user instance only one GateIn will become works fine and the other one shows some database errors of JCR and IDM tables
Is oracle shares anything common in the case of JCR and IDM tables creation other than tables?
I got same issue in the case of JBPM, Drools Guvnor too. I am running those products in JBoss server

A: For GateIn you must add the property "gatein.idm.datasource.schema" in the configuration.properties file, with the name of the schema. For example gatein.idm.datasource.schema=MYSCHEMA1