text:
Q: How to fetch the input value of a form in another component with React Hooks I have used Axios with Reach Hooks. Is there any way to fetch the updated input value from form.js file so that I can use it to update the axios.get link in ApiData.js file? When the user types a value, I want to fetch that value and use in the ApiData.js file so that the value can be updated in axios.get. I have tried a lot of ways to do that by passing the updatedInputVal in the form.js file to a function and then trying to access it in the ApiData.js file. Nothing worked. I'm a beginner. So please let me know if you are unclear about the issue. Thanks in advance
This is the form.js file
import React, {useState} from 'react';

function UseForm(){
    const[inputValue, setInputValue] = useState({
        search: "",
        contactName:"",
        contact:""
    })

    function handleChange(e){
        const {name, value} = e.target;
        setInputValue(previousValue=>{
            if(name === "search"){
                return{
                    search: value,
                    contactName:previousValue.contactName,
                    contact:previousValue.contact
                }
            }
        })
    }

    function onFormSubmit(event){
        let updatedInputVal = setInputValue(inputValue.search)
        event.preventDefault();
        return updatedInputVal;//Want to fetch this value and use it in the ApiData.js component
    }

    return (

                <form onSubmit={onFormSubmit}>
                    <input className="form-input" onChange={handleChange} type="text" name="search" value={inputValue.search} placeholder="Search TV Shows"/>
                </form>

                <button type="submit" className="btn">Submit</button>

)
}

export default UseForm;

This is the ApiData.js file
import React, {useState, useEffect} from 'react';
import axios from 'axios';

const FetchApiData = () =>{
    const [data, setData] = useState([])
    useEffect(()=>{
        async function fetchData(){
        const resquest =  await axios.get(`http://api.tvmaze.com/search/shows?q=${//want to insert here the updated input value the user types}`)
        const appData =  resquest.data[0].show.image.medium;
        setData(appData)
        return appData
    }  fetchData()
    }, [])

    return (

            )
}

export default FetchApiData

App.js file
import React from 'react';
import Nav from "./Nav";
import UseForm from "./Form"
import FetchApiData from './ApiData'

function App(){
    return (

        <Nav
        src={`${process.env.PUBLIC_URL}/images/logo.png`}
        title = "CONTACT US"
        />
        <UseForm/>
        <FetchApiData/>

)
}

export default App

A: Because the App component is the parent of both FetchApiData and UseForm you can simply just handle the state of this value using the App component and pass this property to both children.
App component:
function App(){

    // declare state object here
    const [inputValue, setInputValue] = useState({
        search: "",
        contactName:"",
        contact:""
    });

    return (

        <Nav
        src={`${process.env.PUBLIC_URL}/images/logo.png`}
        title = "CONTACT US"
        />
        {/* Pass props to each component */}
        <UseForm inputValue={inputValue} setInputValue={setInputValue}/>
        <FetchApiData inputValue={inputValue}/>

)
}

UseForm component:
function UseForm({inputValue, setInputValue}){
    // Remove this
    // const[inputValue, setInputValue] = useState({
    //     search: "",
    //     contactName:"",
    //     contact:""
    // })

    // keep everything else the same
}

FetchApiData component:
const FetchApiData = ({inputValue}) =>{
    const [data, setData] = useState([])
    useEffect(()=>{
        async function fetchData(){
        const resquest =  await axios.get(`http://api.tvmaze.com/search/shows?q=${inputValue}`)
        const appData =  resquest.data[0].show.image.medium;
        setData(appData)
        return appData
    }  fetchData()
    }, [inputValue])

    return (

            )
}

FetchApiData will re-render every time inputValue changes. Just take note of that unless it is the intended behaviour.

A: You need to lift the inputValue state to App component and pass it via props:
function App(){
    const [inputValue, setInputValue] = useState({
        search: "",
        contactName:"",
        contact:""
    })
    return (

        <Nav
        src={`${process.env.PUBLIC_URL}/images/logo.png`}
        title = "CONTACT US"
        />
        <UseForm inputValue={inputValue} setInputValue={setInputValue}/>
        <FetchApiData inputValue={inputValue}/>

)
}

function UseForm({inputValue, setInputValue}){
 // ...
}

Also, a state-management solution like Redux can also help in managing state separately from component so that you don't need to pass state via props like shown above.


text:
Q: WordPress site goes blank frequently? My WordPress site goes blank frequently. It goes blank then and there. I don't see it go blank only after doing a particular action.
My guess is that it may due to some memory issues. Kindly help me out to resolve this error.

A: enable debug mode in wp-config.php file:
error_reporting(E_ALL); ini_set('display_errors', 1); // define in config file

define( 'WP_DEBUG', false);

to
define('WP_DEBUG', true);

If there is any error it will display and then try to fix errors

A: define('WP_DEBUG', true);
this only hide the error not resolving it.At development stage of any project it should be place true to find out the error in the code

redpajama_set_name: RedPajamaStackExchange


text:
Q: Signal-flow graphical summary of back-propagation learning I'm trying to draw signal-flow graphical summary of back-propagation learning.  Top part of the graph: forward pass. Bottom part of the graph: backward pass as shown below:

Since this is my first time drawing a figure in Tikz, I am a little overwhelmed by the complexity of this figure. Any help will be appreciated. Also, if you can tell me which tool you used to create this for LaTeX, it will help as well! Thank you!

A: Let me tell you, this is not the best drawing to start using tikz. It has a lot of elements to draw: lines, circles, arrows... That said, I think there are two keys here: positioning the necessary coordinates and using the \foreach command.
First I will provide you with a "map" with my defined coordinates, thus I avoid to explain where is each one.

Now, for the code. It could be less, if I put together more things in the same \foreach. But I think that separating the coordinates, the lines, the labels, etc., we gain a bit in readability. Well, so I hope. I also use the arrows.meta and decorations.markings libraries to put the arrows in the middle of the lines.
It is as follows.
\documentclass [border=2mm]{standalone}
\usepackage    {tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}

\definecolor   {myblue}{HTML}{3CADEF}
\tikzset       {myposition/.store in=\myposition,myposition=0.5}

\begin{document}
\begin{tikzpicture}
  [%
    scale=0.8,thick,line cap=round,line join=round,%
    myarrow/.style=%
    {%
      decoration={markings,mark=at position \myposition with {\arrow{Stealth}}},
      postaction={decorate}
    }
  ]
  % Coordinates
  \foreach\j in {1,2,3}
  {%
    \foreach[count=\xi]\i in {0,8}
    {%
      \coordinate (A\xi\j) at (\i+\j,0);
      \coordinate (B\xi\j) at (\i+\j,8-2*\j);
      \coordinate (C\xi\j) at (\i+\j,8);
      \coordinate (D\xi\j) at (\i+\j,16-2*\j);
    }
    \coordinate (E\j) at  (5, 8-2*\j);
    \coordinate (F\j) at  (7, 8-2*\j);
    \coordinate (G\j) at (13, 8-2*\j);
    \coordinate (H\j) at (-3,16-2*\j);
    \coordinate (I\j) at  (0,16-2*\j);
    \coordinate (J\j) at  (5,16-2*\j);
    \coordinate (K\j) at  (8,16-2*\j);
    \coordinate (L\j) at (13,16-2*\j);
    \coordinate (M\j) at (15,16-2*\j);
    \coordinate (N\j) at (17,16-2*\j);
  }
  \coordinate (H0) at (-3,16);
  \coordinate (J0) at ( 5,16);
  % Blue lines
  \foreach\j in {1,2,3}
  {%
    \foreach\i in {1,2}
    {%
      \draw[myblue,myarrow,myposition=0.4] (D\i\j) -- (C\i\j);
      \draw[myblue,myarrow,myposition=0.6] (C\i\j) -- (B\i\j);
      \draw[myblue,myarrow,myposition=0.6] (B\i\j) -- (A\i\j);
    }
    \draw[myblue,myarrow,myposition=0.3]   (G\j)   -- (B2\j);
    \draw[myblue,myarrow,myposition=0.6]   (B2\j)  -- (F\j);
    \draw[myblue]                          (E\j)   -- (B1\j);
    \foreach\k in {1,2,3}
    {%
      \draw[myblue,myarrow,myposition=0.3] (F\j)   -- (E\k);
    }
  }
  % Black lines
  \foreach\j in {1,2,3}
  {%
    \draw[myarrow,myposition=0.8] (I\j)  -- (D1\j);
    \draw[myarrow]                (D1\j) -- (J\j);
    \draw[myarrow               ] (K\j)  -- (D2\j);
    \draw[myarrow,myposition=0.6] (D2\j) -- (L\j);
    \draw[myarrow,myposition=0.6] (L\j)  -- (M\j);
    \draw[myarrow,myposition=0.6] (N\j)  -- (M\j);
    \draw[myarrow,myposition=1]   (M\j)  --++ (0,-0.5);
    \foreach\i in {0,...,3} \foreach\k/\l in {H/I,J/K}
    {%
      \draw[myarrow,myposition=0.3] (\k\i) -- (\l\j);
    }

  }
  % Circles
  \def\r{0.1} % radius
  \foreach\j in {1,2,3}
  {%
    \foreach\i in {A1,B1,C1,D1,A2,B2,C2,D2,E,F,G}
    {%
      \draw[myblue,fill=white] (\i\j) circle (\r);
    }
    \foreach\i in {H,...,N}
    {%
      \draw[fill=white] (\i\j) circle (\r);
    }
  }
  \draw[fill=white] (H0) circle (\r);
  \draw[fill=white] (J0) circle (\r);
  % Labels
  \foreach\j in {1,2,3}
  {
    \node         at (N\j)                [above]         {$d_\j$};
    \node         at (M\j)                [yshift=-0.6cm] {$e_\j$};
    \node         at (L\j)                [above right]   {$o_\j-1$};
    \node         at ($(D2\j)!0.6!(L\j)$) [above]         {$\varphi(\cdot)$};
    \node         at (J\j)                [above]         {$y_\j^{(1)}$};
    \node         at ($(D1\j)!0.5!(J\j)$) [above]         {$\varphi(\cdot)$};
    \node         at (H\j)                [left]          {$x_\j$};
    \node[myblue] at (G\j)                [right]         {$e_\j$};
    \foreach\i in {1,2}
    {%
      \node[myblue]                          at (D\i\j)                 [above]        {$v_\j^{(\i)}$};
      \node[myblue,fill=white,inner sep=1pt] at (C\i\j)                 [yshift=0.4cm] {$v_\j^{(\i)}$};
      \node[myblue]                          at ($(B\i\j)!0.4!(C\i\j)$) [right]        {$\varphi(\cdot)$};
      \node[myblue]                          at (A\i\j)                 [below]        {$\delta_\j^{(\i)}$};
    }
    \foreach[count=\xi]\i in {H,J}
    {%
      \node at (\i0)  [above]            {$+1$};
      \node at (\i0)  [xshift=1.2cm]     {$w_{10}^{(\xi)}=b^{(\xi)}$};
      \node at (\i3)  [below,xshift=1cm] {$w_{13}^{(\xi)}$};
    }
  }
  \node[myblue] at ($(E3)!0.5!(F3)$) [below] {$w_{31}^{(2)}$};
