text:
Q: Some values are printing extra times the i (i = 0; i < 10; i++) that i don't want . While using for loop in C I want an output that prints cube of odd numbers printing in a triangular order up to base number 10, like this.
1
27  27
125  125  125
343  343  343  343
.....
but my program prints
1
27 27 27
125 125 125 125 125
343 343 343 343 343 343 343
.....
it prints extra values.
I tried whatever possible that I learned, and also adding extra for loops...
#include<stdio.h>
#include<conio.h>
void main()
{
    clrscr();
    int a;
    int i,j;
    a=1;
    for(i=0;i<10;i++)
    {

        for(j=0;j<i;j++)
        {
            if(i%2!=0)
            {
                a=i*i*i;
                printf("%d  ",a);
            }

        }
        printf("\n");
     }
    getch();
}

This is what I want...
1
27  27
125  125  125
343  343  343  343
No errors by the compiler, only those extra values printing on the Output screen.

A: this is ok?
#include<stdio.h>
#include<conio.h>

void main()
{
    int a = 1;

    for (int i = 1; i < 10; i+=2)
    {
        for (int j = 0; j < i - i/2; j++)
        {
                a = i * i * i;
                printf("%d  ", a);
        }
        printf("\n");
    }
    getchar();
}

1
  27  27
  125  125  125
  343  343  343  343
  729  729  729  729  729

A: This solution will give you an easy to understand way to do the printing.  The trick consists in using enough variables to update, the number of times you have to print at each line, and the computations to do de cubes:
#include <stdio.h>

int main()
{
    int a = 1, line;
    for (line = 0; line < 10; line++) {
            int cube = a*a*a, item_in_line;
            char *sep = "";  /* no separator at the beginning */
            for (item_in_line = 0;
                 item_in_line <= line;
                 item_in_line++) {
                    printf("%s%d", sep, cube);
                    sep = ", ";  /* from now on, we print commas */
            }
            printf("\n");
            a += 2; /* get next number to cube */
    }
}

This will print:
1
27, 27
125, 125, 125
343, 343, 343, 343
729, 729, 729, 729, 729
1331, 1331, 1331, 1331, 1331, 1331
2197, 2197, 2197, 2197, 2197, 2197, 2197
3375, 3375, 3375, 3375, 3375, 3375, 3375, 3375
4913, 4913, 4913, 4913, 4913, 4913, 4913, 4913, 4913
6859, 6859, 6859, 6859, 6859, 6859, 6859, 6859, 6859, 6859


text:
Q: Disabling red squiggly lines in visual studio 2015 C# I'm using visual studio 2015 as my script editor for unity and I'd like to get rid of the syntax error underlining because they irritate me a lot, but I can't find the option to do that in visual studio. Can the syntax underlining be disabled for C#?
I've searched for answers but I couldn't find an answer that worked for me,
The solution should apparently be to go to Options>Text Editor>C#>Advanced and change some settings there, but none of the options I have seem to remove the squiggly lines.
Here's my option menu: http://i.imgur.com/gD8JsLF.png

A: You might try changing the color of the squiggly lines by going to tools -> options -> environment -> fonts and colors -> syntax error and setting the color to one that doesn't irritate you. Like white.

A: I had the same question for Visual studio 2019 (and maybe other versions), as I also needed this for talking screenshots with non-compiling code, so here is the settings (took me a while to find!), for what it's worth:

redpajama_set_name: RedPajamaStackExchange


text:
Q: GRUB error 13: invalid or unsupported executable format on custom kernel I am trying to learn OS Dev and I started building my own kernel based on The Little book about OS Development.
When I loaded the kernel using bochs GRUB complains with:
error 13: invalid or unsupported executable format

The files I'm using:
loader.s
global loader

MAGIC_NUMBER equ 0xBADB002
FLAGS equ 0x0
CHECKSUM equ -MAGIC_NUMBER

section .text
align 4
    dd MAGIC_NUMBER
    dd FLAGS
    dd CHECKSUM

loader:
    mov eax, 0xCAFEBABE
.loop:
    jmp .loop

link.ld
ENTRY(loader)

SECTIONS
{
    . = 0x00100000;

    .text ALIGN (0x1000) :
    {
        *(.text)
    }

    .rodata ALIGN (0x1000) :
    {
        *(.rodata*)
    }

    .data ALIGN (0x1000) :
    {
        *(.data)
    }

    .bss ALIGN (0x1000) :
    {
        *(COMMON)
        *(.bss)
    }
}

bochsrc.txt
megs:              32
display_library:    sdl
romimage:           file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage:        file=/usr/share/bochs/VGABIOS-lgpl-latest
ata0-master:        type=cdrom, path=os.iso, status=inserted
boot:               cdrom
log:                bochslog.txt
clock:              sync=realtime, time0=local
cpu:                count=1, ips=1000000

menu.lst
default=0
timeout=0

title First OS
kernel /boot/kernel.elf

commands to execute:
nasm -f elf32 loader.s
ld -T link.ld -melf_i386 loader.o -o kernel.elf
genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -A os -input-charset utf8 -quiet -boot-info-table -o os.iso iso
bochs -f bochsrc.txt

My files structure is like this:
os_dev
  |--(rest of the files)
  |--iso
    |-- boot
      |-- kernel.elf
      |-- grub
        |-- menu.lst
        |-- stage2_eltorito

The file stage2_eltorito was downloaded from https://github.com/littleosbook/littleosbook/blob/master/files/stage2_eltorito

A: Michael Petch noticed that B. Kostas was using an incorrect Magic Number for Grub Legacy.
Changing MAGIC_NUMBER equ 0xBADB002 in loader.s to MAGIC_NUMBER equ 0x1BADB002 solved the issue.


text:
Q: Database Meta tools I'm now working with a legacy database which is missing, among almost everything you'd expect from a decent SQL relational DB, any documentation or metadata. I can't make changes to the DB schema, except my local test copy, as it exists at many client sites and there's no upgrading procedures. Are there any tools that I can use to build and keep my own meta about the database? I'm looking to keep track of relationships, basic documentation about tables and columns, and references in stored procedures. There's 200+ tables and 3300+ SPs. A base autogeneration would be very helpful, particularly with the SPs. Preferably FOSS and Linux, but I will settle for win just to have something.

A: Not sure what you mean with "metadata", but I'm pretty happy with Liquibase.
It manages the schema in one (or more) XML files and can reverse engineer an existing database (all major ones supported).
It's Java/JDBC based and runs fine on Linux
The main purposes of Liquibase is to handle upgrades (schema migration) smoothly, so I'm not sure if this exactly what you are looking for.


text:
Q: How to block an amp-components until other amp-component is resolved.? I want to block some amp-components (amp-image, amp-ad, or amp-iframe) until one of the amp components is resolved. ie. - amp-captcha is solved or amp-script ran successfully.
I checked that we can achieve something similar using an amp-consent component with data-block-on-consent attribute, I am wondering if we have some param to achieve this without using amp-consent


text:
Q: XLPagerTabStrip Change Icon Size Hi I am using XLPagerTabStrip to display android like fragment tabs on my ios app (xcode 10.2.1) (IOS 12.3.1)
I am trying to change the icon size.  I am using the following code to declare the icons
return IndicatorInfo(image: UIImage(named: "ic_chats"), highlightedImage: UIImage(named: "ic_chats"), userInfo: Any?.self)

I tried going to the assets folder and changing the icon size there from 90x90 to 70x70 but it did not work.

A: Found the answer we can use the following code (not sure if this is proper but doing the trick)
Add the following code
    newCell?.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)
    oldCell?.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)

At the end of the following block in the class CommunicateViewController: ButtonBarPagerTabStripViewController
    // Changing item text color on swipe
    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, _: CGFloat, changeCurrentIndex: Bool, _: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = .white
        newCell?.label.textColor = self?.colorAccent

        Enter The Code Here

    }

A: DragonFire's answer seems to cause some bug for me, I edited to only apply the transform on the imageView and it works better now.
Add the following code
newCell?.imageView.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)
oldCell?.imageView.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)

inside the changeCurrentIndexProgressive block :
changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, _: CGFloat, changeCurrentIndex: Bool, _: Bool) -> Void in
    guard changeCurrentIndex == true else { return }

    // enter The Code Here

}


text:
Q: Predict vector of random variables from historical data? There's historical prices for gold, sp500, silver, iron.
Historical data is a series of vectors, a vector of prices for every day.
1970-01-01  1970-01-02  ...  2010-01-01
gold-1      gold-2           gold-n
sp500-1     sp500-2          sp500-n
silver-1    silver-2         silver-n
iron-1      iron-2           iron-n

How to generate (predict) one thousand possible realisations of that vector for the next month?
I intentionally treat daily prices atomic, as a vector and not as separate streams of individual random variables.
We should take into account that correlations are not constant in time, for example some products (almost all commodities and stocks) will suddenly fall down all at the same time in crisis, with correlation ~1.
We assume that individual prices of gold, sp500 etc. have Pareto Distribution with $\alpha \sim 2$.


text:
Q: Redeclaring finentry results in dot printed at the beginning of the document As a follow-up of my old question "How to print the internal ID of the bibliography entries in the output format for referring to files?" I now decided not to use the internal ID, but the special field just as @moewe suggested me, that is declared by default.
So this is an example document:
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=numeric, backend=biber]{biblatex}

