text:
Q: How do I disable rescue handlers in Ruby on Rails apps when I'm running functional tests? I have a number of controllers in my Ruby on Rails apps with a rescue handler at the end of the action that basically catches any unhandled errors and returns some kind of "user friendly" error. However, when I'm doing rake test I'd like to have those default rescue handlers disabled so I can see the full error & stack trace. Is there any automated way to do this?
Update to clarify: I have an action like this:
def foo
  # do some stuff...
rescue
  render :text => "Exception: #{$!}" # this could be any kind of custom render
end

Now when I functional test this, if the exception is raised then I'm going to get just a little bit of info about the exception, but what I'd like is for it to act as though there's no rescue handler there, so I get the full debug information.
Update: SOLUTION
I did this:
  rescue:
    raise unless Rails.env.production?
    render :text => "Exception: #{$!}" # this could be any kind of custom render
  end

A: Not quite automated, but how modifying your code to re-throw exceptions whenever called within a test?
Perhaps something like this:
def foo
  # do some stuff...
rescue
  raise if ENV["RAILS_ENV"] == "test"
  render :text => "Exception: #{$!}" # this could be any kind of custom render
end

A: Have you looked at using the assert_raise( exception1, exception2, ... ) { block } call and then printing the exception from the block?

A: Which method are you using? There are two rescue methods in ActionController.
I have this in my base controller:
def rescue_action_in_public(exception)
    response_code = response_code_for_rescue(exception)
    status = interpret_status(response_code)
    respond_to do |format|
        format.html { render_optional_error_file response_code}
        format.js { render :update, :status => status  do |page| page.redirect_to(:url => error_page_url(status)) end}
end

end
This only displays custom errors in production mode.

A: I think the easiest thing to do is verify that the correct render was called-- or whatever was different from the regular, non-exceptional case.

A: You shouldn't need to disable your rescue block. Use the assert_raise method (as suggested by Scott), and in the block, call the method that you expect an exception from.
For example:
def test_throws_exception
  assert_raise Exception do
    raise_if_true(true)
  end
end


text:
Q: pygsl build issue with swig wrapping I am trying to install pygsl on my machine, on top of gsl 1.14 with Python2.7. I am well aware that these are all deprecated, but I need to ensure backwards compatibility of a new piece of code.
When I run
python setup.py build
I get the following long list of errors:
swig_src/gslwrap_wrap.c:3764:3: warning: unused label 'fail' [-Wunused-label]
  fail:
  ^~~~~
swig_src/gslwrap_wrap.c:10620:17: error: implicit declaration of function 'gsl_linalg_QRPT_lssolve' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_QRPT_lssolve((gsl_matrix const *)arg1,(gsl_vector const *)arg2,(struct gsl_permutation_struct const *)arg3,(gsl_vector const *)arg4,arg5,arg6);
                ^
swig_src/gslwrap_wrap.c:10778:17: error: implicit declaration of function 'gsl_linalg_QRPT_lssolve2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_QRPT_lssolve2((gsl_matrix const *)arg1,(gsl_vector const *)arg2,(struct gsl_permutation_struct const *)arg3,(gsl_vector const *)arg4,arg5,arg6,arg7);
                ^
swig_src/gslwrap_wrap.c:11430:20: error: implicit declaration of function 'gsl_linalg_QRPT_rank' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (size_t)gsl_linalg_QRPT_rank((gsl_matrix const *)arg1,arg2);
                   ^
swig_src/gslwrap_wrap.c:11494:17: error: implicit declaration of function 'gsl_linalg_QRPT_rcond' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_QRPT_rcond((gsl_matrix const *)arg1,arg2,arg3);
                ^