\end{tikzpicture}
\end{document}

A: Welcome to TeX.SX! Some ideas how to tame this beast:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}[
  dot/.style={
    circle, draw, inner sep=1.5pt
  },
  arrow/.style={
    decoration={markings,
    mark=at position 0.5 with {\arrow{latex}}},
    postaction={decorate}
  }
]

\node[dot, label={90:$\upsilon_1^{(1)}$}] (u11) at (0,0) {};

\node[dot, label={300:$\varphi^\prime(\cdot)$}] (p1) at (0,-2) {};

\node[dot] (x1) at (2,-2) {};

\node[dot, label={270:$\delta_1^{(1)}$}] (d11) at (0,-5) {};

\draw[arrow] (u11) -- node[pos=.5, label={180:$\varphi^\prime(\cdot)$}] {} (p1);
\draw (p1) -- (x1);
\draw[arrow] (p1) -- (d11);

\end{tikzpicture}
\end{document}

You can always consult the very comprehensive and comprehensible TikZ manual for basic help.


text:
Q: OS X - WebView questions I am using webview in one of OS X app and got strange requirement from client that:
1) Need to show address bar in app for webview, I tried if there's any support by webview but couldn't really find. I know I can do that by having a text field and show URL in that but I am not sure if that's the right way so is there any other better way, please suggest.
2) Need to also check whether loaded URL has SSL support and show some icon like padlock (open/close). So again is there any support or feature of Webview that i can use or I just have to check for URL prefix of http or https? Please help.
Thanks in advance.
MP

A: That is exactly what you should do. Create the text field, and insert this bit of code into your application:
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
    NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location"];
    [myTextField setStringValue:currentURL];
}

For the second part of your question, use the currentURL string, and check if https:// exists in the string using the NSNotFound method. By using [myString rangeOfString:@"string_to_search_for"].location != NSNotFound, it will return true if the rangeOfString: is found. (!= means not equal to.) (So != NSNotFound means that your rangeOfString is not equal to not being found... if that makes sense)
 - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {

    NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location"];
    if ([currentURL rangeOfString:@"https://"].location != NSNotFound) {
        // *https://* exists! Show your closed padlock image!
    } else {
        // *https://* does not exist. Show your open padlock image.
    }
}

Hope this was helpful!


text:
Q: Why conditionals using && is two times faster I was searching for many things today but after i found some stuff that i didn't know here at SO...so i decided to see which is the fastest this is what i have..
&& is two times faster than if and condition?a:b;
http://jsperf.com/speed-test-for-conditions
Surprising right. Or is it just my browser.
What do you think of this, do you think performance is worth it. I mean if your app starts working 2x faster. Would it be worth changing coding style to weird && s..

A: Your code snippets don't do the same thing. JavaScript's logical AND short-circuits, so the (x = 'default') part is never actually executed. Your code is interpreted like so:
(x == undefined) || (null && (x = 'default'))

Since x == undefined is true, the second part of the OR is never executed, as the whole expression will be true regardless of the boolean value of the second part.
If you add parentheses, the first and third snippets end up being the same speed (at least for me):
(x == undefined || null) && (x = 'default')


text:
Q: Need advice on whether to keep this code I'm inheriting a codebase that has largely JSP scriplets that quickly become less than readable, for instance here's the fragment that does pagination links:
Visa:
<a class="link" href="javascript:doSubmit('MenyNavigation', 'REW_<%= thisPage %>')" >
   <%
     if(headPointer - nrOfHitsOnPage > 0){
         out.print(" << ");
         if(tailPointer - nrOfHitsOnPage <= 0 ){
             out.print(1);
         } else {
             out.print(tailPointer - nrOfHitsOnPage);
         }
         out.print("-");
         out.print(tailPointer);
      } %>

<% if(resultListSize > 0 ) { %>
   <%=(tailPointer + 1)%> - <%= headPointer %>
<%}%>

<a class="link" href="javascript:doSubmit('MenyNavigation', 'FWD_<%= thisPage %>')" >
   <%
     if(headPointer < resultListSize){
         out.print(1 + headPointer);
         out.print("-");
         if(headPointer + nrOfHitsOnPage > resultListSize){
             out.print(resultListSize);
         } else {
             out.print(nrOfHitsOnPage + headPointer);
         }
         out.print(" >> ");
      } %>

Appearantly this code displays the text "Display 1-10 of 20" when there are 10 elements per page and 20 in total and likewise for other settings but I think this solution is not very reusable. The code is already used in one place in our project and we decided that if we haveone solution for a problem we are going to use the same solution for the same problems if they appear in different places and now I must do pagination for > 5 popups(!) that have search functions and I wonder whether to use this code, to make an analgue solution or build from scratch.
The controller Java class has also not that high cohesion:
public class MenyNavigationActionHandler extends PandoraActionHandler {

    private ArendeProcessSessionData sessionData;
    private final static Logger logger = Logger
            .getLogger(MenyNavigationActionHandler.class);

    protected IFormData getFormData() {
        return null;
    }

    protected IFormPattern getPattern() {
        return EmptyFormPattern.getInstance();

    }

    protected void performAction(ISessionHandler sessionHandler, Action action) {

        String returnPage = null;

        try {

            sessionData = (ArendeProcessSessionData) sessionHandler.getSessionData();

            if(sessionData.returnToUnsavedData(sessionHandler, action)){
                return;
            }

            if (sessionData.getMenuManager() == null) {

                MenuManager menuManager = new MenuManager();
                sessionData.setMenuManager(menuManager);
            }

            // Om man bläddar i träfflista på formell kontrollista
            if (action.getActionCommand().endsWith(ArendeProcessLocator.getFormellKontrollLista())) {

                FormellKontrollInfo fInfo = sessionData.getFormellKontrollInfo();
                FormellKontrollSearchAdmin fSearch = fInfo.getFormellKontrollSearchAdmin();

                if(fInfo != null) {

                    if (action.getActionCommand().startsWith("FWD")) {

                        fSearch.setDirection(PandoraConstants.FWD_DIRECTION);

                    } else if (action.getActionCommand().startsWith("REW")) {
                        fSearch.setDirection(PandoraConstants.REW_DIRECTION);

                    } else {
                        fSearch.setDirection(PandoraConstants.NO_DIRECTION);
                    }
                }

                returnPage = ArendeProcessLocator.getFormellKontrollLista();
                action.setReturnPage(returnPage);

            } else if (action.getActionCommand().equalsIgnoreCase(
                    ArendeProcessLabelConstants.SUB_MENU_VISA_REGISTRERADE)) {

                sessionData.setNyinkomnaLista(null);

                MenuManager menuManager = sessionData.getMenuManager();
                returnPage = menuManager.getLatestDestination(action.getActionTarget());

                if (returnPage == null) {

                    returnPage = action.getCurrPage();
                }

                action.setReturnPage(returnPage);

            } else {
                // Standard hantering av menyval. Target från Navigation-objekt hämtas från action.getActionModifier
                MenuManager menuManager = sessionData.getMenuManager();
                if(action.getActionTarget() != null && !action.getActionTarget().trim().equals("")){
                    returnPage = menuManager.getLatestDestination(action.getActionTarget());
                }else{
                    returnPage = menuManager.getLatestDestination(sessionData.getLatestActionTarget());
                }
                if (returnPage == null) {
                    returnPage = action.getCurrPage();
                }
                action.setReturnPage(returnPage);
            }

            if(action.getCurrPage().endsWith(ArendeProcessLocator.getNyregistrering())){
                   // Nytt önskemål, Kom ihåg innehållet på registrera sidan när vi går till listan  2010-12-02
                   sessionData.getNyregistrering().setKundReferens(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_KUNDREFERENS));
                   sessionData.getNyregistrering().setSokEfternamn(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_SOKEFTERNAMN));
                   sessionData.getNyregistrering().setSokFornamn(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_SOKFORNAMN));
                   sessionData.getNyregistrering().setForetag(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_FORETAG));
                   sessionData.getNyregistrering().setSokandeLandKod(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_SELECT_SOKANDELAND));
                   sessionData.getNyregistrering().setAnkomstDatum(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_ANKOMSTDAG));
                   sessionData.getNyregistrering().setOriginal("original".equals(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_HANDLINGSFORM))? true : false);
                   sessionData.getNyregistrering().setArendeNummer(sessionHandler.getRequestParameter(PandoraFieldConstants.FIELD_ARENDENUMMER));
                             //printer ??
             }

            if(!action.getCurrPage().endsWith(ArendeProcessLocator.getNyinkomnaLista2()) && action.getReturnPage().endsWith((ArendeProcessLocator.getNyregistrering()))){
                   // Rensa minnet av registrera sidan om det inte är listan med registrerade man kommer ifrån
                   sessionData.getNyregistrering().setKundReferens("");
                   sessionData.getNyregistrering().setSokEfternamn("");
                   sessionData.getNyregistrering().setSokFornamn("");
                   sessionData.getNyregistrering().setForetag("");
                   sessionData.getNyregistrering().setSokandeLandKod("");
                   sessionData.getNyregistrering().setAnkomstDatum("");
                   sessionData.getNyregistrering().setOriginal(true);
                   sessionData.getNyregistrering().setArendeNummer("");
             }

             if(action.getActionCommand().equals(ArendeProcessLocator.getNyinkomnaLista())){
                   sessionData.setNyinkomnaLista(null);
              }

        } catch (Exception e) {

            logger.error("MenyNavigationActionHandler: performAction() ", e);
        }

    }

}

