text:
Q: Positioning a div underneath a (align-item) stretched div I want to position a div below multiple flex-items using align-item: stretch; to make all the items the same height. And then no matter behind which div I place the new div it will be below the stretched height of the above div.
Current result

This is the current HTML

This is the current CSS i would like to also be able to wrap the images. And make the whole thing responsive.
.flex-container {
padding: 0;
margin: 0;
list-style: none;
       -ms-box-orient: horizontal;
       display: -webkit-box;
       display: -moz-box;
       display: -ms-flexbox;
       display: -moz-flex;
       display: -webkit-flex;
       display: flex;
       float: left;
       flex-wrap: wrap;
}
.stretch {
-webkit-align-items: stretch;
       align-items: stretch;
}
.flex-item{
       width: 23%;
       margin: 0 1%;
       background: orange;
}
.flex-item img{
width: 100%;
}
.info{
       padding:35px 0;
       width:100%;
       float:left;
       left:0;
       text-align:center;
       display:none;
       position:absolute;
       z-index:999;
       background: #fff;
}
.info .detail{
       width:25%;
       float:left;
}

.info image{
       width:65%;
}

Expected result

Thanks.

A: If you set no vertical margins , elements should stretch by themselve and each item on a row will be the same height.
To show the second row of image beneath in absolute, you need to set the parent in relative so it becomes the reference for the size and coordonates.
Mind that each parent here is one average quart of the whole row and that margins are in between them.
The row to show will be an average of 400% width + XX% of margins added all together.
To show it underneath, you can use top:100% and eventually add a margin-top to leave a gap.

.flex-container {
padding: 0;
margin: 0;
list-style: none;
       -ms-box-orient: horizontal;
       display: -webkit-box;
       display: -moz-box;
       display: -ms-flexbox;
       display: -moz-flex;
       display: -webkit-flex;
       display: flex;
       float: left;
       flex-wrap: wrap;
}
.stretch {
/* this was defaut behavior */
}
.flex-item{
       width: 23%;
       margin: 0 1%;
       background: orange;
}
.flex-item img{
width: 100%;
}
/* =========================================================   update*/
.flex-item {
  position:relative;
}
.flex-item > img:hover ~ .info {
  top:100%;
  display:flex ;
}
.info{
       min-width:426%;
       top:100%;
/* =========================================================   end update */
       padding:35px 0;
       left:0;
       text-align:center;
       position:absolute;
       z-index:999;
       background: #fff;
       display:none ;
}

.info .detail{
       min-width:25%;
       float:left;/* useless when parent is a flex box */
       margin:0  ;
}

.info image{/* !!! this rule does nothing. there is no tag image in your HTML structure */
       width:65%;
}

 something more


text:
Q: how to retrieve image with mongodb(mongoose)/react? I want to save image file using mongodb on server side.
and I want to display this (saved) image on front side.
Below is my server side code.
const Video = new Schema({
    ...file owner, file path, etc,.
    screenshot: {
        type: Buffer
    }
});

// Extract thumbnail by using ffmpeg.
    let resDir = __dirname + '/resources/';
    let videoFullPath = resDir + 'videos/' + newFileName;
    let ssFullPath = resDir + 'screenshots/' + newFileName + '.png';
    let execCommand = 'ffmpeg -i ' + videoFullPath +
                      ' -f image2 -t 0.001 -ss 1.0 ' + ssFullPath;
    childProcess.exec(execCommand);

    // Save Video information DB.
    let newVideo = new Video({
        ...file ownef, file path, etc,.
        screenshot: ssFullPath,
    });
    newVideo.save((err, data) => {
        if(err) throw err;
        return res.json({success: true});
    });

And below is my front side code. (movieClipData is mongoDB object)
const imgSrc = 'data:image/png;base64,' + movieClipData.screenshot.data;

I think file type(base64, binary...) cause this issue.
so I tried to convert file type to base64, but it didn't work. (maybe I wouldn't have done it properly...)
Can you explain how to match file type?

A: I'm not sure there is a data property on your movieClipData.screenshot object from what you're describing about your backend.
Did you try to use it as an url directly, since you have screenshot: ssFullPath, the screenshot isn't a Buffer as described in the Schema, but a string of the filepath saved by ffmpeg.

redpajama_set_name: RedPajamaStackExchange


text:
Q: ASP.NET Core, iframe and third party cookie related problem I'm trying to load my local asp.net core web-app to another site using iframe but the data is loaded for a small time (1s), then all case cookie are deleted automatically, and iframe becomes blank.
Can someone tell me what the reason for this is, and how I can solve it?
I have tried:

*

*set x-frame-options to AllowAll

*and also set other header options

When I disable third-party cookies in my browser, it is prohibiting login operation.

A: Add rewrite rule like below, and it works for me. It allow iframe use cookie, and won't delete cookie.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\WebApplication2.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
      <rewrite>
          <outboundRules>
          <clear />
          <rule name="Add SameSite" preCondition="No SameSite">
              <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
              <action type="Rewrite" value="{R:0}; SameSite=None;Secure=true" />
          </rule>
          <preConditions>
              <preCondition name="No SameSite">
                  <add input="{RESPONSE_Set_Cookie}" pattern="." />
                  <add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=None;Secure=true" negate="true" />
              </preCondition>
          </preConditions>
          </outboundRules>
        </rewrite>
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 1940793d-c348-4b1b-93be-83b6228fd09b-->


text:
Q: 2 Forms Closing and opening I have 2 Forms. At init of 1st form I have code:
public App_Index()
        {
            InitializeComponent();

            this.Hide();

            Authorization loginForm = new Authorization();
            loginForm.ShowDialog();
        }

And if I push on Close button [X] on Form2 — App_Index(Form1) Form do .Show(); But no code in Form2 about this. I want to close Form1 and Form2 if I push [X] on Form2. How can I do this?

A: How about this? This closes the current form if the dialog is cancelled.
public App_Index()
{
    InitializeComponent();

    this.Hide();

    Authorization loginForm = new Authorization();
    if (loginForm.ShowDialog() == DialogResult.Cancel)
        Close();
}

A: You could handle FormClosing event :
private void Authorization_FormClosing( object sender, FormClosingEventArgs e )
{
    if ( e.CloseReason == CloseReason.UserClosing )
    {
         Application.Exit();
    }
}

A: There are a couple of different ways to do this.  You can use loop through Application.OpenForms and close the forms you wish.  I would do this on the Form_Closing event of Form2:
    private void Form2_FormClosing(object sender, FormClosingEventArgs e)
    {
        foreach(Form frm in Application.OpenForms)
        {
            if(f.Name == "Form1")
                f.Close();
        }
    }

You can also access the form directly within the OpenForms collection and close it:
Application.OpenForms["Form1"].Close()


text:
Q: Prove that a map is continuous Let $r:[0,1]\to\mathbb R$ be a continuous function and let $u_\lambda$ be the unique solution of the Cauchy Problem:
$$\begin{cases}u''(t)+\lambda r(t)u(t)=0,\quad\forall t\in [0,1],\\ u(0)=0,\quad u'(0)=1.\end{cases}$$
It is well known that $(u_{\lambda_n})$ converges uniformly on $[0,1]$ to $u_\lambda$ whenever $\lambda_n\to\lambda.$ Define the map $\tau:\mathbb R\to\mathbb R$ by setting
$$\tau(\lambda):=\inf\{t\in(0,1]\mid u_\lambda(t)=0\},$$ with the convention $\tau(\lambda)=1$ if $u_\lambda(t)\neq 0$ for every $t\in (0,1]$. Prove then that $\tau$ is continuous.
Edit:
ok so i've been trying to work on Robert hint. I am trying to prove that if $\tau(\lambda_0)=\tau_0<1$ then for some $\varepsilon>0$ small i must have $u_{\lambda_0}(\tau_0+\varepsilon)<0$ , but i seem to go nowhere farther from some silly tryings using mean value theorem or stuff like that.. Where am i missing the key point?

A: Hint: if $\tau(\lambda_0) = \tau_0  < 1$ and $\epsilon > 0$ is small, there is $\delta > 0$ such that $u_\lambda(t) > \delta$ if $\epsilon \le t \le \tau_0 - \epsilon$, while $u_\lambda(\tau_0 + \epsilon) < 0$.

A: A few more hints:

*

