text:
Q: I have downloaded syncfusion, I don't know how to run syncfusion demo code . Please, anyone, know about it. this error occur I have downloaded syncfusion, I don't know how to run syncfusion demo code . Please, anyone, know about it.
this error occur:

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR!
diagrambuilder@0.1.0 start: react-scripts-ts start npm ERR! Exit
status 1 npm ERR! npm ERR! Failed at the diagrambuilder@0.1.0 start
script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Ayushi\AppData\Roaming\npm-cache_logs\2021-01-29T10_14_59_748Z-debug.log

A: In package.json, you need to specify a start script like so:
  "scripts": {
  "start": "<START CODE GOES HERE>"
  },

A: We have checked the customer requirements and he need to add the script in package.json file. Please find the below code snippet.
"scripts": {
    "start": "react-scripts start"
  },

We have created the react sample for your reference. Please find the below link.
Sample: https://www.syncfusion.com/downloads/support/directtrac/313051/7z/react115349736


text:
Q: Shopping cart with hover dropdown I'm uses a previous design of shopping cart, but can't applied the option hover shoppign cart, this its a code example.
My code
$('#cart').hover(function(e) {
    $(".shopping-cart").stop(true, true).addClass("active");
  }, function() {
    $(".shopping-cart").stop(true, true).removeClass("active");
  });

I need the contents of the cart not to disappear until the mouse pointer is out.
Example codepen

See the Pen Shopping Cart Dropdown by Eduardo (@alexd2) on CodePen.

A: use Multiple Selector will solve your issue.
  $('#cart, .shopping-cart').hover(function(e) {
    $(".shopping-cart").stop(true, true).addClass("active");
  }, function() {
    $(".shopping-cart").stop(true, true).removeClass("active");
  });

A: With pure css, you could probably do something like this.

.cart {
background-color: lightblue;
  float: right;
  text-align: right;
  position: relative;
}

.list {

  background-color: lightgreen;
  height: 250px;
  width: 300px;
  border: 2px solid red;
right: 0;
  position: absolute;
  transition: 1s all;
  transform: scale(0) ;
  transform-origin: 100% 0%;
}

.cart:hover > .list {
  transform: scale(1);
}

    This is a cart

      some long list

position: absolute is optional (along with the accompanying css), just that if you don't have it, then the cart will be as long as the child's width, which may or may not be desirable.

A: Just remove "active" from this
$(".shopping-cart").stop(true, true).removeClass("active");

to this one
$(".shopping-cart").stop(true, true).removeClass("");

redpajama_set_name: RedPajamaStackExchange


text:
Q: Making an entire row in GridView a link? I'm trying to make a entire GridView row a link and I think I got it but I'm running into an issue. As you can see from below, all my query strings data is coming from the DB now i want to add a query string that is not coming from the DB, how could I accomplish this??
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {

        string Types = Request.QueryString["Type"].ToString();
        string Rounds = Request.QueryString["Rounds"].ToString();
        string Groups = Request.QueryString["Groups"].ToString();

        string Id = DataBinder.Eval(e.Row.DataItem, "Id").ToString();
        string League = DataBinder.Eval(e.Row.DataItem, "League").ToString();
        string Team1 = DataBinder.Eval(e.Row.DataItem, "Team1").ToString();
        string Team2 = DataBinder.Eval(e.Row.DataItem, "Team2").ToString();
        string Type = DataBinder.Eval(e.Row.DataItem, "TType").ToString();
        string Location = ResolveUrl("Update_Match.aspx" + "?Id=" + Id + "&Team1=" + Team1 + "&Team2=" + Team2 + "&League=" + League + "&Type=" + Type + "&Types=" + Types + "&Rounds=" + Rounds + "&Groups=" + Groups);
        e.Row.Attributes["onClick"] = string.Format("javascript:window.location='{0}';", Location);
        e.Row.Style["cursor"] = "pointer";
    }
}

A: I rewrote this a bit to try to understand your questions better.  It's more verbose than you might want, but it will make it clearer.  All you need to do is build a querystring from a number of elements, some of which come from your database, some from your prior page, and others may be hardcoded.  That's all simple.  Just assign each variable in the querystring its value first, then build the string.
For example, suppose you are grabbing the team name from the database using the ID like this:
String Team1 = db.Teams.Where(w => w.TeamID = TeamID).First().TeamName;

and you are setting the Type as a hardcoded value:
Int type = 0;

