text:
Q: How do I get only a certain value in a text file to a combo box? so I need help regarding how do I add only a certain info to a combo box. My groupmates and I are making a dog pound program where you can buy a dog or donate a dog (Not a real dog pound, btw. Just created for fun). So when a user decides to buy a dog he/she can choose a breed from the combo box(that was successfully made, btw). Then, the user clicks the next button so that the user can pick one from the list inside the combo box (problem is, the items for the combo box will be getting from the text file).
So for example, the user chooses a bulldog as a breed then clicks "next". Then the next window will show a combo box that lists all dogs that are bulldogs inside the text file (tag number of the dog -int-, name of the dog -string- and price -decimal-)
the text file goes like this:
1-Chihuahua+YY=625.00
3-Boxer+Rad=875.00
25-Terrier+Micky=1500.00
10-Bulldog+Mary=1997.500
4-Pug+Charlie=562.50
6-Bulldog+Cayne=2062.50

*(tagNumber-Breed+nameOfTheDog=Price)
**one dog info = one line, don't know what happened with the structure of the text
and the code so far goes like this:
  string location=@"C:\\Users\\LMCPENA98\\Desktop\\MilleniumPaws\\bin\\Debug\\Files.txt";
        string[] temp = File.ReadAllLines(location);
        int[] TagNumber = new int[temp.Length];
        string[] Breed = new string[temp.Length];
        string[] Name = new string[temp.Length];
        decimal[] Price = new decimal[temp.Length];

        for (int i = 0; i < TagNumber.Length; i++)
        {
            TagNumber[i] = int.Parse(temp[i].Substring(0, temp[i].IndexOf("-")));
            Breed[i] = temp[i].Substring(0, temp[i].IndexOf("+"));
            Breed[i] = Breed[i].Substring(Breed[i].LastIndexOf("-") + 1);
            Name[i] = temp[i].Substring(0, temp[i].IndexOf("="));
            Name[i] = Name[i].Substring(Name[i].LastIndexOf("+") + 1);
            Price[i] = decimal.Parse(temp[i].Substring(temp[i].LastIndexOf("=") + 1));

How can I display only the two bulldogs named Mary and Cayne into the combo box (tag number and price included)??

A: First, obtain the data in the most convenient format:
  var data = File
    .ReadLines(location)
    .Select(line => Split('-', '+', '='))
    .Select(items => new {
       tagNumber = int.Parse(items[0]),
       breed = items[1],
       name = items[2],
       price = Decimal.Parse(items[3])
     });

then filter out and represent
  myComboBox.Items.AddRange(data
    .Where(item => (item.breed == "Bulldog") &&
                   ((item.name == "Mary") || (item.name == "Cayne"))))
    .Select(item => String.Format("tag: {0}; price: {1}", item.tagNumber, item.price)));

I've used an anonymous class, but if such queries are frequent, you may want to implement a special class for record in the file:
 public class Dog {
   public int TagNumber {get; private set}
   ...
   public decimal Price {get; private set}
   ...
   public static Dog Parse(String value) {...}
   ...
   public override String ToString() {
     return String.Fromat("tag: {0}; price: {1}", TagNumber, Price);
   }
 }

 var data = File
   .ReadLines(location)
   .Select(line => Dog.Parse(line));

 ...
 myComboBox.Items.AddRange(data
   .Where(dog => (dog.Breed == "Bulldog") &&
                 ((dog.Name == "Mary") || (dog.Name == "Cayne"))))
   .Select(dog => dog.ToString()));

A: Try:
if (Breed[i] == BreedChosen)
{
    TagNumber[i] = int.Parse(temp[i].Substring(0, temp[i].IndexOf("-")));
    Breed[i] = temp[i].Substring(0, temp[i].IndexOf("+"));
    Breed[i] = Breed[i].Substring(Breed[i].LastIndexOf("-") + 1);
    Name[i] = temp[i].Substring(0, temp[i].IndexOf("="));
    Name[i] = Name[i].Substring(Name[i].LastIndexOf("+") + 1);
    Price[i] = decimal.Parse(temp[i].Substring(temp[i].LastIndexOf("=") + 1));
}

... unless I've misunderstood.

A: I would suggest a whole restructuring of the code. It would be best if you create a class to hold all the data for your dogs, sth like:
public class Dog
    {
        public int tagNumber;
        public string Breed;
        public string Name;
        public decimal Price;

        public Dog()
        {
            tagNumber = 0;
            Breed = "None";
            Name = "Nameless";
            Price = 0;
        }
    }

You can add whatever kind of functionality you want in such a constructor, it's quite suitable for your needs and easy to work with.
Then you can load your dogs into a simple list and sort the data however you like. Example:
string location=@"C:\\Users\\LMCPENA98\\Desktop\\MilleniumPaws\\bin\\Debug\\Files.txt";
        string[] temp = File.ReadAllLines(location);

        //Now we'll get all the dogs from our text file
        List<Dog> listOfDogs =  temp
                                .Select(line => line.Split('-', '+', '='))//selecting an array of arrays with the parts of each line
                                .Select(parts => new Dog{   tagNumber = int.Parse(parts[0]),
                                                            Breed = parts[1],
                                                            Name = parts[2],
                                                            Price = Decimal.Parse(parts[3])})//we're converting those arrays of parts to an instance of our Dog class
                                .ToList();//making it list

        //Now you have your list of dogs

        //You can get all the breeds (if you need them for a combobox e.g.). Will be using hashset, so that all the equal strings would be gone
        HashSet<string> hsOfDogBreeds = new HashSet<string>(listOfDogs.Select(dog => dog.Breed));

        //Afterwards you can do quite much everything you want with the info and it's more comfortable in this way.


text:
Q: Multi-page forms in Node.js I'm working on a project where I'd like to split up a form over multiple pages.
We're currently using express for node.js.
Would it be possible to store the variable from one page and continue to pass it along to the subsequent pages?
The first page is called "signup" which directs to "instructions." The code snippit from instructions is as follows:
app.post('/instructions', function(req, res){
    res.render('instructions.ejs', {book-code=req.body.book-code, pages=req.body.pages, author=req.body.author, title=req.body.title});
});

The hidden form on the instructions.ejs page looks like:
<form action = "record" method="POST">
    <input type="hidden" name="iauthor" value="author">
    <input type="hidden" name="ipages" value="pages">
    <input type="hidden" name="ibook-code" value="book-code">
    <input type="hidden" name="ititle" values="title">
</form>

Then, the section for record from the ejs file is:
app.post('/record', function(req, res){
  pg.connect(process.env.DATABASE_URL, function(err, client, done) {
    client.query('INSERT INTO database(book, PAGES, NAME, TITLE) VALUES($1)', [req.body.ibook-code, req.body.ipages, req.body.iauthor, req.body.ititle], function(err, result) {

    if(err) return console.error(err);
    console.log(result.rows);
    });
  });
    res.render('record.ejs');
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Max and min Dates I am using trial version of devExpress controls. I have two calendar controls on one page. I want that Calendar 1 selected date is always less than Calendar' 2 selected date and Calendar 2 selected date is always greater than Calendar 1 selected date.
Please suggest.
Thanks

A: I suppose you use ASPxDateEdit control. Try this for client side checking:
<dxe:ASPxDateEdit ClientInstanceName="cal1" runat="server">
    <ClientSideEvents DateChanged=
            "function(s,e) {
                if (s.GetDate() >= cal2.GetDate())
                {
                    s.SetIsValid(false);
                    s.SetErrorText("cal1 >= cal2");
                }
            }"
    />
</dxe:ASPxDateEdit>

<dxe:ASPxDateEdit ClientInstanceName="cal2" runat="server">
    <ClientSideEvents DateChanged=
            "function(s,e) {
                if (s.GetDate() <= cal1.GetDate())
                {
                    s.SetIsValid(false);
                    s.SetErrorText("cal1 >= cal2");
                }
            }"
    />
