text:
Q: How to see why an SSAS cube fails to refresh a table We have a tabular model cube that is refreshed each day via an SQL Agent job calling an SSAS Command. The command is simply:
{
"refresh": {
"type": "full",
"objects": [
{
"database": "KPIDashboardv1"
}
]
}
}
The job runs and succeeds each day. But I have noticed that some of the tables in the cube have not refreshed. select * from $system.TMSCHEMA_partitions shows these tables with a RefreshedTime of weeks ago.
How can I find what error or problem SSAS is having when attempting to process these tables?
I have tried:

*

*Taking the Table Properties query from $system.TMSCHEMA_partitions
and executing that query against the relevant Data Source. It
succeeds promptly and contains up-to-date data.

*Looked at the Output file configured for the SQL Agent job step. It
is empty.

A: Have you tried to check the data that XE collects?
You needed "ProgressReportEnd" event
    <Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
  <ObjectDefinition>
    <Trace>
      <ID>ETLExecutionLogs</ID>
      <Name>ETLExecutionLogs</Name>
      <AutoRestart>true</AutoRestart>
      <XEvent xmlns="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
        <event_session name="ETLExecutionLogs" dispatchLatency="0" maxEventSize="0" maxMemory="4" memoryPartition="none" eventRetentionMode="AllowSingleEventLoss" trackCausality="true" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
          <event package="AS" name="ProgressReportEnd" />
          <target package="package0" name="event_file">
            <parameter name="filename" value="d:\YourServerLogPath\OLAP\Log\ETLExecutionLogs.xel" />
            <parameter name="max_file_size" value="250" />
            <parameter name="max_rollover_files" value="4" />
            <parameter name="increment" value="50" />
          </target>
        </event_session>
      </XEvent>
    </Trace>
  </ObjectDefinition>
</Create>

After that you can use powershell to extract info:
$SharedPath = "C:\Program Files\Microsoft SQL Server\150\Shared";

$xeCore = [System.IO.Path]::Combine($SharedPath, "Microsoft.SqlServer.XE.Core.dll");
$xeLinq = [System.IO.Path]::Combine($SharedPath, "Microsoft.SqlServer.XEvent.Linq.dll");
Add-Type -Path $xeLinq;

if( [System.IO.File]::Exists($xeCore) )
{
    Add-Type -Path $xeCore;
}

[Microsoft.SqlServer.XEvent.Linq.QueryableXEventData] $xEvents = $null;

    $files = [System.IO.Directory]::EnumerateFiles("d:\YourServerLogPath\OLAP\Log","ETLExecutionLogs*.xel")
    $xEvents =
        New-Object -TypeName Microsoft.SqlServer.XEvent.Linq.QueryableXEventData(
            $files
        );
    $dt = New-Object System.Data.Datatable;
    $dt.Columns.Add("EventSubclass",[int]);
    $dt.Columns.Add("ObjectType",[int]);
    $dt.Columns.Add("NTCanonicalUserName",[String]);
    $dt.Columns.Add("DatabaseName",[String]);
    $dt.Columns.Add("ObjectPath",[String]);
    $dt.Columns.Add("ObjectID",[String]);
    $dt.Columns.Add("EndTime",[DateTimeOffset]);
    $dt.Columns.Add("StartTime",[DateTimeOffset]);
    $dt.Columns.Add("RequestID",[Guid]);
    $dt.Columns.Add("ReEncoding",[String]);

    foreach($publishedEvent in $xEvents)
    {
if( ($publishedEvent.Fields["EventSubclass"].value -In 55) -or   ($publishedEvent.Fields["EventSubclass"].Value -In 59 -And $publishedEvent.Fields["ObjectType"].Value -In 802016,802015,802014, 802013, 802018 -And
      $publishedEvent.Name -eq "ProgressReportEnd" -And $publishedEvent.Fields["Success"].Value -eq "1" ))
        {
            $row = $dt.NewRow();

            $row.EventSubclass = $publishedEvent.Fields["EventSubclass"].Value;
            $row.ObjectType = $publishedEvent.Fields["ObjectType"].Value;
            $row.NTCanonicalUserName = $publishedEvent.Fields["NTCanonicalUserName"].Value;
            $row.DatabaseName = $publishedEvent.Fields["DatabaseName"].Value;
            $row.ObjectPath = $publishedEvent.Fields["ObjectPath"].Value;
            $row.ObjectID = $publishedEvent.Fields["ObjectID"].Value;
            $row.EndTime = $publishedEvent.Fields["EndTime"].Value;
            $row.StartTime = $publishedEvent.Fields["StartTime"].Value;
            $row.RequestID = $publishedEvent.Fields["RequestID"].Value;
            $row.ReEncoding = $publishedEvent.Fields["TextData"].Value;
            $dt.Rows.Add($row)

        }
    }

    $dt

}


text:
Q: django static files 404 errors could not load any static file, and keep poping out 404 errors, i looked through some posts about staticfiles 404 errors, but not help.
My installed apps like
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'articles',
'bootstrap3',
'django_markdown',
'jquery',
'javascript_settings',]

and others like
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',)

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static_root')

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static', 'static_dirs'),
)
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')

MEDIA_URL = '/media/'

got traceback
[10/Apr/2015 00:13:47]"GET /static/js/bootstrap.min.js HTTP/1.1" 304 0
[10/Apr/2015 00:13:47]"GET /static/js/carousel.js HTTP/1.1" 304 0
[10/Apr/2015 00:13:47]"GET /articles/offcanvas.js HTTP/1.1" 404 2333
10/Apr/2015 00:13:47]"GET /articles/10 HTTP/1.1" 200 7760
[10/Apr/2015 00:13:47]"GET /media/IMG_1061.JPG HTTP/1.1" 404 2324
[10/Apr/2015 00:13:47]"GET /media/IMG_1061.JPG HTTP/1.1" 404 2324
[10/Apr/2015 00:13:48]"GET /assets/flash/ZeroClipboard.swf?noCache=1428639228343 HTTP/1.1" 404 2382
[10/Apr/2015 00:14:16]"GET / HTTP/1.1" 200 6315
[10/Apr/2015 00:14:16]"GET /offcanvas.js HTTP/1.1" 404 2306
[10/Apr/2015 00:14:16]"GET /assets/flash/ZeroClipboard.swf?noCache=1428639256192 HTTP/1.1" 404 2382

plaese help!

A: You have to serve the media files from webservers like apache, gunicorn, nginx.
You have to configure the url of your media in the configuration file of the respective server.
Take a look at this link. It explains how to configure webserver to serve media files. django server is an application server and it is better to use webservers to serve the media

redpajama_set_name: RedPajamaStackExchange


text:
Q: xlswriter on a EC2 instance I am running my Python script in which I write excel files to put them into my EC2 instance. However, I have noticed that these excel files, although they are created, are only put into the server once the code stops.
I guess they are kept in cache but I would like them to be added to the server straight away. Is there a "commit()" to add to the code?
Many thanks

A:
I guess they are kept in cache but I would like them to be added to the server straight away. Is there a "commit()" to add to the code?

No. It isn't possible to stream or write a partial xlsx file like a CSV or Html file since the file format is a collection of XML files in a Zip container and it can't be generated until the file is closed.


text:
Q: R get column names for changed rows I have two dataframes, old and new, in R. Is there a way to add a column (called changed) to the new dataframe that lists the column names (in this case, separated with a ";") where the values are different between the two dataframes? I am also trying to use this is a function where the column names that I am comparing are contained in other variables (x1, x2, x3). Ideally, I would only refer to x1, x2, x3 instead of the actual column names, but I can make due if this isn't possible. A tidy solution is preferable.
old <- data.frame(var1 = c(1, 2, 3, 5), var2 = c("A", "B", "C", "D"))
new <- data.frame(var1 = c(1, 4, 3, 6), var2 = c("A", "B", "D", "Z"))
x1 <- "var1"
x2 <- "var2"
x3 <- "changed"

#Output, adding a new column changed to new dataframe
    var1 var2 changed
1    1    A   NA
2    4    B   var1
3    3    D   var2
4    6    Z   var1; var2

A: A tidyverse way -
library(dplyr)
library(tidyr)

cols <- names(new)

bind_cols(new, map2_df(old, new, `!=`) %>%
  rowwise() %>%
  transmute(changed = {
     x <- c_across()
    if(any(x)) paste0(cols[x], collapse = ';') else NA
    }))

#  var1 var2   changed
#1    1    A      <NA>
#2    4    B      var1
#3    3    D      var2
#4    6    Z var1;var2

The same logic can be implemented in base R as well -
new$changed <- apply(mapply(`!=`, old, new), 1, function(x)
                    if(any(x)) paste0(cols[x], collapse = ';') else NA)

A: Here is a base R approach.
new$changed <- apply(old != new, 1L, \(r, nms) toString(nms[which(r)]), colnames(old))

Output
  var1 var2    changed
1    1    A
2    4    B       var1
3    3    D       var2
4    6    Z var1, var2


text:
Q: Laravel eloquent - undefined variable Im have been learning laravel, and now im using for the first time eloquent. But im getting an error. it doesnt recognize the variable that represents the query. I have searched for solutions in the net, but cant get any to solve the problem. Im using laravel version 5.4. Can anyone help?
the error: "Undefined variable: articles" (on the teste7.blade)
the code:
web
Route::get('teste7', 'CentralController@teste7');
Route::get('/article/{article}', ['as' => 'article', 'uses' => 'CentralController@article']);

Controller
    use App\article;

    function teste7(){
    $articles=article::pagination(4);
    return view('teste7');
}
function article($article){
    return view($article);
}

teste7
{{ $articles->total() }} articles
In this page ({{ $articles->count() }} articles )

@foreach ($articles as $article)

  $article->Name])}}">{{
$article->Name }}

@endforeach

{{ $articles->links() }}

A: You have to pass the data into the view using the second parameter. You can find more information in the documentation here.
function teste7() {
    $articles = article::pagination(4);
    return view('teste7', ['articles' => $articles]);
}

A: class CentralController extends Controller
{
   public function teste7()
   {
       $articles = article::pagination(4);

       // returns view 'teste7.blade.php' and passes the $articles variable along
       return view('teste7', compact('articles'));
   }
}

In your article() function, you're not correctly returning a view. In your teste7() function, you're returning a view ('teste7.blade.php'), but not passing any variables to the view.
It is very important that you pass variables from the controller to the view. Otherwise they will not be accessible from within the view.