swig_src/gslwrap_wrap.c:11494:17: note: did you mean 'gsl_linalg_QRPT_decomp'?
/usr/local/include/gsl/gsl_linalg.h:299:5: note: 'gsl_linalg_QRPT_decomp' declared here
int gsl_linalg_QRPT_decomp (gsl_matrix * A,
    ^
swig_src/gslwrap_wrap.c:11607:17: error: implicit declaration of function 'gsl_linalg_COD_decomp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_decomp(arg1,arg2,arg3,arg4,arg5,arg6);
                ^
swig_src/gslwrap_wrap.c:11749:17: error: implicit declaration of function 'gsl_linalg_COD_decomp_e' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_decomp_e(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
                ^
swig_src/gslwrap_wrap.c:11912:17: error: implicit declaration of function 'gsl_linalg_COD_lssolve' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_lssolve((gsl_matrix const *)arg1,(gsl_vector const *)arg2,(gsl_vector const *)arg3,(struct gsl_permutation_struct const *)arg4,arg5,(gsl_vector const *)arg6,arg7,arg8);
                ^
swig_src/gslwrap_wrap.c:11912:17: note: did you mean 'gsl_linalg_QR_lssolve'?
/usr/local/include/gsl/gsl_linalg.h:248:5: note: 'gsl_linalg_QR_lssolve' declared here
int gsl_linalg_QR_lssolve (const gsl_matrix * QR,
    ^
swig_src/gslwrap_wrap.c:12133:17: error: implicit declaration of function 'gsl_linalg_COD_lssolve2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_lssolve2(arg1,(gsl_matrix const *)arg2,(gsl_vector const *)arg3,(gsl_vector const *)arg4,(struct gsl_permutation_struct const *)arg5,arg6,(gsl_vector const *)arg7,arg8,arg9,arg10,arg11);
                ^
swig_src/gslwrap_wrap.c:12133:17: note: did you mean 'gsl_linalg_QR_lssolve'?
/usr/local/include/gsl/gsl_linalg.h:248:5: note: 'gsl_linalg_QR_lssolve' declared here
int gsl_linalg_QR_lssolve (const gsl_matrix * QR,
    ^
swig_src/gslwrap_wrap.c:12324:17: error: implicit declaration of function 'gsl_linalg_COD_unpack' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_unpack((gsl_matrix const *)arg1,(gsl_vector const *)arg2,(gsl_vector const *)arg3,arg4,arg5,arg6,arg7);
                ^
swig_src/gslwrap_wrap.c:12467:17: error: implicit declaration of function 'gsl_linalg_COD_matZ' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_COD_matZ((gsl_matrix const *)arg1,(gsl_vector const *)arg2,arg3,arg4,arg5);
                ^
swig_src/gslwrap_wrap.c:14670:17: error: implicit declaration of function 'gsl_linalg_cholesky_decomp1' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_decomp1(arg1);
                ^
swig_src/gslwrap_wrap.c:14670:17: note: did you mean 'gsl_linalg_cholesky_decomp'?
/usr/local/include/gsl/gsl_linalg.h:423:5: note: 'gsl_linalg_cholesky_decomp' declared here
int gsl_linalg_cholesky_decomp (gsl_matrix * A);
    ^
swig_src/gslwrap_wrap.c:15003:17: error: implicit declaration of function 'gsl_linalg_cholesky_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_scale((gsl_matrix const *)arg1,arg2);
                ^
swig_src/gslwrap_wrap.c:15003:17: note: did you mean 'gsl_linalg_cholesky_solve'?
/usr/local/include/gsl/gsl_linalg.h:425:5: note: 'gsl_linalg_cholesky_solve' declared here
int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky,
    ^
swig_src/gslwrap_wrap.c:15068:17: error: implicit declaration of function 'gsl_linalg_cholesky_scale_apply' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_scale_apply(arg1,(gsl_vector const *)arg2);
                ^
swig_src/gslwrap_wrap.c:15068:17: note: did you mean '_wrap_gsl_linalg_cholesky_scale_apply'?
swig_src/gslwrap_wrap.c:15031:22: note: '_wrap_gsl_linalg_cholesky_scale_apply' declared here
SWIGINTERN PyObject *_wrap_gsl_linalg_cholesky_scale_apply(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
                     ^
swig_src/gslwrap_wrap.c:15133:17: error: implicit declaration of function 'gsl_linalg_cholesky_decomp2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_decomp2(arg1,arg2);
                ^
swig_src/gslwrap_wrap.c:15133:17: note: did you mean 'gsl_linalg_cholesky_decomp'?
/usr/local/include/gsl/gsl_linalg.h:423:5: note: 'gsl_linalg_cholesky_decomp' declared here
int gsl_linalg_cholesky_decomp (gsl_matrix * A);
    ^
swig_src/gslwrap_wrap.c:15213:17: error: implicit declaration of function 'gsl_linalg_cholesky_svx2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_svx2((gsl_matrix const *)arg1,(gsl_vector const *)arg2,arg3);
                ^
swig_src/gslwrap_wrap.c:15213:17: note: did you mean 'gsl_linalg_cholesky_svx'?
/usr/local/include/gsl/gsl_linalg.h:429:5: note: 'gsl_linalg_cholesky_svx' declared here
int gsl_linalg_cholesky_svx (const gsl_matrix * cholesky,
    ^
swig_src/gslwrap_wrap.c:15318:17: error: implicit declaration of function 'gsl_linalg_cholesky_solve2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_solve2((gsl_matrix const *)arg1,(gsl_vector const *)arg2,(gsl_vector const *)arg3,arg4);
                ^
swig_src/gslwrap_wrap.c:15318:17: note: did you mean 'gsl_linalg_cholesky_solve'?
/usr/local/include/gsl/gsl_linalg.h:425:5: note: 'gsl_linalg_cholesky_solve' declared here
int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky,
    ^
swig_src/gslwrap_wrap.c:15412:17: error: implicit declaration of function 'gsl_linalg_cholesky_rcond' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_cholesky_rcond((gsl_matrix const *)arg1,arg2,arg3);
                ^
swig_src/gslwrap_wrap.c:15412:17: note: did you mean 'gsl_linalg_cholesky_decomp'?
/usr/local/include/gsl/gsl_linalg.h:423:5: note: 'gsl_linalg_cholesky_decomp' declared here
int gsl_linalg_cholesky_decomp (gsl_matrix * A);
    ^
swig_src/gslwrap_wrap.c:15636:17: error: implicit declaration of function 'gsl_linalg_pcholesky_decomp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_pcholesky_decomp(arg1,arg2);
                ^
swig_src/gslwrap_wrap.c:15636:17: note: did you mean 'gsl_linalg_cholesky_decomp'?
/usr/local/include/gsl/gsl_linalg.h:423:5: note: 'gsl_linalg_cholesky_decomp' declared here
int gsl_linalg_cholesky_decomp (gsl_matrix * A);
    ^
swig_src/gslwrap_wrap.c:15715:17: error: implicit declaration of function 'gsl_linalg_pcholesky_solve' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  result = (int)gsl_linalg_pcholesky_solve((gsl_matrix const *)arg1,(struct gsl_permutation_struct const *)arg2,(gsl_vector const *)arg3,arg4);
                ^
swig_src/gslwrap_wrap.c:15715:17: note: did you mean 'gsl_linalg_cholesky_solve'?
/usr/local/include/gsl/gsl_linalg.h:425:5: note: 'gsl_linalg_cholesky_solve' declared here
int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky,
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
error: Command "cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/local/include -IInclude -I. -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c swig_src/gslwrap_wrap.c -o build/temp.macosx-12.1-x86_64-2.7/swig_src/gslwrap_wrap.o" failed with exit status 1

How can I fix this problem? I have the swig module installed:
swig -version

SWIG Version 4.0.2

Compiled with clang++ [x86_64-apple-darwin21.1.0]

Configured options: +pcre

Thanks in advance!

redpajama_set_name: RedPajamaStackExchange


text:
Q: SqlDataAdapter can it be used to access oracle db? SqlDataAdapter can it be used to access oracle db?
Yes it says sql, but can it be used for oracle?

A: Microsoft has deprecated its own Oracle drivers. Use Oracle's drivers instead. They will perform better than OleDB or ODBC drivers.

A: No - at least, not directly, you can of course execute SQL Server queries (SqlDataAdapter is SQL Server specific) that access data from Oracle, but you'll need a SQL Server involved.  Check out Oracle and ADO.Net on MSDN instead.

A: OleDbDataAdapter or OdbcDataAdapter classes?


text:
Q: JPA - Weaving not enabled while running test cases I have an application that uses Eclipselink 2.5, and when running the Junit test cases, I always receive this warning:
[EL Warning]: metadata: 2013-08-19 01:14:05.142--ServerSession(14351551)--
Reverting the lazy setting on the OneToOne or ManyToOne attribute [currentTransit]
for the entity class [class ......persistent.entity.BPExecutionEntity] since
weaving was not enabled or did not occur.

So, I wrote a 'weaving' task on my Ant build file like this:
<target name="define.task" description="New task definition for EclipseLink static weaving">
    <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>
</target>
<target name="weaving" description="perform weaving" depends="define.task">
    <weave  source="D:\...\dist\${ant.project.name}.jar"
            target="D:\...\dist\woven-${ant.project.name}.jar"
            persistenceinfo="D:\...\lib\persistence.jar">
        <classpath>
        </classpath>
    </weave>
</target>

OK, everything works, and when I compile the code it generates a woven file half the size of the compiled jar. But, when I run the tests of the project then I still receive the same warning blah blah blah... since weaving was not enabled or did not occur.
Anybody knows how to remove this warning from my tests?

A: I finally solved the situation using dynamic weaving. As I'm using Netbeans 7.3.1, I went to the Project Options | Run | VM options and added this text: -javaagent:C:\eclipselink\jlib\eclipselink.jar, you can change the address to whatever address you have located the eclipselink.jar.
Then I added this line to the persistence.xml:
<property name="eclipselink.weaving" value="true"/>

That's all. This configuration enables dynamic weaving to execute test cases and removes the [EL Warning] Reverting the lazy setting on the OneToOne or ManyToOne attribute...etc.

A: You need to specify that static weaving is used in your persistence.xml properties.  See
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving
"Step 2: Configure persitence.xml" for details


text:
Q: ImportError: DLL load failed while importing _gdal: The specified procedure was not found I am trying to install GDAL and I always get this error message: ImportError:
DLL load failed while importing _gdal: The specified procedure was not found.

I have the Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
and use the wheel: GDAL-3.3.3-cp38-cp38-win_amd64.whl
Can it be that I am using the wrong wheel version and if so how do I find the right one?
where you can finde the wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
my code:
from asyncio.windows_events import NULL
from traceback import print_tb
from osgeo import gdal
from numpy import meshgrid
from numpy import linspace

map = Basemap(projection='tmerc',
              lat_0=0, lon_0=3,
              llcrnrlon=1.819757266426611,
              llcrnrlat=41.583851612359275,
              urcrnrlon=1.841589961763497,
              urcrnrlat=41.598674173123)

ds = gdal.Open("C:/elevation.tif")
data = ds.ReadAsArray()

x = linspace(0, map.urcrnrx, data.shape[1])
y = linspace(0, map.urcrnry, data.shape[0])

xx, yy = meshgrid(x, y)

cs = map.contour(xx, yy, data, range(400, 1500, 100), cmap = plt.cm.cubehelix)
plt.clabel(cs, inline=True, fmt='%1.0f', fontsize=12, colors='k')

plt.show()

(this is a basemap example)


text:
Q: I am getting date in this format Jul 20, 2022 6:16:29 PM from an API response in javascript I want to convert it into this format
Wed Jul 20 18:16:28 GMT+05:30 2022.
How can I achieve it using moment.js or any other suggestion?


text:
Q: Angular component not showing template I downloaded angular form https://angular.io/quick-start and then added a file to the app folder tutoriel.component.ts and wrote the following code
import { Component } from "@angular/core";
@Component({
    selector: 'tutoriel',
    template: '
Tutoriel
'
})
export class TutorielComp{

}

and then changed this in the app.module
@NgModule({
  declarations: [
    AppComponent,
    TutorielComp
  ],

and the class got imported import { TutorielComp } from './tutoriel.component'; The problem is when I deleted all the code in the app.component.html and wrote
<tutoriel></tutoriel>
But,It did not show.
Edit: This is my Module file
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { TutorielComp } from './tutoriel.component';

@NgModule({
  declarations: [
    AppComponent,
    TutorielComp
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }


text:
Q: In GitHub, at what levels can review comments be made? In GitHub, when code reviewer make review comments, I sometimes lose track of some comments, especially when the comments come from several repositories.
In order to show/list all the comments directed to me, what levels can comments be made?

*

*pull request level, i.e. for merging a branch to another branch, so when I click a pull request, I can find all the comments on that pull request?

*commit level, so when I click a commit, i can find all the comments on that commit?

*branch level, so when I click a branch, i can find all the comments on that branch?

*user account level, so when I click my account, I can find all the comments directed to me?

Thanks.

A: When you create a pull request, reviewers can post general comments on the PR issue or on individual lines in each commit. The later are visible in the PR, though, so you should just look there for all feedback. If any reviewer makes comments which are not visible there, then you should feel free to ignore them because the reviewer is not doing their job properly.


text:
Q: I need to center the  in  I need to center the
 in  because now (with my code) I see the div at right but I want to see the div in the center of . This is my code:

          Start date

          <input type="date" name="start_date">

          End date

          <input type="date" name="end_date">

Anyone can help me? I don' know how I can do this.

A: Use align in td

Live Demo

A: Add style="text-align: center;" in the table tag. Here is the JSFiddle

                Start date

                <input type="date" name="start_date">

                End date

                <input type="date" name="end_date">

A: Set this to the div:
display: flex;
justify-content: center;

A: If you do not force the width set for div, changes in alignment for td do nothing because div takes 100% of the width td. Then you need to provide alignment for the div NOT using text-align:
div {
  text-align: center;
}

let div leveled at you and its width is less than the width so on. then use margin:
div {
  margin: 0 auto;
}

Is better use flex:
td {
  display: flex;
  align-items: center;
  align-content: center;
}

A: You can only center the div (not the text!) without using javascript by adding a width to the elements. Then you can use margin: auto;.

div {
  width: 150px;
  margin: auto;
}

          Start date

          <input type="date" name="start_date">

          End date

          <input type="date" name="end_date">

Another way would be to use jQuery. This can even work with dynamic width.

$(window).resize(function() {
    $("td div").each(function() {
        var element = $(this),
            elementWidth = element.width(),
            parentWidth = element.parent().width();

        element.css("margin-left", ((parentWidth - elementWidth) / 2) + "px");
    });
}).resize();
div {
  display: inline-block;
}

          Start date

          <input type="date" name="start_date">

          End date

          <input type="date" name="end_date">

A: Are you trying to achieved something like this

                        Start date

                        <input type="date" name="start_date">

                        End date

                        <input type="date" name="end_date">

A: I assume you want everything inside the div to center on the page. Try:
style="text-align:center;"

or
style="justify-content:center;"

A: You can center the content of your div with:

but you should really put that in your CSS file and not inline

A:

          Start date

          <input type="date" name="start_date">

          End date

          <input type="date" name="end_date">

A: You can add text-align: center; into your div tags

          Start date

          <input type="date" name="start_date">

          End date

          <input type="date" name="end_date">

A: I have an interesting case where none of these solutions worked. There's a CSS level 3 trick that involves top:50% that DID work for me: https://www.w3.org/Style/Examples/007/center.en.tmpl#vertical3
The case I'm dealing with:
A jQuery slideshow that outputs divs. The site is adaptive, so I can't put in fixed widths for any of the elements. Despite that, I wanted to center items both vertically and horizontally inside each slide.
1. Using text-align:center wasn't enough because I also wanted to vertically center the text. Only table-cell elements react to vertical-align:middle. Which I think is a shame, because table-cell elements have a lot of, lets say... luggage. See point 2.
2. Declaring the inner div with display:table-cell didn't work because while I could center the text both horizontally and vertically inside the table-cell, the table-cell remained glued to the left inside its parent div.
The table-cell element did not react to width:100% or margin:0 auto. Nor did it obey the text-align:center of the parent div.
3. The top:50% hack (if I may call it that) does work if you follow the rules from the linked article. It places the element 50% down the height of the parent element and uses translate to move the child element back upwards by half its own height.
The catch is that it probably won't work on old browsers.
Aren't you screwed anyway trying to vertically align something in a fluid width design? Yes, for this trick to work the parent element must have a fixed height. Will take some experimenting.
Dude, this discussion is about horizontal alignment. Yes, I understand. But when you're desperate for a weird solution to a weird problem, a thread like this can be a life saver. Besides, this trick also works horizontally.


text:
Q: Law of Iterated Logarithm Upper Bound Implication Assume the Law of Iterated Logarithm upper bound
\begin{equation}
\limsup_{t\to \infty} \frac{B_t} {\psi(t)} \leq 1
\end{equation}
holds (almost surely). Now I have seen in a proof of the lower bound that for $t$ large enough
\begin{equation}
B_t \geq -2 \ \psi(t)
\end{equation}
is true because of the above mentioned upper bound. Can somebody explain this to me? Why wouldn't $B_t \geq - \psi(t)$ hold?
Recall that $\psi(t) = \sqrt{2t\log \log t}$.

A: Remember that by the definition of the limit supremum, we have
$$\limsup_{t\to\infty} f(t) \leq M \iff \left(\forall \epsilon > 0, \exists T : t > T \implies f(t) \leq M + \epsilon\right)$$
In particular, note that we cannot conclude $f(t) \leq M$ for any $t.$  (e.g. note that $\limsup_{n\to\infty} 1 + \frac{1}{n} \leq 1$)
In your context, this means we can set $\epsilon = 1$ to see that for $t$ large enough,
$$\frac{B_t}{\psi(t)} \leq 1 + 1 = 2 \implies B_t \leq 2\psi(t)$$ almost surely.
Then since $-B_t$ is a brownian motion, we can replace $B_t$ with $-B_t$ to conclude
$$-B_t \leq 2\psi(t) \iff B_t \geq -2\psi(t)$$
almost surely, for $t$ large enough.


text:
Q: cant play local sound when i press the sound button it show error :
E/flutter (30513): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Unable to load asset: assets/sound/1.mp3
E/flutter (30513): #0 PlatformAssetBundle.load
package:flutter/…/services/asset_bundle.dart:237
E/flutter (30513):
E/flutter (30513): #1 AudioCache.fetchToMemory
package:audioplayers/src/audio_cache.dart:89
E/flutter (30513):
E/flutter (30513): #2 AudioCache.load
package:audioplayers/src/audio_cache.dart:115
E/flutter (30513):
E/flutter (30513): #3 AudioCache.play
package:audioplayers/src/audio_cache.dart:159
E/flutter (30513):
E/flutter (30513):
and i have been edited the pubspec.yaml already :
flutter:
uses-material-design: true
assets:

*

*sound/

A: You need to specify the complete path, see this example below (each in its own line):
  uses-material-design: true
  assets:
    - assets/sounds/


text:
Q: null property for component after ChangeDetectorRef detectChanges() Why is the component null after changeDetector is called?
@HostListener('window:resize', ['$event'])
onResize(event) {
    clearTimeout(this.resizeTimer);
    this.resizeTimer = setTimeout(this.resizeObj(), 500);
}

resizeObj() {
    this.applyUpd(this.dataList);
    this.changeDetector.detectChanges();
}

applyUpd(dataList: Data[]) {

    for (var i = 0; i < this.dataList.length; i++) {
        this.dataList[i].applyData(this.width, this.height);
    }

}

Constructor
constructor(private changeDetector: ChangeDetectorRef) {
        this.resizeTimer;
        this.route.data
            .subscribe(( data: { dataList: Data[] }) => {
                // ...
            });
    }

Error:
core.es5.js:1084 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'dataList' of null
TypeError: Cannot read property 'dataList' of null
    at Object.eval [as updateDirectives] (DataListComponent.html:7)
    at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:12806)
    at checkAndUpdateView (core.es5.js:12144)
    at callWithDebugContext (core.es5.js:13206)
    at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.es5.js:12746)
    at ViewRef_.detectChanges (core.es5.js:10218)
at DataListComponent.webpackJsonp.151.DataListViewComponent.applyUpd(data-list-view.component.ts:73)
    at SafeSubscriber._next (data-list.component.ts:55)
    at SafeSubscriber.__tryOrSetError (Subscriber.js:247)
    at SafeSubscriber.next (Subscriber.js:187)
    at Object.eval [as updateDirectives] (DataListComponent.html:7)

A: the error is in onResize(event) method.
You call this.changeDetector.detectChanges() before the component init.
change
this.resizeTimer = setTimeout(this.resizeObj(), 500);

to
this.resizeTimer = setTimeout(this.resizeObj, 500);


text:
Q: Sub-Submenu not appearing on mobile device After asking this question, I was able to I was able to add sub-submenu support to my site. However, on mobile, the menus just appear as blank lines.

A: Replace:
#menu .menus li > ul.menus {
  transform: translateX(100%) scale(1.0);
  top: 0;
}

with
@media only screen and (min-width: 981px) {
  #menu .menus li > ul.menus {
    transform: translateX(100%) scale(1.0);
    top: 0;
  }
}

If worst comes to worst, you could not replace anything and just add this code:
@media only screen and (max-width: 980px) {
  #menu .menus li > ul.menus {
    transform: translateX(100%) scale(1.0) !important;
  }
}


text:
Q: Convex sets in Alexandrov spaces Let $X$ be a compact Alexandrov space with $curv\geq 1$ (and without boundary). Does $X$ always have a nontrivial compact convex subset without boundary?
Definition of a convex subset: $A\subseteq X$ is called convex if for every two points $p ,q\in A$, there exists a minimizing geodesic between them which is completely in $A$.

A: This is extremally rare, even if $X$ is a Riemannian manifold.
If the convex set $A$ has interior points, then any boundary point of the subset $A$ in $X$ lies on the boundary of Alexandrov space $A$.
So if $X\ne A$ then $\dim A<\dim X$.
Note that $A$ has to be totally geodesic, otherwise an end of geodesic would be a boundary point of $A$.
Generic Riemannian manifold do not have totally geodesic submanifolds of dimension at least 2.
So, we are left with the case $\dim A=1$.
In other words, $A$ is a closed geodesic in $X$.
Since $A$ is convex, it has to be length minimizing on each half.
This is also extremally rare thing --- generic Riemannian manifold does not have such geodesics.


text:
Q: Event for Red Close button of NSWindowController How can I handle an event where I click on the red close button of a NSWindowController?
Reason for asking is that I have a video playing in a new NSWindowController window and when user clicks on the red close button, the audio continues playing, so I want to use the event to close the video.

A: Make your NSWindowController subclass conform to the NSWindowDelegate protocol and be the delegate of the corresponding window. Having done that, implement:
- (void)windowWillClose:(NSNotification *)notification {
    // whichever operations are needed when the
    // window is about to be closed
}

in your NSWindowController subclass.

A: In my case, I need to observe the event, see https://stackoverflow.com/a/44721893/1418457
NotificationCenter.default.addObserver(self, selector: #selector(windowWillClose(_:)), name: Notification.Name.NSWindowWillClose, object: nil)


text:
Q: Pivot table; remove old values from slicer I have two pivot tables that are connected with a slicer.
The slicer is used to set the date on both pivot tables.
The problem is that it keeps showing old values that are not in the data anymore.
On one of the files (I have four similar files) I have deleted everything that is newer than 2016-05-09, but still the slicer is showing other dates that month.
If I click on them the tables are empty so clearly it can't find any values with those dates.
The old values are written with gray text.
I have tried to find a solution to this issue on google but no luck.
I have tried to update both tables and I have even removed the slicer and then created a new one, but still the old values does not go away.
Anyone have a clue why it's doing this?
Excel 2010.

A: This has nothing to do with the slicer.This is to do with the PivotCache  for the PivotTable. If you check the Dropdown filters on the PivotTable , you will also see there is checkboxs for data that is not currently in your dataset.
To change this:-
Right click your PivotTable> PivotTable Options
On the Data Tab , Change "Number of items to retain per field" from Automatic to None and press OK.
Then refresh your PivotTable.  The Filters on the PivotTable and the Slicer will now only show values that are currently in the dataset.


text:
Q: Get data cursor callback in Matlab GUI How can I set the Matlab GUI data cursor callback for a specific GUI axes?
I was able to add the data cursor icon in GUI toolbar. I can selected 3D point on the plotted data, but I need to add more info in the data cursor text and also do some other stuff with the coordinates it is getting.
I tried to follow "How to add additional info to the data cursor?", but doesn't work for GUI.
GUI axes are not figures, so I'm getting this error:
Error using datacursormode (line 149)
Invalid figure handle
I need the same here, but for GUI axes (figures?):
function test_main
% Plots graph and sets up a custom data tip update function
fig = figure('DeleteFcn','doc datacursormode');
X = 0:60;
t = (X)*0.02;
Y = sin(-16*t);
plot(X,Y)
dcm_obj = datacursormode(fig); % tried here "handles.MyFigHandle"
set(dcm_obj,'UpdateFcn',{@myupdatefcn,t})

function txt = myupdatefcn(~,event_obj,t)
% Customizes text of data tips
pos = get(event_obj,'Position');
I = get(event_obj, 'DataIndex');
txt = {['X: ',num2str(pos(1))],...
       ['Y: ',num2str(pos(2))],...
       ['I: ',num2str(I)],...
       ['T: ',num2str(t(I))]};

For now I can get only the default datacursor behavior, like this image:

A: I've not found any difference between the use of the data cursor in a GUI and in a figure.
Re-using part of your code, I've created a GUI in which a checkbox enable / disable the datacursormode.
The GUI contains two axes in which two lines and a 3D surface are plotted respectively.
Also three radiobuttons control the string that will be printed in the textbox generated when the datacursormode is enabled.
The tags of the GUI are the folowing:

*

*left axes: axes_2d

*right axes: axes_3d

*left pushbutton: pushbutton_2d

*right pushbutton: pushbutton_3d

*checkbox: checkbox_enable_dc

*left radiobutton: radiobutton1

*middle radiobutton: radiobutton2

*righ radiobutton: radiobutton3
The GUI works this way:

*

*the pushbuttons plot in the axes and enable the checkbox

*the checkbox enable / disable the datacursormode

*by default, the left radiobutton is selected and sets the default string

*the other two radiobutton set a different string

Based on the selected radiobutton, the first line of the string in the textbox will be either:

*

*DEFAULT STRING

*STRING OPTION ONE

*STRING OPTION TWO

the string to be written in the textbox is created in your myupdatefcn that has been modified to handle the options selected by the radiobutton.
Notice: in order not to limit the modification to your version of the myupdatefcn function, I've hard coded the t array.
This is the .m file of the GUI:
function varargout = gui_datacursormode(varargin)
% GUI_DATACURSORMODE MATLAB code for gui_datacursormode.fig
%      GUI_DATACURSORMODE, by itself, creates a new GUI_DATACURSORMODE or raises the existing
%      singleton*.
%
%      H = GUI_DATACURSORMODE returns the handle to a new GUI_DATACURSORMODE or the handle to
%      the existing singleton*.
%
%      GUI_DATACURSORMODE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI_DATACURSORMODE.M with the given input arguments.
%
%      GUI_DATACURSORMODE('Property','Value',...) creates a new GUI_DATACURSORMODE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before gui_datacursormode_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to gui_datacursormode_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help gui_datacursormode

% Last Modified by GUIDE v2.5 02-Apr-2017 17:45:45

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @gui_datacursormode_OpeningFcn, ...
                   'gui_OutputFcn',  @gui_datacursormode_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before gui_datacursormode is made visible.
function gui_datacursormode_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to gui_datacursormode (see VARARGIN)

% Choose default command line output for gui_datacursormode
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes gui_datacursormode wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = gui_datacursormode_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in pushbutton_2d.
function pushbutton_2d_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_2d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Plot two lines in the first axes
t=0:.1:2*pi;
plot(handles.axes_2d,t,sin(t),'r');
hold(handles.axes_2d,'on')
plot(handles.axes_2d,t,cos(t),'b');
% Enable the checkbox that will set datacorsormode on
handles.checkbox_enable_dc.Enable='on';

% --- Executes on button press in pushbutton_3d.
function pushbutton_3d_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_3d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Plot a 3D graph in the second axes
axes(handles.axes_3d);
peaks

% Enable the checkbox that will set datacorsormode on
handles.checkbox_enable_dc.Enable='on';

function txt = myupdatefcn(~,event_obj,t)
% Customizes text of data tips

% Get the handles of the GUI to access to the radiobuttons
my_guidata=guidata(gcf);
% Define the additional string to be written
if(my_guidata.radiobutton1.Value)
   str='DEFAULT STRING ';
elseif(my_guidata.radiobutton2.Value)
   str='STRING OPTION ONE ';
else
   str='STRING OPTION TWO ';
end

% Get the datacursor data
pos = get(event_obj,'Position');
I = get(event_obj, 'DataIndex');
% Create the whole string to be written
txt = {[str], ...
       ['X: ',num2str(pos(1))],...
       ['Y: ',num2str(pos(2))],...
       ['I: ',num2str(I)],...
       ['T: ',num2str(t(I))]}

% --- Executes on button press in checkbox_enable_dc.
function checkbox_enable_dc_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox_enable_dc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% If the checkbox is set
if(hObject.Value)
   %  enable the radiobuttons that control the string to be written
   handles.radiobutton1.Enable='on';
   handles.radiobutton1.Value=1;
   handles.radiobutton2.Enable='on';
   handles.radiobutton3.Enable='on';
   % Create the datacursormode object
   dcm_obj = datacursormode(gcf)
   t=rand(1,10000);
   set(dcm_obj,'DisplayStyle','datatip',...
      'SnapToDataVertex','off','Enable','on', ...
      'UpdateFcn',{@myupdatefcn,t})
else
   % If the checkbox is not set, disable the datacursormode
   datacursormode 'off'
end

% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1

% Toggle the other radiobuttons
handles.radiobutton2.Value=0
handles.radiobutton3.Value=0

% --- Executes on button press in radiobutton1.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1

% Toggle the other radiobuttons
handles.radiobutton1.Value=0
handles.radiobutton3.Value=0

% --- Executes on button press in radiobutton1.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1

% Toggle the other radiobuttons
handles.radiobutton1.Value=0
handles.radiobutton2.Value=0

Hope this helps,
Qapla'


text:
Q: Cannot see available network page after updating to KB4346783 I just updated my laptop using Windows 10 1803 using the cumulative update package (KB4346783). Everything is working great except I cannot click on network taskbar icon and see available network connections.
I am already connected to Wifi, and it's working fine. But I cannot to another one beacuse that page is not showing up. Uninstalling the update seem to fix it for me.
How do I fix it without uninstalling the updates.
Edit: As a temporary fix (if you want to install latest updates), I am able to access available network connection page through lock screen. So just lock your computer, and connect to wifi from that screen.

A: It turned out (by checking event logs), ShellExperienceHost was crashed during the update because of my firewall software.
Reinstalling shell experience host fixed the problem for me.
Get-AppxPackage Microsoft.Windows.ShellExperienceHost | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}


text:
Q: Why does TypeORM require the inverse side of OneToMany to be provided, but doesn't require the inverse side of ManyToOne to be provided? The following quote is taken from the TypeORM docs:

@OneToMany cannot exist without @ManyToOne. If you want to use @OneToMany, @ManyToOne is required. However, the inverse is not required: If you only care about the @ManyToOne relationship, you can define it without having @OneToMany on the related entity. Where you set @ManyToOne - its related entity will have "relation id" and foreign key.

Why do you need to provide the inverse side of OneToMany but not ManyToOne?

A: It is because ManyToOne puts the foreign key in the current entity table, it is necessary for SQL table definition generation. After all it is just a SQL column that is a foreign key in the end, and TypeOrm requires an entity definition that allows it to correctly generate SQL statements.
TypeOrm needs to know where the foreign key is to generate the fetch SQL query of the list, thus requiring the ManyToOne mapping. If OneToMany is undefined then nothing is fetched, so it also works.


text:
Q: "Had me blind" and grammar in lyrics/poems I'm looking at a line from the song "I Can See Clearly Now". It's the line: Gone are the dark clouds that had me blind.
I know that that line is in the passive voice ("the dark clouds that had me blind are gone"), but rearranged with poetic liberty to emphasize "gone". But what's really bothering me is the "had me blind" part.
I'm trying to explain what's happening there. Which do you think is correct?

*

*It's rearranged from a past-perfect tense, and the past participle was dropped ("The dark clouds that had blinded me")

*"Had" holds the meaning of "made" ("The dark clouds that made me blind")

*Something else I haven't thought of

Thanks for the help in advance! I appreciate it!

A: I think your second theory is best: you can substitute 'made' for 'had'. If my daughter arrived home late I might say, "You had me worried," meaning "you made me worried" or "you worried me". Janus Bahs Jacquet's suggestion of 'kept' is also good when, as he says, it refers to a state.
But when we say "she had me guessing", or, of a sad film, "it had me sobbing", you can't simply substitute either. "She made me guess" and "It made me sob" would be better substitutions. In another common usage, "It had me on the edge of my seat", (meaning "The suspense was almost unbearable") it's hard to find any usable substitution, neither "put" nor "held" being quite right.
Although it's a very common expression I haven't been able to find its first appearance. It may derive from 'to have someone at a disadvantage'. Which - to my surprise - doesn't occur in Don Quixote but which Charles Dickens uses no less than three times in Barnaby Rudge (1840-1)
In The Scarlet Pimpernell [1905] we read:

Sir Percy Blakeney wrenched the weapon from his enemy's grasp.
The position now was one which would have made even a braver man than
  Chauvelin quake. He stood alone and unarmed in face of an enemy from
  whom he could expect no mercy.[...]
"You have me at a disadvantage, Sir Percy," he said, speaking every
  whit as coolly as his foe.


text:
Q: Minimum cost path on the whole globe? I am trying to generate the maritime distance between seaports across the world. I am using the cost distance and cost path tool from ArcGIS to extract the shipping lanes from a raster file which contains the density of ships.
Here is the problem that I have. When I tried finding the path connecting Shanghai and San Francisco it provides the result in the figure below. The red line is the path found, the green circle is Shanghai and the green square is San Francisco. As can be seen, it takes all the trouble to go through the Atlantic and Indian Ocean, instead of just cross the Pacific.
I think the problem is that the two sides of the Pacific are not connected on the map. Is there a way that I can tell the tool that the left hand side and right hand side of the map are connected? The projection that I am using is WGS_1984_Mollweide.


text:
Q: Android Can't set image in a ListView layout Looks like find the image but i don't know how to insert into the simple adapter (or anything that let me set the image in my layout)
https://gyazo.com/61ab064c19ae50090f08e6436776a52e
I want to set an image for each object in the array, like:
monsterimglist.setImageResource(R.mipmap.icon_name);

For the moment im testing to show R.mipmap.a1 in all the array items in the listview.
Error: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageResource(int)' on a null object reference
Someone can help me? Thanks a lot
ListView monsterslistview;
ImageView monsterimg;
TextView monstername;
TextView monstertype;

private static String monsterid;
ArrayList<HashMap<String, String>> MonstersList;

@Override
protected void onCreate(Bundle savedInstanceState)  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_monsters);

    //Fiquem els elements creats la seva id corresponent
    monstername = (TextView) findViewById(R.id.namelayout);
    monstertype = (TextView) findViewById(R.id.typelayout);
    monsterslistview = (ListView) findViewById(R.id.monsterslistview);
    monsterimg = (ImageView) findViewById(R.id.imglayout);

    HashMap<String, String> hashMap;

    //Creem un nou objecte ArrayList per inserir les dades
    MonstersList = new ArrayList<HashMap<String, String>>();

    //..........Process JSON DATA................
        try {
            JSONObject reader = new JSONObject(loadJSONFromAsset());

            //Guardem a un Array de tipus JSON les dades
            JSONArray jr = reader.getJSONArray("monsters");
            for (int i = 0; i < jr.length(); i++) {
                JSONObject jsonObjectLine = jr.getJSONObject(i);

                // Desem els items JSON en una variable
                String id = jsonObjectLine.getString("id");
                String name = jsonObjectLine.getString("name");
                String type = jsonObjectLine.getString("type");
                String icon = jsonObjectLine.getString("icon");

                //Toast.makeText(ListMonsters.this, id, Toast.LENGTH_LONG).show();

                // Afegim la clau-valor a un objecte HashMap
                hashMap = new HashMap<String, String>();
                hashMap.put("id", id);
                hashMap.put("name", name);
                hashMap.put("type", type);
                hashMap.put("icon", icon);
                MonstersList.add(hashMap);

                //mostrem per pantalla els elements que volem mostar
                ListAdapter adapter = new SimpleAdapter(
                        ListMonsters.this,
                        MonstersList,
                        R.layout.onemonster,
                        new String[]{"name", "type","icon"},
                        new int[]{R.id.namelayout, R.id.typelayout, R.id.imglayout}

                );
                //Picasso.with(getApplicationContext()).load(R.mipmap.a1).into(monsterimglist);
                monsterslistview.setAdapter(adapter);
                //String idagafat = MonstersList.get(i).get("icon").replace(" ", "");
                monsterimg.setImageResource(R.mipmap.a1);

                monsterslistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        /**
                        String idagafat = MonstersList.get(position).get("id").replace(" ", "");
                        String positionagafada = String.valueOf(position);
                        openmonster(idagafat, positionagafada);
                         **/

                    }
                });

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

// Funció llegir json
public String loadJSONFromAsset() {
    String json = null;
    try {
        InputStream is = ListMonsters.this.getAssets().open("monsters.json");
        int size = is.available();
        byte[] buffer = new byte[size];
        is.read(buffer);
        is.close();
        json = new String(buffer, "UTF-8");
    } catch (IOException ex) {
        ex.printStackTrace();
        return null;
    }
    return json;
}

public void openmonster(String id, String pos){
    int posarray = Integer.parseInt(pos);

    Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("icon").replace(" ", ""), Toast.LENGTH_SHORT).show();
    //Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("name").replace(" ", ""), Toast.LENGTH_SHORT).show();
    //Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("type").replace(" ", ""), Toast.LENGTH_SHORT).show();
}

}

A: Close the Bracket before creating the adapter.May be it will change your result.
Updated :
    ListView monsterslistview; ImageView monsterimg; TextView monstername; TextView monstertype;

private static String monsterid; ArrayList<HashMap<String, String>> MonstersList;

@Override protected void onCreate(Bundle savedInstanceState)  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_monsters);

    //Fiquem els elements creats la seva id corresponent
    monstername = (TextView) findViewById(R.id.namelayout);
    monstertype = (TextView) findViewById(R.id.typelayout);
    monsterslistview = (ListView) findViewById(R.id.monsterslistview);
    monsterimg = (ImageView) findViewById(R.id.imglayout);

    HashMap<String, String> hashMap;

    //Creem un nou objecte ArrayList per inserir les dades
    MonstersList = new ArrayList<HashMap<String, String>>();

    //..........Process JSON DATA................
        try {
            JSONObject reader = new JSONObject(loadJSONFromAsset());

            //Guardem a un Array de tipus JSON les dades
            JSONArray jr = reader.getJSONArray("monsters");
            for (int i = 0; i < jr.length(); i++) {
                JSONObject jsonObjectLine = jr.getJSONObject(i);

                // Desem els items JSON en una variable
                String id = jsonObjectLine.getString("id");
                String name = jsonObjectLine.getString("name");
                String type = jsonObjectLine.getString("type");
                String icon = jsonObjectLine.getString("icon");

                //Toast.makeText(ListMonsters.this, id, Toast.LENGTH_LONG).show();

                // Afegim la clau-valor a un objecte HashMap
                hashMap = new HashMap<String, String>();
                hashMap.put("id", id);
                hashMap.put("name", name);
                hashMap.put("type", type);
                hashMap.put("icon", icon);
                MonstersList.add(hashMap);

    }   //-----This Bracket was missed in your code

                //mostrem per pantalla els elements que volem mostar
                ListAdapter adapter = new SimpleAdapter(
                        ListMonsters.this,
                        MonstersList,
                        R.layout.onemonster,
                        new String[]{"name", "type","icon"},
                        new int[]{R.id.namelayout, R.id.typelayout, R.id.imglayout}

                );
                //Picasso.with(getApplicationContext()).load(R.mipmap.a1).into(monsterimglist);
                monsterslistview.setAdapter(adapter);
                //String idagafat = MonstersList.get(i).get("icon").replace(" ", "");
                monsterimg.setImageResource(R.mipmap.a1);

                monsterslistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        /**
                        String idagafat = MonstersList.get(position).get("id").replace(" ", "");
                        String positionagafada = String.valueOf(position);
                        openmonster(idagafat, positionagafada);
                         **/

                    }
                });

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

