text:
Q: How to print only folder names where same name of file exists I am trying to write a script where all matching file names exist.
For example, I have a file TEST123 in many subfolders under /opt . I have a list of file names. So, I need to print only folder names which has the same file name .
Desired output :
TEST123
/opt/test2
/opt/test3

I am not sure how to use grep command :
I have a list "elements.txt" with full path of file names. And I cutted only the filenames at the end to " onlyfile.txt" .
This is how elements.txt look with many different file names, some of them has duplicated and some dont.
/opt/test2/TEST123
/opt/test3/TEST123
/opt/test2/TEST577
/opt/test6/SUNNY
/opt/test8/SUNNY

This is onlyfile.txt:
TEST123
TEST577
SUNNY
and many more files

And need to loop with the filename , like
for item in `cat onlyfile.txt`
 do
  grep elements.txt
 done

It is giving me all outputs, but I  need only folder names .
Any help would be appreciated.!

A: To get the directory of every file named TEST123, use the find command:
find /opt -name TEST123 -printf "%h\n"

The output will be:
/opt/test2
/opt/test3

The %h specifier will output the directory of the file. See the find manpage for more information.

A: In this case i think you need more than one loop.
for item in `cat onlyfile.txt`; do
    for path in `cat elements.txt |grep $item`; do
            dirname $path
    done
done

First loop iterate filenames
Second loop searches filenames in paths and strip file name from them


text:
Q: Writing with lxml emitting no whitespace even when pretty_print=True I'm using the lxml library to read an xml template, insert/change some elements, and save the resulting xml. One of the elements which I'm creating on the fly using the etree.Element and etree.SubElement methods:
tree = etree.parse(r'xml_archive\templates\metadata_template_pts.xml')
root = tree.getroot()

stream = []
for element in root.iter():
    if isinstance(element.tag, basestring):
        stream.append(element.tag)

        # Find "keywords" element and insert a new "theme" element
        if element.tag == 'keywords' and 'theme' not in stream:
            theme = etree.Element('theme')
            themekt = etree.SubElement(theme, 'themekt').text = 'None'
            for tk in themekeys:
                themekey = etree.SubElement(theme, 'themekey').text = tk
            element.insert(0, theme)

prints to the screen nicely print etree.tostring(theme, pretty_print=True):
<theme>
  <themekt>None</themekt>
  <themekey>Hydrogeology</themekey>
  <themekey>Stratigraphy</themekey>
  <themekey>Floridan aquifer system</themekey>
  <themekey>Geology</themekey>
  <themekey>Regional Groundwater Availability Study</themekey>
  <themekey>USGS</themekey>
  <themekey>United States Geological Survey</themekey>
  <themekey>thickness</themekey>
  <themekey>altitude</themekey>
  <themekey>extent</themekey>
  <themekey>regions</themekey>
  <themekey>upper confining unit</themekey>
  <themekey>FAS</themekey>
  <themekey>base</themekey>
  <themekey>geologic units</themekey>
  <themekey>geology</themekey>
  <themekey>extent</themekey>
  <themekey>inlandWaters</themekey>
</theme>

However, when using etree.ElementTree(root).write(out_xml_file, method='xml', pretty_print=True) to write out the xml, this element gets flattened in the output file:
<theme><themekt>None</themekt><themekey>Hydrogeology</themekey><themekey>Stratigraphy</themekey><themekey>Floridan aquifer system</themekey><themekey>Geology</themekey><themekey>Regional Groundwater Availability Study</themekey><themekey>USGS</themekey><themekey>United States Geological Survey</themekey><themekey>thickness</themekey><themekey>altitude</themekey><themekey>extent</themekey><themekey>regions</themekey><themekey>upper confining unit</themekey><themekey>FAS</themekey><themekey>base</themekey><themekey>geologic units</themekey><themekey>geology</themekey><themekey>extent</themekey><themekey>inlandWaters</themekey></theme>

The rest of the file is written nicely, but this particular element is causing (purely aesthetic) trouble. Any ideas of what I'm doing wrong?

Below is a snippet of markup from the template xml file (save this as "template.xml" to run with code snippet at bottom). The flattening of tags only occurs when I parse an existing file and insert a new element, not when the xml is created from scratch using lxml.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="fgdc_classic.xsl"?>
<metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://water.usgs.gov/GIS/metadata/usgswrd/fgdc-std-001-1998.xsd">
    <keywords>
       <theme>
            <themekt>ISO 19115 Topic Categories</themekt>
            <themekey>environment</themekey>
            <themekey>geoscientificInformation</themekey>
            <themekey>inlandWaters</themekey>
        </theme>
        <place>
            <placekt>None</placekt>
            <placekey>Florida</placekey>
            <placekey>Georgia</placekey>
            <placekey>Alabama</placekey>
            <placekey>South Carolina</placekey>
        </place>
    </keywords>

</metadata>

Below is a snippet of code to be used with the snippet of markup (above):
# Create new theme element to insert into root
themekeys = ['Hydrogeology', 'Stratigraphy', 'inlandWaters']

tree = etree.parse(r'template.xml')
root = tree.getroot()

stream = []
for element in root.iter():
    if isinstance(element.tag, basestring):
        stream.append(element.tag)

        # Edit theme keywords
        if element.tag == 'keywords':
            theme = etree.Element('theme')
            themekt = etree.SubElement(theme, 'themekt').text = 'None'
            for tk in themekeys:
                themekey = etree.SubElement(theme, 'themekey').text = tk
            element.insert(0, theme)

# Write XML to new file
out_xml_file = 'test.xml'
etree.ElementTree(root).write(out_xml_file, method='xml', pretty_print=True)
with open(out_xml_file, 'r') as f:
    lines = f.readlines()

with open(out_xml_file, 'w') as f:
    f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
    for line in lines:
        f.write(line)

A: If you replace this line:
tree = etree.parse(r'template.xml')

with these lines:
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse(r'template.xml', parser)

then it will work as expected. The trick is to use an XMLParser that has the remove_blank_text option set to True. Any existing ignorable whitespace will be removed and will therefore not disrupt the subsequent pretty-printing.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Number of circular placements of $n$ identical letters such that no two letters are adjacent. Suppose I have to place $3$ identical letters on a circular table which has $7$ slots in such a way that no two letters are in consecutive slots. In how many ways can I do this?
Can this be generalized into $n$ identical letters on a circular table with m slots?

A: Whenever you have a circular table, it's easiest to fix the position of one thing that you're placing, then place the rest relative to that position.
So, let's say your letters are $\color{red}{\operatorname{A}}$, $\color{blue}{\operatorname{B}}$, and $\color{green}{\operatorname{C}}$.   Let's fix $\color{red}{\operatorname{A}}$ in position $1$.  There are $6$ remaining positions.
$$\begin{array}{|ccccccc|}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
\color{red}{\operatorname{A}} & \times & \circ & \circ & \circ & \circ & \times \\
\end{array}$$
Note that $1$ is adjacent to $2$ and $7$.  So, neither $\color{blue}{\operatorname{B}}$ nor $\color{green}{\operatorname{C}}$ can go there.  If we place $\color{blue}{\operatorname{B}}$ in position $3$ or position $6$, we see that there are two places available for $\color{green}{\operatorname{C}}$.
$$\begin{array}{|ccccccc|}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
\color{red}{\operatorname{A}} & \times & \color{blue}{\operatorname{B}} & \times & \circ & \circ & \times \\ \hline \color{red}{\operatorname{A}} & \times & \color{blue}{\operatorname{B}} & \times & \color{green}{\operatorname{C}} & \times & \times \\\color{red}{\operatorname{A}} & \times & \color{blue}{\operatorname{B}} & \times & \times & \color{green}{\operatorname{C}} & \times \\
\end{array}\hspace{30pt}\begin{array}{|ccccccc|}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
\color{red}{\operatorname{A}} & \times & \circ & \circ & \times & \color{blue}{\operatorname{B}}  & \times \\ \hline
\color{red}{\operatorname{A}} & \times &  \color{green}{\operatorname{C}} & \times & \times & \color{blue}{\operatorname{B}}  & \times \\ \color{red}{\operatorname{A}} & \times & \times &  \color{green}{\operatorname{C}}& \times & \color{blue}{\operatorname{B}}  & \times \\
\end{array}$$
On the other hand, if $\color{blue}{\operatorname{B}}$ goes into positions $4$ or $5$, then there is only $1$ position left for $\color{green}{\operatorname{C}}$.
$$\begin{array}{|ccccccc|}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
\color{red}{\operatorname{A}} & \times & \times & \color{blue}{\operatorname{B}} & \times & \circ & \times \\ \hline
\color{red}{\operatorname{A}} & \times & \times & \color{blue}{\operatorname{B}} & \times & \color{green}{\operatorname{C}} & \times \\
\end{array}\hspace{30pt}\begin{array}{|ccccccc|}
1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
\color{red}{\operatorname{A}} & \times & \circ & \times & \color{blue}{\operatorname{B}} & \times & \times \\  \hline
\color{red}{\operatorname{A}} & \times & \color{green}{\operatorname{C}}& \times & \color{blue}{\operatorname{B}} & \times & \times \\
\end{array}$$
In each of these final positions, $\color{blue}{\operatorname{B}}$ and $\color{green}{\operatorname{C}}$ can be permuted (i.e. $\color{green}{\operatorname{C}}$ placed before $\color{blue}{\operatorname{B}}$), but doing so only moves us to a solution we already obtained.  (This also holds for the general case: the order of placement does not matter.  Why?) Thus we are left with $$2\times 2 + 2\times 1=6\text{ ways.}$$
Can you extend this counting technique to higher numbers of slots?


text:
Q: Trouble with frame in newcommand I'm making a slideshow with LaTeX beamer class like this :
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{listingsutf8}

\begin{document}

\begin{frame}[fragile]
\frametitle{Découpage et assemblage de lignes}
\begin{lstlisting}[language=bash]
some code
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{Autres opérations}
\begin{lstlisting}[language=bash]
some code
\end{lstlisting}
\end{frame}

\end{document}

For convenient reasons, I would like the code of each frame to be inside a command created with \newcommand like this :
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{listingsutf8}

\newcommand{\framei}{%
\begin{frame}[fragile]
\frametitle{Decoupage et assemblage de lignes}
\begin{lstlisting}[language=bash]
some code
\end{lstlisting}
\end{frame}}

\newcommand{\frameii}{%
\begin{frame}[fragile]
\frametitle{Autres operations}
\begin{lstlisting}[language=bash]
some code
\end{lstlisting}
\end{frame}}