</dxe:ASPxDateEdit>

You should implement server side validation as well.
ASPxClientDateEdit  and DateEditClientSideEvents documentation.


text:
Q: Show image in jquery-ui tooltip based on href All the usual caveats apply:  I'm sure this has probably been addressed in another question, but I can't find the answer.
I've a link, with href to an image.  To this, I'm applying jquery UI's tooltip widget.
The tooltip should then show the image.
This works when the image is hard-coded into the content method, but not when it is worked out by attr.  However, logging the attr displays the correct string.
HTML:
HELLO

JQUERY:
$('.hotspot').tooltip({
tooltipClass: 'imageHotspot',
position: { my: "center top-200", at: "right center" },
content:"",
open: function(){console.log($(this).attr('href'))}
});

CONSOLE:
  http://localhost.pearl-island-dev/wp-content/themes/pearlIsland/assets/img/floorplans/tip-example.jpg
X > GET http://localhost.pearl-island-dev/real-estate/apartments/apartments-floorplans/undefined 404 (Not Found)

I'm not sure why the absolute reference to the image is being replaced by what appears to be a relative one - the same string hard coded into the content method does the job I want, but I need to get different values from each hotspot.
Hope someone can point me in the right direction.
Thanks in advance.
Here's a fiddle... (thanks for the suggestion)
http://jsfiddle.net/8XpMZ/1/

A: Your this is not coherent, here it refers to window but when you make a function it will be applied to your elt.hotspot so this will be set to the element the function is applied to.
Short answer : wrap it in a function
http://jsfiddle.net/techunter/8XpMZ/3/
$('.hotspot').tooltip({
        tooltipClass: 'imageHotspot',
        position: {
            my: "center top-200",
            at: "right center"
        },
        content: function(){
            return "
" + $(this).attr('href') + "
";
        },
        open: function () {
            $('#debugText').html($(this).attr('href'))
        }
    });

A: This will make the image as your tooltip content:
jQuery(document).ready(function ($) {
$('.hotspot').tooltip({
    tooltipClass: 'imageHotspot',
    position: { my: "center top-200", at: "right center" },
    content: function()
        {
            return "";
        },
    open: function(){$('#debugText').html($(this).attr('href'))}});
    $('.hotspot').click(function(e){
        e.preventDefault();
    })

});


text:
Q: Why doesn't dig myip.opendns.com @resolver1.opendns.com use sshuttle's proxy? I am using the great technique from How can I get my external IP address in a shell script? to find my public IP address:
dig +short myip.opendns.com @resolver1.opendns.com

I'm also using sshuttle as a proxy over ssh tunnel. It is started to forward traffic on all ports and IPs (including DNS requests) using the following command:
sshuttle --dns -vr usr@sshserver 0/0

After the proxy has started I visit https://canihazip.com/s to verify that my external IP has changed. It has, but when I run the dig command again, it reports the same external IP reported as before the proxy was started.
From the verbose output, sshuttle seems to be forwarding on other dig commands, and checking https://dnsleaktest.com only reveals the IP on the other end on my proxy, as expected. As far as I can tell sshuttle seems to be working.
Can anyone explain why the dig command reports my external IP before the proxy? My aim is make it seem to the opendns servers that the request is originating from my ssh server.
It's a bit over my head, but I had a quick look in Wireshark and when filtering for DNS traffic Wireshark doesn't see any DNS requests apart from the above DIG command. The command is bypassing the proxy.
I'm happy to use any of the other (less elegant) ways to find my external IP, but this makes me ask the question: what else is bypassing sshuttle?

A: Now that you have used the -v option to show debug message when running shuttle command, you can find that shuttle created some iptables rules. One of the rules is as follows:
iptables -t nat -A sshuttle-12300 -j REDIRECT --dest <nameserver>/32 -p udp --dport 53 --to-ports 12299

The rule above redirects the DNS request sent to <nameserver> to shuttle proxy port. Shuttle finds these <nameserver>s in /etc/resolv.conf file and automatically create iptables rules accroding to them.
So when the dig command make DNS queries using the nameserver defined in /etc/resolv.conf file, it will be proxied by sshuttle, but if not, it will not be proxied.
In your case, the address of resolver1.opendns.com which is 208.67.222.222 is not defined in your /etc/resolv.conf, so it will not be proxied by sshuttle.

A: The gateway has two external IP addresses. The NAT running on the gateway employs some kind of load balancing. It can be based on the destination IP or protocol type. If this is the case the source IP address of the DNS queries and HTTP packets will be different.


text:
Q: How can I add a conditional environment statement in my ember-cli index.html file? I would like to only include my google analytics snippit only for my production environment.
It would be great to be able to keep the snippit in the head of my ember-cli index.html file template in production and not for my development build.

A: Have you looked into the ember-cli-google-analytics addon?
https://www.npmjs.com/package/ember-cli-google-analytics
Check the link and look under Configuration - if you only configure a webPropertyId under production, then the snippet will only be injected into your index file when in production.
The addon was rated a 7/10 and was updated a month ago (I am not the author and have no affiliation, btw).

A: If you'd like to roll your own, you can add a content-for tag to your index.html:
{{content-for 'ga'}}

then provide the content in your Brocfile.js:
var app = new EmberApp({});
if (EmberApp.env() === 'production') {
    app.options.inlineContent = {
        ga: "<script>/* google analytics script here */</script>"
    };
}

