input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Appcelerator 4 cannot find Android SDK on Mac <p>Appcelerator Studio 4.7.1.201609100950 on Mac OS X cannot find Android SDK. I have downloaded it with the button on the Appcelerator Studio Dashboard. After download was successfully finished, the Appcelerator Studio was not able to recognise it.
I was getting the follo... | <p>Try reinstalling the program or check your <code>AppData</code>folder. Most times your <code>AppData</code> folder is hidden by default. Try to make it show and try looking for it there.</p>
|
Is there any way to detect overloaded member function by name alone? (not to detect name) <p>I am wishful here, but I want to be precise about the question. I want to improve implementation of detecting member templates by their names alone, but I came across an obstacle. I can't find any way to detect overloaded <code... | <blockquote>
<p>The question stays the same - Can we detect overloaded member functions, without specifying their arguments, or using mentioned trick? I know I'm maybe asking for impossible, but it never hurts to ask</p>
</blockquote>
<p>Actually, it is not impossible.<br>
It follows a minimal, working example:</p>
... |
Why is an error thrown from within an async function inside a bluebird promise not caught in the .catch() function? <p>In the following code example the function baz() throws a TypeError, when invoked within the <code>fs.open</code> callback inside the <code>new Promise</code> callback the node process exits immediatel... | <p>Because the exception occurs inside the <code>fs.open()</code> async callback so that exception goes back into the async event handler in <code>fs.open()</code> that called the completion callback where it then disappears and has no chance to be propagated anywhere. Bluebird never has a chance to see it. </p>
<p>... |
Not able to identify element on the screen- how to use tab <p>Screenshot of the element I want to click:</p>
<p><img src="http://i.stack.imgur.com/6dmCy.png" alt=""></p>
<p>I automating my website(new to automation). once i login i get to another page where selenium web driver is not able to find any of the elements(... | <p>Just get a random object like the body tag and use that to send your key presses. </p>
<p>e.g. </p>
<pre><code> WebElement dummyElement = driver.findElement(By.xpath("/html/body"));
for (int i = 0; i < 9; ++i) {
dummyElement.sendKeys(keys.TAB);
}
dummyElement.sendKeys(keys.ENTER);
</code></pre>
<p>The ... |
Mongoose - How do you update a specific object inside an array of reference objects? <p>I have this schema: </p>
<pre><code>var UserSchema = new Schema({
name: String,
username: {
type: String,
required: [true, "Please enter a username"],
minlength: [6, "Username must be at least 6 characters"],
ma... | <p>Here is the answer:</p>
<pre><code>update: function(req, res) {
User.findOneAndUpdate({
_id: "57f16436190a09099a1ddbde", "roommates._id": "57f1645c05ec06099ead3db6"
}, {$set: {"roommates.$.status": "active"}}, function(err, res) {
if (err) {
console.log(err);
} else {
conso... |
How to solve equations with 3 variables? <p>I have these 2 equations, found after a bunch of regression analyses studying the relation between the final value and a, b, and c individually. How do I solve them to find the values for a, b, and c?</p>
<p><code>0.76 = 25a * 15.25b * 11500c</code></p>
<p><code>0.70 = 26a ... | <p>For the general case, you can't. You need one equation for each unknown. If you've got one unknown, then trivially a = 123.4 is also the answer. If you've got two, then 3a + 2b = 10, 2a + 3b = 20. So how do we solve? The answer is that if we add them, we get 5a + 5b = 30. That doesn't help. But if we scale one equa... |
Join two datasets by using the first column in scala spark <p>I have two data sets like,
(film name, actress's name) and
(film name, director's name)</p>
<p>I want to join them by using the name of the film, so (film name, actress's name, director's name).</p>
<pre><code>import org.apache.spark.rdd.RDD
import org.apa... | <p>You have to create pairRDDs first for your data sets then you have to apply join transformation. Your data sets are not looking accurate.</p>
<p>Please consider the below example.</p>
<pre><code>**Dataset1**
a 1
b 2
c 3
**Dataset2**
a 8
b 4
</code></pre>
<p>Your code should be like below in Scala</p>
<pre><co... |
How can I select to print a different number of values without using relational operators? <p>A user picks whether to print 3 or 4 random numbers. How can I have my program print the desired number of values using a selection by calculation method? I am writing in C, but any algorithm/method of doing so would be helpfu... | <p>Here is a generic algorithm written in pseudocode to solve your problem. Note that the parameter for the function is the number of random numbers that the user selected. Also did you have a desired range for the random numbers? This example will only print numbers 1 - 10.</p>
<pre><code>function printNRandomNumbers... |
access hadoop intermediate map output files <p>Is it possible to access or read map intermediate output files i.e. sequential file- file.out ?
I want to read a file.out file. I used approach mentioned in this link, <a href="http://hadooptutorial.info/hadoop-sequence-files-example/" rel="nofollow">http://hadooptutorial.... | <p>If you want to read the output of the mapper use the following configuration argument while running the job</p>
<pre><code>-Dmapreduce.job.reduces = 0
</code></pre>
<p>It will set the number of reducers to 0, leading to 0 partitioners and only mappers result will be displayed in output directory.</p>
|
Recursively collect values for property using lodash <p>For a nested complex object or array, I would like to collect all values for a given property name. Example:</p>
<pre><code>var structure = {
name: 'alpha',
array: [
{ name: 'beta' },
{ name: 'gamma' }
],
object: {
name: 'd... | <p>This can be done elegantly with the following mixin, which is a recursive version of <code>_.toPairs</code>:</p>
<pre><code>_.mixin({
toPairsDeep: obj => _.flatMap(
_.toPairs(obj), ([k, v]) =>
_.isObjectLike(v) ? _.toPairsDeep(v) : [[k, v]])
});
</code></pre>
<p>then to get the result... |
How do I register a click event on the bottom canvas of two layered canvases <p>I have a game I'm working on which will have multiple canvases. One for the map, another for user interface, another for game objects, etc. The user interface canvas will be the top most canvas, but I'm wondering, if I wanted to register ... | <p>Set <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events" rel="nofollow"><code>pointer-events</code></a> to <code>none</code> on the <code>#ui</code> element. This will cause pointer-related events to be ignored by <code>#ui</code> and pass through to the underlying element:</p>
<pre><code>#ui{
... |
Value of type 'Set<UITouch>' has no member 'allObjects' <p>Hey in trying to track multiple touches and i get this error. And I know why i get the error its because of the Set at the top of the touchesbegin function. but i have to keep my Set in the overrideBegin. so how would i solve this error and make this code error... | <p>It's Swift's <code>Set</code>, not <code>NSSet</code>. Try:</p>
<pre><code>let touchesArray = Array(touches)
</code></pre>
<p>But I see that there's no need for such conversion here because you can iterate over set. Try only this:</p>
<pre><code>for touch in touches {
let point = touch.location(in: self.view)... |
Numpy not found in Python3 <p>I am trying to run numpy in Python 3, using the WinPy distribution. I put #!python3 at the top of the script, because I was told that is something that Winpy has that allows you to make it run in a certain version. If I run the script in the shell(Eclipse) it works fine, but when I try to ... | <p>The "#!python3" is to help the console determine the right version of python. However you need to make sure the path is correct. Instead of putting "#!python3", put "#!/usr/bin/" and then your python version, so "python" or "python3". </p>
<p>Check this article for more information on this. <a href="http://stackove... |
Java Selenium FirefoxDriver ignores Proxy settings <p>My following Java Code should open a Firefox Window and navigate to
<code>http://whatismyipaddress.com/ip-lookup</code> so I can see if my proxy settings worked.</p>
<pre><code> final String proxy = "86.100.118.44:80";
Proxy p = new org.openqa.selenium.Pro... | <p>Seems like Proxy support is simply not implemented in the current version of geckoDriver yet. </p>
<p>People claim workarounds exist.</p>
<p>Source:
<a href="https://github.com/mozilla/geckodriver/issues/97" rel="nofollow">https://github.com/mozilla/geckodriver/issues/97</a></p>
|
Serilog - RollingFile Sink does not roll files based on date and size <p>I am using Serilog - RollingFile Sink, but it stores all data in a single file for a day.
In my application, 1 GB log is written in a day. So I want to roll log file on the basis of date and size.</p>
<p>How can I configure RollingFile Sink to ro... | <p>From the <a href="https://github.com/serilog/serilog-sinks-rollingfile" rel="nofollow">documentation</a>:</p>
<blockquote>
<p>To avoid bringing down apps with runaway disk usage the rolling file
sink limits file size to 1GB by default. The limit can be changed or
removed using the fileSizeLimitBytes parameter... |
Best way to have text in one line using bootstrap <p>I have faced a styling problem.
What is the best way to have my text lines in a single line?
Screenshot of the problem:</p>
<p><a href="http://i.stack.imgur.com/xQqWU.png" rel="nofollow"><img src="http://i.stack.imgur.com/xQqWU.png" alt="enter image description he... | <p>Using CSS' <code>overflow</code>, your element needs to have somewhat fixed boundries. Since you're writing some plain text and your browser is wrapping that automatically into a new line and your elements boundries are getting exceeded. In order to disable that you'd have to use <code>white-space: nowrap;</code> fi... |
How to change values of a Bootstrap Dropdown with a specific id? <p>I have a typical Bootstrap Dropdown like this:</p>
<pre><code><div class="btn-group">
<button type="button" class="btn btn-lg btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Default option... | <p>This should work:</p>
<pre><code>$("#my-select li a").click(function () {
}
</code></pre>
<p><code>.</code>dot is used for classes</p>
<p>example: </p>
<pre><code><button class="myClass" ...>
$('.myClass')...
</code></pre>
<p><code>#</code>sharp used for ids</p>
<pre><code><button id="myButton" ...&... |
Trying to initiate a Maps Activity after clicking a item in a Navigation Drawer <p>Recently I'm doing an app that have a <em>Navigation Drawer</em> and I have some items wich clik it should open a maps activity but when doing so my app stops and show me the following error:</p>
<pre><code>FATAL EXCEPTION: main
Process... | <p><code>Geocoder.getFromLocationName</code> will return null or empty list if no matches were found or there is no backend service available (<a href="https://developer.android.com/reference/android/location/Geocoder.html#getFromLocationName(java.lang.String,%20int)" rel="nofollow">documentation</a>).</p>
<p>So, to s... |
Solved NullPointer exception but still have questions <p>If I am using <code>Test_Will_Give_Null_Pointer_Error</code> method I get a <code>NullPointerException</code></p>
<pre><code>Stack trace
FAILED: openURL
java.lang.NullPointerException
at SeleniumPracticePackage.CallUrl.**openURL**(CallUrl.java:63)
</code></pre>
... | <p>You override the prop global field:</p>
<pre><code>public void openBrowser() throws IOException
{
Properties prop = new Properties(); // HERE, this is a local field
}
</code></pre>
<p>To assign the new properties to the global prop field you need to do:</p>
<pre><code>public void openBrowser() ... |
How to add a WHERE clause conditionally without using CASE <p>I want to add a clause conditionally in the WHERE portion of a stored procedure but I understand that using CASE is really bad. Here's essentially what I'm trying to do:</p>
<pre><code>@StartDate
@EndDate
@ClientID
SELECT field_1, field_2, datefield_3
fro... | <p>Here it is :</p>
<pre><code>...
Where datefield_3 Between @StartDate AND @EndDate
AND (field_1 > 0 OR field_1 = @ClientID)
</code></pre>
|
Why is glReadPixels so slow and are there any alternative? <p>I need to take sceenshots at every frame and I need very high performance (I'm using freeGlut). What I figured out is that it can be done like this inside <code>glutIdleFunc(thisCallbackFunction)</code></p>
<pre><code>GLubyte *data = (GLubyte *)malloc(3 * m... | <p>OpenGL methods are used to manage the rendering <strong>pipeline</strong>. In its nature, while the graphics card is showing image to the viewer, computations of the next frame are being done. When you call <code>glReadPixels</code>; graphics card wait for the current frame to be done, reads the pixels and then star... |
Can't center a ul <p>I am trying to center my ul, but I can't seem to get it to center. I have tried using <code>display: table margin: 0 auto</code> That puts the ul in the middle, but not exactly in the center. I have also tried using <code>display: block</code> with <code>margin: 0 auto</code> but that doesn't cente... | <p>You can add this rule to the <code><ul></code>: </p>
<p><code>display: inline-block;</code></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-css lang-css prettyprint-override"><code>* {
margin: 0;
pa... |
Is it good practice to write a getter for a handle? <p>I am using glfw to create a window.
Right now I'm having trouble getting input from the keyboard, beacause the function expects a handle to the window, which is private and not in the same class.</p>
<p>I was thinking about writing a getter for the handle like thi... | <p>Use of get and set to access member variables directly is an anti-pattern. It means the class was badly designed. However sometimes you have to do it. But if a windowHandle is private, it's private for a reason, and you are simply subverting that.</p>
|
Rotating 2-vectors, moving backwards and skipping regions. C# <p>I am trying to use rotations of 2-vectors, but I have run into two problems. Firstly the vectors seems to be rotating backwards, and secondly, the vectors skip between two regions when they rotate.</p>
<p>this is the code I am using for the rotation (in ... | <p>I solved my problems by changing the functions <code>radians()</code> and <code>rotate()</code>. The other functions were fine.</p>
<p><code>radians()</code> fixed:</p>
<pre><code>public double radians()
{
return Math.Atan2(x, y); // swap the x and y
}
</code></pre>
<p><code>rotate()</code> fixed:</p>
<pre><... |
StyleCop error trying to access a file in the recycle bin <p>I'm using Microsoft Visual C# 2015 community edition on Windows 7 and just installed the latest version of StyleCop, leaving all settings at the default. Initially got the error about being unable to save documents, used the fix of creating a settings file in... | <p>Manually open the file <code>C:\aklo\aklo.csproj</code> in either Studio or a text editor and search for anything to do with the recycle bin, it looks like somehow a file in the recycle bin has been referenced in the project file. </p>
<p>If you correct that file reference then StyleCop should work.</p>
|
Subset Returns 0 Rows <p>I am new to R. I tried to pull data from a data frame <code>A</code> using <code>subset</code>
Data frame <code>A</code> looks like this:</p>
<pre><code>col a col b
1 1
1 NA
NA NA
1 1
</code></pre>
<p>I want to find out the group with col a =... | <p>To answer the "What is better ways to pull data using R" part of your question: you sould avoid using subset as it can cause problems and cannot be used to assign values. This has been discussed there:</p>
<p><a href="http://stackoverflow.com/questions/9860090/in-r-why-is-better-than-subset">In R, why is `[` better... |
problems with AVG and LIMIT SQL <p>So I am asked to find the query: <em>Find average stars awarded by top 20 users in user reviews (most experienced). Compare it with the average stars awarded by bottom 20 users (least expereinced)</em></p>
<p>the schema is:</p>
<p><strong>Restaurant</strong> (name)</p>
<p><strong>R... | <p>You are missing a <code>GROUP BY</code> statement, and you may want to remove the <code>DISTINCT</code>. You need something along the lines of:</p>
<pre><code>SELECT USER_NAME, USER_REVIEWS, AVG(REVIEW_STARS)
FROM TRIPADVISOR
GROUP BY USER_NAME, USER_REVIEWS
ORDER BY USER_REVIEWS desc
limit 20;
</code></pre>
|
Adding Things within a Layout causes a Crash <p>So There was a layout I wanted changed. So I added a linear layout to it and somehow it crashed code that wasn't even slightly related to it. So here Ill post some code.</p>
<p>Here is my main file and Ill point where the crash happens.
protected override void O... | <p>Your layout does not contain buttons with the ids <code>btnSignUp</code> and <code>btnSignIn</code>. You need to add them or remove the 4 lines in your activity code.</p>
<p><strong>Missing in your layout</strong></p>
<pre><code><Button
android:id="@+id/btnSignUp"
.../>
<Button
android:id="@... |
Need to write Magic 8 Ball while loop <p>The assignment says "using conditionals and a while loop, prompt the user to either ask another question of thank them for using the program, depending on what they decide."</p>
<p>Trying to figure out how to use a while loop to continuously prompt the user to decide if they wo... | <p>You could move the if-else statements to a switch ( rand ) case 1: break; ... basis. (<a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html" rel="nofollow">https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html</a>)</p>
<p>To continuously ask the player a question, I would us... |
Object property lost in loop <p>I'm working with the local storage for the first time and going through some JS tutorials online as I'm quite rusty. Making a dictionary where you can add words in 2 idioms then it displays. Everything is working fine with the exception of the second item in the object "dict", is not be... | <p>I think it's because you're using the variable "i" twice. In the inner for loop, try using "j" instead:</p>
<pre><code>for(var j = 0; j < buttons.length; j++){
buttons[j].addEventListener('click',remove);
}
</code></pre>
<p>Edit: In fact, you can probably remove the inner loop altogether, and just do:<... |
VS Code Syntax TypeScript Syntax Highlighting <p>I've recently started coding TypeScript in VS Code, but I did thought that the syntax highlighting is really bad. So I started to Google around and found out that at its best it could look like this:</p>
<p><a href="http://i.stack.imgur.com/JOLK5.png" rel="nofollow"><im... | <p>The syntax highlighting in VSCode is driven by textmate files. This is the repository : <a href="https://github.com/Microsoft/TypeScript-TmLanguage/" rel="nofollow">https://github.com/Microsoft/TypeScript-TmLanguage/</a></p>
<p>It recently (16 days ago) went through a massive refactor : <a href="https://github.com/... |
How do I adjust my layout? <p>I am moving from Android to IOS, and am following <a href="https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson2.html#//apple_ref/doc/uid/TP40015214-CH5-SW1" rel="nofollow">this</a> tutorial. The problem is that my layout is not adaptive, a... | <p>I think your UI is adaptive, it's just that in Xcode 8 the storyboard shows the UI in whatever device you have selected. If you look at the bottom of your screen in storyboard view it's says iPhone 6s, click that and you can select to view as a different device (iPad included). So even though it doesn't look like it... |
Trying ajax in Rails <p>I'm trying to use Ajax in RoR.
Could you please tell me what am I doing wrong?</p>
<p>Controller:</p>
<pre><code>def create
@post = Post.new(post_params)
respond_to do |format|
if @post.save
format.js
else
format.js
end
end
end
</code></pre>
<p>create.js.erb:</p... | <p>So your code looks fine except for these lines which need to be removed<br>
<code>$('#post_title').value('');</code><br>
<code>$('#post_content').value('');</code></p>
<p>I recreated the project and it worked when I removed those lines of code. Not sure why you need them in the first place because when you hit the ... |
How to get the selected value from dropdown list in PHP? <p>I am not able to retrieve the selected dropdown value to the PHP variable</p>
<pre><code><!DOCTYPE html>
<html>
<body>
<form action="#" method="post">
<select name="Color">
<option value="Red">Red</option>
<option... | <p>I think you should use javascript for this, I give you simple script that will get for you value of selected option. Function load when user change value on select.</p>
<p>Take a look:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<... |
Playing Card Switch Programing <p>Here is the program requirements I'm trying to run. I actually prefer If and Else statements, but once again, the requirement is to only use switch statements. </p>
<p>Create a new Java class inside your project folder.
The name of the class should be: CardConverter</p>
<p>Write a p... | <p>You are, indeed, missing something.</p>
<p><code>case "1":</code> declares that if the switch variable (<code>userinput</code>) matches the case (<code>"1"</code>) then the following code will be executed:</p>
<pre><code>userinput.contains("AH");
System.out.println("Ace of HEARTS");
</code></pre>
<p>It seems like... |
How to provide type safety in a two dimensional type hierarchy? <p>Consider the following class hierarchy:</p>
<pre><code>class A {};
class B : public A {};
class C : public A {};
class D : public A {};
</code></pre>
<p>Assume that it is not trivially reducible: B, C and D have at least one pairwise disjunct member d... | <p>That should do it.</p>
<pre><code>template<typename L>
class V : public std::vector<L*> {}; // all members of original AV
class AV : public V<A> {}; // now empty
class BV : public V<B> {}; // as before
class CV : public V<C> {}; // " "
class DV : public V<D> {}; // " "
</c... |
Javascript only loaded first time or upon refresh <p>I'm building a cross-platform app with Cordova and jQuery Mobile 1.4.5, i have a simple <code>html</code> page which should load a <code>javascript</code> file. </p>
<pre><code><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-... | <p>With jQuery Mobile <code>index.html</code> becomes a container for all pages in your app. So when the user navigates to <code>a.html</code>, its content is injected into the DOM already created for <code>index.html</code>. Script in <code>index.html</code> remains active. <code>index.html</code> content remains in t... |
Android goldfish Kernel compilation <p>I'm trying to run modified android kernel on android lollipop. I downloaded Android sdk api-22 x86 and compiled goldfish using these commands:</p>
<pre><code>$ git clone https://android.googlesource.com/kernel/goldfish.git
$ cd goldfish/
$ git checkout -t origin/android-goldfish-... | <p>Try compiling goldfish v3.10 or 3.18, these are available here - <a href="https://android.googlesource.com/kernel/goldfish/" rel="nofollow">https://android.googlesource.com/kernel/goldfish/</a>
As you can see in outputs, you are compiling 3.4 kernel when emulator requires >=3.10.</p>
|
Comparing value in Access report field to a query using VBA <p>I currently have a report that lists steps for various tasks and tracks the revision count. Each page is one task, with all of the steps under it. At the end of the report is a Revision history where it will list what was changed to update the revision coun... | <p>Not sure exactly what fields are in your table, but maybe I can assume you're trying to match TaskID to the Report Task field?</p>
<p>From <a href="https://support.office.com/en-us/article/DLookup-Function-8896cb03-e31f-45d1-86db-bed10dca5937?ui=en-US&rs=en-US&ad=US&fromAR=1" rel="nofollow">the DLookup ... |
multiplying list of items by a certain number 'x' <p>How would you write a procedure that multiplies each element of the list with a given number (x).If I give a list '(1 2 3) and x=3, the procedure should return (3 6 9)</p>
<p>My try:</p>
<pre><code>(define (mul-list list x)
(if (null? list)
1
(list(* x (car list))(... | <p>This is the text book example where you should use <a href="https://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" rel="nofollow"><code>map</code></a>, instead of reinventing the wheel:</p>
<pre><code>(define (mul-list lst x)
(map (lambda (n) (* x n)) lst))... |
Plotting a solid cylinder centered on a plane in Matplotlib <p>I fit a plane to a bunch of points in 3d and initially gave it an arbitrary size using np.meshgrid, but now I'm trying to plot a cylinder centered on that plane and oriented the same way (such that the plane fit would cut the height of the cylinder in half)... | <p>I have modified a solution to a question <a href="http://stackoverflow.com/questions/38076682/how-to-add-colors-to-each-individual-face-of-a-cylinder-using-matplotlib">How to add colors to each individual face of a cylinder using matplotlib</a>, removing the fancy shading and adding end caps. If you want to show the... |
Keep two floated divs on the same line inside a smaller container <p>I'm trying to build a layout that roughly looks like <a href="https://jsfiddle.net/bdxs8x9r/1/" rel="nofollow">this JSFiddle</a>. Now, the problem is: </p>
<p>I have this two wrappers inside my <code>container</code>, one is for the sidebar and the o... | <p>If your purpose is for <code>wrapper-inner-container</code> to take up the remaining space with <code>wrapper-sidebar</code> visible or not. Then you can do this be leaving out the width of <code>wrapper-inner-container</code> and removing <code>float: left</code>. It will then automatically size to 100% available s... |
Firebase Notifications triggers wrong delegate on iOS 10 <p>I am using <code>Firebase</code> to set up push notifications on iOS 10.
My app is receiving remote messages while in the foreground, but not in the background. Background messages are only received on opening the app.</p>
<p>Somehow all push notifications ar... | <p>Got the same problem. In my case it is ok from test account, but have the same prob</p>
|
C++ code runs on windows but shows bad_alloc error on ubuntu <p>When i run this on windows it works fine.But I obtained the following error when I execute my program On ubuntu it terminates by throwing the following error message:</p>
<pre><code>'std:bad_alloc' what():std::bad_alloc Aborted(core dumped)
</code></pre>
... | <p>After the question was edited to include a proper MCVE, the answer appears to be obvious:</p>
<pre><code>symbolTable::symbolTable(int ts){
table=new symbolInfo* [tableSize];
tail=new symbolInfo* [tableSize];
</code></pre>
<p>The <code>tableSize</code> class member is not initialized to anything. At this poin... |
Arithmetic operation successful in C# - Throws exception in VB <p>Code in C#:
address = glowObject + (glowIndex * 0x38) + 0x4;
Code in VB:
address = glowObject + (glowIndex * &H38) + &H4</p>
<p>I inserted a breakpoint on that line in both my C# code and VB code.
The values were the same in both.
C#: Br... | <p>In C#, arithmetic operations are unchecked by default, which means that arithmetic overflow is not checked at runtime. You can control this with the <a href="https://msdn.microsoft.com/en-us/library/khy08726.aspx" rel="nofollow"><code>checked</code>/<code>unchecked</code> keywords, and/or with the <code>/checked</co... |
API standard for JS / C# interface - Camel vs. Pascal case <p>We have a system where a server written in C# implements a REST interface and the client is written in JS, most of the data is passed as JSON.</p>
<p>In a way there is here a collision between the camelCase and PascalCase worlds.</p>
<p>The parameters most... | <p>I do not know if it is full answer because it is not clear what exactly you want to achieve.</p>
<p>Obviously C# is Pascal case and JSON is Camel case.</p>
<p>So for our web ASP.Net Web API app we have implemented DataConverter for Json.NET:</p>
<pre><code>public class DataConverter : JsonConverter
{
#region ... |
UISliders and setting values <p>I have a code I am writing and its going well but I am having trouble with UISliders...specifically...setting values. I have used the sliders and now I want to reset them to the original state (0 to 10 with a value of 0 and the slider all the way to the left. I have...</p>
<p>@IBOutlet ... | <p>This error is going to happen because the value of your slider is nil. Check your connections to make sure that your storyboard slider is connected to the slider variable.</p>
|
Pass root domain to JS Script <p>I want to replace facebook.com with my root domain</p>
<pre><code><script>
ga('require', 'linker');
ga('linker:autoLink', ['facebook.com']);
ga('send', 'pageview');
</script>
</code></pre>
<p>How can I get the root domain where this code is installed and replace face... | <p>The <code>window.location</code> object has many properties including <code>hostname</code></p>
<p>If I understand you correctly you want:</p>
<pre><code>ga('linker:autoLink', [window.location.hostname]);
</code></pre>
<p>On this page for example it would return <code>"stackoverflow.com"</code></p>
|
How can I convert Twitter API post time/date to valid ISO format? <p>I'm building a twitter interface and I want to display the times like Twitter itself. </p>
<p>I perform a GET request and grab the tweet, I then pass it into <code>moment.js</code> in order to convert it.</p>
<p>Here is a code snippet of this:</p>
... | <p>I would refer to the section in the docs on strict mode. <a href="http://momentjs.com/guides/#/parsing/strict-mode/" rel="nofollow">http://momentjs.com/guides/#/parsing/strict-mode/</a>
you can use your code and then add your desired format as a string for the second argument and true as the third argument and chai... |
How do i implement a play again feature? <p>I would like to be prompted when the game finishes;
If I would like to play again.
And with a Y/N input: either exiting the game or repeat it.</p>
<p>How do I go about this in the most efficient way?</p>
<p>EDIT: Description Resource Path Location Type
The method... | <p>Add a loop to your main method:</p>
<pre><code>public static void main(String[] args) {
do {
ScaredyCat game = new ScaredyCat(new Player("Urkel",23),new Player("Steve", 18));
game.play();
} while(playAgain());
}
private static boolean playAgain() {
Scanner keyboard = new Scanner(System.... |
Grab Instagram Follower count <p>So I have a question what would be the method to just grab the instagram follower count for a said user? </p>
<p>I have looked at two possible options the official instagram API, but I couldn't find a specific method named on how to do so, but they do have a some user endpoints, but co... | <p>You can request <code>https://www.instagram.com/<username>/?__a=1</code> and receive JSON with account information also with followers count as well. It doesn't need authorization.</p>
|
BouncyCastle: Extract public key from Certificate causes NullPointerException <pre><code>import com.security.crypto.Configuration.Properties;
import org.apache.commons.codec.binary.Base64;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence... | <p>For reasons that are not entirely clear to me you must add the Bouncycastle JCE provider. So, at the start of main, you need</p>
<pre><code>Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
</code></pre>
|
Making my jquery slider responsive <p>I've created my jquery slider, and now I'm having issues trying to make it responsive. the navigation dots and navigation buttons can be positioned at fixed height. But I want to position next button to the center right of the carousel and wanted to do it in %. so, I give height:10... | <p>Check <a href="http://codepen.io/anon/pen/amVJWd" rel="nofollow">this</a> out. I believe what was happening was that your next and prev were adjusting to the height of the screen and not the height of the images like you were hoping. </p>
<p>So to customize this, first set the height and width of your images to wha... |
Loading External HTML into DIV <p>In my html I have a div id="mainWrapper" that I want to insert html markup that I created in an external js file. How can I do this without eliminating any existing divs inside "MainWrapper"? I want the external markup to be a child of "mainWrapper". Below is my external JS file and t... | <p>I'm not sure I understood what you want. But if that is to append html within a node without loosing childs, you could do it like so:</p>
<pre><code>function renderMarkup(markup) {
var main_wrapper = document.getElementById('mainWrapper');
main_wrapper.innerHTML += markup;
}
</code></pre>
<hr>
<p>Jquery gives... |
AdMob ads in app not working on some devices <p>Can anyone tell what could be the solution of this problem? I added everything in gradle, manifest etc.</p>
| <p>It might be ad layout too small to display in some devices</p>
|
How to choose which JDBC driver to use? <p>I have included the MySQL connector dependency and h2database dependency to my project. I then try to get an H2 JDBC connection, but an exception is thrown instead from what looks like the MySQL JDBC connector.</p>
<pre><code>DriverManager.getConnection("jdbc:h2:mem:test", "s... | <p>This is a reported bug:</p>
<p><a href="http://bugs.mysql.com/bug.php?id=82896" rel="nofollow">Bug #82896</a></p>
<blockquote>
<p>[7 Sep 21:33] Artem Lodygin Description: Attempt to connect to mySql
JDBC driver with unsupported URL causes WrongArgumentException
stacktrace to be printed to console, such as:</... |
How can I replace the vowels of a word with underscores in python? <p>I'm a beginner learning the python language and I'm stumped on how take the vowels of a word and replacing them with an underscore. </p>
<p>So far this is what I have come up with and it just doesn't work</p>
<pre><code>word = input("Enter a word: ... | <p>You can use <code>string.translate</code> and <code>maketrans</code>.</p>
<pre><code>from string import maketrans
vowels = "aeiouy"
t = "______"
st = "trying this string"
tran = maketrans(vowels, t)
print st.translate(tran)
# Gives tr__ng th_s str_ng
</code></pre>
<p>You may also want to check uppercases.</p>
|
comparing cells to a any cells in a given column <p>I have the following columns in Excel.</p>
<p><a href="http://i.stack.imgur.com/M0693.png" rel="nofollow"><img src="http://i.stack.imgur.com/M0693.png" alt="enter image description here"></a></p>
<p>What I'm trying to do is to get data from two sets of column transf... | <p>Although Vlookup is a formula that will work for your needs, it does come with some <a href="http://www.mbaexcel.com/excel/why-index-match-is-better-than-vlookup/" rel="nofollow">limitations</a>. Better start using the best way from the start, which is nesting a Match formula in an Index one. With the example provid... |
Polymer: access properties of parent or other elements <p>How do I access properties of parent or other elements in Polymer?</p>
<p>For example my top-most element is "my-app".</p>
<p>Now I am in an element called "my-element-1", how would I access/reference any properties from "my-app" using Javascript?</p>
<p>Furt... | <p>1 In a closed parent-child pair like with the <code>iron-pages</code> you can take advantage of the <a href="https://elements.polymer-project.org/elements/iron-pages#property-selectedAttribute" rel="nofollow">selectedAttribute</a> and <a href="https://elements.polymer-project.org/elements/iron-pages#property-selecte... |
Detect the position,orientation and color in Matlab of not overlapped Tiles to be picked by robot <p>I am currently working on a project where I need to find the
square shape tiles in pile which are not overlapped,
am currently working on a project where
I need to determine the orientation , position (center ) ,and ... | <p>You've separated the image into tiles and background. So now simply label all the connected components. Take each one and test for single tile-ness. If you know the approximate size of the tiles, first exclude by area. Then calculate the centroid and the extreme left, right, top and bottom. If it is tile, the inters... |
how to select both true and false column value in mysql <p>I'm having a table called file_download.
I need to display </p>
<ol>
<li>downloaded file list -
<code>select * from file_download where downloaded = 1;</code></li>
<li>not downloaded file list -
<code>select * from file_download where downloaded... | <p>There are three ways to do the same</p>
<p>Using OR (cheaper in cost) </p>
<blockquote>
<p>select * from file_download where downloaded = 1 or downloaded = 0</p>
</blockquote>
<p>Using IN (short and accurate way) </p>
<blockquote>
<p>select * from file_download where downloaded in (0, 1);</p>
</blockquote>
... |
publish the nth attribute from a model <p>I have a model student with a subject and grade attribute. A student can have many subjects and grades, and what I'd like to do is be able to publish the 2nd or 3rd subject listed for a specific student. </p>
<p>For example, the user searches for a student, then clicks on th... | <p>Try adding this code:</p>
<pre><code> <%= @student.grade.split(',')[0] %>
</code></pre>
<p>The [0] will publish the first item in the array. [1] will publish the 2nd item, etc. That should work.</p>
|
Error installing mfpdev-cli <p>I'm trying to install the mobile first CLI, used this command: npm install -g mfpdev-cli</p>
<p>But I'm getting errors. I downgraded my npm to 3.10.6 because I found out that there maybe issues on the latest version.</p>
<p>Error:</p>
<pre><code>npm install -g mfpdev-cli
npm ERR! fetc... | <p>Update: a fix has been released to NPM. </p>
<p>This is a known issue with MobileFirst CLI and version 3.10.x of npm. Downgrade to 3.9.x or 3.8.x and the installation will pass successfully. </p>
|
string is not recognized as a datetime <blockquote>
<p>The value is from the database and the problem is coming only on one member registered</p>
</blockquote>
<p>We're are coding for the file maintenance to edit and delete.</p>
<p>Check my error <a href="http://i.stack.imgur.com/ZeWWh.png" rel="nofollow">here</a><... | <pre><code> private void dBirth_ValueChanged(object sender, EventArgs e) {
TimeSpan age = DateTime.Now - dBirth.Value;
int years = DateTime.Now.Year - dBirth.Value.Year;
if (dBirth.Value.AddYears(years) > DateTime.Now)
{
txtAge.Text = years... |
Asking user to plot two columns in a csv file without him typing the entire column name? <p>My current code:</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-html prettyprint-override"><code>import panda... | <p>One way to do is to use filter in pandas for that purpose.</p>
<pre><code>df.filter(regex=(yaxis))
</code></pre>
<p>It will display all the columns matching that substring of yaxis</p>
<p>here is an example.</p>
<pre><code>A = { 'Name': [ 'John', 'Andrew', 'Smith'] , 'Age' : [20,23,42]}
A
Out[19]: {'Age': [20, ... |
recursively input .sql files as new databases <p>I have a folder with alot of database files as .sql files.</p>
<p>I want to input them into mysql with new databases as the name of the file.</p>
<p>So if a file is name conference_2016.sql, I want the script to take that file and input its contents into a new database... | <p>I think you can use this script:</p>
<pre><code>#!/bin/bash
databases=$(ls *.sql)
for database in ${databases};do
name=${database%.*}
mysql -u root -ppassword -e "CREATE DATABASE IF NOT EXISTS ${name} DEFAULT CHARACTER SET utf8;"
mysql -u root -ppassword ${name} < ${database}
done
</code></pre>
<p... |
AWS lambda Java open http socket times out <p>I'm running the following in AWS Lambda, inside my handler function:</p>
<pre><code>URL url = new URL("www.sfsuperiorcourt.org");
URLConnection connection = url.openConnection();
connection.setConnectTimeout(2000);
connection.connect();
</code></pre>
<p>This is inside a h... | <p>If you set up your lambda in a VPC, and you do not need it in that VPC, just have the lambda in <strong>no</strong> VPC at all. </p>
<p>Otherwise, read my answer <a href="http://stackoverflow.com/a/39206646/3454745">here</a>. </p>
|
SQL: multi-part identifier "c.name" could not be bound <p>I am modifying a script from mssqltips.com that generates a script to recreate all indexes in a database. I am enclosing it in a TRY and the CATCH will call a stored proc and passes it 5 arguments. One of them, c.name is intended to be the primary key of the par... | <p>There is no object with 'c' as alias in your inline query. That is the reason for getting this error.If you wanted to get the column name, then use 'sc.name' instead of 'c.name'.</p>
|
R : quantmod's chartSeries addRSI show different answer than TTR's RSI <p>Difference seen between quantmod packageâs chartSeries()+addRSI() and TTRâs RSI()</p>
<p>chartSeries shows RSI at 54.50
and TTR shows it at 73.49</p>
<p>Any reason why the difference ?</p>
<p>Thanks
GW</p>
<pre><code>todate = Sys.Date()
... | <p><code>rsi <- RSI(price, 2)</code> is using <code>n=2</code>, whereas <code>addRSI</code> is using the default <code>n=14</code> since you did not pass in the value of <code>n</code> in <code>addRSI</code>.</p>
|
Getting PostgreSQL percent_rank and scipy.stats.percentileofscore results to match <p>I'm trying to QAQC the results of calculations that are done in a PostgreSQL database, using a python script to read in the inputs to the calculation and echo the calculation steps and compare the final results of the python script ag... | <p>You can use <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rankdata.html" rel="nofollow"><code>scipy.stats.rankdata</code></a>. The following example reproduces the result shown at <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_WF_PERCENT_RANK.html" rel="nofollow">http://docs.aws... |
Form not working unless underyling query re-saved <p>I'm a newcomer to Access trying to cobble things together from helpful information I've found here. </p>
<p>I have a form that needs to populate the fields based on a combo box selection in the form header. The form is based on an underlying query with the following... | <p>This is old bug in MS Access, I have no idea why they still didn't fix it:
If underlying form's query has in criteria form's control and the form was filtered once (at start or manually/using VBA), it doesn't accept new values from form's control and uses old value.</p>
<p>Workaround: create public function, which ... |
I can not get my loop to end <p>I am trying to create a higher or lower game in python but can't get my loop to end. it just keeps going. My code looks like this</p>
<pre><code>a = 0
def ask(b, d, p):
global a
while a < d:
global question
question = int(input())
if question < b:
... | <p>Without knowing what the rest of the code is here is what I can offer.</p>
<p>In the code provided you have <code>d1 == p1</code> but they are never called or assigned in that area so they will never change. Therefore your loop can never progress because they variables inside it do not control it.</p>
<p>edit: I'm... |
How to determine Laravel Projects running in Homestead <p>So I have two laravel projects running in homestead. Everything's running well in my PC where the projects are located. But in the other computer in a network, it won't work.</p>
<p><strong>Here's my Homestead.yaml:</strong></p>
<hr>
<pre><code>ip: "192.168.1... | <p>You are using a virtual machine with an assigned IP address 192.168.10.10</p>
<p>The machine running the Homestead VM will access it through that IP address.</p>
<p>Your hosts file is an alias to that IP address of the VM Homestead.</p>
<p>..</p>
<p>If someone then takes the vagrantFile of your instance they can... |
conditional simple/comple types in XSD <p>I would like to create Schema Definition for the following xml:</p>
<p>price node may have simple numerical value:</p>
<pre><code><price>1000000</price>
</code></pre>
<p>or price node may have <strong>one and only</strong> child <code>daily</code>:</p>
<pre><cod... | <p>In XSD, you cannot allow both simple and complex content unless you're willing to have mix elements and text via <code>mixed="true"</code>. You <em>could</em> then used XSD 1.1 assertions to exclude both from appearing simultaneously.</p>
<p>However, you're swimming upstream here. Instead, change your XML design ... |
is the best option use a thumbnail creator? or is better use styles? for a maximum size on image <p>Just a quick question, I have a fixed space in my site (100px x 210px) to include an image that user will upload (be aware that user can upload any image with any size) </p>
<p>I can show smaller images, but I can not d... | <ol>
<li><p>At the time of image upload, create a thumbnail image of size
100X210 (if and only if image size is greater than >100X210.) & show them where you want to show. I think this is the best solution</p></li>
<li><p>At the time of showing the image, create the thumbnail of required size.( Not suggested.but if... |
Update model through UIButton within a UITableViewCell <p>In <code>MainVC.swift</code> I'm capturing the tag of my custom "<code>PlayerCell</code>". I want to press the<code>increaseBtn</code> (<code>UIButton</code>) which will increment the <code>playerLbl.text</code> (<code>UILabel</code>) by one but also update my m... | <p>I would use the delegate pattern in this case. Create a protocol that Main.swift implements, and that PlayerCell.swift uses as an optional property. So for example:</p>
<pre><code>protocol PlayerIncrementor {
func increment(by: Int)
func decrement(by: Int)
}
</code></pre>
<p>Then use an extension on Main.s... |
Java: Including spaces when finding the length of the string <pre><code>Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
System.out.println("Please enter a string: ");
String a = input.next();
System.out.println("Please enter another string: ");
String b = input2.next();
int s1 = a.l... | <p>When using input.next(), whitespace is considered a delimiter that separates the tokens accepted by the scanner. So when the scanner reads in your sentence "i like dogs" it finds 3 separate tokens separated by the whitespace. You can either specify a delimiter using the useDelimiter method of the scanner class such ... |
AWS Bitnami Parse Server - Adding HTTP authentication makes my apps in parse dashboard 'unauthorized' <p>I have recently setup an EC2 Bitnami Parse Server and everything was working fine. I was able to access my apps through the dashboard.</p>
<p>Then I decided to add HTTP authentication to ensure I'm the only one wit... | <p>This is a known issue related with having both Parse and Parse Dashboard in the same server. There is an opened issue in GitHub:</p>
<p><a href="https://github.com/ParsePlatform/parse-dashboard/issues/394" rel="nofollow">https://github.com/ParsePlatform/parse-dashboard/issues/394</a></p>
<p>We (Bitnami) opened a t... |
Passing parameter in hive is not working <p>Passing parameter in hive is not working for me. My code:</p>
<pre><code>hive> set x='test variable';
hive> ${hiveconf:x};
</code></pre>
<p>I get this error:</p>
<blockquote>
<p>FAILED: Parse Error: line 1:0 cannot recognize input near <code>''test variable'' '<... | <p>Try :</p>
<pre><code>hive> set x='test variable';
hive> set;
</code></pre>
<p>You will see value of <code>x</code> variable among values of many variable.</p>
|
Youtube API Dynamic iFrame <p>I'm trying to load a youtube video dynamically (iframe is generated on click after the page has loaded) with the ability to control the playback using the Youtube API.</p>
<p>What I have found is that if the iFrame is not present on the page when the API is loaded I can't seem to get the ... | <p>Small typo in <code>enbalejsapi=1</code> should be <code>enablejsapi=1</code></p>
<p>Add iframe <a href="http://www.w3schools.com/tags/att_iframe_sandbox.asp" rel="nofollow">sandbox</a> attributes so that outer script can access the iframe</p>
<pre><code>iframe.setAttribute( "sandbox", "allow-same-origin allow-scr... |
program calling multiple functions at once keeps crashing. (C programming) <p>Hi I am currently trying to learn how to program, and I have been mucking around with structs and pointers in C. So I just made this really random rock paper scissors esque program that works partially but will eventually crash after a couple... | <p>You have <code>%s</code> in <code>printf()</code> instead of <code>%d</code> several times, too many arguments in other places and <code>scanf("%s",&hode );</code> must be <code>scanf("%s",hode );</code> every time. Please listen to your compiler if it utters warnings, the compilers is almost always right in tha... |
Connect Multiple Microsoft Visual Studio to same projects <p>Me and my couple of friends will start working on a C# database project. We will use Microsoft VS 2015 and SQL Server 2014. Is there any way that our Visual Studio (installed on separate laptop) can connect to the same project? </p>
<p>For example, if one of... | <p>If you have db project in Visual studio you should connect it to some version control. After that every change done by your friends will be fetch/pull on your local machine and you will execute the db project. Same is for code changes in your main project. Read about svn and git and choose what is better for you.</p... |
NoMethodError in MoviesController#upvote <p>I'm working on a project, and for the life of me, I'm not sure what's going on. My code was working earlier, now I'm getting </p>
<pre>NoMethodError in MoviesController#upvote</pre>
<p>When I try and vote on a certain movie, here is my "movie_controller.rb" </p>
<pre><code... | <p>The problem is that you are setting a <code>@movies</code> variable instead of <code>@movie</code>. That's why you are getting a <code>undefined method upvote_from' for nil:NilClass def upvote @movie.upvote_from</code></p>
<p>Change this part of the code</p>
<pre><code>private
def set_movie
@movies = Movie.find... |
jquery keep the variable, dont set it to 0 every time <p>My code rotates the image only once - 90' and then stops working. Like the <code>angle</code> is always being set to <code>0</code> every time I call it. How do I fix this? I need to keep the angle in the variable.</p>
<p><strong>FILE1.js</strong></p>
<pre><cod... | <p>You must capture the variable you wish to "remember".</p>
<p>File 1:</p>
<pre><code>$(function () {
$('.rotate-receipt').on('click', rotateImage(0, $('.rotate-receipt')));
});
</code></pre>
<p>File 2:</p>
<pre><code>var rotateImage = function (angle, element) {
var $e = $(element);
var index = $e.data('but... |
Python how to convert a value with shape (1000L, 1L) to the value of the shape (1000L,) <p>I has a variable with a shape of (1000L, 1L), but the structure causes some errors for subsequent analysis. It needs to be converted to the one with the shape (1000L,). Let me be more specific. </p>
<pre><code>import numpy as np... | <p>There are a lot of ways you could do that, such as indexing:</p>
<pre><code>a = b[:, 0]
</code></pre>
<p>raveling:</p>
<pre><code>a = numpy.ravel(b)
</code></pre>
<p>or reshaping:</p>
<pre><code>a = numpy.reshape(b, (-1,))
</code></pre>
|
Iphone Safari browser: VideoJS is not triggering the progress event <p>I'm trying to capture the "progress" event of the video element on iPhone's Safari but no event gets captured. </p>
<pre><code>"Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_3 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G3... | <p>I figured it out. Mobile Safari doesn't preload any video data if you set the Preload attribute on the video element. Hope that helps. =)</p>
|
UnsafePointer no longer works in swift 3 <p>After I convert from swift 2 to swift 3, there is an error pop up for the below metioned line</p>
<pre><code>let value = UnsafePointer<UInt32>(array1).pointee
</code></pre>
<blockquote>
<p>'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily ... | <p>You can try this:</p>
<pre><code>let rawPointer = UnsafeRawPointer(array1)
let pointer = rawPointer.assumingMemoryBound(to: UInt32.self)
let value = pointer.pointee
</code></pre>
<p>Raw pointer is a pointer for accessing untype data.</p>
<p><code>assumingMemoryBound(to:)</code> can convert from an <code>UnsafeRaw... |
Simulators are not showing up for every newly created project <p>When I try to create new project in Xcode 8,simulators are not showing up which are already downloaded in previous project.</p>
| <p>Click on the name of your project (which is on the right hand side of the Run button). Three options will appear.</p>
<ol>
<li>Edit scheme</li>
<li>New scheme</li>
<li>Manage scheme
You can click on "New scheme" and then click on "OK" in popup window.</li>
</ol>
<p>You will get the simulators back. Cheers.</p>
<p... |
Angular 2 - zone.js:355 Unhandled Promise rejection: Template parse errors: 'stocks' is not a known element: <p>Working my way through the Udemy course "Ultimate Angular 2 Developer with Bootstrap 4 & TypeScript" (<a href="https://www.udemy.com/ultimate-angular-2/learn/v4/overview" rel="nofollow">https://www.udemy.... | <p>Problem is with <strong>selector</strong>.</p>
<p><strong>stocks.component.ts</strong> </p>
<pre><code>import {Component} from '@angular/core'
@Component({
selector: 'stock', //<<<===stock selector is used in AppComponent
template: '<h1>Stocks</h1>'
})
export ... |
How to show each cell table data in popup window using datatables? <hr>
<p>How to show the popup for each cell with its table data using Datatables?</p>
<p>In the below script script i had used datatables plugin along with alert to show popup each cell but am not getting the proper output?How can i modify the script ... | <p>Important Note: Before adding code please include js && css to your page refer js which are use fiddle External Resources section. </p>
<p>Revamp your click function to on click function.</p>
<p>Javascript :</p>
<pre><code>$(document).ready(function () {
var companyTable= $('#jobs').DataTable();
... |
Swift 3 - ! vs ? for optional function parameters <p>In Swift 3, when one has optional function parameters, what is the difference between functions with:</p>
<pre><code>func doThis(num: Int!)
</code></pre>
<p>and</p>
<pre><code>func doThat(num: Int?)
</code></pre>
| <p>Both declare that <code>num</code> is an optional <code>Int</code>.</p>
<p>If you do <code>Int!</code> it can be implicitly unwrapped inside of your function.
That means you can use it in places where a plain (non-optional) <code>Int</code> is required. In that case, it will fail if it happens to be <code>nil</code... |
ValueError: Cannot have number of splits n_splits=3 greater than the number of samples: 1 <p>I am trying this training modeling using train_test_split and a decision tree regressor:</p>
<pre><code>import sklearn
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
from sk... | <p>If the number of split is greater than number of sample, you will get the first error. Check the snippet from the <a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/model_selection/_split.py#L315" rel="nofollow">source code</a> given below.</p>
<pre><code>if self.n_splits > n_samples:
... |
Android: Adding only two sets of drawables <p>Is there any way to use only two sets of drawables, one for xxxhdpi and xxhdpi and the other one for xhdpi/hdpi/mdpi/ldpi without having to create 6 drawable-{dpi} folders and duplicating the files.</p>
| <p>You can.
Use <a href="https://www.wikiwand.com/en/Scalable_Vector_Graphics" rel="nofollow">SVG Images</a> instead of PNG or normal extension pictures.
Then use the following link to convert the <a href="http://a-student.github.io/SvgToVectorDrawableConverter.Web/" rel="nofollow">SVG to Vector</a>.
Use vector as yo... |
python: could not broadcast input array from shape (3,1) into shape (3,) <pre><code>import numpy as np
def qrhouse(A):
(m,n) = A.shape
R = A
V = np.zeros((m,n))
for k in range(0,min(m-1,n)):
x = R[k:m,k]
x.shape = (m-k,1)
v = x + np.sin(x[0])*np.linalg.norm(x.T)*np.eye(m-k,1)
... | <p><code>V[k:m,k] = v</code>; <code>v</code> has shape (3,1), but the target is (3,). <code>k:m</code> is a 3 term slice; <code>k</code> is a scalar.</p>
<p>Try using <code>v.ravel()</code>. Or <code>V[k:m,[k]]</code>. </p>
<p>But also understand why <code>v</code> has its shape.</p>
|
couldn't figure out the issue with angular routing / ng-repeat. <p>The <strong>aboutus.html</strong> page is displayed correctly, except the content in the <strong>ng-repeat</strong> within <strong>media-list</strong> in <strong>aboutus.html</strong>. there are no errors displayed in the console. I have not included t... | <p>I think what you want is:</p>
<p><code>
$scope.leaders = corporateFactory.getLeader();
</code> </p>
<p><code>this.leadership</code> is not defined. </p>
|
Write to file in javascript? <p>I have made a simple site that generates random number.
I want to record how many times a specific number comes up.</p>
<p>Is there anyway I can use javascript to write to a Local .txt File on the server?</p>
<p>or do I have to learn PHP?</p>
| <p>If you want to keep track of the number of times a random number comes up for a single client/browser, you can use <strong>localStorage</strong>. If you want to keep track of the number of times the random number occurs across all executions, you'll need some sort of server-side processing.</p>
|
Amazon s3 prevent opening media url in browser <p>We are using Amazon s3 for managing images and videos. We are able integrate it successfully and videos and images loading fine in our website.</p>
<p>eg urls
<a href="https://s3.ap-south-1.amazonaws.com/prod/image/20160810065109.png" rel="nofollow">https://s3.ap-south... | <p>The most suitable solution would be to use an <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html" rel="nofollow">Amazon S3 Pre-Signed URL</a>.</p>
<p><strong>By default, all objects in Amazon S3 are private.</strong> You can then add permissions so that people can access your obje... |
Binary rejection on apple store while running iOS 10.0.2 connected to an IPv6 network <p>I have uploaded my app related to chat to apple store. I am using iOS 9.3. After upload, I got a rejection message:</p>
<p>Your app crashes on iPad and iPhone running iOS 10.0.2 connected to an IPv6 network when we:</p>
<p>Specif... | <p>I have already gone through same problem. I have Found several solutions. Any of this might be working for you.</p>
<p>1) It is related to Image issue in iPad check out this <a href="https://forums.coronalabs.com/topic/64993-app-rejectedcrashing-on-ipv6-possible-solution/" rel="nofollow">Link</a>.</p>
<p>2) <code>... |
having Menu as hamburger Icon in resolution 1280*1024 <p>I am using Bootstrap 3.0, when the website is viewed in resolution 1280*1024 the menu should be viewed like this
<a href="http://i.stack.imgur.com/EASIf.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/EASIf.jpg" alt="enter image description here"></a></p>
... | <p>Could you check the zoom level of the browser? Sometimes users increase the zoom to 120% for example then the bootstrap that time will recognize a bit different.
Try press <kbd>Ctrl</kbd> + <kbd>0</kbd> to reset the zoom level.</p>
|
How to get string between the last nested `(` and `)`, but if no string is there, get string between direct parent `()` of that? <p>Suppose I have this string:</p>
<pre><code>date_format(from_days(datediff(now(),api.dob)),'%y')+0
</code></pre>
<p>I want to check content of the most nested <code>()</code>, that in abo... | <p>I suggest a conditional regex like</p>
<pre><code>\w+\((?<in>[^()]+)?\)(?(in)|,\K[^,()]+)
</code></pre>
<p>See the <a href="https://regex101.com/r/GuWsQg/4" rel="nofollow">regex demo</a></p>
<p><em>Details</em>:</p>
<ul>
<li><code>\w+</code> - 1 or more letters/digits/underscores</li>
<li><code>\(</code> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.