// Funció llegir json public String loadJSONFromAsset() {
    String json = null;
    try {
        InputStream is = ListMonsters.this.getAssets().open("monsters.json");
        int size = is.available();
        byte[] buffer = new byte[size];
        is.read(buffer);
        is.close();
        json = new String(buffer, "UTF-8");
    } catch (IOException ex) {
        ex.printStackTrace();
        return null;
    }
    return json; }

public void openmonster(String id, String pos){
    int posarray = Integer.parseInt(pos);

    Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("icon").replace(" ", ""), Toast.LENGTH_SHORT).show();
    //Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("name").replace(" ", ""), Toast.LENGTH_SHORT).show();
    //Toast.makeText(ListMonsters.this, MonstersList.get(posarray).get("type").replace(" ", ""), Toast.LENGTH_SHORT).show(); }


text:
Q: Dividing doubles returns 0 Below I have the code in my project for a base 58 conversion i've written. Getting the remainder of two small numbers works fine, but when trying to get the remainder of two large numbers represented like for example - 1.03475761285374E+33 returns 0. Is there a way to divide doubles and get a remainder?
Function Base58Value(sInput As String) As String

'reverse the input
sInput = StrReverse(sInput)

'get the length of the input string
Dim inputLen As Long
inputLen = Len(sInput)