I have access to my colleague who write the code and can ask him to guide me what files I should have so the pagination will work but I want a clean and lean solution with no scriplets and that would be a lot of work starting this from scratch instead of using the scriplets.
What do you think I should do? Just use the scriplets above, make them work for my use case and then refactor the most I can to JSTL tags and EL? Any other comment how to reuse Java / JSP code for pagination? Our framework is rather special and custom and we are not using struts or spring or jsf but our own framework which kind of oomplicates things since it relies on session data much.
Any answer or comment is appreciated.

A: I think it depends on how much of this code there is, and whether you have time to spend on making it more maintainable.  I don't think anyone but you (and your boss) can answer that question.
On the question of how to implement this kind of thing, you can choose between the standard JSTL tag libraries or implementing your own, or a combination.  And you can do more if you combine taglibs with EL.  And session attributes shouldn't be a particular problem.
One piece of advice though.  JSTL and JSP EL are getting more expressive, so it could be worthwhile upgrading to a servlet container that implements a recent edition of the Servlet specs.


text:
Q: Mass/Bulk SQL server updates Code
foreach (var item in _context.Duiven.
                .Include(p => p.Duivenmelker.VoedselInstelling)
                .Include(p => p.VoedselHistoriek)
                .Include(p => p.Duivenmelker.Personeel)
                .Include("Ziektes.DuifZiekte")
                .ToList() // 25.000)
            {
                item.FoodHistory();
                item.HealthSimulation();
                item.DiseaseSimulation(diseaseTypes);
                item.CureSimulation(_context);
                item.DeathSimulation();
                item.Feed();
}

_context.SaveChanges()

Problem
The above code loops through aprox. 25000 items.
It updates all kinds of stuff on these objects (This process takes about 10 minutes)
The problem lies in saving all these changes to the database, which takes almost 2 hours.
It updates (sql) each change one by one probably? (This is sql azure)
The process also includes delete 25000 records & inserting 25000 new ones (4 ints)
I have reduced the calls to the database by including a lot that is needed. But I discovered that it's not the process but the saving that takes so long :S
Questions
Is there a difference in performce between [updating all values from a record] and
[deleting current & inserting new]?
How could I improve saving this to the database? Like in 10 minutes instead of 160m ?

A: Entity Framework is just not well suited to bulk updates.
I was in the same situation and ended up rewriting my bulk update logic to use ADO.Net with a stored procedure.  Performance gain was around 10x for my particular use case.
Another option may be SqlBulkCopy depending on your exact situation.

A: There are some tricks you can use like only commit every 100 operations or so.
But, I've always had to fallback to writing a stored procedure for database operations that preform too slowly from the ORM.


text:
Q: Push notification for Voip (type 4) windows phone 8 limit Is push notification and voip free in Windows Phone 8 as same as other types of push notification? I was trying the ChatterBox example. Will I need to pay for Voip when it will run on production? Please provide any link or source

A: You don't need pay for VOIP. Concerning Push Notifications, there is a limit 500 push notifications per subscription, per day. If it is not enough you will need to pay for a certificate. More details http://msdn.microsoft.com/library/windowsphone/develop/ff941099(v=vs.105).aspx


text:
Q: .gif images not showing animation, Here I am setting .gif image in ImageView .gif images not showing animation, Here  I am setting .gif image in ImageView.
    Here is my code. I have these .gif Images in my project.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

 NBoostDetailCell *cell = (NBoostDetailCell *) [tableView dequeueReusableCellWithIdentifier:@"gifCell"];

 [cell imgViewgif].animationImages = [NSArray arrayWithObjects:
                                             [UIImage imageNamed:[cellData valueForKey:@"gifImage"]], nil];
        [cell imgViewgif].animationDuration = 0.5f;
        [cell imgViewgif].animationRepeatCount = 100;
        [[cell imgViewgif] startAnimating];
}


text:
Q: Next.js does not recognize custom npm package Here's my personal custom package structure:
package.json
Posts.js

And here's the content of Posts.js:
const Posts = () => {
    return
List of posts

}

export default Posts;

I publish this to my GitHub Package Registry and I install it to a next.js app using npm install @myOwnerName:blog.
And I can verify that it's been installed.
However, when I want to use it using import Posts from '@myOwnerName/blog/Posts', I see this error:

Failed to compile
./node_modules/@myOwnerUser/blog/Posts.js
Module parse failed: Unexpected token (2:11)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const Posts = () => {
>     return
List of posts

| }
|

What have I done wrong?

A: Before publish npm package, we should compile react components to es-module.
So, in webpack configuration, unknown file type error.
I think, it is more correct way to compile react component before publish it.


text:
Q: More efficient MYSQL Wordpress join/view Query My current query that lists some information from the WordPress User/usermeta database doesn't complete, slows and pretty much halts its operation till i stop the process.
is there a more efficient way of doing this query? i was thinking that selecting all the data and placing it in another table to allow for easier reporting would be better. However, I'm not that good at MYSQL and so wasn't sure what the best approach is.
SELECT
u1.ID,
u1.user_login,
u1.user_email,
m1.meta_value AS Gender,
m2.meta_value AS Username,
m3.meta_value AS Country,
m4.meta_value AS PassedSup,
m5.meta_value AS StartbeingSup,
m6.meta_value AS StoppedbeingSup,
m7.meta_value AS PassedTutor,
m8.meta_value AS CurrentlyaTutor,
m9.meta_value AS StartBeingTutor,
m10.meta_value AS StopBeingTutor,
m11.meta_value AS NoOfChildren,
m12.meta_value AS CurrentSupervisor,
m13.meta_value AS SecondSupervisor,
m14.meta_value AS Volunteer,
m15.meta_value AS VolunteerStart,
m16.meta_value AS VolunteerEnd,
m17.meta_value AS SupervisorName,
m18.meta_value AS NameOfTutor,
m19.meta_value AS DBSNo,
m20.meta_value AS DBSStart,
m21.meta_value AS Ref2
FROM wp_users u1
JOIN wp_usermeta m1 ON ( m1.user_id = u1.ID AND m1.meta_key = 'gender')
JOIN wp_usermeta m2 ON ( m2.user_id = u1.ID AND m2.meta_key = 'username_or_email')
JOIN wp_usermeta m3 ON ( m3.user_id = u1.ID AND m3.meta_key = 'country')
JOIN wp_usermeta m4 ON ( m4.user_id = u1.ID AND m4.meta_key = 'date_supervizor')
JOIN wp_usermeta m5 ON ( m5.user_id = u1.ID AND m5.meta_key = 'sup_start_date')
JOIN wp_usermeta m6 ON ( m6.user_id = u1.ID AND m6.meta_key = 'sup_end_date')
JOIN wp_usermeta m7 ON ( m7.user_id = u1.ID AND m7.meta_key = 'date_tutor')
JOIN wp_usermeta m8 ON ( m8.user_id = u1.ID AND m8.meta_key = 'is_tutor')
JOIN wp_usermeta m9 ON ( m9.user_id = u1.ID AND m9.meta_key = 'tutor_start')
JOIN wp_usermeta m10 ON ( m10.user_id = u1.ID AND m10.meta_key = 'tutor_end')
JOIN wp_usermeta m11 ON ( m11.user_id = u1.ID AND m11.meta_key = 'no_child')
JOIN wp_usermeta m12 ON ( m12.user_id = u1.ID AND m12.meta_key = 'Current_Supervizor')
JOIN wp_usermeta m13 ON ( m13.user_id = u1.ID AND m13.meta_key = 'supervizor_2')
JOIN wp_usermeta m14 ON ( m14.user_id = u1.ID AND m14.meta_key = 'volunteer')
JOIN wp_usermeta m15 ON ( m15.user_id = u1.ID AND m15.meta_key = 'volunteer_start')
JOIN wp_usermeta m16 ON ( m16.user_id = u1.ID AND m16.meta_key = 'volunteer_end')
JOIN wp_usermeta m17 ON ( m17.user_id = u1.ID AND m17.meta_key = 'Name_of_tutor')
JOIN wp_usermeta m18 ON ( m18.user_id = u1.ID AND m18.meta_key = 'DBS_NO')
JOIN wp_usermeta m19 ON ( m19.user_id = u1.ID AND m19.meta_key = 'DBS_start_date')
JOIN wp_usermeta m20 ON ( m20.user_id = u1.ID AND m20.meta_key = 'date_membership_passed')
JOIN wp_usermeta m21 ON ( m21.user_id = u1.ID AND m21.meta_key = 'ref_2')


