text:
Q: How to build the docker image using jib-maven-plugin, but not push by default? I have a simple SpringBoot application and I want to build docker image using Jib Maven plugin.
Following is my plugin configuration:
<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>2.1.0</version>
    <configuration>
        <from>
            <image>openjdk:11-jdk-slim</image>
        </from>
        <to>
            <image>username/appname</image>
            <tags>
                <tag>latest</tag>
                <tag>${project.version}</tag>
            </tags>
        </to>
        <container>
            <mainClass>demo.Application</mainClass>
            <ports>
                <port>8080</port>
                <port>8787</port>
            </ports>
        </container>
    </configuration>
</plugin>

I just want to build the image locally and run it. I don't want to build and push to docker registry in one go.
When I run the command mvn jib:build it is automatically getting pushed to DockerHub using my credentials from Docker config (/Users/username/.docker/config.json).
Is there a way I can disable push and another goal just to push the image to registry?

A: From JIB documentation Jib Maven Plugin, you can run
mvn jib:dockerBuild

This will push an image to a Docker daemon after building.

A: Since you said jib:dockerBuild is not an option, the closest workaround is jib:buildTar; the goal creates a local tarball at target/jib-image.tar (path configurable with <outputPaths><tar>). Running jib:buildTar (or any jib:... goals) for the first time will build and cache everything necessary to build an image. Therefore, subsequent jib:build runs will be no-op in terms of building layers. It will only need to send layers missing in a remote registry.
Of course, one downside of the workaround is that it creates an unnecessary tarball, which may be large.

Unrelated to you question, you don't need to set <tag>latest</tag>, because the target image reference <image>username/appname<image> already implies <image>username/appname:latest<image>. The <tags> configuration is for pushing additional tags on top of <to><iamge>.

A: If you are using podman in mac or windows (with wsl2)...
specify path where podman command can be found
mvn jib:dockerBuild -Djib.dockerClient.executable=$(which podman)

A: I just checked and it is possible to have the image built by Jib locally. First make sure that your Docker daemon is running locally. And then do it like this:
    <to>
        <image><your-local-image-name></image>
    </to>

I guess yours might not have worked because your Docker daemon wasn't running or your image name started with your username, which made Jib think that you actually want to push the image to Docker Hub.


text:
Q: SSIS ADO.NET Destination table using variable? I am using SSDT and working on a simple SSIS package.
The Control flow:
1. A Foreach Loop Container and seek a folder exist a "importdata{}.csv" file or not.
2. If found, a script task will set variables:
  - User::FullPath = (e.g C:\importdata{}.csv)
  - User::varFileNameNoExt = (importdata{}) without extension.
The {} is possible in "toy","game","food".
3. Go to dataflow
The Data Flow:
1. Flat File Source with a flat file connection, the connection string is varible and mapped connection string expression.
2.ADO.NET Destination , insert data.

My question is how can i set the ADO.NET Destination [TableOrViewName] Property in variable?
Assume the table : importdatatoy,importdatagame and importdatafood is created on SQL Server.
I try to set as "dbo"."[User::varFileNameNoExt]" ,but it cannot resolve the table name on runtime.

A: ADO.NET Destination [TableOrViewName]  parametrization can be done at Data flow level. In data flow properties, you can specify "ADO.NET Destination [TableOrViewName]".
Also specify the quotes while assigning value to variable
Eg: varFileNameNoExt = "dbo"."tableName"
But first you will need to create mapping with an existent table.

A: Can you post your error message?  I'm thinking you won't be able to combine static text and a variable like that inside of the TableOrViewName field.  Instead do the combination in a new [User::varTableName] SSIS variable and use the Advanced Properties Expression editor to set the TableOrViewName to this new SSIS variable.  Have a look here.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to remove dynamic text in middle from a sentence I have one requirement where the sentence string is "Shivkumar Pending Fund Changes 202164172551.xlsx is ready"
Note- date value is dynamic in nature the format of date is - yyyymdHHMMss
Do let me know how i can slice second from the string in JavaScript.

A:

let str = "Shivkumar Pending Fund Changes 202164172551.xlsx is ready"

let modifiedStr = str.replace(/\d{2}.xlsx/g, ".xlsx");;

console.log(modifiedStr);

A:

let s = "Shivkumar Pending Fund Changes 202164172551.xlsx is ready";
s = s.split(".xlsx")[0];
console.log(s.substring(s.length - 2, s.length));


text:
Q: Nlog not logging to SQL server I've gone through the setup process to use Nlog in my .NET 6 web api app. Nlog is not logging to my database but I can't see where I've gone wrong.
This is my Nlog.config file:

This is the relevant part of my program.cs file:

My appsettings file:

And the controller where I am calling the logger:

A log should be added to the Logs table in my database but it isn't:

I have checked that the end point is being hit correctly and it is.

A: Changing the Data Source attribute in the XML connection string seems to have resolved the issue:
connectionString="Data Source=.\SQLEXPRESS;


text:
Q: How to close alertDialog from custom adapter I am trying to close the alertDialog on "Done" click from the soft keyboard after user enters input.I am using the dismiss() method but it doesn't work. I have to click out side the alertDialog box to escape it. Also this is being done from a custom adapter class not an activity.
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.text.InputType;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

class CustomAdapter extends ArrayAdapter{

    public CustomAdapter(Context context, ArrayList choreText) {
        super(context, R.layout.custon_listview_row, choreText);
    }

    @NonNull
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater myInflater = LayoutInflater.from(getContext());
        View customView = myInflater.inflate(R.layout.custon_listview_row, parent, false);
        ImageButton imageButton = (ImageButton) customView.findViewById(R.id.imageButton_ID);
        final TextView textView = (TextView) customView.findViewById(R.id.textView_ID);
        final EditText input = new EditText(getContext());
        final AlertDialog OptionDialog = new AlertDialog.Builder(getContext()).create();

        //makes textView clickable
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //what happens when textView is clicked

                final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
                // put aler dialog box logic here
                builder.setTitle("Enter new chore");
                builder.setView(input);
                input.setInputType(InputType.TYPE_CLASS_TEXT);
                input.setImeOptions(EditorInfo.IME_ACTION_DONE);
                //checks if "Done" button on soft keyboard is clicked
                input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                    @Override
                    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                        if(actionId==EditorInfo.IME_ACTION_DONE){
                            //what happens when "Done" is clicked
                            textView.setText(input.getText().toString());
                            OptionDialog.dismiss();
                        }
                        return false;
                    }
                });

                builder.show();
            }
        });

        imageButton.setImageResource(R.drawable.clock);

        return customView;
    }
}

A: try this  in onClick:
//comment this line
//final AlertDialog OptionDialog = new AlertDialog.Builder(getContext()).create();

    //makes textView clickable
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //what happens when textView is clicked

            final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
            AlertDialog OptionDialog = builder.create();
            // put aler dialog box logic here
            builder.setTitle("Enter new chore");
            builder.setView(input);
            input.setInputType(InputType.TYPE_CLASS_TEXT);
            input.setImeOptions(EditorInfo.IME_ACTION_DONE);
            //checks if "Done" button on soft keyboard is clicked
            input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    if(actionId==EditorInfo.IME_ACTION_DONE){
                        //what happens when "Done" is clicked
                        textView.setText(input.getText().toString());
                        OptionDialog.dismiss();
                        //send true as the event has occured
                        return true;
                    }
                    return false;
                }
            });
            builder.show();
        }
    });


text:
Q: Do group elements correspond to observables of a system, or to transformations of a system? Most groups I encountered so far in classical mechanics an special relativity (Galilei-group, Poincare-group, Lorentz-group and so on) described transformations of the system that was to look at. This is somehow intuitive to me, because a transformation succeeded by another transformation is of course a transformation again.
However (and this is something I can't really wrap my head around): In QM, when talking about representations, it seems to me that choosing a representation maps group elements to operators, that is, to observables of the system. Which is of course less intuitive to me (given two positions, why would they have any "group" structure? Of course, if I imagine them to be vectors, I could just add them, but is this what is meant by position becoming a group element now?)
Which is true now? Group elements corresponding to transformations, or to observables? Is there an intuitive approach in how to to group elements are related to observables in EVERY theory that is based on groups?
Edit: I know that in QM, Observables are seen as Operators of an Algebra that act on the Hilbert Space. And of course, those Operators do form a group as well (because linear operators do form the general linear group). But this group is not always the same group that "the theory is built uppon"

A: In quantum mechanics, not every operator is an observable.
Observables correspond to Hermitian operators. Not all operators are Hermitian; a rather well-known example of non-Hermitian operators are the ladder operators familiar from the harmonic oscillator or quantum field theory. Since these are not Hermitian, they are not observables.
Actions of groups on quantum states are usually given by unitary operators. In general, these are not Hermitian. However, things are interesting if our group is a Lie group, a group depending smoothly on some parameters. Such groups include rotations (which depend smoothly on the rotation angles) and translations. From the theory of Lie groups, it is known that a Lie group action can be written as the exponential of a generator, which can be seen as an 'infinitesimal group transformation'.
So suppose that we have an action of the rotation group SO(3) on our quantum state given by $|\psi\rangle \rightarrow U |\psi \rangle$, where $U$ is the operator doing a rotation about the z-axis (for definiteness), then we know that we can write $U = e^{i \theta J_z}$ where $J_z$ is the generator of rotations around the z-axis. For small $\theta$, we can also write $U \approx 1 + i \theta J_z$ if we like. Now, it turns out that $J_z$ is Hermitian and thus an observable; it corresponds to the z-component of angular momentum, although my normalization is probably incorrect. The observable can be seen as quantifying how much a state changes upon applying a rotation. In general, group generators (but not transformations) correspond to observables.
There are exceptions to the rule that unitary operators are not Hermitian. A relevant example is the (unitary and Hermitian) parity operator. This can be seen as an action of the group $\mathbb{Z}_2$ on quantum states. It has eigenvalues $\pm1$ and is an observable. Note that $\mathbb{Z}_2$ is a discrete group and therefore not a Lie group in any interesting way, so the above discussion does not hold here.


text:
Q: Using X11 clipboard in Emacs instance inside gnome-terminal I am using Emacs 24.5.1 from the Gnome Terminal in Arch Linux. When I copy text from outside the Gnome Terminal window (from any other X window, e.g. Firefox), it is not available in the Emacs kill-ring. I have tried (setq x-select-enable-clipboard t) to no avail.
I have also tried this solution, which did not work.
Note: this functionality works when Emacs is run graphically; I am only having a problem when I run Emacs inside a terminal window.

A: The development version of Emacs supports the so-called OSC-52 escape sequences which are supported by some terminals to let applications running inside the terminal access the clipboard.
Sadly, this OSC-52 feature can be (as currently designed in xterms) somewhat dangerous in some situations (e.g. if you display, via cat, in your terminal a file written by someone else), so most of the distributions have disabled the feature by default.
But least for me, under Debian testing, running Emacs-25 inside an xterm -xrm '*.allowWindowOps: true' lets me set the X clipboard via C-k just as if the Emacs was running in GUI mode.
Emacs also supports the direction you want (i.e. makes C-y in Emacs get the text from the X clipboard), tho you'll have to additionally add getSelection to your xterm-extra-capabilities in your ~/.emacs.


text:
Q: Swift: pushed ViewController deinit not called View Controller Structure
Main View Controller -> Table View Controller -> Detail View Controller
They are all embedded in Navigation Controller.
I pushed Detail View Controller by calling pushViewController. When I come back to Table View Controller from Detail View Controller, I realized Detail View Controller deinit() is not called, which causes fatal error at my project.
How can I make DetailViewController to deinit?? Thank you
Part of Table View Controller code where calls pushViewController
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        selectedTilId = thisDayTIL[indexPath.row].id

        if let detailVC = storyboard?.instantiateViewController(withIdentifier: "TILDetailViewController") as? TILDetailViewController {

            detailVC.tilId = selectedTilId
            detailVC.tilViewModel = self.tilViewModel
            detailVC.subjectViewModel = self.subjectViewModel

            self.navigationController?.pushViewController(detailVC, animated: true)
        }

    }