(Caveat: For some reason the inlineContent part is missing from the Ember-CLI docs - it only mentions the use of content-for for addons, so I don't know if the API is changing).


text:
Q: What is the word for something that makes you resentful or indignant? Let's someone treated me badly. He broke my cup on purpose, and I am indignant at that. How to describe that behaviour that caused me to be indignant? Can I say that that person's behaviour is bitter?

A: I would suggest Aggravating
But I can think of a few other words too, such as:
Bothersome
Irritating
Vexatious
But I don't think Bitter would be the correct term. In fact you would be more likely to be the one who is bitter in this case.

A: While bitter does mean:

something that causes deep pain or anger (Cambridge)

it is not idiomatic to characterise someone's behaviour as bitter. I am not very sure  why, but my feeling is that the noun characterised as bitter more often than not provokes bitterness in the person possessing it, not in someone else. Some of the most common nouns used with bitter are taste, tears, disappointment.
For example: bitter taste is a taste which is bitter to the person who is experiences the taste, it does not provoke bitterness in another person. The same goes for bitter tears (you cannot say that your tears are bitter for me) and for bitter disappointment (you cannot say that your disappointment causes bitterness in me).
You could use embittering, which comes from the transitive verb embitter and works grammatically, but only if you want to emphasise the idea of resentment. Embittering means:

having qualities that make a person feel bitter (Collins)

In bitter, the idea of rancour seems stronger than anger.
A better word choice in order to emphasise the idea of anger would be infuriating which means:

extremely annoying:

*

*It's infuriating when people keep spelling your name wrong, isn't it? (Cambridge)

Certainly, any synonyms of annoying would work too.


text:
Q: Bluetooth connection with Android In my App I need to connect a smartphone with an 4.0 low power Bluetooth-module. Then the module sends frequenly data to the phone.

*

*Do you know some good tutorials for programming Bluetooth connection
with Android?

*Can you give me some links where the basics of Bluetooth are
explained? (german if possible)

*How can I test it? (I    have to programm the Bluetooth device too
and it's not finished jet)

A: Google havn't understood that sometimes they have to actually create and DRIVE something themselves, not just piggybacking on open source stuff and marketing it as their own.
Unfortunately there are no standardised BT 4.0. Low Energy API's for Android yet. Maybe Google just decided to only go for NFC for Google Wallet or something and then let BLE die. (We really need BOTH!)
Broadcom tried to make an open source API but somehow (maybe Broadcom wanted money from them?) no phones included the ".so" file in their Android build so this API is useless.
TI and Motorola made another API for the RAZR series running on old Android 2.3.3 or something. This actually works but Motorola removed the documentation and source-code from their site.
HTC ONE X+ and newer HTC phones will support a new API "soon" with special HTC libraries according to HTC. (At least it seems they are doing something)
Samsung Galaxy S3 have some "secret" API's that some people can use for discovering devices, scanning services and characteristics (there is an app in google play "semilink Bluetooth Smart Scanner" which on the Galaxy S3 can do those things).
Google asked Broadcom to make a replacement for Bluez in Android 4.2. Unfortunately this release broke a lot of functionality and peripheral compatibility. Maybe because one or more of Wifi/GPS/Bluetooth Classic/Bluetooth Low Energy shares the same HW resources but the drivers doesn't handle that very well. Lot's of people got problems with the newest Android Bluetooth functionality.
So I would expect Broadcom to focus on fixing the mess and THEN with Google move on to add Bluetooth 4.0. Low Energy. Google have said "Low Energy is the next BIG thing we will integrate". At least 1 year too late.
Personally I had to buy an iPhone4S and iPad retina to get platforms which supports low energy. With those we could finish the BLE peripheral sw and get the protocols working. Now we are waiting for Google and Broadcom to clean up the mess. Hopefully with some backwards compatibility so all the old phones with BT4.0. capable chipsets will also open up to the wonderful world of coincell battery driven peripherals ;-) (got to dream).
In reality we must wait for HTC to release their APIs and for Google to choose/drive the standard API.
Windows Phone 8 was supposed to get BLE but it has been postponed for an update. (Lumia 920 is certified but without API's (AGAIN!!) we developers are helpless)
There are nice GATT API's for Windows 8 as well as for MAC "OS"x.
You really should invest in the TI BLE development kit which costs like $50-$100 for a dongle which can be used for BLE sniffing. It comes SOOO handy when you develop your BLE Peripheral SW.


text:
Q: Изменить число в строке javascript Здравствуйте, такая задача: нужно написать функцию, которая будет выводить измененную строку, а именно если мы получаем строку 'foo' -> 'foo1', 'foo000' -> 'foo001', 'foo001' -> 'foo002', 'foo99' -> 'foo100', 'foo099' -> 'foo100'
Написал такую функцию, но потом понял, что эта функция меняет только последнюю цифру в строке. И теперь не могу понять как прибавлять единицу к числам 001, 099 и т.д. , чтобы когда нужно нули оставались(077 -> 078), а когда не нужны то уходили(099 -> 100)

function incrementString (strng) {
  var numbOfString = strng.match(/[0-9]/ig);
  var numbArray = [];

  if (/[0-9]/i.test(strng)) {
    for (var i = 0; i < numbOfString.length; i++) {
      numbArray.push(parseInt(numbOfString[i]));
    }

    var lastAddValue = numbArray[numbArray.length - 1] + 1;

    var editedStrng = strng.slice(0, -1);
    editedStrng = editedStrng + lastAddValue;
    return editedStrng;
  }
  return strng + '1';
}

UPD: цифры могут быть только в конце строки. Сколько цифр в строке будет неизвестно, строка может быть и такой foo00000001

A: Чтобы было максимально легко разобраться, я постарался лишь модифицировать ваш пример:

function incrementString(strng, base, decrease) {
  var base = base || 3;

  var numbOfString = strng.match(/[0-9]/ig);
  var numbArray = '';

  if (/[0-9]/i.test(strng)) {
    for (var i = 0; i < numbOfString.length; i++) {
      numbArray += numbOfString[i];
    }

    numbArray = parseInt(numbArray);

    var lastAddValue = numbArray + (decrease? -1 : 1);
    return strng.replace(/\d/g, '') + pad(lastAddValue, base);
  }
  return strng + pad(1, base);
}

function pad(num, size) {
  var s = num + "";
  while (s.length < size) s = "0" + s;
  return s;
}

console.log(incrementString('foo', 1));
console.log(incrementString('foo000'));
console.log(incrementString('foo001'));
console.log(incrementString('foo077'));
console.log(incrementString('foo089', 2));
console.log(incrementString('foo099'));
console.log(incrementString('foof099', 3, true));
console.log(incrementString('foof100', 3, true));
console.log(incrementString('foof60', 3, true));

Добавилось 2 параметра:

*

*основание (base), указывающее, сколько цифр должно быть в итоговой строке. Если не передан, то будет равняться 3.

*необязательный флаг decrease, указывающий, что необходимо уменьшение счетчика, а не увеличение

Хочу отметить, что тут имеется весьма забавный... ммм "артефакт".
Так как регулярное выражение тут требует доработки, переданная строка, например такая, тоже отработает и выведет нужный результат:
console.log(incrementString('1f2o3o', 3));

foo124

Я специально назвал это "артефактом", так как кто-то может расценить это как фичу, а кто-то как баг =)
UPD после комментариев

function incrementString(strng, decrease) {

  var numbOfString = strng.match(/[0-9]/ig);
  var number;

  if (numbOfString) {
    number = +numbOfString.join('');

    var lastAddValue = number + (decrease? -1 : 1);
    return strng.replace(/\d/g, '') + pad(lastAddValue, numbOfString.length);
  }
  return strng + pad(1, 1);
}

function pad(num, size) {
  var s = num + "";
  while (s.length < size) s = "0" + s;
  return s;
}

console.log(incrementString('foo', 1));
console.log(incrementString('foo000'));
console.log(incrementString('foo001'));
console.log(incrementString('foo077'));
console.log(incrementString('foo089'));
console.log(incrementString('foo099'));
console.log(incrementString('foof099', true));
console.log(incrementString('foof100', true));
console.log(incrementString('foof60', true));

console.log(incrementString('foo00000001'));
console.log(incrementString('foo0009999'));
console.log(incrementString('foo999999'));

A: На мой взгляд вы слишком усложнили себе задачу. Ваше решение больше похоже на учебное упражнение. Тело функции может быть в одну строку:
function incrementString(str) {
  return str.replace(/\d*$/, s => ('' + (+s + 1)).padStart(s.length, '0'));
}

function incrementString(str) {
  return str.replace(/\d*$/, //находим все цифры в конце строки и заменяем
    s => (
      '' + (+s + 1) //на найденные цифры, преобразовыванные в число + 1
    ).padStart(s.length, '0') //дополненные нулями
  );
}

console.log(incrementString('foo'));
console.log(incrementString('foo000'));
console.log(incrementString('foo001'));
console.log(incrementString('foo077'));
console.log(incrementString('foo089'));
console.log(incrementString('foo099'));
console.log(incrementString('foof099'));
console.log(incrementString('foof100'));
console.log(incrementString('foof999'));

A: вариант ...

function incrementString(d) {
  return d.replace(/(0*)(\d*$)/, function(b, a, c) {
    return (a + ++c).slice(a ? -b.length : 0);
  });
}

console.log(incrementString('foo'));
console.log(incrementString('foo000'));
console.log(incrementString('foo001'));
console.log(incrementString('foo9'));
console.log(incrementString('foo099'));
console.log(incrementString('foo999'));


text:
Q: NSView | NSTextField Right Click issue I have a NSView and inside that, there is a Label : NSTextField Control,
Inside NSView i have to show a context menu on the right click, its working fine except few below issue,
At some place it didn't work, i.e. if i do right click , it doesn't open the Context Menu, further i realized i have kept length/Width of Label is too big and right click happening over the Label,
but since this is the empty area, so as par user experience, it should allow to open the context menu, i feel following two approaches to solve this problem
1 -- Check the width/Length of the NSTextField runtime to set the proper width,
2 -- Pass Mouse event ( or at-least Right-click )from NSTextField( Label ) to its ParentView,
Can anyone suggest me, how can i achieve that ?
Kind Regards
Rohan

A: I'm not sure if this helps but when you click with the right mouse button on the nstextfield in the Interface Builder you'll see a "menu" object. Connecting this with a NSMenu and you have a default context menu.

A: So far its working with following piece of code,
-(void)initSubViews{
       /* In this function just init the sub-views */
    NSSize imageSize = [pStatusImage size];
pStatusImageView = [[NSImageView alloc]initWithFrame:NSMakeRect(0, 0,
                         imageSize.width,imageSize.height)];

pDisplayName = [[NSTextField alloc]initWithFrame:NSMakeRect(0, 0,
                    STATUS_WIDTH,STATUS_HEIGHT)];
[pDisplayName becomeFirstResponder];

**[pDisplayName setMenu:pCTTableMenu];**

    ..........................................................
    ..........................................................
    ..........................................................

}
so i can able to see the menu on the right click,
Kind Regards
Rohan


text:
Q: ReactJS multiple filtering I have a list of data here:
const Information = [
  {
    "id": 1,
    "name":"Samule",
    "age":25,
    "keywords": ["USA","England"]
  },
  {
    "id": 2,
    "name":"Sam",
    "age":19,
    "keywords": ["Ghana"]
  },
  {
    "id": 3,
    "name":"Mark",
    "age":17,
    "keywords": ["Africa","England"]
  },
  {
    "id": 4,
    "name":"Markus",
    "age":21,
    "keywords": ["Africa","England"]
  },
  {
    "id": 5,
    "name":"Markus",
    "age":29,
    "keywords": ["Africa","Nigeria"]
  }
];

export default Information;

And the reactjs code is here:
import React, { useState, useEffect } from "react";

import Information from './info-json'

export default function App() {
  const [searchTerm, setSearchTerm] = useState("Ghana");
  const [searchResults, setSearchResults] = useState([]);

  const [searchTermTwo, setSearchTermTwo] = useState("Ghana");
  const [searchResultsTwo, setSearchResultsTwo] = useState([]);

  const handleChange = e => setSearchTerm(e.target.value);
  const handleChangeTwo = e => setSearchTermTwo(e.target.value);

  useEffect(() => {
    const results = Information.filter(data => data.keywords.includes(searchTerm));

    setSearchResults(results);

  }, [searchTerm]);

  useEffect(() => {
    const resultsTwo = Information.filter(data => data.name.includes(searchTermTwo));

    setSearchResultsTwo(results);

  }, [searchTermTwo]);

  return (

      <input
        type="text"
        value={searchTerm}
        onChange={handleChange}
        placeholder="search"
      />

Search by Keyword

        searchTerm:

        {searchTerm}

      <input
        type="text"
        value={searchTermTwo}
        onChange={handleChangeTwo}
        placeholder="search"
      />

Search by Name

        search name:

        {searchTermTwo}

Available Data

"id": 1,
    "name":"Samule",
    "age":25,
    "keywords": ["USA","England"]

    "id": 2,
    "name":"Sam",
    "age":19,
    "keywords": ["Ghana"]

    "id": 3,
    "name":"Mark",
    "age":17,
    "keywords": ["Africa","England"]

    "id": 4,
    "name":"Markus",
    "age":21,
    "keywords": ["Africa","England"]

    "id": 5,
    "name":"Markus",
    "age":29,
    "keywords": ["Africa","Nigeria"]

Results

          {searchResults &&
            searchResultsTwo.map(item =>

{item.name}

{item.age}

)}

  );
}

What I want to do is to filter multiple values - a use case would be if I just type in Markus to the name field then ID 4 & 5 would show, but if I type in Markus in the first field and Nigeris into the second then only ID 5 would show.
I would then also like to filter by age.
Thanks in advance.

A: I would recommend to store filter object (properties and corresponding inputs) in your state, than (on render) check up against each object whether its respective properties contain desired inputs (or input is empty).
Following is a quick live demo that might give you a clue on how to approach your problem. I wouldn't recommend to deploy that as-is in your production app, though.

const { useState } = React,
      { render } = ReactDOM,
      rootNode = document.getElementById('root')

const data = [{"id":1,"name":"Samule","age":25,"keywords":["USA","England"]},{"id":2,"name":"Sam","age":19,"keywords":["Ghana"]},{"id":3,"name":"Mark","age":17,"keywords":["Africa","England"]},{"id":4,"name":"Markus","age":21,"keywords":["Africa","England"]},{"id":5,"name":"Markus","age":29,"keywords":["Africa","Nigeria"]}]

const App = () => {
  const [filterObj, setFilterObj] = useState({name:'', age:'', keywords:''}),
        onFilter = ({target:{name, value}}) =>
          setFilterObj({...filterObj, [name]: value})
  return (

      Name
      <input name="name" value={filterObj.name} onChange={onFilter} />
      Keywords
      <input name="keywords" value={filterObj.keywords} onChange={onFilter} />
      Age
      <input type="number" name="age" value={filterObj.age} onChange={onFilter} />

        {
          data.map(({id, name, age, keywords}) => {
            const match = (name.toLowerCase().includes(filterObj.name.toLowerCase()) || !filterObj.name) &&
                    (`${age}`.includes(filterObj.age) || !filterObj.age) &&
                    (keywords.some(w => w.toLowerCase().includes(filterObj.keywords.toLowerCase())) || !filterObj.keywords)
             return match &&
{name}, {age} ({keywords.join(', ')})

          })
        }

  )
}

render (
  <App />,
  rootNode
)


text:
Q: Django, unable to import validators in form class, getting "name 'validatorname' is not defined" I am trying to use validators in my form fields but am getting an error:
from django import forms
from django.db import models
from django.core.exceptions import ValidationError

class Register(forms.Form):
    username = forms.CharField(max_length=100,label="Username",validators=[validate_email])

>>>> name 'validate_email' is not defined

I have tried this with a number of different validator types, only to be hit with the same message for each. I have looked over the documentation and really can't see what I am missing as to how to import the validators into the class, any advice is appreciated

A: You seem to be missing an import. Try adding
from django.core.validators import validate_email

to your imports


text:
Q: How can i solve this error? I am installing thirdorder using ././compile.sh command syl2@syl2-HP-EliteBook-840-G2:~/Applications/thirdorder$ ./compile.sh
running build
running build_ext
building 'thirdorder_core' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/syl2/.local/lib/python3.8/site-packages/numpy/core/include -I/home/sy1/Applications/almabte-v1.3.2/build/external/spglib/src/spglib/python/ -I/usr/include/python3.8 -c thirdorder_core.c -o build/temp.linux-x86_64-3.8/thirdorder_core.o
In file included from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
                 from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from thirdorder_core.c:557:
/home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
thirdorder_core.c:559:10: fatal error: spglib/spglib.h: No such file or directory
  559 | #include "spglib/spglib.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

==============================================
I find spglib.h in the following directories but don't understand why its not accessible.
syl2@itel1530:~/Applications/thirdorder$ locate spglib.h
/home/syl2/.local/share/Trash/files/spglib.h
/home/syl2/.local/share/Trash/info/spglib.h.trashinfo
/home/syl2/Applications/almabte-v1.3.2/build/external/spglib/include/spglib/spglib.h
/home/syl2/Applications/almabte-v1.3.2/build/external/spglib/src/spglib/src/spglib.h
/home/syl2/Applications/spglib/src/spglib.h
/home/syl2/Applications/thirdorder/spglib.h
/snap/thirdorder/7/usr/local/include/spglib/spglib.h

A: Thank you for your responses. I solved this error by inserting the spglib directory in the setup.py file.
================================================
Add the location of the "spglib/spglib.h" to this list if necessary.
Example: INCLUDE_DIRS=["/home/user/local/include"]
INCLUDE_DIRS = ["/snap/thirdorder/7/usr/local/include"]
.
.
.


text:
Q: wp7 TemplateBinding Content not working I am new in working with wpf and currently I am trying to do the following: I have created a simple ContenctControl (CtrpushPinContent) that contains a TextBlock:
<ContentControl x:Class="CtrpushPinContent" ...
<Grid x:Name="LayoutRoot" Background="{x:Null}">
<Border BorderThickness="3" Name="border1" CornerRadius="15" BorderBrush="#FF070707" Margin="0,0,0,0">
                <Border BorderBrush="Silver" BorderThickness="3" Name="border2" CornerRadius="15" Background="#FF413E3E">
                    <TextBlock Name="textBlock1" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4" Foreground="White" />
                </Border>
            </Border>
        </Grid>
</ContentControl>

The cs file looks like this:
 public partial class CtrpushPinContent : ContentControl
    {
        public static readonly DependencyProperty CaptionProperty =
           DependencyProperty.Register("Text",
                                        typeof(string),
                                        typeof(CtrpushPinContent),
                                        new PropertyMetadata(string.Empty));

        public string Text
        {
            get { return textBlock1.Text; }
            set { textBlock1.Text = value; }
        }
        public CtrpushPinContent()
        {
            InitializeComponent();
        }
    }

On the main PhoneApplicationPage  I try to do the following:
<phone:PhoneApplicationPage.Resources>
<Style TargetType="my:Pushpin" x:Key="PushpinStyle">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="my:Pushpin">
                        <Grid x:Name="ContentGrid">
                            <StackPanel Orientation="Vertical">
                                <Grid Background="{x:Null}" HorizontalAlignment="Right" MinHeight="31" MinWidth="29">
                                    <LJTileSources:CtrpushPinContent HorizontalAlignment="Right"  Text="{TemplateBinding Content}" Margin="4" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                </Grid>
                                <Image Source="/WifiHotSpot;component/Images/blackPinNoShadow.png"  Width="54" Height="54" HorizontalAlignment="Center"></Image>
                            </StackPanel>
                        </Grid>
                        </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</phone:PhoneApplicationPage.Resources>

<Grid>
      <my:Map Margin="0,1,0,0" Name="map1" LogoVisibility="Collapsed" Height="576"  CredentialsProvider="key" ZoomLevel="2">
      <my:Pushpin Style="{StaticResource PushpinStyle}" Content="Test" Location="50.0863762,14.42814" PositionOrigin="BottomLeft"></my:Pushpin>
                    </my:Map>
</Grid>

However my solution is not working. I cannot see any effect of the
<my:Pushpin Style="{StaticResource PushpinStyle}" Content="Test" .../>

I believe the problem is somewhere in the style declaration:
 <LJTileSources:CtrpushPinContent HorizontalAlignment="Right"  Text="{TemplateBinding Content}" Margin="4" ContentTemplate="{TemplateBinding ContentTemplate}" />

because when I change it to
<LJTileSources:CtrpushPinContent HorizontalAlignment="Right"  Text="TestText" Margin="4" ContentTemplate="{TemplateBinding ContentTemplate}" />

it displays the "TestText" as required.

A: In your case for solve this problem quickly you need to implement this:
public static readonly DependencyProperty CaptionProperty =
     DependencyProperty.Register("Text",
                                        typeof(string),
                                        typeof(CtrpushPinContent),
                                        new PropertyMetadata(string.Empty, OnTextChanged));

        public string Text
        {
            get { return textBlock1.Text; }
            set { textBlock1.Text = value; }
        }

        private static void OnTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ((CtrpushPinContent)sender).textBlock1.Text = (string)e.NewValue;
        }

        public CtrpushPinContent()
        {
            InitializeComponent();
        }