\begin{document}

\framei

\frameii

\end{document}

But when I try to build my slideshow with these modifications, pdftex fail with a  Runaway argument? error.
Is there something wrong with my sources? or is it a LaTeX/beamer bug ?


text:
Q: Python: class not callable from separate file? I have a class, robot, in a file called robot.py
I want to create a robot instance in my main script like so:
in robot.py:
class robot(object):
    def __init__(self,pygame,screen_width,screen_height):

in main.py:
import pygame, sys, copy
import mouse
import robot
import menu
import button
from pygame.locals import *
...
size = [1200,900]
my_robot = robot(pygame,size[0]-400,size[1]-100)

error:
me:cup-robot Me$ python run.py
Traceback (most recent call last):
  File "run.py", line 24, in <module>
    my_robot = robot(pygame,size[0]-400,size[1]-100)
TypeError: 'module' object is not callable

how do I do this?

A: Change your import statement:
from robot import robot

You have robot defined both as a module (robot.py) as well as a class.  You need to import the class from the module so it is publicly available.

A: Two choices :
import robot and then prefix all with robot :
my_robot = robot.robot(pygame,size[0]-400,size[1]-100)

or
from robot import robot and then your code should work. But then, you can see that you won't be able to distinguish if robot is a module or the class, so you should not name the class and the file with the same name.


text:
Q: Writing Windows Service in C# .NET Core for Windows & Azure Cloud Background: We have developed a Windows Service in C# .NET 4.5. The service does two jobs at once.

*

*It communicates with LDAP and reads the user statuses and updates in the Database.

*It communicates with the Database and rolls out items to users.

Requirement: We have got the opportunity to rewrite the service in .NET Core. We need to write the service to achieve the following targets.

*

*The old clients who are using their own infrastructure could install and use the service like they are doing now.

*The clients who are using CLOUD should be able to install it on the cloud. But I don't think for a single service we are required to use VM. Is there a better way to handle this scenario?

*The service's 1st part is communicating with LDAP. Clients who are using the cloud, definitely have the database hosted on the cloud along with the other Web Applications but where should be the service installed so it can easily communicate with the LDAP as well as with the database (2nd part)?

I heard about the background worker process. Does the windows service be used as a background worker process and as a windows service at the same time?

A: For .NET Core take a look at Microsoft.Extensions.Hosting.BackgroundService for windows services.
As far as the Cloud issue I assume it would depend on how the customer is setup.  If LDAP is still on-prem, I assume it would be easier to have the service running on-prem as they would probably have a connection to the VPC on the Cloud where the database is hosted.
If everything exists on the Cloud then I assume it would the depend on the provider how you can run the service?  Small EC2 instance on Amazon, on Azure you might have to use a VM or maybe look at a WebJob on an AppService, not very familiar with Google.
Hope this helps.


text:
Q: Make TextField/TextArea caret visible in JavaFX GUI I was wondering how to make the caret visible and/or flash whilst using a TextField or TextArea. The ones I have created in my GUI work as the letters appear when typed but there is no visible caret.
I've looked through the TextField documentation but none are about making it visible or not. I expected to find something along the lines "setCaretVisible(Boolean);"
Do I have to make it visible via CSS? If so, any suggestions would be most welcome!
Please see code that I've quickly put together to illustrate the problem:
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.event.ActionEvent;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class Test extends Application {
    public static void main(String[] arguments) { launch(arguments); }

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.setRoot(new BuildLayout(stage));

        stage.setTitle("Application Name");
        stage.setScene(scene);
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initStyle(StageStyle.TRANSPARENT);
        stage.setFullScreen(true);
        stage.setFullScreenExitHint("");
        stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
        stage.show();
    }
}

final class BuildLayout extends BorderPane {
    protected BuildLayout(Stage stage) {
        TabPane tabpane = new TabPane();

        Tab tab = new Tab();
        tab.setGraphic(new Text("Video Browser"));
        tab.setClosable(false);
        tab.setContent(new Input(1));

        tabpane.getTabs().addAll(tab);
        setTop(new Toolbar(stage));
        setCenter(tabpane);
    }
}

final class Input extends VBox {
    Input(int id) {
        HBox hbox = new HBox();
        TextField videoTitle = new TextField("video_title");
        TextArea description = new TextArea( "video_description");
        Button share = new Button("share");
        Button unshare = new Button("unshare");

        setPadding(new Insets(5,10,10,5));
        setAlignment(Pos.TOP_CENTER);

        hbox.getChildren().addAll(videoTitle, new Text("   Creator: " + "   Date: " + "   Views: " + "   "));

        if(true) {
            videoTitle.setEditable(true);
            description.setEditable(true);
            if(true) {
                hbox.getChildren().add(share);
            } else { hbox.getChildren().add(unshare); }
        }
        getChildren().addAll(hbox, description);
    }
}

final class Toolbar extends HBox {
    protected Toolbar(Stage stage) {
        Button close = new Button("close");
        close.setOnAction((ActionEvent e) -> { stage.close(); });

        setAlignment(Pos.CENTER_LEFT);
        getChildren().addAll(close);
    }
}

Many thanks,

A: This problem only occurs on Mac and not Windows (untested Linux). The fix is to downgrade to a JavaFX 2.2 compliant maximised window as the setMaximized() from JavaFX 8 also isn't Mac compatible.
Modifying the start method with some code found here:
@Override public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setRoot(new BuildLayout(stage));

    Screen screen = Screen.getPrimary();
    Rectangle2D bounds = screen.getVisualBounds();

    stage.setTitle("Application Name");
    stage.setScene(scene);
    stage.setX(bounds.getMinX());
    stage.setY(bounds.getMinY());
    stage.setWidth(bounds.getWidth());
    stage.setHeight(bounds.getHeight());
    stage.show();
}

Produces a fullscreen application with visible and flashing caret.


text:
Q: How create JAR from upstream Web App as Dependency for downstream Web App I have (amongst other modules) a NetBeans8.1 Maven web app project CoreWeb that (with other module dependencies resolved) runs standalone fine, and is supposed to under any circumstances at least build its default WAR and run standalone.
I have a 2nd NetBeans8.1 Maven web app project SpecWeb that depends on CoreWeb; it is to reuse both JSF managed beans from CoreWeb and also leverage XHTML composite component JSF resources from CoreWeb.
But on building SpecWeb it does not resolve the CoreWeb dependency, because CoreWeb does not (by default) also build a JAR:
Failed to execute goal on project SpecWeb: Could not resolve dependencies
for project com.example.multi:SpecWeb:war:1.0-SNAPSHOT: Could not find
artifact com.example.multi:CoreWeb:jar:1.0-SNAPSHOT -> [Help 1]

(I had this problem with an Ant version of my project with multiple modules and solved it using a small piece of Ant task script to build the extra JAR from CoreWeb for use in SpecWeb, worked perfectly.)
Q: How can I generate a JAR (as well as the WAR) from CoreWeb for use in SpecWeb ?
Under Project > Actions: Build Project I've tried adding various additional goals to install for the Build Project action (using the NetBeans prompting feature).
Using install jar:jar did not work. It indeed created a JAR (as well as the WAR), but that JAR only included the managed bean classes, not the resources, and on build from the "downstream" SpecWeb it still failed to find it:
$ jar tf target/CoreWeb-1.0-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/example/
com/example/multi/
.. Java managed bean classes ..

META-INF/maven/
META-INF/maven/com.example.multi/
META-INF/maven/com.example.multi/CoreWeb/
META-INF/maven/com.example.multi/CoreWeb/pom.xml
META-INF/maven/com.example.multi/CoreWeb/pom.properties

I get the same JAR structure built (without JSF XHTML composite component web resources) if I manually change the packaging in the pom.xml to jar:
<groupId>com.example.multi</groupId>
<artifactId>CoreWeb</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<!--
<packaging>war</packaging>
-->

EDIT: Overlays also not working (in NetBeans)
I have also tried using Overlays, but it's not working as expected. As soon
as I turn the dependency into type war NetBeans can't resolve classes from CoreWeb imported into classes from SpecWeb, and it won't even compile (and the class files have NetBeans Java warnings because of the failed import):
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>CoreWeb</artifactId>
        <version>${project.version}</version>
        <type>war</type>
    </dependency>

Also, as soon I enter <type>war</type> the CoreWeb project vanishes from the list under the project navigator node SpecWeb > Dependencies.

Also tried Warpath plugin
NetBeans still does not see classes in CoreWeb imported into classes in SpecWeb, so SpecWeb won't compile.

A: After lot of research (mostly on the main Maven site) and trial and error, I have found a robust solution compatible with NetBeans.
A general description of the strategy. The trick is to create an additional "client" JAR version of the CoreWeb project for temporary use by the SpecWeb project (enabling NetBeans editor to "see" the classes of CoreWeb), and declare it as an additional dependency of only 'provided' scope (so it does not make it into the final SpecWeb WAR). Then also use overlays to combine both the composite components of CoreWeb and the managed beans of CoreWeb with the SpecWeb project into the final WAR, being careful to exclude the index.xhtml from CoreWeb.
Steps
In the pom.xml from CoreWeb include this:
        <!-- Also make JAR form using classifier during package phase -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.0.2</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <classifier>client</classifier>
                    </configuration>
                </execution>
            </executions>
        </plugin>

On build this will create:
 $ ls -1 CoreWeb/target/CoreW*
 CoreWeb/target/CoreWeb-1.0-SNAPSHOT-client.jar
 CoreWeb/target/CoreWeb-1.0-SNAPSHOT.war

 CoreWeb/target/CoreWeb-1.0-SNAPSHOT:
 META-INF/
 WEB-INF/
 index.xhtml
 resources/

(Note NetBeans can run CoreWeb independently directly over CoreWeb/target/CoreWeb-1.0-SNAPSHOT with its own index.xhtml.)
SpecWeb can then use CoreWeb-1.0-SNAPSHOT-client.jar thus in its pom.xml:
<dependencies>

   ...

    <!-- This is needed for the editor and for the compilation only (not at runtime) -->
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>CoreWeb</artifactId>
        <version>${project.version}</version>
        <type>jar</type>
        <classifier>client</classifier>
        <scope>provided</scope> <!-- To prevent being written even to target folder -->
    </dependency>

    <!-- This is needed for the overlay -->
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>CoreWeb</artifactId>
        <version>${project.version}</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>

Note how there are 2 separate types of dependency of SpecWeb on CoreWeb:

*

