Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
39,717,516 | Why is System.Net.Http.HttpMethod a class, not an enum? | <p><code>HttpStatusCode</code> is implemented as an <code>enum</code>, with each possible value assigned to its corresponding HTTP status code (e.g. <code>(int)HttpStatusCode.Ok == 200</code>). </p>
<p>However, <code>HttpMethod</code> is <a href="https://msdn.microsoft.com/en-us/library/system.net.http.httpmethod(v=vs.118).aspx" rel="noreferrer">implemented as a <code>class</code></a>, with static properties to get instances for the various HTTP verbs (<code>HttpStatus.GET</code>, <code>HttpStatus.PUT</code> etc). What is the rationale behind <em>not</em> implementing <code>HttpMethod</code> as an <code>enum</code>?</p>
| <c#><language-design> | 2016-09-27 06:29:58 | HQ |
39,718,268 | Why do const references extend the lifetime of rvalues? | <p>Why did the C++ committee decide that const references should extend the lifetime of temporaries?</p>
<p>This fact has already been discussed extensively online, including here on stackoverflow. The definitive resource explaining that this is the case is probably this GoTW:</p>
<p><a href="https://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/" rel="noreferrer">GotW #88: A Candidate For the “Most Important const”</a></p>
<p>What was the rationale for this language feature? Is it known?</p>
<p>(The alternative would be that the lifetime of temporaries is not extended by any references.)</p>
<hr>
<p>My own pet theory for the rationale is that this behavior allows objects to hide implementation details. With this rule, a member function can switch between returning a value or a const reference to an already internally existent value without any change to client code. For example, a matrix class might be able to return row vectors and column vectors. To minimize copies, either one or the other could be returned as a reference depending on the implementation (row major vs column major). Whichever one cannot be returned by reference must be returned by making a copy and returning that value (if the returned vectors are contiguous). The library writer might want leeway to change the implementation in the future (row major vs column major) and prevent clients from writing code that strongly depends on if the implementation is row major or column major. By asking clients to accept return values as const ref, the matrix class can return either const refs or values without any change to client code. Regardless, if the original rationale is known, I would like to know it.</p>
| <c++><standards> | 2016-09-27 07:11:05 | HQ |
39,718,294 | Error running docker container: No space left on device: "/data/db/journal" | <p>Running containers form docker-compose on a Mac, this is the file</p>
<pre><code>api:
build: .
volumes:
- .:/src
- /src/node_modules
links:
- mongo
- redis
ports:
- "3015:3015"
- "5858:5858"
mongo:
image: mongo:3.3
ports:
- "27017:27017"
redis:
image: redis
ports:
- "6379:6379"
</code></pre>
<p>Running docker-compose up the mongo container fails and exit. this is the log file:</p>
<pre><code>MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=7115a6cce706
db version v3.3.14
git version: 507a5b4d334c1b4bea8fa232fa6b882849608e97
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
allocator: tcmalloc
modules: none
build environment:
distmod: debian81
distarch: x86_64
target_arch: x86_64
options: {}
** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
See http://dochub.mongodb.org/core/prodnotes-filesystem
error creating journal dir /data/db/journal boost::filesystem::create_directory: No space left on device: "/data/db/journal"
exception in initAndListen std::exception: boost::filesystem::create_directory: No space left on device: "/data/db/journal", terminating
shutdown: going to close listening sockets...
removing socket file: /tmp/mongodb-27017.sock
shutdown: going to flush diaglog...
now exiting
shutting down with code:100
</code></pre>
<p>The main complain it's about no space left for creating a dir but I can't figured out how to fix it.</p>
| <mongodb><docker><docker-compose> | 2016-09-27 07:11:59 | HQ |
39,718,412 | Visual studio code - keyboard shortcuts - expand/collapse all | <p>Trying to find the equivalent to <strong>ctrl + shift + "-"</strong> in Intellij that collapses/expands all functions.</p>
| <visual-studio-code> | 2016-09-27 07:17:31 | HQ |
39,718,690 | How to create custom Toobar in android ..? | Hello everyone i need custom toolbar for my app can anyone help me to create like this Image.
[![enter image description here][1]][1]
**back Button in Left Title in Center and a Save Manu in Right.**
[1]: http://i.stack.imgur.com/XjfUH.png | <android><android-custom-view><android-toolbar> | 2016-09-27 07:30:54 | LQ_EDIT |
39,719,370 | How to wrap checked exceptions but keep the original runtime exceptions in Java | <p>I have some code that might throw both checked and runtime exceptions.</p>
<p>I'd like to catch the checked exception and wrap it with a runtime exception. But if a RuntimeException is thrown, I don't have to wrap it as it's already a runtime exception.</p>
<p>The solution I have has a bit overhead and isn't "neat":</p>
<pre><code>try {
// some code that can throw both checked and runtime exception
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
</code></pre>
<p><strong>Any idea for a more elegant way?</strong></p>
| <java><runtimeexception><checked-exceptions> | 2016-09-27 08:06:38 | HQ |
39,719,567 | Not nesting version of @atomic() in Django? | <p>From the <a href="https://docs.djangoproject.com/en/dev/topics/db/transactions/#django.db.transaction.atomic">docs of atomic()</a></p>
<blockquote>
<p>atomic blocks can be nested</p>
</blockquote>
<p>This sound like a great feature, but in my use case I want the opposite: I want the transaction to be durable as soon as the block decorated with <code>@atomic()</code> gets left successfully.</p>
<p>Is there a way to ensure durability in django's transaction handling?</p>
<h1>Background</h1>
<p>Transaction are ACID. The "D" stands for durability. That's why I think transactions can't be nested without loosing feature "D".</p>
<p>Example: If the inner transaction is successful, but the outer transaction is not, then the outer and the inner transaction get rolled back. The result: The inner transaction was not durable.</p>
<p>I use PostgreSQL, but AFAIK this should not matter much.</p>
| <python><django><postgresql><transactions><acid> | 2016-09-27 08:17:37 | HQ |
39,719,645 | Convert datetime value from one timezone to UTC timezone using sql query | <p>I have a datetime value.
That datetime value may be in any timezone like 'Eastern Standard Time' or 'India Standard Time'.
I want to convert that datetime value to UTC timezone in sql.
Here from timezone value will be the given parameter.
I can achieve this using c# code also.But I need this in sql query.</p>
<p>Can anyone tell me how can I convert that?</p>
| <sql-server><datetime> | 2016-09-27 08:22:05 | HQ |
39,721,386 | How to perform a non linear regression using nls function? | I have set of Temperature and Discomfort index value for each temperature data. When i plot a graph between temperature(x axis) and Calculated Discomfort index value( y axis) i get a inverted U shape curve. I want to do non linear regression out of it and convert it into PMML model.My aim is to get the predicted dicomfort value if i give certain temperature.
Please find the below data set :
Temp <- c(0,5,10,6 ,9,13,15,16,20,21,24,26,29,30,32,34,36,38,40,43,44,45 50,60)
Disc<-c(0.00,0.10,0.25,0.15,0.24,0.26,0.30,0.31,0.40,0.41,0.49,0.50,0.56 0.80,0.90,1.00,1.00,1.00,0.80,0.50,0.40,0.20,0.15,0.00)
How to do non linear regression for this data set ?
Thanks
Arul
| <r><regression><non-linear-regression><pmml> | 2016-09-27 09:45:27 | LQ_EDIT |
39,721,654 | Take ownership of parameter by rvalue-reference | <p>I want to make clear that the constructor of my class <code>A</code> will take ownership of the passed <code>Data</code> parameter. The obvious thing to do is take a <code>unique_ptr</code> by value:</p>
<pre><code>class A
{
public:
A(std::unique_ptr<Data> data) : _data(std::move(data)) { }
std::unique_ptr<Data> _data;
};
</code></pre>
<p>However, for my use-case, there is no reason why <code>Data</code> should be a pointer, since a value type would suffice. The only remaining option that I could think of to make really clear that <code>Data</code> will be owned by <code>A</code> is pass by rvalue-reference:</p>
<pre><code>class A
{
public:
A(Data&& data) : _data(std::move(data)) { }
Data _data;
};
</code></pre>
<p>Is this a valid way to signal ownership or are there better options to do this without using <code>unique_ptr</code>?</p>
| <c++><c++11><unique-ptr><rvalue-reference> | 2016-09-27 09:57:17 | HQ |
39,721,812 | React Router Without Changing URL | <p>I need to have routing that works <strong>without changing the URL</strong>. </p>
<p>Before implementing this on my own, I tried to look for something by react router. I saw that there is such a thing called <strong><code>createMemoryHistory</code></strong>:</p>
<blockquote>
<p>createMemoryHistory([options])</p>
<p>createMemoryHistory creates an in-memory history object that does not
interact with the browser URL. This is useful for when you need to
customize the history object used for server-side rendering, for
automated testing, or for when you do not want to manipulate the
browser URL, such as when your application is embedded in an iframe.</p>
</blockquote>
<p>But beyond this paragraph there aren't any usage examples and I can't find a usage for this anywhere, i.e: how to use <code>Link</code> component to navigate without a pathname, by which parameter do I route if not pathname, etc.</p>
<p>Is this right for my needs, or do I have to implement a router on my own?</p>
| <javascript><reactjs><react-router> | 2016-09-27 10:04:44 | HQ |
39,721,834 | Logout from Fabric Plugin | <p>I want to logout from Fabric Plugin used in Android Studio. Clicking on Profile icon is not working but I need to switch account in there for another project.
What to do? </p>
| <android><android-studio><twitter-fabric> | 2016-09-27 10:05:35 | HQ |
39,722,758 | Runtime errors in Java interpreter | <p>is the Java interpreter the one that does run the bytecode? The runtime errors are detected by the interpreter ?<br>
Thanks </p>
| <java><interpreter> | 2016-09-27 10:52:29 | LQ_CLOSE |
39,722,844 | Core Data file's Location iOS 10 | <p>I am trying to us SQLite Browsers to see my Core Data objects. I am not able to find where does the core data save its sql file. I looked into the app documents folder but there is nothing there. </p>
<p>Do you know where does the core data in IOS 10(simulator) save its SQLite files on?</p>
| <ios><swift><core-data><ios-simulator><ios10> | 2016-09-27 10:56:16 | HQ |
39,723,391 | Passing react text field input values as parameters to a method | <p>I have the below input fields of which I need to get the entered inputs and pass it to the onClick event of the button shown below.</p>
<pre><code><input type="text" style={textFieldStyle} name="topicBox" placeholder="Enter topic here..."/>
<input type="text" style = {textFieldStyle} name="payloadBox" placeholder="Enter payload here..."/>
<button value="Send" style={ buttonStyle } onClick={this.publish.bind(this,<value of input field 1>,<value of input field2>)}>Publish</button><span/>
</code></pre>
<p>I have a method called publish which takes two string arguments. In place of those strings, I need to pass the values entered in the input fields. How can I achieve this without storing the values in states? I do not want to store the input field values in state variables. Any help would be much appreciated.</p>
| <javascript><button><reactjs><input><typescript> | 2016-09-27 11:23:38 | HQ |
39,723,518 | The best solution for implement two icon enable or disable | <p>I need two icon,<br>
If is verify email, show an icon without hyberlink and set "activated" css class for green style and checked.<br>
If is not verify email, the icon is linked to the verify page, and default is gray color style.<br>
Which of the below solution is better and standard? </p>
<h1>Solution #1:</h1>
<pre><code><a href="<?php echo ($modelStatic->isVerifiedEmail) ? 'javascript:void(0)' :
Yii::app()->createUrl('/user/reActivate'); ?>"
class="item<?php if($modelStatic->isVerifiedEmail) echo ' activated'; ?>">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</a>
<style>
.activated {
cursor: default;
}
</style>
</code></pre>
<h1>Solution #2:</h1>
<pre><code>if($modelStatic->isVerifiedEmail) : ?>
<div class="item activated">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</div>
<?php else: ?>
<a href="<?php echo Yii::app()->createUrl('/user/reActivate'); ?>"
class="item">
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
</a>
<?php endif; ?>
</code></pre>
<h1>Solution #3:</h1>
<pre><code><?php if($modelStatic->isVerifiedEmail) : ?>
<div class="item activated">
<?php else: ?>
<a href="<?php echo Yii::app()->createUrl('/user/reActivate'); ?>" class="item">
<?php endif; ?>
<div class="confirm-icon">
<i class="fa fa-envelope-o"></i>
</div>
<div class="text">
<?php echo Yii::t('app', 'Verify Email'); ?>
</div>
<?php if($modelStatic->isVerifiedEmail) : ?>
</div>
<?php else: ?>
</a>
<?php endif; ?>
</code></pre>
| <php><html><css> | 2016-09-27 11:30:06 | LQ_CLOSE |
39,723,887 | Get url parameter and hashed value from an url in javascript | I have a url `http://local.evibe-dash.in/tickets/123?ref=avl-error#10610`
I want to get ref=avl-error and 10610 in two variable
for Example somthing like that
var1 = 'avl-error';
var2 = 10610;
How can I get it in javascript or jQuery
| <javascript><jquery><string><url> | 2016-09-27 11:48:50 | LQ_EDIT |
39,724,072 | I need to find a data structure | <p>I need a data structure in java that can store 1 key and 2 pair values. 1 value needs to be a string and the other an int.
I will also need to be able to put in and take out values and sort the pairs according to the int value.
Please help!</p>
| <java> | 2016-09-27 11:58:31 | LQ_CLOSE |
39,724,200 | replace method for python strings | <p>I have a string S = 'spam'</p>
<p>When I use the method replace as S.replace('pa', 'xx')</p>
<pre><code>S.replace('pa', 'xx')
</code></pre>
<p>The output I get is -</p>
<pre><code>Out[1044]: "sxxm's"
</code></pre>
<p>Why then are the python strings known to be immutable ?</p>
| <python><string><immutability> | 2016-09-27 12:05:28 | LQ_CLOSE |
39,725,326 | Cant connect dynamo Db from my vpc configured lambda function | <p>i need to connect elastic cache and dynamo db from a single lambda function. My code is</p>
<pre><code>exports.handler = (event, context, callback) => {
var redis = require("redis");
var client;
function connectRedisClient() {
client = redis.createClient(6379, "dgdfgdfgdfgdfgdfgfd.use1.cache.amazonaws.com", { no_ready_check: true });
}
connectRedisClient();
client.set('sampleKey', 'Hello World', redis.print);
console.log("set worked");
client.quit();
var AWS = require("aws-sdk");
var docClient = new AWS.DynamoDB.DocumentClient();
var table = "dummy";
var year = 2015;
var title = "The Big New Movie";
var params = {
TableName: table,
Item: {
"userid": "manafcj",
"year": year,
"title": title,
"test1": [645645, 7988],
"info": {
"plot": "Nothing happens at all.",
"rating": 0
}
}
};
console.log("Adding a new item...");
docClient.put(params, function (err, data) {
if (err) {
console.error("Unable to add item. Error JSON:", JSON.stringify(err, null, 2));
} else {
console.log("Added item:", JSON.stringify(data, null, 2));
}
});
callback(null, 'Hello from Lambda');
};
</code></pre>
<p>I executed this lambda code without configuring vpc, elastic cache section is not working , but dynamo insertion is done perfectly.</p>
<p>after that i made setup for VPC in my account by following steps.</p>
<ol>
<li><p>create vpc
name : test-vpc-name
CIDR block:172.31.0.0/16
Tenancy:Default</p></li>
<li><p>Create a new subnet.
name tag : test-subnet-1a
CIDR block :172.31.0.0/20</p>
<p>name tag : test-subnet-1b
CIDR block :172.31.16.0/20</p></li>
<li><p>Create a route table
name tag : test-route-table</p></li>
<li><p>Create a internet gateway
name:test-internet-gateway</p></li>
<li><p>Attach VPC</p></li>
<li><p>Route all outbound 0.0.0.0/0 traffic in routes</p></li>
<li><p>Create a route table subnet association</p></li>
<li><p>Create a NAT Gateway
subnet : test-subnet-1a</p></li>
</ol>
<p>also i have configured my elastic cache setup by following steps</p>
<ol>
<li><p>Create subnet cache group
name : test-cache-group</p></li>
<li><p>Create elastic cache<br>
type: redis
Cluster Name : test-cache</p>
<p>subnet cache group : test-cache-group</p></li>
</ol>
<p>Finally, i have configured newly created vpc on my lambda function. Then redis-elastic cache connection is working fine, but dynamo db connection is lost. I need both working fine from a single lambda function.</p>
<p>I think, some fault in VPC configuration with NAT Gateway. </p>
<p>What is the actual issue in this setup?</p>
| <amazon-web-services><caching><aws-lambda><amazon-vpc><amazon-elasticache> | 2016-09-27 12:58:12 | HQ |
39,725,365 | PChart linear chart image quality | <p>I am using PChart to create linear charts. Everything goes well beside the quality of the actual lines drawn.</p>
<p>Of course, antialiasing is <em>not</em> turned off, and even explicitly turned on. </p>
<p>Here is an example of the actual image, which looks quite ugly with all these steps. </p>
<p><a href="https://i.stack.imgur.com/6NRzG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6NRzG.png" alt="enter image description here"></a></p>
<p>Is there a way to make the lines drawn smoother, without stepping?</p>
<p>The code used:</p>
<pre><code>public function linearTwoAxis($data, $fileName, $startColor = 0)
{
$pData = new \pData();
$i = 0;
foreach ($data as $key => $row)
{
$serie = $this->translator->trans("pages.reportDefault.$key");
$pData->addPoints($row, $serie);
$pData->setSerieOnAxis($serie, $i);
$pData->setSerieWeight($serie, 1);
$pData->setAxisName($i, $serie);
$pData->setPalette($serie, $this->colors[$startColor++]);
$pData->setAxisDisplay($i, AXIS_FORMAT_METRIC);
$i++;
}
$monthNames = array_keys($row);
$pData->setAxisPosition(1, AXIS_POSITION_RIGHT);
$pData->addPoints($monthNames, "Labels");
$pData->setAbscissa("Labels");
$pChart = new \pImage(750, 200, $pData);
$pChart->setFontProperties(array(
"FontName" => $this->fonts_dir . "arial.ttf",
"FontSize" => 8)
);
$pChart->setGraphArea(50, 10, 700, 150);
$pChart->Antialias = TRUE;
$pChart->drawScale(["Mode" => SCALE_MODE_START0]);
$pChart->drawLineChart();
$pChart->drawLegend(325,180,array("Style"=>LEGEND_BOX,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>30,"Family"=>LEGEND_FAMILY_LINE,"Alpha" => 0));
$pChart->render($this->target_dir . $fileName);
return $this->target_dirname . $fileName;
}
</code></pre>
| <php><pchart><image-quality> | 2016-09-27 13:00:08 | HQ |
39,725,367 | How to turn on speaker for incoming call programmatically in Android L? | <p>I want to accept an incoming call using answering phone's GUI (Phone's GUI) of my phone in Android 5.0. I found a way that needs to make an activity which use to send some action to open the Phone's GUI. I was successful to turn on the Phone's GUI for an incoming call. The issue is how can I turn on the speaker for the Phone's GUI. I tried the code but it does not turn on. Could you help me to solve that issue in Android L</p>
<pre><code>audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_CALL);
if (!audioManager.isSpeakerphoneOn())
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_NORMAL);
</code></pre>
<p>Manifest</p>
<pre><code><uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
</code></pre>
<p>Besides, do we have more shoter way to open accept a incoming call using answering phone's intent. My way is so long because it use an Activity. </p>
<p>This is my full class code</p>
<pre><code>public class AcceptCallActivity extends Activity {
private static final String MANUFACTURER_HTC = "HTC";
private KeyguardManager keyguardManager;
private AudioManager audioManager;
private CallStateReceiver callStateReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
}
@Override
protected void onResume() {
super.onResume();
registerCallStateReceiver();
updateWindowFlags();
acceptCall();
}
@Override
protected void onPause() {
super.onPause();
if (callStateReceiver != null) {
unregisterReceiver(callStateReceiver);
callStateReceiver = null;
}
}
private void registerCallStateReceiver() {
callStateReceiver = new CallStateReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
registerReceiver(callStateReceiver, intentFilter);
}
private void updateWindowFlags() {
if (keyguardManager.inKeyguardRestrictedInputMode()) {
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
} else {
getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
}
private void acceptCall() {
// for HTC devices we need to broadcast a connected headset
boolean broadcastConnected = MANUFACTURER_HTC.equalsIgnoreCase(Build.MANUFACTURER)
&& !audioManager.isWiredHeadsetOn();
if (broadcastConnected) {
broadcastHeadsetConnected(false);
}
try {
try {
Log.d("AnswerCall","execute input keycode headset hook");
//Turn on speaker
audioManager.setMode(AudioManager.MODE_IN_CALL);
if (!audioManager.isSpeakerphoneOn())
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_NORMAL);
Runtime.getRuntime().exec("input keyevent " +
Integer.toString(KeyEvent.KEYCODE_HEADSETHOOK));
} catch (IOException e) {
// Runtime.exec(String) had an I/O problem, try to fall back
Log.d("AnswerCall","send keycode headset hook intents");
String enforcedPerm = "android.permission.CALL_PRIVILEGED";
Intent btnDown = new Intent(Intent.ACTION_MEDIA_BUTTON).putExtra(
Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_HEADSETHOOK));
Intent btnUp = new Intent(Intent.ACTION_MEDIA_BUTTON).putExtra(
Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP,
KeyEvent.KEYCODE_HEADSETHOOK));
sendOrderedBroadcast(btnDown, enforcedPerm);
sendOrderedBroadcast(btnUp, enforcedPerm);
}
} finally {
if (broadcastConnected) {
broadcastHeadsetConnected(false);
}
}
}
private void broadcastHeadsetConnected(boolean connected) {
Intent i = new Intent(Intent.ACTION_HEADSET_PLUG);
i.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
i.putExtra("state", connected ? 1 : 0);
i.putExtra("name", "mysms");
try {
sendOrderedBroadcast(i, null);
} catch (Exception e) {
}
}
private class CallStateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
finish();
}
}
}
</code></pre>
| <android><android-intent><android-audiomanager> | 2016-09-27 13:00:11 | HQ |
39,726,174 | Why the statements oDiv[i].style.z-index = arr[i][3]; didn't work? | <p>I had consoled arr[i][3] and I'm sure that it was absolutely correct,else,others statements worked and I don't know why.
The code was listed as follows</p>
<pre><code> for(var i = 0; i<oDiv.length;i++){
arr.push([getAttr(oDiv[i],"left"),getAttr(oDiv[i],"top"),
getAttr(oDiv[i],"opacity"),getAttr(oDiv[i],"z-index")]);
//console.log(arr); it shows a correct value;
}
oBtn[0].onclick = function(){
arr.unshift(arr[arr.length-1]);
arr.pop();
for (var i = 0; i<arr.length; i++) {
oDiv[i].style.left = arr[i][0];
oDiv[i].style.top = arr[i][1];
oDiv[i].style.opacity = arr[i][2]; //these three statements worked;
oDiv[i].style.z-index = arr[i][3]; //it doesn't work.
}
}
</code></pre>
| <javascript><arrays> | 2016-09-27 13:37:19 | LQ_CLOSE |
39,726,908 | JavaScript blinking eye animation | <p>I am currently trying to learn JavaScript and trying out a lot of stuff, but as for now, my JS skilly are still very limited.
I created a little game where there is a box with bunny heads which randomly appear and the user has to click them as fast as possible.</p>
<p>So I created the bunnies with an interval animation where the bunny closes and opens its eyes within every 2 seconds.
Now I feel kind of stupid, but i can't manage to get the animation working as I want it to. Now the bunny is just closing its eyes every 2 seconds and then opening them again every 2 seconds. However, I want it only to blink, meaning that the eyes should be closed just for an instant and then opened again, so that the bunny is blinking every 2 seconds.
And then I would also like it to randomly sometimes blink only once and sometimes blink twice.
Not sure if this is hella easy and I am just blind from hours of coding stuff and learning new things, but it seems that I might need your help here.</p>
<p><a href="https://jsfiddle.net/schakalwal/y390jcx8/">Here is a fiddle</a> of the whole thing as it is right now.</p>
<p>You can see the complete code that was used inside the fiddle. I did not want to post the whole website here in the code section, but the parts I believe are of interest for my animation.</p>
<p>Here is the js code for the blinking eyes:</p>
<pre><code>var eyeleft = document.getElementById("eyeleft");
var eyeright = document.getElementById("eyeright");
window.onload = setInterval(function() {
eyeleft.className = (eyeleft.className != 'closedeyeleft' ? 'closedeyeleft' : 'eyeleft');
eyeright.className = (eyeright.className != 'closedeyeright' ? 'closedeyeright' : 'eyeright');
}, 2000);
</code></pre>
<p>Next the HTML</p>
<pre><code><div id="shape" class="game-shapes">
<div class="ears left"></div>
<div class="ears right"></div>
<div id="eyeleft" class="eyeleft"></div>
<div id="eyeright" class="eyeright"></div>
<div id="mouth">
<div id="tooth"></div>
<div id="tongue"></div>
</div>
</div>
</code></pre>
<p>And now CSS</p>
<pre><code>.game-shapes {
height: 80px;
width: 80px;
cursor: pointer;
opacity: 0;
position: relative;
transition: opacity ease-in-out .2s;
}
.game-shapes div {
position: absolute;
}
.eyeleft,
.eyeright {
background: #000;
border-radius: 50%;
width: 20px;
height: 20px;
top: 30px;
}
.eyeleft {
left: 4px;
}
.eyeright {
right: 4px;
}
.eyeleft:before,
.eyeleft:after,
.eyeright:before,
.eyeright:after {
content: '';
background: #fff;
width: 7px;
height: 7px;
top: 4px;
left: 4px;
border-radius: 50%;
position: absolute;
z-index: 5;
}
.eyeleft:after,
.eyeright:after {
width: 4px;
height: 4px;
top: 10px;
left: 10px;
}
.closedeyeleft,
.closedeyeright {
background: transparent none repeat scroll 0 0;
border-color: #000;
border-radius: 5px;
border-style: solid;
border-width: 4px 4px 0;
height: 4px;
top: 35px;
width: 12px;
}
.closedeyeleft {
left: 3px;
}
.closedeyeright {
right: 3px;
}
</code></pre>
| <javascript><html><css><animation> | 2016-09-27 14:08:32 | HQ |
39,727,075 | Determine user's "Temperature Unit" setting on iOS 10 (Celsius / Fahrenheit) | <p>iOS 10 adds the ability for the user to set their "Temperature Unit" choice under Settings > General > Language & Region > Temperature Unit.</p>
<p>How can my app programmatically determine this setting so it can display the right temperature unit? I poured through NSLocale.h and didn't see anything relevant.</p>
<p>(Before iOS 10, it was sufficient to test if the locale used metric and assume that metric users want to use Celsius. This is no longer the case.)</p>
| <ios><locale><ios10> | 2016-09-27 14:15:26 | HQ |
39,727,287 | Docker show current registry | <p>In docker, how can one display the current registry info you are currently logged in? I installed docker, if I now do docker push, where does it send my images?</p>
<p>I spend over 30min searching this info from Google and docker docs, and couldn't find it, so I think it deserves its own question.</p>
| <docker><docker-registry> | 2016-09-27 14:25:00 | HQ |
39,727,391 | Sql parameters and percentage increase | So how would one use a parameter to increase orders on the orderdetails database by 10 percent i did something like
add parameter named “In
cPercent”) to the value of an order if the value of IncPercent is under
10%, or if IncPercent is 10% or over, add 10% to the value of an order for all orders in the
OrderDetails table utilising IF/ELSE.*/
code what i have so far im kinda stuck
Use SKILLAGEITDB
go
Create procedure [spAddPercentage]
@incPercent decimal(5,4)
as
update OrderDetails
set @incPercent = @incpercent * 1.10
***********************************************
I cannot figure out how to use the if else statement in this code. Can anyone give me a better understanding or give me a example on what i should add for if/else? | <sql><sql-server><tsql> | 2016-09-27 14:30:27 | LQ_EDIT |
39,727,729 | Akka Streams: What does Mat represents in Source[out, Mat] | <p>In Akka streams what does Mat in Source[Out, Mat] or Sink[In, Mat] represent. When will it actually be used?</p>
| <akka><akka-stream><reactive-streams> | 2016-09-27 14:45:34 | HQ |
39,727,972 | What is the default timeout for NPM request module (REST client)? | <p>Following will be my node.js call to retrive some data, which is taking more than 1 minute. Here this will be timeout at 1 minute (60 seconds). I put a console log for the latency also. However I have configured the timeout for 120 seconds but it is not reflecting. I know the default level nodejs server timeout is 120 seconds but still I get the timeout (of 60 seconds) from this <a href="https://www.npmjs.com/package/request" rel="noreferrer">request</a> module for this call. Please provide your insights on this.</p>
<pre><code>var options = {
method: 'post',
url:url,
timeout: 120000,
json: true,
headers: {
"Content-Type": "application/json",
"X-Authorization": "abc",
"Accept-Encoding":"gzip"
}
}
var startTime = new Date();
request(options, function(e, r, body) {
var endTime = new Date();
var latencyTime = endTime - startTime;
console.log("Ended. latencyTime:"+latencyTime/1000);
res.status(200).send(body);
});
</code></pre>
| <node.js><rest><npm><timeout> | 2016-09-27 14:58:13 | HQ |
39,728,460 | iOS 10 barTintColor animation | <p>I've noticed a change in the way bar tint color animates in ios 10. I've created a sample project outlining the change: <a href="https://github.com/johnryan/ios10BarTintDemo" rel="noreferrer">Github: ios10BarTintDemo</a></p>
<p>Basically on ios 9 the barTintColor animates smoothly using <code>[UIViewControllerTransitionCoordinator animateAlongsideTransition]</code></p>
<p>but on ios 10 the animations are much less smooth and when popping a view controller doesn't animate at all, I've tried adding <code>[self.navigationController.navigationBar layoutIfNeeded]</code> as mentioned in some similar answers but this doesn't seem to have any effect when pushing/popping controllers.</p>
| <ios><objective-c><iphone><animation><ios10> | 2016-09-27 15:21:27 | HQ |
39,729,241 | Why does the container created with - 'docker run -d alpine sleep infinity' goes into exited/stopped state? | <p>I have nothing to execute inside a container but want it to be running. So, I tried to create a container using the following command line - <code>'docker run -d alpine sleep infinity'</code>. But, instead, it is going into a exited/stopped state immediately. What's the explanation?</p>
| <docker> | 2016-09-27 15:57:02 | HQ |
39,729,660 | Javascript: How to give String to onclick function | I want to give a String Parameter to a function
function test(p)
{
}
...innerHTML = '<div onclick="test(p)"><div>';
That does not work how to do it?
| <javascript><html> | 2016-09-27 16:17:32 | LQ_EDIT |
39,729,787 | Tensorflow: why 'pip uninstall tensorflow' cannot find tensorflow | <p>I'm using Tensorflow-0.8 on Ubuntu14.04. I first install Tensorflow from sources and then setup Tensorflow for development according to the <a href="https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html#setting-up-tensorflow-for-development" rel="noreferrer">official tutorial</a>. When I want to uninstall tensorflow using the following command</p>
<pre><code>sudo pip uninstall tensorflow
</code></pre>
<p>I encountered the following error:</p>
<pre><code>Can't uninstall 'tensorflow'. No files were found to uninstall
</code></pre>
<p>Could anyone tell me where is wrong?</p>
<p>For your reference, the output of
<code>pip show tensorflow</code> is</p>
<pre><code>Name: tensorflow
Version: 0.8.0
Location: /home/AIJ/tensorflow/_python_build
Requires: numpy, six, protobuf, wheel
</code></pre>
<p>But I actually find another Tensorflow directory at </p>
<pre><code>/usr/local/lib/python2.7/dist-packages/tensorflow
</code></pre>
<p>Besides, I also have a question about the general usage of Python. I have seen two quite similar directories in my system, i.e.</p>
<pre><code>/usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages
</code></pre>
<p>Could any one tell me the differences between them? I noticed that everytime I use <code>sudo pip install <package></code>, the package will be installed to <code>/usr/local/lib/python2.7/dist-packages</code>, could I instead install packages into <code>/usr/lib/python2.7/dist-packages</code> using <code>pip install</code>?</p>
<p>Thanks a lot for your help in advance!</p>
| <python><tensorflow><uninstallation> | 2016-09-27 16:25:24 | HQ |
39,729,894 | Detect non-navigation button click in WKWebView | <p>I have loaded a webpage into a <code>WKWebView</code>. I want to detect when the user clicks this specific button.</p>
<pre><code><div class="compacted-item">
<button class="btn btn-lg btn-primary deploy-button" data-ember-action="1361">
Deploy
</button>
</div>
</code></pre>
<p><code>decidePolicyFor navigationAction</code> isn't triggered because it's not a navigation action. </p>
<p>I know how to add a js message handler to the web views user content controller, but since I don't own the webpage, how do I get it to send off a message for me to intercept? Such as:</p>
<pre><code>window.webkit.messageHandlers.buttonClicked.postMessage(messageToPost);
</code></pre>
<p>Or is there another way to detect non-navigation button clicks in a <code>WKWebView</code>?</p>
| <javascript><ios><swift><wkwebview> | 2016-09-27 16:30:56 | HQ |
39,730,629 | passing multiple arguments to promise resolution within setTimeout | <p>I was trying to follow along with the MDN <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="noreferrer">promise.all</a> example but it seems I cannot pass more arguments to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout" rel="noreferrer">setTimeout callback</a>. </p>
<pre><code>var p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 200, 1,2,3);
});
var p2 = new Promise((resolve, reject) => {
setTimeout(resolve, 500, "two");
});
Promise.all([p1, p2]).then(value => {
console.log(value);
}, reason => {
console.log(reason)
});
</code></pre>
<p>This prints <code>[1, "two"]</code>, where I would expect <code>[1, 2, 3, "two"]</code>. Doing this with <code>setTimeout</code> without promise fulfillment works as expected</p>
<pre><code>setTimeout(cb, 100, 1, 2, 3);
function cb(a, b, c){
console.log(a, b, c);
}
//=>1 2 3
</code></pre>
<p>Why doesn't this work with the promise? How can it be made to work with the promise?</p>
| <javascript><asynchronous><promise><es6-promise> | 2016-09-27 17:11:55 | HQ |
39,730,726 | using processing for 3D image mapping | <p>actually I'm Arduino Neopixel fan and tried to run the spherical POV. For run POV, each image should be converted to the number of lines which is used in each revolution , I think convert the planner POV must not be so hard for java base processing to pixelizid into lines but I don't now how to map an image on spherical and then converted to image lines I really appreciated for any comment</p>
| <image-processing><arduino><processing><pixel><led> | 2016-09-27 17:18:14 | LQ_CLOSE |
39,731,431 | PYTHON READING DATA FROM INPUT FILE | i want to read specific data fro input file . how can i read.
for example my file has data like:
this is my first line
this is my second line.
so i just want to read 'first'from first line and 'secon' fromsecond line.
please help me out .
thanks | <python><python-3.x> | 2016-09-27 18:01:48 | LQ_EDIT |
39,732,223 | GraphQL pass args to sub resolve | <p>I have a relationship between User and Post. This is how I query the User Posts.</p>
<pre><code>const UserType = new GraphQLObjectType({
name: 'User'
fields: () => ({
name: {
type: GraphQLString
},
posts: {
type: new GraphQLList(PostType),
resolve(parent, args , { db }) {
// I want to get here the args.someBooleanArg
return someLogicToGetUserPosts();
}
}
})
});
</code></pre>
<p>The main query is:</p>
<pre><code>const queryType = new GraphQLObjectType({
name: 'RootQuery',
fields: {
users: {
type: new GraphQLList(UserType),
args: {
id: {
type: GraphQLInt
},
someBooleanArg: {
type: GraphQLInt
}
},
resolve: (root, { id, someBooleanArg }, { db }) => {
return someLogicToGetUsers();
}
}
}
});
</code></pre>
<p>The problem is the args in the resolve function of the UserType posts is empty object, how do i pass the args from the main query to sub resolves functions?</p>
| <graphql><graphql-js> | 2016-09-27 18:49:18 | HQ |
39,733,120 | How to read in existing data into Quill JS | <p>I am having real trouble understanding how to work with quill...</p>
<p>Saving the data is not a problem as that pretty straight forward :)</p>
<p>I am a little stuck on two points</p>
<ol>
<li>How to edit the saved data in quill</li>
<li>How to parse the saved data to create a static page</li>
</ol>
<p>can anyone offer any advice how to load the delta </p>
<pre><code>{"ops":[{"insert":"this is a test bit of text\n"}]}
</code></pre>
<p>back into the quill editor and how to parse the output to create a page?</p>
<p>Thanks in advance for any replies!</p>
| <javascript><json><quill> | 2016-09-27 19:47:44 | HQ |
39,733,551 | Trailing and Leading constraints in Swift programmatically (NSLayoutConstraints) | <p>I'm adding from a xib a view into my ViewController. Then I'm putting its constraints to actually fit it </p>
<pre><code>override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
...
...
view!.addSubview(gamePreview)
gamePreview.translatesAutoresizingMaskIntoConstraints = false
if #available(iOS 9.0, *) {
// Pin the leading edge of myView to the margin's leading edge
gamePreview.leadingAnchor.constraintEqualToAnchor(view.leadingAnchor).active = true
//Pin the trailing edge of myView to the margin's trailing edge
gamePreview.trailingAnchor.constraintEqualToAnchor(view.trailingAnchor).active = true
} else {
// Fallback on earlier versions
view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .TrailingMargin, relatedBy: .Equal, toItem: view, attribute: .TrailingMargin, multiplier: 1, constant: 0))
view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .LeadingMargin, relatedBy: .Equal, toItem: view, attribute: .LeadingMargin, multiplier: 1, constant: 0))
}
view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Top, relatedBy: .Equal, toItem: self.topLayoutGuide, attribute: .Bottom, multiplier: 1, constant: 0))
view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute,multiplier: 1, constant: 131))
}
</code></pre>
<p>What i'm trying to do: To actually fit my view constraining it to top, leading, trailing to ViewController's view, and with a prefixed height. The view I'm adding to main view has its own transparent-background view, so no need of margin (the view is meant to be device's width size, so).</p>
<p>I've placed 2 couples of lines that would be supposed to be equal (in my attempts), with the if, because the first 2 lines in if are actually available in iOS9> only, while I'm attempting to do the same thing in the else statement, for every device (starting from iOS 8).</p>
<p>This is what I get:</p>
<p>iOS9+ at left, iOS8+ at right. Transparent background was colored red to show what happens (don't mind at different height in the images, they're equal height in app, instead look at added margins at left and right)</p>
<p><img src="https://i.imgur.com/9DwYku4m.png" alt="">
<img src="https://i.imgur.com/bPLYEWWm.png" alt=""></p>
<p>I also tried <code>AutoLayoutDSL-Swift</code>, but doesn't help, I'm not expert with it but every attempt made only things worse.</p>
<p>How can I write those constraints using classic NSLayoutConstraints methods, and how could I write all in a better way with a framework like AutoLayoutDSL or a fork of it? (or an alternative, though now mostly I'm concerned on official libs)</p>
| <ios><iphone><swift2><nslayoutconstraint> | 2016-09-27 20:16:06 | HQ |
39,734,133 | Jekyll: Include a file from directory outside of _includes | <p>I have an directory called <code>/patterns</code> in my Jekyll site, whose structure generally looks generally like this:</p>
<p><code>
_includes
_layouts
_site
/patterns
index.html
</code></p>
<p>I need to keep the <code>/patterns</code> directory outside <code>_includes</code> for a number of reasons, but mostly because I need to pull the files in <code>/patterns</code> into an iframe to display in a pattern library).</p>
<p>I'd like to include files from <code>/patterns</code> in my Jekyll pages, but using <code>{% include /patterns/file.html %} doesn't work as it points to the</code>_includes<code>folder. How would I go about including a file from a directory that isn't</code>_includes`?</p>
| <include><jekyll> | 2016-09-27 20:53:37 | HQ |
39,734,615 | ItemTouchHelper with RecyclerView in NestedScrollView: Drag scrolling not work | <p>I have implemented ItemTouchHelper like descriped in this articel:
<a href="https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-b9456d2b1aaf#.k7xm7amxi" rel="noreferrer">https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-b9456d2b1aaf#.k7xm7amxi</a></p>
<p>All works fine if the RecyclerView is a child of the CoordinatorLayout.</p>
<p>But if the RecyclerView is a child of NestedScrollView in CoordinatorLayout, the drag scrolling not working anymore.
Draging an item and move it to the top or bottom of the screen, the RecyclerView not scrolling like it do if its not a child of NestedScrollView.</p>
<p>Any ideas?</p>
| <android><android-recyclerview><android-nestedscrollview><itemtouchhelper> | 2016-09-27 21:30:21 | HQ |
39,734,635 | C++ reading unknown number of lines and storing values in an array | <p>Firstly I don't really know C++ well at all. Basically I have a file that looks like</p>
<pre><code>junk
junk
...
junk
3 4 5 1
-9 7 4 -7
8 6 3 1
....
junk
junk
7 5 2 -1
....
-1 7 4 1
etc.
</code></pre>
<p>I want to analyze each block of numbers separately. I.e. here I have two blocks of numbers and want to perform the same analysis on them separately.</p>
<p>I know how I would implement this in Python, I just don't know how it looks in C++.</p>
<pre><code>file = open('data.text')
w = []
x = []
y = []
z = []
for line in file:
line = line.strip()
data = line.split()
w.append(data[0])
x.append(data[1])
y.append(data[2])
z.append(data[3])
file.close()
</code></pre>
<p>I also want to perform an analysis on the block of numbers, comparing all possibilities of two lines at once. In Python it would look something like (I guess -- haven't tried):</p>
<pre><code>r = []
s = []
t = []
for i in range(len(w)):
for j in range(len(w) - 1):
r.append(w[i]*x[j] - w[j]*x[i])
s.append(x[j]*y[i] - y[j]*x[i])
for i in range(len(w):
for j in range(len(s)):
t.append(s[j]*w[i] + r[j]*x[i])
best = min(t)
</code></pre>
<p>Here are a couple of the issues I've had in trying this with C++: I do not know the number of rows for the data (call it n), although I do know the number of blocks of numbers I want to analyze (call it N -- in my example N = 2). And plenty of segmentation faults. I think I can store the data, but I can't seem to call it. I create a class Data data and work from there.</p>
<pre><code>double get_data = 0;
for (std::string line; (std::getline(file,line));)
{
std::istringstream row(line);
Data data;
row >> data.w >> data.x >> data.y >> data.z;
std::vector<double> wcol;
std::vector<double> xcol;
std::vector<double> ycol;
std::vector<double> zcol;
get_data++;
for (int j = 0; j < get_data - 1; j++) {
if(data.w > 0)
{
wcol.push_back(data.w);
xcol.push_back(data.x);
ycol.push_back(data.y);
zcol.push_back(data.z);
}
get_data = 0;
}
</code></pre>
<p>But again I don't really know what I'm doing with C++.</p>
<hr>
<p>Maybe this should be a separate question, but I'd also like to break out of the analysis and then restart it for the next block of numbers. </p>
| <python><c++><arrays> | 2016-09-27 21:31:49 | LQ_CLOSE |
39,734,796 | JPA concurrency issue "On release of batch it still contained JDBC statements" | <p>I have a a concurrency issue I tried to solve with a while loop that attempts to save an entity multiple times until it hits some max retry count. I'd like to avoid talking about whether or not there are other ways to solve this problem. I have other Stackoverflow posts about that. :) Long story short: there's a unique constraint on a column that is derived and includes a numeric portion that keeps incrementing to avoid collisions. In a loop, I:</p>
<ol>
<li>select max(some_value)</li>
<li>increment the result</li>
<li>attempt to save new object with this new result</li>
<li>explicitly flush the entity and, if that fails because of the unique index, I catch a DataAccessException.</li>
</ol>
<p>All of this seems to work except when the loop goes back to step 1 and tries to select, I get:</p>
<pre><code>17:20:46,111 INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (http-localhost/127.0.0.1:8080-3) HHH000010: On release of batch it still contained JDBC statements
17:20:46,111 INFO [my.Class] (http-localhost/127.0.0.1:8080-3) MESSAGE="Failed to save to database. Will retry (retry count now at: 9) Exception: could not execute statement; SQL [n/a]; constraint [SCHEMA_NAME.UNIQUE_CONSTRAINT_NAME]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"
</code></pre>
<p>And a new Exception is caught. It seems like the first flush that causes the unique constraint violation and throws the <code>DataAccessException</code> doesn't clear the entity manager's batch. What's the appropriate way to deal with this? I'm using Spring with JPA and don't have direct access to the entity manager. I guess I could inject it if I need it but that's a painful solution to this problem.</p>
| <java><spring><hibernate><jpa><concurrency> | 2016-09-27 21:43:57 | HQ |
39,735,044 | SQLiteConnection databases leak when running emulator | <p>I was running the emulator and received the following errors about memory leak. It was interesting that the leaking database seems to be of the Google gms instead of a user database. Does anyone know how to fix it? Thanks!</p>
<pre><code>09-27 15:55:07.252 2058-2068/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/metrics.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
09-27 15:55:07.255 2058-2068/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
09-27 15:55:07.259 2058-2068/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
</code></pre>
| <android><memory-leaks><android-database> | 2016-09-27 22:03:31 | HQ |
39,735,141 | How to check connected user on psql | <p>In my PostgreSQL database I have 2 users: postgres and myuser.</p>
<p>The default user is postgres, but this user has no permission to query my foreign tables and myuser does. How can I check if I'm connected with the right user?</p>
<p>If I'm using the wrong user, how do I change to the right one?</p>
| <postgresql> | 2016-09-27 22:11:19 | HQ |
39,735,147 | How to color `matplotlib` scatterplot using a continuous value [`seaborn` color palettes?] | <p>I have a scatterplot and I want to color it based on another value (naively assigned to <code>np.random.random()</code> in this case). </p>
<p><strong>Is there a way to use <code>seaborn</code> to map a continuous value (not directly associated with the data being plotted) for each point to a value along a continuous gradient in <code>seaborn</code>?</strong> </p>
<p>Here's my code to generate the data:</p>
<pre><code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler
from sklearn import decomposition
import seaborn as sns; sns.set_style("whitegrid", {'axes.grid' : False})
%matplotlib inline
np.random.seed(0)
# Iris dataset
DF_data = pd.DataFrame(load_iris().data,
index = ["iris_%d" % i for i in range(load_iris().data.shape[0])],
columns = load_iris().feature_names)
Se_targets = pd.Series(load_iris().target,
index = ["iris_%d" % i for i in range(load_iris().data.shape[0])],
name = "Species")
# Scaling mean = 0, var = 1
DF_standard = pd.DataFrame(StandardScaler().fit_transform(DF_data),
index = DF_data.index,
columns = DF_data.columns)
# Sklearn for Principal Componenet Analysis
# Dims
m = DF_standard.shape[1]
K = 2
# PCA (How I tend to set it up)
Mod_PCA = decomposition.PCA(n_components=m)
DF_PCA = pd.DataFrame(Mod_PCA.fit_transform(DF_standard),
columns=["PC%d" % k for k in range(1,m + 1)]).iloc[:,:K]
# Plot
fig, ax = plt.subplots()
ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"], color="k")
ax.set_title("No Coloring")
</code></pre>
<p><a href="https://i.stack.imgur.com/qh5LW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qh5LW.png" alt="enter image description here"></a></p>
<p>Ideally, I wanted to do something like this:</p>
<pre><code># Color classes
cmap = {obsv_id:np.random.random() for obsv_id in DF_PCA.index}
# Plot
fig, ax = plt.subplots()
ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"], color=[cmap[obsv_id] for obsv_id in DF_PCA.index])
ax.set_title("With Coloring")
# ValueError: to_rgba: Invalid rgba arg "0.2965562650640299"
# to_rgb: Invalid rgb arg "0.2965562650640299"
# cannot convert argument to rgb sequence
</code></pre>
<p>but it didn't like the continuous value.</p>
<p>I want to use a color palette like:</p>
<pre><code>sns.palplot(sns.cubehelix_palette(8))
</code></pre>
<p><a href="https://i.stack.imgur.com/nVxYv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nVxYv.png" alt="enter image description here"></a></p>
<p>I also tried doing something like below, but it wouldn't make sense b/c it doesn't know which values I used in my <code>cmap</code> dictionary above:</p>
<pre><code>ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"],cmap=sns.cubehelix_palette(as_cmap=True)
</code></pre>
| <matplotlib><plot><colors><gradient><seaborn> | 2016-09-27 22:11:41 | HQ |
39,735,289 | fprintf printing garbage to txt file | <p>I'm having trouble with strings and c.</p>
<p>I'm trying to do something very simple: converting an int into a string and printing it into a txt file in the following fashion.</p>
<pre><code>const char * test_string() {
char s[5];
int num = 123;
sprintf(s, "%d", num);
return s;
}
int save() {
FILE *fh = fopen("test.txt", "w");
const char * text = test_string();
fprintf(fh, "%s", text);
fclose(fh);
}
</code></pre>
<p>Yet, for this simple task, I'm getting the following result:</p>
<pre><code>Üþ(
</code></pre>
<p>I'd like some assistance with this problem. Thanks in advance.</p>
| <c> | 2016-09-27 22:27:22 | LQ_CLOSE |
39,735,710 | Bokeh: Models must be owned by only a single document | <p>I'm working with <a href="http://bokeh.pydata.org" rel="noreferrer">Bokeh</a> 0.12.2 in a Jupyter notebook and it frequently throws exceptions about "Models must be owned by only a single document":</p>
<pre><code>---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-23-f50ac7abda5e> in <module>()
2 ea.legend.label_text_font_size = '10pt'
3
----> 4 show(column([co2, co, nox, o3]))
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\io.py in show(obj, browser, new, notebook_handle)
308 '''
309 if obj not in _state.document.roots:
--> 310 _state.document.add_root(obj)
311 return _show_with_state(obj, _state, browser, new, notebook_handle=notebook_handle)
312
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in add_root(self, model)
443 self._roots.append(model)
444 finally:
--> 445 self._pop_all_models_freeze()
446 self._trigger_on_change(RootAddedEvent(self, model))
447
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _pop_all_models_freeze(self)
343 self._all_models_freeze_count -= 1
344 if self._all_models_freeze_count == 0:
--> 345 self._recompute_all_models()
346
347 def _invalidate_all_models(self):
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\document.py in _recompute_all_models(self)
367 d._detach_document()
368 for a in to_attach:
--> 369 a._attach_document(self)
370 self._all_models = recomputed
371 self._all_models_by_name = recomputed_by_name
C:\Users\pokeeffe\AppData\Local\Continuum\Anaconda3\lib\site-packages\bokeh\model.py in _attach_document(self, doc)
89 '''This should only be called by the Document implementation to set the document field'''
90 if self._document is not None and self._document is not doc:
---> 91 raise RuntimeError("Models must be owned by only a single document, %r is already in a doc" % (self))
92 doc.theme.apply_to_model(self)
93 self._document = doc
RuntimeError: Models must be owned by only a single document, <bokeh.models.tickers.DaysTicker object at 0x00000000042540B8> is already in a doc
</code></pre>
<p>The trigger is always calling <code>show(...)</code> (although never the first time after kernel start-up, only subsequent calls). </p>
<p>Based on the docs, I thought <code>reset_output()</code> would return my notebook to an operable state but the exception persists. Through trial-and-error, I've determined it's necessary to also re-define everything being passing to <code>show()</code>. That makes interactive work cumbersome and error-prone.</p>
<p>[<a href="http://bokeh.pydata.org/en/latest/docs/reference/io.html#bokeh.io.reset_output" rel="noreferrer">Ref</a>]:</p>
<blockquote>
<p><strong>reset_output(state=None)</strong></p>
<p>  Clear the default state of all output modes.</p>
<p>  <strong>Returns:</strong> None</p>
</blockquote>
<hr>
<ul>
<li><p>Am I right about <code>reset_output()</code> -- is it supposed to resolve the situation causing this exception?</p></li>
<li><p>Else, how do I avoid this kind of exception?</p></li>
</ul>
| <bokeh> | 2016-09-27 23:11:52 | HQ |
39,735,724 | How to parse ISO 8601 into date and time format using Moment js in Javascript? | <p>I am currently using Moment js to parse an ISO 8601 string into date and time, but it is not working properly. What am I doing wrong? And I would take any other easier solutions as well. </p>
<p>The ISO 8601 I would like to parse: <code>"2011-04-11T10:20:30Z"</code> into date in string: <code>"2011-04-11"</code> and time in string: <code>"10:20:30"</code></p>
<p>And tried <code>console.log(moment("2011-04-11T10:20:30Z" ,moment.ISO_8601))</code> and <code>console.log(moment("2011-04-11T10:20:30Z" , ["YYYY",moment.ISO_8601])</code> as a test, but it just returns an object with all different kinds of properties. </p>
| <javascript><parsing><reactjs><momentjs><iso> | 2016-09-27 23:14:58 | HQ |
39,735,998 | Make qmake use qt5 by default | <p>I have both qt4 and qt5 on my Linux system. qt4 is used by default. What is a clean way to change that so that qmake uses qmake-qt5 by default?</p>
| <qt><qt4><qt5><qmake> | 2016-09-27 23:51:37 | HQ |
39,736,076 | Postgres jsonb 'NOT contains' operator | <p>I'm experimenting with postgres <code>jsonb</code> column types, and so far so good.
One common query I'm using is like this: </p>
<pre><code>select count(*) from jsonbtest WHERE attributes @> '{"City":"Mesa"}';
</code></pre>
<p>How do I reverse that? Is there a different operator or is it simply used as </p>
<pre><code>select count(*) from jsonbtest WHERE NOT attributes @> '{"City":"Mesa"}';
</code></pre>
| <postgresql><postgresql-9.4><jsonb> | 2016-09-28 00:03:42 | HQ |
39,736,640 | Simplest and quickest way to portray an application for development | <p>As a designer I sometimes feel the need to portray the main idea of an application in a graphical form like a flowchart. Something that is easy enough to understand for the development firms and could convey the purpose of the application and possibly the main features it needs to provide which they could ultimately use to reply back with recommendations, rough estimates and turn around times.</p>
<p>The application will still be in the ideation phase so creating a prototype is an overkill. I could do it as a flowchart but I thought there should already be a conventional way professionals follow instead of going through meetings or typing up the details. </p>
<p>How do you go about doing this? If flowchart is the way to go then what type of flowcharts work best here? I just need the initial direction so I could start my research. </p>
<p>For example for an application with 3 different sets of dashboards for customers, providers and admins how can I demonstrate the rough logic that connects all functions between these 3 type of users?</p>
<p>Thank you.</p>
| <project-management><project-planning><project-structure><development-process> | 2016-09-28 01:28:53 | LQ_CLOSE |
39,736,718 | Getting unknown error about "dynamic accessors failing" after updating to macOS | <p>After upgrading to macOS Sierra (10.12) and Xcode 8.0 (8A218a), I began getting many error messages in my macOS/Cocoa app (written in Objective-C) that follow this format:</p>
<pre><code>[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDInfo while resolving selector 'uniqueId' on class 'ABCDInfo'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDContact while resolving selector 'uniqueId' on class 'ABCDContact'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'uniqueId' for entity ABCDEmailAddress while resolving selector 'uniqueId' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
[error] warning: dynamic accessors failed to find @property implementation for 'address' for entity ABCDEmailAddress while resolving selector 'address' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @synthesized in the @implementation ?
</code></pre>
<p>None of this is my code or code from 3rd party developer libraries that I'm using, and doing a search on those variable names (i.e: 'uniqueId' or 'ABCDInfo') does not pull anything up, indicating it's not in my project.</p>
<p>I saw that this issue was also reported on Apple's Developer Forums twice (<a href="https://forums.developer.apple.com/thread/64189">Issue 1</a> and <a href="https://forums.developer.apple.com/thread/64274">Issue 2</a>), but both questions remain unanswered </p>
<p>My question is: What causes these error messages and how can I fix them?
It doesn't cause my app to crash, but I'd rather figure out and understand what's wrong.</p>
| <objective-c><xcode><macos><cocoa><macos-sierra> | 2016-09-28 01:40:55 | HQ |
39,737,159 | What is the property in property binding [class.selected]? | <p>I am learning angular 2 from <a href="https://angular.io/docs/ts/latest/tutorial/toh-pt2.html" rel="noreferrer">official hero tutorial</a>. </p>
<pre><code><ul class="heroes">
<li *ngFor="let hero of heroes"
[class.selected]="hero === selectedHero"
(click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
</code></pre>
<p>I've read the guide about property binding <a href="https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding" rel="noreferrer">here</a>, but still couldn't understand the following code:</p>
<pre><code>[class.selected]="hero === selectedHero"
</code></pre>
<p><strong>Question 1:</strong>
I know html tag has a class property, but class property does not have a key called "selected". The class property may have a value, which is string "selected". How come this property binding is valid? </p>
<p><strong>Question 2:</strong>
How does above property binding translated to class="selected" ?</p>
| <angular> | 2016-09-28 02:37:42 | HQ |
39,737,409 | Finding last row in Excel VBA | <p>I get the run time error 1004: Application-defined or Object defined error</p>
<pre><code>Set wsht = ThisWorkbook.Worksheets("Input Checklist")
finalrow = wsht.Cells(wsht.Rows.Count, 1).End(x1Up).Row
</code></pre>
<p>What is the error related to?</p>
| <excel><vba><row> | 2016-09-28 03:09:54 | LQ_CLOSE |
39,737,601 | Jenkins with Xcode 8 - Cannot find Provisioning Profiles | <p>Jenkins cannot find our recently updated provisioning profiles and after trying every known solution I'm running out of ideas what could be wrong.</p>
<p>Build jobs fail with error:</p>
<blockquote>
<p>No profile matching 'xxxxx' found: Xcode couldn't find a profile
matching 'xxxxx'.</p>
</blockquote>
<p>The build server is a Mac, running Xcode 8 and we're using Jenkins with the Xcode plugin.</p>
<p>Building and signing with Xcode 8 directly on the same machine is successful and I installed all the required profiles by double-clicking them.</p>
<p>Does anyone know any workable solution to fix this issue?</p>
| <ios><xcode><jenkins><code-signing> | 2016-09-28 03:35:37 | HQ |
39,737,607 | Aspnet Core Decimal binding not working on non English Culture | <p>I have an aspnet core app that runs with a non english configuration (spanish):</p>
<pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
......
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture(new CultureInfo("es-AR"))
,SupportedCultures = new List<CultureInfo>
{
new CultureInfo("es-AR")
}
,SupportedUICultures = new List<CultureInfo>
{
new CultureInfo("es")
}
});
.........
}
</code></pre>
<p>In english a decimal number has its decimal part delimited with a dot, but in spanish a comma is used:</p>
<ul>
<li>10256.35 english </li>
<li>10256,35 spanish</li>
</ul>
<p>I have this action in a controller:</p>
<pre><code> [HttpPost]
public decimal Test(decimal val)
{
return val;
}
</code></pre>
<p>If I use postman and send to that action a json like this {val: 15.30}, then val in the action recives a 0 (binding not working because of the culture). If I send a json like this {val: 15,30} then in the action I recive 15.30
The problem I have is, I need the action to accept decimals with commas, because that is the format that comes from inputs type text in the app's forms. But i also need to accept decimal with a dot that comes from request in json format. There is no way to specify a decimal/float in json that accepts a comma (send it as string is not an option). How can I do this??? I'm driving my self crazy with this.</p>
<p>Thanks!!</p>
| <c#><json><asp.net-mvc><localization><asp.net-core> | 2016-09-28 03:36:04 | HQ |
39,737,680 | Difference between != and <> | <p>I've always been using <code>!=</code> as "not equal to" in C++ and PHP. I just realized <code><></code> does the same thing. What's the difference?</p>
<p>Just in case if there is no difference, why does <code><></code> exist?</p>
| <php> | 2016-09-28 03:44:59 | LQ_CLOSE |
39,739,245 | How to get a number in a string? | <p>I want to get a integer value in a string. Any suggessions?<br>
Take this as an example. </p>
<blockquote>
<p>768 - Hello World </p>
</blockquote>
<p>According to the preceding string i want to get the 768 to a variable. How to do so?</p>
| <c#> | 2016-09-28 06:09:55 | LQ_CLOSE |
39,739,439 | Django insert default data after migrations | <p>I want my application to have default data such as user types. Whats the most efficient way to manage default data after migrations.</p>
<p>it needs to handle situations such as after i add a new table it adds the default data for it. </p>
| <django> | 2016-09-28 06:21:50 | HQ |
39,739,560 | How to access the VM created by docker's HyperKit? | <p><a href="https://docs.docker.com/docker-for-mac/">Docker for Mac</a> uses a Linux VM created by <a href="https://github.com/docker/HyperKit/">HyperKit</a> for storing and running containers on Mac.</p>
<p>With Docker Toolbox, I can just open VirtualBox and access the docker-machine VM. But with Docker for Mac, how do I access the VM created by HyperKit?</p>
| <docker><docker-machine><docker-for-mac> | 2016-09-28 06:28:31 | HQ |
39,740,128 | need help i have table in sql server with set of colunms i just want to select values between from and to columns in sql | select Q.mem_id from tb_mem_share Q,tb_member MB where MB.mem_id=Q.mem_id AND Q.share_num_from between '42368' and '42378'
select * from tb_mem_share where share_num_from >= 42368 and share_num_from <=42378
by giving this i can get only second record ,i need data which lies between from and to
mem_id share_num_from share_num_to no_of_shares share_amt
KA003871 42360 42369 10 10000
KA000401 42370 42379 10 10000 | <sql><sql-server><vb.net> | 2016-09-28 06:58:09 | LQ_EDIT |
39,740,262 | why can't i use "where R.ApartmentID = null" to retrieve all non matching rows from the left table | I only have a month of learning experience on sql server and I was just wondering why the first query before produces the right results (i.e. join two table and only select rows from left table that does NOT have a matching row), whereas the second query returns an empty query.
First
select R.Name, A.Name
from tblResident as R
left join tblApartment as A
on R.ApartmentID = A.ID
where R.ApartmentID is null
Second
select R.Name, A.Name
from tblResident as R
left join tblApartment as A
on R.ApartmentID = A.ID
where R.ApartmentID = null
Table structure
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/8Km5G.png | <sql><sql-server><where-clause> | 2016-09-28 07:04:18 | LQ_EDIT |
39,741,429 | Pandas replace a character in all column names | <p>I have data frames with column names (coming from .csv files) containing <code>(</code> and <code>)</code> and I'd like to replace them with <code>_</code>.</p>
<p>How can I do that in place for all columns?</p>
| <python><pandas> | 2016-09-28 08:00:31 | HQ |
39,742,381 | ios simulator map annotations not showing up | I am trying to show markers in the mapview while loading it but the map is showing my countrymap in the mapview but not the annotations. is there anything wrong i am doing? FYI my simulator location is set as Apple.
[A class with annotation properties][1]
[Loading the annotations to the map][2]
[1]: http://i.stack.imgur.com/aGiEc.png
[2]: http://i.stack.imgur.com/C9ueF.png | <ios><swift><annotations><apple-maps> | 2016-09-28 08:48:19 | LQ_EDIT |
39,742,677 | How to set a default value for a Flow type? | <p>I have defined a custom Flow type</p>
<pre><code>export type MyType = {
code: number,
type: number = 1,
}
</code></pre>
<p>I want the <code>type</code> parameter to default as <code>1</code> if no value is present. However, Flow is complaining with <code>Unexpected token =</code>.</p>
<p><a href="https://i.stack.imgur.com/tUmEh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tUmEh.png" alt="Flow error"></a></p>
<p>Can this be done with Flow?</p>
<p>Currently using Flow <code>v0.32.0</code>.</p>
| <javascript><flowtype> | 2016-09-28 09:01:53 | HQ |
39,742,683 | UIUserNotificationSettings deprecated in iOS 10 | <p>I am looking for the alternate way of implementing UIUserNotificationSettings in iOS 10. </p>
<p>Apple documentation has given the below framework for the further usage. UNNotificationSettings in the link <a href="https://developer.apple.com/reference/usernotifications/unnotificationsettings">here</a>.</p>
<p>Is there any one who can help me with the sample code to implement the below using the UNNotificationSettings instead of UIUserNotificationSettings</p>
<pre><code>let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
</code></pre>
| <swift><xcode><apple-push-notifications><ios10><xcode8> | 2016-09-28 09:02:01 | HQ |
39,743,161 | SVG Fill Color Not Working | <p>I'm new to using SVGs and can't figure out what I'm doing wrong here. For most of them, if I want to change the color, I use:</p>
<pre><code>svg path {
fill: blue;
}
</code></pre>
<p>But for this one - and other's I've come across - for some reason this way doesn't work. </p>
<p><a href="https://jsfiddle.net/kevmon/ddb4k2vq/1/" rel="noreferrer">Here's a fiddle demonstrating the problem</a></p>
<p>HTML</p>
<pre><code><div class="logo-wrapper">
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg id="logo-personal-care" width="100%" height="100%" viewBox="0 0 159 42" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g id="Pest-Peeve-Personal-Care-Logo"><g id="PERSONAL-CARE"><text x="19.199px" y="41px" style="font-family:Lucida Grande;font-size:11px;font-weight:500;fill:#fff;">P<tspan x="25.609px 31.901px 39.187px 45.441px 54.316px 62.773px 70.692px 76.887px 80.698px 88.639px 96.558px " y="41px 41px 41px 41px 41px 41px 41px 41px 41px 41px 41px ">ERSONAL CAR</tspan></text><text x="103.503px" y="41.007px" style="font-family:Lucida Grande;font-size:11px;font-weight:500;fill:#fff;">E</text></g><g id="PPLogo"><path id="Fill-1" d="M158.737,16.764l0,1.884c0,0.428 -0.348,0.777 -0.776,0.777l-12.385,0c-0.429,0 -0.777,-0.349 -0.777,-0.777l0,-15.298c0,-0.428 0.348,-0.776 0.777,-0.776l11.771,0c0.238,0 0.454,0.106 0.593,0.291c0.138,0.185 0.18,0.422 0.113,0.65l-0.552,1.897c-0.1,0.347 -0.436,0.599 -0.797,0.599l-8.178,0l0,3.437l6.969,0c0.428,0 0.776,0.348 0.776,0.777l0,1.772c0,0.428 -0.348,0.776 -0.776,0.776l-6.969,0l0,3.215l9.435,0c0.428,0 0.776,0.348 0.776,0.776M143.064,0.321c0.212,0.323 0.096,0.588 -0.215,1.295l-0.061,0.138l-7.178,16.408c-0.337,0.772 -0.434,0.979 -0.644,1.118c-0.146,0.095 -0.309,0.145 -0.472,0.145l-2.487,0c-0.325,0 -0.649,-0.207 -0.787,-0.502l-5.916,-12.756c-0.106,-0.229 -0.092,-0.489 0.039,-0.693c0.131,-0.205 0.36,-0.327 0.612,-0.327l2.688,0c0.331,0 0.656,0.212 0.789,0.515l3.785,8.588l5.486,-12.976c0.329,-0.778 0.424,-0.987 0.636,-1.128c0.144,-0.096 0.308,-0.146 0.473,-0.146l2.643,0c0.249,0 0.477,0.12 0.609,0.321M122.64,16.764l0,1.884c0,0.428 -0.349,0.777 -0.777,0.777l-11.771,0c-0.428,0 -0.777,-0.349 -0.777,-0.777l0,-15.298c0,-0.428 0.349,-0.776 0.777,-0.776l11.771,0c0.238,0 0.454,0.105 0.592,0.29c0.139,0.185 0.181,0.421 0.115,0.649l-0.553,1.899c-0.1,0.347 -0.436,0.599 -0.797,0.599l-8.177,0l0,3.437l6.968,0c0.428,0 0.776,0.348 0.776,0.777l0,1.772c0,0.428 -0.348,0.776 -0.776,0.776l-6.968,0l0,3.215l8.82,0c0.428,0 0.777,0.348 0.777,0.776M105.724,16.764l0,1.884c0,0.428 -0.348,0.777 -0.777,0.777l-11.771,0c-0.428,0 -0.777,-0.349 -0.777,-0.777l0,-15.298c0,-0.428 0.349,-0.776 0.777,-0.776l11.771,0c0.238,0 0.454,0.106 0.593,0.291c0.139,0.185 0.18,0.422 0.114,0.65l-0.553,1.897c-0.101,0.347 -0.436,0.599 -0.797,0.599l-8.178,0l0,3.437l6.969,0c0.428,0 0.776,0.348 0.776,0.777l0,1.772c0,0.428 -0.348,0.776 -0.776,0.776l-6.969,0l0,3.215l8.821,0c0.429,0 0.777,0.348 0.777,0.776M85.303,8.901c0,1.823 -0.924,2.6 -3.091,2.6l-3.895,0l0,-5.49l3.895,0c2.167,0 3.091,0.864 3.091,2.89M82.212,2.574l-6.845,0c-0.429,0 -0.777,0.348 -0.777,0.776l0,15.298c0,0.428 0.348,0.777 0.777,0.777l2.174,0c0.428,0 0.776,-0.349 0.776,-0.777l0,-3.709l3.895,0c4.44,0 6.886,-2.145 6.886,-6.038c0,-4.08 -2.446,-6.327 -6.886,-6.327M66.42,2.923c0.125,0.219 0.12,0.487 -0.014,0.715l-1.122,1.908c-0.156,0.265 -0.467,0.442 -0.774,0.442l-4.365,0l0,12.66c0,0.428 -0.348,0.777 -0.776,0.777l-2.175,0c-0.428,0 -0.776,-0.349 -0.776,-0.777l0,-12.66l-5.629,0c-0.429,0 -0.777,-0.348 -0.777,-0.776l0,-1.862c0,-0.428 0.348,-0.776 0.777,-0.776l15.008,0c0.264,0 0.498,0.13 0.623,0.349M48.228,14.481c0,2.552 -1.896,5.278 -7.22,5.278c-4.576,0 -6.712,-1.734 -7.257,-2.266c-0.134,-0.133 -0.218,-0.308 -0.238,-0.497c-0.028,-0.271 0.076,-0.457 0.52,-1.203l0.24,-0.402c0.411,-0.691 0.549,-0.924 0.899,-0.975c0.211,-0.032 0.429,0.032 0.597,0.175c0.473,0.4 2.253,1.709 5.239,1.709c0.772,0 3.292,-0.116 3.292,-1.618c0,-0.824 -0.14,-1.214 -3.47,-1.829c-3.504,-0.612 -6.93,-1.526 -6.93,-5.313c-0.012,-1.252 0.455,-2.395 1.351,-3.299c0.885,-0.893 2.613,-1.957 5.824,-1.957c3.644,0 5.978,1.23 6.606,1.607c0.338,0.203 0.478,0.632 0.327,0.998l-0.768,1.864c-0.085,0.207 -0.255,0.364 -0.466,0.43c-0.211,0.066 -0.442,0.032 -0.633,-0.092c-0.462,-0.3 -2.19,-1.281 -5.044,-1.281c-0.983,0 -3.27,0.148 -3.27,1.529c0,0.832 0.606,1.451 3.618,1.961c3.711,0.629 6.783,1.453 6.783,5.181M31.133,16.764l0,1.884c0,0.428 -0.348,0.777 -0.776,0.777l-11.772,0c-0.428,0 -0.776,-0.349 -0.776,-0.777l0,-15.298c0,-0.428 0.348,-0.776 0.776,-0.776l11.772,0c0.238,0 0.454,0.106 0.593,0.291c0.138,0.185 0.18,0.422 0.113,0.65l-0.552,1.897c-0.101,0.347 -0.436,0.599 -0.798,0.599l-8.177,0l0,3.437l6.968,0c0.428,0 0.777,0.348 0.777,0.777l0,1.772c0,0.428 -0.349,0.776 -0.777,0.776l-6.968,0l0,3.215l8.821,0c0.428,0 0.776,0.348 0.776,0.776M10.713,8.901c0,1.823 -0.924,2.6 -3.091,2.6l-3.895,0l0,-5.49l3.895,0c2.167,0 3.091,0.864 3.091,2.89M7.622,2.574l-6.846,0c-0.428,0 -0.776,0.348 -0.776,0.776l0,15.298c0,0.428 0.348,0.777 0.776,0.777l2.175,0c0.428,0 0.776,-0.349 0.776,-0.777l0,-3.709l3.895,0c4.44,0 6.885,-2.145 6.885,-6.038c0,-4.08 -2.445,-6.327 -6.885,-6.327" style="fill:#fff;"/></g></g></svg>
</div>
</code></pre>
<p>CSS</p>
<pre><code>.logo-wrapper svg {
width: 300px;
}
.logo-wrapper svg path{
fill: green;
}
</code></pre>
<p>Thanks</p>
| <css><svg> | 2016-09-28 09:22:10 | HQ |
39,743,643 | npm package.json main and project structure | <p>I have a issue with npm and the main field. I see the documentation and as of my understanding I point main to be a different entry point than ./index.js. I already tested the package where all dist files are inside the root folder. I ignore src and test during pack phase using .npmignore but I did not like the point that building and packing the project to verify the structure pul all my files into the package root folder. So i changed the output to be dist instead.</p>
<p>If i use npm pack and extract the file I get the following structure:</p>
<pre><code>/
dist
-- index.js
-- moduleA
-- index.js
package.json
README.md
</code></pre>
<p>So for so good. But now I am forced to import it as follows:</p>
<pre><code>import {moduleA} from "myNpmModule/dist/moduleA";
</code></pre>
<p>But I dont want to have the dist folder in my import. So I set main in package.json</p>
<pre><code>"main": "dist/index.js"
</code></pre>
<p>But still it does not work and only works if I import with dist.
I use npm 3.10.7 and node 6.7.0.</p>
<p>Can anyone help?</p>
<p>Regards</p>
| <node.js><npm><package.json> | 2016-09-28 09:40:57 | HQ |
39,744,309 | node http-server to respond with index.html to any request | <p>I have installed <code>http-server</code> globally.</p>
<p>I launch it from <strong>myDir</strong> on localhost port 8080. In <strong>myDir</strong> I have <code>index.html</code>.</p>
<p>If I request (from the browser) <code>http://localhost:8080/</code> I get index.html, which is OK.</p>
<p>If I request though <code>http://localhost:8080/anything</code> I do not get any response from the server. </p>
<p>What I would like, on the contrary, is that my server always responds with index.html to any http request reaching localhost on port 8080.</p>
<p>Is this possible.</p>
<p>Thanks in advance</p>
| <node.js><httpserver> | 2016-09-28 10:05:25 | HQ |
39,744,805 | What is $ symbol used for in jsp? | <p>I am new to JavaServer Page(jsp) and have been researching this matter, but I dont get what is the symbol $ mean.Any resources or readings regarding this would be appreciated. Thanks.</p>
| <jsp> | 2016-09-28 10:25:16 | LQ_CLOSE |
39,744,987 | Is it possible to search column of a table for a particular value using function in Oracle? | I know it can be done like this, but I want to do it by using functions.
select * from *table_name*
where *column_name* like '%*STR*%'; | <sql><oracle><oracle10g> | 2016-09-28 10:34:17 | LQ_EDIT |
39,745,350 | onclcik check if that element not hasClass() | i want to check on click that div or li any element not hasClass() then do something ..
i am trying to do like this...
$(document).on('click',function() {
if(!(this).hasClass("help-icons") && !(this).hasClass("help") && (this).hasClass("close")){
$(".help-icons").hide();
}else if((this).hasClass("help")){
$(".help-icons").show();
}else{
$(".help-icons").hide();
}
});
help me to solve this problem
thanks.. | <javascript><jquery> | 2016-09-28 10:49:45 | LQ_EDIT |
39,746,115 | I want this function to loop through both lists and return the object that is the same in both. | These are the lists; note how the second list is made up of objects that need splitting first.
gaps = ['__1__', '__2__', '__3__']
questions = ['Bruce Wayne is __1__', 'Clark Kent is __2__', 'Barry Allen is __3__']
Here's the code. It seems to work only for the first (zeroth) object, bud that's it - it doesn't even loop.
def is_gap(question, gap):
place = 0
while (place < 3):
question[place] = question[place].split(' ')
for index in gaps:
if index in question[place]:
return index
else:
return None
place += 1
print is_gap(questions, gaps)
Please be gentle, I am a complete beginner! | <python><list> | 2016-09-28 11:26:34 | LQ_EDIT |
39,747,246 | Angular 2 get current route in guard | <p>I have an AccessGuard class in my project which its work is to determine if user can access to the route or not. I used the <code>router.url</code> to get the current route but the url returns the route before navigation to the new route like I'm in the users route and I click on the candidates route so the url returns users instead of candidates which I want that to validate access to the route
this is my route file:</p>
<pre><code>const routes:Routes = [
{
path:'',
component:PanelComponent,
canActivate:[AuthGuard,AccessGuard],
canActivateChild:[AuthGuard,AccessGuard],
children:[
{
path:'dashboard',
component:DashboardComponent
},
{
path:'users',
component:UsersComponent
},
{
path:'users/:id',
component:ShowUserComponent
},
{
path:'candidates',
component:CandidatesComponent
},
{
path:'permissions',
component:PermissionsComponent
},
{
path:'holidays',
component:HolidaysComponent
},
{
path:'candidate/:id',
component:CandidateComponent
},
{
path:'salary/create',
component:InsertSalaryComponent
},
{
path:'document/create',
component:InsertDocumentComponent
},
{
path:'leave/create',
component:InsertLeaveComponent
}
]
}
];
</code></pre>
<p>and this is my access guard:</p>
<pre><code>permissions;
currentRoute;
constructor(private authService:AuthService,private router:Router){
this.permissions = this.authService.getPermissions();
}
canActivate(){
return this.checkHavePermission();
}
canActivateChild(){
console.log(this.router.url);
return this.checkHavePermission();
}
private checkHavePermission(){
switch (this.router.url) {
case "/panel/users":
return this.getPermission('user.view');
case '/panel/dashboard':
return true;
case '/panel/candidates':
return this.getPermission('candidate.view');
default:
return true;
}
}
getPermission(perm){
for(var i=0;i<this.permissions.length;i++){
if(this.permissions[i].name == perm ){
return true;
}
}
return false;
}
</code></pre>
| <angular><angular2-routing><angular2-guards> | 2016-09-28 12:15:34 | HQ |
39,747,800 | Mysql PHP exention unloaded! Error shows in PHP7 How can i solve it? | <pre><code> Mysql PHP exention unloaded! Error shows in PHP7 How can i solve it?
Version: Windows Server 2012 64-bit
XAMPP Version: 7.0.9
Control Panel Version: 3.2.2
</code></pre>
<p><a href="http://i.stack.imgur.com/Z9NQQ.png" rel="nofollow">http://i.stack.imgur.com/Z9NQQ.png</a></p>
| <php><mysql><upload><xampp> | 2016-09-28 12:38:41 | LQ_CLOSE |
39,748,226 | Must I call parent::__construct() in the first line of the constructor? | <p>I know in Java, <code>super()</code> in a constructor has to be called as the first line of an overridden constructor.</p>
<p>Does this also apply to the <code>parent::__construct()</code> call in PHP?</p>
<p>I found myself writing an Exception class like this:</p>
<pre><code>class MyException extends Exception {
public function __construct($some_data) {
$message = '';
$message .= format_data($some_data);
$message .= ' was passed but was not expected';
parent::__construct($message);
}
}
</code></pre>
<p>and I wondered if this would be considered an error/bad practice in PHP.</p>
| <php><oop> | 2016-09-28 12:56:22 | HQ |
39,749,015 | apple-mobile-web-app-status-bar-style in ios 10 | <p>I know this question has been asked previously, just want to know if this is still the case in ios 10 (and ios 9)...</p>
<p>According to the apple developer guidelines for web apps (<a href="https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html" rel="noreferrer">found here</a>), there are 3 choices for the status bar in a web app; <strong>default</strong>, <strong>black</strong> and <strong>black-translucent</strong>.</p>
<ol>
<li><strong>Default</strong> results in a white status bar with black text,</li>
<li><strong>Black</strong> results in a black status bar with white text, and</li>
<li><strong>Black-translucent</strong> results in a transparent background with white
text. Additionally, this status bar floats above your content,
meaning you have to push your content down 20px in order to not have
the content overlap with thte status bar text.</li>
</ol>
<p>I'd really like to use the black-translucent status bar (as I think it looks more native), but the background of my page is a light grey. This makes the white text on this status bar very hard to read.</p>
<p>Put simply, I'd just like a transparent background with black text (essentially, <strong>default-translucent</strong>). Is this possible?</p>
| <html><ios><web-applications><statusbar><meta> | 2016-09-28 13:30:25 | HQ |
39,749,469 | How to log complex object using Serilog in valid json format? | <p>I have this structure:</p>
<pre><code>public class LogRequestParameters
{
public string RequestID { get; set; }
public string Type { get; set; }
public string Level { get; set; }
public string DateTime { get; set; }
public string MachineName { get; set; }
public Request Request { get; set; }
}
public class Request
{
public string URLVerb { get; set; }
}
</code></pre>
<p>I am writing following line for logging:</p>
<pre><code>Serilog.Log.Information("{@LogRequestParameters}", logRequestParameters);
</code></pre>
<p>I am getting following output:</p>
<pre><code>LogRequestParameters { RequestID: "bf14ff78-d553-4749-b2ac-0e5c333e4fce", Type: "Request", Level: "Debug", DateTime: "9/28/2016 3:12:27 PM", MachineName: "DXBKUSHAL", Request: Request { URLVerb: "GET /Violation/UnpaidViolationsSummary" } }
</code></pre>
<p>This is not a valid json. "LogRequestParameters" (name of class) is coming in the begining. "Request" (name of the property) is coming twice.
How can I log a valid json?</p>
| <c#><json><serilog><structured-data> | 2016-09-28 13:49:07 | HQ |
39,749,683 | Laravel @extends and @include | <p>I'm working on this project using Laravel.</p>
<p>According to this tutorial I'm watching, I had to add this bit of code at the top of the main view. </p>
<pre><code> @extends('layouts.masters.main')
</code></pre>
<p>Since I'm new to Laravel this got me wondering why can i not simply use. </p>
<pre><code> @include('layouts.masters.main')
</code></pre>
<p>I tried it instead and it did the same thing basically. Only thing is i do know how include works but i don't really know what extends does.
Is there a difference and so yeah what is it. Why did tutorial guy go for <code>@extends</code> and not <code>@include.</code></p>
| <php><laravel> | 2016-09-28 13:56:57 | HQ |
39,750,279 | conda environment to AWS Lambda | <p>I would like to set up a Python function I've written on AWS Lambda, a function that depends on a bunch of Python libraries I have already collected in a <a href="http://conda.pydata.org/docs/using/envs.html" rel="noreferrer">conda environment</a>.</p>
<p>To set this up on Lambda, I'm supposed to zip this environment up, but the <a href="http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html" rel="noreferrer">Lambda docs</a> only give instructions for how to do this using pip/VirtualEnv. Does anyone have experience with this?</p>
| <python><amazon-web-services><aws-lambda><conda> | 2016-09-28 14:21:53 | HQ |
39,750,725 | How to programmatically open the Bluetooth settings in iOS 10 | <p>I'm trying to access the Bluetooth settings through my application using swift.how can access bluetooth setting?</p>
<p>Xcode version - 8.0
swift - 2.3
iOS - 10</p>
| <bluetooth><ios10><xcode8> | 2016-09-28 14:41:30 | HQ |
39,751,124 | Increase timeout limit in Google Chrome | <p>Internet speed at work is very limited, and because of this I can't load several useful pages, like Trello, Bitbucket, Slack and so on.</p>
<p>Chrome console shows me a long list timeout errors like <code>GET https://..... net::ERR_TIMED_OUT</code>. </p>
<p>I was wondering if there is any way to change timeout settings in Chrome.</p>
| <google-chrome> | 2016-09-28 14:58:47 | HQ |
39,751,421 | mountPath overrides the rest of the files in that same folder | <p>I have a volume with a secret called config-volume. I want to have that file in the /home/code/config folder, which is where the rest of the configuration files are. For that, I mount it as this:</p>
<pre><code>volumeMounts:
- name: config-volumes
- mountPath: /home/code/config
</code></pre>
<p>The issue is that, after deploying, in the /home/code/config I only have the secret file and the rest of them are gone</p>
<p>So the /home/code/config is an existing folder (not empty), I suspect that the volumeMount overwrites the folder.</p>
<p>Is there a way that this can be done without overwriting everything?</p>
| <kubernetes> | 2016-09-28 15:12:35 | HQ |
39,751,892 | Get full list of full text search configuration languages | <p><code>to_tsvector()</code> supports several languages: english, german, french ...</p>
<p>How to get full list of these languages ?</p>
| <postgresql><full-text-search> | 2016-09-28 15:33:31 | HQ |
39,751,923 | Handling try and throws in Swift 3 | <p>Before Swift 3 I was using:</p>
<pre><code>guard let data = Data(contentsOf: url) else {
print("There was an error!)
return
}
</code></pre>
<p>However I now have to use <code>do</code>, <code>try</code> and <code>catch</code>. I'm not familiar with this syntax. How would I replicate this behaviour?</p>
| <ios><swift><swift3> | 2016-09-28 15:34:51 | HQ |
39,752,216 | Swift 3D Touch iOS 10 Home screen quick actions share Item missing | <p>In my apps that use 3D touch home screen quick actions I do not have the new iOS 10 default sharing option that all apps got for free. </p>
<p>I have seen some apps, for example Amazon, that have their 4 custom shortcut items (quick actions) and the 1 default sharing option.</p>
<p>Is there a way I can get the default iOS 10 sharing option back? </p>
| <swift><ios10><3dtouch> | 2016-09-28 15:49:57 | HQ |
39,752,434 | Python - merge two CSV files and KEEP duplicates | I am trying to merge two csv files and keep duplicate records. Each file may have a matching record, one file may have duplicate records (same student ID with different test scores), and one file may not have a matching student record in the other file. The code below works as expected however if a duplicate record exists only the second record is being written to the merged file. I've looked through many threads and all address removing duplicates but I need to keep duplicate records.
`
import csv
from collections import OrderedDict
import os
cd = os.path.dirname(os.path.abspath(__file__))
fafile = os.path.join(cd, 'MJB_FAScores.csv')
testscores = os.path.join(cd, 'MJB_TestScores.csv')
filenames = fafile, testscores
data = OrderedDict()
fieldnames = []
for filename in filenames:
with open(filename, 'r') as fp:
reader = csv.DictReader(fp)
fieldnames.extend(reader.fieldnames)
for row in reader:
data.setdefault(row['Student_Number'], {}).update(row)
fieldnames = list(OrderedDict.fromkeys(fieldnames))
with open('merged.csv', 'w', newline='') as fp:
writer = csv.writer(fp)
writer.writerow(fieldnames)
for row in data.values():
writer.writerow([row.get(fields, '') for fields in fieldnames])
fafile=
Student_Number Name Grade Teacher FA1 FA2 FA3
65731 Ball, Peggy 4 Bauman, Edyn 56 45 98
65731 Ball, Peggy 4 Bauman, Edyn 32 323 232
85250 Ball, Jonathan 3 Clarke, Mary 65 77 45
981235 Ball, David 5 Longo, Noel 56 89 23
91851 Ball, Jeff 0 Delaney, Mary 83 45 42
543 MAX 2 Phil 77 77 77
543 MAX 2 Annie 88 888 88
9844 Lisa 1 Smith, Jennifer 43 44 55
testscores=
Student_Number Name Grade Teacher MAP Reading MAP Math FP Level DSA LN DSA WW DSA SJ DSA DC
65731 Ball, Peggy 4 Bauman, Edyn 175 221 A 54 23 78 99
72941 Ball, Amanda 4 Bauman, Edyn 201 235 J 65 34 65
85250 Ball, Jonathan 3 Clarke, Mary 189 201 L 34 54
981235 Ball, David 5 Longo, Noel 225 231 D 23 55
91851 Ball, Jeff 0 Delaney, Mary 198 175 C
65731 Ball, Peggy 4 Bauman, Edyn 200 76 Y 54 23 78 99
543 MAX 2 Phil 111 111 Z 33 44 55 66
543 MAX 2 Annie 222 222 A 44 55 66 77
Current output:
Student_Number Name Grade Teacher FA1 FA2 FA3 MAP Reading MAP Math FP Level DSA LN DSA WW DSA SJ DSA DC
65731 Ball, Peggy 4 Bauman, Edyn 32 323 232 200 76 Y 54 23 78 99
85250 Ball, Jonathan 3 Clarke, Mary 65 77 45 189 201 L 34 54
981235 Ball, David 5 Longo, Noel 56 89 23 225 231 D 23 55
91851 Ball, Jeff 0 Delaney, Mary 83 45 42 198 175 C
543 MAX 2 Annie 88 888 88 222 222 A 44 55 66 77
72941 Ball, Amanda 4 Bauman, Edyn 201 235 J 65 34 65
9844 Lisa 1 Smith, Jennifer 43 44 55
Desired output:
Student_Number Name Grade Teacher FA1 FA2 FA3 MAP Reading MAP Math FP Level DSA LN DSA WW DSA SJ DSA DC
65731 Ball, Peggy 4 Bauman, Edyn 32 323 232 200 76 Y 54 23 78 99
65731 Ball, Peggy 4 Bauman, Edyn 56 45 98 175 221 A 54 23 78 99
85250 Ball, Jonathan 3 Clarke, Mary 65 77 45 189 201 L 34 54
981235 Ball, David 5 Longo, Noel 56 89 23 225 231 D 23 55
91851 Ball, Jeff 0 Delaney, Mary 83 45 42 198 175 C
543 MAX 2 Annie 88 888 88 222 222 A 44 55 66 77
543 MAX 2 Phil 77 77 77 111 111 Z 33 44 55 66
72941 Ball, Amanda 4 Bauman, Edyn 201 235 J 65 34 65
9844 Lisa 1 Smith, Jennifer 43 44 55
| <python><python-3.x><csv><merge> | 2016-09-28 16:00:03 | LQ_EDIT |
39,752,941 | Automatic exploitation via Return Oritented Programming | I need help understanding what is going on in this image [image][1].
[1]: http://i.stack.imgur.com/dC3NC.png
What I fail to see is what the `@ .data` instructions accomplish in combination with the `mov dword ptr [edx], eax`, especially considered that edx is popped right after.
Thanks in advance! | <assembly><x86> | 2016-09-28 16:27:05 | LQ_EDIT |
39,753,200 | How to build string with Bullet format | <p>I am trying to display string as </p>
<blockquote>
<pre><code>. string1
. string2
. string3
</code></pre>
</blockquote>
<p>By using Append function of Jquery how to build string with bullet format.</p>
| <javascript><jquery> | 2016-09-28 16:40:40 | LQ_CLOSE |
39,753,804 | Difference(s): android:src and tools:src? | <blockquote>
<p><strong>Difference(s): <code>android:src</code> and <code>tools:src</code>?</strong></p>
</blockquote>
<p>If any, when is it considered proper to use <code>tools:src</code> over <code>android:src</code>?</p>
| <android> | 2016-09-28 17:13:37 | HQ |
39,753,969 | Unable to filter messages by recipient in Microsoft Graph Api. One or more invalid nodes | <p>I am trying to get a list of messages that are filtered by recipient from Microsoft Graph API. The url I am using for the request is:</p>
<p><code>https://graph.microsoft.com/beta/me/messages?$filter=toRecipients/any(r: r/emailAddress/address eq '[Email Address]')</code></p>
<p>But I am getting this is the response:</p>
<pre><code>{
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"request-id": "7db712c3-e337-49d9-aa8d-4a5d350d8480",
"date": "2016-09-28T16:58:34"
}
}
}
</code></pre>
<p>A successful request should look like this (with a lot more data that I have omitted).</p>
<pre><code>{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users('99999999-9999-9999-9999-999999999999')/messages",
"@odata.nextLink": "https://graph.microsoft.com/beta/me/messages?$skip=10",
"value": [
{
"toRecipients": [
{
"emailAddress": {
"name": "[Name]",
"address": "[Email Address]"
}
}
],
}
]
}
</code></pre>
<p>The request works if I remove the filter, and I am able to perform requests with simpler filters.</p>
<p>Is there a problem with my URL, or is there another way to make the request?</p>
| <odata><microsoft-graph-api> | 2016-09-28 17:22:53 | HQ |
39,754,020 | Runtime error: Event loop is running | <p>I get the following error when I call the function <code>send_message</code>.</p>
<pre><code>Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "/home/joffe/Documents/discord/irc/ircbot.py", line 44, in get_message
mydiscord.send_message(line[1])
File "/home/joffe/Documents/discord/irc/mydiscord.py", line 37, in send_message
client.loop.run_until_complete(client.send_message(SERVER,message))
File "/usr/lib/python3.4/asyncio/base_events.py", line 331, in run_until_complete
self.run_forever()
File "/usr/lib/python3.4/asyncio/base_events.py", line 296, in run_forever
raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.
</code></pre>
<p>My function <code>send_message</code> takes a message and sends it to a discord channel.
The function is called from a function that is running in a thread. The client object is created in the main thread.</p>
<pre><code>def send_message(message):
print(str.encode("Message to discord: " + message))
client.loop.run_until_complete(client.send_message(SERVER,message))
</code></pre>
| <python-3.x><python-asyncio> | 2016-09-28 17:26:08 | HQ |
39,755,308 | How to exclude webpack from bundling .spec.js files | <p>my Package.bundle reads </p>
<pre><code>var reqContext = require.context('./', true, /\.js$/);
reqContext.keys().map(reqContext);
</code></pre>
<p>Which basically includes all .js files.</p>
<p>I want the expression to exclude any ***.spec.js files . Any regexp here to exclude .spec.js files ?</p>
| <javascript><regex><webpack> | 2016-09-28 18:41:16 | HQ |
39,755,581 | javascript storage class for reloading page | <p>Hi is it possible to add class to element and storage it in element if the page reloads ?</p>
<pre><code><button></button>
<div class=""></div>
$(document).ready(function () {
$("button").click(function() {
$("div").addClass("test");
});
});
</code></pre>
| <javascript><jquery><html> | 2016-09-28 18:56:38 | LQ_CLOSE |
39,755,819 | view-source in href shows error in console | <p><code><a href="view-source:http://stackoverflow.com">Click Me</a></code></p>
<p>This used to work as a valid <code>href</code> attribute but it seems in the past few months it now shows an error in the console (I'm using Chrome): </p>
<blockquote>
<p>Not allowed to load local resource: view-source: <a href="http://stackoverflow.com">http://stackoverflow.com</a></p>
</blockquote>
<p>I found some links from 2013 where this was once a bug in Chrome but said it was fixed.</p>
<p>Could someone point me to an authoritative source that can explain why this no longer works? I assume that this is security by the browser and not an angular issue (since <code>view-source</code> is whitelisted and used to work)</p>
| <html><google-chrome> | 2016-09-28 19:11:23 | HQ |
39,756,295 | Style both parent and child element in css | <p>I have the following structure...</p>
<pre><code><a href="#" class="brand-logo">
<img src="../static/images/logo_wpc-sm.png" alt="WPC Logo" class="wpc-logo"/>
</a>
</code></pre>
<p>And I have the following css code...</p>
<pre><code>.brand-logo {
height: 100%;
}
.wpc-logo {
height: 100%;
}
</code></pre>
<p>My question: It is a way I can style both in one css code?</p>
| <css> | 2016-09-28 19:40:35 | LQ_CLOSE |
39,756,569 | In C programming, can a string be outputted after a variable? (One line with printf) | Trying to print a string before and after a variable.
Does C have the capability to use one statement to display this output?
This works:
float value = 5;
printf("\nThe value of %f", value");
printf(" is greater than zero.");
This is the desire (one statement)
float value = 5;
printf("\nThe value of %f", value, " is greater than zero.");
(Second string does not display) | <c><printf><output> | 2016-09-28 19:56:25 | LQ_EDIT |
39,757,997 | How can I add spaces in php I means btween st_ id and em_ name I want to add more speces |
echo "student id, emirate name <br>";
foreach ($resultset as $row)
echo $row['st_id'], "" , $row['em_name'], " ", $row['st_bday'], "", $row['st_emirate'] , "", $row['em_id'], "", $row['em_name'],'<br />';
| <php><whitespace> | 2016-09-28 21:30:44 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.