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 |
|---|---|---|---|---|---|
37,336,477 | ChefZero returning 404 | <p>I am setting up a simple vagrant box with chef solo as the provisioner. Everything was going fine until i tried running it on my laptop. The machine comes up fine but when it provisions it spits out some errors.</p>
<p>I'm relatively fresh to chef and i'm not quite sure what i'm looking at.
Any help is immensely appreciated.</p>
<p><strong>Error</strong></p>
<pre><code>==> default: [2016-05-20T00:27:27+00:00] INFO: GET /organizations/chef/nodes/vagrant-ebebf4d0
==> default: [2016-05-20T00:27:27+00:00] INFO: #<ChefZero::RestErrorResponse: 404: Object not found: chefzero://localhost:8889/nodes/vagrant-ebebf4d0>
</code></pre>
<p><strong>Full Stack Trace</strong></p>
<pre><code> default: /tmp/vagrant-chef/fc2e73022d67a62fdf8d4974c11d0294/cookbooks => C:/Projects/new-vagrant/provision/cookbooks
==> default: Running provisioner: chef_solo...
default: Installing Chef (latest)...
==> default: Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2016-05-20T00:27:25+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /tmp/vagrant-chef/fc2e73022d67a62fdf8d4974c11d0294
==> default: One version per cookbook
==> default: [2016-05-20T00:27:25+00:00] INFO: Forking chef instance to converge...
==> default: Starting Chef Client, version 12.11.1
==> default: [2016-05-20T00:27:25+00:00] INFO: *** Chef 12.11.1 ***
==> default: [2016-05-20T00:27:25+00:00] INFO: Platform: x86_64-linux
==> default: [2016-05-20T00:27:25+00:00] INFO: Chef-client pid: 2613
==> default: [2016-05-20T00:27:27+00:00] INFO: GET /organizations/chef/nodes/vagrant-ebebf4d0
==> default: [2016-05-20T00:27:27+00:00] INFO: #<ChefZero::RestErrorResponse: 404: Object not found: chefzero://localhost:8889/nodes/vagrant-ebebf4d0>
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:91:in `rescue in get_data'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:83:in `get_data'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/endpoints/rest_object_endpoint.rb:18:in `get'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:62:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_router.rb:24:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:664:in `block in app'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:336:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:336:in `handle_socketless_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/socketless_server_map.rb:87:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/socketless_server_map.rb:33:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http/socketless_chef_zero_client.rb:154:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:305:in `block in send_http_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:336:in `block in retrying_http_errors'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:334:in `loop'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:334:in `retrying_http_errors'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:299:in `send_http_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:144:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:111:in `get'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/node.rb:604:in `load'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/node.rb:588:in `find_or_create'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/policy_builder/dynamic.rb:72:in `load_node'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/client.rb:465:in `load_node'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/client.rb:267:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:285:in `block in fork_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:273:in `fork'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:273:in `fork_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:238:in `block in run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/local_mode.rb:44:in `with_server_connectivity'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:226:in `run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:456:in `sleep_then_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:443:in `block in interval_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:442:in `loop'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:442:in `interval_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:426:in `run_application'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:58:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/solo.rb:216:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/bin/chef-solo:25:in `<top (required)>'
==> default: /usr/bin/chef-solo:52:in `load'
==> default: /usr/bin/chef-solo:52:in `<main>'
==> default: [2016-05-20T00:27:27+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/vagrant-ebebf4d0
==> default: [2016-05-20T00:27:27+00:00] INFO: POST /organizations/chef/nodes
==> default: --- POST BODY ---
==> default: {"name":"vagrant-ebebf4d0","chef_environment":"_default","json_class":"Chef::Node","automatic":{},"normal":{},"chef_type":"node","default":{},"override":{},"run_list":[]}
==> default: --- END POST BODY ---
==> default: [2016-05-20T00:27:27+00:00] INFO: #<ChefZero::RestErrorResponse: 404: Parent not found: chefzero://localhost:8889/nodes>
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:187:in `rescue in create_data'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:181:in `create_data'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/endpoints/rest_list_endpoint.rb:31:in `post'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/endpoints/nodes_endpoint.rb:24:in `post'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_base.rb:62:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/rest_router.rb:24:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:664:in `block in app'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:336:in `call'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/server.rb:336:in `handle_socketless_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/socketless_server_map.rb:87:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/socketless_server_map.rb:33:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http/socketless_chef_zero_client.rb:154:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:305:in `block in send_http_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:336:in `block in retrying_http_errors'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:334:in `loop'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:334:in `retrying_http_errors'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:299:in `send_http_request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:144:in `request'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/http.rb:127:in `post'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/node.rb:639:in `create'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/node.rb:592:in `rescue in find_or_create'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/node.rb:588:in `find_or_create'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/policy_builder/dynamic.rb:72:in `load_node'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/client.rb:465:in `load_node'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/client.rb:267:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:285:in `block in fork_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:273:in `fork'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:273:in `fork_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:238:in `block in run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/local_mode.rb:44:in `with_server_connectivity'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:226:in `run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:456:in `sleep_then_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:443:in `block in interval_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:442:in `loop'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:442:in `interval_run_chef_client'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/client.rb:426:in `run_application'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application.rb:58:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/lib/chef/application/solo.rb:216:in `run'
==> default: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.1/bin/chef-solo:25:in `<top (required)>'
==> default: /usr/bin/chef-solo:52:in `load'
==> default: /usr/bin/chef-solo:52:in `<main>'
==> default: [2016-05-20T00:27:27+00:00] INFO: HTTP Request Returned 404 Not Found: Parent not found: chefzero://localhost:8889/nodes
==> default: ================================================================================
==> default: Chef encountered an error attempting to load the node data for "vagrant-ebebf4d0"
==> default: ================================================================================
==> default: Resource Not Found:
==> default: -------------------
==> default: The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect.
==> default: Relevant Config Settings:
==> default: -------------------------
==> default: chef_server_url "chefzero://localhost:8889"
==> default: Platform:
==> default: ---------
==> default: x86_64-linux
==> default: Running handlers:
==> default: [2016-05-20T00:27:27+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2016-05-20T00:27:27+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 0 resources updated in 02 seconds
==> default: [2016-05-20T00:27:27+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2016-05-20T00:27:27+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> default: [2016-05-20T00:27:27+00:00] ERROR: 404 "Not Found"
==> default: [2016-05-20T00:27:29+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
</code></pre>
| <vagrant><chef-solo> | 2016-05-20 01:18:33 | HQ |
37,337,289 | React.js: Set innerHTML vs dangerouslySetInnerHTML | <p>Is there any "behind the scenes" difference from setting an element's innerHTML vs setting the dangerouslySetInnerHTML property on an element? Assume I'm properly sanitizing things for the sake of simplicity.</p>
<p>Example:</p>
<pre><code>var test = React.createClass({
render: function(){
return (
<div contentEditable='true' dangerouslySetInnerHTML={{ __html: "Hello" }}></div>
);
}
});
</code></pre>
<p>vs</p>
<pre><code>var test = React.createClass({
componentDidUpdate: function(prevProp, prevState){
this.refs.test.innerHTML = "Hello";
},
render: function(){
return (
<div contentEditable='true' ref='test'></div>
);
}
});
</code></pre>
<p>I'm doing something a bit more complicated than the above example, but the overall idea is the same</p>
| <javascript><html><reactjs> | 2016-05-20 03:04:01 | HQ |
37,338,047 | Bulk saving complex objects SQLAlchemy | <pre><code>association_table = Table("association_table",
Base.metadata,
Column("show_id", Integer(), ForeignKey("show_times.id"), primary_key=True),
Column("theater_id", Integer(), ForeignKey("theaters.id")))
association_table2 = Table("association_table2",
Base.metadata,
Column("show_id", Integer(), ForeignKey("show_times.id"), primary_key=True),
Column("movie_id", Integer(), ForeignKey("movies.id")))
class Movie(Base):
__tablename__ = "movies"
id = Column(Integer, primary_key=True)
title = Column(String(), unique=True)
plot = Column(String())
duration = Column(String())
rating = Column(String())
trailer = Column(String())
imdb = Column(String())
poster = Column(String())
summary = Column(String())
class Theater(Base):
__tablename__ = "theaters"
id = Column(Integer, primary_key=True)
zip_code = Column(String())
city = Column(String())
state = Column(String())
address = Column(String())
phone_number = Column(String())
class Showtime(Base):
__tablename__ = "show_times"
id = Column(Integer, primary_key=True)
date = Column(Date())
theaterz = relationship("Theater", secondary=association_table)
moviez = relationship("Movie", secondary=association_table2)
showtimes = Column(String())
</code></pre>
<p>supposing we have movie objects:</p>
<pre><code>movie_1 = Movie(title="Cap Murica",
plot="Cap punches his way to freedom",
duration="2 hours")
movie_2 = Movie(title="Cap Murica 22222",
plot="Cap punches his way to freedom again",
duration="2 hours")
</code></pre>
<p>and a theater object:</p>
<pre><code>theater = Theater(name="Regal Cinemas",
zip_code="00000",
city="Houston",
state="TX")
</code></pre>
<p>how do we bulk save this into the <code>show_times</code> Model?</p>
<p>I've tried doing this:</p>
<pre><code>movies = [movie_1, movie_2] # these movie objects are from the code snippet above
show_times = Showtime(date="5/19/2016",
theaterz=[theater],
moviez=movies)
session.add(show_times)
session.commit()
</code></pre>
<p>hurray the above works. but when i do it in bulk like this:</p>
<pre><code>showtime_lists = [show_time1, show_time2, showtime3] # these are basically just the same show time objects as above
session.bulk_save_objects(showtime_lists)
session.commit()
</code></pre>
<p>it doesn't fail but the data also doesn't get persisted to the database.</p>
<p>I mean is there an alternative to adding each <code>show_time</code> to the session individually? A bulk insert would be better but I don't get why the data doesn't get persisted if done that way.</p>
| <python><sqlalchemy><flask-sqlalchemy> | 2016-05-20 04:39:17 | HQ |
37,338,560 | What's the difference between firebase cloud messaging & firebase notifications? | <p>in the new Firebase 3.0, i am trying to get my head around when to use Firebase Cloud messaging and when to use Firebase Notifications. </p>
| <web-applications><push-notification><firebase><google-cloud-messaging> | 2016-05-20 05:29:20 | HQ |
37,339,066 | FileUpload1.SaveAs(Server .MapPath ("resume\\"+FileUpload1.FileName + " ")); StatusLabel.Text = "Upload status: File uploaded!"; | FileUpload1.SaveAs(Server .MapPath ("resume\\"+FileUpload1.FileName + " "));
StatusLabel.Text = "Upload status: File uploaded; | <file-upload><c#-3.0> | 2016-05-20 06:06:39 | LQ_EDIT |
37,339,210 | Unable to locate element error in sele | <a class="pointer" ng-click="openLogin()">Log In</a>
now to find Log In I written the code :
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Log In")));
WebElement logIN = driver.findElement(By.linkText("Log In"));
logIN.click();
according to me the code that I have written is correct but still I m getting error like :
no such element: Unable to locate element: {"method":"link text","selector":"Log In"}
(Session info: chrome=48.0.2564.116)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stack | <java><selenium><selenium-webdriver> | 2016-05-20 06:15:51 | LQ_EDIT |
37,341,163 | (Very simple) JavaScript error | <p>I have this JS code, the commented line of which prevents a JSON to work correctly (when I comment the line, it works; when I uncomment it, it stops working):</p>
<pre><code>function GenSpecieChg()
{
var selText = document.getElementById("textGenSpecie");
var sca = selText.value;
//if (sca <> "" && sca.indexOf("%") == -1) selText.value += "%";
localStorage.setItem("34_Delta", selText.value);
alert("GenSpecie changed !");
}
</code></pre>
<p>What is my error ?</p>
| <javascript> | 2016-05-20 08:00:17 | LQ_CLOSE |
37,341,250 | How to use search(in google map) between 2 activities using intent(or something) | <p>i want a make application </p>
<ol>
<li>MainActivity( EditText )
<ul>
<li>put address</li>
</ul></li>
<li>SearchActivity( google map )
<ul>
<li>searching and movecamera using address from MainActivity</li>
</ul></li>
</ol>
<p>like this.</p>
<p>but i can't find any way....</p>
| <android><google-maps> | 2016-05-20 08:05:01 | LQ_CLOSE |
37,341,289 | Remove part of an email with postgresql | I have emails like sales@joebloggs.com
I am looking to select out everything after the @ and before the .
Result should = joebloggs
| <sql><postgresql> | 2016-05-20 08:07:13 | LQ_EDIT |
37,341,304 | Pass NTLM with Postman | <p>Is there a way to pass <code>Windows Authentication</code> with <code>postman</code>?</p>
<p>I have added this in header but still <code>401 Unauthorized</code>.</p>
<pre><code>Authorization: NTLM TkFcYWRtaW46dGVzdA==
</code></pre>
<p>As suggested by <a href="http://www.innovation.ch/personal/ronald/ntlm.html" rel="noreferrer">this</a> link. I've encrypted as <code>Unicode (UTF-16, little-endian)</code> but of no use.</p>
<p>Any Ideas?</p>
| <postman> | 2016-05-20 08:08:05 | HQ |
37,341,574 | Cocoapods 1.0: "xcodeproj was renamed to `project`. Please use that from now on." | <p>I do get the warning <code>xcodeproj was renamed to</code>project<code>. Please use that from now on.</code> when running <code>pod install</code> with Cocoapods 1.0.</p>
<p>Also, <code>[NSBundle bundleWithIdentifier:@"org.cocoapods.xyz"]</code> returns <code>nil</code>.</p>
<p>With version 0.39.0 I don't get the warning and <code>[NSBundle bundleWithIdentifier:@"org.cocoapods.xyz"]</code> returns a valid bundle.</p>
<p>Does anyone know a solution for this?</p>
| <cocoapods> | 2016-05-20 08:21:55 | HQ |
37,342,008 | Program not noticing when the string is equal to a specific string | <p>I've been trying to create a program that censors a word but I was having difficulty with that so I tried going back to some of the fundamental code and testing it and I am coming across an odd result.</p>
<pre><code>import java.util.Scanner;
public class TextCensor
{
public static void main(String[] args)
{
String input;
Scanner keyboard = new Scanner(System.in);
input = keyboard.nextLine();
int length = input.length() - 1;
if (length + 1 >= 3)
{
for (int i=0; i<(length - 1); i=i+1 )
{
char first = input.charAt(i);
char second = input.charAt(i+1);
char third = input.charAt(i+2);
String censorCheck = "" + first + second + third;
if (censorCheck == "tag")
{
System.out.println("success");
}
else
{
System.out.println(censorCheck);
}
}
}
else
{
System.out.println(input);
}
}
}
</code></pre>
<p>If I input the string "adtag" I will obtain the following output:</p>
<pre><code>adt
dta
tag
</code></pre>
<p>yet "success" will never be printed despite the fact that I have printed a censorCheck that is equal to "tag".</p>
| <java> | 2016-05-20 08:42:09 | LQ_CLOSE |
37,342,549 | Code help to Play Multiple Sounds (objective c) to swift(x-code 7) | Hi programmers i am new to programming language! Trying to convert the below code (objective c ) to swift plz help me by doing so or help me with a new code to play MULTIPLE SOUNDS ***
-(IBAction)pushButton {
NSString *path = [[NSBundle mainBundle] pathForResouce:@"ring" ofType:@"mp3"];
if(theAudio) [theAudio release];
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
-(IBAction)pushButton1 {
NSString *path = [[NSBundle mainBundle] pathForResouce:@"amaze" ofType:@"mp3"];
if(theAudio) [theAudio release];
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
| <swift><function><xcode7><avaudioplayer> | 2016-05-20 09:07:44 | LQ_EDIT |
37,342,955 | Find a KeyValuePair inside a List | <p>Suppose I have</p>
<pre><code> List<KeyValuePair<int, string>> d
</code></pre>
<p>I know the string but I want to find its integer.
How do I find the keyvaluepair inside this List?</p>
| <c#><list> | 2016-05-20 09:26:47 | HQ |
37,343,003 | INSERT INTO query not working? | <p>HTML code:</p>
<pre><code><form action="create.php" method="post">
Username: <input type="text" name="username"><br>
Password: <input type="text" name="password"><br>
<input type="submit" value="CREATE ACCOUNT">
</form>
</code></pre>
<p>PHP code (create.php):</p>
<pre><code><?php
require_once 'studentdb.php';
$db_server = mysql_connect($host,$username,$password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db($dbname)
or die("Unable to select database: " . mysql_error());
$query = "INSERT INTO credentials (Username,Password) VALUES(".$_POST['username'].",".$_POST['password'].")"
$make = mysql_query($db_server,$query);
?>
</code></pre>
<p>In the PHP here, studentdb.php has all the necessary information to log into the database. </p>
<p>I don't get any errors, but the table just isn't updating at all. </p>
| <php><mysql> | 2016-05-20 09:28:47 | LQ_CLOSE |
37,343,176 | How to get the key and value of ArrayList in c#? | <p>I have a array list which contain the objects with key value pair,but unable to get the key and value,here how the debugger look like:</p>
<p><a href="https://i.stack.imgur.com/b9pSv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b9pSv.png" alt="enter image description here"></a></p>
| <c#><asp.net> | 2016-05-20 09:36:55 | LQ_CLOSE |
37,344,338 | How do I transfer file data into Vector? | I splited the file to String lines and put them in array indexes.
String fileString = readfromfile(fileEvents);
String[] fileLines = fileString.split("\n");
assuming this is the first index in fileLines:
14 57 9 2 www.buytickets.com
this is the constructor:
Orders (int EventID, int SoldtoCustomerID, int SoldtoEmployeesID, int NumberOfTickets, String URL)
the vector instance:
Vector<Orders> myOrders = new Vector<Orders>();
how do I transfer this line to first index in the vecotr so it would be like this:
(14,57,9,2,www.buytickets.com)
thank you :)
| <java><eclipse><vector><split><readfile> | 2016-05-20 10:29:55 | LQ_EDIT |
37,344,801 | Spring @Scheduler parallel running | <p>I have the following 3 classes:</p>
<p><em>ComponantA</em></p>
<pre><code>package mytest.spring.test.spring;
import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ComponentA {
Logger log = Logger.getLogger(ComponentB.class);
@Scheduled(fixedRate=2000)
public void sayHello() {
for(int i=1 ; i<=5 ; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
log.info("Hello from ComponentA " + i);
}
}
}
</code></pre>
<p><em>ComponentB</em></p>
<pre><code>package mytest.spring.test.spring;
import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ComponentB {
Logger log = Logger.getLogger(ComponentB.class);
@Scheduled(fixedRate=2000)
public void sayHello() {
for(int i=1 ; i<=3 ; i++) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
log.info("Hello from ComponentB " + i);
}
}
}
</code></pre>
<p><em>MyApplication</em></p>
<pre><code>package mytest.spring.test.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
</code></pre>
<p>When I execute it, I'm getting the following output:</p>
<pre><code>Hello from ComponentA 1
Hello from ComponentA 2
Hello from ComponentA 3
Hello from ComponentA 4
Hello from ComponentA 5
Hello from ComponentB 1
Hello from ComponentB 2
Hello from ComponentB 3
Hello from ComponentA 1
Hello from ComponentA 2
Hello from ComponentA 3
Hello from ComponentA 4
Hello from ComponentA 5
Hello from ComponentB 1
Hello from ComponentB 2
Hello from ComponentB 3
...
</code></pre>
<p>I need the 2 Scheduled methods to run in parallel, which is clearly not the cae according to the output I'm getting. I read that it should be possible to provide the @Schedule annotation with a custom TaskExecutor, with which it should be possible to define how many thread we want ...</p>
<p>Am I right ? I can't find how to provide this information.</p>
| <java><spring><spring-boot><schedule> | 2016-05-20 10:51:53 | HQ |
37,344,890 | Converting a string into date format | <p>I'm adding an event, the event displays starting hour (hh:mm) and ending hour (hh:mm), there are 2 tiemPickers, one to pick starting time and one for duration.</p>
<p><strong>Problem 1:</strong> </p>
<p>If the user picks the starting time to be at 10:30h and duration of 1:40h, the ending time should be 12:10h instead of 11:70h, how do I do this?</p>
<p><strong>Problem 2:</strong></p>
<p>If the user picks starting time of 23:00h and duration of 02:00h, ending time should be 01:00h instead of 25:00h.</p>
<p><strong>What I have:</strong></p>
<pre><code>// getting the selected time
int endingHourInt = prefs.getInt("mDurationHour", 0) + prefs.getInt("mStartingHour",0);
int endingMinInt = prefs.getInt("mDurationMin", 0) + prefs.getInt("mStartingMin",0);
// displaying the text
endingTime.setText(endingHourInt + ":" + endingMinInt );
</code></pre>
| <java><android> | 2016-05-20 10:56:21 | LQ_CLOSE |
37,344,984 | JavaFX: Could not find or load main class only on linux | <p>I've developed a program in Windows with Java(FX) using Intellij Idea and that worked just fine, I then exported the artifact (jar) and there was no problem running it on Windows (both with the console and double clicking it).</p>
<p>I've then copied it to my Ubuntu VM, but there it says</p>
<pre><code>Error: Could not find or load main class sample.Main
</code></pre>
<p>This is the Manifest:</p>
<pre><code>Manifest-Version: 1.0
Main-Class: sample.Main
</code></pre>
<p>The JAR file structure looks like this:</p>
<pre><code>test.jar
--- META-INF
--- --- MANIFEST.MF
--- org
--- --- json
--- --- --- // json library
--- sample
--- --- Contacts.class
--- --- Controller.class
--- --- Main.class
--- --- sample.fxml
</code></pre>
| <java><linux><ubuntu><intellij-idea><javafx> | 2016-05-20 11:00:24 | HQ |
37,345,592 | {"Unable to cast object of type 'OneStar' to type 'System.Collections.IEnumerator'."} | hotel_pricesURL = string_builder.ToString();
RootobjectOne robjectOne = JsonConvert.DeserializeObject<RootobjectOne>(hotel_pricesURL);
List<OneStar> one_star_list = new List<OneStar>();
var check = robjectOne.onestar;
foreach(var items in check)
{
}
Hi ! I am getting an Error Stating {"Unable to cast object of type 'OneStar' to type 'System.Collections.IEnumerator'."} , could any one please guide to solve the conflict, i do really appreciate
| <c#><json> | 2016-05-20 11:31:18 | LQ_EDIT |
37,346,363 | java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] | <p>I have been getting this issue.. followed the upgrade guide for new firebase sdk...saved the google services json file in app directory.. still the same error as you but for the database...</p>
<pre><code>Caused by: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
</code></pre>
| <android><firebase><google-play-services> | 2016-05-20 12:07:54 | HQ |
37,346,390 | How creat a table in JS java script | :)
I'm trying create one simple thing, so let me try explain, where say "table here" is supposed appear one table with 4 columns and 6 lines of course, with content inside of cells.
Unfortunately I don't know how make this in java script.
code that I already have below:
_______________________________
<form name="part">
<p align="center">
</p>
<p align="center">
<font face="Verdana" size="2">Please insert the part ID in the field
below:</font></p>
<p align="center">
<font face="Verdana" size="2">Part ID</font><font face="Verdana"><font size="2"> </font><input type="text" name="userid" size="19"/></font></p>
<p align="center"><font face="Verdana"><font size="2">
<p align="center">
<input type="button" onclick="check(this.form)" value="Check now" style="font-family: Verdana"/><font face="Verdana" size="2">
</font>
<input type="reset" value="Cancel" style="font-family: Verdana"/></p>
</form>
<font face="Verdana" size="2">
<script language="javascript">
function check(form) {
if(form.userid.value == "1"){
document.write("table here");
}
else if(form.userid.value == "2"){
document.write("table 2 here");
}
else {
alert("The Part does not esxist\nor does not have compatibility") }
}
</script>
</font>
________________________________
I hope that you can help me! :)
| <javascript><document.write> | 2016-05-20 12:09:17 | LQ_EDIT |
37,347,291 | Execution failed for task ':app:packageDebug' - Failed to read zip file | <p>Without any changes in my code, suddenly i get this error when I try to run my app:</p>
<blockquote>
<ul>
<li>What went wrong:
Execution failed for task ':app:packageDebug'.
com.android.builder.packaging.PackagerException: java.io.IOException: Failed to read zip file 'C:\Users\Eliran\AndroidStudioProjects\Forum\app\build\outputs\apk\app-debug.apk'.</li>
</ul>
</blockquote>
<p>I have no idea why its trying to read the apk as zip file.</p>
<ul>
<li><strong>If I restart Android Studio, I can run the app once and then It happens again.</strong></li>
</ul>
| <android><android-studio><android-gradle-plugin><build.gradle> | 2016-05-20 12:53:31 | HQ |
37,347,327 | Upgraded Firebase - Now Getting Swift Compile Error | <p>I upgraded Firebase yesterday and now am having a very unusual problem. When I run the simulator, I get a swift compile error "Segmentation fault: 11" The are hundreds of lines of code describing the error, but they are absolutely no help. From the error, the only thing I see that might be giving clues is at the bottom. It says:</p>
<pre><code> 1. While loading members for 'ProfileTableViewController' at <invalid loc>
2. While deserializing decl #101 (PATTERN_BINDING_DECL)
3. While deserializing decl #2 (VAR_DECL)
</code></pre>
<p>Oddly, the errors I just typed above are not consistent. The view controller mentioned rotates between the three view controllers where I am using Firebase.</p>
<p>To try to solve the problem, I commented out all of the code in the ProfileTableViewController class, but I still got an error referencing that view controller. The only code running in the view controller was:</p>
<pre><code> import UIKit
import Firebase
import FirebaseDatabase
</code></pre>
<p>(I'm also using FirebaseAuth in other view controllers).</p>
<p>What does work to fix the problem is to hit "clean", restart xcode, clean again on launch and then run the program. Everything will work fine unless I make any changes to the code in the program. Even if all I do is add a comment, the error will reappear.</p>
<p>I don't want to have to close xcode and restart every time I write a couple lines of code, and I am worried that I will run into problems when uploading to the app store. </p>
<p>I am using XCode 7.3.1 and my deployment target is 9.3</p>
<p>Any insight you can give is greatly appreciated! Thank you!</p>
| <ios><xcode><swift><firebase> | 2016-05-20 12:55:20 | HQ |
37,347,415 | Laravel: Access Model instance in Form Request when using Route/Model binding | <p>I have some route/model binding set up in my project for one of my models, and that works just fine. I'm able to use my binding in my route path and accept an instance of my model as a parameter to the relevant method in my controller.</p>
<p>Now I'm trying to do some work with this model, so I have created a method in my controller that accepts a Form Request so I can carry out some validation.</p>
<pre><code>public function edit(EditBrandRequest $request, Brand $brand)
{
// ...
</code></pre>
<p>Each different instance of my model can be validated differently, so I need to be able to use an instance of the model in order to build a custom set of validation rules.</p>
<p><strong>Is there a way of getting the instance of the model, that is injected into the controller from the Form Request?</strong></p>
<p>I have tried type-hinting the model instance in the Form Request's constructor</p>
<pre><code>class EditBrandRequest extends Request
{
public function __construct(Brand $brand)
{
dd($brand);
}
</code></pre>
<p>I have also tried type-hinting the model instance in the Form Request's <code>rules()</code> method.</p>
<pre><code>class EditBrandRequest extends Request
{
// ...
public function rules(Brand $brand)
{
dd($brand);
</code></pre>
<p>In both instances I am provided an empty/new instance of the model, rather than the instance I am expecting.</p>
<p>Of course, I could always get around this by not bothering with Form Requests and just generate the rules in the controller and validate manually - but I would rather do it the <em>Laravel way</em> if it's possible.</p>
<p>Thanks</p>
| <php><laravel><laravel-5> | 2016-05-20 12:58:59 | HQ |
37,347,439 | main function in c with arguments that are defined as definitions | i am currently trying to get arguments from the command line to my main function in c. my program is as follows.
#include <stdio.h>
#include <stdlib.h>
#define BANK1 (0X00100)
#define BANK2 (0x11010)
.
.
#define BANKN (0xNNNNN)
int write_to_bank(int bank, int value);
int main(int argc, char **argv)
{
int a,v;
a=strtol(argv[2],NULL,0);
v=strtol(argv[3],NULL,0);
write_to_bank(a,v);
}
int write_to_bank(int bank, int value){
// some relevant code
}
if i pass the arguments as follows the integers are correctly parsed to the function
./main 0x00100 0x20
but when i try to pass the arguments to my main function in the following way i am not actually parsing the right bank value
./main BANK1 0x30
Is there any way i could pass the definition as an argument to my main functuion where c automatically translates the definition to the corresponding value and parses to the function argument.
-A.R | <c> | 2016-05-20 13:00:47 | LQ_EDIT |
37,347,708 | Remove an item from a list by shifting all other elements | <p>I want to remove a value from a list to a randomly selected id and shift all element content according to the list is shorter than 1 .</p>
| <php> | 2016-05-20 13:15:35 | LQ_CLOSE |
37,347,991 | How much time does it take for firebase analytics first report? | <p>We wanted to try out the new analytics capabilities provided by firebase, and followed all the steps in the getting started guide. </p>
<p>We 've run the app, logged a lot of events and its been a few hours; yet there is no data on the dashboard - We just see a banner saying "Your analytics data will appear here soon" </p>
<p>How much time does it take to get our first reports, events, etc.? </p>
| <firebase><firebase-analytics> | 2016-05-20 13:29:07 | HQ |
37,348,125 | Cisco VPN client on Ubuntu 16.04 LTS | <p>I am trying to install Cisco VPN Client on Ubuntu, but I am facing problems.
So How can I install it on Ubuntu 16.04 LTS ?</p>
| <vpn><cisco><ubuntu-16.04> | 2016-05-20 13:34:41 | HQ |
37,348,563 | Difference between interpolation and property binding | <p>I have a component which defines an <code>imageUrl</code> property and in my template I use this property to set the url of an image.
I tried this using interpolation and using property binding, both work, but I cannot find any differences between the two, or when to use the one over the other. Does anyone know the difference?</p>
<pre><code><img [src]='imageUrl' >
<img src= {{ imageUrl }} >
</code></pre>
| <javascript><angular><property-binding> | 2016-05-20 13:55:40 | HQ |
37,348,809 | Stop the page jumping to top when reload | <p>I am designing a website with a sticky menubar. I am trying to make the page stick to the content area when realoaded or when clicked somewhere on the menu bar and it keeps jumping to the top. </p>
| <javascript> | 2016-05-20 14:05:45 | LQ_CLOSE |
37,349,314 | Is it possible to add border to image in GitHub markdown? | <p>I need to add border to the image in GitHub README.md file. This is how image should be embeded:</p>
<pre><code>
</code></pre>
<p>I have tried to wrap image with the table:</p>
<pre><code>|--------------------------------|
||
</code></pre>
<p>but it is not possible to create table without header.</p>
<p>I have also tried to include image as html tag:</p>
<pre><code><img src="/images/logo.png" style="border: 1px solid black" />
</code></pre>
<p>but without success. Is there any way how to do this?</p>
| <html><github><markdown> | 2016-05-20 14:26:15 | HQ |
37,349,470 | Codeigniter Controller return to previous page | <p>I'd like to ask you how can I instead of $this->load->view('some_view.php') at the end of controller code, return user to page from where he invoked controller method? Simple return statement is not working. </p>
<p>ie.</p>
<pre><code>public function someMethod($IDCustomer) {
$this->Some_modal->persist($IDCustomer);
// how to return to previous page instead of line after?
// i've used $this->load->view('someView.php');
}
</code></pre>
| <php><codeigniter> | 2016-05-20 14:33:53 | HQ |
37,349,567 | Serve different css based on browser width in css | <p>I am unable to find this on Stackoverflow existing queries. Please help if this can be accomplished.
I want to capture browser with with mobile-first responsive design approach.
Depending upon the browser width, I want to include div's:</p>
<p>1) If browser max-width is 320px, then use ""<code><div class="fb-comments" data-href="https://developers.facebook.com/docs/plugins/comments#configurator" data-width="***320***" data-numposts="5"></div><br>Floating box</div></code></p>
<p>2) If browser width is 480px or above, then use
"<code><div class="fb-comments" data-href="https://developers.facebook.com/docs/plugins/comments#configurator" data-width="**480**" data-numposts="5"></div><br>Floating box</div></code>"</p>
<p>I am aware of using media-queries in CSS (like:</p>
<pre><code>@media (min-width: 300px) {
html { background: blue; }
}
</code></pre>
<p>but how do I use these for div's with changing values of width in div parameters (320 and 480)?</p>
<p>Any help would be greatly appreciated.</p>
<p>Thanks</p>
| <html><css> | 2016-05-20 14:38:34 | LQ_CLOSE |
37,350,131 | What is the default variable initializer in Tensorflow? | <p>What is the default method of variable initialization used when <code>tf.get_variable()</code> is called without any specification for the initializer? The Docs just says 'None'.</p>
| <python><machine-learning><tensorflow><deep-learning> | 2016-05-20 15:04:08 | HQ |
37,350,183 | Keep getting "tsc.exe" exited with code 1 | <p>As soon as I add a tsconfig.json file to my Visual Studio 2015 web solution I get the above error. </p>
<p>Also this stops the compiler from re-generating js files even when I set "compileOnSave": true.</p>
<p>When I double click the error it takes me into the Microsoft.Typescript.Targets file which contains a lot of issues such as Unknown Item Group "TypeScriptCompile". In the error list these appear as warnings but they are there whether I have a tsconfig.json file or not.</p>
<p>Is there any way of solving it or getting more information on what the problem is?</p>
| <javascript><typescript><visual-studio-2015> | 2016-05-20 15:20:03 | HQ |
37,350,268 | Send FCM messages from server side to android device | <p>With the new update, FCM is now going to be used.</p>
<p>I tried the sample app from git and it's working all fine. I can send notifications from the console.</p>
<p>But I want to send the notification from the server after a certain event is triggered. I followed the same approach like in GCM but it's not working.</p>
<pre><code>05-20 20:40:58.941 30132-30919/com.google.firebase.quickstart.fcm E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
Process: com.google.firebase.quickstart.fcm, PID: 30132
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.messaging.RemoteMessage$Notification.getBody()' on a null object reference
at com.google.firebase.quickstart.fcm.MyFirebaseMessagingService.onMessageReceived(MyFirebaseMessagingService.java:53)
at com.google.firebase.messaging.FirebaseMessagingService.zzo(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
05-20 20:40:59.118 30132-30279/com.google.firebase.quickstart.fcm E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb9e83390
</code></pre>
<p>Am following this <a href="https://gist.github.com/prime31/5675017" rel="noreferrer">PHP Script</a> to send the notification.
If I try to execute the script, I get the following result.</p>
<pre><code>{"multicast_id":4679427854122301046,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1463757518309261%31bd1c96f9fd7ecd"}]}
</code></pre>
<p>NOTE : I went through their <a href="https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref#notification-payload-support" rel="noreferrer">docs</a> and modified the code is gist to have only body and title. Even then it's not working. </p>
| <php><android><google-cloud-messaging><firebase-cloud-messaging> | 2016-05-20 15:23:55 | HQ |
37,350,790 | How is C# string interpolation compiled? | <p>I know that interpolation is syntactic sugar for <code>string.Format()</code>, but does it have any special behavior/recognition of when it is being used with a string formatting method?</p>
<p>If I have a method:</p>
<pre><code>void Print(string format, params object[] parameters)
</code></pre>
<p>And the following call to it using interpolation:</p>
<pre><code>Print($"{foo} {bar}");
</code></pre>
<p>Which of the following calls lines is most equivalent to the compiled result of string interpolation?</p>
<pre><code>Print(string.Format("{0} {1}", new[] { foo, bar }));
Print("{0} {1}", new[] { foo, bar });
</code></pre>
<p>Reasoning behind the question: Logging frameworks such as NLog typically defer string formatting until they have determined that a log message will actually be written. In general I prefer the string interpolation syntax, but I need to know if it may incur an extra performance penalty.</p>
| <c#><string-formatting><roslyn><c#-6.0> | 2016-05-20 15:50:36 | HQ |
37,351,236 | Vectorize a function in clang | <p>I am trying to vectorize the following function with clang according to this <a href="http://llvm.org/docs/Vectorizers.html">clang reference</a>. It takes a vector of byte array and applies a mask according to <a href="https://tools.ietf.org/html/rfc6455#section-5.3">this RFC</a>.</p>
<pre><code>static void apply_mask(vector<uint8_t> &payload, uint8_t (&masking_key)[4]) {
#pragma clang loop vectorize(enable) interleave(enable)
for (size_t i = 0; i < payload.size(); i++) {
payload[i] = payload[i] ^ masking_key[i % 4];
}
}
</code></pre>
<p>The following flags are passed to clang:</p>
<pre><code>-O3
-Rpass=loop-vectorize
-Rpass-analysis=loop-vectorize
</code></pre>
<p>However, the vectorization fails with the following error:</p>
<pre><code>WebSocket.cpp:5:
WebSocket.h:14:
In file included from boost/asio/io_service.hpp:767:
In file included from boost/asio/impl/io_service.hpp:19:
In file included from boost/asio/detail/service_registry.hpp:143:
In file included from boost/asio/detail/impl/service_registry.ipp:19:
c++/v1/vector:1498:18: remark: loop not vectorized: could not determine number
of loop iterations [-Rpass-analysis]
return this->__begin_[__n];
^
c++/v1/vector:1498:18: error: loop not vectorized: failed explicitly specified
loop vectorization [-Werror,-Wpass-failed]
</code></pre>
<p><strong>How do I vectorize this for loop?</strong></p>
| <c++><vector><simd><clang++> | 2016-05-20 16:11:59 | HQ |
37,351,504 | Kubernetes - Why does selector field fail to validate for Deployment? | <p>Using Kubernetes 1.2.4, why does my below <a href="http://kubernetes.io/docs/user-guide/deployments/" rel="noreferrer">Deployment</a> definition (redis.yaml) cause the following error?</p>
<pre><code>$ kubectl apply -f redis.yaml
error validating "redis.yaml": error validating data: found invalid field name for v1beta1.LabelSelector; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p><strong>redis.yaml:</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
spec:
replicas: 3
selector:
name: redis
template:
metadata:
labels:
name: redis
spec:
containers:
- name: redis
image: kubernetes/redis:v1
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
volumes:
- name: data
emptyDir: {}
</code></pre>
| <kubernetes> | 2016-05-20 16:27:22 | HQ |
37,351,709 | Git: pull vs. fetch→pull | <p>I've never been able to get a clear answer to this question.</p>
<p>For a long time, and at the advisement of a coworker, I've been doing this:</p>
<pre><code>git fetch origin
git pull origin <mybranch>
</code></pre>
<p>I've been told (and have seen) that <code>git pull</code> does not behave the same way if you do not first do <code>git fetch</code>. You don't get any remote changes.</p>
<p>But all I see online is that <code>git pull</code> is the equivalent of <code>git fetch</code> followed by <code>git merge</code>. If that were true, <code>git pull</code> would include <code>git fetch</code>, and I wouldn't need an explicit <code>git fetch</code> first, right? But that doesn't seem to be the case.</p>
<p>So what I'm looking for is some explicit documentation that describes the observed behavior of <code>git pull</code>. (I know I'll probably also get lots of advice to switch to <code>git fetch</code> → <code>git merge</code>; that's fine too, but I'm really interested in <code>git pull</code>.)</p>
| <git> | 2016-05-20 16:37:48 | HQ |
37,352,454 | Node js app.configure is not a function | <p>Can anyone tell what is wrong within this code .I have installed all necessary modules .When i run this script then it tells app.configure is not a function . If i am missing any thing , please suggest me .</p>
<pre><code>var express = require('express')
, app = express()
, server = require('http').createServer(app)
, io = require("socket.io").listen(server)
, npid = require("npid")
, uuid = require('node-uuid')
, Room = require('./room.js')
, _ = require('underscore')._;
app.configure(function() {
app.set('port', process.env.OPENSHIFT_NODEJS_PORT || 3000);
app.set('ipaddr', process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1");
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
app.use('/components', express.static(__dirname + '/components'));
app.use('/js', express.static(__dirname + '/js'));
app.use('/icons', express.static(__dirname + '/icons'));
app.set('views', __dirname + '/views');
app.engine('html', require('ejs').renderFile);
/* Store process-id (as priviledged user) */
try {
npid.create('/var/run/advanced-chat.pid', true);
} catch (err) {
console.log(err);
//process.exit(1);
}
});
</code></pre>
| <node.js> | 2016-05-20 17:24:28 | HQ |
37,352,902 | Python modifying a dictionary with a function call | <p>Here is my code. I am trying to construct a list of names to create a bunch of defaultdicts. Then I want to modify these default dicts by calling a function.
Having problems as you can see in the comments.</p>
<pre><code>#!/usr/bin/python
from collections import defaultdict
class Stats(object):
def __init__(self, name, namedict):
self.name = name
self.namedict = namedict
def update_stats(self, playerdict):
self.playerdict = playerdict
playerdict['HR'] += 1
return(playerdict)
l = ['a', 'b', 'c']
for x in l:
d = x + 'dict' # trying to make a list of dict names
print "Name is",d # it is a string so far
d = defaultdict(int) # now it is a dict but what is its name?
print d # i have a structure here but don't know its name
stats = Stats('stats',d)
# next test code block does not work
#for k,v in adict.iteritems(): # adict not defined!
# print k,v
# next code block does not work either
for y in l:
dictname = y + 'dict'
dictname = stats.update_stats(**dictname)
# it thinks dictname is a String
# in general what is the right way to pass in a dictionary
# and get it back in a modified state?
</code></pre>
| <python><dictionary> | 2016-05-20 17:50:05 | LQ_CLOSE |
37,353,314 | VS 2015 C#-based solution with Linker failure | <p>I'm porting an existing VS 2013-based solution to VS 2015 Update 1 and I am receiving an error code:</p>
<p>The following is a post-build command that triggers the error:</p>
<pre><code>"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\al.exe" /out:"C:\p4\MMM-2015\blah\tm1\Assemblies\USSAdmin.resources.dll" /culture:en /embed:"C:\p4\MMM-2015\blah\tm1\blah\USSAdmin\USSAdmin.resources" /t:lib
</code></pre>
<p>I'm getting an error: exited with code -1073741819 with some Linker error dialogs also.</p>
<p>The above command works fine in a command-prompt.</p>
| <c#><visual-studio-2015><linker-errors> | 2016-05-20 18:16:07 | LQ_CLOSE |
37,353,822 | Add Facebook like button after all image in string | <p>How can I add facebook like button, after all image in string.</p>
<p>For example:</p>
<pre><code><p>This is some text. This is some text. This is image: <img src='url'/>. This is some tekst. This is new image: <img src='url'></p>
</code></pre>
<p>I want change to this:</p>
<pre><code><p>This is some text. This is some text. This is image: <img src='url'/><facebook like buuton>. This is some tekst. This is new image: <img src='url'> <facebook like button></p>
</code></pre>
| <php><facebook> | 2016-05-20 18:46:03 | LQ_CLOSE |
37,354,105 | Find the end of the month Pandas DataFrame Series | <p>I have a series within a DataFrame that I read in initially as an object, and then need to convert it to a date in the form of yyyy-mm-dd where dd is the end of the month.</p>
<p>As an example, I have DataFrame df with a column Date as an object:</p>
<pre><code>... Date ...
... 200104 ...
... 200508 ...
</code></pre>
<p>What I want when this is all said and done is a date object:</p>
<pre><code>... Date ...
... 2001-04-30 ...
... 2005-08-31 ...
</code></pre>
<p>such that df['Date'].item() returns</p>
<pre><code>datetime.date(2001, 04, 30)
</code></pre>
<p>I've used the following code to get almost there, but all my dates are at the beginning of the month, not the end. Please advise.</p>
<pre><code>df['Date'] = pd.to_datetime(df['Date'], format="%Y%m").dt.date
</code></pre>
<p>Note: I've already imported Pandas ad pd, and datetime as dt</p>
| <python><date><datetime><pandas> | 2016-05-20 19:02:31 | HQ |
37,355,244 | Ignore "cannot find module" error on typescript | <p>Can the Typescript compiler ignore the <code>cannot find module 'x'</code> error on import expressions such as:</p>
<pre><code>//How to tell the compiler that this module does exists
import sql = require('sql');
</code></pre>
<p>There are multiple npm libraries such as <a href="https://github.com/brianc/node-sql">node sql</a> that doesn't have existing typings</p>
<p>Is there a way to tell the compiler to ignore this error other than creating a new definition file with the <code>declare module x ...</code> ?</p>
| <import><module><typescript> | 2016-05-20 20:22:33 | HQ |
37,355,445 | c# Abstract class calling an abstract method | Can anyone explain to me why this works the way it does. The output comes out to "Print This". But how does the base class call bar(), when there is no implementation
<i>
abstract class Base
{
protected virtual void foo()
{
bar();
}
protected abstract void bar();
}
class Sub:Program
{
protected override void foo()
{
base.foo();
}
protected override void bar()
{
Console.WriteLine("Print This");
}
static void Main(string[] args)
{
Sub obj = new Sub();
obj.foo();
}
}
</i> | <c#><inheritance><abstract> | 2016-05-20 20:36:18 | LQ_EDIT |
37,355,548 | AES input and output | <p>I want an implementation of AES that takes as parameters two String inputs (plaintext, key) and outputs the encrypted String ciphertext. I have search all over the Internet but I haven't found. I have found AES that has byte[] input and outputs String and the other way round. Is it already implemented or I have to play aroundwith Java and create some methods that will finally do the job?
Thank you!</p>
| <java><encryption><bytearray><aes> | 2016-05-20 20:43:55 | LQ_CLOSE |
37,355,732 | Jenkins: two slaves vs. one slave two executors | <p>Is there any difference between I create two slaves, or one slave with two executors on the same Windows server?</p>
| <jenkins><jenkins-slave> | 2016-05-20 20:57:36 | HQ |
37,355,890 | net::ERR_INSECURE_RESPONSE in Chrome | <p>I am getting an error net::ERR_INSECURE_RESPONSE in the Chrome console when fetching some data from my API</p>
<p>This error usually occurs as a result of an unsigned certificate; however, it is not an issue with this because I have a valid and signed certificate. </p>
<p>The error doesn't happen often at all and it goes away if I restart my Chrome browser. It also doesn't occur in any other browser at all (tested on Safari, Mozilla, Opera)</p>
<p>Any idea why this is happening? Is this just a browser bug?</p>
| <google-chrome> | 2016-05-20 21:09:58 | HQ |
37,356,514 | How to debug PS4 internet browser | <p>We noticed our site is not rendered as expected on PS4 browser, is there a way to debug it or get a console?</p>
<p>I know that the PS4 browser is WebKit based so I wonder is there similar debug tools like chrome or safari have?</p>
| <debugging><webkit><playstation><ps4> | 2016-05-20 22:04:31 | HQ |
37,358,016 | Numpy converting range of angles from (-Pi, Pi) to (0, 2*Pi) | <p>This seems like it would be very straight forward but I can't seem to figure out how to map angles between -Pi and Pi to the range 0 to 2Pi. I tried using np.select but it freezes my program for some reason. I need the angles in this range since they will be used as training data for a neural net which can not output negative numbers.</p>
<pre><code>audio = wav.read('/home/chase/Desktop/ge.wav')[1].astype(np.float32)
audio = np.mean(audio, 1)
audio /= np.max(np.abs(audio))
audio = np.array([np.fft.rfft(audio[i:i + FRAME_SIZE]) for i in range(0, len(audio) - len(audio) % FRAME_SIZE, FRAME_SIZE)])
audio /= FRAME_SIZE
audio_mag = np.abs(audio)
audio_phase = np.angle(audio)
#this line freezes the program
audio_phase = np.select(audio_phase < 0 , 2 * np.pi + audio_phase, audio_phase)
</code></pre>
<p>I need the audio </p>
| <python><numpy> | 2016-05-21 01:31:26 | HQ |
37,358,340 | Should I add the google-services.json (from Firebase) to my repository? | <p>I just signed up with Firebase and I created a new project. Firebase asked me for my app domain and a SHA1 debug key. I input these details and it generated a google-services.json file for me to add in the root of my app module.</p>
<p>My question is, should this .json file be added to a public (open source) repo. Is it something that should be secret, like an API key?</p>
| <git><version-control><firebase> | 2016-05-21 02:37:33 | HQ |
37,358,840 | How to use '?' in java? | <p>I've seen this character being used several times in tutorials and other people's projects, so I would like to know what I would use it for? It's use with 'return' specifically</p>
| <java><operators> | 2016-05-21 04:21:18 | LQ_CLOSE |
37,359,281 | how to remove empty objects from json iOS | how to remove empty objects from json iOS
**{"customer_latitude":"","customer_longtitude":""}**
i get an empty lat and long value from json,but this lat and long point show into sea in map view.i want to remove that empty value | <ios><json> | 2016-05-21 05:32:34 | LQ_EDIT |
37,359,527 | Why Rails 5 uses ApplicationRecord instead of ActiveRecord::Base? | <p>We know that Rails 5 added <code>ApplicationRecord</code> as an abstract class which was inherited by our models (ActiveRecord).</p>
<p>But basically, I think every technical requirement we do with ApplicationRecord, we can also do with <code>ActiveRecord::Base</code>. For instance:</p>
<pre><code>module MyFeatures
def do_something
puts "Doing something"
end
end
class ApplicationRecord < ActiveRecord::Base
include MyFeatures
self.abstract_class = true
end
</code></pre>
<p>So now every model will be attached the behaviors of <code>MyFeatures</code>. But we can also achieve this in Rails 4:</p>
<pre><code>ActiveRecord::Base.include(MyFeatures)
</code></pre>
<p>So what is the benefit of using <code>ApplicationRecord</code>, do you think it is necessary to add <code>ApplicationRecord</code>?</p>
| <ruby-on-rails><ruby-on-rails-4><ruby-on-rails-5> | 2016-05-21 06:10:45 | HQ |
37,360,447 | MySQL Error Nr. 1064 | MySQL Error Number. 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...
after the research then tried this method ; changed TYPE=InnoDB to ENGINE=InnoDB then using query to create, the error still exist.
[1]: http://i.stack.imgur.com/rQQjy.png | <mysql><mysql-error-1064> | 2016-05-21 08:06:28 | LQ_EDIT |
37,361,087 | how to develop PHP and MYSQL ecommerce website without CMS | <p>i am a magento developer, one of my client want Pure PHP ecommerce website, client dont want any CMS. </p>
<p>i searched on the internet but i didn't get the idea. anybody please give me an idea how to develop ecommerce website using php.</p>
<p>sujjest any tutorials or free demo templates include both frontend and backend with the database</p>
<p>Thanks in advance</p>
| <php><mysql><magento> | 2016-05-21 09:22:29 | LQ_CLOSE |
37,361,303 | i have a trouble including the string header in visual stuidio community 2015 | Can someone look at the error below, i have tried around 10 articles on google,
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/JhMvl.png | <c++><visual-studio><visual-studio-2015> | 2016-05-21 09:46:58 | LQ_EDIT |
37,362,244 | SKPaymentQueue updatedTransactions not being called | <p>I am getting "this in app purchase has already been bought it will be restored for free" but the delegate updatedTransactions is not being called and nothing happens, the IAP doesn't execute.</p>
<p>I have implemented Restore Purchase which is working fine but how do i prevent a user from making purchase for a non-consumable item again?And why is the delegate updatedTransactions(SKPaymentTransactionState.Restored) not being called? </p>
<p>Even making purchase after deleting and reinstalling the app shows this pop up.</p>
<p>Here is my code.Please let me know if i am doing anything wrong.Thanks</p>
<pre><code>func makePaymentForProduct(product:SKProduct){
let payment = SKPayment.init(product: product)
SKPaymentQueue.defaultQueue().addPayment(payment)
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}
func restorePurchases(){
SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}
//MARK: SKProductsRequestDelegate
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {
self.delegate?.didGetProducts(response.products)
}
func request(request: SKRequest, didFailWithError error: NSError) {
self.delegate?.purchaseFailed(error.localizedDescription)
}
//MARK: SKPaymentTransactionObserver
func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for (_, transaction) in transactions.enumerate() {
switch (transaction.transactionState) {
case SKPaymentTransactionState.Purchased:
self.completeTransaction(transaction)
break
case SKPaymentTransactionState.Restored:
self.restoreTransaction(transaction)
break
case SKPaymentTransactionState.Failed:
self.failedTransaction(transaction)
break
default:
break
}
}
}
func completeTransaction(transaction:SKPaymentTransaction){
self.delegate?.purchaseSuccessful()
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}
func restoreTransaction(transaction:SKPaymentTransaction){
self.delegate?.purchaseSuccessful()
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}
func failedTransaction(transaction:SKPaymentTransaction){
self.delegate?.purchaseFailed("")
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}
//Restore Purchase
func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue) {
self.delegate?.purchaseRestored()
}
func paymentQueue(queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: NSError) {
self.delegate?.purchaseFailed(error.localizedDescription)
}
</code></pre>
| <ios><swift><storekit><skpaymenttransaction> | 2016-05-21 11:20:50 | HQ |
37,362,462 | Difference of BPMN and BPEL | <p>What's the difference between BPMN (Business Process Model & Notation) and BPEL (Business Process Expression Language) and Where do we use BPMN and where do we use BPEL and which one is better?</p>
| <bpel><bpmn> | 2016-05-21 11:42:44 | HQ |
37,362,557 | find charecter(AND,OR) in string and make as array in javascript/jquery | example var string=(Firstname==test1) AND (Lastname==test2) OR (state=Tamilnadu) OR (country=india)
i required output like {AND,OR,OR} | <javascript><jquery><regex> | 2016-05-21 11:51:41 | LQ_EDIT |
37,362,691 | Implements exceptions on Java Digital Clock | <p>i try to develop digital clock using java. i still new in java. the problem is, i try to implement exception on my code but i did not know how to make it.</p>
<p>my make code as below</p>
<p>Main Class</p>
<pre><code>import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class DigitalClock extends JFrame {
JLabel jLabClock;
ClockThread ct;
public DigitalClock(){
JFrame f = new JFrame("Digital Clock");
jLabClock = new JLabel("00:00:00 AM");
f.getContentPane().setBackground(Color.BLACK);
f.setLayout(new FlowLayout());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jLabClock.setFont(new Font("DS-Digital", Font.BOLD, 50));
jLabClock.setForeground(new java.awt.Color(15, 245, 15));
f.add(jLabClock);
f.pack();
f.setLocationRelativeTo(null);
ct = new ClockThread(this);
f.setVisible(true);
f.setResizable(false);
}
public static void main(String[] args) {
DigitalClock digitalClock = new DigitalClock();
}
}
</code></pre>
<p>Thread Class</p>
<pre><code>import java.util.Calendar;
import java.util.GregorianCalendar;
public class ClockThread extends Thread{
DigitalClock dc;
int timeRun = 0;
public ClockThread(DigitalClock dc){
this.dc = dc;
start();
}
@Override
public void run(){
while(timeRun == 0){
Calendar cal = new GregorianCalendar();
int hour = cal.get(Calendar.HOUR);
int min = cal.get(Calendar.MINUTE);
int sec = cal.get(Calendar.SECOND);
int am_pm = cal.get(Calendar.AM_PM);
String day_night = "";
if (am_pm == 1){
day_night = "PM";
}
else{
day_night = "AM";
}
String time = hour + ":" + min + ":" + sec + " " + day_night;
dc.jLabClock.setText(time);
}
}
}
</code></pre>
<p>this code work fine to me but i just want to try use exception on my code. can somebody help me, please</p>
| <java> | 2016-05-21 12:05:11 | LQ_CLOSE |
37,362,984 | Select from pandas dataframe using boolean series/array | <p>I have a dataframe:</p>
<pre><code> High Low Close
Date
2009-02-11 30.20 29.41 29.87
2009-02-12 30.28 29.32 30.24
2009-02-13 30.45 29.96 30.10
2009-02-17 29.35 28.74 28.90
2009-02-18 29.35 28.56 28.92
</code></pre>
<p>and a boolean series:</p>
<pre><code> bools
1 True
2 False
3 False
4 True
5 False
</code></pre>
<p>how could I select from the dataframe using the boolean array to obtain result like:</p>
<pre><code> High
Date
2009-02-11 30.20
2009-02-17 29.35
</code></pre>
| <python><dataframe> | 2016-05-21 12:34:59 | HQ |
37,363,045 | AngularJs is responsive then why do we apply responsive layout? why isn’t it default? | <p>I read that angularjs is responsive framework then when we use angular material for web page then why web page by default is not responsive?</p>
| <angularjs> | 2016-05-21 12:40:06 | LQ_CLOSE |
37,363,294 | What does a function with 2 values on the right side mean? (Model -> Html msg) | <p>I have encountered that in the guide:</p>
<pre><code>viewValidation : Model -> Html msg
viewValidation model =
let
(color, message) =
if model.password == model.passwordAgain then
("green", "OK")
else
("red", "Passwords do not match!")
in
div [ style [("color", color)] ] [ text message ]
</code></pre>
<p>So this is a function, which takes the <code>Model</code>.
<code>Html msg</code> usually looks to me like we are calling the function <code>Html</code> with the argument <code>msg</code>.</p>
<p><code>msg</code> doesn't seem to play any role in any other part of the <code>viewValidation</code> function, though. So what does it mean and what is it for in this case?</p>
| <elm> | 2016-05-21 13:02:46 | HQ |
37,363,449 | Porn CMS with iframes | <p>I'm looking for a CMS that can at least facilitate my work to create approximately 50k pages that contain code like:</p>
<pre><code><Iframe src = "http://link.com/embed/rewh3487432hdd" frameborder = "0" width = "608" height = "468" scrolling = "no"> </ iframe>
</code></pre>
<p>In addition to every video I have information such as the list of categories for each video (more than one for video), and tags that you would like to submit to me in some ways ..</p>
<p>I know that the request is quite general and will need to adapt the database to CMS, but would like to explore the possibility of avoiding me to generate the code to 0 ..</p>
<p>Thank you</p>
| <video><content-management-system> | 2016-05-21 13:15:58 | LQ_CLOSE |
37,363,560 | How to check the installed version of React-Native | <p>I'm going to upgrade react-native but before I do, I need to know which version I'm upgrading from to see if there are any special notes about upgrading from my version. </p>
<p>How do I find the version of react-native I have installed on my Mac?</p>
| <react-native> | 2016-05-21 13:27:43 | HQ |
37,364,085 | Can't compile a g++ file using OpenGL library on Mac OS using Xcode and Terminal | I am trying to compile this simple program:
[enter image description here][1]
But every time I try to do it using Xcode or terminal they give me the following warnings and the following errors:
[enter image description here][2]
Thanks ! Hope you guys can help me!
[1]: http://i.stack.imgur.com/LYYLi.png
[2]: http://i.stack.imgur.com/gpQh0.png
| <c++><xcode><macos><opengl> | 2016-05-21 14:20:35 | LQ_EDIT |
37,365,214 | More databases inside the same Firebase Project | <p>In the new Console in a Firebase Project, in <strong>Project Setting</strong> session in the <strong>Database tab</strong> there is the label <strong>Databases</strong>.</p>
<p>However I didn't find any action to create more than 1 database inside the same Firebase Project.</p>
<p>Is it possible to create more databases inside the same Firebase Project?</p>
<p><a href="https://i.stack.imgur.com/Vsgvr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vsgvr.png" alt="enter image description here"></a></p>
| <firebase><firebase-realtime-database> | 2016-05-21 16:06:48 | HQ |
37,365,600 | Customized date format in Javascript or jQuery? | <p>I need to format my date like this "2016-04-19T03:35:17.02". How can i format date format like using javascript or jQuery.</p>
<p>Please help me any one this.</p>
| <javascript><jquery> | 2016-05-21 16:43:35 | LQ_CLOSE |
37,366,181 | Passing Argument to JavaScript Object Getter | <pre><code>var URIController = {
get href() {
return url.location.href;
}
}
</code></pre>
<p>I have above object structure. But <code>URIController.href</code> property depends on another object, <code>url</code>. </p>
<p>If the <code>url</code> is defined globally, <code>URIController.href</code> works. But I want to pass <code>url</code> object to <code>href</code> getter manually.</p>
<pre><code>var URIController = {
get href(url) {
return url.location.href;
}
}
</code></pre>
<p>Changed the getter to accept url parameter but </p>
<pre><code>URIController.href(url)
</code></pre>
<p>throws error because href is not a function.</p>
<p>Is it possible to pass arguments to getter in javascript?</p>
| <javascript><getter> | 2016-05-21 17:40:17 | HQ |
37,366,259 | How to run a program from github in Python | <p>I am trying to run a code that was provided on github. I have downloaded and installed all requirements, and I am familiar with accessing json dictionaries. Do I need to input the source url anywhere? Any direction would be helpful. Thanks
<a href="https://github.com/hmm/liigadata" rel="nofollow">Git hub </a></p>
| <python><html><json><github> | 2016-05-21 17:49:19 | LQ_CLOSE |
37,366,857 | How to pass arguments to entrypoint in docker-compose.yml | <p>I use this image: dperson/samba</p>
<p>The image is defining it's own entrypoint and I do not want to override it.</p>
<p>I need to pass arguments to the entrypoint, easy with docker only:</p>
<pre><code>docker run ... dperson/samba arg1 arg2 arg3
</code></pre>
<p>But how to do it with docker_compose.yml ?</p>
<p>Right now I use as a workaround: </p>
<pre><code>command: samba.sh arg1 arg2 arg3
</code></pre>
<p>But it is not satisfying as I force the redefinition of the entrypoint.</p>
| <docker-compose> | 2016-05-21 18:53:15 | HQ |
37,367,769 | How NAT traversal works in case of peer to peer protocols like bittorrent. | <p>I know about NAT traversal and about STUN, TURN and ICE and its use. I want to know whether these are implemented in peer to peer file sharing application like bittorrent. Whether trackers facilitate peers behind NATs to communicate with each other by helping in creating direct connection using STUN or relay through TURN. In the case of Distributed Hash Table(DHT) how one peer would communicate with other peer behind NAT ?</p>
| <p2p><nat><bittorrent><stun><dht> | 2016-05-21 20:41:21 | HQ |
37,368,787 | C++, Sort One Vector Based On Another One | <p>The best example I've got is that I want to sort Names based on their Score.</p>
<pre><code>vector <string> Names {"Karl", "Martin", "Paul", "Jennie"};
vector <int> Score{45, 5, 14, 24};
</code></pre>
<p>So if I sort the score to {5, 14, 24, 45}, the names should also be sorted based on their score.</p>
| <c++><sorting><vector> | 2016-05-21 22:54:11 | HQ |
37,369,452 | Use Laravel seed and sql files to populate database | <p>I got several .sql files of countries, states and cities of the world from github. How can I run them with Laravel's seed files to populate those tables in my database?</p>
| <laravel-4> | 2016-05-22 00:44:39 | HQ |
37,369,466 | TypeError: Firebase is not a function | <p>I am trying to follow the firebase Node tutorial:
<a href="https://www.firebase.com/docs/web/quickstart.html">https://www.firebase.com/docs/web/quickstart.html</a></p>
<p>My node.js app is crashing with a "TypeError: Firebase is not a function" error. My index.js file:</p>
<pre><code>var Firebase = require("firebase");
var firebaseRef = new Firebase("https://word-word-number.firebaseio.com/");
</code></pre>
<p>Line two is where the crash happens.</p>
<p>In my package.json I have:</p>
<pre><code>"firebase": "^3.0.2",
</code></pre>
<p>and </p>
<pre><code>"node": "5.11.0"
</code></pre>
| <javascript><node.js><firebase> | 2016-05-22 00:46:46 | HQ |
37,369,473 | Java Simple program using Loop structure | <p>Sample input : 3456
Sample output :
Digits : 3, 4, 5, 6
Sum : 18</p>
<p>This is the code that I had try, but unfortunately it is wrong since i do not use loop.Please anybody can help me?</p>
<pre><code>import java.util.Scanner;
public class Lab1_5 {
public static void main (String args[])
{
int insert1, insert2, insert3, insert4;
int sum ;
Scanner console = new Scanner(System.in);
System.out.print("Please enter First Number: ");
insert1 =console.nextInt();
System.out.print("Please enter Second Number: ");
insert2 =console.nextInt();
System.out.print("Please enter Third Number: ");
insert3 =console.nextInt();
System.out.print("Please enter Fourth Number: ");
insert4 =console.nextInt();
System.out.println("Digits: "+ insert1+","+insert2+","+insert3+","+insert4);
sum = insert1+insert2+insert3+insert4;
System.out.print("Sum: "+ sum);
}
}
</code></pre>
| <java><loops><structure> | 2016-05-22 00:48:20 | LQ_CLOSE |
37,369,849 | How can I implement asyncio websockets in a class? | <p>I would like to connect to a websocket via <code>asyncio</code> and <code>websockets</code>, with a format as shown below. How would I be able to accomplish this?</p>
<pre><code>from websockets import connect
class EchoWebsocket:
def __init__(self):
self.websocket = self._connect()
def _connect(self):
return connect("wss://echo.websocket.org")
def send(self, message):
self.websocket.send(message)
def receive(self):
return self.websocket.recv()
echo = EchoWebsocket()
echo.send("Hello!")
print(echo.receive()) # "Hello!"
</code></pre>
| <python><python-3.x><websocket><python-3.5><python-asyncio> | 2016-05-22 02:05:11 | HQ |
37,369,929 | Disable AccountChooser for Firebase Auth | <p>I'm trying the new FirebaseUI for Web (<a href="https://github.com/firebase/FirebaseUI-Web" rel="noreferrer">https://github.com/firebase/FirebaseUI-Web</a>). But when I tried to login with Email, it redirects me to an AccountChooser website.</p>
<p>Is there anyway that I can turn off that AccountChooser?</p>
<p>Thanks</p>
| <firebase><openid><firebase-authentication> | 2016-05-22 02:26:07 | HQ |
37,369,960 | Determine if user clicked outside shadow dom | <p>I'm trying to implement a dropdown which you can click outside to close. The dropdown is part of a custom date input and is encapsulated inside the input's shadow DOM.</p>
<p>I want to write something like:</p>
<pre><code>window.addEventListener('mousedown', function (evt) {
if (!componentNode.contains(evt.target)) {
closeDropdown();
}
});
</code></pre>
<p>however, the event is retargeted, so <code>evt.target</code> is <em>always</em> the outside the element. There are multiple shadow boundaries that the event will cross before reaching the window, so there seems to be no way of actually knowing if the user clicked inside my component or not.</p>
<p><b>Note:</b> I'm not using polymer anywhere -- I need an answer which applies to generic shadow DOM, not a polymer specific hack.</p>
| <javascript><shadow-dom> | 2016-05-22 02:31:21 | HQ |
37,370,224 | Firebase stop listening onAuthStateChanged | <p>As of version ^3.0.0, I'm having a difficult time removing the auth state change listener. </p>
<p>To start the listener per the documentation: </p>
<pre><code>firebase.auth().onAuthStateChanged(function (user) {
// handle it
});
</code></pre>
<p>However, I cannot find anywhere in the documentation that refers to a remove auth state change listener. There is peculiar function on the Firebase.Auth class called <code>removeAuthTokenListener</code>. Unfortunately it's not documented (<a href="https://firebase.google.com/docs/reference/js/index-all" rel="noreferrer">firebase docs reference</a>). </p>
<p>Via your browser's web console. </p>
<pre><code>var auth = firebase.auth();
auth.removeAuthTokenListener;
</code></pre>
<p>prints a function definition that takes one parameter. I tried to do the following:</p>
<pre><code>this.authListener = firebase.auth().onAuthStateChanged(function (user) {...});
firebase.auth().removeAuthTokenListener(this.authListener);
</code></pre>
<p>but that didn't do anything. </p>
| <javascript><firebase><firebase-authentication> | 2016-05-22 03:25:04 | HQ |
37,370,282 | please explain this function code this code use to change colored picture into black and white | Can somebdy explain me the function of this code this code use to change colored picture into black and with picture
Begin
Indeks := 3 * Kolom;
R := PDataBaris[Indeks];
G := PDataBaris[Indeks+1];
B := PDataBaris[Indeks+2];
Intensitas := Round(0.2989 * R + 0.5870 * G + 0.1141* B);
if Intensitas < 128 then
begin
p:=p+1;
Intensitas := 0
end;
if Intensitas > 128 then
begin
h:=h+1;
Intensitas := 255
end;
PDataBaris[Indeks] := Intensitas;
PDataBaris[Indeks+1] := Intensitas;
PDataBaris[Indeks+2] := Intensitas;
End;
end;
| <delphi> | 2016-05-22 03:38:37 | LQ_EDIT |
37,370,476 | How to persist a list of strings with Entity Framework Core? | <p>Let us suppose that we have one class which looks like the following:</p>
<pre><code>public class Entity
{
public IList<string> SomeListOfValues { get; set; }
// Other code
}
</code></pre>
<p>Now, suppose we want to persist this using EF Core Code First and that we are using a RDMBS like SQL Server.</p>
<p>One possible approach is obviously to create a wraper class <code>Wraper</code> which wraps the string:</p>
<pre><code>public class Wraper
{
public int Id { get; set; }
public string Value { get; set; }
}
</code></pre>
<p>And to refactor the class so that it now depends on a list of <code>Wraper</code> objects. In that case EF would generate a table for <code>Entity</code>, a table for <code>Wraper</code> and stablish a "one-to-many" relation: for each entity there is a bunch of wrapers.</p>
<p>Although this works, I don't quite like the approach because we are changing a very simple model because of persistence concerns. Indeed, thinking just about the domain model, and the code, without the persistence, the <code>Wraper</code> class is quite meaningless there.</p>
<p>Is there any other way persist one entity with a list of strings to a RDBMS using EF Core Code First other than creating a wraper class? Of course, in the end the same thing must be done: another table must be created to hold the strings and a "one-to-many" relationship must be in place. I just want to do this with EF Core without needing to code the wraper class in the domain model.</p>
| <c#><entity-framework><entity-framework-core><.net-core> | 2016-05-22 04:14:24 | HQ |
37,370,660 | makemigrations doesn't detect changes in model | <p>I'm using django 1.9.6. I recently deleted my migrations and ran <code>migrate --run-syncdb</code> and <code>makemigrations my_app</code>. Today I added a new field to one of my models:</p>
<p><em>models.py:</em></p>
<pre><code>value = models.PositiveSmallIntegerField(null=True)
</code></pre>
<p>I tried to migrate the changes, but <code>makemigrations</code> doesn't detect the change. It's just the development version, so I can resync (I don't have to preserve the data), but running <code>--run-syncdb</code> again doesn't detect it either.</p>
<p>Why isn't this migrating?</p>
| <django><migration> | 2016-05-22 04:47:22 | HQ |
37,370,671 | Android Using Firebase Analytics along with Google Analytics | <p>I'd love to know how I can use Firebase Analytics (FA) and Google Analytics (GA) simultaneously as FA doesn't provide real-time data and my apps already integrated with GA since the beginning. I'd like to continue using GA since all my analytic data started there when I first launched my apps. Meanwhile, I'd like to have my apps have FA integrated to get more info.</p>
<p>I followed <a href="https://support.google.com/analytics/answer/2587086?hl=en">Using Firebase Analytics and Google Analytics together</a> and setup Google Tag Manager. It doesn't seem to be working for me. I do see FA dashboard being updated but nothing is showing up in GA.</p>
<p>Any help is greatly appreciated!</p>
| <android><google-analytics><firebase><firebase-analytics> | 2016-05-22 04:48:53 | HQ |
37,370,748 | multiply a int in Java by it selft | Why if I multiply a int num = 2,147,483,647 by the same int num is returning 1 as result ? notes that i am in the limit of the int possible value.
I already try to catch the exception but still give the result as 1 | <java><int> | 2016-05-22 05:02:23 | LQ_EDIT |
37,371,241 | Is there any merit about assembly language? | <p>I heard some of developers use assembly language in embedded system. </p>
<p>I wonder what merit they have from learning assembly language and what field use assembly language. </p>
<p>Do you have any experience? </p>
| <linux><assembly> | 2016-05-22 06:24:21 | LQ_CLOSE |
37,371,279 | Unable to create table with column name "schemas" | <p>When I tried to execute following statement.</p>
<pre><code>create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
</code></pre>
<p>I am getting following error.</p>
<pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'schemas varchar(255))' at line 1
</code></pre>
<p>When I change the column name "schemas" to something else, it is working fine.</p>
<pre><code>mysql> create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'schemas varchar(255))' at line 1
mysql>
mysql> create table user_schemas (user_id varchar(255) not null, rules varchar(255));
Query OK, 0 rows affected (0.01 sec)
</code></pre>
<p>Any idea on how to solve this problem??</p>
| <mysql> | 2016-05-22 06:32:15 | LQ_CLOSE |
37,371,378 | The "GenerateJavaStubs" task failed | <p>Currently banging my head against a wall with this issue, the error is preventing me from building and running my application. It is a PCL project.</p>
<pre><code> Error The "GenerateJavaStubs" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.Path.GetFullPath(String path)
at Xamarin.Android.Tasks.GenerateJavaStubs.Run()
at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() ConstructionMobileApp.Droid C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1574
</code></pre>
<p>My assembly info in the PCL:</p>
<pre><code>using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ConstructionMobileApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConstructionMobileApp")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
</code></pre>
<p>Android Assembly Info:</p>
<pre><code>using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
[assembly: AssemblyTitle("ConstructionMobileApp.Droid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConstructionMobileApp.Droid")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
</code></pre>
| <c#><android><visual-studio><xamarin> | 2016-05-22 06:46:54 | HQ |
37,371,585 | remove duplicate(non-unique) paired values in stata, urgent | I'm working with an edge list in STATA, of the type:
var1 var2
a 1
a 2
a 3
b 1
b 2
1 a
2 b
I want to remove non-unique pairs such as 1a and 2b (which are same as a1 and b2 for me). How can I go about this? | <stata> | 2016-05-22 07:15:27 | LQ_EDIT |
37,371,891 | How could I write variable input function | <p>I am trying to write a multi input function in C programming. Could somebody explain me that what is the meaning of the 3 points in the following code example? I realize that I could use “sprintf” with 2 input or 3 or more depending of the demand. How could use this method in my programs. Thanks in advance</p>
<pre><code>int sprintf (char *string, const char *form, … );
</code></pre>
| <c><function> | 2016-05-22 07:58:25 | LQ_CLOSE |
37,371,994 | Hello i cannot make update on PHP (Mysqli) | php but it is not correct and what can i do? insert is working. Everything is working but not update. I dont know why, i think i had made everything correct. if you can help me it would be great. Thank you!
i cannot make update on PHP (Mysqli)
<?php
include("conn.php");
echo "<meta charset='utf-8'>";
?>
<?php
$id = $_GET['edi'];
$showrecs = "SELECT ID, English, Georgian FROM register WHERE ID='$id'";
$result = $conn->query($showrecs);
if(isset($_POST['update'])){
$Updatee = "UPDATE register SET English='".$_POST['English']."', Georgian='".$_POST['Georgian']."' WHERE ID='$id'";
$res=mysqli_query($conn, $Updatee);
if($res==1){
echo "წარმატებით განხორციელდა რედაქტირება.";
echo "<br>";
echo "<a href='view.php'>ჩანაწერების ნახვა</a>";
}
if($res==0){
echo "არაფერიც არ მოხდა";
}
exit();
}
elseif ($result->num_rows > 0) {
//
while($row = $result->fetch_assoc()) {
echo "<form method=POST>";
echo "<tr>";
echo "<td>" . "<input type='text' name='id' value=" . $row['ID'] ." disabled>". "</td>";
echo "<td>" . "<input type='text' name='Engish' value=" . $row['Engish'] .">". " </td>";
echo "<td>" . "<input type='text' name='Georgian' value=" . $row['Georgian'] .">". " </td>";
echo "<td>" . "<input type='submit' name='update' value='შეცვლა'>" . " </td>";
echo "</form>";
?>
<?php
echo "</br>";
echo "</br>";
}
} else {
echo "Error;";
}
$conn->close();
?> | <php><mysqli> | 2016-05-22 08:11:59 | LQ_EDIT |
37,372,448 | Is it possible to import fonts from the directory with scss? | <p>I have a scss file with font import implemented this way:</p>
<pre><code>@import url(https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700&subset=latin-ext,cyrillic);
</code></pre>
<p>I understand that using CDN gives advantages in caching for user but this is internal site and it could be used on server without access to the <code>wide web</code>. And I'm not sure that user machine will have access to the Internet too. So I want to serve fronts with other pages static files. </p>
<p>Is there a way in SCSS to import fonts from the some directory on server? Something like:</p>
<pre><code>@import dir(/path/to/fonts/file)
</code></pre>
<p>Or SCSS has not this feature?</p>
| <sass> | 2016-05-22 09:09:12 | HQ |
37,372,603 | How to remove specific substrings from a set of strings in Python? | <p>I have a set of strings <code>set1</code>, and all the strings in <code>set1</code> have a two specific substrings which I don't need and want to remove. <br/>
Sample Input:
<code>set1={'Apple.good','Orange.good','Pear.bad','Pear.good','Banana.bad','Potato.bad'}</code><br/>
So basically I want the <code>.good</code> and <code>.bad</code> substrings removed from all the strings. <br/>What I tried:</p>
<pre><code>for x in set1:
x.replace('.good','')
x.replace('.bad','')
</code></pre>
<p>But this doesn't seem to work at all. There is absolutely no change in the output and it is the same as the input. I tried using <code>for x in list(set1)</code> instead of the original one but that doesn't change anything. </p>
| <python><python-3.x> | 2016-05-22 09:31:05 | HQ |
37,372,815 | Setup Localhost and Wamp Server | <p>I need to setup localhost and wamp server on windows 10, can anybody point me to good website or youtube channel please. Thanks</p>
| <javascript><php><jquery> | 2016-05-22 09:55:07 | LQ_CLOSE |
37,372,897 | how do i create a make file in windows operating system and run it using cmd | i am new to makefile concept
so to try out if i am able to run and compile c files using word "make"in command prompt i made main.c (which contains main function) ,ttt.c (which contain a function void ttt(int)) , mandar.h (headerfile to include void ttt(int) function in main.c)
when i run this program in cmd using "gcc main.c ttt.c -o main && main",program gets compiled and run properly(so there shouldn't be any error in code)
now in the same directory i made a file Makefile.txt as follow
[image of makefile][1]
now when i type "make "in cmd following message is shown
[image of cmd message][2]
i typed everything exactly the same way as in "head first c " book
did i miss something
this is my first time to ask a question so suggestion regarding improvement of questions are also welcomed
[1]: http://i.stack.imgur.com/ymHPw.png
[2]: http://i.stack.imgur.com/rVwLt.png | <c++><c> | 2016-05-22 10:02:27 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.