\DeclareFieldFormat{file}{\texttt{#1}}
\renewbibmacro*{finentry}{\newunit\newblock\printfield{file}\finentrypunct}

\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{sigfridsson,worman,geer,nussbaum}
\printbibliography
\end{document}

Unfortunately, just by changing the to be printed field entrykey from the original answer to file, strange extra dots appear.

When you actually use the file field, you can notice they appear in front of the bibliography entries that follow on entries that do not have a file entry set. (Also, as you can see in the example above, the first entry seems to be excluded.)
Even when you remove \finentrypunct (which I don't want, but did for debugging), they are still there.
So I have no idea where this dot in front of the entries comes from.

A: I think there is a typo in the other answer. The entry should not end with \finentrypunct but with \finentry:
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=numeric, backend=biber]{biblatex}

\DeclareFieldFormat{file}{\texttt{#1}}

\renewbibmacro*{finentry}{\newunit\newblock\printfield{file}\finentry}

\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{sigfridsson,worman,geer,nussbaum}
\printbibliography
\end{document}


text:
Q: How do I get my responsive email to work in Gmail? I can't get my email template to show the mobile version on Gmail. I've tried different solutions from various posts on here and nothing is working. The email is responsive in Apple Mail and even Samsung Mail. I included the css below, any help would be greatly appreciated as I've been stuck on this issue for at least a year now it seems.

.all

.no-mobile

.mobile-only


text:
Q: What is the best practice when an automated test fails because of an open bug?
*

*Keep it on failing till the time bug get fixed(but this will fail
your test run each time).

*Comment the test and mention in the bug itself(once bug fixed remove
comments).

*Maintain a bug file(like config) in the framework which skip the
automated test if it's name mentioned in the file(this is I'm doing right now).
Please suggest.

A: It is a good question. This is why I love Arquillian frameworks. As you use java , you should totally check this framework.
http://www.testautomationguru.com/selenium-webdriver-automation-using-arquillian-framework/
http://www.testautomationguru.com/arquillian-graphene-page-fragments/
http://www.testautomationguru.com/selenium-webdriver-managing-selenium-grid-infrastructure-using-arquillian-cube/
Arquillian has an extension called 'Governor' which has a nice feature to skip/execute a testcase by checking the status of an issue using JIRA API. They also support few other bug tracking system. not just JIRA.
https://github.com/arquillian/arquillian-governor
@RunWith(Arquillian.class)
@RunAsClient
public class TestCase
{
    @Test
    @Jira("ARQ-1907")
    public void test()
    {
        // this test will be run
        // because ARQ-1907 is 'Done'
        // so we assume that this test has to pass as well
    }

    @Test
    @Jira("ARQ-5000")
    public void test2()
    {
        // when this JIRA exists and its status is 'Unresolved' / 'Open'
        // this test method will be skipped because you assume that
        // if you run it, it would fail
    }

}


text:
Q: What is discrete phase space? I've been reading a little about the usual, continuous Wigner functions and phase space quasi-distributions in general, and I believe I understand the idea behind them. The Wigner function arises when you decompose a general operator in terms of a reflection (Fourier transform of translation) basis. As we're talking about phase space distributions, we're actually translating not only position or momentum, but both at the same time. That's why the Wigner function has a very strict connection with the operator $\alpha \hat{q} + \beta \hat{p}$. See http://arxiv.org/abs/quant--ph/0401155.
Wigner functions have been defined also in discrete quantum systems (the article I cited does this), such as the ones arising in Nuclear Magnetic Resonance. The fact that there are many different definitions and some of them are in conflict doesn't matter now.
My question regards the nature of the phase space whose lines we're assigning observables to. What is a discrete phase space, mathematically?
A continuous phase space is a fibre of a cotangent bundle, and it is a differentiable manifold. A discrete phase space is not a manifold, but admits triangulations (simplexes). Is is a cotangent bundle of something? Can we consider operators of position or momentum over it (I believe we can't)? To make things worse, this discrete space is actually$\mod N$ (with $N$ prime or power of a prime), so it's somehow associated to a discrete torus. This only makes things worse for me.
P.S.: Notice I'm not talking about the phase space of a discrete dynamical system, but about a discretisation of a phase space itself. I believe those are not related.

A: I'll answer my own question and hope this information is useful to someone. I'll take $\hbar = 1$ and will deal with systems of one degree of freedom (the generalisation should be obvious). The normalisation factors are very confusing, so I'll omit most of the reasons for them to be what they are.
First, let's take a look at the good old continuous Wigner function. There are many ways to define it. I'll describe two.
Wigner function as coefficients in an expansion in terms of Weyl-Heisenberg operators
Consider the operator $\hat{T}_{(a,b)} = e^{-i(a\hat{p} - b\hat{q})}$. This operator is the generator of translations in position by $b$ and in momentum by $a$. We are, thus, dealing with a formalism that puts positions and momenta on the same ground (we say we're dealing with quantum mechanics in phase space). Associated to the translation operators we can define another operator as its symplectic Fourier transform, i.e, $\hat{R}_{(q,p)} = \frac{1}{2\pi} \int e^{-i(ap - bq)} \hat{T}_{(a,b)}$. It can be shown that these operators form a representation of the group of reflections and translations in a 2-dimensional phase space. We can also show that these operators are orthonormal with respect to the Hilbert-Schmidt metric,
$$ Tr \left(\hat{T}^\dagger_{(a,b)} \hat{T}_{(a',b')} \right) = 2 \pi \delta(a' - a) \delta(b'-b) \\
Tr \left(\hat{R}^\dagger_{(q,p)} \hat{R}_{(q',p')} \right) = 2 \pi \delta(q' - q) \delta(p'-p) .$$
This means that we can expand any operator acting in our Hilbert space in a reflection (or translation basis). In the expansion of the density matrix as a continuos linear combination of reflections,
$$\hat{\rho} = \frac{1}{2\pi} \int W(q,p) \hat{R}_{(q,p)} dq dp ,$$
the coefficients are defined as the Wigner function associated to the system. Such equation can be inverted to explicitly give us
$$W(q,p) = Tr(\hat{\rho} \hat{R}) .$$

Wigner function from projection properties
Say we create a function from the density matrix
$$W(q,p) = Tr(\hat{\rho} \hat{R}) ,$$
and that we wish this operator to have the following property: the integral of $W$ over the strip of phase space bounded by the parallel  lines $aq + bp = c_1$ and $aq + bp = c_2$ is the probability that the operator $a\hat{q} + b\hat{p}$ will take a value between $c_1$ and $c_2$. This, by itself, it enough to define the operator $\hat{R}$ and fix the form of the Wigner function (you only need to invert a Radon transform to get it).

Now, let's go back to discrete phase space. After reading a lot of articles on the subject I noticed what they do is to define the Wigner function either as coefficients, or following the projection property. But, since they're trying to define a quasi-probability distribution to a system with discrete degrees of freedom (mostly spin), the "phase space" needs to be discrete. Actually more than discrete, it needs to be a torus, because the system has only a finite number of accessible states (contrary to the continuous case, where there were infinite accessible states). The thing here is that what you need to do is to either create reflection operators on this discrete set or associate an eigenstate of some observable with lines in phase space and use it as a guide to create a Wigner function-like object, to mimic the continuous case. Nevertheless, you are trying to associate a net of points with states. This is very different from the continuous case, where you where starting from a phase space in the sense of classical mechanics ($q$ and $p$ and etc).
So, my conclusion is the following: the "discrete phase spaces" that appear in the Wigner function formulation of finite state quantum mechanics have nothing to do with quantum mechanics in phase space. These strange, non-unique Wigner functions are nothing more than an efficient way of performing state tomography. The question regarding the possibility of discretisation of phase space lost their meaning, and should be forgotten. I'll, nevertheless, still focus in the problem of compactifying cotangent fibres.
Now, two points of view were very interesting. The first one deals with really creating a group-quotient structure in a classical phase space projecting the Wigner representation from the plane to the torus. By a main result in the spectral theory of compact operators, compactifying the domain of the elements of the Banach space the operator is defined upon results in the countability of its spectrum. This means that projecting the Wigner function from the plane to any compact domain (the torus is the most important case) will cause the operators that act in the Hilbert space to discretise their spectra. This means that we can in fact find the discrete analog of the Wigner function through phase space formalism, but this only makes sense when we're measuring systems where position and momentum are discrete. Spins and angular momenta still need the artificial Wigner-like functions commented above. (The article that develops this is Annals of Physics 276, 223-256 (1999).)
The second point of view that was really interesting deals with problems concerning the dimension of our state-space. Since the dimension is finite, we need a finite field in order to make mathematical sense out of, for example, foliations of finite-dimensional nets (if we were not on a field, two non parallel lines would intersect in more than one point). Now, finite-fields are only possible when the quotient set is taken to be $mod p$, where $p$ is a prime. In order to deal with systems whose degrees of freedom do not follow the prime condition, the authors read a little about Galois theory and added points inside the state space without changing the modular group basis. This was one of the cutest applications of Galois theory in applied physics I've ever seen. (The article that deals with this is Physical Review A 70, 062101 (2004).)
I'm sorry for the long answer. I hope it's useful to someone.


text:
Q: Summary of all IBOutlet, IBAction connections in a project? Is there a tool or trick for displaying all the connections between objects in an Xcode project?  I'm thinking of some kind of graphical display, or less desirably, a table.  Naturally this would be very useful for troubleshooting or studying sample code.  I tried searching in here (SO) but the terms appear in many questions and connections has another meaning.  Thanks.

A: Following Rob Napier's suggestion, something like "ibtool --connections foo.xib" might help.  See http://cocoapi.wordpress.com/2009/02/20/how-to-look-for-a-specific-bind/ for some grunt stuff that might help as well.
I am new to this, too, and coming from android side.  I wonder if it's better in the long run to define all connections dynamically in the view controller as needed, if that can be done in all scenarios.  At least you can see how everything is hooked up there in one place.

A: In IB, you can simply click on File's Owner instead of on individual elements and it will show all available IBOutlets and IBActions in the right sidebar and what they are connected to.


text:
Q: Access declared "try-with"-resource in catch-clause I have an autoclosable class named "VirtuellTx". It is a special kind of transaction and supports a "commit()"- and "rollback()"-Method. How can I access the declared "VirtuellTx"-resource in the catch-block to perform a rollback()?
try (VirtuellTx lVtx = new VirtuellTx()) {
    // do something ...
    lVtx.commit();
} catch (Exception e) {
    lVtx.rollback();
}

The catch-block can not access lVtx: "lVtx cannot be resolved"

A: Resources are only in scope inside the block of the try-with-resources statement. JLS says:

The scope of a variable declared in the ResourceSpecification of a try-with-resources statement (§14.20.3) is from the declaration rightward over the remainder of the ResourceSpecification and the entire try block associated with the try-with-resources statement.

Move the catch inside:
try (VirtuellTx lVtx = new VirtuellTx()) {
  try {
    // do something ...
    lVTX.commit();
  } catch (Exception e) {
    lVtx.rollback();
  }
}


text:
Q: FindGameObjectsWithTag does not work after build Script not working in build - ok in editor.
It looks like this:
public GameObject [] fMassiv;

These are the tags I am looking for:
f_line14 (UnityEngine.GameObject) or f_line15 (UnityEngine.GameObject) or f_line16 (UnityEngine.GameObject) etc.
void OnMouseDown ()
{
    string f_string = "f_line" + searchable number + "(UnityEngine.GameObject)";

    fMassiv = GameObject.FindGameObjectsWithTag (f_string); // and here in the build everything shuts up (((
}

The postscript: (UnityEngine.GameObject), is made by you itself. objects are cloned from the prefab.
But here that is curious.
If I bring f_string to the console, I'll see: f_line16 (UnityEngine.GameObject),
and if in TextBox, then only: f_line16.
I tried to drive into the array and so:
fMassiv = GameObject.FindGameObjectsWithTag ("f_line" + number);

or
fMassiv = GameObject.FindGameObjectsWithTag ("f_line" + number + "(UnityEngine.GameObject)";

does not work.
Once again: in Unity, everything works great.
sorry for my English

A: Just a detail I noticed:
In your tag-descriptions e.g. f_line14 (UnityEngine.GameObject) (copied from above) there is a "space" between the f_lineXX and (UnityEngine.GameObject).
While this line of code:
string f_string = "f_line" + number + "(UnityEngine.GameObject)";

does not generate the same format (space is missing).
Are you manually creating your tags? Or are they procedurally created (through code)? Generally I cannot think of any reason that this would work in the editor but not in the build.
Some more info might help. Form example: are your gameobjects just scene objects? Or are they instantiated prefabs?


text:
Q: How to Connect Openedge to Crystal Report has anyone tried Connecting Openedge 11.1 or 11.7 to Crystal Reports? If so, what version of Crystal Reports should I use? Hoping someone will help. Thanks a lot.

A: Crystal Reports wants a SQL connection to the OpenEdge database.
If your client is a Windows client and has Progress installed on it the ODBC/JDBC drivers should already exist.  If you do not have Progress already installed the drivers are a free download from progress.com:
https://www.progress.com/odbc/openedge
https://www.progress.com/faqs/datadirect-odbc-faqs/progress-database-odbc-and-jdbc-driver-faq
If the OpenEdge DB has been configured to permit SQL access you will need to work with the OpenEdge DBA to obtain the connection details:  hostname, port, username, and password so that you can create the appropriate connection configuration within Crystal.
If the OpenEdge DB is not currently configured to support SQL queries the DBA will need to add that capability and then provide you with the credentials.
If the database is provided as part of a 3rd party application you may need to work with the vendor to get that setup.


text:
Q: Searching for contents in huge number of files in java We are building search feature in our application to traverse over more than 100,000 xml files for content.
Data content are in form of huge number of xml files.
Is this a good idea to keep huge number of xml files and on search (like by name etc) traverse through each file for result? It may reduce our application search performance.
Or what is the best way?

A: You want elasticsearch here.  It will give you what you need.


text:
Q: PostgreSQL SELECT can alter a table? So I'm new to SQL like databases and the place that I work at migrated to PostgreSQL. One table drastically reduced its contents. The point is, I only used SELECT statements, and changed the name of the columns with AS. Is there a way I might have changed the table data?

A: When you migrate from a DBMS to another DBMS you must be sure that the objects created are strictly equivalent... The question seems to be trivial, but is'nt.
As a matter fact one important consideration for litterals (char/varchar...) is to verify the collation used formerly and the collation you have used to create the newly database in PostGreSQL.
Collation in an RDBMS is the way to adjust the behavior of character strings with regard to certain parameters such as the distinction, or not, of upper and lower case letters, the distinction, or not, of diacritical characters (accents, ligatures...), specific sorting to language, etc. And constitutes a superset of the character encoding.
Did you verify this point when using some WHERE clause to search some litterals ? If not, try to restricts litteral in applying the right collation (COLLATE operator) or use UPPER function to avoid the distinguish between upper and lower chars...


text:
Q: WPF: Problem with TreeView databinding I have a tree view defined as follows:
<HierarchicalDataTemplate x:Key="ChildTemplate"
                          ItemsSource="{Binding Children}">
    <TextBlock Text="{Binding TagName, Mode=OneWay}"/>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="NavigationHeaderTemplate"
                          ItemsSource="{Binding Children}"
                          ItemTemplate="{StaticResource ChildTemplate}">
    <StackPanel Orientation="Horizontal" Margin="0">
        <Image Source="{Binding Image}" Height="16" Width="16"></Image>
        <TextBlock Text="{Binding Header}"></TextBlock>
    </StackPanel>
</HierarchicalDataTemplate>
<TreeView Grid.Row="0" Grid.Column="0" Margin="0"
    FlowDirection="LeftToRight"
    ItemTemplate="{StaticResource NavigationHeaderTemplate}"
    Name="TreeView2">
</TreeView>

The data binding is:
public class ViewTag : INotifyPropertyChanged
{
    private string _tagName;
    public string TagName
    {
        get { return _tagName; }
        set
        {
            _tagName = value;
            PropertyChanged(this, new PropertyChangedEventArgs("Tag Name"));
        }
    }
    private ObservableCollection<ViewTag> _childTags;
    public ObservableCollection<ViewTag> ChildTags
    {
        get { return _childTags; }
        set
        {
            _childTags = value;
            OnPropertyChanged(new PropertyChangedEventArgs("Child Tags"));
        }
    }

    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;
    public void OnPropertyChanged(PropertyChangedEventArgs e)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, e);
    }
    #endregion

    public ViewTag(string tagName, ObservableCollection<ViewTag> childTags)
    {
        _tagName = tagName;
        _childTags = childTags;
    }
}

public class ViewNavigationTree
{
    public string Image { get; set; }
    public string Header { get; set; }
    public ObservableCollection<ViewTag> Children { get; set; }
}

And my test binding is:
        var xy = new List<ViewNavigationTree>();
        List<ViewTag> tempTags = new List<ViewTag>();
        ViewTag t1, t2, t3, t4, t5, t6;
        t1 = new ViewTag("Computers", null);
        t2 = new ViewTag("Chemistry", null);
        t3 = new ViewTag("Physics", null);
        var t123 = new ObservableCollection<ViewTag>();
        t123.Add(t1);
        t123.Add(t2);
        t123.Add(t3);
        t4 = new ViewTag("Science", t123);
        var t1234 = new ObservableCollection<ViewTag>();
        t1234.Add(t4);
        t5 = new ViewTag("All Items", t1234);
        t6 = new ViewTag("Untagged", null);

        var tall = new ObservableCollection<ViewTag>();
        tall.Add(t5);
        tall.Add(t6);
        xy.Add(new ViewNavigationTree() { Header = "Tags", Image = "img/tags2.ico", Children = tall });

        var rootFolders = eDataAccessLayer.RepositoryFacrory.Instance.MonitoredDirectoriesRepository.Directories.ToList();
        var viewFolders = new ObservableCollection<ViewTag>();
        foreach (var vf in rootFolders)
        {
            viewFolders.Add(new ViewTag(vf.FullPath, null));
        }
        xy.Add(new ViewNavigationTree() { Header = "Folders", Image = "img/folder_16x16.png", Children = viewFolders });

        xy.Add(new ViewNavigationTree() { Header = "Authors", Image = "img/user_16x16.png", Children = null });
        xy.Add(new ViewNavigationTree() { Header = "Publishers", Image = "img/powerplant_32.png", Children = null });

        TreeView2.ItemsSource = xy;

Problem is, the tree only shows:
+ Tags
    All Items
    Untagged
+ Folders
    dir 1
    dir 2
    ...
Authors
Publishers

The items I added under "All Items" aren't displayed.
Being a WPF nub, i can't put my finger on the problem. Any help will be greatly appriciated.

A: The only thing that jumps out here is that you're referencing the Children property in your ChildTemplate instead of ChildTags as defined in ViewTag.

A: For TreeView binding, you need to use a HierarchicalDataTemplate. This allows you to specify both the data for the node, and also the children for the node (by binding to ItemsSource).


text:
Q: Which function will identify the name of an R variable's enclosing environment? I've been reading about R environments, and I'm trying to test my understanding with a simple example:
> f <- function() {
+   x <- 1
+   environment(x)
+ }
>
> f()
NULL

I'm assuming this means that the object x is enclosed by the environment named NULL, but when I try to list all the objects in that environment, R displays an error message:
> ls(NULL)
Error in as.environment(pos) : using 'as.environment(NULL)' is defunct

So I'm wondering if there's a built-in function I can use on the command line that will return the environment name given the object name.  I tried this:
> environment(x)
Error in environment(x) : object 'x' not found

but that returned an error as well.  Any help will be greatly appreciated.

A: Variables created in function calls are destroyed when the function finishes executing (unless you specifically create them in other persistent environments).  As @joran pointed out, when a function is called, a temporary environment is created where local variables are defined, and is destroyed when the function is done executing (that memory is freed).  However, as @MrFlick pointed out, if the function returns a function, the returned function maintains a reference to the environment it was created in.  You can read more about 'scope', 'stack', and 'heap'.  In R there are various ways you can define your variables into specified environments.
f <- function()  {
    x <<- 1  # create x in the global environment (or change it if it's there)
    ## or `assign` x to a value
    ## assign(x, value=1, envir=.GlobalEnv)
}
environment(f)  # where was f defined?
exists("x", envir=.GlobalEnv)
# [1] TRUE

A: The package pryr has some nice functions to do these kind of things. For example, there is a function called where which will give you the environment of an object:
library(pryr)
f <- function() {
    x <- 1
    where("x")
}
f()
<environment: 0x0000000013356f50>

So the environment of x was the temporary enviroment created by function f(). As people have said before, this enviroment is detroyed after you run the function, so it will give you a different result each time you run f().


text:
Q: How to auto email test failures with pytest or other python packages? I have a page and test class, the test class looks something like below
import unittest
import pytest
import logging

@pytest.mark.usefixtures("setup")
class BigRandomTest(unittest.TestCase):
    log = cl.testogger(logging.DEBUG)

    @pytest.fixture(autouse=True)
    def classSetup(self):
        self.synMax = CarMaxSyndicated()

    # Standard set of tests
    @pytest.mark.run(order=1)
    def test_column_uniqueness_dealership(self):
        pass
        self.log.debug('List of all column duplicate counts: \n' + str(result[1]))
        assert result[0].empty, 'Test failed. Columns with a suspect amount of duplicates: \n {}'.format(result[0])

    @pytest.mark.run(order=2)
    def test_column_uniqueness_consistency_dealership(self):
        pass
        self.log.debug('List of all column duplicates differences: \n' + str(result[1]))
        assert result[0].empty, 'Test failed. Columns with significantly different duplicate counts between collections: \n {}'.format(result[0])

when I run the pytest -s -v path_to_test --html=result.html --self-contained-html it generates the report but what I want to do is email the report whenever there is a test failure only, I can setup some stmp or if there is a package that I can use it would be helpful.

A: Here is what the full code for conftest.py would look like for this situation:
conftest.py
import pytest
import smtplib
import ssl
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

failed: bool = False

def send_email():
    """
    function to send an email with attachment after all test are run and a failure was detected
    """
    subject: str = "subject"
    body: str = "body"
    sender_email: str = "email"
    receiver_email: str = "email"
    password: str = "password"  # Recommended for mass emails# This should obviously be an input or some other stronger protection object other than a string
    smtp: str = "smtp"
    filename: str = "result.html"
    port: int = 587

    # Attachments need to be multipart
    message = MIMEMultipart()
    message["From"] = sender_email
    message["To"] = receiver_email
    message["Subject"] = subject
    message["Bcc"] = receiver_email
    # Add body to email
    message.attach(MIMEText(body, "plain"))

    # Open html file in binary mode
    # This will only work if HTML file is located within the same dir as the script
    # If it is not, then you will need to modify this to the right path
    with open(filename, "rb") as attachment:
        # Add file as application/octet-stream
        # Email client can usually download this automatically as attachment
        part = MIMEBase("application", "octet-stream")
        part.set_payload(attachment.read())

    # Encode file in ASCII characters to send by email
    encoders.encode_base64(part)

    # Add header as key/value pair to attachment part
    part.add_header(
        "Content-Disposition",
        f"attachment; filename= {filename}",
    )

    # Add attachment to message and convert message to string
    message.attach(part)
    text = message.as_string()

    # Log in to server using secure context and send email
    context = ssl.create_default_context()
    with smtplib.SMTP(smtp, port) as server:
        server.starttls(context=context)
        server.login(sender_email, password)
        server.sendmail(sender_email, receiver_email, text)

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
    global failed
    report = yield
    result = report.get_result()

    if result.when == 'call' and result.outcome == "failed":
        failed = True
        print("FAILED")

def pytest_sessionfinish(session, exitstatus):
    if failed is True:
        send_email()

There are two key functions within this file.

*

*pytest_runtest_makereport

*pytest_session

pytest_runtest_makereport will run after every test and simply check if the test failed or not. If any test fails, then the failed flag will be set to True.
Then at the end of the whole script, pytest_session will run and check if the flag was changed to True. If it was, then an email will be sent with the result.html file attached.
I would like to highlight that part of this question was previously answered before, see the link below:
How to send pytest coverage report via email?
Given the linked question/answer did not contain any information on how to only run if a test failed. I decided it was worth answering here.


text:
Q: How to add additional grouped address to edit and detail view? SugarCRM 6.5 has built in grouped address fields in the Lead Module for the Primary Address and for the Alternate Address that can be used with the Edid and Detail view.  I have been able to add the fields for a third address, but when I add the new address field to the edit view and detail view, it does not show the grouped fields, just a single field.
According to the documentation I can use the customCode option in the Detail View and Edit View definitions, but I have not been able to succesfully get this working.  Does anyone have any suggestions on how to accomplish this?

A: You must give a prefix for all the address fields like 'billing' or 'primary'. Then your address fields would be of the form:
billing_address_street
billing_address_city
billing_address_state
billing_address_postalcode
billing_address_country
In Editview you can show this as a single grouped address by adding the below code in editviewdefs. Replace 'billing' by whatever prefix you have used.
array (
  'name' => 'billing_address_street',
  'hideLabel' => true,
  'type' => 'address',
  'displayParams' =>
  array (
    'key' => 'billing',
    'rows' => 2,
    'cols' => 30,
    'maxlength' => 150,
  ),
),

A: If you have a custom address field that has been added through studio, then sugarcrm won't automatically group the address fields, because the field names end in _c. This is a reported bug: https://web.sugarcrm.com/support/issues/cbb00e33-351b-5448-2e5f-4eaf7551f347
There is a blog post here explaining how to work around it:
http://www.profilingsolutions.com/archive/custom-address-fields/
(basically - remove the _c suffix from the created address fields in the database and fix up the vardefs).


text:
Q: Delete default context menu when right click in CefSharp Chromium webbrowser with WPF In my WPF Application, I am loading a URL in a CefSharp Webbrowser. When I gave rightclick from mouse, a default context menu is displaying as below image

My xaml code is
<Window x:Class="StoneApp.WebviewWindow" WindowState="Maximized"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
    xmlns:local="clr-namespace:StoneApp"
    mc:Ignorable="d"
    Title="MyApp">

<DockPanel>

    <Grid x:Name="mygrid">
        <cefSharp:ChromiumWebBrowser x:Name="my_webview" IsBrowserInitializedChanged ="InitializeBrowser" Grid.Row="0" MouseRightButtonDown="Rightbtn_MouseDown"/>
    </Grid>

</DockPanel>

</Window>

My xaml.cs code is
  public WebviewWindow(string webresponse)
    {
        InitializeComponent();
        this.webresponse = webresponse;
    }

    private void InitializeBrowser(object sender, DependencyPropertyChangedEventArgs e)
    {
        my_webview.Load(webresponse);
    }

    private void Rightbtn_MouseDown(object sender, MouseButtonEventArgs e)
    {
        if (e.RightButton == MouseButtonState.Pressed)
        {
            e.Handled = false;
        }
    }

When I give rightclick I am not able to call 'Rightbtn_MouseDown' function too. So my issue is I would like to delete/hide the default context menu when rightclick on the webbrowser view.

A: You just need to override the default IContextMenuHandler.
webView.MenuHandler = new MenuHandler();

internal class MenuHandler : IContextMenuHandler
{
    public bool IContextMenuHandler.RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback)
    {
        return false;
    }

    public void IContextMenuHandler.OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
    {
        model.Clear();
    }
}

You can read more about this here: https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf.Example/Handlers/MenuHandler.cs


text:
Q: Replaces all nan values in a large array of arrays dataset I am fitting a neural network model (autoencoder) on a very large array of arrays dataset, each nested array has the shape (1, 100, 4).
Train_X.shape
(639936, 1, 100, 4)

Right from the first epoch, I got loss with nan for both loss/val_loss:
Epoch 1/50
511948/511948 [==============================] - 267s 522us/step - loss: nan - acc: 0.5239 - val_loss: nan - val_acc: 0.5235
Epoch 2/50
511948/511948 [==============================] - 272s 530us/step - loss: nan - acc: 0.5234 - val_loss: nan - val_acc: 0.5233

Changed all hyperparameter values (optimizer, learning rate etc) yet nothing same problem. On further checking the dataset, I learned there're values with nan, possibly responsible for the nan loss:
if np.isnan(Train_X).any():
  print(Train_X)

[[[[ 5.66440628e-03 -1.11057350e-02  5.35699731e-03  1.42108547e-14]
   [ 4.05186182e-03 -4.71546882e-03 -1.57709147e-03  9.35064891e+01]
   [ 3.92575255e-03 -1.45019307e-03 -7.44808370e-04  1.87012978e+02]
   ...
   [ 5.88266444e-03 -7.59219123e-03  2.22257658e-03  8.46522144e-06]
   [ 8.78427479e-04 -9.54657321e-04  2.68735736e-04  3.63856117e-06]
   [ 4.57741540e-04  0.00000000e+00  2.89454575e-03  4.30687537e-06]]]

 [[[ 5.81100709e+00 -6.76592913e-01 -1.31451089e+00  2.66544929e-04]
   [ 6.05009120e+00 -6.07611268e-03 -8.90299844e-01  5.74642441e-04]
   [ 6.40465738e+00  1.82869833e-01  6.22291158e-02  1.03689017e-03]
   ...
   [ 4.96069986e+00  1.04734007e-01 -2.17030850e-01  7.26117358e-05]
   [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+00]
   [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+00]]]

 [[[            nan             nan             nan  0.00000000e+00]
   [            nan             nan             nan  0.00000000e+00]
   [            nan             nan             nan -1.50999068e-05]
   ...
   [ 5.62468522e-03  4.27860671e-03 -2.06719201e-03  0.00000000e+00]
   [ 1.11051478e-02  3.74979015e-03  1.34607852e-03  0.00000000e+00]
   [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+00]]]]

I can also confirm this with the first entry to Train_X:
Train_X[0]
array([[[ 5.66440628e-03, -1.11057350e-02,  5.35699731e-03,
          1.42108547e-14],
        [ 4.05186182e-03, -4.71546882e-03, -1.57709147e-03,
          9.35064891e+01],
        ...
        [ 7.10669020e-02,  4.91383899e-03, -1.43700407e-02,
          1.52228864e-04],
        [ 7.59807410e-02, -9.45620170e-03,             nan,
          1.35892100e-04],
        [ 6.65245393e-02,             nan,             nan,
          8.98521456e-05],
        [            nan,             nan,             nan,
          1.41090006e-05],
        [            nan,             nan,             nan,
          6.68319391e-06],
        [            nan,             nan,             nan,
         -3.27272689e+01],
        [            nan,             nan,             nan,
         -1.09090911e+01],
        [            nan,             nan,             nan,
          8.25973981e+01],
        [            nan,             nan,             nan,
          1.12207785e+02],
        [            nan,             nan,             nan,
          1.65194797e+02],
        [            nan,             nan,             nan,
          2.25974015e+02],
        [            nan,             nan,             nan,
          2.78961026e+02],
        [ 3.87926649e-03,  1.81274134e-04, -1.08764481e-03,
          3.41298685e+02]]])

I want a way to check for all values where there're nan and replaces it by the column's mean or median. If the whole column happens to be all 0s and nan, I want to delete that particular array from Train_X. So that I can feed the network with dataset NOT containing any nan, and see if the loss change from the current state.
How can I do that?

A: you can use np.isnan, np.nanmean and indexing, the second x[np.isnan(x)] is to set the all nan columns to zeros
x = np.random.randint(0,100,[2,1,4,4]).astype(float)
x[0][0][[0,1,3],[1,2,2]] = float('nan')
x[1][0][[0,1,3],[1,3,2]] = float('nan')
x[0,0,:,1] = float('nan')
x
array([[[[58., nan, 43., 56.],
         [88., nan, nan, 69.],
         [ 2., nan, 56., 21.],
         [65., nan, nan, 23.]]],

       [[[96., nan, 86., 19.],
         [33., 69., 83., nan],
         [93., 21.,  7.,  2.],
         [49., 21., nan, 84.]]]])
x.shape
(2, 1, 4, 4)
columnMean =  np.nanmean(x,axis=2) #get the mean value for each column
idc = np.where(np.isnan(x)) # get the indices of nan values
x[np.isnan(x)] = columnMean[idc[0],idc[1],idc[3]] # set nan values to corresponding mean
x[np.isnan(x)] = 0 # set nan columns to zero
x
array([[[[58.        ,  0.        , 43.        , 56.        ],
         [88.        ,  0.        , 49.5       , 69.        ],
         [ 2.        ,  0.        , 56.        , 21.        ],
         [65.        ,  0.        , 49.5       , 23.        ]]],

       [[[96.        , 37.        , 86.        , 19.        ],
         [33.        , 69.        , 83.        , 35.        ],
         [93.        , 21.        ,  7.        ,  2.        ],
         [49.        , 21.        , 58.66666667, 84.        ]]]])


text:
Q: Uncertainty versus randomness I would like to know the difference between uncertainty and randomness in mathematical fashion. I tried to find it but I get confused , as some people said they are the same? But can any one provide me logical reasoning behind it. If they are not same then please explain it why?

A: Don't get too hung up on it.
People use different words in different situations.
It's not so much that they have different meanings, as that their meanings are situation-dependent.
Randomness is just a fuzzy general term meaning something is random.
In statistics, uncertainty is used to mean that some property of a distribution, such as its mean, is itself unknown but can be given a distribution.
For example, suppose you want to know the average weight of all people.
You could find it out exactly if you could go around to all people, get their weight, add it all up, and divide by the number of people.
But that's too hard to do, so suppose you just pick 10 people at random and get their average weight, and pretend it's the same as the average of everybody.
That's called the sample mean, but you know it isn't accurate.
It has what is called a standard error, meaning it has uncertainty.
In fact, if you were to do that experiment many times over with different people, you would get a different sample mean every time, and those sample means would themselves form a bell-shaped distribution, the standard deviation of which would be called the standard error, representing its uncertainty.
In general, if you increased the number of people you look at by a factor of 100, you can reduce the standard error, the uncertainty, by a factor of 10.
I bet you can tell that people who take polls for a living care about this stuff very much.

EDIT for the downvoter: In case the downvote is because this doesn't look like a stackoverflow question or answer,
I've made a point of advocating the random pausing method of profiling.
Profiling in large part is perceived to be about measuring (statistically) the time that programming constructs are responsible for.
Often people are inhibited from using that method because they are afraid the results have too much uncertainty.
This post gets very specific about what that uncertainty actually is.
It shows that the bogey-man fear of uncertainty has the effect of preventing people from finding really substantial speedups in their code.
So naivete' about statistics is definitely a serious programming problem.

A: My view looks at a scenario using three different coloured balls:
I love some of the answers given here. My own view, based on my current research, is that these are two distinct terms. Uncertainty refers to not knowing in advance which ball could be selected when a person, for instance, is given a chance to select one ball from three different coloured balls.
This remains true when each ball has an equal chance of being selected i.e. equal probabilities. However, things soon get complex when each ball has it's own distinct probability. Chances are that the one with the highest probability will be selected. This seems especially true in algorithm development which would almost always select the highest probability compromising the meaning of randomness.
Having said all of this - I believe these concepts remain confusing which has just made me realise the time I need to dedicate on clearly distinguishing between the two to make sure my current research is not confusing. My own predicament is that I need to work on stochastic vs deterministic views. Based on the current view stochastic would be more uncertain than random whereas deterministic would be more probability based i.e. knowing for certain that the highest probability would be chosen; but this seems very far from the truth.
It seems as if uncertainty holds until just before a ball is selected/touched and soon looses its meaning as soon as the ball is picked which should result to its probability being revised. I personally think the terms have theoretical differences which perhaps allows them to be used interchangeably.

A: Uncertainty in math and science typically means there are a lack of facts, or the facts are unobtainable.  Weather forecasting is a great example of uncertainty.
Randomness has many definitions.  Commonly it's used in probability / statistics  as a measure or quantification of uncertainty.  So in my weather example, a 30% chance of rain is a measure of uncertainty.  The more general definition (which also applies to math / science) is unpredictable, or lack of order.
There is definitely a fuzzy distinction between the two.

A: According to the Bayesian interpretation of probability, uncertainty and randomness are just two names for the same thing.

A: If an experiment is random, then it is uncertain to you. If something is uncertain to you, then it has the randomness property.


text:
Q: ItemClickListener RecycleView Firebase i have recycleview and i retrive data from firebase..i want to show dialog in itemclick to show data of user
that my code and settext in show dialog but error showing that null data
public void showdialog(){

    TextView exist;
    dialog.setContentView(R.layout.doctor_info);
    exist=dialog.findViewById(R.id.exist);
    exist.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    dialog.show();

    //dspecialize.setText(doctors.get(position).getName());
    //dcity.setText(doctors.get(position).getName());

}

@Override
public void onItemClick(int position) {
    doctors.get(position).getName();
    doctors.get(position).getAddress();
    doctors.get(position).getMail();
    doctors.get(position).getPhone();
    dname.setText(doctors.get(position).getName());
    dmail.setText(doctors.get(position).getMail());
    daddress.setText(doctors.get(position).getAddress());
    dgender.setText(doctors.get(position).getGender());
    dphone.setText(doctors.get(position).getPhone());

    showdialog();
}


text:
Q: Trigger a modal I have problem with trigger a modal,
i check for jquery and its ok.
I am using 1.12.4 version and i have tag in head of code:

My open modal tag is:

And my modal cocde is:

Modal Header

A bunch of text

    <input type="text" name="id" value=""></input>

        Agree

With this code i try trigger showing a modal:

Just for note, modal was show but trigger not work.

A: With the code you've provided, I created this in a .html file:
<!DOCTYPE html>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

  Howdy

Modal Header

A bunch of text

  <input type="text" name="id" value=""></input>

    Agree

Note that I added Howdy inside the  tags meant to trigger the modal. That makes it so there is an area where the user can click. I clicked on the link, the alert appeared, followed by the modal. This works on Safari 10.0.3. Hopefully this helps.

A: I don't think there is wrong in your html code. As you can see below its properly working in Chrome/Firefox. I hope this might work for you
  <!DOCTYPE html>

    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">

  Modal Open

Modal Header

A bunch of text

      <input type="text" name="id" value=""></input>

          Agree

A: First: Input tags don't need to be closed, so I advise you to remove the close tag for input and leave it like this:
<input type="text" name="id" value="">

Second: The data-toggle and href attributes already link the anchor to open the modal, so you don't need the javascript function to do it, simply use your html code
See it working here


text:
Q: Padding not working on overlay i'm creating a div with the image and putting overlay on the top . when you hover on image the overlay will appear but it's not taking the padding

          $9.00

          MENS,T-SHIRT

            <button type="button" class="btn btn-default-buy">
              add to cart
            </button>

My CSS
.full-width{
padding-right: 0px !important;
padding-left: 0px !important;
background-color: #F6F6F6;
}

now the problem is here its taking padding for the image class but its not taking overlay class padding
.overlay{
opacity: 0;
transition:all 0.5s ease-in-out;
-webkit-transition:all 0.5s ease-in-out;
-o-transition:all 0.5s ease-in-out;
-moz-transition:all 0.5s ease-in-out;
width:100%;
height:100%;
background-color:rgba(0,0,0,0.5);
position: absolute;
padding: 20px;
}

.spaces{
padding:20px;
}

i wan't my overlay to be the exact size of image any suggestions ? or any efficient way of doing it?

A: There is another way. I will show an example. Here will be the three-type zooming effect.
<!DOCTYPE html>

<title> Powerful Zooming Effect Using jQuery  </title>

<form id="form1" runat="server">

</form>

A: You can use this code below: Here is the Live Demo

 $9.00

 MENS,T-SHIRT

<button type="button">add to cart</button>

.container{
    width:200px;
    height:200px;
    background:green;
    position:relative;
}
.container img{
    width:100%;
    height:100%;
}
.overlay{
    width:100%;
    height:100%;
    background:red;
    opacity:0;
    position:absolute;
    text-align:center;
    box-sizing:border-box;
    padding:20px;
    top:0;
    transition:all .5s;
    transform:scale(.9, .9);
}
.overlay:hover{
    opacity:1;
    transform:scale(1, 1)
}

A: Add this css in overlay class

.overlay{
   box-sizing: border-box;
}

A: By default, background applies to the inner space, including padding.
If you don't want this, you can change with  background-clip property. In your case,
.overlay {
    background-clip: content-box;
}

fiddle

A: I tried to reproduce your code. As you can see the padding works on the overlay.
Can you check if one of the paragraph tags inside the overlay class has some padding or margin?
Other option will be that some other css code overrides the overlay container elsewhere. You should check this with a browser inspector.

.container {
    background:green;
}

.overlay {
    position: absolute;
    width:150px;
    height:150px;
    padding: 20px;
    background:red;
}

.overlay:hover {
     opacity:.5;
}

.spaces {
    width:150px;
    height:150px;
    padding:20px;
}

I'm overlay

          $9.00


text:
Q: Unity3d surrogate pairs emoji not appears I am working in a unity project, and I am adding a chat module in it.
I am facing a problem with emotions as it doesn't appear. I changed the .Net framework of unity to use microsoft .net framework and then used the code that solve the problem inside microsoft .net desktop application
 string codePoint = "1F601";
 int code = int.Parse(codePoint, System.Globalization.NumberStyles.HexNumber);
 string unicodeString = char.ConvertFromUtf32(code);

And the code above solved it and I can see the smily face. But when I use it in unity3d I got the output like that (It separated the surrogate to two parts, the high surrogate and the low surrogate).
\ud83d\ude01

Is there any solution for this problem or at least a work around.
Thanks.


text:
Q: How to lock "Run" button in TeamCity I made a build in TeamCity which deploys code to live server. As a precaution I want to disable that button "run" can be clicked by mistake.So I want to have an additional level of checking "whether I'm sure" I want to click "run" button. Is it possible to accomplish?
Thanks in advance!

A: Another, easier option, is to add a agent requirement to your build such that only the production server's agent can meet it (e.g. env.COMPUTERNAME equals MyProductionServer01), and then disable the agent with a note about "locking" the production build. This will prevent the build from actually running if you accidentally click the Run button.

A: You cannot disable the run button but you can set permissions so that people are still able to view the project without the ability to run it (specifically the Run Build role).
As far as the confirmation goes there is nothing built into TeamCity to accomplish this but I do believe it would be possible to write a small plugin to gain this type of functionality.
Plugin Information:
http://confluence.jetbrains.net/display/TCD6/Developing+TeamCity+Plugins

A: Indeed, there is no ability to hide Run button unless the build configuration is placed in a different project, which user has no permission to run builds in.
There is a related feature request in TeamCity issue tracker.
As to requesting confirmation, there is still no direct support, but since TeamCity 7.0 one may add a parameter with mode "prompt" and this will result in the run custom build dialog popping out on Run button click.

A: We have solved this by providing double log-ins for our users. The normal user is not having permisson to run dangerous projects, but if the log in as elevated.user they have access to the run button for these projects as well.
So in normal situations there is no risk of running by accident.

A: I don't think there is a way to disable the run button.
An approach I've used is to have a Property which gets passed to the build script which needs to be true for the script to run, it's false or not set then the build script throws an error. Then in the build configuration on the Properties & Environment Variables page I set the property to false. Now whenever I need to run the script I have to use the "Run custom build" button (the "| ..." bit beside the run button), then I set the value to true before hitting the build button.

A: I don't think there is disable button for run. You can pause the build and run it when you want to deploy to live sever.

A: Not that I'm aware of. If you have enterprise you could set it up so that there is a special account which has permissions to execute that build. Another workaround would be to make the build look at a specific branch in your SCM repo with restricted permissions, etc. Typically merging to a branch requires a bit of effort so its not as easy as hitting run by accident. Also ensures that someone hitting run won't necessarily grab the latest unstable copy from the trunk or somesuch.

A: You can now remove the Run button by adding teamcity.ui.runButton.caption parameter with an empty value.
See this comment on YouTrack.


text:
Q: A tough dice probability conundrum There are 2 fair die. You randomly roll them at the same time. To win is to have the sum of the die or some combination of the sum or the value of each die cover the numbers 1-9 inclusive.
You can roll something like 2&3 and  count it as both 2&3 or count it as the sum which is  5. If you have already counted one of the outcomes once and you roll it again, you MUST count the sum. If the sum is one you have already counted for, you lose. Thus, what is the chance of winning this game (counting all numbers 1-9 without repeats in consecutive rolls)?

A: Using the following Matlab program, I found the following probabilities: In the current
version, double(n) must count as 2n.  A sum of 10,11 or 12 can not be counted, so 4-6 and up must be treated as separate numbers.
$859736710700/36^9 = 0.008465311909368$ if double$(n)$ can count as $n$
$14398449280/36^8 = 0.005103824293391$ if double$(n)$ must count as $2n$
Sorry, I don't know how to include a program
[a,b,c,d,e,f,g,h,i]=ndgrid(0:1);
abc=[a(:) b(:) c(:) d(:) e(:) f(:) g(:) h(:) i(:)];
Win=zeros(1,512);Win(512)=1;
for CountLeft=1:9,
    for State=1:512,
        Vector=[abc(State,:) 1 1 1];
        if sum(Vector)==12-CountLeft,
            R=zeros(6);
            for Die1=1:6,
                for Die2=1:6,
                    BothOK=(~Vector(Die1))&(~Vector(Die2))&(Die1~=Die2);
                    SumOK=~Vector(Die1+Die2);
                    if BothOK,
                        VectorBoth=Vector;
                        VectorBoth([Die1 Die2])=1;
                        BothState=1+VectorBoth(1:9)*2.^[0:8]';
                        BothScore=Win(BothState);
                    else BothScore=0;
                    end;
                    if SumOK,
                        VectorSum=Vector;
                        VectorSum(Die1+Die2)=1;
                        SumState=1+VectorSum(1:9)*2.^[0:8]';
                        SumScore=Win(SumState);
                    else SumScore=0;
                    end;
                    R(Die1,Die2)=max(SumScore,BothScore);
                end;  end;
            Win(State)=mean(mean(R));
        end;  end;  end;
disp(Win(1));

A: * This is not a full answer. *
It considers only the case where you must win in 6 rolls. Maybe it will help in some way, or be a starting point for a more robust answer.
The game can be won in 6 rolls, at the least. For example, here is one of those ways:

So, lets first figure out how many ways we can roll 6 times. We can roll 2 dice 36 different ways, so 6 rolls we can roll 36^6 = 2,176,782,336 different ways.
Now let's figure out how many ways we can win in 6 rolls. Three of the rolls need to be added, one to obtain 7, one to obtain 8, and one to obtain 9. There are 4 ways to roll a 9 (3,6;6,3;4,5;5,4), 5 ways to roll an 8 (4,4;3,5;5,3;2,6;6,2) and 6 ways to roll a 7 (3,4;4,3;2,5;5,2;1,6;6,1). For the individual numbers (not summed), there are 6! ways to roll them.
Therefore, we have 4*5*6*6! = 86,400 possible ways to win in 6 rolls.
Chance of winning in 6 rolls:
86,400 / 2,176,782,336 = 0.00397% (rounded)


text:
Q: Highlight selected horizontal list item when selected android
Games, Community, Music etc are in Horizontal list view.
Right now Community is selected and community related data is shown below.
I want to highlight Music when it is clicked and change Community colour to default.
listview.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                long arg3) {

((android.widget.LinearLayout)((android.widget.LinearLayout)arg1).getChildAt(2)).setBackgroundColor(getResources().getColor(R.color.MyBlue));
...

This changes the background colour of selected Item but when I scroll other item are also changed which are not selected.
Above code changes linear layout which is define in item's xml file shown below.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:orientation="vertical" >

    <ImageView
        android:id="@+id/IVCategory"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:contentDescription="@string/app_name"
        android:layout_margin="10dp"
        android:layout_gravity="center"
        />

    <TextView
        android:id="@+id/txtCatName"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:gravity="center"
        android:background="@android:color/transparent"
        />

    <LinearLayout
        android:id="@+id/selectedBlue"
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>

Is that possible to do that in the way I'm doing it? I have searched a lot but I couldn't understand how selectors can help me.

A:     * Create Class:

    public class Test {
        private String  name;
        private int selected = 0;

        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }

        public void setSelected(int selected) {
            this.selected = selected;
        }

        public int getSelected() {
            return selected;
        }
    }

Create Custom adaptor:

    public class TestAdaptor extends BaseAdapter {
        Context context;
        List<Test> list;
        private LayoutInflater inflater;
        public TestAdaptor(Context context, List<Test> list ) {
            this.context  =  context;
            this.list  =  list;
            this.inflater  =  LayoutInflater.from(context);
        }
        @Override
        public int getCount() {
            return list.size();
        }
        @Override
        public test getItem(int position) {
            return list.get(position);
        }
        @Override
        public long getItemId(int position) {
            return position;
        }
        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View rowView = convertView;
            try {
                if(rowView == null)
                    rowView =  this.inflater.inflate(R.layout.volume_list_item, null);

                if(list.get(position).getSelected() == 1){
                    rowView.setBackgroundColor(this.context.getResources().getColor(R.color.app_color));
                }else{
                    rowView.setBackgroundColor(this.context.getResources().getColor(R.color.gray));
                }
                rowView.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(final View v) {
                        list.get(position).setSelected(1);
                        notifyDataSetChanged();
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
            }
            return rowView;
        }
    }*

finally:

listview.setAdaptor(new TestAdaptor(this, lsit));


text:
Q: Can't add class while Hover function is in effect What I'm Trying To Do
I have a list (ul#portfoliolist) where each item is a different navigation item.
When the user hovers over any item, the opacity changes from 0.65 to 1, and the right padding changes from 0 to 10px. These are reversed when the user moves the mouse away:
$('ul#portfoliolist>li:not(.active)').hover(function(){
    $(this).stop().animate({paddingRight:'10px',opacity:1},100);
},function(){
    $(this).stop().animate({paddingRight:0,opacity:0.65},300);
})

If a user clicks on the list item, it removes the class active from any other list items and adds the class active to the clicked element:
$('ul#portfoliolist>li').click(function(){
    $('ul#portfoliolist>li').removeClass('active');
    $(this).addClass('active');

    //var item = $(this).attr('data-portfolio');
    //$('div.portfolio').css({backgroundImage:'url(img/portfolio_'+item+'.png)'})
})

The issue I'm having
While these two functions work perfectly well alone, when combining them I'm unable to do both - only the hover effect is successful.
When I hover over, the desired animation works, but when I move the cursor away the secondary hover function occurs and that overrides the .active css.
How can I make the click function take priority over the mouseout part of the hover function?

A: $('ul#portfoliolist>li:not(.active)').hover(function(){
    $(this).stop().animate({paddingRight:'10px',opacity:1},100);
},function(){
    if($this).hasClass('active'){
        return;
    }
    $(this).stop().animate({paddingRight:0,opacity:0.65},300);
})

A: It seems that just writing this out on StackOverflow made it clear enough that I could find a solution myself:
$('ul#portfoliolist>li:not(.active)').hover(function(){
    $(this).stop().animate({paddingRight:'10px',opacity:1},100);
},function(){
    if($(this).hasClass('active')){
        $(this).stop().animate({paddingRight:0},300);
    } else {
        $(this).stop().animate({paddingRight:0,opacity:0.65},300);
    }
})

As the .active class is added between the mouseover and mouseout part of the hover function, I added an if statement to the mouseout function to see if, during the time in which the cursor has entered the element, the class .active has been added.


text:
Q: Best way to import sass / code from GitHub? I'm trying to figure out how Hugo can (automatically) pull the most recent files from a Github folder when running hugo server. In particular, I like to pull css files from Primer CSS by GitHub. What is the best way to implement that, so that I do not always have to update the Primer CSS manually on my Git?
I was thinking modules would be a way (config.yaml):
module:
  imports:
    - disable: false
      path: github.com/primer/css
      mounts:
          - source: src/scss
            target: assets/scss/primer

However, when adding this to config.yaml, it does not appear to work:
Error: module "github.com/primer/css" not found; either add it as a Hugo Module or store it in "/Users/user/code/my-theme/themes".: module does not exist

Is there any simple best practice in automatically pulling the most recent files from https://github.com/primer/css/(/src) and loading it into the /assets folder? Or is the only way to work with npm node modules, like here: https://github.com/lucperkins/hugo-primer
Thanks in advance!

A: I struggled with this for a long time. The key is to initialize your your site as a "go module" by running hugo mod init {anything}. That will create a go.mod file. So if you ran hugo mod init mywebsite that generate a go.mod that looks something like this:
module mywebsite

go 1.14

require github.com/primer/css v1.0.0 // indirect

After that, the modules should work for you.


text:
Q: Parsing variables in curl with bash script Hey I am using conduit curl method to create tasks from post. It work fine when I run from terminal with hardcoded values. But when I try to execute it with variables it throws an error:
Script:
#!/bin/bash
echo "$1"
echo "$2"
echo "$3"
echo "$4"
echo "$5"
echo '{
  "transactions": [
    {
      "type": "title",
      "value": "$1"
    },
    {
      "type": "description",
      "value": "$2"
    },
    {
      "type": "status",
      "value": "$3"
    },
    {
      "type": "priority",
      "value": "$4"
    },
    {
       "type": "owner",
       "value": "$5"
    }
  ]
}' | arc call-conduit --conduit-uri https://mydomain.phacility.com/ --conduit-token mytoken maniphest.edit

execution:
./test.sh "test003 ticket from api post" "for testing" "open" "high" "ahsan"

Output:
test003 ticket from api post
for testing
open
high
ahsan
{"error":"ERR-CONDUIT-CORE","errorMessage":"ERR-CONDUIT-CORE: Validation errors:\n  - User \"$5\" is not a valid user.\n  - Task priority \"$4\" is not a valid task priority. Use a priority keyword to choose a task priority: unbreak, very, high, kinda, triage, normal, low, wish.","response":null}

As you can see in error its reading $4 and $5 as values not variables. And I am failing to understand how to use $variables as input in these arguments.

A: You're using single quotes around the last echo to so that you can use double-quotes inside the JSON, but that causes echo to print the string without expanding anything. You need to use double quotes for the string, so you'll have to escape the double quotes inside of it.
Replace the last echo with this:
echo "{
  \"transactions\": [
    {
      \"type\": \"title\",
      \"value\": \"$1\"
    },
    {
      \"type\": \"description\",
      \"value\": \"$2\"
    },
    {
      \"type\": \"status\",
      \"value\": \"$3\"
    },
    {
      \"type\": \"priority\",
      \"value\": \"$4\"
    },
    {
       \"type\": \"owner\",
       \"value\": \"$5\"
    }
  ]
}"