When you are done building your variables, just put them together like this:
string QS = "Id=" + ID.ToString();
QS = QS + "&Team1=" + Team1;
QS = QS + "&Team2=" + Team2;
QS = QS + "&League=" + League;
QS = QS + "&Type=" + Type.ToString();
QS = QS + "&Types=" + Types;
QS = QS + "&Rounds=" + Rounds.ToString();
QS = QS + "&Groups=" & Groups.ToString();
e.Row.Cells[0].Visible = false;e.Row.Attributes.Add("onclick", "location='newpage.aspx?" + sQueryString;
e.Row.Attributes.Add("style", "cursor:pointer;");

It doesn't matter how you acquire each value as long as they are converted into strings to build the querystring.  Is there something more I'm missing?

A: It looks like your code should work.  Do you get any script errors when you try to load the page?
Also, what browser are you testing this with?
I would try making the "c" in onClick lowercase to start with.
In addition to that, I would consider revising your code a bit because it appears as though you would be vulnerable to a cross site scripting attack because you are not cleaning the QueryString before putting it in the attribute.
An attacker could exploit this by modifying the queryString of the page to say:
http://www.yourpage.com/index.aspx?otherQueryString=3&Groups=<script>window.alert("Hello XSS!!");</script>


text:
Q: Problem in updating an XML file using PHP DOMDocument(); I am trying to write a function that updates the Site Map of a website or technically adds an entry to sitemap.xml file. The standard structure of a Google sitemap can be seen here: http://www.sitemappro.com/google-sitemap.html
Following is the code of that function:
function AddEntry($loc,$lastmod,$changefreq,$priority){

$xmlDoc = new DOMDocument();
$xmlDoc->load("sitemap.xml");

$url []=array('loc' => $loc, 'lastmod' => $lastmod, 'changefreq'=> $changefreq, 'priority' =>$priority );

$r=$xmlDoc->createElement("url");

$xmlDoc->appendChild($r);

foreach($url as $key=>$value)
{
    $r->appendChild($xmlDoc->createElement($key))->appendChild($xmlDoc->createTextNode($value));

}

$xmlDoc->save();
}

The above code is not working and giving this error:
"Fatal error: Uncaught exception 'DOMException' with message 'Invalid Character Error' in..."
Can you please help by correcting my code? Thanks in advance.

A: As pointed out in a comment the issue should be in this line
    $r->appendChild($xmlDoc->createElement($key))->appendChild($xmlDoc->createTextNode($value));

Most likely you're adding some url characters to your XML. The problem is that you must escape them or surround your $value with a CDATA section. Otherwise the generated XML will be invalid and the xml library will throw that kind of exceptions.
P.S. I don't remember if the htmlentities function is good also for xml, I suppose that, but you'll need to investigate about that.


text:
Q: Compiling Xoopic from PTSG errors As you can see below, I am having errors with hdf5.h fftw.h and dfttw.h. None of those are being found and I have specified there locations except dfttw.h since I cannot find this anywhere.
I am also having tremendous amounts of version errors but I cannot seem to find exactly what versions are needed.
~/Documents/xoopic$ TCL_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/ TK_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/ ./configure --with-tclsh=/usr/bin/tclsh8.5 --with-tclconfig=/usr/lib/tcl8.5 --with-tkconfig=/usr/lib/tk8.5 --with-tclhdir=/usr/include/tcl8.5 --with-tkhdir=/usr/include/tcl8.5 --with-sfftw-incdir=/usr/include/sfftw.h --with-hdf5-incdir=/usr/include/hdf5/serial/hdf5.h
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
using HDF5? ... yes
checking for hdf5.h... no
configure: WARNING: hdf5.h not found in /usr/include/hdf5/serial/hdf5.h.  Use --with-hdf5-incdir=
grep: /usr/include/hdf5/serial/hdf5.h/H5pubconf.h: Not a directory
Failed to find serial build of HDF5 in obvious location. Setting _SERIAL vars
to be the same as the parallel vars so as not to break the vpdatanal builds.
configure: WARNING: hdf5 not properly installed -- Turning off hdf5.
Using C++ compiler g++
Using C compiler gcc
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking whether time.h and sys/time.h may both be included... yes
checking for BSD-compatible nm...
install-sh/usr/bin/nm -B
Setting the flags per system and C++ compiler: g++
checking for g++... /usr/bin/g++
Serial C++ compiler is `g++'
checking g++ version... g++
configure: WARNING: Caution: version  is not known to work.
checking for -fsquangle... no
checking how to build libraries... with ar cr
checking for gcc... /usr/bin/gcc
Serial C compiler is `gcc'
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking iostream usability... yes
checking iostream presence... yes
checking for iostream... yes
checking strstream usability... yes
checking strstream presence... yes
checking for strstream... yes
checking fstream usability... yes
checking fstream presence... yes
checking for fstream... yes
checking sstream usability... yes
checking sstream presence... yes
checking for sstream... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
Calling config/macros.m4
Calling config/cxx.m4
checking whether c++ compiler supports exception handling... yes
checking whether c++ compiler supports typename... yes
checking whether c++ compiler can explicitly instantiate templates... yes
checking whether c++ compiler supports RTTI... yes
checking whether c++ compiler supports namespaces... yes
checking whether c++ compiler has complex in the namespace std... yes
checking whether c++ compiler has streams in the namespace std... yes
checking whether c++ compiler can overload const type conversions... yes
checking whether c++ compiler knows mutable... yes
checking whether template friends need brackets... yes
checking whether nontype template operators are allowed... no
checking whether static variables can be declared generally... yes
config/cxx.m4 finished
checking whether make sets $(MAKE)... (cached) yes
checking whether ln -s works... yes
checking for ranlib... ranlib
checking what the library suffix is... .a
checking how to install libraries... with ${INSTALL} -m 644
configure: WARNING: x11.m4 is obsolete.  Please use AC_PATH_X or AC_PATH_XTRA.
checking for X11/Xlib.h... /usr/include/X11/Xlib.h
checking for libX11.a... /usr/lib/x86_64-linux-gnu/libX11.a
checking for libXpm.a... /usr/lib/x86_64-linux-gnu/libXpm.a
checking for libXGC250.a... /usr/local/lib/libXGC250.a
checking for xgrafix.h... /usr/local/include/xgrafix.h
checking for xgscalar.h... /usr/local/include/xgscalar.h
checking for SCALAR in /usr/local/include/xgscalar.h... #define SCALAR double
checking for tclsh... /usr/bin/tclsh8.5
checking for tclConfig.sh... /usr/lib/tcl8.5/tclConfig.sh
checking for tkConfig.sh... /usr/lib/tk8.5/tkConfig.sh
checking for libtcl8.5.a... /usr/lib/x86_64-linux-gnu/
checking for libtk8.5.a... /usr/lib/x86_64-linux-gnu/
checking for up-to-date Tcl version in tcl.h... 8.5
Warning: The Tcl version in /usr/include/tcl8.5/tcl.h is not in the legal Tcl versions list!
tcl_version:  NONE
TCL_MAJOR_VERSION:  8
TCL_MINOR_VERSION:  5
checking for up-to-date Tk version in tk.h... 8.5
Warning: The Tk version in /usr/include/tcl8.5/tcl.h is not in the legal Tk versions list!
tk_version:  NONE
TK_MAJOR_VERSION:  8
TK_MINOR_VERSION:  5
Checking for fftw...
checking for dfftw.h... no
configure: WARNING: dfftw.h not found in /home/nickallen/include:/usr/local/fftw/include:/loc/fftw/include:/local/fftw/include:/usr/common/usg/include:/usr/include.  Set location with --with-dfftw-incdir=
checking for sfftw.h... no
configure: WARNING: sfftw.h not found in /usr/include/sfftw.h.  Set location with --with-sfftw-incdir=
Making Makefiles
configure: creating ./config.status
config.status: creating Makefile
config.status: creating otools/Makefile
config.status: creating advisor/Makefile
config.status: creating physics/Makefile
config.status: creating xg/Makefile
config.status: creating config/Makefile
config.status: creating ./config.h
config.status: ./config.h is unchanged
config.status: executing depfiles commands

I fixed the problems related to fftw.h, dfftw.h, and hdf5. The only question I have left is that is does not find gawk and h5diff. Do you know if this will effect it in any way?
        ~/Documents/xoopic$ TCL_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/ \
> TK_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/  \
> ./configure \
> --with-tclsh=/usr/bin/tclsh8.5 \
> --with-tclconfig=/usr/lib/tcl8.5 \
> --with-tkconfig=/usr/lib/tk8.5 \
> --with-tclhdir=/usr/include/tcl8.5 \
> --with-tkhdir=/usr/include/tcl8.5 \
> --with-dfftw-incdir=/usr/local/include \
> --with-sfftw-incdir=/usr/include \
> --enable-hdf5 \
>  --with-hdf5-incdir=/usr/include/hdf5/serial \
>  --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
using HDF5? ... yes
checking for hdf5.h... /usr/include/hdf5/serial/hdf5.h
checking for libhdf5.a... /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a
checking for h5diff... no
Using C++ compiler g++
Using C compiler gcc
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking whether time.h and sys/time.h may both be included... yes
checking for BSD-compatible nm...
install-sh/usr/bin/nm -B
Setting the flags per system and C++ compiler: g++
checking for g++... /usr/bin/g++
Serial C++ compiler is `g++'
checking g++ version... g++
configure: WARNING: Caution: version  is not known to work.
checking for -fsquangle... no
checking how to build libraries... with ar cr
checking for gcc... /usr/bin/gcc
Serial C compiler is `gcc'
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking iostream usability... yes
checking iostream presence... yes
checking for iostream... yes
checking strstream usability... yes
checking strstream presence... yes
checking for strstream... yes
checking fstream usability... yes
checking fstream presence... yes
checking for fstream... yes
checking sstream usability... yes
checking sstream presence... yes
checking for sstream... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
Calling config/macros.m4
Calling config/cxx.m4
checking whether c++ compiler supports exception handling... yes
checking whether c++ compiler supports typename... yes
checking whether c++ compiler can explicitly instantiate templates... yes
checking whether c++ compiler supports RTTI... yes
checking whether c++ compiler supports namespaces... yes
checking whether c++ compiler has complex in the namespace std... yes
checking whether c++ compiler has streams in the namespace std... yes
checking whether c++ compiler can overload const type conversions... yes
checking whether c++ compiler knows mutable... yes
checking whether template friends need brackets... yes
checking whether nontype template operators are allowed... no
checking whether static variables can be declared generally... yes
config/cxx.m4 finished
checking whether make sets $(MAKE)... (cached) yes
checking whether ln -s works... yes
checking for ranlib... ranlib
checking what the library suffix is... .a
checking how to install libraries... with ${INSTALL} -m 644
configure: WARNING: x11.m4 is obsolete.  Please use AC_PATH_X or AC_PATH_XTRA.
checking for X11/Xlib.h... /usr/include/X11/Xlib.h
checking for libX11.a... /usr/lib/x86_64-linux-gnu/libX11.a
checking for libXpm.a... /usr/lib/x86_64-linux-gnu/libXpm.a
checking for libXGC250.a... /usr/local/lib/libXGC250.a
checking for xgrafix.h... /usr/local/include/xgrafix.h
checking for xgscalar.h... /usr/local/include/xgscalar.h
checking for SCALAR in /usr/local/include/xgscalar.h... #define SCALAR double
checking for tclsh... /usr/bin/tclsh8.5
checking for tclConfig.sh... /usr/lib/tcl8.5/tclConfig.sh
checking for tkConfig.sh... /usr/lib/tk8.5/tkConfig.sh
checking for libtcl8.5.a... /usr/lib/x86_64-linux-gnu/
checking for libtk8.5.a... /usr/lib/x86_64-linux-gnu/
checking for up-to-date Tcl version in tcl.h... 8.5
Warning: The Tcl version in /usr/include/tcl8.5/tcl.h is not in the legal Tcl versions list!
tcl_version:  NONE
TCL_MAJOR_VERSION:  8
TCL_MINOR_VERSION:  5
checking for up-to-date Tk version in tk.h... 8.5
Warning: The Tk version in /usr/include/tcl8.5/tcl.h is not in the legal Tk versions list!
tk_version:  NONE
TK_MAJOR_VERSION:  8
TK_MINOR_VERSION:  5
Checking for fftw...
checking for dfftw.h... /usr/local/include/dfftw.h
checking for libdfftw.a... /usr/local/lib/libdfftw.a
checking for sfftw.h... /usr/include/sfftw.h
checking for libsfftw.a... /usr/lib/libsfftw.a
Making Makefiles
configure: creating ./config.status
config.status: creating Makefile
config.status: creating otools/Makefile
config.status: creating advisor/Makefile
config.status: creating physics/Makefile
config.status: creating xg/Makefile
config.status: creating config/Makefile
config.status: creating ./config.h
config.status: ./config.h is unchanged
config.status: executing depfiles commands

After fixing the h5diff issue, I moved onto make which ran into many more problems with hdf5.
    ~/Documents/xoopic$ make
make  all-recursive
make[1]: Entering directory '/home/nickallen/Documents/xoopic'
Making all in otools
make[2]: Entering directory '/home/nickallen/Documents/xoopic/otools'
g++ -DHAVE_CONFIG_H -I. -I../. -I../advisor -I../physics -I../otools -I../otools -I../config  -I/usr/local/include  -I/usr/local/include  -I/usr/include/hdf5/serial    -Wall -Wno-unused  -g -O2 -pipe -g -O2 -pipe   -DUNIX  -DSCALAR_DOUBLE   -c -o dumpHDF5.o dumpHDF5.cpp
dumpHDF5.cpp: In member function 'void dumpHDF5::readSimple(std::string, double*, int&)':
dumpHDF5.cpp:126:46: error: too few arguments to function 'hid_t H5Dopen2(hid_t, const char*, hid_t)'
   datasetId = H5Dopen(fileId,dataPath.c_str());
                                              ^
In file included from /usr/include/hdf5/serial/hdf5.h:27:0,
                 from dumpHDF5.h:20,
                 from dumpHDF5.cpp:12:
/usr/include/hdf5/serial/H5Dpublic.h:123:14: note: declared here
 H5_DLL hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id);
              ^
dumpHDF5.cpp: In member function 'void dumpHDF5::writeSimple(std::string, double*, int, int*)':
dumpHDF5.cpp:161:84: error: too few arguments to function 'hid_t H5Dcreate2(hid_t, const char*, hid_t, hid_t, hid_t, hid_t, hid_t)'
  datasetId = H5Dcreate(fileId, dataPath.c_str(), h5Scalar, dataspaceId, H5P_DEFAULT);
                                                                                ^
In file included from /usr/include/hdf5/serial/hdf5.h:27:0,
                 from dumpHDF5.h:20,
                 from dumpHDF5.cpp:12:
/usr/include/hdf5/serial/H5Dpublic.h:119:14: note: declared here
 H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
              ^
Makefile:484: recipe for target 'dumpHDF5.o' failed
make[2]: *** [dumpHDF5.o] Error 1
make[2]: Leaving directory '/home/nickallen/Documents/xoopic/otools'
Makefile:389: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nickallen/Documents/xoopic'
Makefile:327: recipe for target 'all' failed
make: *** [all] Er

ror 2

A: Note: the underlying issue is likely that the configuration of the software you are trying to build is based on an out-of-date version of the GNU autotools system. The right way to fix it is probably to modify the scripts and regenerate a more appropriate ./configure script: if I understand the process correctly, autoreconf should help with this, but seems to cause more problems than it fixes. The following is really a hack at best.