text:
Q: What is going on inside quantum gates physically? What are the physical realities of the different quantum gates? I am particularly interested in how the CNOT gate works on the inside as well as how the Hadamard gate works. The Hadamard gate to me is strange because my assumption on superposition was that a particle left undisturbed would naturally assume a superposition, but that cannot be how a Hadamard gate functions because the same process that puts the qubit into superposition also has to be reversible to take that particle out of superposition and into the original state.
Any intuition or articles on the physics going on inside quantum gates would be appreciated.

A: I do not know how it is implemented in a Josephson junction, but if we were working with photons, one way to realise the action of the Hadamard gate is by using a perfect beam splitter.
Operator
In particular, the Hadamard gate is given by:
$$H=\frac{1}{\sqrt{2}}\left[\begin{array}{cc}
1 & 1 \\
1 & -1
\end{array}\right]$$
In comparison, the action of a beam splitter with reflectivity $r$ and transmittivity $t$ is given by
$$H=\left[\begin{array}{cc}
r & t \\
t & -r
\end{array}\right]$$
with $r=t=1/\sqrt 2$ for a perfect beam splitter.

Physical intuition
Consider the following setup. There are two input modes. Namely $1$, corresponding to the state $|10\rangle_1$ and $2$, corresponding to the state $|01\rangle_2$. Similarly the output modes are $3$, corresponding to the state $|10\rangle_3$ and $4$, corresponding to the state $|01\rangle_4$.

If a photon is incoming in mode 1, then after passing through the beam splitter it is in a superposition of two output modes whose weights are given by the Hadamard gate. Similarly for a photon in mode 2.
$$|01\rangle_1 = \frac{1}{\sqrt 2}\big(|10\rangle_3 + |01\rangle_4 \big)$$
$$|10\rangle_2 = \frac{1}{\sqrt 2}\big(-|10\rangle_3 + |01\rangle_4 \big)$$
Now consider the input state in an equal superposition of the two modes. What will be the corresponding output mode?
$$\frac{1}{\sqrt 2} \big(|01\rangle_1+|10\rangle_2\big) = |01\rangle_4$$
As you can see, the output is now a single mode! How is that possible? Well, the amplitudes going to mode 3 from mode 1 and 2, destructively interfered. The reason they did so is because of the emergence of a phase difference of $\pi$ due to reflection through the dielectric in mode 3.
Since the system is symmetric with input and output modes, the same thing happens with a superposition of output modes giving you a single input mode. It's the destructive interference of amplitudes!

And for an all-optical implementation of a CNOT gate, you may look at this paper.


text:
Q: SQL Server: calculate variable dates in stored procedure is there a way in SQL that I can calculate the following in a stored procedure using GETDATE() or something similar ?

*

*First Monday in March of current year

*Last Monday in May of current year

*Third Friday in October of current year

Also, I am looking for a way to add specific dates to the above list, e.g. April 1 of the current year.
I hope someone here can help me with this. Many thanks in advance, Tim.

A: This is where using a Calendar table can come in very handy.
http://web.archive.org/web/20070611150639/http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html
You can then simply join to the table to determine what you are looking for.
For example, finding the first monday in march of the current year:
SELECT TOP 1 dt
  FROM dbo.CALENDAR
 WHERE Y = @currentyear and M = 3 and DW = 2
 ORDER by dt

For more complex things, you can use ROW_NUMBER() and ordering to figure out the "third friday", etc...

A: It is possible to calculate it, here are 3 examples
declare @month int = 6

select
    -- first Monday in @month of current year
    dateadd(d, datediff(d, 0, dateadd(m, @month-1,
      dateadd(yy, datediff(yy, 0, getdate()), 6)))/7*7, 0),
    -- last Monday in @month of current year
    dateadd(d, datediff(d, 0, dateadd(m, @month,
      dateadd(yy, datediff(yy, 0, getdate()), 6)))/7*7, -7),
    -- third Friday in @month of current year
    dateadd(d, datediff(d, 0, dateadd(m, @month-1,
      dateadd(yy, datediff(yy, 0, getdate()), 3)))/7*7, 18)


text:
Q: How can I link Boost to my CMake project on Windows I searched everywhere but most of the answers are relevant to Linux, not many use CLion on Windows.
So I extracted boost_1_60_0 into C:\ and now my path for the boost root folder is
C:\boost_1_60_0

I got the CMakeLists.txt file where I'm trying to set the root directory of boost and include it, but it doesn't recognize it:
set(Boost_Path "C:/boost_1_60_0")
find_package(Boost 1.60.0)
if(Boost_FOUND)
    message(STATUS "It works!")
endif()

What am I doing wrong?


text:
Q: All colors work except whiteColor const CGFloat *color = CGColorGetComponents([[UIColor whiteColor] CGColor]);
CGContextSetFillColor(context, color);

I have black background. While working this above code not sure whats wrong most of the colors work like redColor, purpleColor, greenColor, yellowColor
but whiteColor, grayColor does not work. when i use whiteColor screen looks empty.

A: whiteColor and greyColor have colorspace different from redColor, purpleColor etc (I guess gray and rgb correspondently) and CGContextSetFillColor requires that appropriate color space is set (using CGContextSetFillColorSpace). Note also that docs say that prefered method to set fill color is CGContextSetFillColorWithColor function.


text:
Q: Python assertRaises on user-defined exceptions The following question was triggered by the discussion in this post.
Assume two files (foobar.py and foobar_unittest.py). File foobar.py contains a class (FooBar) with two functions (foo and bar). Function bar raises a built-in exception, function foo a user-defined exception.
# foobar.py
class MyException(Exception):
    pass
class FooBar:
    def __init__(self):
        pass
    def bar(self):
        raise ValueError('Hello World.')
    def foo(self):
        raise MyException('Hello World.')

.
# foobar_unittest.py
import unittest
import foobar as fb
class MyException(Exception):
    pass
class FooBarTestCases(unittest.TestCase):
    def test_bar(self):
        with self.assertRaises(ValueError):
            fb.FooBar().bar()
    def test_foo(self):
        with self.assertRaises(MyException):
            fb.FooBar().foo()
if __name__ == '__main__':
    unittest.main()

When running unit-test on foobar.py, why does the function raising the user-defined exception (foo) fail to pass the test?
>>> python2.7 foobar_unittest.py
.E
======================================================================
ERROR: test_foo (__main__.FooBarTestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "foobar_unittest.py", line 11, in test_foo
    fb.FooBar().foo()
  File "/a_path/foobar.py", line 9, in foo
    raise MyException('Hello World.')
MyException: Hello World.

----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=1)

A: import MyException from foobar, don't redefine it.
import unittest
from foobar import MyException
import foobar as fb

class FooBarTestCases(unittest.TestCase):
    def test_bar(self):
        with self.assertRaises(ValueError):
            fb.FooBar().bar()
    def test_foo(self):
        with self.assertRaises(MyException):
            fb.FooBar().foo()
if __name__ == '__main__':
    unittest.main()

This code should work now as
..
----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK

A: Be aware that the same happens (happened to me) if you use reload to import your exceptions.
In my unittests I have the relevant imports like
from importlib import reload
import foobar
reload(foobar)
from foobar import MyException

This does not work, too, for whatever reason.  Writing this just as
from foobar import MyException

will work. Then, of course, you have to reload the modules yourself.
In case you wonder why I am using reload: How do I unload (reload) a Python module?.


text:
Q: Error installing psycopg2: pg_config executable not found I want to connect my Django application to an Amazon RDS for PostgreSQL database.

*

*Do I need psycopg2 installed? (I think yes)

*How do I install pyscopg2 in a way that doesn't require an entire postgres db install.

The error when installing psycopg2 now is this:
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.

I'm on CentOS7.
I tried:
$ yum install postgresql-libs
$ yum install python-psycopg2

These packages installed, but I still get the same error on trying to pip install pyscopg2 after.


text:
Q: HTML iframes and javascript I have two iframes and each iframe show two different html pages. Both html pages refer to a common javascript file which contains a global variable. If I set the value of that global variable in one frame during html page load. Will the value be accessible using the same global variable to another iframe html page? why or why not?

A: No. The top level of JavaScript's scope space is the page level. However, you can access another page's scope by using window.parent

A: Actually I'm noticing it doesn't seem to maintain scope and maybe someone can shed light on this.
Example 1: You have a HTML page with some Flash Content that has some functions to get the SWF Object and fire a command.  When this page is loaded into a IFRAME the 'getSWFObj' is "not a function".
Example 2: I load a HTML Page that has a series of object based JavaScript files.  I create a instance called "player" and it creates some sub objects like "navigation".  When I call "player.navigation" I get a error saying it doesn't exist when loaded into a IFRAME.


text: Q: Is IIS configuration necessary to serve ArcGIS Server wms services? with ArcGIS for Server server 10.3 on windows Server 2012 and I would like to serve wms services over the internet. I have a reverse proxy set up which directs requests to an end point in ArcGIS server, but am getting a 403 forbidden answer from the server. How can I find out if this an IIS issue or an ArcGIS Server issue? It is necessary to configure IIS in any way before administering wms over the internet?


text:
Q: Avoid race condition when incrementing a counter I have posted on this topic before, but as yet I have not had much luck. I put it down down to a bad question on my part. This time I have made a short compilable example that displays the bad behavior i'm trying to avoid. I hope this is appreciated.
The problem is two (or more) threads are set to run the same process and their "id's" determine which part of the variable data they operate on. Currently both threads will update the counter.
The current output looks like this,
tid = 0, var[tid] = 0
tid = 0, var[tid] = 1
tid = 0, var[tid] = 2
tid = 0, var[tid] = 3
tid = 0, var[tid] = 4
tid = 0, var[tid] = 5
tid = 0, var[tid] = 6
tid = 0, var[tid] = 7
tid = 0, var[tid] = 8
tid = 0, var[tid] = 9
tid = 1, var[tid] = 0
Press any key to continue . . .

The desired output should be like this...
tid = 0, var[tid] = 0
tid = 1, var[tid] = 0
tid = 0, var[tid] = 1
tid = 1, var[tid] = 1
tid = 0, var[tid] = 2
tid = 1, var[tid] = 2
tid = 0, var[tid] = 3
tid = 1, var[tid] = 3 etc.

Any guidance here would be greatly appreciated.
EDIT: Ive updated the answer with code that works as intended.
[Note that efficiency is important here, I want to complete the process as quickly as possible]
#include <iostream>
#include <boost/thread.hpp>