When you set text in Pushpin template:
<LJTileSources:CtrpushPinContent HorizontalAlignment="Right"  Text="{TemplateBinding Content}"
                                                                     Margin="4" ContentTemplate="{TemplateBinding ContentTemplate}" />

you don't set Text property in your control, you set value of dependency property CaptionProperty, because you registered it with name "Text". So when you set Text from xaml, you set exactly Caption property, not Text property of your control. So you need to create event of changing this dependency property for updating text in textBox1.


text:
Q: JavaFX: Exception handling in an editable TextFieldTableCell My TableView is editable, so I can update the price and quantity directly from the table without pressing any button. My price and quantity are Integers so, how can I handle an exception when I enter a String value? I want my program to show a DialogPane with a message or something like that?
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.util.converter.IntegerStringConverter;
import model.Produs;
import service.Service;
import validator.ValidationException;

import javax.persistence.criteria.CriteriaBuilder;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

public class ControllerAdmin implements Initializable  {

    @FXML
    private TableView<Produs> table;

    @FXML
    private TableColumn<Produs, String> colNume;

    @FXML
    private TableColumn<Produs, Integer> colPret;

    @FXML
    private TableColumn<Produs, Integer> colCantitate;

    @FXML
    private TextField lblNume;

    @FXML
    private TextField lblCant;

