text:
Q: How to get data from object and put the this data in a linechart component Called object:

When I call this.state.lineChartData I get the following object(see picture).
The data object looks like this:

data: (5) [{…}, {…}, {…}, {…}, {…}, datasets: Array(0), labels: Array(0)]

When you look to the picture I only need the data [0 till 4] from the array. I need this data for a graph chart.js. I don't need the datasets[] and labels[].
How can I get the array data and fill a line graph with this data.
?
    <Line
        height={100}
        data={this.state.lineChartData.data}
        options={{
          legend: {
            display: true,
            position: "bottom",
          },
          title: {
            display: true,
            text: "test",
            fontSize: 20,
          },
          scales: {
            yAxes: [
              {
                ticks: {
                  beginAtZero: true,
                  min: 0,
                  max: 100,
                },
              },
            ],
            xAxes: [
              {
                ticks: {
                  beginAtZero: true,
                  min: 0,
                  max: 100,
                },
              },
            ],
          },
        }}
      />
    )}

A: So you should set your response as state variable differently:
fetch('...').then(resp => resp.json())
  .then(resp => {
      this.setState({ lineChartData: resp.data });
  });

edit
But then you have to map your data to the format recognizable by chart js:
this.state.lineChartData.map(item => {
    item.x = item.x.split('T')[1].split('.')[0];

    return item;
});

That's only an example, but make sure that you supply the data in a number format for both axis. Also, I did not add labels here.


text:
Q: writing secure clients in Java When a user uses a client like Twitter Client to update their status message, they have to provide their username and password. The server then authenticates the user and updates status message.
My question is how to ensure the security of such sensitive information over the internet.
Is JSSE the correct way to go about it?
What points are to be kept in mind when writing such a client?
Kindly help.

A: From the JSSE Reference Guide:

Once the client and the server are comfortable with each other's identity, SSL provides privacy and data integrity through the encryption algorithms it uses. This allows sensitive information, such as credit card numbers, to be transmitted securely over the Internet.

So yes, JSSE is a good way.

A: For Twitter specifically, they have a whole page dedicated to security best practices.  A lot of those things apply to applications generally, so it's worth a read.  In a nutshell, they highly recommend a protocol called OAuth to handle the password safely, and it's going to be mandatory soon.  The actual programming environment you use is much less important than the process you use.

A: For twitter use OAuth instead of basic authentication. Its much more secure way to authenticate users in your case. Some info could be found here:
https://dev.twitter.com/docs/auth/using-oauth

redpajama_set_name: RedPajamaStackExchange


text:
Q: I am currently writing a stock control system and getting a 105 error I am writing a stock control system and when coding the last thing, I got a 105 error. I was just wondering if anyone had any ideas of what is wrong.
closefile(ContractOrdersfile);
closefile(ContractFile);

assignfile(ContractPriceListFile, 'Contract Price List.txt');
rewrite(ContractPriceListFile);
reset(ContractFile);

while not eof(ContractFile) do
begin
    read(ContractFile, Contract);
      if Contract.Flag = true then
       begin
        Writeln(Contract.Contract_Name + '  ' + inttostr(Contract.Contract_ID) + '  ' +     CurrtoStr(Contract.Search_Price));
        Contract.Search_Price := StrtoCurr('0.00');
        Seek(ContractFile, (Filepos(ContractFile)-1));
        write(ContractFile, Contract);
       end;
end;

ShellExecute(Handle, 'open', PChar('notepad'), PChar('Contract Price List.txt'), nil,    SW_SHOW);
closefile(ContractFile);
closefile(ContractPriceListFile);enter code here

A: I/O Error 105 is "File not open for output". It's usually caused by failing to set the appropriate FileMode after opening the file, or by using Write or WriteLn from a non-console application.
It's most likely caused by the WriteLn inside the if block that writes contract info. It appears to be going to the console (no file is specified as the first argument). You should probably provide a file as the first argument, or make sure you're running a console application.


text:
Q: stored procedure and passing parameters to crystal report state I develop with vb.net and I created a state with crystal report, I use a stored procedure and I would like to know how to pass parameters of the procedure in the state
thank you


text:
Q: Image appears resized automatically When I drop in the third image, it is showing up shorter than the rest. When  I replace the image name with say the Serendipity image it doesn't appear shorter. All images are 1200X800.

Serendipity Coffee & Tea

A small, family owned, cafe in the heart of Osage County.

Audrey Collins

A rising pop artist located in Seattle, WA

Point to Point Transportation

A rising pop artist located in Seattle, WA

JsFiddle Example
Notice the far right image appears shorter even though everything is the extact same except the image link.


text:
Q: Dynamically updating images on website I am accessing the twitter streaming API. I generate a map using Basemap in python.
I want only certain parts of the map to change with time (for eg. every second). Is it hard to do?
Do I need to leave Basemap and look for something else? Please help!

A: You can send an ajax request and update the html contents dynamically.

A: A possible approach: divide the map into tiles, and treat each one separately; use Basemap to generate just the map-tile that contains new data, then update just that tile on your webpage using Ajax.
Of course, depending on the nature of changes to the data on your map, this approach may or may not work for you -- gerrymandering is not really possible.
You would need to write logic to understand which tile the new data belongs to, then use basemap to create a new image for that time, then intelligently update the tiled image. You will also have to play with margins and padding (both in matplotlib and in CSS) to cleanly piece the tiles together.
...
When the approach gets this complicated, one should re-evaluate whether better tools are available. Basemap doesn't sound like a good fit for what you need to do.


text:
Q: Wired connection stuck on connecting I recently installed Lubuntu alongside with Windows 7 on my computer, and I can't get the wired connection to work.
My machine is a Dell E5570 (Latitude 15) laptop with a Dell E-Port dock, when I connect the ethernet cable to the dock I see the following with dmesg -Hw:
[  +9,264007] e1000e: enp0s31f6 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None
[  +0,000007] e1000e 0000:00:1f.6 enp0s31f6: 10/100 speed: disabling TSO