int var[2];
int mT;
int mTotalSamples;
boost::mutex mCountMutex;
boost::thread *threadMap[2];

using namespace std;

void process()
{
    int tid = 1;

    // sleep for 1 seconds - just to make sure threadMap
    // has been assigned (only ncessary for this demo).
    boost::this_thread::sleep(boost::posix_time::seconds(1));

    if (threadMap[0]->get_id() == boost::this_thread::get_id()){ tid = 0;}

    while ( mT < mTotalSamples )
    {
        // perform processing
        var[tid] = mT;
        // processing complete

        mCountMutex.lock(); // (a thread waits to aquire mutex)
        cout << "tid = " << tid << ", var[tid] = " << var[tid] << endl;
        mT++;           // How to stop both threads incrementing this?
        mCountMutex.unlock();
    }
}

int main()
{
    boost::thread_group threads;

    mT = 0;
    mTotalSamples = 10;

    threadMap[0] = threads.create_thread( boost::bind(&process) );
    threadMap[1] = threads.create_thread( boost::bind(&process) );

    threads.join_all();

    return 0;
}

A: Judging from your expected output, you want your threads to synchronize after each update. The boost library provides boost::barrier which, if you put a wait for it at the start or end of the while-loop in process, should do the trick.
#include <iostream>
#include <boost/thread.hpp>

int var[2];
int mT;
int mTotalSamples;
boost::mutex mCountMutex;
boost::thread *threadMap[2];
boost::barrier bar(2);

using namespace std;

void process()
{
    int tid = 1;

    // sleep for 2 seconds - just to make sure threadMap
    // has been assigned (only ncessary for this demo).
    boost::this_thread::sleep(boost::posix_time::seconds(2));

    if (threadMap[0]->get_id() == boost::this_thread::get_id()){ tid = 0;}

    while ( mT < mTotalSamples )
    {
        // perform processing
        var[tid] = mT;
        // processing complete

        bar.wait();
        if (threadMap[0]->get_id() == boost::this_thread::get_id())
        {
            mT++;
            cout << "var[0] = " << var[0] << endl;
            cout << "var[1] = " << var[1] << endl;
        }
        bar.wait();
    }
}

int main()
{
    boost::thread_group threads;

    mT = 0;
    mTotalSamples = 10;

    threadMap[0] = threads.create_thread( boost::bind(&process) );
    threadMap[1] = threads.create_thread( boost::bind(&process) );

    threads.join_all();

    return 0;
}

A: Make this int mT; local in process() - not global.
Or you need a int mT[2];
Then you would not need mutexes.


text:
Q: ReferenceError: i0 is not defined Angular AOT error I have a local Angular git repository that I build using Angular AOT (4.4.4) and everything works when I copy and paste the results to the server. However, when I clone the repo and do the same commands everything works (all of the build steps) until I bring up the site after pasting the changes to the server and I get the following error before the site loads.
Error: Uncaught (in promise): ReferenceError: i0 is not defined ReferenceError: i0 is not defined at View_AppComponent_Host_0 (mywebsite/dist/build.js:1:4546206) at resolveDefinition (mywebsite/dist/build.js:1:104846) at n.create (mywebsite/dist/build.js:1:117593) at n.create
(mywebsite/dist/build.js:1:55999) at n.bootstrap (mywebsite/dist/build.js:1:69345) at mywebsite/dist/build.js:1:66726 at Array.forEach () at n._moduleDoBootstrap (mywebsite/dist/build.js:1:66697) at mywebsite/dist/build.js:1:66172 at e.invoke (mywebsite/zone.min.js:1:19922) at Object.onInvoke (mywebsite/dist/build.js:1:59738) at e.invoke (mywebsite/zone.min.js:1:19862) at t.run (mywebsite/zone.min.js:1:15134) at mywebsite/zone.min.js:1:12167 at e.invokeTask (mywebsite/zone.min.js:1:20606) at new k (mywebsite/zone.min.js:1:12526) at h (mywebsite/zone.min.js:1:11644) at mywebsite/zone.min.js:1:12198 at e.invokeTask (mywebsite/zone.min.js:1:20606) at Object.onInvokeTask (mywebsite/dist/build.js:1:59640) at e.invokeTask (mywebsite/zone.min.js:1:20527) at t.runTask (mywebsite/zone.min.js:1:15783) at i (mywebsite/zone.min.js:1:10706) at
I tried doing some google searches and I think it has something to do with socket.io. I'm not using socket.io directly and it is hard to find anyone with a relatable issue. Any ideas why this error is occuring in a fresh repo clone with Angular AOT?

A: My problem was in 'rollup' (used in the AOT build process). My version of rollup in 'package.json' was "^0.50.1".
See here: https://github.com/rollup/rollup/issues/1706
Apparently this was fixed in 0.51.3. My guess is it was a typo (should have been 'io')...
Current (2018-03-29) version of rollup is 0.57.1. So I updated my 'package.json' and ran 'npm install rollup'. Compiled and ran OK, but encountered the message: "Unknown input option: sourceMap" during build. Likely a deprecated option, so I deleted "sourceMap: false," from 'rollup.config.js'.
All good now.


text:
Q: why onclick called react material-ui I write react component with dialog and list. When component recieve "open" prop and try to build list in render function, it's call onClick={ this.handleToggle(item.id) } function of ListItem, so, that causes an infinite loop "render -> onClick -> setState -> render -> ... ". Why? And how can I get around this?
handleToggle(value) {
   if (this.state.isLoading) {
       return;
   }

    const {checked} = this.state;
    const currentIndex = checked.indexOf(value);
    const newSelected = checked.slice();

    if (currentIndex === -1) {
        newSelected.push(value);
    } else {
        newSelected.splice(currentIndex, 1);
    }
    this.setState({checked: newSelected});
}

render() {
    if (!this.props.show) {
        return null;
    }
    if (this.state.isLoading) {
        return(
Loading...
);
    }

    const {classes, show, caption} = this.props;
    const {checked, projects} = this.state;

    return (
        <Dialog
            open={show}
            onClose={this.onCancel}
            aria-labelledby="form-dialog-title">
                <DialogTitle id="form-dialog-title">{caption}</DialogTitle>
                <DialogContent>
                    <List>
                        {projects.map(item =>
                            <ListItem
                                key={item.id}
                                role={undefined}
                                dense
                                button
                                onClick={ this.handleToggle(item.id) }
                                className={classes.listItem}
                            >
                                <Checkbox
                                    tabIndex={-1}
                                    disableRipple
                                    checked={checked.indexOf(item.id) !== -1}
                                />
                                <ListItemText primary={item.name}/>
                            </ListItem>
                            ) }
                    </List>
                </DialogContent>
                <DialogActions>
                    <Button onClick={this.onSuccess} color="primary">OK</Button>
                    <Button onClick={this.onCancel} color="secondary">Cancel</Button>
                </DialogActions>
        </Dialog>
    );
}

A: You have to write it like
onClick={ () => this.handleToggle(item.id) }

because writing onClick={ this.handleToggle(item.id) } instantly calls the method instead of giving it as a callback to the onClick event

A: onClick={ this.handleToggle(item.id) } will cause the handleToggle function to be evaluated everytime render occurs and since you call a setState in handleToggle, it will go into an infinite loop. onClick expects a function and you should write it like
onClick={() => this.handleToggle(item.id) }

this will cause handleToggle to be called only on a click event


text:
Q: add a class to element in ng-repeat after some event I'm making a playlist. I have this ng-repeat where the current song is highlighted

    {{song.title}}

now in JS I change the value of current_song. I want to apply the class current-song to the new element which is now playing currently.

A: On change of song set $scope.current_song to the new song and in the HTML:

    {{song.title}}

A: you should write like this

  {{song.title}}

A: Use this syntax, Try with this

    {{song.title}}

I suggest, use song.id instead of to song.title and keep id of current_song as song id.

A: The way ng-repeat works is, it creates a child scope which is prototypically inherited from current scope. Therefore inner current_song value would not update per that. I don't want to repeat answer again why it is not working, you can find explanation here. You have to use Dot Rule in order to get correct selected current_song value inside ng-repeat, & while having condition you should compare it with its unique_id (assuming you have id prop here).
$scope.model = {
    current_song: null
};

HTML

    {{song.title}}


text:
Q: Proving directly that $S^2$ is simply connected: is a surjective loop homotopic to a non-surjective one? I want to prove that the sphere $S^2$ is simply connected. The following argument appeared at Munkre's book on topology and it is "flawed", since there are surjective loops in the sphere $S^2$. But I heard that it is possible to show that such a surjective loop is homotopic to a non-surjective loop and hence the argument can be used again to finally prove that $S^2$ is simply connected.
The argument is the following:
Let $f:I = [0,1] \rightarrow S^2$ be a loop in $S^2$. Assuming that $f$ is not surjective, let $p\not\in f(I)$. Now considering $\varphi: S^2 \setminus\{p\} \rightarrow \mathbb R^2$, the stereographic projection at $p$, we obtain a loop in $\mathbb R^2: \varphi \circ f.$ Since $\mathbb R^2$ is simply connected, we obtain that $\varphi\circ f$ is path homotopic to a constant path given by the path homotopy $H$. Hence, $\varphi^{-1}\circ H$  is a path homotopy in $S^2$ between $f$ and a constant path.
Now the question is: is it true that a surjective loop in $S^2$ is path homotopic to a non-surjective loop in $S^2$? How to prove that? Thank you!

A: It's just a Lebesgue number argument. I thought this argument would be in Munkres "Topology", he is usually good on Lebesgue number arguments, but I don't have my copy to check.
Anyway, here is a version of the argument.
Let $\{U_i\}$ be the open cover of $S^2$ by open hemispheres. Using the given loop $f : [0,1] \to S^2$ we obtain an open cover $\{f^{-1}(U_i)\}$ of $[0,1]$. Let $\lambda>0$ be a Lebesgue number for the latter open cover. Choose an integer $n \ge 1$ such that $\frac{1}{n} < \lambda$. Subdivide the interval into subintervals of length $\frac{1}{n}$,
$$[0,1] = [x_0,x_1] \cup [x_1,x_2] \cup \ldots \cup [x_{n-1},x_n]
$$
It follows that for each $i=1,...,n$ the path $f| [x_{i-1},x_i]$ is contained in an open hemisphere of $S^2$. Let $\delta_i$ be the unique great circle path in that open hemisphere having the same endpoints as $f | [x_{i-1},x_i]$. Since open hemispheres are homomorphic to $\mathbb R^2$, it follows that $f | [x_{i-1},x_i]$ is path homotopic to $\delta_i$. Thus $f$ is path homotopic to the concatenation $\delta_1 * \ldots * \delta_n$.
Now convince yourself that a union of finitely many great circle subpaths of $S^2$ is not surjective in $S^2$.