'set up an array for each character
Dim sCharacter() As Integer
ReDim sCharacter(inputLen)

'set up an array for step 2 - index times 8 to the 2nd power
Dim sStep2() As Double
ReDim sStep2(inputLen)

'set up an array or step 3
Dim sStep3() As Double
ReDim sStep3(inputLen)

Dim sFinalNumber As Double
For x = 1 To inputLen
curchar$ = Mid(sInput, x, 1)
sCharacter(x) = Asc(curchar)
sStep2(x) = 2 ^ ((x - 1) * 8)
sStep3(x) = sCharacter(x) * sStep2(x)
sFinalNumber = sFinalNumber + sStep3(x)
Next x

Dim sRemainder() As Integer
ReDim sRemainder(0)
Dim sValue As Double
sValue = sFinalNumber
Dim sNextValue As Double
Dim sIter As Long
sIter = 0

Do Until Fix(sValue) = 0
DoEvents
ReDim Preserve sRemainder(sIter + 1)
sRemainder(sIter) = sMod(Fix(sValue), 58)
sValue = Fix(sValue / 58)
sIter = sIter + 1
Loop

Dim ConversionTable$
ConversionTable = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
Dim addValues As String
addValues = ""
Dim xI As Integer
For xI = 0 To UBound(sRemainder) - 1
DoEvents
List1.AddItem (sRemainder(xI))
addValues = addValues + Mid(ConversionTable, sRemainder(xI) + 1, 1)
Next xI