As far as I know, the s and d prefixes of fftw just denote single- and double-precision.
At least in current versions of Ubuntu, while the single-precision development headers and libraries are packaged as sfftw-dev, the (default) double-precision development package is simply called fftw-dev and the corresponding header files and libraries also lack the d prefix.
I think an acceptable workaround is to simply symlink the missing files e.g. (you don't have to use /usr/local here - I just think it makes a cleaner distinction):
sudo ln -s /usr/include/fftw.h /usr/local/include/dfftw.h
sudo ln -s /usr/include/rfftw.h /usr/local/include/drfftw.h

and
sudo ln -s /usr/lib/libfftw.a /usr/local/lib/libdfftw.a
sudo ln -s /usr/lib/libfftw.so /usr/local/lib/libdfftw.so

sudo ln -s /usr/lib/librfftw.a /usr/local/lib/libdrfftw.a
sudo ln -s /usr/lib/librfftw.so /usr/local/lib/libdrfftw.so

and then following your example above,
TCL_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/ TK_LIBDIR_PATH=/usr/lib/x86_64-linux-gnu/ ./configure \
  --with-tclsh=/usr/bin/tclsh8.5 \
  --with-tclconfig=/usr/lib/tcl8.5 \
  --with-tkconfig=/usr/lib/tk8.5 \
  --with-tclhdir=/usr/include/tcl8.5 \
  --with-tkhdir=/usr/include/tcl8.5 \
  --with-sfftw-incdir=/usr/include \
  --with-dfftw-incdir=/usr/local/include \
  --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu

At least, I was able to build the xoopic binary on 64-bit Ubuntu 14.04 this way - although I only tested it using ./xoopic --help since I'm not familiar with the program's proper usage.

I don't think failure to find gawk should be an issue, since it seems to be happy with mawk; however you can install gawk from the repository if you wish - IIRC it will set itself as the system-wide default awk although you can easily set it back to mawk via update-alternatives.
I didn't have h5diff either when I did the apparently successful build, but you can obtain it by installing hdf5-tools. I found that it was still necessary to add a shell variable definition H5DIFF=/usr/bin/h5diff to the ./configure command line in order to get the script to find it.

A: Simply install the right packages:
sudo apt-get install sfftw-dev
sudo apt-get install libhdf5-dev

A:
sudo apt-get install apt-file
sudo apt-file update
apt-file search -x /hdf5.h$

should yield

libflann-dev: /usr/include/flann/io/hdf5.h
libhdf5-dev: /usr/include/hdf5/serial/hdf5.h
libhdf5-mpich-dev: /usr/include/hdf5/mpich/hdf5.h
libhdf5-openmpi-dev: /usr/include/hdf5/openmpi/hdf5.h
libopencv-flann-dev: /usr/include/opencv2/flann/hdf5.h

I have no idea which one of those you want, but libhdf5-dev sounds like a good bet.
Repeat as necessary.


text:
Q: Odd Problem With window.close() I have an odd problem with window.close() or self.close() (Both create the same issue). I have a window that pops up when a link is clicked, a simple form is submitted then a button is shown that when clicked closes the window using the aforementioned method. This works fine, the problem I'm having is when this is performed multiple times. After 10 - 20 times of performing this task the pop up window no longer loads (It's not hitting any code within the pop up, not even the Page_PreInit). The problem doesn't occur in Firefox or Safari, only IE. It's definatly linked to window.close() as if the window is closed using the X in the top right corner everything works fine. Any ideas what might be causing this? Is it an IE bug?

A: Did you check the memory footprint of Internet Explorer while you were doing your tests? Because your problem might be a memory leak problem: http://msdn.microsoft.com/en-us/library/bb250448%28VS.85%29.aspx .
If this is the case, this page can help you: http://www.outofhanwell.com/ieleak/index.php?title=Fixing_Leaks


text:
Q: AJAX - Delay time between displaying AJAX results I have a search feature which uses an AJAX request to get data from my web-server.
I want to have a fade in animation which gets applied to each search result, with a slight delay so the last result fades in last (i.e. the first result loads, starts fading in, next one loads, starts fading in, etc.).
I have the code which loads the html into the search results area, but it seems like the results are displaying and running their "fade-in-animation" at the same time - although this could also be due to the fact that my computer is too slow.
Here's me code:
JS
$.ajax({
  type: 'GET',
  url: '/PersonSearch',
  data: {
    'search_value': search
  },
  dataType: 'json',
})
.done(function(json) {
  $('#main').html('');
  $.each(json, function(key, value) {
    var search = $('
', {
       id: 'search' + key,
       'class': 'search-item off',
       html:
        '
' +
          '' + value.First_name + '' +
          ' ' +
          '' + value.Last_name + '' +
        '
' +
        '
' +
          '' + 'PHONE: ' + value.Phone_number + '' +
          '' + 'EMAIL: ' + value.Email_address + '' +
          '

' +
        '
'
    }).appendTo('#main');
    setTimeout(function() {
      search.removeClass('off');
    });
  });
});

CSS
.search-item.off{
  opacity: 0;
  top: 8px;
}
.search-item{
  overflow: hidden;
  position: relative;
  opacity: 1px;
  top: 0;
  transition: .75s;
}

HTML

Basically what the code does (so you do not need to piece it together yourself) is it adds the search result which has the class of search-item off, and once the
 is loaded (using setTimeout()) it removes the off class, which then uses the transition CSS attrib to make it fade in over time.
I tried using setTimeout() on the .appendTo('#main') but that did not work.
I need it so that there is a delay in posting each of the search results in the #main element so that there is a delay in running the fade in animation.

A: Your idea could work, but you need to add a little delay to your call to setTimeout. The delay must be increased for each new result. To be sure that it is working, use a long delay at first (1000, ie. 1 second) then adjust with lover values as desired.
setTimeout(function() { ... }, 1000 * index);

Below is a simple snippet that illustrate the use of setTimeout to delay the successive calls to append