*Using the uniqueness of the solution to the Cauchy problem, observe that if $u_\lambda(\tau(\lambda)) = 0$, then there exists some $\epsilon > 0$ such that $u_\lambda|_{(\tau(\lambda)-\epsilon,\tau)} > 0$ and $u_\lambda|_{(\tau,\tau+\epsilon)} < 0$. (Why can't $u$ locally have the same sign on the two sides of the zero?)

*If $u$ is a continuous function such that $u(\tau-\epsilon) > 0$ and $u(\tau+\epsilon) < 0$, what can you say about $u$?

*Since $r(t)$ is continuous, what can you say about $u_\lambda'(t)$, for $t$ sufficiently close to 0? What does this tell you about $u_\lambda$ in, say, $(0,\epsilon)$?

*If $u_{\lambda}|_{[a,b]} > 0$, what can you say about $u_{\eta}|_{[a,b]}$ for $\eta$ sufficiently close to $\lambda$?

To put every thing together, let $\eta$ be a small perturbation of $\lambda$, and fix a very small $\epsilon$ depending on $\lambda$ and $r$. Use 4 to show that $u_\eta$ cannot vanish on $[\epsilon,\tau(\lambda)-\epsilon]$. Use 3 to show that $u_\eta$ cannot vanish on $(0,\epsilon)$. And use 1 & 2 to show that $u_\eta$ must vanish between $(\tau(\lambda)-\epsilon, \tau(\lambda)+\epsilon)$.

Okay, more on point 1 by request.

*

*The function $u \equiv 0$ is a solution to the differential equation (ignoring boundary conditions). So by uniqueness of solutions, if $\exists t_0$ such that $u_\lambda(t_0) = u_\lambda'(t_0) = 0$, $u_\lambda \equiv 0$ and cannot satisfy the boundary condition $u_\lambda'(0) = 1$. Hence for a solution to the ODE with the requisite boundary conditions, at any point where $u_\lambda(t_0) = 0$ we must have that $u_\lambda'(t_0) \neq 0$.

*The usual regularity theory for ODEs guarantee that $u_\lambda'$ is continuous.


text:
Q: Server error with large posts On a large drupal site, the database server is on a separate server connected directly to the web server. The web server uses apache and memcached. The problem is that whenever the post is a large, say larger than 10KB, the server does not return correctly. I checked both apache and mysql logs but could not find any trace of errors being logged. The error happens also when I use nginx/php5-fpm instead of apache.
Despite this, the large posts are registered, however incorrectly so that they show up for admin when I open a new page on the site. I'm really confused and appreciate your hints to pinpoint the possible sources if this chronic problem.

A: Sounds like a memory and/or resources problem.
No guarantee it will help, but I think it's worth experimenting / checking:

*

*Increase the php memory limits by editing the following lines in the php.ini file as:

*

*max_execution_time = 30 --> 60 ;

*memory_limit = 32 --> 128, or even 256M ;

*Add the following lines to the end of .htaccess file:

*

*php_value auto_append_file none

*php_value memory_limit 128M
PS: is this Drupal version 7 (or still 6)?


text:
Q: Prove that a sum of squares to the $n$th power is also a sum of squares Let $p$ and $q$ be real numbers, let $n$ be a positive integer, and let $i$ be the imaginary unit. Using the factorisation $p^2+q^2=(p+qi)(p-qi)$, prove for any $p$, $q$ and $n$, that the sum of the squares of $p$ and $q$, all raised to the power $n$, $(p^2+q^2)^n$, is also a sum of squares.
I am doing this as a way to practice relating complex numbers to real numbers. I have tried expanding $(p^2+q^2)^n$ using the binomial theorem to no avail. I have also tried rewriting everything in polar coordinates, bringing me nowhere.

A: Let $(p+iq)^n = a+bi$ for some integers $a$ and $b$. Then
$$
(p^2+q^2)^n = (p+iq)^n (p-iq)^n = (a+bi)(a-bi)=a^2+b^2.
$$

A: Another way,
without using complex numbers,
which is centuries old:
$\begin{array}\\
(a^2+b^2)(c^2+d^2)
&=a^2c^2+a^2d^2+b^2c^2+b^2d^2\\
&=a^2c^2+b^2d^2+a^2d^2+b^2c^2\\
&=a^2c^2\mp2abcd+b^2d^2+a^2d^2\pm2abcd+b^2c^2\\
&=(ac\mp bd)^2+(ad\pm bc)^2\\
\end{array}
$
Now iterate.
$(a^2+b^2)^2
=(a^2-b^2)^2+(2ab)^2
$
$(a^2+b^2)^3
=((a^2-b^2)^2+(2ab)^2)(a^2+b^2)\\
=((a^2-b^2)a-(2ab)b)^2+((a^2-b^2)b+(2ab)a)^2\\
=(a^3-3ab^2)^2+(3a^2b-b^3)^2
$


text:
Q: 2x beaglebone black microcontrolers and nrf24l01 connection doesn't work I'm trying to setup connection between two BBB using nrf24l01.
I hope i set up everything properly( but I'm not really sure), I used this tutorial https://electron14.com/?p=404 and this code : RF24/librf24-bbb/librf24, and some self investigation.
the result of pingtest is :
./pingtest

RF24/examples/pingpair/
ROLE: Ping out
- gpio.cpp RF24::begin end fun
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0e1
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x00
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x27
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 250KBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH
Now sending 23...ok...Failed, response timed out.
Now sending 1231...ok...Failed, response timed out.
Now sending 2441...ok...Failed, response timed out.
Now sending 3649...ok...Failed, response timed out.
Now sending 4859...ok...Failed, response timed out.
Now sending 6071...ok...Failed, response timed out.

and from other BBB pongtest
 ./pongtest
RF24/examples/pingpair/
ROLE: Pong back
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0d2
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x00
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x27
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 250KBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH

Can someone help me ?

A: Based on your data, both devices have a status register value of 0x0e, which is clearing the lsb; that bit sets the direction of the device, either Tx (0) or Rx (1).  Based on the status register of each board being cleared, you have both of them setup as transmitters.


text:
Q: Characterization of total variation of a complex measure In the text of Real Analysis by Folland, he defines the total variation of a complex measure $\nu $ as the unique measure $|\nu|$ such that if $d\nu = f d\mu $, with $ f$ a $ \mu -$ integrable function, then $d|\nu| = |f| d\mu $.
I've studied real analysis before by Rudin (real and complex analysis), and the definition that Rudin gives is said to be equivalent by and exercise in Folland's book. The propertie that characterizes the total variation is proved in Rudin's book, but it uses a lot of theory which Folland didn't define yet.
So, I'm trying to follow the lines of the Folland's text to show that the total variation is well defined. First, we show that there is a positive (and finite) measure that $d \nu=f d\mu$. We can take $\mu $ as the total variation of the real and imaginary parts of $\nu$. Then, we can use the Lebesgue-Radon-Nikodym theorem, since we have just finite masures.
Now we have to check that if $ d \nu =f_1 d\mu_1= f_2 d\mu_2 $, $ f_j$ a $ \mu_j -$ integrable function, then
$$|f_1|d\mu_1= |f_2|d\mu_2.$$
To see this, he takes $\lambda = \mu_1+\mu_2 $ and then apply the chain rule. I can't see why we can take, for example, $ d\mu_1 / d\lambda $. Is the measure $\lambda$ a $\sigma-$ finite measure? If it's not, how can we work with this derivates?

A: It is a bit late but i just see this while i was looking something different. now, note that  positive measure is complex measure only if it is finite. so both $\mu_{1}$ and $\mu_{2}$ are finite positive measures. $\lambda = \mu_{1} + \mu_{2} $ would be finite positive measure.


text:
Q: How do I return two functions in a function that renders as two components in react instead of the second function overwriting the first I am using a conditional rendering to render different elements in my react header based on url or if a user is logged in. In my default return I want to render two buttons side by side instead only the second button appears. How do I fix this?
const NavHeader = () => {
    const { location } = useSelector(state => state.router);
    const { authenticated } = useSelector(state => state.signIn);

    const menuItem = (linkPath, text, type) => (
        <Item className="header-item">
            <Button type="primary" ghost={type}>
                <Link to={linkPath}>
                    {text}
                </Link>
            </Button>
        </Item>
    );

    const renderMenuItem = ({ pathname }) => {
        if (pathname === '/signup') {
            return menuItem('/signin', SIGNIN, false);
        }
        if (pathname === '/signin') {
            return menuItem('/signup', SIGNUP, true);
        }
        if (authenticated) {
            return menuItem('/dashboard', GO_TO_DASHBOARD, false);
        }
        return (
            menuItem('/signin', SIGNIN, false)
            && menuItem('/signup', SIGNUP, true)
        );
    };

    return (
        <Header>
            <Link to="/" className="left-menu">
                <img src={Logo} height="60px" alt="NeoNatar Logo" />
            </Link>
            <Menu className="right-nav" mode="horizontal">
                {renderMenuItem(location)}
            </Menu>
        </Header>
    );
};

A: You can return an array or a fragment containing both.
Array:
return [
    menuItem('/signin', SIGNIN, false),
    menuItem('/signup', SIGNUP, true)
];

Fragment:
return (
    <React.Fragment>
        {menuItem('/signin', SIGNIN, false)}
        {menuItem('/signup', SIGNUP, true)}
    </React.Fragment>
);

Another way to use fragment in modern versions of Babel:
return (
    <>
        {menuItem('/signin', SIGNIN, false)}
        {menuItem('/signup', SIGNUP, true)}
    </>
);

What you had didn't work because the result of the && operator is the value of just one of its operands. It evaluates its left-hand operand and, if that value is falsy, takes that value as its result; otherwise, it evaluates its right-hand operand and takes that value as its result. In your case, since menuItem returns an object, it's truthy, so the second menuItem call was done and its result was the result of the && expression.


text:
Q: Compiling c++ with Armadillo library at NeatBeans I am going to compile C++ program which contains Armadillo library.
This issue is feasible via command line with this command:
g++ '/arm.cpp' -o example -O1 -larmadillo

But when I add -O1 -larmadillo to the compile options of my NetBeans project I get a considerable amount of errors.
I got these errors:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/atx/NetBeansProjects/armadillo'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/armadillo
make[2]: Entering directory `/home/atx/NetBeansProjects/armadillo'
mkdir -p dist/Debug/GNU-Linux-x86
g++ -O3    -o dist/Debug/GNU-Linux-x86/armadillo build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `gemv<double>':
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
/usr/include/armadillo_bits/blas_wrapper.hpp:79: undefined reference to `wrapper_dgemv_'
build/Debug/GNU-Linux-x86/main.o: In function `gemm<double>':
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
/usr/include/armadillo_bits/blas_wrapper.hpp:114: undefined reference to `wrapper_dgemm_'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/armadillo] Error 1
make[2]: Leaving directory `/home/atx/NetBeansProjects/armadillo'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/atx/NetBeansProjects/armadillo'
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 136ms)

A: Looks like your Armadillo installation is incomplete, or you have two versions of Armadillo installed. I recommend that you manually uninstall any previous versions of Armadillo (both the includes and the run-time library) and then do a fresh install, using a freshly downloaded Armadillo .tar.gz package: http://arma.sourceforge.net/download.html
Alternatively, you can work around the issue you're having.  Edit "include/armadillo_bits/config.hpp" and comment out the line with ARMA_USE_WRAPPER. Then, instead of linking with -larmadillo, link with -lblas -llapack

A: I know this was an old question, but I had troubles recently with this so I want to help if someone else encounters same problems as I did. This is how-to setup Armadillo library in NetBeans C++ on 64 bit Windows 7.

*

*Download the latest version of Armadillo from http://arma.sourceforge.net/download.html

*Unpack it in some directory, where ever you want.

*Go to Netbeans -> Project Properties -> C++ Compiler
3.1 Include Directories -> find your Armadillo directory and select folder "include".
3.2 Preprocessor Definitions -> ARMA_USE_LAPACK ARMA_USE_BLAS

*Go to Netbeans -> Project Properties -> Linker
4.1 Additional Library Directories -> find your Armadillo directory and select folder "examples/lib_win64".
4.2 Additional Dependencies -> lapack_win64_MT.lib blas_win64_MT.lib

*Go to your project's folder and add files from Armadillo/examples/lib_win64. 4 files should be added -> blas_win64_MT.dll, blas_win64_MT.lib, lapack_win64_MT.dll and lapack_win64_MT.lib.
This should be it. Now you can use Armadillo library in C++, just add in your cpp #include  and if you want using namespace arma;
I hope this was helpful! Cheers!


text:
Q: Trigger unable to find Button inside GridView I have a Button and few file upload controls in a template field inside a GridView. The GridView is inside an UpdatePanel and I'm registering the Button with a Postbacktrigger in the GridView_RowDataBound event.
protected void OrderGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
   Button lb = e.Row.FindControl("MarkAsCompleteButton") as Button;
   ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb);
}

It's throwing an error that "Control lb could not be found for the trigger in the UpdatePanel".
Can anyone suggest how to solve this?
thanks.

A: I guess your button can be found in your data rows and not in header row or footer row. Hence you only want to add your button when actual row is a dataRow.
protected void OrderGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType != DataControlRowType.DataRow) return;

   Button lb = e.Row.FindControl("MarkAsCompleteButton") as Button;
   ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb);
}

A: Couple of things done incorrectly here.

*

*File uploads won't work inside updatepanel. In other words, file uploads won't work asynchronously. Hence you need to create a full postback always.