text:
Q: Get multiple barcode strings from Google Vision I'm using Google vision for a week now. but the problem is, when it sees multiple barcodes, it randomly chooses any barcodes & returns only one string. I'm trying to get all the barcodes it sees.
Barcode
In the picture above, there are multiple Barcodes. Right now, for one barcode, I'm doing this in BarcodeCaptureActivity:
@Override
    public void onBarcodeDetected(Barcode barcode) {
        //do something with barcode data returned

        Log.d(TAG, "...::: BARCODE :::...");
        Log.d(TAG, "" + barcode.rawValue);
        Log.d(TAG, "...::: BARCODE :::...");

    }

I'm trying to make it return an array of string with all the barcodes. But how to do it?


text:
Q: Form Widget button in Odoo form I tried to add a button in Invoice form and i need to initiate a call in js
So i done Coding in Js as well as in XML Please find below.
In JS
odoo.define('test_module.print_button', function (require) {
"use strict";

var core = require('web.core');
var form_widget = require('web.form_widget');

var form_common = require('web.form_common');
var formats = require('web.formats');

var QWeb = core.qweb;
var _t = core._t;

form_widget.WidgetButton.include({
    on_click:function() {
        if(this.node.attrs.custom === "print"){
             console.log('Success');
        }
        else{
            this._super();
        }
    },
});
});

in XML i have inherited Account Invoice Form view
<odoo>
    <data>
        <record model="ir.ui.view" id="invoice_form_test">
            <field name="name">invoice.form.test</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_form"/>
            <field name="arch" type="xml">

                <header position="inside">

                    <button type="action" string="Print Test"  icon="fa-print" custom="print" />

                </header>

            </field>
        </record>

    </data>
</odoo>

This won't working , while clicking it shows like

TypeError: exec_workflow() takes exactly 4 arguments (3 given)

Do i need to add anything more to work it. Please comment.
Also Please suggest any way to pass button click to js from form view.
Thanks

A: *

*you imported form widget wrongly.
var form_widget = require('web.form_widgets'); // correct one


text:
Q: Trying to create a Big Endian environment using solaris 10 SPARC VM in Windows8 Host I need a Big Endian system for testing.
I am planning to create a Solaris Virtual Machine by installing
Oracle Solaris 10 SPARC(http://www.oracle.com/technetwork/server-storage/solaris10/downloads/index.html) inside a virtual machine.
I am using Oracle Virtualbox software in my Windows 8.1 machine.
Its processor hardware is Intel core i-5.
Will it work ? because somebody told me Big Endianness is a CPU property rather than OS. Or is there any download link to get a Solaris 10 Big Endian VM template ?

A: You can't run Sparc software on x86 processor (w/o special emulator).
And as endianness is processor related you can try to rent virtual machine (Sparc, Power)
About renting: there are several companies, which offer renting server.
You can also find some offers for virtual machines, like this or this.


text:
Q: TypeError: ufunc 'add' did not contain a loop I use Anaconda and gdsCAD and get an error when all packages are installed correctly.
Like explained here: http://pythonhosted.org/gdsCAD/
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

My imports look like this (In the end I imported everything):
import numpy as np
from gdsCAD import *
import matplotlib.pyplot as plt

My example code looks like this:
something = core.Elements()
box=shapes.Box( (5,5),(1,5),0.5)
core.default_layer = 1
core.default_colors = 2
something.add(box)
something.show()

My error message looks like this:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-2f90b960c1c1> in <module>()
 31 puffer_wafer = shapes.Circle((0.,0.), puffer_wafer_radius, puffer_line_thickness)
 32 bp.add(puffer_wafer)
---> 33 bp.show()
 34 wafer = shapes.Circle((0.,0.), wafer_radius, wafer_line_thickness)
 35 bp.add(wafer)

C:\Users\rpilz\AppData\Local\Continuum\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.pyc in _show(self)
 80     ax.margins(0.1)
 81
---> 82     artists=self.artist()
 83     for a in artists:
 84         a.set_transform(a.get_transform() + ax.transData)

C:\Users\rpilz\AppData\Local\Continuum\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.pyc in artist(self, color)
952         art=[]
953         for p in self:
--> 954             art+=p.artist()
955         return art
956

C:\Users\rpilz\AppData\Local\Continuum\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.pyc in artist(self, color)
475         poly = lines.buffer(self.width/2.)
476
--> 477         return [descartes.PolygonPatch(poly, lw=0, **self._layer_properties(self.layer))]
478
479

C:\Users\rpilz\AppData\Local\Continuum\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.pyc in _layer_properties(layer)
103         # Default colors from previous versions
104         colors = ['k', 'r', 'g', 'b', 'c', 'm', 'y']
--> 105         colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))
106         color = colors[layer % len(colors)]
107         return {'color': color}

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

A: The gdsCAD has been a pain from shapely install to this plotting issue.

This issue is because of wrong datatype being passed to colors function. It can be solved by editing the following line in core.py
colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))

to
colors += list(matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)))

If you dont know where the core.py is located. Just type in:
from gdsCAD import *
core

This will give you the path of core.py file. Good luck !

A: Well first, I'd ask that you please include actual code, as the 'example code' in the file is obviously different based on the traceback. When debugging, the details matter, and I need to be able to actually run the code.
You obviously have a data type problem. Chances are pretty good it's in the variables here:
puffer_wafer = shapes.Circle((0.,0.), puffer_wafer_radius, puffer_line_thickness)

I had the same error thrown when I was running a call to Pandas. I changed the data to str(data) and the code worked.

A: I don't know if this helps I am fairly new to this myself, but I had a similar error and found that it is due to a type casting issue as suggested by previous answer. I can't see from the example in the question exactly what you are trying to do. Below is a small example of my issue and solution. My code is making a simple Random Forest model using scikit learn.
Here is an example that will give the error and it is caused by the third to last line, concatenating the results to write to file.
import scipy
import math
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn import preprocessing, metrics, cross_validation

Data = pd.read_csv("Free_Energy_exp.csv", sep=",")
Data = Data.fillna(Data.mean()) # replace the NA values with the mean of the descriptor
header = Data.columns.values # Ues the column headers as the descriptor labels
Data.head()
test_name = "Test.csv"

npArray = np.array(Data)
print header.shape
npheader = np.array(header[1:-1])
print("Array shape X = %d, Y = %d " % (npArray.shape))
datax, datay =  npArray.shape

names = npArray[:,0]
X = npArray[:,1:-1].astype(float)
y = npArray[:,-1] .astype(float)
X = preprocessing.scale(X)

XTrain, XTest, yTrain, yTest = cross_validation.train_test_split(X,y, random_state=0)

# Predictions results initialised
RFpredictions = []
RF = RandomForestRegressor(n_estimators = 10, max_features = 5, max_depth = 5, random_state=0)
RF.fit(XTrain, yTrain)       # Train the model
print("Training R2 = %5.2f" % RF.score(XTrain,yTrain))
RFpreds = RF.predict(XTest)

with open(test_name,'a') as fpred :
    lenpredictions = len(RFpreds)
    lentrue = yTest.shape[0]
    if lenpredictions == lentrue :
            fpred.write("Names/Label,, Prediction Random Forest,, True Value,\n")
            for i in range(0,lenpredictions) :
                    fpred.write(RFpreds[i]+",,"+yTest[i]+",\n")
    else :
            print "ERROR - names, prediction and true value array size mismatch."

This leads to an error of;
Traceback (most recent call last):
  File "min_example.py", line 40, in <module>
    fpred.write(RFpreds[i]+",,"+yTest[i]+",\n")
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

The solution is to make each variable a str() type on the third to last line then write to file. No other changes to then code have been made from the above.
import scipy
import math
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn import preprocessing, metrics, cross_validation

Data = pd.read_csv("Free_Energy_exp.csv", sep=",")
Data = Data.fillna(Data.mean()) # replace the NA values with the mean of the descriptor
header = Data.columns.values # Ues the column headers as the descriptor labels
Data.head()
test_name = "Test.csv"

npArray = np.array(Data)
print header.shape
npheader = np.array(header[1:-1])
print("Array shape X = %d, Y = %d " % (npArray.shape))
datax, datay =  npArray.shape

names = npArray[:,0]
X = npArray[:,1:-1].astype(float)
y = npArray[:,-1] .astype(float)
X = preprocessing.scale(X)

XTrain, XTest, yTrain, yTest = cross_validation.train_test_split(X,y, random_state=0)

# Predictions results initialised
RFpredictions = []
RF = RandomForestRegressor(n_estimators = 10, max_features = 5, max_depth = 5, random_state=0)
RF.fit(XTrain, yTrain)       # Train the model
print("Training R2 = %5.2f" % RF.score(XTrain,yTrain))
RFpreds = RF.predict(XTest)

with open(test_name,'a') as fpred :
    lenpredictions = len(RFpreds)
    lentrue = yTest.shape[0]
    if lenpredictions == lentrue :
            fpred.write("Names/Label,, Prediction Random Forest,, True Value,\n")
            for i in range(0,lenpredictions) :
                    fpred.write(str(RFpreds[i])+",,"+str(yTest[i])+",\n")
    else :
            print "ERROR - names, prediction and true value array size mismatch."

These examples are from a larger code so I hope the examples are clear enough.


text:
Q: Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database I'm using Umbraco CMS v7.4 with SQL Server 2014, the project was working fine until a few hours ago, when an error started showing up:

Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database

The error occurs when I tried to open the website, see the image below:

I tried the following:

*

*Checked to see if SQL Server is running

*Checked the connection string credentials in web.config
Any help is appreciated.

A: After a few tries, even I loaded the backed up DB, I found that it caused by the DB login, the user in the connection string was having a password expiration enabled (the password had expired).
So, this is what I did:

*

*Open the SQL server

*Logged in as the user used in the connection string

*Created a new password

*Updated the web.config connection string "Password"

Hope this will help

A: So, in my case I tried to get started with the existing project. I got all the files, restored DB backup locally, made sure all permissions are set for IIS AppPool user etc. But I kept getting the error in question. It turns out that I cannot use server=localhost;database=... in connection string. After I replaced it with server=.\;database=..., it started to work right away.

