text:
Q: more than one recyclerview integrated in one page of a viewpager I am somewhat new to android development and I am working on my final year project.
I have this problem, and I don't have a clue how this from the images image 1 image 2 image 3 was achieved. The way I see it, it looks like a viewpager but it has 3 recycler views probably in a linear layout in each view.
Now my problem is that I have only done a viewpager which will use values from one Jsonarray item for each view in the vp. I might be looking at it the wrong way so I would appreciate any other theories to achieve the above.

A: The only difference between these 3 tabs is the data. You have the same item everywhere. I would suggest to implement 1 Fragment which will hold 1 RecyclerView and all the logic to set items to Adapter, handle click events etc.
But you need to pass the actual array of elements to this Fragment from outside, no logic for getting data from some source should be written in Fragment.
And in your activity, you should have get the actual data, for example 3 Arraylists of Items, then you need to have a ViewPager, and add 3 instances of the Fragment to this ViewPager with different list of items.
In general that's it. If you need more details, well first provide more details and just let me know.


text:
Q: Dagger2 inject a list of childFragments in a parentFragment cause Error: cannot be provided without an @Provides-annotated method I have a MainActivity, and There is a nested MainFragment in my MainActivity, and even more, There are a list of ChildFragment in the MainFragment.Every Activity or Fragment has a Module and Subcomponent. Now I want to inject the list of ChildFragment int the MainFragment, but If I use the List<Fragment> provided method with the @FragmentScoped annotation in the MainFragmentModule, it will cause an error which said the fragment list cannot be provided without an @Provides-annotated method. Instead if I put the List<Fragment> provided method in the MainActivityModule with annotation @ActivityScoped, it works.Could anyone tell me that's why?
Here is the code:
MainActivityModule :
@Module
public abstract class MainActivityModule {
    @ContributesAndroidInjector(modules = {MainFragmentModule.class})
    @FragmentScoped
    abstract MainFragment mainFragment();
}

MainFragmentModule :
@Module
public abstract class MainFragmentModule {

    @ContributesAndroidInjector(modules = {HomeModule.class})
    @ChildFragmentScoped
    abstract HomeFragment homeFragment();

    @ContributesAndroidInjector
    @ChildFragmentScoped
    abstract NewsFragment newsFragment();

    @ContributesAndroidInjector
    @ChildFragmentScoped
    abstract MomentsFragment momentsFragment();

    @ContributesAndroidInjector
    @ChildFragmentScoped
    abstract WalletFragment walletFragment();

    @ContributesAndroidInjector
    @ChildFragmentScoped
    abstract PersonalFragment personalFragment();

    @FragmentScoped
    @Provides
    static List<Fragment> provideList(HomeFragment home, NewsFragment news, MomentsFragment moments, WalletFragment wallet, PersonalFragment personal) {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(home);
        fragments.add(news);
        fragments.add(moments);
        fragments.add(wallet);
        fragments.add(personal);
        return fragments;
    }
}

FragmentAdapter:
public class FragmentAdapter extends PagerAdapter {

    //...

    @Inject
    public FragmentAdapter(List<Fragment> fragments, FragmentUtil fragmentUtil) {
        mFragments = fragments;
        mFragmentUtil = fragmentUtil;
    }

    //...

}

MainFragment:
public class MainFragment extends DaggerFragment{

    //...

    @Inject
    FragmentAdapter mFragmentAdapter;

    @Inject
    public MainFragment() {
        // Required empty public constructor
    }

    //...
}

If I use the List<Fragment> provided method with the @FragmentScoped annotation in the MainFragmentModule, it will cause the following error:
Error:(20, 8) Error: [dagger.android.AndroidInjector.inject(T)]  java.util.List<android.support.v4.app.Fragment> cannot be provided without an @Provides-annotated method.
java.util.List<android.support.v4.app.Fragment> is injected at
com.sample.fragment.FragmentAdapter.<init>(fragments, …)
com.sample.fragment.FragmentAdapter is injected at
com.sample.fragment.MainFragment.mFragmentAdapter
com.sample.fragment.MainFragment is injected at
com.sample.activity.MainActivity.mMainFragment
com.sample.activity.MainActivity is injected at
dagger.android.AndroidInjector.inject(arg0)

But with the following code it works:
@Module
public abstract class MainActivityModule {

    @ActivityScoped
    @Provides
    static List<Fragment> provideList(HomeFragment home, NewsFragment news, MomentsFragment moments, WalletFragment wallet, PersonalFragment personal) {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(home);
        fragments.add(news);
        fragments.add(moments);
        fragments.add(wallet);
        fragments.add(personal);
        return fragments;
    }
}

A: Well, It seems that I have found the problem. When I inject the MainFragment in my MainActivity, because the MainFragment has an @Inject member which is FragmentAdapter, it needs to inject the FragmentAdapter . By the same way, it needs List injected. However, I provide the List in the MainFragmentModule, the parent subcomponent cannot use the provided dependencies of its child subcomponent.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Wrong solution of congruence system due to not cancelling gcd in homogeneous solution I have the following system of congruences:
$$\cases{3x\equiv6\pmod{18}\\2^x \equiv1\pmod5}$$
After solving the two equations, I obtain:
$$\cases{x\equiv2\pmod6\\x\equiv0\pmod4}$$
As per the Chinese remainder theorem, I expect the solution to be in the form $x\equiv x_0\pmod{12}$, however the following procedure, which is the one we've been taught at my course, leads to a result modulo $24$.
$$x\equiv2\pmod6 \land x\equiv0\pmod4 \iff x = 2 + 6k = 4h$$$$ k, h \in \mathbb{Z}$$
So we have the equation
$$6k-4h = -2$$
which $k_0 = -1, h_0 = -1$ are a particular solution of. Therefore, $k = -1 +4y, h = -1 + 6y$, with $y \in \mathbb{Z}$.
Plugging, say, the equation for $k$ back into our equation for $x$, I get $x = 2 + 6(-1+4y) = 2 - 6 + 24y$, which means $x\equiv-4\pmod{24}$.
However, I was expecting an answer modulo $12$. What am I missing?

A: The mistake is that you didn't cancel $\,\color{#c00}{\gcd(4,6)=2}\,$ in the homogenous component of the solution. Recall that the general solution of a linear equation like $\,4h-6k = 2\,$ is the sum of any particular solution plus the general solution of the associated $\rm\color{#0a0}{homogeneous}$ equation, here $\, 4h - 6k \color{#0a0}{= 0},\,$ with homogeneous general solution  $\ \dfrac{h}k = \color{#c00}{\dfrac{6}4}^{\phantom{|^{|^|}}}\!\!\!\! = \dfrac{3}2\iff \begin{align}h=3n\\ k = 2n\end{align}\qquad$
So the general solution is $\,(h,k) =\underbrace{(-1,-1)+(3n,2n)}_{\rm particular \ +\  homogeneous\!\!\!\!\!} = (-1\!+\!3n,\,-1\!+\!2n)$
thus we conclude that $\, x = 4h =  4(-1\!+\!3n)=-4\!+\!12n\equiv 8\pmod{\!12}$

A: From your work, $6k-4h = -2$ is equivalent to $2h-3k=1$ and then we find $h=-1+3y$, and $k=-1+2y$ with $y \in \mathbb{Z}$. Hence
$$x = 4(-1+3y)=-4+12y$$
that is $x\equiv 8\pmod{12}$.
A slight different approach. Note that $\gcd(6,4)=2$ and therefore
$$\cases{x\equiv2\pmod6\\x\equiv0\pmod4}\Leftrightarrow
\cases{z\equiv1\pmod3\\z\equiv0\pmod2}$$
where $x=2z$.
The equivalent system on the right is solved by $z\equiv 4\pmod{6}$ and therefore, going back to $x$, we find that $x\equiv 8\pmod{12}$.


text:
Q: On the bias of a confidence interval I have that
$n(\hat{f}(x)-f(x)) \sim N(\mu,\sigma)$
And $\mu$ cannot be estimated.
Can I say that the bias of my confidence interval for $\hat{f}(x)$ is $\mu n^{-1} $?

A: We don't usually say that a confidence interval is biased or not. That is a property of an estimator (here: $\hat{f}(x)$). But yes it's a result of Slutsky's theorem that if $n(\hat{f}(x) - f(x)) \rightarrow_d N(\mu, \sigma)$ then $E(\hat{f}(x)) = f(x) + \mu/n$ where $\mu/n$ is a bias.
The main operating characteristic of a CI is its coverage. We can calculate the % of coverage of the CI. For instance, if the 95% CI only captures the $f(x)$ 50% of the time, we can say the CI is anticonservative in that it reflects too optimistically the level of precision of the estimate. Coverage higher than the nominal level implies an estimator is too variable, too low implies the estimator is biased.