Base58Value = StrReverse(addValues)

End Function

Public Function sMod(a, b)
Dim x As Variant
x = a / b
x = x - Fix(x)
x = x * b
sMod = x
End Function

A: Without actually analyzing what your code does, I'll say that floating point values represent a compromise between range and precision: it's not possible to have all of both. A very large float is not necessarily able to store a very precise value.
There are only about 53 bits of actual precision in a VB double, so the largest integer that can be stored exactly is around 15 digits long.
Try using Decimals (variant) instead. I'm not sure they'll do what you need because as I said I didn't analyze your code. But they do offer extended precision -- up to 29 decimal digits, twice what a double offers.


text:
Q: Writing a script that automatically forwards emails from a Yahoo Mail address Starting 1/1/2021 Yahoo Mail is making automatic email forwarding a Premium/Paid Feature for all users. Quite a scummy thing to do in my opinion.
I have looked through some Yahoo API documents, but they are either deprecated, or don't seem to offer integration with Yahoo Mail.
https://developer.yahoo.com/oauth2/guide/openid_connect/getting_started.html
This explains how to access the API for read/write access to emails, but it seems these features are either behind a paywall or are deprecated. I've kind of hit a dead end.
Either way, I would assume Yahoo would wall off this functionality since they are making it a paid feature...
I'm thinking of maybe trying test automation software to manually forward emails, but that seems like it may get cumbersome.
If anyone has any insight into this, it would be greatly appreciated.
Thank you in advance.


text:
Q: Trusted Web Activity [TWA] - Can it read AccountManager accounts on Android? Problem: Attempting to read accounts created via AccountManager API in Android via a TWA LauncerActivity.

*

*I'm aware that some native functionality isn't possible in Android, and if I am attempting something that is impossible please link me a resource. I haven't came across anything explicitly about account manager access.

I have confirmed I have accounts on device, and am attempting a print out to Logcat of all of the accounts, but I am returned no results:
    private void printAccounts() {
        Account[] accounts = AccountManager.get(this).getAccounts();

        Log.d("FoundAccount", "Total accounts: " + accounts.length);

        for (Account account : accounts) {
            Log.d("FoundAccount", ": " + account.name);
        }
    }

Resulting output via Logcat: D/FoundAccount: Total accounts: 0
Any resources would be greatly appreciated, thank you!

A: After running the exact same code in a pre-existing Android application, the accounts were pulled right away for Google and custom third party accounts. Safe to say this functionality doesn't exist for TWAs... if anyone else has any links to the documentation for this, I would say that is still pertinent information, but for the sake of answering this question for anyone else seeking an answer to the same question.... the answer is no, this functionality is not possible, at least at this time.


text:
Q: genetic programming fitness function I am trying to write a fitness function in genetic programming to enlarge the area occupied by the points inside the polygon. There are some points near the center of the polygon, I want to expand these points from the center till it is just inside the polygon.
I was using the difference between the area occupied by the points inside the polygon and the area of outside polygon and trying to minimize it in the fitness function. But I don't know how to use this to change the coordinates of the points and then recalculate the difference in area and do it iteratively. I have given how the input and output should look like.
Thanks in advance.
This is the code I have written so far.
require(rgp)
require(splancs)
require(grDevices)
functionSet1 <- functionSet("+", "*", "-", "/","^")
inputVariableSet1 <- inputVariableSet("x","y")
constantFactorySet1 <- constantFactorySet(function() rnorm(1))

outpolygon<-matrix(c(3.061188,2.517408,0.523754,-0.258800,0.981104,4.036885,
                     3.061188,4.069070,4.069070,2.695074,0.485581,-2.129055,
                     -2.653607,4.069070),nrow=7,byrow=F)
inpoints<-matrix(c(2.637644,-0.4456578,2.160003,0.8553066,1.501256,1.3137518,2.352020,-0.2643815,
                   1.254139,1.2241712,1.918191,0.6595725,1.453478,0.9153824,1.900110,1.0607272,
                   1.648038,0.6847361,2.194931,2.2842159),nrow=10,byrow=T)

plot(-10:10,xlim=c(-5,5),ylim=c(-5,5))
polygon(outpolygon[,1],outpolygon[,2])
points(inpoints[,1],inpoints[,2])

fitnessFunction1 <-  function(f){
  if(all(point.in.polygon(inpoints[,1],inpoints[,2],outpolygon[,1],outpolygon[,2])!=0)){
    rmse(areapl(inpoints[chull(inpoints[,1],inpoints[,2]),]),areapl(cbind(outpolygon[,1],outpolygon[,2])[chull(outpolygon[,1],outpolygon[,2]),]))
  }else{
    rmse(1000,0)
  }
}

