input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
SpringBoot app running on AWS-EC2 unable to connect to MySQL AWS-RDS database <p>I am having problems running an app I have developed in an EC2 instance. When I execute the .jar (java -jar app.jar), the SpringBoot app starts but it fails when trying to connect to my MySQL RDS database. The thing is when I run the app l... | <p>From your description and log file, it's likely that network configuration is the cause here. </p>
<p>You might want to draw the network topology of your instances (region/availability zone, VPC, subnet, network acl, security group). This will be very helpful when you do more complex development work.
There are goo... |
HTML/CSS Progess Bar shows on browser but doesnt show when trying to print the document <p>Im helping a friend create a resume and wanted to incorporate a cool progress bar for the skills portion. </p>
<p>I have created a progress bar and it displays on the browser completely fine; however, when I try to try to save t... | <p>add this code inside your style tag</p>
<blockquote>
<p>-webkit-print-color-adjust: exact;</p>
</blockquote>
<p>example</p>
<pre><code> @page {
size: A4;
margin: 0;
box-shadow: 0;
-webkit-print-color-adjust: exact;
}
@media print {
html, body {
wid... |
Why maximum integer number multiplication gives 1 as result <p>I think much explanation is not required, why below calculation gives result as 1?</p>
<pre><code>int a = 2147483647;
int b = 2147483647;
int c = a * b;
long d = a * b;
double e = a * b;
System.out.println(c); //1
System.out.println(d); //1
System.out.... | <p>The binary representation of the integer number 2147483647 is as following:</p>
<pre><code>01111111 11111111 11111111 11111111
</code></pre>
<p>Multiplying this with itself results in the number 4611686014132420609 whose binary representation is:</p>
<pre><code>00111111 11111111 11111111 11111111 00000000 0000000... |
Script which replaces specific words in text by asterisks (Python) <p>I tried to create a function which finds a censored word (which is an argument of the function) in a text (which is a second argument) and replaces all the instances of the word with astrerisks. </p>
<pre><code>def censor(text, word):
if word i... | <p>You need to return the recursive result like this: </p>
<pre><code>def censor(text, word):
if word in text:
position = text.index(word)
new_text = text[0: position] + "*"*len(word) + text[position+len(word):]
return censor(new_text,word) # <-- Add return here
else:
return ... |
How to convert list of list to dictionary in Python? <p>I have the following list of list: </p>
<pre><code>website=[["Ram"],["google"],["yahoo"],["linkedin"],["facebook"],["twitter"],
["google"],["yahoo"],["linkedin"],["facebook"],["twitter"],["google"],["yahoo"],
["linkedin"]]
</code></pre>
<p>i would like... | <pre><code>website=[["Ram"],["google"],["yahoo"],["linkedin"],["facebook"],["twitter"],["google"],["yahoo"],["linkedin"],["facebook"],["twitter"],["google"],["yahoo"],["linkedin"]]
print dict([(i[0], website.count(i)) for i in website])
</code></pre>
<p>The output : </p>
<pre><code>{'google': 3, 'twitter': 2, 'Ram':... |
ruby on rails, how to using try() method in this case <p>I have a rails tag to call an attribute from an object like this</p>
<pre><code><%= item.product.name %>
</code></pre>
<p>but I got the error undefined method 'product' for nilClass. I've tried to use try() method like in the following code, it allows nil... | <p>Use safe navigation (available from Ruby 2.3.0):</p>
<pre><code>item&.product&.name
# for Ruby < 2.3.0
item.try(:product).try(:name)
</code></pre>
<p>For hashes use <a href="http://ruby-doc.org/core-2.3.0_preview1/Hash.html#method-i-dig" rel="nofollow">Hash#<code>dig</code></a> (available from Ruby 2.3... |
How to create autocomplete which only starts with either first letter or any other letter in the string starting after space <p>In this fiddle autocomplete if I type letter "s" it shows listing which starts with "s" but I need all the listing starting with "s" and having space before "s". </p>
<p>Means if I type "s" t... | <p>I'm not a RegExp guru, so there might be more clever solutions, but here's an updated fiddle: <a href="http://jsfiddle.net/9R4cV/702/" rel="nofollow">http://jsfiddle.net/9R4cV/702/</a></p>
<pre><code> source: function(req, responseFn) {
var re = $.ui.autocomplete.escapeRegex(req.term);
var matcher = new ... |
popBackStack() not working on PreferenceFragment <p>I have a <code>AppCompatActivity</code> with different <code>PreferenceFragments</code>. I am adding <code>fragments</code> to <code>backstack</code> using <code>addToBackStack()</code> call but while retrieving fragments using <code>popBackStack()</code>, the <code>a... | <p>I think your are using Support Fragment, if so then you need to use <code>getSupportFragmentManager</code> instead of <code>getFragmentManager</code></p>
<p>Hope it helps</p>
|
Sharedpreference with user level bugs <p>My sharedpreference have some bugs where even a user dont put values on username and password it will still go to the <code>OwnerTabs</code> and I don't know why. Can you guys please help me. Here are my codes. </p>
<h1>authenticate.php</h1>
<pre><code> <?php
require 'd... | <p>You PHP code should be like this,</p>
<pre><code><?php
require 'database-config.php';
if(isset($_POST['username']) && isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$q = 'SELECT * FROM tbl_user WHERE username=:username AND password=:password';
... |
ValueError: substring not found - Really stuck <p>I keep getting this error: </p>
<blockquote>
<p>File "abc.py", line 19, in findBetween start = s.index(first) +
len(first) ValueError: substring not found</p>
</blockquote>
<p>from running this code: </p>
<pre><code> def findBetween(s, first, last):
s... | <p>I can't figure out what you are trying to do but if you want to create a function to return the part of string between two chracters this code will work</p>
<pre><code>def findBetween(s, first, last):
start=s.index(first)+1
end=s.index(last)
return s[start:end]
print findBetween("ahellob","a","b")
</code></pr... |
How to send URL id from Asp.net View to Controller using Ajax? <p>I want send the data from asp.net MVC View to my controller using Ajax.i can send the data to controller from text boxes.. the problem is how to add the URL id to post data in Controller using Ajax. please see the below code</p>
<p><strong>My URL</stron... | <p>You can try</p>
<p><code>project_id= <%=Url.RequestContext.RouteData.Values["id"]%></code></p>
<p>But please take note it's only work if your Js is in the View.
Else , your can store it in a ViewBag or some javascript object...</p>
|
Command line option with compound sub-options <p>The long option style looks like this</p>
<pre><code>--key=value
</code></pre>
<p>This syntax can easily be expanded for array-like values</p>
<pre><code>--key=value\ 1,value\ 2,value\ 3
</code></pre>
<p>Is there a standard approach if each item takes sub-options? Th... | <p>First, the standard on GNU systems is not this:</p>
<pre><code>--key=value\ 1,value\ 2,value\ 3 // WRONG
</code></pre>
<p>But this:</p>
<pre><code>--key=value\ 1 --key=value\ 2 --key=value\ 3
</code></pre>
<p>Which in Bash can be written this way:</p>
<pre><code>--key=value\ {1,2,3}
</code></pre>
<p>Now, if yo... |
Visual Studio Community 2015 No .NET Framework <p>The problem is pretty simple, I can't create a VS C++ project because, apparently VS can't see the available .NET frameworks, only option I see is " more frameworks" and I do know that I have</p>
<ul>
<li>4.5.1 SDK & Multi-targeting pack & Multi-targeting pack ... | <p>I think you've forgotten to install <strong>Visual C++</strong>, which by default is not checked to be installed.</p>
<ol>
<li>Go to <strong>Control Panel</strong></li>
<li>Click <strong>Uninstall</strong> a program under <strong>Programs</strong></li>
</ol>
<p><img src="http://i.stack.imgur.com/F30XS.png" alt="im... |
NPM Multer returning no response <p>I am trying to upload a file using <code>npm multer</code>. The issue is multer is returning no response, not even error. I tried to create the common function for whole application for file upload. <strong>I have all (777) permission to my folder as well.</strong> </p>
<p>My sample... | <p>@Sankalp, I checked the code and made it work, but not with all logic to format the filename (please, do re-implement that later).</p>
<p>As you did not include here the code from the form you are submitting, I think its important to say it must have the <code>enctype="multipart/form-data"</code> in it, otherwise i... |
How to apply conditional error messages? <p>I am trying to implement laravel's required_if validation in parsley, I was able to successfully apply it but main issue is coming while displaying error message. I have added following custom validator - </p>
<pre><code>window.Parsley.addValidator('lpyRequiredIf', {
val... | <p>I figured it out how it can be done. I need to return jquery promise with first argument as custom message which I need to display - </p>
<pre><code>window.Parsley.addValidator('lpyRequiredIf', {
validateString(value, ...requirement) {
let valid = true;
const formElement = $(requirement[requirem... |
Why MAVLink Protocol is not secure? <p><code>Unmanned Aircraft Systems</code> (UAS) are the systems based <code>Micro Air Vehicle communication Protocol</code> i.e. Drones, tinyCopters are based on MAVLink Protocol</p>
<p>but Why MAVLink Protocol is not secure?</p>
<p>How packet forwarding attacks, eavesdropping, and... | <p>The Mavlink Protocol does not provide any security. There is no confidentiality, or authentication mechanisms and while there are integrity mechanisms (CRC and packet count) these are for data loss not secure tamper checking. </p>
<p>While the Mavlink Protocol is not secure, it can be encapsulated in other secure p... |
How to add NA rows to an incomplete dataframe based on an complete index? <p>For the given incomplete dataframe <code>df</code> and complete index <code>t</code>:</p>
<pre><code>t = seq(as.POSIXct("2016-01-01 00:05:00"), as.POSIXct("2016-01-01 01:00:00"), by = '5 min')
index<-t[c(1,2,4:7,9,12)]
a<-(1:8)
b<-(1... | <p>We can do this with <code>merge</code> (<code>base R</code>) or <code>left_join</code> (from <code>dplyr</code>)</p>
<pre><code>library(dplyr)
data.frame(index = t) %>%
left_join(., df)
</code></pre>
<hr>
<p>Or join from <code>data.table</code></p>
<pre><code>library(data.table)
setDT(df)[data.t... |
JavaScript non-parameterized function is still able to get arguments <p>Up to my knowledge, in most programming languages such as C# and java, which are the common. The method or function need to have parameter to pass a variable. </p>
<pre><code>class Program
{
static void Main(string[] args)
{
Cons... | <p>It can definitely be used as an <strong>advantage</strong>.</p>
<p>In JavaScript, all functions are inherently <a href="https://en.wikipedia.org/wiki/Variadic_function" rel="nofollow">variadic</a>, meaning that they accept a variable amount of parameters.</p>
<p>You can't prevent this from occurring. What you <em>... |
Providing multiple lines of input using Scanner in java <p>My input will be</p>
<pre><code>12
4.0
has to be concatenated with this input
</code></pre>
<p>My Expected output is </p>
<pre><code>16
8.0
RandomString has to be concatenated with this input
</code></pre>
<p>My code which tries to do this is follows </p>
... | <p>Primitive data types like int, double does not consume Enter key/End of line. That's why enter typed after keying integer is taken as value from buffer for your nextLine().</p>
<p>When you want to use the same scanner object with nextInt(), and a nextLine(), It doesn't work well.</p>
<p>There are two solutions to ... |
Handling a powershell error into a batch file <p>I have powershell code that is similar to this:</p>
<pre><code>If ($a -eq $false)
{
"FALSE"
exit 5
}
Else
{
If ($b -eq $false)
{
"FALSE"
exit 5
}
}
</code></pre>
<p>I have imported this code into a batch file with the <code>powershel... | <pre><code>@echo off
`some batch code here`
powershell -Command "& { if $a -eq $false -or $b -eq $false { 'FALSE'; exit 5} }"
echo %errorlevel%
if '%errorlevel%' NEQ '5' (
`code here`
)
echo ERROR
pause
exit
</code></pre>
|
New dynamic instance in php of a class at runtime <p>I have different classes in which I have different properties. Now I want to instantiate these classes at runtime. Please have a look on my Example.
Thank you for your help.</p>
<pre><code> class costumers
{
    $ Name;
...
}
class users
{
  $ Username;
... | <p>Perhaps you may want to take a look at this commented Code. It may give you some hints....</p>
<pre><code><?php
class costumers {
protected $Name;
//...
}
class users {
protected $Username;
//...
}
class db_helper {
//...
// NOTICE THAT THER... |
group by 'last' value in bash <p>I have a two-column file:</p>
<pre><code>1,112
1,123
2,123
2,124
2,144
3,158
4,123
4,158
5,123
</code></pre>
<p>I need to know last column2 value for each column1:</p>
<pre><code>1,123
2,144
3,158
4,158
5,123
</code></pre>
<p>how to do this in <code>bash</code> ?</p>
| <p>Couple of solutions:</p>
<p>1) With <code>tac</code> to reverse input file and <code>sort</code></p>
<pre><code>$ tac ip.txt | sort -u -t, -k1,1n
1,123
2,144
3,158
4,158
5,123
</code></pre>
<p>2) With <code>perl</code></p>
<pre><code>$ perl -F, -ne '$h{$F[0]} = $_; END{print $h{$_} foreach (sort {$a <=> $b... |
When to use 'Break' in For loop? <p>I have various pages, each of them contain some number of arrays,</p>
<p>For example:</p>
<p>Page 1 contains only 2 arrays:</p>
<pre><code>$textual_button[1] = "I am a long character";
$textual_button[2] = "I am also a long character";
</code></pre>
<p>Page 2 contains 20 arrays:<... | <p><code>break</code> breaks out of the loop so in both cases, your loop will only run once, or the first iteration, and stop then.</p>
<p>So no, you should not use <code>break</code> here as you have already limited the number of iterations to 15.</p>
<p><code>break</code> could be useful (there are other methods...... |
Error with npm install - a pre-gyp error <p>I wanted to install <a href="https://github.com/mattlewis92/angular2-calendar#installation" rel="nofollow">this</a> angular 2 calendar using npm. Tried to use npm to install it and then downloaded it and tried to install it. In both cases its failed.</p>
<p>I am on windows a... | <p>I had a similar problem on windows, installing node-gyp globally removed those errors.</p>
<pre><code># before installing node-gyp on windows
npm install --global --production windows-build-tools
# install node-gyp globally
npm install -g node-gyp
</code></pre>
|
How can I display larger text in small Label.text? <p>I am a beginner in swift and I am developing my first application. The problem I am having right now is a large text which should be displayed in a small label.text.</p>
<p>I have tried some of these codes:</p>
<pre><code> Label.text = "The text I want to see h... | <p><code>label.sizeToFit</code> does not shrink text to fit the label but rather changes the size of the label to fit around the text that you have set for the label.</p>
<p>Without creating a new pop-up window or something like that your best bet is either shrinking the font size or allowing the label to have multipl... |
How to autogenerate unique ID for mySQL in JSP <p>I would like to ask where and how I can create an auto-generated item code (similar to primary key with auto-increment) for my form in JSP. As seen in this image ></p>
<p><img src="http://i.stack.imgur.com/H1NHx.png" alt="link to JSP screen"></p>
<p>I need to display ... | <p>Create a Servlet and write these codes<br>
Connection con = null;<br>
ResultSet rs = null;<br>
/* I assume that u have established connection <em>/<br>
Statement stmt = con.createStatement();<br>
rs = stmt.excecuteQuery("SELECT count(</em>) FROM TABLE_NAME");<br>
String id = "IGA" + count + "";<br>
PreparedStatemen... |
Make Ionic App visible only for mobile phone <p>My app does not have registration. my App get it's data from API. I want to my client could not try my API url.</p>
<p>Is OAuth2 applicable here? If yes, please explain.</p>
<p>How can I make My API visible only for trusted mobile phones?</p>
<p>And how can I prevent t... | <p>CORS is only an issue when running your app in development mode with ionic serve, and not when running as a mobile app packaged with Cordova
You should also go through this link <a href="http://blog.ionic.io/handling-cors-issues-in-ionic/" rel="nofollow">http://blog.ionic.io/handling-cors-issues-in-ionic/</a></p>
|
Jquery ajax to submit a FORM containing different types of inputs(file, text etc) <p>I am trying to submit a form containing- <code>input type="file"</code> , <code>select</code> , n <code>input type="text"</code>. All through <code>$.ajax</code>, but am confused with <code>data:</code> inside <code>$.ajax()</code>. Wh... | <p>Your `formData' should be initialized like this:</p>
<p><code>var formData = new FormData($(this)[0]);</code></p>
<p>After doing this, you can remove the loop, which iterates the form inputs.</p>
|
How to use std::mutex in different threads? <p>How to properly write multithreaded code with mutex:</p>
<pre><code>std::mutex m, m2;
... thread
m2.lock();
if ((++reference) == 1) m.lock();
m2.unlock();
... differenet thread
m2.lock();
if ((reference--) == 0) m.unlock(); // error here
m2.unlock ();
</code></pre... | <p>Mutex needs to be unlocked by the owning thread (the thread that locked it):</p>
<blockquote>
<p>If the mutex is not currently locked by the calling thread, it causes
undefined behavior. (<a href="http://www.cplusplus.com/reference/mutex/mutex/unlock/" rel="nofollow">http://www.cplusplus.com/reference/mutex/mut... |
Searching an element in a list of double-nested dictionaries with generator <p>I have a list of dictionaris. In every dictionary, i need to use values, which are in the dictionaries, which are in the dictionaries:</p>
<pre><code>[{'Cells': {'Address': 'Ðижний ÐиÑелÑнÑй пеÑеÑлок, дом 3, ÑÑÑ... | <p>First, let's assume you have a function get_distance() which finds distance between two points with lat and long. I can describe it, but I think for now it is not the point of the question. Then, the code will be look like:</p>
<pre><code>cells = {...} # your data is here
point = [..] # coordinates of the point
di... |
Xcode 8 Stuck at Indexing and uses up all free space in the storage <p>I am a Unreal C++ Developer and I'm using Xcode as my primary editor for my Unreal projects. Everything was fine with Xcode 7.3.1. Yesterday, I upgraded Xcode from 7.3.1 to 8.0. While opening Unreal Projects in Xcode 8, Xcode freezes at Indexing and... | <p>After some investigation version 4.13.0 and 4.13.1 of Unreal triggers that index bug in Xcode 8.</p>
<p>I uninstalled Xcode (drag to Trash from Applications) then downgraded to <a href="http://adcdownload.apple.com/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg" rel="nofollow">Xcode 7.3.1</a> via downloading from the ... |
How to write Dom pdf output to file in Zf2 <p>I am using dompdf to create one pdf file in zf2.</p>
<pre><code>$pdf = new PdfModel();
$pdf->setOption('filename', 'monthly-report'); // Triggers PDF download, automatically appends ".pdf"
$pdf->setOption('paperSize', 'a4'); // Defaults to "8x11"
$pdf->setOption('... | <p>Try This </p>
<pre><code>$pdfView = new ViewModel();
$pdfView->setTerminal(true)
->setTemplate('Order/order/forme-pdf-view.phtml')
->setVariables(array(
'fetchResult' => $fetchResult,
));
$html = $this->getServiceLocator()->get('viewpdfrenderer')->g... |
A different number of features in the SVC.coef_ and samples <p>I downloaded the data.</p>
<pre><code>news = datasets.fetch_20newsgroups(subset='all', categories=['alt.atheism', 'sci.space'])
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(newsgroups.data)
y = news.target
print(X.shape)
</code></pre>
<p>Th... | <p>So in short everything is fine, your weight matrix is in clf.coef_. And it has valid shape, it is a regular numpy array (or scipy sparse array if data is sparse). You can do all needed operations on it, index it etc. What you tried, the .data field is attribute which holds <strong>internal</strong> storage of the ar... |
why Alternative's some and many are infinite recursive functions in haskell <p>I was looking at <code>Alternative</code> typeclass in haskell and I was playing with it in ghci when I issued this </p>
<pre><code>some (Just 2)
</code></pre>
<p>It hanged, I looked in the source code of Alternative, Alternative's some an... | <p>The Alternative instance for Maybe is as follows:</p>
<pre><code>instance Alternative Maybe where
empty = Nothing
Nothing <|> r = r
l <|> _ = l
</code></pre>
<p>It defines <code>empty</code> and <code>(<|>)</code>, leaving <code>some</code> and <code>many</code> as their default... |
Eclipse ignores applet code <p>Trying to write and run applets in Java using Eclipse Neon. Here is a very simple example from Schildt (2012): </p>
<pre><code>import java.awt.*;
import java.applet.*;
/*
<applet code="SimpleApplet" width=200 height=60>
</applet>
*/
public class SimpleApplet extends Applet{
... | <p>Open <code>Run -> Run configurations... -> Java Applet -> Simple Applet</code>. Switch to the second tab <code>Parameters</code>. You'll see there that Width and Height are defined by default to 200. Unfortunately Eclipse ignores the comment tags while creating the configuration with defaults. You can chang... |
Implementing HEAD and GET requests, simple web server in C <p>I'm making a simple web server in C, and I need to handle both simple and full versions of http 1.0 methods HEAD and GET requests. All other requests should result in status code 501. It's my first time programming a web server and finding what you need is k... | <p>In the HTTP protocol, since the first "word" is the method, you have to check that first. </p>
<p>Use standard functions like <code>strchr()</code> or <code>strtok()</code> to split the buffer into "words". Then use something like <code>strcmp()</code> to see if the "word" is "GET" or "HEAD". </p>
<p>Once you got ... |
Search City option not showing up in Android Studio <p>I am trying to develop a simple weather forecast app.
<strong>Android Studio v2.2</strong>
Minimum SDK set to API10:Gingerbread.</p>
<p><strong>Problem</strong> - I need a <strong>Search City</strong> option on my 1st page.So I simply edited the <strong>menu_main.... | <p>I think that the problem is that you're not inflating menu in your activity. Add to your <code>MainActivity.java</code> this code:</p>
<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.men... |
Find children recursively <p>I have a table like this:</p>
<p><a href="http://i.stack.imgur.com/WWPY5.png" rel="nofollow"><img src="http://i.stack.imgur.com/WWPY5.png" alt="enter image description here"></a>
Creation script:</p>
<pre><code>CREATE #TableName TABLE (
Id int,
Id_Group int,
Id_Menu int
)
IN... | <p>may be this one will help</p>
<pre><code>; with CTE as(
select Id_Group from YourTable where Id_Menu=1014)
select c.Id_Group,y.Id_Menu from CTE c with(nolock) join YourTable y with(nolock) on c.Id_Group=y.Id_Group
</code></pre>
|
Angular ui-bootstrap modal unknown provider <p>I have read a lot of questions about this problem but I'm still not able to find a solution for my case.</p>
<pre><code>Unknown provider: $uibModalProvider <- $uibModal
</code></pre>
<p>What I have done so far:</p>
<p>installed <code>angular-bootstrap</code> via npm<... | <p>Do you have included the angular ui file script in your page ?</p>
<p>If yes, it should work. If not, maybe you should gice us a jsfiddle (or other site) sample</p>
|
Send a notification when the app is closed <p>How is it possible to send a notification programmatically, when the App got completely closed? </p>
<p>Example: The User closed the App, also in the Android Taskmanager, and waits. The App should send a notification after X Seconds or when the App check for Updates.</p>
... | <p>You can use alarm manager to do this.
Follow below steps :</p>
<p>1) Use alarmmanager to create an alarm of after X seconds.</p>
<pre><code>Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("NotificationText", "some text");
PendingIntent pendingIntent = ... |
How do I save all the dependencies I install through npm into my package.json file? <p>I ran <code>npm install</code> for a lot of packages, but I forgot to include the <code>--save</code> argument. Now when I try to deploy on Heroku I get errors for missing certain dependencies. How can I automatically add those depen... | <p>You can add all installed packages not installed with <code>--save</code> to your <code>package.json</code> automatically by calling <code>npm init</code>. It will append the dependencies to your existing ones. No settings in your file should be lost. Still don't forget to make a backup of the file to be 100% secure... |
Memory allocations when using unordered_map <p>If a <code>std::unordered_map<int,...></code> was to stay roughly the same size but continually add and remove items, would it continually allocate and free memory or cache and reuse the memory (ie. like a pool or vector)? Assuming a modern standard MS implementation... | <p>The standard is not specific about these aspects, so they are implementation defined. Most notably, a caching behaviour like you describe is normally achieved by using a <em>custom allocator</em> (e.g. for a <a href="https://github.com/cacay/MemoryPool" rel="nofollow">memory pool allocator</a>) so it should normally... |
Fetch values of key-value in array of objects <p>I'm trying to display the values of all key-value pairs in an array of objects. I've tried several methods, for example <a href="http://jsfiddle.net/4Mrkp/" rel="nofollow">http://jsfiddle.net/4Mrkp/</a>, but I can't seem to get it to work on my data.</p>
<p>The data, I ... | <p>You may use underscoreJS for manipulating the JSON.</p>
<pre><code>var make = _.map(json_object.output.list.make,function(make) {
document.write(make.name);
return make;
})
</code></pre>
<p>This make variable will contain values in key-value pair.</p>
|
Kafka Connector - JMSSourceConnector for Kafka topic <p>Does Confluent by default provides this JMSSourceConnector for Kafka topic.</p>
<p>Or we need to write custom connector for this?</p>
<p>I dont see any documentation on Confluent page on this.</p>
| <p>Currently Confluent doesn't provide source connector for JMS. Please find below link for number of connectors available in Kafka Connect.</p>
<p><a href="http://www.confluent.io/product/connectors/" rel="nofollow">http://www.confluent.io/product/connectors/</a></p>
<p>But developers can develop custom connectors f... |
I want to reset the counter value after case 3 <p>I am trying to reset the nextClick variable in jquery but i can not do that How to reset the value of nextClick variable.Any one help me ?</p>
<pre><code>$(document).ready(function () {
$('.slide').eq(1).hide();
$('.slide').eq(2).hide();
var constant = 0;
$('.next').cl... | <p>if its greater than the desired number - reset it like this (after the increment function):</p>
<p>try replacing this line:</p>
<pre><code>$(this).data("count", ++nextClick);
</code></pre>
<p>with the following</p>
<pre><code> if(nextClick >=3){nextClick = 0)}else{++nextClick};
$(this).data("count", next... |
Is it possible to identify a WordPress Theme? <p>I have this website <a href="https://londonrealacademy.com/" rel="nofollow">https://londonrealacademy.com/</a> and I need a wordpress theme closest to this site. Is it possible to search? </p>
| <p>you can check theme by source code of site.
view source code and check link of any theme file like </p>
<pre><code><!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://londonrealacademy.com/wp-content/themes/kleo/assets/js/html5shiv.js"></script>
&l... |
Google maps clear all markers before placing new one <p>I'm trying to place a marker on click in google maps along with populating input boxes with the lat and lng. I need the code to clear all the existing markers first before placing the new marker and updating the lat and lng. everything works except when I add code... | <p>seem you have placed the code in the wrong place .. try </p>
<pre><code><div id="map"></div>
<script>
var map;
var markersArray = [];
function initMap() {
var latlng = new google.maps.LatLng(-29, 25);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 6,
... |
Tomcat7 takes too much time to start <p>I am using tomcat7 as application server to run my java web application (.war) when I restart tomcat it take 20-25 mins to deploy may war file.
i get this log when i restart tomcat : </p>
<pre><code> Sep 24, 2016 9:45:29 AM org.apache.catalina.core.StandardService startInter... | <pre><code>INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [965,010] milliseconds.
</code></pre>
<p>This is the process that takes a lot of server time.
Creation of SecureRandom itself takes <a href="https://www.google.co.in/search?q=965,010%20ms%20to%20minutes&gws_rd=cr&... |
error: Can't resolve symbol 'AdRequest' and 'AdView' <p>I'm trying to add a banner advertisement from AdMob. </p>
<pre><code>dependencies {
.......
compile 'com.google.firebase:firebase-ads:9.6.0'
}
</code></pre>
<p>...</p>
<pre><code>apply plugin: 'com.google.gms.google-services'
</code></pre>
... | <p>solved the issue</p>
<blockquote>
<p>go to <strong>File > Project Structure > Dependencies</strong></p>
<p>add google-play-services and google-play-ads</p>
</blockquote>
|
Is it possible in C# to return a array back to the calling program? <p>Is it possible in C# to return a array back to the calling program? If it is not possible, please say it is not all possible. Another alternative is to create a long string and use string.split(). But that does not look nice.
ExamnationOfReturnsFile... | <p><code>public string[] ExamnationOfReturnsFiled(string panreceived)</code> //function</p>
<p>you are returning type not variable name change the method signature like above </p>
|
how to redirect a page from web service and return the value of textbox c# <pre><code>public void getuserinfo(string username, string password, string role, string errormsg)
{
SqlConnection con = new SqlConnection(connectionstring);
List<object> logininfo = new List<object>();
if(role=="Admin" |... | <p>Return value from this methord <code>getuserinfo(string username, string password, string role, string errormsg)</code> get it to your action method from action method you can redirect user to another page using </p>
<pre><code> RedirectToAction("Welcomepage", "Account");
</code></pre>
|
Android Open Camera From Webview Is not Working in andorid 6+ <p>I followed <a href="http://androidexample.com/Open_File_Chooser_With_Camera_Option_In_Webview_File_Option/index.php?view=article_discription&aid=128" rel="nofollow">this</a> to Capture Images Form Webview</p>
<p>Here I Have done Exactly Same But Its ... | <p>Found complete solution for all android devices including marshmallow <a href="https://infeeds.com/d/CODEmgks/20475/upload-image-file-gallery-or-camera-webv" rel="nofollow">here</a> see its github project for more.</p>
|
Foreach not iterating through elements <p>I have an HTML document and I'm getting elements based on a class. Once I have them, I'm going through each element and get further elements:</p>
<pre><code>var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(content);
var rows = doc.DocumentNode.SelectNodes("//tr[cont... | <p>This is a FAQ in XPath. Whenever your XPath starts with <code>/</code>, it ignores <em>context element</em> (the element referenced by <code>row</code> variable in this case). It searches for matching elements starting from the root document node regardless of the context. That's why your <code>SelectSingleNode()</c... |
OpenCv contourArea error: trying to read or write protected memory <p>It's been two days i'm facing this problem but i've no idea how to solve it. I'm creating an app to simply detect the contour of an object and analize it only if the area is bigger than a certain value (using OpenCv). I plug the camera, place some ob... | <p>Just update to opencv 3.1.0 to make it works. 3.1.0 is the only version compatible with visual studio 2015.</p>
|
NullPointerException in databinding when bind ArrayList <p>activity_product_detail.xml</p>
<p></p>
<pre><code><data>
<import type="android.text.Html"/>
<import type="java.util.List" alias="list"/>
<variable
name="productDetail"
type="com.example.k2.kishanoil.pojocl... | <p>The <code>onResponse</code> callback in your retrofit network call is asynchronous and is fired later than <code>sliderInitialize</code> in <code>ProductDetailHandler</code>, so yo will get NPE in <code>sliderInitialize</code>. I think it is better to create an instance variable <code>mSliderList</code> (which is in... |
Looking for better Sql Query <p>I need to update <code>@tblData</code> table's <code>LastDateTime</code> column with <code>MAX ChildDateTime</code> of table <code>@tblChildData</code> and <code>IsLast</code> = 1.</p>
<pre><code>Declare @tblData Table(DId Int, TypeId Int, LastDateTime DateTime)
Insert Into @tblData Val... | <p>You can try update like this:</p>
<pre><code>UPDATE t
SET t.lastDateTime = (SELECT
MAX(childDatetime)
FROM @tblChildData
WHERE did = t.did
AND IsLast = 1)
FROM @tblData t
</code></pre>
<p>Not sure why you joined with childdata again below. Check the output with your expected output. Obviously it will perform bet... |
Select from a database and insert into a different database in PHP-MySQL <p>I have to select data from a table in a database and insert them into another table in a different database but its not working.Could you please correct the code and let me know your response?</p>
<pre><code><?php
$log1 = "taxicom";
$pwd1 ... | <p>You might be able to do the operation in one single query by prefixing the tables with the relevant database name like:</p>
<pre><code>insert into `suitecrm`.`prospects` (
`id_client_source`,
`num_tel_dest`,
`operateur`,
`montant`
)
select distinct `id`, `numdest`, `operateur`, `mont_pay`
from... |
Validation In rails 2 <p>I have Model Called Student In the student table i am storing student_name, phone number also i stored other model id class i need to check the for create a student record all these 3 values are unique for creating the new record. </p>
<p>Please help me in validating this in rails 2.Also i tri... | <p>In a model i used the following code to validate </p>
<pre><code>module StudentModel validate :is_valid_true private
def is_valid_true
@b... |
Deploying docker-compose as yml in order to be able to scale using the same port <p>I've successfully managed to deploy a docker-compose.yml using docker-machine. The problem I have is with scaling. Trying to scale a node.js app that uses port 3000. How can I scale a docker-compose service. I know I can use <code>docke... | <p>As you are actually BINDING to the host, it wouldn't be possible without a proxy or load balancer. </p>
<p>See this issue on the topic via GitHub where a user was asking a similar question:</p>
<p><a href="https://github.com/docker/compose/issues/3088" rel="nofollow">https://github.com/docker/compose/issues/3088</... |
polygon 'contains' and other operations on geometries not supported <p>I'm quite new to postgis and rgeo. I suspect I may be tackling things in the wrong way but I have been a bit surprised to find out a few operations, in particular contains & within, aren't possible on spherical based objects. </p>
<p>I have a b... | <p>I recommend using <a href="http://postgis.net/docs/ST_DWithin.html" rel="nofollow">ST_DWithin</a>, which is well supported for PostGIS' <code>geography</code> type. For the radius parameter, you can use 0 or maybe 10 (i.e. if your data has an accuracy of 10 m).</p>
<p>There are not any plans to make <a href="http:/... |
Background color only displays above the fold <p>Try to access acetheinterview.co on your mobile phone and go to page 2. You will see that the part of the screen you see when you land on the page has a background color but when you start to scroll it becomes white and you cannot see the last part of my content. </p>
<... | <p>As I guess this is the problem:</p>
<pre><code>body { height: 100vh;}
</code></pre>
<p>100vh limits the heigh to the viewport height. Change this to <code>height:100%</code> or <code>min-height:100vh;</code> as Paulie_D suggested</p>
|
Modifying JSON data for API <p>I have built an API which essentially has three calls. Firstly, a call is made to retrieve a token. Next, I have a type of autocomplete feature which returns data and the coresponding table it should look up. This data is returned like so</p>
<pre><code>[
{
"result": "Apples",
... | <p>You can explicitly build the array with the query results.</p>
|
Yii2: Pretty URL Rule to allow garbage data in URL <p>I am using URL Rewriting rules and URL manager on my project. This is the code of my URLManager rules:</p>
<pre><code> 'rules' => [
'/'=>'site/index',
'<controller:\w+>/<action:\w+>' => '<controller>/<act... | <p>I think i know why you are getting 404 error. It's the last '/' part, just before '?_=147471488ââ9055', which is causing 404. </p>
<p>According to Yii2 following these two URLs are different:</p>
<pre><code>// these two are not same
http://domain.com/controller/action
http://domain.com/controller/action/
</co... |
List of acitivies for sharing is empty with IOS10 <p>I have some problem with sharing with SO iOS10.
I wrote this code to choose a activity and share a link</p>
<pre><code>@IBAction func shareAction(_ sender: AnyObject) {
let objectsToShare = ["Shared by: xxxxxx**strong text**", url]
let activityVC = UIActivit... | <p>Very weird.... The problem solved automatically.
All works now without any patch
My iPhone updated to iOS 10.0.2, maybe this version solved the issue</p>
|
Why table header is also sorting with table data in jade? <blockquote>
<p>Here is my code sample that is working perfect but the only problem is that when i click on table header its sort the data but also it include the table header itself.(Table header also sorted)</p>
</blockquote>
<pre><code>.Container.feedPageC... | <p>The table header elements need to be in <code>thead</code> to be recognised as a table head. Then the rest goes into the <code>tbody</code>.</p>
<p>See also <a href="https://github.com/Mottie/tablesorter/issues/397" rel="nofollow">https://github.com/Mottie/tablesorter/issues/397</a> :</p>
<blockquote>
<pre><code> ... |
jquery append class with hover AND touch for mobile device <p>I'm using the script below to add a class 'hover' to a div with the class 'reveal-area'.</p>
<pre><code>jQuery(document).ready(function(){
$(".reveal-area").hover(
function () {
$(this).addClass("reveal-show");
},
function (... | <pre><code>Use touchstart function
$('.reveal-area').on("touchstart", function (e) {
'use strict'; //satisfy code inspectors
var link = $(this); //preselect the link
if (link.hasClass('hover')) {
return true;
$(this).addClass("reveal-show");
}
else {
link.addClass('hover');
$('.reveal-ar... |
can't get complete body message by using imap_fetchbody function? <pre><code>$emails = imap_search($inbox,'ALL');
foreach($emails as $email_number) {
$message = imap_fetchbody($inbox,$email_number,2);
echo $message;
}
</code></pre>
<p>I am trying to get body of the gmail email message using imap_fetchbody fu... | <p>Imap is quite involved, but without seeing the E-mail, my guess would be that the E-mail is either embedding the files or you are fetching the plain text rather than the HTML, so you will need to use <code>imap_fetchstructure()</code> to get all the parts and then reconstruct the E-mail. </p>
<p>I wrote a very comp... |
"Error watching file for changes: EMFILE" when run the examples from facebook/react-native/Examples <p>I want to run the Examples from facebook/react-native/Examples in OS X 10.12.</p>
<p>First I use <code>npm install</code> and then use <code>npm start</code>:</p>
<p>There is an error:</p>
<pre><code>Error watching... | <p>The react-native-cli depends on watchman, you can try to install watchman with "brew install watchman",then have another try.</p>
|
How to move boxing into a function instead of caller side <p>I have a trait and its implementation for some structures:</p>
<pre><code>trait Named {
fn name(&self) -> String;
}
struct Americano;
impl Named for Americano {
fn name(&self) -> String { String::from("Caffè Americano") }
}
</code><... | <p>In your struct:</p>
<pre><code>struct Menu {
item: Box<Named>,
}
</code></pre>
<p><code>Box<Named></code> has an implicit <a href="http://rustbyexample.com/scope/lifetime/lifetime_bounds.html" rel="nofollow">lifetime bound</a> and is equivalent to <code>Box<Named + 'static></code>. Therefore,... |
Why is my spring security not forwarding the request to authentication-success-handler? <p>I am trying to implement Spring Security in my application and somehow I am having some problem with it. Whenever I hit one of the intercepted URLs then I do get a custom login page. However after successful login, my Spring Sec... | <p>So the problem was that that I forgot to declare the following in my web.xml. </p>
<pre><code><filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping&g... |
How do I set up the recyclerView adapter? <p>So, I don't know how should I do it. I want to get jsonData and set up an adapter with this data from the same Activtiy. Is this even possible? If yes how should I do it, because it always crashes out for me because of the delay of the "download". The adapter wants to set up... | <p><strong>Please make sure to set the adapter only after you get data from calling webservice</strong> </p>
<p>please got follow below so that you get an overview on how to implement it:</p>
<pre><code> public class MainActivity extends Activity implements OnClickListener {
private SzabadEuMusorok[]... |
angular ngCookies doesn't save cookies after restarting the browser <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code> var app = angular.module('MyApp', ['... | <p>This is because if you don't set an expiration time for the cookie, it will be created as session cookie. Which will be removed as soon as you close the browser.</p>
<p>In order to avoid this just set an expiration time for the cookie, like e.g. here for one day:</p>
<pre><code>var expireDate = new Date();
expire... |
How to ignore spaces in string indexes and start with a capital letter on each word in a sentence <p>Basically, I have this code, where I want to change a given string to <code>wEiRd CaSe</code>, alternate between indexes, for example: </p>
<p>Starting from index <strong>0</strong> I want the letter to be capital, and... | <p>You can add another variable <code>charIndex</code> which you increase manually only if the value is no space. <code>charIndex</code> will represent the indexes for your string like it has no spaces in it.</p>
<pre><code>"use strict";
var weirdCase = function(string) {
var characters = string.split("");
va... |
Cmd script for cycle <p>My job is to write a small script in cmd which compares two variables(number) a and b. </p>
<p>If a is smaller than b then it counts from a to b with 1 steps
if a is bigger than b then it counts from a to b backwards.
Here is the code:</p>
<pre><code>if a LSS b (for /L %%g in (a, 1, b) do echo... | <p>Your variables need to be wrapped in <code>%</code> marks to access them</p>
<pre><code>set a=1
set b=10
if %a% LSS %b% (
for /L %%g in (%a%, 1, %b%) do echo %%g
) else (
for /L %%g in (%a%, -1, %b%) do echo %%g
)
</code></pre>
|
Changing content of the <title> element with pseudo-element <h1>What i want</h1>
<p>To change contents of html 'title' element by selecting it via '::before' pseudo-element and applying 'content' attribute to selection.</p>
<h1>Problem</h1>
<p>I have a webpage:</p>
<pre><code><html>
<head>
<title&g... | <p>The title element isn't rendered on the viewport like other elements since it's in the head and not the body, so pseudo-elements aren't going to work with it.</p>
|
Query to retrieve stock quotes variation from a single day <p>I'm quite new YQL and i've found the query to retrieve a single quote from a stock</p>
<p><code>select * from yahoo.finance.quote symbol = "YHOO"</code></p>
<p>and another query to get this same information but on date range</p>
<p><code>select * from yah... | <p>You can retrieve the complete quotes of a day by querying the Yahoo Finance API endpoint directly (not via YQL) and receiving a list in JSON format.</p>
<p>The end point is <code>http://chartapi.finance.yahoo.com/instrument/1.0/$symbol/chartdata;type=$type;range=$range/json/</code>, where:</p>
<ul>
<li><code>$sym... |
PyQt allowed enumeration values and strings <p>In PySide I can get the dictionary with possible/allowed enumerator values and their string representations by using <code>values</code> attribute. For example:
<code>QtWidgets.QMessageBox.StandardButton.values.items()</code>. How to achieve the same in PyQt4/PyQt5? Is tha... | <p>PySide has a built-in enum type (<code>Shiboken.EnumType</code>) which supports iteration over the names/values. It also supports a <code>name</code> attribute, which you can use to get the enumerator name directly from its value.</p>
<p>Unfortunately, PyQt has never had these features, so you will have to roll you... |
How to enable access to datastore for root user <p>I'm trying to use the nodejs lib for Datastore from a Compute Engine machine. The code runs well when I run it with my user on the Compute Engine machine. But when I run it with <code>sudo</code> I get an error of <code>Request had insufficient authentication scopes</c... | <p>Set IAM permissions for service accounts in "Developer Console -> IAM & Admin -> IAM".</p>
|
Is there any API available to create instance(VM) on amazon by access token? <p><strong>Purpose</strong>:
I want to create aws instance(VM) programmatically on user AWS console. </p>
<p><strong>Findings</strong>:
I found there is aws-sdk available with runInstance method which will create instance but It must require ... | <p>Each AWS user is provided with both access key and secret key. You can get those keys under IAM service in your AWS management console. Here is the image of IAM console</p>
<p><a href="http://i.stack.imgur.com/fiaGr.png" rel="nofollow"><img src="http://i.stack.imgur.com/fiaGr.png" alt="IAM console"></a></p>
<p>The... |
How to send JSONArray with JsonObjectRequest using volley <p>We can send JSONObject with JsonObjectRequest using volley. How can we send JSONArray with JsonObjectRequest?</p>
| <p>You have to use <strong>JsonArrayRequest</strong> for <strong>JSONArray</strong> parameter.</p>
|
Populate drop down menu from database <p>I have this method in my controller to get all the created floors so that I can use it in creating a room record.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang... | <p>It think it should be like this.</p>
<pre><code><select name="floor">
<c:forEach items="floors" var="floor">
<option value="${floors.id}">${floors}</option>
</c:forEach>
</select>
</code></pre>
|
I am using LeafletJS and JavaScript to display points on a MapBox map. The points are not lining up though. They are close but not exact <p>I am using LeafletJS to display points on a MapBox map. The points are not lining up though. They are close but not exact.</p>
<p>I have my setView set to the following location... | <p>I ended up answering my own question. </p>
<p>In the code where i am drawing the circles I was setting the cx and cy to the latitude and longitude and then transforming them from there. Like this:</p>
<pre><code> g.append("circle")
.attr("cx", temp.LatLng.lat)
.attr("cy", temp.LatLng.lng)
... |
Prerequisites for JSP project <p>I have developed a software using vb.net. Now as per the client's requirement I have to develop this project as web application using JSP. I am new for JSP. </p>
<p>First I want to know, is there any way to convert the vb.net code to JSP? Is there any application is available to copy t... | <p>As far as I know there are no such convertion, but hey.. maybe someone out there can do it, I dont know.</p>
<p>For the IDE you can try Eclipse or Netbean IDE, both of them are free and have the best Intellisence for Java Environtment development.</p>
|
Do action if app paused for more than 5 minutes <p>I have an android app and I would like to be able to set it that if the app is minimized for less that 5 minutes it will resume normally but if for over 5 minutes will will be restarted like a banking app works.</p>
<p>I can't find anything on this can be achieved, ca... | <p>I think it's easier just to save a timestamp when your app is paused and check it on resume</p>
|
What makes NSCalendarsUsageDescription required? <p>When I upload to iTunes Connect, my app gets the error that the <code>NSCalendarsUsageDescription</code> privacy is not provided. I am aware that this information is now mandatory, however I am not aware what and where my app uses something that would require this pri... | <p>You could try using <code>nm</code> tool to look for EventKit specific symbols in your frameworks binaries, something like:</p>
<pre><code>nm YourFramework.framework/YourFramework | grep EK # EK is a prefix for EventKit classes
</code></pre>
<p>Or one-liner (look for files without extension, also ignore CodeResour... |
Firebase Realtime Database doesn't update values <p>I have been writing an app using firebase database and for the last two days, it doesn't work.
What I mean by this is that I have a connection to the database, but when I try to read information by setting <code>addListenerForSingleValueEvent</code> it doesn't run the... | <p>As I stated later on, when I was trying to reduce the code, I found the <code>setLogLevel</code> method, which is used with <code>Level.DEBUG</code>, which I then used to discover the error:<br></p>
<blockquote>
<p>Error fetching token: The user's credential is no longer valid. The user must sign in again.</p>
</... |
Refresh subview using ajax and jquery in codeigniter? <p>For my CI project I am using Codeigniter & Boostrap.
Now my structure is that i have divided my view into two parts :</p>
<ol>
<li>_layout_main.php</li>
<li>subview</li>
</ol>
<p>So in each controller I first load subview and then the main layout.</p>
<pre... | <p>The best thing to solve your problem with AJAX you have to deal more with javascript or jquery. You don't have to call subview <strong>< ? php $this->load->view($subview); ?></strong> instead you update this div with what you want to display.
1. create a controller(used for ajax call) that accepts a parameter to ... |
Customizing embedded Git Gist text size in html file <p>I have an embedded gist on my html page to display some code. I'm wondering if there's a way to edit its default font size? After searching the web some people suggested to override gist's css. I'm not well versed in html or css, so apologies for the noob question... | <p>In my testing, I updated <code>.gist .blob-code-inner</code> to override the gist's default font setting. However, it did require <code>!important</code> to do so. Depending on how specific you get, you <em>may</em> not need to add <code>!important</code> to your styles.</p>
<h2>CSS code (in head)</h2>
<pre><code>... |
Any way to immediately draw multiple rects/circles in pygame? <p>Is there any way to draw a lot of circles/rectangles in pygame? I want to draw some objects every frame and I basically have all positions/sizes here ready in a numpy array.</p>
<p>Do I really have to run through a slow python <code>for</code>-loop? Does... | <p>Yeah, you do. It shouldn't be too much of a speed issue though: in a previous project I did, drawing up to 400 circles on the screen, every frame, at 60 frames per second, had virtually no lag.</p>
|
Render series of responses in selenium webdriver <p>I want to collect a series of responses when navigating a website, and afterwards "recreate" the process <strong>using the responses</strong>.</p>
<p>From an <a href="http://stackoverflow.com/questions/36785588/render-http-responsehtml-content-in-selenium-webdriverbr... | <p>You have to account for certain browser-specific things, like the fact that <a href="http://stackoverflow.com/a/9239272/771848"><code>#</code> and <code>%</code> have to be escaped if you use Firefox</a> - from what I understand, you can simply pass the content through <code>quote()</code>:</p>
<pre><code>try:
... |
How to handle can-connect errors correcly when connecting to a RESTful API <p>I've managed to load data and to save data. But cannot understand the error handling scheme needed.
When everything goes fine I receive the same object in that was sent but with an extra attribute <code>_saving</code> (false).</p>
<p>When so... | <p>Regarding the error handling ...</p>
<blockquote>
<p>Bad request (error on the console, don't want that)</p>
</blockquote>
<p>There's no way of preventing the error on the console. This is something chrome does.</p>
<blockquote>
<p>The response object (might be usefull to show an error)</p>
</blockquote>
<p... |
What's the best way to organize Routes in angular2 <p>I have questions about Routes in angular2. Today I'm using the same example as angular2 official tutorial.
The code is something like this (<a href="https://github.com/celsoagra/angular-typescript/blob/master/web/app/app.routing.ts" rel="nofollow">file link</a>):</p... | <p>Follow along the <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="nofollow">Routing & Navigation Guide</a>. More specifically, these parts:</p>
<p><strong>Create Feature Modules (Milestone #2)</strong>: For every component that handles a different responsibility, create a new folder in the app... |
Procedure to map all relationships between elements in a list of lists <p>I'm looking for an algorithm that can map all the relationships between all of the elements in sublists belonging to a list of length <code>n</code>. </p>
<p>More concretely, suppose <code>a</code>, <code>b</code>, <code>c</code>, <code>d</code>... | <pre><code>result = defaultdict(set)
for shift in shifts:
for worker in shift:
result[worker].update(shift)
# now, result[a] contains: a, b, c, d - so remove the a
for k, v in result.iteritems():
v.remove(k)
</code></pre>
|
How to get object's value in Pug? <p>I'm using Node.js to render a page using Pug. My JavaScript code:</p>
<pre><code>router.get('/', function(req, res, next) {
res.render("index",{
title:"é¦é¡µ",
user:{name:"luo",age:19}
});
});
</code></pre>
<p>My Pug code:</p>
<pre><code>script.
window.user = #{u... | <p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="nofollow"><code>JSON.stringify()</code></a> and change <code>#</code> to <code>!</code> to prevent the quotes from being escaped:</p>
<pre><code>script.
window.user = !{JSON.stringify(user)}
</code... |
perl regex to convert currency <p>i need some help in text cleaning/normalization process</p>
<p>i struck at a place where i need to convert a currency format</p>
<p>input: $100 million output: 100 million dollar </p>
<p>input: eur20 million output: 20 million euros</p>
<p>i'm using perl rege... | <p><code>[...]</code> in a regex introduces a character class, so <code>[million]</code> is the same as <code>[nolim]</code>, and it matches <em>one</em> of those characters.</p>
<p>I'd create a translation table for the currencies in a hash. From the keys of the hash, you can build a regex that matches them, and use ... |
SVG image hover animation not shown in css background <p>I'm having trouble displaying an animated SVG file correctly when used in a CSS background</p>
<h1>My Setup</h1>
<h2>SVG file</h2>
<p>The SVG file I use is basically a semi-transparent circle that gets fully opaque when hovered. It works as I expect it to work... | <p><code><svg> <animate></code> markup won't work when using an svg as a background image. In the example you gave, you can use a light circle and a dark circle along with <code>:hover</code> and <code>transition</code>, like so (note that I'm using straight svg in the <code>url()</code> - that works genera... |
How to rectify this error? <pre><code> python serve.py
/usr/local/lib/python3.4/dist-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead.
.format(x=modname), ExtDeprecationWarning
Traceback (most recent call last):
File "serve.py", line ... | <p><code>
from utils import get_config, set_config
</code></p>
<p>looks like <code>get_config</code> does not exists in <code>utils</code> library. </p>
<p>I think you need to give more details about your problem. </p>
|
Multivariate linear regression in pymc3 <p>I've recently started learning <code>pymc3</code> after exclusively using <code>emcee</code> for ages and I'm running into some conceptual problems. </p>
<p>I'm practising with Chapter 7 of <a href="https://arxiv.org/abs/1008.4686" rel="nofollow">Hogg's Fitting a model to dat... | <p>You may try by adapting the following model. Is a "regular" linear regression. But <code>x</code> and <code>y</code> have been replaced by Gaussian distributions. Here I am assuming not only the measured values of the input and output variables but also a reliable estimation of the their error (for example as provid... |
chrome Failed - Network Error <p>I have an ASP.NET application Hosted on server 2008.
Recently After latest chrome update to 53.0.2785.116m All of my downloads from server get fail.
<a href="http://i.stack.imgur.com/p2JB2.png" rel="nofollow">error image</a>
I tested chrome version 52, firefox and IE! all of them work.
... | <p>Finally I find the solution.
web servers by default set the "content-length" in header and also most of the browser auto correct the file size if its wrong.
in new version of google chrome (v53) the auto correct doesn't work.
And at the end I had to set "content-length" property in HTTP Context while flushing the fi... |
How does String substring work in Swift 3 <p>I've been updating some of my old code and answers with Swift 3 but when I got to Swift Strings and Indexing with substrings things got confusing. </p>
<p>Specifically I was trying the following:</p>
<pre><code>let str = "Hello, playground"
let prefixRange = str.startIndex... | <p>All of the following examples use </p>
<pre><code>var str = "Hello, playground"
</code></pre>
<h1>substring(to: String.Index)</h1>
<p>This takes the substring from the beginning of the string <strong><em>to</em></strong> the specified index.</p>
<pre><code>let index = str.index(str.startIndex, offsetBy: 5)
str.s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.