    @FXML
    private TextField lblPret;

    private ObservableList<Produs> observableList;

    private Service service;
    public ControllerAdmin(){}
    public void setService(Service service){
        this.service=service;
        observableList = FXCollections.observableList(StreamSupport.stream(service.getAllProducts().spliterator(), false).collect(Collectors.toList()));
        observableList.remove(new Produs("b",2,2));
        loadTables();
    }

    private void loadTables() {
        table.setItems(observableList);
        table.getSelectionModel().selectedItemProperty().addListener((observer, oldData, newData) -> showDetails(newData));
        table.setEditable(true);
        colPret.setCellFactory(TextFieldTableCell.forTableColumn(new IntegerStringConverter()));
        colCantitate.setCellFactory(TextFieldTableCell.forTableColumn(new IntegerStringConverter()));

    }

    private void showDetails(Produs t) {if(t!=null){
        lblNume.setText(t.getDenumire());
        lblCant.setText(String.valueOf(t.getCantitate()));
        lblPret.setText(String.valueOf(t.getPret()));
    }

    }

    public void clickAdd(ActionEvent event) {
        try {
            service.saveProduct(new Produs(lblNume.getText(), Integer.parseInt(lblPret.getText()), Integer.parseInt(lblCant.getText())));
            observableList.add(new Produs(lblNume.getText(), Integer.parseInt(lblPret.getText()), Integer.parseInt(lblCant.getText())));
            table.setItems(observableList);
        }catch (ValidationException e){
            showAllert(e);
        }
    }
    public void clickDelete(ActionEvent event) {
        try {
            Produs p = new Produs(lblNume.getText(), Integer.parseInt(lblPret.getText()), Integer.parseInt(lblCant.getText()));
            service.deleteProduct(p);
            observableList.clear();
            observableList = FXCollections.observableList(StreamSupport.stream(service.getAllProducts().spliterator(), false).collect(Collectors.toList()));
            table.setItems(observableList);
        }catch (ValidationException e){
            showAllert(e);
        }
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        colNume.setCellValueFactory(new PropertyValueFactory<model.Produs,String>("denumire"));
        colPret.setCellValueFactory(new PropertyValueFactory<model.Produs,Integer>("pret"));
        colCantitate.setCellValueFactory(new PropertyValueFactory<model.Produs,Integer>("cantitate"));

    }