$(function() {
  var $container = $('#container');
  $.each(['foo', 'bar', 'qux'], function(i, value) {
    setTimeout(function() {
      $container.append('
' + value + '
');
    }, 1000 * i);
  });
});

A: try use
setTimeout(function() { ... }, 0);

It will wait that your content is fully loaded.

A: This happens because setTimeout works asynchronously which means these setTimeout functions will start at 5ms, 10ms, 13ms, etc. and fire off at similar times as well. What you can do is define a timeout variable above ajax call and increase timeout at each call before setTimeout and give this timeout variable as the timeout value to the setTimeout. Following is an example (I know too much timeout):

var timeout = 0;
$('div').each(function() {
  var $this = $(this);
  timeout += 1000;
  setTimeout(function() {
    $this.hide('slow');
  }, timeout);
});

1

2

3

4

5

A: Try using the timeout in the callback of the $.each() function.
$.each(json, setTimeout(function(key, value) {...},1000) )


text:
Q: How does one properly define "quot" as a single function? As an example, I'm trying to define quot in a single function.  I'm struggling to see how to do so without appending an extra parameter (in this case, a counter).
quot x y n
  | x < y = n
  | otherwise = quot (x-y) y (n+1)

quot0 x y = x y 0

I've run into this problem multiple times and continue to use this ad hoc solution, while I know there must be an easy way to incorporate the n implicitly.

A: You use a local binding, either with where
myQuot :: Int -> Int -> Int
myQuot x y = go x 0
  where
    go x n
       | x < y     = n
       | otherwise = go (x - y) (n + 1)

or let … in …:
myQuot2 :: Int -> Int -> Int
myQuot2 x y =
  let
    go x n
       | x < y     = n
       | otherwise = go (x - y) (n + 1)
  in go x y 0

Alternatively, you provide both functions but write an easy to use wrapper for your users:
myQuotImp x y n = if x < y then n else myQuout (x - y) y (n + 1)

myQout3 :: Int -> Int -> Int
myQout3 x y = myQuotImp x y 0

A: quot x y | x < y = 0
         | otherwise = 1 + quot (x-y) y


text:
Q: How do I detect whether user accepts or rejects call prompt on iOS? On iOS, when I do call me, the prompt will pop up.
How do I detect in javascript whether user cancels or accepts to make the call?
onBlur and onFocus doesn't get fired on iOS.
Thanks.

A: Short answer
No, this is not possible from a web page. It may be possible if you create an native application, by using custom prompt.
Long answer
This prompt is in response to the 911 exploit.
https://9to5mac.com/2017/03/06/911-ios-exploit/
You can see it added in 10.3 Release notes
https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/
The behaviour is further explained in https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html

The tel URL scheme is used to launch the Phone app on iOS devices and
  initiate dialing of the specified phone number. When a user taps a
  telephone link in a webpage, iOS displays an alert asking if the user
  really wants to dial the phone number and initiates dialing if the
  user accepts. When a user opens a URL with the tel scheme in a native
  app, iOS 10.3 and later displays an alert and requires user
  confirmation before dialing. (When this scenario occurs in versions of
  iOS prior to 10.3, iOS initiates dialing without further prompting the
  user and does not display an alert, although a native app can be
  configured to display its own alert.)

According to RFC 3966: 11. Security Considerations

Web clients and similar tools MUST NOT use the "tel" URI to place
  telephone calls without the explicit consent of the user of that
  client.  Placing calls automatically without appropriate user
  confirmation may incur a number of risks, such as those described
  below:
o  Calls may incur costs.
o  The URI may be used to place malicious or annoying calls.
o  A call will take the user's phone line off-hook, thus preventing
        its use.
o  A call may reveal the user's possibly unlisted phone number to the
        remote host in the caller identification data and may allow the
        attacker to correlate the user's phone number with other
        information, such as an e-mail or IP address.

Also see Suppressing the native dialog when clicking on a tel: link


text:
Q: Eliminate $t$ to give an equation that relates $x$ and $y$ I am having problems understanding how to solve the following parametric equation. I have achieved an answer, but am unsure if my answer is correct or not.
Eliminate t to give an equation that relates x and y:
$x= \sec(t)$, $y=\tan^2(t)-2$
must solve for:
$y=$
My solution
$t = \sec^{-1}(x)$
Insert this value of $t$ in the equation for $y$.
$y=\tan^2(\sec^{-1}(x))-2$
Supplementary notes: for a point on the the curve:
$f(t)= \sec(t)$
$g(t)=\tan^2(t)-2$
where $z$ is some number
$P_{point}(f(z),g(z))$
Please confirm or reject my answer.

A: From "supplementary notes" onwards I don't quite understand. An easier way is using that $\tan^2t + 1 = \sec^2t$, so that: $$y = \tan^2t-2 = 1+\tan^2t - 3 = \sec^2t - 3 = x^2-3.$$

A: I will add another answer, because the method is so useful for any calculus problem involving trig substitutions or anything of the sort. (You will not need to remember any trig identities based on the Pythagorean Theorem.)
Starting off with $x = \sec t$, construct a right-triangle have the appropriate side lengths (here hypotenuse=$x$, adjacent=$1$) and determine the "other" side length using the Pythagorean Theorem.
Then simply read the values of other trig functions from the triangle by their definitions:
$\tan t = \dfrac{opposite}{adjacent} = \sqrt{x^2-1}$
so
$\tan^2 t = x^2-1$

A: The identity $\color{blue}{\sec^2t=\tan^2t+1}$ imply
$$y+2=\tan^2t=\sec^2 t-1=x^2-1$$

A: $\cos^{2} t+\sin^{2} t =1$, so $1+\tan^{2}t = \sec^{2}t$ so $y+3=x^{2}$


text:
Q: React Leaflet Polyline with arrow Head Issues I am using react Leaflet. I try to implement it with a polyline with an arrowhead.
it showing the following error.

1.TypeError: Cannot read property 'addLayer' of undefined at t.n.componentDidMount (MapLayer.js:40)
2.TypeError: Cannot read property 'leafletElement' of undefined at a.value (Polyline.js:8)
3.TypeError: Cannot read property 'removeLayer' of undefined at t.n.componentWillUnmount (MapLayer.js:61)

here I add my Maplayer.js and Polyline.js also
MapLayer.js
import type { Layer } from 'leaflet'
import React, { Fragment } from 'react'

import { LeafletProvider } from './context'
import MapComponent from './MapComponent'
import type { LeafletContext, MapLayerProps } from './types'

export default class MapLayer<LeafletElement: Layer,Props: MapLayerProps,>
extends MapComponent<LeafletElement, Props> {
  contextValue: ?LeafletContext
   leafletElement: LeafletElement

 constructor(props: Props) {
 super(props)
 this.leafletElement = this.createLeafletElement(props)
}

get layerContainer(): Layer {
return this.props.leaflet.layerContainer || this.props.leaflet.map
 }

createLeafletElement(_props: Props): LeafletElement {
 throw new Error('createLeafletElement() must be implemented')
}

updateLeafletElement(_fromProps: Props, _toProps: Props) {}

componentDidMount() {
super.componentDidMount()
this.layerContainer.addLayer(this.leafletElement)
}

componentDidUpdate(prevProps: Props) {
super.componentDidUpdate(prevProps)

if (this.props.attribution !== prevProps.attribution) {
  const { map } = this.props.leaflet
  if (map != null && map.attributionControl != null) {
    map.attributionControl.removeAttribution(prevProps.attribution)
    map.attributionControl.addAttribution(this.props.attribution)
  }
}

this.updateLeafletElement(prevProps, this.props)
}

componentWillUnmount() {
super.componentWillUnmount()
this.layerContainer.removeLayer(this.leafletElement)
}

 render() {
  const { children } = this.props
  if (children == null) {
   return null
 }
  return this.contextValue == null ? (
  <Fragment>{children}</Fragment>
   ) : (
  <LeafletProvider value={this.contextValue}>{children}</LeafletProvider>
  )
  }
 }

Polyline.js
import React from 'react'
import { Polyline } from 'react-leaflet'
import 'leaflet-arrowheads'

class ArrowheadsPolyline extends React. Component{

 componentDidMount(){
  const polyline = this.polylineRef.leafletElement
  if (this.props.arrowheads){
     polyline.arrowheads(this.props.arrowheads)
     polyline._update()
  }
 }
 componentWillUnmount(){
  if (this.props.arrowheads){
     const polyline = this.polylineRef.leafletElement
     polyline.deleteArrowheads()
  }
  }
  render(){
  return(
     <Polyline {...this.props} ref={polylineRef => this.polylineRef = polylineRef} />
  )
  }

}

export default ArrowheadsPolyline

and my map component is like
<Map <Polyline positions={ [coordinates] } arrowheads /> />

If you guys have any idea please let me know


text:
Q: Removing a cavity from inside a resistor Suppose we have a resistor of resistance R.
We build a new one by removing a cavity A from inside it, and this new resistor has resistance $R_A$. This cavity can be a sphere or similar region.
We then build a third one by not removing region A but by removing another cavity B from inside a resistor like the original, and this new resistor has resistance $R_B$. We also have that A and B are disjoint regions.
We now build a fourth one by removing both region A and B from inside a resistor like the original, and this gives resistance $R_{AB}$.
My question is, is there any (very) approximate relationship $f(R,R_A,R_B)=R_{AB}$ ?

A: Let's think about this a little. If you remove a serial slice, you can almost think of a resistor as a sequence of serial resistors. Let's make it out of 3 slices:
$$R=R_x+R_y+R_z$$
now for A case, replace $R_y$ by $R_y'$ (bigger resistance because this slice has a cavity now), and for B, replace $R_z$:
$$R_A=R_x+R_y'+R_z$$
$$R_B=R_x+R_y+R_z'$$
Now we seek
$$R_{AB}=R_x+R_y'+R_z'=R_A+R_B-R$$
This will work reasonably well if the cavities don't overlap, and they are far enough apart, so that curving current around one cavity doesn't affect the current flow around the other cavity.
Now think about the case where the holes are in parallel. There, you have
$$\frac1{R_{AB}}=\frac1{R_A}+\frac1{R_B}-\frac1{R}$$
This is not quite the same, so when does which of them apply? Which approximation is better? That we can partition the resistor into parts with cavities and parts without in parallel or serially? This depends on the shape and position of the holes. There are certainly cases where none of the above apply (if the holes overlap a little both in longitudinal and transverse projection, or if the holes are of strange shapes).
If the holes are small and far apart, both approximations should give approximately the same result, as they are just two different types of averaging (arithmetic and harmonic average). This ultimately gives you a very good approximation of the real result - compute both averages and approximate the error with the difference between them.

A:
I shall assume that you are talking about a carbon resistor. A carbon resistor can be treated as a wire with high specific resistance (resistivity).
Hence, the popular wire resistance formula will work,
$$R = \rho \frac{l}{A}$$
where $\rho$ is the specific resistance, $l$ is the length of the wire and $A$ is the area of the cross-section of the wire.
If you remove a section of the resistor of area $A_1$, the resistance of the resistor will change as follows
$R = \rho \frac{l}{A - A_1}$
The resistance of the resistor $R_A$ will be,
$R_A = \rho \frac{l}{A_1}$
Similarly, you can do the same for resistor B.
You can now solve for a relation between the resistances.
The question is unclear as of now. I am not quite sure if you are removing a part of resistor to make resistor A then remove another part of the resistor A or remove it from the old resistor or a completely new resistor

A: Your resistor $R$ is actually three resistors in parallel:

*

*The region which lies within the cavity $A$.

*The region which lies within the cavity $B$.

*The region which lies within neither $A$ nor $B$.
$R$ is $R_1$ and $R_2$ and $R_3$ in parallel.
$R_A$ is $R_2$ and $R_3$ in parallel.
$R_B$ is $R_1$ and $R_3$ in parallel.
$R_{AB}$ is $R_3$ on its own.
From here, you can work it out for yourself.

*

*$R$ and $R_A$ will, with appropriate (and simple) algebra, give you the value of $R_1$.

*$R$ and $R_B$ will, with appropriate (and simple) algebra, give you the value of $R_2$.

*$R$ and $R_1$ and $R_2$ will, with appropriate (and simple) algebra, give you the value of $R_3$ (which equals $R_{AB}$).

*So will $R_A$ and $R_2$.

*So will $R_B$ and $R_1$.
The fact that you have three ways of getting to the same answer means that you can confirm your calculations by using all three methods. If the answers are different, you have gone wrong somewhere.

A: In general the answer must be "no".
Here is a simple thought process: cavity A occupies one half of the resistor's cross section; cavity B occupies the other half. If you take away the material of both A and B you will have an open circuit.


text:
Q: application for mobile devices there are so many platfroms mac/Andriod/windows. can we make one application which will work on all platform  I don't want make seperate binaries for all platforms. will j2me help us in achieving this?

A: Web application based on HTML 5

A: The opinion of this does not sound very high from what I have herd.
There are options such as PhoneGap (based on HTML5). There are others also on the market.
There are compilers which can build native applications for most platforms by adobe (flash & flex based).


text:
Q: How to verify icon's presence in statusBar of Android with Selenium? I need to write code (Java, Selenium) that verifies icon's presence in Android status bar. For instance, after enabling airplane mode, a plane icon appears. But I can't figure out how to do this, what selectors should be used? Appium desktop doesn't seem to work with the status bar and 'adb shell dumpsys statusbar' also gives no useful info. I have written verifications of the elements in the notification bar, quick options, etc, but I'm stuck at finding about status bar icons. Please help.

A: So, I've found a way to verify it via dumpsys of  systemUIservice. The code looks like this:
    public static boolean validateAirplaneModeBySystemUIService(DeviceAng deviceAng) throws Exception {
    String systemUIService = "activity service SystemUIService";
    return deviceAng.getADB().shell().dumpsys().service(systemUIService, "mAirplaneMode=true").GetBoolean()
            && deviceAng.getADB().shell().dumpsys().service(systemUIService,
            "icon=StatusBarMobileView(slot=mobile state=MobileIconState").GetString().contains("visible=false")
            && deviceAng.getADB().shell().dumpsys().service(systemUIService,
            "icon=StatusBarIconView(slot=airplane icon=StatusBarIcon").GetString().contains("visible user=0");
}


text:
Q: How can I make a CSS border line
How can I establish a height property for the border-right (of the left section with social buttons)?
I created this modal window using the grid.
Here is snippet of my html code:
    <form class="form">

Log in to the Site

            <button class="facebook">

                Log in with Facebook
            </button>
            <button class="google">

                Log in with Google +
            </button>

                 Login
                <input type="text" name="login" class="login">

                Password
                <input type="password" name="password" class="password">

                Remember me
                <input type="checkbox" name="checkbox" class="checkbox" checked>

              <button class="log-btn">Log in</button>
              Need help logging in?

Don't have an account yet? Sign up

  </form>

Here my scss code. I thought to add padding property to main section but it didn't make sense.
    .main {
        background: $light-grey-color;
        display: grid;
        width: 100%;
        grid-template-columns: 1fr 1fr;
        font-size: 14px;
        font-weight: bold;

      .left {
        padding: 40px 58px;
        border-right: 1px solid $grey-color;

        .facebook {
            background: #3e5b96;
            margin-bottom: 20px;
            padding: 10px 45px 10px 50px;
        }
        .google {
            background: $red-color;
        }

        button {
            display: flex;
            font-weight: bold;
            display: inline-block;
            vertical-align: middle;
            padding: 0;
            margin: 0;
            border: none;
            border-radius: 3px;
            white-space: nowrap;
            user-select: none;
            text-decoration: none;
            color: #fff;
            font-size: 14px;

            position: relative;
            padding: 10px 50px;

             i {
              position: absolute;
              left: 5px;
              top: 0;
              padding: 0 0 0 5px;
              height: 100%;
              box-sizing: border-box;

              display: flex;
              align-items: center;
        }
    }
    }
          .right {
        padding: 40px 58px;

       .wrap {
        display: block;
        margin-bottom: 20px;

         .login {
            width: 100%;
         }

         .password {
            width: 100%;
         }

         label {
            display: block;
            margin-bottom: 5px;
         }
       }
        .check-box {
            display:  inline-block;

            .checkbox {
                float: left;
            }
        }
        div {
            display: flex;
            margin-top: 24px;
            justify-content: space-between;
                    align-items: center;

            .log-btn {
                background: #252525;
                border: none;
                display: inline-block;
                vertical-align: middle;

                  white-space: nowrap;
                  user-select: none;
                  font-family: 'Open sans';

                  font-weight: bold;
                  text-decoration: none;
                  color: #fff;
                  padding: 14px 30px;
            }
            a {
                color: #000;
            }

        }
      }
    }

I have used to create it using border property but I need to make it shorter (as on image)

A: you can put another div between left and right with following property
.middle {
    background-color : #ccc;
    width : 2px;
    height : 150px;
    margin-top : 15px;
    display : inline-block;
}

A: Put form tag as relative and form.form:before as position: absolute

  .main {
    background: $light-grey-color;
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    font-size: 14px;
    font-weight: bold;
      .left {
        padding: 40px 58px;
        border-right: 1px solid $grey-color;
        .facebook {
          background: #3e5b96;
          margin-bottom: 20px;
          padding: 10px 45px 10px 50px;
        }
        .google {
          background: $red-color;
        }
        button {
          display: flex;
          font-weight: bold;
          display: inline-block;
          vertical-align: middle;
          padding: 0;
          margin: 0;
          border: none;
          border-radius: 3px;
          white-space: nowrap;
          user-select: none;
          text-decoration: none;
          color: #fff;
          font-size: 14px;
          position: relative;
          padding: 10px 50px;
          i {
            position: absolute;
            left: 5px;
            top: 0;
            padding: 0 0 0 5px;
            height: 100%;
            box-sizing: border-box;
            display: flex;
            align-items: center;
          }
        }
      }
      .right {
        padding: 40px 58px;
        .wrap {
          display: block;
          margin-bottom: 20px;
          .login {
            width: 100%;
          }
          .password {
            width: 100%;
          }
          label {
            display: block;
            margin-bottom: 5px;
         }
       }
       .check-box {
         display: inline-block;
           .checkbox {
             float: left;
           }
         }
         div {
           display: flex;
           margin-top: 24px;
           justify-content: space-between;
           align-items: center;
           .log-btn {
             background: #252525;
             border: none;
             display: inline-block;
             vertical-align: middle;
             white-space: nowrap;
             user-select: none;
             font-family: 'Open sans';
             font-weight: bold;
             text-decoration: none;
             color: #fff;
             padding: 14px 30px;
            }
            a {
              color: #000;
            }
          }
       }
     }
     form.form{
       position: relative;
     }
     form.form:before {
       position: absolute;
       border-left: 1px solid #000;
       content: "";
       margin-left: 49%;
       top: 0;
       bottom: 0;
     }
 <form class="form">

Log in to the Site

      <button class="facebook">

        Log in with Facebook
      </button>
      <button class="google">

        Log in with Google +
      </button>

         Login
        <input type="text" name="login" class="login">

        Password
        <input type="password" name="password" class="password">

        Remember me
        <input type="checkbox" name="checkbox" class="checkbox" checked>

        <button class="log-btn">Log in</button>
        Need help logging in?

Don't have an account yet? Sign up

</form>

A: Add a positioned pseudo-element to the .main div

.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 14px;
  font-weight: bold;
  position: relative;
  margin: 1em auto;
  grid-column-gap: 1em;
}