*A dependency on the CoreWeb-1.0-SNAPSHOT-client.jar using the classifier client and with scope runtime (so it won't be included under /target at all). This will appear in the NetBeans project window under a special node Non-Path Dependencies, with a clear indication that it is for [runtime] only.

*A dependency on the CoreWeb-1.0-SNAPSHOT.war for the overlay to use. This will appear in the NetBeans project window under the node Dependencies.
Then also in the pom.xml for SpecWeb specify the overlays (excluding the CoreWeb's index.html) and packaging (to be sure also excluding any "client" jars):
  <build>
     <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>

                <packagingExcludes>WEB-INF/lib/*-client.jar</packagingExcludes>

                <overlays>
                    <overlay>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>CoreWeb</artifactId>
                        <excludes>
                            <exclude>index.xhtml</exclude>
                        </excludes>
                    </overlay>
                    <overlay>
                        <!-- empty groupId/artifactId represents the current build -->
                    </overlay>
                </overlays>
            </configuration>
        </plugin>

The SpecWeb project behaves correctly in the NetBeans editor (classes from CoreWeb are seen), compiles ok, and can be run over SpecWeb/target/SpecWeb-1.0-SNAPSHOT with its own index.html, with access to both the JSF managed beans and JSF composite components of CoreWeb.
CAVEAT: NetBeans XHTML editor will complain when editing JSF pages from SpecWeb that the composite components provided by CoreWeb don't exist because of this known NetBeans Bug 257684 - JSF 2 composite components in JAR are not recognized , but the project will still run ok.


text:
Q: Запись данных PHP в файл txt Есть чекбоксы (их порядка 50 штук), которые передают данные в php файл, и эти данные нужно сохранить, я что то наковырял, и получается что после отправки формы с боксами, выходит файл php и в строку названия декоров, и сразу же сохранятся в файл.
Проблема в том что

*

*сохраняется только последний декор (последнее значение), а не все

*как убрать страницу php файла а вместо нее сделать просто страницу (сделаю сам) где благодарю за участие в опросе

как это выглядит можете посмотреть тут https://getalit.000webhostapp.com/index.html
<form action="decor.php" method="post">
<input type="checkbox" name="answer[]" value="L 115 [T]" id="abc">
L 115 [T]

<input type="checkbox" name="answer[]" value="L 245 [T]" id="abc">
L 245 [T]

<input type="checkbox" name="answer[]" value="L 441 [T]" id="abc">
L 441 [T]

<input type="image" src="pic/button.png" alt="Отправить опрос" width="200">

    <?php
$name = $_POST['answer'];
foreach ($name as $answer){
    echo $answer."\n \n";
}
$user = fopen("result.txt","a+");
fwrite($user,"\n $answer \n"  . PHP_EOL);
fclose($user);
?>

A: $answer содержит последнее значение, которое вы зачем то используете вне цикла. Вы выводите результат почему то в цикле (вероятно для проверки), а сохраняете вне его. Делайте это тоже в цикле.
Правда не знаю как вы после этого будете в куче этих L 245 [T] разбираться. Данные лучше хранить в удобночитаемом для скрипта или человека виде, чтобы можно было потом обработать. И лучше в БД, а не в файлах.
Редирект делается с помощью установки заголовков функцией header().
<?php

$name = $_POST['answer'];

$user = fopen("result.txt", "a+");

foreach ($name as $answer) {
    //echo $answer . "\n \n";
    fwrite($user, "\n $answer \n" . PHP_EOL);
}

fclose($user);

header('Location: thanks.html');


text:
Q: Is there a way to define the pin with an input? I'm trying to program a kind of dmx controller, therefore I got a RaspberryPi and now I want to write a program to controlle a GPIO with pi4j. The idea is to ask for the GPIO that should be the output, save it in a int and reuse this to tell pi4j which GPIO I would like to be the Output.
Sorry for the bad code :)
I'm a native Germanspeaker so the println are in German.
System.out.println("GPIO des DMX Outputs :");

BufferedReader br_dmx_out = new BufferedReader(new InputStreamReader(System.in));

int dmx_out = Integer.parseInt(br_dmx_out.readLine());

System.out.println("Der DMX Output GPIO ist also GPIO " + dmx_out);

// GPIO Controll

String predef = ""+dmx_out;
/*
String def = MessageFormat.format("RaspiPin.GPIO_0{0}",predef);
System.out.println(def);
*/
Pin pin_dmx = "RaspiPin.GPIO_0"+ predef;

GpioController gpio = GpioFactory.getInstance();

GpioPinDigitalOutput dmx_output = gpio.provisionDigitalOutputPin(pin_dmx);

Normaly you code:

GpioPinDigitalOutput dmx_output = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01);

Java says:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    Type mismatch: cannot convert from String to Pin

    at test.main(test.java:44)

I also tried a switch/case but this wouldn't either
GpioController gpio = GpioFactory.getInstance();

switch(dmx_out)
{
case 2:
    GpioPinDigitalOutput dmx_output = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02);
    break;

Java's error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    Duplicate local variable dmx_output
    dmx_output cannot be resolved
    dmx_output cannot be resolved

    at test.main(test.java:59)

A: You are trying to assign a String to the Pin interface.
https://pi4j.com/1.2/apidocs/com/pi4j/io/gpio/Pin.html
To get an implementation of it you might want to call the constructor of PinImpl as in the following example:
https://github.com/Pi4J/pi4j/blob/master/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/mcp/MCP3204Pin.java


text:
Q: A jquery countdown issue I am using countdown timer in my project.
I want to make a 30 day counter.
Javascript function is as follows..
$(document).ready(function(){
            JBCountDown({
                secondsColor : "#ffdc50",
                secondsGlow  : "none",

                minutesColor : "#9cdb7d",
                minutesGlow  : "none",

                hoursColor   : "#378cff",
                hoursGlow    : "none",

                daysColor    : "#ff6565",
                daysGlow     : "none",

                startDate   : "1385722978",
                endDate     : "1388314978",
                now         : "1385722978"
            });
        });

This function takes 3 parameters at last..
startDate,endDate and now..
i made a 30 day difference between startDate and endDate..
but confused about how to set current time in seconds..

A: I think the simplest way would be this .
var current = new Date();

    var seconds = (+current.getHours() * 60 * 60 + (+current.getMinutes() * 60 + (+current.getSeconds());
console.log(seconds)

A: Not sure what the JBCountDown does, as you have not provided the code...
On first look the times seem off in terms of how it is used in javascript.. (they should have 3 more digits..)
To get the current date try  new Date().getTime()
And if you want it in the format of your plugin just devide by 1000, so new Date().getTime()/1000

If you want to set the now parameter then try now : parseInt(new Date().getTime(),10)


text:
Q: How to swap largest and smallest number in multidimensional array? I'm writing a program that swaps largest and smallest number in multidimensional array. Largest number should be on the place where is the smallest, and smallest where is the largest, and the idea is to use pure logic, without any php function that could help me out.
Please check my code and help me about this problem.
For instance:
$array = [
  [45, 456, 321, 344, 567],
  [100, 434, 173, 400, 789],
  [191, 211, 457, 809, 900],
  [431, 323, 432, 805, 906],
  [708, 232, 897, 101, 696]
];

New order should be:
$array = [
  [906, 456, 321, 344, 567],
  [100, 434, 173, 400, 789],
  [191, 211, 457, 809, 900],
  [431, 323, 432, 805, 45],
  [708, 232, 897, 101, 696]
]

I've tried with adding and changing code with this piece of code, but it doesn't give me right results...
$min_index = $max_index = 0;
foreach($array as $k => $v){
    if($v < $array[$min_index]){
        $min_index = $k;
    }
    if($v > $array[$max_index]){
        $max_index = $k;
    }
}
$min = $array[$min_index];
$array[$min_index] = $array[$max_index];
$array[$max_index] = $min;

$array = [
  [45, 456, 321, 344, 567],
  [100, 434, 173, 400, 789],
  [191, 211, 457, 809, 900],
  [431, 323, 432, 805, 906],
  [708, 232, 897, 101, 696]
];

$intRows = 4;
$intCols = 4;

$intMaxRow = $intMinRow = $intMaxCol = $intMinCol = 0;

$minIndex = $maxIndex = 1;

for($row = 0; $row < $intRows; $row++)
{
  for($col = 0; $col < $intCols; $col++)
  {
    if($array[$row][$col] > $maxIndex)
    {
      $maxIndex = $array[$row][$col];
      $intMaxRow = $row;
      $intMaxCol = $col;
    }
    if($array[$row][$col] < $minIndex)
    {
      $minIndex = $array[$row][$col];
      $intMinRow = $row;
      $intMinCol = $col;
    }
  }
}

$arrNxm[$intMinRow][$intMinCol] = $minIndex;
$arrNxm[$intMaxRow][$intMaxCol] = $maxIndex;

echo "
";
var_dump($arrNxm);
echo "
";

A: You've got some logical issues in your code which is causing it to not work.  You are going along the right lines though.
Issue 1
You have set the number of rows and columns incorrectly.  There are not 4, there are 5 of each:
$intRows = 5;
$intCols = 5;

Issue 2
The next issue is with:
$minIndex = $maxIndex = 1;

If $minIndex is 1, then nothing in your array can be lower than it, so it's never going to be updated from 1.  This should be something like:
$minIndex = 100000; // This is an arbitrary choice to fix the issue
$maxIndex = 1;

Issue 3
Next, you use $arrNxm in your code.  There is no $arrNxm, it should be $array.
Issue 4
Finally, this is wrong because you are putting the minimum value back into the minimum position in the array:
$arrNxm[$intMinRow][$intMinCol] = $minIndex;
$arrNxm[$intMaxRow][$intMaxCol] = $maxIndex;

You just need to swap $minIndex and $maxIndex around:
$array[$intMinRow][$intMinCol] = $maxIndex;
$array[$intMaxRow][$intMaxCol] = $minIndex;

Full code
The fully working code is:
$array = [
  [45, 456, 321, 344, 567],
  [100, 434, 173, 400, 789],
  [191, 211, 457, 809, 900],
  [431, 323, 432, 805, 906],
  [708, 232, 897, 101, 696]
];

$intRows = 5;
$intCols = 5;

$intMaxRow = $intMinRow = $intMaxCol = $intMinCol = 0;

$minIndex = 100000;
$maxIndex = 1;

for($row = 0; $row < $intRows; $row++)
{
  for($col = 0; $col < $intCols; $col++)
  {
    if($array[$row][$col] > $maxIndex)
    {
      $maxIndex = $array[$row][$col];
      $intMaxRow = $row;
      $intMaxCol = $col;
    }
    if($array[$row][$col] < $minIndex)
    {
      $minIndex = $array[$row][$col];
      $intMinRow = $row;
      $intMinCol = $col;
    }
  }
}

$array[$intMinRow][$intMinCol] = $maxIndex;
$array[$intMaxRow][$intMaxCol] = $minIndex;

echo "
";
var_dump($array);
echo "
";

This outputs:
array(5) {
  [0]=>
  array(5) {
    [0]=>
    int(906)
    [1]=>
    int(456)
    [2]=>
    int(321)
    [3]=>
    int(344)
    [4]=>
    int(567)
  }
  [1]=>
  array(5) {
    [0]=>
    int(100)
    [1]=>
    int(434)
    [2]=>
    int(173)
    [3]=>
    int(400)
    [4]=>
    int(789)
  }
  [2]=>
  array(5) {
    [0]=>
    int(191)
    [1]=>
    int(211)
    [2]=>
    int(457)
    [3]=>
    int(809)
    [4]=>
    int(900)
  }
  [3]=>
  array(5) {
    [0]=>
    int(431)
    [1]=>
    int(323)
    [2]=>
    int(432)
    [3]=>
    int(805)
    [4]=>
    int(45)
  }
  [4]=>
  array(5) {
    [0]=>
    int(708)
    [1]=>
    int(232)
    [2]=>
    int(897)
    [3]=>
    int(101)
    [4]=>
    int(696)
  }
}

Whereby 45 and 906 are swapped in position as you wanted.


text:
Q: Loop method until it returns falsey I was trying to make my bubble sort shorter and I came up with this
class Array
  def bubble_sort!(&block)
    block = Proc.new { |a, b| a <=> b } unless block_given?
    sorted = each_index.each_cons(2).none? do |i, next_i|
      if block.call(self[i], self[next_i]) == 1
        self[i], self[next_i] = self[next_i], self[i]
      end
    end until sorted
    self
  end

  def bubble_sort(&prc)
    self.dup.bubble_sort!(&prc)
  end
end

I don't particularly like the thing with sorted = --sort code-- until sorted.
I just want to run the each_index.each_cons(s).none? code until it returns true. It's a weird situation that I use until, but the condition is a code I want to run. Any way, my try seems awkward, and ruby usually has a nice concise way of putting things. Is there a better way to do this?

A: This is just my opinion
have you ever read the ruby source code of each and map to understand what they do?
No, because they have a clear task expressed from the method name and if you test them, they will take an object, some parameters and then return a value to you.
For example if I want to test the String method split()
s = "a new string"
s.split("new")
=> ["a ", " string"]

Do you know if .split() takes a block?
It is one of the core ruby methods, but to call it I don't pass a block 90% of the times, I can understand what it does from the name .split() and from the return value
Focus on the objects you are using, the task the methods should accomplish and their return values.
I read your code and I can not refactor it, I hardly can understand what the code does.
I decided to write down some points, with possibility to follow up:
1) do not use the proc for now, first get the Object Oriented code clean.
2) split bubble_sort! into several methods, each one with a clear task
def ordered_inverted! (bubble_sort!), def invert_values, maybe perform a invert_values until sorted, check if existing methods already perform this sorting functionality
3) write specs for those methods, tdd will push you to keep methods simple and easy to test
4) If those methods do not belong to the Array class, include them in the appropriate class, sometimes overly complicated methods are just performing simple String operations.
5) Reading books about refactoring may actually help more then trying to force the usage of proc and functional programming when not necessary.