Whole Detail View Controller code
//
//  TILDetailViewController.swift
//

import UIKit
import RxSwift

class TILDetailViewController: UIViewController {

    @IBOutlet weak var tilTitleLabel: UILabel!
    @IBOutlet weak var tilSubjectLabel: UILabel!
    @IBOutlet weak var tilContentLabel: UILabel!

    var til: TIL!
    var tilId: Int!

    var tilViewModel: TILViewModel!
    var subjectViewModel: SubjectViewModel!

    var disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()

        _ = tilViewModel.allTIL
            .map {
                $0.filter { $0.id == self.tilId }
            }
            .subscribe(onNext: { [weak self] til in
                self?.setLabelText(til[0])
                self?.til = til[0]
            })
            .disposed(by: disposeBag)

        let rightBarButton = UIBarButtonItem(title: "Edit", style: .plain, target: self, action: #selector(editButtonClicked))

        self.navigationItem.rightBarButtonItem = rightBarButton
    }

    deinit {
        print("DetailVC deinitialized")
    }

    @objc private func editButtonClicked(_ sender: Any) {
        guard let editVC = storyboard?.instantiateViewController(withIdentifier: "TILEditViewController") as? TILEditViewController else {
            return
        }
        editVC.til = til
        editVC.tilViewModel = self.tilViewModel
        editVC.subjectViewModel = self.subjectViewModel

        editVC.modalPresentationStyle = .overFullScreen
        self.present(editVC, animated: true, completion: nil)
    }

    func setLabelText(_ til: TIL) {
        tilTitleLabel.text = til.title
        tilContentLabel.text = til.content
        tilSubjectLabel.text = subjectViewModel.getSubjectNameById(til.subjectId)
    }
}

A: You're holding a strong reference to self in your Detailed VC which prevents it from being deallocated. This is called a retain cycle.
On this line: $0.filter { $0.id == self.tilId }.
Adding [weak self] to your map block will fix this.


text:
Q: Random numbers shared between canvases I am new to Java, and I am also new to posting a question online. So please bear with me.
I am currently constructing a Java program which displays several canvases, and I require the different canvases to use shared and/or inherited information. Let's assume for simplicity that canvas C1 displays a polygon with random vertices on a circle. Currently these vertices are created in a coordinate class and are then instantiated by a drawing class. I am now trying to store these values in a way which allows the second canvas C2 (via drawing class) to use them, but without instantiating it, as I need the same sequence of random numbers.
Let this be a simplified example of my coordinate class:
public class Coord {
    public Complex[] z = new Complex[5];

    public Coord() {}

    // create n random vertices (length of a and z will match)
    public Complex[] randCoord(Complex[] a) {
        for(int i = 0; i < a.length; i++){
            z[i] = new Complex(200 * Math.random(), 200 * Math.random());
            }
        return z;
    }

//    public static Complex[] getCoord() {
//        return z;
//        }

}

The commented out section is one of my million attempts to generate a static version of the coordinate list, but I am not allowed to return z as it is not a static variable (in this case). I am probably missing something painfully obvious in regard to transferring between static and non-static methods, but any insight on how to store the random sequence (and likewise, how to call it) would be appreciated.

A: First of all, you should read up on the MVC-pattern: Model-View-Controller.
Secondly, it looks like what you're currently trying to do can simply be done by declaring z to be static:
public static Complex[] z = new Complex[5];

A: It sounds like the Singleton pattern would be helpful :
public class Coord {

    private static final Complex[] z = fixedRandomPoints(5);

    private Coord() {}

    //this is the method you call from both canvases
    public static Complex[] getInstance() {
       return z;
    }

    private static Complex[] fixedRandomPoints(int n) {
        final Complex[] results = new Complex[n];
        for(int i = 0; i < n.length; i++){
            results[i] = new Complex(200 * Math.random(), 200 * Math.random());
        }
        return results;
    }

}

The only thing thats unclear is the relationship of this class to the 'a' variable, which I think you need to explain a little better.


text:
Q: VBA - Conditional Formatting with dynamic formulas using VBA I am making a project planning worksheet and writing a function to add a team member that inserts a number of grouped cells for summing up hours per week.
The new cells should have a conditional format to show when the total actual hours worked (shown in blue) exceed the planned hours worked (column M).
Example
Manage Rules Box
I am having some trouble using the range that I define in Formula1:
When I run the program, it does define the conditional format, but the formula shown in "manage rules" shows the name of the range, not the cells I am trying to format.
Any and all help is greatly appreciated!
I have defined the range of cells to be formatted, but it doesn't seem to translate to actual cell selections when using MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=sum(MyRange)>FmtHrs"

Sub Button1_Click()
Dim iCol As Long
Dim WeekCount As Long
Dim LastCol As Long

Dim RowCount As Integer
Dim FmtRow As Long

Set ws = Sheet1

'This sections adds new staff member info'

'This sections adds weeks for new staff memeber'

WeekCount = Range("B3").Value  'number of columns to add (weeks of project in B3)'
LastCol = ActiveSheet.Cells(3, Columns.Count).End(xlToLeft).Column  'position of new columns at last column with data'
Columns(LastCol + 1).Insert Shift:=xlToRight

For i = 1 To WeekCount  'inserts columns for each week of project'
    Columns(LastCol + 1).Insert Shift:=xlToRight
Next i

'insterns column for new staff and adds labels'
LastCol = ActiveSheet.Cells(3, Columns.Count).End(xlToLeft).Column + WeekCount + 1
ActiveSheet.Cells(3, LastCol).Value = "Role"
ActiveSheet.Cells(4, LastCol).Value = "Name"
ActiveSheet.Cells(5, LastCol).Value = "Rate"

'Groups New Columns
LastCol = ActiveSheet.Cells(3, Columns.Count).End(xlToLeft).Column
Range(Cells(1, LastCol - WeekCount), Cells(1, LastCol - 1)).Columns.Group
ActiveSheet.Outline.ShowLevels ColumnLevels:=1 'collapses all groups

'Adds Conditional Formats to New Rows
RowCount = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row - 1
FmtRow = RowCount
Dim FmtHrs As Long
Dim MyRange As Range
Dim condition1 As FormatCondition

For i = RowCount - 1 To 6 Step -1
FmtHrs = ActiveSheet.Cells(FmtRow, LastCol)
Set MyRange = Range(Cells(FmtRow, LastCol - WeekCount), Cells(FmtRow, LastCol - 1))

    MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=sum(MyRange)>FmtHrs"
    MyRange.Interior.Color = RGB(128, 100, 250)

FmtRow = FmtRow - 1
Next i

End Sub

A: You write "=sum(MyRange)>FmtHrs" as formula to the conditional formatting. In Excel, MyRange has no meaning, that's a VBA variable. What you want is to write the range address into the formula.
An advice: don't write the formula directly, always use an intermediate variable, that makes it much easier to check if something does not work as expected
Dim formula As String
formula = "=sum(" & MyRange.Address & ")>FmtHrs"
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:=formula


text:
Q: Adding element at the middle of scala.collection.immutable.Vector in Java I am trying to use Scala's immutable.Vector in Java. Can anyone post an simple Java code for this?
This is what I have tried till now.

*

*Tried Vector Builder.

*Tried Vector.concat(Seq<Traversable <A>>)
Here is a sample of what I have tried:
Vector<Long> part1= orignal.slice(0, indexOfMid);
Vector<Long> part2 = orignal.slice(indexOfMid, orignal.size());
orignal= part2.appendFront(1L);
Vector <Traversable<Long>> vectorOfTraversables = Vector.empty();
vectorOfTraversables.appendFront(orignal.toTraversable());
vectorOfTraversables.appendFront(part1.toTraversable());
orignal= Vector.concat(vectorOfTraversables.toSeq());

I am getting the following error

Exception in thread "main" java.lang.NoSuchMethodError:
scala.collection.immutable.Vector.concat(Lscala/collection/Seq;)Lscala/collection/immutable/Vector;

Is there a better totally different way to do this? Or am I going wrong somewhere?

A: This should work:
Vector<Long> part1 = original.slice(0, indexOfMid);
Vector<Long> part2 = original.slice(indexOfMid, original.size());
VectorBuilder<Long> builder = new VectorBuilder<Long>();
builder.$plus$plus$eq(part1);
builder.$plus$eq(new Long(100));
builder.$plus$plus$eq(part2);
Vector<Long> result = builder.result();

VectorBuilder provides methods that do not use CanBuildFrom or repeated parameters, so it's much easier to use from Java.
By the way the NoSuchMethodError is probably due to the fact the concat is a method of the companion object. Import scala.collection.immutable.Vector$ and try this:
Vector$.MODULE$.concat(vectorOfTraversables.toSeq());