and it'll work. To avoid issues like this you can check http://wiki.bash-hackers.org and http://mywiki.wooledge.org/BashGuide for some general tips for bash newbies. Also, you can use shellcheck with a lot of text editors, which will spot errors like this automatically.


text:
Q: Block Website in https This code block the website ex: http://google.com or plus.google.com but https://google.com doesn't work
e.Cancel = e.Url.Host.Contains("google");

A: private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
    e.Cancel = e.Url.ToString().Contains("google");
 }


text:
Q: Riemann integrable vs Lebesgue integrable Let $f$ be a real-valued function on $[a,b]$. Assume $f$ is Riemann integrable with strictly positive Riemann integral over $[a,b]$ then $f$ is strictly positive on some nonempty open interval.
What if Lebesgue integrable instead of Riemann?
*What I'm thinking is the following for Riemann.
Assume otherwise, then for all open interval, say $(a',b')$,$\int_{a'}^{b'}f(x) dx\leq 0$. Since $f$ is Riemann-integrable with strictly positive Riemann integral over $[a,b]$, $\int_a^b f(x)dx< 0$. Let $a'\rightarrow a$, and $b'\rightarrow b
$, then $\forall\epsilon>0$, $\exists\delta>0$ such that if $|a-a'|<\delta$ and $|b-b'|<\delta$, then $|\int_a^b f(x)dx-\int_{a'}^{b'}f(x)dx|<\epsilon$. By letting $\epsilon\rightarrow 0$, we'll have $\int_a^bf(x)dx\leq 0$, contradiction.
Is this correct? and what about Lebesgue?