*If you really want some button control inside a gridview to create a partial postback, think about putting the GridView RowCommand event itself to be the AsyncTrigger for the updatepanel.

<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:GridView ID="GridView1" runat="server" ... OnRowCommand="GridView1_RowCommand">
            ...
        </asp:GridView>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand"/>
    </Triggers>
</asp:UpdatePanel>


text:
Q: regex for finding date dir i am looking to search for  in dir ...
a2010-02-10
how to search the ls all dir in with date format
ls -d *(\d+)-(\d+)-(\d+)

its not working like perl
what is the right format

A: Your regex appears to be correct, but bash doesn't support full regular expressions.  It supports wildcards, which can't always work the same way.  Try this:
ls -d | grep -E '(\d+)-(\d+)-(\d+)$'

And really, the (\d+) groups could be replaced with just \d+.
If you prefer a pure-bash solution, try this:
ls -d *[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]

You can simplify that to be less exact if desired:
ls -d *[0-9]*-[0-9]*-[0-9]*

But I'd go for using grep because it is a lot clearer what you want.  You could make it even clearer:
ls -d | grep -E '\d{4}-\d{2}-\d{2}$'

A: With shopt -s extglob, you can do:
ls -d *+([0-9])-+([0-9])-+([0-9])


text:
Q: Docker registry dashboard I am using shipyard for a consolidated dashboard for our swarm.  Unfortunately, shipyard does not support the new docker swarm.  I switched over to portainer which does not display the images in the registry but supports the new swarm. Any suggestions for what folks have implemented for dashboarding their docker swarm and registry?  I would like to find out if there are any alternatives as comprehensive as shipyard.

A: At my company we are using the docker-registry-frontend by kwk, it's far from perfect but I works pretty well for our needs.


text:
Q: pull to refresh returns data twice I,m getting data from JSON feed.
I'm able to do pull-to-refresh and it's working fine, but it's not bringing new data only, it brings all data over and over again, so every time I refresh it brings all results like same results and repeat them inside the app.
im using Volly library.
my Data JSON Looks Like
http://twaa9l.com/ji/feed.json
here is My Code :
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;

import com.android.volley.Cache;
import com.android.volley.Cache.Entry;
import com.android.volley.Request.Method;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonObjectRequest;
import com.twaa9l.photosee.feed.FeedItem;
import com.twaa9l.photosee.feed.FeedListAdapter;
import com.twaa9l.photosee.library.AppController;
import com.twaa9l.photosee.library.SessionManagement;
import com.twaa9l.photosee.library.UploadPhoto;

public class MainActivity extends Activity {
    private static final String TAG = MainActivity.class.getSimpleName();
    private ListView listView;
    private FeedListAdapter listAdapter;
    private List<FeedItem> feedItems;
    protected SwipeRefreshLayout mSwipeRefreshLayout;
    private String URL_FEED = "http://twaa9l.com/ji/feed.json";
    // Session Manager Class
    SessionManagement session;

    @SuppressLint("NewApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //refresh();
        // Session class instance
        session = new SessionManagement(getApplicationContext());

        /**
         * Call this function whenever you want to check user login
         * This will redirect user to LoginActivity is he is not
         * logged in
         * */
        session.checkLogin();

        // get user data from session
        HashMap<String, String> user = session.getUserDetails();

        mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.swipeRefreshLayout);
        mSwipeRefreshLayout.setOnRefreshListener(mOnRefreshListener);
        mSwipeRefreshLayout.setColorScheme(
                R.color.swipeRefresh1,
                R.color.swipeRefresh2,
                R.color.swipeRefresh3,
                R.color.swipeRefresh4);

        listView = (ListView) findViewById(R.id.list);

        feedItems = new ArrayList<FeedItem>();

        listAdapter = new FeedListAdapter(this, feedItems);
        listView.setAdapter(listAdapter);

        // These two lines not needed,
        // just to get the look of facebook (changing background color & hiding the icon)
        getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3b5998")));
        getActionBar().setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

            getNewPosts();

    }

    private void getNewPosts() {

            // making fresh volley request and getting json
            JsonObjectRequest jsonReq = new JsonObjectRequest(Method.GET,
                    URL_FEED, null, new Response.Listener<JSONObject>() {

                        @Override
                        public void onResponse(JSONObject response) {
                            VolleyLog.d(TAG, "Response: " + response.toString());
                            if (response != null) {
                                parseJsonFeed(response);
                                if(mSwipeRefreshLayout.isRefreshing()){
                                    mSwipeRefreshLayout.setRefreshing(false);
                                }
                            }
                        }
                    }, new Response.ErrorListener() {

                        @Override
                        public void onErrorResponse(VolleyError error) {
                            VolleyLog.d(TAG, "Error: " + error.getMessage());
                        }
                    });

            // Adding request to volley request queue
            AppController.getInstance().addToRequestQueue(jsonReq);
    }

    /**
     * Parsing json reponse and passing the data to feed view list adapter
     * */
    private void parseJsonFeed(JSONObject response) {
        try {
            JSONArray feedArray = response.getJSONArray("feed");

            for (int i = 0; i < feedArray.length(); i++) {
                JSONObject feedObj = (JSONObject) feedArray.get(i);

                FeedItem item = new FeedItem();
                item.setId(feedObj.getInt("id"));
                item.setName(feedObj.getString("name"));

                // Image might be null sometimes
                String image = feedObj.isNull("image") ? null : feedObj
                        .getString("image");
                item.setImge(image);
                item.setStatus(feedObj.getString("status"));
                item.setProfilePic(feedObj.getString("profilePic"));
                item.setTimeStamp(feedObj.getString("timeStamp"));

                // url might be null sometimes
                String feedUrl = feedObj.isNull("url") ? null : feedObj
                        .getString("url");
                item.setUrl(feedUrl);

                int lastStoredTimeStamp = 0;
                if(i == feedArray.length()){
                     lastStoredTimeStamp = feedObj.getInt("timeStamp");
                }

                if(feedObj.getInt("timeStamp") > lastStoredTimeStamp){
                    feedItems.add(item);
                    }
            }

            // notify data changes to list adapater
            listAdapter.notifyDataSetChanged();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();

        switch (itemId) {
        case R.id.action_settings:
            session.logoutUser();
            break;
        case R.id.addPhoto:
            Intent intent1 = new Intent(this, UploadPhoto.class);
            startActivity(intent1);
            break;
        }

        // TODO Auto-generated method stub
        return super.onOptionsItemSelected(item);
    }

    protected OnRefreshListener mOnRefreshListener = new OnRefreshListener() {
        @Override
        public void onRefresh() {
            // TODO Auto-generated method stub
            //Toast.makeText(MainActivity.this, "We Are Refreshing", Toast.LENGTH_SHORT).show();
            getNewPosts();
        }
    };

}

What i want to do is, only bringing the new results and append them to the existing results in the app,
NOT repeating the results.
Note : This Question is not DUPLICATED because i looked for all question the has pull to refresh problems in here and nothing worked for me

A: Ideally the server from which you are pulling the data needs to return data based on the timestamp you passed.
For example when you query you specify the timestamp "T" of the data which you have and the server returns data only after timestamp "T"
If the server doesnot support this mechanism then on the client side you need to make sure you are adding data items to the listview list which have the timestamp > "T".
Something like following:
          long lastStoredTimeStamp = 0;//This should be in constructor
/**
 * Parsing json reponse and passing the data to feed view list adapter
 * */
private void parseJsonFeed(JSONObject response) {
    try {
        JSONArray feedArray = response.getJSONArray("feed");

        for (int i = 0; i < feedArray.length(); i++) {
            JSONObject feedObj = (JSONObject) feedArray.get(i);

            FeedItem item = new FeedItem();
            item.setId(feedObj.getInt("id"));
            item.setName(feedObj.getString("name"));

            // Image might be null sometimes
            String image = feedObj.isNull("image") ? null : feedObj
                    .getString("image");
            item.setImge(image);
            item.setStatus(feedObj.getString("status"));
            item.setProfilePic(feedObj.getString("profilePic"));
            item.setTimeStamp(feedObj.getString("timeStamp"));

            // url might be null sometimes
            String feedUrl = feedObj.isNull("url") ? null : feedObj
                    .getString("url");
            item.setUrl(feedUrl);

            if(i == feedArray.length()-1){
                 lastStoredTimeStamp = feedObj.getLong("timeStamp");
            }

            if(feedObj.getLong("timeStamp") > lastStoredTimeStamp){
                feedItems.add(item);
                }
        }

        // notify data changes to list adapater
        listAdapter.notifyDataSetChanged();
    } catch (JSONException e) {
        e.printStackTrace();
    }
}


text:
Q: Postgresql select distinct I'm with a problem on postgresql select.
This query works fine:
SELECT
    DISTINCT(COLUMN_A || ' - ' || COLUMN_B),
    COLUMN_A,
    COLUMN_B
FROM
    TABLE_A

But, when I include a new colmun on select like that:
SELECT
    DISTINCT(COLUMN_A || ' - ' || COLUMN_B),
    COLUMN_A,
    COLUMN_B,
    COLUMN_C
FROM
    TABLE_A

The number of result grow's up, and the column with DISTINCT has repeated on result set.
What is going on?