    public void onPretChange(TableColumn.CellEditEvent<Produs, ?> pretIntegerCellEditEvent) {

        try{
            Produs produs=table.getSelectionModel().getSelectedItem();
            produs.setPret((Integer) pretIntegerCellEditEvent.getNewValue());
            service.updateProdus(produs);}
        catch (NumberFormatException e){
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle("EroareMare");
            alert.setHeaderText(null);
            alert.setContentText("Pretul trebuie sa fie un numar natural");
            DialogPane dialogPane = alert.getDialogPane();
            dialogPane.getStylesheets().add(getClass().getResource("/cssDesign/myDialogs.css").toExternalForm());
            dialogPane.getStyleClass().add("myDialog");
            dialogPane.setHeader(null);
            alert.show();
        }
    }

    public void onCantitateChange(TableColumn.CellEditEvent<Produs, Integer> pretIntegerCellEditEvent) {

        try{
            Produs produs=table.getSelectionModel().getSelectedItem();
            produs.setCantitate(pretIntegerCellEditEvent.getNewValue());
            service.updateProdus(produs);}
        catch (NumberFormatException e){
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle("EroareMare");
            alert.setHeaderText(null);
            alert.setContentText("Cantitatea trebuie sa fie un numar natural");
            DialogPane dialogPane = alert.getDialogPane();
            dialogPane.getStylesheets().add(getClass().getResource("/cssDesign/myDialogs.css").toExternalForm());
            dialogPane.getStyleClass().add("myDialog");
            dialogPane.setHeader(null);
            alert.show();
        }
    }

private void showAllert(ValidationException e){
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("Eroare");
        alert.setHeaderText(null);
        alert.setContentText(e.getMessage());
        DialogPane dialogPane = alert.getDialogPane();
 dialogPane.getStylesheets().add(getClass().getResource("/cssDesign/myDialogs.css").toExternalForm());
        dialogPane.getStyleClass().add("myDialog");
        dialogPane.setHeader(null);
        alert.show();
    }
}

The exception:
Exception in thread "JavaFX Application Thread" java.lang.NumberFormatException: For input string: "a"
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.base/java.lang.Integer.parseInt(Integer.java:652)
        at java.base/java.lang.Integer.valueOf(Integer.java:983)
        at javafx.base/javafx.util.converter.IntegerStringConverter.fromString(IntegerStringConverter.java:49)
        at javafx.base/javafx.util.converter.IntegerStringConverter.fromString(IntegerStringConverter.java:35)
        at javafx.controls/javafx.scene.control.cell.CellUtils.lambda$createTextField$1(CellUtils.java:255)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
        at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
        at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8865)
        at javafx.controls/com.sun.javafx.scene.control.behavior.TextFieldBehavior.fire(TextFieldBehavior.java:184)
        at javafx.controls/com.sun.javafx.scene.control.behavior.TextInputControlBehavior.lambda$keyMapping$62(TextInputControlBehavior.java:330)
        at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
        at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
        at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
        at javafx.graphics/javafx.scene.Scene$KeyHandler.process(Scene.java:4083)
        at javafx.graphics/javafx.scene.Scene$KeyHandler.access$1600(Scene.java:4029)
        at javafx.graphics/javafx.scene.Scene.processKeyEvent(Scene.java:2146)
        at javafx.graphics/javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2620)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:217)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:149)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(GlassViewEventHandler.java:248)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
        at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:247)
        at javafx.graphics/com.sun.glass.ui.View.handleKeyEvent(View.java:547)
        at javafx.graphics/com.sun.glass.ui.View.notifyKey(View.java:971)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
        at java.base/java.lang.Thread.run(Thread.java:844)

A: You can write a custom IntegerStringConverter in your ControllerAdmin class:
public static class CustomIntegerStringConverter extends IntegerStringConverter {
    private final IntegerStringConverter converter = new IntegerStringConverter();

    @Override
    public String toString(Integer object) {
        try {
            return converter.toString(object);
        } catch (NumberFormatException e) {
            showAlert(e);
        }
        return null;
    }

    @Override
    public Integer fromString(String string) {
        try {
            return converter.fromString(string);
        } catch (NumberFormatException e) {
            showAlert(e);
        }
        return -1;
    }
}

Then you can use it the same way as IntegerStringConverter:
colPret.setCellFactory(TextFieldTableCell.forTableColumn(new CustomIntegerStringConverter()));
colCantitate.setCellFactory(TextFieldTableCell.forTableColumn(new CustomIntegerStringConverter()));

And make showAlert() take an Exception as a parameter instead of ValidationException:
private void showAlert(Exception e){
    /* show an alret */
}