A: The theorem is false in the Lebesgue setting. Consider
$$f(x) = \begin{cases} 0 & x \in \mathbb{Q} \\ 1 & \textrm{otherwise} \end{cases} .$$
Your very first sentence of your "proof" is wrong.
EDIT: I just realized this was meant to be a proof for Riemann-integrable functions, not Lebesgue.

A: For Lebesgue integrals, this is not even true up to modification on a set of measure zero. Take for instance the indicator function of a "fat" Cantor set (cf. page 39 of Folland's 'Real Analysis').

A: The proof for Riemann could be easier.
Since $\int_a^bf(x)dx>0$, there is a Partition $P$ such that $L(P,f)>0$, where $L(P,f)$ means Darboux lower sum. So there must be a interval, where $\inf f>0$


text:
Q: Kendo UI combo-box virtualization issue with small set of local data Combo box is not loading the items after filtering it.
The issue is with around 10-60 items(small set of data).
Steps to reproduce:

*

*Filter an item(eg.: ZIORE) from text box.

*Open the combo box using mouse.

*Scroll down and see the items.

*Loading... text is persist for ever.

                <select kendo-combo-box
           ng-model="product.selectedproduct"
           k-placeholder="'Select product'"
           k-data-text-field="'product'"
           k-data-value-field="'productId'"
           k-data-source="productsDataSource"
           k-index="0"
           k-filter="'contains'"
           k-virtual="productsVirtualOptions"
           k-height="200">
                </select>

I have demonstrated the issue in plunker.
http://plnkr.co/edit/OBt8kJCDMeCUSbhQm1LV?p=preview
Please provide a solution.

A: This is fixed in the latest kendo version.
include the latest version of kendo.
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.default.min.

http://plnkr.co/edit/vHFmfn?p=preview


text:
Q: How to control deep linking? I want to add a deep link in to my app, that opens the native app when the link is clicked. I used Google firebase to implement it. I copied the necessary parts for it and pasted them into my Code. But I dont know how to Control the deeplink. Additionally to that, there is an error in the Code sample from Google, what I can't believe. I searched a lot to solve this Problem, but I coul'nt find something useful.
I added this into my manifest file:
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="example.com"
        android:scheme="https"/>
</intent-filter>

And I created the variable in my main activity:
private GoogleApiClient mGoogleApiClient;

And added this Code snipped to my main activity:

There you can see also the two Errors which I don't understand.
Also, there is the part, where I can handle the link. Unfortunately I don't know how to do it.
Sorry, but I'am new on Android Studio. I Need a Little bit time to understand the stuff :)


text:
Q: communication with local network from other network connection First of all I'm really new to those internet connection properties I would try my best to explain the problem that I faced, hope you guys help on it thanks.
So at first, my network public IP is [175.139.x.x]. On this network, I have a NAS with IP [192.168.x.xxx] I have set up MySQL server in the NAS which will running phpMyAdmin database.
Now it came to the main point, I have develop an IOS app with react native in expo snack. The app will update or insert data into the database. So to doing that action, I have create some php script inside the WEB folder in the NAS [192.168.x.xxx] so in the react native code when I try to fetch the API I would do like thisfetch(http://192.168.x.xxx/api/insert.php),all of this function will works perfectly when the user is connect to the local network which the network with the public IP [175.139.x.x]. But when the user is using other internet connection or using it own mobile data the data would not send to the database. I have tried research on many article and website but I can't found the ways that can overcome this problem. here is the link to my code https://snack.expo.dev/KUjWAk491
Any guidance would be appreciated. Thanks in advance

A: This looks like a typical use of Destination NAT . I hope you do have the privilege (otherwise have your network admin do so) to configure the WAN router. Basically, you want the router to pass the packet oringinally destined to a certain tcp port of your public address e.g 175.139.x.x:8080 ,instead to the tcp port 80 of your LAN address 192.168.x.xxx (as the http in the url http://192.168.x.xxx/api/insert.php use the default tcp port 80 ). That's to say , have the router perform a destination network address translation from 175.139.x.x:8080 to 192.168.x.xxx:80 . Surely, you will have to change the fetch to (http://175.139.x.x:8080/api/insert.php) .
Note, in some cases, people from the internal network visit a LAN server  would still prefer to use the public adress + port (DNAT) to have the WAN router propagate traffic back to the detination LAN server for the sake of address consistency regardless of where the connection is initiated.


text:
Q: sensitivity and specificity is given need to calculate the true positive I have the sensitivity value known as, 0.825 and specificity as 1.00. Can we derive the True Positive (TP) and True Negative (TN) values from that? Is that possible at all?

A: Sensitivity is $\text{TP}/(\text{TP+FN})$, and specificity is $\text{TN}/(\text{TN+FP})$. If specificity is $1$, there is no false positives. The sensitivity figure yields $0.175\times\text{TP}=0.825\times \text{FN}$.
Even if you know the total number of samples, $\text{TP+FN+TN}=n$, you'd still need to know the number of true negatives in terms of others. So, it's not possible to calculate the true pos/neg.


text: Q: How to assert varying payload of connector call in for-each loop in Mule 3 (Munit 1.11)? My Mule 3.9 app (Munit 1.11) consists of a for-each loop in which a http connector is called in each for-each iteration. The payload with which the connector is called varies in each loop. Now I would like to assert the payload in a corresponding Munit test for each for-each iteration. The idea is to use something comparable to the JavaScript Jest function toHaveBeenNthCalledWith so that a assert payload can be defined for each nth connector call. Is there some build in function for this available or is there a workaround for this?


text:
Q: Screen tearing on google chrome in 15.10 I am having problems with screen tearing while watching videos on google chrome (both with and without fullscreen). I have integrated Intel HD graphics controller on my Z97X-Gaming-5 motherboard. I have tried following things so far to deal with this problem:

*

*Install Intel graphics installer 1.4.0 and update drivers using it.

*Disabled backing store option in xorg using "-bs" option. This solved the problem for Kodi and firefox but not for google chrome.

*Added "TearFree" option to 20-intel.conf file as per this answer.

*Disabled "Unredirect full screen windows" option in compiz settings manager.

None of these solutions have solved screen tearing in google chrome for me. Is there anything else that I can try? I have rebooted my machine after trying each of these solutions. I even tried reinstalling google chrome but nothing has worked so far.

A: As suggested by dobey, enabling hardware acceleration in google chrome's advanced settings solved the problem.


text:
Q: JQuery draggable div I am trying to create my first JQuery-based webpage.
At the moment there is a little problem with my draggable div.
I am able to move it and it works well but I am able to move it out of my screen. Is there a code like maxleft=0px?
JQUERY:

HTML:

A: You need give boundry div in which area it can be move.
 $("#card").draggable({
            axis: "x",
            containment: 'body'
        });


text:
Q: How to control the number of divs in a column I'm attempting to complete a coding challenge that produces a layout of three columns containing four boxes, so that the center column maintains 2 boxes, and the surrounding columns maintain 1 box vertically centered when viewed on a desktop:

And one column containing all four boxes on mobile:

Where I'm struggling is figuring out the desktop layout.
I've looked into grid vs. flexbox vs. columns, but it's not clear to me which (if any) are right for this project. Any suggested approaches? (By "approaches" I'm not requesting specific code, just a desirable layout method you'd recommend.)
Here's my HTML as requested below:
    <!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
  <link media="screen" rel="stylesheet" href="stylesheet.css">
  <title>Frontend Mentor | Four card feature section</title>

Reliable, efficient delivery

Powered by Technology

        Our Artificial Intelligence powered tools use millions of project data points
        to ensure that your project is successful

        Supervisor
        Monitors activity to identify project roadblocks

        Team Builder
        Scans our talent network to create the optimal team for your project

        Karma
        Regularly evaluates our talent to ensure quality

        Calculator
        Uses data from past projects to provide better delivery estimates

      Challenge by Frontend Mentor.
      Coded by Aaron McDonald.

A: I am not sure if this works with every browser, but at least here in the snippet it works:

*

*display: flex, flex-direction: column, flex-wrap: wrap; and justify-content: center; on the container to get the columns and  the vertical centering.

*width: 30% (or a little more) and page-break-inside: avoid; (to avoid them being split across columns - this property works as well for columns) on the children

*force a "page-break" (actually column-break) after the first and third child (see below)

*Plus a media query resetting those page-breaks and setting the childrens' width to full width for mobile screens.

.info-boxes {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  justify-content: center;
}

.info-box {
  width: 30%;
  height: 100px;
  background: #ddd;
  margin: 5px 0;
  page-break-inside: avoid;
}

.info-box:nth-child(1),
.info-box:nth-child(3) {
  page-break-after: always;
}

@media screen and (max-width: 480px) {
  .info-box {
    width: 100%;
  }
  .info-box:nth-child(1),
  .info-box:nth-child(3) {
    page-break-after: auto;
  }
}

    Supervisor Monitors activity to identify project roadblocks

    Team Builder Scans our talent network to create the optimal team for your project

    Karma Regularly evaluates our talent to ensure quality

    Calculator Uses data from past projects to provide better delivery estimates


text:
Q: I am having trouble passing a multidimensional variable array to a function in C using malloc() this code should create an array in main and then print it but every time I run it I just get an array of all 0s
#include <stdio.h>
#include <stdlib.h>

void print(float **A, int w, int h){
  int i, j;

  A = (float*) malloc(w*h*sizeof(float));

  for (i=0;i<h;i++){
    A[i] = (float*) malloc(w*sizeof(float));
  }

  for (i=0; i<h; i++){
    for(j=0; j<w; j++){
      printf("%f ", A[i][j]);
    }

    printf("\n");
  }
}

int main(void) {

    int i;
    int x_dimension=3;
    int y_dimension=2;
    float arr [3][2]={};
    arr[0][0]=16.2;

    print(arr,x_dimension,y_dimension);

    return 0;
}

A: You're re-allocing it in your print function, this should work:
#include <stdio.h>
#include <stdlib.h>

void print(float * A,int h, int w){
  int i,j;
  for (i=0;i<h;i++){
    for(j=0;j<w;j++){
      printf("%f ",A[i * w + j]);
    }
    printf("\n");
  }
}

int main(void) {
    int i;
    const int x_dimension=3;
    const int y_dimension=2;
    float arr[x_dimension][y_dimension];
    arr[0][0]=16.2;
    print(arr,x_dimension,y_dimension);
    return 0;
}

Note that I also inverted the w and h parameters in the print function.

A: I think you see the arr is not initialized:

*

*alloc memory?

*default values.

*float arr[][] is not same with float **arr, you should use like this: float (*A)[2]
But in your main function, you have finished the alloc work. The arr is allocated at the stack.
So in your print function, what you have to do is only print the result or initialize each item's value.
#include <stdio.h>
#include <stdlib.h>

void printArr(float (*A)[2],int w, int h){
    int i,j;
    //Wrong, A has been alloced.
    /*
       A = (float*) malloc(w*h*sizeof(float));
       for (i=0;i<h;i++){
       A[i]=(float*) malloc(w*sizeof(float));
       }
       */
    for (i=0;i<h;i++){
        for(j=0;j<w;j++){
            printf("%f ",A[i][j]);
        }
        printf("\n");
    }
}

void printPointer(float *A,int w, int h){
    int i,j;
    //Wrong, A has been alloced.
    /*
       A = (float*) malloc(w*h*sizeof(float));
       for (i=0;i<h;i++){
       A[i]=(float*) malloc(w*sizeof(float));
       }
       */
    for (i=0;i<h;i++){
        for(j=0;j<w;j++){
            printf("%f ",*((A+i*h)+j));
        }
        printf("\n");
    }
}
int main(void) {
    int x_dimension=3;
    int y_dimension=2;

    //By Array, Array is not a pointer, but is a structure
    float arr[2][3] = {};
    //Only [0][0] item has been initialized
    arr[0][0]=16.2f;
    printArr(arr,x_dimension,y_dimension);

    //By pointer
    float* arrp = (float*)calloc(x_dimension*y_dimension,sizeof(float));
    *arrp=16.2f;
    printPointer(arrp,x_dimension,y_dimension);

    return 0;
}


text:
Q: Rationale for the objective function in a flow network based generative model by Yoshua Bengio? I am reading the Yoshua Bengio et al, Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation. It seems to me the objective of the paper is to generate the flow $F$ given the reward function $R(s)$ that satisfies the detailed balance constraint Equation (4). This can be easily solved by walking backwards from the terminal nodes and accumulating reward along the way. When the incident action edge is not unique the flow solution is not unique and in fact uncountably infinite number of them. The computational complexity of this algorithm is obviously linear with respect to the number of states.
What is the rationale for devising an objective function such as Equation (12) which is computationally complex to solve the problem?

A: If the state-space is small, you could indeed solve by dynamic programming (which would require visiting all the states, though). In exponentially large state-spaces (which are the ones you care about in AI), it would not work, and the objectives proposed in the paper are ways around that using the generalization power of deep learning or other ML approaches that can generalize thanks to inductive biases. In spirit, this is similar to how you solve the Bellman equation with TD-learning (which is a form of implicit -by opposition to explicit- dynamic programming), but where the fixed point is the flow-matching constraint rather than the Bellman equation.


text:
Q: assignment and reference initialization from a temporary suppose i have the following:
boost::unordered_map< string , someValueType > map;
someValueType& value = map[ "key" ] = someValueType();

the last line contains:

*

*a temporary constructed instance of someValueType

*an assignment of the temporary into a new map entry

*initialization of a reference to the map entry

so if next line is:
   value.someProperty = 42;

this will try to change the map entry right? not the original temporary?
I know in this case if the reference couldn't take a temporary because it is non const (so a compiler error or the absence of one would answer my question), but if i added the const to the reference declaration, i'm not sure what the evaluation rules would say in this case

A: That's true. You have an initialization with an assignment expression on the right:
someValueType & value = (map["key"] = someValueType());

In fact, this is equivalent to:
someValueType & value = map["key"];

This is because the []-operator creates a new element if one doesn't already exist for that key.
Binding the map entry to a const reference makes no difference. However, if you know that the key is guaranteed to exist, then you can bind a const reference to the mapped value even if you only have a constant reference to the map itself:
void (MapType const & m)
{
    someValueType const & = m.find("key")->second;
}

This would be an error of course if the key didn't exist, since you'd be dereferencing the end iterator.


text:
Q: Controlling two LEDs with one digital output I have a bicolour RG LED, which looks like this:
.
I don't have a datasheet for it. There are three cables on it: one is cathode of each colour (common cathode type) and the other two are the anodes of each colour. The forward voltage of each LED is 24V, and forward current is 10 mA.
I want to change its colour by changing ONE digital output of an arduino. I mean that when the digital output is low, green LED is on, and red LED is off. And then when the output is high, green LED should be off, while the red LED is on. Digital output level is 3V DC when it's "high" state, and "0" V DC when it is "low" state.
So, how can I control which LED is on, while changing one digital output?

A:

simulate this circuit – Schematic created using CircuitLab
Figure 1. High-side driver and inverter.
How it works:

*

*If GPIO is low then Q1 is off and Q2 is off. Q3's base will find a path to ground through R1 and D1 and will turn on lighting D2.

*If GPIO is high then Q1 is on, Q2 is on and D1 will light. Since the collector of Q2 is pulled high Q3's base current will fall to zero and D2 will turn off.

*By using PWM (pulse width modulation) the light can blend from one colour to the other.

Does it have to be so complicated?

Figure 2. High-side driver fail.
Yes. Without the NPN transistor of Figure 1 there are two problems:

*

*There is a sneak path for the current through the protection diodes of the micro's GPIO. Whether the output is pulled high or tri-stated to try to shut off the PNP transistor of Figure 2 the base can turn on via D1.

*The high voltage - 24 V in your case - may damage the GPIO.

Opto-isolator option:

Figure 3. A pair of opto-isolators simplifies the task further and can isolate the 24 V circuit completely from the micro.

*

*When the GPIO is low the upper opto-isolatore will be turned on.

*When the GPIO is high the lower one will be turned on.

The very simple option:
The LED series resistors are clearly visible heat-shrunk in leads of the lamp. If you are prepared to replace these the circuit becomes trivial.

Figure 5. Direct drive of the LEDs.
Setting R1 and R2 to 56 Ω should be fine.
If the output is tri-stated (wired as an input or disconnected by program control) a current will flow through R1, L1, R2, L2 and both LEDs will glow dimly. On a 3.3 V device the voltage wouldn't be high enough to illuminate both LEDs significantly so they would appear dark.

A: I'm not sure if I understood your question correctly, but if I did, then the easiest answer is to use a not gate.
Take the output from the Arduino pin, tap into the output using a not gate, and then connect the two LEDs.
When the output is high, the LED connected directly to the output lights up while the other one doesn't. When the output is low, the LED connected to the not gate lights up while the one connected directly to the output doesn't.
Cheers!