.main::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  height: 50%;
  /* adjust as required */
  width: 2px;
  /* adjust as required */
  transform: translate(-50%, -50%);
  background: red;
}

.main div {
  height: 75vh;
  background: lightblue;
}


text:
Q: Spring boot Read write Split / Master - Slave / Multiple Databases I am following this link
https://github.com/kwon37xi/replication-datasource
I have implemented the code But STILL Both my service functions are using the same Database(one which is marked primary)
Service Class
public class TableService{

    @Autowired
    private Table1Repo t1Repo;
    @Transactional(readOnly = false)
    public void saveTable1(Table1 t,int a, Table1 t2){
            try{
                t1Repo.save(t2);
            }
            catch(Exception e){
                System.out.println("Inside");
            }

    }

    @Transactional(readOnly = true)
    public Table1 getTable(int id){
        return t1Repo.findOne(id);
    }

}

Then Added two Class(from the link)
ReplicationRoutingDataSource
public class ReplicationRoutingDataSource extends AbstractRoutingDataSource {

    @Override
    protected Object determineCurrentLookupKey() {
        String dataSourceType = TransactionSynchronizationManager.isCurrentTransactionReadOnly() ? "read" : "write";
        return dataSourceType;
    }
}

WithRoutingDataSourceConfig
@Configuration
public class WithRoutingDataSourceConfig {

    /*@Bean(destroyMethod = "shutdown")*/
    @Bean
    @Primary
    @ConfigurationProperties(prefix="datasource.primary")
    public DataSource writeDataSource() {
       /* EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
                .setName("routingWriteDb")
                .setType(EmbeddedDatabaseType.H2)
                .setScriptEncoding("UTF-8")
                .addScript("classpath:/writedb.sql");
        return builder.build();*/
        return DataSourceBuilder.create().build();
    }

/*    @Bean(destroyMethod = "shutdown")*/
    @Bean
    @ConfigurationProperties(prefix="datasource.secondary")
    public DataSource readDataSource() {
        /*EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
                .setName("routingReadDb")
                .setType(EmbeddedDatabaseType.H2)
                .setScriptEncoding("UTF-8")
                .addScript("classpath:/readdb.sql");
        return builder.build();*/
        return DataSourceBuilder.create().build();
    }

    /**
     * {@link org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource}는
     * {@link org.springframework.beans.factory.InitializingBean}을 구현하므로,
     * 명시적으로 afterPropertiesSet()메소드를 호출하거나
     * 별도 @Bean으로 만들어 Spring Life Cycle을 타도록 해야 한다.
     */
    @Bean
    public DataSource routingDataSource(@Qualifier("writeDataSource") DataSource writeDataSource, @Qualifier("readDataSource") DataSource readDataSource) {
        ReplicationRoutingDataSource routingDataSource = new ReplicationRoutingDataSource();

        Map<Object, Object> dataSourceMap = new HashMap<Object, Object>();
        dataSourceMap.put("write", writeDataSource);
        dataSourceMap.put("read", readDataSource);
        routingDataSource.setTargetDataSources(dataSourceMap);
        routingDataSource.setDefaultTargetDataSource(writeDataSource);

        return routingDataSource;
    }

    /**
     * {@link org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy}로 감싸서
     * 트랜잭션 동기화가 이루어진 뒤에 실제 커넥션을 확보하도록 해준다.
     *
     * @param routingDataSource
     * @return
     */
    @Bean
    public DataSource dataSource(@Qualifier("routingDataSource") DataSource routingDataSource) {
        return new LazyConnectionDataSourceProxy(routingDataSource);
    }
}

application.prop file
server.port=8089

spring.jpa.show-sql = true
spring.jpa.properties.hibernate.show_sql=true

# Primary DataSource configuration
datasource.primary.url=jdbc:mysql://127.0.0.1:3306/jpa
datasource.primary.username=root
datasource.primary.password=root
# Any of the other Spring supported properties below...

# Secondary DataSource configuration
datasource.secondary.url=jdbc:mysql://127.0.0.1:3306/jpa2
datasource.secondary.username=root
datasource.secondary.password=root

Repository
public interface Table1Repo extends JpaRepository<Table1, Integer>{}

Issue is my both service functions are using the primary Database. What am I missing. I only have these class. Rest I have one Controller
Edited
I have made by code work by adding this class
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="com.example")
public class ReplicationDataSourceApplicationConfig {

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("dataSource") DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.example");
        HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(jpaVendorAdapter);

        return emfb;
    }

    @Bean
    public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory(entityManagerFactory);
        return transactionManager;
    }

    @Bean
    public PersistenceExceptionTranslationPostProcessor exceptionTranslationPostProcessor() {
        return new PersistenceExceptionTranslationPostProcessor();
    }
}

A: I'm the writer of the link you refered.
Which data source do you use with Table1Repo?
You have to inject the specific bean "dataSource" to you JDBC call.
I guess @Primary "writeDataSource" is injected to your Repository.
Try to change @Primary to "dataSource" or find a way to inject "dataSource" to your repository.

A: you can also try in this way:
Spring Boot 2 with Multiple DataSource for Postgres Data Replication
and here is source code in github:
spring-boot-multi-data-source
The following link explans, how you can have multiple datasource
DB1 (write):
@Configuration
@ConfigurationProperties("spring.datasource-write")
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "entityManagerFactoryWrite",
        transactionManagerRef = "transactionManagerWrite",
        basePackages = {"com.ehsaniara.multidatasource.repository.writeRepository"}
)
public class DataSourceConfigWrite extends HikariConfig {

    public final static String PERSISTENCE_UNIT_NAME = "write";