A: Also note that if you're running it in Azure with an Azure SQL database you'll have to go to the Azure SQL Server settings and under "Firewalls and virtual networks" you'll need to tick "Yes" for "Allow Azure services and resources to access this server".

A: I was getting this error when running an Umbraco project locally, with the DB pointing to an instance on Azure. In that case, this problem happens if you haven't allowed the IP access within the Server Firewall of the DB in Azure.
You can fix this by finding out your IP and then adding it to the DB:

*

*Click All Resources within your Azure portal, then click on the SQL Database your project points to.

*Click Set Server Firewall on the right-side window.

*Add in your IP as the start and end points, and call it something memorable.

*Click Save and once you get the confirmation message that It has been applied, refresh your site locally.

A: I experienced the same problem and here is how I fixed it.

*

*Right-click on your localhost in SSMS and select Properties

*Got to the Security page and select "Select authentication" as "SQL Server and Windows Authentication mode"

*Hit OK.

*Go to Services and find your SQL Server service and restart it.

*Check your local umbraco website now, you should be able to see it without any issues. If you still have problems, then you might need to check your local setup and permissions.

*Further details are below and on this blog post.


text:
Q: how can I clear notifications in android studio (java) I have this media player project and I have foreground service in it which allows me to control the song through notifications even if I clear the app in the background. Everything is working fine including the controls in the notification. But...the notification just remains forever and cannot be cleared even if I try to clear it until I re-run the app or restart my phone. Please help. Tried things like setAutoCancel(true) and etc

A: Are you calling
stopForeground()

?
This method takes a Boolean to indicate if you want to remove the notification as well.
Read this article


text:
Q: What do you call a job offer that isn't a real offer yet? A company is interested in a person as a potential employee, and contacts that person. The company's representative describes the role, advertises the benefits, interviews the person etc.
You would call this a job offer(ing?), except the word offer in this context has acquired a very specific meaning: the final phase of the negotiations, when the company is committed to hiring the person and sends a formal job offer listing the salary etc.
Before the formal offer happens, what do you call this?
Example contexts:

*

*Thank you, but I am not interested in your [offer].

*I am considering two other [offers] at the moment.

A: It's a provisional offer.
See this standard UK HR industry letter template (from pohwer.net)

"Once I have heard back from you confirming that you have received this letter and are accepting my provisional offer of employment, I will contact your referees"

From provisional:

subject to later alteration; temporary or conditional: a provisional decision (-- Collins)

A: I think you may refer to it as a prospective (job) offer:

*

*potential, likely, or expected.

The Free Dictionary

A: All the current answers are using language that is perhaps correct as a definition, but not what would actually work in your situation.
The word you want to use in your phrases is "opportunity." A job opportunity is when there is the opportunity for a job. Nearly no company would describe this as a job offer until an actual job offer has been made.
It is also a very general term that can be used regardless of which stage you are in the process. This has the added benefit of not being presumptuous of your application state. You could for example turn down another interview request or a formal offer or an informal offer all with the same word.
An interview request is NOT an offer in nearly all cases.

*

*Thank you, but I am not interested in this opportunity.

*I am considering two other opportunities at the moment.

However, once they commit to making an offer it would be considered a "verbal offer." This is the state where the company has indicated they intend to give you a formal job offer, but not the actual paperwork yet. It might include as you describe the expected salary but doesn't include all the specific information.
In this case, I would still use the word opportunity in both the above contexts. The reason is that while well intentioned a verbal offer does not guarantee a formal offer. On The Workplace we get questions about this all the time. But it is still an opportunity.

A company is interested in a person as a potential employee, and contacts that person. The company's representative describes the role, advertises the benefits, interviews the person etc.

When the job is available to apply for, you would consider it a job posting / position. Once you have applied, but without having reciprocated interest, it'd become a job application. It can be considered to become an opportunity once you have communication back/forth from the company.

A: Opening - noun - 8. an employment vacancy; an unfilled position or job:

A: I would probably use the word "tentative":

not certain or fixed; provisional.
not fully worked out or developed

It's a sort of 'offer of an offer' which I think would be appropriate here. They are tentatively offering you something, but with the implication that it's not a firm commitment by either party.

A: I'd argue it's not a provisional offer because the job is still to be offered to the candidate. The process described here is called head-hunting.

A: Prospect works for your question and your second example.  Less so for your first.
Opportunity works for both (though I'd go with "this..." rather than "your...").

A: The term position is much broader

a post of employment; job

Collins
While it is routinely used to describe an existing employment (What is your position in the company?), it is regularly used to describe prospective jobs.
It would fit in the context of both your examples.

A: Well, I have a sort of "non-answer". And that is that in common usage for those 2 exact examples you don't typically refer to an "offer" (or whatever you want to call it), you refer to the opening/position itself. Especially since no actual offer has been made.
Thank you, but I am not interested in your position.
I am considering two other openings at the moment.
A head-hunter contacting you about a position does not in any way imply that you are any closer to an offer than if you had contacted them about it, so no "tentative/prospective offer" language is needed.
I once worked for a company that had such a division (what I refer to as "head-hunters", staffing experts that sought out potential employees for a job opening). They contacted enough people to hold full rounds of interviews, you had no more likeliness of getting the job just because it was one that they were contacting you about vs. one you applied for. In fact, they purposefully would find very lowly qualified people and send them in to the interviewers to up the likelihood of the company taking someone (and therefore them getting their commission for finding them) by making the regular people look more qualified by comparison. So those people definitely were not any closer to a real offer, they were basically sacrifices.
If some sort of unofficial/spoken offer has actually been made (the OP does not specify it has, but for the sake of thoroughness), then it would technically would be called exactly that: an unofficial offer, and it would be completely appropriate to just refer to it as an "offer".
Thank you, but I am not interested in your offer.

Provisional offer does not fit here at all, because that is an actual offer that has been made but with provisions/conditions. That does not seem to be the case.
Prospective offer and potential offer fits the description the OP gives (i.e. an offer is expected but not yet actually given), but not at all the examples given. You wouldn't tell them you're rejecting their prospective offer that hasn't even been given yet, you'd tell them you reject the position (like the beginning of my answer). Likewise you wouldn't tell one potential employer you have "prospective offers" elsewhere. Until an offer has actually been made you'd still just say that they are other "openings" or "positions" you're interested in.
That's what makes this question a little hard to answer: the description and the examples don't actually fully mesh. You tend to be answering for one or the other.

A: I would substitute your examples as follows:

Thank you, but I am not interested in your [VACANCY].
I am considering two other [POSITIONS] at the moment.

I am amazed that "vacancy" has not been included as an answer yet (only a as a definiton in an answer.) It fits perfectly in the sentence above.
There is one other important phrase:

I'm sorry. The [POST] has been filled

A:
Sorry, I'm not interested in your offer.
I"m considering two other offers at the moment.

is the most likely answer that Joe and Jane Doe would give to a job opportunity they are not interested in.

A: (Edited for clarity)
That type of overture is called a 'feeler', as in a sensory organ.
"I received a feeler regarding a job opening"
From OED (via Google):
'A tentative proposal intended to ascertain someone's attitude or opinion.
"he put out feelers about seeking the party nomination"
"the committee put out feelers"
Synonyms:   tentative inquiry/proposal, advance, approach, overture, probe '
My opinion follows:
A tactful response to a feeler should not contain the words 'feeler' or 'offer'. The first is gauche, and the second is not accurate. Don't try to characterize their intent, just speak to their words.
For your first example, you could try something like, "Thank you for your interest (or 'consideration'), but I couldn't accept a position as (X) at this time..." Notice the future tense. By using "couldn't" you acknowledge that an offer has not been made.
The intent of the second example isn't clear. If you need more time to consider, you should explicitly request a specific amount of time. Otherwise, they may think you are saying "No".

A: There a many words to choose from, and the right one to use depends on the degree of progress made in developing the relationship.

*

*If there isn't even a well-defined job description, but the company is likely to hire someone, I'd call it an opportunity.

*If there is a job description, then I would call it a vacancy, opening, or position.

*After a favourable interview, you're now a candidate.  At this stage, to decline to proceed, as in your first example, I would say Thank you, but I am no longer interested in this position.

*If there is a mutual desire to proceed, then you enter a negotiation.  Your second example could be worded as I am negotiating two other offers at the moment.  "Negotiating" makes it clear that you haven't reached final agreement yet.

*The company would usually make a conditional or provisional offer, subject to verification of references, etc.  At this stage, you could say that you decline the offer.  The company can withdraw the offer (but that would generally require some kind of justification).

A: "Projected position" might work, just please mind, nobody hires people before they register the company :)
https://www.google.ie/search?q=%22projected+position%22+job+offer&ie=utf-8&oe=utf-8&gws_rd=cr&ei=ooknVsn8KIGIUcvHlsAG

A: Well, you can call it as "letter of intent"


text:
Q: How to print the old and new value using bash? I need to print numbers in this pattern starting from 7:
The start number is 7 and the end number is 14
The start number if 14 and the end number is 21
The start number if 21 and the end number is 28

...
up to 70
I am trying to use if inside for loop but not able to get the desires output.

A: Shell programming always allows a vast amount of possible solutions (this is why it is always a crude way to solve problems), but you can try it like this:
number=7
while [ "$number" -lt 70 ]
do
  echo -n "The start number is $number"
  number=$((number+7))
  echo " and the end number is $number"
done


text:
Q: Best practices of wrapping an HTTP API for both Android and iOS I have some http REST APIs which are used for both android and iOS, however, this is not very easy to maintain once the API updated.
I prefer to wrap it in C/C++, so it could be used as JNI (dynamic library) or static linked with iOS.
But it seems Apple will force to use https, they do not support http anymore, I am not sure if there are similar libraries support this feature. Is there some best practices for doing this?


text:
Q: get twitter profile picture using claims oauth 2 I've got a site setup to accept twitter and facebook external logins.
Is there a way to get the twitter profile picture using claims?
var twitter = new TwitterAuthenticationOptions
            {
                ConsumerKey = AuthenticationSettings.Twitter.ConsumerKey,
                ConsumerSecret = AuthenticationSettings.Twitter.ConsumerSecret,
                AuthenticationType = Constants.ExternalProviders.Twitter,
                SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
                Provider = new TwitterAuthenticationProvider()
                {
                    OnAuthenticated = async ctx =>
                    {
                        //SOME CODE HERE TO GET PROFILE PHOTO
                    }
                }
            };