gpResult1 <- geneticProgramming(functionSet=functionSet1,
                                inputVariables=inputVariableSet1,
                                constantSet=constantFactorySet1,
                                fitnessFunction=fitnessFunction1,
                                stopCondition=makeTimeStopCondition(10))

best1 <- gpResult1$population[[which.min(sapply(gpResult1$population,
                                                fitnessFunction1))]]

A: There are a few ways you could do this. The easiest way would actually be with a GA, not a GP. In this case, you would have an array of integers broken into quads such that:
[funcx1, valx1, funcy1, valy1, funcx2, valx2, funcy2, valy2, ... , funcxn, valxn, funcyn, valyn]
Your fit function would take the modulus of the funcxi and get the corresponding function. Then, you would apply the number in valxi to that function to the corresponding x value. Given the points that are returned, you would calculate the area as you said and punish the individual if they go over the corresponding area (negative constant or factor by degree over).
Alternatively, if you have to use a GP for some reason, there are two main routes. If you want the code to be generic (i.e., you apply the same evolved chunk of code to each point; note: this is way harder), you would need more non-terminals (i.e., functions). I would probably add if-statements at minimum. Automatically defined functions (ADFs) would also be good and some kind of grouping function like progn from Lisp. Suffice to say, the GA method is way easier.
The other route is to use a more structured GP and add an assignment function instead.
GPnonterminals: +, -, *, /, ^, = (all vector functions)
GPterminals: point1, point2, ..., pointn, randompoint()
Using a Lispy structure, your code would look something like:
(* (= (= point2 (* randompoint() (= point2 randompoint()))) point1) randompoint())
Then, when you evaluate it, you would make all the assignments from the leafs to the root with overwriting of the lower points by higher ones. So, in the example above, point2 would get assigned as a random point (probably bad). The result would get multiplied by a random point and then overwrite the original assignment made to point2 with the result. That same result would get assigned to point1 and, finally, it would get multiplied by a randompoint. However, since there are no further assignments, the final value would just be discarded.
The reason why this is "more structured" is that you have to make sure assignment never occurs on anything other than a point. Grammar-based or grammar-guided GPs are particularly good at this. I'll refer you to this paper by Whigham (1995) that explains them:
http://sc.snu.ac.kr/courses/2007/fall/pg/aai/GP/whigham/whigham95grammaticallybased.pdf
If you use a GP, in either case, you are going to have to write some functions for list traversal for the format I described above. I also suggest using points and vector functions rather than x's and y's so that you have less terminals to keep track of (and your program trees will be smaller/process faster). Oh, and make sure the randompoint() function returns a specific point (i.e., make sure you evaluate it before you put it into the chromosome or the code will give inconsistent results -- very bad, that). And make the range of those possible points reasonable (i.e., don't go to 100 if you are in a space of 10 squared).
You have a bit of a way to go, but hopefully that points you in the right direction.


text:
Q: Simulation of PLL I am simulating a PLL with a reference frequency of 25 MHz, VCO freq of 450 MHz. I want to plot the gain versus frequency offset of the closed loop PLL in cadence. How should I give the inputs to get the offset frequencies and how should I plot the graph??

The graph is just for a reference. It is the blue graph that I want to plot

A: Based on a small-signal model of all components you can draw the small-signal frequency-dependent PLL model. If you excite this model with an ac signal each circuit simulator (ac analysis) will give you the desired lowpass response.
However, note that
1) the closed-loop model applies to in-lock conditions only,
2) the corresponding closed-loop transfer function is a "Phase-Transfer function":
H(s)=f(output phase/input phase)  .
3) The frequency variable (horizontal axis) is not a "frequency offset" but a "fictitious" frequency w=d(PHI)/dt.


text:
Q: Problem while importing with pandas python I am having a problem while importing data with pandas.
Here is the situation. I have a file which I have to skip the initial 40 lines.
Afterwards, it needs to separate the data with ';' and use ',' as a decimal.
Then, the first and second columns should be assigned to the variable x and y, respectively.
Here is the code I am using:
 data = pd.read_csv(path, sep=';', skiprows=40, header=None,engine='python', decimal=",")
# Separates the data into x vector and y vector
x=data.loc[:,0].values
y=data.loc[:,1].values

The data vector comes out as:
   0  29.49486      0.10915     -0.30708
   1  30.45667      0.17562     -0.30724
   2 31.41848       0.23216     -0.30735
   3 32.38029       0.27814     -0.30750
   4 33.34211       0.31412     -0.30764
   5 34.30390       0.34117     -0.30794
   .
   .
   .
166  189.15537      0.41301     -0.16899
167  190.11718      0.41302     -7,7716e-002
168  191.07899                   2,7883e-002

Everything, except the last 2 lines are imported as expected.
when assigning the vectors to variables with:
  x=data.loc[:,0].values
  y=data.loc[:,1].values

I get the x vector as float64 and the y as an object.
What am I doing wrong while importing?
Kind Regards!


text:
Q: How to force solr QParserPlugin not to use whitespace tokenizer for Keyword fields? I have keyword field in Solr schema.
<fieldType name="text_keyword" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.SimpleKeywordTokenizerFactory"/>
</analyzer>
</fieldType>

When I try to search this field with default solr query or dismax query
category:(Mouse Pad) it creates query (category:Mouse) AND (category:Pad)
I want to know is there a way not to split terms by whitespaces if it is keyword field or so.
Added:
I need SimpleKeywordTokenizerFactory analyze (which is lowercase without white-space splitting) on query, so raw and term query parser doesn't work for me

A: You want to enter this query:
category:"Mouse Pad"

The query syntax already provides a way to do this. Quotes are for phrases. Parentheses mean something different. You can write your own query parser if you want, but I don't recommend it.

A: You could use TermQParserPlugin:
{!term f=category}Mouse Pad
Beware that no analysis is performed, so this will only work if the internal representation of your field is "Mouse Pad" (with title case).
Edit (2012-04-17):
If you still want analysis to be performed, all you need to do is to escape the space by prepending a backslash:
{!lucene}category:Mouse\ Pad


text:
Q: Understanding Execution Environment of a Process How do I know the difference in the 'execution env' of a process in two different contexts?
To articulate the question properly, I have plan9port installed in /opt/plan9/ and when I run the fortune program from /opt/plan9/bin/fortune it works fine. (reads the list of fortunes from /opt/plan9/lib/fortune and /opt/plan9/lib/fortune.index ). When I call it from inside of a c code (test.c) with
char* opts[] = {"fortune"};
execve("/opt/plan9/bin/fortune", opts, NULL);

It doesn't read the fortune list. I used strace to see what is the difference when I call these two binaries.
strace -f -eopen ./test
open("/usr/local/plan9/lib/fortunes", O_RDONLY) = -1 ENOENT (No such file or directory)
Misfortune!
+++ exited with 1 +++

Gives out the default message "Misfortune".
strace -f -eopen fortune
open("/opt/plan9/lib/fortunes", O_RDONLY) = 3
Snob intellectual bachelors can't have fun in San Antonio.  -Ted Nelson
+++ exited with 0 +++

which works perfectly fine.
How do I change ./test read fortunes file. It must have something to do with the exec environment, from where the binary reads the libraries from.

A: When you call execve(), you are explicitly setting up a NULL environment. So the fortune program is probably depending on some environment variable to find /opt/plan9/.... Type env at a shell prompt to find out which environment variables are set.


text:
Q: Java Spring: Why making a call to /logout redirects to /login I'm creating a statless webapp backend that provides bunch of Rest API endpoints. The WebSecurityConfig class that extends WebSecurityConfigurerAdapter looks like this:
@Override
protected void configure(HttpSecurity http) throws Exception {
    http
        .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
        .and()
        .csrf().disable()
        .authorizeRequests()
            .anyRequest().authenticated()
        .and()
        .addFilterBefore(
            new JWTAuthenticationFilter(userDetailsServiceBean()),
            UsernamePasswordAuthenticationFilter.class);
}

When I make a call to /logout endpoint, I expect to get Access Denied and 403 http status code in the response, but I get this:
{
  "timestamp": 1495012033216,
  "status": 405,
  "error": "Method Not Allowed",
  "exception": "org.springframework.web.HttpRequestMethodNotSupportedException",
  "message": "Request method 'GET' not supported",
  "path": "/login"
}

This is what I get with or without including the authentication JWT in the header. Why ? I don't have anything specific to /logout so why does this happen ?
I saw some questions before that login?logout gets the same behavior, but nothing regarding /logout. How should I override this behavior and make it just like any other Rest endpoints ?
What are the benefits of this default behavior ?


text: Q: why linear regression gives high mean squared error with robust scaler? I've been trying to use a pipeline that consists of robust scaler and one of the algorithms like xgboost, ridge, lasso, and linear regression, and they all give better results except for linear regression that gives awfully higher error. I was wondering how this happens.


text:
Q: Ionic forward view cached when side menu present I am building a demo application on ionic framework. My demo ionic application has three states :
    $stateProvider.state("app", {
        abstract : true,
        url : "/app",
        templateUrl : "app/templates/theme.html"
    });
    $stateProvider.state("app.dashboard", {
        url : "/dashboard",
        views : {
            "content" : {
                templateUrl : "app/modules/dashboard/dashboard.html",
                controller : "dashboardController"
            },
            "settings" : {
                templateUrl : "app/templates/settings.html"
            },
            "menu": {
                templateUrl: "app/templates/menu.html"
            }
        }
    });
    $stateProvider.state("app.demo", {
        url : "/demo",
        views : {
            "content" : {
                templateUrl : "app/modules/demo/demo.html",
                controller : "demoController"
            }
        }
    });

And theme.html looks like this :
<ion-side-menus enable-menu-with-back-views="false">

    <ion-side-menu-content drag-content="true">

        <ion-nav-bar class="bar-stable nav-title-slide-ios7 two-side" align-title="center">

            <ion-nav-back-button class="button-clear inverse">
                <i class="icon ion-ios7-arrow-back">
                </i>< Back
            </ion-nav-back-button>

            <ion-nav-buttons side="left">
                <button menu-toggle="left" id="menuBtn" class="button button-icon icon ion-navicon inverse"></button>
            </ion-nav-buttons>

            <ion-nav-buttons side="right">
                <button menu-toggle="right" id="settingsBtn" class="button button-icon icon ion-gear-b inverse"></button>
            </ion-nav-buttons>
        </ion-nav-bar>

        <ion-nav-view name="content">
        </ion-nav-view>

    </ion-side-menu-content>

    <ion-side-menu side="left">
        <ion-nav-view name="menu" animation="slide-left-right"></ion-nav-view>
    </ion-side-menu>

    <ion-side-menu side="right">
        <ion-nav-view name="settings" animation="slide-left-right"></ion-nav-view>
    </ion-side-menu>

