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
35,775,405
Is there any use for basic_string<T> where T is not a character type?
<p>The declaration of C++ string <a href="http://en.cppreference.com/w/cpp/string/basic_string" rel="noreferrer">is the following</a>:</p> <pre><code>template&lt; class CharT, class Traits = std::char_traits&lt;CharT&gt;, class Allocator = std::allocator&lt;CharT&gt; &gt; class basic_string; </code></pre> <p>The <code>CharT</code> is character type which can be <code>char</code>, <code>wchar_t</code>, <code>char16_t</code> and <code>char32_t</code>; but after all <code>basic_string</code> is a template so can be instantiated with other <code>CharT</code> and other allocators. While I can think in some use cases for other allocators I'm unable to think in use cases for strings of other data types, for example:</p> <pre><code>using string = std::basic_string&lt;int&gt;; </code></pre> <p>Using a string of integers, we cannot initialize it as a string (obvious) nor u32 string (not that obvious, at least for me); but we can initialize it with <code>initializer_list</code> as long as the contained type of the list is convertible to <code>int</code>:</p> <pre><code>string err1("test"); // Error! string err2(U"test"); // Error! string err3{"test"}; // Error! string err4{U"test"}; // Error! string err5 = "test"; // Error! string err6 = U"test"; // Error! string success1({U't', U'e', U's', U't'}); string success2 = {U't', U'e', U's', U't'}; string success3({'t', 'e', 's', 't'}); string success4 = {'t', 'e', 's', 't'}; </code></pre> <p>But even if we manage to initialize a integer string, we cannot use it in the normal way:</p> <pre><code>std::cout &lt;&lt; success1; // Error! expected 116101115116 </code></pre> <p>The only <code>basic_string</code> expected to be used with <code>cout</code> are the <em>normal</em> ones, that makes sense: after all we cannot assume how is supposed to be printed a string of integers or a string of <code>MyFancyClass</code>es.</p> <p>But anyways, the creation of <em>strange</em> instances of <code>basic_string</code> isn't forbidden; on one hand is not forbidden due to the lack of features which forbids that use (a.k.a. concepts) and on the other coding <code>basic_string</code> without limiting the underlying type is easier than doing it on the opposite way (without concepts) so, that makes me wonder:</p> <ul> <li>Is there any use for <code>std::basic_string&lt;T&gt;</code> where <code>T</code> is not a character type?</li> </ul> <p>As for <em>any use</em> I'm thinking about things that only can be achieved with strings of <code>T</code> and that cannot be done with vector of <code>T</code> (or it will be significantly harder to do), in other words:</p> <ul> <li>Have you ever faced a situation where a string of <code>T</code> is the better choice?</li> </ul>
<c++><string>
2016-03-03 14:50:57
HQ
35,775,465
Some of my text all over the website underline automatically
<p>I'm not quite sure what's going on, but I don't want any text underline on my website and for some reason, it just got added automatically... any of you know how to fix it?</p> <p>Is it because of the browser? The Stylesheet.css?</p> <p>I'm really confuse since some of them are fine and other aren't...</p> <p>Any help is really appreciated. Thanks</p> <p>This is the website: <a href="http://cliniquedukine.com" rel="nofollow">cliniquedukine.com</a></p>
<html><css><underline>
2016-03-03 14:53:44
LQ_CLOSE
35,775,506
How to pass/get placeholder value? [PHP]
So I have a form where one entry is: <input type="text" id="ptid" name="ptid" readonly="readonly" placeholder="<?php echo $pid; ?>"> The value of "$pid" is not null, I already got the value from database. Then I would like to get that value and pass to another php file. So I tried this code : <?php $ptid=$_POST['pid']; ?> I tried printing this out, but somehow there's no result. Is there anyway to get the value?
<php><placeholder>
2016-03-03 14:55:18
LQ_EDIT
35,776,663
React-intl multi language app: changing languages and translations storage
<p>I have react-router app and would like to add i18n. In react-intl <a href="https://github.com/yahoo/react-intl#example" rel="noreferrer">example</a> root component wrapped in IntlProvider:</p> <pre><code>ReactDOM.render( &lt;IntlProvider locale="en"&gt; &lt;App /&gt; &lt;/IntlProvider&gt;, document.getElementById('container') </code></pre> <p>);</p> <p>But there is only one locale. How to update app for adding other languages and how is the best way to store translations? </p>
<reactjs><internationalization><formatjs><react-intl>
2016-03-03 15:45:28
HQ
35,776,826
How to specify the Chrome binary location via the selenium server standalone command line?
<p>I am using a portable version of Google Chrome that is not stored at the default location of my Windows 7 machine. I don't have admin rights to install Chrome at the default location.</p> <p>Running <code>java -jar selenium-server-standalone-2.52.0.jar -help</code> does not hint any possibility of setting the path to the <strong>chrome binary</strong> (<strong>not the chrome driver</strong>). </p> <p>The <a href="https://sites.google.com/a/chromium.org/chromedriver/capabilities" rel="noreferrer">chrome driver capabilities</a> indicate that it's possible to set the <strong>binary</strong> but I'm not sure how to do it via the command line.</p>
<google-chrome><selenium>
2016-03-03 15:52:16
HQ
35,777,991
TypeError: Super expression must be null or a function, not undefined with Babeljs
<p>I'm currently trying to make multiple-files inheritance in ES6, with node.JS and Babel (I'm using Babel to convert the code from ES6 to ES5 'cause Node don't implement ES6 right now). I'm using import/export to "link" the differents files.</p> <p>Actually I have : <strong>Parent Class (File 1)</strong></p> <pre><code>export class Point { constructor(x, y) { this.x = x; this.y = y; } toString() { return '(' + this.x + ', ' + this.y + ')'; } } </code></pre> <p>And : <strong>Child Class (File 2)</strong></p> <pre><code>import Point from './pointES5' export class ColorPoint extends Point { constructor(x, y, color) { super(x, y); this.color = color; } toString() { return super.toString() + ' in ' + this.color; } } </code></pre> <p>And the main <strong>Main (File 3)</strong></p> <pre><code>import Point from './pointES5' import ColorPoint from './colorpointES5' var m_point = new Point(); var m_colorpoint = new ColorPoint(); console.log(m_point.toString()); console.log(m_colorpoint.toString()); </code></pre> <p>I'm doin' that to test the toString() methods calls, from Parent and from Child.<br> So then I use Babel to convert the code from ES6 to ES5 and I run each parts separately to test if it's ok or not.<br> - Point (the Parent) is good, and execute without error.<br> - ColorPoint (the Child) don't run completely and throw : </p> <blockquote> <p>TypeError: Super expression must either be null or a function, not undefined</p> </blockquote> <p>The first line of the StackTrace is :</p> <blockquote> <p>function _inherits(subClass, superClass) { if (typeof superClass !== 'function' &amp;&amp; superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass &amp;&amp; superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.<strong>proto</strong> = superClass; } (It comes from the ES5 converted code (Babelified), and I can post it entirely if it's needed).</p> </blockquote> <p>It is frustrating cause this code is very simple... But I don't see what is causing the error.</p> <p>I try differents versions of Babel (5, 5.8, 6) but there is no differences...</p> <p>What have I done wrong ?</p> <p>PS : I forgot to tell : it WORKS PERFECTLY when I do that in just one file. But it's really important to me to have only one class by file...</p>
<javascript><node.js><inheritance><babeljs>
2016-03-03 16:42:27
HQ
35,778,315
Can I have a route53 subdomain in a different Hosted Zone?
<p>I have foo.com as a Hosted Zone with an A, NS, SOA, TXT and MX Record Sets. It works fine. Now I want a separate test.foo.com with an A entry but I want it in a separate Hosted Zone. Is it possible?</p> <p>If I put an A record in foo.com's Hosted Zone with the value test.foo.com it works but I want it in a separate Hosted Zone.</p> <p>I want it like so in order to have a clear separation between the test and prod. This way I can break the test but the prod is still up.</p> <p>Thank you!</p>
<dns><amazon-route53>
2016-03-03 16:58:40
HQ
35,778,382
Chrome 49 timing and loading errors using require.js modules
<p>My web app (which has lots of JS) has been working fine until this Chrome 49 update. (I know it's the update because it was working, then I updated my browser, and now its not).</p> <p>There seems to be a timing issue on when the require.js <code>define()</code> functions are called. Although the require.js files are loaded first, my non-amd JS loaded after are firing first and causing issues like:</p> <p><code>Uncaught Error: Module name [name] has not been loaded...</code></p> <p>Is anyone else having this problem?</p>
<javascript><google-chrome><requirejs><amd>
2016-03-03 17:01:42
LQ_CLOSE
35,778,442
C# Coding structure wrong, input (45 degrees) not outputting correct answer?
<p>I have some c# code (as below **) but I cannot seem to output the correct answer? The input is 45 (degrees) and the output should read 255.102 (meters), my answer is wrong as the output reads 413.2653. </p> <p>I must confess that I think my code (structure) is actually wrong and not the arithmetic?</p> <p>The whole code is as followed:</p> <p>**</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace sums { class Program { static void Main(string[] args) { //prompt the user for angle in degrees Console.Write("Enter initial angle in degrees: "); float theta = float.Parse(Console.ReadLine()); //convert the angle from degrees to radians float DtoR = theta * ((float)Math.PI / 180); //Math.Cos DtoR = theta * (float)Math.Cos(theta); //Math.Sin DtoR = theta * (float)Math.Sin(theta); //t = Math.Sin / 9.8 DtoR = theta / (float)9.8; //h = Math.Sin * Math.Sin / (2 * 9.8) DtoR = theta * theta / (2 * (float)9.8); //dx = Math.Cos* 2 * Math.Sin / 9.8 DtoR = theta * 2 * theta / (float)9.8; //result Console.Write("Horizontal distance {0} Meters. \r\n ", DtoR, theta); } } } </code></pre>
<c#>
2016-03-03 17:04:08
LQ_CLOSE
35,778,495
fatal error: 'Python.h' file not found while installing opencv
<p>I am trying to get opencv 3.1 installed for Python on my Mac OS X 10.10.5 I'm following the steps as outlined here - <a href="http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/">http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/</a></p> <p>When I actually try installing opencv after all the setup, I get the following error: </p> <pre><code>.../opencv/modules/python/src2/cv2.cpp:6:10: fatal error: 'Python.h' file not found #include &lt;Python.h&gt; ^ </code></pre> <p>I looked around StackOverflow and found that most people facing this issue are using Anaconda, which is not my case. It would be great if someone could point me in the right direction to get this fixed. </p> <p>Thanks,</p>
<python><macos><opencv>
2016-03-03 17:05:40
HQ
35,778,955
Regex for Punctuation (Section sign) in PHP
<p>I want to create a regex that finds § in a string.</p> <p>The section sign has unicode U+00A7 ,html sect and ascii value 245;</p> <p>But I wonder if /(\245)/ would work</p>
<php><regex>
2016-03-03 17:28:35
LQ_CLOSE
35,779,151
Merging multiple TypeSafe Config files and resolving only after they are all merged
<p>I am writing test code to validate a RESTful service. I want to be able to point it at any of our different environments by simply changing an environment variable before executing the tests.</p> <p>I want to be able to merge three different config files:</p> <ul> <li><code>conf/env/default.conf</code> - the default configuration values for all environments</li> <li><code>conf/env/&lt;env&gt;.conf</code> - the environment-specific values </li> <li><code>application.conf</code> - the user's overrides of any of the above</li> </ul> <p>The idea is that I don't want everything in a single config file, and run the risk of a bad edit causing configuration items to get lost. So instead, keep them separate and give the user the ability to override them.</p> <p>Here's where it gets tricky: <code>default.conf</code> will include ${references} to things that are meant to be overridden in <code>&lt;env&gt;.conf</code>, and may be further overridden in <code>application.conf</code>. </p> <p>I need to postpone resolving until all three are merged. How do I do that?</p>
<merge><typesafe-config>
2016-03-03 17:37:50
HQ
35,779,178
What is the equivalent of string in C++
In Python, there is a type string, which i'm sure most of you will know, just asking what is the equivalent of string in c++
<c++><string>
2016-03-03 17:38:34
LQ_EDIT
35,780,406
Ocaml turning a string to an array of chars without the blank spaces
so i am doing an assignment on Ocaml and i am kind of stuck in a part where i need to convert a String to an array. The trick is that i dont want the array to have blank spaces. Example: let s = "This is a string test";; and i want the outcome to be something like y = [|'t'; 'h'; 'i'; 's'; 'i'; 's'; 'a';'s';'t';'r';'i';'n';'g';'t';'t';'e';'s';'t';|]; for this problem im using the following instruction let test = Array.init (String.length y) (fun t -> y.[t]);; but the value of test has the blank spaces (' ') in it. If anyone could help i would appreciate it.
<arrays><string><ocaml>
2016-03-03 18:45:06
LQ_EDIT
35,780,409
Position Fixed not working when CSS Filters applied on same element in Microsoft Edge
<p>I am testing this on Edge 20.10240.16384.0 </p> <p>I have an element whose position is fixed and has CSS Filters applied to it. This works great in all browsers except Microsoft Edge, where the position of the element doesn't remain fixed. This issue is directly related to CSS3 Filters as removing them makes the position fixed work correctly</p> <p>Here is a basic example of this. It works correctly (aka the fixed background remains fixed) on browsers other than Microsoft Edge. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; body { height: 5000px; } .fixed { position: fixed; left: 0; background-image: url(https://lh5.googleusercontent.com/-REJ8pezTyCQ/SDlvLzhAH-I/AAAAAAAABeQ/mC1PXNiheJU/s800/Blog_background_750.gif); background-repeat: repeat; background-attachment: fixed; height: 100%; width: 100%; -webkit-filter: brightness(70%); -moz-filter: brightness(70%); -o-filter: brightness(70%); filter: brightness(70%); } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class='fixed'&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>After searching around , I came across <a href="https://connect.microsoft.com/IE/feedback/details/1810480/ms-edge-rendering-problem-of-css-filter" rel="noreferrer">https://connect.microsoft.com/IE/feedback/details/1810480/ms-edge-rendering-problem-of-css-filter</a> , which details the same issue but has been marked as Fixed most likely as it couldn't be reproduced. I am attaching GIF for the same - </p> <p><strong>Microsoft Edge -</strong> <a href="https://i.stack.imgur.com/RSbZh.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/RSbZh.gif" alt="enter image description here"></a></p> <p><strong>Google Chrome -</strong> <a href="https://i.stack.imgur.com/uXfmQ.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/uXfmQ.gif" alt="enter image description here"></a></p>
<css><microsoft-edge><css-filters>
2016-03-03 18:45:17
HQ
35,780,506
How to make switch case syntax smaller?
<p>i'm making simple name generator, and it's working like that: I got an array with name values it's 4 elements, and i'm using random class to pick specific name from array, and next i'm using switch case to validate which one is picked and print it to console.</p> <p>But, it's only 4 element, but what when i'll try to make 100 elements 4example? I've tried to make switch case in for loop to increment everything in one case, but it turns out that case index should be const. Well, is there any other possible way to make switch case more flexible, and smaller?</p> <p>Here's code for intersed <a href="http://pastebin.com/bbCxLtRq" rel="nofollow">http://pastebin.com/bbCxLtRq</a></p>
<c#>
2016-03-03 18:49:25
LQ_CLOSE
35,780,537
Error: "No module named _markerlib" when installing some packages on virtualenv
<p>I can't install some packages on virtualenv because of this error.</p> <p>I tried to install:</p> <pre><code>pip install pyups==0.4.4 </code></pre> <p>and </p> <pre><code>pip install --upgrade distribute </code></pre> <p>and they give me the error:</p> <pre><code>Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; File "/tmp/pip-build-tLx1oC/distribute/setup.py", line 58, in &lt;module&gt; setuptools.setup(**setup_params) File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "setuptools/command/egg_info.py", line 177, in run writer = ep.load(installer=installer) File "pkg_resources.py", line 2241, in load if require: self.require(env, installer) File "pkg_resources.py", line 2254, in require working_set.resolve(self.dist.requires(self.extras),env,installer))) File "pkg_resources.py", line 2471, in requires dm = self._dep_map File "pkg_resources.py", line 2682, in _dep_map self.__dep_map = self._compute_dependencies() File "pkg_resources.py", line 2699, in _compute_dependencies from _markerlib import compile as compile_marker ImportError: No module named _markerlib </code></pre> <p>I tried also to install markerlib with </p> <pre><code>pip install markerlib </code></pre> <p>But the error continues.</p>
<python><python-2.7><pip>
2016-03-03 18:51:06
HQ
35,780,621
Array Reverse is not working for me ...
<p>Consider the following code (React JS code):</p> <pre><code> poll() { var self = this; var url = "//" + location.hostname + "/api/v1/eve/history/historical-data/" + this.state.itemId + '/' + this.state.regionId + '/40'; $.get(url, function(result) { console.log(result.data, result.data.reverse()); self.setState({ error: null, historicalData: result.data.reverse(), isLoading: false }); }).fail(function(response) { self.setState({ error: 'Could not fetch average price data. Looks like something went wrong.', }); }); } </code></pre> <p>Notice the console.log. Lets see an image:</p> <p><a href="https://i.stack.imgur.com/yWnRm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yWnRm.png" alt="enter image description here"></a></p> <p>Last I checked, reverse should have reversed the order of the array. Yet it doesn't.</p> <p>Am I <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" rel="noreferrer">Using this wrong (official MDN Docs)</a>? Why isn't reverse working?</p>
<javascript><arrays><reverse><array-reverse>
2016-03-03 18:55:13
HQ
35,780,743
Structured Query Language
how can i compare two dates based on month field in sql...i tried all answers dat was given here but they did n't work.if you show any example of displaying employee names who have joined in those months when their managers joined....it will b helpful for me..
<sql><oracle>
2016-03-03 19:01:24
LQ_EDIT
35,781,669
Clean way to use postgresql window functions in django ORM?
<p>I'd like to use postgresql window functions like <code>rank()</code> and <code>dense_rank</code> in some queries in need to do in Django. I have it working in raw SQL but I'm not sure how to do this in the ORM.</p> <p>Simplified it looks like this:</p> <pre><code>SELECT id, user_id, score, RANK() OVER(ORDER BY score DESC) AS rank FROM game_score WHERE ... </code></pre> <p>How would you do this in the ORM? </p> <p>At some point I might need to add partitioning too :|</p> <p>(we're using Django 1.9 on Python 3 and already depend on django.contrib.postgres features)</p>
<sql><django><postgresql><orm>
2016-03-03 19:49:27
HQ
35,781,817
Trigger workflow on Github push - Pipeline plugin - Multibranch configuration
<p>We are using the pipeline plugin with multibranch configuration for our CD. We have checked in the Jenkinsfile which works off git.</p> <pre><code>git url: "$url",credentialsId:'$credentials' </code></pre> <p>The job works fine, but does not auto trigger when a change is pushed to github. I have set up the GIT web hooks correctly. </p> <p>Interestingly, when I go into a branch of the multibranch job and I click "View Configuration", I see that the "Build when a change is pushed to Github" is unchecked. There is no way to check it since I can not modify the configuration of the job (since it takes from parent) and the same option is not there in parent. </p> <p>Any ideas how to fix this? </p>
<jenkins><jenkins-workflow>
2016-03-03 19:58:49
HQ
35,781,911
Detect when reCaptcha does not load
<p>What is the best way to detect if a reCaptcha v2 does not load? I would like to alert users when they need to use the captcha to continue, but it was unable to load.</p>
<captcha><recaptcha>
2016-03-03 20:03:24
HQ
35,781,922
Why PHP isn't use the variable declared outside of POST?
<p>I need some help about how to pass a variable with POST without using sessions.</p> <p>Currently my code doesn't display value of the variable called $myvariable:</p> <pre><code>&lt;?php if(isset($_POST['testbutton'])){ if ($_POST['testbutton'] == 'Testing') { echo $myvariable; var_dump($_POST); } } $myvariable = "hello world"; echo '&lt;form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post"&gt;'; echo '&lt;input type="submit" value="Testing" name="testbutton"/&gt;'; echo '&lt;/form&gt;'; ?&gt; </code></pre> <p>What should I change in the code to be able to use $variable in POST['testbutton'] part of the code ?</p>
<php>
2016-03-03 20:03:56
LQ_CLOSE
35,782,288
css skewed arrow box with transparent background
<p><a href="https://i.stack.imgur.com/d86P6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d86P6.png" alt="enter image description here"></a></p> <p>Basically thats the shape I want to create in CSS, the height is 192 and I want the background to be transparent.</p> <p>Can I do this in CSS and if so is it smarter to do with SVG maybe?</p> <p>Thanks</p>
<css><shape>
2016-03-03 20:24:37
LQ_CLOSE
35,782,434
Streaming file from S3 with Express including information on length and filetype
<p>Using the <code>aws-sdk</code> module and Express 4.13, it's possible to proxy a file from S3 a number of ways.</p> <p>This callback version will return the file body as a buffer, plus other relevant headers like <code>Content-Length</code>:</p> <pre><code>function(req,res){ var s3 = new AWS.S3(); s3.getObject({Bucket: myBucket, Key: myFile},function(err,data){ if (err) { return res.status(500).send("Error!"); } // Headers res.set("Content-Length",data.ContentLength) .set("Content-Type",data.ContentType); res.send(data.Body); // data.Body is a buffer }); } </code></pre> <p>The problem with this version is that you have to get the entire file before sending it, which is not great, especially if it's something large like a video.</p> <p>This version will directly stream the file:</p> <pre><code>function(req,res){ var s3 = new AWS.S3(); s3.getObject({Bucket: myBucket, Key: myFile}) .createReadStream() .pipe(res); } </code></pre> <p>But unlike the first one, it won't do anything about the headers, which a browser might need to properly handle the file.</p> <p>Is there a way to get the best of both worlds, passing through the correct headers from S3 but sending the file as a stream? It could be done by first making a <code>HEAD</code> request to S3 to get the metadata, but can it be done with one API call?</p>
<node.js><express><amazon-s3><aws-sdk>
2016-03-03 20:32:52
HQ
35,782,855
nano editor on OS X - How to type M-U for undo?
<p>I am using nano 2.5.3 on OS X Yosemite, and I see commands at the bottom such as:</p> <p>M-U Undo M-E Redo</p> <p>So far, I have not been able to figure out which key or keys that <code>M</code> is referring to. What would be <code>M</code> on OS X?</p>
<nano>
2016-03-03 20:55:32
HQ
35,783,053
show account chooser every time with GoogleSignInApi
<p>I am using the new GoogleSignInApi that was introduced in play services 8.3. It remembers the last selected account and doesn't show account picker from 2nd time onwards. But I want it to let user choose account every time. Looks like the clearDefaultAccountAndReconnect() method of GoogleApiClient is not allowed to be used with googleSignInApi. Is there any way to achieve this without implementing a custom account chooser? I am on play services 8.3 and google services 1.5.0.</p>
<android><google-play-services><google-signin>
2016-03-03 21:07:51
HQ
35,783,505
is possible to set a default value in java object?
class Person { private String name; private String sex="male"; public Person(String name) { this.name = name; } public String getSex(){return this.sex;} } In the above class, if I want to set the default value for sex. is it ok? then, if I want to create new Person, is the following code good? Person p = new Person("mike'); String sex = p.getSex();
<java><constructor><default-value>
2016-03-03 21:35:05
LQ_EDIT
35,783,514
Append text to an HTML tag using javascript
<p>I am looking to use Jquery append to append text to a pre existing div element. I also want to have several element 'templates' and append more text into those elements (see snippet).</p> <pre class="lang-js prettyprint-override"><code>var template = { template1: "&lt;p class='someclass'&gt;&lt;/p&gt;" }, o = $('.divClass'); o.append(template.template1); // Append text inside P tag </code></pre>
<javascript><html>
2016-03-03 21:35:36
LQ_CLOSE
35,783,550
Undeclared Identifier in second function? (C++)
<p>I am having an issue with my C++ code. It keeps telling me Undeclared Identifier in the second function (the menu), but I cannot see the issue since I am passing the variable. The code is <a href="http://pastebin.com/5RvJz8pc" rel="nofollow">here</a></p>
<c++>
2016-03-03 21:37:24
LQ_CLOSE
35,783,718
PhpMailer SMTP NOTICE: EOF caught while checking if connected
<p>I got an issue with phpMailer, i can't send any e-mail, and it gives me this error:</p> <pre><code>2016-03-03 21:32:09 SERVER -&gt; CLIENT: 2016-03-03 21:32:09 SMTP NOTICE: EOF caught while checking if connected 2016-03-03 21:32:09 SMTP Error: Could not authenticate. 2016-03-03 21:32:09 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Erreur : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting </code></pre> <p>This is my code :</p> <pre><code>&lt;?php require('phpmailer/PHPMailerAutoload.php'); $mail = new PHPMailer(); $mail-&gt;IsSMTP(); $mail-&gt;Host = 'ssl://smtp.gmail.com'; $mail-&gt;SMTPAuth= true; $mail-&gt;Username='myadress@gmail.com'; $mail-&gt;Password='passwordgmail'; $mail-&gt;Port = 587; $mail-&gt;SMTPDebug = 2; $mail-&gt;SMTPSecure = 'ssl'; $mail-&gt;SetFrom('myadress@gmail.com', 'Name'); $mail-&gt;AddAddress('someone@gmail.com', 'HisName'); $mail-&gt;Subject = 'Subject'; $mail-&gt;Subject = "Here is the subject"; $mail-&gt;Body = "This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;"; $mail-&gt;AltBody = "This is the body in plain text for non-HTML mail clients"; if(!$mail-&gt;Send()) { echo 'Error : ' . $mail-&gt;ErrorInfo; } else { echo 'Ok!!'; } ?&gt; </code></pre> <p>I tried all the answers i found, but none of them worked so far. I also tried other ports, the 25 and 465 don't work and give me other errors. If someone could help me please it would be really nice =) . Thank you</p>
<php><phpmailer>
2016-03-03 21:48:45
HQ
35,783,719
Combining a string and user input in C
<p>I'm brand new to C, and I was wondering how to combine a string with a user's input. This is what I had, I'm not sure if the user input is correct though.</p> <pre><code>#include &lt;stdio.h&gt; int main () { int a; int input = scanf("%d", &amp;a); printf ("Hello, \n" + input); } </code></pre> <p>But this just asks for input, then prints to the terminal "Hello, ". Does anyone know how to fix this?</p>
<c>
2016-03-03 21:48:46
LQ_CLOSE
35,783,728
Is there a way to access and view html report in Travis CI for maven tests?
<p>Is there a way to access and view html report in Travis CI for maven testng tests ?</p> <p>At this moment, Travis CI logs is the only way I see how many tests passed/failed/skipped etc.</p> <p>Something like this: Tests run: 34, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 50.427 sec</p> <p>Results :</p> <p>Tests run: 34, Failures: 0, Errors: 0, Skipped: 0</p> <p>However there are surefire reports generated in this directory:</p> <p>[INFO] Surefire report directory: /home/travis/build/xxxx/yyyy/target/surefire-reports</p> <p>I want to access the surefire-reports/index.html file and view the results.</p> <p>Is this possible,could someone help?</p>
<continuous-integration><testng><maven-3><travis-ci>
2016-03-03 21:49:22
HQ
35,784,352
Intellij doesn't show .git directory
<p>How I can I get Intellij to show the .git folder in the project viewer? I tried ctrl+alt+A and clicked "show hidden files and directories", but it doesn't switch to the "on" position, so I suppose that's not the way of going about this?</p>
<intellij-idea>
2016-03-03 22:29:48
HQ
35,785,274
Cant get Object String value (Need to convert to String for Compare)
I want to check if the value does exist or not in JTree when trying to add node from Jtree. (the values does not match case i got object code not string) Here is the action code for calling existsInTable() try { DefaultMutableTreeNode selectedElement = (DefaultMutableTreeNode) TestTree.getSelectionPath().getLastPathComponent(); Object[] row = {selectedElement}; DefaultTableModel model = (DefaultTableModel) myTests_table.getModel(); if (selectedElement.isLeaf() == true && existsInTable(myTests_table, row) == false) { model.addRow(row); } else { JOptionPane.showMessageDialog(null, "Please Choose Test name!", "Error", JOptionPane.WARNING_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error"); } Here are the Check method public boolean existsInTable(JTable table, Object[] testname) { int row = table.getRowCount(); for (int i = 0; i < row; i++) { String str = ""; str = table.getValueAt(i, 0).toString(); if (testname.equals(str)) { System.out.println(str); JOptionPane.showMessageDialog(null, "data alreadyexist.", "message", JOptionPane.PLAIN_MESSAGE); return true; } } return false; }
<java><swing><object><jtable><jtree>
2016-03-03 23:39:14
LQ_EDIT
35,785,375
Iterate a dictionary and store value in array using Phython
I have a dictionary [{'abc':10,'efg':20,'def':30},{'abc':40,'xya':20,'def':50}] and I would like to create an array abc[] and store corresponding value in that array.so the output should look like abc[10,40] def[30,50] efg[20] and so on, using python.
<python><arrays><dictionary>
2016-03-03 23:47:53
LQ_EDIT
35,785,410
Cards with different sizes in Bootstrap 4 card-group
<p>Is it possible to mix card of different sizes within a card-group in Bootstrap 4. I want to have a large card (double width) on the left size, and two smaller cards on the right, with the same height of all three.</p> <pre><code>&lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div class="card-group"&gt; &lt;div class="card col-md-6"&gt; &lt;div class="card-block"&gt; &lt;h4 class="card-title"&gt;Card 1&lt;/h4&gt; &lt;p class="card-text"&gt;Text 1&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="card col-md-3"&gt; &lt;div class="card-block"&gt; &lt;h4 class="card-title"&gt;Card 2&lt;/h4&gt; &lt;p class="card-text"&gt;Text 2&lt;/p&gt; &lt;p class="card-text"&gt;More text 2&lt;/p&gt; &lt;p class="card-text"&gt;More text 2&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="card col-md-3"&gt; &lt;div class="card-block"&gt; &lt;h4 class="card-title"&gt;Card 3&lt;/h4&gt; &lt;p class="card-text"&gt;Text 3&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
<twitter-bootstrap><twitter-bootstrap-4><bootstrap-4>
2016-03-03 23:50:17
HQ
35,785,719
INC command in assemblxy x86
does the INC command used on registers increments by 1 byte or by 4 bytes? For example, first I set mov ecx,0. and then inc ecx. what does ecx hold? example number 2: esi holds an address in memory. What happens in this case? I think that in the first case is 4 bytes and in the second its 1 byte (because memory), am I right?
<assembly><x86>
2016-03-04 00:19:44
LQ_EDIT
35,786,124
Making second textbox"Required”(*) based upon “selected” value of Dropdown list
This is my dropdownlist <asp:DropDownList CssClass="DropDownForm" ID="PositionShift" runat="server"> <asp:ListItem Text="Please Select" Value="" /> <asp:ListItem Text="option1" Value="1" /> <asp:ListItem Text="option2" Value="2" /> <asp:ListItem Text="option3" Value="3" /> <asp:ListItem Text="option4" Value="4" /> <asp:ListItem Text="option5" Value="5" /> <asp:ListItem Text="option6" Value="6" /> <asp:ListItem Text="option7" Value="7" /> </asp:DropDownList> label <asp:Label ID="RequisitionNumberLabel" Text="Requisition Number" runat="server"></asp:Label> textbox <asp:TextBox ID="RequisitionNumberTextbox" runat="server" ></asp:TextBox> So, When ever user choose Option1, option5 , option6, then make RequisitionNumberTextbox as a required field with showing "*" on its label. Otherwise its not required and no need to show * on label. I found some related example but I cant figure out on my own.I was trying on Jquery Completely beginner.Thank you
<c#><jquery><asp.net>
2016-03-04 01:00:47
LQ_EDIT
35,787,368
How to split sentence on first space in Apache Spark?
I am new to Apache Spark, I have a file, where every sentences which has first 10 characters as a key and rest is a value, how do I apply spark on it to extract the first 10 characters of each sentence as a key and rest as a data, so in the end I get a [key,value] pair Rdd as a output.
<apache-spark><pyspark><apache-spark-sql><spark-streaming>
2016-03-04 03:22:06
LQ_EDIT
35,787,860
How to reorder columns gridview asp.net
<p>I create a dynamically gridview, but I want to insert the columns according to the alphabetical order of the headers. How do I do that? Help me.</p>
<c#><asp.net>
2016-03-04 04:13:11
LQ_CLOSE
35,788,863
How to convert STRING VALUE into an STRING VARIABLE
My question is suppose there is a String variable like String abc="Shini"; So is it possible to use 'Shini' as new variable name by some automatic means not by explicit typing. String abc="Shini"; String Shini="somevale";
<java>
2016-03-04 05:47:44
LQ_EDIT
35,790,017
what are mapping functions in c++?
<p>I have searched about mapping functions in n dimensional array but didn't find particular answer. I want to know that how multidimensional arrays works i c++? what is general formula for finding element at particular index in n dimensional array.?</p>
<c++>
2016-03-04 07:06:35
LQ_CLOSE
35,790,224
Matlab incorrect computation result
<p>I got a few Matlab code to play. But the answer is not correct:</p> <pre><code>x = linspace(-pi, pi, 10) sinc = @(x) sin(x) ./ x sinc(x) // wrong result occurs at here. </code></pre> <p>The expected result as below:</p> <pre><code>ans = Columns 1 through 6: 3.8982e-17 2.6306e-01 5.6425e-01 8.2699e-01 9.7982e-01 9.7982e-01 Columns 7 through 10: 8.2699e-01 5.6425e-01 2.6306e-01 3.8982e-17 </code></pre> <p>real result:</p> <pre><code>ans = Columns 1 through 3 0.000000000000000 0.263064408273866 0.564253278793615 Columns 4 through 6 0.826993343132688 0.979815536051016 0.979815536051016 Columns 7 through 9 0.826993343132688 0.564253278793615 0.263064408273866 Column 10 0.000000000000000 </code></pre> <p>details: My OS is arch linux, Matlab is downloaded through official website.</p> <p>matlab version is 2015b</p>
<matlab>
2016-03-04 07:19:34
LQ_CLOSE
35,790,321
php, simpleXML after clicking submit I want to come back to the same page using a relative path
This is 5 lines of what I have using an absolute path. this is part of a simpleXML parser in php <?php if (isset($_POST['lsr-submit'])) { header('Location: http://wft.com/customerentry.php'); } The problem is this is going to be on several servers so I need a relative path 'cusomerentry.php' I forgot how that's done...
<php><html><xml><redirect><http-headers>
2016-03-04 07:25:48
LQ_EDIT
35,791,134
objective c NSArray to NSString
Server side is java: First create a string 'Hello world.' for example, and then use java code to convert this string to be a byte array, then send to ios client. My ios client use NSStream to read the data, and got the array. Now I want to convert this array to be the string 'Hello world'. How to do that? I have tried to convert the array to nsdata and then to nsstring, but it fails. And also I try to convert the array to a string ,but it seems to convert the number in array to be a string number instead of my expected string 'Hello world'.
<ios><objective-c><nsarray><nsdata>
2016-03-04 08:19:40
LQ_EDIT
35,792,299
SQL I have to dipaly the digist 123.34 as 123.3400000000000 ie., 13 digit after the decimal point without loosing any values
Running query from Java code no chance to change the global preferences. I have to print 123.34 as 123.3400000000000 ie., 13 digit after the decimal point without loosing any values CAST(SUM(F.TOTAL_DOCUMENT_CHARS) AS DECIMAL(18,0))/1000 AS "DOC CHARS" by changing global preferences to default format getting 14891.4530000000000.., without that as well I need to get Expected output : 123.3400000000000
<sql><squirrel-sql>
2016-03-04 09:25:53
LQ_EDIT
35,792,775
how to upload image by below code
I am trying to upload image by the below code. I am getting the file name from input file field. if(isset($_REQUEST['requestsubmit'])){ $field_values_array1 = $_REQUEST['name']; $field_values_array2 = $_REQUEST['address']; $field_values_array3 = $_REQUEST['image']; print_r($field_values_array1); /*foreach($field_values_array as $k=>$value){}*/ foreach($field_values_array1 as $k=>$value1){} foreach($field_values_array2 as $k=>$value2){} foreach($field_values_array3 as $k=>$value3){ //your database query goes here $insert ="INSERT INTO `infotown_house`.`test` (`id`, `userName`, `cat`, `det`) VALUES (NULL, '".$field_values_array1[$k]."', '".$field_values_array2[$k]."', '".$field_values_array3[$k]."')"; mysql_query($insert);
<php><file-upload>
2016-03-04 09:48:24
LQ_EDIT
35,794,149
What does html mean
<p>what does it mean s <em>this</em>.</p> <p><strong>This is bold</strong>, just like <strong>this</strong>.</p> <p>You can <strong><em>combine</em></strong> them if you <strong><em>really have to</em></strong>.</p>
<yui>
2016-03-04 10:51:08
LQ_CLOSE
35,794,402
How to add class to multiple divs with same class, javascript?
<p>I have multiple classes with same class name, for example I have 10 classes that have class name test. I want to add new class, for example active, for each class.</p> <p>So if I have this:</p> <pre><code>&lt;div class="test"&gt;&lt;/div&gt; &lt;div class="test"&gt;&lt;/div&gt; &lt;div class="test"&gt;&lt;/div&gt; &lt;div class="test"&gt;&lt;/div&gt; </code></pre> <p>multiple times on page. How to add to each class active, so it looks like this</p> <pre><code>&lt;div class="test active"&gt;&lt;/div&gt; &lt;div class="test active"&gt;&lt;/div&gt; &lt;div class="test active"&gt;&lt;/div&gt; &lt;div class="test active"&gt;&lt;/div&gt; </code></pre>
<javascript><jquery>
2016-03-04 11:02:08
LQ_CLOSE
35,795,960
put different rows from file in one column in postgres
I have a file which has different rows and I want to put all the values in a table in postgre in one column. my file is like that: Houses Houses Palace Clock Bus Clock Sky Street Street Tower bell clock faced face sun tower stage underground palace Palace river and I want to have a table with just one column as tag ant put evrything in there! like this Houses Houses Palace Clock Bus
<sql><postgresql><file>
2016-03-04 12:22:07
LQ_EDIT
35,797,331
PHP CURL Post Fields is not working
<p>PHP curl post is not working..</p> <p>Here's my code </p> <pre><code> function post_to_url($url, $data) { $fields = ''; foreach($data as $key =&gt; $value) { $fields .= $key . '=' . $value . '&amp;'; } rtrim($fields, '&amp;'); $post = curl_init(); curl_setopt($post, CURLOPT_URL, $url); curl_setopt($post, CURLOPT_POST, count($data)); curl_setopt($post, CURLOPT_POSTFIELDS, $fields); curl_setopt($post, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($post); curl_close($post); } post_to_url("http://www.i-autosurf.com/signup.php",$data); </code></pre> <p>can you please checkout the error..</p> <p>is the code going wrong or is there anything different in website.</p>
<php><curl>
2016-03-04 13:29:39
LQ_CLOSE
35,797,609
I have it going in a complete loop and don't kn ow how to make it stop
my teacher asked us to create a magic 8 ball program in java 8. we have to use 3 methods, a main, a processing, and an output and we need to pass parameters between the methods. the output needs to use the switch statement, we need to have a while statement in there and the answers need to be randomly generated. I have everything required but when I try to run the program it is stuck in the while loop and I don't know what I did wrong. here is what I have: import java.util.*; public class Magic8Ball { public static void main(String[]args) { Scanner input = new Scanner(System.in); System.out.print("Would you like to ask a question? Y or N: "); char answer = input.next().charAt(0); char Y = Character.toUpperCase(answer); process(answer, Y); } public static void process(char a, char Yes) { if (a != Yes) { System.out.println("Thank you, goodbye."); } else { while(a==Yes) { System.out.print("Ask your question: "); Random random = new Random(); int ran = random.nextInt(8-1+1)+1; output(ran); } } } Public static int output(int r) { switch (r) { case 1: System.out.println("Out of memory, try again later); break; case 2: System.out.println("The probability matrix supports you."); break; case 3: System.out.println("That does not compute."); break; case 4: System.out.println("System error, try again later"); break; case 5: System.out.println("Siri says yes."); break; case 6: System.out.println("The asnwer could not be found on the internet."); break; case 7: System.out.println("Wikilinks claims it is true."); break; case 8: System.out.println("Siri says no."); break; default: System.out.println("The system is not responding, try again later"); break; } return r; } }
<java>
2016-03-04 13:42:56
LQ_EDIT
35,797,969
HTML (php) how to check uncheck checkbox all at the same time
All I want is to check / uncheck all of the choices with one check button. <!DOCTYPE html> <html> <body> <form action="process.php" method="post"> <p> Select pet: </p> <p> <input type="checkbox" name="dog" value="dog"> Dog </p> <p> <input type="checkbox" name="cat" value="cat"> Cat </p> <p> <input type="checkbox" name="bird" value="Tbird"> Bird </p> <p> <input type="checkbox" name="checkall" value="checkall"> All </p> </body> </html> what code / codes am I missing? I need "All" to uncheck / check all choices if it is chosen by the user. I use xampp for this one. Thank you
<javascript><html>
2016-03-04 14:00:59
LQ_EDIT
35,799,284
How to switch from Second form to Main form but not create new Main form?
I know how to switch form to form, but problem is when switch from Second form to main form. It always create a new Main form. How to avoid this? (If not my app will replace a lots of Ram). Bad English!
<c#><winforms><instance>
2016-03-04 15:06:15
LQ_EDIT
35,800,087
android setText STOPPİNG ERROR
Ben dairenin alanını hesaplamak istiyorum ve sonucu textView yazdır.Ama hata veriyor.I'm sorry for my bad english public void hesapla1(View v){ double pi = 3.14; double yari = R.id.e1; double alan = pi * Math.pow(yari,2); Log.e("a","Buraya kadar geldi"); sonuc1.setText((int) alan); //Mantık Kuramıyorum }
<android><settext>
2016-03-04 15:42:04
LQ_EDIT
35,800,521
Add another user for remote access Windows 10
<p>So, I created remote access from my lap top to server(Windows 10). Now, how can I add more users, so they can log in from their lap tops with their microsoft accounts or whatever accounts they have?</p>
<authentication><windows-10><remote-access><remote-desktop>
2016-03-04 16:01:20
LQ_CLOSE
35,800,649
Js comparison of between hours
In my app i want to determine if `hour:minute one` is biger than 21:00h and `hour:minute two` is lesser than 08:00 Am using 24h format for this. var one = "21:30"; var two = "09:51"; To get just hour from hour and minuts i use `split()`. var h_1 = one.split(":"); //21 var h_2 = two.split(":"); // 08 if(h1 > "21" && h2 < "08") { // do somthing } The real story for app is : Shop has option for delivery out of working time. Working hours start at "08:00" - "21:00". If a customer wants to buy out of hours `do somthing` So how this my example has problem and not work properly. Any better example to compare just hour and minutes between two h:m.
<javascript><time>
2016-03-04 16:07:33
LQ_EDIT
35,800,777
Why is java telling me the string are not matching?
<p>I'm reading in from a text file. every time the frame number changes I need to check if the ipv6 address is changed. every time I compare the strings it tells me they don't match even after setting the value to the source address.</p>
<java>
2016-03-04 16:12:55
LQ_CLOSE
35,800,814
Insert buttons on a picture on mouse hover and image darken
<p>I want the image to be darkened a little bit when the mouse is hovered on it (Overlay?). Then, the buttons like in the picture should appear when hover, then if mouse is hovered on one button, it should turn to red (just like picture), and image description text should appear under the buttons (as the picture), then if one button is clicked it should take us to a new URL (Say, if the button is clicked, it takes us to the www.google.com), can anyone provide any code? I have no idea how to do that.</p> <p><a href="https://i.stack.imgur.com/VE7dR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VE7dR.png" alt="enter image description here"></a></p>
<jquery><html><css><hover>
2016-03-04 16:14:42
LQ_CLOSE
35,801,272
How to make a date vector be ordered so it starts with the earliist date first?
<p>I'm pretty new to r but picking it up gradually. My question is, I want to make my date vector start from the earliest date rather from the newest. I have about 50 odd rows and want it in order of earliest first. </p> <p>head(dates1) [1] "2016-03-04" "2016-02-26" "2016-02-19" "2016-02-12" "2016-02-05" "2016-01-29"</p> <p>I've tried order() but it gives back numeric values, I want to keep them as dates. </p> <p>Thanks if you can help.</p>
<r><date><time>
2016-03-04 16:35:13
LQ_CLOSE
35,801,954
Remove all numbers which are lower than 15 using preg_replace
<p>I'm trying to remove numbers which are lower than '15' using preg_replace for example: <code>$string = '1 20 5 16 11 15 14';</code> I'm expecting the output after preg_replace to be <code>20 16 15</code> How to do that :)</p>
<php><regex><preg-replace>
2016-03-04 17:09:15
LQ_CLOSE
35,802,173
Why does C# have 'readonly' and 'const'?
<p>I come from a C++ background and am trying to become proficient in C#. It seems like C# always has 2 types of modifiers wherever C++ had one. For example, in C++ there is <code>&amp;</code> for references and then in C# there is <code>ref</code> and <code>out</code> and I have to learn the subtle differences between them. Same with <code>readonly</code> and <code>const</code>, which are the topic of this thread. Can someone explain to me what the subtle differences are between the 2? Maybe show me a situation where I accidentally use the wrong one and my code breaks. </p>
<c#><.net>
2016-03-04 17:19:29
LQ_CLOSE
35,802,176
Fixing Disappearing Zeros
<p>I wanted to divide the integer and store it in an array</p> <p>For Ex:1000000000000 into two indexes</p> <p>arr[0]=1000000 arr[1]=000000</p> <p>but arr[1] stores it as 0 instead of 0000000.</p> <p>I wanted to perform some operations with it,so i needed 7 zeros in it ,instead of 1 zero.</p> <p>Is it achievable in some way ?</p>
<java>
2016-03-04 17:19:39
LQ_CLOSE
35,803,703
custom nearbuy places using google places api
<p>I got this from internet. </p> <pre><code>// &lt;script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;libraries=places"&gt; var map; var infowindow; function initMap() { var pyrmont = {lat: -33.867, lng: 151.195}; map = new google.maps.Map(document.getElementById('map'), { center: pyrmont, zoom: 15 }); infowindow = new google.maps.InfoWindow(); var service = new google.maps.places.PlacesService(map); service.nearbySearch({ location: pyrmont, radius: 500, type: ['store'] }, callback); } function callback(results, status) { if (status === google.maps.places.PlacesServiceStatus.OK) { for (var i = 0; i &lt; results.length; i++) { createMarker(results[i]); } } } function createMarker(place) { var placeLoc = place.geometry.location; var marker = new google.maps.Marker({ map: map, position: place.geometry.location }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(place.name); infowindow.open(map, this); }); } </code></pre> <p>How can I search for custom locations like CVS pharmacies instead stores, withing 5 miles of radius? Also can you provide reference about full set of properties of nearby Search?</p>
<javascript><google-maps><google-places-api>
2016-03-04 18:43:41
LQ_CLOSE
35,804,230
How do I display array object information?
<pre><code> &lt;html&gt; &lt;head&gt; &lt;script&gt; var contacts =[]; function getInfo() { var firstName = prompt("Enter first name"); var lastName = prompt("Enter last name"); var emailId = prompt("Enter Email ID"); var phoneNo = prompt("Enter Phone number"); var person ={ fname : firstName, lname : lastName, email : emailId, phone : phoneNo }; contacts.push(person); var currPerson = contacts[contacts.length-1]; //take last pushed object from the array if(currPerson.lname.toUpperCase().charAt(0)==='Z'){ document.getElementById("mydiv").innerHTML +=currPerson.fname+" "+currPerson.lname + '&lt;br/&gt;'; } } &lt;/script&gt; &lt;body&gt; &lt;button onclick="getInfo()"&gt;Get Person Info&lt;/button&gt; &lt;p&gt;----------------------------&lt;/p&gt; &lt;div id="mydiv"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><a href="https://i.stack.imgur.com/WYv2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WYv2a.png" alt="Output"></a></p> <blockquote> <p>When I click on billa zopper, his <strong>details(full name,phone and email)</strong> should appear on right hand side in the same page. How do I achieve this? I know DOM is an option. But how do I link the DOM with the array elements? </p> </blockquote>
<javascript><arrays><dom>
2016-03-04 19:12:31
LQ_CLOSE
35,805,474
UUID primary key in Eloquent model is stored as uuid but returns as 0
<p>I have a mysql table in which I'm using a UUID as the primary key. Here's the creation migration:</p> <pre><code>Schema::create('people', function (Blueprint $table) { $table-&gt;uuid('id'); $table-&gt;primary('id'); ... $table-&gt;timestamps(); } </code></pre> <p>Which generates the following MySQL schema:</p> <pre><code>CREATE TABLE `people` ( `id` char(36) COLLATE utf8_unicode_ci NOT NULL, ... `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; </code></pre> <p>In my Eloquent model I have a method for creating an instance which calls a method for generating the UUID:</p> <pre><code>class Person extends Model { protected $fillable = [ ... ]; public function make(array $personData){ $person = new Person; $person-&gt;setUUID(); collect($personData)-&gt;each(function ($value, $columnName) use($person){ if(in_array($columnName, $this-&gt;fillable)){ $person-&gt;{$columnName} = $value; } }); $person-&gt;save(); return $person; } protected function setUUID(){ $this-&gt;id = preg_replace('/\./', '', uniqid('bpm', true)); } } </code></pre> <p>When I create a new model instance it stores it fine in the database:</p> <p><a href="https://i.stack.imgur.com/ZMQ2V.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZMQ2V.png" alt="uuids stored"></a></p> <p>But when I try to access the new instance's id:</p> <p><a href="https://i.stack.imgur.com/CVvHU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CVvHU.png" alt="creating new instance and dumping id"></a></p> <p>It returns as 0:</p> <p><a href="https://i.stack.imgur.com/wr0or.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wr0or.png" alt="returned result"></a></p> <p>What am I missing here?</p>
<laravel><eloquent><uuid>
2016-03-04 20:29:42
HQ
35,806,570
i want to get css/html/js codes without many files
<p>I have a found an amazing slider which you can see in this link <a href="http://flexslider.woothemes.com/basic-carousel.html" rel="nofollow">http://flexslider.woothemes.com/basic-carousel.html</a></p> <p>i've downloaded it, but there is a lot of files i just want the codes to use it directly for example css code html code js code</p> <p>like in jsffiddle</p> <p>Thanks guys</p>
<html><css>
2016-03-04 21:42:10
LQ_CLOSE
35,808,106
How can I manually read/write a PNG image file in C#?
There are already lots of classes and functions supplied with the .NET to manipulate Images including PNG. Like [Image, Bitmap, etc. classes][1]. But, if I want to manually read/write a PNG image as a binary file, what should I do? Where should I start? [1]: http://stackoverflow.com/questions/100247/reading-a-png-image-file-in-net-2-0
<.net><image><bitmap><png><c#-2.0>
2016-03-04 23:45:07
LQ_EDIT
35,808,242
How to pass parameters into a SPARQL query
<p>How do I pass var1 and var2 into the sparql query shown below. I have the code below but its not returning anything. </p> <p>I appreciate your help on this. Thank you in adavnce</p> <pre><code>string var1, var2; var1 = DropDownList1.SelectedValue.ToString(); var2 = DropDownList2.SelectedValue.ToString(); //Load first listbox private const string loadlist1 = @" PREFIX au: &lt;http://semwebowl.somee.com/au/n3_notation#&gt; SELECT DISTINCT ?ResearchArea WHERE { [a au:var1; au:ResearchArea var2; au:ResearchArea ?ResearchArea]. }"; </code></pre>
<c#><sparql><dotnetrdf>
2016-03-05 00:00:02
LQ_CLOSE
35,809,545
Fatal Exception: Invalid index 0,out of 0
<p>I'm trying to retrieve the json data with JsonArrayRequest and then add it to a list. Here's my code</p> <pre><code>public class QuestionDetailFragment extends Fragment { RecyclerView cRecyclerView; private static final String url = "http://10.0.2.2:80/forumtest/readquestion.php?format=json"; private List&lt;String&gt; userList = new ArrayList&lt;&gt;(); RequestQueue requestQueue; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.question_details_layout, container, false); readQuestionDetails(); Log.d("check", "data:" + userList.get(0)); return view; } private void readQuestionDetails() { Log.d("Volley", "Called222!"); requestQueue = Volley.newRequestQueue(getActivity().getApplicationContext()); JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.POST, url, new Response.Listener&lt;JSONArray&gt;() { @Override public void onResponse(JSONArray response) { try { for (int i=0;i&lt;response.length();i++) { JSONObject jsonObject = response.getJSONObject(i); userList.add(jsonObject.getString("user")); } } catch (JSONException e) { e.printStackTrace(); Log.e("tag",e.getMessage()); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("Volley", error.getMessage()); } }); requestQueue.add(jsonArrayRequest); } } </code></pre> <p>I've used <strong><em>Log.d("user`,"data:",user.get(0));</em></strong> just to make sure that the data has been added to the list. This is my logcat after running the code</p> <pre><code> 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: FATAL EXCEPTION: main 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: Process: com.rekoj.softwarica, PID: 2767 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at java.util.ArrayList.get(ArrayList.java:308) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at com.rekoj.softwarica.Forum.QuestionDetailFragment.onCreateView(QuestionDetailFragment.java:50) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 03-08 20:45:25.750 2767-2767/com.rekoj.softwarica E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 03-08 20:50:25.802 2767-2767/? I/Process: Sending signal. PID: 2767 SIG: 9 </code></pre>
<android><json>
2016-03-05 03:14:46
LQ_CLOSE
35,810,595
How could I know if my integer array contains characters?
for example my array contains elements like 56,12,ew34,45 or 56,12,34rt,45 how can I show that the array is not integer array?
<c>
2016-03-05 05:47:12
LQ_EDIT
35,810,773
Click function now working as when called from a function
I had function as below being called when I click on a radio button "foo" and it works as expected when I clicked $("#foo").live("click",function() { if ($('input:radio[name=foo]:checked').val() == 'foo') { $.each(oneArray, function(key,value){ $("#foo1").append($("<option></option>") .attr("value",key) .text(value)); }); $.each(twoArray, function(key,value){ $("#foo2").append($("<option></option>") .attr("value",key) .text(value)); }); } }); But it didn't worked when i did the following checkFoo(){ $("#foo").click(); } Please correct me if I am doing anything wrong .
<javascript><jquery><javascript-events>
2016-03-05 06:10:10
LQ_EDIT
35,811,041
How to make the title bar, minimize button and maximize button invisible on a web browser page in javascript?
I am doing a project on an online examination site. I wanted to make the title bar, minimize button and windows taskbar of the browser invisible when a candidate is clicking to attend the exam. Does anyone know how to do this ?
<javascript><php>
2016-03-05 06:44:39
LQ_EDIT
35,811,155
how to make structs point to different strings ?
I have a struct and in that a struct i have a character pointer but and i am creating different instances of this struct but when i am changing the pointer in one struct the other is also changing. #include <stdio.h> #include <stdlib.h> typedef struct human{ int age; char* name; }Human; int main(){ Human h; FILE *s = fopen("h.txt","r"); if(s==NULL){ printf("dsdfsf"); } fscanf(s,"%d",&h.age); fscanf(s,"%s",h.name); // add h to linked list // repeat all this code 10 times to fill linked list by 10 humans return 0; } what is happening that all humans in the linked list have different ages but same name!
<c><pointers><struct><linked-list>
2016-03-05 06:57:50
LQ_EDIT
35,811,774
Create Json in jquery
i need create json code in each loop for read my input data like this but i I do not know. { "element1": { "type": "text", "id": "1" }, "element2": { "type": "text", "id": "1" }, "element3": { "type": "text", "id": "1" } }
<arrays><json>
2016-03-05 08:14:11
LQ_EDIT
35,812,020
removing space in between photos
<p>I want to remove all the space (padding if any) in between 4 photos and to be in full width of the browser without space. I tried many things including setting the padding to 0 but, I got success to a certain extent, still I get tiny white space between photos. Do anyone have idea what this white space occurs even when padding is set to 0.</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html lang="en" class="no-js"&gt; &lt;head&gt; &lt;script&gt; /* Modernizr 2.6.2 (Custom Build) | MIT &amp; BSD * Build: http://modernizr.com/download/#-touch-shiv-cssclasses-teststyles-prefixes-load */ ;window.Modernizr=function(a,b,c){function w(a){j.cssText=a}function x(a,b){return w(m.join(a+";")+(b||""))}function y(a,b){return typeof a===b}function z(a,b){return!!~(""+a).indexOf(b)}function A(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:y(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&amp;#173;",'&lt;style id="s',h,'"&gt;',a,"&lt;/style&gt;"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},u={}.hasOwnProperty,v;!y(u,"undefined")&amp;&amp;!y(u.call,"undefined")?v=function(a,b){return u.call(a,b)}:v=function(a,b){return b in a&amp;&amp;y(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&amp;&amp;b instanceof DocumentTouch?c=!0:t(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c};for(var B in n)v(n,B)&amp;&amp;(s=B.toLowerCase(),e[s]=n[B](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)v(a,d)&amp;&amp;e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&amp;&amp;f&amp;&amp;(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},w(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x&lt;style&gt;"+b+"&lt;/style&gt;",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&amp;&amp;!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e&lt;g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&amp;&amp;("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&amp;&amp;!f&amp;&amp;!c.hasCSS&amp;&amp;(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^&lt;|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="&lt;xyz&gt;&lt;/xyz&gt;",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e.testStyles=t,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&amp;&amp;g(l.readyState)&amp;&amp;(u.r=o=1,!q&amp;&amp;h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&amp;&amp;m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&amp;&amp;y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&amp;&amp;(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&amp;&amp;(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&amp;&amp;h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&amp;&amp;!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&amp;&amp;"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&amp;&amp;!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&amp;&amp;(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f&lt;d;f++)g=a[f].split("="),(e=z[g.shift()])&amp;&amp;(c=e(c,g));for(f=0;f&lt;b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&amp;&amp;(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&amp;&amp;"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&amp;&amp;f.load(function(){k(),e&amp;&amp;e(i.origUrl,h,g),j&amp;&amp;j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&amp;&amp;b++;return b}(),a)a.hasOwnProperty(n)&amp;&amp;(!c&amp;&amp;!--m&amp;&amp;(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&amp;&amp;a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&amp;&amp;l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&amp;&amp;c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i&lt;a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&amp;&amp;h(j,l);else Object(a)===a&amp;&amp;h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&amp;&amp;b.addEventListener&amp;&amp;(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&amp;&amp;g(k.readyState)&amp;&amp;(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))}; &lt;/script&gt; &lt;style type="text/css"&gt; /* */ .grid { /* padding: 20px 20px 100px 20px;*/ padding: 0px 0px 0px 0px; /*max-width: 1300px;*/ max-width: 100%; /* margin: 0 auto; */ margin: 0px 0px 0px 0px; !important list-style: none; text-align: center; } .grid li { display: inline-block; width: 24.75%; margin: 0px 0px 0px 0px; padding: 0px; text-align: left; position: relative; } .grid figure { margin: 0; position: relative; } .grid figure img { max-width: 100%; display: block; position: relative; } .grid figcaption { position: absolute; top: 0; left: 0; padding: 20px; background: #2c3f52; color: #ed4e6e; } .grid figcaption h3 { margin: 0; padding: 0; color: #fff; } .grid figcaption span:before { content: 'by '; } .grid figcaption a { text-align: center; padding: 5px 10px; border-radius: 2px; display: inline-block; background: #ed4e6e; color: #fff; } /* Caption Style 4 */ .cs-style-4 li { -webkit-perspective: 1700px; -moz-perspective: 1700px; perspective: 1700px; -webkit-perspective-origin: 0 50%; -moz-perspective-origin: 0 50%; perspective-origin: 0 50%; } .cs-style-4 figure { -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; } .cs-style-4 figure &gt; div { overflow: hidden; } .cs-style-4 figure img { -webkit-transition: -webkit-transform 0.4s; -moz-transition: -moz-transform 0.4s; transition: transform 0.4s; } .no-touch .cs-style-4 figure:hover img, .cs-style-4 figure.cs-hover img { -webkit-transform: translateX(25%); -moz-transform: translateX(25%); -ms-transform: translateX(25%); transform: translateX(25%); } .cs-style-4 figcaption { height: 100%; width: 50%; opacity: 0; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform-origin: 0 0; -moz-transform-origin: 0 0; transform-origin: 0 0; -webkit-transform: rotateY(-90deg); -moz-transform: rotateY(-90deg); transform: rotateY(-90deg); -webkit-transition: -webkit-transform 0.4s, opacity 0.1s 0.3s; -moz-transition: -moz-transform 0.4s, opacity 0.1s 0.3s; transition: transform 0.4s, opacity 0.1s 0.3s; } .no-touch .cs-style-4 figure:hover figcaption, .cs-style-4 figure.cs-hover figcaption { opacity: 1; -webkit-transform: rotateY(0deg); -moz-transform: rotateY(0deg); transform: rotateY(0deg); -webkit-transition: -webkit-transform 0.4s, opacity 0.1s; -moz-transition: -moz-transform 0.4s, opacity 0.1s; transition: transform 0.4s, opacity 0.1s; } .cs-style-4 figcaption a { position: absolute; bottom: 20px; right: 20px; } @media screen and (max-width: 31.5em) { .grid { /*padding: 10px 10px 100px 10px;*/ padding: 0px 0px 0px 0px; } .grid li { width: 100%; min-width: 300px; } } *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body, html { font-size: 100%; padding: 0; margin: 0;} /* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container demo-3"&gt; &lt;ul class="grid cs-style-4"&gt; &lt;li&gt; &lt;figure&gt; &lt;div&gt;&lt;img src="images/5.png" alt="img05"&gt;&lt;/div&gt; &lt;figcaption&gt; &lt;h3&gt;Safari&lt;/h3&gt; &lt;span&gt;Jacob Cummings&lt;/span&gt; &lt;a href="http://dribbble.com/shots/1116775-Safari"&gt;Take a look&lt;/a&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;/li&gt; &lt;li&gt; &lt;figure&gt; &lt;div&gt;&lt;img src="images/6.png" alt="img06"&gt;&lt;/div&gt; &lt;figcaption&gt; &lt;h3&gt;Game Center&lt;/h3&gt; &lt;span&gt;Jacob Cummings&lt;/span&gt; &lt;a href="http://dribbble.com/shots/1118904-Game-Center"&gt;Take a look&lt;/a&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;/li&gt; &lt;li&gt; &lt;figure&gt; &lt;div&gt;&lt;img src="images/2.png" alt="img02"&gt;&lt;/div&gt; &lt;figcaption&gt; &lt;h3&gt;Music&lt;/h3&gt; &lt;span&gt;Jacob Cummings&lt;/span&gt; &lt;a href="http://dribbble.com/shots/1115960-Music"&gt;Take a look&lt;/a&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;/li&gt; &lt;li&gt; &lt;figure&gt; &lt;div&gt;&lt;img src="images/4.png" alt="img04"&gt;&lt;/div&gt; &lt;figcaption&gt; &lt;h3&gt;Settings&lt;/h3&gt; &lt;span&gt;Jacob Cummings&lt;/span&gt; &lt;a href="http://dribbble.com/shots/1116685-Settings"&gt;Take a look&lt;/a&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- /container --&gt; &lt;script&gt; /** Used Only For Touch Devices **/ ( function( window ) { // for touch devices: add class cs-hover to the figures when touching the items if( Modernizr.touch ) { // classie.js https://github.com/desandro/classie/blob/master/classie.js // class helper functions from bonzo https://github.com/ded/bonzo function classReg( className ) { return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); } // classList support for class management // altho to be fair, the api sucks because it won't accept multiple classes at once var hasClass, addClass, removeClass; if ( 'classList' in document.documentElement ) { hasClass = function( elem, c ) { return elem.classList.contains( c ); }; addClass = function( elem, c ) { elem.classList.add( c ); }; removeClass = function( elem, c ) { elem.classList.remove( c ); }; } else { hasClass = function( elem, c ) { return classReg( c ).test( elem.className ); }; addClass = function( elem, c ) { if ( !hasClass( elem, c ) ) { elem.className = elem.className + ' ' + c; } }; removeClass = function( elem, c ) { elem.className = elem.className.replace( classReg( c ), ' ' ); }; } function toggleClass( elem, c ) { var fn = hasClass( elem, c ) ? removeClass : addClass; fn( elem, c ); } var classie = { // full names hasClass: hasClass, addClass: addClass, removeClass: removeClass, toggleClass: toggleClass, // short names has: hasClass, add: addClass, remove: removeClass, toggle: toggleClass }; // transport if ( typeof define === 'function' &amp;&amp; define.amd ) { // AMD define( classie ); } else { // browser global window.classie = classie; } [].slice.call( document.querySelectorAll( 'ul.grid &gt; li &gt; figure' ) ).forEach( function( el, i ) { el.querySelector( 'figcaption &gt; a' ).addEventListener( 'touchstart', function(e) { e.stopPropagation(); }, false ); el.addEventListener( 'touchstart', function(e) { classie.toggle( this, 'cs-hover' ); }, false ); } ); } })( window ); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
<html><css>
2016-03-05 08:44:22
LQ_CLOSE
35,812,060
C language_Error:expected ')' before ';' token
<p>Just in case you need to know what the program I'm working on -It's a homework question:A five-digit number is entered through the keyboard. Write a function to obtain the reversed number and another function to determine whether the original and reversed numbers are equal or not. Use this functions inside the main() and provide the necessary arguments to get a result.</p> <p>My code is:</p> <pre><code>#include &lt;stdio.h&gt; int Reversed(int rev); int Equality(int equ); int main (){ int num,result; printf("Please enter a number that has five digits:"); scanf("%d", &amp;num); result=Equality(num); return 0; } int Reversed(int num){ int number=num; int rev=0; int digit; do{ digit=num%10; rev=rev*10+digit; num=num/10; } while ((num&gt;0)); return rev; } int Equality(num){ int reve,numb; if ( (numb=num)== (reve=Reversed(num);) ) printf("number equals the reversed number"); else printf("number doesn't equal the reversed number"); } </code></pre>
<c><token>
2016-03-05 08:48:52
LQ_CLOSE
35,812,829
PHP convert date to DD-M-YY
<p>I'm trying to validate a date like 17-JAN-1985 in my code.</p> <p>Here is the function I'm using:</p> <pre><code>function fncDate($date){ $d = DateTime::createFromFormat('DD-M-YY', $date); $result = $d &amp;&amp; $d-&gt;format('DD-M-YY') == $date; if(!$result){ return "Date should be in the following format: DD-MMM-YYYY"; } } </code></pre> <p>This returns always false: <code>fncDate("17-JAN-1985");</code></p> <p>Am I doing something wrong?</p> <p>Thanks</p>
<php><date>
2016-03-05 10:14:03
LQ_CLOSE
35,813,027
Logback is not writing specific log file on the CentOS Linux server
I am using Logback API to log java based application and giving following path to create files, but on VPS server it's not creating file. Same config is working fine on my local machine. Please check if you can help, Is this issue related to folder and file write permission. I have given chmod 777 permission to the following log folder, but still no luck. Please help. /root/apps/myservice/logs
<maven><tomcat><logback>
2016-03-05 10:35:51
LQ_EDIT
35,813,320
How to store multiple product under one shop? How to manage certain situation in Mysql
<p>I guys, i'm working on a e-commerce website where in, Mysql i got two tables. Products and Shops now i have condition where, i need to add Multiple product under one shop in my shop table. i'm confused how to figure out this thing. please give soltion or atleast Table structure so that, i can implement according to that. i need table colum structure thank you.</p>
<php><mysql><sql><database>
2016-03-05 11:07:07
LQ_CLOSE
35,813,374
I need to export my table datas to .csv file using codeignitor
I am using codeignitor, I have listed records from a table. I want to download all the records to excel. I have used PHPExcel library but it was not supporting. Could you please help to how to achieve it.
<mysql><excel><codeigniter><export><phpexcel>
2016-03-05 11:12:47
LQ_EDIT
35,813,729
PHP connect to DB and check URLs
I try to build a PHP function to check if some URLs are still working of have expired. I managed to connect to my database, retrieve the list of URLs to check and use a check function I found on stackoverflow. However I have problems loop through all the URLs and write back the results to the database. Would be great if someone can help on that part in the end ("define URL" should loop through the list and "output" should write back the echo into the table). Here the php <?php //DB Credentials $servername = "localhost"; $username = "root"; $password = "password"; $dbname = "dbname"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //Retrieve list of URLs to check $sql = "SELECT product_id, link FROM link_check"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo "id: " . $row["product_id"]. " " . $row["link"]. "<br>"; } } else { echo "0 results"; } //Function to check URLs function check_url($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $headers = curl_getinfo($ch); curl_close($ch); return $headers['http_code']; } //Define URLs $sql = "SELECT link FROM link_check"; $url = $conn->query($sql); //Output $check_url_status = check_url($url); if ($check_url_status == '200') echo "Link Works"; else echo "Broken Link"; $conn->close(); ?> This question is related to this old post: [Check Link URL][1] [1]: http://stackoverflow.com/questions/15770903/check-if-links-are-broken-in-php
<php><mysql>
2016-03-05 11:48:57
LQ_EDIT
35,814,515
how to start an activity from the marker on Google map api?
<p>i ve tried to search on Google but i coulnt find the exact solution. how can i start another activity from the marker on map ? i want to click the marker and move to another activity. </p> <p>here is my code ,</p> <pre><code>public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, GoogleMap.OnMapLongClickListener { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setOnMapLongClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.hava_durumu, menu); return true; } @Override public void onMapLongClick(LatLng point) { mMap.addMarker(new MarkerOptions() .position(point) .title("You are here") .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))); } } </code></pre>
<android><google-maps>
2016-03-05 13:07:31
LQ_CLOSE
35,814,676
possible help me again to get a percentage of the result also of the total number of bills
possible help me again to get a percentage of the result also of the total number of bills this code is calc number of order SELECT COUNT(*) FROM ( SELECT id FROM OrderDetails WHERE Product IN ('p1','p9') GROUP BY id HAVING COUNT(DISTINCT Product) = 2) AS t you can understand me if read it : http://stackoverflow.com/questions/35781468/how-to-select-two-products-where-it-is-in-same-orderdetails
<sql><sql-server><sql-server-2008><sql-server-2012>
2016-03-05 13:21:43
LQ_EDIT
35,814,730
Postfix notation stack C++
<p>I am new to C++ and I want to use a stack to evaluate an expression given as an input (2+3*5+4 for example), containing only numbers, + and *. I wrote this code but it gives me Segmentation fault: 11. Could you please help me solve this or give me a hint about what could be wrong? Thank you! (I noticed there were similar questions on this site, but I couldn't use them to solve my problem)</p> <pre><code>#include &lt;iostream&gt; #include &lt;stack&gt; using namespace std; bool highPrecedence(char a, char b){ if((a=='+')&amp;&amp;(b=='*')) return true; return false; } int main() { char c = 'a'; double x; stack&lt;char&gt; stack; double v[10]; int i=0; double res; while(true) { c = cin.get(); if(c=='\n'){ while(stack.size()!=0){ if (stack.top()=='*'){ double res = v[i]*v[i-1]; i--; v[i]=res; stack.pop(); } if (stack.top()=='+'){ res = v[i]+v[i-1]; i--; v[i]=res; stack.pop(); } } break; } if ( '0'&lt;=c &amp;&amp; c&lt;='9' ) { cin.putback(c); cin&gt;&gt;x; cout&lt;&lt;"Operand "&lt;&lt;x&lt;&lt;endl; i=i+1; v[i]=x; } else { if(c!=' ') cout&lt;&lt; "Operator " &lt;&lt;c&lt;&lt;endl; if (stack.size()==0) stack.push(c); else{ while((!highPrecedence(stack.top(),c)) &amp;&amp; (stack.size()!=0)){ if (stack.top()=='*'){ double res = v[i]*v[i-1]; i--; v[i]=res; stack.pop(); } if (stack.top()=='+'){ res = v[i]+v[i-1]; i--; v[i]=res; stack.pop(); } } stack.push(c); } } } cout&lt;&lt;v[0]&lt;&lt;endl; } </code></pre>
<c++><stack>
2016-03-05 13:26:30
LQ_CLOSE
35,815,179
Express Repeating jquery codes into looping
<p>Recently i was working with the UX of forms someting like login and registration form for just inspiration.I just coded in a row format without applying any logic to shorten it.</p> <h2>Below is how i coded :</h2> <pre><code>$('.form-content.minimized a').click(function(event) { event.preventDefault(); $('.form-content.minimized').addClass('first_step', setTimeout(function(){ $('.form-content.minimized').addClass('second_step', setTimeout(function(){ $('.form-content.minimized').addClass('third_step', setTimeout(function(){ $('.form-content.minimized').addClass('fourth_step', setTimeout(function(){ $('.form-content.minimized').addClass('fifth_step ' + fifth_step , setTimeout(function(){ $('.form-content.minimized').addClass('opened'); }, 100) ) }, 600) ); }, 400) ); }, 200) ); }, 200) ); }); </code></pre> <p>Here we can see there is happening something with stepping like staircase. <code>first_step</code> , <code>second_step</code> ..... And also a time interval is happening between every steps.</p> <p>What about if we do something like <code>i=0</code> , <code>i++</code>, <code>i&lt;= something</code> in a loop.Then i think it would be more readable and maintainable. </p>
<javascript><jquery><html><css>
2016-03-05 14:16:18
LQ_CLOSE
35,815,928
Why can't I declare a thread in an if in C++? Is there a way around?
<p>I am trying to use threading in an if statement. </p> <p>The following code gives an error saying t1 in t1.join is not declared in this scope. Is there a way to make the loop skip the first thread operation and start multithreading for the other passes?</p> <pre><code> #include &lt;thread&gt; void someFunction() {/*someTask*/} void main() { bool isFirstRun = true; while(true){ if(isFirstRun==false){std::thread t1(someFunction);} //some long task if(isFirstRun==false){t1.join} if(isFirstRun){isFirstRun = false;} } } </code></pre> <p>More generally, is there a way to create a thread like a global variable in C++ and control its execution anywhere in the code? I saw the following in java and thought this might solve my problem if implemented in C++:</p> <pre><code>Thread t1 = new Thread(new EventThread("e1")); //some tasks here t1.start(); //some tasks here t1.join(); </code></pre>
<c++><multithreading>
2016-03-05 15:29:30
LQ_CLOSE
35,817,068
integrate ng2Material by NPM
I have a problem trying to integrate Angular2 with ng2Material. I get show small buttons with the Material style but i dont know why when i click over the buttons, i can see the effect over buttons click. If somebody can help me please, this is really urgent. I prepare a github url You must just make: 1) npm install 2) bower install 3) npm run go [Github project][1] [1]: https://github.com/webdeveloperfront/ng2Material_Angular2
<angular><angular-material>
2016-03-05 17:06:17
LQ_EDIT
35,817,239
Dependency injection with abstract class and object in Play Framework 2.5
<p>I'm trying to migrate from Play 2.4 to 2.5 avoiding deprecated stuff.</p> <p>I had an <code>abstract class Microservice</code> from which I created some objects. Some functions of the <code>Microservice</code> class used <code>play.api.libs.ws.WS</code> to make HTTP requests and also <code>play.Play.application.configuration</code> to read the configuration.</p> <p>Previously, all I needed was some imports like:</p> <pre><code>import play.api.libs.ws._ import play.api.Play.current import play.api.libs.concurrent.Execution.Implicits.defaultContext </code></pre> <p>But now you <a href="https://www.playframework.com/documentation/2.5.x/ScalaWS">should use dependency injection to use <code>WS</code></a> and also <a href="https://www.playframework.com/documentation/2.5.x/Migration25#Deprecated-play.Play-and-play.api.Play-methods">to use access the current Play application</a>.</p> <p>I have something like this (shortened):</p> <pre><code>abstract class Microservice(serviceName: String) { // ... protected lazy val serviceURL: String = play.Play.application.configuration.getString(s"microservice.$serviceName.url") // ...and functions using WS.url()... } </code></pre> <p>An object looks something like this (shortened):</p> <pre><code>object HelloWorldService extends Microservice("helloWorld") { // ... } </code></pre> <p>Unfortunately I don't understand how I get all the stuff (WS, configuration, ExecutionContect) into the abstract class to make it work.</p> <p>I tried to change it to:</p> <pre><code>abstract class Microservice @Inject() (serviceName: String, ws: WSClient, configuration: play.api.Configuration)(implicit context: scala.concurrent.ExecutionContext) { // ... } </code></pre> <p>But this doesn't solve the problem, because now I have to change the object too, and I can't figure out how.</p> <p>I tried to turn the <code>object</code> into a <code>@Singleton class</code>, like:</p> <pre><code>@Singleton class HelloWorldService @Inject() (implicit ec: scala.concurrent.ExecutionContext) extends Microservice ("helloWorld", ws: WSClient, configuration: play.api.Configuration) { /* ... */ } </code></pre> <p>I tried all sorts of combinations, but I'm not getting anywhere and I feel I'm not really on the right track here.</p> <p>Any ideas how I can use things like WS the proper way (not using deprecated methods) without making things so complicated?</p>
<scala><playframework><playframework-2.5>
2016-03-05 17:20:03
HQ
35,817,325
How safe is JWT?
<p>I am learning about JWT for the security of my project, but I have a question. If I recieve the token correctly after I did the login, but someone else (hacker) in other place steals this specific token, can he access to my session? The server that use JWT authentication is able to detect this and protect me? How?</p>
<security><token><jwt>
2016-03-05 17:27:21
HQ
35,818,308
Concept of creating Array of structures in C with three properties
<p>Hi all what I wish to create is some code in C that will allow me to store R,G,B values separately (this will be from an image), I have done some research and assume that using Array of structures to be the best way but still unsure. I then wish to access values from these structures to carry out some simple calculations. The problem I am having is getting my head around accessing the structure/arrays. I'm finding the conceptual part quite difficult if anyone can use a simple example it doesn't have to be relevant to my task but some sample code 3 properties to one structure would be helpful showing how the values can be accessed. I am also looking to understand how I load the structure with values. Any tips or help would be appreciated.</p>
<c><arrays><struct>
2016-03-05 18:49:01
LQ_CLOSE
35,818,587
/varible int time won't display the numeric value entered
<pre><code>//varible int time won't display the numeric value entered </code></pre> <p>The Speed of Sound The following table shows the approximate speed of sound in air, water, and steel: Medium Speed Air 1,100 feet per second Water 4,900 feet per second Steel 16,400 feet per second Write a program that asks the user to enter “air”, “water”, or “steel”, and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time 5 Distance / 1,100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time 5 Distance / 4,900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time 5 Distance / 16,400</p> <p><a href="http://i.stack.imgur.com/33T0K.png" rel="nofollow">C:\Users\DeLaCruz\Desktop\j2</a></p> <p><a href="http://i.stack.imgur.com/gELHB.png" rel="nofollow">V:\CSC106-Spring 2016\j3</a></p> <pre><code>import java.util.Scanner; public class ProgramSpeedOfSound{ public static void main(String [] args){ Scanner keyboard = new Scanner(System.in); String input; System.out.println("Enter Air, water or steel "); input = keyboard.nextLine().toUpperCase(); if(input.equals("Air")){ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); int var = 1100; double time = Distance / var; System.out.println("it would take " + time); } else if(input.equals("Water")){ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); double time = (((Distance/ 4900))); System.out.println("it would take " + time); } else{ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); double time = Distance/ 16400; System.out.println("it would take " + time); } } } </code></pre>
<java><if-statement><java.util.scanner>
2016-03-05 19:11:11
LQ_CLOSE
35,818,703
swift difference between final var and non-final var | final let and non-final let
<p>What's difference between final variables and non-final variables :</p> <pre><code>var someVar = 5 final var someFinalVar = 5 </code></pre> <p>and</p> <pre><code>let someLet = 5 final let someFinalLet = 5 </code></pre>
<swift><swift2>
2016-03-05 19:20:45
HQ
35,819,129
How to use PyCharm for GIMP plugin development?
<p>I need to develop a plugin for GIMP and would like to stay with PyCharm for Python editing, etc.</p> <p>FYI, I'm on Windows.</p> <p>After directing PyCharm to use the Python interpreter included with GIMP:</p> <p><a href="https://i.stack.imgur.com/RbFkW.jpg"><img src="https://i.stack.imgur.com/RbFkW.jpg" alt="Project interpreter"></a></p> <p>I also added a path to <code>gimpfu.py</code> to get rid of the error on <code>from gimpfu import *</code>:</p> <p><a href="https://i.stack.imgur.com/1DYZO.jpg"><img src="https://i.stack.imgur.com/1DYZO.jpg" alt="enter image description here"></a></p> <p>This fixes the error on the import, even when set to <code>Excluded</code>. </p> <p>I experimented with setting this directory to <code>Sources</code>, <code>Resources</code> and <code>Excluded</code> and still get errors for constants such as <code>RGBA-IMAGE</code>, <code>TRANSPARENT_FILL</code>, <code>NORMAL_MODE</code>, etc.</p> <p><a href="https://i.stack.imgur.com/K2EFG.jpg"><img src="https://i.stack.imgur.com/K2EFG.jpg" alt="enter image description here"></a></p> <p>Any idea on how to contort PyCharm into playing nice for GIMP plugin development?</p> <p>Not really running any code from PyCharm, it's really just being used as a nice code editor, facilitate revisions control, etc.</p>
<python><pycharm><gimp><gimpfu>
2016-03-05 19:57:28
HQ
35,819,264
Angular 2: Callback when ngFor has finished
<p>In Angular 1 I have written a custom directive ("repeater-ready") to use with <code>ng-repeat</code> to invoke a callback method when the iteration has been completed:</p> <pre><code>if ($scope.$last === true) { $timeout(() =&gt; { $scope.$parent.$parent.$eval(someCallbackMethod); }); } </code></pre> <p>Usage in markup:</p> <pre><code>&lt;li ng-repeat="item in vm.Items track by item.Identifier" repeater-ready="vm.CallThisWhenNgRepeatHasFinished()"&gt; </code></pre> <p>How can I achieve a similar functionality with <code>ngFor</code> in Angular 2?</p>
<javascript><angularjs><angular><ngfor>
2016-03-05 20:09:10
HQ
35,819,990
Regular expression to extract only numbers but only if sting doesn't contain any letters
Hello regular expression gurus! I need Your help! I want to extracts digits from the string that may contain some special character (let's say "+-() ") but not any other characters! I.e.: "+123 (456) 7-8" -> "1, 2, 3, 4, 5, 6, 7, 8" is extracted "123a45" -> pattern matching fails, nothing is extracted "1234 B" -> pattern matching fails, nothing is extracted Thanks!
<regex><regex-negation>
2016-03-05 21:15:11
LQ_EDIT
35,820,697
Pulling values from an array of objects with key pairs inside
I am new to programming so apologies if this is incredibly basic! As part of my application I would like to extract the values for monthlyIncome, savePercent and years and save them as $scope. values so they can be set as default values when a user logs in! [{"$value":1457178818625,"$id":"date","$priority":null},{"$value":"a@b.com","$id":"email","$priority":null},{"$value":"test","$id":"firstname","$priority":null},{"$value":"Isaacs","$id":"lastname","$priority":null},{"$value":328947,"$id":"monthly","$priority":null},{"$value":123,"$id":"monthlyIncome","$priority":null},{"$value":10,"$id":"percent","$priority":null},{"$value":"4157e8b1-efa2-4feb-bf75-e907c0e200e0","$id":"regUser","$priority":null},{"$value":10,"$id":"savePercent","$priority":null},{"$value":40,"$id":"years","$priority":null}] Any help would be greatly appreciated.
<arrays><angularjs><object><firebase>
2016-03-05 22:26:19
LQ_EDIT
35,821,267
Accessing a size_type of vector inside a structure
I have got a structure structue str{ std::vector<double> values; } And I have got a for loop in my program that interates through values in this vector and these codes work: for (vector::size_type i = 0; i < str.values.size(); i++) { and for (size_t i = 0; i < str.values.size(); i++) { but I know that it should be done somehow like here but I have got an error. How to get this size? for (str::values::size_type i = 0; i < str.values.size(); i++) { And I know that I could use for (auto i : str.values) but I also need number of iteration, not only double value that is in that vector. Is it possible using this solution?
<c++><c++11><vector>
2016-03-05 23:38:34
LQ_EDIT
35,821,329
React-router link doesn't work
<p>React-router is off to a really bad start... What seems basic doesn't work. Using react-router 2.0.0 my Link component updates the URL to be /about, but my page doesn't render the About component after that...</p> <p><strong>Entry point js</strong></p> <pre><code>var React = require('react'); var ReactDOM = require('react-dom'); var Router = require('react-router').Router; var Route = require('react-router').Route; var hashHistory = require('react-router').hashHistory; var App = require('./components/App.react'); var About = require('./components/About'); ReactDOM.render( &lt;Router history={hashHistory} &gt; &lt;Route path="/" component={App}&gt; &lt;Route path="about" component={About} /&gt; &lt;/Route&gt; &lt;/Router&gt;, document.getElementById('app') ); </code></pre> <p><strong>App.js</strong></p> <pre><code>'use strict'; var React = require('react'); var Link = require('react-router').Link; var Header = require('./Header'); var UserPanel = require('./UserPanel'); var ModelPanel = require('./ModelPanel.react'); var EventPanel = require('./event/EventPanel'); var VisPanel = require('./vis/VisPanel'); var LoginForm = require('./LoginForm'); var AppStore = require('../stores/AppStore'); var AppStates = require('../constants/AppStates'); var App = React.createClass({ [... code omitted ...] render: function() { var viewStateUi = getViewStateUi(this.state.appState); return ( &lt;div&gt; &lt;Header /&gt; &lt;Link to="/about"&gt;About&lt;/Link&gt; {viewStateUi} &lt;/div&gt; ); } }); </code></pre>
<reactjs><react-router>
2016-03-05 23:47:07
HQ