Otherwise, what;s the best way of getting the profile photo?

A: Apparently there is not an easy way to do this, you need to use the Twitter Api.
Look here, get-the-twitter-profile-image-using-the-asp-net-identity


text:
Q: Private constructor in Javascript with Static members It might not be possible, but I'm curious. Is it possible to define a private constructor with a public factory method?
function MyParentClass() {}
MyParentClass.prototype.init = function() { ... }

function MyChildClass() {}
MyChildClass.prototype = new MyParentClass();
MyChildClass.prototype.init = function() {
    ...
    MyParentClass.prototype.init.apply(this);
    ...
}
MyChildClass.Create = function() {
    var instance = new MyChildClass();
    instance.init();
    return instance;
}

Is it possible to hide the 2 constructors and only expose Create()?
Other approaches to this overridable init() approach are welcome too. Thank you.

A: I am not sure what you are trying to achieve, but here's an example where MyClass would be a singleton that has a factory method create that allows creating MyClass instances.
//MyClass will be an object with a create method only
var MyClass = (function() {
    function MyClass() {
        this.initialized = false;
    }

    MyClass.prototype = {
        init: function () {
            this.initialized = true;
            return this;
        }
    };

    return {
        create: function () {
            return new MyClass().init();
        }
    };

})();

var m = MyClass.create();
console.log(m);
console.log(m.constructor); //Will be Object because we replaced the whole prototype

However, I am not sure why you want to have two constructor functions (init and the constructor itself)? Are you trying to abstract the object creation process away because it is complicated?
I suspect that you simply want to move the constructor logic into another function because of the way you are trying to achieve inheritance.
Are you simply trying to avoid calling the constructor logic when you do the following?
MyChildClass.prototype = new MyParentClass();

If it's the case, using Object.create would fix your problem (it is not supported in old browsers, but there's a shim for it -- the shim support the features you would need, but not everything that Object.create does).
function A(test) {
    this.test = test;
}

function B(test) {
    A.call(this, test); //call parent constructor
}
B.prototype = Object.create(A.prototype); //inherit from A

var b = new B('test');

console.log(b);
console.log(b instanceof A); //true

You could also use a pure prototypal approach, without using constructor functions together with the new keyword.
var A = {
        init: function (test) {
            this.test = test;
            return this;
        }
    },
    B = Object.create(A),
    b;

    //override constructor function
    B.init = function (test) {
        return A.init.call(this, test);
    };

b = Object.create(B).init('test');

console.log(b);


text:
Q: Remove item from session based on item hash in PHP I try to delete from the session a product based on his hash and not on his id, I have several products with the same id and the problem is when I delete a product from the cart all the others containing the same id are deleted and therefore instead of product id I want to delete them through the product hash.
Here is the function that is made for remove that i want to change instead of id to be on hash remove:
public function remove($id, $attributes = [])
{
    if (!isset($this->items[$id])) {
        return false;
    }

    if (empty($attributes)) {
        unset($this->items[$id]);

        $this->write();

        return true;
    }
    $hash = md5(json_encode(array_filter($attributes)));

    foreach ($this->items[$id] as $index => $item) {
        if ($item['hash'] == $hash) {
            unset($this->items[$id][$index]);

            $this->write();

            return true;
        }
    }

    return false;
}

Array Session Output:
Array
(
    [25] => Array
        (
            [0] => Array
                (
                    [id] => 25
                    [qty] => 1
                    [hash] => 0a3610cb23dba6f6f40f74a1a9e2680a
                    [attributes] => Array
                        (
                          [price] => 60
                        )
                )
        )
)


text:
Q: Rank-ordered cumulative distribution estimation: where does this function come from? I am reading over some process analysis data for some failure analysis tests, and I have come across the following definition of an "estimated cumulative probability":
$$F(t) = \frac{i-3/8}{N+1/4},$$
where $i$ is the rank of the failure case (i.e. failure order), and $N$ is the total number of samples.
I had some difficulty in figuring out the who/what/why behind this formula. An internet search brought me to this page, where it seems to be referred to as "White's plotting position." However, a reference is not presented.
Is this relationship familiar to anyone, and if so, could you provide either a reference or a background on this formula. Specifically, why is this a good estimate of cumulative probability, and how those results may be interpreted.

A: This is called White's plotting position, an alternative to the median rank.  Check out The Weibull Analysis Handbook, page 21.

A: I also found that this has to do with the Weibull distribution for cumulative rank order of failures when the data have more than one censored observation.  The StatSoft manual that you cite referenced Dobson (1994) which could be found by properly searching the references for the site.
Dodson, B. (1994). Weibull analysis. Milwaukee, Wisconsin: ASQC.


text:
Q: SQL Select Radius Search based on Latitude Longitude I got 2 tables:
Events:
 - id
 - name
 - place

Places:
 - id
 - name
 - lat
 - lng

I would like to retrieve all events that in 10KM radius (based on the place lat & lng) from the current lat and lng. How can I do that?
Thanks!

A: If you are willing to use an extension, the geospatial extension, in MySQL 5.6 and on, is intended to address exactly this type of question. You will need to build a spatial index on your places table:
ALTER TABLE places ADD SPATIAL INDEX lat, lng

select name from places
order by st_distance(point(@lng, @lat), point(lng, lat))
limit 10

The actual finding of actual distances is a bit computation heavy. The following post lays out some of the methods you might want to try: http://www.plumislandmedia.net/mysql/using-mysqls-geospatial-extension-location-finder/
For even more detail, look at http://www.percona.com/blog/2013/10/21/using-the-new-spatial-functions-in-mysql-5-6-for-geo-enabled-applications/

A: Maybe this helps you http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
Basically the problem is that lat/lng are spherical coordinates (lat and lng are angles), and you want to make a search using a linear distance over the spherical surface. Then, you are trying to compare two different things, I mean, angles with kilometers. To do it, you must make a coordinate transformation and then compare.

A: Hope this simple query helps
SELECT
    *
FROM
    `locator`
WHERE
    SQRT(POW(X(`center`) - 49.843317 , 2) + POW(Y(`center`) - 24.026642, 2)) * 100 < `radius`

details here http://dexxtr.com/post/83498801191/how-to-determine-point-inside-circle-using-mysql

A: You have to use st_distance_sphere, which will interpret the two points given as geographic points that is lat/lng instead of two points in a two-dimensional coordinate system.
The result is in meters.
mysql> SET @pt1 = ST_GeomFromText('POINT(0 0)');
mysql> SET @pt2 = ST_GeomFromText('POINT(180 0)');
mysql> SELECT ST_Distance_Sphere(@pt1, @pt2);
+--------------------------------+
| ST_Distance_Sphere(@pt1, @pt2) |
+--------------------------------+
|             20015042.813723423 |

The result is in meters.
Here is the documentation:
enter link description here


text:
Q: How to open Google Maps using a button on an Android app I'm trying to make an app with a button called "Map" that will display a city map once pressed. So far I've made an app which contains the Map button and a separate app for my map which uses the Google Developers' tutorial to display a map when the app is opened. I'm having trouble when I try to combine both apps. I'm working on the OnClickListener but I don't know what I should put so that the map would be displayed after pressing the button.
EDIT
Below is my MapFragment class for the map:
    public class MapFragment extends FragmentActivity
    {
        private GoogleMap mMap;
        private LatLngBounds ILOILO = new LatLngBounds(new LatLng(10.6, 122.466), new LatLng(10.716, 122.566));

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

        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.inflate(R.layout.map_layout, container, false);

            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
            mMap.setMyLocationEnabled(true);
            mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
            mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ILOILO.getCenter(), 10));

            if (mMap == null)
            {
                 Toast.makeText(this, "Google Maps not available",
                     Toast.LENGTH_LONG).show();
            }

            return v;
        }
    }

Here's my XML file for the map:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/map"
    map:uiCompass="false"
    map:uiTiltGestures="true"
    map:uiZoomControls="true"
    map:uiZoomGestures="true"
    map:uiRotateGestures="true"
    map:uiScrollGestures="false"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"/>

Here's for the button located in my MainActivity.java:
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageButton mapButton = (ImageButton) findViewById(R.id.mapButton);
    mapButton.setOnClickListener(mapListener);
}

private OnClickListener mapListener = new OnClickListener()
{
    public void onClick(View v)
    {
        Intent i = new Intent(MainActivity, MapFragment.class);
        startActivity(i);
    }
};

I've also modified my Manifest since I've been getting "Unable to find explicit activity class (com.example.ipp.MapFragment); have you declared this activity in your AndroidManifest.xml?" error. Below is my manifest.
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="MapFragment" >
        </activity>

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

PROBLEM
When I try to click the "Map" button, it displays my UI instead of displaying the map I've prepared.


text:
Q: How to fix input string was not in a correct format in sql on C#? public static String AccountNumber;
public static double oldBalance, newBalance;

SqlConnection connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\CSharp\ATM\DB\LoginDB.mdf;Integrated Security=True;Connect Timeout=30");