Then the status icon of internet is stuck on "connecting" (a little loop) and then one minute after I get the notification message "You are disconnected".
This is the output of ifconfig:
$ ifconfig
enp0s20f0u7u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.42.252  netmask 255.255.255.0  broadcast 192.168.42.255
    inet6 fe80::a945:4246:b6f5:d5e2  prefixlen 64  scopeid 0x20<link>
    ether 0e:04:ec:56:0a:27  txqueuelen 1000  (Ethernet)
    RX packets 14611  bytes 13392266 (13.3 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 12673  bytes 1831860 (1.8 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 84:7b:eb:30:6b:eb  txqueuelen 1000  (Ethernet)
    RX packets 62  bytes 3968 (3.9 KB)
    RX errors 0  dropped 24  overruns 0  frame 0
    TX packets 474  bytes 84105 (84.1 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 16  memory 0xef200000-ef220000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 2278  bytes 161681 (161.6 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 2278  bytes 161681 (161.6 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether e4:b3:18:0f:40:e7  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s20... is my phone connection.
Here is /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

and /etc/network/interfaces:
auto lo
iface lo inet loopback

I can connect fine with Windows, I can connect to a wireless network with Ubuntu or even my phone shared connection through USB.
When I connect the cable directly to the computer it is not recognized: nothing is displayed in dmesg nor with the Network Manager.
I am behind a company proxy.
Have you got any idea on how to solve this problem?


text:
Q: Get value from select record in store Hello I'm have store and I want get value in field ID from this store.
Ext.ComponentQuery.query('price gridpicker[name=price]')[0].store.getAt(0).data.id;

But this output only ID from first record in store, and when select other record I will still get  ID from first record, help me thanks

A: The correct call is:
...getAt(0).get('id);

or, if you want all record's data then
...getAt(0).getData();

Of course, you can get also other values but you need to know which record is selected by the gridpicker.

A: If you want to get the selected record then you need to query the grid, not the store.  The store just contains the data, it doesn't know what's going on on the screen.
Ext.ComponentQuery.query('price gridpicker[name=price]')[0].getGrid().getSelectionModel().getSelection()[0].get('id');


text:
Q: What happens when a function's __qualname__ is changed in python? In order to be able to pickle a nested function (for multiprocessing), I decorated the nested function with the decorator:
def globalize_one(func):
    def wrapper_one(*args,**kwargs):
        return func(*args,**kwargs)
    setattr(modules['__main__'],'sdfsdf',wrapper_one)
    return wrapper_one

However, this decorator does not work, when I ran this
def test_one():
    @globalize_one
    def inside_one():
        return 1

    try:
        pickle.dumps(inside_one)
    except Exception as e:
        print(e)

test_one()

I received the exception Can't pickle local object 'globalize_one.<locals>.wrapper_one'
To make the decorator work, all I need is to change the __qualname__ of wrapper_one to sdfsdf in globalize_one right before the line setattr(modules['__main__'],'sdfsdf',wrapper_one).
def globalize_two(func):
    def wrapper_two(*args,**kwargs):
        return func(*args,**kwargs)

    # the single extra line as compared to globalize_one
    wrapper_two.__qualname__ = 'sdfsdf'

    setattr(modules['__main__'],'sdfsdf',wrapper_two)
    return wrapper_two

def test_two():
    @globalize_two
    def inside_two():
        return 1

    try:
        pickle.dumps(inside_two)
    except Exception as e:
        print(e)

As you can see by running the code, the nested function inside_two can be pickled now.
My confusion is, why by changing the __qualname__, the decorator will work properly? I thought changing the name of a function have no real effect.


text:
Q: Error in SOAP-UI while loading the wsdl hosted in localhost I am getting the following error while loading a localhost wsdl. If I try other wsdls which are not hosted locally it works fine. Please help.
Error loading [http://localhost:7001/xyz?wsdl]: java.lang.Exception: Failed to load url; http://localhost:7001/xyz?wsdl, 0

Errors from the log
ERROR:com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException
   com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException
    at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.makeInvalidDefinitionException(WsdlLoader.java:119)
    at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:112)
    at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:488)
    at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:477)
    at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:94)
    at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:209)
    at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
    at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:131)
    at java.lang.Thread.run(Unknown Source)

I have gone through this link and it did not solve the problem.
soapUI failed to load url error when loading wsdl

A: Based on the errors you're getting, here is a list of possible solutions that come to mind:

*

*Check the URL of the WSDL in a browser. Does it open? If not, your server is not started and the WSDL contract is unreachable.

*Make sure you are not using a proxy and you don't have some proxy option set in the SOAP UI preferences

*There might be a problem with the validity of your WSDL, but it is impossible to tell without inspecting it.

Hope this helps!

A: In may case the problem was I was trying to load the .xsd instead the .wsdl
-as both are very similar when open in browser.. is easy to make the mistake.

A: Added the following parameters to the .vmoptions file, and restarted SoapU helped resolve this for me.
-Dsoapui.https.protocols=TLSv1.2
-Djsse.enableSNIExtension=false
-Djava.net.preferIPv4Stack=true


text:
Q: Multiple cookies with same name after changing the sameSite setting Context:
In our Node.js & express based app I updated the cookie settings from
res.cookie(newCookieName, sessionCookie, {
    domain: getCookiesDomain(),
    maxAge: ms('30 days'),
    secure: true,
    httpOnly: true
});

To this slightly different options by adding explicitly sameSite property:
res.cookie(newCookieName, sessionCookie, {
    domain: getCookiesDomain(),
    maxAge: ms('30 days'),
    secure: true,
    httpOnly: true,
    sameSite: 'lax'
});

And as result, I see 2 values of cookies stored at browser, probably due different sameSite values ("default" and explicitly set lax value).
Browser: Chrome 102, OS: Windows 11.
Who else experienced this double-cookies at case of updated cookie settings?
Update
Possible cause is that at least Chrome (or may be other browsers as well?) threat different configuration of these flags and options like HttpOnly, Secure or SameSite as part of cookie full identity, among with origin and name of cookie.
It is possible to mitigate this problem by these tactics:

*

*if you use some different format in new version of cookie, like s:value.signature in old cookie and prefix.JWT_base64url you will have to scan all arriving cookie values by parsing manually arriving Cookie header to be able detect this case. Standard Express cookie parsing code for express-session useless in this tricky scenario.

*The second part is to clear manually cookies with deprecated/legacy options like Secure, HttpOnly and absent or different SameSite values. So if you did not specify SameSite, than later used Lax value and finally settled on Strict value, you will have 3 separate cookies, so you will need 2 cookie cleanup commands (2 additional set-cookie headers) set with response to clear these old versions of cookies.

Of course you can add custom properties to Request in express to mark request with flags mentioning whether such extra headers should be sent with response for request where multi-cookie issue was detected to send extra cleanup set-cookie headers with empty value and negative maxAge in res.cookie cleanup call only when such custom flags present on request, if you use this tweak.
Note that standard res.clearCookie provided by Express unaware of this issue and you can not provide the related options there, as I know.


text:
Q: server not working smoothly Hi I am getting this error message in log.
Please suggest something to fix this issue
Sep 6 06:19:17 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:17 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:17 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:17 sa1 kernel:
Sep 6 06:19:17 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:19 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:19 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:19 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:19 sa1 kernel:
Sep 6 06:19:19 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:21 sa1 Adaptec Storage Manager Agent: [418] Bad Block discovered: controller 1 (1a5f5dec).
Sep 6 06:19:21 sa1 last message repeated 2 times
Sep 6 06:19:21 sa1 xinetd[6613]: START: smtp pid=4075 from=127.0.0.1
Sep 6 06:19:21 sa1 xinetd[6613]: START: smtp pid=4076 from=127.0.0.1
Sep 6 06:19:21 sa1 xinetd[6613]: EXIT: smtp status=1 pid=4075 duration=0(sec)
Sep 6 06:19:21 sa1 xinetd[6613]: EXIT: smtp status=1 pid=4076 duration=0(sec)
Sep 6 06:19:21 sa1 xinetd[6613]: START: smtp pid=4095 from=127.0.0.1
Sep 6 06:19:21 sa1 xinetd[6613]: EXIT: smtp status=1 pid=4095 duration=0(sec)
Sep 6 06:19:27 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:27 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:27 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:27 sa1 kernel:
Sep 6 06:19:27 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:29 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:29 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:29 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:29 sa1 kernel:
Sep 6 06:19:29 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:31 sa1 Adaptec Storage Manager Agent: [418] Bad Block discovered: controller 1 (1a5f5dec).
Sep 6 06:19:31 sa1 Adaptec Storage Manager Agent: [418] Bad Block discovered: controller 1 (1a5f5dec).
Sep 6 06:19:31 sa1 xinetd[6613]: START: smtp pid=4836 from=127.0.0.1
Sep 6 06:19:31 sa1 xinetd[6613]: START: smtp pid=4838 from=127.0.0.1
Sep 6 06:19:32 sa1 xinetd[6613]: EXIT: smtp status=1 pid=4836 duration=1(sec)
Sep 6 06:19:32 sa1 xinetd[6613]: EXIT: smtp status=1 pid=4838 duration=1(sec)
Sep 6 06:19:45 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:45 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:45 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:45 sa1 kernel:
Sep 6 06:19:45 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:45 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002
Sep 6 06:19:45 sa1 kernel: sda: Current: sense key: Hardware Error
Sep 6 06:19:45 sa1 kernel: Add. Sense: Internal target failure
Sep 6 06:19:45 sa1 kernel:
Sep 6 06:19:45 sa1 kernel: end_request: I/O error, dev sda, sector 442457580
Sep 6 06:19:47 sa1 kernel: sd 0:0:0:0: SCSI error: return code = 0x08000002

A: Your hard drive has failed. Replace it.

A: Your /dev/sda has gone... replace it as soon as possibile.


text:
Q: Responsive Img within Jquery slider I have a problem with my images in a jquery slider. The slider is working, but there are a couple of problems. I can have the images responsive, but when I remove the height property, the content below shoots up into the slider. So I then add a height value, but the images become distorted when re-sizing the window. I was wondering if you can see where I am going wrong.
HTML

CSS
 .indexImg {
height: 45rem;
width: 100%;
}

 #indexSlider div {
position:absolute;
z-index: 0;
}

 #indexSlider div.previous {
z-index: 1;
}

 #indexSlider div.current {
z-index: 2;
}

JQUERY
 $(function() {
        // create the image rotator
        setInterval("rotateImages()", 2000);
    });

    function rotateImages() {
        var oCurPhoto = $('#indexSlider div.current');
        var oNxtPhoto = oCurPhoto.next();
        if (oNxtPhoto.length == 0)
            oNxtPhoto = $('#indexSlider div:first');

        oCurPhoto.removeClass('current').addClass('previous');
        oNxtPhoto.css({ opacity: 0.0 }).addClass('current')
                .animate({ opacity: 1.0 }, 700,
                            function() {
                                oCurPhoto.removeClass('previous');
                            });
    }

A: Instead of using img tag you can add image as a background to the div

And on the css
.indexImg {
  height: 45rem;
  width: 100%;
  background-repeat:none;
  background-size:cover;
  background-position:center;
}


text:
Q: Persisting object to database error I have this error:
Expected argument of type "integer or null", "App\Entity\User" given

which I don't understand, well I understand the error, but I'm not sure why it's arising.
Here's my AddController.php file:
<?php
    namespace App\Controller\Tag;

    use App\Entity\Tag;
    use App\Form\Tag\AddType;
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Symfony\Component\Config\Definition\Exception\Exception;
    use Symfony\Component\HttpFoundation\Request;

    class AddController extends Controller
    {
        public function add(Request $request)
        {
            $tag  = new Tag();
            $form = $this->createForm(AddType::class, $tag);

            $form->handleRequest($request);

            if ($form->isSubmitted() && $form->isValid()) {
                $entityManager = $this->getDoctrine()->getManager();

                $pageInfo = $form->getData();

                $description = $pageInfo['description'];
                $name        = $pageInfo['name'];
                $guru        = $pageInfo['guru_id'];
                $createdTs   = new \DateTime();

                $tag->setApproved(false);
                $tag->setDescription($description);
                $tag->setName($name);
                $tag->setGuruId((is_int($guru) ? $guru : null));
                $tag->setCreatedTs($createdTs);

                try {
                    $entityManager->persist($tag);
                    $entityManager->flush();

                    $this->addFlash('success', 'Tag Submitted for review! '. $guru);
                } catch (Exception $e) {
                    $this->addFlash('danger', 'Something went skew-if. Please try again.');
                }

                return $this->redirectToRoute('tag_add');
            }

            return $this->render('tag/add.html.twig', array('form' => $form->createView()));
        }
    }

the initial load works, but submitting the form generates the above error. But I'm not sure why. Even if I reorder my lines like this:
$tag  = new Tag();
$tag->setGuruId(null);

my Tag entity:
<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass="App\Repository\TagRepository")
 */
class Tag
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=125)
     */
    private $name;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $description;

    /**
     * @ORM\Column(type="boolean")
     */
    private $approved;

    /**
     * @ORM\Column(type="datetime")
     */
    private $created_ts;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $last_edit_ts;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $guru_id;

    public function getId()
    {
        return $this->id;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getDescription(): ?string
    {
        return $this->description;
    }

    public function setDescription(?string $description): self
    {
        $this->description = $description;

        return $this;
    }

    public function getApproved(): ?bool
    {
        return $this->approved;
    }

    public function setApproved(bool $approved): self
    {
        $this->approved = $approved;

        return $this;
    }

    public function getCreatedTs(): ?\DateTimeInterface
    {
        return $this->created_ts;
    }

    public function setCreatedTs(\DateTimeInterface $created_ts): self
    {
        $this->created_ts = $created_ts;

        return $this;
    }

    public function getLastEditTs(): ?\DateTimeInterface
    {
        return $this->last_edit_ts;
    }

    public function setLastEditTs(\DateTimeInterface $last_edit_ts): self
    {
        $this->last_edit_ts = $last_edit_ts;

        return $this;
    }

    public function getGuruId(): ?int
    {
        return $this->guru_id;
    }

    public function setGuruId(?int $guru_id): self
    {
        $this->guru_id = $guru_id;

        return $this;
    }
}

my AddType

use App\Entity\Tag;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class AddType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', TextType::class)
            ->add('description', TextareaType::class)
            ->add('guru_id', EntityType::class, array(
                'class' => User::class,
                'choice_label' => 'username'
            ));
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => Tag::class
        ));
    }
}

it still gives the same error so I'm really not sure how it's being generated... how can I persist an integer (got from EntityType dropdown) to database?
Thanks

A: Probably you have an EntityType field within AddType form to handle the guru_id property and it is mapping the submitted value (instance of User) automatically with setGuruId(?int $guru_id) method. That's why that:
Expected argument of type "integer or null", "App\Entity\User" given

You've some options to fix that, but likely the best one is to change the guru_id mapping to ManyToOne relationship with User:
// Tag entity

/**
 * @ORM\ManyToOne(targetEntity="App\Entity\User")
 */
private $guru;

public function getGuru(): ?User
{
    return $this->guru;
}

public function setGuru(?User $guru): self
{
    $this->guru = $guru;

    return $this;
}

Also, I'd remove this code:
$tag->setDescription($description);
$tag->setName($name);
$tag->setGuruId((is_int($guru) ? $guru : null));