A: distinct is NOT a function. Using distinct (a), b is the same as
distinct a, b or distinct a, (b). You simply put the columns between parentheses (which isn't such a good idea to begin with because that creates an anonymous record in Postgres).
In Postgres you can use distinct on () for what you are trying to do (at least I think that's what you are trying to do):
SELECT distinct on (column_a, column_b)
       COLUMN_A || ' - ' || COLUMN_B,
       COLUMN_A,
       COLUMN_B
FROM TABLE_A
order by column_a, column_b

The above will only work in Postgres. If you are looking for a portable version based on the SQL standard, you can use a window function for this:
select column_a, column_b, column_c
from (
   select column_a, column_b, column_c,
          row_number() over (partition by column_a, column_b order by something) as rn
   from table_a
) t
where rn = 1;

The order by something is needed to pick one of the duplicate rows.


text:
Q: Problem involving Sylow Theorem from Michael Artin's book. Let $n = p^em$, and let $N$ be the number of subsets of order $p^e$ in a set of order $n$. Determine the congruence class of $N$ modulo $p$.
I think the answer is m and I feel it is a little similar with the prove of Third Sylow Theorem, which shows the number of Sylow p-subgroups is congruent to 1 modulo p by proving only [H] is fixed by H.
Then, could I decompose the N sets into H-orbit and find m sets that fixed by H in this question?

A: You're trying to compute $\binom{p^{\large e}m}{p^{\large e}}$ mod $p$. Indeed one can prove $\binom{pa+b}{pc+d}\equiv\binom{a}{c}\binom{b}{d}$ mod $p$ using generating functions mod $p$ (binomial theorem!) and then inducting to prove Lucas' theorem, but we can also invoke orbit-stabilizer for a more combinatorially-pure answer.
To prove a set $X$ has a given size mod $p$, one can equip it with a group action of a $p$-group and then show the number of fixed points of the action has that residue.
The cyclic group $C(p^e)$ acts on itself, and thus acts on $C(p^e)\times\{1,\cdots,m\}$ (leaving the second coordinate fixed). Consider the set $\Lambda$ of all subsets of size $p^e$. Show that the fixed points are precisely the sets $C(p^e)\times\{k\}$ for $k\in\{1,\cdots,m\}$, so there are $m$ fixed points.

A: We choose a group $G$ which has order $N$(for example: group of roots of $x^N-1$.)\
S:= set of all subsets of order $p^e$ of $G$.
Take a Sylow-p group of $G$, call $H$.
Introduce $H$ into $S$ by left multiplication.
Then $|S|=\sum \text{orb}(A_i)$ with $\text{orb}(A_i)s $ are all distinct orbits of this operation.
We have: $|\text{orb}(A_i)|=1$ or $p||\text{orb}(A_i)|$ since $\text{orb}(A_i)| |H|=p^e$.
For $A\in S$: $\text{orb}(A)=\{A\} \iff  hA=A \forall h\in H$.
Take $a\in A \to Ha \subset A, |Ha|=|A| \to Ha=A \to A \text{ is a right coset of } H. $
Indeed $H$ fixes all right cosets of $H$.
$\to H$ fixes and only fixes right cosets of $H$.
Number of $H$-right cosets =$m$.
Thus, $|S| \equiv m (\mod p)$.


text:
Q: How to bundle and install an exe app with window store app? I have a windows store app but i want to install another exe file when the metro app installs. It is because i need to use some features that are not accessible via metro applications. Thanks in advance!

A: I'm not saying you are trying to do anything wrong, but even with bundling, there is no way Microsoft would let you actually install/run an exe.
It wouldn't work on ARM devices, and is an absolutely ENORMOUS security hole. Windows 8 apps are run in a sandbox, and that sandbox is restricted to very specific operations (you can't even mess with the power saving settings!). Running an exe file is just not going to happen.
See Is there a possibility to start another App or Program from a Windows 8 Store App (C#) for more information

A: Maybe you could ask the user to save and run the exe?
I'm wondering though if "Microsoft" would allow you to package an exe with the app that isn't part of the app.
I'm also curious - how would you do the communication between the two apps if it is at all needed? I think there are no supported process communication APIs. Would you use some sort of a mail box file/folder?


text:
Q: How to change navigation keyboard shortcuts in xterm? I want to change the navigation keyboard shortcuts when using bash in xterm to use the Ctrl-ijkl, instead of Ctrl-pbnf. For example, I want to be able to navigate forward in the line by pressing Ctrl-l, instead of Ctrl-f. I also wanted to change the start-of-line and end-of-line commands to C-u and C-o. I was able to do this in emacs by adding the following to my .emacs
(global-set-key (kbd "C-j") 'backward-char)
(global-set-key (kbd "C-k") 'next-line)
(global-set-key (kbd "C-l") 'forward-char)
(global-set-key (kbd "C-u") 'start-of-line)
(global-set-key (kbd "C-o") 'end-of-line)

In the case of C-i, I had to remap the C key in emacs to the relatively unused super key to avoid also remapping TAB with C-i
(keyboard-translate ?\C-i ?\H-i)
(global-set-key [?\H-i] 'previous-line)

I found in this answer that you can avoid that particular pitfall in xterm by remapping Ctrl-i to send a different keycode
XTerm*Translations: #override\
    Ctrl ~Meta ~Shift <Key>i    :string("\033[105;5u")

So I wanted to know, is it possible in xterm to remap key combinations to navigation commands as I did in emacs?


text:
Q: restkit installation into xcode - is it always this complex? Trying to use the restkit framework into my xcode project, and they have an "installation guide" at their github page (https://github.com/RestKit/RestKit, scroll down to xcode 4.2)
OK, so being a 2-weeks objective-c coming in from the Java world, please excuse me:
This guide is 10 steps, half of it i don't even understand what it is... Is it just me, or is this extremely complex, just to be able to use a third-party api?
If something goes wrong, i'll stand as much chance as a snowman in hell to understand whats going on let alone fixing it...

A: have you tried the visual guide? Installing-RestKit-in-Xcode-4.x

A: Follow the instructions under "Xcode 4.x (Git Submodule)"
https://github.com/RestKit/RestKit
Seems to be the simpler of the two to follow from a new user perspective. Although I'm not sure what's not to get in the top one? Perhaps explain where it is you're having trouble. i.e. which step of the 10/12 steps do you need assistance with?

A: in their documentation recommended to use cocoapods for installation: https://github.com/RestKit/RestKit/wiki/Installing-RestKit-v0.20.x-via-CocoaPods


text:
Q: Fresh Rails 6.0.0 breaks after doing `bundle install` (Learning Rails 6)
I have a fresh Ruby 2.6.3 and Rails 6.0.0 setup.
Started out a fresh rails project with
rails new flix && cd flix
Running rails s worked just fine
Then I wanted to run
rails g controller movies

but it complaining..
Tried to do a spring stop (as suggested on stackoverflow) - that did not work. Then I did bundle install and the generate contoller worked.
But now the rails s won't work at all..♂
It's saying something about
`require': incompatible library version - /Users/norfeldt/.rvm/gems/ruby-2.6.3/gems/msgpack-1.3.1/lib/msgpack/msgpack.bundle (LoadError)

and a lot of others LoadErrors.
What to do? (seems a bit early to break it all)

A: Did the following
gem uninstall -aIx

and then
bundle install

now it works.. (but I have to do bundle install in other Rails projects on my computer)


text:
Q: PHP Sum status column I have a php script that I am attempting to sum up the status types into variables. For example when I do the following:
echo $val['status'];

I get:

New New New Dead In Process New New New New New Dead New Dead Dead New New New In Process

What I am wanting to do is sum all of these up by status type and place them into variables:
$statusnew
$statusdead
$statusinprocess

so if I were to do an:
echo $statusnew;

I would be presented with "12" and so forth and so on. I am extremely new to PHP so I am trying to figure out the most efficient way to do this. I know there is an array_sum function but not sure it will work here since we are not summing numeric values.
Loop:
if($_SESSION['partner'] == 1)
{

 $query = "select l.id as lead_id , l.account_name as account_name , l.first_name as first_name , l.last_name as last_name,l.date_entered as date_entered ,  lc.endpoints_c as endpoints ,  l.status as status from leads  as l
                    join leads_cstm  as lc on lc.id_c = l.id
                    where lc.account_id_c = '".$_SESSION['account_id']."'
                    and l.deleted = '0' and l.status <> 'Converted' order by date_entered DESC";

 $db -> PS_Pagination($query, 20, 5, "");
 $db -> setDebug(true);
 $rs = $db->paginate();
 $num_rows = mysql_num_rows($rs);

further down in the script:
        while($val = mysql_fetch_assoc($rs))
        {
             $date_create = date("m/d/Y", strtotime($val['date_entered']));

What I just added from @Joseph:
        $count = array(); // for graph

    // then, in your loop:
    if ( array_key_exists($val['status'], $count) )
    $count[$val['status']]++;
    else
    $count[$val['status']] = 1;

    echo $count['New'];

A: $count = array();

while($val = mysql_fetch_assoc($rs))
{
    $date_create = date("m/d/Y", strtotime($val['date_entered']));

    if ( array_key_exists($val['status'], $count) )
        $count[$val['status']]++;
    else
        $count[$val['status']] = 1;

    // continue with everything else being done in this loop
}

After running your loop, you can access the count like this:
$count['new']; // 12
$count['dead']; // 4
$count['in proccess']; // 2


text:
Q: Martha has two sons, who are still at school, and two, who are at university Here's a quote from A Student's Introduction to English Grammar:

[11]   i  Martha has [two sons who are still at school] and [two who are at university].

In [i] the relative clauses certainly are semantically restrictive: they distinguish two sets of sons (evidently Martha has at least four in all).

Is it possible to add commas like this?

Martha has two sons, who are still at school, and two, who are at university.

If so, does this mean that she has only four sons, not that she has at least four?

A: With the commas in your last example the sentence could be reduced to

Martha has two sons, and two.

This does not make sense. To say that she has two sons at school and two sons at university you would need

Martha has two sons at school, and two at university.

The comma here could be left out as well.
The sentence does not strictly imply that Martha has no other children, but it is reasonable for a reader to expect that there are no others.


text:
Q: Excel VBA prevent VBA from converting Time values to decimals I am trying to extract data from my workbook because I made the workbook wrong but I want to keep the data. So I have to go through each worksheet and extract the specific bits of data I need. (Repetitive task = vba code to the rescue)
I'm done, but I have one nasty little problem.
I am using ws.Range("C13") to extract each cell that I need. It's a cell that has time values like 10:00 or 22:13. When I debug.print that value however I get a decimal. Why? How do I prevent it from converting my "10:30" to "0.4375"
From what I can tell, the decimal isn't even related to the time value.
WRONG it is simply the time value as a representation of a 24 hour period. So it is related. But still.

A: ws.Range("C13") is the equivalent of ws.Range("C13").Value which returns the underlying data from that cell.
If instead you use ws.Range("C13").Text, you will get the displayed text from the cell. If you have set a specific date/time format for that cell then calling ws.Range("C13").Text should return text in that specific format

A: The time values are correct; it's the way Excel stores date and time values internally.
Dates are stored as floating point values, where the whole portion represents the number of days since 12/30/1899 00:00.00 (date 0.0) and the decimal part represents the fractional part of a single day (eg., 408875.5 represents 11/28/2011  12:00:00 PM).
Here are some conversion factors you might find useful:
Decimal value    Time Value    Calculation
=============    ==========    ===========
0.00094444444    12:01:00 AM   1.0 / 24 / 60 (1 day/24 hours/60 minutes per hour)
0.01041666666    12:15:00 AM   1.0 / 24 / 60 * 15
0.02083333333    12:30:00 AM   1.0 / 24 / 60 * 30
0.04166666666    01:00:00 AM   1.0 / 24

A: hours        = MOD(INT(0.tttttttt*24), 24)
minutes      = MOD(INT(0.tttttttt*24*60), 60)
seconds      = MOD(INT(0.tttttttt*24*60*60), 60)
milliseconds = MOD(INT(0.tttttttt*24*60*60*1000), 1000)


text:
Q: How do I use parameters + dependency injection in a service Here is what I want to do
    (function(){angular.module('app').factory("loadDataForStep",ls);
        ls.$inject = ['$scope','stepIndex']
        function ls ($scope, stepIndex) {
            if ($routeParams.code != undefined) {
                $scope.code = $routeParams.code;
                $scope.retrieveData($routeParams.code);
            }
            $rootScope.stepIndex = stepIndex-1;
            $rootScope.currentStep = stepIndex;
            $rootScope.resultsLoaded = false;
            if (!fieldDefinitionsLoaded) {
                loadAllElementsDefinition();
                loadStepsWithOverrides(stepIndex, loadStep);
            } else {
                loadStep(stepIndex);
            }
    }
    })();

I know there are plenty of issues here, but the issue of the moment (the question) is How do I get $scope injected and pass step index as a parameter? As you can see, $scope needs to come from angular, but I need to provide stepIndex.
Any help is appreciated.

A: Service don't have scope So can't inject scope in factory.
Scope is an instance of controller.
If you wanna to deal scope object in factory then declare variable in factory then bind factory with scope variable.
Then try kinda like this
var app = angular.module("app",[]);
app.factory("mySvc",function(){

  return {
    dataList : []
  }

});

app.controller("myCtrl",function($scope,mySvc){
   $scope.model=mySvc;
   console.log($scope.model);
});


text:
Q: Can github actions automatically open web pages? My requirement is to automatically open a web page every 5 hours (for example: www.xxx.com, I don't need to see the content of this page, just open it). The page takes 3 minutes to load, and then just close the page.
Can I use Github Actions to achieve my requirement?

A: Yes, this technically possible. GitHub Actions has the on.schedule event which allows you to essentially set up a cron schedule for execution of your workflow. Your cron schedule for running the workflow every 5 hours would be something like 0 0/5 * * * (see here).
If you just want to open the webpage for 3 minutes, your workflow run step could use the && chaining the URL-opening command (xdg-open www.example.com can be used to open a URL) with a sleep 360. I leave the actual composition of the workflow file as an exercise to the reader .


text:
Q: How to change text on page dynamically depending on value from another page/ product in Kentico CMS 9.0 Currently, we are working on Kentico CMS 9.0 version.
We are facing some development issue on below scenario:

There is a static message getting displayed on a Success page after
  Registration. This Text is written in WebPart -- > HTML Envelop
  section - Content after  But we want to change this text dynamically
  as per User selects the Band category.

Example If User registers for 1-10 Band category, then  text message should be displayed  as " Fees  $1, 500 / two years", or if the range of 2-20, then "Fees: $2,500 / two years" etc.
We tried with Macros on this, but not getting the exact solution. Also tried with relating the pages to get value from this Category pages. But no luck.
If anyone has any pointers on this. Or whether it could be possible to do this in Kentico CMS, please let us know ASAP.

A: If the data the user is submitting is part of the user's record or attached to a user's ID you could do a lookup using a macro or create your own custom macro to do the work for you.
For instance, if the value the user selected is attached to the user's record and they are logged in after they register, you can use something like:
CurrentUser.GetValue("CustomFieldName")

This all depends on what the value is that you're storing.  If you're storing an integer or key of some sort to another table, you'll need to get that key and do another lookup to that other table to get the actual display value. Something like this:
var userRegisteredValue = CurrentUser.GetValue("CustomFieldName");
GlobalObjects.CustomTables["CustomTableNamespace.CustomTableName"].Items.Where("ItemID = " + userRegisteredValue);


text:
Q: Using ASP.Net MVC Razor - @Html.ActionLink I have a @Html.ActionLink in a .cshtml which is in my CustomerOrder folder, but I want point to an action method in a different folder.
My actionlink is:
@Html.ActionLink("Order", "/Products/ProductList", new { id = Model.ID }, new { @class = "link-button btn-primary" })

I'm getting an HTTP Error 404.0 - Not Found error and this is the URL:
http://localhost:63549/CustomerOrder/Products/ProductList/1
I want the resulting view to be:
http://localhost:63549/Products/ProductList/1

A: You are specifying the controller and action both in the same parameter using the overload which takes just action method name which is not correct in this case as you want to call action method on a different controller class.
You actually need to specify action method name and controller name using the following overload method:
@Html.ActionLink("Order", "ProductList","Products",
                 new { id = Model.ID },
                 new { @class = "link-button btn-primary" })

and in controller class you will have to add an action method for it:
public class ProductsController : Controller
{

     ................
     ................
     // other action methods here

     public ActionResult ProductsList(int id)
     {
        // your code goes here and finaly returns view
        // var model = new Model();
        return View(model)
     }

}


text:
Q: ds_list can't handle more than 3 elements i don't know why i can't even add 4th element...
(im working on windows with mingw)
this is my code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
typedef struct ds_list_element {
    char value[MAX];
    struct ds_list_element *next;
}* ds_list;
int ds_list_empty(ds_list id) { // id listy
    if (id == NULL) return 1;
    else return 0;
}
ds_list ds_list_add(ds_list id, char add[MAX]) {
    ds_list temp;
    temp = (ds_list)(malloc(sizeof(ds_list)));
    strcpy(temp->value,add);
    temp->next = id;
    return temp;
}
void ds_list_print(ds_list id) {
    if (ds_list_empty(id) == 0) {
        printf("%s\n",id->value);
        ds_list_print(id->next);
    }
}
int main () {
    ds_list my_list = NULL;
    my_list = ds_list_add(my_list,"one");
    my_list = ds_list_add(my_list,"two");
    my_list = ds_list_add(my_list,"three");
    my_list = ds_list_add(my_list,"four");
    ds_list_print(my_list);
    return 0;
}

and the result is:
four
three
two
 y
Press any key to continue . . .

i don't know why it is happening. everything should work fine.
my friend told me it is working on ubuntu...

A: temp = (ds_list)(malloc(sizeof(ds_list)));

will be
temp = malloc(sizeof(*temp)));

You want to allocate memory for struct ds_list_element not struct ds_list_element*.  Don't hide pointers behind typedef name. It rarely helps.
Also you should check the return value of malloc and the casting is not needed.

A: Use ds_list as structure not a pointer
typedef struct ds_list_element {
    char value[MAX];
    struct ds_list_element *next;
}ds_list;

and allocate memory for the structure not a pointer.
Working program:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100

typedef struct ds_list_element {
    char value[MAX];
    struct ds_list_element *next;
}ds_list;

int ds_list_empty(ds_list *id) { // id listy
    if (id == NULL) return 1;
    else return 0;
}

ds_list * ds_list_add(ds_list *id, char add[MAX]) {
    ds_list *temp;

    temp = (malloc(sizeof(ds_list)));
    strcpy(temp->value,add);
    temp->next = id;
    return temp;
}

void ds_list_print(ds_list *id) {

    if (ds_list_empty(id) == 0) {
        printf("%s\n",id->value);
        ds_list_print(id->next);
    }
}

int main () {
    ds_list *my_list = NULL;

    my_list = ds_list_add(my_list,"one");
    my_list = ds_list_add(my_list,"two");
    my_list = ds_list_add(my_list,"three");
    my_list = ds_list_add(my_list,"four");

    ds_list_print(my_list);
    return 0;
}

Output:
four
three
two
one


text:
Q: How to expose mysql table schema as JPA object using Odata4j without maven I have to generate JPA objects for mysql tables using odata4J , as i am new to web services i have followed some online resources created following tasks;

*

*Created new database connection under "Database Development"

*Added eclipse link and mysql connector libraries through windows-> preferences->user library

*Changed project Facets to JPA and configured further JPA configurations

*Persistence.xml is generated and Populated Transaction Type from "Resource Local" under connection tab in the Persistence.xml

*Generated JPA Entities from table by Right clicking on Project and selecting JPA Tools -> Generate entities from Table option.

*One Java file is generated with the name of Table name.

*I have written one Java class called TestProducer

public class TestProducer implements ODataProducerFactory {
String persistence = "testJPA";
String namespace = "testui5";
int maxResults = 50;

@Override
public ODataProducer create(Properties properties) {

    String endpointUri = "http://localhost:8080/TestProducer.svc/";
    EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistence);
    JPAProducer producer = new JPAProducer(emf, namespace, maxResults);

    DefaultODataProducerProvider.setInstance(producer);
    return producer;
}

}

*

*Am able to get result on console by calling create method in TestProducer from Main

*But can any one tell me step by step procedure to access JPA Object through http , am not getting any online resouces.Please help me ..thanks in advance.


text:
Q: Loop through array and display result in table style I have following array:
var arr = ['1---William---Developer', '2---Winston---Staff', '3---Thomson---Admin'];

I want to split this and allocate to table.
Example:

    1
    William
    Developer

    2
    Winston
    Staff

    3
    Thomson
    Admin

Here is the code I tried
var a = "";
 var b = "";
 for (i = 0; i < worker_row_array.length; i++) {
     var row_item = worker_array[i];
     var row = "
";
     var worker_item_array = row_item.split("---");
     for (var s = 0; s < worker_item_array.length; s++) {
         column_item = worker_array_list[s];
         b += ""+column_item+"	";
     }
    a += b.concat("
");
}

A: try this fiddle
 var arr = ['1---William---Developer', '2---Winston---Staff', '3---Thomson---Admin'];

var html = "";
for ( var counter = 0; counter < arr.length; counter++)
{
 var columns = arr[ counter ].split( "---" );
 console.log(columns);
 html += "
";
 columns.forEach( function(value){
    console.log(value);
    html += "" + value + "	";
    } );
 html += "
";
 console.log( html );
}
document.body.innerHTML += "
" + html + "
";

A: You need to name the arrays the same as you define them
I reused your original code:

var  worker_row_array = ['1---William---Developer', '2---Winston---Staff', '3---Thomson---Admin'];

var a = "";
for (i = 0; i < worker_row_array.length; i++) {
     var row_item = worker_row_array[i];
     var row = "
";
     var worker_item_array = row_item.split("---");
     for (var s = 0; s < worker_item_array.length; s++) {
         column_item = worker_item_array[s];
         row += ""+column_item+"	";
     }
     a += row+"
";
}
a = "
"+a+"
";
console.log(a);
document.getElementById("workers").innerHTML=a;


text:
Q: Grep multiple patterns and print a different number of lines below each of the patterns? I am trying to find a way to grep/awk multiple patterns and then print a certain number of lines below the first pattern and a certain number of lines below the second pattern. For example
  ....
  other lines
  ....
###Pattern 1####
line 1
line 2
line 3
 ....
 other lines
 ....
####Pattern 2####
line 1
line 2
line 3
line 4
 ....
 other lines
 ....

So what I want to do is find the two patterns in the file and print out the first pattern and the 3 preceding lines underneath, then the second pattern and the four preceding lines underneath the second pattern.
So that my desired output looks like:
####Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4

Updated Desired Output
So before I wasn't as clear I apologize, there may be multiple patterns. So what I would hope to achieve is an output that looks like the following:
####Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4
-----
####Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4
-----
 and so on

A: sed -ne'/pattern1/{:1' -e'$p;N;s/\n/&/[num]; to' -eb1 -e\} \
     -e'/pattern2/{:2' -e'$p;N;s/\n/&/[num]; to' -eb2 -e\} \
     -ed -e:o -eh      -e'y/\n-/-\n/;s/[^-]*//g' -e'H;x;p'

That will print as many -dashes following a match block as there are newlines which follow that match. And so, if you wanted 4 lines after every pattern1 match and 2 after every pattern2 match, you'd get an additional divider line printed between each block of 4 hyphens at the tail of a pattern1 block and 2 hyphens at the tail of a pattern2 block. This is all true except when the last line is encountered while gathering the tail for each - in that case everything between the last line and the pattern match is printed, but no hyphens are appended.
You might notice that much of the code in the above sed script is fairly redundant. Basically we're just implementing an identical type of loop for each possible match. It is thanks to sed's very simple syntax rules, as is evinced above, that makes scripting sed so eminently scriptable. In other words, because sed's syntax is basic, it is a simple affair to write a script which can write a sed script.
For example, this task might easily be parameterized to work with any number of patterns and associated follow line counts:
amatch(){  sed ${2:+"-ne$(n=0;                   \
    while  [ "$#" -gt "$((!!(n+=1)))" ];         \
    do     printf "\n/%s/{:$n\n\t%s;to\n\t%s\n}" \
                  "$1" "\$p;N;s/\n/&/$2" "b$n";  \
           shift 2;                              \
    done;  printf "\nd;:o\n\t%s\n\t%s\n\tH;x;p"  \
                  'h;y/\n-/-\n/' 's/[^-]*//g'    \
)"}; }

So long as amatch() is called with 2 or more parameters, it will build out a sed script just like the one above, and write a loop for each pair.
So it first builds and prints a sed script in a subshell, and afterward sed runs it against stdin.
So when I do:
seq 30 | amatch \[45] 5 1$ 2

The shell's while loop assembles and prints out to the command substitution a script that looks like:
/[45]/{:1
    $p;N;s/\n/&/5;to
    b1
}
/1$/{:2
    $p;N;s/\n/&/2;to
    b2
}
d;:o
    h;y/\n-/-\n/
    s/[^-]*//g
    H;x;p

And sed evaluates that against stdin and prints...
1
2
3
--
4
5
6
7
8
9
-----
11
12
13
--
14
15
16
17
18
19
-----
21
22
23
--
24
25
26
27
28
29
-----

A: Doubtless some more elegant approaches, but here's one way
# awk '/Pattern 1/{for(c=0;c<4;c++){print;getline}}/Pattern 2/{for(c=0;c<5;c++){print;getline}}' foo
###Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4
#

Marginally more elegant:
# awk '/Pattern 1/{c=4}/Pattern 2/{c=5}{while(c-->0){print;getline}}' foo
###Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4
#

And to pop 5 hyphens under the matched set, try this
# awk '/Pattern 1/{c=4}/Pattern 2/{c=5}{while(c-->0){print;getline;x=1}if(x){print "-----";x=0}}' foo
###Pattern 1####
line 1
line 2
line 3
-----
####Pattern 2####
line 1
line 2
line 3
line 4
-----
#

Or for a "-----" at the very end use:
# awk '/Pattern 1/{c=4}/Pattern 2/{c=5}{while(c-->0){print;getline}}END{print "-----"}' foo
###Pattern 1####
line 1
line 2
line 3
####Pattern 2####
line 1
line 2
line 3
line 4
-----
#


text:
Q: hashtags for posted yammer messages using yammer REST API For any existing yammer messages, is there a way to create a tag (i.e., hashtag) programmatically using the yammer rest API. The URI: https://www.yammer.com/api/v1/messages/about_topic/:Topic_ID.json accepts only GET requests.

A: You would have to include #YOURHASHTAG in a new reply.


text:
Q: TCC Compiler: Undefined symbol "main" I am trying to compile a library, but keep getting these errors.  Not too
familiar with C and don't know how to get around this.  It doesn't create the dll.
c:\>C:\tcc\tcc.exe C:\tcc\examples\hello_dll.c -o C:\tcc\examples\test_win.dll
tcc: error: undefined symbol 'hello_data'
tcc: error: undefined symbol 'hello_func'

//+---------------------------------------------------------------------------
//
//  HELLO_DLL.C - Windows DLL example - main application part
//

#include <windows.h>

void hello_func (void);
__declspec(dllimport) extern const char *hello_data;

int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR     lpCmdLine,
    int       nCmdShow)
{
hello_data = "Hello World!";
hello_func();
return 0;
}

A: Two errors:

*

*The hello_data variable is declared extern which means it is not defined in this program module so needs to come from somewhere else, from somewhere else that is linked in at the same time.

*Your WinMain routine calls the hello_func but it is not defined.  In C, when you see the definition ending with (); that means this is a prototype to tell the compiler what to expect, not the actual code for the function.

I would suggest that to start, you plan on getting a console type application going to start, such as the infamous hello world, something like:
#include <stdio.h>
int main()
{
    printf("Hello William\n");
}

This would be compiled and run in a cmd window under MS Windows.  When you get that working, you can look into doing something fancier using the windows environment and things like WinMain in a DLL.


text:
Q: Fastest way to import data into Neo4j with Lucene I have a large dataset of about 20million Person nodes with a text field that I want to index with Lucene. What is the best way to do such a large data import in Neo4j when one of the fields require a lucene index?

*

*Cypher: CREATE (n:Person { pid:538, text: 'hello this is me', name: 'David' }) where text is preconfigured to be indexed by Lucene.

*API: Iteratively nodes are created, properties are set and text is added to the Lucene index:

Node node = graphDb.createNode(DynamicLabel.label("Person"));
node.setProperty("name","David"); node.setProperty("pid",538);
nodeIndex.add(node,"text","hello this is me");

*CSV importer: Can we use the batch importer when one of the fields require a manual lucene index? If yes, how do I go about it?

Thanks!!


text:
Q: Make .ipa for iPhone, not iPad using PhoneGap Build I'm trying to submit an iPhone-only app to the store. I'm building using PhoneGap Build.
I found this SO question (from 2013): Phonegap targeting only iPhone (not iPad)? saying to use <preference name="target-device" value="handset" /> but it's not working. The .ipa file continues to declare support for iPad
It appears to be a known issue: https://github.com/phonegap/build/issues/504
I'm wondering if anyone else has had to deal with this recently? And if there are any workarounds. Any tricks?
I've started the submission process anyway, but have had the app rejected a couple of times so far for iPad related style/sizing issues. I'm going to try and pick through the issues as a back up plan, but I don't need to support iPad so I'd like to just submit a iPhone only version
Note: I can't build without PhoneGap build at the moment. I need to upgrade my Mac OS to get the newer xcode to compile using Cordova on my machine. I'm in Vietnam right now, with terrible internet, and can't do it at the moment.

A: Fixed in GitHub issue 504 https://github.com/phonegap/build/issues/504
I've tested this and it's good.


text:
Q: Swift - Push Segue I have a setup like this:

All the segues are sit to Push, right now if i move from SignupView to LoginView it seems like it duplicates the LoginView, because the back button takes me to LoginView again, and then the SignupView, and when i try to add a segue from LoginView to the tableViewController the app crashes.
How exactly should i implement this ?
PS: the segue to the LoginView, is coming from the Login Button in the SignUp view. And to the tableview is doing from the Login Button in the LoginView

A: Hmm, I just set up a Storyboard to mimic your setup and when I move to Login view, the back button takes me right back to the SignUp view.  I would check the Connections inspector for each view and make sure nothing extra is in there.


text:
Q: Picture box not working and setting it to another one I have two picture box one for photo and the other for signature but I notice when updating my information once I browse to change the signature it will automatically set the image to the same thing with the  one in photo
Public sub GetAccountSignsture(byval accountnumber as string, byval imageviewer as picturebox)

Connect
Conn.changedatabase("Bgsale")
Cmd.commandtext="select signature from tblaccounts where accountnumber =@id"
With cmd.parameters
.clear
.addwithvalue("@id",accountnumber ")
End with
Dim rd as sqldatareader = cmd.executereader
If rd.hasrows then
Rd.read
Dim imgstream as new system.io.memorystream
Dim imgbyte as byte()
Imgbyte= rd("signature")
For each img as byte In imgbyte
Imgstream.write(img)
Next
Image viewer.image.fromstream(imgstream)
Rd.close
Else
Rd.close
Image viewer.image=nothing

A: Instead of passing the PictureBox as a parameter, I have separated the database code from the user interface code.
The UI code gets the account number from a TextBox. I made a guess that it was and Integer in the database and used .TryParse to validate.
When you name a method GetSomething, one could assume that something will be returned. So, this is now a Function that returns an image.
Keep your database objects local to the method where they are used. This way you can be sure they are closed and disposed. A Using...End Using block will do this for you even if there is an error.
Try to use the .Add method on the parameters collection. See http://www.dbdelta.com/addwithvalue-is-evil/
and
https://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/
and another one:
https://dba.stackexchange.com/questions/195937/addwithvalue-performance-and-plan-cache-implications
Here is another
https://andrevdm.blogspot.com/2010/12/parameterised-queriesdont-use.html
Since you are retrieving a single piece of data you can use .ExecuteScalar which will give your the value in the first column of the first row.
Private Sub DisplaySignatue()
    Dim acctNum As Integer
    If Integer.TryParse(TextBox1.Text, acctNum) Then
        PictureBox1.Image = GetAccountSignature(acctNum)
    Else
        MessageBox.Show("Please enter AddressOf valid account number.")
    End If
End Sub

Public Function GetAccountSignature(ByVal accountnumber As Integer) As Image
    Dim retVal As Object
    Using cn As New SqlConnection("Your connection string"),
         cmd As New SqlCommand("select signature from tblaccounts where accountnumber =@id")
        cmd.Parameters.Add("@id", SqlDbType.Int).Value = accountnumber
        cn.Open()
        retVal = cmd.ExecuteScalar()
    End Using
    Dim img As Image
    If retVal IsNot Nothing Then
        Using imgstream As New System.IO.MemoryStream
            Dim imgbyte = CType(retVal, Byte())
            imgstream.Write(imgbyte, 0, imgbyte.Length)
            img = Image.FromStream(imgstream)
        End Using
        Return img
    Else
        Return Nothing
    End If
End Function

EDIT
Let's check for Nothing before filling the PictureBox.
Private Sub DisplaySignatue()
    Dim acctNum As Integer
    If Integer.TryParse(TextBox1.Text, acctNum) Then
        Dim i As Image = GetAccountSignature(acctNum)
        If i Is Nothing Then
            MessageBox.Show("No signature retrieved")
        Else
            PictureBox1.Image = i
        End If
    Else
        MessageBox.Show("Please enter AddressOf valid account number.")
    End If
End Sub


text:
Q: How to change the color of a button when a date value changes and also when a textbox value changes? I have a view which has number of textboxes and a datepicker with a button of gray color. When the textbox and datepicker value is changed, the color of the button becomes red and if I replace the new value of input with previews it becomes gray again.
My code (below) is working fine with the textbox but not with the datepicker:
$(".class Selector").each(function(){
  $(this).on('change blur keyup',function(){
    if(oldvalue of textbox1!=newvalue of textbox1){
      $("#button id ").css('backgroundcolor','red')
    }
    else if(oldvalue of textbox2!=newvalue of textbox2){
      $("#button id ").css('backgroundcolor','red')
     }
    else if(oldvalue of datepicker !=newvalue of datepicker){
      $("#button id ").css('backgroundcolor','red')
     }
    else {
      $("#button id ").css('backgroundcolor','gray')
    }
  });
});

My code runs incase of textbox values but it is not working on datepicker case
In this case .on fired first while I want to fire date picker on change first. When I click on date picker textbox , I always get new date undefined.
Any help please. Thanks.

A: Use the JQuery UI datepicker.
In JQuery UI datepicker has function, name onSelect, under this function you can add your code. For know more please click here.enter link description here


text:
Q: Исключение вещественных чисел в int Всем доброго времени,
появилась некоторая необходимость в языке, который я не знаю абсолютно.
Собственно, по заданию необходимо сделать ввод и вывод по каждому типу переменной.
string принимает любой ввод,
double тоже принимает любое число,
А как быть с int? Cделал так, чтобы оно не принимало строку, но при вводе вещественного, программа ломается. Как быть в данной ситуации?
Вот тот кусочек программы..
 List<int> mylist(0);
             while (true)
                    {
                     int r;
                     cout<<"Реализация списка для типа Int"<<endl;
                     cout<<"1) Добавить элемент"<<endl;
                    ...................
                     cin>>r;
                     if (r==0) {mylist.~List();break;}
                     switch (r)
                        {
                         case 1:
                            {
                             int st;
                             cout<<"Введите элемент"<<endl;
                             while (!(cin >> st))
                            {
                                cin.clear();
                                while (cin.get() != '\n');
                                cout << "Неверный ввод. Повторите." << endl;
                                cout <<"Введите целое число "<< endl;
                            }
                             mylist.add(st);
                             system("pause");
                             continue;
                            }
                    .......................
                        }


text:
Q: Using different values in find method based on boolean value - React I have a React component which accepts 3 props:

*

*code (can be country or currency code)

*currencyCode (boolean)

*countryCode (boolean)

And makes use of a flagsList like so:
type CountryEntry = {
  currencyCode?: string,
  countryCode?: string,
  countryLabel: string,
  flagComponent: JSX.Element,
};

export const flagsList: CountryEntry[] =
  {
    currencyCode: "AED",
    countryCode: "AE",
    countryLabel: "United Arab Emirates (the)",
    flagComponent: UnitedArabEmirates,
  },
  {
    currencyCode: "AFN",
    countryCode: "AF",
    countryLabel: "Afghanistan",
    flagComponent: Afghanistan,
  },
];

What I am trying to do is:

*

*when currencyCode is true - search the flagsList by currencyCode, and

*when countryCode is true search the flagsList by countryCode
whilst maintaining the fallback for each if a code cannot be found (StyledIcon)
const CountryFlag = ({ code, currencyCode, countryCode }: Props) => {
  const countryEntry = flagsList.find(
    (f) => f.currencyCode === currencyCode
  );

  if (!countryEntry) {
    return
    );
  }
};

A: Consider using a string union or enum instead of multiple booleans.
type CountryFlagProps = {
  keyCode: string;
  keyType: "currencyCode" | "countryCode";
};

const CountryFlag = ({ keyCode, keyType }: CountryFlagProps) => {
  const countryEntry = flagsList.find((f) => f[keyType] === keyCode);

  if (countryEntry) {
    return countryEntry.flagComponent
  }

  // Choose your fallback
  return <Flag country="UK" />;
};

If you know all of your codes in advance you can be more restrictive and consumers will get better intellisense when using <CountryFlag />
type CurrencyCode = "AED" | "AFN";
type CountryCode = "AE" | "AF";

type CountryEntry = {
  currencyCode?: CurrencyCode;
  countryCode?: CountryCode;
  countryLabel: string;
  flagComponent: JSX.Element;
};

const flagsList: Array<CountryEntry> = [
  {
    currencyCode: "AED",
    countryCode: "AE",
    countryLabel: "United Arab Emirates (the)",
    flagComponent: <Flag country="AE" />
  },
  {
    currencyCode: "AFN",
    countryCode: "AF",
    countryLabel: "Afghanistan",
    flagComponent: <Flag country="AF" />
  }
];

type CountryFlagProps = {
  keyCode: CurrencyCode | CountryCode;
  keyType: "currencyCode" | "countryCode";
};

const CountryFlag = ({ keyCode, keyType }: CountryFlagProps) => {
  const countryEntry = flagsList.find((f) => f[keyType] === keyCode);

  if (countryEntry) {
    return countryEntry.flagComponent;
  }

  return <Flag country="UK" />;
};

export default function App() {
  return (

Hello CodeSandbox

Start editing to see some magic happen!

      <CountryFlag keyCode="AF" keyType="countryCode" />

  );
}


text:
Q: Is it correct to sat "Keep the amount of time to the minimum?" Is the sentence below correct grammatically ?

I've tried my best to keep the amount of time I spend on different social media platforms to the minimum.

Is "spend on" correct ?
Is "to the minimum" correct?


text:
Q: Need to get name and age from the user in a specific format I'm trying to get the specific output of
What is your name?
What is your age?
Hello, Mr. Alex Whatmore (35)!

This is my code:
#include <iostream>
using namespace std;
#include <string>

int main()
{
  string name;
  int age;

  cout<<"What is your name?";
  cin>>name;
  cout<<"What is your age?";
  cin>>age;
  cout<<"Hello,"<<name;
  cout<<age;
  cout<<"!";
return 0;
}

How could I put the numbers in brackets or how could I allow the user to input their first and last name?

A: Every time you ask your user for input, expect him or her to press Enter.
#include <ciso646>
#include <iostream>
#include <limits>
#include <string>

int main()
{
  std::string name;
  int         age;

  std::cout << "What is your name? ";
  getline( std::cin, name );

  std::cout << "What is your age? ";
  std::cin >> age;
  std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );

  if (!std::cin or name.empty() or (age < 0) or ...)
  {
    complain about bad input
  }

  std::cout << "Hello " << name << " (" << age << ")!\n";
}

For homework assignments you can often assume that all input will be correct and leave off any checks.

*

*!std::cin will be true if the user tried to input anything but a valid integer for age, or if EOF was reached before all your inputs were complete.

*name.empty() doesn't preclude the user from entering a bunch of spaces or dashes or anything weird for his name.You don't need to care for a homework solution, but Patrick McKenzie's Falsehoods Programmers Believe About Names should be required reading for anyone serious about dealing with identifying people with computer systems.

*Obviously, people cannot be younger than zero years old.

*Et cetera.

The numeric_limits thing is obnoxiously verbose, but it is how C++ expects you to skip to NL. A more correct way would be to get input as a string and then attempt to convert the entire string to int and complain on failure. The exampled method lets the user enter any random stuff after a valid integer (which we just ignore with the cin.ignore(...)).
Again, for a simple homework, I'd let it slide.


text:
Q: My code won't append student grades into a text file I'm trying to write a program that allows a teacher to input the name of a student and the grade they recieved and then output that to a text file. After doing that 12 times, the code is supposed to ask you for the name of the file that has the grades, known as "grades.txt," and after you type in grades.txt it's supposed to read out the grades and the names of the students you entered.
count = 0
with open('grades.txt', 'w') as grades:
        grades.write('Student Names and Grades:')
        grades.write('\n')

while count <12:
    count+=1
    name=input(' Enter student name: ')
    try:
        average=int(input('Enter grade average: '))
        if 0<= average <=100:
            continue
        else:
            print('Average must be between 0 and 100')
    except ValueError:
        print ('Input grade must be a number')

    with open('grades.txt', 'a') as grades:
        grades.write('Student name: ')
        grades.write(name)
        grades.write(' -- Student average grade: ')
        grades.write(str(average))
        grades.write('\n')
        grades.close()

try:
    question=input('Enter file name for grades: ')
    if question == 'grades.txt':
        with open('grades.txt', 'r') as grades:
            grades_read = grades.read()
            print(grades_read)
            grades.close()
except:
   print('File not found')

However, when the file is read out, it only displays "Student Names and Grades:" and none of the names and grades that were appended to it. Does anyone know why?

A: This is because of the line
if 0<= average <=100:
        continue

continue will make you skip the rest of the code and go to the next iteration of the loop (so no printing in file here). The correct command here for your application is "pass" not "continue" just replace and try it out.
BTW : even if you put count < 12 its will only count 11 (maybe try <=)

A: Your continue is misplaces, you skip when you have a correct grade.
Furthermore you don't need to close a file, when you use the context manager (the with statement). And better use except FileNotFoundError than a bare except.
And probably you want to increase count only after you saved a valid record, so move it to the end of the loop.
count = 0
with open('grades.txt', 'w') as grades:
    grades.write('Student Names and Grades:')
    grades.write('\n')

while count < 12:
    name = input(' Enter student name: ')
    try:
        average = int(input('Enter grade average: '))
        if not 0 <= average <= 100:
            print('Average must be between 0 and 100')
            continue
    except ValueError:
        print('Input grade must be a number')
        continue

    with open('grades.txt', 'a') as grades:
        grades.write('Student name: ')
        grades.write(name)
        grades.write(' -- Student average grade: ')
        grades.write(str(average))
        grades.write('\n')

    count += 1

try:
    question = input('Enter file name for grades: ')
    if question == 'grades.txt':
        with open('grades.txt', 'r') as grades:
            grades_read = grades.read()
            print(grades_read)
except FileNotFoundError:
    print('File not found')


text:
Q: Bitwise operations vs. logical operations in C++ In C++ are the following statements when comparing two integer values for equality the same? If not, why?
if(a == b)
  ...do

if(!(a ^ b))
  ...do

A: For integer values, yes. Obviously the xor operator will return not-zero if there are any bit differences between A and B, and ! will invert that. For integer data types, the conditions are equivalent.
For floating point values, because of how you can perform two mathematical operations that "should" give the same result, but they may be represented differently as floats, you should not use either of these to compare floats for equality, you should check whether they are the same to within a small margin of error (an "epsilon").
For pointers...I have no idea why you would want to do this to pointers. But if you really want to do it, then yes, they are the same.
However, there is no reason to do this. With optimizations enabled, they will compile to the same code, without, the first will likely be faster. Why would you use the less-clear !(a^b)?

A: The two comparisons are equivalent: a^b is 0 if and only if a==b, so !(a^b) is true if and only if a and b have the same value.
Whether you can call them "the same" depends on what you mean by two different operations being "same." They probably will not be compiled into the same code, and a==b is definitely easier to read.


text:
Q: Fit new model in statsmodel fails - RuntimeError I have created one AR model using statsmodels . That has worked but when I tried to create new model I hav gotten RuntimeError :

RuntimeError:  Model has been fit using maxlag=1, method=cmle,
ic=None, trend=c. These cannot be changed in subsequent calls to
fit. Instead, use a new instance of AR.

This is how I generated the first model:
model=AR(df['Pop'])
AR1fit=model.fit(maxlag=1)

...
AR1fit.predict(start=start,end=end)

#the 2nd model:
AR2fit=model.fit(maxlag=2)
>>>
RuntimeError:
Model has been fit using maxlag=1, method=cmle, ic=None, trend=c. These
cannot be changed in subsequent calls to `fit`. Instead, use a new instance of
AR.

I haven't found any post about this specific error, my goal is to  fit the new model .

A: You have to instantiate a new model for the AR(2) and then call the fit method:
model2 = AR(df['Pop'])
AR2fit = model2.fit(maxlag=2)


text:
Q: Problem in exporting .apk file (Could not access the digital certificate - unable to load a certificate)
I had created a .p12 certificate file in Adobe CS6 in 2015.
I was later using Adobe Animate CC 2016 to export the .apk file with the same certificate to update the app in Google-play.
Recently, I was trying to update the app but Google Play needed SDK 28 or later.
So, I updated to Adobe Animate 2019 and I'm getting this error now.

A: *

*You need to update java in:
C:\Program Files\Common Files\Adobe\Adobe Animate CC 2016\jre

*You need to download server-jre-8u211-windows-x64 from here.

*Open the file that you downloaded and copy (jre) folder and put it in this location:
C:\Program Files\Common Files\Adobe\Adobe Animate CC 2016\ (New jre)

Then everything is right.

A: Packaging an Android app fails on computers having Java 8 when using an RSA-1024 certificate created with the Adobe AIR Developer Tool (ADT). Read More

*

*install java 7 in your computer.

*copy entire "jre" folder from ProgramFiles/java in  C:\Program Files\Common Files\Adobe\Adobe Animate 2020\jre.

*now you cand reinstall java 8 in your computer


text: Q: Android вход в приложение по биометрии/пину У нас есть много приложений где осуществляется вход через пин или биометрию. Банковские (ПриватБанк, Монобанк) и другие (Дия), уверен в других странах таких же много, к примеру ТинькоффБанк. Как такое реализовать?


text:
Q: Get Object to Fly From the Left Side to the Right Side of the Screen Starting with this fiddle we see a basic animation of a box flying from its start position to its finish position. This is the known good code. (I tried it as a stackoverflow snippet, but it didn't work here for some reason.)
HTML

Start

Finish

Fly

CSS
#start{
  position:absolute;
  background:red;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  left:0px;
}
#finish{
  position:absolute;
  background:blue;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  left:200px;
}
#fly{
  position:absolute;
  background:yellow;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  left:0px;
  transition:1000ms;
}
#fly.finish{
  left:200px
  }

JavaScript
document.getElementById("fly").className = "finish";

-
Unlike the fiddle above this fiddle below however does not work. Rather than transitioning gently from the start location to the finish, it starts at the finish. This is because it should transition from a "left" property to a "right" property.
HTML

Start

Finish

Fly

CSS
#start{
  position:absolute;
  background:red;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  left:0px;
}
#finish{
  position:absolute;
  background:blue;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  right:0px;
}
#fly{
  position:absolute;
  background:yellow;
  height:100px;
  width:100px;
  line-height:100px;
  text-align:center;
  left:0px;
  right:auto;
  transition:1000ms;
}
#fly.finish{
  right:0px;
  left:auto;
  }

Javascript
document.getElementById("fly").className = "finish";

Although I understand why this doesn't work, I need a box to fly to the right of the screen from just off the left edge of the screen. Most solutions to this issue either look strange on extremely wide screen devices, or have a slow response time on narrow mobile devices. I want an animation that's responsive to browser width, travelling more slowly across narrow screens and more quickly across wide screens.
What is the most elegant solution for this?
Ideally I'd like not to use any external libraries, but if I must, the page is already using jquery, so that would be the ideal one to use if that helps.
I'm not opposed to writing extremely long JavaScript functions, but shorter is always better.

A: As you know that the animation doesn't work cause can't animate two different attributes, in this case, changing left and right value in hope for the element to be animated.
My suggestion would be this:
#fly.finish {
  left:calc(100% - 100px);
}

this is assuming that the box is always 100px width. Hope it helps!

A: Change your flying elements "left" property to (100% - elements width) as shown below.
#fly.finish{
  left: calc(100% - 100px);
}


text:
Q: what is the equivalent hashmap or list structure for the below json? There is a need of Java object to JSON conversion. So I think I need help in making use of HashMap or List (Arraylist) to generate the below complicated JSON. I gave it a try, but I was not able to generate the exact JSON format.
{
    "uid": "prathap.b",
    "commonName": "prathap",
    "unverifiedMails": "prathap.balachandra@xyz.com",
    "alternateMobiles": "+91123456789",
    "realm": "jio",
    "deviceInfo": {
        "consumptionDeviceName": "My Desktop",
        "info": {
            "type": "browser",
            "devicePrint": {
                "screenHeight": 1080,
                "product": {
                    "sub": 20030107,
                    "name": "Gecko"
                },
                "platform": "Linuxx86_64",
                "timezone": "-¬-120",
                "userAgent": "Mozilla/5.0(X11;Linuxx86_64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/28.0.1500.5Safari/537.36",
                "screenWidth": 1920,
                "installedPlugins": "libpepflashplayer.so;internal-¬-remoting-¬-viewer",
                "longitude": 17.003768500000003,
                "latitude": 51.110937899999996,
                "installedFonts": "AbyssinicaSIL;Amiri;AsanaMath;BitstreamCharter",
                "screenColorDepth": 24
            },
            "mobile": {
                "id_brand": "ghdh",
                "model": "on_wifi"
            }
        }
    },
    "unverifiedMobiles": "+91123412341",
    "preferredOtpMethod": "M",
    "password": "rjil@1234"
}

Thanks in advance
PFB the code I tried.
CreateUser createuser=new CreateUser();

CreateUser.DeviceInfo device=createuser.new DeviceInfo();

DeviceInfo.Info in=device.new Info();

Info.DevicePrint dp=in.new DevicePrint();

DevicePrint.Product prd=dp.new Product();

DevicePrint.Mobile mob=dp.new Mobile();

List l1=new ArrayList();
l1.add("123456789");
l1.add("987456321");
createuser.setAlternateMobiles(l1);

List l2=new ArrayList();
l2.add("123456789");
l2.add("987456321");
createuser.setUnverifiedMobiles(l2);

List l3=new ArrayList();
l3.add("abc@ril.com");
l3.add("cba@ril.com");
createuser.setUnverifiedMails(l3);

createuser.setPassword("password123");
createuser.setPreferredOtpMethod('M');
createuser.setRealm("jio");
createuser.setCommonName("prathap");
createuser.setUid("prathap.b");

device.setConsumptionDeviceName("My Desktop");

in.setType("browser");

dp.setInstalledFonts("A");
dp.setInstalledPlugins("B");
dp.setLatitude(123);
dp.setLongitude(456);
dp.setPlatform("C");
dp.setScreenColorDepth(789);
dp.setScreenHeight(10);
dp.setTimezone("D");
dp.setUserAgent("E");

prd.setName("john");
prd.setSub("F");

mob.setId_Brand("G");
mob.setModel("H");

List<CreateUser> listUser=new ArrayList<CreateUser>();

listUser.add(createuser);

List<DeviceInfo> listdevice=new ArrayList<DeviceInfo>();

listdevice.add(device);

TestInfo ti=new TestInfo();
ti.setInfo(in);

TestDevicePrint tdp=new TestDevicePrint();
tdp.setDevicePrint(dp);

Testproduct tp=new Testproduct();
tp.setProduct(prd);

List<Mobile> listmob=new ArrayList<Mobile>();

listmob.add();

TestMobile tm=new TestMobile();
tm.setMobile(mob);

List<Object> Listfinal=new ArrayList<Object>();
Listfinal.add(createuser);
Listfinal.add(ti);
Listfinal.add(tdp);
Listfinal.add(tp);
Listfinal.add(tm);

Gson gson=new Gson();
String one =gson.toJson(Listfinal);

/*System.out.println("Lest chk"+one);*/

generated JSON:
[
    {
        "commonName":"prathap",
        "realm":"jio",
        "uid":"prathap.b",
        "password":"password123",
        "unverifiedMails":["abc@ril.com","cba@ril.com"],
        "unverifiedMobiles":["123456789","987456321"],
        "alternateMobiles":["123456789","987456321"],
        "preferredOtpMethod":"M"
    },
    {
        "info":{
            "type":"browser"
        }
    },
    {
        "devicePrint":{
            "screenColorDepth":789,
            "screenHeight":10,
            "screenWidth":0,
            "installedPlugins":"B",
            "installedFonts":"A",
            "timezone":"D",
            "latitude":123.0,
            "longitude":456.0,
            "userAgent":"E",
            "platform":"C"
        }
    },
    {
        "product":{
            "name":"john",
            "sub":"F"
        }
    },
    {
        "mobile":{
            "id_Brand":"G",
            "model":"H"
        }
    }
]

A: You can use Google Gson library for Json. Here is link click here.
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.
Here is answer to your question .

A: Your problem is that you put the various components of the original object into an array and hope for it to magically become an object, when converted to JSON.
To solve this, let CreateUser have a field deviceInfo of the type DeviceInfo. Similarly let DeviceInfo have a field infoof type Info and so on.


text:
Q: function to count query results in zend Is there another way to count no of rows returned by a query.The following code returns 1 even though there is no result returned.(i am working on ZEND).
$this->view->overdue_query = $overdue_query->fetchAll();
/*Get overdue count */
$this->view->overdue_count = count($overdue_query);

A: $this->view->overdue_query = $overdue_query->fetchAll();
/*Get overdue count */
$this->view->overdue_count = count($overdue_query);//you are doing count on
//your query and not the result of fetchAll

it should be instead
$this->view->overdue_query = $overdue_query->fetchAll();
 /*Get overdue count */
$this->view->overdue_count = count($this->view->overdue_query);

//unless you're getting overdue_count in your view then you would do :
$count = count($this->overdue_query);

A: As far as I know this should work I do it all the time.
$results = $overdue_query->fetchAll();
echo count($results);

If it does'nt maybe something else in your code is wrong its hard to tell.
Also try toArray() to see if it changes anything.
$results = $overdue_query->fetchAll()->toArray();
echo count($results);

Documentation

A: I agree with MMC that you are trying to count wrong thing.
count($this->view->overdue_query); should do the trick.