A: After looking into it further I'm fairly sure the best solution is
loop do
  break if condition
end

Either that or the way I have it in the question, but I think the loop do version is clearer.
Edit:
Ha, a couple weeks later after I settled for the loop do solution, I stumbled into a better one. You can just use a while or until loop with an empty block like this:
while condition; end

until condition; end

So the bubble sort example in the question can be written like this
class Array
  def bubble_sort!(&block)
    block = Proc.new { |a, b| a <=> b } unless block_given?
    until (each_index.each_cons(2).none? do |i, next_i|
      if block.call(self[i], self[next_i]) == 1
        self[i], self[next_i] = self[next_i], self[i]
      end
    end); end
    self
  end

  def bubble_sort(&prc)
    self.dup.bubble_sort!(&prc)
  end
end


text:
Q: CSS conflict within a span - can't fix. Any offer a solution? I have a radio button with text next to and a label wrapped around so that when the text or button are clicked it becomes active.
When inactive, I want part of the text to be standard colour and some of the other text a different colour so I have a span inside that span.
Once active, the style changes on the text to make it a bolder font and all orange. But the inner span goes unaffected.
Can anybody help? Alternative to span on inner text?

    <input type="radio" name="group1" class="class-name" />
    Lorem Ipsum

&
.class-name input:checked + span {
  font-family: "bold-font-family", sans-serif;
  color: #f26900 !important;
}

.light-grey {
  color: #838383;
  display: inline;
}

Styling the whole line of text in a p tag won't work for what I'm doing.

A: You can use the below to apply the style to the inner span also.
:checked + span, :checked + span > span {
  font-family: "bold-font-family", sans-serif;
  color: #f26900;
}

+  is for selecting the adjacent sibling directly after the input. > is to select the child span of the span that is the adjacent sibling of the input.
Sample Fiddle


text:
Q: Command find and convert using ffmpeg I would like to combine the two following commands to find mp4 files and convert them to mp3 and save them with same name.
The two command line:
find ./ -name '*.mp4'
ffmpeg -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3

A: With find's -exec functionality:
find ./ -name '*.mp4' -exec bash -c 'ffmpeg -i $0 -vn -acodec libmp3lame -ac 2 \
-ab 160k -ar 48000 ${0/mp4/mp3}' {} \;

This should make xyz.mp4 to xyz.mp3.


text:
Q: Regular Expression to search and replace in notepad ++ If i have a line of text that i want to remove from a text file in notepad and it is always formatted like this
[text]:
except that the words in the text area change. what is a regular expression i could create to remove the whole section with the search and replace function in notepad?

A: To delete the entire line starting with [any text]: you can use: ^[\t ]*\[.*?\]:.*?\r\n
Explanation:
^ ... start search at beginning of a line (in this case).
[\t ]* ... find 0 or more tabs or spaces.
\[ ... find the opening square bracket as literal character.
.*? ... find 0 or more characters except the new line characters carriage return and line-feed non greedy which means as less characters as possible to get a positive match, i.e. stop matching on first occurrence of following ] in the search expression.
\]: ... find the closing square bracket as literal character and a colon.
.*?\r\n ... find 0 or more characters except the new line characters and finally also the carriage return and line-feed terminating the line.
The search string ^[\t ]*\[.*?\]:.*?$ would find also the complete line, but without matching also the line termination.
The replace string is for both search strings an empty string.

A: If by removing the entire section, you mean remove the [text]: up to the next [otherText]:, you can try this:
\[text\]:((?!\[[^\]]*\]:).)*

Remember to set the flag for ". matches newline".
This regex basically first matches your section title. Then, it would start matching right after this title and for each character, it uses a negative lookahead to check if the string following this character looks like a section title. If it does the matching is terminated.
Note: Remember that this regex would replace all occurrences of the matched pattern. In other words, if you have more than one of that section, they are both replaced.


text:
Q: Chrome adding gray outline to printed transparent png/gif I'm working on a printing template in the browser for print-to-pdf, and am using a transparent .png overlay in one section.
This happens both with transparent .png files and transparent .gif files:
Chrome, when printing (both to .pdf, and in the print preview window), seems to outline transparent images with a 1px gray line:
Exhibit A:

I've tried this in several other browsers (including Safari) and none appear to do what Chrome does. Has anyone seen this before? I need to find a way to disable it or hack it on the Chrome side so that this will work across browsers.
To see this in action, click here: http://jsfiddle.net/brandonscript/nELwd/ (just an  tag) and press Cmd/Ctrl+P to bring up the print preview. You'll see this in the preview and if you print to .pdf. Make sure you have "Background colors and images" enabled, or you won't see any images.
Note: I'm not looking for workarounds after it's been printed and I'm aware that if you size the image to 100% and view the .pdf at 100% zoom you don't see the gray line. I need to programmatically (or otherwise) remove the gray line prior to printing the .pdf.

A: I have experimented enough and considered all the answers above while doing so.
Suspiciously, Upon saving your image and opening in gimp and some pokes into it, What I found was this.

Which makes me think that your image in truth, containing the gray border around it. My suggestion is you remove that layer and make that empty space around the actual image to transparent.
EDIT(response to @remus comment)
I do not know if my claim is correct, but I am believing that the image is not what you are expecting it to be. You need to correct that image. I have tested with another image of mine, pasted on the fiddle is not having any border around it in screen and print preview. (And the final pdf too). Sorry if this Answer is correct and hurts you.

A: Though I haven't come across this exact issue, I do a lot of work with css printing (for pdf and browser printing) and more often than not I have to use 2 images: 1 for screen and 1 for printing (do not use transparency for the printing one in yuour case):

in your main css file:
img.forPrinting { display:none }

in your print css file which should be declared after your main css file:
img.screen {display:none }
img.forPrinting { display:block; }

A: Short Answer:
Change your PDF printing preset to a higher resolution.
you'll get:

The Long version:
I noticed you have re-sized the image by changing its width height properties in the HTML code.
So I made sure your image is exactly in the size you need it and it will not have this strange contour.
See Link: jsfiddle.net/cyVqw/
I have a print preview:
PDF screenshot:

To verify that in any size the PDF will keep your image transparency I checked
PDF saved in a Higher resolution preset i.e. "Print Quality". this resulted in a large file but with better zooming quality:
Here is High Resolution 33% preview:

High Resolution 200% preview

So, what you need to do is to adjust your PDF quality preset.