text:
Q: In selenium webdriver,How to get a particular row and column content In selenium webdriver,How to get a particular row and column content.Like I need 2nd row 5th column element and my requirement keeps changing.Next I might need the 3rd row 1st column element.

A: In C# Using a css selector:
IWebElement selection = WebDriver.FindElement(
             By.CssSelector("#customers tr:nth-of-type(" + rowNum + ") td:nth-of-type(" + colNum + ")"));

In C# Using an xpath:
IWebElement selection = WebDriver.FindElement(
             By.Xpath("//*[@id='customers']//tr[" + rowNum + "]//td[" + colNum + "]"));

Where rowNum and colNum are the row and column passed in.

A: A very simple way would be to use XPath. In Java this would somehow look like this:
Integer row = 2;
Integer col = 3;
By by = By.xpath("//table[@id='customers']//tr[" + row.toString() + "]//td[" + col.toString + "]");


text:
Q: $http get loop append response data together I have a list of links, with a number in each one from 1 up to however many there are. My goal is to write a for loop, that goes through each link, runs a HTTP get, then saves the response data to an array object. I have tried various methods, but its difficult because of the fact that I am dealing with $scope variables, so none of the methods I find work.
for (let i = 0; i < 1000; i++) {
  $http.get("Start of URL"
+ i +  "End of URL")
  .then(function (response){
    $scope.datasingle = response.data;
  });
  $scope.datacombined = ??

}

A: Try this way;
const promisses = [];
for (let i = 0; i < 1000; i++) {
  promisses.push( new Promise(function (resolve, reject) {
    $http.get("Start of URL"+ i +  "End of URL").then(function(response){
      resolve(response.Data);
    });
  }));
}

Promise.all(promisses).then(function (values) {
  console.log(values); //you will get all the resolved result in this array and do what you want
});


text:
Q: How to delete a cookie in javascript I am trying to delete a cookie with this function , but it doesnt work..
deleteAllCookies();

function deleteAllCookies() {
    var cookies = document.cookie.split(";");

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var eqPos = cookie.indexOf("=");
        var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
        document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
    }
}

Why the cookie is in my browser, even after i activate that function ...

A: function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

Source: http://www.quirksmode.org/js/cookies.html

A: The standard way of deleting a cookie in JavaScript is to overwrite cookie's value to empty value and expires date to a passed date. Something like this.
Example, this should delete acctoken cookie.
document.cookie = "acctoken=; expires=Thu, 01 Jan 1970 00:00:00 UTC;"

If your cookie is in different domain or sub-doman, then you will have to explicitly specify domain/sub-domain in overwritten cookie.
document.cookie = "acctoken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=example.com"

More, context in this answer.

A: var cookies = document.cookie.split(";");

for (var i = 0; i < cookies.length; i++) {
    var cookie = cookies[i];
    var eqPos = cookie.indexOf("=");
    var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
    document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT ; path = /;";

Answers above are correct but don't forget to add path


text:
Q: EntityManagerFactory Error when setting up Hibernate with Spring and Maven I'm trying to configure a Spring 3.2, Maven 3 project to use Hibernate 4.1, but I seem to be having issues with my Persistence.xml, and/or my entityManagerFactory.
I am trying to follow the JPA specifications.
When I run the application I get the following error:
[see bottom]
I have some ideas about what might be wrong, but no idea how to fix what might or might not be wrong. First, I'm not sure I have the hibernate.connection.url property configured right in the persistence.xml file. (Which is in resources/META-INF.) "jdbc:oracle:thin:@PC55555.oururl.com:1521:psychos" psychos is the SID, but the schema name is Daredevils. Also, does the property "hibernate.hbm2ddl.auto" work with Oracle 11g?
Here's my persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

    <persistence-unit name="MyPersistence"
        transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
        <property name="dialect" value="org.hibernate.dialect.OracleDialect" />
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
            <property name="hibernate.connection.url"
                value="jdbc:oracle:thin:@PC55555.oururl.com:1521:psychos" />

            <property name="hibernate.connection.username" value="theusername" />
            <property name="hibernate.connection.password" value="thepassword" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
        </properties>
    </persistence-unit>
</persistence>

As far as spring configuration of Hibernate goes, here's my hibernate-context.xml file (which is imported in my base spring configuration xml file). It seems the error is thrown when the entityManagerFactory declares its persistence unit property, so I don't think there's something wrong with what's in here.
<?xml version="1.0" encoding="UTF-8"?>

<!-- Set up as per http://blog.springsource.org/2012/04/06/migrating-to-spring-3-1-and-hibernate-4-1/ -->

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
              http://www.springframework.org/schema/jdbc
              http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd">

<!-- Add JPA support -->
    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="persistenceUnitName" value="MyPersistence" />
         <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
    </property>
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />

      <property name="url" value="jdbc:oracle:thin:@PC55555.oururl.com:1521:psychos"/>

      <property name="username" value="theusername"/>
      <property name="password" value="thepassword"/>
    </bean>

    <!-- Add Transaction support -->
    <bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean
        class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
        lazy-init="false" />

</beans>

And just in case you need it, here are the relevant POM dependencies the project uses:

    <!-- Spring dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
        <scope>runtime</scope>
    </dependency>

    <!-- Database and ORM dependencies -->

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${org.hibernate.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- Oracle back-end support (acquired through internal repository) -->
    <dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc6</artifactId>
  <version>11.2.0.3-INTERNAL</version>
</dependency>

</dependencies>

I really appreciate any help!
As much stacktrace as I could fit:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/hibernate-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: NikeChallengesPersistence] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:519)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:331)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:747)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:277)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: NikeChallengesPersistence] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:286)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
    ... 59 more
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97)
    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:170)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:77)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
    ... 65 more

2013-01-16 11:37:06.340:WARN:/:unavailable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/hibernate-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: NikeChallengesPersistence] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:519)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:331)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:747)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:277)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by:
javax.persistence.PersistenceException: [PersistenceUnit: NikeChallengesPersistence] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:286)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:519)
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:331)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:747)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:277)
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at

A: First, make sure the connection is setup properly.  If pyschos is the sid it should be find as long as the other properties such as port and server are ok.  The oracle JDBC url should follow the syntax:

jdbc:oracle:thin:[USER/PASSWORD]@[HOST][:PORT]:SID

Also make sure that DareDevils is being used as the username with the appropriate password.
Second I do not believe you need to configure a JpaVendorAdapter since you are relying on the persistence.xml file to define the persistence provider <provider>org.hibernate.ejb.HibernatePersistence</provider>, this would change the entity manager config to :
<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="persistenceUnitName" value="MyPersistence" />
</bean>

Oracle does support hibernate.hbm2ddl.auto.
You may also want to checkout the video tutorial in my blog that describes how to setup a Spring Data project, which contains directions for how to create the configuration for the entity manager: http://tothought.cloudfoundry.com/post/3

A: The property is called hibernate.dialect, not just dialect. That should at least get you passed this initial exception.

A: Lame fix, but I switched to using Java-based spring configuration, and when I didn't need a persistence.xml or any xml configuration in the first place I was able to get it working fine!


