language
stringclasses
1 value
query
stringlengths
16
203k
source
stringclasses
20 values
metadata
stringlengths
14
99
source_name
stringclasses
20 values
stratify_key
class label
74 classes
en
does epsom salt help acne?
sentence-transformers/gooaq
{ "index": 1755733 }
gooaq
46gooaq_1
en
Computer is not talking to my monitor So last night I opened my computer to install a new 4tb hard drive, easy enough, but when I plugged everything back in my monitor only shows the unconnected screen, I pulled it apart again and tried moving the sata cable to another port but that didn't change anything, going to try disconnecting the new hard drive and see if it works but I don't really see why my hard drive should affect my computer talking to the monitor any ideas?
nreimers/reddit_question_best_answers
{ "index": 16213844 }
reddit_qa
97reddit_qa_4
en
Teams with good playoff schedules I've heard a lot of talk on this sub about players with "bad playoff schedules." What are some teams with good playoff schedules? Is there a resource people are using to see which teams play a lot during the playoffs?
nreimers/reddit_question_best_answers
{ "index": 22616902 }
reddit_qa
96reddit_qa_3
en
I have a switch statement in a factory that returns a command based on the value of the enum passed in. Something like: ``` public ICommand Create(EnumType enumType) { switch (enumType) { case(enumType.Val1): return new SomeCommand(); case(enumType.Val2): return new SomeCommand(); case(enumType.Val3): return new SomeCommand(); default: throw new ArgumentOutOfRangeException("Unknown enumType" + enumType); } } ``` I currently have a switch case for each value in the enum. I have unit tests for each of these cases. How do I unit test that the default case throws an error? Obviously, at the moment I can't pass in an unknown EnumType but who's to say this won't be changed in the future. Is there anyway I can extend or mock the EnumType purely for the sake of the unit test?
ArmelR/stack-exchange-instruction
{ "qid": 1827430 }
stackexchange
108stackexchange_4
en
Quick dumb question about GPUs Since CPUs used to be plug-in boards, like GPUs today and the Pentium II of yesteryear, when is will we expect to be able to simply switch out a GPU on our motherboard and supply it with it's own separate RAM that we can also replace?
nreimers/reddit_question_best_answers
{ "index": 8148224 }
reddit_qa
96reddit_qa_3
en
I am new at swift language and I need to compare some strings or some characters in any string. first question: The last version of swift doesn't allow equal operation == like this. ``` if "1" == item.index(item.startIndex, offsetBy: 7){ print("ok!") } ``` item is a string, it has this string "01: 06-08-2017, 13:43" (I can see its inside when I write print) How can I check some characters in any string?
ArmelR/stack-exchange-instruction
{ "qid": 45536904 }
stackexchange
108stackexchange_4
en
I have Sprint unlimited everything but I pay $200 + a month, should I switch? More information on this, I currently have two phones on this account. Both have unlimited everything. Issue is, the other phone used 6GB and I used 10GB last month. But most of it was because we forgot to switch to wifi once we got home. We also have LG G4 phones. Is this something for us?
nreimers/reddit_question_best_answers
{ "index": 14539313 }
reddit_qa
96reddit_qa_3
en
Is there any way to set up a coupon code in WooCommerce so that a usage is counted for each line item in the order? Example process: 1. Customer has a voucher code unique to themselves with 100 use maximum 2. Customer places an order with 10 products in it and uses the voucher code 3. Voucher now has 90 remaining uses And another: 1. Customer has a voucher code unique to themselves with 100 use maximum 2. Customer places an order with 200 products in it and uses the voucher code 3. Voucher now has 0 remaining uses 4. Customer pays full price on the remaining 100 products As it is, I can't see any core way to do this, or any third party extension that would allow it.
ArmelR/stack-exchange-instruction
{ "qid": 19958654 }
stackexchange
108stackexchange_4
en
how long does it take to get back the results of an mri?
sentence-transformers/gooaq
{ "index": 683771 }
gooaq
47gooaq_2
en
what happens to your body when you eat healthy?
sentence-transformers/gooaq
{ "index": 1260074 }
gooaq
47gooaq_2
en
I have a Lenovo ThinkPad x230 that I just purchased and installed Ubuntu 12.10 on it. There is no sound, how do I fix it? I checked that my volume is not muted. I also tried checking in alsamixer and it looks like it doesn't see my sound card.
ArmelR/stack-exchange-instruction
{ "qid": 203312 }
stackexchange
107stackexchange_3
en
Let's say I have a class like this: ``` public class ClassA { [...] protected void methodIWantToTest() { [...] } [...] } ``` When I a write a unit test in IntelliJ Idea 13, I don't get compiler errors, when I write something like: ``` public class ClassATest { @Test public void test() { final ClassA objectUnderTest = new ClassA(); objectUnderTest.methodIWantToTest(); // Why can I access a protected method here? } } ``` `methodIWantToTest` is protected. Why can I access it in a test?
ArmelR/stack-exchange-instruction
{ "qid": 26894041 }
stackexchange
108stackexchange_4
en
how to change keyboard layout windows 10 shortcut?
sentence-transformers/gooaq
{ "index": 2993870 }
gooaq
47gooaq_2
en
My understanding (erroneous as I may be told this is) is that iCloud is like a virtual external drive to some extent. Maybe that is my first mistake. But before everyone starts saying to look at other posts, please know I believe I have read all the posts about photo stream, camera roll, and the link that was posted (in one of these answers on this general topic) about iCloud backups, as well as those Q&A's related to freeing up space. I am still confused. I am reaching storage capacity on my iPhone. I have a lot of photos on my phone because they've always migrated over from phone to phone every year or so. However, I need to free up some space and would like to delete photos from my iPhone (the device I took them on), but am still not sure if I do this, if it will remain on iCloud. I have an iPad and a Macbook too, and they (the photos and docs) are on there, but with photos I just don't ever want to lose, I want to be sure that if I start deleting off my phone, and my computer gets stolen or dies and my iPad is broken or whatever, that I can still always access all of my photos by just logging in to iCloud from any device. I (supposedly) have iCloud backing up all of these things. However, If I log into iCloud.com, I do not see my documents and photos. Shouldn't I conceivably be able to log in to iCloud.com from any device (Apple or not - say my work computer) and access my saved documents and photos? Because I cannot go to iCloud.com (not settings/iCloud - bit iCloud.com) and see these things, I am hesitant to delete photos from my phone, depending on the idea that they are stored in iCloud. The same is true, to a different extent with my documents. I have purchased extra storage on iCloud w/the idea that these things will always be there. What am I missing. Also, aside from apps, photos and documents - are there some less obvious things I can delete that will free up space that would not be evident to the less than professionally savvy user?
ArmelR/stack-exchange-instruction
{ "qid": 200370 }
stackexchange
109stackexchange_5
en
I am learning about shell scripting, particularly the shell commands `test`, `[ ]`. `[[ ]]` and `(( ))`, I wrote a real simple script to test my understanding, it takes in three arguments, if all three are integers (and the second argument is lower than the third) it tests if the first argument lays in the range between the second and third. Here it is: ``` #!/bin/bash #test if arg1 is contained in the range [arg2, arg3] function isint() { if [[ "$1" =~ ^-?[0-9]+$ ]]; then echo $1 is integer return 0 else echo $1 is not integer return 1 fi } if [[ $(isint $1) && $(isint $2) && $(isint $3) && $2 -lt $3 ]]; then if [[ $2 -le $1 && $1 -le $3 ]]; then echo "$1 is in the range [$2,$3]" else echo "$1 is not in the range [$2,$3]" fi else echo usage: $0 INT1 INT2 INT3 fi ``` Here is my problem: the preceding script doesn't work, the ``` if [[ $(isint $1) && $(isint $2) && $(isint $3) && $2 -lt $3 ]] ``` never evaluates to true, if I want to obtain the wanted result I need to change the test to: ``` if [[ !$(isint $1) && !$(isint $2) && !$(isint $3) && $2 -lt $3 ]] ``` I don't get why this is working, the way I understood the `test`and `[[ ]]` commands is that they both evaluate the expressions passed to them, `0` evaluates to true and `1` evaluates to false. In my case if the correct parameters are passed to the script, the `isint` calls evaluate to 0, hence true, why the need for inverting them for the script to work as I want ? Thank you in advance.
ArmelR/stack-exchange-instruction
{ "qid": 46797575 }
stackexchange
109stackexchange_5
en
When I create a polygon, there are three quality display settings in Maya: rough, medium and smooth. What is the use of these display qualities in realtime and what does smoothness really indicates? I mean: is it actual object that is shown after rendering is done and why does a polygon looks like a disoriented sphere, when I press 3? My friend suggested to use insert edge loop tool to make look like a sphere, is this the right process?[![enter image description here](https://i.stack.imgur.com/eaAdW.jpg)](https://i.stack.imgur.com/eaAdW.jpg) What is the difference between the above and below image and should I make the bottom image look like a smooth square with the insert edge tool before I start working on it? [![enter image description here](https://i.stack.imgur.com/xmxud.jpg)](https://i.stack.imgur.com/xmxud.jpg)
ArmelR/stack-exchange-instruction
{ "qid": 97534 }
stackexchange
108stackexchange_4
en
I liked the Nightmare Collective interference for one reason. I (like most viewers) do not think the Nightmare Collective is working right now. However their interference responded to criticism we have been saying for a while now: the women's division has not storylines. Before the last event most of the matches have no motivations. We did not really know who the good guys and bad guys were. Their interference clearly established who the "bad team" is and who the "good guys" are. This is leading to a match next week. It's not a great story, but it is a story.
nreimers/reddit_question_best_answers
{ "index": 38453885 }
reddit_qa
97reddit_qa_4
en
I'm a beginner in bash. I have a .csv file. It contains 2 columns (Name and Num). Here is the content of columns: ``` Name, Num ex1, 10.20.30.40 ex2, 20.30.40.30 ex3, 10.45.60.20 ex4, 10.20.30.40 ``` I want to select the rows that their 2nd column is equal to $Number (For example "10.20.30.40"). I use this script: ``` awk -F, '$2 == $Number' name.csv >output.txt ``` but after executing the code, "output.txt" is empty. When I echo the found values, it doesn't show anything either. What's wrong? I also want to access to the value that is stored in the first column of this row. How should I do this?
ArmelR/stack-exchange-instruction
{ "qid": 60042072 }
stackexchange
108stackexchange_4
en
I'm studying Hazewinkel's "Formal Groups" book, and example of a non-commutative group law is given by: on the ring $\mathbb{F}\_p[c]/(c^2)$ we define $$F(X,Y)=X+Y+cXY^p.$$ I see how to prove everything except non-commutativity- my problem is I tried to find example where it fails for $p=3$ and I keep getting that this is commutative (I am making mistake somewhere): 1. I think that elements in $\mathbb{F}\_3[c]/(c^2)$ can be seen as polynomials of degree $1$ or $0$, ie. elements are of form $a\cdot c+b$. 2. Also, since characteristic of ring is $3$ we have $(a\cdot c+b)^3=a^3c^3+b^3=b$ so 3. if $F(X,Y)=F(Y,X)$ than since $X+Y=Y+X$ we must have $cXY^p=cYX^p$ 4. Let $X=ac+b$ and $Y=Ac+B$ then $cXY^3=c(ac+b)(Ac+B)^3=$(step 2)$=c(ac+b)B=bBc$ 5. and $cYX^3=c(Ac+B)(ac+b)^3=$(step 2)$=c(Ac+B)b=bBc$ which leads to conclusion it is commutative. Which steps are wrong?
ArmelR/stack-exchange-instruction
{ "qid": 2112221 }
stackexchange
108stackexchange_4
en
I'm writing a sci-fi screenplay and I wonder how a human face of an adolescent would look if it was somehow covered with a sort of flexible mask since birth? What would you discover if you removed the mask? What are the effects of constant irritation and absence of light on the skin? Would there grow hairs like after a cast? Is there a possibility that the skull or muscles are deformed by constant pressure? Would the skin start to fester? Or would it just be a pale, but fairly normal face? Thanks in advance!
ArmelR/stack-exchange-instruction
{ "qid": 60261 }
stackexchange
108stackexchange_4
en
Threat and Orbital boomstick charging First time I'm reaching the phase of charging the Orbital Power Transmitter. A few minutes after, I got the "20000% threat" achievement. It is an interesting challenge! Missiles are flying constantly, and my base is a coal chugging turret porcupine. But, I'm just curious if I'm playing it correctly as I don't know what to expect from this stage of the game. Is it supposed to be this intense at this stage of the game, or am I just being very bad at threat management?
nreimers/reddit_question_best_answers
{ "index": 29871388 }
reddit_qa
97reddit_qa_4
en
Is MAC Viva Glam I better for warm olives? While rummaging through my old makeup at my mum's house, I found an old tube of MAC Viva Glam I. It was the first red lipstick I ever bought. And it was the lipstick that made me think I couldn't wear red. It pulled very brown and orange, and the skin on my upper lip turned green. Fast forward years down the road. I've figured out I'm a light-medium probably cool-neutral olive with a lot of facial redness. My lips are mauve, which is why dusty pinks and mauves are my BFFs. And I've recently rediscovered reds. My current HG red is Maybelline's Siren in Scarlet, and I also look good in the following: # * NARS Cruella * NARS Provocative Red * Revlon Blake's Red * Revlon Julianne's Red * UD Gash *UD Rocksteady So I'm wondering why Viva Glam I looks bad on me when it technically should look good? Is it because of the brown mixing with my mauve-ish lips? Or is it because I'm most likely a cooler olive?
nreimers/reddit_question_best_answers
{ "index": 20740462 }
reddit_qa
97reddit_qa_4
en
I am unable to display in one row. I will be looping the images dynamically. So if there are 4 to 5 images, then it should come in one row. But if there are more than 5 images or you can say 9, then it should come in next rows. In the below code, I am using HTML and CSS but unable to get in same row. ```css #umar { display: inline; width: 100%; } .card { box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); transition: 0.3s; width: 20%; } .card:hover { box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); } .container { padding: 2px 16px; margin-bottom: 10px; } ``` ```html <h2>Card</h2> <div id="umar"> <div class="card"> <img src="images/img.jpg" alt="Avatar" style="width:100%"> <div class="container"> <h4><b>John Doe</b></h4> <p>Architect & Engineer</p> </div> </div> <div class="card"> <img src="images/img1.jpg" alt="Avatar" style="width:100%"> <div class="container"> <h4><b>John Doe</b></h4> <p>Architect & Engineer</p> </div> </div> </div> ```
ArmelR/stack-exchange-instruction
{ "qid": 44989778 }
stackexchange
108stackexchange_4
en
How has JJ Barea looked this year? Pels fan here just wondering how he’s looking like coming off a torn achilles which is possibly the worst injury that a player can have. I’m just asking because John Wall has been one of my fav players in the league and he’s coming off the same injury so I’m hoping he can still be somewhat of himself. So how was JJ been? Notice any differences in his game or anything like that? Ik he’s always been quick.
nreimers/reddit_question_best_answers
{ "index": 37869751 }
reddit_qa
97reddit_qa_4
en
Need Suggestions.... Got a buddy who is not a fan of Scotch but likes bourbon. He's not a fan of the woodiness nor the smokiness of Scotches, some of them anyway. He's into Basil Hayden's, Makers, that sort of flavor profile. Want to get him a decent bottle of whiskey for Christmas and found a bottle of WhistlePig 10 year Rye that can be shipped to the state where he lives. As I am much more a Scotch fan, I find myself out of my realm when it comes to this. Any suggestions on what I might look for? Thanks in advance.
nreimers/reddit_question_best_answers
{ "index": 47652159 }
reddit_qa
97reddit_qa_4
en
A requirement of the product that we are building is that its URL endpoints are semantically meaningful to users in their native language. This means that we need UTF-8 encoded URLs to support every alphabet under the sun. We would also not like to have to provide installation configuration documentation for every application server and version that we support, so it would be nice if we could accomplish this in-code. This might not be possible, since by the time that the Servlet has received the request, its been encoded by the App server, etc. I've gotten this working (for my first use case using ISO-Latin non-US ASCII characters) by reconstituting the request's path info with: ``` String pathInfoEncoded = new String(httpServletRequest.getPathInfo().getBytes(), "UTF-8"); ``` and then parsing that. However, this doesn't work after redirecting from a POST to a GET using sendRedirect(). The request's path comes in already escaped (so ö is encoded as %F6) and my method above doesn't work. So I guess my question is am I going about this all wrong? And if so, whats the antidote to my ignorance? :) Update : found the solution. The problem is that the Servlet API has some weird behaviour with regards to URL encoding before sending the redirect. You have to URL-encode (escape the UTF-8 characters) BEFORE you call sendRedirect(). The encodeRedirectURL() method doesn't do it for you. This page discusses it: <http://www.whirlycott.com/phil/2005/05/11/building-j2ee-web-applications-with-utf-8-support/>
ArmelR/stack-exchange-instruction
{ "qid": 846409 }
stackexchange
109stackexchange_5
en
In the modern context, we have many things to keep ourselves entertained and motivated to do work - music, videos, movies, games, magazines etc. According to [1 Corinthians 10:31 KJV](http://www.biblegateway.com/passage/?search=1%20Corinthians%2010:31&version=KJV) > > Whether therefore ye eat, or drink, or whatsoever ye do, do all to the glory of God. > > > It is clear that in whatever we do we will do it for the glory of God. However I really wonder how does gaming, watching video and having self-entertainment would do to glorify God.
ArmelR/stack-exchange-instruction
{ "qid": 920 }
stackexchange
108stackexchange_4
en
do you take a gift for a gender reveal?
sentence-transformers/gooaq
{ "index": 1960682 }
gooaq
46gooaq_1
en
what is the formula used to calculate acceleration?
sentence-transformers/gooaq
{ "index": 2948951 }
gooaq
47gooaq_2
en
So if I have an sql query like these: ``` SELECT title, document FROM docs WHERE id = "1" and type = "2" SELECT title FROM docs WHERE id = "1" SELECT title FROM docs WHERE member = "foo" ``` to maximize speed for the first one i. would I have to index only the keys (id and type together? seperate?) ii. would I also have to index title and document (together,separate) same type of questions apply for the second one, and for the third query i. would I have to index only member? IM just trying to understand mysql retrieval and indexing.
ArmelR/stack-exchange-instruction
{ "qid": 7102956 }
stackexchange
108stackexchange_4
en
I caught a perfect Shuckle. Does it have any use? So yesterday I caught my "gem" of this Rock event: A perfect IV Shuckle with the best defensive moveset (Stugglebug/Rock Blast). I've been told Shuckle was actually really good in the original games but I can't for the life of me figure out what to do with it in PoGo. Maybe just hope for something after the gym rework?
nreimers/reddit_question_best_answers
{ "index": 18857609 }
reddit_qa
96reddit_qa_3
en
I've looked all over for information but I just don't understand how the state by state votes are tallied during the convention. After watching the DNC broadcast tonight I was confused to see that Biden, despite losing California and Nevada's primaries to Sanders, had more votes cast for him in each state during the "roll-call." I understand that there were previously unpledged superdelegates which have since been all but abolished before this primary, so how does Biden come away with more votes in two states which he lost? The California votes tally up to 494 so that makes sense, but Biden ended up with nearly 100 more votes than he got in the primary which he lost. I assume that some votes were "given up" from the Warren campaign or whatever, and that Biden also received the remaining 79 or so unpledged delegates, but then I thought that these delegates were no longer able to vote for whoever they wanted. Anyway any information on how this works would be great. Thanks!
ArmelR/stack-exchange-instruction
{ "qid": 56450 }
stackexchange
108stackexchange_4
en
[![enter image description here](https://i.stack.imgur.com/xXQSd.jpg)](https://i.stack.imgur.com/xXQSd.jpg)How the concentric super ellipses as shown in the figure can be divided into parts containing equal area such that the total area of the superellipse *A* = *A*1 + *A*2 + ... *A*n where *n* = 60 in the shown figure given its semi-major axis *a* and semi-minor axis *b*. The origin of the sectors lies at the center of the superellipse. Any help is appreciated.
ArmelR/stack-exchange-instruction
{ "qid": 2797052 }
stackexchange
108stackexchange_4
en
are yugi and tea together?
sentence-transformers/gooaq
{ "index": 1527838 }
gooaq
46gooaq_1
en
I am confused about best practice in situation when you need throw multiple exceptions. Let say that we have exceptions declared as it is shown below. ``` public class DaoException extends Exception public class ClientNotFoundException extends DaoException public class NotUniqueResultException extends DaoException ``` Now we have а method, which can throw `ClientNotFoundException` and also `NotUniqueResultException`. What is better to be appled to the `throws` clause? ``` getClientByNumber(Long number) throws ClientNotFoundException, NotUniqueResultException ``` or ``` getClientByNumber(Long number) throws DaoException ``` ? How do you solve this situation in your code? Do you creatе your own exception hierarchy in your applications? Is there other possible way how to solve it?
ArmelR/stack-exchange-instruction
{ "qid": 26253067 }
stackexchange
108stackexchange_4
en
What if advertisers used IPs instead of URLs? Blokada works great. 100,000 trackers within one week is astonishing. But I wonder how long it takes until advertisers and tracking companies begin to actively work against such filters. Wouldn't it be possible for them to just use plain IP-adresses instead of readable address-strings? Wouldn't that render Blokada, Pie-hole and others just useless? Maybe I'm completely wrong about that, but what countermeasures could then be taken?
nreimers/reddit_question_best_answers
{ "index": 45773066 }
reddit_qa
97reddit_qa_4
en
In php 5.3, when you create an anonymous function, can you set the default values? Like in a normal functon you do > > function tim($a=123){ > > > } > > > where 123 is the default value for $a. What abut in anonymous functions? **UPDATE** I'm having trouble with it in this context: ``` //$data is an object; $data->title = 'test'; add_filter('title',function($current, $new = $data->title ){ return $new; }); ``` produces "unexpected T\_VARIABLE" works fine without the `$data->title` bit, but I really want to pass this in... ``` add_filter('title',function($current, $new = 'some-title' ){ return $new; }); ``` I'm adding a filter in Wordpress. Works fine if I explicitly set it, but I want to pull it from another variable. Is that possible?
ArmelR/stack-exchange-instruction
{ "qid": 7328843 }
stackexchange
108stackexchange_4
en
Lets talk upgrades : D So I just got my 2015 Mk7 the other week, and I'm in love. I wanna make some aesthetic and performance changes but I'm not took knowledgeable with diy stuff so I'd pay for all the work. So my question is; what type of upgrades appearance and performance can I get that won't void the warranty, and will either add to, or not lower my eventfully resale value?? I am interested in a stage 1 tune, but If I get that, will I have to put more money into other parts as well?? Any help would be awesome!
nreimers/reddit_question_best_answers
{ "index": 13333137 }
reddit_qa
97reddit_qa_4
en
Give me an introduction over 200 words for Padmini Petroplast Pvt. Ltd, a chemical company in 105, Tirupati Udyog,I. B. Patel Road, Goregaon (E), Mumbai - 400 063, India
lmsys/lmsys-chat-1m
{ "conversation_id": "59ed2067260c4cab989337e6986d57b3" }
lmsys_chat
68lmsys_chat_3
en
Aerospace Engineering Student's summer time question Why is that the airfoil on a military airplane (not fighters) is on top of the airframe and the airfoil on a commercial/civilian airplane is on the bottom of the airframe?
nreimers/reddit_question_best_answers
{ "index": 3399449 }
reddit_qa
96reddit_qa_3
en
im having an error stating "The method '[]' can't be unconditionally invoked because the receiver can be 'null'. Try making the call conditional (using '?.') or adding a null check to the target ('!')." Ive tried to add the '!' mark as stated and searching online but it doesn't resolve the issue. any ideas? ``` factory UserModel.fromSnapshot(DocumentSnapshot snapshot) { return UserModel( name: snapshot.data()["name"], email: snapshot.data()['email'], phoneNumber: snapshot.data()['phoneNumber'], uid: snapshot.data()['uid'], isOnline: snapshot.data()['isOnline'], profileUrl: snapshot.data()['profileUrl'], status: snapshot.data()['status'], designation: snapshot.data()['designation'], company: snapshot.data()['company'], ); } ```
ArmelR/stack-exchange-instruction
{ "qid": 72699462 }
stackexchange
108stackexchange_4
en
Built-in prius car heater at -20° F? Hi, I just wanted to ask if it's okay to run car heater continuously for 12 hours while the car is idle but ignition is on and in ready to drive position. I know that it will burn gas. That is okay with me. I just want to know if it will cause damage to the engine or transmission. Sorry my car knowledge is non-existent. I will need to do this every night. Run the car and the heater continuously every night for 12 hours. And as I see the weather, it will remain in the negative teens for a couple of weeks at least.
nreimers/reddit_question_best_answers
{ "index": 49795200 }
reddit_qa
97reddit_qa_4
en
Using the clone method, can we get many instances of a class which has been made singleton ? Also, is it necessary to write "implements Cloneable" because I learnt that all objects extend from Object class and hence the child object calling protected clone() on another child of Object should have no access issues
ArmelR/stack-exchange-instruction
{ "qid": 51168836 }
stackexchange
107stackexchange_3
en
what is the difference between 2d and 3d transformation?
sentence-transformers/gooaq
{ "index": 2200815 }
gooaq
47gooaq_2
en
I am studying for an interview and having trouble with this question. Basically, you have a word that has spaces in it like c\_t. You have a word bank and have to find all the possible words that can be made with the given string. So for in this case, if cat was in the word bank we would return true. Any help on solving this question (like an optimal algorithm would be appreciated). I think we can start with checking lengths of strings in the word bank and then maybe use a hashmap somehow.
ArmelR/stack-exchange-instruction
{ "qid": 33470950 }
stackexchange
108stackexchange_4
en
Years ago I had a little `#define` which I used in Borland C++ Builder. From memory, it was something *approximately* like ``` #define BREAK_IF_DEBUGGING asm(0xA3); ``` or something like that. It relied on 0XA3 (or whatever it was) being the op code for the interrupt which Borland were using to trigger a breakpoint. Can I do the same thing in Eclipse? (I'll probably wrap it in a few `#idef ECLIPSE` and `#ifdef TESTING`) What I hope to achieve here is that - the code compiles away to nothing in the release version, of course. - if I run by unit tests with Ctrl-F11 then I don't want a breakpint to be triggered (which it won't because of Ctrl-F11 being "Run") - if I "Run with Debug" using F11) then if executions hits any use of the macro then it will stop at a breakpoint. Why? Because I want to set & forget. Just put one of these in each error leg (or embed it in my `LOG_ERROR` macro). Often when I choose my initial breakpoint, it is too late, so this macro says "I think I want to run to line X, but if execution passes through one of those error branches first, I'd like to stop there & sniff around". Whether you like the idea or not, can you tell me how to do it?
ArmelR/stack-exchange-instruction
{ "qid": 2309465 }
stackexchange
109stackexchange_5
en
Even if the div condition is not satisfied it is executing the code inside div. ``` <div ng-if = "1==11"> nishant <td><a href="indexForm.jsp?id={{x.id}}" class="btn btn-primary">View Details</a></td> </div> ``` Here in the code the ng-if is not satisfied, so it need not to go through the div, but it is not printing "nishant" but executing .Kindly, help me why it is executing .
ArmelR/stack-exchange-instruction
{ "qid": 46598290 }
stackexchange
108stackexchange_4
en
My dateFromString is not working and i'm not sure why ``` NSString *purchase = @"2011-09-30 17:47:57"; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd hh:mm:ss"]; NSDate *date = [dateFormat dateFromString:purchase]; ``` date is 'invalid CFStringRef' See anything i might be overlooking?
ArmelR/stack-exchange-instruction
{ "qid": 7616416 }
stackexchange
107stackexchange_3
en
I am using ruby on rails with MongoDB. I have one field 'possession' as string type field. I've updated it as 'Integer'. Now, I want to find old data with specific string(for example, '6') and need to update all as integer values(means 6). So, instead of doing each loop on all record I will just distinct values and update\_all based on distinct values. Please let me know if anyone has idea about this.
ArmelR/stack-exchange-instruction
{ "qid": 59177420 }
stackexchange
108stackexchange_4
en
write me down a txt for a song Smells like NAME_1 spirit
lmsys/lmsys-chat-1m
{ "conversation_id": "04fb26e910134a9cb06a05714c9eb2db" }
lmsys_chat
67lmsys_chat_2
en
check how many points are on my license ga?
sentence-transformers/gooaq
{ "index": 2097200 }
gooaq
46gooaq_1
en
what are the moisturizers for oily skin?
sentence-transformers/gooaq
{ "index": 529566 }
gooaq
46gooaq_1
en
First world problems The worst part about starting a new game on any RAC game is not having the box breaker upgrade on the wrench and having to break boxes in smaller bursts like a pleb 😂 box breaker is definitely the most satisfying gadget/item.
nreimers/reddit_question_best_answers
{ "index": 53280225 }
reddit_qa
96reddit_qa_3
en
I am getting this error after using JSON data into text wigdet. My json is stored locally in > > assets/json/data.json > > > I am building a Listview using ListView.builder My code ``` Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xff655ee6), appBar: AppBar( backgroundColor: Color(0xff655ee6), title: Text("Apply Online"), ), body: SingleChildScrollView( child: SizedBox( height: MediaQuery.of(context).size.height, child: FutureBuilder( future: DefaultAssetBundle.of(context).loadString("assets/json/example.json"), builder: (context,snapshot){ var mydata = json.decode(snapshot.data.toString()); if(mydata == null){ return Center( child: CircularProgressIndicator( ), ); } else {return ListView.builder( itemCount: 30, itemBuilder: (context, index){ return Card( child: ListTile( title: Text(mydata["saarthiService"]['applyOnline']["0"]), leading: Icon(Icons.import_contacts), ), ); }, );} }, ), ), ), ); } } ``` Please Help Me and I am new to flutter Thanks
ArmelR/stack-exchange-instruction
{ "qid": 64388908 }
stackexchange
109stackexchange_5
en
What are some fun extra classes to take? After this quarter, I will only have 15 units left to graduate, so I decided to spread these 15 units across Fall 2018 and Spring 2019 semesters. I'm in no rush. If I wanted to be considered full time though, what extra classes should I take? Preferably something that requires being physically active, but I'm open to anything.
nreimers/reddit_question_best_answers
{ "index": 24717610 }
reddit_qa
96reddit_qa_3
en
are adsl and vdsl filters different?
sentence-transformers/gooaq
{ "index": 1170214 }
gooaq
46gooaq_1
en
I have a S3 bucket with versioning enabled. It is possible to undelete files, but how can I undelete folders? I know, S3 does not have folders... but how can I undelete common prefixes? Is there a possibility to undelete files recursively?
ArmelR/stack-exchange-instruction
{ "qid": 45207055 }
stackexchange
107stackexchange_3
en
Currently, if your accounts are associated there's a button to let you disassociate them. ![Clear All Associations button](https://i.stack.imgur.com/v0oSn.png) I really think we ought to kill this feature. Its pretty worthless as is and adds a lot of (error causing) complexity to account management. But first, some numbers since we all love data. On Stack Overflow, **206** users have disassociated their accounts and remained unassociated (0.1% of >1 rep users). Only 2,588 have ever disassociated their accounts. This is not a terribly popular feature. And what's the point? To hide your behavior on other sites\*? There is a lot of complexity making this possible at all, and it would be much simpler\*\* to just treat "related accounts" as associated without an explicit association step. It would also eliminate [some](https://meta.stackexchange.com/questions/88223/wordpress-account-not-showing-up-on-stackexchange) [recurring](https://meta.stackexchange.com/questions/86044/no-mathematics-account-listed-on-stackexchange-com) [issues](https://meta.stackexchange.com/questions/87731/network-profile-doesnt-list-all-accounts/87733). To be clear, I'm **not** suggesting a policy of "if you have accounts on two sites, they must be associated." Just that if you signup with the same OpenId on two sites, they would be; you would remain free to use distinct identifiers and retain distinct accounts. So, are there any good reasons for the disassociate button to remain around? Or is it finally time to kill it? \*Protip, doesn't work since moderators can see some of your "related accounts." ~~\*\*One of the grand simplifications would be being able to treat "once associate" as "always associated," which would let us kill some ugly GUIDs. Network account links, for example.~~ \*\*On further reflection, it'd actually be simpler to just always do a lookup by identifiers; so disassociation would remain possible by changing ids, but your accounts would need to actually be disjoint in terms of identifiers.
ArmelR/stack-exchange-instruction
{ "qid": 88233 }
stackexchange
109stackexchange_5
en
Last night episode of Grey's Anatomy So in last episode one of the story was about a nurse who's been very hard working and amazing at her job for a long time but she had a strict life plan that she decided to make happen with IVF. She miscarried the first time and then went again and got pregnant, she put so much money in it she said it was her last shot. She died because of pregnancy complications. The message of the episode was the sacrifice of mothers or whatever but I felt it was more of a warning than anything and a lesson to those who want so bad to have their own kids. Fucking adopt and don't die jesus
nreimers/reddit_question_best_answers
{ "index": 28692274 }
reddit_qa
97reddit_qa_4
en
A good cheap smokey bourbon? I'm on a tight budget and I'm looking for a good bourbon that is cheap but still good and has a rich, smokey taste. Thanks
nreimers/reddit_question_best_answers
{ "index": 3885219 }
reddit_qa
96reddit_qa_3
en
what does a yeast infection come from?
sentence-transformers/gooaq
{ "index": 2449466 }
gooaq
46gooaq_1
en
how much does it cost to buy domain name?
sentence-transformers/gooaq
{ "index": 176982 }
gooaq
46gooaq_1
en
Give 20 creative names for username .
lmsys/lmsys-chat-1m
{ "conversation_id": "f8e7232e1c8a40faaa107c6cdd0a4ea0" }
lmsys_chat
66lmsys_chat_1
en
TL;DR Querying data from a two table database I've setup a long time ago takes a really long time to execute. --- Back when I was a student, quite some time ago, I developed a simple survey tool for a college project. I later launched it as a free service for fellow students to use. Now, many, many years later, my survey tool still gets used by students. I kind off neglected the tool for long time until I recently tried it again and noticed it has become painstakingly slow when viewing survey results. Oops. There are much beter survey tools/services available now. However, the collected survey data is still valuable to many people I guess. I wrote it in PHP with a MySQL database. The database contains well over 6,000 different surveys. I am familiar with MySQL, but I am by no means a database expert. I certainly wasn't back then and I suspect I made some poor choices structuring the database. Depending on the number if participants to a survey, running a query to filter results from a single survey can take up to 12 seconds(!). I upgraded to a better server, but this didn't helped as much as I hoped it would. It only slightly improved the query time back from 18 to 12 seconds. Because of the required flexibility (every survey has different questions) I setup two database tables. On the main table all the fixed data gets inserted, such as unique record ID, timestamp, users IP address, ect. The second table is used insert all the answers on; one record for each answer on each question. To get all the answers the seconds table gets 'pivoted' using Case statement in the SQL query (shown below). I think this might not have been the most efficient setup, and maybe this is the reason to why filtering results is really slow. So, this is how I structured the database. The main table with fixed data (`form_submits`) ``` +--------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+--------------+------+-----+---------+----------------+ | id | bigint(20) | NO | PRI | NULL | auto_increment | | formid | mediumint(9) | NO | MUL | NULL | | | email | varchar(255) | NO | MUL | NULL | | | status | tinyint(1) | NO | | NULL | | | submit_date | int(11) | NO | | NULL | | | submit_ip | varchar(46) | NO | | NULL | | | submit_ua | text | NO | | NULL | | | confirm_date | int(11) | NO | | NULL | | | confirm_ip | varchar(46) | NO | | NULL | | | notifications_send | tinyint(4) | NO | | NULL | | | notification_last | int(11) | NO | | NULL | | +--------------------+--------------+------+-----+---------+----------------+ ``` The data table with the questions and answers (`form_submits_data`) ``` +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ | submit_id | mediumint(9) | NO | PRI | NULL | | | form_id | int(11) | NO | MUL | NULL | | | field_id | mediumint(9) | NO | PRI | NULL | | | question | text | NO | | NULL | | | answer | text | NO | | NULL | | +-----------+--------------+------+-----+---------+-------+ ``` If, for example, I want to get all the answers from participants that live in a certain postcode area this query is used: ``` SELECT fs.id, fs.email, coalesce(MAX(case when field_id = 10 then answer end), 0) as 'C10', coalesce(MAX(case when field_id = 11 then answer end), 0) as 'C11', coalesce(MAX(case when field_id = 12 then answer end), 0) as 'C12', coalesce(MAX(case when field_id = 15 then answer end), 0) as 'C15', coalesce(MAX(case when field_id = 16 then answer end), 0) as 'C16', coalesce(MAX(case when field_id = 17 then answer end), 0) as 'C17', coalesce(MAX(case when field_id = 21 then answer end), 0) as 'C21', coalesce(MAX(case when field_id = 32 then answer end), 0) as 'C32', coalesce(MAX(case when field_id = 36 then answer end), 0) as 'C36', coalesce(MAX(case when field_id = 38 then answer end), 0) as 'C38', coalesce(MAX(case when field_id = 340 then answer end), 0) as 'C340', coalesce(MAX(case when field_id = 341 then answer end), 0) as 'C341', coalesce(MAX(case when field_id = 342 then answer end), 0) as 'C342', coalesce(MAX(case when field_id = 343 then answer end), 0) as 'C343', coalesce(MAX(case when field_id = 344 then answer end), 0) as 'C344' FROM `form_submits` fs LEFT JOIN `form_submits_data` fsd ON fsd.submit_id = fs.id WHERE fs.form_id = 45023 AND fs.status = 1 GROUP BY fs.id HAVING C32 LIKE 'HA0 1AA%' ORDER BY fs.submit_date DESC ``` Which on a survey with 21,000 responses takes 12 seconds to execute. I feel this can't be right and thats this is probably because I structured the database poorly. **This makes me wonder, what should I have done differently? What setup/structure would be more efficient while retaining flexibility?**
ArmelR/stack-exchange-instruction
{ "qid": 182856 }
stackexchange
110stackexchange_6
en
I have one server with 2 databases, and i want to replicate several tables from one database to another. Purpose is that we uses same user's table that used in projects. As in anothers tables used InnoDB with foreign keys to users table i've chosen a replication way. For that I made the changes for my.cnf ``` master-user=root server-id = 2 replicate-rewrite-db = dou->jobs replicate-do-table = jobs.auth\_user replicate-wild-do-table = jobs.geo\_% replicate-do-table = jobs.user\_profile replicate-same-server-id = 1 report-host = master-is-slave binlog-do-db = dou log-bin ``` after syncing tables from `binlog-do-db` and starting slave error.log next lines appears: ``` 111112 15:10:22 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='localhost', master_port='3306', master_log_file='', master_log_pos='4'. New state master_host='localhost', master_port='3306', master_log_file='mysql-bin.000074', master_log_pos='106'. 111112 15:10:36 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000074' at position 106, relay log '/var/log/mysql/dell-relay-bin.000001' position: 4 111112 15:10:36 [Note] Slave I/O thread: connected to master 'root@localhost:3306',replication started in log 'mysql-bin.000074' at position 106 ``` Seems that on this step everything is ok, and `show slave status` shows no errors. ``` mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: root Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000074 Read_Master_Log_Pos: 814 Relay_Log_File: dell-relay-bin.000002 Relay_Log_Pos: 959 Relay_Master_Log_File: mysql-bin.000074 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: jobs.user\_profile,jobs.auth\_user Replicate_Ignore_Table: Replicate_Wild_Do_Table: jobs.geo\_% Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 814 Relay_Log_Space: 1113 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: 1 row in set (0.00 sec) ERROR: No query specified ``` The thing is that master changes does not affect slave but slave status changes. Thanks for any help in solve that problem.
ArmelR/stack-exchange-instruction
{ "qid": 8104700 }
stackexchange
110stackexchange_6
en
Ideally I want to avoid using gems, as I am currently using: `pdf-reader`, `combine-pdf` and `origami` Each gem if it comes across a damaged pdf sometimes doesn't send an exception but stays there and does nothing. So I would like you to please help me with a code to see if the file is damaged or not. I have noticed that some pdf files do not have hexadecimal `(hex 25 50 44 46 | %PDF)` but I'm afraid it's not a universal solution. Besides all those gems sometimes throw exceptions even when the pdf does work, but at least if I'm sure the pdf works, I'll know what to do. I could start there. How do I read hexadecimal with ruby? Is the only way to check a pdf?
ArmelR/stack-exchange-instruction
{ "qid": 53697619 }
stackexchange
108stackexchange_4
en
When adding a html sitemap to a site, for SEO purposes should the links it contains be locally referenced or is it better to use the full URL? Eg: ``` <ul> <li><a href="/company/about-us.html">About Us</a></li> <li><a href="/company/environmental-policy.html">Environmental Policy</a></li> <li><a href="/company/recruitment.html">Recruitment</a></li> <li><a href="/company/faqs.html">FAQs</a></li> </ul> ``` or ``` <ul> <li><a href="http://www.mydomain.com/company/about-us.html">About Us</a></li> <li><a href="http://www.mydomain.com/company/environmental-policy.html">Environmental Policy</a></li> <li><a href="http://www.mydomain.com/company/recruitment.html">Recruitment</a></li> <li><a href="http://www.mydomain.com/company/faqs.html">FAQs</a></li> </ul> ```
ArmelR/stack-exchange-instruction
{ "qid": 59584 }
stackexchange
108stackexchange_4
en
The brightness changes with the colors displayed on the screen on my Lenovo Thinkpads with Intel HD Graphics. Light colors make the screen brighter, dark make it darker. Same behavior in Windows 8.1 and 10. The "adaptive brightness" feature in Windows is disabled.
ArmelR/stack-exchange-instruction
{ "qid": 994443 }
stackexchange
107stackexchange_3
en
The PHP function `hash_algos()` gives me this list on my webserver: ``` [0] => md2 [1] => md4 [2] => md5 [3] => sha1 [4] => sha256 [5] => sha384 [6] => sha512 [7] => ripemd128 [8] => ripemd160 [9] => ripemd256 [10] => ripemd320 [11] => whirlpool [12] => tiger128,3 [13] => tiger160,3 [14] => tiger192,3 [15] => tiger128,4 [16] => tiger160,4 [17] => tiger192,4 [18] => snefru [19] => gost [20] => adler32 [21] => crc32 [22] => crc32b [23] => haval128,3 [24] => haval160,3 [25] => haval192,3 [26] => haval224,3 [27] => haval256,3 [28] => haval128,4 [29] => haval160,4 [30] => haval192,4 [31] => haval224,4 [32] => haval256,4 [33] => haval128,5 [34] => haval160,5 [35] => haval192,5 [36] => haval224,5 [37] => haval256,5 ``` Which ones should I use for what and why? Especially, which one should I use for password hashing?
ArmelR/stack-exchange-instruction
{ "qid": 3791283 }
stackexchange
108stackexchange_4
en
Please let me know how to make an image appear at a centre point. Let me elaborate. I have a custom image on MapPin but the image seems to be something like this ![enter image description here](https://i.stack.imgur.com/cVSw1.png) If you closely look at it, the pin falls on the correct lat and long but the centre of the the image that is the rounded part falls on the lat and long.Due to which the lat long seems to be at a different position.(See the pin base). But what we want instead is the pin base to fall on the position (Lat and Long). Something like this.. (Refer the second image) Please don't tell me to change the height and width of the image as there are 300 of images. Unless and until that is the only option or probably i can change it programmatically. Please help with this pathetic issue. Thank You Pals. ![enter image description here](https://i.stack.imgur.com/243rd.png)
ArmelR/stack-exchange-instruction
{ "qid": 19763490 }
stackexchange
108stackexchange_4
en
In products table I have fields like ``` id product_name product_value quantity status 1 abc 10000 50 received 2 efg 5000 15 shipment 3 hij 850 100 received 4 klm 7000 20 shipment 5 nop 350 50 received ``` I can select multiple rows at a time. And here I selected `id=2,4` and need to change the `status='received'`. How to do multiple update at single time in rails?
ArmelR/stack-exchange-instruction
{ "qid": 54864521 }
stackexchange
108stackexchange_4
en
I have created a for loop to limit my list to only show last 10 search results but can't seem to shift() index[0] of the object array off so earliest results are deleted and latest results are at the end of the array: ```js for (let i = 0; i < searchHistory.length; i++) { if (searchHistory.length > 10) { console.log(searchHistory[i]); searchHistory[i].shift(); } } ``` The console.log of searchHistory = [Object Array](https://i.stack.imgur.com/2c1bk.png) The console.log of searchHistory[i] = [Console Log](https://i.stack.imgur.com/mcWvQ.png)
ArmelR/stack-exchange-instruction
{ "qid": 65699612 }
stackexchange
108stackexchange_4
en
I am trying to build a JAR file out of a spring project. When I try to do a maven install, it throws me the following error ``` Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project ABC: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to rename 'ABC-0.0.1-SNAPSHOT.jar' to 'ABC-0.0.1-SNAPSHOT.jar.original' -> ``` The 'pom' file is as shown below ``` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ABC</groupId> <artifactId>ABC</artifactId> <version>0.0.1-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-configuration2</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>5.0.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>5.0.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>1.5.9.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>1.5.9.RELEASE</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <!--$NO-MVN-MAN-VER$--> <scope>provided</scope> </dependency> </dependencies> ``` The build part of the pom file is as shown below ``` <build> <sourceDirectory>src</sourceDirectory> <plugins> <!-- Set a compiler level --> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <!--$NO-MVN-MAN-VER$--> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <!-- For Generating the Jar File --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>ABCapp</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> <!-- Generating jar file which has Spring boot application --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <mainClass>${start-class}</mainClass> <layout>JAR</layout> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> ``` I tried to look in SO and other forums for a possible solution. But none of them worked. Any pointers as to where the problem might be ?
ArmelR/stack-exchange-instruction
{ "qid": 48900700 }
stackexchange
110stackexchange_6
en
I want to convert my system date with yyyy-MM-dd date format and assign to another date my code is: ``` NSDate *datenow = [NSDate date]; NSDateFormatter *df = [[NSDateFormatter alloc]init]; [df setDateFormat:@"yyyy-MM-dd"]; currDate = [df stringFromDate:datenow]; NSLog(@"currDate ====%@",currDate); [df setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]]; [df setDateFormat:@"yyyy-MM-dd"]; NSDate *compareDate = [df dateFromString:currDate]; NSLog(@"compareDate ====%@",compareDate); ``` NSLog prints like this currDate ====2014-05-10 compareDate ====2014-05-10 00:00:00 +0000 I want remove 00:00:00 +0000 in the compare date. How to do it. please help me it's killing my time.
ArmelR/stack-exchange-instruction
{ "qid": 23577967 }
stackexchange
108stackexchange_4
en
Found a girl on tinder that actually wants to meet up, how should I proceed? Been texting one night, then I suggested that we should meet up tomorrow - she agreed. We talked alot about sex, and i don't want to get catfished. How do I actually proceed fucking her on the first date? she's probably willing if we hit it off. She told me that we could probably fuck on the second date if everything goes well, but who has time for that shit? We're going out for a drink, and then should I ask her if she wants to come over for a "movie"? Or is that too obvious? What is my course of action after establishing a connection and a willingness for a meetup/hookup? And of course, I'll wrap it up.. she's probably a slut lol
nreimers/reddit_question_best_answers
{ "index": 7679389 }
reddit_qa
97reddit_qa_4
en
Fiat withdrawal - status “finished” but did not recieve funds I went for SEPA transfer. Took a day. It says the transfer is finished but I dont see funds on my bank account. Is it normal? do I have to wait some more for the bank to process it or something?
nreimers/reddit_question_best_answers
{ "index": 53195417 }
reddit_qa
96reddit_qa_3
en
Been using Logic Pro X for years just got FL Studio as a gift how could I use them together (to make loops and beats)? After I downloaded FL I opened Logic and noticed there was a new plugin from Imagine-Line called FL Rewire which is essentially FL studio program wired through a Logic instrument track and I dont really know how I can use them together.
nreimers/reddit_question_best_answers
{ "index": 40570966 }
reddit_qa
96reddit_qa_3
en
I'm hoping someone can help me since I am new at VBA. I have a spreadsheet with 200 command buttons on it. I want to be able to change the backcolor of a button based on the value in a cell. The names for the 200 buttons are FACopy1 through FACopy200. The code below works for changing a specific button (in this case FACopy1). ``` ActiveSheet.FACopy1.BackColor = RGB(0, 255, 255) ``` However, I want the button that changes to be based on a cell value. For example, If the cell value is 7 then it will change the color of FACopy7. I want something like this: ``` ActiveSheet.FACopy(cell value).BackColor = RGB(0, 255, 255) ``` Does anyone have any ideas on how to do this?
ArmelR/stack-exchange-instruction
{ "qid": 63892609 }
stackexchange
108stackexchange_4
en
I am trying to open a public company page on Linkedin using [Puppeteer](https://github.com/puppeteer/puppeteer), but every time it is redirected to an authentication form. This does not happen when I manually paste the URL in Chromium or in Chrome. This is the code: ```js const puppeteer = require("puppeteer"); (async () => { const url = "https://www.linkedin.com/company/google/"; const browser = await puppeteer.launch({ headless: false, args: [ "--lang=en-GB", "--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu", "--disable-dev-shm-usage", ], defaultViewport: null, pipe: true, slowMo: 30, }); const page = await browser.newPage(); await page.goto(url, { waitUntil: 'networkidle0', }); await page.waitForSelector(".top-card-layout__entity-info-container", { timeout: 10000 }); await page.close(); await browser.close(); })(); ``` This is where the browser is redirected: [![enter image description here](https://i.stack.imgur.com/rTuu0.png)](https://i.stack.imgur.com/rTuu0.png) This does not happen if I manually paste the URL `https://www.linkedin.com/company/google/` in Chromium or Chrome. What I have tried so far: * Use an `incognito` browser context: ```js // [...] const context = await browser.createIncognitoBrowserContext(); const page = await context.newPage(); // [...] ``` * Use [puppeteer-extra-plugin-stealth](https://www.npmjs.com/package/puppeteer-extra-plugin-stealth) to avoid being detected as bot: ```js const puppeteer = require("puppeteer-extra"); puppeteer.use(require("puppeteer-extra-plugin-stealth")()); // [...] ``` * [Random user agent](https://www.npmjs.com/package/random-useragent) ```js const randomUserAgent = require("random-useragent"); // [...] await page.setUserAgent(randomUserAgent.getRandom()); // [...] ``` Nothing has worked. Is there anything else I can try?
ArmelR/stack-exchange-instruction
{ "qid": 63660406 }
stackexchange
109stackexchange_5
en
what's the strongest D&amp;D monster the Predator could defeat? **The setup** will have all the weaponry and feats of the first two movies predators, all fights will take place whatever type of terrain the monster dwells in. all feats for thee D&amp;D monsters will be based on lore from Planescape and forgotten realms settings unless otherwise stated. **Bonus challenge** Could the Predator defeat Tucker's Kobolds?
nreimers/reddit_question_best_answers
{ "index": 53170597 }
reddit_qa
97reddit_qa_4
en
I am working with WPF and the MVVM Light framework. In my project I have a `GameViewModel` and an associated view for it that acts as the main screen of my game (this is not my main ViewModel). Within the GameView, I would like to dynamically display other UserControls, triggered by button clicks or something of that nature, at a certain location within the grid. I'm not entirely sure how to go about this. I thought about using a secondary ViewModelLocator or something similar (which I wouldn't be sure how to go about doing at all), but before I dove into that I thought I'd ask here and see if there are any more practical ways to do this. Say a button is clicked, UserControl1 is displayed at 3, 3 on the grid, then another button is clicked and UserControl2 is displayed at the same location. This is essentially what I'm trying to accomplish. While it is not imperative, I would like to use as much XAML and as little code-behind as possible, but anything that gets the job done in an MVVM-friendly manner will work perfectly fine for me. Any advice that you could give would be greatly appreciated. I'm guessing the solution is probably a lot easier than I'm making it out to be... it usually is.
ArmelR/stack-exchange-instruction
{ "qid": 17055245 }
stackexchange
109stackexchange_5
en
I'm making a WebExtension for Chrome and Firefox that adds more information to GitHub. It's supposed to be faster than existing extensions. I have my manifest set up like Mozilla's documentation recommends. ``` { "manifest_version": 2, "name": "GitHub Extended", "version": "0.0.1", "description": "Adds information to GitHub normally accessible only by the API.", "permissions": [ "https://github.com/*" ], "content_scripts": [ { "all_frames": true, "run_at": "document_start", "matches": [ "https://github.com/*" ], "js": [ "source/github.js", "source/repository.js" ] } ] } ``` When the page is loaded, the content scripts are injected. The file `github.js` is a light wrapper around GitHub's API, and `repository.js` is the code to modfy the DOM of the main repository root page. The most important code in there is this the preloader, which makes an API request while the page is loading and waits for both events to complete before adding to the DOM. While this [current code](https://github.com/spikespaz/github-extended) works fine in Chrome, in Firefox it simply does nothing. I tried testing it by putting `console.log("I'm loaded!");` in `repository.js`. Nothing is printed. Why is this code not working in Firefox? ``` function beginPreload() { console.log("Test from preload scope!"); let urlMatch = window.location.pathname.match(/\/([\w-]+)\/([\w-]+)/); console.log(urlMatch); Promise.all([ getSortedReleases(urlMatch[1], urlMatch[2]), documentReady() ]).then((values) => { let releaseJson = values[0]; let actionsEl = document.getElementsByClassName("pagehead-actions")[0]; let dlCount = 0; for (release of releaseJson) for (asset of release.assets) dlCount += asset.download_count; let buttonEl = createDownloadButton( releaseJson[0].html_url, window.location.pathname + "/releases", formatNum(dlCount) ); actionsEl.appendChild(buttonEl); }); } beginPreload(); console.log("Test from global scope!"); ```
ArmelR/stack-exchange-instruction
{ "qid": 52476811 }
stackexchange
109stackexchange_5
en
I am looking for something similar to `Promise.all` that will continue to resolve promises concurrently even in the event that one or more of the promises reject or throw an error. Each request does not rely on another request. **Close to what I want - please see comments** ``` function fetchRequest (request) { return new Promise(function (resolve, reject) { fetch(request) .then(function(response) { return response.text(); }).then(function (responseXML) { //Do something here. Maybe add data to dom resolve(responseXML); }).catch(function (err) { reject(new Error(err)); } } function promiseRequests (requests) { var result = Promise.resolve(); for (var i = 0; i < requests.length; i++) { result = fetchRequest(requests[i]) } //This is wrong as it will resolve when the last promise in the requests array resolves // - not when all requests resolve resolve(result); } promiseRequests(['url1.com', 'url2.com']).then(function (data) { console.log('All requests finished'); //optionally have data be an array of resolved and rejected promises }); ``` I have succeeding in using `Promise.all` together with only ever resolving the fetchRequest promise and this results in the expected outcome (an array of results and `undefined`'s) but I feel like this is the wrong way to do things. It also removes my ability to use thrown errors. **Works but feels like incorrect use of resolve** ``` function fetchRequest (request) { return new Promise(function (resolve, reject) { fetch(request) .then(function(response) { return response.text(); }).then(function (responseXML) { resolve(responseXML); }).catch(function (err) { resolve(); } } Promise.all([fetchRequest('url1.com'), fetchRequest('url2.com')]).then(function (data) { console.log('All requests finished', data); //data could be ['resultXML', undefined] }); ``` Please only native es6 promise API answers thanks.
ArmelR/stack-exchange-instruction
{ "qid": 30930298 }
stackexchange
109stackexchange_5
en
Im young and my spine hurts a lot, on a daily basis, is there something wrong? i also do lots of martialarts and sports. This may sound weird but i think this started when i went on a rollar coaster and it went on a bumpy part and i jumped a bit and i just felt a little bit of pain. I dont know if its possible though. I also crack my back a lot. Im 15 years old
lavita/medical-qa-datasets(chatdoctor_healthcaremagic)
{ "index": 105281 }
healthcaremagic
50healthcaremagic_3
en
I want to get the key, value of the recorderEndpoint from the object. presenter[6] outputs undefined ``` presenter = { id : sessionId, pipeline : null, webRtcEndpoint : null, presenterRoomNum : roomNum, roomName : presenterRoomName, presenterId : presenterId, recorderEndpoint : {uri: argv.file_uri} } ``` I want these results. {recorderEndpoint : {uri: argv.file\_uri}} What should I do?
ArmelR/stack-exchange-instruction
{ "qid": 55710075 }
stackexchange
108stackexchange_4
en
are ipad pros good for photo editing?
sentence-transformers/gooaq
{ "index": 2820963 }
gooaq
46gooaq_1
en
Is it worth going to the listing agent? Just wondering what are people thoughts on going to the listing agent instead of getting my own. I am not a first time buyer so I am confident to navigate through this myself
nreimers/reddit_question_best_answers
{ "index": 52145743 }
reddit_qa
96reddit_qa_3
en
Serious question, but does the average Bruneian like the Sultan? I'm not a Bruneian myself, so I'm just curious. But Brunei isn't exactly the most wealthy country in the world, yet its (absolute) monarch is one of the richest men in the world. Doesn't this make a lot of people frustrated? Angry? &amp;#x200B; I mean, sure he can be a monarch, but his lavish life and clear cut hedonism would make me angry if I were a Bruneian. Again, not looking to start a fire or anything, just wondering what peoples thoughts are.
nreimers/reddit_question_best_answers
{ "index": 46249391 }
reddit_qa
97reddit_qa_4
en
I'm using Firefox(version 12) on Windows 7. I have disabled trimming URLs via `about:config` setting: ``` browser.urlbar.trimURLs ``` i.e., the above key is set to `false` If I close the browser, open it and go to a URL on a page, and point the mouse to it, it still shows it trimmed (i.e. when I move the mouse to the URL, but do not click yet, and look below the page, where the URL is displayed in the little box that comes up, the tooltip style box). I'd like to see the full URL in the tooltip box there. I see something like `http:/abs.../file.htm` notice the dots in the name. It shortened it. Even though the URL is not large and can fit in the window, it still trims it by putting these dots. What else can I do so that Firefox does not trim the URL?
ArmelR/stack-exchange-instruction
{ "qid": 422033 }
stackexchange
108stackexchange_4
en
Is there local multiplayer competitive? I assume there is, but I just want to make sure. Score duel or whatever it's called, I can't quite remember.
nreimers/reddit_question_best_answers
{ "index": 10626084 }
reddit_qa
96reddit_qa_3
en
do augers work in rocky soil?
sentence-transformers/gooaq
{ "index": 1883882 }
gooaq
46gooaq_1
en
My neurologist told me something interesting at my recent appointment. Since the addition of a third medication I have been seizure free, which makes me feel like a normal person again. It was my year follow up, and he mentioned compared to the first time he saw me, I seemed more clear mentally. He said patients who manage to get their seizures under control seem to have a different, more clear energy to them. I'm still depressed and not particularly "there" mentally, but since I don't have my brain frying once a month, my mind does feel a little more clear, even compared to between clusters.
nreimers/reddit_question_best_answers
{ "index": 45150725 }
reddit_qa
97reddit_qa_4
en
I had been trying to get the tag name and its value in java script. The xml file which I use looks like below: ``` <root> <note> <to>Gil</to> <from> <firstname>john</firstname> <lastname>corner</lastname> </from> <heading>Reminder</heading> </note> <note> <to>Mary</to> <from> <firstname>Clara</firstname> <lastname>Diana</lastname> </from> <heading> How are you </heading> </note> </root> ``` I would like the output to be as below: ``` TageName : root Attribute: 0 Text: null TageName : note Attribute: 0 Text: null TageName : to Attribute: 0 Text: Gil TageName : from Attribute: 0 Text: null TageName : firstname Attribute: 0 Text: john TageName : lastname Attribute: 0 Text: corner TageName : heading Attribute: 0 Text: Reminder TageName : note Attribute: 0 Text: null TageName : to Attribute: 0 Text: Mary TageName : from Attribute: 0 Text: null TageName : firstname Attribute: 0 Text: Clara TageName : lastname Attribute: 0 Text: Diana TageName : heading Attribute: 0 Text: How are you ``` Is this possible. If so, please help me...
ArmelR/stack-exchange-instruction
{ "qid": 11294690 }
stackexchange
109stackexchange_5
en
Best running/shoe store in Tampa? I am not a runner, but I have heard running stores tend to be the best for expert advice on shoe fit. I am in desperate need of new shoes. I tried the New Balance stores but didn't find anything I loved or felt comfortable. I have also ordered some of the past shoes I have worn off Zappos, but the new models didn't work either. I know there is one in International Mall, but I didn't know if there were any others.
nreimers/reddit_question_best_answers
{ "index": 3672234 }
reddit_qa
97reddit_qa_4
en
Please show me an example code on how to set image as wallpaper using Android WallpaperManager. I have shortened and edited my question. Hopefully you guys could understand my question. I will show some attempts I have made. HomeActivity.class ``` public class HomeActivity extends BaseActivity { String[] imageUrls; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_home); ArrayList<String> url = new ArrayList<String>(); try { URL url_link = new URL("http://mywebsite.net/web/thumb.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url_link.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("list"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); Element fstElmnt = (Element)node; NodeList nameList = fstElmnt.getElementsByTagName("thumb_url"); Element nameElement = (Element)nameList.item(0); nameList = nameElement.getChildNodes(); url.add(nameList.item(0).getNodeValue()); } imageUrls = (String[]) url.toArray(new String[0]); } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } } public void onImageGridClick(View view) { Intent intent = new Intent(this, ImageGridActivity.class); intent.putExtra(Extra.IMAGES, imageUrls); startActivity(intent); } public void onImagePagerClick(View view) { Intent intent = new Intent(this, ImagePagerActivity.class); intent.putExtra(Extra.IMAGES, imageUrls); startActivity(intent); } } ``` ImagePagerActivity.class ``` package com.nostra13.example.universalimageloader; import java.io.IOException; import android.app.WallpaperManager; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.assist.FailReason; import com.nostra13.universalimageloader.core.assist.ImageLoadingListener; import com.nostra13.universalimageloader.core.assist.ImageScaleType; public class ImagePagerActivity extends BaseActivity { private ViewPager pager; private DisplayImageOptions options; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_image_pager); Bundle bundle = getIntent().getExtras(); String[] imageUrls = bundle.getStringArray(Extra.IMAGES); int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0); options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.image_for_empty_url) .cacheOnDisc() .imageScaleType(ImageScaleType.EXACT) .build(); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new ImagePagerAdapter(imageUrls)); pager.setCurrentItem(pagerPosition); } public void setWallpaper() { WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); try { myWallpaperManager.setResource(R.id.pager); // nothing happened } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.item_clear_memory_cache: imageLoader.clearMemoryCache(); return true; case R.id.item_clear_disc_cache: setWallpaper(); return true; default: return false; } } @Override protected void onStop() { imageLoader.stop(); super.onStop(); } private class ImagePagerAdapter extends PagerAdapter { private String[] images; private LayoutInflater inflater; ImagePagerAdapter(String[] images) { this.images = images; inflater = getLayoutInflater(); } @Override public void destroyItem(View container, int position, Object object) { ((ViewPager) container).removeView((View) object); } @Override public void finishUpdate(View container) { } @Override public int getCount() { return images.length; } @Override public Object instantiateItem(View view, int position) { final View imageLayout = inflater.inflate(R.layout.item_pager_image, null); final ImageView imageView = (ImageView) imageLayout.findViewById(R.id.image); final ProgressBar spinner = (ProgressBar) imageLayout.findViewById(R.id.loading); imageLoader.displayImage(images[position], imageView, options, new ImageLoadingListener() { public void onLoadingStarted() { spinner.setVisibility(View.VISIBLE); } public void onLoadingFailed(FailReason failReason) { String message = null; switch (failReason) { case IO_ERROR: message = "Input/Output error"; break; case OUT_OF_MEMORY: message = "Out Of Memory error"; break; case UNKNOWN: message = "Unknown error"; break; } Toast.makeText(ImagePagerActivity.this, message, Toast.LENGTH_SHORT).show(); spinner.setVisibility(View.GONE); imageView.setImageResource(android.R.drawable.ic_delete); } public void onLoadingComplete(Bitmap loadedImage) { spinner.setVisibility(View.GONE); Animation anim = AnimationUtils.loadAnimation(ImagePagerActivity.this, R.anim.fade_in); imageView.setAnimation(anim); anim.start(); } public void onLoadingCancelled() { // Do nothing } }); ((ViewPager) view).addView(imageLayout, 0); return imageLayout; } @Override public boolean isViewFromObject(View view, Object object) { return view.equals(object); } @Override public void restoreState(Parcelable state, ClassLoader loader) { } @Override public Parcelable saveState() { return null; } @Override public void startUpdate(View container) { } } } ``` 1st Attempt (My `pagerPosition` is giving error "pagerPosition cannot be resolved to a variable") ``` public void setWallpaper(){ Bitmap bitmap = BitmapFactory.decodeResource(getResources(), pagerPosition); try { ImagePagerActivity.this.setWallpaper(bitmap); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.d("Gallery Example", "Image setted."); } ``` 2nd Attempt (My pagerPosition is giving error "pagerPosition cannot be resolved to a variable") ``` public void setWallpaper() { try { File file = new File("/sdcard/sampleimage"); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), pagerPosition); bitmap.compress(CompressFormat.JPEG, 80, new FileOutputStream(file)); Context context = this.getBaseContext(); context.setWallpaper(bitmap); Toast.makeText(getApplicationContext(), "Wallpaper has been set", Toast.LENGTH_SHORT).show(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.set_wallpaper: setWallpaper(); return true; default: return false; } } ``` 3rd Attempt (My setResource(R.id.pager) is not getting the image from the viewpager. ``` public void setWallpaper() { WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); try { myWallpaperManager.setResource(R.id.pager); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } ``` Conclusion If i put the below codes above my `onCreate` my whole project will not run. ``` Bundle bundle = getIntent().getExtras(); String[] imageUrls = bundle.getStringArray(Extra.IMAGES); final int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0); ```
ArmelR/stack-exchange-instruction
{ "qid": 11938182 }
stackexchange
111stackexchange_7
en
I am building a "Campground" site using Hibernate and Spring MVC. I have a "Campground" page that shows the details of a campground and user submitted comments. There is an "edit" button that can be used to edit the details of a `Comment`. This button sends you to a form (Spring form) where you can change the information and then the changes submitted are saved to the object then saved to the database using Hibernate. Here is the issue. Somethings in the Hibernate Entity `Comment.java` are Objects retrieved from other tables in the database and Hibernate handles retrieving those objects using its Hibernate Magic. The problem is that these fields in the Entity class come back `null` when retrieved from the Spring `Model` (after submission of the form). This makes updating the object using a form a challenge. Fields like the `author` of type `User`, the `Campground` that it is associated with are all null. Is there a way to instruct Spring to not null out these fields when the results of the form are sent back? I found a way to avoid the id for the comment to not be nulled out using ` but it throws an exception when this is attempted on objects. One solution I did come up with is to just update the `author` and `campground` field on the `Comment` object in my `@PostMapping` after the form is submitted, but that requires retrieving those objects from the database which seems redundant if there is a way to just not null them out in the first place. It feels like a band-aid when I may be overlooking a legitimate solution. Below is the `Entity` classes in question along with the form to edit the `Comment`, and my Contoller. `Comment Entity class` ``` @Entity @Table(name = "comments") public class Comment { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; @Column(name = "text") private String text; @ManyToOne @JoinColumn(name = "author") private User author; @ManyToOne @JoinColumn(name = "campground") private Campground campground; public Comment() { } public Comment(String text, User author) { this.text = text; this.author = author; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public User getAuthor() { return author; } public void setAuthor(User author) { this.author = author; } public Campground getCampground() { return campground; } public void setCampground(Campground campground) { this.campground = campground; } @Override public String toString() { return "Comment{" + "id=" + id + ", text='" + text + '\'' + ", author=" + author + ", campground=" + campground + '}'; } } ``` `@RequestMapping` from `Controller class` ``` @GetMapping("/campgrounds/{campgroundId}/comments/{commentId}/edit") public String editComment(@PathVariable Long commentId, @PathVariable Long campgroundId, Model model, HttpSession session) { User user = (User) session.getAttribute("user"); Comment comment = commentDAO.getComment(commentId); if (!user.equals(comment.getAuthor())) { return "redirect:/campgrounds/" + campgroundId; } model.addAttribute("editComment", comment); return "editComment"; } @PostMapping("/campgrounds/{campgroundId}/comments/{commentId}/edit") public String editPostComment(@ModelAttribute("editComment") Comment comment, @PathVariable Long campgroundId, @PathVariable Long commentId, HttpSession session) { User author = (User) session.getAttribute("user"); comment.setAuthor(author); // because it comes back null Campground campground = campgroundDAO.getCampgound(campgroundId); comment.setCampground(campground); // because it comes back null commentDAO.saveComment(comment); return "redirect:/campgrounds/" + campgroundId; } ``` Finally the `editComment.jsp` ``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ include file="partials/header.jsp"%> <div class="container mx-auto my-3"> <spring:form modelAttribute="editComment" action="${pageContext.request.contextPath}/campgrounds/${campgroundId}/comments/${commentId}/edit" method="post"> <div class="card border-info"> <h3 class="h3 text-center card-header badge-info">Edit Comment</h3> <div class="my-3"> <spring:hidden path="id"/> <div class="form-group col-5 m-auto"> <label for="comment_text">Comment Text</label> <spring:textarea id="comment_text" path="text" cssClass="form-control"/> </div> <input class="btn btn-primary form-control mt-3" type="submit" value="Submit"> </div> </div> </spring:form> </div> <%@ include file="partials/footer.jsp"%> ```
ArmelR/stack-exchange-instruction
{ "qid": 61741057 }
stackexchange
110stackexchange_6
en
In the C++ standard libraries I found only a floating point log method. Now I use log to find the level of an index in a binary tree ( `floor(2log(index))` ). Code (C++): ``` int targetlevel = int(log(index)/log(2)); ``` I am afraid that for some of the edge elements (the elements with value 2^n) log will return n-1.999999999999 instead of n.0. Is this fear correct? How can I modify my statement so that it always will return a correct answer?
ArmelR/stack-exchange-instruction
{ "qid": 994593 }
stackexchange
108stackexchange_4
en
what is the difference between vizio v series and e series?
sentence-transformers/gooaq
{ "index": 2281267 }
gooaq
47gooaq_2
en
What is the way to debunk this Arabic poem? Implying Thumma does not denote a sequence?  قل لمن ساد ثم ساد أبوه ثم قد ساد قبل ذلك جده Thanks in advance! Do Lane's Lexicon and Lisan Alarab imply the words always denote a sequence?
nreimers/reddit_question_best_answers
{ "index": 25712335 }
reddit_qa
96reddit_qa_3
en
how to know that you're blocked on whatsapp?
sentence-transformers/gooaq
{ "index": 22071 }
gooaq
46gooaq_1