A: If you see a NoSuchMethodError, or any other error that descends from LinkageError, it means that your code was compiled against a different version of a library than is in your classpath.
This is somewhat uncommon with Java libraries, but it's incredibly common in Scala, where binary compatibility is quite difficult to achieve—primarily because of traits.
Make sure your runtime classpath contains the exact same Scala version as your compile classpath, and you should at least get further.*
*EDIT: But, then again, you won't get very far without a LOT of pain.  If you really need to use a Scala collection from Javaland, I think your best best is probably to write an interface in Java, and implement it from Scala.


text:
Q: elastich search missing filter on query it's the first time I use the 'missing' parameter and I am not sure if I am doing something wrong as i am not getting what i expect.
Can someone please tell me if the missing condition is correctly integrated in this query? it should created 5 facets, counting for each one only the occurrences for which decimallatitude field is 'not set in the index' or its value is null.
curl -XGET http://my_url:9200/idx_occurrence/Occurrene/_search?pretty=true -d '{
    "filter": {
        "missing": {
            "field": "decimallatitude",
            "existence": true,
            "null_value": true
        }
    },
    "query": {
        "query_string": {
            "fields": ["dataset"],
            "query": "3",
            "default_operator": "AND"
        }
    },
    "facets": {
        "test": {
            "terms": {
                "field": ["kingdom_interpreted"],
                "size": 5
            }
        }
    }
}
'

A: As you can see on the Search API - Filter page, the filter is applied to your query results but not to the facets. To make it work for facets, try using the Filtered Query instead
curl -XGET http://my_url:9200/idx_occurrence/Occurrene/_search?pretty=true -d '{
    "query": {
        "filtered": {
            "filter": {
                "missing": {
                    "field": "decimallatitude",
                    "existence": true,
                    "null_value": true
                }
            },
            "query": {
                "query_string": {
                    "fields": ["dataset"],
                    "query": "3",
                    "default_operator": "AND"
                }
            }
        }
    },
    "facets": {
        "test": {
            "terms": {
                "field": ["kingdom_interpreted"],
                "size": 5
            }
        }
    }
}
'


text:
Q: CSS nested divs & property inheritance I've some CSS that sets up several classes that change the coloring inside of a div, called accents. The accent class changes the background-color of the div, the text color, and the link color. The issue is that when accent divs are nested inside of each other, the colors start to override each other, showing up incorrectly.
Codepen here (Using SASS) but the following is relevant code. Basically what is happening is when nesting one or more of these accents inside of each other, trying to define colors for elements inside of the wrappers, such as an anchor tag , fails if the accent colors for the parent accent (.accent-4) are output after the styles for a child accent (.accent-1) because with the following markup, .accent-4 a also matches .accent-4 .accent-1 a.
HTML

Gradparent

Text should be white and links should be white.

Parent

Text should be black and links should be blue

But the links are white

Child

Text should be white and links should be white.

CSS
.wrapper {
 display: inline-block;
 width: 100%; }

 .wrapper [class*="accent-"] {
  padding: 20px;
  width: 100%;
  display: inline-block; }

  .wrapper [class*="accent-"] p, .wrapper [class*="accent-"] a, .wrapper [class*="accent-"] h3 { color: inherit; }

.accent-1 {
 background-color #333;
 color: white; }
 .accent-1 a { color: white; }

.accent-2 {
 background-color #ccc;
 color: black; }
 .accent-2 a { color: blue; }

.accent-3 {
 background-color salmon;
 color: black; }
 .accent-3 a { color: white; }

.accent-4 {
 background-color blue;
 color: white; }
 .accent-4 a { color: white; }

.accent-5 {
 background-color white;
 color: black;}
 .accent-5 a { color: blue; }

How do I ensure that accents always have the correct colors and allow for infinite nesting?
A few criteria:

*

*The colors for the accents may not always be what they are in the examples. This is actually part of a sass mixin that takes the accent colors as arguments. (Hence the color functions in the codepen).

*I say infinite nesting, but 3 levels is probably sufficient.

*I have already tried using the direct child selector (.accent-1 > p a). This is a simplified example and there will be additional complex elements inside the accents with other properties that will need to be different based off of what color the background of the accent is. Explicitly listing out each of these properties with the > selector for each of the 5 accents comes out to around 200KB of additional CSS

*Support for all modern browsers as well as back to IE8

A: You can do it easily with CSS variables:
.accent-1, .accent-3, .accent-4 {
  --anchor-color: white;
}
.accent-2, .accent-5 {
  --anchor-color: #3488C9;
}
.accent-1 a, .accent-2 a, .accent-3 a, .accent-4 a, .accent-5 a {
  color: var(--anchor-color);
}

* {
  box-sizing: border-box;
}

a {
  color: #3488C9;
  text-decoration: underline;
}

.wrapper {
  display: inline-block;
  width: 100%;
}

[class*="accent-"] {
  padding: 20px;
  width: 100%;
  display: inline-block;
}
[class*="accent-"] p, [class*="accent-"] b, [class*="accent-"] strong, [class*="accent-"] i, [class*="accent-"] em, [class*="accent-"] blockquote,
[class*="accent-"] h1, [class*="accent-"] h2, [class*="accent-"] h3, [class*="accent-"] h4, [class*="accent-"] h5, [class*="accent-"] h6,
[class*="accent-"] ul, [class*="accent-"] ol, [class*="accent-"] li, [class*="accent-"] a {
  color: unset;
}

.accent-1 {
  background-color: #333;
  color: white;
  --anchor-color: white;
}
.accent-2 {
  background-color: #ccc;
  color: black;
  --anchor-color: #3488C9;
}
.accent-3 {
  background-color: salmon;
  color: black;
  --anchor-color: white;
}
.accent-4 {
  background-color: #2A4D68;
  color: white;
  --anchor-color: white;
}
.accent-5 {
  background-color: #fff;
  color: black;
  --anchor-color: #3488C9;
}
.accent-1 a, .accent-2 a, .accent-3 a, .accent-4 a, .accent-5 a {
  color: var(--anchor-color);
}

[class*="col-"] {
  float: left;
}

.col-2 {
  width: 50%;
}

.col-3 {
  width: 33.3333%;
}

.col-4 {
  width: 25%;
}

[class*="correct"] {
  color: #fff !important;
  padding: 3px 4px;
  border-radius: 3px;
  display: inline;
  font-size: 12px;
  font-weight: normal;
  vertical-align: middle;
}

.correct {
  background-color: green;
}

.incorrect {
  background-color: red;
}

em {
  font-size: 13px;
  opacity: 0.8;
}

Section A: Accent 1 CORRECT

In this section, text should be white and links should be white.

All the styles in this section are correct because the parent div has a class of .accent-1, which is output before the rest of the accent styles, allowing them to override the parent's styles

Section A: Accent 2 CORRECT

In this section, text should be black and links should be blue.

Section A: Accent 3 CORRECT

In this section, text should be black and links should be white.

Section B: Accent 4 CORRECT

In this section, text should be white and links should be white.

Section B: Accent 2 CORRECT

In this section, text should be black and links should be blue.

This is incorrect because blue .accent-4 comes after light-grey .accent-2 in the stylesheet and the elements inside this section are also children of a blue .accent-4 section (SectionB:accent-4)

Section B: Accent 3 CORRECT

In this section, text should be white and links should be white.

This is only correct because the colors for the blue parent section (SectionB:Accent4) are being applied and  are the same.

Section C: Accent 1 CORRECT

In this section, text should be white and links should be white.

All the styles in this section are correct because the parent div has a class of .accent-1, which is output before the rest of the accent styles, allowing them to override the parent's styles

Section C: Accent 5

        CORRECT

In this section, text should be black and links should be blue.

Section C: Accent 2

        CORRECT

In this section, text should be black and links should be blue.

Section C: Accent 3

        CORRECT

In this section, text should be black and links should be white.

Section 3: Accent 4

        CORRECT

In this section, text should be white and links should be white.

Section D: Accent 4 CORRECT

In this section, text should be black and links should be white.

Section D: Accent 5

        CORRECT

In this section, text should be black and links should be blue.

This is correct because the styles for .accent-5 are output after the styles for the parent div with .accent-4 class

Section D: Accent 3

        CORRECT

In this section, text should be black and links should be white.

Section D: Accent 2

        CORRECT

In this section, text should be black and links should be blue.

Once again, this is incorrect because the styles for the .accent-2 class are output before the styles for the .accent-4 class of the parent wrapper.

Section D: Accent 1

        CORRECT

In this section, text should be white and links should be white.

And again, this is only correct because the foreground colors for .accent-4 happen to be the same as .accent-1

But note that currently there is small browser support.


text:
Q: Finding Parabola equations with 2 points. problem give 2 points and we know that none of them are vertex,
how to find the equation

A: Given two points on a parabola, $(x_1,y_1)$ and $(x_2,y_2)$ (where $x_1\neq x_2$), we try to find as much information as we can about the set of parabolas which pass through these points: $y=ax^2+bx+c$
Using the information given by those two points, this tells us the system of equations:
$$\begin{cases} ax_1^2+bx_1+c=y_1\\ ax_2^2+bx_2+c=y_2\end{cases}$$
Rewriting this in terms of a matrix equation:
$$\begin{bmatrix}x_1^2&x_1&1\\x_2^2&x_2&1\end{bmatrix}\begin{bmatrix}a\\b\\c\end{bmatrix}=\begin{bmatrix}y_1\\y_2\end{bmatrix}$$
Solve the system using familiar methods (such as via row reduction)

For example, finding the set of parabolas which pass through the points $(0,1)$ and $(3,0)$ will produce the matrix equation:
$$\begin{bmatrix} 0&0&1\\9&3&1\end{bmatrix}\begin{bmatrix}a\\b\\c\end{bmatrix}=\begin{bmatrix}1\\0\end{bmatrix}$$
Row reducing the augmented matrix $\left[\begin{array}{ccc|c}0&0&1&1\\9&3&1&0\end{array}\right]$ yields $\left[\begin{array}{ccc|c}1&\frac{1}{3}&0&-\frac{1}{9}\\0&0&1&1\end{array}\right]$ implying that $c=1$ and $a=-\frac{1}{9}-\frac{1}{3}b$
Thus, all polynomials passing through those two points can be written as:
$$f(x)=(-\frac{1}{9}-\frac{1}{3}t)x^2+tx+1$$
for some $t\in\Bbb R$