text:
Q: Find the index of the List items - WP7 I have listbox which contains buttons listed vertically with related datas as given below;
<ListBox Name="CTransactionList" Margin="0,0,0,0"   >
                    <ListBox.ItemTemplate >
                        <DataTemplate>
                            <Button Width="400" Height="200" Background="#6A040B2E" Click="completetransact">
                                <Button.Content >
                                    <StackPanel Orientation="Horizontal" Height="200" Width="400">
                                        <Image Source="{Binding Type1}" Width="80" Height="80" VerticalAlignment="Top" Margin="0,40,0,0"/>
                                        <StackPanel Orientation="Vertical" Height="200">
                                            <StackPanel Orientation="Horizontal" Height="30">
                                                <TextBlock Width="100" FontSize="22" Text="Name:" Height="30"/>
                                                <TextBlock Width="200" FontSize="22" Text="{Binding Date1}" Height="30"/>

                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Height="30">
                                                <TextBlock Width="100" FontSize="22" Text="Difficulty:" Height="30"/>
                                                <TextBlock Width="200" FontSize="22" Text="{Binding Amount1}" Height="30"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Height="30">
                                                <TextBlock Width="110" FontSize="22" Text="TotalTime:" Height="30"/>
                                                <TextBlock Width="200" FontSize="22" Text="{Binding Time1}" Height="30"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Height="30">
                                                <TextBlock Width="100" FontSize="22" Text="Distance:" Height="30"/>
                                                <TextBlock Width="200" FontSize="22" Text="{Binding Dis1}" Height="30"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Height="65">

                                                <TextBlock Width="290" FontSize="14" Text="{Binding Def1}" Height="65" TextWrapping="Wrap" FontStyle="Italic"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </StackPanel>
                                </Button.Content>
                            </Button>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

                </ListBox>

And I'm binding the data with such classes;
[DataContract]
    public class CTransaction
    {
        [DataMember]
        public String Date1 { get; set; }
        [DataMember]
        public String Amount1 { get; set; }
        [DataMember]
        public String Type1 { get; set; }
        [DataMember]
        public String Time1 { get; set; }
        [DataMember]
        public String Dis1 { get; set; }
        [DataMember]
        public String Def1 { get; set; }
        [DataMember]
        public String Cdate1 { get; set; }
        [DataMember]
        public String Strpt1 { get; set; }
        [DataMember]
        public String Endpt1 { get; set; }
        [DataMember]
        public int Index1 { get; set; }

        public CTransaction(String date1, String amount1, String type1, String time1, String dis1, String def1, String cdate1, String strpt1, String endpt1,int index1)
        {
            this.Date1 = date1;
            this.Amount1 = amount1;
            this.Time1 = time1;
            this.Dis1 = dis1;
            this.Def1 = def1;
            this.Cdate1 = cdate1;
            this.Strpt1 = strpt1;
            this.Endpt1 = endpt1;
            this.Index1 = index1;
            switch (type1)
            {
                case "FR":
                    this.Type1 = "Images/a.png";
                    break;

                case "TA":
                    this.Type1 = "Images/b.png";
                    break;

                case "DA":
                    this.Type1 = "Images/c.png";
                    break;

                case "CC":
                    this.Type1 = "Images/mount.png";
                    break;
            }
        }
    }

As shown above, I have a data binding named Index1 which indexes the button with an arbitrary integer. I want to remove a specified indexed button by user with this code;
ctransactionList.RemoveAt("index comes here");

My exact desire is to remove the clicked button,(i.e. if the second button clicked, then remove the second one). And I tried to embed some indexes(i.e. Index1) in it to remove it, I couldn't find any possible way; I also failed again.
This is the way I tried;
The removal code given above only removes the indexed item based on the whole list item count. I mean, for example, the first element always has the '0' index. It does not care my Index1 data.(I can retrieve the Index1 data with selectedButton as sender method) I wish I could have removed the button which includes the user-specified Index1 data.
How can I do this?
Thanks in advance.
(Windows Phone 7)

A: You can do this by adding click event handler for button:
private void Button_Click(object sender, RoutedEventArgs e)
{
    var button = sender as Button;
    var item = button.DataContext as CTransaction;
    if (item != null)
    {
      ctransactionList.Remove(item);
    }
}

ctransactionList should be an ObservableCollection.


text:
Q: Quantifying non-bipartiteness Suppose I have a graph that is bipartite, except for one edge.  That is, if this one edge were deleted, the graph would be bipartite.  This graph is 'almost' or 'very nearly' bipartite.
A complete graph on many vertices, on the other hand, is extremely non-bipartite, because many edges would need to be deleted to have a bipartite graph.

*

*Does the 'degree of non-bipartiteness' have a name?

*What, if anything, is known about 'nearly bipartite' graphs?

A: I've read many papers which studied the number of edges that need to be deleted to make a graph bipartite, and none of them had good terminology for it (there is various notation, but nothing that's generally known). On the other hand, there are some interesting results.
Approximately the best thing we can say in general is that if the graph has $m$ edges, we need to delete at most $\frac m2$. (In other words, there is a bipartite graph containing at least half the edges.) This has a probabilistic proof: if we partition the vertex set into two halves randomly and only keep the edges between the two halves, then $\frac m2$ edges are kept in expectation, so there must be some way to keep at least $\frac m2$ edges.
To say more things, we need to add other conditions. One interesting question is: if a graph is triangle-free, how close is it to being bipartite?
We know from Turán's theorem that the most edges a triangle-free graph on $n$ vertices can have is $n^2/4$; the only graph that achieves this is $K_{n/2,n/2}$, which is already bipartite. Brouwer (1981, Some lotto numbers from an extension of Turán's theorem) proves that even if a triangle-free graph has around $n^2/4 - n/2 + 2$ edges, slightly fewer, it must already be bipartite.
For smaller graphs, Erdős, Faudree, Pach, Spencer (1988, How to make a graph bipartite) prove some general bounds: if the triangle-free graph has $n$ vertices and $m$ edges, we can make it bipartite by deleting at most
$$
    \min \left\{ \frac m2 - \frac{2m(2m^2 - n^3)}{n^2(n^2-2m)}, m - \frac{4m^2}{n^2}\right\}
$$
edges. The first part of the $\min$ strengthens the $\frac m2$ claim for general graphs; the second part is good when $m$ is close to $\frac{n^2}{4}$. A slightly weaker version of the second part is that a triangle-free graph with $n^2/4-t$ edges can be made bipartite by deleting $t$ more edges.
Füredi (2015, A proof of the stability of extremal graphs, Simonovits' stability from Szemerédi's regularity) proved a generalization of this for $K_{r+1}$-free graphs: if they're $t$ edges away from the maximum number they could have, then they can be made $r$-partite by deleting $t$ more edges.

A: A graph is bipartite if and only if it has no odd-length cycle, so an almost bipartite graph either has exactly one odd cycle, or it has more than one odd cycle and they all share a common edge.


text:
Q: linear regression on calculator I have the equation T(t)=T_0 e^kt . and some coordinates (t,T). t: (10,20,30,40,50,60). (T: 45,40,37,33,27,24)
I transform it to y = ae^bx = lna+bx.
I then change the coordinates to the form (x, lny) and use the stat function of my calc to plot in the coordinates.
I get a= 3.981, b= -0.0003636
how do I find the value for a and k? I thought since y = ae^bx is the same form as T(t)= T_0e^kt , a would qual to T_0, and b would equal to k, but in the solutions manual it says that k = -0.127 with no further explanation. Am I supposed to do something with the a and b value to get the right answer?
Im using a casio fx9860GII

A: You wrote : I transform it to y = ae^bx = lna+bx.
This is not correct. You should have written : y = ln(ae^bx) = lna+bx.
In order to avoid confusion, use clear notations :
$$T=T_0e^{kt}$$
which is transformed to
$$\ln(T)=kt+\ln(T_0)$$
$$y=ax+b\quad\text{with}\quad \begin{cases}
y=\ln(T)\\
x=t\\
a=k\\
b=\ln(T_0)
\end{cases}$$
Now you proceed to the linear regression according to the standard form $y=ax+b$
Once you got $a$ and $b$ there is no difficulty at all to find $k$ and $T_0$ from the above equations :
$$\begin{cases}
k=a\\
T_0=e^b
\end{cases} $$

NOTE :
I wonder why you use an exponential function. If you plot the data $(t,T)$ you see that the points are quite lined. Thus, no need for $T=T_0e^{kt}$. More simply :
$$T=At+B$$

A: $$T=T_0e^{kt}$$
becomes
$$\ln T=kt+\ln T_0$$ which is a linear relation of the form
$$y=mx+p$$
with the following correspondences:
$$\begin{align}y&\leftrightarrow \ln T,\\x&\leftrightarrow t,\\m&\leftrightarrow k,\\p&\leftrightarrow \ln T_0.\end{align}$$
So after performing the linear regression with the input pairs $(t, \ln T)$, $k$ is given by the slope and $T_0$ by the antilogarithm of the intercept.


text:
Q: sort command : -g versus -n flag What's the difference between using the sort command with -g and -n?
I have tried both flags with ls -la and the output was identical.
The man-page says that -g "compares according to general numerical value" and -n "compares according to string numerical value" ?
I don't get what they mean there.
What does "general numerical value" mean? What does "string numerical value" mean?