as this procedure is already done by Form component after submit the data.

As a quick workaround you can fix this removing the typehint:
public function setGuruId($guru_id): self
{
    $this->guru_id = $guru_id instanceof User ? $guru_id->getId() : $guru_id;

    return $this;
}


text:
Q: Null space -Differentiation of the equation A $3$ dimensional vector $v=[w_x,w_y,w_z]$, The product of the vector's null space and the vector itself is given as $J(v^T)*v=0...(1)$ , where $J(v)=\text{null}(v^T)$ and assumed as orthonormal. Now, the vector can be written as $v=\text{inverse}(J(v^T))$
I would like to know the value of $d(v)/dt$.
Whether $d(v)/dt=\text{inverse}(\text{null}((d(v)/dt)^T))$


text:
Q: combinining multiple summarize calls dplyr Given the df
ww <- data.frame(
    GM = c("A", "A", "A", "A", "A", "A",
            "B", "B", "B", "B", "B", "B",
            "C", "C", "C", "C", "C", "C"),
    stanza = rep(c("Past", "Mid", "End"), 6),
    change = c(1, 1.1, 1.4, 1, 1.3, 1.5, 1, 1.2, 1.4,
               1.1, 1.2, 1.3, .9, 1.2, 1.3, .9, 1.3, 1.5))

I would like to calculate the mean for Past for each GM and the divide each value in 'change' by the GM specific mean. I can do this with two dplyr calls and a join function as follows:
past <- ww %>%
    group_by(GM) %>%
    filter(stanza == "Past") %>%
    summarize(past.mean = mean(change))

ww <- left_join(ww, past, by = "GM")

ww %>%
    group_by(GM, stanza) %>%
    summarize(pr.change = change/past.mean)

But there must be a way to do this in one dplyr call.

A: No need to join, you can compute this directly in one pipe chain:
ww %>%
  group_by(GM) %>%
  mutate(pr.change = change / mean(change[stanza == "Past"])) %>%
  ungroup()

Output
   GM    stanza change pr.change
   <chr> <chr>   <dbl>     <dbl>
 1 A     Past      1       1
 2 A     Mid       1.1     1.1
 3 A     End       1.4     1.4
 4 A     Past      1       1
 5 A     Mid       1.3     1.3
 6 A     End       1.5     1.5
 7 B     Past      1       0.952
 8 B     Mid       1.2     1.14
 9 B     End       1.4     1.33
10 B     Past      1.1     1.05
11 B     Mid       1.2     1.14
12 B     End       1.3     1.24
13 C     Past      0.9     1
14 C     Mid       1.2     1.33
15 C     End       1.3     1.44
16 C     Past      0.9     1
17 C     Mid       1.3     1.44
18 C     End       1.5     1.67

A: Using base R
transform(ww, pr.change = change/ave(replace(change,
    stanza != 'Past', NA), GM, FUN = function(x) mean(x, na.rm = TRUE)))

-output
 GM stanza change pr.change
1   A   Past    1.0  1.000000
2   A    Mid    1.1  1.100000
3   A    End    1.4  1.400000
4   A   Past    1.0  1.000000
5   A    Mid    1.3  1.300000
6   A    End    1.5  1.500000
7   B   Past    1.0  0.952381
8   B    Mid    1.2  1.142857
9   B    End    1.4  1.333333
10  B   Past    1.1  1.047619
11  B    Mid    1.2  1.142857
12  B    End    1.3  1.238095
13  C   Past    0.9  1.000000
14  C    Mid    1.2  1.333333
15  C    End    1.3  1.444444
16  C   Past    0.9  1.000000
17  C    Mid    1.3  1.444444
18  C    End    1.5  1.666667

A: A data.table solution:
library(data.table)
setDT(ww)
ww[, pr.change := change / mean(change[stanza == "Past"]), GM]

    GM stanza change pr.change
 1:  A   Past    1.0  1.000000
 2:  A    Mid    1.1  1.100000
 3:  A    End    1.4  1.400000
 4:  A   Past    1.0  1.000000
 5:  A    Mid    1.3  1.300000
 6:  A    End    1.5  1.500000
 7:  B   Past    1.0  0.952381
 8:  B    Mid    1.2  1.142857
 9:  B    End    1.4  1.333333
10:  B   Past    1.1  1.047619
11:  B    Mid    1.2  1.142857
12:  B    End    1.3  1.238095
13:  C   Past    0.9  1.000000
14:  C    Mid    1.2  1.333333
15:  C    End    1.3  1.444444
16:  C   Past    0.9  1.000000
17:  C    Mid    1.3  1.444444
18:  C    End    1.5  1.666667


text:
Q: In SpringBoot web service endpoint, how do I access http headers? I have a class annotated with @Endpoint and a handler method
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getWeatherRequest")
@SoapAction("http://foo/domain/getWeatherRequest")
@ResponsePayload
public GetWeatherResponse getWeatherRequest(@RequestPayload GetWeatherRequest request) {
    // I want to get HTTP header (Not SOAP Header) here
}

A: Try using the @RequestHeader annotation
@SoapAction("http://foo/domain/getWeatherRequest")
@ResponsePayload
public GetWeatherResponse getWeatherRequest(@RequestPayload GetWeatherRequest request,
@RequestHeader("header-name") String header) {

}

A: You can use RequestHeader annotation in your method to access http headers, you can specify whether header is mandatory or optional using required attribute
@RequestHeader(value = "ConfigId", required = true) String configId


text:
Q: R: Remove "." and 0 in year column in a data frame I have a quite basic question, but I am not sure how to handle it in a smart way.
I have a column with quarterly year dates of the form yyyy.0q (y for year and q for quarter).
Example: 1990.01, 1990.02, 1990.03,...
I want to change the format to: 19901,19902,19903,... So, basically to remove the "." and the foregoing "0". The column is numeric.
Is there a fast and convenient way to solve this problem?

A: library(tidyverse)

dat <- data.frame(x = c("1990.01", "1990.02", "1990.03"))

dat %>%
  mutate(x2 = str_replace(x, "\\.0", ""))

which gives:
        x    x2
1 1990.01 19901
2 1990.02 19902
3 1990.03 19903

A: We can use str_remove
library(dplyr)
library(stringr)
dat %>%
     mutate(x2 = str_remove(x, "\\.0"))

data
dat <- data.frame(x = c("1990.01", "1990.02", "1990.03"))

A: There are already two answers, by deschen and akrun and one in comment (mine). Here is a speed comparison run with package microbenchmark.
First, my solution.
x <- scan(what = character(), text = "1990.01 1990.02 1990.03")
sub("\\..", "", x)
#[1] "19901" "19902" "19903"

Now the test. I will create a bigger vector.
library(microbenchmark)

x2 <- x
for(i in 1:log2(1e4/nchar(x))[1]) x2 <- c(x2, x2)

mb <- microbenchmark(
  base_Rui = sub("\\.0", "", x2),
  stringr_deschen = str_replace(x2, "\\.0", ""),
  stringr_akrun = str_remove(x2, "\\.0")
)
print(mb, order = "median")
#Unit: milliseconds
#            expr      min       lq     mean   median       uq       max neval cld
#        base_Rui 2.060452 2.274474 2.531059 2.310165 2.410621  6.503303   100  a
# stringr_deschen 2.092459 4.181407 4.598719 4.265935 4.390778 11.885202   100   b
#   stringr_akrun 3.754172 4.194410 4.624510 4.283582 4.499489  9.093461   100   b

With small vectors the difference is more impressive, try it on x above.


text:
Q: Html input date when select same date I have question,
If I have a html element like this:
<input type="date" onchange="func(this)" value="2022-05-16">

It works fine, when you select a different date, if I select 2022-05-16, the func() is not calling, I know seems the onchange only trigger when the date is different(onchange), but if I want to trigger when I select 2022-05-16, same as original date, How I can set it up correctly? Here I do not want to change it to 2022-05-15, then change back to 2022-05-16, I want one click only to tigger my func() here.

A: try oninput:
<input type="date" oninput="func(this)" value="2022-05-16">


text:
Q: Select last record for each foreign key that match primary key I am stuck in MySQL query. I have two tables one name is STUDENT and field names is (ID, FullName) where ID is PRIMARY KEY and another table is Student_FEE field is (ID, Student_ID, Date) here Student_ID is foreign key.
When i execute this query i get all the record of but i just want to select only that last row of each Student_ID not all here is image and query.
Remember I Just Need ID 5 and ID 9
SELECT Student_FEE.*
FROM Student_FEE
LEFT JOIN Student
ON Student_FEE.ID=Student.ID

A: Thanks you so much i have found this , thanks stackoverflow. Here is answer
 SELECT Student_FEE.* FROM Student_FEE LEFT JOIN Student
 ON Student_FEE.student_ID = Student.ID
WHERE Student_FEE.ID IN (SELECT MAX(ID)
FROM Student_FEE GROUP BY Student_ID)

A: You should use a group by  adn an in clause
  SELECT Student_FEE.*
  FROM Student_FEE
  LEFT JOIN Student
  ON Student_FEE.student_ID=Student.ID
  where Student_FEE in ( select max(ID)
                         from Student_FEE
                         group by student_ID)


text:
Q: how to make multiple JSON request and combine them I am very new to swift (just spent 1 day on it).
I recently want to convert my jquery web to an ios app.
my project is to get a number of JSON requests and combine them together.
class RemoteAPI{
class func getJSON(completionHandler: NSArray -> ()) {
    let jsonUrl = ["http://a.json","http://b.json","http://c.json","http://d.json"];
    var cjson: [AnyObject] = []

    for var i = 0 ; i < jsonUrl.count ; i++ {
        let session = NSURLSession.sharedSession()
        let r = jsonUrl[i]
        let shotsUrl = NSURL(string: r)

        let task = session.dataTaskWithURL(shotsUrl!) {
            (data, response, error) -> Void in

        do {
            let jsonData = try NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary
            cjson.append(jsonData)
            completionHandler(cjson)
        } catch _ {
        // Error
        }

        }

        task.resume()
    }

}
}

In class Viewcontroller, i put
RemoteAPI.getJSON() { (cjson) in
        print(cjson)
        }

But the output is d.json, d.json, b.json, d.json, b.json, c.json, d.json, b.json, c.json, a.json. Why is it not d,b,c,a.json but repeated? Thank you very much in advance!


text:
Q: Accessing BeagleBone from the Internet(not from browser) I wanted to get a head start on how I can  control my beaglebone Black from the internet preferably I will have android app there on the other part!
I have gone through a lot of tutorials but all they do is access it using the browser and I want to access it through my Android phone's app that may be a TCP/IP app.
So wanted to know whether I should use the Webserver or not if yes which? Tornado, node.js and some headstart on how to do it step by step