    @Bean
    public HikariDataSource dataSourceWrite() {
        return new HikariDataSource(this);
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryWrite(
            final HikariDataSource dataSourceWrite) {

        return new LocalContainerEntityManagerFactoryBean() {{
            setDataSource(dataSourceWrite);
            setPersistenceProviderClass(HibernatePersistenceProvider.class);
            setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
            setPackagesToScan(MODEL_PACKAGE);
            setJpaProperties(JPA_PROPERTIES);
        }};
    }

    @Bean
    public PlatformTransactionManager transactionManagerWrite(EntityManagerFactory entityManagerFactoryWrite) {
        return new JpaTransactionManager(entityManagerFactoryWrite);
    }
}

DB2 (read):
@Configuration
@ConfigurationProperties("spring.datasource-read")
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "entityManagerFactoryRead",
        transactionManagerRef = "transactionManagerRead",
        basePackages = {"com.ehsaniara.multidatasource.repository.readRepository"}
)
public class DataSourceConfigRead extends HikariConfig {

    public final static String PERSISTENCE_UNIT_NAME = "read";

    @Bean
    public HikariDataSource dataSourceRead() {
        return new HikariDataSource(this);
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryRead(
            final HikariDataSource dataSourceRead) {

        return new LocalContainerEntityManagerFactoryBean() {{
            setDataSource(dataSourceRead);
            setPersistenceProviderClass(HibernatePersistenceProvider.class);
            setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
            setPackagesToScan(MODEL_PACKAGE);
            setJpaProperties(JPA_PROPERTIES);
        }};
    }

    @Bean
    public PlatformTransactionManager transactionManagerRead(EntityManagerFactory entityManagerFactoryRead) {
        return new JpaTransactionManager(entityManagerFactoryRead);
    }
}


text:
Q: How to get the Floatbuffer stored float[]? Having  -
FloatBuffer floatBuffer  = FloatBuffer.allocate(SIZE)

how could I get its float[SIZE]  ?

A: FloatBuffer.array() should return you the float array

A: To get the float[] array backed by the buffer just call the method array() :
float[] arrayBuff = floatBuffer.array();

A: You can use the FloatBuffer#get(float[] dst) method to copy the underlying array to a new destination array.


text:
Q: Bootstrap navbar-toggler doesn't appear as a button on my site. Does bootstrap have a bug? In my code, when I use navbar-toggler, it doesn't show. I've used a direct example from bootstraps homepage to see if that works, but no difference. It doesn't show in bootstrap's example either. Is this a bug that's easy to fix?
https://getbootstrap.com/docs/4.1/components/navbar/#toggler
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Pianostuen</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">

        </button>

            Hidden brand

                    Home (current)

                    Link

                    Disabled

            <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
            </form>

A: I'm not exactly sure of what your issue is, but the code you provided works exactly as it should, based on the Bootstrap example you took it from.
https://getbootstrap.com/docs/4.1/components/navbar/#toggler
If you want the .navbar-brand to appear, you can just move it out of the .collapse div

<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Pianostuen</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">

        </button>

      Hidden brand

          Home (current)

          Link

          Disabled

      <form class="form-inline my-2 my-lg-0">
        <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
      </form>

    Hidden brand
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">

        </button>

          Home (current)

          Link

          Disabled