text:
Q: Odoo reports: No module named report In OpenERP 7, I used to create reports in (report) directory and import the directory in the __init__.py using the statement: import report and it worked fine.
In Odoo 8, when I tried to install the same module that worked on OpenERP 7 I got the error message: No module named report
Is Odoo 8 not allowing to import directories? How to solve this?

A: because obviously you can't use modules across different versions of Odoo "OpenErp",
the migration process however has it's own set of procedures it maybe become so hard to migrate between versions but it still possible.


text:
Q: Data Annotation Ranges of UK Datetime fields I want to use Data Annotations to validate DateTime fields, but I'm running into problems. According to documentation on MSDN (http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.rangeattribute.aspx), the following should do the job
[Range(typeof(DateTime), "1/2/2004", "3/4/2004",
    ErrorMessage = "Value for {0} must be between {1} and {2}")]

However, this marks any date I enter as invalid!
At first I thought it was not picking up UK dates (when I tried 26/2/2004) but I can't even get it to use dates such as 2/2/2004.
I'm using the dataannotations within MVC2, and using the MicrosoftAjax framework for clientside validation.
Any suggestions?
Thanks

A: Well, a few years have gone past and I revisited this same issue with MVC4 and I can tell you that it has apparently been resolved.
I created a very simple default MVC4 site, and gave a date member the following attributes
    [Required]
    [DataType(DataType.Date)]
    [Range(typeof(DateTime), "1/2/2004", "3/4/2004", ErrorMessage = "Value for {0} must be between {1} and {2}")]
    public DateTime BlogDate { get; set; }

The validation now works perfectly under UK data system, disallowing a date 2/1/2004, allowing a date of 4/3/2004 or 26/3/2004.
The template I was using took advantage of code-first EF4, but I don't have any reason to suspect that it hasn't been fixed generally, since the javascript is working properly too.
So if you are using MVC2 this may still be a problem, but the best solution which I've found is to use MVC4 as long as it is available to you.

A: As far as i know the RangeAttribute can only validate number on client side, you'll have to write a custom javascript validator for this to work...
check out http://haacked.com/archive/2009/11/19/aspnetmvc2-custom-validation.aspx for an example on how to do this.


text:
Q: Re-transform a linear model. Case study with R Let's say I have a response variable which is not normally distributed and an explanatory variable. Let's create these two variables first (coded in R):
set.seed(12)
resp = (rnorm(120)+20)^3.79
expl = rep(c(1,2,3,4),30)

I run a linear model and I realize that the residuals are not normally distributed. (I know running a Shapiro might not be enough to justify that the residuals are not normally distributed but it is not the point of my question)
m1=lm(resp~expl)
shapiro.test(residuals(m1))
0.01794

Therefore I want to transform my explanatory variable (looking for a transformation with a Box-Cox for example).
m2=lm(resp^(1/3.79)~expl)
shapiro.test(residuals(m2))
0.4945

Ok, now my residuals are normally distributed it is fine! I now want to make a graphical representation of my data and my model. But I do not want to plot my explanatory variable in the transformed form because I would lose lots of its intuitive meaning. Therefore I do:
plot(x=expl,y=resp)

What if I now want to add the model? I could do this
abline(m2) # m2 is the model with transformed variable

but of course the line does not fit the data represented. I could do this:
abline(m1) # m1 is the model with the original variable.

but it is not the model I ran for the statistics! How can I re-transform the line predicted by m2 so that it fits the data?

A: plotexpl <- seq(1,4,length.out=10)
predresp <- predict(m2,newdata=list(expl=plotexpl))

lines(plotexpl, predresp^(3.79))

I won't discuss the statistical issues here (e.g. a non-significant test does not mean that H0 is true and your model is not better than the mean).

A: Since you've mentioned that the transformation might base on Box-Cox formula,
I would like to point out a issue you might want to consider.
According to the Box-cox transformation formula in the paper Box,George E. P.; Cox,D.R.(1964). "An analysis of transformations", your transformation implementation  (in case it is a Box-Cox one) might need to be slightly edited.The transformed y should be (y^(lambda)-1)/lambda instead of y^(lambda). (Actually, y^(lambda) is called Tukey transformation, which is another distinct transformation formula.)
So, the code should be:
lambda=3.79
m2=lm(resp^((lambda-1)/lambda)~expl)
shapiro.test(residuals(m2))

More information

*

*Correct implementation of Box-Cox transformation formula by boxcox() in R:
https://www.r-bloggers.com/on-box-cox-transform-in-regression-models/

*A great comparison between Box-Cox transformation and Tukey transformation. http://onlinestatbook.com/2/transformations/box-cox.html

*One could also find the Box-Cox transformation formula on Wikipedia:
en.wikipedia.org/wiki/Power_transform#Box.E2.80.93Cox_transformation
Please correct me if I misunderstood your implementation.


text:
Q: How can disable function wp_link_dialog() How can disable public static function wp_link_dialog from my theme function.php
in class-wp-editor.
I can delete it but if WordPress release any updates it will return to default again.

A: You should make a child theme and include a definition in functions.php for the function that does nothing.
You should be able to find tutorials on making child themes with any google search.


text:
Q: Tests cases for merge in merge sort Are there any edge cases or just cases in general that I need to test for this function. The only thing I can think of is if one of the arrays being merged is empty. Are there other test cases I need to consider?

A: For any sort, I consider these cases:

*

*The empty list

*An already sorted list

*A reverse sorted list

*A list consisting of the same element throughout

*A list containing dupes

This is not just to prove the algorithm but also for performance.

A: Some more:

*

*Think about the number of elements in each array:
Both array have even number of elements
One array has even while the other has odd number of elements
Number of elements in one array is more than the number of elements in another

*Also consider the range of elements in the array
The largest element in one array is smaller than the smallest element in the second array
One array has duplicates
Both the arrays have the same set of elements e.g.(A1: 2,4,6,8 and A2: 2,4,6,8)
Basically these ones are good at catching one off errors in the for loop while merging

A: Following cases I used to test my Merge Sort code. I guess this covers majority of the cases. You can directly copy in your C code and use it for testing.
//int arr[] = {12, 15, 23, 4 , 6, 10, 35, 28}; //Even number of element
//int arr[]={}; //Empty list
int *arr = NULL; //Null pointer
//int arr[] = {4, 6, 10, 12, 15, 23, 28, 35}; //already sorted array
//int arr[] = {12, 15, 23, 4 , 6, 10, 35}; //odd length array
//int arr[] = {35, 28, 23, 15, 12, 10, 6, 4}; //descending sorted array input
//int arr[] = {12};//one element
//int arr[] = {12, 4}; // two elements
//int arr[] = {12, 15, 23, 4 , 6, 10, 35, 28, 100, 130, 500, 1000, 235, 554, 75, 345, 800, 222, 333, 888, 444, 111, 666, 777, 60};//large list of elements
//int arr[] = {12, 15, -23, -4 , 6, 10, -35, 28}; //negative elements
int arr[] = {12, 12, 23, 4 , 6, 6, 10, -35, 28}; //duplicate elements
int arr[] = {12, 12, 12, 12, 12}; //Same element

A: Think about every if statement and loop condition in your code and try to find test cases which would make the condition true/false. If you post your code we can discuss possible test cases.