</ion-side-menus>

Issue is when I am going from app.dashboard to app.demo first time,
  demoController is called. Then I go back to app.dashboard. And when
  again going to app.demo state any number of times, demoController is
  never called. app.demo view is cached. I don't know why.

In addition, I don't want to put cache-view=false or cache false in routing config because that disables the caching of that page totally(Forward & Backward). I want to reload page when I go in forward direction like app.dashboard to app.demo but not to reload page when I go in backward direction like app.demochild(For example) -> app.demo.
If I delete both ion-side-menu tag from my theme.html, the issue gets resolved, demoController is called every time when going in forward direction, But I want both ion-side-menu to be present in my theme.html
I have even disabled the forward caching.
 $ionicConfigProvider.views.forwardCache(false);

Any help would be highly appreciated.

A: Ionic broadcast multiple things while changing a route, like'$ionicView.beforeEnter', '$ionicView.enter' etc.
write condition to check whether its in forward direction / backward direction and call $state.reload() accordingly in your broadcast handler

$scope.$on("$ionicView.beforeEnter", function(event, data){
  if()//check for the direction backward / forward
    {
      $state.reload();
    }
});


text:
Q: How to warn the user when edited data in UI so I can warn them of overwriting, or prompt them to save? (Java) How to warn the user when edited data in UI so I can warn them of overwriting if they load from another source, or prompt them to save? (JavaFX2.2)
I will have over 50 text fields across a number of tabs and 2 or 3 tables with buttons to add and delete rows.
I was wondering whether to have a global 'isDirty' boolean flag and can set onAction handlers on the buttons, but must I set onKeyTyped handlers on every one of the text fields and text areas? (will it slow things?). Does Java keep track of whether any field was edited and if so, can I capture that information from it?

A: A possibly clean solution would be to have a sort of MyWholeDataset class that is filled with data at the startup of the UI and another "cloned" object that is used for the actual UI display.
  Then every time the user changes the data from the UI you change the second object (the cloned one).
  At the end you should implement the Comparable interface. This tells you that there are differences and then you can, for example, have a sort of "getDeltas" method that returns either a set of field names that are different or a hasmap that return field names as keys and an object containing old/new values pairs as value.


text:
Q: How do I load Require.JS developed modules in an Ember.JS application? I am trying to integrate a third-party library developed with Require.JS into a new Ember.JS application. I have looked at addons like ember-cli-amd and ember-auto-import but I cannot figure out how to make them work for a library loaded like so
<script data-main="jslib/app/LibConfig" type="text/javascript" src="jslib/modules/require.js"></script>

A: Welcome to Stack Overflow!
So you can't directly use require.js in Ember, but the Ember loader builds in a version of require.js for you. You just need to ensure that the library(ies) that you want to use are in named AMD or UMD format, and you can import them using app.import from your ember-cli-build file like this:
// ember-cli-build.js

'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    // Add options here
  });

  // Use `app.import` to add additional libraries to the generated
  // output files.
  //
  // If you need to use different assets in different
  // environments, specify an object as the first parameter. That
  // object's keys should be the environment name and the values
  // should be the asset to use in that environment.
  //
  // If the library that you are including contains AMD or ES6
  // modules that you would like to import into your application
  // please specify an object with the list of modules as keys
  // along with the exports of each module as its value.

  app.import('vendor/my-awesome-named-amd-library.js');

  return app.toTree();
};

For more information, see: https://ember-cli.com/user-guide/#standard-named-amd-asset
Alternatively, see if a version of the library you want to use is in npm, and ember-auto-import can figure out the format and do the work for you.


text:
Q: Why there are indents in the table list? I take Api data and output their to the page as a table-list in my React-Redux app.
it should look like this:

But I got it like this:

Ignore the different colors. The problem is that my gray line breaks. I don't need indents.Also line should also be up to the end of the width of the white container.What can be the problem? And how to fix it?
TableData.js(component which displays the data on the page):
import React from "react";

export default ({ data }) => (

        Terminal
        Gate
        Time
        Destination
        Airline
        Flight
        Status

      {data.map(item => {
         const dt = new Date(item.actual);
         const mins = dt.getMinutes();
        return (

            {item.term}
            {item.gateNo}
            {`${dt.getHours()}:${mins < 10 ? '0' : ''}${mins}`}

              {item["airportToID.city_en"]
                ? item["airportToID.city_en"]
                : item["airportFromID.city_en"]}

            {item.airline.en.name}
            {item["planeTypeID.code"]}
            {item.status}

        );
      })}

);