text:
Q: Trouble with object recognition in UITapGestureRecognizer I am trying to call the handleTap() function as shown below and let result: AnyObject look for objects in another class that extends to SCNScene
    override func viewDidLoad()
{
    super.viewDidLoad()
 ...
  // add a tap gesture recognizer
    let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
    self.sceneView.addGestureRecognizer(tapGesture)
}
//(HANDLES A TAP BY THE USER)    NOT WORKING
func handleTap(_ gestureRecognize: UIGestureRecognizer)
{
    print("tap")
    //retrieve the SCNView
    let scnView = self.view as! SCNView

    //check what nodes are tapped
    let p = gestureRecognize.location(in: scnView)
    let hitResults = scnView.hitTest(p, options: [:])
    //check that we clicked on at least one object
    if hitResults.count > 0
    {
        //retrieved the first clicked object
        let result: AnyObject = hitResults[0]

        //get its material
        let material = result.node!.geometry!.firstMaterial!

        //highlight it
        SCNTransaction.begin()
        SCNTransaction.animationDuration = 0.2
    }

The function works however it is supposed to highlight a node which is located in another class AppScene that extends to SCNScene
    class AppScene: SCNScene
    {
     //objects are located in here
    }

I am trying to find a way to make the handleTap() function to search for objects that are children of AppScene() as it doesn't work right now.


text:
Q: How to chain Linq methods dynamically in C#? I working with MongoDB driver and I have the following classes:
public class Transactions
{
    public ObjectId Id { get; set; }
    public int UserId { get; set; }
    public int AccountId { get; set; }
    public int SettingId { get; set; }
}
public class Account
{
    public int Id {get; set;}
    public int Name {get; set;}
}
public class User
{
    public int Id {get; set;}
    public int Name {get; set;}
}
public class Setting
{
    public int Id {get; set;}
    public int Name {get; set;}
}

And I want form this, depending of the input of user:
var docs = collection.Aggregate()
                     .Lookup("account", "AccountId", "_id", "asAccounts")
                     .Lookup("user", "UserId", "_id", "asUsers")
                     .Lookup("setting", "SettingId", "_id", "asSettings")
                     .As<BsonDocument>()
                     .ToList();

That is, if the user just wanna the relation with account, form this:
var docs = collection.Aggregate()
                         .Lookup("account", "AccountId", "_id", "asAccounts")
                         .As<BsonDocument>()
                         .ToList();

Or if him wanna the relation with account and user:
var docs = collection.Aggregate()
                         .Lookup("user", "UserId", "_id", "asUsers")
                         .Lookup("setting", "SettingId", "_id", "asSettings")
                         .As<BsonDocument>()
                         .ToList();

It I trying to do is form the query depending the needs of user. Just wanna know how to chain the methods in runtime.

A: You can create your dynamic chain using some conditional tests to prepare the query:
var docs = collection.Aggregate();

if ( WantRelationWithAccount )
  docs = docs.Lookup("account", "AccountId", "_id", "asAccounts")

if ( WantRelationWithUser )
  docs = docs.Lookup("user", "UserId", "_id", "asUsers")

if ( WantSettings )
  docs = docs.Lookup("setting", "SettingId", "_id", "asSettings")

var result = docs.As<BsonDocument>().ToList();

But remember that order of operations in the chain is as added.
Linq queries are deferred executed, that means they are only executed when used like with a loop or a any method that causes the execution like ToList.
There is a linq ToLookup method but not Lookup, and it causes the query execution.
Does ToLookup forces immediate execution of a sequence
Perhaps you use extension methods provided by a special framework.
In anyway, staging execution does not prevent you from create the chain as exposed previously.


text:
Q: How can I bundle a person's info in a macro with genealogytree I would like to wrap each person's name and other information in a macro, and then use that macro in a genealogytree. This is to reduce clutter in the tree itself so as to make it easier to read and edit. But none of my attempts work.
MWE:
\documentclass[varwidth,margin=10pt]{standalone}
\usepackage[all]{genealogytree}

\gtrset{mytree/.style={
    template=database traditional,
    database format=medium no marriage,
  }
}

\newcommand\nSon{name=Son, comment=Prince of the Valley}    % this does not work
%\newcommand\nSon{{name=Son, comment=Prince of the Valley}} % also does not work
%\edef\nSon{name=Son, comment=Prince of the Valley}         % also does not work
%\edef\nSon{{name=Son, comment=Prince of the Valley}}       % also does not work

\begin{document}
\begin{tikzpicture}
  \genealogytree[mytree]{
    parent{
      %g{name=Son, comment=Prince of the Valley} % this works
      g{\nSon}                                   % this does not work
      p{name=Father, comment=King of the Hill}
    }
  }
\end{tikzpicture}
\end{document}

A: Approach 1:
Unless the package provides a way to pre-expand \nSon, you have to do it manually, with a bunch of \expandafters.
\documentclass[varwidth,margin=10pt]{standalone}
\usepackage[all]{genealogytree}

\gtrset{mytree/.style={
    template=database traditional,
    database format=medium no marriage,
  }
}

\newcommand\nSon{name=Son, comment=Prince of the Valley}
\begin{document}
\begin{tikzpicture}
\def\tmpA{\genealogytree[mytree]}
\def\tmpB{parent}
\expandafter\expandafter\expandafter\tmpA
\expandafter\expandafter\expandafter{%
\expandafter\tmpB
\expandafter{%
\expandafter g%
\expandafter{%
\nSon}       %
      p{name=Father, comment=King of the Hill}
    }
  }
\end{tikzpicture}
\end{document}

Approach 2:
Use \expanded, shown here with several macro insertions:
\documentclass[varwidth,margin=10pt]{standalone}
\usepackage[all]{genealogytree}

\gtrset{mytree/.style={
    template=database traditional,
    database format=medium no marriage,
  }
}

\newcommand\nSon{name=Son, comment=Prince of the Valley}
\newcommand\nPar{name=Father, comment=King of the Hill}
\begin{document}
\begin{tikzpicture}
\def\tmpA{\genealogytree[mytree]}
\expandafter\tmpA\expandafter{\expanded{%
  parent{%
     g{\nSon}
     p{\nPar}
    }
  }}
\end{tikzpicture}
\end{document}


text:
Q: sed pattern replace with new line I'm trying to replace with insert in all files in the directory with the following command:
find . -type f -exec sed -i.bak ':begin;$!N;s/\(@Autowired\)\n\(public .*\)\((ServletRequest\)/\2() \{\}\n&/;tbegin' {} \;

Here is what I'm trying to do:
Match:
@Autowired
public something(ServletRequest

Replace With:
public something() {}
@Autowired
public something(ServletRequest

I am basically trying to add a default constructor to all my java classes in a certain directory/package.  I can't seem to match the newline

A: This seems to work:
sed '/@Autowired/{:l
    N;s/\(.*public[ ]*\)\([^(]*\)\((ServletRequest\)/public \2() {}\n\1\3/;
    /ServletRequest/!bl}' input

and if you have the ServletRequest bit always following the @autowired:
sed '/@Autowired/{
   N;s/\(.*public[ ]*\)\([^(]*\)\((ServletRequest\)/public \2() { }\n\1\3/}'
  input


text:
Q: The value is not retained with Page.ClientScript.RegisterHiddenField in asp.net In Asp.net c#, with this syntax:
 Page.ClientScript.RegisterHiddenField("hfFileName", Value);

I can define a Hiddenfield:
1) Why in this code , the value is nothing:
function pageLoad() {
alert(document.getElementById("hfFileName").getAttribute("value"));
}

2) Whats the difference between this hiddenField and this one which I can define from Asp.net toolbox:
<asp:HiddenField ID="HiddenField1" runat="server" />

Thank you in advanced.

It was working before, I changed some code in Update panels and now
  its not working, is it possible of that?

A: Try the following:
on Code Behind:
protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterHiddenField("hfFileName", "testvalue");
        }

on Jquery:
 $(document).ready(function () {
            alert(document.getElementById("hfFileName").getAttribute("value"));
        })

This is working for me.


text:
Q: Class inheriting Builder Pattern class with private constructor Okay, so I have a parent class with Builder Pattern and private constructor:
    public class ExternalResult implements ExternalEntity {

    private String mConnectionStatus;

    private ResultSet mResultSet;

    /**
     * Creates a new instance for result .
     *
     * @return new instance of {@link ExternalResult}
     */
    public static ExternalResult.Builder builder() {
        return new ExternalResult.Builder();
    }

    /**
     * Constructor.
     *
     * @param builder
     */
    private ExternalResult(ExternalResult.Builder builder) {
        this.mConnectionStatus = builder.mConnectionStatus;
        this.mResultSet = builder.mResultSet;
    }

    /**
     * Builder class
     */
    public static final class Builder {
        /** Connection status. */
        private String mConnectionStatus;

        /** Result set. */
        private ResultSet mResultSet;

        /**
         * Prevents creation of Builder.
         */
        private Builder() {
        }

        /**
         * Sets connection status.
         *
         * @param connectionStatus connection status.
         * @return
         */
        public ExternalResult.Builder setConnectionStatus(String connectionStatus) {
            this.mConnectionStatus = connectionStatus;
            return this;
        }

       /**
         * Sets the result set.
         *
         * @param resultSet.
         * @return
         */
        public ExternalResult.Builder setResultSet(ResultSet resultSet) {
            this.mResultSet = resultSet;
            return this;
        }

        /**
         * Create a new result object.
         *
         * @return
         */
        public ExternalResult build() {
            return new ExternalResult(this);
        }
    }
}

And I want to make a wrapper of it, but when I try to extend it in the subclass, it throws

Implicit super constructor ExternalListRemoteFolderResult() is
undefined. Must explicitly invoke another constructor

But my constructor here is private and I can't invoke it. So should I try to extend it and how?


text:
Q: Problems using Prolog[] with the LevelScheme library I am trying to use Prolog[] in ListLinePlot[] with the LevelScheme library. Here is a sample of what I am trying to do.
Figure[
 {
  Multipanel[
   {2, 1},
   XPlotRanges -> {0, 10},
   YPlotRanges -> {{-1, 1}, {-1, 1}},
   Margin -> 40,
   XFrameTicks -> LinTicks[0, 10, 1, 1],
   ExtendRange -> 0.03,
   XFrameLabels -> "Time (sec)", BufferB -> 3.5,
   YFrameLabels -> {"Out 1", "Out 2"}, BufferL -> 4.5,
   PanelLetterCorner -> {-1, -1},
   YGapSizes -> {0.1},
   Background -> White
   ],

  SetOptions[DataSymbol, SymbolSize -> 0.1],

  FigurePanel[{1, 1}],
  RawGraphics[
   ListLinePlot[Transpose[{Range[0, 10, 0.1],
      RandomReal[{-1, 1}, 101]}], PlotRange -> All]],
  FigurePanel[{2, 1}],
  RawGraphics[
   ListLinePlot[Transpose[{Range[0, 10, 0.1],
      RandomReal[{-1, 1}, 101]}],
    PlotStyle -> {Black, Thick},
    Prolog -> {Opacity[0.1], Red, Rectangle[{0, -1}, {2.5, 1}], Green,
       Rectangle[{2.5, -1}, {7.5, 1}], Red,
      Rectangle[{7.5, -1}, {10, 1}]}]]
  },
 ImageSize -> {600, 350}
 ]

And here is the output if get,

I can't figure out how to get the shadings I want - shading I have provided in the Prolog.
It would be helpful if someone can tell me what is the problem in the code, and how I can fix it.


text:
Q: Issue with my XML file in Java Apache Tomcat v7.0 Hey guys so I am trying to get my form sent to a class file within src/'where the packages are located'.  I'm getting issues because if I am on the form page which is contained in a WebContent folder the url is...http://localhost:8080/Final_Project/Band_roster.jsp Once I hit submit it gets sent to the class file and sends it to this url. http://localhost:8080/bandser This url just does not look right?  So once it is sent here I get a 404 error.  I am using a xml file to transfer over.
XML CODE:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
  <servlet-name>BandListServ</servlet-name>
  <servlet-class>bandServ.BandListServ</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>BandListServ</servlet-name>
  <url-pattern>/bandser</url-pattern>
</servlet-mapping>

    <error-page>
        <error-code>404</error-code>
        <location>/error_404.jsp</location>
    </error-page>
    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/error_java.jsp</location>
    </error-page>

    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>BandForm.jsp</welcome-file>
    </welcome-file-list>
</web-app>

Here is the class file url in which it tells me once I hit properties \workspace\finalprojectfor_client\src\BandListServ.java.
So If you need more info let me know, I really appreciate the help!
EDIT:
also in the XML file I am getting an error saying - Referenced file contains errors (http://java.sun.com/xml/ns/javaee/javaee_5.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."

A: I had this problem, I replaced javaee by j2ee and it worked.


text:
Q: Why is IntelliJ IDEA hanging on "Indexing"? I'm running on Arch Linux, on an i7-5930k 6 core CPU and 64GB of DDR4 RAM, and I'm using IntelliJ IDEA 14.
IDEA was working just fine for me several days ago, but one day, suddenly, it began hanging after opening a project, during the "Indexing" stage. I did not update IDEA and nothing changed about my projects. The IDE's UI hangs after it opens the project, with just a tiny little sliver of the progress bar for "Indexing" complete. Every 5-10 minutes or so it unfreezes and the progress bar crawls forward a little bit, before the IDE freezes again for another few minutes. This happens repeatedly for anywhere between 15 minutes and an hour, until it is finally finished indexing, at which point it hangs for another 5-10 minutes doing nothing, before it finally unlocks and allows me to develop.
While this is happening, my system is fairly unresponsive - Firefox tabs take a long time to switch, and scrolling in them is laggy. Opening a new terminal window takes a long time. Switching windows in general takes awhile. In htop, one of my CPU cores is loaded at 100% while the rest have a normal load, and about 6GB of RAM is used (fairly normal load when this system is idle.)
Things I have tried that have not helped:

*

*Delete caches folder

*Delete entire ~/.IntelliJIDEA14 folder

*Reinstall IntelliJ package

*Download IntelliJ manually from JetBrains' site and run it from my Downloads folder (to see if there was something wrong with the Arch AUR package)

*Configure IntelliJ to use my system JVM and Maven for importing instead of its embedded tools

*Opening multiple different projects (not just the one I initially experienced the issue on.)

This issue is really hurting my workflow, if anybody has any solution to this I would be very greatful.

A: I was stuck with a similar issue with the latest IntelliJ Idea 2019.3, so maybe it'll help. For me the issue was with one of the plugins, uninstalling/reinstalling, cleaning caches didn't help. My steps were:

*

*Kill intellij, start it over

*When it's starting and about to load a project, be quick and cancel opening the project. This way you'll end up with a small window with a list of previously opened projects and a few menu items.

*Open menu > plugins, disable them all

*Restart intellij idea, open any project.

If step 4 above succeeds (which happened to me), one by one try enabling the plugins to see which one is causing error. For me it was Kubernetes plugin from JetBrains.

A: Try Invalidating the cache and restarting IntelliJ.
In the File menu, select Invalidate Caches / Restart... and then click the Invalidate and Restart button.

A: Select Help -> Debug Log Settings...
Add the following line (note the leading # symbol)

#com.intellij.util.indexing:trace

Relaunch the IDE (don't need to invalidate cache as that will cause it to start from scratch, whereas restarting from the point of failure, for me anyway, reported the problem file as soon as I restarted):

Scheduling indexing of file://C:/dev/tools/ruby/lib/ruby/2.2.0/x64-mingw32/win32ole.so by request of index Stubs

Our project doesn't use win32ole so I moved the file to a safe location and restarted my IDE... Bingo, problem gone, indexing finally completed after almost 1 year of effectively using intellij as a slightly-smarter-than-notepad ruby editor.

A: In my case I found out that Intellij is actually trying to index a 50GB directory with logs that was under the project's root. Make sure that if you have such a directory, it is marked as "Excluded" in the IDE.
You can see which file the IDE is indexing currently in the Indexing Status window (access by clicking on the indexing message in the toolbar). You may need to enlarge this window to see the full path of the file currently being indexed.

A: In PhpStorm, what solved this for me was excluding folders I didn't need to be indexed from the indexing (specifically the vendor folder, a caches folder, and a few asset folders that contained thousands of images). Instantly it began making progress and completed.
To do this:

*

*in the project directory list, right click the folder you want to exclude

*Mark Directory As

*Excluded

A: seems that there might be several reasons for getting into this "indexing" hell. I spent few hours trying to fix it using the ideas above.
At the end of the day, with some profiling work, I found that the bad guy in my case was the csv plugin:
https://plugins.jetbrains.com/plugin/10037-csv-plugin
I had few (not so large) CSV files serving as input, and although I marked them as not to be indexed, the plugin kept trying to index them.
Once I removed the plugin everything worked fine.

A: Disabling unused plugins will improve the indexing. In my case I have disabled Kotlin plugin from File -> Settings->Plugins
if you check the intellij logs (can be found under C:\Users<User Name>.IntelliJIdea2019.1\system\log ) you will get a pointer what is failing. I was getting an error in Kotlin. After disabling the plugin and restarting Intellij fixed my issue
java.lang.RuntimeException: java.io.EOFException
at com.intellij.util.ExceptionUtilRt.rethrow(ExceptionUtilRt.java:31)
at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:120)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.handleError(FSRecords.java:516)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.access$000(FSRecords.java:153)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.writeAndHandleErrors(FSRecords.java:965)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.access$300(FSRecords.java:47)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$AttributeOutputStream.close(FSRecords.java:1629)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:53)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.write(FileAttributeServiceImpl.kt:64)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.writeBooleanAttribute(FileAttributeServiceImpl.kt:48)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClass(IDEKotlinBinaryClassCache.kt:67)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClassHeaderData(IDEKotlinBinaryClassCache.kt:8

A: I've finally figured it out. The solution was... Rather odd. TL;DR: Run it under strace. Read on for a more detailed explanation.
I came upon it when I decided to run IntelliJ under strace to see what files it was opening to determine whether or not it was a filesystem bottleneck.
This gave me some very strange results: strace was spewing out a near-constant stream of segfaults. Not only that, but IntelliJ was running just fine, not taking forever to index.
After consulting with a friend, I learned that on Arch Linux, systemd logs a dump of a process's memory every time a segfault occurs, except when a debugger is attached. strace is considered a debugger. Arch was thrashing my disks when it kept logging memory dumps due to all the segfaults, hence why the indexing was taking so long, because it was fighting for disk I/O.
My solution for now is to simply run IntelliJ under strace. I will, however, be looking into the issue further, as I don't think java should be segfaulting that much.

A: edit Intellij[VERSION]/bin/idea.properties,
set idea.max.intellisense.filesize=50
update:
Intellij will skip index files that size larger than 50kb.try this if you have many libraries or many large files(too many characters one line or too many lines)

A: I had a similar problem with 2019.1.4. However, mine would change directories and sometimes, eventually, finish. If it did finish, it was somewhere in the 8-10 minute range.
I was all over SO, and even JetBrains' forums. I excluded directories via Project Structure | Modules. I used Invalidate Caches And Restart on multiple occasions. I tried having only 1 project open to let it finish. I installed and tried 2019.2.4 and 2019.3.3 (the latter would crash for other reasons). And best of all, it only seemed to happen on one project!
What ultimately led me to an answer was Help > Activity Monitor... where I found  psi.impl.cache.impl.todo was running at nearly 100% CPU and not showing signs of stopping.
It turned out, I had a TODO filter setup with a poorly-defined RegEx. It was something like \b.*wip\b.*; the idea was to find all of our "WIP" values. Well, the leading .* was a huge mistake and one that didn't occur to me until losing many hours blaming a plugin upgrade. I believe the reason this was a bad filter was because the project it was hanging on is in ExtJS, which is JavaScript, which means things are in triplicate with the app.js file and whatnot...
Update
In IntelliJ 2020.x and 2021.x, the option has moved to Help > Diagnostic Tools > Activity Monitor.

A: I had this issue as well with version 2016.2 on Mac OS X. I had to do a force quit to end the application, then I deleted the .idea folder. The next time I launched IntelliJ everything worked fine, it had no problem indexing the project.

A: Had the same issue in the past on some Scala project. I have installed IDEA 16 EAP (https://confluence.jetbrains.com/display/IDEADEV/IDEA+16+EAP) and the problem has gone.

A: I ran into this problem today on a Mac. It would hang before I was able to get to the menu and invalidate the cache.
I deleted the cache from command line using the following command and it worked for me.
rm -rf ~/Library/Caches/JetBrains/IntelliJIdea*

After that it started up with no issues.

A: I had the same problem with IntelliJ 2017.3.2. When I clicked on the indexing progress bar I noticed it was hung on a directory within my build directory. When I did a gradlew clean which removed that directory then the indexing was able to proceed.

A: I have encountered this problem, and resolved it:

*

*remove idea

*delete all files and dirs which name regex 'jetbrain' and 'IntelliJ' in my computer(Mac mini)

*then install idea

I also try just delete idea cache files, it do not work.

A: There might be another project opened parallelly in new window which is being indexed.

A: I was using the Elm plugin and installed the elm-bounded-nats package which included a semi-large source file. IntelliJ kept hanging on this file, but did not always report this correctly in the indexing popover dialog (perhaps due to threading). When I exluded this specific file in Settings -> File Types ("Nats.elm") indexing managed to complete successfully. Now the editor renders errors for this package but the compilation process still works.

A: Invalidate Cache and Restart did not work for me on IntelliJ 2021.3 Ultimate.
I was curious to see if the new Repair IDE feature on 2021.3 Ultimate version works on this issue on my mac.

*

*On startup, IntelliJ froze on indexing

*

*Force quit and relaunched IntelliJ

*On Startup, manually "paused" the indexing from the status bar at the bottom

*Invalidated cache and restarted

*

*Still froze on indexing

*Forced quit and relaunched IntelliJ

*Repeated Step #2 on startup

*From File Menu, executed Repair IDE, and went through repair steps

*

*FIXED; no longer froze on indexing

*Quit IntelliJ and Relaunch

*

*No Index issues

A: I was also facing freezing issue with intellij 2021.3. Earlier I was using intellij 2021.1 version and that was working fine but since I upgraded intellij version to 2021.3 it started freezing on indexing of files.
Someone in this thread suggested to repair ide using Repair IDE feature. But that didn't worked for me.
So, I went through the thread dumps available in intellij logs folder. After analyzing logs, I found out that calls are blocking on Package Search plugin. So, I disabled that plugin in settings -> plugin. To do that I had to pause indexing at start for time being. After disabling this plugin, it is working fine for me.
This is a known issue and I know disabling it is not a correct fix for it. But I will use it till intellij will release an official fix for this issue.

A: It looks like the problem can come from many different sources as other answers point out.
In my case, it was the Subversion plugin that had difficulties to communicate with the server and make the IDE to hang on indexing.

A: I was able to resolve this problem by removing all of my "target" folders from my project.


text:
Q: Not Creating Tables in Hibernate JPA I am creating Spring (Version 4.0.6) , Hibernate(Version 4.3.6) CRUD application.
I tried giving both <prop key="hibernate.hbm2ddl.auto">create</prop> and <property name="generateDdl" value="true" />. But the tables did not get created.
    All entities has @Entity and @Table(name) annotation from javax.persistence.
Here comes my applicationContext.xml. http://textuploader.com/5pjw8
Here comes one of my Entity
    http://textuploader.com/5pjyk

*

*Where I have gone wrong and why it is not creating tables for me?

*How do I troubleshoot the issue?

A: You don't seem to have defined a datasource bean, i.e. an actual database to connect to, is this in another file?


text:
Q: Error creating JSON string in github action In one of my steps in a github action, I am trying to create a JSON string that I can use in a later step.
I get an error on the following step,
- name: Generate JSON string
        run: echo "JSON_STRING=$( jq -n \
                --arg image "foo" \
                --arg region "us-west-2" \
                --arg secret "mysecret" \
                --arg env "prod" \
                '{"flask":{"image": $image,"ports":{"5000":"HTTP"},"environment":{"FLASK_ENV":$env,"AWS_SECRET_NAME": $secret,"AWS_REGION_NAME": $region}}}' )" >> $GITHUB_ENV

In a terminal shell (ubuntu), I am able to run this command and generate a JSON string.

A: Your step appends JSON_STRING=value to $GITHUB_ENV. This causes the JSON_STRING environment variable to be set in subsequent steps.
Normally GITHUB_ENV contains one VAR=value per line. Though, multiline values can also be added if they're surrounded by delimiters.
So the problem is that jq formats its output on multiple lines by default. A simple fix would be to pass --compact-output / -c to jq so that your JSON string fits on a single line.


text:
Q: Convert folders structure to partitions on S3 using Spark I have a lot of data on S3 which are in folder instead of partitions. The structure looks like this:
## s3://bucket/countryname/year/weeknumber/a.csv

s3://Countries/Canada/2019/20/part-1.csv
s3://Countries/Canada/2019/20/part-2.csv
s3://Countries/Canada/2019/20/part-3.csv

s3://Countries/Canada/2019/21/part-1.csv
s3://Countries/Canada/2019/21/part-2.csv

Is there any way to convert that data as parititons. Something like this:
s3://Countries/Country=Canada/Year=2019/Week=20/part-1.csv
s3://Countries/Country=Canada/Year=2019/Week=20/part-2.csv
s3://Countries/Country=Canada/Year=2019/Week=20/part-3.csv

s3://Countries/Country=Canada/Year=2019/Week=21/part-1.csv
s3://Countries/Country=Canada/Year=2019/Week=21/part-2.csv

I have no clue how to do this, instead of having a for loop which iterates over all the folders and load the data, which is complex.
Any help will be appreciated.

A: Hive style paths isn't always necessary for partitioning. I got to this question from another question you wrote in the context of Athena, so I'm going to guess that the underlying metastore is in fact Glue, and that you're really targeting Athena (I added the amazon-athena tag to your question).
In Presto, or Athena/Glue you can add partitions with for any kind of path, as long as the prefixes don't overlap. For example, you to add the partitions in your first example you would do this:
ALTER TABLE table_name ADD IF NOT EXISTS
  PARTITION (country = 'Canada', year_week = '2019-20') LOCATION 's3://Countries/Canada/2019/20/'
  PARTITION (country = 'Canada', year_week = '2019-21') LOCATION 's3://Countries/Canada/2019/21/'

This assumes there is a year_week column, but you could have year and week as separate columns if you want (and do (country = 'Canada', year = '2019', week = '20')), either works.

Why are almost all Athena examples using Hive style paths (e.g. country=Canada/year=2019/week=20/part-1.csv)? Part of it is for historical reasons, IIRC Hive doesn't support any other scheme, partitioning and paths are tightly coupled. Another reason is that the Athena/Presto command MSCK REPAIR TABLE works only with that style of partitioning (but you want to avoid relying on that command anyway). There are also other tools that assume, or work with that style and no other. If you aren't using those, then it doesn't matter.

If you absolutely must use Hive style partitioning, there is a feature that lets you create "symlinks" to files in a separate path structure. You can find instructions on how to do it here: https://stackoverflow.com/a/55069330/1109 – but keep in mind that this means that you'll have to keep that other path structure up to date. If you don't have to use Hive style paths for your partitions, I would advice that you don't bother with the added complexity.


text:
Q: pass ArrayList> in AsyncTask I did a bit of mistakes and I do not know how to get out.
Originally, the code is this and it works:
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();

        XMLParser parser = new XMLParser();
        String xml = parser.getXmlFromUrl(URL); // getting XML
        Document doc = parser.getDomElement(xml); // getting DOM element

        NodeList nl = doc.getElementsByTagName(KEY_ITEM);
        // looping through all item nodes <item>
        for (int i = 0; i < nl.getLength(); i++) {
            // creating new HashMap
            HashMap<String, String> map = new HashMap<String, String>();
            Element e = (Element) nl.item(i);
            // adding each child node to HashMap key => value
            map.put(KEY_ID, parser.getValue(e, KEY_ID));
            map.put(KEY_NAME, parser.getValue(e, KEY_NAME));
            map.put(KEY_COST, parser.getValue(e, KEY_COST));

            // adding HashList to ArrayList
            menuItems.add(map);
        }

        // Adding menuItems to ListView
        ListAdapter adapter = new SimpleAdapter(this, menuItems,
                R.layout.list_item,
                new String[] { KEY_NAME, KEY_COST }, new int[] {
                        R.id.name, R.id.cost });

        setListAdapter(adapter);

    }

Now since I put in another activity, I should be in error.
Studying a bit I saw that you need to utlizare the taskasync but do not know how to end.
And this is the code:
public class TaskAsincrono  extends AsyncTask<ArrayList<String>, Void, ArrayList<String>> {
        @Override
        protected void onPreExecute(){
        }

        @Override
        protected void onProgressUpdate(Void[] values) {

        };

        @Override
        protected ArrayList<String> doInBackground(ArrayList<String>... params) {
            ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();

            XMLParser parser = new XMLParser();
            String xml = parser.getXmlFromUrl(URL); // getting XML
            Document doc = parser.getDomElement(xml); // getting DOM element

            NodeList nl = doc.getElementsByTagName(KEY_ITEM);
            // looping through all item nodes <item>
            for (int i = 0; i < nl.getLength(); i++) {
                // creating new HashMap
                HashMap<String, String> map = new HashMap<String, String>();
                Element e = (Element) nl.item(i);
                // adding each child node to HashMap key => value
                map.put(KEY_ID, parser.getValue(e, KEY_ID));
                map.put(KEY_NAME, parser.getValue(e, KEY_NAME));
                map.put(KEY_COST, parser.getValue(e, KEY_COST));

                // adding HashList to ArrayList
                menuItems.add(map);

            }

            return menuItems;
        }

        @Override
        protected void onPostExecute(ArrayList<String> success) {
            //se l'alert è visibile viene rimosso
            if(dialog.isShowing()) dialog.dismiss();

            ListAdapter adapter = new SimpleAdapter(this, menuItems,
                    R.layout.list_item,
                    new String[] { KEY_NAME, KEY_COST }, new int[] {
                            R.id.name, R.id.cost });

            setListAdapter(adapter);

        }

        @Override
        protected void onCancelled() {
            mAuthTask = null;
        }
    }

How can I do?
thank you very much

A: Just follow the suggestions of Raghunandan.
If your return type is ArrayList < HashMap < String,String > then why you return ArrayList < Sting >.
Change it like:
public class TaskAsincrono  extends AsyncTask<ArrayList<String>, Void, ArrayList<String>>

to
public class TaskAsincrono  extends AsyncTask<String, Void, ArrayList<HashMap<String,String>>>

And Also :
 @Override
 protected ArrayList<String> doInBackground(ArrayList<String>... params)

to
    @Override
    protected ArrayList<HashMap<String,String>> doInBackground(String... params)

I think your in your program the doInBackground() needs the url as its argument, so you may change it from ArrayList < String > to  simple String [] ..
your AsyncTask skeleton is something like:
    public class TaskAsincrono  extends AsyncTask<String, Void, ArrayList<HashMap<String, String>>> {

    @Override,
    protected void onPreExecute(){
       //what you want to do before AsyncTask execution(runs on UI thread)
      ......................
    }

    @Override
    protected void onProgressUpdate(Void[] values) {
       //About updates..........
    };

    @Override
    protected ArrayList<HashMap<String, String>> doInBackground(String... params) {
        ArrayList<HashMap<String, String>> menuItems = new ArrayList<HashMap<String, String>>();

         for (String extraUrl : params) {
           //do all stuffs here
           //like parse xml stuffs
           //put them to hashmap then add the hashmap to arraylist(menuitems)....
           }
           return menuItems;
       }
 }

Now you can fetch the ArrayList from outside of AsyncTask(like button onclick or from onCreate() ) like this.
 TaskAsincrono  task = new TaskAsincrono  ();
    try {
        ArrayList<HashMap<String, String>> arr = new ArrayList<HashMap<String, String>>();
        arr = task.execute(URL).get();

And also follow the Developer Link For AsyncTask to know more about it.
All The Best


text:
Q: web scraping live quotes form website I have been trying to scrape live quotes form this website but am running into an error. The code I used is given below
library(XML)
webpage='http://quotes.freerealtime.com/dl/frt/M?SA=Percent+Gainers&IM=stats&stat=3'

# parse url
url_parsed <- htmlParse(getURL(webpage), asText = TRUE)

# select table nodes of interest
tableNodes <- getNodeSet(url_parsed, '/html/body/table[2]/tbody/tr/td[4]/table[2]/tbody/tr[2]/td/table')

But the tableNodes turns out to be NULL. Can anyone help me figure this out?

A: I think the following link explains your main problem
Why does my XPath query (scraping HTML tables) only work in Firebug, but not the application I'm developing?
So the following does return values
tableNodes <- getNodeSet(url_parsed, '/html/body/table[2]/tr/td[4]/table[2]/tr[2]/td')

but since the actual table is renderd by js, you will not be able to access it.
I would suggest looking at the following :
https://www.datacamp.com/community/tutorials/scraping-javascript-generated-data-with-r

A: The webpage uses AJAX. You may open the webpage in Chrome, then press F12 to open Developer Tools, and go to Network tab. Refresh the webpage, and examine logged XHRs.
The table on the webpage is split in 4 parts, so you can find 4 logged requests containing the necessary data with URLs like http://app.quotemedia.com/quotetools/scalingMarketStats.go?webmasterId=100804&toolWidth=620&statExchange=NSD&stat=pg&statTop=15&targetsym=symbol&detailURL=http://quotes.freerealtime.com/dl/frt/M%3fIM=quotes%26type=Quote%26SA=quotes%26symbol=symbol&sid=0. There are two <table> tags within each HTML response. Extract the second (nested) table, it contains the necessary data:

Those URLs you can find within webpage HTML content from the first logged request by http://quotes.freerealtime.com/dl/frt/M?SA=Percent+Gainers&IM=stats&stat=3.
Try the following steps to scrape live quotes from the website:

*

*Make request to http://quotes.freerealtime.com/dl/frt/M?SA=Percent+Gainers&IM=stats&stat=3

*Extract all URLs containing app.quotemedia.com/quotetools/scalingMarketStats.go from response.

*Make request to each extracted URL.

*Extract nested table from each response.


text:
Q: React: Passing State Between Page, NavBar, And Modal Components I'm still trying to get the hang of passing state between components in React. I have a NavigationBar and RunSimsModal component, with a Ratings page.
The user tweaks inputs on the Ratings page which then contains inputs that go into RunSimsModal. I'm not sure how to do this as RunSimsModal is only accessible from NavigationBar. The NavigationBar does not know the Ratings state at any time. How do I go about passing data/state from Ratings to RunSimsModal ?
NavigationBar.js
import React, {useState} from "react";
import { Nav, Navbar, Form, FormControl, Button } from "react-bootstrap";
import styled from "styled-components";
import RunSimsModal from "./RunSimsModal";

const Styles = styled.div`
  .navbar {
    background-color: #222;
  }
  a,
  .navbar-nav,
  .navbar-light .nav-link {
    color: #9fffcb;
    &:hover {
      color: white;
    }
  }
  .navbar-brand {
    font-size: 1.4em;
    color: #9fffcb;
    &:hover {
      color: white;
    }
  }
  .form-center {
    position: absolute !important;
    left: 55%;
    right: 25%;
  }
`;

export const NavigationBar = function () {
  const [modalShow, setModalShow] = useState(false);
  return
}

RunSimsModal.js
import React, { useState} from "react";
import { Button, Modal, FormFile, Form } from "react-bootstrap";
import * as outrightSimulatorApi from "../api/outrightSimulatorApi";
import Body from "../api/model/body.json";
import { withRouter } from "react-router-dom";

function RunSimsModal({ staticContext, ...props }) {
  const [numberofSims, setNumberOfSims] = useState("");
  const [simName, setSimName] = useState("");

  const runSims = event => {
    console.log("triggered");
    outrightSimulatorApi.runSim(
      Body.clientId,
      simName,
      numberofSims,
      Body.teamRatings, //This is the data I want to pass in from the Ratings page, it's an array
      Body.fixtureOverrides,
      Body.tournamentId
    );
    props.history.push("/reports");
  };

  return (
    <Modal
      {...props}
      size="lg"
      aria-labelledby="contained-modal-title-vcenter"
      centered
    >
      <Modal.Header closeButton>
        <Modal.Title id="contained-modal-title-vcenter">
          Run Simulations
        </Modal.Title>
      </Modal.Header>

      <Modal.Body>

Run Sims

        <Form onSubmit={runSims}>
          <Form.Group controlId="formBasicEmail">
            <Form.Label>Number Of Simulations</Form.Label>
            <Form.Control
              required
              type="text"
              placeholder="Enter number of sims"
              value={numberofSims}
              onChange={e => setNumberOfSims(e.target.value)}
            />
          </Form.Group>

          <Form.Group controlId="formBasicEmail">
            <Form.Label>Simulation Name</Form.Label>
            <Form.Control
              required
              type="text"
              placeholder="Enter simulation name"
              value={simName}
              onChange={e => setSimName(e.target.value)}
            />
          </Form.Group>

          <Form.Group controlId="formBasicEmail">
            <Form.Label>Tournament Type</Form.Label>
            <Form.Control as="select">
              <option>LEAGUE</option>
            </Form.Control>
          </Form.Group>

          <Form.Group controlId="formBasicEmail">
            <Form.Label>Teams in tournament</Form.Label>
            <FormFile.Input />
          </Form.Group>

          <Button type="submit">Run</Button>
        </Form>
      </Modal.Body>
      <Modal.Footer>
        <Button onClick={props.onHide}>Close</Button>
      </Modal.Footer>
    </Modal>
  );
}

export default withRouter(RunSimsModal);

Ratings.js
import React, { useState, useEffect } from "react";
import styled from "styled-components";
import { Table } from "react-bootstrap";
import NumericInput from "react-numeric-input";
import Teams from "../assets/Teams.js";
import { loadRatings } from "../actions/outrightSimulatorActions";
import ratingsStore from "../stores/ratingsStore";

const GridWrapper = styled.div`
  display: grid;
  grid-gap: 10px;
  margin-top: 4.5em;
  margin-left: 6em;
  margin-right: 6em;
  grid-template-columns: repeat(1, 1fr);
  grid-auto-rows: minmax(25px, auto);
`;

const TeamIcon = styled.span`
  margin-right: 0.5em;
`;

const teams = Teams;

function Display() {
  return (
    <GridWrapper>

        <RatingsGrid />

    </GridWrapper>
  );
}

function RatingsGrid() {
  const [ratings, setRatings] = useState(ratingsStore.getRatings());

  useEffect(() => {
    ratingsStore.addChangeListener(onChange);

    if (ratingsStore.getRatings().length === 0) loadRatings();

    return () => {
      ratingsStore.removeChangeListener(onChange);
    };
  }, []);

  function onChange() {
    console.log("ratings changed");
    setRatings(ratingsStore.getRatings());
  }

  return (

          Teams
          Ratings
          Home Advantage

        {ratings.map(rating => (

              <TeamIcon>

                   t.id === rating.teamId).icon}
                    className="icon"
                    height="42"
                    width="42"
                    alt={rating.teamName}
                  />

                {rating.teamName}
              </TeamIcon>

              <NumericInput
                value={rating.rating}
                step={0.01}
                mobile={false}
                size="14"
              />

              <NumericInput value={0.4} step={0.01} mobile={false} size="14" />

        ))}

  );
}

export default Display;


text:
Q: How can I integrate BIRT in GWT? I need to integrate a BIRT chart engine in one of my app. Birt can generate an image as the chart output. My idea is to generate this chart image and then send it to the client side for display. Perhaps in a RemoteServiceServlet on the server. Is this the best way to do it ? or are there other techniques for doing it right ?
thanks in advance,

A: The most robust way to generate a "report," be it an image, a PDF, or any sequence of bytes that needs to be downloaded by the browser in response to a user action, is to make the client's RPC call return immediately with a URL, or token, at which the contents of the report will be available later.  Later, in this context, just means that a subsequent request will be necessary to retrieve the contents of the report, but the pattern scales well to use cases where it may take a non-trivial amount of time to create the report.

*

*The client sends an RPC request to the server with the parameters of the report.

*The server adds the parameters to a report queue and responds with some token that can be used to retrieve the contents of the report later on.

*

*The contents of the report are generated in a separate thread or perhaps on a separate machine if the report is computationally expensive.

*If the report is guaranteed to only take a short amount of time to complete, it could be generated immediately, but in any case, the contents of the report must be written to a storage mechanism to be retrieved later.

*(Optionally) The client polls some service to determine if the report is ready.

*The client presents the report to the user.

*

*In your case, the presentation would consist of creating an Image widget, perhaps with a URL pattern http://example.com/getReportImage/<Generated Token>.  This request could simply block until the report is finished.

If the choice of the report identifier is a function of the report parameters and has stable semantics, you can get caching and de-duplication of work with little extra effort.
As for the choice of using data: URLs, it only makes sense if your users are using modern browsers and the image size is tiny.  It's not appropriate for the general case.

A: Make the client send an RPC and let the server do all BIRT rendering. Once the server has finished, stream the resulting HTML (or image) back to the client. See http://www.birt-exchange.org/org/forum/index.php/topic/15515-build-birt-report-engine-with-gwt/
myServiceImpl.getReport(
    "monthlySales",
    "2013-02-01",
    "includeGST",
    new AsyncCallback<String>() {
        public void onSuccess(String serverGeneratedBirtHtml) {
            myVerticalPanel.add(new HTML(serverGeneratedBirtHtml));
        }
    }
);


text:
Q: VueJs display html inside for loop without element I my pages component i loop through. The problem is that the loop ommits for example
 with

Is there a way that i can loop and do this

 without outputting the div around the other?
How can achieve that?
Pages component:
    <template v-for="item in json.content">
        <component v-if="item.substring(0,10) === 'component-'" :is="item"></component>

    </template>

Data php array which will be converted to json:
array:13 [▼
    1 => "
"
    2 => "
"
    3 => "
111
"
    4 => "
"
    8 => "
"
    9 => "
222
"
    10 => "
"
    14 => "
"
    15 => "
333
"
    16 => "
"
    17 => "
"
    20 => "component-adreswidget"
    23 => "
test
"
]

A: It's not possible to use v-html without wrapping in some tag as you can see in offical docs https://v2.vuejs.org/v2/guide/syntax.html#Raw-HTML.
what you can do is rearrange your array in such a way that it gives you whole chunk rather than seperate tags like
array:13 [▼
    1 => `

111

`
    2 => "component-adreswidget"
    3 => "
test
"
]

and wrapping it in span or div.


text:
Q: generate 1000 random card deck shuffles at once c++ I'm basically trying to build a computer simulation of a casino game idea that uses a standard deck of 52 cards.
I would like to run 1000 games at once.
I've used srand(time(NULL)) before, but I dont think it's possible to output 1000 different random number sequences at one time with this, is there? My perception is that since all the numbers are generated at the same time, that they will all be the same.
Is there a way to use the first generated random number to seed 1000 new 52 number sequences?
Thanks

A: Yes, you can have your first random number generator (seeded with time(NULL)) output 1000 random numbers, each of which can be used as a seed for 1000 separate random number generators.

A:
My perception is that since all the numbers are generated at the same
  time, that they will all be the same

They are not generated at the same time. I presume you are using a for loop? Each iteration is not
at the same time".
Did you even test this theory?
for i = 1 to 1000 do
{
  print <time to ms resolution>
  print <random number>
}

A: Seeding with the same number will always lead to the same sequence of pseudo-random numbers. As long as you don't re-seed with the same seed in between iterations, the (sub)sequences are not going to be the same.

A: try seeding the rand() function with srand(time(NULL)*getpid()). PID of the process that you are invoking a 1000 times should be system dependent and has a good chance of being different from one another.
If you are using threads for different games, use threadID instead of getpid().
If you want you can pre-generate all random numbers at once and use them later:
int random_numbers[1000];
for (i = 0; i < 1000; i++) {
    srand(time(NULL)*(i+1));
    random_numbers[i] = rand();
}


text:
Q: How to extract the masses from LIGO strain data? I am a Computer science student working on LIGO data. I have seen this well describing link
How were the solar masses and distance of the GW150914 merger event calculated from the signal?
On how to extract the masses from the data.
But I still find it a little difficult despite the good explanation.
Can anyone give me a much simpler explanation on how to extract the masses from this data ?
A simple step by step solution would be really helpful
Thanks in advance


text:
Q: Let consider a square $10$x$10$ and write in the every unit square the numbers from $1$ to $100$ Let   consider   a  square $10\times 10$   and  write  in  the   every   unit  square    the   numbers   from  $1$  to  $100$   such  that   every  two   consecutive  numbers  are  in   squares   which  has  a  common edge.  Then  there  are  two  perfect  squares   on  the  same line  or  column. Can  you   give  me  an  hint? How  to  start?

A: We note the following:

*

*Write the coordinates of $k$ as $(i_k,j_k)$, where $i_k$ is the column that $k$ is in; $i_k \in \{1,2,\ldots, 10\}$; and $j_k$ is the row that $k$ is in; $j_k \in \{1,2,\ldots, 10\}$. Then if $i_k+j_k$ is even, then $i_{k+1} + j_{k+1}$ must be odd, for each $k=1,2,\ldots, 99$.

*If $i_{k^2} + j_{k^2}$ is even, then $i_{(k+1)^2} + j_{(k+1)^2}$ must be odd, as $(k+1)^2-k^2$ is an odd integer, for each $k=1,2,\ldots, 9$.

*We call a square $k^2$ even-even if $i_{k^2}$ and $j_{k^2}$ are both even.
and we call a square $k^2$ odd-odd if $i_{k^2}$ and $j_{k^2}$ are both odd. We call a square mixed otherwise. Then if $k^2$ is odd-odd or even-even, then $(k+1)^2$ must be mixed.
So from 3 we have the following:

 4. Precisely 5 squares are mixed and precisely 5 squares that are either even-even or odd-odd.

But this is impossible unless a row or column has at least 2 squares:

 Indeed: Either at least 3 of the squares $k^2; k=1,2,\ldots, 10$; are even-even, or at least 3 of the squares are odd-odd. LEt us assume that 3 of the squares are even-even. Then if every row and column has exactly one square, then of the 5 mixed squares, only 2 can be in an even column (as 3 of the even columns were already taken by the 3 even-evens and so there are only 2 even columns left). And likewise, only 2 can be in an even row. But this implies that at least one (i.e. $5-2-2$) of the 5 mixed squares is odd-odd after all, which contradicts 4. above. [The likewise holds by the same line of reasoning holds if 3 of the squares are odd-odd.]

A: Here are several successively more revealing hints, hidden behind spoilers in case you want to try the problem after only reading one or two.
Hint 1:
Color your $10\times 10$ board like a checkerboard. What can you say about the colors of the squares containing perfect squares?
More specifically:

 How does the color of square $1$ compare to that of $4$? And how does $4$ compare to that of $9$? Etc.

Hint 2:

 In general, show that for any $10$ squares in pairwise different rows and columns, an even number of these squares must be black.

  Assuming that a path where the perfect squares are in different rows and columns exists, combine this fact with the conclusion of Hint $1$ to get a contradiction.

Hint 3:

 This goes into more detail about how to prove the first sentence of Hint $2$.

 Suppose there are $10$ squares in pairwise different rows and columns. A square in row $i$ and column $j$ is black if and only if $i+j$ is even.

 Suppose square in row $i$ is in column $\pi_i$, where $\pi$ is a permutation of $\{1,2,\dots,n\}$. Then the summation $\sum_{i=1}^{10}(i+\pi_i)$ is equal in parity to the number of black squares, so you need to prove this summation is even.


text:
Q: I need to push the array standard format Array
Array (
    [0] => 1436073376-java_tutorial.pdf
    [isread] => 0
)
Array (
    [0] => 1436073294-hadoop_tutorial.pdf
    [isread] => 0
)

I need expected output like
Array (
    [0] => 1436073376-java_tutorial.pdf
    [isread] => 0
),
Array (
    [1] => 1436073294-hadoop_tutorial.pdf
    [isread] => 0
)

what i have tried is
$filenameuploaded = array_push($1starray,$secondarry);

How can i do this ?

A: You can do something like this:
$array1 = array(
    '0' => '1436073376-java_tutorial.pdf',
    'isread' => 0
);
$array2 = array(
    '1' => '1436073294-hadoop_tutorial.pdf',
    'isread' => 0
);

$result[] = $array1;
$result[] = $array2;
echo '<pre>';
print_r($result);


text:
Q: How do I create a point, buffer it, and intersect with polygon geometry? The sql below is intended to create a point from a know X,Y. It should then buffer the point with a known distance. Last, the sql should intersect the buffer with an underlying polygon layer and return the name field from the polygon the buffer intersects. Seems straightforward.
SELECT name
FROM polygons t1
WHERE sde.st_intersects (sde.st_buffer(sde.st_point(x, y), buffer), t1.SHAPE) = 1

When I run the sql, I get the following:
Error at line 3
ORA-20003: Geometry type "" is not a valid shape type.
ORA-06512: at "SDE.ST_GEOM_UTIL", line 275
ORA-06512: at "SDE.ST_POINT", line 21

What am I doing wrong and how do I fix it? The X,Y I'm using are definitely in the correct area so buffering and finding an intersection should not be a problem.
I'm using st_geometry on Oracle from Arc 10.1

A: You need to add a SRID to ST_POINT.
SELECT name
FROM polygons t1
WHERE sde.st_intersects (sde.st_buffer(sde.st_point(x, y, SRID), buffer), t1.SHAPE) = 1


text:
Q: C++ STL algorithms to add element in list I want to know if anyone has a quick way for adding an element to a std::list<T*> if the element is not already in it.
It's a generic function and I can not use loops so something like this
template <class T>
bool Class<T>::addElement(const T* element)
{
    for (list<T*>::iterator it = list_.begin(); it != list_.end(); it++)
    {
        if (element == *it)
            return false;
    }
    list_.push_back(element);
    return true;
}

Is not ok because of the loop. Does anyone have ideas?

A: Why is what you have "not ok"? Looks perfectly fine and readable to me (modulo missing typename).
If you really don't want to use a loop, you can accomplish the same by using the algorithm to does precisely that loop: std::find:
template <class T>
bool Class<T>::addElement(const T* element)
{
    if (std::find(list_.begin(), list_.end(), element) != list_.end()) {
        return false;
    }

    list_.push_back(element);
    return true;
}

A: If you can add other members to your class, you could add an index such as a std::unordered_set. That container stores a list of unique values, and can be searched for specific values in O(1) complexity, which implies that no full-loop search is done by the implementation for checking if the value already exists. It will stay fast even if you have a lot of values already stored.
With std::list, using library functions such as std::find will avoid explicitely writing a loop, but the implementation will perform the loop and this will be slow when a lot of values are already stored (O(n) complexity)

A: You can use intrusive list instead of the std::list. In this case each element in the list keeps its node data, so you can just query that data to find out if the element is already in the list. The disadvantage is that all elements in this list must be able to provide such data, and you can't put in such lists, for example, integer or boolean elements.
If you still need the std::list and/or the elements can be of any type, then the only way of fast queryng whether the element already exists in the list is to use an index. The indexes can be stored in separate std::unordered_set for fast lookups. You can use for indexes either the list's values "as is" or calculate the indexes using any custom function.


text:
Q: android java passing data from view to activity i'm starting with drawing in android.
I have simple activity with only onCreate method:
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Set full screen view
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    height = displaymetrics.heightPixels;
    width = displaymetrics.widthPixels;

    drawView = new DrawView(this, height, width);
    setContentView(drawView);
    drawView.requestFocus();
}

In the drawView i have used onDraw method to draw circles every time i tap the screen. Circles are drawed where i tap.
When the app detects there's no more possibility to add circle i want to get back to my main activity and start another actions.
Will be grateful for any suggestions.

A: I think you are missing the point of object oriented programing here.  With an object oriented program there is no clear path your program follows.  You create a series of objects and teach them how to handle events.
If your drawView is done its work then remove it from view and put somthing else in its place for the user to interact with.
It is that simple.
In your case your drawview is an axctivity.  When you  are done with it you should call another activity.  I suggest re-reading this dev guide section.
The best way to learn and understand is to find an open source app (Google's own apps are best) that does something similar and study its source code.