text:
Q: Magento - Dynamically change discount cost in cart In my magento store how can i go about changing the discount total in my shopping cart dynamically?
I'm able to access and get the current discount with this code:
<?php
$quote = Mage::getSingleton('checkout/cart')->getQuote();
$totals =  $quote->getTotals();
$discount = $totals["discount"]->getValue();
?>

I have a button in my shopping cart that when pressed should add an extra £5 onto the discount value, updating the total cost etc at the same time.

A: There is an event in magento,
sales_quote_collect_totals_after

This is fired whenever your total is calculated, what you can do is set a flag in session on click on the button to apply discount, and in this above event's observer method, check if it is set then apply discount.
In your config.xml
<global>
 <events>
   <sales_quote_collect_totals_after>
     <observers>
       <class>Custom_Module_Model_Observer</class>
       <method>collectTotals</method>
     </observers>
   </sales_quote_collect_totals_after>
 </events>
</global>

Make a Observer.php in
Custom
  /Module
    /Model
      /Observer.php

Make a function in Observer.php
public function collectTotals(Varien_Event_Observer $observer)
{
       $quote=$observer->getEvent()->getQuote();
       $quoteid=$quote->getId();
    //check condition here if need to apply Discount
        if($disocuntApply) $discountAmount =5;

     if($quoteid) {
               if($discountAmount>0) {
           $total=$quote->getBaseSubtotal();
           $quote->setSubtotal(0);
           $quote->setBaseSubtotal(0);

           $quote->setSubtotalWithDiscount(0);
           $quote->setBaseSubtotalWithDiscount(0);

           $quote->setGrandTotal(0);
           $quote->setBaseGrandTotal(0);

           $canAddItems = $quote->isVirtual()? ('billing') : ('shipping');
           foreach ($quote->getAllAddresses() as $address) {

                    $address->setSubtotal(0);
                    $address->setBaseSubtotal(0);

                    $address->setGrandTotal(0);
                    $address->setBaseGrandTotal(0);

                    $address->collectTotals();

                    $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());
                    $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());

                    $quote->setSubtotalWithDiscount(
                        (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()
                    );
                    $quote->setBaseSubtotalWithDiscount(
                        (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()
                    );

                    $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());
                    $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());

           $quote ->save();

              $quote->setGrandTotal($quote->getBaseSubtotal()-$discountAmount)
              ->setBaseGrandTotal($quote->getBaseSubtotal()-$discountAmount)
              ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)
              ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$discountAmount)
              ->save();

            if($address->getAddressType()==$canAddItems) {

             $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$discountAmount);
             $address->setGrandTotal((float) $address->getGrandTotal()-$discountAmount);
             $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$discountAmount);
             $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$discountAmount);
             if($address->getDiscountDescription()){
             $address->setDiscountAmount(-($address->getDiscountAmount()-$discountAmount));
             $address->setDiscountDescription($address->getDiscountDescription().', Amount Waived');
             $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()-$discountAmount));
             }else {
             $address->setDiscountAmount(-($discountAmount));
             $address->setDiscountDescription('Amount Waived');
             $address->setBaseDiscountAmount(-($discountAmount));
             }
             $address->save();
            }//end: if
           } //end: foreach
           //echo $quote->getGrandTotal();

          foreach($quote->getAllItems() as $item){
                         //We apply discount amount based on the ratio between the GrandTotal and the RowTotal
                         $rat=$item->getPriceInclTax()/$total;
                         $ratdisc=$discountAmount*$rat;
                         $item->setDiscountAmount(($item->getDiscountAmount()+$ratdisc) * $item->getQty());
                         $item->setBaseDiscountAmount(($item->getBaseDiscountAmount()+$ratdisc) * $item->getQty())->save();

                       }

                    }

            }
         }

collectTotals function will be called, whenever the quote totals is updated, so there is no need to call it explicitly.
Check for how it works here.
Setting magento session variables, check here.
hope it helps!


text:
Q: Styling a Div Class within Div ID I have a page that has the following div element:

Which of the following should I use to style the class?
#name .class_name
name .class_name
#name class_name

A: Just #name would be enough to apply the style only to that specific element:
#name {
   // your styles here
}

If you want to apply the style to all the elements using the class_name class, then you can use:
.class_name {
   // your styles here
}

A: #name .class_name will apply to the children elements of your div with the .class_name class.
There must not be any spaces between.
You should use: #name.class_name because it is the correct syntax.
But, when working with identifiers, it should be enough to use it alone.
#name {
  // some properties
}

But let's say you have a unique block, which inherits some generic styles, then you could use #idenifier.class to mix styles.
#comments {
    width: 453px;
}

#comments.links
{
   border: 0 none;
}

A: If I got your question right you use
#name .class_name

as in
#name .class_name {
    color:#000;
}

But actually you don't need to do that.
If #name and .class_name are oly used in that div you can just drop the .class_name. Otherwise, if you use multiple stuff with .class_name that don't share the same properties as div #name, you should separate them.
.class_name {
    color:#000;
}
#name {
    width:600px;
}

A: ID's should be unique, so there isn't much point in styling both the id of the div and the class_name.
Just using the ID of the div is fine if that's your goal.
#name
{
   //styles
}

If you want to style every div that has that class name, then just use
.class_name
{
   //styles
}

A: You can read about CSS selectors here:
http://reference.sitepoint.com/css/selectorref
In the CSS you can reference it by class:
.class_name { color: green; }

or by id using #id
#name { color: green; }

or by element type
div { color: green; }

//or by combinations of the above
div.class_name { color: green; }
div#name { color: green; }

A: If you already have #name and .class_name styled, but for some reason you want to style

(that is, a specific style to the element with an id of "name" AND a class of "class_name"), you can use
#name.class_name {
/* note the absence of space between the id and class selector */
    ...
}

Bear in mind that this selector is not supported by Internet Explorer 6.


text:
Q: Zend\Db: Select from subquery I'm porting an application from ZF1 to ZF2 and as part of that I have to rewrite our database mappers.
I'm struggling with this SQL statement:
SELECT full_name, GROUP_CONCAT(value)
FROM (
   SELECT full_name, value
   FROM my_table
   ORDER BY id DESC
   ) as subtable
GROUP BY full_name
ORDER BY full_name DESC;

The underlying problem I'm trying to solve is that I need to order the results of the sub query before running GROUP_CONCAT and I need it to work for both MySQL and Sqlite. In MySQL I could simply specify the order within the GROUP_CONCAT function, but this is not possible with Sqlite so I need the sub query for it to be compatible with both MySQL and Sqlite.
In ZF1 I could do:
$fromSql = $db->select()
              ->from('my_table', array('full_name', 'value'))
              ->order('id DESC');

$sql = $db->select()
          ->from(array(
                'subtable' => new Zend_Db_Expr('(' . $fromSql . ')')
            ), array(
                'full_name' => 'full_name',
                'value' => new Zend_Db_Expr('GROUP_CONCAT(subtable.value)'),
            )
          )
          ->group('full_name')
          ->order('full_name DESC');

However, using a sub query in the from clause doesn't seem possible with ZF2. Is there some work around for this?

A: EDIT: Actually, I now see that my query was flawed. It won't work as expected with MySQL, which means I still have to write specialized queries. See GROUP_CONCAT change GROUP BY order

After going through the code of Zend\Db\Sql\Select I found these lines:
if ($table instanceof Select) {
    $table = '(' . $this->processSubselect($table, $platform, $driver, $parameterContainer) . ')';
} else {
    $table = $platform->quoteIdentifier($table);
}

So the answer is actually quite simple, all I had to do was to provide a Zend\Db\Sql\Select object to from(), without wrapping it in a Zend\Db\Sql\Expression like I used to with ZF1.
Code example:
$adapter = $this->getAdapter(); // Returns Zend\Db\Adapter\Adapter
$sql = new Zend\Db\Sql\Sql($adapter);

$from = $sql->select()
    ->from(static::$table)
    ->columns(array(
        'full_name',
        'value',
    ))
    ->order('id DESC');

$select = $sql->select()
    ->from(array(
        'subtable' => $from,
    ))
    ->columns(array(
        'full_name' => 'full_name',
        'value' => new Expression('GROUP_CONCAT(value)'),
    ))
    ->group('full_name')
    ->order('full_name DESC');

$selectString = $sql->getSqlStringForSqlObject($select);

$resultSet = $adapter->query($selectString, $adapter::QUERY_MODE_EXECUTE);

return $resultSet->toArray();


text:
Q: How to add Custom Registeration field from admin Hi i have a form in admin and i want that when select the type this values should reflect on an appropriate selected form but am not able to do so can anyone guide me here is a screenshot

InstallSchema.php
<?php
/**
 * @category   Eecom
 * @package    Eecom_CustomCustomerAttribute
 */
namespace Eecom\CustomCustomerAttribute\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
 * @codeCoverageIgnore
 */
class InstallSchema implements InstallSchemaInterface
{
    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();