      <form class="form-inline my-2 my-lg-0">
        <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
      </form>


text:
Q: wmuSlider causing problems in IE10 This is my first attempt at posting a question here so fingers crossed - and please be kind.
I am using wmuSlider on a site I am building - this is not yet full styled but is working as I want in Chrome and Firefox but for some reason it is not displaying in IE10 - could someone please let me know why this might be please.  The slider in question can be found on the link below.
http://www.justg.co.uk/smg
Thank you in advance
G


text:
Q: Adding CSS to osssearchresults.aspx I made several design changes to my SP online site.
Everything went smoothly 'till I encountered the search page osssearchresults.aspx
I'm aware that osssearchresults.aspx is a server page and doesn't let you edit in browser.
However, light visual changes(CSS) need to be made in order to keep the same pattern throughout the site (functionality will stay unchanged).
My question is, how to accomplish that requirement? What do I need to change?
Must I use SPD for that?
All of this happens in a site level and not a site collection.
Thank you,

A: To add CSS, you must create an Enterprise Search Center and use that instead of the osssearchresults.aspx, then you can add CSS to any of the result pages.
http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/manage-the-search-center-in-sharepoint-online-HA103994122.aspx


text:
Q: Default ScrollingOffset for mouse-wheel-changes I have an input form that I have to scroll based on changes of the mouse-wheel. I can not use the standard mechanic to let the scrolling be done automatically but have to do the scrolling manually (from code).
My question is, if there are some guidelines or standards on how big the scrolling offsets should be? Maybe there exists an enumeration (.net) that holds default-values? The contents that is shown are huge input forms. (The app is a WPF-App, however I assume this is a general question that is independent of the language)
Update
Thanks to gstercken showing me the appropriate value in the SystemInformation-class, I have found for WPF the System.Windows.SystemParameters.WheelScrollLines value.

A: The SystemInformation class has a property MouseWheelScrollLines that indicates how many logical lines to scroll for every notch of the mouse wheel (set by the user in the Mouse control panel), or -1 if the "One screen at a time" mouse option is selected.
However, it is up to your specific application what should be regarded as a "logical line".


text:
Q: How to get record by date from 1 table and update other table in Postgresql? I have two tables. In one table(order_produt) have multiple records by date and other table(Transfer_product) also multiple record by date. order_product table have correct record. i want update my transfer_product table with order_product table by date range.
order_product_table
-------------------------

id    | date         | Product_id  | value
-------------------------------------------
1     | 2017-07-01   | 2           | 53
2     | 2017-08-05   | 2           | 67
3     | 2017-10-02   | 2           | 83
4     | 2018-01-20   | 5           | 32
5     | 2018-05-01   | 5           | 53
6     | 2008-08-05   | 6           | 67

Transfer_product_table
----------------------------

id    | date         | Product_id  | value
--------------------------------------------
1     | 2017-08-01   | 2           | 10
2     | 2017-10-06   | 2           | 20
3     | 2017-12-12   | 2           | 31
4     | 2018-06-25   | 5           | 5

Result(Transfer_product_table)
--------------------------------
id    | date         | Product_id  | value
--------------------------------------------
1     | 2017-08-01   | 2           | 53
2     | 2017-10-06   | 2           | 83
3     | 2017-12-12   | 2           | 83
4     | 2018-06-25   | 5           | 53

I want by date value update like you can see Result table.
i use query partion by but this is not what i want.
UPDATE Transfer_product_table imp
SET    value = sub.value
FROM  (SELECT product_id,value
,ROW_NUMBER() OVER (PARTITION BY product_id ORDER BY orderdate DESC)AS Rno
FROM order_product_table
where orderdate between '2017-07-01' and '2019-10-31') sub
WHERE  imp.product_id = sub.product_id
and  sub.Rno=1
and imp.date between '2017-07-01' and '2019-10-31'

A: This is pretty straightforward using postgres' awesome daterange type.
with order_product_table as (
select * from (
  VALUES (1, '2017-07-01'::date, 2, 53),
         (2, '2017-08-05', 2, 67),
         (3, '2017-10-02', 2, 83),
         (4, '2018-01-20', 5, 32),
         (5, '2018-05-01', 5, 53),
         (6, '2008-08-05', 6, 67)
) v(id, date, product_id, value)
), transfer_product_table as (
select * from (
  VALUES (1, '2017-08-01'::date, 2, 10),
         (2, '2017-10-06', 2, 20),
         (3, '2017-12-12', 2, 31),
         (4, '2018-06-25', 5, 5)
) v(id, date, product_id, value)
), price_ranges AS (
  select product_id,
         daterange(date, lead(date) OVER (PARTITION BY product_id order by date), '[)') as pricerange,
         value
  FROM order_product_table
)
SELECT id,
       date,
       transfer_product_table.product_id,
       price_ranges.value
FROM transfer_product_table
JOIN price_ranges ON price_ranges.product_id = transfer_product_table.product_id
  AND date <@ pricerange
ORDER BY id
;
 id |    date    | product_id | value
----+------------+------------+-------
  1 | 2017-08-01 |          2 |    53
  2 | 2017-10-06 |          2 |    83
  3 | 2017-12-12 |          2 |    83
  4 | 2018-06-25 |          5 |    53
(4 rows)

Basically, we figure out the price at any given date by using the order_product_table.  We get the price between the current date (inclusive) and the next date (exclusive) with this:
         daterange(date, lead(date) OVER (PARTITION BY product_id order by date), '[)') as pricerange,

Then we simply join to this on the condition that the product_ids match and that date in the transfer_product_table is contained by the pricerange.


text:
Q: If 3 six faced fair dice are thrown together, then the probability that the sum of the numbers $ 9\leqslant k \leqslant 14$ If 3 six faced fair dice are thrown together, then the probability that the sum of the numbers appearing on the dice is k where $ 9\leqslant k \leqslant 14$ is  :
My approach : Possible sum values are from 3 to 18 and our cases of interst are $9,10,11,12,13,14 \therefore$ probability should be $\frac{6}{16}$ but the answer given is $\frac{21k-k^{2}-83}{216}$ How can arrive at the given answer ?

A: Consider only Sum of all outcomes to be 9.
Then see the cases where when 3 fair dices are thrown, the sum comes out to be 9. There will be 25 such cases when checked.
Means probability will be 25/216.
With this knowledge, put k=9 in the given equations. The equation which will give the same output is the answer. Thus, equation with 21k-k^2-83 as numerator satisfies our requirement.

A: Every roll of three dice corresponds to an ordered triple $(D_1, D_2, D_3)$, where $1 \leq D_i \leq 6$ for each $1 \leq i \leq 3$. There are $6^3 = 216$ such ordered triples, which make up our sample space: $$\Omega := \{(D_1, D_2, D_3):\text{for each } 1 \leq i \leq 3, D_i \in \Bbb{N} \text{ and } 1 \leq D_i \leq 6 \} .$$ Therefore the probability we want to find, $$\Bbb{P}( D_1 + D_2 + D_3 = k ) \text{ for } k \in \Bbb{N} \text{ and } 3 \leq k \leq 18,$$ must have a denominator of $216$, if we write it as $$\Bbb{P}( D_1 + D_2 + D_3 = k ) = \frac{|E_k|}{|\Omega|},$$ where $E_k \subset \Omega$ is the set $$E_k := \{(D_1, D_2, D_3):\text{for each } 1 \leq i \leq 3, D_i \in \Bbb{N}, 1 \leq D_i \leq 6, \text{ and } D_1 + D_2 + D_3 = k \}.$$
Because $$(D_1, D_2, D_3) \in E_k$$ is equivalent to $$(7 - D_1, 7 - D_2, 7 - D_3) \in E_{21 - k},$$ we have $|E_k| = |E_{21-k}|$, so it suffices to evaluate $$E_3, E_4, ..., E_9, E_{10},$$ as we will then know the values of $$E_{18} = E_3, E_{17} = E_4, ..., E_{12} = E_9, E_{11} = E_{10}.$$ An application of stars-and-bars then gives us $$E_k = \binom{k-1}{2} - 3\binom{k-7}{2} = \frac{-2k^2+42k-166}{2} = -k^2+21k-83 = k(21-k) - 83$$ for $3 \leq k \leq 10$.
(The second term comes from excluding partitions of $k$ that have at least one part $>6$. We can partition $k-6$ into a sum of three positive integers in $\binom{k-7}{2}$ ways, and then we have $3$ choices of which positive integer to add $6$ back to to get a partition of $k$ where one part is strictly greater than $6$. This gives a total of $3\binom{k-7}{2}$ such partitions of $k$.)
This matches the original numerator when $k = 9, 10$. Since the quadratic $f(x) = x(21-x) - 83$ satisfies $f(x) = f(21-x)$, we know that this formula works for $k = 11, 12, 13, 14$ as well. Done.


text:
Q: How to query a table to see what range a certain value belongs to , java I have a table in the db ,used as lookup to see what score a certain value has.
 The table
 5     1

10     2

15    3

If given an input, example 6, how do I query the table in Java and see that 6 is in between 5 and 10..so its score is 2.
if it's 12. It's between 10 and 15 and the score is 3.
Or maybe instead of a table in the database, I could save the lookup values in a class ?
Is there a more efficient way to do this ?

A: In this case you need to get the max value of field1 that is smaller than the current record's field1 value and check if the searched value falls between these two values. If yes, return field2. Assuming that there is no overlapping ranges, you can use the following query:
select field1, (select max(field1) from yourtable t2 where t2.field1<t1.field1) as lowerfield1, field2
from yourtable t1
where ...<fíeld1 and ...>=(select max(field1) from yourtable t2 where t2.field1<t1.field1)

The searched value must be in place of the ....


text:
Q: Return Request in Spring API My program calls an external API. Now I want to return this response directly to the user without any changes. But instead of the response where Im supposed to see the header and body, I only get this response:
 {
    "redirect": false,
    "successful": true
}

My code looks like this:
    try (Response response = client.newCall(request).execute()) {

        return response;
    }

When I look at the response object in debug mode, I get all the information I want. Why can't the user see it?
Thanks in advance

A: The try block automatically closes the response when leaving its scope. Mitigate by reading the response inside that block or getting rid of the try block.


text:
Q: Jmeter error http test script recorder with Firestore Request I am testing a website that is using firestore.googleapis.com services, at some point I am blocked and I can't proceed to the test, due to this error from the firestore request:

Here's a copy of the request body:

I also did some troubleshooting with Firefox Developers Tools and I found this error on console:

My configurations:

*

*Jmeter Version: 5.4.1

*Firefox Version: 85.0.2

Firefox is configured with Proxy so I can catch all the responses in the jmeter in port 8080 with HTTP test script recorder.
This just happens when I have the proxy configured in Firefox. If I turn the proxy off, the website works perfectly, already uninstall jmeter and remove certificates and add new ones, but the error appears always.
I have already tried Edge and Chrome with proxy configured, but with no success.
How can I "bypass" or fix this problem with firestore.googleapis.com/google.firestore.v1.Firestore?

A: Try clearing your Firefox browsing data, it might be the case Firebase connection is blocked by HSTS so your first visit to the website you're testing should be "clean".
Also if there is no essential data in the Firebase I would recommend skipping recording requests to it (as well as to other 3rd-party websites) as you load test should solely focus on your application. You can filter out the domains which shouldn't be in your test scope via "URL Patterns to Exclude" section of the HTTP(S) Test Script Recorder:

In the unlikely case of above hints don't help be aware of the alternative way of recording a JMeter test - JMeter Chrome Extension, it's not that "invasive" as JMeter so you shouldn't see any impact on your web application functionality.


text:
Q: ERROR : Call to undefined method Illuminate\Database\Query\JoinClause::whereIn() I have a method which returns a list of provinces based on some join and where clauses. The problem I have is That laravel throws an Exception that tells there is an undefined method called whereIn. But there exist whereIn method in Eloquent. How should I use whereIn method on joins?
public static function getProvinces($IDs = array()){
        $query =
            DB::Table('doctors')
            ->join('users',  function($join){
                $join->on('users.id', '=', 'doctors.user_id')
                    ->whereIn('users.status_id', array(3,4,7));

            })
            ->join('contacts',  function($join){
                $join->on('doctors.id', '=', 'contacts.doctor_id')
                    ->where('contacts.type_id', '=', 1);

            })
            ->join('provinces', 'contacts.province_id', '=', 'provinces.id')
            ->select('contacts.province_id as id','provinces.name as name',DB::raw("COUNT('contacts.province_id') as count"))
            ->groupBy('contacts.province_id');
        if(!empty($IDs))
            $query->whereIn('doctors.id', $IDs);
        return $query->get();

    }

Thanks for your help.

A: Currently, JoinClause doesn't support whereIn method, but you can overwrite it following way:
$query =
    DB::Table('doctors')
    ->join('users',  function($join){
        $join->on('users.id', '=', 'doctors.user_id')
            ->where('users.status_id', '=', 3)
            ->orWhere('users.status_id', '=', 4)
            ->orWhere('users.status_id', '=', 5);
    })
    ->join('contacts',  function($join){
        $join->on('doctors.id', '=', 'contacts.doctor_id')
            ->where('contacts.type_id', '=', 1);

    })
    ->join('provinces', 'contacts.province_id', '=', 'provinces.id')
    ->select('contacts.province_id as id','provinces.name as name',DB::raw("COUNT('contacts.province_id') as count"))
    ->groupBy('contacts.province_id');


text:
Q: What is the best testing pattern for checking that parameters are being used properly? I'm using Rhino Mocks to try to verify that when I call a certain method, that the method in turn will properly group items and then call another method.
Something like this:
//Arrange
var bucketsOfFun = new BucketGame();

var balls = new List<IBall>
                {
                    new Ball { Color = Color.Red },
                    new Ball { Color = Color.Blue },
                    new Ball { Color = Color.Yellow },
                    new Ball { Color = Color.Orange },
                    new Ball { Color = Color.Orange }
                };

//Act
bucketsOfFun.HaveFunWithBucketsAndBalls(balls);

//Assert ???

Here is where the trouble begins for me.  My method is doing something like this:
public void HaveFunWithBucketsAndBalls(IList<IBall> balls)
{
    //group all the balls together according to color
    var blueBalls = GetBlueBalls(balls);
    var redBalls = GetRedBalls(balls);
    // you get the idea

    HaveFunWithABucketOfBalls(blueBalls);
    HaveFunWithABucketOfBalls(redBalls);
    // etc etc with all the different colors
}

public void HaveFunWithABucketOfBalls(IList<IBall> colorSpecificBalls)
{
    //doing some stuff here that i don't care about
    //for the test i'm writing right now
}

What I want to assert is that each time I call HaveFunWithABucketOfBalls that I'm calling it with a group of 1 red ball, then 1 blue ball, then 1 yellow ball, then 2 orange balls.
If I can assert that behavior then I can verify that the method is doing what I want it to do, which is grouping the balls properly.
Any ideas of what the best testing pattern for this would be?

A: One way to test this is to break out the responsibility of working with a colour-specific balls to a dependency, say, IBucketHandler:
//Arrange
var bucketHandler = MockRepository.GenerateStub<IBuckerHandler>();
var bucketsOfFun = new BucketGame(bucketHandler);
...
//Assert
bucketHandler.AssertWasCalled(x => x.HaveFunWithABucketOfBalls(redBalls));
bucketHandler.AssertWasCalled(x => x.HaveFunWithABucketOfBalls(greenBalls));

This test is then checking your BucketGame correctly calls HaveFunWithABucketOfBalls on the mocked object. This may still give you trouble in specifying what each argument should be. You can in turn make this easier to test (at the expense of introducing more abstraction) by pushing the responsibility for sorting the balls to a new dependency. You'd then end up with something like this:
//Arrange
var balls = new List<IBall>(); //Can really be anything, we just need the object reference
var greenBalls = new List<IBall>();
var redBalls = new List<IBall>();
var sortedBalls = new [] { greenBalls, redBalls };

var bucketHandler = MockRepository.GenerateStub<IBucketHandler>();
var ballSorter = MockRepository.GenerateStub<IBallSorter>();
ballSorter.Stub(x => x.Sort(balls)).Return(sortedBalls);

var bucketsOfFun = new BucketGame(bucketHandler, ballSorter);

//Act
bucketsOfFun.HaveFunWithBucketsAndBalls(balls);

//Assert
bucketHandler.AssertWasCalled(x => x.HaveFunWithABucketOfBalls(greenBalls));
bucketHandler.AssertWasCalled(x => x.HaveFunWithABucketOfBalls(redBalls));

And to pass this test, in BucketGame:
public BucketGame(IBucketHandler bucketHandler, IBallSorter ballSorter)
{
  this.bucketHandler = bucketHandler;
  this.ballSorter = ballSorter;
}

public void HaveFunWithBucketsAndBalls(IList<IBall> balls)
{
    //group all the balls together according to color
    var sortedBalls = ballSorter.Sort(balls);
    foreach (var groupOfBalls in sortedBalls)
    {
        bucketHandler.HaveFunWithABucketOfBalls(groupOfBalls);
    }
}

This tests the BucketGame logic. You'll now want to write unit tests for an IBallSorter implementation to check that it sorts the balls by colour as you require. Those tests probably won't need any mocking, you'll simply be able to throw data in and assert that the data you get back is what you expect.

A: the first thing you need to sort out in any test is what exactly your Subject Under Test is. that might sound gratuitous but I know from my own experiences that this can be confusing when you are learning interaction testing.
the reason I am guessing this is part of the problem is that you have an IBall object, but you want to asserts calls being made on a method that doesn't appear to be part of an interface. As you know, Rhino does it's magic by overriding something virtual, like an interface; so if you want to use to Rhino to do this you have to give it an interface. Assuming that is the case, maybe
interface IBucketGame{
    void HaveFunWithBucketsAndBalls(IList<IBall> balls)
    void HaveFunWithSpecificBalls(IList<IBall> balls)
}

Now you can set up an interaction test:
[Test]
public void HaveFunWithBucket_IfMoreThanOneColor_CallsHaveFunWithSpecificBallsForSpecificColor()
    {
        //Arrange
        var bucketsOfFun = MockRepository.GenerateMock<IBucketGame>();

        IBall expColor_1 = new Ball(Color.Red);
        IBall expColor_2 = new Ball(Color.Green);
        IBall expColor_3 = new Ball(Color.Red);
        var startlist = new List<IBall>{expColor_1, expColor_2, expColor_3};
        var onlyRedBalls = new List<IBall>{expColor_1, expColor_3};
        var onlyGreenBalls = new List<IBall>{expColor_2};

        //Act
        bucketsOfFun.HaveFunWithBucketsAndBalls(balls);

        //Assert
        bucketsOfFun.AssertWasCalled(x=>x.HaveFunSpecificBalls(Arg<IEnumerable<IBall>>.List.Equal(onlyRedBalls)));
        bucketsOfFun.AssertWasCalled(x=>x.HaveFunSpecificBalls(Arg<IEnumerable<IBall>>.List.Equal(onlyGreenBalls)));

    }

HTH,
Berryl


text:
Q: checkbox onCLick function using AJAX My question is simple, I have a contact form with a checkbox in it. What I want is when the user clicks the checkbox, a message to appear on the side. What I will add in future is, when a second checkbox is clicked to change the message, but first I would like to fix this. I saw some similar questions asked, but I still couldnt do it. The code is:
The checkbox inside the form:
<input type="checkbox" onclick="check(this);" />

This is still in the same file, contact.php
<script type="text/javascript">
function check(cb)
{
    if(cb.checked)
    {
        $.getScript("clickCheckbox.php");
    }
}

and another php which is supposed to be called after a click: clickCheckbox.php
<?php
    header("Content-type: text/javascript");
    echo 'alert("Clicked!");';
?>

What am I not doing right? I am a begginer, so I will apriciate every comment and advice. Thank you!


text:
Q: F# attributes, typeof, and "This is not a constant expression" EDIT: Added a more complete example, which clarified the problem.
Some .NET attributes require a parameter of type Type. How does one declare these parameters in F#?
For example, in C# we can do this:
[XmlInclude(typeof(Car))]
[XmlInclude(typeof(Truck))]
class Vehicle { }
class Car : Vehicle { }
class Truck : Vehicle { }

But, in F# the following...
[<XmlInclude(typeof<Car>)>]
[<XmlInclude(typeof<Truck>)>]
type Vehicle() = class end
type Car() = inherit Vehicle()
type Truck() = inherit Car()

...results in a compiler error: This is not a constant expression or valid custom attribute value.

A: You should address a circular type dependency introduced by forward usage of types in attributes. The snippet below shows how this can be done in F#:
// Compiles OK
[<AttributeUsage(AttributeTargets.All, AllowMultiple=true)>]
type XmlInclude(t:System.Type) =
   inherit System.Attribute()

[<XmlInclude(typeof<Car>)>]
[<XmlInclude(typeof<Truck>)>]
type Vehicle() = class end
and Car() = inherit Vehicle()
and Truck() = inherit Car()

A: Can you try putting together a more complete example that gives the error? I just quickly tried something similar and it works fine (in F# 3.0 in Visual Studio 2012):
type Car = C

type XmlInclude(typ:System.Type) =
  inherit System.Attribute()

[<XmlInclude(typeof<Car>)>]
let foo = 0

I guess there is some tiny detail somewhere that confuses the F# compiler for some reason - but it should understand typeof (which is, in reality, a function) and allow its use in attributes.


text:
Q: How to write sql query for FIlter country as status wise Here I have a simple table. I would like to end up with a table like the one given. What is the best way to write the sql statement to achieve this?
Table 1
 Id    Name           Approved
 1     Australia      3
 2     UAE            1
 3     India          2

Table 2
Id    Status
1     Submit
2     In-Progress
3     Pending

Show result as
Submitted    In-Progress     Pending
UAE           India         Australia

A: Please Try below query:
create table #country
(
    ID int identity(1,1),
    Name varchar(30),
    Approved int
)

create table #status
(
    ID int,
    Status varchar(30)
)

insert into #country (Name, Approved) values ('Australia',3), ('UAE',1), ('India',2)
insert into #status (ID, Status) values (1,'Submit'), (2, 'In-Progress'), (3,'Pending')

select Submit, [In-Progress],[Pending]
from (
    select t1.Name, t2.Status
    from #country t1
    inner join #status t2 on t1.Approved = t2.ID
)dd1
pivot (
    max(Name) for Status in ([Submit], [In-Progress],[Pending])
) piv

drop table #country
drop table #status

Output of this query:

A: Try this:-
select
trim(replace(group_concat(submitted),',',' ')) as submitted,
trim(replace(group_concat(InProgress),',',' ')) as InProgress,
trim(replace(group_concat(Pending),',',' ')) as Pending
from
(
Select
case when status='Submit' then A.Name else ' ' end as submitted,
case when status='In-Progress' then A.Name else ' ' end as InProgress,
case when status='Pending' then A.Name else ' ' end as Pending

FROM

TABLE1 A
INNER JOIN
TABLE2 B
ON A.ID=B.ID
) a;

A: Here's the answer as of given Data:
select `Submit`,`In-Progress`,`Pending` from
(select `Submit`,`In-Progress`,INP.id from
(select   Name as 'Submit',a.id  from
 (select * from table1)as a

LEFT JOIN

  (select * from table2) as b
on a.Approvide = b.`Id`
where b.`STATUS` = 'Submit') as Sub

INNER JOIN

(select   Name as 'In-Progress',a.id  from
 (select * from table1)as a

LEFT JOIN

  (select * from table2) as b
on a.Approvide = b.`Id`
where b.`STATUS` = 'In-Progress') as INP
on Sub.id != INP.id) as c

INNER JOIN

(select   Name as Pending,a.id  from
 (select * from table1)as a

LEFT JOIN

  (select * from table2) as b
on a.Approvide = b.`Id`
where b.`STATUS` = 'Pending') as Pen

on c.id != Pen.id

A: select Name,Status from Table1 natural join Table2;

That's simple. The result should look like this now. I think this is usual approach that how we actually retrieve the information from multiple tables.
Name           Status

Australia      Pending
UAE            Submit
India          In-Progress

Please consider


text:
Q: XForms: get the position of item in model using select element I'm really struggling with XForms.  This code has two problems.  My refresh action doesn't work and my position() value doesn't work.  I can't find any documentation that specifies which elements are allowed/need to be nested within each other. It seems like XForms has a huge amount of capability but I can't get anything to hook up.  This is just supposed to set "sel" to 2.  I've also tried "value="instance('foo')/bar[index('ns')]/position()" " because I'm not sure if only ref attributes inherit a context node.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms">
<body>
    <xf:model id="master">
        <xf:instance xmlns="" id="test">
            <foo>
                <bar>test</bar>
                <bar>error</bar>
                <sel>1</sel>
            </foo>
        </xf:instance>
    </xf:model>
    <xf:output ref="sel"/>
    <xf:select1 id="sl" ref="instance('test')/sel">
        <xf:itemset id="ns" nodeset="instance('test')/bar[.='error']">
            <xf:label ref="."/>
            <xf:value value="./position()"/>
        </xf:itemset>
        <xf:action>
            <xf:refresh model="master"/>
        </xf:action>
    </xf:select1>
</body>
</html>

Any literature on the rules and categories of all the XForms elements would also be appreciated.  http://www.w3.org/TR/xforms/ sure makes it look like a select element and a trigger element are similar things.  But if they are, why does my refresh work inside a trigger but not a select?

A: First, the position() function is evaluated according to the selected list of nodes and, in this example, there is just one element because of the predicate. It is possible to use the count() function as in "count(preceding-sibling::bar)+1".
About the action, an ev:event attribute is required to tell when the action is to be performed.

A: A few notes on your code:

*

*Usually, XForms models are placed under the HTML head element, although implementations are allowed to place models in other places.

*I cannot see how your code can set the value of sel to 2 because you are going to have a dropdown control with a single item with label "error" and value 2. But there is no code which sets the value of sel to 2. And that's because the value would change only if the user changes the selected value in the dropdown, but the user cannot do that because there is only one item.

*In XForms, you very rarely need an explicit refresh action. The view is automatically refreshed after changes to the data model have completed.

*Yes, a trigger is like a select1: a core form control.

*All XForms actions need to tell which event they react to with the ev:event attribute (or plain event with some implementations). Your action action doesn't have an ev:event attribute so wouldn't run anyway.

*XForms now recommends using ref consistently instead of nodeset. Some implementations already support that.

*the position() XPath expression is sometimes tricky because it only works following the XPath context position. With Orbeon, using position() as you show works. But if it doesn't, you could also try to compute the position using count(preceding::bar) + 1.

The following works with Orbeon, in the sense that I have made your itemset point to the two bar elements, and if the user changes the selection, the value in sel changes. There is no need for an explicit action or refresh, because the dropdown will write its value to the sel element as it changes.
<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xf="http://www.w3.org/2002/xforms">
    <head>
        <xf:model id="master">
            <xf:instance xmlns="" id="test">
                <foo>
                    <bar>test</bar>
                    <bar>error</bar>
                    <sel>1</sel>
                </foo>
            </xf:instance>
        </xf:model>
    </head>
    <body>
        <xf:output ref="sel"/>
        <xf:select1 id="sl" ref="sel">
            <xf:itemset id="ns" nodeset="instance('test')/bar">
                <xf:label ref="."/>
                <xf:value value="position()"/>
            </xf:itemset>
        </xf:select1>
    </body>
</html>