text:
Q: How to setup nginx + php-fpm + wordpress for only certain URLs? I'm trying to get nginx + php-fpm +wordpress to serve some pages from my site while acting as a proxy to other pages.
ie:
host/foo -> proxy to another www server
host/bar -> wordpress (via fpm)
the proxy part works fine, but the nginx -> wordpress part just keeps redirecting to the root page.
When i strace the php-fpm process, i see the hits coming in and wordpress actually does it's think and loads all the content, but at the last second it just redirects back to the root page.
Can't find anything on google as to how to see the incoming fastcgi params on the php side.  guessing something is wrong in the headers being sent from nginx, but I have no idea how to see what all is being sent. (strace not super-helpful here since it only gives the first few bytes)
if I try it via telnet and type:
GET / HTTP/1.0 <CR><CR>
i get the correct content as you would expect (ie: doesn't redirect).  but from a browser it's getting redirected.

A: Adding the following under your server settings
# proxy the page to Apache listening on 127.0.0.1:80
location ^~ /foo {
    proxy_pass   http://127.0.0.1;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ /bar/.*\.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
}


text:
Q: Theora granulepos when merging two theora video files without sound I need merge two files with video (without recompressing video) compressed by theora codec, without sound, to do that i parse each file,
find packets inside, change flag 5 bit in packet header to 0 (continue flag) and set for all packet
equal serial. This methon works fine, but have some problem with granulepos. Help me please with
granule pos, i try many ways to set it right (set it like miliseconds for example) but this not help.
Tell me please what is granulepos parameter and showind and how i need set granulepos to do than time
 betwen each frame be 300 milisec? Thanks!

A: I think the OggCat tool from Ogg Video Tool allows you to do this without recompressing the video. Note, both files need to have the same attributes (framerate, framesize, etc). It is an open-source project so you can look through the pertinent code relating to concatenating Theora video.


text:
Q: Jquery Mobile - Download wont start I've got following problem:
I want that the user can click a Button in a HTML Form, then a download starts.
The Button calls a new php file called "working.php" with a POST method.
In the working.php it generates a file and saves it on my server.
After that the customer can download the file.
On the Desktop version, it works, but with JQuery it won't work and I dont know why :(
Here is my Code for index.php:

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

    <title>Mobile</title>

    <link rel="stylesheet" type="text/css" src="styles.css" />

    <link rel="stylesheet" href="themes/sl_theme.min.css" />
    <link rel="stylesheet" href="themes/jquery.mobile.icons.min.css" />

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />

Mobile

        <form action="../working.php" method="post">
            <input name="sc_url" type="text" size="50" class="textbox">

            <input type="submit" value="GO">
        </form>

© 2014 by ###

and here the code from the working.php
    function savefile($id, $title) {
    $dir = "files";
    $file = file_get_contents($id);
    $thetitle = "";
    $titlelen = strlen($title) - 2;
    $thetitle = substr($title, 1, $titlelen);

    $thetitle = str_replace("/", " - ", $thetitle);
    $thetitle = str_replace("\\", " - ", $thetitle);

    if(strlen($thetitle) === 0) {
        die('

                    <link href="_styles.css" type="text/css" rel="stylesheet" media="all">

Sorry, but I cannot find a Track/Trackname :/

                    Home

            ');
    }

    $filename = $dir . "/" . $thetitle . ".mp3";

    file_put_contents("$filename", $file);

    header('Pragma: public');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Cache-Control: public');
    header('Content-type: audio/mpeg');
    header("Content-Transfer-Encoding: binary");
    header('Content-Length: '.filesize("$filename"));
    readfile("$filename");
}

When i click the Button, it only shows me a blank page (the working.php), but the download wont start.
Can anyone help me please?
greetings,
pascal

A: jQuery Mobile by default use AJAX behavior on forms, a download or an upload to work needs a full post, you should use the attribute
data-ajax="false"

So the form doesn't use the ajax behavior
<form action="../working.php" method="post" data-ajax="false">
    <input name="sc_url" type="text" size="50" class="textbox">

    <input type="submit" value="GO">
</form>

If you want to disable globally you shoud use the jquery global object, for more info you could look here:
Tip: Disable AJAX On jQuery Mobile Forms
jQuery Mobile Forms Demo


text:
Q: Salesforce lightning inspector chrome extension not found Tried to install Google chrome extension Salesforce Lightning Inspector but it takes me to 404 page which means that there is no extension literally not available to install. Is there a way to get this? Does Salesforce released some other tools for debugging? But according to the documentation it seems like the extension still exists.
please don't close this question if you don't know the answer or if don't know Salesforce just leave it as it is. Someone who knows the platform very well can answer.
Salesforce Lightning Inspector
Any thoughts?

A: The extension is temporarily removed. There was an issue with permissions and a new version is published to resolve it, but it's still under review with Google. It will be back up soon
See this post on twitter: https://twitter.com/YsrShk/status/1276025491485388800

Update
This has been updated by Salesforce. Lightning Inspector is up now.
Ref - https://twitter.com/YsrShk/status/1287697565153017856


text:
Q: Electronjs Unable to open X display I get the following error when trying to start an Electronjs app
[299:1006/231946.753542:ERROR:browser_main_loop.cc(1400)] Unable to open X display.

The futex facility returned an unexpected error code./mnt/c/dev/XXXXX/electron-vue/node_modules/electron/dist/electron exited with signal SIGABRT

A: The issue is that I was trying to start the Electronjs app using WSL on windows. Since WSL doesn't support a GUI (headless) it can't launch the ElectronJS app.
Run the Electronjs app from Windows instead of WSL


text:
Q: Combining beamer, tikz, externalize and standalone I've read a bunch of questions and answers on these topics as well as the documentation of the external library for tikz. I suspect I fundamentally misunderstand what I'm doing.
I have a mindmap which I'm including in a beamer presentation. It takes forever to compile so I would like to externalise it using the external library. I am also using overlay specifications to gradually make parts of the map visible. The mindmap is prepared in a separate file which I \input with the facilities of standalone.
Without externalisation, my code produces the slides OK. With externalisation, it fails.
This is a Minimal Non-Working Example using beamer, external and standalone. The beamer presentation is in prawf3.tex:
\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\makeatletter
    \tikzset{% https://tex.stackexchange.com/a/79572/39222
      beamer externalising/.style={%
        execute at end picture={%
          \tikzifexternalizing{%
            \ifbeamer@anotherslide
            \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}%
            \fi
          }{}%
        }%
      },
      external/optimize=false
    }
\makeatother

\begin{document}

\begin{frame}{A frame}
    \input{prawf3-pic}
\end{frame}

\end{document}

prawf3-pic.tex is as follows:
\documentclass[11pt,tikz]{standalone}

\begin{document}

\begin{frame}{A frame}
    \begin{tikzpicture}[beamer externalising]
        \node (a) {A};
        \only<2->
        \node (b) at (0,1) {B};
    \end{tikzpicture}
\end{frame}

\end{document}

[Obviously, prawf3-pic.tex will not compile on its own as it stands because beamer externalising is not defined in that case. This isn't the problem.]
The code for the beamer externalising style is from Andrew Stacey's answer to a somewhat similar question which lacked the standalone element.
When I try to compile prawf3.tex using pdflatex -shell-escape, the compilation fails with
! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "prawf3-figure0" "\def\tikzexternalrealjob
{prawf3}\input{prawf3}"' did NOT result in a usable output file 'prawf3-figure0
' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled
system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is a
lso named 'write 18' or something like that. Or maybe the command simply failed
? Error messages can be found in 'prawf3-figure0.log'. If you continue now, I'l
l try to typeset the picture.

but obviously shell escape is enabled as the error itself makes clear.
prawf3-figure0.log includes this just before it gives up with a Fatal error message:
LaTeX Info: Redefining \includegraphics on input line 21.
No file prawf3-figure0.nav.
(./prawf3-pic.tex
\openout5 = `prawf3-figure0.dpth'.

Missing character: There is no ( in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no ) in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no ( in font nullfont!
Missing character: There is no 0 in font nullfont!
Missing character: There is no , in font nullfont!
Missing character: There is no 1 in font nullfont!
Missing character: There is no ) in font nullfont!
Missing character: There is no B in font nullfont!
Missing character: There is no ; in font nullfont!
[1

\providecommand \oddpage@label [2]{}
{/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
! Extra }, or forgotten \endgroup.
\endframe ->\egroup
                    \begingroup \def \@currenvir {frame}
l.27 \end{frame}

I tried using {} with \only<2->:
{\node (b) at (0,1) {B};}

but that did not help. (This isn't surprising but it seemed worth trying as it was about the only thing I could think to try.)
Note that I think the complaints about the nullfont are unrelated as I get these with the full example even though everything compiles fine.
EDIT
I'm even more confused now as it turns out that it is not even sufficient to disable externalisation as follows:
\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\tikzexternaldisable
\makeatletter
    \tikzset{% https://tex.stackexchange.com/a/79572/39222
      beamer externalising/.style={%
        execute at end picture={%
          \tikzifexternalizing{%
            \ifbeamer@anotherslide
            \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}%
            \fi
          }{}%
        }%
      },
      external/optimize=false
    }
\makeatother

\begin{document}

\begin{frame}{A frame}
    \input{prawf3-pic}
\end{frame}
\end{document}

I thought that disabling externalisation would be sufficient to get compilation since it essentially turns the externalisation off. And beamer externalising seems to be defined conditionally so that it should be innocuous enough in that case...

A: This version works for me (and is shorter in code).
No need for standalone. That answer should be possible updated, although my score is yet too low to do that.
If you want full automatization, you would need a counter inside.
prawf3.tex
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{external, automata}
\tikzexternalize
\tikzexternaldisable
\makeatletter
\makeatother
\begin{document}
    \begin{frame}{A frame}
        \input{prawf3-pic}
    \end{frame}
\end{document}

prawf3-pic.tex
\only<1-2>{%the count of figures needs to be clear(quick hack)
    \begin{tikzpicture}
        \node (a) {A};
        \only<2->{\node (b) at (0,1) {B};}
    \end{tikzpicture}%
}

A: Workflow for multiple graphics on slides (possibly in background) and on use of \only or similiar tools or/and on unclear rowing of slides for a long presentation (due to possibly long(er) compilation times)
\includegraphics[height=0.65\textheight,keepaspectratio]{tikzGraphics/pdfToInclude}

in combination with

pdflatex -jobname $jn "\\\documentclass{standalone}\\\usepackage{pgfplots,amsmath,ifthen,xcolor}\\\input{../commands.tex}\\\pgfplotsset{compat=1.13}\\\input{../plotadaptions.tex}\\\begin{document}\\\input{$file}\\\end{document}"

did the job for me.
As complete shell script

for file in *.tex
do
    jn=$(basename -s .tex $file)
    pdflatex -jobname $jn "\\\documentclass{standalone}\\\usepackage{pgfplots,amsmath,ifthen,xcolor}\\\input{../commands.tex}\\\pgfplotsset{compat=1.13}\\\input{../plotadaptions.tex}\\\begin{document}\\\input{$file}\\\end{document}"
done

Only some adaptions to set tikz-properties, commands to use and colors are needed and not all PDFs for each slide on changing some graphics need to be compiled.
(This can be very unpleasant on having a 80 slides long presentation)


text:
Q: Can't change folder background I tried to change via dragging from the Backgrounds and Emblems window, but the icon just goes back to that window rather than changing the folder background.However, I can change the task bar by this drag-n-drop.
Probably it is something about changing ownership permission? if so how to change that?
In /home/mashruf/.gconf/apps/nautilus/preferences/%gconf.xml file it says:, Should I change this file? how?
<?xml version="1.0"?>
<gconf>
    <entry name="click_policy" mtime="1297597800" type="string">
        <stringvalue>single</stringvalue>
    </entry>
    <entry name="default_folder_viewer" mtime="1297597336" type="string">
        <stringvalue>list_view</stringvalue>
    </entry>
    <entry name="media_autorun_x_content_open_folder" mtime="1297534321" type="list" ltype="string">
    </entry>
    <entry name="media_autorun_x_content_ignore" mtime="1297534321" type="list" ltype="string">
    </entry>
    <entry name="media_autorun_x_content_start_app" mtime="1297534321" type="list" ltype="string">
        <li type="string">
            <stringvalue>x-content/software</stringvalue>
        </li>
    </entry>
    <entry name="start_with_location_bar" mtime="1297300028" type="bool" value="true"/>
    <entry name="side_pane_view" mtime="1297269334" type="string">
        <stringvalue>NautilusTreeSidebar</stringvalue>
    </entry>
    <entry name="navigation_window_saved_maximized" mtime="1297600306" type="bool" value="false"/>
    <entry name="navigation_window_saved_geometry" mtime="1297600306" type="string">
        <stringvalue>964x608+59+2</stringvalue>
    </entry>
    <entry name="sidebar_width" mtime="1297390418" type="int" value="192"/>
</gconf>

A: It sounds like there is a much easier way to achieve what you would like to do.

*

*Open Nautilus

*Right Click on a Folder

*Click on Properties

*Click on the Folder Icon Button (yes it's really a button!)

*Browse to the image you would like to replace it with
/usr/share/pixmaps
are where most of the standard icons are stored

*

*Select the image you would like to use

(see the images below)
On a side note. Never try to edit the gconf files by hand in the XML it's completely unnecessary and very easy to nuke your entire desktop/gnome configuration.
Instead use the GUI(Graphical User Interface) tool gconf-editor. Ubuntu-Key (Super) then type in gconf and choose the Configuration Editor. It works very similar to the Windows(R)(tm)(c) registry editor (gasp).
For your third question on File Permissions you can right-click in Nautilus, Choose Properties and change the permissions under the Permissions tab.
Or you can change the permissions on the command line using the chmod command
see this Ubuntu Help document on File Permissions
https://help.ubuntu.com/community/FilePermissions

A: Have a look at $HOME/.gconf/apps/nautilus/preferences


text:
Q: Workload Scheduler events on version 9.4 not working after switch over in production Looking at conman show cpus the state is incorrect.
%sc
CPUID RUN  NODE        LIMIT FENCE DATE  TIME    STATE   METHOD   DOMAIN
TWS1  842 *UNIX MASTER   10     0 06/14/17 09:06   I J   MDe        MDM
After JnextPlan everything is still working properly, but it is still
reporting MDe  and not MDEA
From WAS logs
com.ibm.tws.util.jmx.JMXBrowser.getSSLAttributeList(JMXBrowser.java:391)
 at
com.ibm.tws.util.jmx.JMXBrowser.loadSSLServerConfiguration(JMXBrowser.ja
va:1078)
 at
com.ibm.tws.util.jmx.JMXBrowser.getSSLTrustFilePassword(JMXBrowser.java:
1061)
 at
com.ibm.tws.event.EIFListener.addSSLCertsProperties(EIFListener.java:668
 at
com.ibm.tws.event.EIFListener.loadServerProperties(EIFListener.java:641)
 at
com.ibm.tws.event.EIFListener.generateConfigurationFile(EIFListener.java
:310)
 at com.ibm.tws.event.EIFListener.start(EIFListener.java:163)
 at
com.ibm.tws.conn.event.engine.EventRuleEngineImpl.startEventProcessor(Ev
entRuleEngineImpl.java:638)
 at
com.ibm.tws.conn.event.engine.ConnEventRuleEngineBean.startEventProcesso
r(ConnEventRuleEngineBean.java:314)
 at
com.ibm.tws.conn.event.engine.EJSLocalStatelessConnEventRuleEngine_28e79
c7e.startEventProcessor(Unknown Source)
 at
com.ibm.tws.conn.event.engine.ConnEventRuleEngineEjbLocalImpl.startEvent
Processor(ConnEventRuleEngineEjbLocalImpl.java:245)
 at
com.ibm.tws.cli.events.command.StartEventProcCommand.execute(StartEventP
rocCommand.java:116)
Workload Scheduler is running, but events are not triggering...

A: To help understand the state
The STATE field has a lowercase e
If the STATE field has a lower case e, the event processor is installed
but not running. Start the event processor using the conman startevtproc
command, or the Dynamic Workload Console. If you use conman, for
example, you will see the following output:
 %startevtproc
 AWSJCL528I The event processor has been started successfully.
The STATE field has no M If the STATE field has no M, monman is not
running. Start monman using the conman startmon command. You will see
the following output: %startmon
AWSBHU470I A startmon command was issued for CPU_MASTER. The STATE field
has no D
Resolution 1
1) make sure that value if the event processor port is wrong into the
database
db2 => select mpr_value from mdl.mpr_model_properties
where mpr_name='EVPROC_HTTPS_PORT'
This returns the event processor https port, that should
be something like 31116, but in this error case it could be 0 or -1.
2) If the value is wrong, we have to
save the correct value. Run wastools/showHostProperties.sh to retrieve
the value of httpsPort (suppose it is 31116).
3) Update the database: db2 => UPDATE MDL.MPR_MODEL_PROPERTIES SET
MPR_VALUE='31116' WHERE MPR_NAME='EVPROC_HTTPS_PORT'
4) The change will take effect at next JnextPlan.
In order to apply the change immediately, make sure if
Carry Forward is
set to ALL (run "optman ls" to get the value of cf value).
If it is not set to ALL take note of its value and run the following
optman chg cf = ALL
5) run JnextPlan -for 0000
6) if Carry Forward was not set to ALL revert its value
to the original value with optman chg cf =
7) updateWas.sh -user  -password
where the user is the primary admin id (TWS admin user).
The user specified in useropts file should be the user
defined as WAS primary admin id in security.xml file.
These are the steps to perform:
- login as tws_user
- remove the file useropts_tws_user
- in order to recreate the file, launch "composer sc" :
you will be asked to specify a username and
a password. Please specify the the primary admin id
 as user and its password.
- now run "conman stopeventprocessor"
- run "conman starteventprocessor"
If problem still occurs,
Check if the planman command has an issue:  planman showinfo
Check /etc/TWA/twainstanceX.TWA.properties file to see if EWas_basePath
is correct. (Default is /opt/IBM/WebSphere/AppServer)
If each of the above has no issue, then truss the problematic command
using the following syntax:
truss -o /tmp/truss_conman.out conman "stopappserver;wait"
Check the truss_conman.out output file and look for an error similar to
this:
/1: stat("/opt/IBM/WebSphere/AppServer", 0xFFFFFD7FFFDEFB00) Err#13
EACCES
[file_dac_search]
/1: write(2, " A W S B H U 6 2 6 W   T".., 76) = 76
Resolution part 2
Consult with your UNIX system administrator to investigate the cause for
the Operation System level error code 13.
Compare the /opt
/opt/IBM
/opt/IBM/WebSphere
/opt/IBM/WebSphere/AppServer
- and their sub-directories' permissions against a working environment to correct the permissions
Correct permissions should look like the following.
drwxr-xr-x   6 root  root 4096 Apr  8  2015 ibm
drwxr-xr-x  18 root  root 4096 Oct  3  2016 IBM
drwxr-x---  2 root  root 4096 Apr 17 12:34 CAP
drwxr-xr-x  6 root  root 4096 Jan 15  2016 IMShared
drwxr-xr-x  5 root  root 4096 Apr 13  2015 InstallationManager
drwxr-xr-x  3 root  root 4096 Apr 13  2015 ISA
drwxr-xr-x 14 root  root 4096 Jun 21 15:12 JazzSM
drwxr-xr-x  3 root  root 4096 Apr  8  2015 tsamp
drwxr-xr-x  2 m92   root 4096 Mar  1 09:59 TWA
drwxr-xr-x  8 root  root 4096 May 24 12:18 TWAUI
drwxr-xr-x  3 root  root 4096 Aug  6  2015 WebSphere
drwxr-xr-x 37 root root 4096 Jun 21 15:11 AppServer


text:
Q: couldn't get kerberos ticket for realm I have successfully built an Active Director on AWS. I can ping the directory from Centos7 EC2 instance located in the same VPC.
Now, I try to join the realm, but I receive the following errors:
        [ec2-user@ip-172-22-2-182 ~]$ sudo realm join -U admin@corp.xxx.com corp.xxx.com --verbose
 * Resolving: _ldap._tcp.corp.xxx.com
 * Resolving: corp.xxx.com
 * Performing LDAP DSE lookup on: 172.22.2.34
 * Successfully discovered: corp.xxx.com
Password for admin@corp.xxx.com:
 * Required files: /usr/sbin/oddjobd, /usr/libexec/oddjob/mkhomedir, /usr/sbin/sssd, /usr/sbin/adcli
 * LANG=C /usr/sbin/adcli join --verbose --domain xxx.com --domain-realm CORP.xxx.COM --domain-controller 172.22.2.34 --login-type user --login-user admin@xxx.com --stdin-password
 * Using domain name: corp.xxx.com
 * Calculated computer account name from fqdn: IP-172-22-2-182
 * Using domain realm: xxx.com
 * Sending netlogon pings to domain controller: cldap://172.22.2.34
 * Received NetLogon info from: WIN-QUUMO7C7PU3.xxx.com
 * Wrote out krb5.conf snippet to /var/cache/realmd/adcli-krb5-g1oscN/krb5.d/adcli-krb5-conf-RlQBkY
 ! Couldn't get kerberos ticket for: admin@xxx.com: Cannot find KDC for realm "xxx.com"
adcli: couldn't connect to xxx.com domain: Couldn't get kerberos ticket for: admin@xxx.com: Cannot find KDC for realm "xxx.com"
 ! Failed to join the domain
realm: Couldn't join realm: Failed to join the domain
[ec2-user@ip-172-22-2-182 ~]$

Anyone knows how to resolve it? Amazon Documentation does not say anything about installing Samba and its integration with AWS Windows Active Directory. It only has this link to enroll the host
enter link description here
Thanks

A: Not sure if this is still unresolved, but I encountered the same error as well when joining an Ubuntu machine to my domain... If you are using Ubuntu 16.04, you must enter the domain name portion of the username with all capital letters.
For example, admin@CORP.XXX.COM corp.xxx.com --verbose, worked for me.


text:
Q: Excel Runtime Error 1004 I am new to Visual Basic. I created a spreadsheet which worked fine until I copied entries from it to another sheet!
Apparently, whenever I click the CONTINUE button on the Find Entry form I get the runtime error 1004 also the drop down shows nothing in it yet I never changed the code. When I click Debug,
TargetRow = Application.WorksheetFunction.Match(ColumnD_Menu, Sheets("Data").Range("Dyn_Full_Name"), 0)

is highlighted and I don't know how to proceed with it as I never touched this line of code at all.
What could be the problem and how can I resolve it?
Below is my code
Option Explicit

Private Sub CommandButton1_Click()

    Dim TargetRow As Integer

    TargetRow = Application.WorksheetFunction.Match(ColumnD_Menu, Sheets("Data").Range("Dyn_Full_Name"), 0)
    Sheets("Engine").Range("B5").Value = TargetRow

    Unload Find_Entry_UF

    Data_UF.Txt_FirstName = Sheets("Data").Range("Data_Start").Offset(TargetRow, 1).Value
    Data_UF.Txt_Surname = Sheets("Data").Range("Data_Start").Offset(TargetRow, 2).Value

    Data_UF.Combo_Age = Sheets("Data").Range("Data_Start").Offset(TargetRow, 4).Value
    Data_UF.Combo_Marital = Sheets("Data").Range("Data_Start").Offset(TargetRow, 5).Value
    Data_UF.Combo_Gender = Sheets("Data").Range("Data_Start").Offset(TargetRow, 6).Value

    If Sheets("Data").Range("Data_Start").Offset(TargetRow, 7).Value = "Yes" Then
        Data_UF.Option_Y_Children = True
    Else
        Data_UF.Option_N_Children = True
    End If

    Data_UF.Combo_Religion = Sheets("Data").Range("Data_Start").Offset(TargetRow, 8).Value
    Data_UF.Txt_Address = Sheets("Data").Range("Data_Start").Offset(TargetRow, 9).Value
    Data_UF.Combo_FileNumber = Sheets("Data").Range("Data_Start").Offset(TargetRow, 10).Value

A: The 1004 error comes from the fact, that in the Excel file at least 1 of the following 2 conditions are missing:

*

*There is no sheet named Data

*There is no named range Dyn_Full_Name on the sheet Data
Adjust the worksheet correspondingly and error would be fixed.


text:
Q: How to add query parameters with okhttp3 Java? I am trying to use the Kroger API and need to add query parameters to get the data I need. Thanks for the help!
Example from the docs: filter.term=milk
https://developer.kroger.com/reference#operation/productGet
Code:
OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
                .url("https://api.kroger.com/v1/products/0001111041700")
                .get()
                .addHeader("Accept", "application/json")
                .addHeader("Authorization", "Bearer " + TOKEN)
                .build();

        Response response = client.newCall(request).execute();
        System.out.println(response);


text:
Q: Remove items in the first Lixtbox which is added in the second Listbox
I am making a simple ftp app, when I click the browse button, the full path of the files will be added in the first ListBox. When I click on the Send Files button, it will execute and the full path will appear in the second ListBox. What I want to achieve is that, when a particular path is in the second ListBox, it will be removed in the first ListBox.
Here' what I have so far.
  private void button2_Click(object sender, EventArgs e)
    {
         List<string> str = new List<string>();
         OpenFileDialog v1 = new OpenFileDialog();
        v1.Multiselect = true;
         if (v1.ShowDialog() == DialogResult.Cancel)
             return;

         foreach (string s in v1.FileNames)
         {
             ////listBox1.Items.Add(Path.GetFileName(s));
            listTransfer.Items.Add(Path.GetFullPath(s));
             str.Add(s);
         }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        SendFiles();
    }

    private int SendFiles()
    {
        try
        {
            // Setup session options
            SessionOptions sessionOptions = new SessionOptions
            {
                Protocol = Protocol.Ftp,
                HostName = "192.168.1.3",
                UserName = "Admin",
                Password = "foxtrotAlpha",
                PortNumber = 21
               // SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="
            };

            using (Session session = new Session())
            {
                // Connect
                session.Open(sessionOptions);

                // Upload files
                TransferOptions transferOptions = new TransferOptions();
                transferOptions.TransferMode = TransferMode.Binary;

                TransferOperationResult transferResult;
                //  transferResult = session.PutFiles(@"d:\upload\*", "/transfer/", false, transferOptions);

                foreach (var listBoxItem in listTransfer.Items)
                {
                    string item = listBoxItem.ToString();
                    string[] result = item.Split(',');

                    transferResult = session.PutFiles(@result[0], "/_transfer/", false, transferOptions);

                    // Throw on any error

                    transferResult.Check();

                    // Print results
                    foreach (TransferEventArgs transfer in transferResult.Transfers)
                    {
                        lblCompleted.Text = transfer.FileName.ToString();
                        listCompleted.Items.Add(lblCompleted.Text);
                    }
                }
            }
            return 0;
        }
        catch (Exception e )
        {

                MessageBox.Show(e.Message.ToString(),"FTP",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return 1;
        }
    }

A: Consider putting
listTransfer.Remove(listBoxItem);

somewhere suitable, like above //print results..


text:
Q: kotlin error recycler view with gridlayout type was mismatched im facing errors in recyclerView here is //
data class categories(
val Name: String,
val Image:Int

)
here is model /////
object CategoriesModel {
fun getImages(): ArrayList<categories> {
    val ImagesList = ArrayList<categories>()
    val categoryFirst = categories(
        "Memmals",R.drawable.memmals
    )
    ImagesList.add(categoryFirst)

    val categorySecond = categories(
        "Memmals",R.drawable.fish
    )
    ImagesList.add(categorySecond)
    return ImagesList
    }
}

//// adapter///
class CategoriesAdapter(private val itemList: ArrayList) :
RecyclerView.Adapter<CategoriesAdapter.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CategoriesAdapter.ViewHolder {

    val view =LayoutInflater.from(parent.context)

.inflate(R.layout.memmals, parent,false)
return ViewHolder(view)
}

override fun onBindViewHolder(holder: CategoriesAdapter.ViewHolder, position: Int) {
    holder.bind(categories("Memmals",2))
}

override fun getItemCount(): Int {
    return itemList.size
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

    fun bind(category: categories) {
        val textViewName = itemView.findViewById<TextView>(R.id.txtCategory)
        textViewName.text = category.Name
        val txtImage=itemView.findViewById<View>(R.id.image)
        txtImage.id=category.Image
    }
}

}
/////main activity///
class MainActivity : AppCompatActivity() {
private lateinit var mAdapter: CategoriesAdapter
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    binding= ActivityMainBinding.inflate(layoutInflater)
    setContentView(binding.root)
    binding.recyclerView.setOnClickListener{
        val intent=Intent(this,Level1::class.java)
        startActivity(intent)

    }

    val recyclerView = findViewById<RecyclerView>(R.id.recyclerView)
    recyclerView.layoutManager = GridLayoutManager(this,2)

    val itemList = ArrayList<CategoriesModel>()

// from here
    itemList.add(categories("Memmals",R.drawable.memmals))
    itemList.add(categories("Fishes",R.drawable.fish))
    itemList.add(categories("Arthropods",R.drawable.dear))
    itemList.add(categories("Yalk",R.drawable.yalk))

//to here errors are there
    //Adapter setting
    mAdapter = CategoriesAdapter(itemList)
    recyclerView.adapter = mAdapter

}

}
/// here is the error///
MainActivity.kt: (34, 22): Type mismatch: inferred type is categories but CategoriesModel was expected

A: MainActivity.kt
 val itemList = ArrayList<CategoriesModel>()

should be changed to
 val itemList = ArrayList<categories>()

because you are using CategoriesModel object and expected is categories.


text:
Q: Rails Join - How to get fields with same name I have two tables with same name and am doing a join
Visits::Appointment
    name:string
    id:integer
    ...

Places::Seatables
    name:string
    appointment_id:integer
    id:integer
    ....

I want to do a outer join and get all the fields. I am getting only the name and id from the seatable table when I do the following.
  Visits::Appointment.joins("LEFT OUTER JOIN places_seatables ON  places_seatables.appointment_id=visits_appointments.id").where('checkout is null and "isActive" is true and noshow is false').select(visits_appointments.*,places_seatables.*')

How can I get both the fields instead of just one

A: appointments = Visits::Appointment
               .joins("LEFT OUTER JOIN places_seatables ON  places_seatables.appointment_id=visits_appointments.id")
               .where('checkout is null and "isActive" is true and noshow is false')
               .select(visits_appointments.*,places_seatables.name as seatable_name, places_seatables.id as seatable_id')

Now you can access them as
appointment = appointments.first
appointment.seatable_name
appointment.seatable_id


text:
Q: Python: parsing SQL query I'm trying to reduce the number of queries that I run on a database.  I currently run a query to determine the deliveries that occurred in the last day, then queries each delivery twice, once to find account information, then again to find which items were delivered in order to invoice them.  I can combine the last two sets of queries into one query, but am having trouble separating each delivery into a separate object.
Here's the query I get:
AccountName    Date    ItemName    Quantity    Cost

     A        3/8/16      i1           2      $1.00
     A        3/8/16      i2           3      $2.00
     A        3/8/16      i3           1      $3.00
     B        3/8/16      i3           3      $3.00
     B        3/8/16      i4           1      $4.00
     C        3/8/16      i2           2      $2.00

I want to organize this into:
AccountName = [A,B,C]
Date = [3/8/16,3/8/16,3/8/16]
ItemDetails = [
           [[i1,i2,i3],[2,3,1],[$1,$2,$3]],
           [[i3,i4],[3,1],[$3,$4]],
           [[i2],[2],[$2]]
          ]

A: Here's something that should get you started:
import csv

from datetime import datetime as dt

data = {}
with open('path/to/file') as infile:
    for _ in range(2): infile.readline()
    for name, date, item, quant, cost in csv.reader(infile, delimiter='\t'):
        if name not in data: data[name] = {}
        if date not in data[name]: data[name][date] = {}
        if item not in data[name][date]: data[name][date][item] = []
        data[name][date][item].append((quantity, cost))

Now, you can query data by account name, per each date, to see how much (and at what cost) of each item was purchased


text:
Q: How To Update Xojo Objects From HTML/Javascript? I am working on a Google map web application under Xojo. The map has a draggable marker that updates the values of latitude and longitude textboxes. Since the UI for mapping is entirely made with HTML/Javascript and shown through Xojo's WebHTMLViewer control, I am having problems getting the values of the lat-lang textboxes to Xojo.
screenshot

A: Check out HTMLViewer's ExecuteJavaScript and ExecuteJavaScriptSync functions to interact with the HTML Viewer JavaScript. Use the JavaScript function detailed on the HTMLViewer.JavaScriptRequest Event to pass data back to the Xojo framework.
Since you're able to get the latitude and longitude values into those text fields, you should be able to pass them to the Xojo framework using these functions and event.

A: You might try using the WebMapViewer control instead, which has Latitude and Longitude properties. Or if that doesn't meet your needs you could try creating your specific control using the Web SDK, located in the Extra/WebSDK folder of the Xojo installation.


text:
Q: SQL query from highest value from duplicates I have a table that looks like this.
username | vendor | time
-------------------------
x        |  a     | 10
x        |  b     | 11
x        |  c     | 12
y        |  a     | 9
y        |  c     | 14

I want to pull out the rows with the highest time value among their usernames, so it should look like this:
username | vendor | time
-------------------------
x        |  c     | 12
y        |  c     | 14

I have no idea how to go about this after a couple queries didn't get what I wanted. What would this look like? Thanks!

A: This code is fairly database agnostic:
SELECT username, vendor, MAX(time)
FROM foo
WHERE vendor = 'c'
GROUP BY username, vendor;

If it were me, I would want to use an analytic function (personal preference, really). This is supported in both MS SQL Server and Oracle:
SELECT username, vendor, MAX(time) OVER (PARTITION BY username, vendor)
FROM foo
WHERE vendor = 'c';

Here is a SQL Fiddle.

A: You can use the ANSI standard window function row_number():
select t.*
from (select t.*,
             row_number() over (partition by username order by time desc) as seqnum
      from t
     ) t
where seqnum = 1;

A: I'm not sure that the OP wants a vendor filter, so the following will get the top time for each username, and the linked vendor.
This is making the same assumption as Jacobm001 that it is MySQL
select * from (select username, vendor, time from foo order by time desc) as t
group by username

Where foo is the name of your table
SQL Fiddle


text:
Q: How to check list of strings parameter type from isinstance() method I want to try to handle the parameter type passed to the function by using isinstance() function. Basically, i want to check that whether passed list to the function contains only string or not. So, I wrote function as
def fun(parameter: list[str]):
    #want to check parameter type here

After getting the list, I want to ensure that it contains only strings. So, is there any way to check this from isinstance() function? Otherwise i have to make custom check by looping through the list.

A: You could add an assertion, but yes, I think you need a loop
def fun(parameter:list[str]):
    assert all(isinstance(s, str) for s in parameter)

A: This is kind of an odd, roundabout way of doing it, but here's how you could get away without using a loop. I prefer @OneCricketeer's answer in general though.
import numpy as np

def fun(parameter: list[str]):
    assert list(np.array(parameter, dtype=str)) == parameter
   ...

Passing dtype=str will cause any non-string items in parameter to be converted to strings in the resulting array, which you can then convert back to a list and compare to the original. The two will be equal only if all items were strings already.
You could also use np.array_equal() instead of wrapping the array in list() and comparing with ==, which would be more efficient if your parameter list is very large.

A: You can use 2 methods:
Method 1: Using the built-in function of python3 i.e isinstance().\
example:
def fun(parameter: list[str]):
 return isinstance(parameter, (list, str))

This will return the True or False. It will check parameter is list or string or a list of strings.
Method 2: create the custom function to check the type.
example:
def fun(parameter:list[str]):
     if type(parameter) == list:
            for i in parameter:
                 if type(i) != str:
                       return False
            return True
     return False

The logic behind the above code is simple it will check whether the parameter is list or not if a list will send False. If it is list then it will check the contains of the list are true or not. If they are true it simply returns True.


text:
Q: Rust timerfd CLOCK_MONOTONIC equivalent In my Linux Rust program I would like to wait for the system monotonic clock to reach a specified value. (The Linux monotonic clock counts the elapsed time since system boot).
Here is the C implementation of the desired function, error checking omitted:
void sleep_until_monotonic(int64_t ts)
{
  int fd = timerfd_create(CLOCK_MONOTONIC, 0);

  struct itimerspec its = { .it_value = { .tv_sec = ts }};
  timerfd_settime(fd, TFD_TIMER_ABSTIME, &its, NULL);

  struct pollfd pfd = { .fd = fd, .events = POLLIN };
  poll(&pfd, 1, -1);
  close(fd);
}

Here is a sketch of the Rust API I'm imagining:
  some_lib::sleep_until_monotonic(1234).await?

Is something like this possible in Rust? A Linux-only solution is OK but of course if there is a cross-platform solution available that would be great.


text:
Q: Plotting a function based of a complicated integral I would like to have help in making a plot of a complicated function based a definite integral.

 - desired graph
My calculation:

ClearAll[F, z];
F[z_] := 0.5*(1 + Erf[z/Sqrt[2]]);
q[B_, g_, m_] :=
  (1/Sqrt[2*Pi])*
     Integrate[F[z]^(-1 + m)/E^(0.5*((-Sqrt[B])*g + z)^2), {z, -1000, 1000}];
p[B_, g_, m_] := 1 - q[B, g, m];
Plot[{p[B, 0.2, 8]}, {Log[B, 2], -4, 4}]

First: Log[B,2] - Error.
Second: It's very long considers.
How to make my plot in the Mathematica?

A: I think the graph in your book contains an error. When we look closely at the graph of Alexei, then we see that for m=8 and g=0.2, the graph crosses the y-axis at 0.84. In the picture in your book, this is not the case and the crossing is at {0, 0.65} (the plot is log-scaled!). Additionally, Alexei's graph ends in {4, 0.67} while in your book this is the point isn't even on the graph. Instead, it contains the point {3, 0.1}.
To cut is short: Although you book claims that it depicts g=0.2, I believe it rather used g=1.
Additionally, note that you can integrate from -Infinity to Infinity in your code. NIntegrate can handle this. To make this a complete answer:
f[z_] := 1/2 (1 + Erf[z/Sqrt[2]]);
Plot[f[z], {z, -10, 10}, Axes -> False, Frame -> True,
 PlotRange -> {Automatic, {0, 1}}]

ClearAll[q];
q[B_?NumericQ, g_?NumericQ, m_?NumericQ] :=
 1 - (1/Sqrt[2*Pi])*
   NIntegrate[
    Exp[-1/2 (z - g*Sqrt[B])^2]*f[z]^(-1 + m), {z, -Infinity,
     Infinity}]

LogPlot[Evaluate[q[2^x, 1, #] & /@ {8, 128, 512}], {x, -4, 4},
 Frame -> True, Axes -> False, PlotRange -> {Automatic, {0.1, 1}},
 GridLines -> {None, {.2, .3, .4, .5, .6, .7, .8, .9}},
 PlotLegends -> {"m=8", "m=128", "m=512"}]

A: You might do as follows:
    ClearAll[F, z];
F[z_] := 0.5*(1 + Erf[z/Sqrt[2]]);
p[lgB_, g_, m_] :=
  1 - (1/Sqrt[2*Pi])*
    NIntegrate[
     F[z]^(-1 + m)/E^(0.5*((-2^(lgB/2))*g + z)^2), {z, -1000, 1000},
     MaxRecursion -> 12];
Plot[{p[lgB, 0.2, 8]}, {lgB, -4, 4}]

yielding this

The key points are tha (i) I substituded B=^lgB, thus, introduced a new variable, lgBthat you probably have head in mind, and (ii) I used NIntegrateinstead of Integrate.
Have fun!


text:
Q: Dynamic pdf filename to my visualforce page using iframe Here is my visualforce page code where i am displaying pdf in iframe but i am not able to set "file name" of this pdf,
<apex:page standardController="xyz__c" title="XYZ Form" action="{!Mergepdf}"
        extensions="viewPDF" >

    <apex:slds />
    Contract's PDF

</apex:page>

this is what i have tried so far : fileName = "testFileABC.pdf" is not working for me.


text:
Q: Should I git ignore xcodeproject/project.pbxproj file? in a XCode project, I offen got xcodeproject/project.pbxproj file changed, but useless info for me, it for compile.
Should I git ignore this file and xcodeproject/projectxworkspace/username.xcuserdata/UserInterfaceState.xcuserstate file?

A: That is the only file that you want in your repos from the xcodeproj bundle. That file holds all of the info for targets files and build settings.

A: Unfortunately, if your Build Settings includes code signing, you have to re-enter your code-signing entity after every "git pull" if another team member has changed it.  It seems to me this info should be in the user settings, not the global pbxproj file.

A:
project.pbxproj is an important file in the Xcode configuration bundle. It is responsible for maintaining references to all of the linked files and their groupings, linked frameworks, and most importantly, the project's build settings. Because of this, we cannot exclude project.pbxproj from version control.

Here is my general .gitignore for my Xcode Project.
# OS X Finder
.DS_Store

# Xcode per-user config
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata

# Build products
build/
*.o
*.LinkFileList
*.hmap

# Automatic backup files
*~.nib/
*.swp
*~
*.dat
*.dep

A: If you exclude project.pbxproj Jenkins builds will fail. So this is important if you use Jenkins.

A: Update in the light of Swift Package Manager: If you're building a project as a Swift package - you should definitely ignore this file as it can be generated using file system as source of truth. You can do that by using the following command:
$ cd ~/Projects/MyProjectFolder/
$ swift package generate-xcodeproj

For non-SwiftPM answer - see below.
This file holds the list of all the files in the project, settings of targets and which files belong to which targets. It's probably the meatiest file in project bundle. You should not ignore this file. There are few points for this:

*

*You may not want to work on this project alone or;

*You're planning on working on project from different machines;

*You'll want to share your code base with others;

A: You can use Xcodegen to generate a pbxproj out of a YAML project specification file then you can ignore pbxproj in git and generate them every time you need.
I have already used Xcodegen on a second project which has a modular architecture (many pbxprojs) and more then 8 developers is working on it.
https://github.com/yonaskolb/XcodeGen
Hope it helps.

A: I found that I also need to preserve the xcworkspace file(s). If didn't, project with a sub-project broke.


text:
Q: changing UILabel text on a subview from main view Ok, so I'm a relative noob with Objective-C/iOS programming, so hopefully someone with more knowledge here can help me out.
I have an iPad application using the SplitViewController template (with Core Data).  I created another UIViewController (with xib file) called PlayerViewController.  This View has several UILabel components on it.
I have a list of players that show up in the RootViewController (UITableView) and when you select a player, I programmatically create a PlayerViewController (in DetailViewController), pass it the NSManagedObject that was passed to the DetailViewController, try to set the text of one of the labels on the PlayerViewController's view, and then add it as a subview to the DetailViewController.
All of this works great except for the setting the text of the label on the PlayerViewController's view.  I'm not sure what I'm doing wrong.  I have used NSLog to confirm that the NSManagedObject is not nil and that the NSManagedObject property I'm trying to use has the correct text.
I'm at a loss here.  Any help would be greatly appreciated.  (Code follows):
This method is in the DetailViewController.m file:
- (void)configureView {
    // Update the user interface for the detail item.
    PlayerViewController *player = [[PlayerViewController alloc] init];
    player.player = detailItem;
    [self.view addSubview:player.view];
}

This method is called when the user selects an item from the RootViewController (This functionality, calling of configureView, is setup by the template and I haven't changed it).
Setting the player property of the PlayerViewController to object detailItem is handled in the setPlayer method of that class.
- (void)setPlayer:(NSManagedObject *)managedObject {

    if (player != managedObject) {
        [player release];
        player = [managedObject retain];

        // Update the view.
        [self configureView];
    }
}

I then have a configureView method as well in PlayerViewController that sets the text of the label:
- (void)configureView {
    nickName.text = [[player valueForKey:@"Nickname"] description];
    NSLog(@"Nickname %@", [[player valueForKey:@"Nickname"] description]);
    NSLog(@"Nickname %@", nickName.text);
}

Ok, so the first NSLog statement prints the desired value, but the text of the UILabel (called nickName) returns nil.
The following is the full PlayerViewController.h & .m files:
PlayerViewController.h:
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>

@interface PlayerViewController : UIViewController {

    NSManagedObject *player;

    IBOutlet UILabel *nickName;
    IBOutlet UILabel *goalCount;
    IBOutlet UILabel *assistCount;
    IBOutlet UILabel *timeInGame;
}

@property (nonatomic, retain) IBOutlet UILabel *nickName;
@property (nonatomic, retain) IBOutlet UILabel *goalCount;
@property (nonatomic, retain) IBOutlet UILabel *assistCount;
@property (nonatomic, retain) IBOutlet UILabel *timeInGame;

@property (nonatomic, retain) NSManagedObject *player;

@end

PlayerViewController.m:
#import "PlayerViewController.h"

@implementation PlayerViewController

@synthesize nickName, goalCount, assistCount, timeInGame, player;

#pragma mark -
#pragma mark Managing the detail item

/*
 When setting the player item, update the view
 */
- (void)setPlayer:(NSManagedObject *)managedObject {

    if (player != managedObject) {
        [player release];
        player = [managedObject retain];

        // Update the view.
        [self configureView];
    }
}

- (void)configureView {
    nickName.text = [[player valueForKey:@"Nickname"] description];
    NSLog(@"Nickname %@", [[player valueForKey:@"Nickname"] description]);
    NSLog(@"Nickname %@", nickName.text);
}

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)dealloc {
    [super dealloc];
}

@end

I'm sure I'm just missing something trivial, but I can't figure it out, and haven't been able to find any answers searching the web.
Thanks for any help!

A: Ok, so after playing with this for a bit and searching and searching around, I have gotten the answer to my problem.  It turns out all the code I had was fine except the location of one statement.  My call to configureView in PlayerViewController.m needed to be in viewDidLoad() not in the setPlayer() method.  It all works great now.

A: Change the configureView method to that :
- (void)configureView {
    nickName.text = (NSString*)[player valueForKey:@"Nickname"];
}

A: Yes, better place to call method is
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self configureView];
}

*

*(void)setPlayer:(NSManagedObject *)managedObject  called before your nib files loaded.


text:
Q: Unable to resolve maven-resources-plugin:2.19.1 dependencies in Eclipse | Maven version - 3.6.1 Unable to resolve maven-resources-plugin:2.19.1 dependencies in Eclipse.

I also tried changing maven-resources-plugin versions
Getting following error message-
    Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.19.1 or one
    of its dependencies could not be resolved: Failed to read artifact descriptor for
    org.apache.maven.plugins:maven-resources-plugin:jar:2.19.1
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
 instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
 4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.qmetry</groupId>
    <artifactId>quantum-starter</artifactId>
    <version>2.0-SNAPSHOT</version>

    <properties>
        <testngXmlDir>src/main/resources/config</testngXmlDir>
        <testngXmlFile>localRegressionTest.xml</testngXmlFile>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <reportium-sdk.version>2.2.1</reportium-sdk.version>
        <testng.version>6.10</testng.version>
        <cukes.version>1.2.5</cukes.version>
        <qaf.version>2.1.14</qaf.version>
        <qafsupport.version>2.1.14</qafsupport.version>
        <quantum.version>1.19</quantum.version>
        <org.json.version>20160810</org.json.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                    <systemPropertyVariables>
                        <application.properties.file>resources/application.properties</application.properties.file>
                    </systemPropertyVariables>

                    <suiteXmlFiles>
                        <suiteXmlFile>${testngXmlDir}/${testngXmlFile}</suiteXmlFile>
                    </suiteXmlFiles>

                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>perfectomobile</id>
            <name>Perfecto mobile</name>
            <url>https://repo1.perfectomobile.com/public/repositories/maven</url>
        </repository>
        <repository>
            <id>jai</id>
            <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cukes.version}</version>
        </dependency>
        <dependency>
            <groupId>com.quantum</groupId>
            <artifactId>quantum-support</artifactId>
            <version>${quantum.version}</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>
        <dependency>
            <groupId>com.perfecto.reporting-sdk</groupId>
            <artifactId>reportium-testng</artifactId>
            <version>${reportium-sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>
        <!-- Added -->

        <dependency>
            <groupId>com.qmetry</groupId>
            <artifactId>qaf</artifactId>
            <version>${qaf.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.qmetry</groupId>
            <artifactId>qaf-support</artifactId>
            <version>${qafsupport.version}</version>
        </dependency>

        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>6.1.0 </version>
        </dependency>
    </dependencies>
</project>

Error log:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.19.1 or one
of its dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-resources-plugin:jar:2.19.1
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.19.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.19.1
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)
    at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:47)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:179)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:284)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:408)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$2.call(MavenImpl.java:420)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$2.call(MavenImpl.java:1)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:418)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupMojoExecution(ProjectRegistryManager.java:961)
    at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:408)
    at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:66)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:113)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.19.1
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:282)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
    ... 35 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.19.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.19.1 from/to central (https://repo.maven.apache.org/maven2): unexpected end of stream on Connection{repo.maven.apache.org:443, proxy=HTTP @ vmproxy.virginmedia.co.uk/172.19.41.40:8080 hostAddress=172.19.41.40 cipherSuite=none protocol=http/1.1} (recycle count=0)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
    ... 38 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.19.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.19.1 from/to central (https://repo.maven.apache.org/maven2): unexpected end of stream on Connection{repo.maven.apache.org:443, proxy=HTTP @ vmproxy.virginmedia.co.uk/172.19.41.40:8080 hostAddress=172.19.41.40 cipherSuite=none protocol=http/1.1} (recycle count=0)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:238)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    ... 41 more

A: maven-resources-plugin version 2.1.9.1 doesn't exist.
Try change version to 3.1.0 (or other existing version)
You can check which artifacts (and versions) actually exists here :
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin
(Maybe it was a wrong copy paste from another plugin).
See you


text:
Q: Trying to multiply the first two numbers that results to a particular number, is there way i can do this without using nested loops? Here is the full solution, please is there much better ways to go about this
the question is getting total number of squares in a box but in the inverse way, for example the normal question is 2,9 and the total number of available squares will be 26. but i was given the question in another way such that 26 will be given and im to find all the possible ways m and n can be arranged so the total number of squares will be the given question, which is 26
The code actually works but i need a faster way to do this.
const n = 26;
function count(m, n) {
    if (n < m) {
        const temp = n;
        n = m;
        m = temp;
    }
    return m * (m + 1) * (2 * m + 1) /
        6 + (n - m) * m * (m + 1) / 2;
}
const arr = [];

const len = n + 1;

for (let i = 1; i < len; i++) {
    if(i<len/2) {

    }
    for (let b = 1; b < len; b++) {
        if (i === 1) {
            arr.push(`${i} ${n}`);
            break;
        } else if (i === n) {
            arr.push(`${n} 1`);
            break;
        } else {

            const sum = count(i, b);
            if (sum == n) {
                arr.push(`${i} ${b}`);
                break;
            }
        }
    }

}
const arrLength = arr.length;
console.log(arrLength); //shows the length of the array

for (let g = 0; g < arrLength; g++) {
    console.log(arr[g]); // shows each ways it can be arranged to give 26

}


text:
Q: WPF localization with dynamic resource doesn't work I made a custom UI wix bootstrapper as a WPF .net class library. I wanted to change the setup language in realtime according to the user choice by using a MergedDictionaries and DynamicRessource.
But the issue I encounter is that the string doesn't show on the UI and it's not an uri path error because I can access it with the code behind.
<Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <ResourceDictionary x:Key="Application">
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/LanguageSelector;component/Langues/StringResources.fr-FR.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
</Window.Resources>

The code used to access the string ressource in the view
 <TextBlock Text="{DynamicResource Setup}" Margin="10" FontSize="16" Visibility="{Binding Path=LanguageSelectorUIEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"  />

The StringResources.fr-FR.xaml file
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:system="clr-namespace:System;assembly=mscorlib">

    <system:String x:Key="Setup">Choissisez la langue du gestionnaire d'installation</system:String>

A: Modify your window markup to include the merged resource dictionary in the Resources dictionary directly:
<Window.Resources>
    <ResourceDictionary>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/LanguageSelector;component/Langues/StringResources.fr-FR.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

Or merge the ResourceDictionary at application level in App.xaml:
<Application x:Class="WpfApp1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/LanguageSelector;component/Langues/StringResources.fr-FR.xaml"/>
            </ResourceDictionary.MergedDictionaries>
       </ResourceDictionary>
    </Application.Resources>
</Application>


text:
Q: sqlite3_exec()! = SQLITE3_OK. Trying to tranfer in OOP won't work I'm trying to work with a database in C++. I made a  program that opens the database and then creates the tables in procedural programming.
When trying to make it in OOP, sqlite3_exec() != SQLITE_OK
I am new at this, so be gentle.
Here is main.cpp:
#include <iostream>
#include "sqlite3.h"
#include "Table.h"
using namespace std;

int openDatabase(sqlite3 *db);

int main() {
    sqlite3 *db;
    string columnValues, rowValues;   // these are for query
    Table Personal;
    Personal.SettableName("PERSONAL");
    columnValues = "NUME TEXT, ID TEXT";   // this is just an example

    openDatabase(db);

    Personal.createTable(db, columnValues);
    sqlite3_close(db);
    return 0;
}

Table.cpp
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "Table.h"
#include "sqlite3.h"

using namespace std;

static int callback(void *data, int argc, char **argv, char **azColName) {
    int i;
    fprintf(stderr, "%s: ", (const char*)data);

    for(i = 0; i < argc; i++) {
        printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }

    printf("\n");
    return 0;
}

void executeSqlStatement(sqlite3 *db,const char* sql) {
    int rc = 0 ;
    char *zErrMsg = 0;

    rc = sqlite3_exec(db, sql, callback, 0, &zErrMsg);  // Here it doesn't work, rc=21;
    if( rc != SQLITE_OK ) {
        fprintf(stderr, "SQL error: %s\n", zErrMsg);
        sqlite3_free(zErrMsg);
    }
    else {
        fprintf(stdout, "Operation done successfully\n");
    }
}

void Table::createTable(sqlite3 *db, string columnDetails) {
    this->sqlCommand =  "CREATE TABLE ";

    this->sqlCommand += (this->tableName + " (" + columnDetails + ");");
    executeSqlStatement(db, this->sqlCommand.c_str());
    printf(sqlCommand.c_str());
}

And Table.h
#include "sqlite3.h"
using namespace std;
void executeSqlStatement(sqlite3 *db);
static int callback(void *data, int argc, char **argv, char **azColName);
class Table
{
public:
    void SettableName(string val){tableName = val;}
    void createTable(sqlite3 *db, string columnDetails);
    string tableName;
    string sqlCommand;
};

A: Including the sqlite3.h file in all three files is not necessary, as Table.h was included by both the cpp files, so you only needed to have it in that file.
The sqlite3.h file is also a system file, so using include <sqlite3.h> instead of include "sqlite3.h" makes it clearer where the file is coming from.
I would recommend compiling with the -Wall and -Wextra flags - at first they appear to make loads of complaints but it is worth paying attention to the problems reported and working out how to fix them.
Table.h
#include <sqlite3.h>
using namespace std;
void executeSqlStatement(sqlite3 *db);
int callback(void *data, int argc, char **argv, char **azColName);
class Table
{
public:
    void SettableName(string val){tableName = val;}
    void createTable(sqlite3 *db, string columnDetails);
    string tableName;
    string sqlCommand;
};

Table.cpp
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "Table.h"

using namespace std;

 int callback(void *data, int argc, char **argv, char **azColName) {
    int i;
    fprintf(stderr, "%s: ", (const char*)data);

    for(i = 0; i < argc; i++) {
        printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }

    printf("\n");
    return 0;
}

void executeSqlStatement(sqlite3 *db,const char* sql) {
    int rc = 0 ;
    char *zErrMsg = 0;

    rc = sqlite3_exec(db, sql, callback, 0, &zErrMsg);  // Here it doesn't work, rc=21;
    if( rc != SQLITE_OK ) {
        fprintf(stderr, "SQL error: %s\n", zErrMsg);
        sqlite3_free(zErrMsg);
    }
    else {
        fprintf(stdout, "Operation done successfully\n");
    }
}

void Table::createTable(sqlite3 *db, string columnDetails) {
    this->sqlCommand =  "CREATE TABLE ";

    this->sqlCommand += (this->tableName + " (" + columnDetails + ");");
    executeSqlStatement(db, this->sqlCommand.c_str());
    printf(sqlCommand.c_str());
}

main.cpp
#include <iostream>
#include "Table.h"
using namespace std;

int main() {
    sqlite3 *db;
    sqlite3_open_v2("test.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
    string columnValues, rowValues;   // these are for query
    Table Personal;
    Personal.SettableName("PERSONAL");
    columnValues = "NUME TEXT, ID TEXT";   // this is just an example

    Personal.createTable(db, columnValues);
    sqlite3_close(db);
    return 0;
}

On my github I have a working version of your code, with a (borrowed) makefile to pull the files together so I just have to type make debug to compile the code.
make debug && bin/debug/hello

will build the file, and if the compilation was successful run the executable.


text:
Q: How many interface we can declare within a class in java/android How many interface we can declare within a class.
Is this number 65535? if yes then why? if no, what is the limit and why?
Something like:
public class GenericModelLinker {
   public interface Link {
      Object getProperty(IAdaptable n);
      void setProperty(IAdaptable n, Object value);
   }
 // .........so on
}

Thanks in Advance

A: Yes! According to the Official Specifications of the Java Virtual Machine. It seems the fields, methods and nested types info are each stored in some kind of an structure that has a limited size.
If you're asking Why 65535 ? Simply because :

it is the highest number which can be represented by an unsigned
  16-bit binary number

4.11. Limitations of the Java Virtual Machine

The following limitations of the Java Virtual Machine are implicit in
  the class file format:
The per-class or per-interface constant pool is limited to 65535
  entries by the 16-bit constant_pool_count field of the ClassFile
  structure (§4.1). This acts as an internal limit on the total
  complexity of a single class or interface.
The number of fields that may be declared by a class or interface is
  limited to 65535 by the size of the fields_count item of the ClassFile
  structure (§4.1).
Note that the value of the fields_count item of the ClassFile
  structure does not include fields that are inherited from superclasses
  or superinterfaces.
The number of methods that may be declared by a class or interface is
  limited to 65535 by the size of the methods_count item of the
  ClassFile structure (§4.1).
Note that the value of the methods_count item of the ClassFile
  structure does not include methods that are inherited from
  superclasses or superinterfaces.
The number of direct superinterfaces of a class or interface is
  limited to 65535 by the size of the interfaces_count item of the
  ClassFile structure (§4.1).
The greatest number of local variables in the local variables array of
  a frame created upon invocation of a method (§2.6) is limited to 65535
  by the size of the max_locals item of the Code attribute (§4.7.3)
  giving the code of the method, and by the 16-bit local variable
  indexing of the Java Virtual Machine instruction set.
Note that values of type long and double are each considered to
  reserve two local variables and contribute two units toward the
  max_locals value, so use of local variables of those types further
  reduces this limit.
The size of an operand stack in a frame (§2.6) is limited to 65535
  values by the max_stack field of the Code attribute (§4.7.3).
Note that values of type long and double are each considered to
  contribute two units toward the max_stack value, so use of values of
  these types on the operand stack further reduces this limit.
The number of method parameters is limited to 255 by the definition of
  a method descriptor (§4.3.3), where the limit includes one unit for
  this in the case of instance or interface method invocations.
Note that a method descriptor is defined in terms of a notion of
  method parameter length in which a parameter of type long or double
  contributes two units to the length, so parameters of these types
  further reduce the limit.
The length of field and method names, field and method descriptors,
  and other constant string values (including those referenced by
  ConstantValue (§4.7.2) attributes) is limited to 65535 characters by
  the 16-bit unsigned length item of the CONSTANT_Utf8_info structure
  (§4.4.7).
Note that the limit is on the number of bytes in the encoding and not
  on the number of encoded characters. UTF-8 encodes some characters
  using two or three bytes. Thus, strings incorporating multibyte
  characters are further constrained.
The number of dimensions in an array is limited to 255 by the size of
  the dimensions opcode of the multianewarray instruction and by the
  constraints imposed on the multianewarray, anewarray, and newarray
  instructions (§4.9.1, §4.9.2).


text:
Q: Filtering console output containing multiline strings in Xcode I'm printing JSON data that spans multiple lines to the console. I'm prefixing all my messages with a tag and then filtering by that tag to keep things relevant. So my messages look like this with no filter:
TAG: {
"key1": "value1",
"key2": "value2",
...
}

When I filter by TAG, I only see the first line because as far as I can tell, Xcode is just checking line by line instead checking by message.
TAG: {

How can I make Xcode output all the lines in the JSON? Is there a better way than writing my own print function that splits by \n and prefixes each line with TAG? This might not even work because the values might have a \n internally.

A: You can use .description property while printing.
Here is an example
print(yourObject.description)
It prints everything in one line and while doing a filter, you will be able to see everything.
This worked for me. Hope this helps you.


text:
Q: mongodb find largest key inside an item in mongodb I have a mongodb collection that has the following schema
{
  _id: ,
  data: {
       1: {
          values: ...
       },
       3: {
           values: ...
       }
       2: {
          values: ...
       }
   }
}

and I wanted to know if it would be possible to sort the items inside the data object or pick the highest values using core mongodb instead of retrieving them and sorting using javascript.

A: Please read @NeilLunn's comments to the question first
The "possible" yet "impractical" pipeline could be like following:
db.collection.aggregate([
    {$project: {
        data: { $objectToArray: "$data" }
    }},
    {$unwind: "$data"},
    {$sort: {_id:1, "data.k":-1}},
    {$group: {_id:"$_id", data:{$first:"$data"}}},
    {$group: {_id:"$_id", data:{$push:"$data"}}},
    {$project: {
        _id: 1,
        data: { $arrayToObject: "$data" }
    }}
])


text:
Q: discord.py Command for locking all channels takes a long time I have a command on my discord bot that locks channels. Locking a single channel works flawlessly, but when i try to lock all channels in a server, it takes quite a while to do so depending on how many channels there are. Im not really sure if there is a way to speed up the process, but here's my code:
  async def send_m(self, ctx, check: bool):
      for c in ctx.guild.text_channels:
          if c.overwrites_for(ctx.guild.default_role).send_messages != check:
             await c.set_permissions(ctx.guild.default_role, send_messages = check)

  #lock
  @commands.check_any(commands.is_owner(), commands.has_permissions(manage_channels = True), commands.guild_only())
  @_channel.command(name="lock",
                   brief="Locks channel(s).",
                   help="Lock current/all channel(s)"
                   )
  async def _lock(self, ctx, channel=None):
      overwrite = ctx.channel.overwrites_for(ctx.guild.default_role)
      try:
          if channel == None and overwrite.send_messages != False:
              await ctx.channel.set_permissions(ctx.guild.default_role, send_messages = False)
              await ctx.send("Locked.")

          if channel == None and overwrite.send_messages == False:
              await ctx.send("This channel is already locked.")

          if channel == "all":
              await ctx.send(f"This will **lock** *all* channels. Type `{confirm}` to confirm.")
              def check(m):
                  return m.channel.id == ctx.channel.id and m.author.id == ctx.author.id
              try:
                  msg = await self.bot.wait_for("message", timeout=30, check=check)
              except asyncio.TimeoutError:
                  return await ctx.send("Time's up. Aborted.")
              if msg.content.lower() != confirm:
                  return await ctx.send("Aborted.")

              await ctx.send("Locking all channels...")
              await self.send_m(ctx=ctx, check=False)
              await ctx.send("Locked all channels ✅.")
      except Exception as e:
          raise e

As you can see, i tried making it a async function to see if that would help, but it didn't. Am i doing something wrong? Any help would be appreciated!

A: You've written an asynchronous function, but it isn't really running asynchronously.
async def send_m(self, ctx, check: bool):
    for c in ctx.guild.text_channels:
        if c.overwrites_for(ctx.guild.default_role).send_messages != check:
            await c.set_permissions(ctx.guild.default_role, send_messages = check)

await is a blocking operation. When you run send_m, it iterates over the channels and calls c.set_permissions, waiting for each call to complete before moving on to the next.
Instead, you should schedule all of the c.set_permissions calls with the event loop before awaiting anything. One common way to do this is to create a task for each and then gather them.
tasks = []
for c in ctx.guild.text_channels:
    if c.overwrites_for(ctx.guild.default_role).send_messages != check:
        tasks.append(asyncio.create_task(c.set_permissions(ctx.guild.default_role, send_messages=check)))
await asyncio.gather(*tasks)

This will get you the result you want. However, there's no direct benefit to using create_task here since your for loop is synchronous and none of the tasks would be able to start anyway. You can do the same as above but remove the create_task call.
tasks = []
for c in ctx.guild.text_channels:
    if c.overwrites_for(ctx.guild.default_role).send_messages != check:
        tasks.append(c.set_permissions(ctx.guild.default_role, send_messages=check))
await asyncio.gather(*tasks)


text:
Q: Import Excel into mySQL taking too long So, I have a form that allows users to upload an excel sheet and then the system will import that excel data into mySQL.
However, every time I submit the form using AJAX, it starts the process, saves about half of the data, and then gives me a 504 gateway error. I have already changed the PHP config timeout to 300 but it still gives in half way through. I do not think that an excel sheet with a little under 1000 rows should be taking 5+ minutes?
Here is my code:
 public function postImportGroup(Request $request)
{

    if($request->hasFile('import_numbers')) {
       $file = $request->file('import_numbers');
       $file_extension = Input::file('import_numbers')->getClientOriginalExtension();
       $supportedExt = array('csv', 'xls', 'xlsx');

    if (!in_array_r($file_extension, $supportedExt)) {
        return response()->json([
            'status' => 'error',
            'msg' => 'Please make sure that the uploaded file is a valid CSV, XLS, XLSX sheet.',
        ]);
    }

   }

    $results = Excel::load($file)->get();

    $results = json_decode($results[0], true);

    $class = new DailyGroup();
    $class->title = $request->group_name;
    $class->user_id = Auth::guard('client')->user()->id;
    $class->entries = count($results);
    $class->save();

    foreach ($results as $r => $value) {
      //$data = array_values($value);
        //return $value["employee_number"];
      $group = new DailyGroupLocations();

      $address = $value["address"] . ',' . $value["city"] . ',' . $value["state"] . ',' . $value["zip"];
      $c = $value["country"];

      $file_contents = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&components=country:' . urlencode($c) .'&sensor=false&key=xxx');
      $json_decode = json_decode($file_contents);

      if (isset($json_decode->results[0])) {
        $group->lat = $json_decode->results[0]->geometry->location->lat;
        $group->lng = $json_decode->results[0]->geometry->location->lng;
    }
      $phone = preg_replace('/\D+/', '', $value["ph"]);
      $phone = '1'.$phone;

      $group->user_id = Auth::guard('client')->user()->id;
      $group->group_id = $class->id;
      $group->employee_number = $value["employee_number"];
      $group->work_date = $value["work_date"]["date"];
      $group->first_name = $value["name"];
      $group->last_name = $value["lastname"];
      $group->phone = $phone;
      $group->email = $value["email"];
      $group->job_number = $value["job_number"];
      $group->address = $value["address"];
      $group->city = $value["city"];
      $group->state = $value["state"];
      $group->zip = $value["zip"];
      $group->country = $value["country"];
      $group->job_name = $value["job_name"];
      $group->location = $value["location"];
      $group->shift_description = $value["shift_description"];
      $group->shift_start = $value["shift_start_time"];
      $group->shift_end = $value["shift_end_time"];
      $group->post_hours = $value["post_hours"];
      $group->save();
}

        return response()->json([
            'status' => 'success',
            'msg' => 'All data uploaded successfully. Please wait for tables to refresh.',
            //'url' => '/user/location/location-areas'
        ]);
}

Is there anything I can do to optimize this? Am I running to many things in the foreach statement? Any tips or tricks I can use?

A: its Not the excel file taking its time... its the google  geocode call which is blocking your code from executing.
you can get yourself an google api key to speed up your process.
reference: https://developers.google.com/maps/documentation/javascript/get-api-key
you should also Check for the response status of your geocode calls
$status = json_decode->results[0]->status;

possible status values:

*

*OK

*ZERO_RESULTS

*OVER_QUERY_LIMIT

*INVALID_REQUEST

*UNKNOWN_ERROR

if its possible in your case you could consider pre-geocoding your dataset, store the lat and lng values with the address so you do Not have to geocode on the fly if you expect or need a fast execution.