        /**
         * Creating table eecom_customcustomerattribute
         */
        $table = $installer->getConnection()->newTable(
            $installer->getTable('eecom_customcustomerattribute')
        )->addColumn(
            'customcustomerattribute_id',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            null,
            ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
            'Entity Id'
        )->addColumn(
            'attribute_code',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            ['nullable' => true],
            'Attribute  Code'
        )->addColumn(
            'attribute_label',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            ['nullable' => true,'default' => null],
            'Attribute Label'

            )->addColumn(
            'sortorder',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            ['nullable' => true,'default' => null],
            'Sort Order'

// edited from here
            )->addColumn(
            'inputtypeforstoreowner',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            1,
            ['nullable' => false,'default' => 0],
            'Input Type For Store Owners'

            )->addColumn(
            'valuerequired',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            1,
            ['nullable' => false,'default' => 0],
            'Value Required'

            )->addColumn(
            'inputvalidationforstoreowner',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            1,
            ['nullable' => false,'default' => 0],
            'Input Validation For Store Owners'

            )->addColumn(
            'displayfieldinform',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            1,
            ['nullable' => false,'default' => 0],
            'Dispaly Field In Form'

        )->addColumn(
            'status',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            1,
            ['nullable' => false,'default' => 0],
            'Status'
        )->setComment(
            'Eecom CustomCustomerAttribute Table'
        );
        $installer->getConnection()->createTable($table);
        $installer->endSetup();
    }
}

i just need suggestion on how to take it further can any one explain it to me it will be a great help.
Thanks in advance
UPDATE
<?xml version="1.0" encoding="UTF-8"?>

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_data_source</item>
            <item name="deps" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_data_source</item>
        </item>

        <item name="spinner" xsi:type="string">eecom_customcustomerattribute_index_listing_columns</item>
        <item name="buttons" xsi:type="array">
            <item name="add" xsi:type="array">
                <item name="name" xsi:type="string">add</item>
                <item name="label" xsi:type="string" translate="true">Add New Attribute</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/new</item>
            </item>
        </item>
    </argument>
    <dataSource name="eecom_customcustomerattribute_index_listing_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">EecomCustomCustomerAttributeGridDataProvider</argument>
            <argument name="name" xsi:type="string">eecom_customcustomerattribute_index_listing_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">customcustomerattribute_id</argument>
            <argument name="requestFieldName" xsi:type="string">customcustomerattribute_id</argument>
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                    <item name="update_url" xsi:type="url" path="mui/index/render"/>
                    <item name="storageConfig" xsi:type="array">
                        <item name="indexField" xsi:type="string">customcustomerattribute_id</item>
                    </item>
                </item>
            </argument>
        </argument>
    </dataSource>
    <container name="listing_top">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/toolbar</item>
                <item name="sticky" xsi:type="string">true</item>
            </item>
        </argument>
        <bookmark name="bookmarks">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="storageConfig" xsi:type="array">
                        <item name="namespace" xsi:type="string">eecom_customcustomerattribute_index_listing</item>
                    </item>
                </item>
            </argument>
        </bookmark>
        <component name="columns_controls">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="columnsData" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns</item>
                    </item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
                    <item name="displayArea" xsi:type="string">dataGridActions</item>
                </item>
            </argument>
        </component>
        <exportButton name="export_button">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="selectProvider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns.ids</item>
                </item>
            </argument>
        </exportButton>
        <filterSearch name="fulltext">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_data_source</item>
                    <item name="chipsProvider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.listing_filters_chips</item>
                    <item name="storageConfig" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.bookmarks</item>
                        <item name="namespace" xsi:type="string">current.search</item>
                    </item>
                </item>
            </argument>
        </filterSearch>
        <filters name="listing_filters">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="columnsProvider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns</item>
                    <item name="storageConfig" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.bookmarks</item>
                        <item name="namespace" xsi:type="string">current.filters</item>
                    </item>
                    <item name="templates" xsi:type="array">
                        <item name="filters" xsi:type="array">
                            <item name="select" xsi:type="array">
                                <item name="component" xsi:type="string">Magento_Ui/js/form/element/ui-select</item>
                                <item name="template" xsi:type="string">ui/grid/filters/elements/ui-select</item>
                            </item>
                        </item>
                    </item>
                    <item name="childDefaults" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.listing_filters</item>
                        <item name="imports" xsi:type="array">
                            <item name="visible" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns.${ $.index }:visible</item>
                        </item>
                    </item>
                </item>
            </argument>
        </filters>
        <massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">
            <action name="delete">
                <settings>
                    <confirm>
                        <message translate="true">Delete selected items?</message>
                        <title translate="true">Delete items</title>
                    </confirm>
                    <url path="eecom_customcustomerattribute/items/massDelete"/>
                    <type>delete</type>
                    Delete
                </settings>
            </action>
            <action name="status">
                <settings>
                    <type>status</type>
                    Change status
                    <actions>
                        <action name="0">
                            <type>enable</type>
                            Enable
                            <url path="eecom_customcustomerattribute/items/massStatus">
                                <param name="status">1</param>
                            </url>
                        </action>
                        <action name="1">
                            <type>disable</type>
                            Disable
                            <url path="eecom_customcustomerattribute/items/massStatus">
                                <param name="status">0</param>
                            </url>
                        </action>
                    </actions>
                </settings>
            </action>
        </massaction>
        <paging name="listing_paging">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="storageConfig" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.bookmarks</item>
                        <item name="namespace" xsi:type="string">current.paging</item>
                    </item>
                    <item name="selectProvider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns.ids</item>
                </item>
            </argument>
        </paging>
    </container>
    <columns name="eecom_customcustomerattribute_index_listing_columns">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="storageConfig" xsi:type="array">
                    <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.bookmarks</item>
                    <item name="namespace" xsi:type="string">current</item>
                </item>
                <item name="editorConfig" xsi:type="array">
                    <item name="selectProvider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns.ids</item>
                    <item name="enabled" xsi:type="boolean">true</item>
                    <item name="indexField" xsi:type="string">customcustomerattribute_id</item>
                    <item name="clientConfig" xsi:type="array">
                        <item name="saveUrl" xsi:type="url" path="eecom_customcustomerattribute/items/inlineEdit"/>
                        <item name="validateBeforeSave" xsi:type="boolean">false</item>
                    </item>
                </item>
                <item name="childDefaults" xsi:type="array">
                    <item name="fieldAction" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing_columns_editor</item>
                        <item name="target" xsi:type="string">startEdit</item>
                        <item name="params" xsi:type="array">
                            <item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
                            <item name="1" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="storageConfig" xsi:type="array">
                        <item name="provider" xsi:type="string">eecom_customcustomerattribute_index_listing.eecom_customcustomerattribute_index_listing.listing_top.bookmarks</item>
                        <item name="root" xsi:type="string">columns.${ $.index }</item>
                        <item name="namespace" xsi:type="string">current.${ $.storageConfig.root}</item>
                    </item>
                </item>
            </item>
        </argument>
        <selectionsColumn name="ids">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">customcustomerattribute_id</item>
                </item>
            </argument>
        </selectionsColumn>

        <column name="customcustomerattribute_id">
            <argument name="data" xsi:type="array">
                <item name="js_config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item>
                </item>
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">customcustomerattribute_id</item>
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="sorting" xsi:type="string">desc</item>
                    <item name="label" xsi:type="string" translate="true">ID</item>
                </item>
            </argument>
        </column>

        <column name="attribute_code">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="filter" xsi:type="string">text</item>
                    <item name="sortOrder" xsi:type="number">10</item>
                    <item name="label" xsi:type="string" translate="true">Attribute Code</item>
                </item>
            </argument>
        </column>

        <column name="attribute_label">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">text</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="filter" xsi:type="string">text</item>
                    <item name="sortOrder" xsi:type="number">20</item>
                    <item name="label" xsi:type="string" translate="true">Attribute Label</item>

                </item>
            </argument>
        </column>

        <column name="status">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">Eecom\CustomCustomerAttribute\Model\Source\Status</item>
                <item name="config" xsi:type="array">
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">select</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">true</item>
                        </item>
                    </item>
                    <item name="filter" xsi:type="string">select</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
                    <item name="label" xsi:type="string" translate="true">Status</item>
                    <item name="dataType" xsi:type="string">select</item>
                    <item name="sortOrder" xsi:type="number">30</item>
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                </item>
            </argument>
        </column>
        <actionsColumn name="actions" class="Eecom\CustomCustomerAttribute\Ui\Component\Listing\Column\CustomCustomerAttributeActions">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">customcustomerattribute_id</item>
                    <item name="urlEntityParamName" xsi:type="string">id</item>
                </item>
            </argument>
        </actionsColumn>
    </columns>
</listing>

A: try this
 <field name="priority">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">VendoreName\ModuleName\Model\Config\Source\CustomOption</item>
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">text</item>
            <item name="component" xsi:type="string">VendoreName_ModuleName/js/form/element/options</item>
            <item name="label" xsi:type="string" translate="true">Priority</item>
            <item name="formElement" xsi:type="string">select</item>
            <item name="dataScope" xsi:type="string">priority</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

<field name="order_id">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string">Order</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">text</item>
            <item name="formElement" xsi:type="string">input</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

app\code\VendoreName\ModuleName\view\adminhtml\web\js\components
options.js
        define([
    'jquery',
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/select',
    'Magento_Ui/js/modal/modal'
], function ($,_, uiRegistry, select, modal) {
    'use strict';

    return select.extend({
              /**
         * Init
         */
        initialize: function () {
            this._super();
            this.fieldDepend(this.value());
            return this;
        },
        /**
         * On value change handler.
         *
         * @param {String} value
         */
        onUpdate: function (value) {
            this.fieldDepend(value);
            return this._super();
        },
        /**
         * Update field dependency
         *
         * @param {String} value
         */
        fieldDepend: function (value) {
            setTimeout(function () {
                var field_value = uiRegistry.get('index = order_id'); // add your field name
                if (value == 1) {
                    field_value.show();
                } else {
                    field_value.hide();
                }
            }, 1);
            return this;
        }
    });
});

