input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
unable to fetch push notifications from FCM when app is completely closed <p>There are 3 states that an app can be in :
<strong>1. Foreground.
2. Background(minimized)
3. Completely closed( removed from list of active applications)</strong></p>
<p>This is the way I've done it :
1. <strong>Forground/Background ->... | <p>So going by the comments. I deduce that the reason you are not getting intent data in activity after adding <strong>android:alwaysRetainTaskState="true"</strong> is because the task is being retained by the system and system is not creating a new task so now new <strong>Root Activity</strong>. But according to <a hr... |
Set rounded corners on UIimage in UICollectionViewCell in swift <p>I have a simple problem that I cannot find a solution to on google, the docs or here.</p>
<p>I have a Collectionview in my view controller. I have created a custom cell, DescriptionCell, that contains a UIImage. I want this image to have rounded corner... | <p>Have you tried placing it inside the custom UICollectionViewCell's init function?</p>
<pre><code>override init(frame: CGRect) {
super.init(frame: frame)
image.layer.masksToBounds = true
image.layer.cornerRadius = 10
}
</code></pre>
|
What is the worst-case for gift-wapping algorithm (Jarvisâs Algorithm) to compute convex hull? <p>I have made a program to implement the Gift Wrapping algorithm of finding convex hull. Is there any way to generate a point set that serves as the worst case for this algorithm?</p>
<p>How will I generate such case?</... | <p>Suppose you have a set of points - S. When on every iteration you subtract one point from S and add this point to a convex hull and you need to check every point what still left in S.</p>
<p>The run time depends on the size of the output, so Jarvis's march is an output-sensitive algorithm.</p>
<p>So, bigger output... |
How to use knockoutjs click binding to create a hamburger menu <p>My current repo <a href="https://github.com/matosb2/P5" rel="nofollow">https://github.com/matosb2/P5</a></p>
<p>I'd like to be able to refactor this particular code using knockoutjs instead of jQuery. How would I go about doing this?</p>
<pre><code>va... | <p>You have the three DOM elements. Two of them will have click bindings and one will have a css binding. You have one variable that represents whether the drawer is open, used in the CSS binding. The click bindings control its value. As far as Knockout is concerned, it's just this:</p>
<p><div class="snippet" data-la... |
When writing a PowerShell module in C#, how do I store module state? <p>I'm writing a PowerShell module in C# that connects to a database. The module has a <code>Get-MyDatabaseRecord</code> cmdlet which can be used to query the database. If you have a <code>PSCredential</code> object in the variable <code>$MyCredential... | <p>One approach would be to use a cmdlet or function that outputs a connection object. This object could be simply the PSCredential object, or it could contain the credential and other information like a connection string. You're saving this in a variable now and you can continue to do this, but you can also use $PSDef... |
How to set outer padding / margin on a flex row? <p>I have several flex rows which I want to set an outer margin or padding on, so that the contents for example will not reach within 50px of the screen edge.</p>
<p>I have tried all manner of messing with <code>width</code>, <code>min-width</code>, and <code>flex-basis... | <p>First, some notes:</p>
<ol>
<li>You don't need the absolute positioning to get the alignment you want in your fiddle, unless you have that for some other reason.</li>
<li>You have a couple of <code>justify-content</code> properties set. You can delete the <code>justify-content: center</code> one.</li>
<li>You also ... |
PowerMockito throwing ClassNotPreparedException even with @PrepareForTest using Scala Test <p>I have the following test...</p>
<pre><code>import org.scalatest.junit.JUnitRunner
...
@PowerMockRunnerDelegate(classOf[JUnitRunner])
@PrepareForTest(Array(classOf[AuditLog]))
class ConnectorAPITest extends path.FreeSpec with... | <p>I had the same problem using FunSuite. It works when I turned to JUnit.</p>
<pre><code>@RunWith(classOf[PowerMockRunner])
@PrepareForTest(Array(classOf[SomeStaticClass]))
class MyTestClass {
@Before
def setUp {
PowerMockito.mockStatic(classOf[SomeStaticClass])
Mockito.when(SomeStaticClass.getSomeObject... |
SQL sum function - how to sum and still include the non-summed columns <p>I want to sum columns by startDate. There are 3,213 rows.</p>
<p>I want and expect only to get 51 rows.</p>
<p>If I use this, I get the 3,213 but not summed up per StartDate. Hence the 51 rows.</p>
<pre><code>SELECT SwitchID as S,
PortI... | <p>It sounds like the output you're expecting doesn't match the purpose you are intending. That purpose seems to be summing bandwidth by day, in which case grouping by <code>Switch_id</code> and <code>PortIndex</code> is going to split your data in ways you don't want unless each <code>StartDate</code>/<code>EndDate</... |
g++: CreateProcess: No such file or directory. Can't find solution <p>Edit: whoops. Forgot to put the correct link while formatting</p>
<p>I'm following <a href="https://www.youtube.com/watch?v=wbhOJDHNp1U" rel="nofollow">this</a> tutorial, but I have gotten an error I can't fixed (I've looked at my code and then back... | <p>When you write <code>-o makefile</code> it means you want your C++ compiler to write its output to a file named <code>makefile</code>. Since Windows has case-insensitive file systems, that is a very bad idea because you will end up overwriting your Makefile, which should be named <code>Makefile</code>.</p>
<p>Also... |
Setting the CSS of an html element with text entered by the user <p>My page has two textareas and a div. One textarea is for the user to enter html and the other is for entering css. When a button is clicked I will call a javascript function to display the css and html inside the div.</p>
<p><div class="snippet" data-... | <p>Yes, @adeneo answer works, this snippet shows it. Enter <code>color: red;</code> for example as CSS, and any text as HTML...</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-js lang-js prettyprint-override"><co... |
How can I use x, y coordinate matrices to choose where a character appears in a string with python? <p>I am attempting to make a simple maze game to test a NNS with genetic algorithms.
the maze for each test would use a matrix to hold the x, y points of things like barriers, the start, the end, and the player's current... | <p>You're probably looking for something along the lines of this:</p>
<pre><code>width = 6
height = 6
coords = [(1,1),(3,4),(1,5)]
print('\n'.join(['|' + ''.join(['x' if (x,y) in coords else 'o' for x in range(width)]) + '|' for y in range(height)]))
</code></pre>
<p>Using list comprehension, we can easily construct ... |
D3.js: Bars in Bar chart, scales are not modeling data properly <p><a href="https://codepen.io/juanf03/pen/YGyyjY?editors=1111" rel="nofollow">https://codepen.io/juanf03/pen/YGyyjY?editors=1111</a></p>
<p>I'm modeling a bar chart with D3.js and the data is not being represented by the bars like it's supossed to be....... | <p>Your <code>height</code> and <code>y</code> calculations are off. If you refer to the <a href="https://bl.ocks.org/mbostock/3885304" rel="nofollow">venerable bar chart example</a>, it should be:</p>
<pre><code> rect.attr('y', function(d) {
return yScale(d[1]);
});
rect.attr('height', function(d) {
r... |
Email notification from ActionMailer using sendgrid when a user send a new message to another user <p>I'm building an application where I tried using ActionMailer to trigger an email to a user when a message has been sent. The problem is that my code sends a message to the user who wrote the message and not to the reci... | <p>You need to create a variable that selects the recipient user. Right now, you have it set to where <code>@user = current_user.</code>
The problem with this is that when you call user.email you are calling the <code>current_user</code>'s email address, not the recipient. You need to create a variable for the recipien... |
Extending a C++ application with python <p>I have a legacy (but still internally maintained) application written in C++ which handles some hardware, interacts with databases, receives commands via serial line or socket... in short it does a non-trivial amount of work.</p>
<p>This application runs under Linux (ARM/Buil... | <p>Can you do it the other way around - embed your C++ code in Python program? This way it would be more prepared for moving existing functionality Python like you said.</p>
<p>Python makes a lot of things easier (faster to develop, easier to maintain) - communication with databases, libraries (if hey have Python wrap... |
CSS: Font Weight Property Doesn't work on font family, why? <p>The <code><head></code> tag in my html file contains this link call:</p>
<pre><code><link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
</code></pre>
<p>Then I go on to say:</p>
<pre><code><style>
bo... | <p>When using custom font's you need to add each font type for each weight you are going to use.</p>
<p>The reason you are seeing a broken version of Lato or another font is you either have another font defined for those font weights or you are seeing the browsers render version of Lato which will be based on the Lato... |
Prevent more than one DialogBox to appear <pre><code>import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
class Demo implements ActionListener
{
JFrame f;
JButton b;
DisplayDialog dialog;
public Demo()
{
f = new JFrame();
f.setSize(200,200);
b = new JButton("Click me");
f.add... | <p>The thing is that you cannot do this in single thread (like you are preseting it in your demo) - <code>setVisible</code> will always block (wait till dialog closes) and another <code>display</code> call will not be invoked till then.</p>
<p>Try to run it in multi frame env (like you have stated that your app is) bu... |
Spring MVC: Controller function not getting called on form submit <p>I am new to using Spring MVC framework and have designed a html page which has two forms. One is login(form id: loginform) and other is for signup((form id:signupform). The controller is being called correctly for the login page but for the signup, no... | <p>Your singup form has the http method POST but your controller is form http method GET</p>
<p>Your JSP:</p>
<pre><code><form:form id="signupform" class="form-horizontal" role="form"
method="POST" modelAttribute="userForm"
action="<c:url value='/adduser' />"&g... |
MassTransit publish to specific queue <p>I have successfully updated a MassTransit app from 2.x to 3.x and switched to RabbitMQ for my transport. I did this to get one-to-many messaging to function properly, which the previous developer thought would work with MSMQ but I found it was not working and it became clear by... | <p>You should probably configure a separate RabbitMQ virtual host for each customer, and point that customer's web site instance to that specific virtual host. That way, each way site has its own virtual service for message traffic, keeping it isolated from the other.</p>
|
Is there any event for body change? <p>As i know in Jquery there are .change() event for any textbox is there any way to access body textbox? </p>
<p>Or is there any build in event for Office.context.mailbox.item?</p>
<p>ref
<a href="https://dev.outlook.com/reference/add-ins/Office.context.mailbox.item.html" rel="no... | <p>No, at the moment there's no event to be notified of body changes. You can poll every few seconds (3-5) to request it though.</p>
|
c++ function does not take 0 arguments <p>Why am I getting <a href="https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(C2660)&rd=true" rel="nofollow">this error</a> from the compiler about the function not taking 0 arguments? Is is because I declare the function after it has been call... | <blockquote>
<p>Is is because I declare the function after it has been called?</p>
</blockquote>
<p>Yes.</p>
<p>By the time the compiler sees the call to <code>swap()</code>, it doesn't know about your function yet. You'd normally get an error along the lines of âcall to undeclared functionâ in this case, were ... |
iOS In-App Purchases handling when app goes to background (Unfinished interrupted transactions) <p>In my app In-App Purchases are working fine. </p>
<p>The issue I am facing is that;</p>
<ul>
<li>if I initiate a subscription process and send app to background by pressing Home button on iPhone.</li>
<li><p>then In-App... | <p>OK, So I have got the answer. </p>
<p>For others in easy words.</p>
<p>If you have an interrupted In-App Purchase which was due to any reason was completed but the receipt/information of that transaction of In-App Purchase, could not be sent to your server. Simply do this</p>
<p><strong>Most Important: NEVER CALL... |
How would I make a page only accessable if a mysql varible is '1'? <p>So, at the moment, I am working on a mod panel for a forum. There is a varible in the database called 'moderator'. The default is 0, but I would like to be able to set it to '1', and then people would have access to a page. I was currently looking at... | <p>Flip your logic...</p>
<pre><code><?php
include 'config.php';
if(empty($_SESSION['moderator'])) {
// $_SESSION['moderator'] is not set or 0
header("Location:noaccess.php");
exit;
}
// $_SESSION['moderator'] is set and something other than 0,
// the following page is moderator only...
</code></pre>... |
Hex conversion going terribly wrong in CPP <p>I amtrying to read command line hex arguments in an unsigned char array. My code:</p>
<pre><code> #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <memory.h>
#include <cstring>
unsigned char key[16] ={0x00, 0x00, 0x00, 0... | <p>Problem 1:</p>
<p><code>argv[0]</code> is not the first user provided argument. <code>arg[0]</code> is reserved for use by the implementation. Typically it is the command used to execute the program. In this case "./a.out". "./a.out" doesn't convert to an integer resulting in bad behavior since <code>strtol</code> ... |
Thymeleaf Property or field 'datas' cannot be found on null <p>I'm getting the error: Property or field 'datas' cannot be found on null on thymeleaf.</p>
<p>I've seen similar problems, but can't find the problem with my code.</p>
<p>Basically, i have a list of and object named Months with two attributes: Name(String)... | <p>The Object you've added to your model is named "listOfMonths." There is no object on your model named "months", so when it gets to this line:</p>
<pre><code><tr th:each="days : ${months.datas}">
</code></pre>
<p>months is null. The top line works, because you've defined "months" before you use it.</p>
<pr... |
Why isn't my CSS and Bootstrap.css styling applied? <p>Within my Ruby on Rails application I am trying to adapt the design to look similar to <a href="http://vinceg.github.io/Bootstrap-Admin-Theme-3/" rel="nofollow">http://vinceg.github.io/Bootstrap-Admin-Theme-3/</a> (which you can download from <a href="http://www.cs... | <p>You have placed your css file in project directory but you also need to include it in your html files <code><head></code> section by href, otherwise your app won't know what styling you are using.</p>
|
How to create multiple sprites(nodes) with the same texture that will automatically generate a new when one node is removed? <p>I'm trying to create a game where the user can swipe a node and once it's swiped a new node will be created at the bottom of the screen and push all other nodes up, kind of like a reverse Tetr... | <p>As @KnightOfDragon said you can create a copy of your <code>plankWood</code> sprite using <code>.copy()</code> so you could create a function to add a plank kind of like this one:</p>
<pre><code>func addPlank() {
let newPlank = plankWood.copy() as! SKSpriteNode
newPlank.position = CGPoint(x: 0, y: -250) //T... |
Stacked Lines in Pandas <p>I want to draw stacked lines in <code>pandas Dataframe</code>.
So, currently I draw one line:</p>
<pre><code>df.plot.line(x='xvals',y='yvals')
</code></pre>
<p>in which <code>xvals</code> column contains <code>x</code> values, and <code>yvals</code> contains <code>y</code> values. </p>
<p>... | <p>Keep the returned <code>Axes</code> object and pass to <code>ax</code> argument:</p>
<pre><code>ax = df.plot.line(x='xvals',y='yvals')
df.plot.line(x='xvals2',y='yvals2', ax=ax)
</code></pre>
|
How to bold a RichTextBox through button click? <p>The code I am currently using to bold the text currently is this:</p>
<pre><code>rtb.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
</code></pre>
<p>but the drawback of this having to highlight the text first before the bold can be ap... | <pre><code>if(rtb.CaretPosition.Parent is TextElement)
{
(rtb.CaretPosition.Parent as TextElement).FontWeight = FontWeights.Bold;
}
</code></pre>
|
MySQL select row where one field is less than the previous record and one field is greater <p>I have two tables. A table of called <code>laps</code> which holds a record of all laps completed round a track by a car and a table called <code>best_time</code> that consists of fastest times for certain distances on that l... | <p>This will show all the rows where elapsed time is less than all previous elapsed times, by total distance and lap id for car=1:</p>
<pre><code>SELECT `bt`.`total_distance`, `bt`.`total_elapsed_time`, `bt`.`start_time`
FROM `best_times` AS `bt`, `laps` AS `l`
WHERE `bt`.`total_elapsed_time` <= (Select min(`bt2`... |
Fatal error: Cannot access empty property in, why is it empty? <p>I follow <a href="https://www.youtube.com/watch?v=lNWArvc-uN0&index=12&list=PLfdtiltiRHWF0RicJb20da8nECQ1jFvla" rel="nofollow">this video</a> step by step, but I do seem to have a mistake somewhere. Can anyone explain where my mistake is and how ... | <p>There is a typo in <code>Calculator::calculate()</code>, <code>$this->$result</code> should be <code>$this->result</code>:</p>
<pre><code>public function calculate(){
foreach(func_get_args() as $number){
$this->result = $this->operation->run($number, $this->result);
}
}
</code></pr... |
WaitGroup is reused before previous Wait has returned <p>So im getting further into using golang and looking more into the concurrency it offers. I decided to try to use go routines to implement permutations of strings in a phone number. </p>
<p>I am running into issues using sync.WaitGroup to coordinate the go routin... | <p>In your recursive cases in <code>ThreadSafeCalcWords</code>, you're calling <code>wg.Done</code> <em>before</em> calling <code>wg.Add</code>. That means that the wg can drop down to 0 (which will trigger the <code>Wait</code> to complete) before you actually finish all the work. Calling <code>Add</code> again while ... |
Create simple Card layout android <p>I want to create a simple card layout like this image </p>
<p><a href="http://i.stack.imgur.com/MhkCB.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/MhkCB.jpg" alt="enter image description here"></a></p>
<p>this is my layout</p>
<pre><code> <?xml version="1.0" encod... | <p>To keep the layout ratio in your case you could use this XML attributes <code>android:ellipsize</code> and <code>android:maxLines</code> on the TextView.</p>
<p>TextView example:</p>
<pre><code><TextView android:id="@+id/txt_discription"
android:layout_width="match_parent"
android:layout_height="wrap_co... |
JAXB This will cause infinitely deep XML <p>I'm writing a simple budgeting program that has a budget class with an array of category classes. Each category class can have child category classes. When I try to save the data to an XML file using JAXB, I get the error
com.sun.istack.internal.SAXException2: A cycle is d... | <p>I'm a bit embarrassed. I know you have to be careful with recursion and that was my problem. </p>
<p>Before building the ui, I hardcoded some values - created a budget and added some categories. I should have posted that code. I had set one of the categories as a child to itself.</p>
<pre><code>Category food = ... |
Change variable in included jinja2 template <p>Say I have two templates:</p>
<p><strong>main.j2</strong></p>
<pre><code>{% include "vars.j2" %}
main: {{ var1 }}
</code></pre>
<p><strong>vars.j2</strong></p>
<pre><code>{% set var1 = 123 %}
vars: {{ var1 }}
</code></pre>
<p>When run, only this line is output:</p>
... | <p>You can try using <code>with</code>:</p>
<pre><code>{% with var1=0 %}
{% include "vars.j2" %}
vars: {{ var1 }}
{% endwith %}
</code></pre>
|
C++ - creating an alias for an std::array of std::array iterator <p>I have an array of iterators of type <code>std::array<Point, SIZE>::iterator</code>, where <code>SIZE</code> is a template variable.</p>
<p>So having an array of these iterators would be </p>
<pre><code>std::array<std::array<Point, SIZE&g... | <p>In C++, <a href="http://en.cppreference.com/w/cpp/language/dependent_name#The_typename_disambiguator_for_dependent_names" rel="nofollow">dependent</a> template type names require the keyword, <code>typename</code>.</p>
<p>You should change your alias from </p>
<pre><code>template<std::size_t SIZE>
using p_it... |
Does Solr 4.3.1 run on Java 8 <p>We are still using Solr 4.3.1, Java 7 and JBoss 7. Just trying to upgrade to Java 8 without upgrading Solr at the moment. Solr admin does not start though, Solr log is absent and I see no error in any log. </p>
<p>Could someone confirm that Solr 4.3. does not work using Java 8. Thanks.... | <p>Just to wrap up. Solr 4.8.1 officially support Java 8. At this point, I am migrating to Solr 5 though.</p>
|
Returning reference to parent class C++ <p>I've been experimenting with a tuple-like data structure. It should contain only 1 of each type of object, and each object should be a c-style PODS. It uses a bizarre way of accessing the objects it holds, where it returns a reference to a class it derives from. Like:</p>
<pr... | <p>As far as I can tell this can be simplified to just:</p>
<pre><code>template<class... Ts>
class Container : private Ts...
{
public:
template<class T>
T& get_component()
{
return *this;
}
template<class T>
const T& get_component() const
{
retur... |
Relation between two join tables <p>I have the following tables: <code>Department</code>, <code>Section</code>, <code>Employee</code>,<code>Manager</code>, and <code>Position</code>. The relations between the tables are as follows:</p>
<ul>
<li>Each Department contains many sections</li>
<li>Each Department contains m... | <p>Some thoughts on your post. It is not an answer (too long to comment) but might help a bit.</p>
<blockquote>
<p>Each Department contains many sections</p>
</blockquote>
<p>From this I guess that you don't need the lookup table <code>DepartmentSections</code> since this sentence describes one-to-many and not many... |
Trouble accessing an array passed through execlp <p>I am having trouble with passing an array though exec. I can only ever seem to get the first element after passing it. I know the pointer only points to the head, but the rest should be in contiguous memory.</p>
<pre><code>//runner
int nums[10];
int* nums1=malloc(10*... | <p>As <a href="http://stackoverflow.com/users/4774918/olaf">Olaf</a> pointed out in a <a href="http://stackoverflow.com/questions/39800990/trouble-accessing-an-array-passed-through-execlp#comment66894865_39800990">comment</a>, you can only pass an array of strings to another program.</p>
<p>Further, with <a href="http... |
Why does my text clustering do this <p>I have an unlabeled dataset with product names. For example, baseball shirt, bomber jacket, active classic boxer, etc. </p>
<p>I created a tf-idf matrix with the data then I ran k-means on the matrix. I plotted a within-cluster sum of squares to find the best k which is 5. </p>
... | <p>TF-IDF only works for <strong>long text</strong>.</p>
<p>Because of this, almost every document is completely different from every other, and they "fan out" like this.</p>
<p>I doubt that k-means worked either.</p>
|
Error with spread operator ES6 <p>I don't know why I am getting an error using the spread operator.
Can anyone explain why and how can I fix it?
<a href="http://i.stack.imgur.com/ATat3.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/ATat3.jpg" alt="enter image description here"></a>
Thanks</p>
| <p>Thats not quite how the spread attributes would work see <a href="https://facebook.github.io/react/docs/jsx-spread.html" rel="nofollow">https://facebook.github.io/react/docs/jsx-spread.html</a></p>
<p>you can do <code><ShowCard {...show} key={show.imdbID} /></code> but you cant have a specific prop be equal t... |
Unity 5 OnLevelWasLoaded? <p>In this new unity version,i think SceneManager is used.But i cant find how to do on level was loaded with SceneManager.</p>
<p>The old way :</p>
<pre><code>void OnLevelWasLoaded(){
// do something
}
</code></pre>
<p>When i try the old way i get this:</p>
<blockquote>
<p>OnLevelWasLoad... | <p>You have to <code>sceneLoaded</code> as an event.</p>
<p>Register <code>sceneLoaded</code> event in the <code>Start()</code> or <code>Awake()</code> function.</p>
<pre><code>SceneManager.sceneLoaded += this.OnLoadCallback;
</code></pre>
<p>The <code>OnLoadCallback</code> function will then be called when scene is... |
Missing data in Github Archive on Big Query? <p><strong>Missing data in Github Archive on Big Query?</strong></p>
<p>Using <a href="https://bigquery.cloud.google.com/table/githubarchive:day.20150101" rel="nofollow">BigQuery's tables from the Github Archive</a>, and running a query on pull-requests for the <a href="htt... | <p>This repo changed names, though the id continued the same:</p>
<pre><code>SELECT repo.name, MIN(created_at) since, MAX(created_at) until
FROM (TABLE_DATE_RANGE([githubarchive:day.],
TIMESTAMP('2015-01-01'),
TIMESTAMP('2016-10-01')
))
WHERE repo.id = 29986727
GROUP BY 1
ORDER BY 1
repo_name ... |
Replace Array.ConvertAll in NetCore 1.0 <p>My current code is using <code>Array.ConvertAll</code>, which I need to migrate to net core 1.0. How to migrate it to work in Net core.</p>
<p>Can we use <code>foreach</code> statement with custom conversion code to handle the conversion?
But I don't know how to do it.</p>
<... | <p>Only if you upgrade to latest .NET Core 1.0 official release (forget about all previous testing bits), you can use this method in <code>System.Runtime</code> package,</p>
<p><a href="https://docs.microsoft.com/en-us/dotnet/core/api/system.array#System_Array_ConvertAll__2___0___System_Converter___0___1__" rel="nofol... |
YouTube - Data API v3 Unable to display private videos of my YouTube channel on my website using Google Service Account <p>I have few private videos on my YouTube channel and i want to put them on my website. Basically i don't want my website users to watch them directly on my YouTube channel. Furthermore i don't want ... | <p>Displaying of private videos is not allowed in Youtube API as <a href="https://support.google.com/youtube/answer/77272?hl=en" rel="nofollow">stated in the help guide</a>.</p>
<blockquote>
<p>Private videos can only be seen by people who have been invited to
view the video.</p>
<p>Here are some possible rea... |
How to trigger ng-change on md-select when model is changed? <p>I'm using md-select and need to trigger certain code when the value changes (building a Country/State selector). I have it working fine when I change the value through the control but I also need to have the controls reflect the values properly when the mo... | <p>You could use $scope.$watch</p>
<pre><code>$scope.$watch(
function valueGetter(){
return smth;
},
function onChange(newSmth, oldSmth){
}
)
</code></pre>
|
Icons in jstree using types are not redrawn within create <p>I use panel with several accordions.</p>
<p>Each time the accordion is opened a tree with the content is created.</p>
<p>This works well.</p>
<p>But when the tree is displayed in the accordion pane jstree uses the themeicon instead of the icon defined in t... | <p>I found a/the solution.
The <code>$.jstree.create( $('#panel_tree_div'), { options });</code>
function works not the same way as <code>$('#panel_tree_div').jstree({ options});</code> or the event binding is different.</p>
<p>After this modification it works without <code>refresh()</code> or <code>redraw()</code>.</... |
ARM assembly error undefined reference to `a' <p>I am running ARM assembly code to initialize array a. I get the error saying
undefined reference to `a'. I am using gcc to compile
Here is the code </p>
<pre><code>.text
.global main
main:
ldr r0, addr_of_a // r1 = *a
mov r1, #0 // Index i... | <p>As +Notlikethat indicated, your 'a' is not present. </p>
<p>You may add it accordingly like in the examples below:</p>
<pre><code>.data
a: .asciz "deadcode\n"
</code></pre>
<p>or </p>
<pre><code>.data
a: .word 3,1,4,1,5,9
</code></pre>
|
Using Bluemix Mobile Services dashboard and foundation download code gives error <p>I am using the mobile services dashboard and trying to deploy a mobile app to a Mobile Foundation Server. After I build my application using mobile app builder I select "Get Code". One of my options is to "Deploy to Foundation", but whe... | <p>It looks like you have the wrong publish location. Here are how my settings looked when I deployed to a V8 MFP Server successfully:</p>
<p><a href="http://i.stack.imgur.com/BXuNl.png" rel="nofollow"><img src="http://i.stack.imgur.com/BXuNl.png" alt="mfp"></a></p>
|
Angular 2 - How to send asynchronous information to the template <p>I'm trying to send to the template some image information after validation. But I'm not getting.</p>
<p>The variables that go to the template are within a callback, or are within an asynchronous function, and I do not know to send this information to ... | <p>Try what @peeskillet suggested first – i.e., use the proper <code>this</code> context by using an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions" rel="nofollow">arrow function</a>:</p>
<pre class="lang-typescript prettyprint-override"><code>export class Ev... |
Change button when hovered <p>I am a beginner and I am looking for a simple way to make a button in WPF application move when it is hovered over.</p>
<pre><code>public MainWindow()
{
InitializeComponent();
}
private void btnNo_Click(object sender, RoutedEventArgs e)
{
}
</code></pre>
| <p>You may put the <code>Button</code> in a <a href="https://msdn.microsoft.com/en-us/library/system.windows.controls.grid(v=vs.110).aspx" rel="nofollow"><code>Grid</code></a>, and changes its <a href="https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.margin.aspx" rel="nofollow"><code>Margin</cod... |
Injecting presenter subclass to view android <p>I am creating an android application using the MVP pattern. For dependency injection I use dagger 2. I have an abstract fragment that implements the "view" interface, making it the view in Model-View-Presenter.</p>
<pre><code>public abstract class MediaDetailFragment ext... | <p>You must inject your presenter in the child classes (MovieDetailFragment & ShowDetailFragment) and in your module you need to have TWO provide module like below :</p>
<pre><code>@Module
public class ConfigPersistentModule {
@Provides
MovieDetailFragment provideDetailPresenter(DataManager dataManager) {
ret... |
Permutations of a list using stack <p>I'm trying to find a way to enumerate all combinations of a list of numbers without recursion or using itertools. I came up with a solution that works but I think it turned into a recursive function after all. I'm new to Python and not sure how I would make this work without recu... | <p>It is not that intuitive to come up with an algorithm "just like that" that produces all permutations without the use of recursion. </p>
<p>But there exist several different such algorithms. Have look at <a href="https://en.wikipedia.org/wiki/Heap%27s_algorithm" rel="nofollow">Heap's algorithm</a> for example:</p>
... |
How to use promises between angular factories and controllers? - Having annoying issue - Thanks <p>Factory: </p>
<pre><code>function thingyFactoryFunction($http) {
return {
search: function(city, state) {
$http({
method: 'POST',
url: 'http://localhost:7500/search',
data:... | <p>Your factory/Service search method not returning anything. Your trying to access .then() of nothing(undefined). $http itself returns a promise object.
Try following.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-... |
IDP Initiated SSO not working in spring security SAML sample app <p>I have a fork of spring security saml project. You can see the changes I've applied here: <a href="https://github.com/troyhart/spring-security-saml/commits/nwri-sample_simple" rel="nofollow">https://github.com/troyhart/spring-security-saml/commits/nwri... | <p>The issue is that the <a href="https://github.com/spring-projects/spring-security-saml/blob/master/docs/reference/docbook/quick-start.xml" rel="nofollow">quick-start quide</a> references a deprecated <code>metaAlias</code> in the documented IDP-initiated SSO URL for SSO Circle. The new value is <code>/publicidp</cod... |
Scipy.optimize not fiting to my data <p>I cannot get <code>scipy.optimize.curve_fit</code> to properly fit my data which is visually apparent. I know approximately what the parameter values should be and if I evaluate the function with the given parameters the calculated and experimental data appear to agree well:</p>
... | <p><a href="http://stackoverflow.com/questions/39801490/scipy-optimize-not-fiting-to-my-data#comment66895673_39801490">@WarrenWeckesser has a really good point</a>, but further note that the y axis is logarithmic. That apparently huge error at the right end is something like 1e-5 in magnitude, while the points on the t... |
Namespacing My Unity Project Scripts <p>I create tools for the Unity Asset Store and one of my tools is in conflict with other assets people bought from the store which is resulting in unwanted errors. From talking this over with people they said that I should just "namespace TrollBridge{}" EVERY script. Would this b... | <blockquote>
<p>Would this be a way of doing it</p>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>or do I only need to do certain scripts?</p>
</blockquote>
<p>Do it for all your scripts.</p>
<blockquote>
<p>Even data structure scripts?</p>
</blockquote>
<p>Yes, even that. All your classes for this should be in ... |
How to sort custom data objects into an empty array by NSNumber property -Swift2 iOS <p>I have a custom data object with a NSNumber property. How would I sort the messages from one array into another array using the NSNumber property?</p>
<p>I tried this but I get an error</p>
<pre><code>Binary operator '<' cannot... | <p>I needed to use the intValue</p>
<pre><code>emptyArray = messagesArray.sort{$0.time.intValue < $1.time.intValue}
</code></pre>
|
How to find optimal line on y axis using a divide and conquer algorithm? <p>If I am given a group of numbers that are positions on the y axis how do I find the position on the y axis that is has the shortest total difference in respect to the group of numbers. For example, if you are give the numbers 1 8 3 6 2 7 it sho... | <p>Let's take your example: <code>1 8 3 6 2 7</code>. I'm assuming we're looking for an integer answer.</p>
<p>The answer has to be between the smallest and the largest number. 0 has a larger sum of differences than 1. 8 has a smaller sum of differences than 9.</p>
<p>With your example, the end bounds are 1 and 8.... |
No reponse while sendind form data from angular js to mysql db using spring <p>HI all i am new to angular and i am trying to learn it. i have developed an app that takes input data from angular and validations done and post the data to my server using spring as controller.</p>
<p>my controller class</p>
<pre><code>@A... | <p>If you're not hitting your controller, obviously your form is not being submitted.</p>
<p>I'm not familiar with AngularJS, but from looking at your JSP file, you're missing a couple of attributes within the form tag:</p>
<ol>
<li>action=the_url_of_your_controller</li>
<li>method=POST</li>
</ol>
<p>Like this:</p>
... |
Assign Global Variable Inside Class From Class Variable <p>I have a question about classes in Python. I have create a class that looks something like this:</p>
<pre><code>class Model(Object):
__table__ = 'table_name'
def func():
def func2():
</code></pre>
<p>The table name is a global variable that the... | <p><code>__table__</code> is a class variabe, which means you can access it from an instance or from the class itself. You can update any instance value according to the value of <code>backfill</code> in the <code>__init__</code> method:</p>
<pre><code>class Model(Object):
__table__ = 'table_name'
def __init__... |
Http PUT in Angular2 to .NET Core Web API gives http 401 error from the preflight request <p>I have an Angular2 app which does an http PUT to a .NET Core Web API controller. When I run the app, it makes an OPTIONS preflight request first and throws a 401 Unauthorized error. </p>
<pre><code>XMLHttpRequest cannot load h... | <p>Instead of web.config, can you enable CORS like this in your ASP.NET core web api-</p>
<p>First, add dependency in project.json - <code>"Microsoft.AspNetCore.Cors": "1.0.0",</code></p>
<p>then enable CORS in <code>startup.cs</code> like this-</p>
<pre><code>app.UseCors(builder => {
builder.AllowAnyOrigin()... |
A member test using Recursion <p>I was having trouble understanding recursion. I'm looking for some feedback here to see how this program looks.</p>
<p>Question :::
Write a recursive Boolean function named isMember. The function should accept three parameters: an array of integers, an integer indicating the number of ... | <p>Your function doesn't return if the <code>if</code> clause is false. Also, keep in mind that indexes start at 0, not 1 (and why <code>sizze</code>?).</p>
<p>I would recommend starting with an array of 3 values, rather than of 10. That way you''ll be able to manually follow and unfold the successive calls.</p>
|
How to Log Data in a Realtime Linux Application? <p>I am working with the 4.4.12-rt19 RTLinux kernel patch.</p>
<p>I have a realtime application written in C that has separate processes running on separate cores taking in data from the network, computing on that data, and then logging results. I am attempting to log o... | <p>Using <code>sqlite3async</code> does not remove the delays associated with writing; it just defers them until later, when you can afford them.</p>
<p>Consider using WAL mode. There, you have the same delay when doing a <a href="http://www.sqlite.org/wal.html#ckpt" rel="nofollow">checkpoint</a>, but the WAL is store... |
glance doesn't work due to authentication fail <p>I'm setting up Openstack on some machines. I was following this guide <a href="http://docs.openstack.org/liberty/install-guide-ubuntu/" rel="nofollow">http://docs.openstack.org/liberty/install-guide-ubuntu/</a> until I ran into this problem:</p>
<p>When I'm verifying I... | <p>in your glance configuration, the project name is service, but your env var project name is admin.</p>
<p>solutions:</p>
<ul>
<li>ensure passw0rd is the real pw to glance:service account</li>
<li>change glance conf to use admin project instead</li>
</ul>
|
How to use the `pos` argument in `networkx` to create a flowchart-style Graph? (Python 3) <p><strong>I am trying create a linear network graph using <code>Python</code></strong> (preferably with <code>matplotlib</code> and <code>networkx</code> although would be interested in <code>bokeh</code>) similar in concept to t... | <p>Networkx has decent plotting facilities for exploratory data
analysis, it is not the tool to make publication quality figures,
for various reason that I don't want to go into here. I hence
rewrote that part of the code base from scratch, and made a
stand-alone drawing module called netgraph that can be found
<a hre... |
NASM assembly language cant seem to save output to a file <p>Ok so im following along a tutorial and i've been scratching my brains out over this.. I've tried looking for resources but nothing seems to work or click. All Im trying to do is read input from a file, character by character then proceed to save it to anothe... | <p>With <code>fd_in resb 1</code> and <code>fd_out resb 1</code> you are reserving ONLY ONE BYTE for your file handles. But then you read and write an entire <code>ebx</code> to and from those locations. <code>ebx</code> is 4 bytes long. That's not going to work very well. </p>
<p>Try <code>resb 4</code> for both f... |
Mongodb c# update a comment in n-nested comment chain <p>I've found a few questions about updating children of parent documents, but only when you already know how far the parent/child tree goes. Here's my model:</p>
<pre><code>public class ParentThread
{
public string id { get; set; }
public string title { g... | <p>There are a couple of recommended ways of modelling tree structures. Take a look at <a href="https://docs.mongodb.com/manual/tutorial/model-tree-structures-with-parent-references/" rel="nofollow">parent references</a> in the official docs. This will liniarize your tree. The Parent References pattern stores each tree... |
Specify a range of ASCII lowercase chars in C++ <p>I am writing a program that takes a char and compares it to see if it's in a range of certain chars. For instance, if the char I get is an <code>n</code> I go to state 3, if its a - m or o - z I go to state 4. I'm new to C++ so I'm still learning.</p>
<p>Can I say som... | <p>There is no such syntax in C++. The options are:</p>
<ol>
<li><p>Use a <code>switch</code> statement, when the list of values is generally not contiguous, or</p></li>
<li><p>Convert the list of explicit character values into contiguous ranges into equivalent boolean expressions. As you know, alphabetic characters c... |
os.walk(directory) - AttributeError: 'tuple' object has no attribute 'endswith' <p>I am trying to make a script in python to search for certain type of files (eg: <code>.txt</code>, <code>.jpg</code>, etc.). I started searching around for quite a while (including posts here in SO) and I found the following snippet of c... | <p>The reason why you use <code>root, dirs, files</code> with <code>os.walk</code> is described in the <a href="https://docs.python.org/2/library/os.html#os.walk" rel="nofollow">docs</a>:</p>
<blockquote>
<p>For each directory in the tree rooted at directory top (including top itself), it yields a 3-tuple (dirpath, ... |
How to plot an equation with multiple variables in Python? <p>Suppose I have a variable list z</p>
<pre><code>z = [1,2,3,4,5,6,7,8,9,10]
</code></pre>
<p>I am trying to plot the equation</p>
<pre><code>y = 1a + 2b + 3c + 4d + 5e + 6f + 7g + 8h + 9i + 10k
</code></pre>
<p>I am confused on how to plot a multi dimensi... | <p>Try this:</p>
<pre><code>z = [1,2,3,4,5,6,7,8,9,10]
equation="y ="
for i in range(len(z)):
if i>0:
equation=equation+" +"
equation=equation+" "+str(z[i])+chr(ord('a')+i)
print equation
</code></pre>
<p>The output is:</p>
<pre><code>y = 1a + 2b + 3c + 4d + 5e + 6f + 7g + 8h + 9i + 10j
</code></p... |
NS-3 WIFI Base Station and accesspoint handover <p>I am a new user of NS-3. Can you help me in writing a code of handover in between nodes in Wi-Fi environment? </p>
| <p>I'm gonna base my response on the little information you have provided.</p>
<p>General idea of Wi-Fi (as the technology which we use on daily basis to connect to internet and stuff like that :D) is based on IEEE 802.11 standard which does not support handover between nodes. Therefor you either are asking the wrong ... |
RSpec - Testing methods that call private methods that should be mocked <p>I'm using RSpec for testing my classes on Rails.</p>
<p>I'm wondering what is a good way to test methods calling private methods.</p>
<p>For example I have this class:</p>
<pre><code>Class Config
def configuration(overrides)
@config.mer... | <p>One idea would be to actually create a copy of the YAML file in the test. You could take a snippet of the file that you're using in your production code, write it to the expected file location and delete it upon test completion.</p>
<pre><code>before do
File.open(file_path_here, 'w+') do |f|
f << <&l... |
Windows Azure iot hub telemetry message to push notification <p>I am trying to figure out the best approach for this scenario.</p>
<p>I have a pir sensor attached to a raspberry pi that is sending telemetry data to a windows azure iot hub.</p>
<p>I want to trigger a push notification when this telemetry data is recei... | <p>I would create an Azure Web Job to consume the data coming to the IoT Hub and call a Notification Hub.</p>
<p>This would look like this :</p>
<p>[Raspberry Pi] -> [IoT Hub] -> [Web Jobs] -> [Notification Hubs]</p>
<p>Here are the pointers to the 3 key components</p>
<ul>
<li><p><a href="https://azure.microsoft.c... |
What Are The Accepted Keys for NSTextView.typingAttributes? <p>In Swift on macOS, I have the following Text View and want to set the font size of text that is entered into it, like so:</p>
<pre><code>myTextView.typingAttributes = ["Unknown" : NSFont(name: "Helvetica", size: 18)]
</code></pre>
<p>I am currently unable... | <p>You can find the supported attribute names in the <a href="https://developer.apple.com/reference/foundation/nsattributedstring/1652619-character_attributes" rel="nofollow">documentation for <code>NSAttributedString</code></a> under <a href="https://developer.apple.com/reference/foundation/nsattributedstring" rel="no... |
VB program to calculate monthly deposits plus interest <p>I am having issues trying to make a calculator that accurately calculates deposits plus the amount of interest that is added monthly. I dont know how to incorporate a loop that can add monthly deposits to total deposits, then adds the total deposits plus total i... | <p>This is how I implemented the loop for calculating total interest and total deposits correctly. </p>
<p>For index As Integer = 1 To intMonthsTotal Step 1
decTotalDeposits += decMonthlyDeposit
decTotalInterest += (decTotalDeposits + decTotalInterest) * ((decAnnualRate / 100) / 12)</p... |
Average of field from subquery with limit <p>I'm having trouble generating a query that I'm sure is possible. I have a <code>products</code> table and a <code>product_changes</code> table. I would like to select the average of the <code>product_changes.rank</code> field for the top 30 lowest values for each associated ... | <p>I would use a <code>LATERAL</code> subquery or a correlated subquery to ensure that the subquery is executed for each product. Here's an example:</p>
<pre><code>SELECT products.id, avg_rank
FROM "products",
LATERAL (
SELECT AVG(rank) avg_rank
FROM (SELECT rank
FROM product_cha... |
Materialised views - best practices <p>With the advent of materialised views - is there a best-practices guideline to follow?</p>
<p>I have read;
<a href="http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views" rel="nofollow">http://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views</a... | <p>After watching the Sessions from Cassandra Summit 2016, all the advice I heard from presenters - including Patrick Mcfadden of DataStax, stated that Materialised Views WAS a good default choice.</p>
<p>That you only needed to create individual tables if you had to have discreet control over the timing of when data ... |
Where do you put the libraries(sap.ui.core.js etc.) when downloading OPENUI5 SDK locally <p>I have a SAPUI5 Application developed via Eclipse(Using SAPUI5 Plugins) and now i want to call it to deploy on a Web Server. </p>
<p>But, in eclipse, i downloaded the plugins and libraries through Eclipse->New Software. Now, i ... | <p>Most probably you will use Tomcat as a web server for testing, see <a href="http://stackoverflow.com/questions/29846186/open-ui5-basic-setup">here</a> the basic steps for installation.</p>
|
Understanding constraintBottom and constraintBaseline <p>Among all the ConstraintLayout attributes available in Android Studio 2.2, there are these two <em>Bottom</em> constrains and a <em>Baseline</em> constrain: </p>
<p><code>layout_constraintBottom_toTopOf</code><br>
<code>layout_constraintBottom_toBottomOf</code><... | <p>Baseline is used for make view bottom to bottom of text</p>
<p>for example in EditText the text is not the bottom so
if you use baseline it will be in bottom of </p>
<p>EditText's <strong>text</strong> not EditText's <strong>view</strong></p>
<p><a href="http://i.stack.imgur.com/mwxJM.png" rel="nofollow"><img src... |
Cannot create new opportunity in Vtiger? incorrect integer value <p>Could you please give me a hand to correct the error when I created new opportunity in Vtiger CRM. </p>
<p>The cause is "incorrect integer value '' when system insert '' into int field.
There is solution to solve it by set sql mode. But I'm using shar... | <p>In vtiger by default it use mysqli as DB type which will be defined in config.inc.php file</p>
<pre><code>$dbconfig['db_type'] = 'mysqli';
</code></pre>
<p>I would suggest you to set SQL mode runtime by defining this line in Library file which vtiger using for DB connection</p>
<pre><code>\vtiger\libraries\adodb\... |
Change Status Bar Background Color in Swift 3 <p>In XCode 7.3.x ill changed the background Color for my StatusBar with:</p>
<pre><code>func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
... | <pre><code>extension UIApplication {
var statusBarView: UIView? {
return value(forKey: "statusBar") as? UIView
}
}
UIApplication.shared.statusBarView?.backgroundColor = UIColor.red
</code></pre>
|
Java, CSV, Getting error if do not click on Save button of the csv file <p>This is my code </p>
<pre><code> public double myMethod(String name)
{
double result = 0.0;
String path = "/Users/T/Desktop/Training/MyFolder/";
int maxColumn = 0;
BufferedReader br = null;
ArrayLi... | <p>Check that your encoding when you save the file is the same encoding with the one you use when you read the file. It may well be that you are saving, for example, in UTF8 and reading the file as it would be UTF16. </p>
<p>This fits what you describe (if opening and saving the file before reading it, then it works) ... |
OpenCV, webcam window not opening <p>I am very new to computer vision and using the OpenCV libraries for some basic functions like opening a window for the camera. I used the code from the OpenCV book I run a code from there. A part is shown below:</p>
<pre><code>def run(self):
"""Run the main loop"""
... | <p>It's hard to say from the code what the problem is, but I believe is <code>cv2.namedWindow()</code>not <code>nameWindow</code>. Also, add <code>cv2.waitKey(1)</code> after the <code>imshow()</code> function call. </p>
<p>Here's a simpler way to open the webcam using python and opencv:</p>
<pre><code>import cv2
vid... |
Cannot GET (Passed url as parameter) <p>Can routes in express not take a full URL as a parameter?</p>
<p>For example,</p>
<pre><code>router.get("/new/:url", <some function>);
</code></pre>
<p>gives me the Cannot GET error when the :url is <a href="https://www.google.com" rel="nofollow">https://www.google.com</... | <blockquote>
<p>You can't get full <code>URL</code> like this format.This type of format is used to take parameters send by client</p>
</blockquote>
<pre><code> router.get("/new/:url", <some function>);
//you can get url as params
req.params.url//Use your URL
</code></pre>
|
Storing Component Name as a String for later use <p>On my form I have a number of TMyQuery Components. Their names identify which MySQL Tables they work with. For example, COMPONENTSTABLE works with the COMPONENTS TABLE, etc.</p>
<p>There are about 30 tables, but that might change in the future. </p>
<p>I also use a ... | <p>I am not sure what your question actually is. In the first part of the answer I assume that you don't really care about names of the objects but rather want some automated way of getting all the tables available refer to a field in another table. Below that, I answer your question about referring to an object if you... |
how to run array using for loop and do while loop <p>I'm newbie in Java and my problem is the output of my code will loop to infinity. First, I was asked to initialize the number of tickets to sum of number of children and number of adults. </p>
<pre><code> int noOfChildren = 2;
int noOfAdults = 5;
int noOfTick... | <p>You need to increment <code>i</code> inside the <code>do while</code> loop. The <code>for</code> loop has <code>i++</code>. The <code>do while</code> loop needs something like that.</p>
|
An array that will declare 5 random numbers from 0 to 100. Then it will average all the numbers that are over 70 <p>This is the homework question that I need to answer.</p>
<p>Write a complete program that declares an array of any five integers, from 0 to 100 , and averages only those integers which are greater than... | <p>try this:</p>
<pre><code>public static void main(String[] args){
Random Rnum = new Random();
int[] ar1 = new int[100];
int counter=0;
double total=0;
for(int i = 0; i < 5; i++) {
ar1[i] = Rnum.nextInt(100);
System.out.print(ar1[i] + " ");
if(ar1[i] > 70)
... |
Web Markup, background color set as base <p>so I'm having a slight issue. I need some way to get my background color of RGB(151,151,151) to be set as a base for the preceding code. I'll copy it down below</p>
<pre><code>body {
background-image: url(sd_back2.jpg);
background: -webkit-radial-gradient(circle clos... | <p>What do you mean by"set as a base"? If you want your color to display if the gradient doesn't work, just do exactly as you have done...</p>
<pre><code>body {
background-image: url(sd_back2.jpg);
background: -webkit-radial-gradient(circle closest-corner at 40% 70% , #ffffff 15%, rgba(151,151,151,0.5) 50% );
... |
why wireshark can't track wget packet? <p>When I use wireshark to track tcp packet, it works fine. But when I use <code>wget</code> command, it can't track. What's the problem ?</p>
<pre><code>â â wget http://superuser.com/questions/674605/what-is-type-of-icmp-packets-tcp-or-udp
--2016-10-01 10:50:36-- http://sup... | <p>I got it, because I use VPN which causes the dest ip changed to VPN address . </p>
|
Indexing the list in python <pre><code>record=['MAT', '90', '62', 'ENG', '92','88']
course='MAT'
</code></pre>
<p>suppose i want to get the marks for MAT or ENG what do i do? I just know how to find the index of the course which is new[4:10].index(course). Idk how to get the marks.</p>
| <p>Try this:</p>
<pre><code>i = record.index('MAT')
grades = record[i+1:i+3]
</code></pre>
<p>In this case <code>i</code> is the index/position of the <code>'MAT'</code> or whichever course, and grades are the items in a slice comprising the two slots after the course name.</p>
<p>You could also put it in a function... |
how can xss filtering in codeigniter 3 still usefull? <p>Hi I would like to know if should the use of this parameters still usefull and effective for security purposes.</p>
<pre><code>$this->input->post('some_data', TRUE);
</code></pre>
<p>I'm not sure if I should put all my post data with the second parameter ... | <p>XSS filtering is depreciated in the sense that you are using it. However you are advised to use </p>
<pre><code>$data = $this->security->xss_clean($data);
</code></pre>
<p>This is to be used for submission and used at the time of submission</p>
<p>Look in the Security library.</p>
<p>Using form_open escape... |
Success function is not called in ajax form <pre><code>$('#upload').on('click',function(){
$('#upload_form').ajaxForm({
url:insert_url,
type:'post',
target:'#preview',
beforeSubmit:function(e){
console.log('before');
$('.progress').show();
},
success:function(res, status, xhr, fo... | <p>Are you using jQuery form plugin? If so, make sure it's source added to the HTML and loaded without errors.</p>
<p>Your code seems incomplete, is it because you just have other stuff inside of <code>$('#upload').on('click',function(){</code>? If not, make sure that you close the function, here's what I mean (I also... |
onChange in html and Javascript <p>I have a fiddle</p>
<p><a href="http://jsfiddle.net/U4vaP/4/" rel="nofollow">http://jsfiddle.net/U4vaP/4/</a></p>
<p>it works, but I want to perform a function when the value of the dropdown changes. so i put </p>
<pre><code><select id="mycars" onChange="showmake(this.value)" &g... | <p>This may help, read this: <a href="http://stackoverflow.com/questions/6587059/javascript-onchange-arrow-keys">Javascript onChange arrow keys</a></p>
<p>You may need to trigger the blur event, inside an onclick event.</p>
<p>And to elaborate more.</p>
<pre><code>function captureChange(some_var) {
console.log(s... |
How do I have my Chrome Extension run when my Youtube Comments are loaded or when my Messenger messages are loaded? <p>I want to change youtube comments containing a certain keyword to something else, but to do that, I have to detect their text. I'm using a chrome extension with a manifest as follows:</p>
<pre><code>{... | <p>YouTube comments and messenger messages are loaded Asynchronously, and your <code>content.js</code> runs at <code>document_end</code> i.e before these calls are preformed.</p>
<blockquote>
<p>In the case of "document_end", the files are injected immediately after the DOM is complete, but before subresources like ... |
How does this code calculate pi with high precision? <p>Here is the code:</p>
<pre><code>#include <stdio.h>
long f[2801];
int main()
{
long i = 0, c = 2800, d = 0, e = 0, g = 0;
for (i = 0; i < c; ++i)
f[i] = 2000;
for (;;) {
d = 0;
g = c * 2;
if (!g)
... | <p>This is a formatted copy of the PI program written by Dik T. Winter of the CWI institute of Holland. Originally written in an obfuscated form, in two or three lines, there are several variations by Dik and other that output different numbers of places of PI (e.g. 800, 15,000, etc.) based on evaluation of a mathemat... |
in R find duplicates by column 1 and filter by not NA column 3 <p>I have a dataframe: </p>
<pre><code>a <- c(rep("A", 3), rep("B", 3), rep("C",2))
b <- c(1,1,2,4,1,1,2,2)
c <- c(1,NA,2,4,NA,1,2,2)
df <-data.frame(a,b,c)
</code></pre>
<p>I have a dataframe with some duplicate variables in column 1 but when... | <p>Your use of <code>duplicated</code> function to remove duplicate observations (lines) using a column as key from a data frame is correct.</p>
<p>But it seems that you are worried that it may keep a line that contains NA in another column and drop another line that contains a non NA value.</p>
<p>I'll use you examp... |
My app is forced closing. Can someone help me? <p>Here's my app code:</p>
<pre><code>public class LEDOnOFF extends Activity {
private static final String TAG = "LEDOnOff";
Button btnOn1, btnOff1, btnOn2,btnOff2,btnOn3,btnOff3,btnOn4,btnOff4,btnOn5,btnOff5;
private static final int REQUEST_ENABLE_BT = 1;
... | <p>Well the error is crystal clear .. That is on the following line </p>
<pre><code>BluetoothDevice device = btAdapter.getRemoteDevice(address);
</code></pre>
<p>You have this inside your <code>onResume()</code> method, where you have not initialized it properly . Globally you have initialized it as null </p>
<pre>... |
React use radium to change css under div <p>Here is my original code : </p>
<p>the css will change all the <code>p</code> tag under <code><div className="TEST"></code> </p>
<p><strong>Home.js</strong></p>
<pre><code>export default class Home extends Component {
render() {
return (
<div classNa... | <p>You can use the <code>Style</code> component of Radium (see more at: <a href="https://github.com/FormidableLabs/radium/tree/master/docs/api#style-component" rel="nofollow">https://github.com/FormidableLabs/radium/tree/master/docs/api#style-component</a>)</p>
<pre><code>import React, { Component } from 'react'
impor... |
HTML toolbar button positioning <p>So here is my issue I have a logo on the nav bar of the website I'm developing and when i have the logo added, the text is not centered vertically, but when I remove the logo the text is centered.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-b... | <p>There are a lot of ways to do this. One solution is using flexbox:</p>
<pre><code>.navigation{
display: flex;
align-items: center;
}
</code></pre>
<p>Live demo: <a href="https://jsfiddle.net/j2ahjd8w/6/" rel="nofollow">https://jsfiddle.net/j2ahjd8w/6/</a></p>
<p>More solutions here: <a href="https://css-trick... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.