A: The major difference is in the treatment of numbers that are in scientific notation. From info sort, when using the -n (numeric) sort
 Neither a leading `+' nor exponential notation is recognized.  To
 compare such strings numerically, use the `--general-numeric-sort'
 (`-g') option.

So, for example, given
$ cat file
+1.23e-1
1.23e-2
1.23e-3
1.23e4
1.23e+5
-1.23e6

then
$ sort -n file
-1.23e6
+1.23e-1
1.23e-2
1.23e-3
1.23e4
1.23e+5

whereas
$ sort -g file
-1.23e6
1.23e-3
1.23e-2
+1.23e-1
1.23e4
1.23e+5

A: From sort info page, sort -g is explained by these
'-g'
'--general-numeric-sort'
'--sort=general-numeric'
     Sort numerically, converting a prefix of each line to a long
     double-precision floating point number.  *Note Floating point::.
     Do not report overflow, underflow, or conversion errors.  Use the
     following collating sequence:

        • Lines that do not start with numbers (all considered to be
          equal).
        • NaNs ("Not a Number" values, in IEEE floating point
          arithmetic) in a consistent but machine-dependent order.
        • Minus infinity.
        • Finite numbers in ascending numeric order (with -0 and +0
          equal).
        • Plus infinity.

     Use this option only if there is no alternative; it is much slower
     than '--numeric-sort' ('-n') and it can lose information when
     converting to floating point.

sort -n is the natural sort we usually expect
'-n'
'--numeric-sort'
'--sort=numeric'
     Sort numerically.  The number begins each line and consists of
     optional blanks, an optional '-' sign, and zero or more digits
     possibly separated by thousands separators, optionally followed by
     a decimal-point character and zero or more digits.  An empty number
     is treated as '0'.  The 'LC_NUMERIC' locale specifies the
     decimal-point character and thousands separator.  By default a
     blank is a space or a tab, but the 'LC_CTYPE' locale can change
     this.

     Comparison is exact; there is no rounding error.

     Neither a leading '+' nor exponential notation is recognized.  To
     compare such strings numerically, use the '--general-numeric-sort'
     ('-g') option.

Check Steeldriver's answer for a better explanation.

A: From the sort manual:

'-n'
'--numeric-sort'
'--sort=numeric'
Sort numerically. The number begins each line and consists of optional
  blanks, an optional '-' sign, and zero or more digits possibly
  separated by thousands separators, optionally followed by a
  decimal-point character and zero or more digits. An empty number is
  treated as '0'. The LC_NUMERIC locale specifies the decimal-point
  character and thousands separator. By default a blank is a space or a
  tab, but the LC_CTYPE locale can change this.
Comparison is exact; there is no rounding error.
Neither a leading '+' nor exponential notation is recognized. To
  compare such strings numerically, use the --general-numeric-sort
  (-g) option.

And;

'-g'
'--general-numeric-sort'
'--sort=general-numeric'
Sort numerically, converting a prefix of each line to a long
  double-precision floating point number. See Floating point. Do not
  report overflow, underflow, or conversion errors. Use the following
  collating sequence:

*

*Lines that do not start with numbers (all considered to be equal).

*NaNs ("Not a Number" values, in IEEE floating point arithmetic) in a consistent but machine-dependent order.

*Minus infinity.

*Finite numbers in ascending numeric order (with -0 and +0 equal).

*Plus infinity.

  Use this option only if there is no alternative; it is much slower
  than --numeric-sort (-n) and it can lose information when
  converting to floating point.

So, it would seem that using -g could result in incorrect comparisons due to loss of precision, but for whatever reason, I can't produce such a result:
$ printf "%s\n" 1 1.23 1.234 1.2345 1.23456 1.234567 1.2345678 1.23456789 1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888878888888888 | sort -g
1
1.23
1.234
1.2345
1.23456
1.234567
1.2345678
1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888878888888888
1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
1.23456789

sort -g correctly places the second long fraction before the first, but the difference between the two is well beyond the precision from a double:
$ cat test.cpp
#include<iostream>

using namespace std;

int main()
{
    cout << (1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888887888888888888888888888 < 1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888) << endl;
    cout << (1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888887888888888888888888888 > 1.23456788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888) << endl;
}
$ make test
g++     test.cpp   -o test
$ ./test
0
0


text:
Q: How to search on a @connection with AWS Amplify So I have 3 collections in my schema
type User @model(subscriptions: null)  {
  id: ID!
  name: String
  email: String
  events: [EventUser] @connection(keyName: "byUser", fields: ["id"])
}

type Event @model
  @key(name: "byApiKey", fields: ["apiKey"])
  @key(name: "byOrganization", fields: ["organizationID"], queryField: "eventByOrganization")
  {
  id: ID!
  apiKey: ID!
  title: String
  participants: [EventUser] @connection(keyName: "byEvent", fields: ["id"])
}

type EventUser @model
  @key(name: "byUser", fields: ["userID"], queryField: "eventByUser")
  @key(name: "byEvent", fields: ["eventID"], queryField: "userByEvent")    {
  id: ID!
  userID: ID!
  eventID: ID!
  user: User! @connection(fields: ["userID"])
  event: Event! @connection(fields: ["eventID"])
}

And I am trying to search the EventUser collection by eventID and user.name. Is there some piece of amplify that can enable me search by the user.name and return the EventUser collection?


text:
Q: how-to submit form with multiple groups of radio buttons? goal: post several groups of radio buttons to array (as a message, to database, etc.)
Hi there,
I was wondering how i can post my selections of several groups of radio buttons.
Here is the code:

<form action="" method="post">
<select name="module 1">
<input type="radio" name="radioA" value="Radio 1">Radio 1
<input type="radio" name="radioA" value="Radio 2">Radio 2
<input type="radio" name="radioA" value="Radio 3">Radio 3
<input type="submit" name="submit" value="Get Selected Values" />
</select>

<select name="module 2">
<input type="radio" name="radioB" value="Radio 21">Radio 21
<input type="radio" name="radioB" value="Radio 22">Radio 22
<input type="radio" name="radioB" value="Radio 23">Radio 23
<input type="submit" name="submit" value="Get Selected Values" />
</select>

<select name="module 3">
<input type="radio" name="radioC" value="Radio 31">Radio 31
<input type="radio" name="radioC" value="Radio 32">Radio 32
<input type="radio" name="radioC" value="Radio 33">Radio 33
<input type="submit" name="submitC" value="Get Selected Values" />
</select>

</form>

<?php
if (isset($_POST['submit'])) {
if(isset($_POST['radioA']))
{
echo "You have selected :".$_POST['radioA'];  //  Displaying Selected Value
}
}
?>

...But I can't make it display the list of my selections, but only one instructions, instead of 3x (one for each).
Long story short... How can I treat this as a 1 global set of 3 groups, having only 1 "submit" button to process all 3 groups at once?
Txs a lot, and have a nice weekend.

A: You just need to remove the other two submit buttons and only display one. As long as it is inside the <form> it will submit all the radio button "groups" to the $_POST.
Also, remove the select tags as you are using them incorrectly. Only an option or optgroup should be nested inside a select element.
You will need to reference each one individually to see the selected response:
echo $_POST['radioA'];
echo $_POST['radioB'];
echo $_POST['radioC'];


text:
Q: How to remove an item in a string array in firestore? I am trying to remove an item in a string array in firestore with:
   db
    .collection("users")
    .doc(request.user.username)
    .update({
      clients: firebase.firestore.FieldValue.arrayRemove(clientEmail),
    })

it is giving me the error in the firebase logs:
Error: Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Value for argument "dataOrField" is not a valid Firestore document. Couldn't serialize object of type "FieldValue$1" (found in field "clients"). Firestore doesn't support JavaScript objects with custom prototypes (i.e. objects that were created via the "new" operator). at WriteBatch.update (/workspace/node_modules/@google-cloud/firestore/build/src/write-batch.js:374:23) at DocumentReference.update (/workspace/node_modules/@google-cloud/firestore/build/src/reference.js:377:14) at exports.deleteOneClient (/workspace/APIs/users.js:771:6) at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5) at next (/workspace/node_modules/express/lib/router/route.js:137:13) at /workspace/util/auth.js:28:14 at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5

the data looks like this in the document in
clients:
    0: "test@test.com"
    1: "test@test.com"
    2: "test@test.com"

I believe the issue is as simple as me using the array remove wrong. the clientEmail is just the string value that i want to remove in the array. Based on examples I've seen, I might just be inputting params wrong.


text:
Q: Disable/Enable  on deselecting/selecting  I want to disable the submit button on my jsp Page if the user has not agreed to the terms and conditions. I have tried many solutions available but still not getting through. Here is my code :
 <h:form id="form2" styleClass="align topLabel page">
 <h:selectBooleanCheckbox id="check" onclick="document.getElementById('form2:saveForm').disable = !this.checked"/>Agree

                        <h:commandButton id="saveForm" styleClass="btTxt submit"
                            type="submit" value="Submit"
                            action="#{declarationFormBean.formSubmit }"></h:commandButton>

</h:form>

Please help.

A: May the following code snippet help you

<h:form id="form2" >
        <h:selectBooleanCheckbox id="check" onclick="checkClick(this)"/>Agree

                <h:commandButton id="saveForm" styleClass="btTxt submit"
                                 type="submit" value="Submit" disabled="true" ></h:commandButton>

</h:form>

Also you could add required field. Check this : RequiredCheckboxValidator

A: Your button is always enabled on the server side, so correcting user-controlled code on the client side will still execute business action associated with the command button.
What you want is to disable button on the server by setting its disabled attribute to the inverse of the current checkbox value:
<h:selectBooleanCheckbox binding="#{agree}" ... />
<h:commandButton disabled="#{not agree.value}" ... />

What remains to be done is to submit the form either via ajax, by nesting <f:ajax render="form:button" />, or synchronously, by adding onclick="document.getElementById('form').submit();". Both changes must be done to the <h:selectBooleanCheckbox> tag.


text:
Q: Java Arrays.fill() negative number I am trying to fill a 2D array with '-1' as all the values. The code that I'm using is:
int c [] []=new int[4][4];
Arrays.fill(c,-1)

This throws the following error:
Exception in thread "main" java.lang.ArrayStoreException: java.lang.Integer

Can anyone please tell me what's wrong in the code?

A: Its an array of array of Integer.
You should write
    int c [] []=new int[4][4];
    for(int[] arr : c){
        Arrays.fill(arr,-1);
    }


text:
Q: Ornament as an entry in the TOC I have a book containing a number of chapters and several indices.  I would like to place an ornament in the TOC between the list of chapters and the list of indices.  My simple approach fails (see below, comment out the first example and uncomment the second one).
Is there some way to protect the \pgfornament statement so that this will work?
Note: You'll need an xindy style file to get the index to show up when compiling.
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}

%Use Junicode for a nice looking font
\usepackage{xltxtra}
\setmainfont{Junicode}[Language=Icelandic,Fractions=On]

\usepackage[xindy,splitindex]{imakeidx}
\makeindex[title=Index of Tale Information,program=texindy,intoc,columns=2,options=-L icelandic -C utf8 -M lang/icelandic/utf8 -M generalstyle]

\usepackage[object=vectorian]{pgfornament}

\begin{document}
    \tableofcontents
    \mainmatter
    \chapter[Mori]{Móri}
        \index{icelandic!Mori the Hound}
        \index{icelandic titles!Hundurinn Móri}
        \index{collectors!Árnason, Jón}

        \Large Main text

        This is the ornament that I would like in the TOC before the index.

        \pgfornament[width=8cm]{88}

        %Try to add the ornament to the TOC before the index entry
        %It works with simple text
        \addtocontents{toc}{\protect\contentsline{chapter}%
            {\hfill This should be an ornament \hfill}{}}
        %It fails with a tikz object
        %\addtocontents{toc}{\protect\contentsline{chapter}{\pgfornament[width=8cm]{88}}{}}

    \printindex
\end{document}

A: This puts the ornament in a \parbox of length \textwidth and centers it with \centering. You have to \protect both \centering and \pgfornament:
\addtocontents{toc}{\nobreak\smallskip\parbox{\textwidth}{\protect\centering\protect\pgfornament[width=8cm]{88}}}

This is the result.

This is the MWE.
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}

%Use Junicode for a nice looking font
%\usepackage{xltxtra}
%\setmainfont{Junicode}[Language=Icelandic,Fractions=On]

%\usepackage[xindy,splitindex]{imakeidx}
%\makeindex[title=Index of Tale Information,program=texindy,intoc,columns=2,options=-L icelandic -C utf8 -M lang/icelandic/utf8 -M generalstyle]

\usepackage[object=vectorian]{pgfornament}

\begin{document}
    \tableofcontents
    \mainmatter
    \chapter[Mori]{Móri}
%        \index{icelandic!Mori the Hound}
%        \index{icelandic titles!Hundurinn Móri}
%        \index{collectors!Árnason, Jón}

        \addtocontents{toc}{\nobreak\smallskip\parbox{\textwidth}{\protect\centering\protect\pgfornament[width=8cm]{88}}}

\end{document}

A: NOTE: The reason my original attempt at using \addtocontents using \protect failed in my original document, but worked in my MWE was due to my use of the hyperref package, which redefines \contentsline.
The following does work:
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}

%Use Junicode for a nice looking font
\usepackage{xltxtra}
\setmainfont{Junicode}[Language=Icelandic,Fractions=On]

\usepackage[xindy,splitindex]{imakeidx}
\makeindex[title=Index of Tale Information,program=texindy,intoc,columns=2,options=-L icelandic -C utf8 -M lang/icelandic/utf8 -M generalstyle]

\usepackage[object=vectorian]{pgfornament}

%Provide hyperlinks in the T.O.C. to the chapters
%Note: should be last package loaded
\usepackage[hidelinks]{hyperref}
\hypersetup{pdfpagemode=UseNone}

\begin{document}
    \tableofcontents
    \mainmatter
    \chapter[Mori]{Móri}
        \index{icelandic!Mori the Hound}
        \index{icelandic titles!Hundurinn Móri}
        \index{collectors!Árnason, Jón}

        \Large Main text

        This is the ornament that I would like in the TOC before the index.

        \pgfornament[width=8cm]{88}

        %Try to add the ornament to the TOC before the index entry
        \addtocontents{toc}{\protect\contentsline{chapter}{\hfill%
                \protect\pgfornament[width=8cm]{88}%
                \hfill}{\protect\relax}{}}

    \printindex
\end{document}


text:
Q: Can we get weakly convergence from the above Glivenko-Cantelli theorem? I am reading this result:

Here the empirical distribution function $F_n(x)=\frac{1}{n}\sum I(X_i\le x)$ and $\mu_n=\frac{1}{n}\sum\delta_{X_i}$.
Question: If I want to prove that $\mu_n$ converges to $\mu$ weakly. Can we get this conclusion from the above Glivenko-Cantelli theorem?

Why do we need almost surely $F_n(\cdot)(\omega)\to F$ uniformly on $R$ rather than
$$
\mbox{ almost surely } F_n(x)(\omega)\to F
$$
for each $x\in R$ by SLLN?

A: Yes, you can since GC implies pointwise convergence of the empirical measures to the limiting measure..
Uniform convergence is a stronger condition than normal convergence:
Uniform Convergence $\implies$ Pointwise Convergence
Therefore $F_n(\cdot)(\omega)\to F$ uniformly a.s $ \implies F_n(x)(\omega)\to F$ for each $x\in R$ a.s.


text:
Q: Murphy-Topel standard errors correction for GMM? I employ a two-stage estimation routine: In the first stage, a large vector $\hat \theta_1$ (around 2000 elements) is estimated with maximum likelihood. In the second stage, I estimate $\hat \theta_2 ( \hat \theta_1)$ using GMM, and I'm interested in the standard errors of $\theta_2$.
If I were to use GMM for estimation of my parameters in one step only, I know that I would obtain consistent estimates of the standard errors using the outer product of the gradient estimator. Conversely, if I were to use ML also in the second stage, I could apply the Murphy-Topel correction for standard errors.
How can I correct for standard-errors given that I use GMM in the second stage?


text:
Q: How to Fix: failed to upload the package. flutter I am trying to publish my first package for the first time and when I use flutter packages pub publish, it give me in the end.
Uploading...
Failed to upload the package.
pub finished with exit code 1

The log for flutter packages pub publish -v is:
ERR : Failed to upload the package.
FINE: Exception type: ApplicationException
FINE: package:pub/src/utils.dart 512:5                                                      fail
    | package:pub/src/command/lish.dart 109:9                                               LishCommand._publish
    | ===== asynchronous gap ===========================
    | dart:async                                                                            Future.catchError
    | package:pub/src/utils.dart 113:52                                                     captureErrors.wrappedCallback
    | package:stack_trace                                                                   Chain.capture
    | package:pub/src/utils.dart 126:11                                                     captureErrors
    | package:pub/src/command.dart 164:13                                                   PubCommand.run
    | package:args/command_runner.dart 196:27                                               CommandRunner.runCommand
    | package:pub/src/command_runner.dart 150:26                                            PubCommandRunner.runCommand
    | package:pub/src/command_runner.dart 138:18                                            PubCommandRunner.run
    | C:\b\s\w\ir\cache\builder\src\third_party\dart\third_party\pkg\pub\bin\pub.dart 9:48  main
[+15501 ms] "flutter pub" took 15,607ms.
[   +6 ms] pub finished with exit code 1
[   +2 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:366:7)
           <asynchronous suspension>
           #2      PackagesPassthroughCommand.runCommand (package:flutter_tools/src/commands/packages.dart:267:5)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #5      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
           <asynchronous suspension>
           #6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
           <asynchronous suspension>
           #9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #11     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>

[   +6 ms] ensureAnalyticsSent: 4ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

I tried to delete credentials.json file and the auth process gave me success but it still the same problem.

A: I found it.

*

*delete .pub-cache folder inside src/flutter and invalid cach

*invalid cache and restart your IDE

*in terminal flutter packages pub publish
done.


text:
Q: Apply a filtering mask to a data matrix I have two matrices:
data = imported_data.data; % matrix from hdf5, 30x20000 single
filter = imported_data.invalid_flags == 0; % 30x20000 logical

I want to merge information from the two matrices, so that I get a new data matrix with the same dimensions, and with positions where filter is 0 set to to 0 or NaN. Here's a small example to clarify my question:
data =       [3, 4, 5;
              2, 3, 4];
filter =     [0, 1, 1;
              1, 0, 1];
valid_data = [0, 4, 5; % 'reset' values specified in filter
              2, 0, 4];

I tried valid_data = data(filter);, but that resulted in a 400000x1 single matrix. However, I want to have a matrix valid_data with the original dimensions.
Is it necessary to loop over all values or is there a quicker solution?

A: Multiplying the arrays element-wise will work:
valid_data = data .* filter;

Alternatively, to replace with NaN we can use a trick with 0/0 division:
valid_data = data .* (filter./filter);

Finally, you could use logical indexing:
valid_data = data; valid_data(~filter) = NaN;


text:
Q: Local Photo Gallery Is there a way to get Photos from the Gallery of the Device with Tabris? I know that it wasnt possible like half a year ago, maybe there is a way now? Couldnt find any information on the tabris homepage.

A: We just added that functionality to Tabris.
It should come with the next release.
You  can take a look at the CameraDemo here: https://github.com/eclipsesource/tabris-demos/blob/master/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/CameraDemo.java#L179


text:
Q: How to do combination matrices in tf.Variable? I have these 2 matrices and I need to combine them so:

these are them in code:
matrix_a = tf.Variable(np.zeros(big_shape, dtype=np.float32))
matrix_b = tf.Variable(np.zeros(small_shape, dtype=np.float32))

#here I need to combine them

How can I do that?

###################################################### EDITED

Thanks to @jdehesa I've written this code:
    shape = (batch_size, window_size, window_size, num_channels)

    # the variable we're going to optimize over
    modifier = tf.Variable(np.zeros(shape, dtype=np.float32))

    mask = tf.zeros((batch_size, image_size, image_size, num_channels), tf.float32)
    # Get input shapes
    modifier_shape = tf.shape(modifier)
    mask_shape = tf.shape(mask)
    # Make indices grid
    oo, ii, jj, kk = tf.meshgrid(tf.range(modifier_shape[0]), tf.range(modifier_shape[1]), tf.range(modifier_shape[2], modifier_shape[3]), indexing='ij')
    # Shift indices
    ii += y_window
    jj += x_window
    # Scatter update
    mask_to_apply = tf.tensor_scatter_nd_update(mask, tf.stack([oo, ii, jj, kk], axis=-1), modifier)

bot now I have this error:
ValueError: Requires start <= limit when delta > 0: 28/1 for 'range_2' (op: 'Range') with input shapes: [], [], [] and with computed input tensors: input[0] = <28>, input[1] = <1>, input[2] = <1>.

Why?

A: This is a way to do that:
import tensorflow as tf

# Input data (assumes two 2D tensors, `a` at least as big as `b`)
a = tf.zeros((4, 4), tf.int32)
b = tf.ones((2, 2), tf.int32)
# Get input shapes
a_shape = tf.shape(a)
b_shape = tf.shape(b)
# Make indices grid
ii, jj = tf.meshgrid(tf.range(b_shape[0]), tf.range(b_shape[1]), indexing='ij')
# Shift indices
ii += a_shape[0] - b_shape[0]
jj += a_shape[1] - b_shape[1]
# Scatter update
c = tf.tensor_scatter_nd_update(a, tf.stack([ii, jj], axis=-1), b)
tf.print(c)
# [[0 0 0 0]
#  [0 0 0 0]
#  [0 0 1 1]
#  [0 0 1 1]]


text:
Q: Replace support v4 fragment with the older fragment I need to replace android.support.v4.app.Fragment with android.app.Fragment. I am forced to use android.app.Fragment. How do I change my Fragment to inherit from android.app.Fragment instead of android.support.v4.app.Fragment?

A: You can change the import statement to be android.app.Fragment instead of the one you are importing now every where you're using it (I'd start in your Fragment class). There will be a few other things you might need to change, like using FragmentManager instead of SupportFragmentManager to manage your Fragments, etc. You can fix or google how to fix the errors that arise when you change your Fragment descendant to extend the regular Fragment, not the support one.
EDIT: it's usually better to use support fragments. It would be worth looking into finding an alternative resolution to the problem that's forcing you to switch.


text:
Q: Delphi 2009 TListView Change Grid Color and Width of GridLines I have a TListView with ViewStyle set to vsReport.  How do you change the color of the grid and the width of the gridlines.  The gridlines is a bit too thick in D2009, I want to have the same width as in D5.
Thanks

A: There isn't any Delphi code that draws those lines. They're drawn by the underlying Windows common-control code, and that doesn't provide any means of specifying the thickness of the lines. They're either on or off. If you're seeing a different appearance between Delphi versions, then it's probably because you're running the program on different Windows versions.


text:
Q: Is sql to Linq union by reference? (the same for except and intersect?) When you perform a union in linq to sql, will it be by reference - if the reference to the object point to the same object - or is it by the id field?
Example method:
        public IEnumerable<CustomerModel> GetCustomers(string searchCriteria)
    {
        ExpressLogger.LogDebug("Enter");
        try
        {
            var datacontext = Helpers.Utils.GetCustomerRmhDataContext();
            using(datacontext)
            {
               var accountCustomers = datacontext.Customers.Where(c =>
                            c.AccountNumber.ToLower().Contains(searchCriteria.ToLower())).Select(c=>convertRmhToModel(c,datacontext)).ToList();

                var phoneCustomers = datacontext.Customers.Where(c =>
                            c.PhoneNumber.ToLower().Contains(searchCriteria.ToLower())).Select(c => convertRmhToModel(c, datacontext)).ToList();

                var personalNumberCustomers = datacontext.Customers.Where(c =>
                            c.TaxNumber.ToLower().Contains(searchCriteria.ToLower())).Select(c => convertRmhToModel(c, datacontext)).ToList();

                var emailCustomers = datacontext.Customers.Where(c =>
                            c.EmailAddress.ToLower().Contains(searchCriteria.ToLower())).Select(c => convertRmhToModel(c, datacontext)).ToList();

                var allCustomers = accountCustomers.Union(phoneCustomers).Union(personalNumberCustomers).Union(emailCustomers).ToList();

                return allCustomers;
            }
        }
        catch (Exception ex)
        {
            ExpressLogger.LogError(ex.Message);
            throw;
        }
    }

This function do what i want, it searches for customer for accountnumber, phone, mail and swedish personalnumber. And then i make a union and return the result. But im curios - how does this work, will it compare the union with the ID field or is it by reference - will it check hashcode and equal comparer? (is it the same for intersect and except?)

A: At this point, .Union is called on .Net collections and its behavior is defined in the docs for Enumerable.Union:

The default equality comparer, Default, is used to compare values of the types that implement the IEqualityComparer generic interface.

This is further clarified in the docs for EqualityComparer<T>.Default:

The Default property checks whether type T implements the System.IEquatable<T> interface and, if so, returns an EqualityComparer<T> that uses that implementation. Otherwise, it returns an EqualityComparer<T> that uses the overrides of Object.Equals and Object.GetHashCode provided by T.

So, if CustomerModel implements IEquatable<CustomerModel>.Equals and/or overrides Object.Equals, then Union uses one of these methods to compare customers.
Otherwise, it falls back on default implementation of Object.Equals that compares object references:

If the current instance is a reference type, the Equals(Object) method tests for reference equality, and a call to the Equals(Object) method is equivalent to a call to the ReferenceEquals method..


text:
Q: Would the old series 4000 CMOS logic series have evolved over time? Would the old series 4000 CMOS logic series have evolved over time?
The manufacturers surely have bought new machines and are not using the same machines from some odd 40 years back.
Would they have adapted the 4000 logic series to a smaller scale (nanometre) transistors / FETs / diodes / Zeners and what not to reduce power consume or are they still using the same masks?

A: Usually, IC's built 40 years apart with the exact same part number have the exact same circuit inside (sometimes, something very close). This is because reverse-compatibility is critical.  An LM358 built last month has the same high noise and crossover distortion as one built in the 1970's.  And a CD4011 will be just as slow as it used to was.
Many old designs will fail with a newer part that is 10x faster because that faster output edge can create several different types of noise, including inducing ringing in downstream circuits that can be interpreted as false pulses.
Also, a shorter propagation delay could cause all kinds of timing problems, including a complete lockup of the circuit.
Yes, the series has evolved over time into dozens upgraded variants. No, the original part numbers have not evolved.

A: One practical difficulty is that modern logic processes can't tolerate the 12V supply voltage (and usually 18V abs max rating) for classic 4000 series devices.
Anything breaks down (including silicon dioxide and other insulators) in a sufficiently high electric field (measured in volts/metre), and as you scale features down, you find you can get a lot of volts/metre across a micron, let alone 14 nM.
It seems like only yesterday to an old codger like me, that 3.3V and now 2.5 and 1.8V, took over from 5V as the supply rails for general purpose logic, because the I/O transistors could no longer support voltages as high as 5V ... let alone 12V.
And of course the core in a CPU or high end FPGA now runs on a fraction of a volt, with only especially large and beefy transistors around the I/O pads, capable of tolerating 2.5V or so. Newer FPGA families stopped supporting 5V I/O about ten years ago.
I believe that CD4000 was designed around a 10um or 15um gate width, easily achieved with what was basically optical microscope technology used in reverse...


text:
Q: Name Range in an array I have a variant variable which contains two name ranges. I try to copy the range using the name of the range stored in the variable but i do not know how to do it. Please see below my code. Any suggestions?
Dim tbl2 As Range
Dim tablearray2 As Variant

Application.ScreenUpdating = False
Application.EnableEvents = False

tablearray2 = Worksheets("Sheet2").Range("C2:C3") **<--- Here i store the name of the ranges in the tablearray2 variable**

'The tablearray2 now contains the following values: Table1, Table2 which are the names of two different ranges.

Set tbl2 = tablearray2(2,1)

tbl2.copy

End Sub

Thank you for your help

A: Here's a small example, including the paste bit.
Sub x()

Dim tbl2 As Range
Dim tablearray2 As Variant

tablearray2 = Worksheets("Sheet2").Range("C2:C3")

Set tbl2 = Range(tablearray2(2, 1)) 'contents of C3 = "Table2"

tbl2.Copy Worksheets("Sheet2").Range("A5") 'paste range to A5

End Sub

A: Following the previous question I try to copy the table to word document, but i get that error:
Run-time error'91:
Object variable or With block variable not set
See my code below:
Private Sub commandButton2_Click()
Dim tbl2 As Range
Dim wordapp As Word.Application
Dim mydoc As Word.Document
Dim wordtable As Word.Table
Dim tablearray2 As Variant
Dim bokkar As Variant

bookar = Array("PhoneNumber", "Occupation")

Application.ScreenUpdating = False
Application.EnableEvents = False

'fnopenworddoc <--- this is a function which open the word document

tablearray2 = Worksheets("Sheet2").Range("C2:C3")

Set tbl2 = Range(tablearray2(2, 1))
tbl2.copy
'Worksheets("Sheet1").Range("K4").PasteSpecial xlPasteAll

mydoc.Bookmarks("Occupation").Range.PasteExcelTable _
       LinkedtoExcel:=False, _
          WordFormatting:=False, _
            RTF:=False

Set wordtable = mydoc.Tables(1)
      wordtable.AutoFitBehavior (wdAutoFitWindow)

End Sub


text:
Q: Are the gerund forms 'having been + adj./noun..,There being,There having been,etc.' in use? Are these  gerund forms  correct / in use?

*

*John's having been late..

*There being people at the hotel..

*There having been people at the hotel..

*People having had cars..

I have no idea how to use these forms in sentences.That's why I couldn't provide perfect examples.(sorry for that)

A: Your examples are all grammatically sound gerund clauses. They may be employed in a variety of ways:

As a Subject NP: John's having been late caused us many problems.
As an Object NP: The owners enjoy there being people at the hotel.
As a 'supplemental' Absolute Clause: There having been people at the hotel, the owners suffered no loss.
As the object of a preposition: The taxi drivers were greatly annoyed at people having had cars.

Your last example can also be interpreted as a noun plus a modifying participle phrase:

People having had cars were invited to post photographs of them.


text:
Q: Los mensajes por Websocekets tienen un retraso de más de 5 minutos en angular Estoy haciendo una aplicación en angular 9, donde un servidor manda información cada 5 milisegundos, aproximadamente 27.000 mensajes y el último mensaje es recibido hasta 10 minutos después del envio.
onMessageListener() {
this.ws.onmessage = (event) => {
  const time = new Date();
  console.log(
    `recived at: ${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}.${time.getMilliseconds()}`
  );
  console.log('from service: ', event?.data);
};
  }

connect(wsUrl: string) {
    if (!this.ws || this.ws.readyState === this.ws.CLOSED) {
      this.ws = new WebSocket(wsUrl);
    }

    this.onOpenListener();
    this.onMessageListener();
    this.onCloseListener(wsUrl);
    this.onErrorListener(wsUrl);
  }

Por otra parte encontré este simple ejemplo en un tag de script dentro de un HTML, lo probé y la diferencia con la misma cantidad de datos es de aproximadamente 10 segundos, escribiendo los mensajes en el html y no en consola. A que se debe esta gran diferencia?
Intenté también crear un Js con las funciones en el ejemplo encontrado e importarlo al proyecto de angular, lo puedo utilizar en el componente pero no el tiempo no mejora, por lo tanto encuentro que el inconveniente se presenta del lado de Angular

https://www.websocket.org/echo.html

function testWebSocket()
  {
    websocket = new WebSocket(wsUri);
    websocket.onopen = function(evt) { onOpen(evt) };
    websocket.onclose = function(evt) { onClose(evt) };
    websocket.onmessage = function(evt) { onMessage(evt) };
    websocket.onerror = function(evt) { onError(evt) };
  }

function onMessage(evt)
  {
    let time = new Date();
    let dateRecived = time.getHours()+":"+time.getMinutes()+":"+time.getSeconds()+"."+time.getMilliseconds() +'::>>';
    writeToScreen('RESPONSE: ' + dateRecived + evt.data+'');
  }

A: Creo que a tu navegador no le da tiempo a procesar los mensajes: Sólo escribir en consola mensajes, cada 5 milisegundos ya acumula retraso. He puesto un ejemplo con 200 llamadas a console.log, cada una a los 5ms y ya necesita más de 11 segundos (un segundo sobre lo esperado). Ahora imagina además procesar un mensaje recibido desde un servidor.

let count = 0;
const start = performance.now();
const interval = setInterval(() => {
  const time = new Date();
  console.log(`Time: ${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}.${time.getMilliseconds()}`);
  if (count++ > 2000) {
    clearInterval(interval);
    timed();
  }
}, 5);

function timed () {
  console.log((performance.now()-start)/1000);
}