This line added js to your form field
<item name="component" xsi:type="string">VendoreName_ModuleName/js/form/element/options</item>

Update
I create form and in which one priority field and order field.
once priority is high (value - 1) show order field and priority is low (value - 0) hide order field.

var field_value = uiRegistry.get('index = order_id');

this line get my order field by using it's field name

<field name="order_id">

Reference Link
For adding field dependency click here
I Hope This Helps You.


text:
Q: VBA find and replace row entry I'm trying to write a function that basically does the following:

*

*Grabs a "name" cell value from workbook #1

*Grabs an "amount" cell value from workbook #1

*Opens 2nd workbook (which is a 2 column list where columnA = "Names" and columnB = "Amounts")

*Scans column A of 2nd workbook for a duplicate "name" entry (from step 1)

*If a duplicate exists, overwrites the corresponding "amount" value in column B with the value stored from step 2

*If no duplicate exists, appends a new last row to the list

*Writes "name" in last row of column A of 2nd workbook

*Writes "amount" in last row of column B of 2nd workbook

Essentially, this function will update a list of names with their corresponding amounts.  If a name already exists on the list, this script will find the duplicate entry in column A, and update the associated amount in column B of the same row.  If a name doesn't exist on this list, the function will add a new row to the list and then write the stored "name" value in column A, and the stored "amount" value in column B.
I've got steps 1-3 working but I'm having some trouble creating the loops for 4-8.  Here's what I currently have for code... any help would be appreciated!
Thanks!
Sub Open_Updator()

Dim proj_name As String
Dim amount As Double
Dim updator As Workbook
Dim updator_sheet As Worksheet
Dim LastRow As Long
Dim arr() As Variant
Dim R As Long
Dim C As Long
Dim Destination As Range

proj_name_raw = ThisWorkbook.Sheets("Cover").Range("C7").Value
proj_name = Left(proj_name_raw, Len(proj_name_raw) - 3)
amount = ThisWorkbook.Sheets("Summary").Range("O110").Value

Set updator = Workbooks.Open(Filename:="C:\Users\XXXXX\Desktop\updator.xlsx")
updator.Activate

Set updator_sheet = Sheets("Table")

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
arr = Range("A1:B" & LastRow)
Set Destination = Range("A1")

For R = 1 To UBound(arr, 1)
    For C = 1 To UBound(arr, 2)
        If arr(R, C) = proj_name Then arr(R, C) = arr(R, 1)
    Next C
Next R

Destination.Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr

End Sub

Thanks!

A: Ok. Try this:
    Private Sub Test()

        Dim WB1 As Worksheet
        Set WB1 = Workbooks.Open(Filename:="WB1.xlsx").Sheets("Sheet1")
        Dim LastRow As Long
        Dim LastRowWB1 As Long

        LastRow = Cells(Rows.Count, "A").End(xlUp).Row

        LastRowWB1 = WB1.Cells(Rows.Count, "A").End(xlUp).Row

        j = 1

        For r = 2 To LastRowWB1
            Name = WB1.Cells(r, "A").Value
            For x = 2 To LastRow + j
                If Cells(x, "A").Value = Name Then
                    Cells(x, "B") = WB1.Cells(r, "B")
                    Exit For
                ElseIf Cells(x, "A") = "" Then
                    Cells((LastRow + j), "A") = WB1.Cells(r, "A").Value
                    Cells((LastRow + j), "B") = WB1.Cells(r, "B").Value
                    j = j + 1
                End If
            Next x
        Next r

    End Sub

You can also use Find:
Private Sub Test2()

    Dim WB1 As Worksheet
    Set WB1 = Workbooks.Open(Filename:="U:\Temp\WB1.xlsx").Sheets("Sheet1")
    Dim LastRow As Long
    Dim LastCol As Long
    Dim SrchInArray As Range

    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    LastRowWB1 = WB1.Cells(Rows.Count, "A").End(xlUp).Row

    j = 1
    Set SrchInArray = Range(Cells(2, "A"), Cells(LastRow, "A"))

    For r = 2 To LastRowWB1
        Name = WB1.Cells(r, "A").Value
        Set y = SrchInArray.Find(WB1.Cells(r, "A").Value, , xlValues, xlWhole, xlByRows, xlNext, False, False, False)
        If Not y Is Nothing Then
            Cells(y.Row, "B") = WB1.Cells(r, "B").Value
        Else
            Cells(LastRow + j, "A") = WB1.Cells(r, "A").Value
            Cells(LastRow + j, "B") = WB1.Cells(r, "B").Value
            j = j + 1
        End If
    Next r

End Sub

You will have to adjust some names. The code assumes that in both workbooks row 1 has labels, and names and values begin in row 2.
Let me know if you get stuck somewhere so we can work it out. Otherwise, provide a sample of your workbooks to adjust the code.


text:
Q: Search for duplicates, if found sum values I have this array :
$data = [
    0 => [
       'date'       => '2018-09-12',
       'department' => 12,
       'country'    => 14,
       'total'      => 12
    ],
    1 => [
       'date'       => '2018-09-12',
       'department' => 12,
       'country'    => 14,
       'total'      => 18
    ],
    2 => [
       'date'       => '2018-09-12',
       'department' => 12,
       'country'    => 15,
       'total'      => 10
    ]
];

The return should be :
$return = [
   0 => [
       'date'       => '2018-09-12',
       'department' => 12,
       'country'    => 14,
       'total'      => 30
   ],
   1 => [
       'date'       => '2018-09-12',
       'department' => 12,
       'country'    => 15,
       'total'      => 10
   ]
];

I tried like this :
foreach ($data as $value) {
     if(!in_array($value, $data)) {
         $result[] = $data;
     }
}

The idea is, if all fields except total are indentical, then add total to the existing total with the same fields. Please help me. Thx in advance and sorry for my english

A: You can do this by looping through your array, comparing all the other values of each element (date, department and country) with previously seen values and summing the totals when you get a match. This code uses serialize to generate a composite key of the other values for comparison:
$output = array();
$keys = array();
foreach ($data as $value) {
    $total = $value['total'];
    unset($value['total']);
    $key = serialize($value);
    if (($k = array_search($key, $keys)) !== false) {
        $output[$k]['total'] += $total;
    }
    else {
        $keys[] = $key;
        $output[] = array_merge($value, array('total' => $total));
    }
}
print_r($output);

Output:
Array (
    [0] => Array (
        [date] => 2018-09-12
        [department] => 12
        [country] => 14
        [total] => 30
    )
    [1] => Array (
        [date] => 2018-09-12
        [department] => 12
        [country] => 15
        [total] => 10
     )
)

Demo on 3v4l.org
By using the composite key as the index into the $output array, we can simplify this code, we just need to use array_values after the loop to re-index the $output array:
$output = array();
foreach ($data as $value) {
    $v = $value;
    unset($v['total']);
    $key = serialize($v);
    if (isset($output[$key])) {
        $output[$key]['total'] += $value['total'];
    }
    else {
        $output[$key] = $value;
    }
}
$output = array_values($output);
print_r($output);

Output is the same as before. Demo on 3v4l.org

A: You can also try this method as it doesn't involve much memory intensive operations such as merging, especially while working with large amount of data:
$new_data=[];
foreach($data as $key=>$value){
    $i=array_search($value["date"],array_column($new_data,"date"));
    if(($i!==false)&&($new_data[$i]["department"]==$value["department"])&&($new_data[$i]["country"]==$value["country"])){
        $new_data[$i]["total"]+=$value["total"];
    }
    else{
        $new_data[]=$value;
    }
}
print_r($new_data);


text:
Q: How to set a Content Description on an Android Preference view Is there a way to gain add a Content Description to the View representing a Preference in a PreferenceFragment or PreferenceActivity?
Basically I need a way to obtain a handle on the View representing the preference. This would allow me to setContentDescription(...) on the view.
It is surprising that this is not directly exposed as an xml attribute in preference xml files, since this is an accessibility feature it seems like it should be everywhere a UI element can be proxied / generated.

A: Getting the View from the Preference is the obvious way, since setContentDescription() can be called on any View. Now, how to get the View is not very well documented but it is fairly simple. In your Preference Fragment class, do the following:
public class SettingsFragment extends PreferenceFragment {

    ...
    private Preference toGetViewFrom;
    private ViewGroup parent;
    private View obtainedView;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        ...
        parent = container;
        obtainedView = toGetViewFrom.getView(null, parent);
        //Now do whatever you want with your view. In your case,
        obtainedView.setContentDescription("Content Description");
    }


text:
Q: ERROR: Unsupported PIVOT column type: text I'm trying to perform a PIVOT but getting an error. I'm trying to see which patients have more than one Interval session. The column is a text type. I attempted to convert the column type to VARCHAR(MAX) in my query but still getting the error.
Here is my code:
SELECT patientname, IntervalName1, IntervalName2, IntervalName3
  FROM (SELECT DISTINCT
               patientname,
               CAST(IntervalName AS VARCHAR(MAX)),
               'IntervalName' +
                CAST(ROW_NUMBER() OVER
                    (PARTITION BY patientname
                         ORDER BY patientname) AS VARCHAR(10)) AS ColumnSequence
          FROM vwPatientPEIOutcomes
         WHERE [ vwPatientPEIOutcomes.DueDate = daterange ]
         GROUP BY patientname, IntervalName
         ORDER BY patientname, ColumnSequence) Temp
PIVOT(
      MAX(patientname) FOR
         ColumnSequence IN ( IntervalName1, IntervalName2, IntervalName3 )
     ) tb2