app.css(style):
/*Table*/
.tableContainer{
    background: white;
    width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

table td,table th {
  padding: 15px;
  margin: 0;
  font-size: 18px;

}
th {
    color: grey;
}

.tableContainer tr:nth-child(even) {
  background-color: grey;
  padding-right: 0;
}

A: Give this a shot
table {
  border: 0px
  border-collapse: separate;
  border-spacing: 0px;
}

See https://www.w3schools.com/cssref/tryit.asp?filename=trycss_border-spacing

A: Use { border-spacing: 0px } for table


text:
Q: connection refused from other time zone We have a webservice that run under glassfish 3.1.1 and metro.
We are using username authentification with symmetric key.
It works fine except for clients from other time zone . If they try to invoke the web service they get this  error:
Caused by: javax.xml.ws.soap.SOAPFaultException: Creation Time is older than configured Timestamp Freshness Interval!

Is it possible to fix this without syncrhonizing the client system clock with the server ?
Thank.

A: If your web service will be called from a different time zone then you should use
RFC 2822 date format


text:
Q: How to handle asynchronous calls to Firebase in React-Native app? I am currently trying to set the initial state of my application to a value pulled from Firebase. However, I can't figure out how to properly handle the asynchronous nature of Javascript--currently when I get the state of the application in my render function, itemsList is undefined. Any suggestions for what I'm doing wrong would be greatly appreciated.
  getInitialState: function() {

    var dataSource = new ListView.DataSource({
        rowHasChanged: (r1, r2) => r1.guid != r2.guid,
        sectionHeaderHasChanged: (s1, s2) => s1 !== s2
    });

    return {
        dataSource: dataSource,
        itemsList: this.getItemsList()
    };
},

getItemsList: function() {
    var userRef = usersRef.child("5019e705-0-29f09e520b7e");
    var itemsListRef = userRef.child("items_list");
    var itemsList;

    itemsListRef.on('value', (snap) => {
        itemsList = snap.val();
        return itemsList;
    });
},

A: You will need to use one of the React life cycle methods to handle async calls:
Check out the docs HERE
  componentDidMount: function() {
    this.serverRequest = $.get(this.props.source, function (result) {
      var lastGist = result[0];
      this.setState({
        username: lastGist.owner.login,
        lastGistUrl: lastGist.html_url
      });
    }.bind(this));
  },


text:
Q: Angular Service Provide with a default value? Consider an Angular Service that wraps HTTP Client Module.
export class HttpWrapperService {
  private apiKey: string;
}

Obviously, it has more features that are irrelevant.
Now I need to provide HttpWrapperService to the multiple modules with some unique default value. This default value should be assigned to a private data member, i.e. private apiKey: string;

Observation:
As I have seen other imports with default values, I wonder how can this be implemented.
RouterModule.forRoot(AppRoutes),
GravatarModule.forRoot(GRAVATAR_CONFIG_TYPE1),
AngularFireModule.initializeApp(environment.firebaseConfig),
ServiceWorkerModule.register("ngsw-worker.js", {
  enabled: environment.production
})

Current Way Out
Currently, I am using a static method to initialize a static variable. Not sure if that's the correct approach to this problem.
export class AppModule {

  constructor(){
    HttpWrapperService.register(environment.apiKeyHeaders);
    UserService.registerEndpoint(environment.apiEndpoint);
  }
}

A: You can provide the api key value in the AppModule as follows:
@NgModule({
  providers: [
    { provide: 'API_KEY', useValue: '<apiKeyValue>' },
    HttpWrapperService
  ],
})
export class AppModule { }

The api key value can be injected as follows
export class HttpWrapperService {
    constructor(@Inject('API_KEY') private apiKey: string) {}
}


text:
Q: How do I install commands on command line? - Windows 7 Hi I often use Power Shell on Windows 7
I'm often typing commands like

C:\Python26\ python.exe   example.py
C:\Python26\scripts\ pip.exe  install examplePy
C:\Python26\scripts\ easy_install.exe examplePy

I would like to simply type (as I do on Linux)

python example.py
easy_install examplePy
pip install examplePy

How do I go on about it?
Help would be very much appreciated.

A: You can set the system variable PATH. Here you can store several directories which will be searched when you enter a command on the command line and this command is not found in the current directory.
Go to system control and search for "path" in the search box.

A: You'll need to set the PATH.  There are several paths, and in the end they (usually) get merged in to one.
PATH entries are delimited by semicolon (;).
Two are managed by Windows:

*

*The system path. Affects all users on the computer.

*The user path. Affects all programs you run under your user account.
Under Windows 7, the first two are easy to find: open the start menu and type PATH.

Under older Windows version, you'll need to find the Environment Variables settings. There are several ways to get to them, and it varies by Windows version, but the other answers are valid.

A third is process-specific:

*

*The current process path. Affects the current process and any new processes it creates.

If you're in a PowerShell session, the PATH is visible as $env:PATH.  To add something, use +=.  I'd recommend using env. vars. instead of hard paths where possible.

PS > $env:PATH += ";C:\Python26\"
PS > $env:PATH += ";$($env:ProgramFiles)\Bar\"

Normally you'd do this in your profile. The path can be found at $profile:

PS > notepad $PROFILE

A: Add folders C:\Python26\ and C:\Python26\scripts to path.
Go to system administration -> Environment -> Locate path and add your folders. Do not delete anything.

A: Using setx can be easy here:
setx PATH "%PATH%;Folder path to add"

then restart CMD.


text:
Q: PowerShell IntelliSense on parameters If I type Get-Help ena I can then do Tab or Ctrl-Space to show the available commands (I'm calling that IntelliSense, is there another more correct PowerShell term for this?).
I am writing a function and it has one parameter which I want to also be subject to Tab and Ctrl-Space and ideally I would like this parameter to have IntelliSense tab completion (and Ctrl-Space) for Cmdlets and Module names and Aliases. Does someone know how to activate that functionality for a function parameter?


text:
Q: $\mathbb{R}$-linear and $\mathbb{C}$-linear What does it mean for a map $\phi$ to be $\mathbb R$-linear or $\mathbb{C}$-linear? I have tried to look for this definition on Google but I cannot find it.

A: For example, $\mathbb C$ is both a real vector space and a complex vector space.  The "complex conjugate" map $z \mapsto \overline{z}$ is real-linear but not complex-linear.
explanation
Of course it is additive:
$$
\overline{z+w} = \overline{z}+\overline{w}
$$
and real scalars are OK
$$
\overline{rz} = r\overline{z}\qquad\text{if $r$ is real}
$$
But complex scalars are sometimes not OK, for example
$$
\overline{iz} = i\overline{z}
$$
is false when $z \ne 0$.

A: A linear map is a map between vector spaces (over the same field) that preserves the vector operations of scalar multiplication and vector sum. The names $\mathbb{R}$-linear and $\mathbb{C}$-linear are just a reminder of what field we are looking at.

A: In either case, we have $\phi(x + y) = \phi(x) + \phi(y)$, but the difference is under what conditions we can pull scalars out; for what scalars $k$ we are guaranteed to have $\phi(kx) = k\phi(x)$.
For a $\Bbb C$-linear map, this happens whenever $k \in \Bbb C$, and for an $\Bbb R$-linear map, this happens whenever $k \in \Bbb R$.
Source: Remmert's Theory of Complex Functions.


text:
Q: Correct HTML Structure inside PHP IF Condition This is my modified Wordpress loop w/ PHP If and Else Condition code.
    <?php if (have_posts()) : ?>

<?php
$i = 1;

while (have_posts()) {

    the_post();

    if ($i <= 1) {

            echo '
';

                echo '';
                    the_post_thumbnail('article-oneimg', array( 'id'    => "article-oneimg"));
                echo '';

                echo '
';
                    the_date();
                echo '
';

                echo '
';;
                    the_title();
                echo '
';

                echo '
';
                    the_excerpt();
                echo '
';

            echo '
';

    } elseif ($i <= 10) {
        echo '
';
        include "secondp.php";
        echo '
';

    } else {
        // There should be a bunch of HTML mixed in here too
        the_title();
    }
    $i++;
}

?>

<?php else : ?>

No Posts Found

<?php endif; ?>

secondp.php contains this code:

    <a href="<?php the_permalink() ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
        <?php the_post_thumbnail('article-twoimg', array( 'id'  => "article-twoimg")); ?>

        <?php the_date(); ?>

        <a href="<?php the_permalink() ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

What I'm trying to do here is just to add a holder/container of the secondp.php since it has several posts. But every time I use an echo '
'; before & after the include "second.php"; this happens (see image below taken using Firebug.)

What's wrong with the HTML structure inside the PHP IF condition? I trying to achieve is to put a container that holds all the divs class secondp.
In simple HTML, it's something like this:

a href="<?php the_permalink() ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
        <?php the_post_thumbnail('article-twoimg', array( 'id'  => "article-twoimg")); ?>

        <?php the_date(); ?>

        <a href="<?php the_permalink() ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

A: Try this code:-
<?php global $wp_query;?>
<?php if (have_posts()) : ?>

<?php
$i = 1;
$start_hoder = true
$total_posts = $wp_query->found_posts;
while (have_posts())
{

    the_post();

    if ($i <= 1) {

        echo '
';

            echo '';
                the_post_thumbnail('article-oneimg', array( 'id'    => "article-oneimg"));
            echo '';

            echo '
';
                the_date();
            echo '
';

            echo '
';;
                the_title();
            echo '
';

            echo '
';
                the_excerpt();
            echo '
';

        echo '
';

    } elseif ($i <= 10) {
        if($start_hoder)
        {
            echo '
';
            $start_hoder = false;
        }
            include "secondp.php";
        if($total_posts == $i && $start_hoder == false)
        {
            echo '
';
        }
    } else {
        // There should be a bunch of HTML mixed in here too
        the_title();
    }
    $i++;
}
?>

<?php else : ?>

No Posts Found

<?php endif; ?>

May be this will help you to get your expected output.

A: Looks like you have a loop, an inside your loop you are repeatedly echoing the holder. You want to rearrange your code to not have the holder inside the loop.

A:

<?php  while (have_posts()) { ?>

<?php } ?>

 this will be always out of the loop
or in your code Do this
<?php if($i==0) {?>
<?php } ?>

and add the div out of loop but its not good idea . Let me know if you need more help .


text:
Q: Unable to view table in RootViewController I have a navigation app that I am working on which for some reason is not allowing me to view my table on my initial screen (i.e. from the RootViewController).  I have the following method that is called by my "viewDidLoad" method:`
- (void) locationManager:(CLLocationManager *)manager
 didUpdateToLocation:(CLLocation *)newLocation
        fromLocation:(CLLocation *)oldLocation {

`
which does some work, and then calls the method:
- (void) readRestaurantsFromDatabase:(double)userLatitude
                withUserLocation:(double)userLongitude{

This method does some work with an NSArray called "sortedArray" which is a property declared, and synthesized in RootViewController:
//compile a list of categories
        NSMutableArray *categoryList = [[NSMutableArray alloc] init];
        [categoryList addObject:@"All Types"];

        for (Restaurant *restCat in restaurants){

            [categoryList addObject:restCat.category];
        }

        //remove duplicates
        NSArray *copy = [categoryList copy];
        NSInteger index = [copy count] - 1;

        for (NSString *restCategory in [copy reverseObjectEnumerator]) {

            if ([categoryList indexOfObject:restCategory inRange:NSMakeRange(0, index)] != NSNotFound) {
                [categoryList removeObjectAtIndex:index];
            }

            index--;

        }

        [copy release];

        //put list in alphabetical order
        sortedArray = [categoryList sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

This is how the above method ends.  I then have the following code for my "cellForRowAtIndexPath" method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell.

NSString *cellValue = [sortedArray objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;

return cell;

}
To me, everything looks fine.  When I run my code, I have NSLog statements that issue output to the console which clearly shows me that the NSArray sortedArray contains data.  Yet, when I run the code on my iPhone simulator in XCode, I get an empty table.  Can anyone see what I'm doing wrong?
Thanks in advance to all who reply.

A: Have you implemented tableView:numberOfRowsInSection: ?
This should probably return [sortedArray count].

A: Did you fill numbersOfRowInSection?
On a side note, I don't understand why you're copying everything then removing duplicates instead of skipping adds when your array contains the object.

A: Have you connected your tableView to a property in interface builder?
Also, when your sorted array changes, you might want to call [myTabelView reloadData]; to refresh the table. Do this each time you change your sortedArray i.e.
//put list in alphabetical order
sortedArray = [categoryList sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

// The sorted array has changed, get the table view to refresh
[myTabelView reloadData];

A: Double check your tableview datasource property. If the datasource isn't set for your UITableView.  Make sure that you are setting that to your object and make sure your object defines the -(NSInteger)tableView:numberOfRowsInSection:  method.
That should return [sortedArray count].


text:
Q: What direction to walk in to capture a targeted Pokemon? There is a list of the nearby Pokemon and some approximate idea of the distance. But after I choose one, how do I actually walk towards it? Is there a way to see the Pokemon on the map or some direction indicator to follow?

A: The game, as of now, does not have a builtin direction indicator.
You can use the footsteps to determine which way is approximately the right way to go (if the count gets larger, you're going in the wrong direction), but the game is intentionally vague on this front.

A: Actually, if you want to track a specific Pokemon listed in the bottom right ''Nearby'' area:

*

*Bring up the list.

*Click which one you want to track/find.

*Whenever you are facing and/or walking TOWARDS the Pokemon, every so often there will be a SMALL green border "pulse" animation from the rounded rectangle that's indicating how far away it is.
THIS is how you can know if you are going in the right direction or not.
((I'm 100% certain of this.))

Also, though listed by closest to furthest in the popped up nearby window, when minimized it seems to re-order them based on what direction you are facing and/or which direction you are currently travelling in.
((Not 100% certain, but it seems this way from observations.))


text:
Q: Disable CSS animation on window resize I have a CSS animation that makes the logo big on window load and then shrinks it down to size. Works great, however if I shrink down the window and then make it big again, the animation replays. Is there someway I can incorporate jQuery (or a CSS fix) that will disable the animation after it loads once? I thought I could do something with animation-play-state: paused; but I want it to play once so I'm not sure how I'd go about that.
Maybe onLoad assign class and then unassign class after animation is completed. Just thinking that might work? Anyone have any thoughts on how I'd go about that?
#logo {
    max-width: 260px;
    height: auto;
    width: 40%;
    -webkit-animation: animate 3s ease;
-moz-animation: animate 3s ease;
-ms-animation: animate 3s ease;
-o-animation: animate 3s ease;
}

Thanks!

A: you can use JQuery for this by testing the changed CSS property and behave accordingly:
for instance:
JQuery:
    $(document).ready(function() {
    // run test on initial page load
    checkSize();

    // run test on resize of the window
    $(window).resize(checkSize);
});

//Function to the css rule
function checkSize(){
    if ($(".logo").css("float") == "none" ){
        // your code here
    }
}

your css:
    .logo {float:left;}
@media only screen and (max-width: 800px){
    .logo {float:none;}
}

source


text:
Q: Change all aria-expanded on a page to false with javascript I have some FAQs on a page that I need to open up before parsing the HTML because the text value of the answer is hidden and therefore coming up empty when  parsing the HTML of the page.
When I use the code below in the browser it returns me all the links but it doesn't change the "aria-expanded" attribute to "false".
 $('a').each(function() { this.setAttribute('aria-expanded', 'false')});

A: I would try with .attr() (http://api.jquery.com/attr/)

this.attr('aria-expanded', 'false')}

A: jQuery way should work:
$(function () {
     $('a').each(function() {
         $(this).attr('aria-expanded', 'false')
     });
});

A: I don't believe that this refers to the objects (a tags) you want. You might try the following code.
$('a').each(function(index, obj) { $(obj).attr('aria-expanded', 'false') });

A: setAttribute is native JavaScript function. Use attr() of jquery.
$('a').each(function() { this.attr('aria-expanded', 'false')});