A: If you are only required to find ONE possible parabola that suits the graph given, here is an approach.
Note that $x=4$ and for some $\alpha>-2$ are the roots of the parabola. Since the parabola opens downwards, we write
$$y=-(x-4)(x-\alpha)$$
From the point $(-2,-2)$,
$$-2=-(-6)(-2-\alpha)\implies\alpha=-\frac53$$
So the parabola can be
$$y=-(x-4)(x+\frac53)$$
To further verify the equation, we have $y=\frac{20}3>0$ when $x=0$, which is indeed true.

A: If you have a parabola then it's a quadratic equation. You have a system of equations. Using f'' 's notation, $$ax_1^2+bx_1+c=y_1 \, \land \, ax_2^2+bx_2+c=y_2$$  2 equations and 3 unknowns $a,b,c$.

A: If the axis is vertical, we have three constants so we need to determine three constants in:
$$ y= a x^2 + b x + c $$
We require three points. Two points would not suffice.
For completeness..
If the axis is horizontal, we also find three constants in $x= a y^2 + b y + c. $
If the parabola axis is inclined to x-, y-, axes, then we need  to find four constants in $y = a x +b + \sqrt{ c x +d }. $


text:
Q: How to setup a Docker container for Eclipse? I really like the idea of packing my favourite Eclipse setup inside a tiny, portable, gittable Dockerfile. I already know how to setup a base Ubuntu desktop OS + Java + base eclipse package. However, I need a way to install Eclipse plugins from the command line.
Any advice?

A: Use the P2 Director application to install the plug-in and features as needed, just remember that features need ".feature.group" appended to their IDs when you specify them (otherwise it'll look for a bundle by that name). -repository and -installIU can both take comma separated lists of values.
https://help.eclipse.org/stable/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html


text:
Q: Using regular expression to extract substring I want to extract  from < to the next  from my log-files.
$>cat messages.log
2013-03-24 19:32:37.231 <F280 [192.168.178.22]:5000 -- Unknown>, Msg:[Test1]
2013-03-24 19:32:37.547 <F281 [192.168.178.22]:5000 -- Unknown>, Msg:[Test2
Test3
Test4]
2013-03-24 19:32:38.833 <F280 [192.168.178.22]:5000 -- Unknown>, Msg:[Test5]
2013-03-24 19:32:42.222 <F281 [192.168.178.22]:5000 -- Unknown>, Msg:[Test6]
$>sed 's/.*\<\(.*\) \[.*/\1|/g' messages.log
F280|
F281|
Test3
Test4]
F280|
F281|

I almost got what I wanted except for the output with the newlines. So I'd like to have the following result:
F280|F281|F280|F281

How has the regular expression look like?

A: I wouldn't create a unreadable regexp to do this I'd use awk here:
$ awk -F'[< ]' '/^[0-9]+/{s?s=s"|"$4:s=s$4}END{print s}' file
F280|F281|F280|F281

A: Try this:

sed -n '/</{s/^.*<\([^ ]\+\) .*$/\1|/g;H;${x;s/\n//g;s/|$//;p}}' messages.log