Here are my second set of edits below in regards to your answer. I'm new to this so took my some time to figure out what was needed:
Thank you for the answer. I was using the group by because the row_number was creating duplicates and I could not figure out how else to not have that happen.
Both the patient name and interval name are strings in the database. Intervalname is a field that signifies if they have been administered a questionnaire in a given timeframe. I'm trying to create a single row per patient.
Here is the dataset:
CREATE TABLE vwPatientPEIOutcomes (
  patientname varchar(max) NOT NULL,
  intervalname varchar(max) NOT NULL,
  ) ;
   INSERT INTO vwpatientPEIOutcomes (patientname,intervalname)
  VALUES
  ('Patient 1','End'),
  ('Patient 2','Start'),
  ('Patient 3','Start'),
  ('Patient 4','End'),
  ('Patient 4','6-Month'),
  ('Patient 4','Start'),
  ('Patient 5','6-Month'),
  ('Patient 6','Start'),
  ('Patient 6','End'),
  ('Patient 7','6-Month');

And I'm trying to get this result:

patientname
Intervalname1
Intervalname2
Intervalname3

Patient 1
End

Patient 2
Start

Patient 3
Start

Patient 4
End
6-Month
Start

Patient 5
6-Month

Patient 6
End
Start

Patient 7
6-Month

A: The SQL engine is probably complaining about the reference in the GROUP BY clause.  Change that to
GROUP BY patientname, CAST(IntervalName as varchar(max))

although, it's odd that you're using GROUP BY when there is no aggregation.
And I'm not sure the widow function you're using is in the correct context.  The ORDER BY doesn't seem meaningful.
I could be sure if you had posted code to produce the table and sample data.

A: You can use Conditional Aggregation after deriving ordinal values for each interval through use of ROW_NUMBER() window function within a subquery such as
SELECT patientname,
       MAX(CASE WHEN rn = 1 THEN intervalname END) AS intervalname1,
       MAX(CASE WHEN rn = 2 THEN intervalname END) AS intervalname2,
       MAX(CASE WHEN rn = 3 THEN intervalname END) AS intervalname3
  FROM
  ( SELECT *, ROW_NUMBER() OVER ( PARTITION BY patientname
                                      ORDER BY patientname) AS rn
      FROM vwPatientPEIOutcomes ) AS p
 GROUP BY patientname
 ORDER BY patientname

Demo


text:
Q: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response? I have a spring boot application calling a SOAP WS. I use client to call WS, code looks like:
@SuppressWarnings("unchecked")
JAXBElement<CreateCaseResponse> response = (JAXBElement<CreateCaseResponse>) soapConnectorCase
                            .callWebService(soapActionCreateCase, request);

After run code from IDE I receive next stack trace:
2022-03-29 16:02:48 INFO  SOAPEndpointInterceptor:50 - Request WS is : **<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns42:CreateCaseRequest xmlns:ns10="http://www.tunisiana.com/ws/facturation/GetPaymentResponsible" "><businessUnit>CESRV</businessUnit><quickCode>DDC</quickCode><msisdn>22125111</msisdn><custCode>4.6493.14.00.100003</custCode><summary>Correction</summary><description>Boutique : ADMINISTRATION CENTRALE , Type Demande : Correction, Type Produit : Clé 3G , Engagement : Engagement Pack, Total mensualité : 18 Mois,  Motif correction : 22125113 , montant reechelonné : 110.0</description><notes><note><noteSummary>Correction</noteSummary><noteDescription>Boutique : ADMINISTRATION CENTRALE , Type Demande : Correction, Type Produit : Clé 3G , Engagement : Engagement Pack, Total mensualité : 18 Mois,  Motif correction : 22125113 , montant reechelonné : 110.0</noteDescription><noteVisibility>I</noteVisibility></note></notes></ns42:CreateCaseRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>**
2022-03-29 16:02:48 INFO  SOAPEndpointInterceptor:51 - Response WS is : **<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body/></SOAP-ENV:Envelope>**

org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
2022-03-29 16:02:48 INFO  ScheduledTasks:33 - ********** Job createCaseProcess Finished *****************
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:218)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:62)
    at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:92)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:611)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
    at com.ooredoo.tn.ws.SOAPConnector.callWebService(SOAPConnector.java:29)
    at com.ooredoo.tn.services.scheduler.CaseCrmScheduler.createCase(CaseCrmScheduler.java:125)
    at com.ooredoo.tn.services.scheduler.ScheduledTasks.createCaseProcess(ScheduledTasks.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:655)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:301)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1_1Impl.java:65)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:63)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:190)

I copied the request in SOAP UI i got a response but in the project spring boot i have this error :
Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?

config.java :
    @Bean(name = "soapConnectorCase")
    public SOAPConnector soapConnectorCase(final Jaxb2Marshaller marshaller) {
        final SOAPConnector client = new SOAPConnector();
        client.setDefaultUri(this.endPointCaseCrm);
        client.setMarshaller((Marshaller) marshaller);
        client.setUnmarshaller((Unmarshaller) marshaller);
        client.setMessageSender((WebServiceMessageSender) this.httpComponentsMessageSender());
        ClientInterceptor[] clientInterceptors = { new SOAPEndpointInterceptor() };
        client.setInterceptors(clientInterceptors);

        return client;
    }


text:
Q: Having an issue searching for a string in a file I have tried to use a 'case' loop but it doesn't work for a reason unknown to me.
This is my script for the case loop.
echo "Do you wish to search again? [y/n]"
read INPUT_STRING2
case $INPUT_STRING2
   y)
   ;;
   *)
   exit
   ;;

Then I am having issues trying to make my script more user friendly, I want my script to tell the user if the string isn't found but I can't figure it out. I have tried using a case loop instead but have had no luck, and tried to use an else statement but it didn't work.
if grep -q $STRING $FILE ; then
             echo "string found"
fi

This part works but isn't all of what I want.

A: There seems to be an 'in' missing in the line with the case statement as well as a closing esac:
echo "Do you wish to search again? [y/n]"
read INPUT_STRING2
case $INPUT_STRING2 in
   y)
   ;;
   *)
   exit
   ;;
esac

A: You did two syntax errors (in after the variable and esac as end of the case statement):
echo "Do you wish to search again? [y/n]"
read INPUT_STRING2
case $INPUT_STRING2 in
   "y")
   echo "Searching again"
   ;;
   *)
   exit
   ;;
esac

A:
I want my script to tell the user if the string isn't found ….
  I have tried ... to use an else statement but it didn't work.

What did you try?
if grep -q "$STRING" "$FILE"
then
        echo "string found"
else
        echo "string not found"
fi

works.
P.S. I advise you to quote all references to shell variables
(e.g., "$INPUT_STRING2", "$STRING", and "$FILE")
unless you have a really good reason not to and you're sure you know what you're doing.
Conversely, you don't need to quote constant strings (e.g., string found)
unless they contain special characters.
(Square brackets – "[" and "]" – are special characters in this context.)
But it's a good idea to quote them anyway.


text:
Q: How do I SIMPLY connect google docs and google sheets? myFunction(e){
var Name = e.values[1];
DocumentApp.create("Test");
DocumentApp.appendParagraph("hello" + Name);
DocumentApp.saveAndClose;
}

This is how simple I want it. "Name" is pulled from a sheet that is generated from a form and "Name" is inputted after form generates its data, upon edit

*

*I am brand new to this. I mimicked the auto responder for when you get a form response, and "myFunction(e)" was name of function.

*I would think bound to spreadsheet. Path from beginning to end: input data to form>collect data on spreadsheet>edit spreadsheet, add more data>create simple letter using most of data collected. Sample letter

DocumentApp....appendParagragh("dear " + Name + "\n\n I like your " + Product + ". Are you interested in selling?").
There is an error related to "var Name = e.values[1];"

"TypeError: Cannot read property "values" from undefined. (line 2, file "Code")"

A: The error that you are getting occurred because you tried to run your function using the Run button on the Google Apps Script editor as the function has e as parameter but it only gets an object automatically when it's called from a trigger.
A couple of related Q&A

*

*How can I test a trigger function in GAS?

*Getting TypeError in onFormSubmit trigger?

*How do I resolve this "TypeError: Cannot read property "values" from undefined. (line 2, file "Code")" based on the context below?

In order to get a value from a spreadsheet by using Google Apps Script we could use Class SpreadsheetApp. Example
The following script works on a bounded to spreadsheet script project.
function getName(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1');
  var range = sheet.getRange('A1');
  var name = range.getValue();
  Logger.log(name);
}


text:
Q: Azure load balancer inside a subnet VPN gateway I have two virtual machines in azure VNet (IP adresses 10.1.0.4 and 10.1.0.5), and one machine connected to VNet via VPN Gateway (IP 10.3.0.2). Is is possible to create a load balancing in internal load balancer to redirect UPD traffic to VPN connected machine?

A: Azure Load Balancer supports virtual machines or virtual machine scale sets as it's backend pool endpoints along with addition of instances via network interface or IP addresses. However, a backend pool configured by IP address has the following limitation:

*

*The backend resources must be in the same virtual network as the load balancer.

Reference : https://learn.microsoft.com/en-us/azure/load-balancer/backend-pool-management#limitations
So, you cannot add a VPN connected on-premise machine in the backend pool of the load balancer. There is an active feature request for this and it is under review by the load balancer product group team. You can upvote this feature request in the below forum for future improvements:
https://feedback.azure.com/d365community/idea/49c222f6-8726-ec11-b6e6-000d3a4f0789