private void iconButton1_Click(object sender, EventArgs e)
{
        newBalance = oldBalance + Convert.ToInt32(txtAmmount.Text);
        try
        {
            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
            adapter.SelectCommand = new SqlCommand("UPDATE Account SET AccBalance ='" + Convert.ToDouble(newBalance) + "'WHERE AccountNum =" + txtAccount.Text.Trim() + "", connection);
            DataTable data = new DataTable();
            adapter.Fill(data);
            if (data.Rows.Count >0)
            {
                MessageBox.Show("Deposit Success", "Deposit", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Deposit Faild", "Deposit", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            }

            connection.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(" " + ex, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
}

private void GetBalance()
{
        try
        {
            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
            AccountNumber =Form1.AccountNumber;
            int accounts=Convert.ToInt32(AccountNumber);
            adapter.SelectCommand = new SqlCommand("SELECT AccBalance FROM Account WHERE AccountNum='" + accounts + "'", connection);
            DataTable data = new DataTable();
            adapter.Fill(data);
            oldBalance = Convert.ToInt32(data.Rows[0][0].ToString());
            connection.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Warning Message!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
}

private void Form3_Load(object sender, EventArgs e)
{
    GetBalance();
}

When I load the Form, I get an error

Input string was not in a correct format

A: I think the error is here
UPDATE Account SET AccBalance ='" + Convert.ToDouble(newBalance) + "'WHERE AccountNum =" + txtAccount.Text.Trim() + ""

In the runtime, for example, newBalance = 1 and then txtAccount.Text = "My name" the result will be
UPDATE Account SET AccBalance ='1'WHERE AccountNum =My Name

As you can see:

*

*No space between 1' and WHERE

*No ' before and after "My Name"

That's why the code can't work and now you know how to fix it.
As some comment already above, you should use SQLCommand Params instead of building raw SQL string https://csharp-station.com/Tutorial/AdoDotNet/Lesson06


text:
Q: Castor JDO / OQL query returning duplicate objects and missing some dependants I have this issue when querying certain objects (persisting in Postgres database)
using Castor 0.9.6 (can't upgrade)
Problem only occurs on production, not dev machine. Despite using same database.
udOql= db.getOQLQuery( "SELECT DISTINCT ud FROM model.objects.UserDefinition ud WHERE ud.siteId = $1");
udOql.bind(other.getSiteId());

This normally is working fine but for some reason I am getting duplicate objects, even when I include DISTINCT
Mapping XML is as follows:
  <class name="model.objects.UserDefinition" identity="userId" key-generator="HIGH-LOW">
    <cache-type type="unlimited" capacity="1000"/>

    <map-to table="userdefinition" xml="userDefinition" />
    <field name="siteId" type="java.lang.Integer">
      <sql name="siteid" type="integer" />
    </field>

    <field name="userAttributeDefinition" type="model.objects.UserAttributeDefinition" collection="vector">
      <sql many-key="userid" />
    </field>
    <field name="roleAssignmentDefinition" type="model.objects.RoleAssignmentDefinition" collection="vector">
      <sql many-key="userid" />
    </field>
  </class>

Not only will it return multiple UserDefinition objects, some of them are missing some linked roleAssignmentDefinition or userAttributeDefinition. Usually after restarting tomcat it fixes the problem but then it comes back. Sometimes the issue the issue is there from the start.
The database holds correct data. Any tips, pointers much appreciated


text:
Q: ERROR Scanning textFile shows error " Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException" public class checkDuplicateNames1 {

public boolean checkDuplicateNames1(String name , String surname){
   boolean found = false;
    File file = new File("transactions.txt");

    try {
        Scanner sc = new Scanner(new File("transactions.txt"));
        sc.useDelimiter("/");

        while(sc.hasNext()){

        String userName = sc.next();
        String userLastName = sc.next();
        String userCash = sc.next();
        String paidStatus = sc.next();

        if((userName.equals(name)&&userLastName.equals(surname))){

            found = true;

        }
        else
        {

            found = false;
        }
        }

    } catch (FileNotFoundException ex) {
        Logger.getLogger(checkDuplicateNames.class.getName()).log(Level.SEVERE, null, ex);
    }

 return found;

}

}

When i am in the point when i use the "boolean checkDuplicateNames1" method i get this error
Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1371)
at Lending.checkDuplicateNames1.checkDuplicateNames1(checkDuplicateNames1.java:41)
at Lending.Loan.jButton1ActionPerformed(Loan.java:250)
at Lending.Loan.access$200(Loan.java:24)
at Lending.Loan$3.actionPerformed(Loan.java:137)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I tried to use different filereader like bufferedReader it's just the same ,
here's the "Loan class "  method that uses "checDuplicateNames1" method
 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    String name = jTextField1.getText();
    String surname = jTextField4.getText();
    String cash = jTextField5.getText();
    System.out.println("loan clicked");

    try {

        String info = name + "/" + surname + "/" + cash + "/" + "unpaid";

        checkDuplicateNames1 c = new checkDuplicateNames1();
        boolean duplicated = c.checkDuplicateNames1(name,surname);

        if(duplicated == true){
            System.out.println("duplicated");
            this.currentName = name;
            this.currentSurname = surname;
          JOptionPane.showMessageDialog(null,"Person already in the Record ");
          wannaAddLoanValue w = new wannaAddLoanValue(name,surname,cash);
          w.show();

        }
        else
        {
            File file = new File("transactions.txt");
             PrintWriter writer = new PrintWriter(new FileWriter(file,true));
             String info1 = name + "/" + surname + "/" + cash + "/" + "unpaid";
             writer.println(info1);
              writer.close();

        }

    } catch (FileNotFoundException ex) {
        Logger.getLogger(Loan.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Loan.class.getName()).log(Level.SEVERE, null, ex);
    }

}

and Also the text in the file are like this
rodchris/toledo/200/unpaid
yannie/taub/890/unpaid

A: You should always call sc.hasNext() before sc.next();.
while(sc.hasNext()){

    // This line is OK
    String userName = sc.next();

    // The following lines can cause NoSuchElementException
    String userLastName = sc.next();
    String userCash = sc.next();
    String paidStatus = sc.next();

checkDuplicateNames1() can be refactored as follows:
public boolean checkDuplicateNames1(String name, String surname) {
    boolean found = false;
    try (Scanner sc = new Scanner(new File("transactions.txt"))) {
        sc.useDelimiter("/");
        String userName = sc.hasNext() ? sc.next() : null;
        String userLastName = sc.hasNext() ? sc.next() : null;
        return userName != null && userLastName != null && userName.equals(name) && userLastName.equals(surname);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(checkDuplicateNames.class.getName()).log(Level.SEVERE, null, ex);
    }
    return found;
}

A: which line in ur class is 41 ? i.e which next() causes the error,
i think hasNext() considers the whole current input as 1 token, but when you call next() several times, you got only first 1 then the exception, to fix this i think you have to check for hasNext() before each next()
while(sc.hasNext()){
    String userName="",userLastName="",userCash="",paidStatus="";

    //first one already checked in while(...)
    userName = sc.next();

    if(sc.hasNext())
        userLastName = sc.next();

    if(sc.hasNext())
        userCash = sc.next();

    if(sc.hasNext())
        paidStatus = sc.next();

    //... rest of code

in the rest of your code you may want to check each variable is empty
if(!userLastName.isEmpty()) ...


text:
Q: scraping web vba oncick in the link https://www.forebet.com/en/predictions-tips-atl%C3%A9tico-madrid-real-madrid-553878 I want to load the document that is on the page that you click on "uo_t_butt"
I create the script with
Sub provaonclick()

Dim objIE As Object
Dim ele As Object
Dim ele1 As Object

Set objIE = CreateObject("internetexplorer.application")
objIE.Visible = True
objIE.navigate "https://www.forebet.com/it/pronostico-per-real-madrid-liverpool-fc-731893"
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
Set ele = objIE.document.getElementsByClassName("tabs-ul")(0)
Set ele1 = ele.document.getElementById("uo_t_butt").Click

End Sub

but in the object ele1 there is nothing

A: What i think is your problem is that it is a javascript controlling the button.
HTML and javascript isn't my strong suit but the following code works for me:
Sub provaonclick()
Dim objIE As Object

Set objIE = New InternetExplorerMedium
objIE.Visible = True
objIE.navigate "https://www.forebet.com/it/pronostico-per-real-madrid-liverpool-fc-731893"
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop

With objIE.Document.getElementById("uo_t_butt")
    .Focus
    .Click
End With

End Sub

".Focus" made the code work for me. I don't know what it does though.
EDIT: Actually not using set in front of "objIE.Document.getElementById("uo_t_butt").click" was the difference.

A: You can't normally set an element and try to do a click on it at the same time.
The Set keyword is for assigning a reference.  It is necessary to distinguish between assignment of an object and assignment of the default property of the object. It is this reference type you will be passing around.
This:
Set ele1 = ele.document.getElementById("uo_t_butt").Click

Normally, this would have thrown an error. Weirdly there is a javascript item generated which is JScriptTypeInfo. This , according to this, likely

hides a number of objects that can be found in JScript.dll.

Remove the action (.Click) from the end to set an object in the normal way and you don't need the preliminary object. Work direct of document with the id.
I had no problem using id with:
objIE.document.querySelector("#uo_t_butt").Click

You can use an attribute = value CSS selector
objIE.document.querySelector("[onclick*='uo']").Click

This switches to the unders/overs tab.

Could also use:
objIE.document.querySelector("[id='uo_t_butt']").Click

A: Sub provaonclick()
Dim objIE As Object
Dim ele As Object

Set objIE = CreateObject("internetexplorer.application")
objIE.Visible = True
objIE.navigate "https://www.forebet.com/it/pronostico-per-real-madrid-liverpool-fc-731893"
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
objIE.document.getElementById("uo_t_butt").Click

Set ele = objIE.document.getElementsByClassName("schema")(1)
Stop
End Sub

sorry all I thought I had solved but my macro just click on "onclick" but does not load the new page in "ele".
In "ele" I find the first page that opens not the clicked one


text:
Q: How to export the output from previous cell to a csv file? How can I export the output of this previous cell to a .csv file?

A: Assuming that you are trying to write a dictionary to a csv file, I recommend pandas for this, you can also use csv but this is faster.
import pandas as pd

vm =  {'rs963837': None, 'rs9895661': 'BCAS3', 'rs10277115': None, 'rs62435145': None, 'rs13230509': None, 'rs13230625': None, 'rs11761603': None, 'rs12702509': None}

df = pd.DataFrame.from_dict(vm,orient='index')

print(df)

My output looks like this
            0
rs963837    None
rs9895661   BCAS3
rs10277115  None
rs62435145  None
rs13230509  None
rs13230625  None
rs11761603  None
rs12702509  None

next you can just do the following to save the dataframe as a csv file.
df.to_csv('filename.csv',index=True)


text:
Q: SQL statement to swap timestamps I have several records that I have just copied and edited.
As you can tell in the following picture that I have 2 of each FactorType one with a timestamp of "2014...." and one with "2100..."

I just finished updating them to the values I wanted except I realized that I have the timestamps backwards. The records with the 2014 dates I want to have 2100 and the ones with the 2100, I want to have 2014.
Is there any series of SQL statements I can use to accomplish this?

A: update e
set     ValidTo = case  when e.ValidTo = '20140204' then '21000101'
                        when e.ValidTo = '21000101' then '20140204'
                    end
from    [central].dbo.EstimateFactors as e
where   [ComponentPart] = 'Labor Cost' and e.ValidTo in ('20140204','21000101')

Edit: Well ya, don't "test" code on your database.  Backup to another materialized table (select * into EstimateFactors_backup from [central].dbo.EstimateFactors where [ComponentPart] = 'Labor Cost' and ValidTo in ('20140204','21000101') might work, or just backup the db depending on what is appropriate).


text:
Q: Laravel 4 two submit buttons I know the two submit buttons question was asked before, i tried to follow the coding examples but it didn't worked out for me.
I have a form with two buttons (Preview & save)
The save button is for saving the data in DB.
The preview button is for displaying the entered data in a view, the user can navigate back and if everything is ok he can save the data.
No matter which button I click, I always end up with on a blank page: http://localhost:8888/laravel4/public/backend/menubuilder/5
It seems like the @weiche method is now working properly.
However I have no luck.
My Form submits to:
{{ Form::open(array('url' => 'backend/menubuilder/'.$id, 'method' => 'POST'))}}

My Route is
Route::post('backend/menubuilder/{id}',  array('uses' =>'MenuBuilderController@weiche'));
Route::resource('backend/menubuilder', 'MenuBuilderController');

My Controller is:
    public function weiche($id) {
    //check which submit was clicked on
         if(Input::get('save')) {
                 $this->update($id); //if login then use this method
         } elseif(Input::get('preview')) {
                 $this->preview($id); //if register then use this method
         }
}

public function preview($id)
{

    //Wenn angemeldeter Benutzer gleich aufgerufener id -> Anzeigen des dashboards für den entsprechenden User
    $user = User::find($id);
    $owner = (Auth::id() === (int) $id);
    return View::make('backend/menubuilder/templatesview/tempone')->withUser($user)->withOwner($owner);

}

public function update($id)
{
    //Aktualisieren der User Profile
    $rules = array(
        // 'username' => 'unique:users',
        'password' => 'min:6'
    );
    $validator = Validator::make(Input::all(), $rules);

    //Wenn Prüfung fehlgeschlagen, Weiterleitung mit Fehlermeldung
    if ($validator->fails())
        return Redirect::to('backend/menubuilder/'.$id.'/edit')->withInput()->withErrors($validator->messages());

    $user = User::find($id);
    //Wenn Eingabefeld ausgefüllt wird, aktualisere den bestehenden Wert mit dem eingegeben Wert
    $user->gericht_1_mo = Input::get('gericht_1_mo');
$user->gericht_2_mo = Input::get('gericht_2_mo');
$user->preis_1_mo = Input::get('preis_1_mo');
$user->preis_2_mo = Input::get('preis_2_mo');

    if(Input::has('password')) $user->password = Hash::make(Input::get('password'));
    $user ->save();
    Session::flash('message', 'Deine Wochendkarte wurde gespeichert');
    //return Redirect::to('backend/menuebuilder'.$id);
    return Redirect::back()->withMessage('Wochendkarte gespeichert!');
}

A: While it could be that you have errors, it's probably white because your weiche() method doesn't actually return anything. It just calls the update()/preview() methods. If you change to this, it will work - assuming the rest of your code is correct. :)
if(Input::get('save')) {
    return $this->update($id); //if login then use this method
} elseif(Input::get('preview')) {
    return $this->preview($id); //if register then use this method
}

Or, a little shorter:
return Input::get('save') ? $this->update($id) : $this->preview($id);

If you still get white pages, you have an error and you'll need to start digging in the logs. Good luck!


text:
Q: react set state not rerendering component When i use a ternary expression in react render method it renders the false component fine. when set to true nothing happens however when i log state it's updated with true. so this is really confusing. i even tried it with ternary string return and that worked fine, its just the component that wont work. I also found that it renders both when i wrap FormGroup in a empty div. this is really weird. What's supposed to happen is when i click the radio button it will set state to true and variantForm will be true having the ternary return a diff component.
my state on init

{variantForm: false}

after radio button clicked to true

{variantForm: true}

component did mount
    this.productForm.current.controls.hasVariants.current.valueChanges().subscribe(boolean=>{
         this.setState({variantForm:boolean},()=>{
        console.log(this.state);
      })
    })

inside render method

{this.state.variantForm? 'true':'false'}
 // works
      <FormGroup ref={this.productForm} groupName="productForm">
        <FormControl element={InputField} fieldName="productName" label="Product Name"></FormControl>
        <FormControl  defaultValue={false} element={RadioGroupField} fieldName="hasVariants" label="Has Variants"></FormControl>
      </FormGroup>
      {this.state.variantForm? <FormGroup ref={this.productLowerForm} groupName="variantForm">
        <FormControl element={InputField} fieldName="variantName" label="Variant Name"></FormControl>
      </FormGroup> :
      <FormGroup ref={this.productLowerForm} groupName="productLowerForm">
        <FormControl element={InputField} fieldName="productName" label="Product Name"></FormControl>
        <FormControl element={InputField} fieldName="bin" label="Bin"></FormControl>
        <FormControl element={InputField} fieldName="quantity" label="Quantity"></FormControl>
      </FormGroup>
       }

what worked but not sure why was

 {this.state.variantForm?

<FormGroup ref={this.productLowerForm} groupName="variantForm">
        <FormControl element={InputField} fieldName="variantName" label="Variant Name"></FormControl>
      </FormGroup>
 :
      <FormGroup ref={this.productLowerForm} groupName="productLowerForm">
        <FormControl element={InputField} fieldName="productName" label="Product Name"></FormControl>
        <FormControl element={InputField} fieldName="bin" label="Bin"></FormControl>
        <FormControl element={InputField} fieldName="quantity" label="Quantity"></FormControl>
      </FormGroup>
       }

if your wondering what FormGroup returns its the react fragment because no container was provided

        {this.props.container ? <this.props.container>{this.clonedChildren}</this.props.container> : <React.Fragment>{this.clonedChildren}</React.Fragment>}

)

this also works?
   {this.state.variantForm === true?
      <FormGroup ref={this.productLowerForm} groupName="variantForm">
        <FormControl element={InputField} fieldName="variantName" label="Variant Name"></FormControl>
      </FormGroup> : null}
      {this.state.variantForm === false?
      <FormGroup ref={this.productLowerForm} groupName="productLowerForm">
        <FormControl element={InputField} fieldName="productName" label="Product Name"></FormControl>
        <FormControl element={InputField} fieldName="bin" label="Bin"></FormControl>
        <FormControl element={InputField} fieldName="quantity" label="Quantity"></FormControl>
      </FormGroup>: null
       }

A: I realized my issue was because the radio button was not a   boolean it was a string. so it was always true.


text:
Q: How to calculate total number of visible characters of QListWidgetItem in a QListView? I want to add a special character at the last visible position of a QListWidgetItem.
I'm opening the QListWidget using sizeHint.
List items contain simple texts, so I want to add blank characters till the last visible postion and then adding the special character at the last position.
How can I calculate the last visible position of QListView?


text:
Q: How to resolve the cassandra node issue I created a three Cassandra node initially it's working fine, but now 2 nodes are stop working.
I tried
sudo service dse stop

and
sudo service dse start

got below error
Job for dse.service failed because the control process exited with error code.
See "systemctl status dse.service" and "journalctl -xe" for details.

systemctl status dse.service
● dse.service - LSB: DataStax Enterprise
   Loaded: loaded (/etc/init.d/dse; generated)
   Active: failed (Result: exit-code) since Tue 2020-03-17 04:34:24 UTC; 4min 43s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4263 ExecStop=/etc/init.d/dse stop (code=exited, status=0/SUCCESS)
  Process: 11273 ExecStart=/etc/init.d/dse start (code=exited, status=1/FAILURE)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/dse.service

Mar 17 04:34:14 cstar-node1 su[11442]: pam_unix(su:session): session closed for user cassandra
Mar 17 04:34:14 cstar-node1 su[11456]: Successful su for cassandra by root
Mar 17 04:34:14 cstar-node1 su[11456]: + ??? root:cassandra
Mar 17 04:34:14 cstar-node1 su[11456]: pam_unix(su:session): session opened for user cassandra by (uid=0)
Mar 17 04:34:14 cstar-node1 su[11456]: pam_unix(su:session): session closed for user cassandra
Mar 17 04:34:24 cstar-node1 dse[11273]: ERROR: DSE failed to start. Please check your logs.
Mar 17 04:34:24 cstar-node1 dse[11273]:    ...fail!
Mar 17 04:34:24 cstar-node1 systemd[1]: dse.service: Control process exited, code=exited status=1
Mar 17 04:34:24 cstar-node1 systemd[1]: dse.service: Failed with result 'exit-code'.
Mar 17 04:34:24 cstar-node1 systemd[1]: Failed to start LSB: DataStax Enterprise.

only one node is UP
nodetool status
Datacenter: Cassandra
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address       Load       Tokens       Owns    Host ID                               Rack
DN  X.X.X.X   ?          1            ?       46fdfb5e-238c-476b-a243-184a530fg30e  rack1
UN  X.X.X.Y  207.4 KiB  1            ?       7fasd242-891d-4ecf-ggef-0f8hffarr434  rack1
DN  X.X.X.Z  ?          1            ?       34ffda2f-46d2-443d-4546-33c55cface2c  rack1

how to resolve this error? can anyone help me.
Thanks in advance.

A: It's some time ago - so even if it is not of help for you anymore, it might for others. I had the same issue but there hasn't been any entry in the cassandra logs nor in the system logs. Also the start process failed with that non-descriptive message above. To resolve the issue I've been stopping (as root):

*

*the agent: systemctl stop datastax-agent and

*the dse service: systemctl stop dse
Then deleted the directories where the PIDs are located:

*

*/var/run/datastax-agent

*/var/run/dse

And finally restarted both services. That did the trick for me. I cannot say if the deletion of the PIDs or restarting the datastax-agent actually resolved the problem but I my blind guess would fall on the PIDs.


text:
Q: Stack extends Vector If stacks extends vector does that mean that stacks are syncronized?
Note from Vector Java docs

Unlike the new collection implementations, Vector is synchronized.

A: Yes, methods inherited from Vector remain synchronized in Stack. Own Stack methods peek, pop, search are synchronized in Stack. Stack.push and Stack.empty methods are not synchronized, but
public boolean empty() {
    return size() == 0;
}

public E push(E item) {
    addElement(item);
    return item;
}

both methods are calling Vector's synchronized methods therefore Stack.empty and Stack.push are thread safe.

A: Yes, it is synchronized, but according to the Javadocs you should prefer a Deque instead of a Stack.
From the Stack Javadocs:

A more complete and consistent set of LIFO stack operations is
  provided by the Deque interface and its implementations, which should
  be used in preference to this class. For example:
Deque<Integer> stack = new ArrayDeque<Integer>();