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 | Name 4 ways that the madrigal genre influenced the development of Italian opera in the early 1600s. | cmalaviya/expertqa | {
"example_id": 1064
} | expertqa | 34expertqa_2
|
en | Basically, I want to show an overlay div that covers everything on the page, including the scroll-bars.
Is it possible for a fixed element to appear above the page's scroll-bars ? I tried setting the z-index of the scroll-bars to -1, but apparently doesn't work. | ArmelR/stack-exchange-instruction | {
"qid": 16365320
} | stackexchange | 107stackexchange_3
|
en | I'm trying to create a chrome extension that clicks a button on a website using the DOM.click() method. (<https://www.w3schools.com/jsref/met_html_click.asp>)
EDIT: The purpose of this chrome extension is to create a keyboard shortcut to toggle on/off English Subtitles while watching a foreign language video. Having to use your mouse and dragging it to open a menu to turn on subtitles when you need them can be inconvenient if you are trying to understand the language without the subtitles. I wanted to create a keyboard shortcut that would immediately turn on the subtitles. An example of such a website is
(<https://www.ondemandkorea.com/ask-us-anything-e102.html>)
```
<button type="button" class="jw-reset jw-settings-content-item" role="menuitemradio" aria-checked="false">English</button>
```
This is button on the website I'm trying to click with Javascript
In my code, I have a window listener that waits for the specific website to load. Then, to find the button I want to click, I call *document.getElementsByClassName("Class Name")* and look through the returned elements array for a button that that says *English* and save it into *var englishButton*. I add another listener that listens for a keyboard key to be pressed which in turn presses *englishButton*.
However, when I click the shortcutKey, *englishButton.click();* doesn't seem to do anything. I know that the correct English Button is found and that my shortcutKey Listener works through the use of *console.log()* statements.
I can't seem to understand why the button won't click.
EDIT: After adding a buttonListener to the code, the English button does click after all, but it does not turn on the subtitles for the video
Here's my code.
```
/*
Looking for the subtitle button that states "English"
*/
var englishButton;
window.addEventListener("load", function(event) {
var buttonList = document.getElementsByClassName('jw-reset jw-settings-content-item');
for (var i = 0, len = buttonList.length; i < len; i++){
if(buttonList[i].textContent === "English") {
englishButton = buttonList[i];
break;
}
}
englishButton.addEventListener('click', function() {
console.log('englishButton clicked!');
});
/*
Event Listener that detects when the shortcut key is hit.
When the shortcut Key is hit. It will simulate a mouse click on the subtitle button
*/
document.addEventListener('keyup', function(e){
if(e.key === shortcutKey){
console.log('shortcut pressed')
englishButton.click();
}
}
);
});
``` | ArmelR/stack-exchange-instruction | {
"qid": 53509905
} | stackexchange | 109stackexchange_5
|
en | >
> **Question:**
> Let $\vec u,\vec v$ and $\vec w$ be vectors in $\Bbb R^n$. Suppose that $\vec u,\vec v, \vec w$ are linearly independent. Show that $\vec u+\vec v$, $\vec u-3\vec w$ and $2\vec v-3\vec w$ are linearly independent.
>
>
>
I understand that if a vectors are linear independent if the equation
$$a\_1\vec v\_1 + a\_2\vec v\_2 + \cdots + a\_k\vec v\_k = 0$$
so when
$$a\_1 = a\_2 = \cdots= a\_k = 0.$$
I just don't understand how to explain, any help would be appreciated, thanks guys! | ArmelR/stack-exchange-instruction | {
"qid": 2953447
} | stackexchange | 108stackexchange_4
|
en | According to Wikipedia, the US radar station [SCR-270](https://en.wikipedia.org/wiki/SCR-270) picked up the Japanese approach and reported it, but this report was ignored as the duty officer, who believed the sighting to be [American bombers coming from California](https://en.wikipedia.org/wiki/Attack_on_Pearl_Harbor). It also states that SCR-270 was still in training mode. So far, everything is clear in this specific case but, looking at the bigger picture, I can't find a reason or reasons why. The article [SCR-270](https://en.wikipedia.org/wiki/SCR-270) goes on to state:
>
> Despite the high level attention and the excellence of the school in training on the use of the SCR-270 and its integration and coordination with fighter intercepts, the army did not follow through on supporting the junior officers who were trained at this session
>
>
>
Further, Wikipedia states that:
>
> Except in rare cases, there was little interest in assisting or even cooperating with the goal of setting up the air defense system.
>
>
>
The British had already demonstrated the value of radar, and shared both that knowledge and the specific technology they were using with the US.
Aside from the tendency of some people to ignore things they don't understand (which appears to have been the case with some army officers, though this may be hard to prove), are there any specific reasons why this 'high level attention' was not properly followed up on? | ArmelR/stack-exchange-instruction | {
"qid": 40133
} | stackexchange | 109stackexchange_5
|
en | I'm trying to add a link at the bottom of google's home page using javascript and greasemonkey in firefox, but I can't make it work:
```
// ==UserScript==
// @name testing greasemonkey
// @include http://*google.com/
// ==/UserScript==
document.write('<a href="http://bing.com">Go to Bing</a> ');
```
Can anyone help me? | ArmelR/stack-exchange-instruction | {
"qid": 5994756
} | stackexchange | 107stackexchange_3
|
en | I am working on a program that downloads images from a URL to a bitmapimageand displays it. Next I try to save the bitmapimage to the harddrive using jpegbitmapencoder. The file is successfully created but the actual jpeg image is empty or 1 black pixel.
```
public Guid SavePhoto(string istrImagePath)
{
ImagePath = istrImagePath;
BitmapImage objImage = new BitmapImage(
new Uri(istrImagePath, UriKind.RelativeOrAbsolute));
PictureDisplayed.Source = objImage;
savedCreationObject = objImage;
Guid photoID = System.Guid.NewGuid();
string photolocation = photoID.ToString() + ".jpg"; //file name
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(objImage));
using (FileStream filestream = new FileStream(photolocation, FileMode.Create))
{
encoder.Save(filestream);
}
return photoID;
}
```
This is the function that saves and displays the photo. The photo is displayed correctly but again when it is saved I get an empty jpeg or 1 black pixel. | ArmelR/stack-exchange-instruction | {
"qid": 4161359
} | stackexchange | 108stackexchange_4
|
en | Expand invitational? should the invitational be expanded to 32 teams ? It has the largest prize pool and garners the most attention, so shouldn’t more teams able to compete for this prize. | nreimers/reddit_question_best_answers | {
"index": 37691736
} | reddit_qa | 96reddit_qa_3
|
en | I have more than a half pound of chopped liver - what to do with it? Bought a deli special that included 1lb of chopped liver and we have a lot leftover. What should I do with it? should I freeze it or should I incorporate it into other recipes? I have no idea where to start! | nreimers/reddit_question_best_answers | {
"index": 6932031
} | reddit_qa | 96reddit_qa_3
|
en | How do I properly create a function within a function prototype?
What I have is this:
```
<body>
<p id="demo"></p><script>
function person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
}
person.prototype.name = function() {
return {
myFunc: function() {
this.firstName + " " + this.lastName;
}
}
};
var myFather = new person("John", "Doe", 50, "blue");
document.getElementById("demo").innerHTML =
"My father is " + myFather.name().myFunc;
</script>
</body>
```
When I run this it returns "My father is function () { this.firstName + " " + this.lastName; }" , but I was expecting John Doe. | ArmelR/stack-exchange-instruction | {
"qid": 28417716
} | stackexchange | 108stackexchange_4
|
en | How can I disable Jalopy for a specific project in IntelliJ Idea 14 or 15?
It seems that he is not so friend with Java8, but all other projects are in Java7. So, I need to selectively disable Jalopy. Or maybe It would be nice to enable it only for specific projects.
Can someone provide a kind of tutorial. An answer suggested to use aliases, but I would like to see how. | ArmelR/stack-exchange-instruction | {
"qid": 32100554
} | stackexchange | 107stackexchange_3
|
en | Why do muscles twitch? I know what can cause it including stress or diet, but what really causes the muscle twitch? Like, I'm thinking our bodies have an "energy short" in that area. Some sort of glitch in a complex robot. | nreimers/reddit_question_best_answers | {
"index": 36324946
} | reddit_qa | 96reddit_qa_3
|
en | I can't even get out of bed Really, I don't have any energy, to eat, to get up and piss, to shower. I wish I could just sleep the rest of this day away.
I just don't see the point in doing anything anymore. The only reason I had the energy to get on here is because my laptop was right by my bed. I go in to fits of crying out of the blue, with no prompting sometimes. It's not a good feeling. I'm completely down and for no good reason, I don't deserve to feel this way, I don't deserve anything I have. Idk what's going on. | nreimers/reddit_question_best_answers | {
"index": 2857771
} | reddit_qa | 97reddit_qa_4
|
en | what is the difference between constant k and m derived filter? | sentence-transformers/gooaq | {
"index": 569259
} | gooaq | 47gooaq_2
|
en | Hello, I have been living under alot of stress for the past 3 years. I have also overdone meditation . I recently admitted myself to the hospital after experiencing what was diagnosed as stroke like symptons except all tests came back clear. No stroke but am experiencing a strong pulling sensation on left side of body and in the nerves in my head and neck to the point of extreme discomfort. Pulling sensation in the groin area. When walking still noticed uncoordination at times with feet. Am continuing to lose weight even though eating healthy. Have done research and know something is out of balance with sympathetic and para-sympathetic nervous systems. Am on Cipralex (10mg.) and Lorazapam (.5 in am and .5 at night). Could these be harmful if there is something depleted with nervous system. Am 54 year old female. Thank you, | lavita/medical-qa-datasets(chatdoctor_healthcaremagic) | {
"index": 40199
} | healthcaremagic | 51healthcaremagic_4
|
en | there is a source code for Natran-95 on [Github](https://github.com/nasa/NASTRAN-95). I need to install it on Window 10
but searching on the web there is no clear tutorial on installation. while I click on the nastran.exe on this package in the hyperlink to GitHub, I get windows error the file not found in directory.
the specific reason to use nastran is to generate a superelement from a PSHELL model. it seems that MYSTRAN 12.0 has added sparse solver that some of its subroutines do the reduction of sparse matrix, but I am not sure if it also saves it or only uses for solving, but uses the same craig bampton method
could anyone tell me if there is a compiling step missing ? just if you know how to install it, and also use it, please write an answer? it will be a great source for internet | ArmelR/stack-exchange-instruction | {
"qid": 40107
} | stackexchange | 108stackexchange_4
|
en | I am working on an Android app that deals with sensitive user information. One of the requirements is that the user is required to log back into the application whenever they leave it and come back. This is easily dealt with for the case when the user presses the Home button and then relaunches the app (`android:clearTaskOnLaunch` attribute on the `Activity` in `AndroidManifest.xml`). However, we need to do the same thing when the user long presses the Home button, switches to another application, then comes back.
I have researched this every way that I can think of and have not found a workable solution. Is this even possible with Android?
When answering, please keep in mind that this is a business requirement which I have no control over. | ArmelR/stack-exchange-instruction | {
"qid": 5008019
} | stackexchange | 108stackexchange_4
|
en | Why do the writers hate Deanna Troi so much? It seems like every time she is the featured character in the episode, she has to go through extreme physical or emotional suffering. See "The Loss", "Violations", "Man of the People", etc. Not to mention the amount of times she is in a rape-like situation...
She's the weakest character on the show, the writers continue to put her in awful situations that reduce her to a damsel in distress. I think I'm almost starting to like her mother more, at least she's interesting.
Dr Crusher has a lot less episodes centered around her, but she's a much better-written female character, at least in my eyes. She's gentle and feminine without being a stereotype or sexualized, and she's competent at the same level as the men on the show.
Does Troi ever get any good development or become a less miserable character to watch? (I'm on season six of TNG by the way) | nreimers/reddit_question_best_answers | {
"index": 16027374
} | reddit_qa | 97reddit_qa_4
|
en | how to change your name on minecraft education? | sentence-transformers/gooaq | {
"index": 500466
} | gooaq | 47gooaq_2
|
en | Friend? Partner in crime? Rival? I am newish to the BG scene - I’ve been working there about two years or so. I’m really needing friends, as lame as that sounds. People who will want to do the same things as me, such as:
Eat at weird places
Get drunk at Tidballs sometimes
Help me find good local music
Help me find drag queens
Teach me to bowl
Take me to a Hot Rods game
And so much more.
Applicant needs to have their shit together somewhat, not want in my pants, and be okay with eating our weight in pizza. | nreimers/reddit_question_best_answers | {
"index": 24277412
} | reddit_qa | 97reddit_qa_4
|
en | I'm using Google Charts in order to make a nice columns chart, its actually a pretty easy task but I got stuck at the following point: I gotta format the values showed at the vertical axis this way -> "R$ 1.000,00" (for Brazilian currency), I then found at [googles documentation page about columns charts](http://code.google.com/intl/pt-BR/apis/chart/interactive/docs/gallery/columnchart.html#Configuration_Options) that its possible to supply an ICU expression to format the number the way I want, including currency formatting.
```
--------------------------------| ICU SYNTAX BELOW |
vAxis: {title: 'VALUES', format: 'R\u00A4 #.###0,00'}
```
This was the closest I could get, but this expression gives me:
```
1000 -> R$ 1000.00 when it should be R$ 1.000,00
```
So my two problems are:
1) Cant get the thousand separator to show
2) Cant replace thousand separator by "." and decimal separator by ","
googled the web and found lots of stuff regarding ICU itself, describing how to achieve it by calling some methods from ICU C++ lib, but its obviously not available when dealing w/ google charts. | ArmelR/stack-exchange-instruction | {
"qid": 7117074
} | stackexchange | 109stackexchange_5
|
en | Are there any updated bulk cooking mods? "FeedTheColonists" hasn't been updated for the beta release and have been trying to find a new mod to bulk cook.
Any suggestions? I'm pretty nooby when it comes to mods. | nreimers/reddit_question_best_answers | {
"index": 22088327
} | reddit_qa | 96reddit_qa_3
|
en | >
> I need to retrieve the details where the reportedAt = "moka" && name =
> "chickungunya". as displayed in the firebase screenshot attached
>
>
>
Please help
```
//Filter markers by disease
disease = String.valueOf(spnDisease.getSelectedItem()).toLowerCase();
location = String.valueOf(spnLocation.getSelectedItem()).toLowerCase();
Query dbQuery = FirebaseDatabase.getInstance().getReference().child("diseaseReported").orderByChild("name").equalTo(disease);
dbQuery.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Log.d("v1", dataSnapshot.toString());
Map m = dataSnapshot.getValue(Map.class);
double lat = m.getLat();
double lng = m.getLng();
String reportedAt = m.getReportedAt();
String reportedOn = m.getReportedOn();
String name = m.getName();
String snippetText = "Reported on: " + reportedOn;
LatLng c = new LatLng(lat, lng);
mMap.addMarker(new MarkerOptions().position(c).title("Disease reported: " + name).snippet(snippetText).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
```
[Firebase screenshot](https://i.stack.imgur.com/qoVUz.png) | ArmelR/stack-exchange-instruction | {
"qid": 48768796
} | stackexchange | 109stackexchange_5
|
en | In a laid back, relaxed tone, can you write a short (< 250 words) blog post about the history of metal detecting for an audience that is new to it? | HuggingFaceH4/no_robots | {
"prompt_id": "f1f229fb396a5dc590903e67057d12e706175d033d5ade4e048bc8938d591c1f"
} | HuggingFaceH4_no_robots | 8HuggingFaceH4_no_robots_3
|
en | Now that many people seem to be moving towards JSON for web communication I am wondering about why XML should continue to be used.
I appreciate that XML has many years on JSON, during which time it has been widely adopted. However, the fact that it is so well-adopted appears to be the one decisive reason why it should continue to be used.
Is there a good reason why XML should not gradually be phased out in favour of JSON? | ArmelR/stack-exchange-instruction | {
"qid": 2957466
} | stackexchange | 108stackexchange_4
|
en | I am working on a project where users have to log in then if it is correct it creates a cookie to process requests. I would like to find a way to auto-renew sessions every day without affecting the user or requiring the user to log in again.
I would like to also know if I overlooked any security flaws such as SQL injection or session-hijacking and all those, are there any other one that I could prevent or improve?
The login page is
```
<?php
//Login.php
if(isset($_POST['username']) && isset($_POST['password'])){
$username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH); //Changes to unicode characters to prevent injection
$password = $_POST['password']; //Get password
$result = LoginManager::Login($username, $password); //Run login method
if($result == "invalid_username"){
echo 'Invalid Username!';
}
if($result == "invalid_login"){
echo 'Invalid Login!';
}
$expires = gmdate('Y-m-d', strtotime($Date. ' + 1 days')); //sessions expire in 1 day
DataBase::query("INSERT INTO sessions VALUES(:session, :userid, :expires)", array(':session' => $result, ':userid' => $userid, ':expires' => $expires)); //insert into database
setcookie("session", $result); //set as cookie
return;
}
echo '<form action="Login.php" method="post">
<p>Username: <input type="text" name="username" placeholder="Username"/></p>
<p>Password: <input type="password" name="password" placeholder="Password"/></p>
<p><input type="submit" name="login" value="Login"/></p>
</form>';
?>
```
The LoginManager class
```
<?php
//LoginManager.php
public static function Login($username, $password){
if(strlen($username) > 16 || strlen($password) > 50 || strlen($password) < 5){ //usernames less than 16, password from 5-50 char
return 'invalid_bounds';
}
$sql = "SELECT * from accounts WHERE username = :username";
$users = Database::query($sql, array(':username' => $username)); //get account
if(sizeof($users) == 0){ //no accounts found
return 'invalid_username';
}
$userdata = $users[0];
$salt = '-45dfeHK/__yu349@-/klF21-1_\/4JkUP/4'; //salt for password
if(password_verify($password . $salt, $userdata['password'])){ //check if password is correct
$session = com_create_guid(); //create unique session
return $session;
}else{
return 'invalid_login';
}
}
?>
```
And the main page / feed
```
<?php
//Main.php
$session = $_COOKIE['session']; //get cookie session
$sessions = DataBase::query('SELECT * FROM sessions WHERE id=:id', array(':id' => $session));
if(sizeof($sessions) == 0){
//Redirect to login page
return;
}
//get first session
$session = $sessions[0];
$date = new DateTime($session['expires']);
$now = new DateTime();
if($date < $now) {
//Expired session : Redirect to login
return;
}
//Display feed
?>
``` | ArmelR/stack-exchange-instruction | {
"qid": 193243
} | stackexchange | 109stackexchange_5
|
en | I took ELK container from [here](https://elk-docker.readthedocs.io/) using the command :
```
sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk
```
It runs fabulously, but I cannot use it without my configuration for logstash and elasticsearch can we ? so I killed the services and added the configuration. I changed the users to a new user called `elk:elk`. Now when I try to start the elasticsearch it fails with the following exception :
```
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:77)
at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:207)
at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:226)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:291)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
Refer to the log for complete error details.
``` | ArmelR/stack-exchange-instruction | {
"qid": 52221774
} | stackexchange | 109stackexchange_5
|
en | I want to set my input source to ibus-unikey(i installed it and set my input to ibus) but can't find it anywhere in setting.
In 14.10 there are a input source tab in Region and Language but now it isn't.
I opened the language section but there is nothing in it.
Is there any way to open ibus please help me.
 | ArmelR/stack-exchange-instruction | {
"qid": 615410
} | stackexchange | 108stackexchange_4
|
en | Which leader is best for SK Druids? Kind of confusing that we already have Battle Trance for Alchemy and Druids but devs tend to push rain for the archetype. It can be the moment where Rage of the Sea shines though it does not have Alchemy synergies.
Which leader will be better for Druids? | nreimers/reddit_question_best_answers | {
"index": 53426825
} | reddit_qa | 96reddit_qa_3
|
en | Trying to make my first app and learn a bit about coding and react and react native. I started making this mtg life counter and ran into a problem that the touchables are under some text and therefore cannot be pressed. Is there a simple way around this?
I would want the upper half of the number also register + to life and the lower part to - life. It currently kind of works on mobile, but the touchable part is too small.
```
import { StatusBar } from 'expo-status-bar';
import React, { useState } from 'react';
import { StyleSheet, Text, View, Dimensions, TouchableWithoutFeedback } from 'react-native';
const windowHeight = Dimensions.get('window').height;
var opponentColor = 'green'
var playerColor = 'red'
export default function App() {
const [playerLife, setplayerLife] = useState(20);
const [opponentLife, setOpponentLife] = useState(20);
return (
<View style={styles.container}>
<View style={styles.rivi}>
<TouchableWithoutFeedback onPress ={() => setplayerLife(playerLife - 1)}>
<View style={styles.sideContainerOpponent}>
<Text>Mana -</Text>
</View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress ={() => setOpponentLife(opponentLife - 1)}>
<View style={styles.midContainerOpponent}>
<Text>Vihu -</Text>
</View>
</TouchableWithoutFeedback>
<View style={styles.sideContainerOpponent}>
<Text>Tyhjä</Text>
</View>
</View>
<View style={styles.rivi}>
<View style={styles.sideContainerOpponent}>
<Text>Mana +</Text>
</View>
<TouchableWithoutFeedback onPress ={() => setOpponentLife(opponentLife + 1)}>
<View style={styles.midContainerOpponent}>
<Text>Vihu +</Text>
</View>
</TouchableWithoutFeedback>
<View style={styles.sideContainerOpponent}>
<Text>Tyhjä</Text>
</View>
</View>
<View style={styles.rivi}>
<View style={styles.sideContainerPlayer}>
<Text>Tyhjä</Text>
</View>
<TouchableWithoutFeedback onPress ={() => setplayerLife(playerLife + 1)}>
<View style={styles.midContainerPlayer}>
{/* <Text>Life +</Text> */}
</View>
</TouchableWithoutFeedback>
<View style={styles.sideContainerPlayer}>
<Text>Mana +</Text>
</View>
</View>
<View style={styles.rivi}>
<View style={styles.sideContainerPlayer}>
<Text>Tyhjä </Text>
</View>
<TouchableWithoutFeedback onPress ={() => setplayerLife(playerLife - 1)}>
<View style={styles.midContainerPlayer}>
<Text>Life -</Text>
</View>
</TouchableWithoutFeedback>
<View style={styles.sideContainerPlayer}>
<Text>Mana -</Text>
</View>
</View>
<View style={styles.pelaaja1}>
<Text style={styles.lifeCounterPlayer}>
{playerLife}
</Text>
</View>
<View style={styles.pelaaja2}>
<View>
<Text style={styles.lifeCounterOpponent}>
{opponentLife}
</Text>
</View>
</View>
</View >
);
}
const styles = StyleSheet.create({
rivi: {
flex: 1,
flexDirection: 'row',
alignSelf: 'stretch',
alignContent: 'stretch',
},
container: {
flex: 1,
alignSelf: 'stretch',
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
sideContainerOpponent: {
flex: 1,
alignSelf: 'stretch',
backgroundColor: opponentColor,
alignItems: 'center',
justifyContent: 'center',
},
midContainerOpponent: {
flex: 3,
alignSelf: 'stretch',
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
sideContainerPlayer: {
flex: 1,
alignSelf: 'stretch',
backgroundColor: playerColor,
alignItems: 'center',
justifyContent: 'center',
},
midContainerPlayer: {
flex: 3,
alignSelf: 'stretch',
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
pelaaja1: {
position: 'absolute',
top: windowHeight / 2,
left: 0,
right: 0,
bottom: 0,
justifyContent: 'center',
alignItems: 'center'
},
pelaaja2: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: windowHeight / 2,
justifyContent: 'center',
alignItems: 'center'
},
lifeCounterPlayer: {
fontSize: windowHeight / 4,
},
lifeCounterOpponent: {
fontSize: windowHeight / 4,
transform: [{ rotate: '180deg' }]
},
});
``` | ArmelR/stack-exchange-instruction | {
"qid": 65776398
} | stackexchange | 110stackexchange_6
|
en | I would like to know if it is possible to reduce a drill bit diameter (the body and not the shank). From times to times I need to work with dimensions that are not integer number or half number.... example: where I live I can only find drill bits 6mm or 6.5mm or 7mm..... however, in some cases I really need to have a dimension of 6.25mm.
Is this even possible to do, if yes how? | ArmelR/stack-exchange-instruction | {
"qid": 44368
} | stackexchange | 108stackexchange_4
|
en | I want my rendered objects in separate layers so that i can take them in photoshop and add stuff in between. How do I do that? One way I learned was hide other objects and use *Transparent* in *Render Properties>Film>Transparent* but this method doesnot render bounce lights. What I need is an entire scene rendered as usual but the objects separated in different layers. \* phew \* | ArmelR/stack-exchange-instruction | {
"qid": 276220
} | stackexchange | 108stackexchange_4
|
en | How to we turn our thoughts into actions? M(31) F(30) Married in Missouri My (F) spouse and I are always making sexy comments and discussing each and every detail of a threesome or foursome when we get Hott. When out on a date night we always talk about it happening. It's as though we need the opportunity to fall right in our lap and everything to go perfectly even after that. Hahaha. How do we get our feet wet without going to far out of the box? (I.e. parties or meetups) | nreimers/reddit_question_best_answers | {
"index": 26234872
} | reddit_qa | 97reddit_qa_4
|
en | what is semi jacketed bullet? | sentence-transformers/gooaq | {
"index": 1207104
} | gooaq | 46gooaq_1
|
en | In the communities where I’m from We’re less concerned about who is dropping out of the race for president and more concerned about where we’re dropping in on Tilted Towers. | nreimers/reddit_question_best_answers | {
"index": 39819486
} | reddit_qa | 96reddit_qa_3
|
en | Oke i got the problem days ago and someone helped me with treading but my code was really ugly (im totaly new to coding) now i try to make it better and on an smarter way but now my gui get a frezze all time.
i tryed to do it on the way like my last code but it dosent work this time.
What have i to do this time i cant understand it but want understand it.
some Helpful Tips and tricks ?
Or better ways to do it smart, faster, and more powerfull, or mybae the gui more Beautyfule ?
```
import time
import sys
from tkinter import *
import threading
root = Tk()
root.geometry("600x400")
global start
start = 1
def startUp():
user_input()
thr = threading.Thread(target=user_input)
thr.start()
def user_input():
global nameInput
global start
nameInput = textBox.get("1.0","end-1c")
start = 0
if start < 1:
while True:
apex = ApexLegends("APIKey")
player = apex.player(nameInput)
print("Gesamt Kills: " + player.kills + "\n" + 'Gesamt Damage: ' + player.damage)
time.sleep(3)
else:
print("stop")
anleitung=Label(text="Gib einen Spielernamen ein und drücke Start")
anleitung.pack()
textBox=Text(root, height=1, width=30)
textBox.pack()
startButton=Button(root, height=1, width=10, text="Start", command=lambda:startUp())
startButton.pack()
``` | ArmelR/stack-exchange-instruction | {
"qid": 55478342
} | stackexchange | 109stackexchange_5
|
en | I am trying to implement the SVProgressHUD activity indicator. I copied the classes to my project and added the following code to my appDelegate but can't figure out why it crashes.
I get they following error and am not sure where to look to fix it:
```
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SVProgressHUD", referenced from:
objc-class-ref in QuotesAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
Here is the code:
```
#import "SVProgressHUD.h"
@implementation QuotesAppDelegate
- (void)startLoading
{
//call this in your app delegate instead of setting window.rootViewController to your main view controller
//you can show a UIActivityIndiocatorView here or something if you like
[SVProgressHUD show];
[self performSelectorInBackground:@selector(loadInBackground) withObject:nil];
}
- (void)loadInBackground
{
//do your loading here
//this is in the background, so don't try to access any UI elements
[self populateFromDatabase];
[SVProgressHUD dismiss];
[self performSelectorOnMainThread:@selector(finishedLoading) withObject:nil waitUntilDone:NO];
}
- (void)finishedLoading
{
//back on the main thread now, it's safe to show your view controller
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self copyDatabaseIfNeeded];
[self startLoading];
}
``` | ArmelR/stack-exchange-instruction | {
"qid": 9809477
} | stackexchange | 109stackexchange_5
|
en | I drew an image in Illustrator and now I would like to fill it with color. I created a second layer and placed it under the line art.
However when I try to painting with the brush tool I get a really annoying (international prohibition sign / no symbol).
*Why is that?*
--------------
[](https://i.stack.imgur.com/vn3tD.gif)
[](https://i.stack.imgur.com/27M7p.png) | ArmelR/stack-exchange-instruction | {
"qid": 109768
} | stackexchange | 108stackexchange_4
|
en | Tips for writing a recommendation letter? I just started teaching this semester and I'm teaching some upper level courses. As a result, some students are asking me to be their references. I just got a first email to write a recommendation letter. I have a few thoughts for some things to write about, but I also always waived my ability to see the ones written about me so I have no idea what one actually looks like.
Any tips would help greatly, thanks! | nreimers/reddit_question_best_answers | {
"index": 37317696
} | reddit_qa | 97reddit_qa_4
|
en | I am trying to lookup data in a 26 page spreedsheet based off a client number. Each sheet is labeled as a letter to organise for surnames. Each sheet has the following table:
```
Surname | Forename | Client Number | Daily Ticket Count | Monthly Ticket Count |
Ticket No | Date | Ticket No2 | Date | Ticket No3 | Date | Ticket No4 | Date |
Ticket No 5 | Date
```
I'm searching by client Number to pull all assigned tickets. This formula below is to only check Ticket No, and then there is another formula in another cell to search Ticket No2. Repeat for Tickets 3 to 5.
This is my current formula. I was planning on repeating this entirely for each sheet A-Z, but that isn't feasible apparently. Is it possible to still do this by using another function, and if so what function?
```
=IFERROR(INDEX(A!F2:F36,(MATCH($B12,A!C2:C36,0))),INDEX(B!F2:F36,(MATCH($B12,B!C2:C36,0))),
INDEX(C!F2:F36,(MATCH($B12,C!C2:C36,0))))
``` | ArmelR/stack-exchange-instruction | {
"qid": 31134208
} | stackexchange | 108stackexchange_4
|
en | I have a code like this:
```
IF EXISTS (SELECT * FROM table WHERE id = @id)
BEGIN
UPDATE table
SET stock = stock + @stock
WHERE id = @id
END
ELSE
BEGIN
INSERT INTO [table] ([id], [name], [stock])
VALUES (@id, @name, @stock)
END
```
But, this code isn't working and I am unable to find the root cause for the same. Can someone please help me? | ArmelR/stack-exchange-instruction | {
"qid": 45855004
} | stackexchange | 107stackexchange_3
|
en | I recently had an interview with a software company who asked me the following question:
>
> Can you describe to me what adding *volatile* in front of variables does? Can you explain to me why it's important?
>
>
>
Most of my programming knowledge comes from C, yet the job position is for C# (I thought I might add this bit of info if necessary for the question specifically)
I answered by saying it just lets the ***compiler*** know that the variable can be used across processes or threads, and that it should not use optimization on that variable; as optimizing it can deteriorate behavior. In a nutshell, it's a warning to the compiler.
According to the interviewer, however, it's the other way around, and the volatile keyword warns the ***OS***, not the compiler.
I was a bit befuddled by this, so I did some research and actually found conflicting answers! Some sources say it's for the compiler, and others for the OS.
Which is it? Does it differ by language? | ArmelR/stack-exchange-instruction | {
"qid": 41026418
} | stackexchange | 108stackexchange_4
|
en | how long does it take for medication to clear your system? | sentence-transformers/gooaq | {
"index": 2592551
} | gooaq | 47gooaq_2
|
en | I'm learning about microservices.
On one hand, the literature recommends using asynchronous event-publishing for microservices that need to collaborate on sagas or take action on events published by other services.
On the other hand, the same literature recommends not using a shared library to define common events because that couples the microservices through that event library.
Am I taking crazy pills? Aren't those microservices coupled by those events anyway if they rely on them? If so, what is the advantage of coding the exact same events with the same definition in two (or even more) different places? Isn't that a total violation of the DRY principle?
I'm starting to smell a code smell that starts with the initials BS. Will someone help me drink the rest of this koolaid? Or did I just see the emperor with his clothes off for a second? | ArmelR/stack-exchange-instruction | {
"qid": 58593469
} | stackexchange | 108stackexchange_4
|
en | I want to prove that the set of natural numbers *n* having a prime divisor greater than $\sqrt{n}$ is positive.
I have a heuristic argument that this density should be $\log 2$, which is approximately 0.7, but I am not sure how this could be converted to a formal argument.
For any *x*, the probability that *x* is prime is approximately $1/ \log x$ (By the prime number theorem). Further, the probability that *n* is a multiple of *x* is approximately $1/x$. These are "independent" so the probability that *n* is a multiple of *x* and *x* is prime is approximately $1/x\log x$.
We know that *n* can have at most one prime divisor greater than $\sqrt{n}$, so the probability that *n* has a prime divisor greater than $\sqrt{n}$ can be approximated by the integral:
$$\int\_{\sqrt{n}}^n \frac{dx}{x \log x} = [\log (\log x)]\_{\sqrt{n}}^n = \log 2$$
Can this be made precise in terms of densities? How would the error terms be handled? Has this or a similar result already been proved?
ADDED LATER: The proofs below resolve this question, and they also seem to show that the density of numbers *n* with a prime divisor greater than $n^\alpha$ is $-\log \alpha$ for $1 > \alpha \ge 1/2$. My question: is the result also valid for $0 < \alpha < 1/2$? For such $\alpha$, we could have more than one prime divisor, so the simple counting above doesn't work; we need to use a sieve that subtracts the multiple contributions occurring from numbers that have more than one such prime divisor. My guess would be that asymptotically, this wouldn't matter, but I'm not sure how to formally show this. | ArmelR/stack-exchange-instruction | {
"qid": 14664
} | stackexchange | 109stackexchange_5
|
en | I've designed a robot with two motors. It works as follows:
The first motor is attached to the the person's arm, the second motor receives the calculated movement and moves accordingly.
When the person moves his hand (open/close) the other robot moves the the opposite direction; upon opening it closes and vise-versa.
I've tried to invert the movement by multiplying by -1 but the second motor keeps moving on his own. I've tried multiplying the results of both motors, before subtracting, with no success.
The ['code'](https://i.stack.imgur.com/ebils.png) does the following:
1. I take the movements of motors A and B
2. Subtract value of motor A from motor B's
3. Save the result to a variable-'moveDist'
4. Take the absolute value after subtraction for comparison
5. If greater than 6, pass 'moveDist' value to the second motor.
[](https://i.stack.imgur.com/ebils.png) | ArmelR/stack-exchange-instruction | {
"qid": 6324
} | stackexchange | 108stackexchange_4
|
en | need to make $1000/month, options? what are my options? willing to work 80-120h a month for it. Currently a p/t student but need some help paying a few things. | nreimers/reddit_question_best_answers | {
"index": 28343123
} | reddit_qa | 96reddit_qa_3
|
en | Does it matter how I burn calories? As long as I burn them?
After a year of Brazilian jiu-jitsu, my endurance has gotten much higher and I barely sweat with biking or running. I'm in between gyms right now, so I spend a couple hours on a bike. | nreimers/reddit_question_best_answers | {
"index": 15930155
} | reddit_qa | 96reddit_qa_3
|
en | Logout/Rest XP zone in Nova Praetoria? So I'm a total newb here, but is there a logout area in NP, similar to City Hall in Atlas Park? For the life of me I can't seem to fine one and it's driving me nuts.
Thanks :) | nreimers/reddit_question_best_answers | {
"index": 43447384
} | reddit_qa | 96reddit_qa_3
|
en | I am currently trying to do an `Out-GridView` to get a simple overview about our group policy objects. To do so, I am using the `Get-GPO` cmdlet, like so:
```
Get-GPO -all |
Select-Object -Property DisplayName, Description |
Sort-Object -Property DisplayName |
Out-GridView
```
In our company we use the first line of the description field to store the name of the admin who created the policy, and all following lines hold a short description.
I would want to be able to grab the first line of the the `Description` field with the column header `Responsability` and all other lines of the field in a separate column. So assuming my current code would give me a table like this:
```
DisplayName | Description
-------------------------
GPO1 | Username
| stuff
| stuff
```
I would want it to look like this:
```
DisplayName | Responsability | Description
------------------------------------------
GPO1 | Username | stuff
| | stuff
```
How can I achieve this? | ArmelR/stack-exchange-instruction | {
"qid": 44530016
} | stackexchange | 108stackexchange_4
|
en | While using Android Studio just now I was editing an XML file in the editor and I got this error in the Preview and Design windows:
```
Exception raised during rendering: Unable to find the layout for Action Bar.
```
I've tried restarting Android Studio, my Laptop and Googling for the answer but I can't find anything. Has anybody experienced anything similar? | ArmelR/stack-exchange-instruction | {
"qid": 29535863
} | stackexchange | 107stackexchange_3
|
en | Best practice for Python-based Saltstack project I am a SaltStack user. When I am playing with those YAML files (and jinja templates), I am always wondering that maybe building the SaltStack project just with Python is more clear. But all advanced samples I can find are building multiple sls YAML files that work together for provision and event reaction.
Is there any practical way to code a SaltStack project mainly with Python instead of YAML files? | nreimers/reddit_question_best_answers | {
"index": 19627902
} | reddit_qa | 97reddit_qa_4
|
en | I am trying to use gridFs storage with node rest api. I am confused on how to use these two together. I am following Brad Traversy's gridfs source code for that. Should I be using those code in my node rest's 'app.js' file or in 'product.js(Route's folder)'.
Here's the gridfs code:
```
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const crypto = require('crypto');
const mongoose = require('mongoose');
const multer = require('multer');
const GridFsStorage = require('multer-gridfs-storage');
const Grid = require('gridfs-stream');
const methodOverride = require('method-override');
const app = express();
const productRoutes = require("./api/routes/products");
const userRoutes = require("./api/routes/user");
app.use(morgan("dev"));
app.use('/uploads', express.static('uploads'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept, Authorization"
);
if (req.method === "OPTIONS") {
res.header("Access-Control-Allow-Methods", "PUT, POST, PATCH, DELETE, GET");
return res.status(200).json({});
}
next();
});
// Routes which should handle requests
app.use("/products", productRoutes);
app.use("/user", userRoutes);
app.use((req, res, next) => {
const error = new Error("Not found");
error.status = 404;
next(error);
});
app.use((error, req, res, next) => {
res.status(error.status || 500);
res.json({
error: {
message: error.message
}
});
});
module.exports = app;
// Middleware
app.use(bodyParser.json());
app.use(methodOverride('_method'));
app.set('view engine', 'ejs');
// Mongo URI
const mongoURI = 'mongodb://brad:[email protected]:57838/mongouploads';
// Create mongo connection
const conn = mongoose.createConnection(mongoURI);
// Init gfs
let gfs;
conn.once('open', () => {
// Init stream
gfs = Grid(conn.db, mongoose.mongo);
gfs.collection('uploads');
});
// Create storage engine
const storage = new GridFsStorage({
url: mongoURI,
file: (req, file) => {
return new Promise((resolve, reject) => {
crypto.randomBytes(16, (err, buf) => {
if (err) {
return reject(err);
}
const filename = buf.toString('hex') + path.extname(file.originalname);
const fileInfo = {
filename: filename,
bucketName: 'uploads'
};
resolve(fileInfo);
});
});
}
});
const upload = multer({ storage });
// @route GET /
// @desc Loads form
app.get('/', (req, res) => {
gfs.files.find().toArray((err, files) => {
// Check if files
if (!files || files.length === 0) {
res.render('index', { files: false });
} else {
files.map(file => {
if (
file.contentType === 'image/jpeg' ||
file.contentType === 'image/png'
) {
file.isImage = true;
} else {
file.isImage = false;
}
});
res.render('index', { files: files });
}
});
});
// @route POST /upload
// @desc Uploads file to DB
app.post('/upload', upload.single('file'), (req, res) => {
// res.json({ file: req.file });
res.redirect('/');
});
// @route GET /files
// @desc Display all files in JSON
app.get('/files', (req, res) => {
gfs.files.find().toArray((err, files) => {
// Check if files
if (!files || files.length === 0) {
return res.status(404).json({
err: 'No files exist'
});
}
// Files exist
return res.json(files);
});
});
// @route GET /files/:filename
// @desc Display single file object
app.get('/files/:filename', (req, res) => {
gfs.files.findOne({ filename: req.params.filename }, (err, file) => {
// Check if file
if (!file || file.length === 0) {
return res.status(404).json({
err: 'No file exists'
});
}
// File exists
return res.json(file);
});
});
// @route GET /image/:filename
// @desc Display Image
app.get('/image/:filename', (req, res) => {
gfs.files.findOne({ filename: req.params.filename }, (err, file) => {
// Check if file
if (!file || file.length === 0) {
return res.status(404).json({
err: 'No file exists'
});
}
// Check if image
if (file.contentType === 'image/jpeg' || file.contentType === 'image/png') {
// Read output to browser
const readstream = gfs.createReadStream(file.filename);
readstream.pipe(res);
} else {
res.status(404).json({
err: 'Not an image'
});
}
});
});
// @route DELETE /files/:id
// @desc Delete file
app.delete('/files/:id', (req, res) => {
gfs.remove({ _id: req.params.id, root: 'uploads' }, (err, gridStore) => {
if (err) {
return res.status(404).json({ err: err });
}
res.redirect('/');
});
});
```
and here's my product.js code in route's folder in which I want to use grid fs for file storage:
```
const express = require("express");
const router = express.Router();
const mongoose = require("mongoose");
const multer = require('multer');
const storage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, './uploads/');
},
filename: function(req, file, cb) {
cb(null, Date.now() + file.originalname);
}
});
const fileFilter = (req, file, cb) => {
// reject a file
if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/png') {
cb(null, true);
} else {
cb(null, false);
}
};
const upload = multer({
storage: storage,
limits: {
fileSize: 1024 * 1024 * 5
},
fileFilter: fileFilter
});
const Product = require("../models/product");
router.get("/", (req, res, next) => {
Product.find()
.select("name price _id productImage reference description quantity date category")
.exec()
.then(docs => {
const response = {
count: docs.length,
products: docs.map(doc => {
return {
name: doc.name,
price: doc.price,
productImage: doc.productImage,
reference: doc.reference,
description: doc.description,
quantity: doc.quantity,
date: doc.date,
category: doc.category,
_id: doc._id,
request: {
type: "GET",
url: "https://booksbackend.herokuapp.com/products/" + doc._id
}
};
})
};
// if (docs.length >= 0) {
res.status(200).json(response);
// } else {
// res.status(404).json({
// message: 'No entries found'
// });
// }
})
.catch(err => {
console.log(err);
res.status(500).json({
error: err
});
});
});
router.post("/", upload.single('productImage'), (req, res, next) => {
const product = new Product({
_id: new mongoose.Types.ObjectId(),
name: req.body.name,
price: req.body.price,
productImage: req.file.filename,
reference: req.body.reference,
description: req.body.description,
quantity: req.body.quantity,
date: req.body.date,
category: req.body.category,
newProduct: req.body.newProduct,
relatedProduct: req.body.relatedProduct
});
product
.save()
.then(result => {
console.log(result);
res.status(201).json({
message: "Created product successfully",
createdProduct: {
name: result.name,
price: result.price,
_id: result._id,
request: {
type: 'GET',
url: "https://booksbackend.herokuapp.com/products/" + result._id
}
}
});
})
.catch(err => {
console.log(err);
res.status(500).json({
error: err
});
});
});
``` | ArmelR/stack-exchange-instruction | {
"qid": 51545932
} | stackexchange | 110stackexchange_6
|
en | Why does durex america care more than durex europe at this point? Correct me if I'm wrong, but the American Dured XXL got Updated from 57mm To 64mm.
&#x200B;
Not too long ago the european Durex XXL got Updated from 57mm to 57mm
&#x200B;
Isn't 54-56mm the avarage? What the hell? | nreimers/reddit_question_best_answers | {
"index": 47375917
} | reddit_qa | 96reddit_qa_3
|
en | First challenge advice? I've never really looked into challenges until now and am realising I should probably start doing them.
I'm not really sure which I should start with although I was thinking maybe 1000 years? Also don't know if I should stock up in certain resources like TCs and relics etc beforehand.
Right now I have 1806 paragon, 2830 burned, 41.59k TC, all metas up to malkuth and I haven't bought any chronospheres in this run yet.
Basically what challenge should I do first and is there anything I should know or do to prepare before I start? | nreimers/reddit_question_best_answers | {
"index": 53658535
} | reddit_qa | 97reddit_qa_4
|
en | I'm trying to do simple jquery function:
```
<div id="container"><span>This is my text</span></div>
```
js code:
```
$(document).ready(function() {
var fontSize = parseInt($("#container").width()/4)+"px";
$("#container span").css('font-size', fontSize);
});
```
css code:
```
* {
font-family:Myriad Pro;
}
#container {
height:100px;
width:98%;
background-color:#eeeeee;
padding:1%;
}
```
It works when I change resize window and refresh it, but I'd like it to work continously, so when I resize browser window font-size is changing dynamically.
<http://jsfiddle.net/8TrTU/1627/> | ArmelR/stack-exchange-instruction | {
"qid": 32991804
} | stackexchange | 108stackexchange_4
|
en | R rated movie watch list? I've only ever seen two R-rated movies; Stand by me and Lost Boys. Yeah, it was the '90's.
Now there are thousands of R-rated movies I've never seen. So where should I start? (I have seen the HBO series The Wire, which is amazing!) | nreimers/reddit_question_best_answers | {
"index": 7101923
} | reddit_qa | 96reddit_qa_3
|
en | I don't want a video controller but pause the video and change its current time in JS, what should I do? I have done a lot of research and tried a lot, but it always says" Cannot read property 'pause' of null". | ArmelR/stack-exchange-instruction | {
"qid": 44938282
} | stackexchange | 107stackexchange_3
|
en | Is Canon C200 a good choice for narrative filmmalking? Hello everybody!
I am about to buy my first cinema camera. It will be used mainly for short films and scripted stuff, and the C200 seems to me the best option.
It has good low light performance and it is lightweight enough to use on something like a zhiyun crane. This will be very useful in low budget projects with little to no crew and not much money to spend on lighting or an expensive Movi gimbal.
The two main flaws seems to be the lack of a 10 bit codec and timecode imput.
I'll shoot in 12 bit RAW so the codec thing isn't a problem for me, and the timecode issue can apparently be solved using something like the Tentacle Sync E.
Am I considering everything? Is the C200 the best camera in its price range for me? | nreimers/reddit_question_best_answers | {
"index": 26543615
} | reddit_qa | 97reddit_qa_4
|
en | I am getting the following error while running shark 0.9.0.
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at shark.SharkCliDriver$.main(SharkCliDriver.scala:82)
at shark.SharkCliDriver.main(SharkCliDriver.scala)
Any solution regarding the problem is highly appreciable. | ArmelR/stack-exchange-instruction | {
"qid": 21854585
} | stackexchange | 107stackexchange_3
|
en | How can I receive indexed array after mysql query? Or is there any method to convert `$this->db->get()` into mysql resource? Or convert associative array to indexed? | ArmelR/stack-exchange-instruction | {
"qid": 7877803
} | stackexchange | 107stackexchange_3
|
en | Hori fighting commander Im using xbox one controller currently and Im enjoying it but is it worth transitioning to hori controller? Im mostly concerned about arrow button functionality | nreimers/reddit_question_best_answers | {
"index": 46078906
} | reddit_qa | 96reddit_qa_3
|
en | I have a DELL R710 with ESXI 5.0. I've created a VM with 100GB thin provision. I deleted most of the data. Is it possible to shrink the VM folder on the ESXI?
thanks!
Dotan. | ArmelR/stack-exchange-instruction | {
"qid": 527920
} | stackexchange | 107stackexchange_3
|
en | I played around a bit with the version of Stack Overflow to anonymous (not logged in) users, and I noticed the following behaviour (click on the image to see the full size version, some things are not easily visible in the smaller inline image):
[](https://i.stack.imgur.com/BPxGc.gif)
This bug only appears when one of the Jobs ads for a specific company is visible. Because Tim Post commented that he couldn't reproduced it, I got curious and tried to load Stack Overflow via TOR with my location in the US, and there I actually don't get any of these ads that trigger the bug. I only see them when my location is Germany.
One difference seems to be that these ads inject a stylesheet called `cp.min.css`, which isn't present without them and which does apply styles to the elements that move. | ArmelR/stack-exchange-instruction | {
"qid": 357875
} | stackexchange | 108stackexchange_4
|
en | There's clearly something I don't understand about SpringLayout. I'm trying to create a class, an extension of JPanel, that allows me to add components and have them appear vertically, all the same width.
My extension of JPanel would set its LayoutManager to use SpringLayout, and each time a component was added it would put in the SpringLayout constraints to attach it, to the panel for the first component, and then each component to the previous one.
First, here's an Oracle-written example of using SpringLayout that I altered to put components vertically instead of horizontally:
```
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import javax.swing.SpringLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Container;
public class SpringDemo3
{
/**
* Create the GUI and show it. For thread safety, this method should be
* invoked from the event-dispatching thread.
*/
private static void createAndShowGUI()
{
// Create and set up the window.
JFrame frame = new JFrame("SpringDemo3");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Set up the content pane.
Container contentPane = frame.getContentPane();
SpringLayout layout = new SpringLayout();
contentPane.setLayout(layout);
// Create and add the components.
JLabel label = new JLabel("Label: ");
JTextField textField = new JTextField("Text field", 15);
contentPane.add(label);
contentPane.add(textField);
// Adjust constraints for the label so it's at (5,5).
layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);
// Adjust constraints for the text field so it's at
// (<label's right edge> + 5, 5).
// layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
// layout.putConstraint(SpringLayout.EAST, textField, 5, SpringLayout.EAST, contentPane);
layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.SOUTH, label);
// Adjust constraints for the content pane: Its right
// edge should be 5 pixels beyond the text field's right
// edge, and its bottom edge should be 5 pixels beyond
// the bottom edge of the tallest component (which we'll
// assume is textField).
layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, textField);
layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, textField);
// Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args)
{
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
}
});
}
}
```
Based on what I understood SpringLayout requires, I wrote the following:
```
import java.awt.Component;
import java.awt.LayoutManager;
import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.SpringLayout;
import static javax.swing.SpringLayout.NORTH;
import static javax.swing.SpringLayout.EAST;
import static javax.swing.SpringLayout.SOUTH;
import static javax.swing.SpringLayout.WEST;
public class OneWidthPanel extends JPanel
{
private static final long serialVersionUID = 1L;
private int padding = 5;
SpringLayout springLayout = new SpringLayout();
public OneWidthPanel() { super(); setLayout(springLayout); }
public OneWidthPanel(boolean isDoubleBuffered) { super(isDoubleBuffered); }
public OneWidthPanel(LayoutManager layout) { throw new IllegalArgumentException("Cannot set a layout manager on the OneWidthPanel class"); }
public OneWidthPanel(LayoutManager l, boolean isDoubleBuffered) { throw new IllegalArgumentException("Cannot set a layout manager on the OneWidthPanel class"); }
private ArrayList<Component> componentList = new ArrayList<>();
@Override
public Component add(Component comp)
{
super.add(comp);
componentList.add(comp);
int listSize = componentList.size();
String topConstraint;
Component northComponent;
if (listSize == 1)
{
topConstraint = NORTH;
northComponent = this;
}
else
{
topConstraint = SOUTH;
northComponent = componentList.get(listSize - 2);
}
springLayout.putConstraint(topConstraint, northComponent, padding, SpringLayout.NORTH, comp);
springLayout.putConstraint(WEST, this, padding, WEST, comp);
springLayout.putConstraint(EAST, this, padding, EAST, comp);
return comp;
}
public void finishedAdding()
{
Component lastComponent = componentList.get(componentList.size()-1);
springLayout.putConstraint(EAST, this, padding, EAST, lastComponent);
springLayout.putConstraint(SOUTH, this, padding, SOUTH, lastComponent);
}
}
```
Here's a little program to test it:
```
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import rcutil.layout.OneWidthPanel;
public class OneWidthPanelTester extends JFrame
{
private static final long serialVersionUID = 1L;
public static void main(String[] args)
{
OneWidthPanelTester tester = new OneWidthPanelTester();
tester.go();
}
public void go()
{
OneWidthPanel panel = new OneWidthPanel();
JButton button1 = new JButton("ONE new button");
JButton button2 = new JButton("second b");
JRadioButton rButton = new JRadioButton("choose me");
panel.add(button1);
panel.add(button2);
panel.add(rButton);
panel.finishedAdding();
add(panel, BorderLayout.WEST);
pack();
setVisible(true);
}
}
```
The components appear on top of each other at the top of the panel. I thought setting the constraints of each one, as I added it, to connect the north end of each component to the south edge of the previous component, would line them up vertically in the order added. I have the `finishedAdding()` method so that I can wrap up the last component's connection to its container, as told in the "How to use SpringLayout" tutorial at <https://docs.oracle.com/javase/tutorial/uiswing/layout/spring.html>, and as done in the demo program I copied.
I don't understand why my components overlay each other but the (two) demo components are next to each other vertically. And am I going to be able to satisfy my original desire, which is to have the vertical components stretch to be the same size in the panel? | ArmelR/stack-exchange-instruction | {
"qid": 70966055
} | stackexchange | 110stackexchange_6
|
en | write a social media caption and invite to come and see a kids Christmas play titled, "a saviour is born." IT WILL BE ON THE 9TH OF DECEMBER AT 149 ROBERT MUGABE AUDITORIUM FROM 12PM TO 3:30PM. | allenai/WildChat-1M | {
"conversation_hash": "6f3db39432d342caa0279d1fa37c962a"
} | wildchat | 117wildchat_3
|
en | I am trying fetch records from mongoDB through mongoose
```
router.route('/testaa')
.get(function(req,res){
fisSite.find(function(err, retVal) {
var x = [];
for(var i =0;i<retVal.length;i++){
x.push(retVal[i].site);
}
res.json(x)
});
})
```
The above code is giving undefined values.
```
undefined
undefined
undefined
.....
```
Please help to run the for loop inside node.js so that i can use extract data from array. | ArmelR/stack-exchange-instruction | {
"qid": 43930506
} | stackexchange | 108stackexchange_4
|
en | I'd like to Evaluate $$\int\_0^\infty \frac{x\sin x}{1+x^2}$$ The sine function makes the obvious choice $\dfrac{z \sin z}{1+z^2}$ useless since if we integrate over a semicircle sine can become large. I tried $\dfrac{ze^{iz}}{1+z^2}$ but $x\sin x$ is not the real part or imaginary part of $ze^{iz}$. I'm not sure how to choose a related function that will allow me to recover $\dfrac{x\sin x}{1+x^2}.$ | ArmelR/stack-exchange-instruction | {
"qid": 1052798
} | stackexchange | 108stackexchange_4
|
en | So ive been trying it for 1 hour, I already tried every solution already posted here regarding this problem,
I have a logo which I named img in CSS, and as you can see in a picture I want to edit “Font Awesome” image in CSS, but it wont work, I tried:
```
CSS:
.second {
float: right;
opacity: 0.5;
}
HTML:
<div class=“second”>
<img src=
"https://www.vectorlogo.zone/
logos/
font-awesome/
font-awesome-card.png">
</div>
```
I tried just adding class=“” to HTML code and that didnt worked either, maybe its thats the code is inside .box code, if I have to post whole code Ill do it, cheers, hoping for solution
(<https://i.stack.imgur.com/rCHWS.png>) | ArmelR/stack-exchange-instruction | {
"qid": 52457053
} | stackexchange | 108stackexchange_4
|
en | I'm getting the error "cannot execute unlisten during recovery" when I use Pooling=True in my connection string.
This error is on a replicated / read server which is running on hot standby. | ArmelR/stack-exchange-instruction | {
"qid": 36442576
} | stackexchange | 107stackexchange_3
|
en | I've just finished my Android widget. Now I need to have different sizes of this widget for the user to choose from.
For example, I need a medium, small and large size widget, so when the user installs the app and hold the home screen then choose widget, in the widget menu I want him to see three widgets with the same app name but with the size. Something like this:
helloSmall
helloMedium
helloLarge
I have the medium one ready, but how can I add the small and the large in the same app? Knowing that all three sizes contain the same exact data and actions, just the size and the background are different. | ArmelR/stack-exchange-instruction | {
"qid": 2570004
} | stackexchange | 108stackexchange_4
|
en | I have an iOS app that I am converting to an iOS/Mac app. In the iOS version, I used UILabels for my text. Obviously, I can't do that on the mac. I can see two options:
Option 1: Use UILabels on iOS and NSTextView on the Mac.
Option 2: Use CATextLayers on both platforms, as part of a general strategy to make as much as possible work on both of them.
Obviously, option 2 has a big advantage that there would be less code to maintain. My question is -- does option 1 have any advantages I should be aware of? In particular, does CATextLayer have drawbacks that UILabel and NSTextView don't have?
EDIT: It's a game. The user never enters text -- but the game does output some, scores for example. | ArmelR/stack-exchange-instruction | {
"qid": 4701895
} | stackexchange | 108stackexchange_4
|
en | Are there any other games that are suffering the same fate as this one or are close to? After seeing what happened to gigantic, I don't wanna let that happen to another good game. Are there any games going through the same hard times as gigantic? | nreimers/reddit_question_best_answers | {
"index": 29612607
} | reddit_qa | 96reddit_qa_3
|
en | Dont celebrate thanksgiving!! Because its a really really pagan holiday. Uh NOT. And also just because pilgrims killed tons of natives doesnt mean we dont need to have a day to remind us of who we are thankful for | nreimers/reddit_question_best_answers | {
"index": 21972253
} | reddit_qa | 96reddit_qa_3
|
en | Adderall during WD?? I’m going through it and have access to some adderall. Will these help at all? I’m only considering it because I have to work. | nreimers/reddit_question_best_answers | {
"index": 48099134
} | reddit_qa | 96reddit_qa_3
|
en | what is the difference between ecg and emg? | sentence-transformers/gooaq | {
"index": 408720
} | gooaq | 46gooaq_1
|
en | If present participle is used as an adjective in sentences like these
* *I saw him riding a bike*
* *The guy shouting at his wife looks familiar.*
Is it indicated the progress of an action or just describes a noun?
Basically, the sentences mean just the same as
* *When I saw him he was riding a bike*
* *The guy is shouting at his wife and he looks familiar.*
but emphasizes on the facts (not progression) and a bit simplified for easier usage? | ArmelR/stack-exchange-instruction | {
"qid": 445634
} | stackexchange | 108stackexchange_4
|
en | why does my stomach hurt every time i eat something? | sentence-transformers/gooaq | {
"index": 1096682
} | gooaq | 47gooaq_2
|
en | I am getting a strange error saving a tiff file (stack grayscale), any idea?:
>
> File
> "C:\Users\ptyimg\_np.MT00200169\Anaconda3\lib\site-packages\tifffile\tifffile.py",
> line 1241, in save
> sampleformat = {'u': 1, 'i': 2, 'f': 3, 'c': 6}[datadtype.kind] KeyError: 'b'
>
>
>
my code is
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from skimage.morphology import watershed
from skimage.feature import peak_local_max
from scipy import ndimage
from skimage import img_as_float
from skimage import exposure,io
from skimage import external
from skimage.color import rgb2gray
from skimage.filters import threshold_local , threshold_niblack
import numpy as np
import tifffile
from joblib import Parallel, delayed
import sys
# Load an example image
input_namefile = sys.argv[1]
output_namefile = 'seg_'+ input_namefile
#Settings
block_size = 25 #Size block of the local thresholding
img = io.imread(input_namefile, plugin='tifffile')
thresh = threshold_niblack(img, window_size=block_size , k=0.8) #
res = img > thresh
res = np.asanyarray(res)
print("saving segmentation")
tifffile.imsave(output_namefile, res , photometric='minisblack' )
``` | ArmelR/stack-exchange-instruction | {
"qid": 62076488
} | stackexchange | 109stackexchange_5
|
en | has peta done anything good? | sentence-transformers/gooaq | {
"index": 1886869
} | gooaq | 46gooaq_1
|
en | I want to use `printf` to print a variable. It might be possible that this variable contains a `%` percent sign.
Minimal example:
```
$ TEST="contains % percent"
$ echo "${TEST}"
contains % percent
$ printf "${TEST}\n"
bash: printf: `p': invalid format character
contains $
```
(`echo` provides the desired output.) | ArmelR/stack-exchange-instruction | {
"qid": 519315
} | stackexchange | 107stackexchange_3
|
en | I am in need of a ortho to access my physical abilities for my ex-employer. I was getting long term disability from their insurance(cigna) and they cut my benefits until I have a doctors assessment of my ability or inability to do my job there. i had two rotator cuff surgeries on my right shoulder and i still cannot use it 100 percent and am in constant pain. I cant afford my doctor who did the surgery because my benefits did not include health insurance. I just need a doctors opinion on my restrictions so that I may start receiving my benefits from cigna again. | lavita/medical-qa-datasets(chatdoctor_healthcaremagic) | {
"index": 68406
} | healthcaremagic | 51healthcaremagic_4
|
en | Why are media outlets allowed to report the identity of people just accused (not yet tried) of a crime? It seems that the media ruins the reputation of the accused person before any substantive evidence or trial has taken place. And what happens when the accused person is found not guilty? Why doesn't the law require any type of equal coverage of both the arrest and the outcome of the trial? Lastly, is the media immune from removing any existing record (public internet search, public archive, etc.) of news reports of an arrest in the case that a person is found not guilty and the arrest record is expunged? I'm not a law person in any way, but it seems that there are plenty of laws to help the alleged victims conceal their identities but few, if any, laws that protect the identities of the accused prior to a guilty verdict or plea agreement. Am I wrong or way off base? | nreimers/reddit_question_best_answers | {
"index": 161272
} | reddit_qa | 97reddit_qa_4
|
en | Sleeves for a well endowed, uncut fella? I'm not new to sex toys, and have a nice little collection going. (tantus strap on kit, njoy wand and plug, and a tenga flip - which has always felt really small.)
I'm a fairly well endowed guy (9.5" x 8") and the flip tends to buckle a bit when I use it. Super frustrating, fairly uncomfortable.
I'm looking for a masturbator to use while the wife is away on work for the next six months. Price isn't really an issue - just looking for something wonderful!
I've looked at the pulse iii, cobra 2, and a few other bits and pieces... Not sold on the idea of a vibrator, prostate, sleeve, or anything... Any larger guys willing to chime in? | nreimers/reddit_question_best_answers | {
"index": 22501533
} | reddit_qa | 97reddit_qa_4
|
en | I am learning machine learning and data analysis on `wav` files.
I know if I have `wav` files directly I can do something like this to read in the data
```
import librosa
mono, fs = librosa.load('./small_data/time_series_audio.wav', sr = 44100)
```
Now I'm given a gz-file `"music_feature_extraction_test.tar.gz"`
I'm not sure what to do now.
I tried:
```
with gzip.open('music_train.tar.gz', 'rb') as f:
for files in f :
mono, fs = librosa.load(files, sr = 44100)
```
but it gives me:
`TypeError: lstat() argument 1 must be encoded string without null bytes, not str`
Can anyone help me out? | ArmelR/stack-exchange-instruction | {
"qid": 50202350
} | stackexchange | 108stackexchange_4
|
en | I am after this dataset:
<http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=adehabitat:lynxjura>
Is anyone aware of where to find/download it?
Thanks!
Christian | ArmelR/stack-exchange-instruction | {
"qid": 7819780
} | stackexchange | 107stackexchange_3
|
en | How to give boost write permissions I changed my phone and want to save images.
I tried to change the save folder but there where no folders.
my first language isn't English it's like my fourth so sorry if there was a lot of mistakes. | nreimers/reddit_question_best_answers | {
"index": 45507895
} | reddit_qa | 96reddit_qa_3
|
en | I'm doing an application with google maps API that have a JSON with the marker's coordinates. Then I draw polylines between the markers. I also implemented a function with a onclick event that creates a new marker inside the polyline. This marker has to show information of the previous marker in the polyline (the one taked of the JSON, not a clicked one). But I don't know how to take the previous vertex(marker) of a selected polyline.
[](https://i.stack.imgur.com/6UBI1.jpg)
Code:
```
(function() {
window.onload = function() {
var options = {
zoom: 3,
center: new google.maps.LatLng(37.09, -95.71),
mapTypeId: google.maps.MapTypeId.HYBRID,
noClear: true,
panControl: true,
scaleControl: false,
streetViewControl:false,
overviewMapControl:false,
rotateControl:false,
mapTypeControl: true,
zoomControl: false,
};
var map = new google.maps.Map(document.getElementById('map'), options);
// JSON
$.getJSON("loc.js", function(json) {
console.log(json);
});
//Marker type
var markers = [];
var arr = [];
var pinColor = "FE7569";
var pinImage = new google.maps.MarkerImage("http://labs.google.com/ridefinder/images/mm_20_red.png" + pinColor,
new google.maps.Size(21, 34),
new google.maps.Point(0,0),
new google.maps.Point(10, 34));
// JSON loop
for (var i = 0, length = json.length; i < length; i++) {
var data = json[i],
latLng = new google.maps.LatLng(data.lat, data.lng);
arr.push(latLng);
// Create markers
var marker = new google.maps.Marker({
position: latLng,
map: map,
icon: pinImage,
});
infoBox(map, marker, data);
//Polylines
var flightPath = new google.maps.Polyline({
path: json,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2,
map:map
});
infoPoly(map, flightPath, data);
//Calculate polylines distance
google.maps.LatLng.prototype.kmTo = function(a){
var e = Math, ra = e.PI/180;
var b = this.lat() * ra, c = a.lat() * ra, d = b - c;
var g = this.lng() * ra - a.lng() * ra;
var f = 2 * e.asin(e.sqrt(e.pow(e.sin(d/2), 2) + e.cos(b) * e.cos
(c) * e.pow(e.sin(g/2), 2)));
return f * 6378.137;
}
google.maps.Polyline.prototype.inKm = function(n){
var a = this.getPath(n), len = a.getLength(), dist = 0;
for (var i=0; i < len-1; i++) {
dist += a.getAt(i).kmTo(a.getAt(i+1));
}
return dist;
}
}
function infoBox(map, marker, data) {
var infoWindow = new google.maps.InfoWindow();
google.maps.event.addListener(marker, "click", function(e) {
salta(data.tm);
});
(function(marker, data) {
google.maps.event.addListener(marker, "click", function(e) {
salta(data.tm);
});
})(marker, data);
}
//Create onclick marker on the polyline
function infoPoly(map, flightPath, data){
google.maps.event.addListener(flightPath, 'click', function(event) {
mk = new google.maps.Marker({
map: map,
position: event.latLng,
});
markers.push(mk);
map.setZoom(17);
map.setCenter(mk.getPosition());
});
}
function drawPath() {
var coords = [];
for (var i = 0; i < markers.length; i++) {
coords.push(markers[i].getPosition());
}
flightPath.setPath(coords);
}
// Fit these bounds to the map
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < arr.length; i++) {
bounds.extend(arr[i]);
}
map.fitBounds(bounds);
//dist polylines
distpoly = flightPath.inKm();
distpolyround = Math.round(distpoly);
};
})();
```
If I click in the blue arrow, I create a marker on that point of the polyline. I that marker it takes the values of the previous one. | ArmelR/stack-exchange-instruction | {
"qid": 36827322
} | stackexchange | 110stackexchange_6
|
en | I'm converting images from RGB to CMYK. How can I tell if my image is CMYK from the Linux command line? | ArmelR/stack-exchange-instruction | {
"qid": 370959
} | stackexchange | 106stackexchange_2
|
en | I have a large sequence of vectors of length N. I need some unsupervised learning algorithm to divide these vectors into M segments.
For example:

K-means is not suitable, because it puts similar elements from different locations into a single cluster.
Update:
The real data looks like this:

Here, I see 3 clusters: `[0..50], [50..200], [200..250]`
Update 2:
I used modified k-means and got this acceptable result:

Borders of clusters: `[0, 38, 195, 246]` | ArmelR/stack-exchange-instruction | {
"qid": 6113
} | stackexchange | 108stackexchange_4
|
en | I am trying to remove all files on my storage card without removing one. I can keep the directory I specify but not its contents with my current code. It just leaves the blank
folder data because it removes everything inside. How can I keep it from removing that folder and its contents?
```
private void button1_Click(object sender, EventArgs e)
{
ScanDirectory scanDirectory = new ScanDirectory();
scanDirectory.WalkDirectory(@"/Storage Card");
scanDirectory.WalkDirectory(@"/Application");
}
public class ScanDirectory
{
public void WalkDirectory(string directory)
{
WalkDirectory(new DirectoryInfo(directory));
}
private static void WalkDirectory(DirectoryInfo directory)
{
// Scan all files in the current path
foreach (FileInfo file in directory.GetFiles())
{
file.Attributes &= ~FileAttributes.ReadOnly;
var name = file.Name;
name = name.ToLower();
if (name != "test.txt")
{
file.Delete();
}
}
DirectoryInfo[] subDirectories = directory.GetDirectories();
foreach (DirectoryInfo subDirectory in subDirectories)
{
WalkDirectory(subDirectory);
subDirectory.Attributes &= ~FileAttributes.ReadOnly;
var name = subDirectory.Name;
name = name.ToLower();
if (name != "data")
{
subDirectory.Delete();
}
}
}
}
``` | ArmelR/stack-exchange-instruction | {
"qid": 17282033
} | stackexchange | 109stackexchange_5
|
en | I'm trying to set up pretty format colors for Git. From what I can tell version 1.6.0 only recognizes red, green and blue.
```
$ git log --pretty=format:"%Credred%Creset %Cgreengreen%Creset %Cyellowyellow%Creset %Cblueblue%Creset %Cmagentamagenta%Creset %Ccyancyan%Creset %Cwhitewhite%Creset"
red green %Cyellowyellow%Creset blue %Cmagentamagenta %Ccyancyan %Cwhitewhite
```
**In addition none of the colors work with the parenthesized color format.**
Is there a way to list the available pretty format colors for Git?
Unfortunately this is on a legacy SCO OpenServer 5.0.7 machine and the last version of Git released by SCO Skunkworks was 1.6.0.3. | ArmelR/stack-exchange-instruction | {
"qid": 15458237
} | stackexchange | 108stackexchange_4
|
en | I am doing a hydroponics project at school.
For this I need to make a circuit for a Ph sensor, I was going crazy looking and I found only one that did not really work for me, I will add photos.
The voltages do not give me as they should give me
Where I got the schematic from is here: [Building a pH meter circuit - is it feasible?](https://electronics.stackexchange.com/questions/289548/building-a-ph-meter-circuit-is-it-feasible)
Abe Karplus did answer.
[](https://i.stack.imgur.com/DjdMP.png)
By the way, I didn't use the op amp that this man used. I used a UA741CP.
Then I used the same scheme that that man came up with to use in proteus and then make the board.
[](https://i.stack.imgur.com/Iw8GY.png)
[](https://i.stack.imgur.com/3jkVX.png)
And this is how I got the board:
[](https://i.stack.imgur.com/1ah97.jpg)
[](https://i.stack.imgur.com/kCR7h.jpg) | ArmelR/stack-exchange-instruction | {
"qid": 589075
} | stackexchange | 109stackexchange_5
|
en | I need help with improving my script's execution time.
It does what it suppose to do:
* Reads a file line by line
* Matches the line with the content of json file
* Writes both the matching lines with the corresponding information from json file into a new txt file
The problem is with execution time, the file has more than 500,000 lines and the json file contains much more.
How can I optimize this script?
```py
import json
import time
start = time.time()
print start
JsonFile=open('categories.json')
data = json.load(JsonFile)
Annotated_Data={}
FileList = [line.rstrip('\n') for line in open("FilesNamesID.txt")]
for File in FileList:
for key, value in data.items():
if File == key:
Annotated_Data[key]=(value)
with open('Annotated_Files.txt', 'w') as outfile:
json.dump(Annotated_Data, outfile, indent=4)
end = time.time()
print(end - start)
``` | ArmelR/stack-exchange-instruction | {
"qid": 56762150
} | stackexchange | 108stackexchange_4
|
en | Is there a permission to allow one app to read the (private) data/data//files/... files of another application? If not, how do backup programs like MyBackup work?
C | ArmelR/stack-exchange-instruction | {
"qid": 2899631
} | stackexchange | 107stackexchange_3
|
en | Hello Dr, I have a son age 12 years. He is suffering from infection in intestine from last three days. Day before yesterday Dr has given him Junior Lanjol-15 tab , one each for three days. Today is third day and third tab will be given today. he was also given Meftal-spas for pain (I think) tablets thrice a day. So far he has taken (7 tab 3x2=6 + 1 tab of today morning) Pain is little less but he is having dysentery. pl advice... | lavita/medical-qa-datasets(chatdoctor_healthcaremagic) | {
"index": 90942
} | healthcaremagic | 51healthcaremagic_4
|
en | Are pumps for blow up mattresses provided? Travelling from UK so was wondering if edc provide pumps for blow up mattresses on site? Or is it possible to rely on others to have one around me? | nreimers/reddit_question_best_answers | {
"index": 27939707
} | reddit_qa | 96reddit_qa_3
|
en | I have an unordered\_map of an unordered\_map which stores a pointer of objects. The unordered map is being shared by multiple threads. I need to iterate through each object and perform some time consuming operation (like sending it through network etc) . How could I lock the multiple unordered\_map so that it won't blocked for too long?
```
typedef std::unordered_map<string, classA*>MAP1;
typedef std::unordered_map<int, MAP1*>MAP2;
MAP2 map2;
pthread_mutex_lock(&mutexA) //how could I lock the maps? Could I reduce the lock granularity?
for(MAP2::iterator it2 = map2.begin; it2 != map2.end; it2++)
{
for(MAP1::iterator it1 = *(it2->second).begin(); it1 != *(it2->second).end(); it1++)
{
//perform some time consuming operation on it1->second eg
sendToNetwork(*(it1->second));
}
}
pthread_mutex_unlock(&mutexA)
``` | ArmelR/stack-exchange-instruction | {
"qid": 4654522
} | stackexchange | 108stackexchange_4
|
en | Stauskas trade ideas So the kings have apparently made stauskas available. I know many hornets fans wanted him in the draft. Any ideas of possible trades for him? Also, why haven't we heard anything about hornets pursuing him? | nreimers/reddit_question_best_answers | {
"index": 8227254
} | reddit_qa | 96reddit_qa_3
|
en | I can retrieve values from our database at work that represent coordinates. I use SQL to retrieve the data and open the results in Excel. They're stored to appear as coordinates in the degrees format, e.g. DDMMSS for LAT and DDDMMSS for LONG.
The excel sheet is created with two columns labeled LAT and LONG. However the values are formatted as General and so Excel treats them as string. e.g. 987654 for LAT and 9876543 for LONG
I need the data as time values to perform Great Circle Distance calculations as described here:
<http://www.cpearson.com/excel/LatLong.aspx>
I manage to convert the string values to Time values by using:
```
=TIME(VALUE(MID(A1,1,2)),VALUE(MID(A1,3,2)),VALUE(MID(A1,5,2)))
```
However the HH values are not maintained.
e.g. 544039 becomes 06:40:39
The 54 becomes an 06 because 54/24 = 2.25 and 0.25\*24 = 6
BUT I need to maintain it as 54 not 06.
I believe Excel calls it "Elapsed Time" in the following format:
```
[hh]:mm:ss
```
How can I properly convert 544039 from a string value, to an Elapsed Time value; 54:40:39?
Any help would be appreciated. I'm open to running VB scripts if needed. | ArmelR/stack-exchange-instruction | {
"qid": 22849383
} | stackexchange | 109stackexchange_5
|
Subsets and Splits