text:
Q: Uploading file using MVC2, ios6 on the ipad I have a MVC2 web application in which i have a view containing a simple form as follows:
<%using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { enctype = "multipart/form-data", @id = "frmAddNewObservationPhoto" }))
  {%>
    <%= Html.AntiForgeryToken()%>
    1. Enter Photo Description

    <%= Html.TextArea("photoDescription", Model.photoDescription, new { @style = "height: 100px", @id = "photoDescription" })%>

        2. Browse New Photo:

        <%= Html.HiddenFor(x => x.questionNo)%>
        <%= Html.HiddenFor(x => x.observationID)%>
        <input id="file" type="file" name="file">

        Or Select Saved Photo:

<%} %>

I have tested on desktop browsers (firefox, IE, Chrome) and the the file the user selects is posted to my action correctly.  My action code begins as follows:
[HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult AddNewObservationPhoto(Guid observationID, string photoDescription, decimal questionNo)
    {
        TaskFireObservations fireObservation = FireHelper.GetObservationByID(observationID, _session);

        if (Request.Files.Count > 0)
        {

For completion the javascript is as follows:
function AddNewObservationPhoto() {
   var photoDescription = $('#photoDescription').val();
   if (photoDescription.length == 0) {
       alert('Please enter the photo description');
   }
   else {
       $('#frmAddNewObservationPhoto').submit();
   }

};
My problem is that when i test this on an iPad version 6.0.1 (hence mobile safari browser), there are no files posted to the action.  I have tested on the chrome browser for the ipad and it works fine on there.  Ive also tested on an online ipad emulator and it works; i.e. the selected file is posted to the action and then saved to the relevant location.
Does anyone know why this would be happening? I hope ive explained the issue clearly enough.
Thanks.

A: I am putting this down to a bug in mobile safari as this happens intermittently, i.e. on some occasions the file is posted and on others it does nothing.


text:
Q: Ruby: Dynamic setter with inheritance I'm trying to format hex strings using an inherited format method. I'm a bit of a Ruby-noob, any help is appreciated.
class Bar
  def alter_the_variable attribute_name
    attribute = method(attribute_name)
    formatted = "%.4x" % attribute.call.hex
    puts formatted    # => 00f3
    attribute = formatted   # What I "want" to be able to do, but
                            # doesn't work because attribute is a local variable

    #attribute.owner.send(:h=, formatted)   # Doesn't work either, gives:
                                            # in `send': undefined method `h=' for Foo:Class (NoMethodError)
  end
end

class Foo < Bar
  def initialize
    @h = "f3"
  end

  def h
    @h
  end

  def h= val
    @h = val
  end
end

f = Foo.new
puts f.h    # => f3
f.alter_the_variable :h
puts f.h    # => f3

A: Here's one way to do what you wanted to do:
def alter_the_variable attribute_name
  current_value = send(attribute_name)
  formatted_value = "%.4x" % current_value.hex
  send (attribute_name.to_s+'=').to_sym, formatted_value
end


text:
Q: Setting Cookie in Response from WEB API of a different domain I have a Web API project and a separate web app. they have two different port numbers for their local host address. I am trying to set a cookie on the web app passed from the WEB API response. I can see it the cookie in the header, however the browser does not save the cookie. Also, if I set a cookie on the web app and try read it in the API request, it can not be seen.
 task.Result.Headers.AddCookies(new CookieHeaderValue[] {
                    new CookieHeaderValue(MemberToken, Guid.NewGuid().ToString()){
                        Domain = request.RequestUri.Host == "localhost" ? null : request.RequestUri.Host,
                        Expires = DateTime.Now.AddDays(30),
                        Path = "/"
                    }
                });


text: Q: declare output parameter of table type in mysql I know that mysql functions / procedures can return tables, but I am wondering if it is possible to declare output parameters of table types? Or are they limited to only mysql primitive types?


text:
Q: train a neural network on real subject input/output to have it behave similarly to subject The goal is to create an AI to play a simple game, tracking a horizontally moving dot across the screen which increases speed until no longer tracked.
I would like to create an AI to behave similarly to a real test subject. I have a large amount of trials that were recorded of many months, position of dot on screen and user cursor position over time.
I would like to train the network on these trials so that the network behaves similarly to a real test subject and I can then obtain very large amounts of test data to observe how changing the parameters of the game affects the networks ability to track the moving dot.
I am interested in learning about the underlying code of neural networks and would love some advice on where to start with this project. I understand AIs can get very good at performing different tasks such as snake, or other simple games, but my goal would be to have the AI perform similarly to a real test subject.

A: Your question is a bit broad, but i'll try to answer nonetheless.
To imitate a subjects behavior you could use and LSTM network which has an understanding of the state it's in (in your case the state may include information about how fast and in which direction the dot is going and where the pointer is) and then decides on an action. You will need to feed your data (the dot coordination and users behavior) into the the network.
A simpler yet effective approach would be using simple MLP network. Your problem does not seem like a hard one and a simple network should be able to learn what a user would in a certain situation. However, based on what you mean by "perform similarly to a real test subject" you might need a more complex architecture.
Finally there are GAN networks, which are somewhat complicated if you're not familiar with NNs, are hard and time-consuming to train and in some cases might fail to train at all. The bright side is they are exactly designed to imitate a probability distribution (or to put it more simply, a set of data).
There are two more important notes to mention:

*

*The performance of your network depends heavily on your data and the game. for example, if in your dataset users have acted very differently to the same situation MLP or LSTMs will not be able to learn all those reactin.

*Your network can only imitate what it's taught. So if you're planning to figure out what a human agent would do under some conditions that never happened in your dataset (e.g. if in your dataset the dot only moves in a line but you want it to move in a circle when experimenting) you won't get good results.

hope this helps.


text:
Q: Направить в pipe уже запущенный процесс Например, я запустил какой-то процесс, который работает и выдаёт довольно много текста в stdout. Я понимаю, что весь поток текста читать не успею, но знаю, как отфильтровать нужое мне.
Можно ли уже запущенный процесс из stdout перенаправить, например в | grep somefilter или | less? Как это сделать?
(Понятно, что можно остановить и перезапустить, но в некоторых случаях это неприемлемо.)

A: перевод ответа Redirect STDERR / STDOUT of a process AFTER it's been started, using command line?:

*

*подключитесь к процессу программой gdb и выполните в ней команды (/dev/null здесь в качестве примера; подставьте имя реального файла):

*

*p dup2(open("/dev/null", 0), 1)

*p dup2(open("/dev/null", 0), 2)

*detach

*quit

пример:
$ tail -f /var/log/lastlog &
[1] 5636

$ ls -l /proc/5636/fd
total 0
lrwx------ 1 myuser myuser 64 Feb 27 07:36 0 -> /dev/pts/0
lrwx------ 1 myuser myuser 64 Feb 27 07:36 1 -> /dev/pts/0
lrwx------ 1 myuser myuser 64 Feb 27 07:36 2 -> /dev/pts/0
lr-x------ 1 myuser myuser 64 Feb 27 07:36 3 -> /var/log/lastlog

$ gdb -p 5636
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Attaching to process 5636
Reading symbols from /usr/bin/tail...(no debugging symbols found)...done.
Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x7f3c8f5a66e0 (LWP 5636)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2

(no debugging symbols found)
0x00007f3c8eec7b50 in nanosleep () from /lib/libc.so.6

(gdb) p dup2(open("/dev/null",0),1)
[Switching to Thread 0x7f3c8f5a66e0 (LWP 5636)]
$1 = 1

(gdb) p dup2(open("/dev/null",0),2)
$2 = 2

(gdb) detach
Detaching from program: /usr/bin/tail, process 5636

(gdb) quit

$ ls -l /proc/5636/fd
total 0
lrwx------ 1 myuser myuser 64 Feb 27 07:36 0 -> /dev/pts/0
lrwx------ 1 myuser myuser 64 Feb 27 07:36 1 -> /dev/null
lrwx------ 1 myuser myuser 64 Feb 27 07:36 2 -> /dev/null
lr-x------ 1 myuser myuser 64 Feb 27 07:36 3 -> /var/log/lastlog
lr-x------ 1 myuser myuser 64 Feb 27 07:36 4 -> /dev/null
lr-x------ 1 myuser myuser 64 Feb 27 07:36 5 -> /dev/null


text: Q: NiFi 1.2 TransformXML jar file I'm running NiFi 1.2.0 and would like to replace the default XSLT engine with something else? i.e. saxon9he.jar? I've copied this jar into the lib directory and restarted NiFi, but I see no references in the log it's being used?


text:
Q: How to do background work(like worker role) in web role(IIS)? I am working on azure MVC4 application, i need to read messages from servicebus then update online users through IIS(by SignalR). I want to run some worker role type of process within the web role. Looking for best practices to deal with servicebus in web role itself.

A: To run the "worker role" inside the Web Role, you just need to implement RoleEntryPoint in your Web Project, just like you do in your Worker roles.
Just remember that this "background" process (WaIISHost.exe) runs in total isolation than your Web Application process (w3wp.exe). Although this article is very old, it still represents very clearly what process do run in your Web Roles.
You could host your SignalR in the "worker role", not the IIS. And pass messages from the web worker to the service bus, and read them from the worker process.

A: I think that the best solution is to work with a worker role with Service Bus, you can try the worker role with service bus queue.
you can get the required message from the web, send it through the service bus queue to the worker role, and then do the required process.
After that you can send the result back to the webrole whether by using the queue or the service queue backward.
you can check this link, I think he is doing something a little bit similar http://middlewareinthecloud.com/2012/06/23/azureservice-bus-queues-in-worker-roles/
and this is the MSDN URL for the Worker Role With Service Bus Queue
http://msdn.microsoft.com/en-us/library/windowsazure/jj149831.aspx