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,354,795 | Clang and GCC accept questionable sizeof | <p>I have compilers that disagree on sizeof. For the following code, Clang and GCC will compile it, but other compilers that I have to use fail claiming "illegal sizeof operand". My reading of the standard says this is illegal, since <code>sizeof</code> can only take an expression (I don't think that S::a is an expression) or a type-id, but it is unusual for GCC and Clang to both be wrong. I can obviously replace it with <code>sizeof(S().a)</code>, which works with all my compilers.</p>
<pre><code>struct S
{
int a[32];
int b;
int c;
int d[32];
};
int main()
{
return sizeof(S::a);
}
</code></pre>
<p>Are Clang and GCC wrong, or am I misreading the standard?</p>
| <c++><c++11> | 2016-09-06 17:33:49 | HQ |
39,359,143 | How to make a WordPress grid with text overlay | <p>I'm trying to make a 2 column grid in WordPress where each row has a grid item filled with an image, and a grid item filled with text/a clickable button and a background image. </p>
<p>I'm also using Visual Composer. I'm creating a full width row, and then splitting it into two 50% columns. Then I make one an HTML block, and add the image simply enough. But the other is more difficult...</p>
<p>If I make it an HTML block and write out the text and set a background image, then the background image is only going to cover the text area. I need the grid items to be the same size, I will attach a mock-up I'm trying to recreate. I can't post a link because it's for a client and that is against our contract.</p>
<p>Thank you!!</p>
<p><a href="http://i.stack.imgur.com/d3WtF.png" rel="nofollow">Mock-up</a></p>
| <html><css><wordpress> | 2016-09-06 23:21:44 | LQ_CLOSE |
39,359,398 | Understanding _ids array in CakePHP model data | <p>Using CakePHP v3.1 w/ Postgres DB. When I retrieve records with associations I often see an extra array of <code>_ids</code>. Something like this:</p>
<pre><code> ...
(int) 26 => [
'agency_id' => (int) 23,
'routes' => [
'_ids' => (int) 2
]
]
</code></pre>
<p>Or sometimes:</p>
<pre><code> '_ids' => Array (
0 => 1
1 => 5
2 => 3
3 => 4
)
]
</code></pre>
<p>I would like to understand:</p>
<ol>
<li>How and why do these magic <code>_ids</code> appear?</li>
<li>Is there a way to control or prevent that behavior?</li>
</ol>
| <php><cakephp><orm><cakephp-3.0> | 2016-09-06 23:53:00 | HQ |
39,359,455 | ¿How can I stop my number sequence from growing? | <p>I am trying to make a sequence of numbers that starts with number 10 and grows like 10...11...12...13 etc every two seconds. But lets say that I want it to stop when it reaches 100, how do i do it. So far I have this.Any ideas?</p>
<pre><code>function conteo(num){
setInterval(function(){document.write(num++ + "..."); }, 2000);
</code></pre>
<p>}conteo(10)</p>
| <javascript><function><numbers><sequence> | 2016-09-07 00:00:18 | LQ_CLOSE |
39,359,740 | What are enum Flags in TypeScript? | <p>I'm learning TypeScript using <a href="https://basarat.gitbooks.io/typescript/content/docs/enums.html" rel="noreferrer">this ebook</a> as a reference. I've checked the <a href="https://www.typescriptlang.org/docs/handbook/enums.html" rel="noreferrer">TypeScript Official Documentation</a> but I don't find information about enum flags.</p>
| <javascript><typescript> | 2016-09-07 00:45:54 | HQ |
39,359,924 | Add entity with InheritanceType.JOINED to native query | <p>I am struggling to get native queries to work with <code>InheritanceType.JOINED</code>. From the Hibernate <a href="https://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch13.html#d5e3844">documentation</a> I have found:</p>
<blockquote>
<h1>13.1.6. Handling inheritance</h1>
<p>Native SQL queries which query for entities that are mapped as part of an inheritance must include all properties for the baseclass and all its subclasses.</p>
</blockquote>
<p>Using the following two entities:</p>
<pre class="lang-java prettyprint-override"><code>@Data
@Entity
@Table(name = "my_super")
@EqualsAndHashCode(of = {"id"})
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class MySuper {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long id;
}
</code></pre>
<p>And:</p>
<pre class="lang-java prettyprint-override"><code>@Data
@Entity
@Table(name = "my_sub_a")
@EqualsAndHashCode(callSuper = true)
public class MySubA extends MySuper {
@Column(name = "x")
private int x;
}
</code></pre>
<p>When I try to create a native query using:</p>
<pre class="lang-java prettyprint-override"><code>Object actual = session
.createNativeQuery("SELECT {s.*} FROM my_super {s} LEFT JOIN my_sub_a {a} USING (id)")
.addEntity("s", MySuper.class)
.getSingleResult();
</code></pre>
<p>It translates to the query:</p>
<pre><code>SELECT s.id as id1_1_0_, s_1_.x as x1_0_0_, case when s_1_.id is not null then 1 when s.id is not null then 0 end as clazz_0_ FROM my_super s LEFT JOIN my_sub_a a USING (id)
</code></pre>
<p>And then fails with:</p>
<pre><code>javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not prepare statement
Caused by: org.hibernate.exception.SQLGrammarException: could not prepare statement
Caused by: org.h2.jdbc.JdbcSQLException: Column "S_1_.X" not found; SQL statement:
</code></pre>
<p>So we observe the alias injection doing its work, figuring out that it may need the <code>x</code> column of <code>my_sub_a</code> as well. It is however unable to figure out the alias for <code>my_sub_a</code>. How should my code be modified so that this alias is connected properly as well?</p>
<p>My code is available at <a href="https://gist.github.com/JWGmeligMeyling/51e8a305f3c268eda473511e202f76e8">https://gist.github.com/JWGmeligMeyling/51e8a305f3c268eda473511e202f76e8</a> for easy reproduction of my issue.</p>
<p><em>(I am aware that this query can easily be expressed in JPQL or HQL as well, and can even be achieved using the <code>EntityManager</code> and <code>Session</code> API's. I do however want to use this in a more complex query, that I simplified to all details required for this question).</em></p>
| <hibernate> | 2016-09-07 01:16:58 | HQ |
39,360,328 | How to enable type checking in TSLint under WebStorm? | <p>I have some rules in my tslint.json that require the --type-check functionality. WebStorm doesn't give me a way to add the command-line argument and to the TSLint plugin. It also doesn't give me a way to enable it from the GUI.</p>
<p>As a result TSLint crashes and the TSLint plugin reports an error and I can't see the inspections.</p>
<p>It works when I run TSLint from the command-line with the --type-check argument, but I need the inspections in the IDE.</p>
<p>Does anyone have a workaround for this situation?</p>
| <webstorm><tslint> | 2016-09-07 02:20:51 | HQ |
39,360,611 | Vba code to auto serial number in column A after my userform entered data in column B | I have a userform which user can insert data and data will insert in column B to M. I need a code,either in worksheet or in userform to auto fill serial number starting with "RD 00001" which will fill in column A everytime data has enter.Please someone give me an idea
| <excel><userform><vba> | 2016-09-07 03:03:53 | LQ_EDIT |
39,361,680 | some issue with string in C | <p>i'm reading the C programming language, question 2-4 asks to write a function called squeeze to delete all char in s1 which is in s2, so i write the code, but it can't run at all.</p>
<p>here is my code</p>
<pre><code>#include <stdio.h>
void squeeze(char s1[], char s2[]);
int main()
{
squeeze("tabcdge", "abc");
}
void squeeze(char s1[], char s2[])
{
int i, j, k;
for (i = k = 0; s1[i] != '\0'; i++) {
for (j = 0; s2[j] != '\0' && s2[j] != s1[i]; j++)
;
if (s2[j] == '\0')
s1[k++] = s1[i];
}
s1[k] = '\0';
for (i = 0; s1[i] != '\0'; i++)
printf("%c", s1[i]);
}
</code></pre>
| <c><arrays><string> | 2016-09-07 05:17:19 | LQ_CLOSE |
39,361,858 | If a record is inserted and if the same record is deleted in the same transaction, does that count as an insertion at all? | <p>If I have a database transaction where a database is created and deleted within the same transaction, would it be counted as an insertion?</p>
<p>Thanks!</p>
| <java><mysql><oracle><jdbc> | 2016-09-07 05:33:11 | LQ_CLOSE |
39,361,909 | Combining two Id String | I just want to combine two **string uids** (28 digit alphanumeric) without concatenation ,ie by addition to create another uid that is unique as well. Any help is appreciated | <java><security><math><random><uid> | 2016-09-07 05:37:51 | LQ_EDIT |
39,361,943 | How can visualize tensorflow convolution filters? | <p><a href="https://i.stack.imgur.com/prfoT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/prfoT.png" alt="Example"></a></p>
<p>In many documents, there are images about each filter like "Example".
I want to visual my convolution filters like "Example" image, but I don't know how can visualize it.</p>
<p>How can I visualize my convolution filters?</p>
| <tensorflow><deep-learning> | 2016-09-07 05:40:49 | HQ |
39,362,671 | confused for setup angularjs.Many dependency found | <p>I google for setup angularjs.I found many tutorial but i am confused.I found</p>
<ol>
<li>angular-seed </li>
<li>Yeoman</li>
<li>bower</li>
<li>etc.</li>
</ol>
<p>it is necessary to use this dependency.
there is any scratch for start angularjs.</p>
| <angularjs> | 2016-09-07 06:33:43 | LQ_CLOSE |
39,362,730 | How to capture packets for single docker container | <p>There have many container running on the host. And I want to capture packets for the one container of these. Is there any way to do this?</p>
| <networking><docker> | 2016-09-07 06:37:15 | HQ |
39,363,987 | how to restrict background data in android programmatically | I am trying to make an app, which stops individual apps from data usage . I checked everywhere... and got nothing...please help..
I have tried in [https://developer.android.com/training/basics/network-ops/data-saver.html][1] but it is showing data usage... but not how to restrict it.
ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
// Checks user’s Data Saver settings.
switch (connMgr.getRestrictBackgroundStatus()) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
// Background data usage is blocked for this app. Wherever possible,
// the app should also use less data in the foreground.
case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
// The app is whitelisted. Wherever possible,
// the app should use less data in the foreground and background.
case RESTRICT_BACKGROUND_STATUS_DISABLED:
// Data Saver is disabled. Since the device is connected to a
// metered network, the app should use less data wherever possible.
}
} else {
// The device is not on a metered network.
// Use data as required to perform syncs, downloads, and updates.
}
thanks in advance
| <android><performance><android-studio> | 2016-09-07 07:41:21 | LQ_EDIT |
39,364,796 | when I try to run my program it won't run | I'm very very new to python and I'm I've got this exercise and like the first part of the program was running fine and I must've done something because now when I try to run it will just show => None and and nothing seems to be 'wrong'. and I don't know enough to even figure out what's wrong.
def main():
"""Gets the job done"""
#this program returns the value according to the colour
def re_start():
#do the work
return read_colour
def read_names():
"""prompt user for their name and returns in a space-separaded line"""
PROMPT_NAMES = input("Enter names: ")
users_names = '{}'.format(PROMPT_NAMES)
print (users_names)
return users_names
def read_colour():
"""prompt user for a colour letter if invalid colour enter retry"""
ALLOWED_COLOURS = ["whero",
"kowhai",
"kikorangi",
"parauri",
"kiwikiwi",
"karaka",
"waiporoporo",
"pango"]
PROMPT_COLOUR = input("Enter letter colour: ").casefold()
if PROMPT_COLOUR in ALLOWED_COLOURS:
return read_names()
else:
print("Invalid colour...")
print(*ALLOWED_COLOURS,sep='\n')
re_start()
main() | <python><python-3.x> | 2016-09-07 08:24:44 | LQ_EDIT |
39,364,840 | error: not found: value StructType/StructField/StringType | <p>I am running scala on my local machine, version 2.0.</p>
<pre><code>val schema = StructType(schemaString.split("|^").map(fieldName =>StructField(fieldName, StringType, true)))
<console>:45: error: not found: value StructType
val schema = StructType(schemaString.split("|^").map(fieldName =>StructField(fieldName, StringType, true)))
^
<console>:45: error: not found: value StructField
val schema = StructType(schemaString.split("|^").map(fieldName => StructField(fieldName, StringType, true)))
^
<console>:45: error: not found: value StringType
val schema = StructType(schemaString.split("|^").map(fieldName => StructField(fieldName, StringType, true)))
^
</code></pre>
<p>i loaded import org.apache.spark.sql._ but still getting this error. am i missing any packages?</p>
| <scala><apache-spark> | 2016-09-07 08:27:05 | HQ |
39,365,394 | DateTime + 12 hours showing same DateTime. Why? | <p>When I am increasing DateTime value by any hours, the result is OKAY, but when I increase it by 12 hours, it is not increasing.
<hr/>
Please see the following code for details:
<br/><br/><br/><br/></p>
<pre><code>$creation_date = new DateTime('2016-09-07 06:00:00', new DateTimeZone('Asia/Kolkata'));
$expiration_date = new DateTime('2016-09-07 06:00:00', new DateTimeZone('Asia/Kolkata'));
</code></pre>
<p>When I increase the <code>$expiration_date</code> variable by 1 hour, 3 hour, 8 hour, 24 hours etc., the result is perfect. For example,</p>
<p>Case 1:<br/> </p>
<pre><code>$expiration_date->add(new DateInterval('PT1H'));
echo "Creation Date: ".$creation_date->format('Asia/Kolkata')."<br/>Expiration Date: ".$expiration_date->format('Asia/Kolkata');
</code></pre>
<p>Result 1:<br/><br>
Creation Date: 2016-09-07 06:00:00<br/>
Expiration Date: 2016-09-07 07:00:00</p>
<p>Case 2:<br/> </p>
<pre><code>$expiration_date->add(new DateInterval('PT3H'));
echo "Creation Date: ".$creation_date->format('Asia/Kolkata')."<br/>Expiration Date: ".$expiration_date->format('Asia/Kolkata');
</code></pre>
<p>Result 2:<br/>
Creation Date: 2016-09-07 06:00:00<br/>
Expiration Date: 2016-09-07 09:00:00</p>
<p>Case 3:<br/> </p>
<pre><code>$expiration_date->add(new DateInterval('PT8H'));
echo "Creation Date: ".$creation_date->format('Asia/Kolkata')."<br/>Expiration Date: ".$expiration_date->format('Asia/Kolkata');
</code></pre>
<p>Result 3:<br/>
Creation Date: 2016-09-07 06:00:00<br/>
Expiration Date: 2016-09-07 02:00:00</p>
<p>Case 4:<br/> </p>
<pre><code>$expiration_date->add(new DateInterval('PT24H'));
echo "Creation Date: ".$creation_date->format('Asia/Kolkata')."<br/>Expiration Date: ".$expiration_date->format('Asia/Kolkata');
</code></pre>
<p>Result 4:<br/>
Creation Date: 2016-09-07 06:00:00<br/>
Expiration Date: 2016-09-08 06:00:00</p>
<p><strong>But when I increase the <code>$expiration_date</code> variable by <em>12 hours</em>, the date is not getting increased!<br/><br/>They are showing the same datetime!</strong></p>
<p>Case 5:<br/> </p>
<pre><code>$expiration_date->add(new DateInterval('PT12H'));
echo "Creation Date: ".$creation_date->format('Asia/Kolkata')."<br/>Expiration Date: ".$expiration_date->format('Asia/Kolkata');
</code></pre>
<p>Result 5:<br/>
Creation Date: 2016-09-07 06:00:00<br/>
Expiration Date: 2016-09-07 06:00:00
<br/><br/><br/><br/>
What am I doing wrong?</p>
| <php><date><datetime><time><dateinterval> | 2016-09-07 08:54:10 | LQ_CLOSE |
39,365,605 | path with a dot in web.config <location> | <p>I need to add a location element in my web.config file, but the path starts with a dot (and I don't think I can change that path, it's for <a href="http://letsencrypt.org">letsencrypt</a> automation).</p>
<p>If I let the dot, like in <code><location path=".well-known/acme-challenge"></location></code>, the site doesn't start at all (I think the web.config file is not parsed at all because I get the page asking me to configure customErrors, but it is already configured and usually works fine)</p>
<p>If I remove the dot, like in <code><location path="well-known/acme-challenge"></location></code> the web.config file is correctly loaded, but of course that doesn't help me to configure anything at the location I wish.</p>
<p>The final goal is to disable basic authentication (which I need for the rest of the site) on this path only ; I don't even know if I'll be able to set this up in a <code><location></code> element.</p>
| <iis><web-config><basic-authentication> | 2016-09-07 09:04:05 | HQ |
39,365,979 | How do i filter the output of a scrapper? (PHP) | <p>I am scrapping a page and i am getting this result:</p>
<pre><code>string(1) " "
string(15) " +0,25 pist.wit"
string(14) " +0,25 pist.br"
// and so on...
</code></pre>
<p>But i want a result like this:</p>
<pre><code>0,25
0,25
//and so on...
</code></pre>
<p>So technically i want to filter the prices (without + signs) and
the bread names (pist.wit etc.)
Does someone know how to do this? Here is my code:</p>
<pre><code> public function onRun()
{
$client = new Client();
$crawler = $client->request('GET', 'http://www.sandwich-express.nl/online-bestellen/');
$crawler->filter('tr')->each(function ($node) {
if(sizeof($node->filter('.table-spacing')) > 0)
var_dump('nieuwe headers next TR');
$node->filter('tr.colomn_text td')->each(function ($node) {
var_dump($node->text());
});
});
}
</code></pre>
| <php> | 2016-09-07 09:21:01 | LQ_CLOSE |
39,366,027 | Angular.js(SPA) loading times | I have a website that is built with Angular.js. I’m having issues with a slow loading time (obviously) especially from users in countries that have slow internet connections. Even for some users the page is not loaded at all. How can I improve initial loading times? | <javascript><angularjs><single-page-application> | 2016-09-07 09:23:30 | LQ_EDIT |
39,366,171 | count word strings on external website | <p>I am looking for a way to count word strings on a 3rd party site and then report it into an html generated page on a daily schedule.</p>
<p>So goes to www.bbc.co.uk - counts the incidents of the word "balloon" and reports this back into the page.</p>
<p>I'm not a coder really, html and css fine, some minor PHP, but everything else eludes me (probably why I've gone into digital marketing away from web dev over the years)</p>
<p>cheers for any help given</p>
| <php> | 2016-09-07 09:29:34 | LQ_CLOSE |
39,366,963 | How to use Mono.Cecil to create HelloWorld.exe | <p>How do you use Mono.Cecil to create a simple program from scratch? All the examples and tutorials I've been able to find so far, assume you are working with an existing assembly, reading or making small changes.</p>
| <.net><mono.cecil> | 2016-09-07 10:07:57 | HQ |
39,366,984 | Solution For getting Mobile Number in Android | <p>Using Telephony Manager returns null value for Mobile number, I want to get Mobile Number directly in to the app without asking user.</p>
| <android> | 2016-09-07 10:08:55 | LQ_CLOSE |
39,367,636 | why function pointer to make it difficult ~ | from [Wikipedia - Function object](https://en.wikipedia.org/wiki/Function_object)
> A typical use of a function object is in writing callback functions. A callback in procedural languages, such as C, may be performed by using function pointers.[2] However it can be difficult or awkward to pass a state into or out of the callback function. This restriction also inhibits more dynamic behavior of the function. A function object solves those problems since the function is really a façade for a full object, carrying its own state.
1. why function pointer to make it difficult `pass a state into or out of the callback function` and `dynamic behavior of the function`
2. if function do not use function pointer how programs can called function | <c++><function-object> | 2016-09-07 10:39:16 | LQ_EDIT |
39,367,754 | How to match on Some(Vec<T>)? | I'm working a network application where I want to iterate over all possible ip addresses for a network interface (IPv4 or IPv6) and only do something with the v4 addresses (in my case print them).
For example, printing with debug I get
Some([V6(fe80::6a5b:35ff:fec7:5eeb), V4(10.0.11.241)])
Which is a *Option<Vec<std::net::IpAdd>>* in which I want to iterate and if I encounter a V4 address will write the Display implementation for it.
Note that the type of [std::net::IpAdd][1] is
pub enum IpAddr {
V4(Ipv4Addr),
V6(Ipv6Addr),
}
But how do I match the enum on type (V4 only in my case)?
[1]: https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html | <types><rust><match> | 2016-09-07 10:44:26 | LQ_EDIT |
39,367,823 | How to schedule send message in Quickblox android | I want create scheduled send message function in my chat application. Quickblox Android support to do it? | <android><quickblox> | 2016-09-07 10:47:14 | LQ_EDIT |
39,368,404 | How to specify webpack-dev-server webpack.config.js file location | <p>I am starting with webpack.</p>
<p>I have been able to specify to webpack the location of webpack.config.js like this:</p>
<pre><code>"webpack --config ./App/webpack.config.js"
</code></pre>
<p>Now I am trying to use the webpack-dev-server with that file also, but I can not find how to specify the webpack.config.js location to it.</p>
<p>This is the relevant part of my package.json</p>
<pre><code>"scripts": {
"start": "webpack-dev-server --config ./App/webpack.config.js --progress --colors",
"build": "webpack --config ./App/webpack.config.js --progress --colors"
}
</code></pre>
<p>How can I pass the ./App/ directory to my webpack-dev-server?</p>
| <webpack><webpack-dev-server><package.json> | 2016-09-07 11:14:45 | HQ |
39,369,210 | How to pass data from Hashmap Listview to next Activity | I wish to pass data from one Listview activity to the next activity ie when an item is clicked in the list, data such as the title or thumb_url (an image from a remote database) can be passed to a detail Activity.
In the example below, these items are set out in an Hashmap.
What code will pass the above data to another activity, using an intent??
I'm puzzled because these data items are laid out in an hashmap.
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.pskovcreative.hullguide.R;
import com.pskovcreative.hullguide.SingleListItem_Attractions;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
public class CustomizedListView extends Activity {
// All static variables
static final String URL = "http://padihamcars.com/music.xml";
// XML node keys
static final String KEY_SONG = "song"; // parent node
static final String KEY_ID = "id";
static final String KEY_TITLE = "title";
static final String KEY_ARTIST = "artist";
static final String KEY_DURATION = "duration";
static final String KEY_THUMB_URL = "thumb_url";
ListView list;
LazyAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML from URL
Document doc = parser.getDomElement(xml); // getting DOM element
NodeList nl = doc.getElementsByTagName(KEY_SONG);
// looping through all song nodes <song>
for (int i = 0; i < nl.getLength(); i++) {
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
Element e = (Element) nl.item(i);
// adding each child node to HashMap key => value
map.put(KEY_ID, parser.getValue(e, KEY_ID));
map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
map.put(KEY_ARTIST, parser.getValue(e, KEY_ARTIST));
map.put(KEY_DURATION, parser.getValue(e, KEY_DURATION));
map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL));
// adding HashList to ArrayList
songsList.add(map);
}
list=(ListView)findViewById(R.id.list);
// Getting adapter by passing xml data ArrayList
adapter=new LazyAdapter(this, songsList);
list.setAdapter(adapter);
// Click event for single list row
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
} | <android><listview><android-intent><hashmap> | 2016-09-07 11:52:58 | LQ_EDIT |
39,369,367 | increase max_allowed_packet size in mysql docker | <p>We are using <strong>Docker</strong> for mysql, We are facing the below error while running</p>
<pre><code>Packet for query is too large (12884616 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.; nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (12884616 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
</code></pre>
<p>now we need to increase <code>max_allowed_packet</code> size in <strong>mysql</strong> configuration, Can anyone help me on docker command to increase <code>max_allowed_packet</code>.</p>
| <mysql><linux><docker><max-allowed-packet> | 2016-09-07 11:59:35 | HQ |
39,369,433 | Do we need to use background thread for retrieving data using firebase? | <p>I've an android app where I'm retrieving data into a Fragment. And I believe that Firebase manages its asynchronous calls. But still I've doubt the if we need to write the Firebase code in the background thread or not?.</p>
<p>If we need to write it into the background thread then can you please tell which operations takes more time. eg:</p>
<pre><code>mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog");
</code></pre>
<p>I think that performing this on the main UI thread may become risk full because setting connection between database may sometime take large time.</p>
| <android><multithreading><firebase><firebase-realtime-database> | 2016-09-07 12:02:09 | HQ |
39,369,444 | Empty SQL afte form submission | I've searched and searched I cannot find an answer to this
I've made a form [HERE][1] Its very basic. Somehow it's not submitting the final data. the code is
<
form class="form" action="submit.php" method="post">
<table>
<tr>
<td>Team Name: </td>
<td><input type="text" name="team"></td>
</tr>
<tr>
<td>Captains xbox tag: </td>
<td><input type="text" name="cap"></td>
<tr>
<td>Captains E-mail:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>Team Mates: </td>
<td><TEXTAREA name="teammates" rows="6" cols="50">
Please place each team member on a new line
</TEXTAREA><br></td>
</tr>
<tr>
<td>Sub team mates: </td>
<td><TEXTAREA name="subs" rows="2" cols="50"></TEXTAREA></td>
</tr>
</table>
<p><input type="submit"></p>
</form>
Thats the form
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "dbname";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO tournament1 (team, teammates, cap, email, subs)
VALUES ('$_POST[team]','$_POST[cap]','$_POST[email]','$_POST[teammates]','$_POST[subs]')";
if ($conn->query($sql) === TRUE) {
echo "Your team has been submitted Thankyou. You will be redirected back to the tournaments page Shortly";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
What am I doing wrong? It will connect and do something because the ID fills because its autoincremented. everything else gets lost.
Thanks in advance guys
Kyle
[1]: http://vixengaming.online/tournaments.html | <php><html><sql> | 2016-09-07 12:02:44 | LQ_EDIT |
39,369,941 | Why did this guy use '\\n' | Ok so i was watching a python 3 tutorial about how to download a file
and this is what it kinda looks like
from urllib import request
import requests
goog="http://realchart.finance.yahoo.com/table.csvs=GOOG&d=8&e=7&f=2016&g=d&a=7&b=19&c=2004&ignore=.csv"
rp=request.urlopen(goog)
s=rp.read()
cp=str(s)
m=cp.split('\\n')
dest='goog.csv'
fw=open(dest,'w')
for c in m:
fw.write(c+ '\n')
fw.close()
fr=open('goog.csv','r')
k=fr.read()
print(k)
Why was split(\\\n) used ??? its true that the code only works properly when you use the double black slashes but why | <python-3.x><newline> | 2016-09-07 12:26:24 | LQ_EDIT |
39,370,203 | Implementing a Linked list in Java | I have to create a class named Myset which includes methods like IsEmpty(), Insert(Object O) etc. I thought to use a Linked list of objects to implement the Myset class. But as I am new to Java, I am stuck with creating the object itself i.e. I am not clear even how to start with. I thought of something like this:
`public class Myset {`
`LinkedList<Object> LL = new LinkedList<Object>();`
`}`<Br>
I further have to write a method: `public Myset Union(Myset a)`: Returns a set which is the union of the current set with the set a. This can be done by iterating through a, if the element at a particular index in a is not contained in LL then we add that element to LL. But how do I write this in a Java code? <Br> PS: This is an assignment question and we aren't allowed to use Sets implementation. | <java><linked-list> | 2016-09-07 12:38:58 | LQ_EDIT |
39,371,186 | How to convert 007898989 to 7898989 python | I am trying to convert 007898989 to 7898989 using long(007898989)
but it gives error as invalid token.
please help | <python> | 2016-09-07 13:26:27 | LQ_EDIT |
39,371,772 | How to install Anaconda on RaspBerry Pi 3 Model B | <p>I would like to know how to install the latest Anaconda version from Continuum on my Raspberry Pi 3 model B. Any help would be appreciated...</p>
| <python-3.x><anaconda><raspberry-pi3> | 2016-09-07 13:50:47 | HQ |
39,372,014 | Java: Error parse date's string to date object | <p>I try to convert string to date on java. I read and try the example from this website <a href="https://www.mkyong.com/java/java-date-and-calendar-examples/" rel="nofollow">"Java Date and Calendar examples"</a> but I still cannot compile and run it. </p>
<p>This is my code.</p>
<pre><code>package javaapplication5;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class JavaApplication5 {
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
String dateInString = "31-08-1982 10:20:56";
Date date = sdf.parse(dateInString);
System.out.println(date);
}
}
</code></pre>
<p>And I got this error.</p>
<pre><code>Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - unreported exception java.text.ParseException; must be caught or declared to be thrown
</code></pre>
<p>What I missing or do it wrong? Thank you for help.</p>
| <java> | 2016-09-07 14:01:27 | LQ_CLOSE |
39,372,301 | Control key not working on embedded terminal (mac os) | <p>I probably changed some setting by mistake, how do I get the control key to work again??</p>
<p><strong>Given</strong> I open a terminal in IntelliJ (2016.2.3)<br>
<strong>And</strong> I run a command that takes some time to run<br>
<strong>When</strong> I press <code>control + c</code> <br>
<strong>Then</strong> I should see the command being aborted <br>
<strong>Instead</strong> I see the letter c is typed instead.</p>
<p>Basically the <code>control</code> key is not working at all in the embedded terminal.</p>
<p>The same scenario works on <strong>webstorm</strong> and <strong>iterm</strong>. So it's definitely <strong>IntelliJ</strong></p>
| <intellij-idea> | 2016-09-07 14:14:48 | HQ |
39,372,681 | What does :scope "provided" mean? | <p>I've seen a lot of places where some dependencies in Clojure project are marked with <code>:scope "provided"</code> (<a href="https://github.com/funcool/cats/blob/d1b7f3d60c7791798182937c54cbafa4e81536d4/project.clj#L6-L12" rel="noreferrer">example</a>).</p>
<p>What does it mean?</p>
| <clojure><leiningen> | 2016-09-07 14:29:58 | HQ |
39,372,804 | Typescript : how to loop through enum values for display in radio buttons? | <p>What is the proper way to loop through litterals of an enum in Typescript ?
(Currently using typescrip 1.8.1)</p>
<p>I've got the following enum :</p>
<pre><code>export enum MotifIntervention {
Intrusion,
Identification,
AbsenceTest,
Autre
}
export class InterventionDetails implements OnInit
{
constructor( private interService: InterventionService )
{
let i:number = 0;
for (let motif in MotifIntervention) {
console.log( motif );
}
}
</code></pre>
<p>The result displayed is a list</p>
<pre><code>0
1
2
3
Intrusion,
Identification,
AbsenceTest,
Autre
</code></pre>
<p>I do want only 4 iterations in the loop as there are only 4 elements in the enum, I don't want to have 0 1 2 and 3 that seem to be index numbers of the enum.</p>
| <javascript><arrays><typescript><enums><element> | 2016-09-07 14:35:34 | HQ |
39,372,886 | Document.importNode VS Node.cloneNode (real example) | <p><a href="https://www.w3.org/TR/dom/#dom-document-importnode" rel="noreferrer">Document.importNode in specification</a> </p>
<p><a href="https://www.w3.org/TR/dom/#concept-node-clone" rel="noreferrer">Node.cloneNode in specification</a></p>
<p>This two methods work equally. Please give me real example in which I can see the difference between this methods. </p>
| <javascript><html><dom><w3c> | 2016-09-07 14:39:35 | HQ |
39,373,037 | Access router instance from my service | <p>I create a auth service (<code>src/services/auth.js</code>), with just functions and properties ..</p>
<pre><code>export default {
login() { ... }
...
}
</code></pre>
<p>Inside <code>login</code> function, I need to redirect user </p>
<pre><code>router.go(redirect)
</code></pre>
<p><strong>How can I retrieve router instance</strong>?</p>
<hr>
<h3>Context</h3>
<p>In my <code>src/main.js</code> file, i create a router ..</p>
<pre><code>import VueRouter from 'vue-router'
Vue.use(VueRouter)
import route from './routes'
const router = new VueRouter({
history: false,
linkActiveClass: 'active'
})
route(router)
const App = Vue.extend(require('./App.vue'))
</code></pre>
<p>In my <code>src/routers.js</code> is just map routes</p>
<pre><code>export default function configRouter (router) {
router.map({ .. })
}
</code></pre>
| <vue.js><vue-router> | 2016-09-07 14:46:31 | HQ |
39,373,047 | Include global functions in Vue.js | <p>In my Vue.js application I want to have some global functions. For example a <code>callApi()</code> function which I can call every time I need access to my data.</p>
<p>What is the best way to include these functions so I can access it in all my components?</p>
<ul>
<li>Should I create a file functions.js and include it in my main.js?</li>
<li>Should I create a Mixin and include it in my main.js?</li>
<li>Is there a better option?</li>
</ul>
| <javascript><vue.js><vue-resource><vue-component> | 2016-09-07 14:47:07 | HQ |
39,373,217 | Docker: Looks something went wrong in step Looking for vboxmanage.exe | <p>I just installed Docker Toolbox on my windows 7 machine.
After installing I run the Docker Quickstart terminal which displays the following message:</p>
<p>Looks something went wrong in step nLooking for vboxmanage.exen... Press any key to continue....</p>
<p>Anyone here who knows how to solve this?</p>
<p>Regards,</p>
| <docker><virtualbox> | 2016-09-07 14:54:49 | HQ |
39,373,230 | What does TensorFlow's `conv2d_transpose()` operation do? | <p>The documentation for the <code>conv2d_transpose()</code> operation does not clearly explain what it does:</p>
<blockquote>
<p>The transpose of conv2d.</p>
<p>This operation is sometimes called "deconvolution" after
<a href="http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf" rel="noreferrer">Deconvolutional Networks</a>, but is actually the transpose (gradient) of
conv2d rather than an actual deconvolution.</p>
</blockquote>
<p>I went through the paper that the doc points to, but it did not help.</p>
<p>What does this operation do and what are examples of why you would want to use it?</p>
| <tensorflow><conv-neural-network> | 2016-09-07 14:55:18 | HQ |
39,373,844 | docker base image with solaris operating system | <p>Does anybody know from where i can get docker base image with Solaris OS in it?</p>
<p>I tried finding it on Dockerhub but couldn't find one.</p>
<p>Please provide me the detail 'dockerhost/namespace/imagename:tag'</p>
| <docker><solaris><docker-machine><docker-registry><dockerhub> | 2016-09-07 15:24:01 | HQ |
39,374,157 | Angular save file as csv result in Failed- network error Only on Chrome | <p>I'm using the following code to save file as csv.</p>
<pre><code>$scope.saveCSVFile = function (result)
{
var a = document.createElement('a');
a.href = 'data:application/csv;charset=utf-8,' + encodeURIComponent(result.data);
a.target = '_blank';
a.download = $scope.getFileNameFromHttpResponse(result);
document.body.appendChild(a);
a.click();
$scope.isReportInProgress = false;
};
</code></pre>
<p>The file is working on most of the cases but for some reason when the file is larger than 10MB i get "Failed - Network Error".</p>
<p>It happens only on chrome.</p>
<p>I tried to search the web for this issue and couldn't find anything relevant.</p>
<p>Can you think of an idea why does it happens? or maybe use a different save file method that will work on chrome/firefox/IE instead of my function?</p>
| <javascript><angularjs><google-chrome><csv> | 2016-09-07 15:39:45 | HQ |
39,374,235 | Algorithm for checking diagonal in N queens algortihm | I am trying to implement N- Queens problem in python. I need a small help in designing the algorithm to check if given a position of Queen check whether any other queen on the board is present on its diagonal or not.
I am trying to design a function diagonal_check(board, row, col) where board is N*N matrix of arrays where '1' represents presence of queen and '0' represents absence.
I will pass array and position of queen (row,col) to the function. My function must return false if any other queen is present on its diagonal or else return true.
If anyone could help me with algorithm for diagonal_check function. Not looking for any specific language code.
| <python><algorithm><language-agnostic><n-queens> | 2016-09-07 15:43:25 | LQ_EDIT |
39,374,295 | SELECT ID THAT HAVE MULTIPLES ATTRIBUTS AND VALUES |
i have table1 :
+------+---------+
| id | name |
+------+---------+
| 1 | name1 |
| 2 | name2 |
| 3 | name3 |
| 4 | name4 |
+------+---------+
i have table2 :
+------+---------+----------+
| id | attribut| value |
+------+---------+----------+
| 1 | 1 | 1 |
| 1 | 3 | 3 |
| 2 | 1 | 1 |
| 2 | 3 | 4 |
+------+---------+--------- +
i want to select the distinct id(s) and name(s) in table1 that have ( attribut 1 and value 1) and (attribut 3 and value 3) in table 2
thanks for help !! | <mysql> | 2016-09-07 15:46:34 | LQ_EDIT |
39,374,880 | Sub Resource Integrity value for //maps.google.com/maps/api/js | <p>Where do i find the sub resource integrity value for the script //maps.google.com/maps/api/js?</p>
<p>For example: </p>
<pre><code><script src="//maps.google.com/maps/api/js" integrity="sha256-????" crossorigin="anonymous"></script>
</code></pre>
| <google-maps><google-maps-api-3><google-cdn><subresource-integrity> | 2016-09-07 16:14:30 | HQ |
39,374,968 | JSON: Add pointer | <p>I have an automatially made json that looks like:</p>
<pre><code>{
"node_id_1": {
"x": -87,
"y": 149
},
"node_id_2": {
"x": -24,
"y": 50
},
"node_id_3": {
"x": 55,
"y": -32
}
}
</code></pre>
<p>I have problems to access the a specific node_id to get its x and y values. My idea is to automatically add an <code>"id:"</code> before e.g. <code>"node_id_1"</code> and then to flatten the array.
Could you give me a hint how to add this <code>"id:"</code>? Or is there another elegant way to access the IDs?
Thank you a lot!
Best regards</p>
| <javascript> | 2016-09-07 16:18:57 | LQ_CLOSE |
39,375,000 | Does the join query works differently on hive? | I have a join query (that joins 4 table) on mysql returns 2 rows while on Hive returns OK results. So i checked table individually on hive and mysql side. Records on each table on both side matches but results doesn't match.
Is the OK results on hive an issue.
Below is the part of the result:
Stage-Stage-6: Map: 2 Reduce: 1 Cumulative CPU: 22.22 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS
Stage-Stage-7: Map: 2 Reduce: 1 Cumulative CPU: 24.94 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS
Stage-Stage-8: Map: 2 Reduce: 1 Cumulative CPU: 22.25 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS
Total MapReduce CPU Time Spent: 2 minutes 36 seconds 110 msec
OK
Time taken: 411.225 seconds
hive>
| <mysql><hadoop><hive> | 2016-09-07 16:21:02 | LQ_EDIT |
39,375,290 | User-Agent in request for IOS and Android | <p>Hi i'm developing a android and IOS app . I never set a user-agent header for my API call. (simply use some library to make request and get response) Now my server guys told me that </p>
<p>" We are facing an issue as currently mobile does not do any authentication when calling esb</p>
<p>Simply states SytemId=’ABC’</p>
<p>Now we are getting malicious hits from intruders disguised as mobile and is cauing lot of traffic"</p>
<p>Is this related to user-agent? What should I do now? Any help is much appreciated. I'm not good at security thing</p>
| <android><ios><user-agent> | 2016-09-07 16:39:53 | LQ_CLOSE |
39,375,471 | How to open a new box when clicked on a link | <p>I am a beginner in web developing world.</p>
<p>I have a table of data fetched from mysql database shown in php. Now I want to create a link on each row which on click will open up a new box (not window) of specific width-height and will show detailed information.</p>
<p>How can i do this ?</p>
| <javascript><php><html><css> | 2016-09-07 16:51:59 | LQ_CLOSE |
39,375,474 | Why I Am Getting Error While Running a Bat File? | The code is as follows:
@Echo off
Set _File=SQLQuery.txt
Set /a _Lines=0
For /f %j in ('Type %_File%^|Find "" /v /c') Do Set /a _Lines=%j
Echo %_File% has %_Lines% lines.
When I run as a bat file it gives me error as 'the syntax of the command is incorrect' .
And when I run all the above commands it runs successfully.
Why this is so? | <batch-file> | 2016-09-07 16:52:10 | LQ_EDIT |
39,376,108 | How chnage image size before uploaded on server | <p>I want to change image size before uploaded on server/mysql database, As its for member, so member can uploaded big images in size and i want to prevent and assign a new image size of their images.</p>
<p>I need it in PHP.</p>
<p>Thanks</p>
| <php><mysql> | 2016-09-07 17:35:05 | LQ_CLOSE |
39,376,786 | Docker and symlinks | <p>I've got a repo set up like this:</p>
<pre><code>/config
config.json
/worker-a
Dockerfile
<symlink to config.json>
/code
/worker-b
Dockerfile
<symlink to config.json>
/code
</code></pre>
<p>However, building the images fails, because Docker can't handle the symlinks. I should mention my project is far more complicated than this, so restructuring directories isn't a great option. How do I deal with this situation?</p>
| <docker><symlink> | 2016-09-07 18:22:58 | HQ |
39,376,840 | Angular2 RC5 Mock Activated Route Params | <p>I need to be able to mock the activated route parameters to be able to test my component.</p>
<p>Here's my best attempt so far, but it doesn't work.</p>
<pre><code>{ provide: ActivatedRoute, useValue: { params: [ { 'id': 1 } ] } },
</code></pre>
<p>The ActivatedRoute is used in the actual component like this:</p>
<pre><code>this.route.params.subscribe(params => {
this.stateId = +params['id'];
this.stateService.getState(this.stateId).then(state => {
this.state = state;
});
});
</code></pre>
<p>The error I get with my current attempt is simply:</p>
<p><code>TypeError: undefined is not a constructor (evaluating 'this.route.params.subscribe')</code></p>
<p>Any help would be greatly appreciated.</p>
| <angular><typescript><angular2-routing><angular2-testing> | 2016-09-07 18:26:51 | HQ |
39,377,055 | How to display countdown timer on status bar in android, like time display? | <p>I am making an app which allows the user to pick a date and time. Once the date and time are reached,it will display an animation on the screen. Before its time, it will just show countdown time (like xxx:xx:xx) on screen. I achieved this using a textview which changes every second. How can I display this text on status bar, like time is displayed</p>
<p>I have tried using Notification constructor like in some post I found here but they are depricated and wont work anymore.
I tried with NotificationCompat.Builder but it doesnt really have a way to set text which could be displayed on status bar.</p>
<p>Anyone knows any work arpund solution for it, please give me an answer. I just need to display a text on status bar insted of icon</p>
| <android><android-layout><android-notifications><countdowntimer><android-statusbar> | 2016-09-07 18:41:46 | HQ |
39,377,541 | How to solve 'libcurl' not found with Rails on Windows | <p>This is giving me a headache. I'm continuing a Rails project that started on Linux and I keep getting this when I run Puma on Ruby Mine:</p>
<pre><code>Error:[rake --tasks] DL is deprecated, please use Fiddle
rake aborted!
LoadError: Could not open library 'libcurl': The specified module could not be found.
Could not open library 'libcurl.dll': The specified module could not be found.
Could not open library 'libcurl.so.4': The specified module could not be found.
Could not open library 'libcurl.so.4.dll': The specified module could not be found.
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib'
[...]
</code></pre>
<p><strong>Now, what have I tried?</strong></p>
<ul>
<li>I installed Puma successfully on Windows following <a href="https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows" rel="noreferrer">this steps</a></li>
<li>I downloaded <code>curl-7.50.1-win32-mingw</code> and put it on "C:/curl"</li>
<li>I added C:/curl/bin and C:/curl/include to PATH</li>
<li>I installed successfully curb gem with <code>gem install curb --platform=ruby -- --with-curl-lib=C:/curl/bin --with-curl-include=C:/curl/include</code></li>
<li>I put the .dll files in Ruby bin folder, installed the certificate in curl/bin and even run the curl.exe just in case.</li>
</ul>
<p>I rebooted the machine but I keep seeing the same error.</p>
<p>I do not know what to do. <strong>How to successfully install libcurl on Windows for use with Rails</strong></p>
| <ruby-on-rails><windows><curl><libcurl><rubymine> | 2016-09-07 19:17:32 | HQ |
39,378,233 | JSON to PHP error - array | <p>I'm having problems getting data from JSON with PHP. </p>
<p>json string</p>
<pre><code>{"cpresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}
</code></pre>
<p>Same json decoded</p>
<pre><code> array (
'cpresult' =>
array (
'apiversion' => '2',
'error' => 'Access denied',
'data' =>
array (
'reason' => 'Access denied',
'result' => '0',
),
'type' => 'text',
),
)
</code></pre>
<p>PHP code</p>
<pre><code> $get_accounts = json_decode($get_accounts);
echo $get_accounts['cpresult']['data'][0]['result'];
</code></pre>
<p>error: Fatal error: Cannot use object of type stdClass as array</p>
| <php><json> | 2016-09-07 20:10:46 | LQ_CLOSE |
39,378,924 | Need recommendations of an exception tracking system | <p>We need a recommendation for tracking exceptions in our web app. Our front-end is using Angular 1 or 2, back-end is using ColdFusion. We found <a href="https://bugsnag.com/" rel="nofollow">BugSnag</a>, but this company cannot do annual billing. </p>
<p>Does anyone know any other similar product?</p>
<p>Thanks a lot!</p>
| <angularjs><exception><angular><exception-handling><coldfusion> | 2016-09-07 21:00:55 | LQ_CLOSE |
39,379,792 | Install Cuda without root | <p>I know that I can install Cuda with the following:</p>
<pre>
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
chmod +x cuda_7.0.28_linux.run
./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers
cd nvidia_installers
sudo ./NVIDIA-Linux-x86_64-346.46.run
sudo modprobe nvidia
sudo ./cuda-linux64-rel-7.0.28-19326674.run
</pre>
<p>Just wondering if I can install Cuda without root?</p>
<p>Thanks,</p>
| <cuda><tensorflow><gpu><theano> | 2016-09-07 22:13:17 | HQ |
39,382,050 | DynamoDB update Item multi action | <p>I am trying to update an item in DynamoDB table:</p>
<pre><code>var params = {
TableName: 'User',
Key: {
id: 'b6cc8100-74e4-11e6-8e52-bbcb90cbdd26',
},
UpdateExpression: 'ADD past_visits :inc, past_chats :inc',
ExpressionAttributeValues: {
':inc': 1
},
ReturnValues: 'ALL_NEW'
};
docClient.update(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
</code></pre>
<p>It's working. But I want to set some more value (reset_time = :value') like this:</p>
<pre><code>var params = {
TableName: 'User',
Key: {
id: 'b6cc8100-74e4-11e6-8e52-bbcb90cbdd26',
},
UpdateExpression: 'ADD past_visits :inc, past_chats :inc, SET reset_time = :value',
ExpressionAttributeValues: {
':inc': 1,
':value': 0
},
ReturnValues: 'ALL_NEW'
};
docClient.update(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
</code></pre>
<p>Can DynamoDb support multi action in one query ?</p>
| <amazon-dynamodb> | 2016-09-08 03:17:49 | HQ |
39,382,090 | How do i extract data out from Ienumerable? | I'm coding in C#. I have this code that tells me the difference in my 2 listview data.
`var diff = ListViewDatabase.Items.Cast<ListViewItem>().Select(x => x.SubItems[1].Text).Except(LstView.Items.Cast<ListViewItem>().Select(x => x.SubItems[1].Text));
MessageBox.Show(string.Format("{0} Missing.", string.Join(",", diff), "\n"));`
Now how do I extract the information out from variable diff to a single string? It needs to be seperated to different string. | <c#><winforms> | 2016-09-08 03:22:05 | LQ_EDIT |
39,382,517 | how can i convert this query result to date format (SQL-Server | this for example :
concat (concat('201',(substring('A41020',2,1)),'-',(substring('B210906',6,2))
and the result is 2014-06.
what additional query I can use to change this string (2014-06) to date format automatically while I retrieve the data?
please help me. | <sql><sql-server> | 2016-09-08 04:18:17 | LQ_EDIT |
39,383,041 | What is not file in Linux | <p>When I first learned Linux, I was told <strong>almost</strong> everything in Linux is file. This morning, when I repeated it to my girlfriend. She asked what is not? I tried to find an example for half a day.</p>
<p>So my question is what is not file in Linux?</p>
| <linux> | 2016-09-08 05:16:02 | LQ_CLOSE |
39,383,097 | How to Pass Parameter to SQL Query After Conditional Split | I am fairly new at working with SSIS, and everything was straight forward until I came across this. I have a system that has data everywhere and I am trying to clean everything up by normalizing it. Now my issue is, in my SSIS I have a conditional split, what what I would like to do is to take that value which I just split it up and pass it as a parameter to a query I already have.
Thanks a lot in advance! | <sql-server><ssis><ssis-2012> | 2016-09-08 05:21:26 | LQ_EDIT |
39,384,457 | Gulp not defined | i am new to Gulp and have been struggling all day to make this work
**This is my Gulpfile.js**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
'use strict';
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt);
module.exports = function(grunt) {
// Define the configuration for all the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'app/scripts/{,*/}*.js'
]
}
}
});
grunt.registerTask('build', [
'jshint'
]);
grunt.registerTask('default', ['build']);
};
<!-- end snippet -->
**This my package.json**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
{
"name": "conFusion",
"private": true,
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"jit-grunt": "^0.10.0",
"jshint-stylish": "^2.2.1",
"time-grunt": "^1.4.0"
},
"engines": {
"node": ">=0.10.0"
}
}
<!-- end snippet -->
**And this is the error message i get**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
grunt build
Loading "Gruntfile.js"
tasks...ERROR >>
ReferenceError: grunt is not defined
Warning: Task "build"
not found.Use--force to
continue.
Aborted due to warnings.
<!-- end snippet -->
Pls guys i need help. am working on windows 10, so am using the command line there | <javascript><gruntjs> | 2016-09-08 07:00:12 | LQ_EDIT |
39,384,523 | Covert Json to NSDictionary | I am trying to convert serialized `Json` string to `NSDictionary` but not find any solution to convert serialized `Json` to `NSDictionary`.
This is my response string
{"id":2,"parent_id":1,"lft":2,"rght":3,"name":"Audio Engineering","images":[{"id":22,"user_id":2,"name":"iStock_000027023404_Small","url":"https:\/\/pbs.twimg.com\/profile_images\/97601593\/Picture_3_400x400.png","alt":"iStock_000027023404_Small","description":"","thumbnail":"a:3:{i:0;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:30;s:6:\"height\";i:30;s:3:\"url\";s:58:\"\/uploads\/2016\/09\/thumb\/small\/iStock_000027023404_Small.jpg\";}i:1;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:90;s:6:\"height\";i:90;s:3:\"url\";s:59:\"\/uploads\/2016\/09\/thumb\/medium\/iStock_000027023404_Small.jpg\";}i:2;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:230;s:6:\"height\";i:230;s:3:\"url\";s:67:\"\/uploads\/2016\/09\/thumb\/medium_251x230\/iStock_000027023404_Small.jpg\";}}","created":"2016-09-07T06:24:09+00:00","modified":"2016-09-07T06:24:09+00:00","_joinData":{"id":12,"category_id":2,"image_id":22}}]}
Which I am trying to convert to `NSDictionary`. In this value for key `Thumbnail` is serialized data which I am not able to parse.
So if anybody knows the solution please help.
Thanks in advance. | <ios><objective-c><iphone><json><nsdictionary> | 2016-09-08 07:04:58 | LQ_EDIT |
39,385,391 | R's order equivalent in python | <p>Any ideas what is the python's equivalent for R's <code>order</code>? </p>
<pre><code>order(c(10,2,-1, 20), decreasing = F)
# 3 2 1 4
</code></pre>
| <python><r><python-2.7> | 2016-09-08 07:51:04 | HQ |
39,386,251 | Selecting List<string> into Dictionary with index | <p>I have a List</p>
<pre><code>List<string> sList = new List<string>() { "a","b","c"};
</code></pre>
<p>And currently I am selecting this into a dictionary the following structure:</p>
<pre><code>//(1,a)(2,b)(3,c)
Dictionary<int, string> dResult = new Dictionary<int, string>();
for(int i=0;i< sList.Count;i++)
{
dResult.Add(i, sList[i]);
}
</code></pre>
<p>but with Linq I've seen some slimmer way like <code>ToDictionary((x,index) =></code></p>
<p>How is the correct syntax or how can this be solved within one line?</p>
| <c#><list><dictionary> | 2016-09-08 08:36:49 | HQ |
39,387,118 | How to get Last latest value from recyclerview | I am making Garage Application just like Calculator..Taking 2 values from Edittext and print in third Edittext.and then it will store all values in recyclerview.**Now issue is I am trying to get the latest Total Gross value ie last row Total Value** I had done all possibly Solution still I am not getting.
Here is my code in Custom Adapter:
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
Employee employee = bank_details.get(position);
holder.total.setText(employee.getTotal());
holder.accept.setText(employee.getAcceptmoney());
holder.given.setText(employee.getGivemoney());
holder.note.setText(employee.getNote());
holder.date.setText(employee.getTime());
int selectedItem = 0;
if(selectedItem == position)
holder.itemView.setSelected(true);
}
@Override
public int getItemCount() {
return bank_details.size();
}
public void setSelectedItem(int last_pos) {
}
public class MyViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView total;
TextView accept;
TextView given;
TextView note;
TextView date;
Button edit;
Button delete;
public MyViewHolder(View itemView) {
super(itemView);
cv= (CardView) itemView.findViewById(R.id.cv);
total = (TextView) itemView.findViewById(R.id.grossIncome);
accept = (TextView) itemView.findViewById(R.id.acceptmoney);
given = (TextView) itemView.findViewById(R.id.givenmoney);
note = (TextView) itemView.findViewById(R.id.note);
date= (TextView) itemView.findViewById(R.id.date);
}
}
public Employee getItem(int position) {
return bank_details.get(position);
}
Here is the code of recyclerview:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recyclerview);
final RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
rv.setHasFixedSize(true);
final ArrayList<Employee> arr = InitializeData();
final LinearLayoutManager llm = new LinearLayoutManager(this);
rv.setLayoutManager(llm);
rv.setHasFixedSize(true);
cu = new CustomAdapter(arr);
rv.setAdapter(cu);
int last_pos = cu.getItemCount() - 1;
cu.notifyDataSetChanged();
cu.setSelectedItem(last_pos);
rv.scrollToPosition(last_pos);
}
public ArrayList<Employee> InitializeData() {
ArrayList<Employee> arr_emp = new ArrayList<>();
ArrayList<Employee> arr_emp_2 = new ArrayList<>();
DAL dal = new DAL(this);
dal.OpenDB();
arr_emp = dal.AllSelectQryForTabEmpData();
dal.CloseDB();
return arr_emp;
}
public void setSelectedItem(int position)
{
selectedItem = position;
}
Problem is I want total value and that total value can be used as giving and receiving value ie-**Total+receving Money**,**Total-giving Money** | <android><sqlite><android-recyclerview><android-cardview> | 2016-09-08 09:21:05 | LQ_EDIT |
39,387,399 | Sum digits of numbers in a list Python | Trying to write a function that takes a list like x = [1, 13, 14, 9, 8] for example and sums the digits like:
1 + (1+3) + (1+4) + 9 + 8 = 27 | <python><list><python-3.x> | 2016-09-08 09:33:44 | LQ_EDIT |
39,387,467 | using Ruby do little changes to run the program | for every line of code a description is given what to do i have completed half of the program and stuck in self object and onwards program so please complete it so that it works.
class Person
#have a first_name and last_name attribute with public accessors
#attr_accessor
attr_accessor :first_name , :last_name
#have a class attribute called `people` that holds an array of objects
@@people = []
#have an `initialize` method to initialize each instance
def initialize(first_name,last_name)#should take 2 parameters for first_name and last_name
@first_name = first_name
@last_name = last_name #assign those parameters to instance variables
#add the created instance (self) to people class variable
end
#have a `search` method to locate all people with a matching `last_name`
def self.search(last_name)
#accept a `last_name` parameter
#search the `people` class attribute for instances with the same `last_name`
#return a collection of matching instances
end
#have a `to_s` method to return a formatted string of the person's name
def to_s
#return a formatted string as `first_name(space)last_name`
end
end
p1 = Person.new("John", "Smith")
p2 = Person.new("John", "Doe")
p3 = Person.new("Jane", "Smith")
p4 = Person.new("Cool", "Dude")
puts Person.search("Smith")
# Should print out
# => John Smith
# => Jane Smith
| <ruby> | 2016-09-08 09:36:41 | LQ_EDIT |
39,388,259 | Inserting Response data inside data into table using Angular JS ng-repeat | I have a response as given below
Response :
response:
{"json":
{"response":
{"servicetype":"",
"functiontype":"",
"statuscode":"0",
"statusmessage":"Success",
"data":[{"graphtype":"piechart",
"xlabel":"state",
"ylabel":"count",
"s1":"contact",
"s2":"User",
"data":["Total Contacts: 1 Users: 20",
[{"x":"Karnataka","s1":"1","s2":"15","lat":"12.9716","long":"77.5946"},
{"x":"New Delhi","s1":"0","s2":"5","lat":"28.6139","long":"77.2090"}]]}]}}}
I need to insert table row name , table data name dynamically using ng-repeat.
My table shoud look like.
State Contact User
Karnatka 1 15
New Delhi 0 5
| <angularjs><json><object><angularjs-ng-repeat><ng-repeat> | 2016-09-08 10:14:37 | LQ_EDIT |
39,388,563 | VS2015: Compiling doesn't work? | The visual studio I use displays ' cannot start debugging bcuz the debug target is missing. Pls build the project and retry, or set the outputpath and AssemblyName appropriately to point at the correct location for the target assembly'.
Am new to programming, n I can't seem 2 understand what this means.Thanks 4 assisting me | <.net><visual-studio> | 2016-09-08 10:28:50 | LQ_EDIT |
39,388,903 | Posting on Facebook Page with video id | <p>What are the parameters to post on a Facebook page with an already uploaded video using Graph API. I have the video id.</p>
| <python><facebook><facebook-graph-api> | 2016-09-08 10:45:49 | LQ_CLOSE |
39,389,678 | How can i Export a datatable to an excel sheet with userdefined row no of the excel sheet from c#? | how can,i Export a datatable to an excel sheet with userdefined row no of the excel sheet from c#? | <c#><export-to-excel> | 2016-09-08 11:25:59 | LQ_EDIT |
39,390,160 | pandas.factorize on an entire data frame | <p><a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.factorize.html" rel="noreferrer"><code>pandas.factorize</code></a> encodes input values as an enumerated type or categorical variable. </p>
<p>But how can I easily and efficiently convert many columns of a data frame? What about the reverse mapping step?</p>
<p>Example: This data frame contains columns with string values such as "type 2" which I would like to convert to numerical values - and possibly translate them back later.</p>
<p><a href="https://i.stack.imgur.com/MLATh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MLATh.png" alt="enter image description here"></a></p>
| <python><pandas><dataframe><machine-learning> | 2016-09-08 11:50:52 | HQ |
39,390,240 | Create Cookie ASP.NET & MVC | <p>I have a quite simple problem - I want to create a cookie at a Client, that is created by the server.
I've found a lot of <a href="http://www.codeproject.com/Articles/244904/Cookies-in-ASP-NET" rel="noreferrer">pages</a> that describe, how to use it - but I always stuck at the same point.</p>
<p>I have a DBController that gets invoked when there is a request to the DB. </p>
<p>The DBController's constructor is like this:</p>
<pre><code>public class DBController : Controller
{
public DBController()
{
HttpCookie StudentCookies = new HttpCookie("StudentCookies");
StudentCookies.Value = "hallo";
StudentCookies.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(StudentCookies);
Response.Flush();
}
[... more code ...]
}
</code></pre>
<p>I get the Error "Object reference not set to an instance of an object" at:</p>
<pre><code>StudentCookies.Expire = DateTime.Now.AddHours(1)
</code></pre>
<p>This is a kind of a basic error message - so what kind of basic thing I've forgot?</p>
| <c#><asp.net><asp.net-mvc><cookies> | 2016-09-08 11:55:11 | HQ |
39,390,339 | Integration testing with in-memory IdentityServer | <p>I have an API that uses IdentityServer4 for token validation.
I want to unit test this API with an in-memory TestServer. I'd like to host the IdentityServer in the in-memory TestServer. </p>
<p>I have managed to create a token from the IdentityServer. </p>
<p>This is how far I've come, but I get an error "Unable to obtain configuration from <a href="http://localhost:54100/.well-known/openid-configuration" rel="noreferrer">http://localhost:54100/.well-known/openid-configuration</a>"</p>
<p>The Api uses [Authorize]-attribute with different policies. This is what I want to test. </p>
<p>Can this be done, and what am I doing wrong?
I have tried to look at the source code for IdentityServer4, but have not come across a similar integration test scenario. </p>
<pre><code>protected IntegrationTestBase()
{
var startupAssembly = typeof(Startup).GetTypeInfo().Assembly;
_contentRoot = SolutionPathUtility.GetProjectPath(@"<my project path>", startupAssembly);
Configure(_contentRoot);
var orderApiServerBuilder = new WebHostBuilder()
.UseContentRoot(_contentRoot)
.ConfigureServices(InitializeServices)
.UseStartup<Startup>();
orderApiServerBuilder.Configure(ConfigureApp);
OrderApiTestServer = new TestServer(orderApiServerBuilder);
HttpClient = OrderApiTestServer.CreateClient();
}
private void InitializeServices(IServiceCollection services)
{
var cert = new X509Certificate2(Path.Combine(_contentRoot, "idsvr3test.pfx"), "idsrv3test");
services.AddIdentityServer(options =>
{
options.IssuerUri = "http://localhost:54100";
})
.AddInMemoryClients(Clients.Get())
.AddInMemoryScopes(Scopes.Get())
.AddInMemoryUsers(Users.Get())
.SetSigningCredential(cert);
services.AddAuthorization(options =>
{
options.AddPolicy(OrderApiConstants.StoreIdPolicyName, policy => policy.Requirements.Add(new StoreIdRequirement("storeId")));
});
services.AddSingleton<IPersistedGrantStore, InMemoryPersistedGrantStore>();
services.AddSingleton(_orderManagerMock.Object);
services.AddMvc();
}
private void ConfigureApp(IApplicationBuilder app)
{
app.UseIdentityServer();
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var options = new IdentityServerAuthenticationOptions
{
Authority = _appsettings.IdentityServerAddress,
RequireHttpsMetadata = false,
ScopeName = _appsettings.IdentityServerScopeName,
AutomaticAuthenticate = false
};
app.UseIdentityServerAuthentication(options);
app.UseMvc();
}
</code></pre>
<p>And in my unit-test: </p>
<pre><code>private HttpMessageHandler _handler;
const string TokenEndpoint = "http://localhost/connect/token";
public Test()
{
_handler = OrderApiTestServer.CreateHandler();
}
[Fact]
public async Task LeTest()
{
var accessToken = await GetToken();
HttpClient.SetBearerToken(accessToken);
var httpResponseMessage = await HttpClient.GetAsync("stores/11/orders/asdf"); // Fails on this line
}
private async Task<string> GetToken()
{
var client = new TokenClient(TokenEndpoint, "client", "secret", innerHttpMessageHandler: _handler);
var response = await client.RequestClientCredentialsAsync("TheMOON.OrderApi");
return response.AccessToken;
}
</code></pre>
| <identityserver4> | 2016-09-08 12:00:15 | HQ |
39,390,402 | C How can I calculate an average of a list without loops? | <p>So I created a linked List in C using structs and it stores ints. My mission is to calculate the average of the values in the list without using recursion or loops.
I already have the list's item count I just need the sum.</p>
<p>Any ideas?</p>
| <c><list><average> | 2016-09-08 12:03:57 | LQ_CLOSE |
39,390,418 | Python: How can I enable use of kwargs when calling from command line? (perhaps with argparse) | <p>suppose I have the module myscript.py; This module is production code, and is called often as <code>%dir%>python myscript.py foo bar</code>. </p>
<p>I want to extend it to take keyword arguments. I know that I can take these arguments using the script below, but unfortunately one would have to call it using </p>
<p><code>%dir%>python myscript.py main(foo, bar)</code>.</p>
<p>I know that I can use the <code>argparse</code> module, but I'm not sure how to do it. </p>
<pre><code>import sys
def main(foo,bar,**kwargs):
print 'Called myscript with:'
print 'foo = %s' % foo
print 'bar = %s' % bar
if kwargs:
for k in kwargs.keys():
print 'keyword argument : %s' % k + ' = ' + '%s' % kwargs[k]
if __name__=="__main__":
exec(''.join(sys.argv[1:]))
</code></pre>
| <python><python-2.7><command-line><argparse><keyword-argument> | 2016-09-08 12:04:48 | HQ |
39,390,738 | how to access a single object from a json array | Okay so I have this json file
{ "Concepts":[ {"Concept":"1","Description":"siopao"},{"Concept":"4","Description":"gulaman"},{"Concept":"9","Description":"sisig"},{"Concept":"12","Description":"noodle"},{"Concept":"15","Description":"sisigan"},{"Concept":"16","Description":"buko shake"},{"Concept":"17","Description":"mango shake"},{"Concept":"19","Description":"burger"},{"Concept":"20","Description":"sample"},{"Concept":"21","Description":"shit"} ]}
how do I get only "Description":"siopao"? I'm using angularjs. | <angularjs><json> | 2016-09-08 12:19:15 | LQ_EDIT |
39,391,437 | Merge two or more []map[string]interface{} types into one in Golang | <p>I'm using Golang and for some reason, I need to merge results from different database queries, all of which return me a <code>[]map[string]interface{}</code>
I'm thinking of Append but its just not clear enough if this is even possible.
What is the final datatype I'm looking at?</p>
<p>Clearly, an array of maps of interfaces with keys as strings should be able to simply 'attach' (concat, if you may) to another array of maps of interfaces with keys as strings!</p>
<p>So what is the mechanism to achieve this?</p>
| <arrays><go><types><maps> | 2016-09-08 12:50:19 | HQ |
39,391,595 | Event handler on chosen option | <p>I need to handle alert event on chosen option.</p>
<pre><code> <select>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="3">D</option>
</select>
</code></pre>
<p>For ex., if I choose "B" option, I want alert like "Chosen option is: B", etc...</p>
<p>Thank you!</p>
| <javascript> | 2016-09-08 12:57:18 | LQ_CLOSE |
39,391,675 | Inconsistency in Parallel.ForEach | <p>I am using Parallel.foreach for more than 500 iterations.</p>
<p>My loop is something like:</p>
<pre><code>Parallel.ForEach(indexes, (index) =>
{
//parentCreation with index object
parent=create(index);
//call of function to create children
createChildrenOfType1(parent);
createChildrenOfType2(parent);
});
</code></pre>
<p>I am facing inconsistent output. Parents are created correctly but child creation is inconsistent.
Sometimes no child is created, sometimes only few are created and so on.
Child creation method again has for loop to create 100s of children.</p>
<p>How can I make my child creation consistent while using the parallel foreach for parent creation.</p>
| <c#><multithreading><foreach><parallel-processing><task-parallel-library> | 2016-09-08 13:00:52 | LQ_CLOSE |
39,391,910 | Angular 2: how to create radio buttons from enum and add two-way binding? | <p>I'm trying to use Angular2 syntax to create radio buttons from an enum definition, and bind the value to a property that has the type of that enum.</p>
<p>My html contains:</p>
<pre><code><div class="from_elem">
<label>Motif</label><br>
<div *ngFor="let choice of motifChoices">
<input type="radio" name="motif" [(ngModel)]="choice.value"/>{{choice.motif}}<br>
</div>
</div>
</code></pre>
<p>In my @Component, I declared the set of choices and values:</p>
<pre><code>private motifChoices: any[] = [];
</code></pre>
<p>And in the constructor of my @Component, I filled the choices the following way:</p>
<pre><code>constructor( private interService: InterventionService )
{
this.motifChoices =
Object.keys(MotifIntervention).filter( key => isNaN( Number( key )))
.map( key => { return { motif: key, value: false } });
}
</code></pre>
<p>The radio buttons are displayed correctly, now I seek to bind the value selected to a property. But when I click one of the buttons the value choice.value is set to undefined.</p>
| <button><angular><binding><radio><two-way> | 2016-09-08 13:12:10 | HQ |
39,392,854 | Add hashmap values in hashmap inside arraylist without duplicate in android | Set of values present in HashMap<key,value>.How to add HashMap value in HashMap<key,value> inside array list by avoiding duplicate value in android. | <java><android><arraylist><hashmap><duplicates> | 2016-09-08 13:54:25 | LQ_EDIT |
39,393,079 | No provider for ConnectionBackend | <p>So recently I had to update to the latest version of Angular2, RC.6. The biggest breaking change seems to be the whole bootstrapping (by "introducing" ngModule).</p>
<pre><code>@NgModule({
imports: [HttpModule, BrowserModule, FormsModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [AppComponent, ...],
providers: [FrameService, Http, { provide: $WINDOW, useValue: window }],
bootstrap: [AppComponent]
})
class AppModule {
}
platformBrowserDynamic().bootstrapModule(AppModule);
</code></pre>
<p>However after a lot of tears, sweat and pleading to all the deities I could come up with... I still remain with what is hopefully the last error in a series of many:</p>
<p><strong>No provider for ConnectionBackend!</strong></p>
<p>At this point I am tearing out the last strains of hair I have left as I am clueless at this point regarding the "what I am missing".</p>
<p>Kind regards!</p>
| <angular> | 2016-09-08 14:05:33 | HQ |
39,393,624 | DataGrip: how to connect to Oracle as SYSDBA | <p>I tried to setup in <a href="https://www.jetbrains.com/datagrip/" rel="noreferrer">DataGrip</a> an Oracle connection under SYS user.</p>
<p>But got error:</p>
<blockquote>
<p>ORA-28009: connection as SYS should be as SYSDBA or SYSOPER</p>
</blockquote>
<p>But there is no option in GUI to choose <code>as SYSDBA</code> option.</p>
| <oracle><sys><datagrip><sysdba> | 2016-09-08 14:29:55 | HQ |
39,393,925 | Can i write two foreach in only one? [PHP] | In my code i've this:
$im = $database->query("SELECT * FROM cms_messaggi_importanti WHERE messo_da = :id ORDER BY ID DESC", array("id"=>$functions->Utente("id")));
foreach($im as $imp){
$mex_i = $database->query("SELECT * FROM cms_messaggi WHERE id = :id ORDER BY ID DESC", array("id"=>$imp['id_mex']));
foreach($mex_i as $mex_imp){
} }
Can i write this code in only one? Because i've to use a lot of variable with this method... is there a solution to my problem? For example.. using "JOIN".
Thanks! | <php><mysql> | 2016-09-08 14:43:07 | LQ_EDIT |
39,394,570 | I want result in horizontal format in pl sql. | `V_RES varchar2(100)
BEGIN
FOR I IN 1..5 LOOP
FOR J IN 65..70 LOOP
V_RES := V_RES ||' '||I||CHR(J);
END LOOP;
DBMS_OUTPUT.PUT_LINE(V_RES);
V_RES :='';
END LOOP;
END;
/
` I use this Code Below
*Result is Below*
'1A 1B 1C 1D 1E 1F
2A 2B 2C 2D 2E 2F
3A 3B 3C 3D 3E 3F
4A 4B 4C 4D 4E 4F
5A 5B 5C 5D 5E 5F'
*But i want Result in this format*
'1A 2A 3A
1B 2B 3B
1C 2C 3C' | <oracle><plsql><oracle11g> | 2016-09-08 15:12:44 | LQ_EDIT |
39,394,734 | Sorting multiple strings into an order | <p>I need an help on my php code</p>
<p>I got string array. It contains multiple values inside. Such as 'XXL', 'X', '1', '1.5','2', '3', 'T', '1K','1.5K','5K','Adult','One Size'.</p>
<p>Now I want it to be sorted as follows.
2T, 3T, 4T, YXXS, YXS, YS, YM, YL, YXL, XXS, XS, S, M, L, XL, XXL, XXXL, WXXS, WXS, WS, WM, WL, WXL, WXXL, Youth, Adult, One Size, 8K, 8.5K, 9K, 9.5K, 10K, 10.5K, 11K, 11.5K 12K, 12.5K, 13K, 13.5K, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15, Futsal</p>
<p>I need a sorting function or an algorithm to fix this issue</p>
| <php><arrays><sorting> | 2016-09-08 15:19:25 | LQ_CLOSE |
39,395,198 | Configuring Tensorflow to use all CPU's | <p>Reading :
<a href="https://www.tensorflow.org/versions/r0.10/resources/faq.html" rel="noreferrer">https://www.tensorflow.org/versions/r0.10/resources/faq.html</a> it states : </p>
<blockquote>
<p>Does TensorFlow make use of all the devices (GPUs and CPUs) available
on my machine?</p>
<p>TensorFlow supports multiple GPUs and CPUs. See the how-to
documentation on using GPUs with TensorFlow for details of how
TensorFlow assigns operations to devices, and the CIFAR-10 tutorial
for an example model that uses multiple GPUs.</p>
<p>Note that TensorFlow only uses GPU devices with a compute capability
greater than 3.5.</p>
</blockquote>
<p>Does this mean Tensorflow can automatically make use of all CPU's on given machine or does it ned to be explicitly configured ?</p>
| <tensorflow> | 2016-09-08 15:42:34 | HQ |
39,396,032 | Need help in writing mssql query | I am having a table having data .. percentage of each students in a school with below columns ...
**Class | name | Percentage( % ) **
I need a sql query to get Count of students in each class with below Diff % slabs.Students who had not written exam will have NULL in source table.
class| 0-10% | 10%-20% | 20%-30% | >30% | Not written ( NULLS in source table)
Can anybody help me in writing query .Thanks in advance
| <sql-server><tsql> | 2016-09-08 16:25:40 | LQ_EDIT |
39,396,270 | MACRO, difference between a date and today | i have a range of dates from column E3:E, in column F, i want to have the difference in days of today-E3=F3, in F4= Today-E4 and so on until the last value in E. this is the code i have right now:
'Calculate Overdue
For i = 1 To lastrow
If i = 1 Then
Workbooks(Main).Sheets(1).Cells(i + 1, lastcolumn + 1).Value = "Overdue [days]"
Else
Workbooks(Main).Sheets(1).Cells(i + 1, lastcolumn + 1).Value = _
Now - Workbooks(Main).Sheets(1).Cells(i + 1, lastcolumn - 1).Value
End If
Next i
help pleaseee | <excel><vba> | 2016-09-08 16:41:40 | LQ_EDIT |
39,397,278 | Post files from ASP.NET Core web api to another ASP.NET Core web api | <p>We are building a web application that consist of an Angular2 frontend, a ASP.NET Core web api public backend, and a ASP.NET Core web api private backend.</p>
<p>Uploading files from Angular2 to the public backend works. But we would prefer to post them forward to the private backend.</p>
<p>Current working code</p>
<pre><code>[HttpPost]
public StatusCodeResult Post(IFormFile file)
{
...
}
</code></pre>
<p>From there I can save the file to disk using file.CopyTo(fileStream);</p>
<p>However, I want to re-send that file, or those files, or, ideally, the whole request to my second web api core.</p>
<p>I am not sure how to achieve this with the HttpClient class of asp.net core.</p>
<p>I've tried all kinds of things such as</p>
<pre><code>StreamContent ss = new StreamContent(HttpContext.Request.Body);
var result = client.PostAsync("api/Values", ss).Result;
</code></pre>
<p>But my second backend gets an empty IFormFile.</p>
<p>I have a feeling it is possible to send the file(s) as a stream and reconstruct them on the other side, but can't get it to work.</p>
<p>The solution must use two web api core.</p>
| <c#><asp.net><asp.net-core> | 2016-09-08 17:49:52 | HQ |
39,397,329 | Jenkins Project Artifacts and Workspace | <p>I've used jenkins for quite a few years but have never set it up myself which I did at my new job. There are a couple questions and issues that I ran into.</p>
<p><strong>Default workspace location</strong> - It seems like the latest Jenkins has the default workspace in Jenkins\jobs[projectName]\workspace and is overwritten (or wiped if selected) for every build. I thought that it should instead be in Jenkins\jobs[projectName]\builds[build_id]\ so that it would be able to store the workspace state for every build for future reference? </p>
<p><strong>Displaying workspace on the project>Build_ID page</strong> - This goes along with the previous as I expected each 'workspace' for previous builds to show here. Currently in my setup this individual page gives you nothing except the Git revision and what repo changes triggered the build. As well as console output. Where are the artifacts? Where is the link to this build's workspace that was used?</p>
<p><strong>Archiving Artifacts in builds</strong> - When choosing artifacts, the filter doesn't seem to work. My build creates a filestructure with the artifacts in it inside workspace. I want to store this and the artifacts filter says it starts at workspace. So I put in 'artifacts' and nothing gets stores (also where would this get stored?). I have also tried '/artifacts' and 'artifacts/*'. </p>
<p>Any help would be great! Thanks!</p>
| <jenkins> | 2016-09-08 17:53:20 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.