input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
jquery datatable not working in firefox <p>I use the below code</p>
<pre><code> $("body").html(tab).promise().done(function () {
$('table').DataTable({
initComplete: function () {
$('.buttons-excel').click()
},
paging: false,
... | <p>make sure you have followed HTML structure of table.</p>
<ol>
<li>Well defined tabel start and end tag.</li>
<li><p>for header line make sure you have defined structure like this <code><thead><tr><th>...</th><th>...</th>...</tr></thead></code></p></li>
<li><p>for all ... |
How to pass a QueryString variable to jQuery Ajax <p>I have Default.aspx</p>
<pre><code><asp:Button ID="showOrderbtn" runat="server" Text="ShowOrder"
onclick="showOrderbtn_Click"/>
</code></pre>
<p>And in Default.aspx.cs </p>
<pre><code>protected void showOrderbtn_Click(object sender, EventArgs e)
... | <p>Why don't we pass the query string to web method and just the redirect to the page you want in aspx page .Lets have a look !!!</p>
<p><strong>In *.aspx</strong></p>
<pre><code><script>
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.... |
executing N times in bach an emacs macro <p>I have an Emacs macro(named/saved) in a mymacro.el file</p>
<p>I would like to execute N times the macro in batch mode
like this:</p>
<pre><code>emacs --batch -l ~/mymacro.el test.txt -f MyFoo
</code></pre>
<p>Question how to add N times in the lisp mymacro.el code ... | <p>ErgoEmacs has a <a href="http://ergoemacs.org/emacs/elisp_command_line_argv.html" rel="nofollow">good page</a> on this. What you want to do is reference the <code>argv</code> variable after calling emacs with the <code>--script</code> option. <code>(elt argv 0)</code> will give you the value of the first argument yo... |
Acessing a variable as a string in a module <p>Following other posts here, I have a function that prints out information about a variable based on its name. I would like to move it into a module.</p>
<pre><code>#python 2.7
import numpy as np
def oshape(name):
#output the name, type and shape/length of the input v... | <p>The actual problem you have here is a namespace problem.</p>
<p>You could write your method this way:</p>
<pre><code>def oshape(name, x):
# output the name, type and shape/length of the input variable(s)
# for array or list
if type(x) in (np.array, np.ndarray):
print('{:20} {:25} {}'.format(nam... |
How to check the status of a spring batch job whether an instance of the job is currently under execution through spring-batch-admin? <p>I have a requirement where i have created a custom UI for spring-batch monitoring using the spring-batch-admin JSON api. I have a requirement where i dont want to allow the user to st... | <p>Never used this API, but from this site: <a href="http://docs.spring.io/spring-batch-admin/reference/json.html" rel="nofollow">http://docs.spring.io/spring-batch-admin/reference/json.html</a></p>
<p>You can get the status of the last job (so, the one running if there is one running) with <code>http://localhost:8080... |
auto start, cross platform, background mobile web service with codename one or cordova <p>I'm a newbie to mobile software development. I want to make a piece of software that:<br /><br />
1. I write once, and it runs on iOS, android, and windows mobile devices.<br />
2. Has no user interface of its own.<br />
3. Is lik... | <p>Codename One has builtin support for background polling of the web, notice that it isn't designed to run frequently as this is a battery drain.</p>
<p>See: <a href="https://www.codenameone.com/blog/background-fetch.html" rel="nofollow">https://www.codenameone.com/blog/background-fetch.html</a></p>
<p>You can also ... |
Replace newline in python when reading line for line <p>I am trying to do a simple parsing on a text in python which I have no issues with in bash using tr '\n' ' '. Basically to get all of the lines on a single line. In python print line is a bit different from what I understand. re.sub cannot find my new line becau... | <p>You can write directly to stdout to avoid the automatic newline of <code>print</code>:</p>
<pre><code>from sys import stdout
stdout.write("foo")
stdout.write("bar\n")
</code></pre>
<p>This will print <code>foobar</code> on a single line.</p>
|
MongoDB query with embedded document in array (3 levels) <p>I had this data on my MongoDB database and I would like to get only the second array about blades.</p>
<pre><code>{
"_id" : ObjectId("..."),
"name" : "Westereems",
"country" : "Netherlands",
"turbines" : [
{
"turbine_id" : ObjectId("..."),
... | <p>You can use this query, it's not an optimal query for large array's items but if you have only above items then you can use it.</p>
<p>you can also go with <a href="https://docs.mongodb.com/manual/aggregation/" rel="nofollow">aggregation</a> to make it more optimal.</p>
<pre><code>db.collection("windfarms").find({... |
Android Location Manager crashing the app when called <p>I wrote a code to get the current position of the device every time the user clicks on a button. But when I call the listener, the app just crashes. Can anyone give me an insight of what I did wrong? Thanks in advance.</p>
<pre><code>public void onStartService()... | <p>Call <code>addListenerLocation();</code> in the service's <code>onCreate()</code> method instead.</p>
|
How to set an initial moving average value in Java? <p>I want to actively calculate the moving average of stock data using the formula below:</p>
<pre><code> public class Average {
private static double usdJpy;
private int counter = 1;
private double movingAverageUsdJpy_ = 100.5;
public void calc... | <p>Your formula is incorrect. If <code>counter</code> is the not-yet incremented value, then use</p>
<p><code>movingAverage = (counter * movingAverage + latestRate) / (counter + 1)</code></p>
<p>Then increment <code>counter</code> by 1. Note that if you want <code>counter</code> to be fixed in size (as is quite commo... |
Cannot convert value of type '(String!, NSError!) -> ()' to expected argument type 'GGLInstanceIDTokenHandler!' <p>I have this problem with <code>Google Cloud Messaging</code> (<code>GCM</code>) after refactoring to Swift 3. Can anyone help?</p>
<p>I got this error:
<strong>Cannot convert value of type '(String!, NSE... | <p>Change registrationHandler to</p>
<pre><code>func registrationHandler(_ registrationToken: String?, error: Error?) {
// â¦
}
</code></pre>
|
My angular frontend App can not send PUT request to my backend REST app <p>I have two web apps running on a single tomcat instance. One of them is Spring MVC Rest app which has basic structure, a rest controller, a service layer and DAO layer which is interacting with postgresql .
Below you can see my RestController</p... | <p>Looks like your RequestMapping is wrong, you did not specify a path there :</p>
<pre><code>@RequestMapping( method = RequestMethod.PUT)
</code></pre>
<p>You need to set a apth and add {id} so spring can map it as @PathVariable</p>
<pre><code>@RequestMapping(value = "/listjson/{id}", method = RequestMethod.POST)
<... |
Using an auth function on an onEnter route vs using a high order function and are both methods really secure? <p>Lets take a system where a jwt token is saved to local storage upon login and now we check for the token existence to allow a user access to a protected route.</p>
<p>We're using react-router-redux and bun... | <p>In my opinion you shouldn't store you JWT token in localStorage, instead you should keep it as a cookie with httpOnly and secure flags as true. So that your client script can't get your JWT token. Also man in the middle attacks are not possible since you are sending your cookie on https only. </p>
<p>You could have... |
Std::Array with unique_ptr <p>I have an class which I wish to instantiate by passing an array of values. The object here has two members but this has been reduced for illustration. In the future I will read values from disk and then create an object from those values, hence the array. The object will have multiple poin... | <p>First of all its bad if you pass the array by value in the SimpleBody constructor. Better use a reference</p>
<pre><code> SimpleBody(const std::array<int, varCount> &inputArray);
</code></pre>
<p>At the moment, you construct your shared_ptr the unique_ptr looses the ownership of the array. You don't need... |
Can i change the class of an variable in an abstract class <p>In my current project I have a couple of classes that inherit variables from an abstract class. One of the similarities is that they all need to cal for a new specific controller class, based on which extension of the abstract class they are. These classes a... | <p>If you're running into this problem with all your Controllers, I recommend using a generic:</p>
<pre><code>abstract class ObjectController<T extends GameObject> {
protected T gameObject;
protected Game gameVersion;
public ObjectController(T object, Game gameVersion){
this.gameObject = obj... |
Values not being passed to on submit function in redux-form 6.0.5 <p>For some reason, when I use anonymous functions to define my components, the values never get passed to the submit handler. I am using redux-form 6.0.5</p>
<p>I created the following simple form:</p>
<pre><code>class TestForm extends Component {
... | <p>I am actually in the same course as you and wanted to post about what the issue is. There is a breaking change from V4 to V6 and in the course we are using V4 of redux-form. I like to learn on the most up to date so I updated everything but it's a pain but I did find the solution to having the form actually save. Fi... |
How to move a file on Azure File Storage from one sub folder to another sub folder using the Azure Storage SDK? <p>I'm trying to figure out how to move a file in Azure File Storage from one location to another location, in the same share.</p>
<p>E.g.</p>
<pre><code>source -> \\Share1\someFile.txt
destination ->... | <p>This is <a href="https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/" rel="nofollow">documented in the Getting Started guide on Azure Storage Files</a> reference. </p>
<p>What you need is the <code>StartCopy</code> method to copy the file from one location to another.</p>
<pre... |
MongoDB Node Driver Count of current aggregation <p>I am using mongodb for node and am trying to aggregate a collection of documents based on some set filters and then limit it to 10. I have it aggregating just fine and limiting just fine but I need to get the total number of that aggregated documents before I limit th... | <p>It's possible to do so in a single query.</p>
<p>You can project the filtered array using <code>$project</code> into two different fields: one with the content and one with the count.</p>
<p>You can use <code>$slice</code> to limit the content array.</p>
<pre><code> db.collection.aggregate([
{
$match:... |
SQL query to populate dropdown field <p>I'm trying to query a table in my DB to populate a dropdown field on a form.
I'd like Field1 as the display and Field2 as the value on my insert.</p>
<pre><code>select '[CategoryName]','[CatID]' from BND_ListingCategories
</code></pre>
<p>The above query just populates [Categor... | <p>Remove the single quotes from column names.</p>
<pre><code>select [CategoryName],[CatID] from BND_ListingCategories
</code></pre>
<p>If you wanted to sort with category name, use ORDER BY.</p>
<pre><code> select c.CategoryName, l.CatID
from BND_ListingCategories as c
INNER JOIN BND_Listing as l
... |
How to unit test this Redux thunk? <p>So I have this Redux action creator that is using <code>redux thunk</code> middleware:</p>
<p><strong>accountDetailsActions.js:</strong></p>
<pre><code>export function updateProduct(product) {
return (dispatch, getState) => {
const { accountDetails } = getState();
d... | <p>Have a look at <a href="https://github.com/reactjs/redux/blob/master/docs/recipes/WritingTests.md#async-action-creators" rel="nofollow">Recipe: Writing Tests</a> from the official documentation. Also, what are you testing, the action creator or the reducer?</p>
<h3>Action Creator Test Example</h3>
<pre><code>descr... |
Vim Highlight Problems <p>I'm working with nesC language using vim under Ubuntu 16.04 LTS.</p>
<p>My problem is when I'm editing the codes, highlighting works ok (like on the first picture), but when I save, quit and open the file again, the highlighting disappears (like on the second one).</p>
<p><a href="http://i.s... | <p><code>vim</code> highlights syntax of existing files based on file extension (which one do you use?). Fortunately, there can be some extensions that allow you to fix it. Probably <a href="http://www.vim.org/scripts/script.php?script_id=899" rel="nofollow">this</a> is such an extension. <a href="http://beerpla.net/20... |
Logstash: Is it possible to take file input from remote host <p>I want to feed a log file to logstash. But the file is on a remote host. Is there a way to make logstash consume this file? Then, I will forward the events to an elasticsearch instance running on the same machine as logstash. </p>
<p>Conversely, is it pos... | <p>I am trying the same but still did not find any solution.. please share your any workaround</p>
|
Angular2: Access class variable within anonymous function <p>I'm sure there is a simple way to do this but I can't seem to find it. Here is my code</p>
<pre><code>export class UserLoginComponent {
private user: User;
public authService: AuthService;
constructor(private cognitoConfigs: CognitoUtil, authService: AuthSe... | <p>Don't use <code>function ()</code> because this changes the scope of <code>this</code>.</p>
<p>Array functions retain the scope of <code>this</code></p>
<pre><code> onSuccess: (result: any) => {
this.authService.login(this.user, result);
},
onFailure: (err: any) => {
console.log(er... |
Reproducing Spotify playlist with "devices available" programmatically <p>Is there any way to reproduce Spotify playlist <strong>programmatically</strong> in devices available on my network such as Chromcast Audio? </p>
<p>Looking for code examples. </p>
<p><strong>Update</strong>:
The idea is to do this:
Change fro... | <p>You would need to write your MediaRouteChooserDialog and write your own MediaRouteDialogFactory and register that. You can find sample codes in <a href="https://github.com/googlecast/CastCompanionLibrary-android/tree/master/src/com/google/android/libraries/cast/companionlibrary/cast/dialog/video" rel="nofollow">CCL<... |
PHP - How to get mysqli_connect() to return a RESOURCE so it can be used with define() <p>I have noticed something while testing different MySQL connection methods in PHP.</p>
<p>I usually use odbc_connect() when making a connection to a database in PHP. I save the resouce variable that odbc_connect() returns into a g... | <p>i would recommend to use the singleton pattern for this case
Here a example:</p>
<pre><code><?php
class PDOConnection {
/**
* singleton instance
*
* @var PDOConnection
*/
protected static $_instance = null;
/**
* Returns singleton instance of PDOConnection
*
* @return PDOConnection
*/
public stati... |
Reverse calculation of sqrt() <p>I'm making a online RPG game where I use this math formula (found online) to calc exp -> level.</p>
<pre><code>$level = (25 + sqrt(625 + 100 * $exp)) / 50;
</code></pre>
<p>I have tried for days to make a script to reverse it.
My goal is to make a function to calc the amount of exp re... | <p>Turns out it's possible to simplify even further to:</p>
<pre><code>$exp = 25*($level*$level - $level);
</code></pre>
<p>Derivation:</p>
<pre><code>l=(25 + sqrt(625 + 100e))/50
50l=25 + sqrt(625 + 100e)
50l-25=sqrt(625 + 100e)
(50l-25)^2=625 + 100e
(25*(2l-1))^2=625 + 100e
625*((2l-1))^2=625 + 100e
625*((2l-1))^2... |
How to add an item into a JSON in Knockout.js <p><strong>EDIT:</strong> I want to be able to add any element into the object, not just specifically age.</p>
<p>Is there any way of adding items into a JSON in Knockout.js?
I want to add age into this existing JSON below and have it reflected on the web page. The click f... | <p>Set the age property on the original JSON object, even if you leave it blank. This will cause it to map into your view model properly. Then, later on, you can set the age value on the view model without re-mapping. You should only ever have to use ko.mapping once on an object. See below:</p>
<p>HTML:</p>
<pre><cod... |
Call a function when counter reaches some value without if statement <p>Lets say I have a function named <code>loop()</code>. In this <code>loop()</code> I increment a counter <code>count</code>.<br>
I have few functions, <code>A()</code>, <code>B()</code>, <code>C()</code>, etc. </p>
<p>I want to call each one of th... | <p>Leave optimisations to the compiler in the first place. Concentrate on writing human-readable code. Optimise only iff you have a timing problem and after you profiled the code. Then concentrate on the hot-spots. If some code is good for branch-prediction is hard to predict with modern CPUs.</p>
<p>Use a <a href="ht... |
Problems with "redo/undo" function(mfc, c++) <p>I'm trying to create Redo/Undo function in my mfc application, but when i'm trying to undo CLine object - it doesn't work correctly. What i do wrong? Sorry for my english!</p>
<p><a href="http://i.stack.imgur.com/qfFXF.png" rel="nofollow"><img src="http://i.stack.imgur.c... | <p>As mentioned, <code>SetAt</code> accessed an out of bounds index, which resulted in a assert call from VS. Using <code>Add</code> naturally solves the problem, as the array is extended.</p>
<p><sub><a href="http://stackoverflow.com/questions/39575690/problems-with-redo-undo-functionmfc-c?noredirect=1#comment6646211... |
Where is the project folder for node.js app on digital ocean <p>I have just spun up a Digital Ocean Single Click App for node.js. I connected via SSH and installed npm. What directory do I run <code>npm init</code> in to start coding my new app?</p>
<p>My question is not: </p>
<blockquote>
<p>What are some good res... | <p>After connecting to the server via SSH, go into the <code>var</code> folder and create a <code>www</code> folder. Then go into the <code>www</code> folder and create a <code>project</code> folder (name the folder with your project name). Inside that <code>project</code> folder, run <code>npm init</code> to initializ... |
In how many ways can I use 4 colors in a square <p>I'm doing a program in C but I got stuck in math :D</p>
<ul>
<li><blockquote>
<p>I have a square divided by quadrants. 4 squares inside a square</p>
</blockquote></li>
<li><blockquote>
<p>For each quadrant I can have a color. Red,Blue,Green and Yellow.</p>
</block... | <p>I think you are asking for a permutation without repetition, which in your case would be 4! = 24.</p>
|
Ionic Push Notification: Not receiving in IOS <p><strong>THE SITUATION:</strong></p>
<p>I use <a href="http://docs.ionic.io/services/push/" rel="nofollow">Ionic Push Notifications</a> in my app.</p>
<p>With android everything works fine. But with IOS I don't receive any notification.</p>
<p>The code should be fine. ... | <ul>
<li>Make sure notifications are enabled in your iOS settings app</li>
<li>Try using content_available = true in push payload</li>
<li>Try using priority = "high" in push payload</li>
<li>Make sure you're not sending using development certificates on a production app version or viceversa</li>
<li>Make sure your tok... |
How do I get opencv for python3 with anaconda3? <p>So, initially, I just had python 3.5 from the anaconda installation and all was fine. Then I was following a tutorial that suggested the use of enthought canopy, which used python 2.7.
After this I did a 'pip install opencv-python' and that installed the 2.7 version ... | <p>Once you have anaconda installed, try the following (as seen in <a href="https://rivercitylabs.org/up-and-running-with-opencv3-and-python-3-anaconda-edition/" rel="nofollow">this tutorial</a>):</p>
<pre><code>conda create -n opencv numpy scipy scikit-learn matplotlib python=3
source activate opencv
conda install -c... |
Should I call super.processAction(actionRequest, actionResponse) in any action method in a Liferay portlet <p>Should I call super.processAction(actionRequest, actionResponse) in every action method I have within a Liferay portlet. If yes, why? and where this call should go (should it go to the beginning or to the end o... | <p>It totally depends on your requirement. If you simply want to call Super class implementation for process action, you can use super.processAction(actionRequest, actionResponse) and it should be called at end because any code after this line will not executed if redirected to proessAction of MVCPortlet or GenericPor... |
password field is showing password in plain text <p>I have used django allauth for user registration and login system. I could show the form by simplifying the lines of code using for loop. I got the right field type(TextInput and PasswordInput) for each field too. However the password field which has PasswordInput sho... | <p>You can add class by overriding <code>__init__</code> method in form class</p>
<pre><code>def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['password'].widget.attrs['class'] = 'form-control'
</code></pre>
|
How to expand 'a'-link to a whole div without jQuery or JavaScript? <p>There are two divs with an image and hyperlink in each. The goal is to force each div to be an entire hyperlink - without jQuery, JavaScript or Onclick function.</p>
<p>What do I have now:</p>
<p><div class="snippet" data-lang="js" data-hide="fals... | <p>You can see the changes I've made as they are the CSS rules indented to the left. In short you need to make the font awesome icons absolutely positioned so the link element can take up the whole box area.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div clas... |
How to add another two full width sections below (CSS) <p>Hi there I've built a portfolio website but for the life of me for the past 3 days I haven't been able to added full-width sections after my portfolio grid.</p>
<p>I'm really at this point not sure what more I can do and would really love to hear from you how c... | <p>I did following changes to your code</p>
<ul>
<li>Took out the parent div from work div and made it 100% width </li>
<li>Removed the padding-right from the h1. </li>
<li>Moved up the .footer class and added right after the .parent class styles.</li>
<li>Removed padding-left: 20em; and the big font size from .footer... |
Finding a document, editing it, and putting it back in MongoDB <p>I am using mongodb and I want to be able to edit a document and reinsert it WITHOUT duplicates. So far i have tried collection.findAndModify() but I couldn't get that to work. I have a collection like this:</p>
<p><div class="snippet" data-lang="js" dat... | <pre><code>modelname.findOneAndUpdate({ email: var_email}, { $set: { token: var_token, platform: var_platform}}, { new: true }, function(err, doc)
{
//doc here has updated document, in case you need it.
});
</code></pre>
<blockquote>
<p>var_email etc. is your variable name and email is field name in
database.... |
Close/expand widths on hover/mouseout events <p>it was hard to find a good title so sorry for that...</p>
<p>I've got follow 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... | <p>i guess you want something like this ? </p>
<p>Explanation : on click on <code>.group2</code> i add a class <code>expanded</code> . on the second click that class will be removed ( <a href="http://api.jquery.com/toggleclass/" rel="nofollow">toggleClass</a> ) . same for <code>.group1</code> with class <code>shrink</... |
Install multiple .service files with dh_systemd packaging <p>I'm currently packaging a python app with dh_virtualenv, to deploy it on Ubuntu 16.04, daemonized with systemd.</p>
<p>I use the dh_systemd plugin to automatically install the file my_app.service will install the .deb package, but I'd like to run another pro... | <p>Found the solution <a href="http://%20http://unix.stackexchange.com/questions/306234/is-it-possible-to-install-two-services-for-one-package-using-dh-installinit-how" rel="nofollow">here</a> : </p>
<pre><code>override_dh_installinit:
dh_installinit --name=service1
dh_installinit --name=service2
</cod... |
using golnag channels. GETTING "all goroutines are asleep - deadlock!" <p>iam currently playing around with go routines, channels and sync.WaitGroup. I know waitgroup is used to wait for all go routines to complete based on weather wg.Done() has been called enough times to derement the value set in wg.Add().
i wrote ... | <p>The call to <code>wg.Wait()</code> wouldn't return until <code>wg.Done()</code> has been called once.</p>
<p>In <code>addStuff()</code>, you're writing values to a channel when there's no other goroutine to drain those values. Since the channel is unbuffered, the first call to <code>channel <- val</code> would b... |
Storyboard won't open in XCode8 <p>I have a storyboard that opens fine in XCode7.3.1 but in XCode 8 will only open source code, it will not open in Interface Builder. Trying to open it in Interface Builder produces the error: The document "Main.Storyboard" could not be opened. Unrecognized file content.</p>
| <p>Got a similar problem, although I had a never ending spinwheel, didn't even get an error message.</p>
<p>When I noticed not a single file of my project was changed when it stopped working I assumed a cache error somewhere, so in the end I 'fixed' it by restarting my computer (restarting XCode wasn't enough).</p>
<... |
proper way to run kotlin application from gradle task <p>I've got simple script</p>
<pre><code>package com.lapots.game.journey.ims.example
fun main(args: Array<String>) {
println("Hello, world!")
}
</code></pre>
<p>And here is <code>gradle</code> task </p>
<pre><code>task runExample(type: JavaExec) {
... | <p>Thanks to the link <a href="http://stackoverflow.com/questions/9355690/how-to-run-compiled-class-file-in-kotlin/26402542#26402542">how to run compiled class file in Kotlin?</a> provided by @JaysonMinard
that <code>main</code></p>
<pre><code>@file:JvmName("Example")
package com.lapots.game.journey.ims.example
fun... |
Use model checker to check one particular trace <p>I'm using LTL to define rules for open interaction protocols. I then want to check if a particular interaction follows the specification, or if any rule was broken. My immediate approach was to use NuSMV, but the problem is that I don't have a model of the interaction ... | <p>After some thinking, I found a solution to encode a particular trace in a NuSMV model. It's quite simple, the trick is to use one variable for each state of the trace. </p>
<p>For example, I wanted to encode an interaction, and I wanted only the last uttered message to be true in each state. If the interaction to e... |
Im not able to edit the timeout on Selenium Standalone <p>I'm trying to create a test Automation with webdriverio, selenium standalone and Gulp. Selenium is running within the app, but I can't edit the selenium timeout default value. The page loads fine, but it's super slow and I get the default 10 second timeout. How ... | <p>On the <code>wdio.conf.js</code> file, on <code>mochaOpts</code> attribute added <code>timeout</code> with the milliseconds desired under the <code>compiler</code> options.
The config ended up like this:</p>
<pre><code> exports.config = {
specs: [
'./testcases/*.js'
],
exclude: [
... |
Eclipse Neon HTTP Proxy Authentication Required Error <p>when I go to Install new software and select an update site Or
go to Available Software Site Click Reload, I get a "HTTP Proxy Authentication Required" error.</p>
<p>I have searched the web, and I've tried the found suggestion like setting eclipse.ini with</p>
... | <p>Solve it adding to eclipse.ini
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4</p>
<p>and removing -Djava.net.preferIPv4Stack=true</p>
|
Validating a users input <p>I'm fairly new to Python and I'm using a while True loop. Inside that loop I have </p>
<pre><code>Sentence= input("please enter a sentence").lower().split()
</code></pre>
<p>However I want to create validation so an error message appears when the user inputs a number instead of a letter. I... | <pre><code>sentence = input("please enter a sentence").lower().split()
for word in sentence:
if not word.isalpha():
print("The word %s is not alphabetic." % word)
</code></pre>
|
rename the pandas Series <p>I have some wire thing when renaming the pandas Series by the datetime.date</p>
<pre><code>import pandas as pd
a = pd.Series([1, 2, 3, 4], name='t')
</code></pre>
<p>I got <code>a</code> is:</p>
<pre><code>0 1
1 2
2 3
3 4
Name: t, dtype: int64
</code></pre>
<p>Then, I have:</... | <p>Because <code>rename</code> does not change the object unless you set the <code>inplace</code> argument as <code>True</code>, as seen in the <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.rename.html" rel="nofollow">docs</a>.</p>
<p>Notice that the <code>copy</code> argument can be use... |
How to ask user to input and that's should be required <p>From a shell script, I want to ask the user to input data such as database name, database user etc.</p>
<p>When the user inadvertently presses the enter key, the input is blank. How do I make the input required? If the input is blank, the script asks that quest... | <p>You may use an infinite loop and <code>break</code> if input is not empty:</p>
<pre><code>while true; do
echo -n "Your Database Name: "
read dbname
if [[ "$dbname" != "" ]]
then
echo "dbname = $dbname"
break
fi
done
</code></pre>
|
Time conversion Ruby on Rails 4 not working <p>Part of my logic for sending an email to a supplier is that the promise date must be less than today's date in order to send the email. For whatever reason, it is passing as true even though it should be false. I test it in the console and it shows false, but it sends the ... | <p>I think the problem is with your TimeZone.</p>
<p>Always use <code>Time.zone.now</code> instead of <code>Time.now</code>. <a href="http://danilenko.org/2012/7/6/rails_timezones/" rel="nofollow">Click here</a> for more details.</p>
<p>You can change your <code>if</code> condition like this.</p>
<pre><code>x.promis... |
Submit Form and it's Data to Outside URL as well as redirecting <p>I am trying to make a login form on the front end of my site that will take the username and password and submit to an outside URL (a portal for the customers). I want the data they sumbit to the form on my website to pass to the new URL with the portal... | <p>Change your form method to <strong>POST</strong>.</p>
<pre><code><form id="redirect-form" method="POST">
<p class="mbn"><input type="text" name="loginid" placeholder="username" /></p>
<p class="mbn"><input type="password" name="password" placeholder="password" /></p>
<... |
adding the "/" character in my footer links wordpress <p>I need some help. I am stuck with adding the "/" in the footer links of my wordpress secondary link menu. I want to add "/" between the navigation of my <code><div id="footer-right"></code>. I am using wordpress.</p>
<p>here is my code in footer :</p>
<pr... | <p>you can use <code>display:inline-block</code> instead of <code>float:right</code> and give some <code>left/right margin</code></p>
<p><strong>Notes</strong></p>
<ul>
<li>avoid using <code>!important</code></li>
<li><code>ul</code> can only have <code>li</code> has direct descendant, so remove/rearrange the <code>b... |
Android UI Images Sharp Edge <p>I've been having problems with large images being resized for UI use in Android.
Look at this image, it's an <code>ImageView</code>: </p>
<p><a href="http://i.stack.imgur.com/6KPhR.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/6KPhR.jpg" alt=""></a><br>
The original image (Tha... | <p>You should use Vector Images instead of Bitmap Images.</p>
<p>Bitmap x Vector</p>
<p>A bitmap represents an image by a series of colored pixels. Whereas a vector image is represented by geometric shapes (lines, curves) using colors.</p>
<p>The main utility of a vector image is allowing to scale without losing def... |
In-App purchase with Windows phone8 <p>I have developed an Win-Phone8 application, Initially for 15 days I am giving my application for trail period and after 15 days the user have to subscribe the application (They can purchase) to use it uninterruptedly rest of the time , I was planning to use third party payment gat... | <p>Yes. In-app purchase given by Microsoft is enough for selling apps in windows store. You don't need to worry about third party payment gateway etc. </p>
<p>refer to this link <a href="https://msdn.microsoft.com/en-in/library/windows/apps/jj206949(v=vs.105).aspx" rel="nofollow">https://msdn.microsoft.com/en-in/libra... |
Why is collect in SparkR so slow? <p>I have a 500K row spark DataFrame that lives in a parquet file. I'm using spark 2.0.0 and the SparkR package inside Spark (RStudio and R 3.3.1), all running on a local machine with 4 cores and 8gb of RAM.</p>
<p>To facilitate construction of a dataset I can work on in R, I use the ... | <p>@Will</p>
<p>I don't know whether the following comment actually answers your question or not but Spark does lazy operations. All the transformations done in Spark (or SparkR) doesn't really create any data they just create a logical plan to follow.</p>
<p>When you run Actions like collect, it has to fetch data d... |
Unit test Android, getString from resource <p>I am trying to do an unit test for an android app and I need to get a string from res.string resources. The class that I want to test is a POJO class. I am doing the app in two languages, due to this, I need to get a string from resource. The problem is that I cannot get th... | <p>You don't have a real android Context while you are using JVM unit test. For your case, maybe you can try Android Instrumentation Test, typically it is implemented in the "androidTest" directory of your project.</p>
|
Evaluating a passed object in a directive <p>I'm making a custom directive for a textbox directive, which is part of a separate project.</p>
<pre><code><textbox restrict="{type: 'ref', callback: _.noop}"></textbox>
</code></pre>
<p>Note that I used noop for testing purposes at the moment. When I access:at... | <p>You can use angular.FromJSON function</p>
<pre><code>var jsonObject = angular.fromJson(jsonString)
</code></pre>
<p>$parse is a bit heavy compared to above. If you are sure you have a JSON string I won't suggest using $parse. </p>
<p>$scope.eval will internally call $parse</p>
|
Transform to normal Data Frame which has row as list. Split rows to column <p>My Data Frame output from reading a complex json looks like below.</p>
<p>Where individual row is a list within a single column.</p>
<p>Below is the sample Data Frame(<code>df</code>)</p>
<pre><code>col
[A,1,3,4,Null]
[B,4,5,6,Null]
[C,7,8... | <p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.from_records.html" rel="nofollow"><code>DataFrame.from_records</code></a>, but first need create nested <code>list</code> from values of column <code>col</code>:</p>
<pre><code>df = pd.DataFrame({'col':[['A',1,3,4,'Null'],['... |
Powershell Getting the nth day of the month <p>I have this script which I found on the internet to calculate the third Tuesday of every month - but I need to modify it to simply give me the 7th day of the month, and the same but plus any number of days).</p>
<pre><code> $FindNthDay=3
$WeekDay='T... | <p>This actually isn't too bad.</p>
<p>First, let's store a pointer to todays date in a variable, let's call it $date.</p>
<pre><code>$date = Get-Date
</code></pre>
<p>Next, we'll need to figure out what numerical day of the month is (like the numerical portion of it). We can do that using <code>$date.Day</code>.</... |
Using django-photologue to assign single image to a model <p>I'm working on my first project in django, and the first part of it is a blog app. I've installed django-photologue which seems very useful for the intended purposes for later apps. Although this app will be used extensively later for posting galleries in oth... | <p>As per Andreas' comment: it looks like your database does not reflect your Post model; it looks like either you have migrations that have not been applied to the database (run <code>python manage.py migrate --list</code> to see them), or else you have not yet created migrations for your Post model - <a href="https:/... |
Updating postgres column using python dataframe <p>I am generating dataframe (<code>df</code>) for different dates and it will have the following variables</p>
<pre><code>date value rowId
2016-05-14 2.5 1
2016-05-14 3.0 2
2016-05-14 3.4 5
</code></pre>
<p>I have to up... | <p>Well, closing transaction with commit should help. I'm not sure if you are using <code>psycopg2</code>, or any other library which has a <code>commit()</code> function. If not, then a simple <code>cur.execute('COMMIT')</code> should be enough. This should be run right after the <code>for</code> loop.</p>
|
Convert angular2 component name / "this" to String <p>In an Angular2 Component, when doing:</p>
<pre><code>console.log (this);
</code></pre>
<p>you get as expected the whole object with all members, e.g.</p>
<pre><code>"ComponentName {member1, member2, member_n}"
</code></pre>
<p>Now I want to only log the Componen... | <p>Really interesting question, this is what you are looking for:</p>
<pre><code>console.log(this.constructor.name);
</code></pre>
|
How can I hide other actions for some users which are neither recipient nor sender? <p>I am sending embedded request using rest api. I can get recipient view url by setting authentication method as 'email'. In this view there are other actions like void, delete, view history, view certificate. But I want to hide this o... | <p>In the "Other Actions" dropdown:</p>
<ul>
<li>View History: Account wide setting, either enabled or disabled. You will need to reach out to DocuSign support to enable/disable this option. </li>
<li>View Certificate: Account wide setting, either enabled or disabled. You will need to reach out to DocuSign support to ... |
Default value for Mongoid Hash field accessor <p>Given a Mongoid model:</p>
<pre><code>class Counts
include Mongoid::Document
# lists of tag counts
field :tags, type: Hash, default: {}
end
c = Counts.new( tags = {new: 12, old: 7})
</code></pre>
<p>I would like to override <code>c#tags[]</code> so that if a ke... | <p>Try setting default hash values as below:</p>
<pre><code>class Counts
...
field :tags, type: Hash, default: Hash.new{ |h, k| h[k] = 0 }
end
</code></pre>
|
Re-writing an AVERAGEIFS statement into a STDEV statement <p>I am looking to rewrite my averageifs statement into a STDEV statement. I currently have an average if statement which looks for the current name "N" within the type "M", and finds the same type and name within columns "A" and "B", and will average the result... | <p>You would us an array form of STDEV with an IF() inside:</p>
<pre><code>=STDEV(IF(($A$4:$A$19=M4)*($B$4:$B$19=N4),$C$4:$C$19))
</code></pre>
<p>Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of enter when exiting edit mode. If done correctly the Excel will put <code>{}</code> around the... |
Initialize Javascript Select2 controler using HTML5 data-* attributes <p>i'm trying to manage <a href="https://select2.github.io/" rel="nofollow">select2 library</a> in order to augment the capabilties of natives select html controls.</p>
<p>According to the official documentation (very compressed) it says that for u... | <p>You're not initializing Select2 anywhere... <code>data-*</code> attributes let you override default configuration, but you still need to kick off the plugin:</p>
<pre><code><script>$('select').select2();</script>
</code></pre>
<p><a href="https://plnkr.co/edit/RPObSPVl8jlZgtedsK38?p=preview" rel="nofol... |
RecyclerView not clearing (notifyDataSetChanged not working) <p>I've had a look everywhere on here and nothing is related to my problem. Basically I've implemented a feature which changes the reading direction of my app (1 or -1) now I can get it to initially change direction and it works really well but when I get it ... | <p>Implement a public method <strong>in your RecyclerView</strong> code, e.g:</p>
<pre><code>public void clearAll(){
mData.clear();
this.notifyDataSetChanged();
}
</code></pre>
<p>And then call that function from your activity (or Fragment):</p>
<p>private void flip() {</p>
<pre><code>if (!isFlipped) {
... |
list indices must be integers, not str <pre><code>class targil4(object):
def plus():
x=list(raw_input('enter 4 digit Num '))
print x
for i in x:
int(x[i])
x[i]+=1
print x
plus()
</code></pre>
<p>this is my code, I try to get input of 4 digits from user, ... | <p>I believe you may get more out of an answer here by actually looking at each statement and seeing what is going on. </p>
<pre><code># Because the user enters '1234', x is a list ['1', '2', '3', '4'],
# each time the loop runs, i gets '1', '2', etc.
for i in x:
# here, x[i] fails because your i value is a string... |
Matlab trailing singleton dimension <p>I have the following code</p>
<pre><code>o = ones(4,3,2)
c = cellfun(@squeeze,num2cell(o,[2 3]), 'UniformOutput', false)
</code></pre>
<p>which gives as expected the 4 cells, each containing 3x2 matrixes.</p>
<p>But if I reduce the last dimension of o to one, the behavior is to... | <p>When the dimension of <code>o</code> is <code>4 x 3 x 1</code>, <code>num2cell(o, [2 3])</code> gives a <code>1 x 3</code> vector. As stated in the <a href="http://www.mathworks.com/help/matlab/ref/squeeze.html" rel="nofollow">documentation</a>, <code>squeeze</code> has no effect on a 2D array, so it will remain a r... |
How to get a value from this XML? <p>I am working with SharePoint lists and in one case trying to retrieve data from a so called MicroFeed list. This lists item has a property called <code>XML</code> which has the following content</p>
<pre><code><z:row xmlns:z='#RowsetSchema' ows_ID='10' ows_ContentTypeId='0x0100E... | <p>Load your XML with one of these two lines:</p>
<pre><code>XDocument xdoc = XDocument.Load(filePath);
XDocument xdoc = XDocument.Parse(xmlString);
</code></pre>
<p>Get the root element that way:</p>
<pre><code>XElement rootElement = xdoc.Elements().First();
</code></pre>
<p>Or even better, as @KSib pointed out:</... |
Passing information between controllers in a Swifty (/protocol) way? <p>I am trying to pass information from controller <strong>A to controller B</strong>. The thing is, I want:</p>
<ul>
<li><p><strong>Concise</strong>: To minimize the autocomplete from <code>XCode</code> to some key information. I want to know in a e... | <p>I'd approach this from the other side (i.e. the side of the controller you are presenting).</p>
<p>You could do something like creating a <code>Presenter</code> protocol.</p>
<pre><code>protocol Presenter {
func present(inContext context: UIViewController)
// possibly with some data in it too (if it's acro... |
ionic platform add ios failed <p>When I try to run</p>
<pre><code>ionic platform add ios
</code></pre>
<p>it fails with following error:<br/>
<code>Couldn't find ionic.config.json file. Are you in an Ionic project?</code>
Yes, I'm in an ionic project, called <code>todo</code>.<br/>
What do I do to fix this?</p>
<p>F... | <p>Found a solution from <a href="https://forum.ionicframework.com/t/couldnt-find-ionic-config-json-file-are-you-in-an-ionic-project/51214/6" rel="nofollow">this post</a> in ionic forum.<br/>I'm just leaving the summary of the solutions if anyone needs it:<br/></p>
<h3>Solution 1:</h3>
<ul>
<li>Open a text editor.</l... |
Tracking the time on each Cell like Hours App <p>I have a <code>UITableViewCell</code> with some buttons that have time values like the hours app. I would like to track the time on each cell whenever I click on the button related to that cell like the hours app does - as shown in the screen shot below. </p>
<p>I alrea... | <p>From my understanding, your problem is want to track each timer states. Just keep in mind that <code>UITableViewCell</code> is reusable and it will keep change when you scroll or view it. </p>
<p>Normally I will use array to easily keep track all those states or values in cell.</p>
<p>So, in your controller will h... |
Error: SQLSTATE[42S22]: Column not found: 1054 CakePHP <p>I've been searching some answers for that problems that occurs while I'm trying to access a page baked with CakePHP, and I'm still getting this error :</p>
<p>Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Billet. user_id' in 'field list' </p>
... | <p>You're missing ticks on this line, and you have an extra space in the <code>AS</code> name:</p>
<pre><code>`Billet. user_id` AS `Billet__ user_id`,
</code></pre>
<p>It should be</p>
<pre><code>`Billet`.`user_id` AS `Billet__user_id`,
</code></pre>
<p>Same goes for this line:</p>
<pre><code>`Billet` INNER JOIN `... |
Spring batch with column alias as sort key - malformed "where" statement <p>I'm using Spring-batch version 3.0.6.RELEASE to query a MySQL DB for some data and then process it.</p>
<p>Details about usage: </p>
<ul>
<li>query provider is <code>MySqlPagingQueryProvider</code> </li>
<li>when setting up the query provid... | <p>When you specify a column alias of SELECT as sort key, <strong>page - 1</strong> ( i.e. except <strong>page -0</strong> ) onward queries generated by Spring Batch use that alias in WHERE clause as shown in your question and as per <a href="http://stackoverflow.com/questions/8370114/referring-to-a-column-alias-in-a-w... |
Podio Api - Create item error - "Invalid value null (null): must be Range" <p>I am trying to create an item with relationship field with multiple references like this.</p>
<pre><code> $collection = new PodioCollection(array(
new PodioItem(array('item_id' => 425989858)),
new PodioItem(array('item_id' => 4259... | <p>This one should work</p>
<pre><code>$response = PodioItem::create("16748745", array('fields' => array(
"130415123" => "+13334445552",
"130415337" => array(425989858, 425987845)
)));
</code></pre>
<p>I've tested this for Ruby code and that works well :)</p>
<pre><co... |
unresponsive GUI when class instantiated outside main() <p>I am starting learning Java, and I wanted to create a simple camera feed viewer using OpenCV.
MyCV class works just fine when instantiated from its own main() method, or when the call is made from within the main() method of a caller class.
I then built a "MyC... | <pre><code>while(true){
</code></pre>
<p>The above is an infinite loop that runs on the Event Dispatch Thread (aka <code>EDT</code>). <code>Swing</code> is single threaded - all events, painting, etc...occur on a single thread (the EDT) - if that Thread is for any reason tied up doing work none of its other responsibi... |
Search XML files in directory for specific string then do copy action using bat script <p>I'm new to batch scripts so I would appreciate commented solution if possible.
I'm looking for a bat script that would search set directory c:\in containing XML files for files that contain "xyz" string (in them, not in their file... | <p>This code is inspired from <a href="http://pastebin.com/ADdjPEfH" rel="nofollow"><strong>Local_Search_Engine.bat</strong></a></p>
<pre class="lang-dos prettyprint-override"><code>@ECHO OFF
Title Scan a folder and Search a string in XML-files by (c) Hackoo 2016
mode con cols=75 lines=2
Call :init
Call :inputbox "Ple... |
Typeahead/TypeScript - multiple Datasets of different generic type <p>I have two Datasets, each of a different generic type. Everything works well except the for the initialisation where for </p>
<pre><code>var localDataset: Twitter.Typeahead.Dataset<Node>;
var globalDataset: Twitter.Typeahead.Dataset<Budget&... | <blockquote>
<p>As a workaround I cast Datasets as , but what would be the correct solution</p>
</blockquote>
<p>Anything that consolidates the two type e.g. a <code>map</code> or just: </p>
<pre><code>type NodeOrBudget = Node | Budget;
var localDataset: Twitter.Typeahead.Dataset<NodeOrBudget>;
var globalDat... |
How to underline second label in a DIV <p>so I am working on a pretty big site for a customer. And all the information is entered in via labels and follow this format:</p>
<pre><code><div class="col-xs-12 col-md-6" id="permissionsDIV">
<label id="labelName"></label><label id="labelData"><... | <p>2 options:</p>
<ol>
<li><p>You can apply a minimum width using css</p></li>
<li><p>You can apply constant left and right padding to the label which would then have the underline under it</p></li>
</ol>
<p>One such example:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel... |
Translate a string then pass to ng-click <p>I have a jade template which contains a list and it calls a method called <code>change()</code> when an item is clicked. In the example below, I want the <code>change()</code> method to be passed the paramaters "category" and "Jobs" (I'm using <a href="https://angular-transla... | <p>You can use $filter to translate on javascript directly from your translation string ID. Just call the "translate" filter and pass your translation string parameter. For example:</p>
<pre><code>var translate = this.$filter("translate");
var jobsTranslated= translate('jobs');
</code></pre>
|
Lodash + TypeScript _.property iteratee shorthand <p>Is it possible to use _.property iteratee shorthand somehow with TypeScript?</p>
<p>Consider the following example. How can you make it compile?</p>
<pre><code>let someCollection: Type1[] = [obj1, obj2];
let result: Type2[] = _(someCollection).filter('some.nested.p... | <p>This seems to be shortest solution:</p>
<pre><code>let result: Type2[] = _(someCollection).filter('some.nested.property').map <Type2> ('another.nested.property');
</code></pre>
<p>By explicitly giving the Type in <> the compiler is satisfied (<code><Type2></code>). Of course you're only really type ... |
Grails 3 - GORM for MongoDB - nearest read for replica set <p>I'm upgrading my Grails 2.4 web application to Grails 3, and I'm considering switching from my custom DAO to GORM for my Mongo database.</p>
<p>I'm trying to understand how to setup GORM correctly, in particular about connection <code>options</code>, but it... | <p>Yes you can set anything in the <a href="http://api.mongodb.com/java/current/com/mongodb/MongoClientOptions.Builder.html" rel="nofollow">MongoClientOptions.Builder</a> class via configuration. Although you syntax is wrong, it should be:</p>
<pre><code>grails {
mongodb {
options {
readPreference = c... |
Dynamically setting scrapy request call back <p>I'm working with scrapy. I want to rotate proxies on a per request basis and get a proxy from an api I have that returns a single proxy. My plan is to make a request to the api, get a proxy, then use it to set the proxy based on :</p>
<pre><code>http://stackoverflow.co... | <p>The stacktrace info suggests Scrapy has encountered a request object whose <code>url</code> is <code>None</code>, which is expected to be of string type.</p>
<p>These two lines in your code:</p>
<pre><code>newrequest.replace(url = 'http://ipinfo.io/ip') #TESTING
newrequest.replace(callback= self.form_output) #TEST... |
Creating a modal box and getting input from field <p>I have some code that will enable me to publish an article by giving a prompt box the relevant information. The code is to work with MediaWiki, in case people were wondering. </p>
<p>So far, the code takes the information from a prompt box and stores it in a variabl... | <p>If you can use jquery, I'm a fan of the plugin <a href="https://github.com/kylefox/jquery-modal" rel="nofollow">jquery-modal</a>. Here's some code that could work for you.</p>
<pre><code><style>
#mymodal {
display:none;
}
.modal {
width:200px;
position: absolute;
top: 50%;
left: 50%;... |
WxPerl, getting coordinates from wxPoint object <p>I want solve this problem. </p>
<ol>
<li>get position from specific frame (<a href="http://docs.wxwidgets.org/trunk/classwx_frame.html" rel="nofollow">wxFrame</a>) (function GetPosition() return <a href="http://docs.wxwidgets.org/trunk/classwx_point.html" rel="nofollo... | <p>wxPerl and its documentation are a bit of a hackathon. For instance, many packages are defined only in the XS components of the library so it's pretty much impossible to debug. (That's why your <code>Wx::Point</code> object is a scalar reference; the scalar value is just a handle on the object's data.)</p>
<p>I hav... |
What do you call the alternate of a negation statement? <p>Consider the original statement: all politicians lie.</p>
<p>The negation of the statement is: there exist some politicians that don't lie.</p>
<p>But what about the following: all politicians don't lie. Is there a word for it?</p>
| <p>In classical logic, "All politicians lie" is the Universal Affirmative. If P is the set of politicians and L the set of liars, then we can write it as "All P is L".</p>
<p>"All politicians don't lie" is more commonly expressed in this tradition of logic as "No politicians lie". This is the Universal Negative, "No P... |
Angular 2 unit testing components with routerLink <p>I am trying to test my component with angular 2 final, but I get an error because the component uses the <code>routerLink</code> directive. I get the following error:</p>
<blockquote>
<p>Can't bind to 'routerLink' since it isn't a known property of 'a'.</p>
</bloc... | <p>You need to configure all the routing. For testing, rather than using the <code>RouterModule</code>, you can use the <code>RouterTestingModule</code> from <code>@angular/router/testing</code>, where you can set up some mock routes. You will also need to import the <code>CommonModule</code> from <code>@angular/common... |
Drone.io Filter by Tag name <p>So I'm doing a build with drone.io and I'm wondering if with the build/deploy/publish steps it is possible to do:</p>
<p><code>
when:
tag: PRODUCTION
</code></p>
<p>Or something similar in the same way it is possible to do with branches.</p>
<p>If not is there anyway to use the $$DRON... | <p>You can filter steps based on the hook event type:</p>
<pre><code>when:
event: tag
</code></pre>
<p>If you need to filter steps based on the tag name, this may be possible depending on which version control hosting provider you are using. If you are using GitHub, when drone processes a tag hook event, it sets th... |
How to multiply without the * sign using recursion? <p>so as homework for a programming class on python we're supposed to multiply to integers (n,m) with each other WITHOUT using the * sign (or another multiplication form). We're supposed to use recursion to solve this problem, so i tried just adding n with itself, m n... | <p>I don't want to give you the answer to your homework here so instead hopefully I can provide an example of recursion that may help you along :-). </p>
<pre><code># Here we define a normal function in python
def count_down(val):
# Next we do some logic, in this case print the value
print(val)
# Now we c... |
Raspberry LCD IP display format <p>I'm working on a little project with a Raspberry Pi, and I need to display the IP adress of the PI on an LCD screen. </p>
<p>I followed this tutorial :
<a href="https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/python-code" rel="nofollow">https://learn.adafruit... | <p>I found the <code>netifaces</code> package to be useful for obtaining the IP address. The link below explains well about its basic usage</p>
<p><a href="https://pypi.python.org/pypi/netifaces" rel="nofollow">https://pypi.python.org/pypi/netifaces</a></p>
<p>Below is an example to obtain the ip address in the pytho... |
SQL Server Update column comparing cross row's value <p>I have requirement to update column3 of following table by cross checking the value of value2 with next row of value1</p>
<p>If equal then value3 = value1*value2 and if not value3 = value1</p>
<pre><code>CREATE TABLE #tmpValue1(id INT IDENTITY(1,1), value1 FLOAT... | <p>We can simply do it by using LEFT JOIN as below:</p>
<pre><code>UPDATE t1 SET t1.value3 = (ISNULL(t2.value2,1) * t1.value1)
FROM #tmpValue1 t1
LEFT JOIN #tmpValue1 t2 ON t1.id = t2.id+1
AND t1.value1 = t2.value2
</code></pre>
<p>We should use id which is identity column and is beneficial for performing such an... |
How to write to Nashorn error stream? <p>I use Nashorn scripts from a Java application. Java sets the context (including errorWriter) and everything just works fine...
BUT i haven't found the way to write to the error Stream from the nashorn script. Does anyone know ?</p>
<p>I tried to throw an error but it outputs i... | <p><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/shell.html#sthref29" rel="nofollow">It looks like</a> there is no built in function to write to <code>stderr</code>, like there is one to write to <code>stdout</code> (<code>print</code>).</p>
<p>But, you can set an attribute in the Sc... |
Building a class registry: Cannot use 'new' with an expression whose type lacks a call or construct signature <p>I have this setup:</p>
<pre><code>//./things/Base.ts
export default class Base{
constructor(){
console.log("HI I AM A BASE THING");
}
}
//things.ts
import Base = require('./things/Base');
export =... | <p><code>import Base = require(...)</code> does not mix well with <code>export default class Base</code>.</p>
<p>If you add <code>console.dir(Base)</code> to <code>things.ts</code>, you will see that <code>Base</code> is actually a module there, not a class:</p>
<pre><code>{ __esModule: true, default: [Function: Base... |
Setting range for cells <p>How to set range for cells like with formula "102."&H2 and give value 102.1
H2 will give different number after loops </p>
<pre><code>Count = 2
For I = 7 To N
If Range("E" & Count) = Range("E" & I) And Range("A" & I) = "102." & [H2] Then
</code></pre>
<p>Something</p>
<... | <pre><code> If Range("E" & Count) = Range("E" & I) And Range("A" & I) = "102." & [H2] Then
</code></pre>
<p>Something</p>
<p>This is not working with "102." & [H2]</p>
<pre><code> If Range("E" & Count) = Range("E" & I) And Range("A" & I) > 0 Then
</code></pre>
<p>If i switch with ... |
Right to left (RTL) Electronic program guid (EPG) in Android <p>I want to create an <strong>Electronic program guid</strong> or <strong>EPG</strong>, that scrolls both horizontal, vertical and diagonal (Listed on <code>Y-axis</code> are channels and <code>X-axis</code> are programs/events).</p>
<p>I found a <a href="h... | <p>add this to your AndroidManifest.xml:</p>
<pre><code><application
...
android:supportsRtl="true"
>
</code></pre>
<p>As View checks RTL support first, if true, then resolve layout direction.</p>
<p>You can get more details in View.resolveLayoutDirection().</p>
|
Nested For Loop with Unequal Entities <p>I would like to scrape the contents of a website with a similar structure to</p>
<p><a href="https://www.wellstar.org/locations/pages/default.aspx" rel="nofollow">https://www.wellstar.org/locations/pages/default.aspx</a></p>
<p>Using the provided website as a framework, I woul... | <p>You need a way to group the locations by name. For this, we separate each block, get the title and locations collected into a dictionary:</p>
<pre><code>from pprint import pprint
import requests
from bs4 import BeautifulSoup
url = "https://www.wellstar.org/locations/pages/default.aspx"
response = requests.get(url... |
Command produces different results in commandline versus script file <p>I have this line</p>
<pre><code>grep -n -m7 '\$' myfile.asm | tail -n 1 | awk -F':' '{print $1}'
</code></pre>
<p>Which produces this output:</p>
<pre><code>27
</code></pre>
<p>I wanted to use it in a script that is editing a file. So I did th... | <p>I think you're overcomplicating things.</p>
<p>This is a much simpler way to output that section:</p>
<pre><code> sed -n '/SECONCT/,/^\$$/p' myfile.asm
</code></pre>
<p>I don't have ksh installed, but this works under csh.</p>
<p>Explanation:</p>
<ul>
<li>"-n" - sed will only print what you are interested in.</... |
how to stop append same data from ajax call for mysql cause setInterval <p>I made a simple chat application and everything is working fine,
but please let me know how to stop appending same data like,
looping in ajax call from setInterval. This is my code</p>
<pre><code>setInterval(function() {
get_ajax_msg();
},... | <p>Simple approach without altering most of your code logic, store the ids of messages that are appended and then append only those ids that are not in the list. Its not the most not the most efficient way, but its the least change to your original code. (Note, I use underscore for iterating the array, you may use some... |
Inline editable row to update each records in database mysql using ajax php <p>this question is relevant to <a href="http://stackoverflow.com/questions/39565300/error-in-ajax-insert-database/39565683">Error in ajax insert database</a>. Many advices, but none of them helps.
You can see a demo: <a href="http://phppot.com... | <p>There appears to be no reason to load an array and then process the array, when it can all be done in the while loop.</p>
<pre><code><?php
$query = mysqli_query($conn,"SELECT * FROM dsdonhang");
while($row=mysqli_fetch_assoc($query)) {
echo '<tr>';
echo '<td>' . $row['idd'] . '&... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.