A: Try something like that (you'll have nested groups), or turn on multiline option in regex:
(^.+<(\w+) .+$)+

A: Is it compulsory to only use grep or are also other commands available?
I'd say that
grep "<.* " messages.log | sed  's/.*\<\(.*\) \[.*/\1|/g' | tr -d '\n' | sed 's/.$//'

The first grep is to remove data not following your desired pattern, followed by your sed command.
On the output, who should look like
F280|
F281|
F280|
F281|

The last tr command just removes the newline character at the end of each line (i.e it concatenates the result) while the last sed is just to remove the final pipe delimiter


text:
Q: Data model, many-to-many and one-to-many relation So we are developing a KPI and Initiative management system for a client.
In the image you can see the data model we've built based on the client's needs.
Basically this is the hierarchy of our data model: Strategic Objective linked to one entity > KPI > Initiative
Recently we've discovered from the customer that the strategic objective and KPI could be shared between more than one entity, but in the end for each entity there is a different Initiative.
I don't know how to reflect this in the data model. But I came up with three possible solutions:
1- Breaking down the Strategic Objective and Entity relation from one-to-many to many-to-many. And also the Strategic Objective and KPI relation to many-to-many, but this does not solve my problem. As in the end I want to model that for example SO1 is shared between entity1 and entity2, so is the KPI but not the Initiative.
2- EntityOwner table, that basically maps the Strategic Objective or KPI or Initiative to the entity directly.
3- Instead of mapping the entity to the strategic objective, we map it to the Initiative.
The Datamodel

A: Why not remove the relation between the KPI and Initiative and instead create one between Entity and Initiative?
Such model resembles the fact that KPIs seem to be in the domain of business performance while initiatives lie more on the side of programmes / projects office. In other words a business creates initiatives to satisfy strategic objectives not KPIs. KPIs are for visibility.
I would also query whether Strategic Objectives should have direct relationship with Entities, or whether there should be relationship SO -
- INITIATIVE -- ENTITY.


text:
Q: Can't get ModelForm to show in template - Django I have been trying to get this form to show for about 8hours now with no luck. I have read the just about every question on this site and others and those didn't resolve my problem.
models.py
class Quote(models.Model):
    first_name = models.CharField(verbose_name=('First Name'), max_length=35, null=True,blank=True)
    last_name = models.CharField(verbose_name=_('Last Name'), max_length=35,null=True,blank=True)

forms.py
class QuoteForm(forms.ModelForm):
    class Meta:
        model = Quote
        fields = '__all__'

views.py
def get_quote(request):
    if request.method == 'POST':
        form = QuoteForm(request.POST or None)
        if form.is_valid():
            #form.save()
            # process the data in form.cleaned_data as required
            # ...
            # redirect to a new URL:
            return HttpResponseRedirect('/testing/thank-you/')
    else:
        form = QuoteForm()
    return render(request, 'request-for-quote.html', {'form': form})

urls.py
urlpatterns = patterns ('',
    url(r'^testing/request-for-quote/','lsr.views.get_quote',
        name='get_quote'),)

request-for-quote.html
{% extends "base.html" %}
{% load cms_tags staticfiles sekizai_tags menu_tags %}
{% load i18n %}
{% block content %}
<form method="POST" action="">
{% csrf_token %}
{{ form }}
<button type="submit">{% trans "Request Quote" %}</button></form>
{% endblock content %}

When I use shell commands to display the form it shows me the html and renders in the console. just wont display in html template. What am i doing wrong? (EDIT) I forgot to mention that if i change the action to "get_quote" and you click on the button it will redirect to the thank you page above. Just won't show the form fields.
shell commands
>>>from lsr.forms import QuoteForm
>>>from lsr.models import Quote
>>>form = QuoteForm()
>>>form.as_p()

Help resolving this would be greatly appreciated. Yes I'm new to Django & Python.
UPDATE:
I believe my views.py is not even getting called. The only other 2 defs i have are for the 404 and 500 view so i turned debug to off in my settings and got a bad request instead of my custom 404 pages. So now I'm looking at how to get Django-CMS and Django forms to work together. I'm going to try this and let you know if it worked.


text:
Q: Proving the convergence of Jacobi method Is there any elementary way of showing that the Jacobi method converges for the following system?
$$\begin{pmatrix}10 & -2 & -11\\-3 & 10 & 2\\-1 & 1& 10\end{pmatrix}X= \begin{pmatrix} 13\\9\\11 \end{pmatrix}$$
The problem I face is that the iteration matrix has two complex eigenvalues, so how could I show that this eigenvalues have an absolute value which is less than $1$?

A: Set $D=diag(2,1,1)$, then
$$
D^{-1}AD=
\begin{pmatrix}
10&-1&-5.5\\
-6&10&2\\
-2&1&10
\end{pmatrix}
$$
is diagonal-dominant. Which should be sufficient to show convergence of the Jacobi method.

A: I think, if the complex eigenvalues are $\lambda_1=re^{\theta}$ and $\lambda_2=re^{-\theta}$, then you just need to consider $r$, together with the real eigenvalue.
What happens is that, as the iteration matrix $D^{-1}R$ gets multiplied by itself itteratively, its corresponding eigenvalue matrix is taken to higher powers and if $r$ and the real eigenvalue are less than $1$, they would go to $0$, eventually.


text:
Q: Taking a subset of equal value and other value of column I have a dataframe:
> df <- data.frame(x = c('x1','x1','x2','x2','x2','x3','x3','x3'),
+                  y = c(0,0,1,1,1,0,0,0),
+                  z = c(1,1,0,0,0,0,0,0))
> df
   x y z
1 x1 0 1
2 x1 0 1
3 x2 1 0
4 x2 1 0
5 x2 1 0
6 x3 0 0
7 x3 0 0
8 x3 0 0

I would like to create a subset based on y column where it is equal to 1, keep the value of x column based on the condition and make the 1 be 0.
I have only found how I could find the first step:
> length(which(df$y == 1))
[1] 3

How could a have a final output like this:
x  y
x2 0
x2 0
x2 0

A: require(dplyr)
df %>%
    filter(y == 1) %>%
    select(x, y) %>%
    mutate(y = 0)

A:  transform(subset(df[1:2],y==1),y=0)
   x y
3 x2 0
4 x2 0
5 x2 0

A: If you're open to using other packages, data.table is another option:
library(data.table)
setDT(df)[y == 1, .(x, y = 0)]

#   x y
#1: x2 0
#2: x2 0
#3: x2 0


text:
Q: Passing DropdownList value inside grid to the grid itself I've defined a DropdownList inside a KendoGrid. The DropdownList it's in a column on that Grid and it's showing the fields that come from the datasource correctly but, when I select one of those fields in the dropdown, it isnt passing/updating it's value to the grid itself.
I know that I need to use the change event to pass the value there but am not being able to do that somehow.
Can you help? I'll drop an image with the current code.
Thank you for the help.
if ('@viewMode.ToUpper()' == "EDIT") {
    var grid = e.sender;
    var items = e.sender.items();
    items.each(function (e) {
        var dataItem = grid.dataItem(this);
        var promtypedropdown = $(this).find('.equipDropDownEditor');
        $(promtypedropdown).kendoDropDownList({
            dataTextField: "Text",
            dataValueField: "Value",
            dataSource: {
                transport: {
                    read: {
                        dataType: "json",
                        url: '@Url.Action("GetPromoTypesCodeDetail", "Omni")'
                    }
                },
                width: 150,
                schema: {
                    data: function (response) {
                        return response.data.data;
                    },
                }
            },
            change: function(e){

                var uid = $(e.sender.element).closest("tr").attr('data-uid');
                var model = $("#omniDataGrid").data("kendoGrid").dataSource.getByUid(uid);
                model.PROMOTION_TYPE = this.text();

A: For the future, I got it working adding the this line of code:
model.set("PROMOTION_TYPE", this.text());


text:
Q: Inhomogeneous wave equation with Dirichlet condition I'm trying to solve the problem:
$\begin{cases} \frac{\partial u}{\partial tt} -\frac{\partial u}{\partial xx} =g(t)sin(x)\\ u(x,0)=\frac{\partial u}{\partial t}(x,0)=0 \\ u(0,t)=u(\pi, t)=0 \end{cases}$
I'd know the solution if there were no Dirichlet condition:
$u(x,t)=\int_{\Delta} g(t)sin(x)dxdt$
where $\Delta$ is the area between the x axis and the characteristics that pass thorugh $(x,t)$.
I'd also know the solution if there were no source: in that case you can separate variables, and the solution is found by decomposing $u(x,0)$ in a Fourier serie and by considering the time evolution of every eigenfunction. But with the inhomogenous case, when I try to separate the variables I get:
$u=Q(t)S(x)\\
\frac{d^2Q}{dt^2}(t)S(x)-\frac{d^2S}{dx^2}(x)Q(t)=g(t)sin(x)$
and now I have a harder problem.
Is there a better way to find the solution?


text:
Q: Hand segmentation using Depth thresholding I want to segment hand from a depth image using depth thresholding. I used this kinect and leap dataset from this link-
http://lttm.dei.unipd.it/downloads/gesture/
I tried these 2 codes, but the output I got is total black image in both the cases. The original .png image is

I selected depth value from 1_depth.bin file in the dataset.
Code 1
I = fopen('D:\dsktop\kinect_leap_dataset\acquisitions\P1\G1\1_depth.bin', 'r');
A = fread(I, 480*640, 'uint8=>uint8');
A = reshape(A, 480, 640);

min_row = min(A);
min_col = min(min_row);

for i = 1:480
    for j = 1:640
        if ((A(i,j) > (min_col + 10)) || (A(i,j) == (min_col + 10)))
           A(i,j) = 1;
       else
           A(i,j) = 0;
        end
    end
end
imshow(A)

Code 2
image = imread('D:\dsktop\kinect_leap_dataset\acquisitions\P1\G1\1_depth.png');
I = fopen('D:\dsktop\kinect_leap_dataset\acquisitions\P1\G1\1_depth.bin', 'r');
A = fread(I, 480*640, 'uint8=>uint8');
A = reshape(A, 480, 640);

min_row = min(A);
min_col = min(min_row);
for i = 1:480
    for j = 1:640
        if ((A(i,j) > (min_col + 10)) || (A(i,j) == (min_col + 10)))
            image(i,j) = 1;
        else
            image(i,j) = 0;
        end
    end
end
imshow(image)

The output I am getting is
Kindly tell what is wrong in this code and why I am not getting any out?

A: Your code is extremely not vectorize. Here's how to re-write your code in a more vectorize fashion. This is both more efficient and more "readable":
I = fopen('D:\dsktop\kinect_leap_dataset\acquisitions\P1\G1\1_depth.bin', 'r');
A = fread(I, 480*640, 'uint8=>uint8');
A = reshape(A, 480, 640);

min_ = min(A(:));  % minimal value across rows and columns
mask = A>=(min_+10);  % no need for loop, vectorize code.
imshow(mask, []);


text:
Q: Music bot can join but cant play a file Im coding an discord bot and i want to include an music player, for now im trying to play an file in the same folder
The function is being called from my main file.
I've already tried multiple stuff, but none did work,
the player const is later gonna be used to pause resume and so on
(ignore the link variable for now, its gonna be used for carrying an youtube link later)
module.exports = {
streamyt: function (message, link) {
    if (message.member.voiceChannel ) {
        const jchannel = message.member.voiceChannel
        jchannel.join()
        const player = jchannel.play('./Pascal.mp3')
    }
    else {
        message.reply('I cant do that,you need to be in an vc first')
    }
}

expected:
The bot should join and start playing my Pascal.mp3 file
actual:
the bot connects to the vc and then crashes
const player = jchannel.play('./Pascal.mp3')
                        ^
TypeError: jchannel.play is not a function

A: Apparently .play() is not the method of jchannel object.
module.exports = {
streamyt: function (message, link) {
    if (message.member.voiceChannel ) {
        const jchannel = message.member.voiceChannel
        jchannel.join().then(function (connection) {
            connection.playFile('./Pascal.mp3')
    }
    else {
        message.reply('I cant do that,you need to be in an vc first')
    }
}


text:
Q: Discord.js Birthday Bot-I have bdays stored in JSON file, how do I send "Happy bday" when someone has birthday I'm coding a Disord Bday Bot. Which saves someone in JSON file. I coded a command which can find someone by user id and tell when they have their bday. I want the bot to send a message when someone has theirs bday but I have no idea how should I do it. Any ideas?
JSON file, which holds bdays :
    "397698843858436097": {
        "day": "9",
        "month": "2",
        "year": "2006",
        "id": "  "
    },
    "453556418352513025": {
        "day": "16",
        "month": "1",
        "year": "2006",
        "id": "BookOfMonsterman04"
    }
}

command which saves a bday to JSON file:
const client = new Discord.Client();
const fs = require('fs');
module.exports = {
    name: 'setbday',
    description: 'this is a setbday command!',
    execute(message, args) {

        client.bdays = require('./bdays.json');

        client.bdays[message.author.id] = {
            day: args[0],
            month: args[1],
            year: args[2],
            id: message.author.username
        }
        fs.writeFile('./bdays.json', JSON.stringify(client.bdays, null, 4), err => {
            if (err) throw err;
            message.channel.send('Saved your birthday date!');
        });
    }
}

and command which can read someone bday if you tag them as argument:
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require('fs');
module.exports = {
    name: 'bday',
    description: 'this is a bday command!',
    execute(message, args, Discord){

      const target = message.mentions.users.first();
      fs.readFile("./bdays.json", "utf8", (err, jsonString) => {
        if (err) {
          console.log("File read failed:", err);
        }else{
          const data = JSON.parse(jsonString);
          let bday = data[target.id].day;
          let bmonth = data[target.id].month;
          let byear = data[target.id].year;
          const newEmbed = new Discord.MessageEmbed()
          .setColor('#0099ff')
            .setTitle('Birthday')
            .setURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstleyVEVO')
            .addFields(
                {name: 'Day', value: bday},
                {name: 'Month', value: bmonth},
                {name: 'Year', value: byear}
                );
          message.channel.send(newEmbed);
        }
      });
    }

}

A: Instead of using setInterval, which is really designed to repeat a task every x milliseconds, you can instead use the node package called node-schedule which is largely designed for time-based scheduling instead of interval-based scheduling. It makes it much easier to schedule tasks at a specific date.
Assuming you want to send a happy birthday message automatically when it is the user's birthday, you should be scheduling your task(s) in your client.on("ready") handler instead of using a command to read the JSON file and send a message, but you also need to schedule the task when a birthday is set (because otherwise newly set birthdays will only be congratulated after the bot restarts again). In that handler, you need to read the JSON file, loop through all of the items in it, assemble a Date object from each user's birth day/month and the current year, and schedule a message send at that Date. You would also need to slightly modify your setbday command to set a specific channel in which the message should be sent; you can either set it to a single constant channel (like a #birthdays channel) or just the channel in which the command is used (which is what I will do in this example).
You will also need to remove your creation of a new Discord.Client in both of your command files; not only is that unnecessary, but it will not work in the way you intend.
Solution
So here's an example:
This is a new file called birthdays.js which is in your main folder (not commands):
const schedule = require("node-schedule");
const Discord = require("discord.js");

module.exports = {
    scheduleBday(day, month, year, username, channelID, client) {

        var currentDate = new Date();

        //Date constructor is in the format: year, month, day
        //Month is from 0-11, where 0 is January and 11 is December (so we subtract 1)
        var birthDate = new Date(currentDate.getFullYear(), Number(month) - 1, day);

        var j = schedule.scheduleJob(birthDate, () => {

            const newEmbed = new Discord.MessageEmbed()
            .setColor('#0099ff')
            .setTitle(`Happy Birthday, ${username}!`)
            .setURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstleyVEVO')
            .addFields(
                {name: 'Day', value: day},
                {name: 'Month', value: month},
                {name: 'Year', value: year}
             );

            var channel = client.channels.cache.get(channelID);
            if (!channel) return console.log("Could not find channel");
            channel.send(newEmbed);
        });

        return j;

    }
}

This is in your bot's main file (i.e. index.js or server.js):
const birthdaysjs = require("./birthdays");

client.on("ready", () => {

    //Use the proper path to your bdays.json; this is an assumption based on your code
    const bdays = require("./commands/bdays.json");

    Object.values(bdays).forEach(bday => {

        //Schedule a happy bday message for each bday in bdays.json
        birthdaysjs.scheduleBday(bday.day, bday.month, bday.year, bday.id, bday.channelID, client);
    });

});

This is your setbday command's file:
const fs = require('fs');
const birthdaysjs = require("../birthdays");

module.exports = {
    name: 'setbday',
    description: 'this is a setbday command!',
    execute(message, args) {

        message.client.bdays = require('./bdays.json');

        var bday = {
            day: args[0],
            month: args[1],
            year: args[2],
            id: message.author.username,
            //Get the ID of the channel you want to send the happy bday message in:
            channelID: message.channel.id
        }

        message.client.bdays[message.author.id] = bday;

        fs.writeFile('./bdays.json', JSON.stringify(message.client.bdays, null, 4), err => {
            if (err) throw err;
            message.channel.send('Saved your birthday date!');

            //Schedule a happy bday message for this newly added birthday!
            birthdaysjs.scheduleBday(bday.day, bday.month, bday.year, bday.id, bday.channelID, message.client);

        });
    }
}

Explanation
First of all, let me explain why I created a separate birthdays.js file to do this: the happy bday message needs to be scheduled in more than one different file. Here's what I mean: if you only schedule a bday message in your client.on("ready") handler, then any birthdays added with your setbday command after the bot starts up will not have a bday message scheduled; only the previously set birthdays will have a message scheduled. To solve this, I not only schedule all birthdays in the ready handler, but also schedule them as they are created. I decided to create a separate file for the scheduling code and to require that file, instead of directly pasting the exact same code in two different files.
Next, allow me to explain how birthdays.js works. First, we get the current date using new Date(). We need the current date because we want to send the happy bday message on the user's birthday this year, so we need to get the current year. Next, we construct the date at which the user will have a birthday this year using: the current year, the user's birth month, and the user's birth day. Note that javascript's months go from 0-11 instead of 1-12, so we need to subtract one from our month value in order to get an accurate Date object. Finally, we use node-schedule to schedule a task on the user's birthdate. As for the task itself, we simply use the embed from your bday command's code, get the channel we need to send the message in, and then send the embed in that channel.
As for the ready event handler in your bot's main file, we only need to add a few things. First, we read your bdays JSON file to get all of the birthdays. Next, we use Object.values() to get an array of only the values of the JSON file (remember that your JSON file's format is {"user id": birthdayObject}, matching the JSON structure of {"key": value}). We then loop through all of those values using Array.forEach(). Finally, we use the code from our birthdays.js file to schedule a happy bday message for each of the birthdays that we loop through in the JSON file.
And finally, let's look at your setbday command code. First of all, I removed your new Discord.Client() because that creates an entirely new bot instead of using your existing bot's Client. Use message.client instead. Other than that, all I changed in that file was adding a channel ID to send the happy bday message in, and scheduling the happy bday message for any newly set birthdays.
If you didn't understand any part of this code, or if you notice any errors or such, feel free to comment below and let me know!
Answer to question in your comment
If you just want to list all of the users with a birthday today, here's the full code for one way you could do it (assuming this is in a command file such as your bday command):
var bdays = require("./bdays.json");
var bdayUsers = [];

Object.values(bdays).forEach((data) => {
    let {day, month, id} = data;

    var currentdate = new Date();
    var goaldate = new Date(currentdate.getFullYear(), currentdate.getMonth(), currentdate.getDate());
    var birthdate = new Date(currentdate.getFullYear(), Number(month) - 1, day);

    if (goaldate.getTime() == birthdate.getTime()) {
        //Today is the birthday of this user!
        bdayUsers.push(id);
    }
});

//If no users have a birthday today, make the below message say "None" in bold
if (bdayUsers.length == 0) bdayUsers = ["**None**"];

message.channel.send("Users with a birthday today: " + bdayUsers.join(", "));


text:
Q: Tracing methods with ASM4.0 in java -- transformed method gets ruined (NoSuchMethodError) I'm experimenting with ASM 4.0 and I'm having some trouble running my agent. I have a class TraceTransformer that should transform the bytecode, but something is going wrong -- it seems that every class I visit gets ruined when I attempt to transform it.
Agent
JavaTraceAgent.java:
package traceagent;

import java.lang.instrument.Instrumentation;

public class JavaTraceAgent {
    private static Instrumentation instrumentation;
    private static String agentId = "Uninitialized";

    public static void premain(String args, Instrumentation inst) throws Exception {
        instrumentation = inst;
        instrumentation.addTransformer(new TraceTransformer());
    }

    public static void agentmain(String args, Instrumentation inst) throws Exception {
        instrumentation = inst;
        instrumentation.addTransformer(new TraceTransformer());
    }

    public static void initialize() {
        if (instrumentation == null) {
            JavaAgentLoader.loadAgent();
        }
    }

    public static void logMethodInvocation() {
        System.out.println("Logging invocation...");
        //Thread.dumpStack();
        System.out.println("logging complete!");
    }

    public static void setAgentId(String _agentId) {
        agentId = _agentId;
    }
}

TraceTransformer.java
package traceagent;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class TraceTransformer implements ClassFileTransformer {

    @Override
    public byte[] transform(ClassLoader loader, String className,
            Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
            byte[] classfileBuffer) throws IllegalClassFormatException {

        if (!className.contains("superman")) return classfileBuffer;

        System.out.println("TraceTransformer invoked on " + className);

        ClassReader reader = new ClassReader(classfileBuffer);
        ClassWriter writer = new ClassWriter(reader, 0);

        ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, writer) {

            @Override
            public MethodVisitor visitMethod(int access, final String name, String desc, String signature, String[] exceptions) {
            return new MethodVisitor(Opcodes.ASM4) {
                @Override
                public void visitCode() {
                    if (name.contains("sayHello")) {
                            super.visitMethodInsn(Opcodes.INVOKESTATIC, "traceagent/JavaTraceAgent", "logMethodInvocation", "()V");
                            System.out.println("Injecting logger on " + name);
                    }
                    super.visitCode();
                }
            };
        }
    };

    reader.accept(visitor, 0);

    return writer.toByteArray();
}

}

Manifest
build.xml:

    ...
    <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Class-Path" value="${manifest.classpath}"/>
        <attribute name="Agent-Class" value="traceagent.JavaTraceAgent" />
        <attribute name="Can-Redefine-Classes" value="true" />
        <attribute name="Can-Retransform-Classes" value="true" />
        <attribute name="Premain-Class" value="traceagent.JavaTraceAgent" />
    </manifest>
    ...

Target
Program.java (entry point):
package jack;

import jack.superman.Hello;

public class Program {
    /**
    * @param args
    */
    public static void main(String[] args) {
        Hello.sayHello();
    }

}

Hello.java:
package jack.superman;

public class Hello {

    public static void sayHello() {
        System.out.println("Hello");
    }
}

Current procedure
...\src> javac -d . jack\Program.java
...\src> java --javagent:jack\TAgent.jar jack.Program
TraceTransformer invoked on jack/superman/Hello
Injecting logger on sayHello
Exception in thread "main" java.lang.NoSuchMethodError: jack.superman.Hello.sayHello()V
        at jack.Program.main(Program.java:10)

What am I doing wrong here? How do I avoid "destroying" the method?

A: I tested your code and I got the same error, but after some testing and reading of docs I made it work. The problem is in your MethodVisitor of your ClassVisitor. Here is the code.
ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, writer) {
    @Override
    public MethodVisitor visitMethod(int access, final String name, String desc, String signature, String[] exceptions) {
        MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions);
        if (!name.contains("sayHello")) return mv;

        MethodVisitor mv2 = new MethodVisitor(Opcodes.ASM4, mv) {
            public void visitCode() {
                mv.visitMethodInsn(Opcodes.INVOKESTATIC, "traceagent/JavaTraceAgent", "logMethodInvocation", "()V");
            }
        };

        return mv2;
    }
};

The output is

TraceTransformer invoked on jack/superman/Hello
Loggin invocation...
loggin complete!
Hello


text:
Q: remove element from complex type of schema with  I have the following schema (simplified to remove types we're not discussing):
baseGUIconfig.xsd
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- Types -->
  <xs:complexType name="defaultsType">
      <xs:sequence>
          <xs:element name="dataDirectory"              type="xs:string"/>
          <xs:element name="UpstreamDataFileExtension"  type="xs:string"/>
          <xs:element name="LocalDataFileExtension"     type="xs:string"/>
          <xs:element name="connectionTimeoutMs"        type="xs:decimal"/>
          <xs:element name="connectionMaxRetry"         type="xs:decimal"/>
      </xs:sequence>
      <xs:attribute name="os" use="required">
          <xs:simpleType>
              <xs:restriction base="xs:string">
                  <xs:enumeration value="linux"/>
                  <xs:enumeration value="windows"/>
              </xs:restriction>
          </xs:simpleType>
      </xs:attribute>
  </xs:complexType>

  <xs:complexType name="baseGuiConfigType">
      <xs:sequence>
          <xs:element name="defaults" type = "defaultsType" minOccurs="1" maxOccurs="2" />
      </xs:sequence>
  </xs:complexType>

  <!-- Elements -->
  <xs:element name="baseGuiConfig" type="baseGuiConfigType" />

</xs:schema>

However, I have another schema which redefines this one. In it, I would like to remove the UpstreamDataFileExtension element. Is it possible to remove elements, or redefine the defaultsType in such a way that the derivative schema no longer has it?
Here's what I've tried (which doesn't work):
Redefining schema
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- Base Schema w/ connection restrictions -->
    <xs:redefine schemaLocation="qrc:///schema/baseGUIconfig.xsd">
        <!-- Redefine the defaultsType to remove Upstream -->
        <xs:complexType name="defaultsType">
            <xs:complexContent>
                <xs:restriction base="defaultsType">
                  <xs:sequence>
                    <xs:element name="dataDirectory"            type="xs:string"/>
                    <xs:element name="LocalDataFileExtension"   type="xs:string"/>
                    <xs:element name="connectionTimeoutMs"      type="xs:decimal"/>
                    <xs:element name="connectionMaxRetry"       type="xs:decimal"/>
                  </xs:sequence>
                </xs:restriction>
            </xs:complexContent>
        </xs:complexType>
    </xs:redefine>
</xs:schema>

A: You can't do it in XSD 1.0 since the element you're trying to remove is mandatory. The restriction mechanism was designed such that the valid XML for the new type must still be valid when matched against the original (restricted) type. The new XSD 1.1 introduced a new construct, override, where one can do whatever one wants.


text:
Q: Opencv how to read single frame from camera I am trying to read single frame from camera but it hang my program and make the imshow window not responding , so any idea how to read single frame so that my vision module can process it
Here is my code:
 cv::VideoCapture VideoCapture;
 // Frame read from Camera will be stored in CamFrame MAT
 cv::Mat CamFrame;

// Open camera
VideoCapture.open(0);

if(!VideoCapture.isOpened())  // Check if we succeeded
{
    with for loop it not hang the imshow model
  //   for (;;){

    // Read frame from Camera
    VideoCapture.read(this->CamFrame);
    // check if we succeeded
    if (this->CamFrame.empty()) {
        qDebug() <<  "ERROR! blank frame grabbed\n";
        break;
    }
    cv::imshow("live frame ",this->CamFrame);

     // }
}

A: You should use waitKey() after imshow(). As documentation says:

Note :This function is the only method in HighGUI that can fetch and
  handle events, so it needs to be called periodically for normal event
  processing unless HighGUI is used within an environment that takes
  care of event processing.

cv::VideoCapture VideoCapture;
 // Frame read from Camera will be stored in CamFrame MAT
 cv::Mat CamFrame;

// Open camera
VideoCapture.open(0);

if(!VideoCapture.isOpened())  // Check if we succeeded
{
    with for loop it not hang the imshow model
  //   for (;;){

    // Read frame from Camera
    VideoCapture.read(this->CamFrame);
    // check if we succeeded
    if (this->CamFrame.empty()) {
        qDebug() <<  "ERROR! blank frame grabbed\n";
        break;
    }
    cv::imshow("live frame ",this->CamFrame);
    waitKey(0);

     // }
}

Note: If you want to use imshow for continuous frames, you can assign an if case with a specific waitKey() or also in while()


text:
Q: Identify: book about a Jesuit arguing that lizard people are Satanic? I got most of the way through this book a while back but had to return it to the library.  Now I can't remember the title or who wrote it.  I do remember it was written sometime around 1955.
An expedition of ~5 humans has been sent to a jungle planet, the first intelligent species discovered by humans.  These people are reptilian, and live without government in a highly cultured self-organizing society: adolescents have an instinct for picking their vocation.  The life cycle of the lizards involves laying tons of eggs in marshes; tadpoles hatch and the juvenile/adolescent lizards have a hard time of it -- most of them don't survive to adulthood.  Those that do never know their parents.
The purpose of the human expedition is to decide whether the planet is safe for human visitation.
The main character is a Jesuit (iirc, certainly a Catholic), who is both a botanist/doctor (can't recall) and the spiritual adviser to the trip, who befriends one of the Lizards, a dignified and kind "man".  The Jesuit comes to the opinion that the Lizards, who have nothing resembling religion, nor do they love (or even know) their children, nor do they marry, are sent by Satan to tempt humanity to a loveless and secular lifestyle.
The last part of it I read was where the Jesuit was having a debate with the other members of the expedition as to whether to recommend that the planet be closed off to all human visitors.
Can you guess what book this might be?

A: A Case of Conscience by James Blish. There are two versions: a novella, published in If magazine in 1953, takes the story up to end of your summary, and is most likely the version you read; an expansion to novel length (first published 1958) adds a second section in which the priest Ruiz-Sanchez returns to Earth with a Lithian who proves disruptive to human society.
Blish wrote three other novels with Catholic themes: two short apocalyptic fantasies, Black Easter and The Day After Judgment, and the historical Doctor Mirabilis, based on the life of Roger Bacon. These four novels have been printed together under the title After Such Knowledge.
The September 1953 issue of Worlds of IF is freely available on the Internet Archive; A Case of Conscience starts at page 5.


text:
Q: Troubleshooting a bad download speed on great Internet connection I have a couple machines experiencing an awful download speed on an awesome Internet connection, and for the life of me I can't come up with a rational explanation as to why.
Speed test to the local ISP shows >10Mbps downspeed. The line is supposed to be symmetrical but test shows ~7Mbps upspeed. Speed test to a server further away shows < 8Mbps. (One server I tested showed under 1Mbps.) And pingtest.net shows 11ms ping, 1ms jitter, 0% packet loss. Internal pings are 1ms or 2ms.
Actual downloads however are terribly slow. The speeds vary between website. Drivers from Dell (over FTP) at 40Kb/s, sometimes 10Kb/s. Windows 8 Preview from Microsoft 100Kb/s, VLC from SourceForge at 60Kb/s.
Firewall blocks all ICMP. (This is clearly the problem, but this question is about to be closed so I won't get a chance to confirm what specifically the problem is in this case.)

A: Blocking ICMP will cause horrible TCP performance problems because ICMP is used to perform path MTU discovery. Remove the ICMP block and test again. I bet you'll find the problem goes away.
There are also other possible ways the firewall could be causing this. So I'd suggest shutting off the firewall and re-testing. If that solves the problem, enable the firewall but disable ICMP filtering and test again.


text:
Q: Push method in JavaScript Hi I have a problem in javascript.
when i try to save info in the localStorage  in  console i had  the error  'method 'push' of undefined.
<script type="text/javascript">

//localStorage.clear(); // Clears the hard drive (database)
var oUsers = {aIds:[], aNames:[]};

// Default
if(localStorage.sUsers){
    console.log('Users already in memory');
    // Get the string with users from the database and
    // convert it into an object, so we can use it
    oUsers = JSON.parse(localStorage.sUsers);
}

function SaveUser(){
    // Take the text and make it an object
    oUsers.aIds.push(document.getElementById("TxtId").value);
    oUsers.aNames.push(document.getElementById("TxtName").value);
    localStorage.sUsers = JSON.stringify(oUsers);
    console.log(localStorage.sUsers);
}

</script>


text:
Q: Trouble combining jQuery and .php in Wordpress I am trying to make a simple translation site here:http://traductordeinglesaespanol.co/. I created a simple php code that uses get to an external translation api which works fine. Here's the code:
<?php
if(!empty($_GET['text'])){
  $trans_url ='http://api.mymemory.translated.net/get?q='.urlencode($_GET['text']).'&langpair=en|es'    ;
  $trans_json = file_get_contents($trans_url);
  $trans_array = json_decode($trans_json, true);

  echo $trans_array['responseData']['translatedText'];
 }
?>

Here is the simple html form:
 <form id="form" method="get" action="tran.php">Enter Text to be Translated below:
 <input name="text" type="text" id="test" />
 <button id="but">Translate</button></form>

The translation works ok now but I what I would like to do is to grab the tran.php result using jQuery and show it in the "result" class below the form. I am trying to do this by the following:
 I loaded by editing the functions.php file so it loads jQuery and a .js script named tran.js. When I inspect element I see both jQuery and the script being loaded. In the script I put this basic code:
jQuery(document).ready(function(){

$('#go').click(function() {

    $.ajax({
         type: 'GET',
         url: 'tran.php',
         success: function(data) {
            $('.result').html(data);
            }
    });
 });
});

and change  action to  to handle the form from this page. (tran.php is in the root directory.) But it isn't working at all. I suspect there is/are some crucial mistakes in the coding but being a complete beginer I cannot find where the mistakes are so any advice/correction would be greatly appreciated!

A: You should use ajax this way :
var to_be_translated = "Hello";
$.ajax({
    type: 'GET',
    url: 'tran.php',
    data : 'text=' + to_be_translated,
    success: function(data) {
        $('.result').html(data);
    }
});

Here I added the "data" label, it says the JS variable to_be_translated will be seen as $_GET['text'] in PHP.

A: I somehow managed it to work! There was a small typo:
     data : 'text=' + to_be_translated;

I replaced the ";" in the end with a comma and now I am getting the result like this: Let's say I input the text name to translate (nobre in spanish!), I get this:
<!DOCTYPE html>   <meta charset="utf-8"/> <title>estes</title>  nombre

So I have to get rid of these headers somehow! Anyway I want to thank you again very much for your help! Gracias!


text:
Q: Why did Macports take ownership over lots and lots of files and what can I do about it? I have just removed Macports. After that I did some random checks in directories and found out that some files still have Macports as their owner. So I did a 'find' on all files that have Macports as their owner and I was shocked by the results. Tons of images, Spotify files, crashlogs that had absolutely nothing to do with Macports are apparently owned by Macports (while Macports has been removed according to their own uninstall instructions).
Now I am in no means a good administrator but when I remove something it would be nice if everything will be reverted to its former state. Plus on top of that I don't even know why Macports would take ownership of all those files.
So...

*

*Can anyone explain to me how this could have happened and what I can
do to prevent it from happening again should I want to use Macports again.

*How can I safely reclaim ownership? The problem is that I don't even know "who" used to be the owner of the files at hand.

A: If the files should be owned by you, you could do something like this:
sudo find ~ -user macports -exec chown $USER {} +

I have also uninstalled MacPorts and I still had a user named macports, but there were no files owned by it.

A: I can verify that a similar phenomenon has occurred on my Mac: I have MacPorts 2.3.3 installed (on OS X 10.9.5), and user macports recently took ownership of many seemingly random files on an external drive that I use regularly, including media files and applications.
I noticed the problem because suddenly today I could not download from Firefox to my designated downloads folder, which is on the external drive; after examining the downloads folder, I noticed that the user and group of the folder had been changed to macports, and was read-only for other users. After some searching, I discovered that user macports had commandeered a number of other files on the external drive unrelated to MacPorts.
The previous answer worked for me, e.g.:
sudo find /Volumes/External -user macports -exec chown $USER {} +

However, that only changes the user, and I needed to change the group too, e.g.:
sudo find /Volumes/External -group macports -exec chown :staff {} +

MacPorts ticket #41039 discusses a similar issue and may shed some light on the origins of the problem: https://trac.macports.org/ticket/41039
Update: I have determined that the probable cause of the problem, in my case, is that I occasionally connect my external drive to other Macs, and on one of those Macs (let's call it Computer B) the user account that I use has uid=502 (MacPorts is not installed on Computer B). User macports on the other computer (let's call it Computer A, on which MacPorts is installed) also has uid=502. So after I have used the external drive on Computer B, later when I mount the external drive on Computer A, any files that I created or modified on Computer B will have user and group macports on Computer A.
So, for example, any files that were created on another computer with uid=502 and then are copied to a computer that has MacPorts installed (where user macports has uid=502) will be owned by user macports on that computer. Or, if you once had a user account on your computer with uid=502, but then you delete that account and later install MacPorts, and then user macports uses uid=502, all of the remaining files that were once owned by the deleted user account will now be owned by user macports.


text:
Q: Proper design of command line parameters? I have a Java class API that looks like this:
boolean categoryAdd( String name, String description, String user );

and I need to create a command line equivalent for it.
How would the command line parameters look like?
Like this
-categoryadd name description user

or like this
-categoryadd -categoryname name -categorydescription description -categoryuser user

or like this
-categoryadd -categoryname=name -categorydescription=description -categoryuser=user

or something else?

A: Common usage dictates that single character (short) options are in the form of -v and multi-character (long) options are in the form of --verbose as examples.
http://en.wikipedia.org/wiki/Command-line_interface
Seriously consider using a CLI Parsing library that will handle all this for you and more.
My preference is JSAP, it is feature complete, stable and highly useful. Newer libraries use @Annotations and other things but this gets it done for me.

A: In java command line string separated by spaces so when you call you method from CLI like:

java MyClass categoryadd name description user

, in you main class you will recieve args with 4 values:

*

*categoryadd

*name

*description

*user

This way it will be easy for to manipulate (validate) parameters, because you don't need to do additional manipulations to extract passed variables.
From other hand from user side without additional information it pretty confusing what kind of parameters to pass and in which order.
In your 2nd and 3rd propositions you "helping" user to determine which parameters he passes. I prefer the 3rd proposition with equals, because it will be easy to parse the:
you will receive parameters like:

*

*-categoryadd

*-categoryname=name

*-categorydescription=description

*-categoryuser=user

Now you delay on first and can parse key-value with string.split(=) way.
Your 2nd option also can be done but I think it is more tricky


text:
Q: JSF backing bean triggered when not called I have this button in a .xhtml:
    <p:commandButton id="openDialog"
     value="#{msg.CreateMultiple}"
     onclick="PF('dialogLocations').show();" title="View"
     type="button">
     </p:commandButton>

What it is supposed to do, is to open the dialog dialogLocations which has the next code:
<p:dialog header="#{msg.CreateMultiple}" id="dialogLocations"
            widgetVar="dialogLocations" modal="true"closable="true"
            dynamic="true" closeOnEscape="true">
            <h:form>

                        <p:commandButton id="acceptMultiple_button" value="#{msg.Create}"
                            action="#{locationCreateBean.createMultiple(true)}"
                            styleClass="btn-green internal-margin-left" update="@form">
                        </p:commandButton>

                        <p:commandButton id="cancelMultiple_button"
                            styleClass="btn-red internal-margin-left"
                            onclick="PF('dialogLocations').hide();" value="#{msg.Cancel}"
                            title="View" type="button">
                        </p:commandButton>

                    </div>

                </h:panelGroup>

            </h:form>
        </p:dialog>

The dialog has some inputs also to use in the bean.
My problem is that, when I click the button "openDialog" the dialog opens and the method locationBean.createMultiple(true) is being called, which is the action of the button "acceptMultiple_button" .
Shouldn't the action of the button be triggered when I click the button?
Thanks.

A: Solved it. It was a comment on the xhtml surrounded by <!-- --> that has the call to the method. I thought that in a comment wouldn't call the function. But it seems sometimes it calls a comment anyway.
Thanks for the comments.


text:
Q: Installing PyQt5 on windows with pip I am trying to install PyQt5 on my windows. My python is 3.16.
pip install PyQt5 gives not error and it seems PyQt5 is installed. Future "pip install PyQt5" gives the message "Requirement already satisfied"

Then in same terminal I run "python test.py" and test.py contains single line "from PyQt5.QtWidgets import QMainWindow". this gives me error "No module named PyQt5.QtWidgets".
"where pip" and "where python" are pointing to same python distribution. PyQt5 is in site-packages.
Can anybody say what is going on?
This is the same issue I have asked a few days before but in that time I got same error when installing with wheels. Now I kind a localized the issue.

A: I tried to solve this 2 days then I give up and reinstalled python. This solves the problem. Still don't understand the cause of issue.

A: Did you include the path of PyQt5 in the environment variables[path] add C:\Python34\Scripts,C:\Python34\Lib\site-packages\, C:\Python34\Lib\site-packages\PyQt5\, that is mine yours maybe different, i solved it that way.


text:
Q: jQuery Lightbox Me - Multiple links same popup Hi i am using the jQuery Lightbox Me plugin to open a popup on a page but i want multiple links to open the same popup.
The Code:

<link rel="stylesheet" href="./pop_files/styles.css" type="text/css" media="screen" title="no title" charset="utf-8">

The links:
Open pop link 1
Open pop link 2

The problem i'm having is, i need to give every link a new (id="try-...") for it to work this is fine for 2 link but fore 50 it is a bit unnecessary i think.
There must be a easier way of doing this, so any ideas most appreciated.
Regards Kevin.

A: try using a class instead of an id. give all the links the same class:
$('.try').click(function(){
    //some code...
})

A: you can use jQuery Selector to do that as below:

<link rel="stylesheet" href="./pop_files/styles.css" type="text/css" media="screen" title="no title" charset="utf-8">

this would solve your problem for more then 100s as well
I hope this would help


text:
Q: How resilient is reporting to Trains server? How would Trains go about sending any missing data to the server in the following scenarios?

*

*Internet connection breaks temporarily while running an experiment

*Internet connection breaks and doesn't come back before the experiment ends (any manual way to send all the data that was missed?)

*The machine running Trains server resets in the middle of an experiment

A: Disclaimer: I'm part of the allegro.ai Trains team

*

*Trains will auto retry to send logs, basically forever. The logs/metrics are sent in a background thread so it should not interfere with execution. You can set the backoff parameter, to control the retry frequency, by adjusting the sdk.network.iteration.retry_backoff_factor_sec parameter in your ~/trains.conf file, see example here

*The experiment will try to flush all metrics to the backend when the experiment ends, i.e. the process will wait at_exit until all metrics are sent. This means if the connection was dropped, it will retry until it is up again. If the experiment was aborted manually, there is no way to capture/resend those lost metric reports. That said with the new 0.16 version, offline mode was introduced. This way one can run the entire experiment offline,  then later report all logs/metrics/artifacts.

*The Trains-Server machine is fully stateless (the states themselves are stored in the databases on the machine) this means that from the experiment perspective, the connection was dropped for a few minutes and then it's available again. To your question, if the Trains-Server restarted, it is transparent to all experiments and they continue as usual, no reports will be lost.


text:
Q: Find if CountDownTimer is Finished? I was playing around with the CountDownTimer on Android and I came into sort of a dilemma. In my code, I have the following:
public class mCountDownTimer extends CountDownTimer{
    protected boolean hasFinished = false;
    public mCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        // TODO Auto-generated constructor stub
    }
    public void onFinish(){
        hasFinished = true;
    }
    @Override
    public void onTick(long millisUntilFinished) {
        // TODO Auto-generated method stub

    }
}

Basically I want to find out if my CountDownTimer has finished. But in the function I want to call it in, I have some code that goes:
public void function(){
public boolean finished = false;
    if(interrupted)
        countDownTimer.cancel();
    if(temporaryCountHolder == false){
        countDownTimer.start();
        interrupted = true;
    }
}

How can i tell whether or not my timer has finished? I want to implement something that says:
 if(countDownTimer.hasFinished == true){
        Time now = new Time(); //finds the current time
        now.setToNow();
        String lsNow = now.format("%m-%d-%Y %I:%M:%S");
        lsNow += " just Started\n";
        try {
            dumpToFile("StepsChanged", lsNow);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
 }

But if I put the statement right after
if(temporaryCountHolder == false)

statement, then the if statement with hasFinished will always evaluate to be false. How can I get it so that I can record the time if and only if the timer has finished?

A: As per your comments, the reason why you are getting the false value is because you are executing the statements before the timer has stopped.
You can go like below,
@Override
public void onFinish(){
        hasFinished = true;
        Time now = new Time(); //finds the current time
        now.setToNow();
        String lsNow = now.format("%m-%d-%Y %I:%M:%S");
        lsNow += " just Started\n";
        try {
            dumpToFile("StepsChanged", lsNow);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
}

To simply record the time you can just move those methods to the onFinish method of countdowntimer class. I don't know about dumpToFile if it is a method of another class you can make it a static method and use it or even some suitable alternative methods. Hope this helps.

A: you need to cancel CountDownTimer in OnFinsh
    @Override
    public void onFinish() {
        Log.v(TAG, "On Finish");
        Intent intent = new Intent(TIME_OUT);
        intent.putExtra("dialog", "timeout");
        sendBroadcast(intent);
        countDownTimer.cancel();
    }


text:
Q: strangely added character to my strings when using .encode("utf-8") I'm getting a really weird error. A character is added basically when I try to use utf-8.
Code 1
Here's the link content I'm analyzing:
https://www.dropbox.com/s/sjmsbuhrghj7abt/new_tweets.txt?dl=0
new_tweets = 'content in the link'

The following code now pulls out the tweets just as I want them:
outtweets = [[tweet.text] for tweet in new_tweets]
print(outtweets)

Output:

[['@sicaleigh That is false.'], ['RT @ArgonautNews: @mikebonin wants
  more cops on patrol. #LAPD], ["RT @LAHomelessCount: We've exceeded
  7,000 registered volunteers and the # is climbing! Thx all. Let's do
  this and help end homelessness. #t…"]]

(links deleted because SE requires it)
Problem
The problem is this code doesn't work for parsing many accounts. You need to encode them using utf-8 for whatever reason.
Code 2
Here's my modified code to do that
outtweets = [[tweet.text.encode("utf-8")] for tweet in new_tweets]
print(outtweets)

Problem
But this results in a weird set of b's being put in front of my tweets that I don't want.

[[b'@sicaleigh That is false.'], [b'RT @ArgonautNews: @mikebonin wants more cops on patrol. #LAPD], [b"RT @LAHomelessCount: We've exceeded 7,000 registered volunteers and the # is climbing! Thx all. Let's do this and help end homelessness. #t\xe2\x80\xa6"]]

My Question:
Why is this character being added? How do I get rid of it?
In some cases, it is not just a b but an additional set of quotation marks "" around it. So I'm not sure just removing the first character will work


text:
Q: Superpowered: fade-in/fade-out I was looking for a simple fade-in/fade-out in the documentation, but wasn't able to find anything.
Is is it possible to make a fade-in/fade-out on a looping signal with superpowered?
//edit
I am using the CrossExample and I loop sounds in small pulses. I wanna apply a fade-in and fade-out on the looping signal with superpowered.

A: Just set the volume parameter of the player's process() method to 1.0f or 0.0f. The player will smoothly fade within one buffer.
For longer fading, dynamically adjust the volume parameter.

A: Depending on the complexity of the signal, you could probably apply a Superpowered3BandEQ and gradually decrease gain toward -40dB (kill point).


text:
Q: How to stop coerced autocomplete/suggestion in VS Code When I write a code in VS Code it's frequently giving me autosuggestion which is great, but sometimes the very specific thing I'm looking for is not there and I want to discard that suggestion and keep going with what I'm writing. when I press the space bar or the tab key the autosuggestion will take a place; I don't want that, I want to discard the suggestion without disabling the feature.

A: Go to Settings, and in the Text Editor > Suggestions section there will be:

Editor: Accept Suggestion on Commit Character

Un-tick this checkbox and the suggestion will not be completed anymore on characters such as ; or ( etc.

A: In VS 2022, you can still disable the space-bar auto-complete with IntelliSense.
Tools-> Options -> Text Editor/Advanced
Set Default IntelliSense completion mode; to Tab-only.
After restarting VS, this worked for me to stop auto-complete with spacebar.  Now I can type in peace and not worry about random insertions, but tab is still available for auto-complete for the many times I need it as well.