input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
NpgSQL resources and references <p>I have connected to my PostgreSQL database using .NET npgsql. I am programming in C#. Where can I find how to manipulate with this database using npgsql? Resources. Please don't send me <a href="http://www.npgsql.org/doc/index.html" rel="nofollow">http://www.npgsql.org/doc/index.html<... | <p>As is clearly stated in the docs, Npgsql is a standard .NET driver (ADO.NET), so any .NET database tutorial out there would do. You may also have missed the link to the MSDN docs: <a href="https://msdn.microsoft.com/en-us/library/h43ks021(v=vs.110).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/h43ks0... |
Visual Studio Web Deploy Error at Start Preview <p>I am working on Visual Studio 2015 Web API project.</p>
<p>I have created Web Empty Project with API Option click. I choose Web Deploy option in process to publish web api app on server. I have created custom profile, provide the require detail and successfully pass t... | <p>Try setting the AuthType to NTLM in your publish profile (.pubxml):</p>
<pre><code><PropertyGroup>
<AuthType>NTLM</AuthType>
</code></pre>
|
How to interpret multiple Accept-* headers <p>My reading of <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="nofollow">RFC 2616</a> hasn't answered my question:</p>
<p>How should a server interpret multiple <em>Accept</em>, <em>Accept-Encoding</em>, <em>Accept-Language</em>, etc, headers?</p>
<p... | <p>1) You are looking at an outdated RFC. RFC 2616 has been obsoleted two years ago.</p>
<p>2) That said, the answer is 1); see <a href="https://greenbytes.de/tech/webdav/rfc7230.html#rfc.section.3.2.2.p.3" rel="nofollow">https://greenbytes.de/tech/webdav/rfc7230.html#rfc.section.3.2.2.p.3</a>: "A recipient MAY combin... |
RESTful service in Karaf without blueprint xml <p>I am new to Karaf, hence was looking for resources to create a project for RESTful web services using felix annotations and without the use of BundleActivator class(i mean by an actual class that needs to be written by me, but its ok if some compiler or maven plugin doe... | <p>If you want to completely avoid blueprint then you should use cxf-dosgi. You simply annotate your rest service using jaxrs and publish it as an OSGi service with some special properties. </p>
<p>See the <a href="https://github.com/apache/cxf-dosgi/tree/master/samples/rest" rel="nofollow">cxf-dosgi rest sample</a>.<... |
call function in 'code behind' with AJAX in ASP.NET WebForms? <p>I want to get access to a method in code behind when I clicked an span in my view aspx:</p>
<p><strong>DEFAULT.ASPX VIEW CODE:</strong> </p>
<pre><code><asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<%-- MY SPA... | <p>Go to "RouteConfig.vb" under "App_Start" folder.</p>
<p>Change following line</p>
<pre><code> settings.AutoRedirectMode = RedirectMode.Permanent
</code></pre>
<p>To</p>
<pre><code>settings.AutoRedirectMode = RedirectMode.Off
</code></pre>
<p>i think your method code returning something like this.</p>
<p>Return... |
Does using two Task.Run without await make them run in parallel? <p>I have just started dipping my toes in asynchronous programming. I tried to read a lot about Task.Run but I'm not clear on one question.</p>
<p>If I have to two continuous statements which use Task.Run, without await, will those two run in parallel?</... | <p>It is possible that they will run in parallel, yes.</p>
<p>Of course, this assumes that there are resources that allow them to run in parallel - for example, that you have enough free threadpool threads, that you have multiple execution units, that they're not blocking on the same I/O...</p>
<p>Note that even thou... |
Has someone already used the XsdTypeImporterTask from XsdBuildTask.dll in MSBuild? <p>I used to convert XSD files to CS files using the XSD.exe program.
I made a custom MSBuild Task to do that and it works quite well.</p>
<p>Now, I try to find an MSBuild Task to do it because I don't want to maintain my custom task an... | <p>Well, after succeeding to use it, I can say that someone used it: me.</p>
<p>This <a href="http://source.roslyn.io/#MSBuildFiles/C/Windows/Microsoft.NET/Framework64/v4.0.30319/Microsoft.ServiceModel.targets" rel="nofollow">page</a> helped me understand how to use it.
It works very well!</p>
|
Get-ADObject for DNS A-Record <p>how do I get the ADObject for a DNS A Record?</p>
<pre><code>Get-DnsServerResourceRecord -Name server1 -ZoneName Zone1.biz | Get-ADObject
</code></pre>
<p>does not work. I am just able to do this with "guessing" the DN. </p>
<pre><code>Get-ADObject -Identity "DC=server1,dc=zone1.biz,... | <p>The object you get from the Get-DnsServerResourceRecord will mostlikely need to be filtered to pipe it.
Also, what kind of details do you need from the ADObject? Can get-adcomputer get the same data?
This one works fine for me :</p>
<pre><code>(Get-DnsServerResourceRecord -Name server1 -ZoneName Zone1.biz).hostname... |
Insert sections in a Moodle course <p>I am trying to create sections within a <strong>Moodle</strong> course using a <strong>script</strong> but I can not. I am using Moodle <code>course_create_sections_if_missing</code> function but can not get sections are displayed on the web but in the database they are created.</p... | <p>You need to update the sections number on the table <strong>mdl_course_format_options</strong></p>
<p>Try this:</p>
<pre><code>$sql = "update mdl_course_format_options set value = ? where courseid = ? and name ='numsections'";
$result = $DB->execute($sql, array($numSections , $course));
</code></pre>
|
Angular.js dependencies order for third party libraries <p>First of all all third-party libraries should be wrapped in angular module so it can be added as a dependency to other angular modules.</p>
<p>for example</p>
<pre><code>angular.module('lodash', [])
.factory('_', function($window) { return $window._;})... | <p>The order doesnt really matter in this case. Angularjs will automatically handle the dependencies between the dependencies. </p>
|
How to open contacts and show the picked contacts in a list? <p>I am trying to make a button to opens up my contacts and let me choose contacts I want to pick. Then, list the names and(maybe) their mobile numbers on a list. So far, I'm stuck on opening the contacts from my phone. Hope you can help me. Thanks! Here's my... | <p>// You need below permission to read contacts</p>
<pre><code><uses-permission android:name="android.permission.READ_CONTACTS"/>
</code></pre>
<p>// Declare this at Global variable</p>
<pre><code> static final int PICK_CONTACT=1;
</code></pre>
<p>// put this code in Click event </p>
<pre><code> Intent int... |
VelocityAutoConfiguration is deprecated in Spring Boot 1.4.* <p>I upgraded Spring Boot dependency in my project and I realized that some classes, such as VelocityAutoConfiguration, are deprecated.</p>
<p>Do you know how can change this in Spring Boot 1.4.1?</p>
<pre><code>@SpringBootApplication
@EnableAsync
@EnableSc... | <p><code>VelocityAutoConfiguration</code> is deprecated but still working. You cannot remove the line because without the line Spring Boot tries to configure Velocity.</p>
<p>You have to wait to version 1.5 if you want remove the line</p>
|
MDX : calculated measure gives different result with "where" and "from select" <p>I have a problem with 2 MDX statements, the first one gives the correct result, but the second one is different as expected.</p>
<p>As the MDX is build dynamically I'd rather prefer to use the second one.</p>
<pre><code>create calculate... | <p>Don'g forget that in icCube you've an MDX debugger that will help you understand how the different parts of MDX statements are solved.</p>
<p>The question is how this expression is solved :</p>
<pre><code>[Ambu].[Ambu].current
</code></pre>
<p>Current is <strong>not</strong> taking the values from the subselect f... |
swift 3 json serialisation <p>I'm trying to serialize a JSON using Swift 3, and coming up short..
This is the JSON (summarised):</p>
<pre><code>{
"values": [
{
"a": {
"b": "1",
"c": {
"d": 0.0
}
},
"wantThisOne": "2016-10-07T08:47:00Z"
},
{
"a": {... | <p>First of all in Swift use generic type <code>Dictionary</code> like <code>[String:Any]</code> instead of <code>NSDictionary</code> and after you get dictionary get the array from the <code>value</code> key and iterate through the Array and get the <code>wantThisOne</code> from every object.</p>
<pre><code>if let js... |
Logging in a console application which hosts a NancyFx web service <p><strong>What I am doing</strong><br>
I am writing a Nancy self hosting application (runs in a console window)</p>
<p><strong>My problem</strong><br>
I cannot get log4net to log anything to my console window. (Specifically - I cannot get this to work... | <p>i use log4net like:</p>
<p>First you must define once the XmlConfigurator:</p>
<pre><code>XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));
</code></pre>
<p>and the you can use it in the Classes:</p>
<pre><code>var log = LogManager.GetLogger("ClassName")... |
Prestashop custom field in groups in admin <p>I have edit AdminGroupsController.php and add one field to renderForm function, like :</p>
<pre><code>array(
'type' => 'text',
'label' => $this->l('Myfield'),
'name' => 'my_field',
</code></pre>
<p>and name is same as database column. But I... | <p>I found out that I had to copy classes/Group.php to override/classes/Group.php and modify it: </p>
<pre><code>class Group extends GroupCore
{
</code></pre>
<p>Seems to be the model for this.</p>
<p>and to add fiel(d) to the model I wanted to update, and it seems it will fetch that also when I try to edit the grou... |
Deploying ASP.Net application to two Windows servers <p>I've got this <em>Asp.Net MVC</em> App I would like to deploy to my two servers running <em>Windows Server 2012</em>. Actually I've got <strong><em>two servers</em></strong> on which I would like the application to run. Only one server is used at some point in tim... | <p>Check this ARR setup configuration in IIS
<a href="https://www.iis.net/downloads/microsoft/application-request-routing" rel="nofollow">https://www.iis.net/downloads/microsoft/application-request-routing</a></p>
|
SQL select and count same table <p>I'm making a newsletter tool with a table that stores e-mail address's user and email id opened, to calculate total and unique opened for every sent e-mail. </p>
<p>I'd like to show a detailed page with a distinct about e-mail address's user and counting times that the user opened th... | <p>Simply do a <code>GROUP BY</code>. Use <code>COUNT(*)</code> to count.</p>
<pre><code>select user, count(*) as counttotal
FROM newsletter_log
where email_id = 1
group by user
</code></pre>
|
How to overcome this item padding in navigation drawer? <p>I check out all the question and also google a lot I just want to remove this padding between each item in navigation view. Help me to sort out this problem thanks in advance.</p>
<p>This is the code of my main_drawer</p>
<pre><code><?xml version="1.0" enc... | <p>According to sourcecode of NaviagtionView found <a href="https://github.com/android/platform_frameworks_support/blob/master/design/src/android/support/design/widget/NavigationView.java" rel="nofollow">here</a>, it led me to NavigationMenuPresenter (found <a href="https://github.com/android/platform_frameworks_suppor... |
How to use a static UITableView inside a UIViewController? <p>I know that it is not possible to add a static <code>UITableView</code> inside an <code>UIViewController</code> (or at least I could not find any way to do it). Trying to do a workaround (as pointed <a href="http://stackoverflow.com/questions/22364230/static... | <p>You are using a <code>UITableView</code> with <strong>Prototype Cells</strong> which is visible because in the grey area it's written "Prototype Content". </p>
<p>Change to <strong>Static Cells</strong> in the Table View inspector (on the right of the window) after selecting the <strong>TableView</strong> in <stron... |
How can i get my program to return the password strength <p>I'm struggling with my password rater program. How can i make sure that when i insert a password, my program returns the password strength. When i run this program it says that password_strength is stored at .....) is the return that i call at the end of my pr... | <p>Well first of all, you tell python to print the function, not the evaluation of the function. This is why you get that message.</p>
<p>Also, you never call any of the functions you wrote. To get a working program
after the declaration of all definitions is the following:</p>
<p>Call the check_len definition:</p>
... |
I want to store excel in database having data in 3 sheets <p>I want to store excel file in SQL Server database having 3 sheets.
So what will be better option form following.</p>
<p>1st Option Creating 3 table for each sheet and saving data.</p>
<p>2nd Appending columns to single table and append sheetnumber as prefix... | <p>To maintain the most flexibility, maintainability and least chance for headaches in the future do yourself a favor and create separate tables for each sheet. </p>
|
I want to stroed data of client side slider in temporary using javascript <ol>
<li><p>I have using one slider from client side that slider containing 4
question n question having 4 option of the answer. </p></li>
<li><p>user have select any one from them n go to next question.</p></li>
<li><p>i want to that user select... | <p>You can use localstorage to store data on client-side</p>
|
touchesMoved seen by all view controllers in Swift? <p>I have a ViewController that defines touchesMoved() to increment a counter as a user drags a finger over the screen:</p>
<pre><code>override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
numMoved += 1
print("Moved: \(numMoved)... | <p>Instead of defining <code>touchesMoved</code> in a view controller, define it in a <em>view</em>. The main view of the view controller will do. (You will need to subclass UIView and make the main view of the view controller an instance of this subclass.)</p>
<p>It will have the same effect, but now you are not in t... |
Bash JQ getting multiple values Issue in JSON file <p>I'm trying to parse a JSON file for getting multiple values. I know how to parse the specific values ( "A"/"B"/"C") in the array <code>(.info.file.hashes[])</code>. </p>
<p>For Example : When issuing the following command over the file <code>b.json</code></p>
<pre... | <p>Literally just downloaded and read the manual </p>
<p>Try </p>
<pre><code>jq '(.info.file.hashes[] |select(.name == ("A","B","C")).value), .Finish, .Start' b.json
"f34d5f2d4577ed6d9ceec516c1f5a744"
"66031dad95dfe6ad10b35f06c4342faa"
"9df25fa4e379837e42aaf6d05d92012018d4b659"
1475668827
1475668826
</code></pre>
<... |
Typescript type assignation <p>I'm curently learning Typescript and I'm having an issue ...</p>
<p><strong>Type assignation for a function</strong></p>
<p>Here are 2 simple sample of code, which are compiling in a different way and I don't get the reason.</p>
<p><strong>1 Sample</strong></p>
<pre><code>testP(): Pro... | <p>The compiler cannot infer the return type of the promise from a call to <code>resolve</code>.</p>
<p>This code:</p>
<pre><code>return new Promise((resolve, reject) => {
</code></pre>
<p>... is a shorthand for:</p>
<pre><code>return new Promise<any>((resolve, reject) => {
</code></pre>
<p>And then th... |
Ruby hashes group by multiple value <p>I have multiple hashes who looks like this: </p>
<pre><code>[{"name" => "name1", "folder" => "folder1", id => 1 },
{"name" => "name1", "folder" => "folder1", id => 2 },
{"name" => "name1", "folder" => "folder2", id => 3},
{"name" => "name2", "fold... | <p>This seems to <a href="http://ideone.com/tUK9Ar" rel="nofollow">do what you want</a>:</p>
<pre><code>transformed_hash = initial_hash
.group_by { |x| x['name'] }
.map { |k, v| [k, v.group_by{ |x| x['folder'] }] }
.to_h
</code></pre>
|
Empty return in non-void function, is undefined behaviour? <p>After reading answers about the topic of <em>control reaches end of non-void functions</em> I didn't see any answer adressing specifically the the case of exiting a non-void function with an empty <code>return</code> statement:</p>
<pre><code>int return_int... | <pre><code>int UB(int x) { if (x) return; }
</code></pre>
<p>This is not even undefined behavior, it is a <em>constraint violation</em>. The cited text </p>
<blockquote>
<p>A return statement without an expression shall only appear in a
function whose return type is void</p>
</blockquote>
<p>from 6.8.6.4 is nor... |
Charts not rendering ASP.NET <p>Please help. I am trying to put charts on a aspx page but they don't show when attempting to view in browser. It just shows blank where the charts should be. Here is the aspx code. Thank you.</p>
<pre><code><h2>Top 5 Most Expensive Products</h2>
<br />
<asp:Chart ID... | <p>You are missing the mapping between the <strong>Data</strong> coming from you <strong>Database</strong> and the <code>Series</code> in the <code>Charts</code>.</p>
<p>For that you need to use <code>XValueMember</code> and <code>YValueMember</code> to complete the mapping.</p>
<p>Try something like this:</p>
<pre>... |
Angular2 : Login Page to restrict access to entire app <p>I'm struggling to find a solution to my problem.
In my Angular2 app I would like to redirect all my "routes" to a login page when no user is authenticated. I'm aware about the routes, guards etc...</p>
<p>But in the <a href="https://angular.io/docs/ts/latest/gu... | <p>Found the solution by myself reading the <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="nofollow">official Angular2 documentation</a> and using <em>Child Routes</em> & <em>CanActivate Guard</em></p>
<p>I pushed on Sample on <a href="https://github.com/An0d/angular-login-sample" rel="nofollow... |
looping over product to compute a serie in python <p>I'm just gonna compute the result of below serie in python:</p>
<p>The formula</p>
<p><a href="http://i.stack.imgur.com/vxNE0.gif" rel="nofollow"><img src="http://i.stack.imgur.com/vxNE0.gif" alt="enter image description here"></a></p>
<p>So, here is my function t... | <p>As others have already mentioned, <code>//</code> is integer division. No matter whether you're dividing floats or integers, the result will always be an integer. Pi is not an integer, so you should use float division: <code>/</code> and tell Python explicitly that you really want a float by converting one of the nu... |
Python: Matplotlib open interactive figures <p>since I like the interactive figures of matlab (*.fig). I wrote a small program for saving interactive figures in Python. I use pickle to dump a matplotlib.pyplot figure in a name.pyfig file:</p>
<pre><code> output = open('name.pyfig', 'wb')
pickle.dump(plt.gcf(),... | <p>You need to give the full absolute path if you want to put the bat file somewhere else.</p>
<pre><code>f = open('C:\full\path\to\folder\name.pyfig','rb')
</code></pre>
|
Custom error pages in IIS <p>I have the following set-up in my web.config</p>
<pre><code><customErrors mode="RemoteOnly" defaultRedirect="/ServerError" redirectMode="ResponseRewrite"/>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="400" subStatusCode="-1" />
... | <p>Yes, this can be easily achieved and you do not really need other pages. You need to have some session variables for custom messages and use them to determine whether you need to display some messages. If so, then display them in your view.</p>
<p>Algorithm:</p>
<ol>
<li>Your custom page detects an error</li>
<li>... |
Double Lost Of Precision <p>I'm a little bit confused because I lose precision all the time.</p>
<p>Maybe I'm operating with the wrong type. I have a String like "100.00". But when I do </p>
<blockquote>
<p>Double.parseDouble("100.00") it is being cut off to 100. Need help. Thanks in advance.</p>
</blockquote>
| <p>You probably printed your number with <code>System.out.println(d)</code>. It will internally call <code>Double.toString(double)</code>, whose specification states</p>
<blockquote>
<p>How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional par... |
Return empty fields in view if relationship not available? <p>I am trying to retrieve a view with a employee and personal detail data that are held on different tables. It works fine when the relationship is set. </p>
<p>However when employee model does not yet have a PersonalDetail row in db i get Trying to get prope... | <p>You have to just check is is <code>null</code> or not:</p>
<pre><code>{{ $employee->personaldetail ? $employee->personaldetail->address : '' }}
</code></pre>
<p><strong>UPDATE</strong></p>
<p>If you want to change it level above the view then you can add a method in the <code>Employee</code> model like t... |
jq select attribute if any array element satisfies a condition <p>With the help of <strong>jq</strong> i would like to select all addresses of nodes that have at least one <strong>required=true</strong> in their attribute list. The result list should have unique items.</p>
<p>Here is my Json:</p>
<pre><code>{
"nodes"... | <p>Using <code>unique</code> is safe but it does require sorting, which may not be necessary. In your particular case, for example, the repetition is an artifact of the jq query. Consider using <code>any</code> instead (or as well), as it more precisely captures the intention ("at least one"), as well as having "shor... |
How to store and retrieve passwords without being seen in the code using spock table <p>I am looking for some good approaches on storing passwords within the framework (groovy+geb+spock+selenium). Currently I am using encrypt and decrypt methods using Crypto.Cipher. However I would like to know if others have any good ... | <p>You can encrypt the password and store in the spock table. Write a separate method in other class for decrypt. Use the encrypted data. Call the decrypt method in password field instead of plain test. </p>
<p>More secure decrypt method should be converted as jar file and use it. So its difficult to find the decrypt ... |
I am trying to run the code inside the onMenuItemClick() without pressing the menu button <p>This is the code for android activity I want to run, if at all possible without creating a new activity. Need to get rid of the Listener function. I tried to make a new java class but it gave me error on putExtra functions. Als... | <p>This is a basic constructor within a listener paradigm. It's a core idea within computer science that code should be reusable, and to facilitate this code needs to generally be self contained. This is often done within Java with a listener. It's usually an abstract class or an interface that has a few set functions.... |
Change global variable to value in entry field <p>How can I change a global variable to a value inputted by a user in an entry field?</p>
<pre><code>card_no = 0
def cardget():
global card_no
card_no = e1.get()
print(card_no)
def menu():
global card_no
root = Tk()
e1 = Entry(root).pack()
... | <p>Don't use global variables. Tkinter apps work much better with OOP.</p>
<pre><code>import tkinter as tk
class App:
def __init__(self, parent):
self.e1 = tk.Entry(parent)
self.e1.pack()
self.l = tk.Label(root, text="Enter card number")
self.l.pack(anchor=tk.NW)
self.b = t... |
SDL_PollEvent causes screen to wake up after xset dpms force off <p>I have a program that turns the screen on and off with <code>xset dpms force on/off</code> and also calls <code>SDL_PollEvent(&e)</code> in a loop. After turning the display off with <code>xset</code>, any call to <code>SDL_PollEvent</code> causes ... | <p>Call <a href="https://wiki.libsdl.org/SDL_EnableScreenSaver" rel="nofollow"><code>SDL_EnableScreenSaver()</code></a>.</p>
<p><a href="https://wiki.libsdl.org/FAQUsingSDL#Why_does_SDL_disable_my_screensaver_by_default.3F" rel="nofollow">More info</a>:</p>
<blockquote>
<p><strong>Why does SDL disable my screensave... |
Spring REST Controller returns JSON with empty data <p>I have a simple Spring Boot web application. I'm trying to receive some data from server. The Controller returns a collection, but the browser receives empty JSON - the number of curly brackets is equals to the number of objects from server, but its content is empt... | <p>I think you should use Lombok as class level instead of field level.</p>
<pre><code>@Entity
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Employee implements Serializable {}
</code></pre>
<p>This may solve your problem.</p>
|
most suited search algorithm? <p>I'm now facing a problem and I'm not sure what the right solution is. I'll try to explain it, and I hope someone has some good solutions for me:</p>
<p>I have two big data arrays. One that I'm browsing, with something between 50^3 and 150^3 data samples (usually between 50 and 100, rar... | <ul>
<li><p>GPGPU is not a suitable choice due to the fact that you are limited by their capacity and since you are not telling us the data size of these samples I am assuming that a titan x tier card will not suffice. If you could go really wild, TESLA or FirePro, then it is actually worth it since you mentioned that ... |
Passport create multi session in my database <p>Iâm confronted to a weird situation using an API made with sailsJS.</p>
<p>So when I use postman to login, passport create one session in DB and everything works fine.</p>
<p>But when I use my app made with Angular2 and do the same request to my API, passport generate... | <p>I finally add the "saveUninitialized" to false in my express-session configuration. </p>
<p>This parameter set to true forces a session that is "uninitialized" to be saved to the store. <a href="https://github.com/expressjs/session" rel="nofollow">Documentation</a></p>
<p>So now, as long as req.session is not upd... |
I'm trying to run an Angular Material example dialog, but seeing a blank page <p>I want to run this demo:</p>
<p><a href="https://material.angularjs.org/latest/demo/dialog" rel="nofollow">https://material.angularjs.org/latest/demo/dialog</a></p>
<p>But there is blank page when I run this in the browser</p>
<pre><cod... | <p>Below is the working code. Two changes I've made are </p>
<blockquote>
<p>Included the <code>ng-app</code> tag on body to bootstrap</p>
<p>Included the angular material cdn</p>
</blockquote>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet... |
Node.js killed due to out of memory <p>I'm running <code>Node.js</code> on a server with only <code>512MB</code> of <code>RAM</code>. The problem is when I run a script, it will be killed due to out of memory. </p>
<p>By default the <code>Node.js</code> memory limit is <code>512MB</code>. So I think using <code>--max-... | <p>If you're giving Node access to every last megabyte of the available 512, and it's still not enough, then there's 2 ways forward:</p>
<ol>
<li><p>Reduce the memory requirements of your program. This may or may not be possible. If you want help with this, you should post another question detailing your functionality... |
Small Javascript Program, Change one image for another bug <p>I am learning Javascript, I am writing this program below, you click the picture of an orange, and then it changes into a picture of an apple, but it's not working yet, can anyone help explain what errors are in my program? </p>
<p>Thanks</p>
<p>Here is th... | <blockquote>
<pre><code>onclick="newFunction"()
</code></pre>
</blockquote>
<p>The attribute value must be entirely inside the <code>"</code> characters. Use <a href="https://validator.w3.org/nu/" rel="nofollow">a validator</a>.</p>
<blockquote>
<pre><code>"document.getElementById('changeimage') .src='apple.jpg'"
</c... |
If number comparison too slow <p>I have a buffer and I need to make sure I don't exceed certain size. If I do, I want to append the buffer to a file and empty it.</p>
<p>My code:</p>
<pre><code>import sys
MAX_BUFFER_SIZE = 4 * (1024 ** 3)
class MyBuffer(object):
b = ""
def append(self, s):
if sys.g... | <p>Undeleting and editing my answer based on edits to the question.</p>
<p>It's incorrect to assume that the comparision is slow. In fact the comparision is fast. Really, really fast. </p>
<p>Why don't you avoid re inventing the wheel by using buffered IO?</p>
<blockquote>
<p>The optional buffering argument specif... |
.htaccess Redirect with Cloudflare location <p>I'm really struggling to place redirects into my .htaccess file based on the cloud flare country code. I'm either getting "too many redirect errors" or 500 internal errors using examples from across this site.</p>
<p>I currently have this:</p>
<pre><code>Options +FollowS... | <p>Try with:</p>
<pre><code>Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP:CF-IPCountry} ^GB$
RewriteCond %{REQUEST_URI} !(?:gif|png|jpg|jpeg|css)$ [NC]
RewriteRule !^gb/ /gb%{REQUEST_URI} [NC,NE,R,L]
</code></pre>
<p>Redirect <code>http://example.com/test</code> to <code>http://example.com/gb/test</cod... |
How to design a auto generated mail in HTML format using javamail <p>i want to try to generate mail in HTML Table format using CSS in java project</p>
<pre><code> email.append("<html><head><style type='text/css'> .out {border-width:1px,border-color: black}</style></head>");
email.append()... | <p>Hey simply use template api for email, i prefered Velocity Template</p>
<p>follow steps,
1 create html file of your mail content
2 use Velocity api methods to retrive & replace dynamic content
3 convert in to string and send mail using javamail</p>
<p>click link to learn more <br>
<a href="http://www.javaworld... |
Elasticsearch 2.4 nodes does not form cluster with ConnectTransportException <p>I am already running ELK stack with Elasticsearch(ES) 1.7 with docker container with 3 nodes, each running one ES container, running behind <code>nginx</code> server. Now I am trying to upgrade ES to 2.4.0. Root user is not allowed in ES 2... | <p>I was able to form cluster with following settings</p>
<p><code>network.publish_host=CONTAINER_HOST_ADDRESS</code> i.e. address of node where the
container is running. </p>
<pre><code>network.bind_host=0.0.0.0
transport.publish_port=9300
transport.publish_host=CONTAINER_HOST_ADDRESS
</code></pre>
<p><code>tranpo... |
Connection to IP is refused when trying to connect from android application <p>I am trying to connect my android app with server which is running in same PC,ip is 192.168.1.129,and tomcat port is 8081,getting below issue,Can any one help me to resolve this?</p>
<pre><code>10-07 15:51:45.672 29710-5937/com.net.app W/Sy... | <p>There can be two problems. First the firewall can prevent access. Switch it off for a test. Second: Maybe Tomcat is bound to localhost/127.0.0.1 only. Have a check in its settings. </p>
|
How to match json response in 2 requests? <p>I have a json response in 1 request like this:</p>
<blockquote>
<p>{"total":1,"page":1,"records":2,"rows":[{"id":1034,"item_type_val":"Business
Requirement","field_name":"Assigned To","invalid_value":"Jmeter
System","dep_value":"","dep_field":""},{"id":1033,"item_type... | <p>Not sure if you can do it with a single regex but other way out is you can create a map of it and then compare everything except 'id' </p>
|
how to listen android serial port data in my BroadcastReceiver <p>I made an application with serial port comminication systems. But i need this. When serial data received, application triggers and opens the screen.</p>
<p>I already use USB_DEVICE_ATTACHED but i need something like that action "USB_DATA_RECEIVED". Is i... | <p>There is no default action for this. </p>
<p>In your custom receiver, get the port and use this.</p>
<ul>
<li>I use <a href="https://github.com/mik3y/usb-serial-for-android" rel="nofollow">mik3y</a> and/ or <a href="https://github.com/felHR85/UsbSerial" rel="nofollow">felHR85</a> solution for serial port</li>
</ul... |
Getting slightly different input in each data fetch operation <p>I am following the <a href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/models/image/cifar10" rel="nofollow">cifar10 tutorial</a> and fetch my data using <a href="https://github.com/tensorflow/tensorflow/blob/r0.11/tensorflow/models/im... | <p>The queue runners you are starting there are multiple threads loading data from disk and adding it to the queue. <a href="https://github.com/tensorflow/tensorflow/blob/r0.11/tensorflow/models/image/cifar10/cifar10_input.py#L117" rel="nofollow">There are 16 of them by default</a>. </p>
<p>The queue itself is thread-... |
Polymer: Passing array to property via markup <p>I have created an element which has an array property 'icon-buttons'. I can pass the array using javascript but when I pass it in the markup itself, it does not work.</p>
<p>Property:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data... | <p>a1626 is right, use <code>\"</code> instead of <code>''</code> in your alerts</p>
<pre><code>... "click": "alert(\"close\");", ...
</code></pre>
|
ASP.NET Dropdownlist into jquery variabel <p>I have 2 code,</p>
<p>This is the First:</p>
<pre><code> $("#Button1")
.click(function () {
var index;
var select = $("#DropDownList1");
var select = document.getElementById("DropDownList1");
var myindex = ["zero", "one", ... | <p><code>appendChild</code> is not a jquery function. </p>
<p>Assuming your first code has a paste-typo with the extra <code>document.getElementById</code>, you can use <code>select.get(0).appendChild()</code> to convert a jquery object to a DOM element.</p>
<pre><code> var index;
var select = $("... |
Targeting placeholder text using sass <p>So I designed a flat signup form for a website to learn front-end developing. I used Mailchimp for the form, and this all seems to work. Now I have styled up everything how it supposed to be, however I cannot get this placeholder text to have a normal opacity. To me, it seems it... | <p>All are correct, except you need to specifically change the color of the input placeholder for different browsers, try:</p>
<p>WebKit, Blink (Safari, Google Chrome, Opera 15+) and Microsoft Edge are using a pseudo-element</p>
<pre><code>::-webkit-input-placeholder {
color: white;
}
</code></pre>
<p>Mozilla Fi... |
How to return to home activity on single backpressed <p>I want to return to home activity on single backpressed and on double backpressed exit from app but it not working properly i had added code below kindly help me.</p>
<pre><code> if (doubleBackToExitPressedOnce)
{
replaceFragment(new HomeActivity());... | <p>just add this in your Handler run method</p>
<pre><code> @Override
public void run() {
replaceFragment(new HomeActivity());
ActivityName.super.onBackPressed();
doubleBackToExitPressedOnce = false;
}
</code></pre>
<p><strong>OR</stro... |
ng-repeat fails due to duplicates <p>I'm trying to <a href="http://stackoverflow.com/questions/16824853/way-to-ng-repeat-defined-number-of-times-instead-of-repeating-over-array#16824944">ng-repeat something a defined number of times</a>:</p>
<p>Here's the (reduced) HTML:</p>
<pre><code><div class="row" ng-repeat="... | <p>try this,change <code>$rowIndex</code> to <code>$index</code></p>
<pre><code><div class="row" ng-repeat="r in getNumber(size) track by $index">
<span class="slot" data-y-coord="{{$index}}"></span>
</div>
</code></pre>
<p>AngularJS does not allow duplicates in a ng-repeat directive. <a h... |
Python function returning string which is function name, need to execute the returned statement <p>1) Function 1 encodes the string</p>
<p>def Encode(String):<br>
..<br>
..code block<br>
..<br>
return String</p>
<p>2) Function 2 return the string, which actually forms function call of Function 1</p>
<p>d... | <p>Consider using the <a href="https://docs.python.org/2.0/ref/exec.html" rel="nofollow">exec statement</a></p>
|
Mindset behind recursive functions <p>I'm trying to learn recursive functions, but I can't seem to wrap my head around the idea of recursion. I've watched videos on recursions and saw tutorials, but I cant think of the recursion needed when I try to solve them myself. However, I can solve those pretty quickly using loo... | <p>Recursion is very useful if the problem at hand is recursive as well. One such problem is traversing a tree-like datastructure. Any computer program that is being compiled results in such a structure called the syntax tree. The compiler goes through the tree and generates code for the branches it finds. I know this ... |
Concatenate/append bitcoin address to image_tag source Rails <p>I have a hash that contains a bitcoin address.
The hash looks like this:</p>
<pre><code>{"status"=>"success", "data"=>{"user_id"=>2, "address"=>"2NE9LK7LGKr9dStvxpF64ucKyoywnfcLd1W", "label"=>"slesle91", "available_balance"=>"0.00000000"... | <p>I managed to resolve this in the following manner:</p>
<pre><code><%= image_tag src="https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=#{@balance["data"]["address"]}" %>
</code></pre>
|
sitecore reporting DB - performance <p>we are on 8.0, Update 4.</p>
<p>Our Azure MS-SQL reporting database is showing massives performance spiking every day between 5am and 8am. We have 2 CD servers, and one CM server, the CM servers' app pool gets recycled daily at 5am, so i guess the spike is related to that. </p>
... | <p>This is a known issue published on the Sitecore KB <a href="https://kb.sitecore.net/articles/028657" rel="nofollow">https://kb.sitecore.net/articles/028657</a>. </p>
<p>Your case is #2. <strong>Disable the periodic index rebuild</strong></p>
<p>Basically, the problem occurs because of the scheduled suggested_tests... |
I want to edit data without editing the email only edit another input field <p>basic email check is clear but if any user wants to update the data with same email Id then that message should not display.... </p>
<pre><code>if(isset($_GET['edited']))
{
$sql="SELECT * FROM user WHERE Id=".$_REQUEST['id']."... | <p>Looking at the code you have provided and not really understanding what you are trying to do, have a look at this and see if it helps.</p>
<pre><code>$query = "SELECT * FROM user WHERE email='$email'";
$result = mysqli_query($connect,$query);
if(mysqli_num_rows($result)>0)
{
echo 'Email is already exists... |
hide and show component with angularjs <p>I am creating a web app in c# but i am using angularjs for fetching data from sql-server and there is one issue for me</p>
<p>as i am using angular for fetching the data I want to use angular for showing and hiding the required component</p>
<p>like there is a dropdownlist</p... | <p>If you are really interested to do it in angular way the set <code>ng-model</code> and <code>ng-show</code> first for all text controls.</p>
<pre><code><select ng-model="ddSelect" ng-change="getOptions()">
<option>Guest</option>
<option>Google</option>
<option>User</option>... |
Window.Activate() not working properly <p>Sometime, <code>Window.Activate()</code> not working in other system.</p>
<pre><code>var window = Application.Current.Windows.OfType<Window>().FirstOrDefault(y => y.IsActive) ?? Application.Current.Windows.OfType<Window>().FirstOrDefault();
if (window != null)
... | <p>It can fail if you call it from non-UI thread. In that case you should to wrap call into dispatcher.</p>
<pre><code>Application.Current.Dispatcher.Invoke(() =>
{
///.... UI stuff
});
</code></pre>
|
R - Time Spent in Interval <p>I have a data frame of start and end dates/times, like so:</p>
<pre><code>start_date <- c("20/09/2016 01:20" , "22/09/2016 01:20", "28/09/2016 22:16", "16/09/2016 21:01")
end_date <- c("20/09/2016 06:20" , "24/09/2016 22:40", "29/09/2016 03:20", "16/09/2016 23:01")
df <- data.fr... | <p>Package <code>lubridate</code> helps doing the job. The main problem to tackle is long time periods, where the interval occurs several times (I solved it with the inner <code>for</code> loop) and the key function is <code>intersect</code>, which gives the simple answer to the problem "Intersection of two intervals".... |
Yii2 admin pretty urls not working in nginx <p>I have deployed yii2 in nginx server and working fine..I can access the admin section by /admin url but no other urls under /admin is not working. I have enabled pretty urls in the application, what could be the nginx config I need to change </p>
| <p>Can you add your nginx conf ? </p>
<p>I also faced same issue, do you use this conf ?</p>
<pre><code>server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name mysite.local;
root /path/to/basic/web;
index ... |
Swift Extension For Generic type compiler error <p>I have created extension of Cache class for NSData generic type (<a href="https://github.com/aschuch/AwesomeCache" rel="nofollow">https://github.com/aschuch/AwesomeCache</a>)</p>
<p>First method works fine, but <em>setIntegerValue</em> show compiler error:
"Cannot inv... | <p>The problem is that <code>data</code> is an NSData, but <code>setObject</code> takes a T as its first parameter. Not an NSData.</p>
<p>It's true that you have defined this extension for <code>T:NSData</code> but that doesn't matter to Swift.</p>
|
Missing artifact error when adding a Maven dependency <p>I am not familiar with maven but I need to add a <a href="https://github.com/kwhat/jnativehook" rel="nofollow">jnativehook</a> dependency in a Java/Jersey project. I tried to add this dependency in my pom.xml </p>
<pre><code><dependency>
<groupId>c... | <p>According <a href="http://mvnrepository.com/artifact/com.1stleg" rel="nofollow">this</a>, it should be:</p>
<pre><code><dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.0.3</version>
</dependency>
</code></pre>
<p>... |
Using Entity Framework to retrieve distinct values from SQL Server in json for angularjs <p>I am having an issue where I'm trying to retrieve distinct values using Entity Framework and returning it in JSON format to use in an angularJS dropdown list. When trying to retrieve distinct values I get the following error: <... | <p>U r specifying in select statement u only need a field data but u r trying to assign it into
List</p>
<pre><code>List<String> objContext = dc.TABLE_NAME.Where(a >= a.COLUMN_NAME != null).Select(m >= m.COLUMN_NAME).Distinct().ToList();
</code></pre>
<p>in this case </p>
<pre><code> objContext = dc.TA... |
How to save JSpinner values in variables as a permanent unchangeable value? <p>I have a JSpinner Number Model as in the following Picture:</p>
<p><a href="http://i.stack.imgur.com/mOutw.png" rel="nofollow"><img src="http://i.stack.imgur.com/mOutw.png" alt="JSpinner"></a></p>
<p>I saved the value shown in the Width fo... | <p>When you initialize doubleWidth set it to</p>
<pre><code>doubleWidth = -1
</code></pre>
<p>then inside your stateChanged method only adjust it if it is still equal to -1.</p>
<pre><code>if (doubleWith == -1){
doublewidth =(Double) spinnerwidthto.getModel().getValue();
}
</code></pre>
|
how to set when downloading from playstore that app should install in sdcard or internal memory in android? <p>Requirement: When I install app from the playstore,after clicking on install button I want to show a dialog whether app should be installed in SD card or internal memory. How can I achieve this. C... | <p>Check <a href="https://developer.android.com/guide/topics/manifest/manifest-element.html" rel="nofollow">manifest</a>'s <code>android:installLocation</code>.</p>
<p>Dynamically changing the <code>android:installLocation</code> is not possible.</p>
|
How to multithread using serial connection vb.net <p>I have a serial connection to a remote machine and i'm developing a windows form using vb.net in order to gather some infos.</p>
<p>So as u can see in the code below i'm waiting until i receive the full string ( length 4, # as separator ) to change some textboxes te... | <p>So you could create a quick sub that invokes your textboxes. You're already doing that in your previous method. This makes it reusable.</p>
<pre><code>Private Sub UpdateTextBox(Text As String, TextBox As TextBox)
If TextBox.InvokeRequired Then
TextBox.Invoke(DirectCast(Sub() UpdateTextBox(Text, TextBox)... |
how to keep the key background color changed...? <p>I have custom keyboard with red buttons when I press on the for example number 1 the color changed to blue when I pull my finger from the screen goes back to be red , I want to stay blue anyone knows how to do it here's my color changing (pressing) xml</p>
<pre><code... | <blockquote>
<pre><code>Add this methods to the `keyboardListner`
</code></pre>
</blockquote>
<pre><code> public class SimpleIME extends InputMethodService
implements OnKeyboardActionListener{
private KeyboardView kv;
private Keyboard keyboard;
private boolean caps = false;
@Override
public ... |
Error when trying to sort dictionaies stored inside array inside NSUserDefaults <p>Im making a game which saves the final score together with an entered name and a date to be then displayed in an UITableView. I need to be able to sort the values so that the values are stored by the highest score to lowest score. Im try... | <p><code>NSUserDefaults</code> does not return mutable objects and a downcast won't change this, hence the exception that results from attempting to mutate an immutable object. </p>
<p>You need to create a mutable copy of the immutable array you get from <code>NSUserDefaults</code></p>
<pre><code>if let defaultsArray... |
MySQL - How to do a self join to return overlapping date ranges? <p>I have a table of historical position tenures held by members within an organisation (tbl_tenue).
Each position may only be held by one person at a time but one person may hold several positions sequentially or concurrently.
I want to check the integri... | <p>After spending the day on it and having a think while running on my treadmill I believe I have the answer. I'm posting it here for the benefit of others. I moved the join with tbl_member into a sub query, and for the sake of completeness include another subquery to get the actual title of the position from a third t... |
Upload files to google drive using Google.Apis.Drive.v3 in asp.net MVC <p>I want to upload files to Google Drive using the Google.Apis.Drive.v3 in asp.net MVC. I want my visitor to upload the files to my google drive, I will set the credentials of my google drive in code. Can anyone help me to get this work?</p>
<p>I ... | <p>According to this <a href="https://developers.google.com/drive/v3/web/quickstart/dotnet" rel="nofollow">documentation</a>, you need to get the access credentials to enable the Google Drive. If you want to programmatically access users data without any manual authorization on their part, then perform <a href="https:/... |
IdentityServer 3 and ASP.NET Identity: how to get user information <p>I'm using IdentityServer 3 with ASP.NET Identity as its user store. I have followed this <a href="https://mindfulsoftware.com.au/guidance/oauth2-walkthrough-using-identity-server-and-aspnet/creating-an-identity-server-using-aspnet-identity-and-entity... | <p>I managed to send claims to my client application this way:</p>
<pre><code>var scopes = new Scope[]
{
StandardScopes.OpenId,
new Scope
{
Name = "roles",
Type = ScopeType.Identity,
Claims = new Lis... |
How to specify folder for build definition in VSTS <p>I have a single repository, hosted in VSTS, that contains two projects - a frontend SPA and a backend API.</p>
<p>I want to create separate build definitions for each. </p>
<p>When I go to "Create new build definition", I have an option to select the Repository so... | <p>Multiple build definitions can have the same repository source. So, In your example, one build definition could build your frontend project and the other build definition can build your backend API project. Inside each build definition, you will create a task where you specify the required project to build. For .N... |
invalid column index error in java while fetching data from oracle 10g database. Cant figure out whats wrong <p>Code snippet:
On a button click, actionevent will be called</p>
<pre><code>public void actionPerformed(ActionEvent e)
{
Function f = new Function();
</code></pre>
<p>Function is a nested class which i have ... | <p>Don't put the parameter placeholder <code>?</code> in single quotes.</p>
<p>This: </p>
<pre><code>ps = con.prepareStatement("Select * from gkkdb where cust_name='?'");
</code></pre>
<p>should be </p>
<pre><code>ps = con.prepareStatement("Select * from gkkdb where cust_name = ?");
</code></pre>
<p>The <code>?</c... |
mootools equivalent of jQuery's .is() <p>Does Mootools have the equivalent of jQuery's .is()? Or if not, what's the best approach for this functionality in Mootools? I've searched for a while and can't seem to find the right solution. </p>
<p>Example of jQuery I'm trying to achieve in Mootools.</p>
<pre><code>if(a.is... | <p>Well I don't know of a Mootools equivalent, but you can probably the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/matches" rel="nofollow">native</a> <code>matches()</code> function. <a href="https://davidwalsh.name/element-matches-selector" rel="nofollow">Other Link</a></p>
<pre><code>var bd = ... |
Remove the sharing app from share intent chooser listing <p>I want to share the content from my application to other applications. I've used the below code for this</p>
<pre><code>Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, title);
intent.putExtra... | <p>Look the below code.. taken from my previous <a href="http://stackoverflow.com/a/39527295/2299040">answer</a></p>
<pre><code> public static void shareExludingApp(Context ctx, String packageNameToExclude, android.net.Uri imagePath, String text) {
List<Intent> targetedShareIntents = new ArrayList&l... |
issue storing data to Sqlite database <p>i need your help..i am getting incoming call mobile no. using broadcastreceiver and and want to save that no into my database..but when i do that it shows :- Attempt to invoke virtual method 'android.content.Context.getResources()' on a null object reference...please guys help... | <p>Obviously, you have got an incorrect implementation of <code>AppCompatActivity</code> class. </p>
<p>this code has an incorrect point:
<code>Toast.makeText(MyReceiver.this, "Data Inserted", Toast.LENGTH_LONG).show();</code></p>
<p>I mean <code>Toast.makeText</code> needs a <code>context</code> variable which is c... |
Django Rest: Correct data isn't sent to serializer with M2M model <p>I have a simple relational structure with projects containing several sequences with an intermediate meta model.</p>
<p>I can perform a GET request easily enough and it formats the data correctly. However, when I want to post the validated_data varia... | <p>As you see in the <code>ProjectMetaSerializer</code>, the fields <code>id</code> and <code>name</code> are ReadOnlyFields. So you can't use them in <code>post</code> request.</p>
<pre><code>class ProjectMetaSerializer(serializers.ModelSerializer):
seqrecords = SeqRecordSerializer(many=True)
class Meta:
... |
how to reconnect after autobahn websocket timeout? <p>I'm using Autobahn to connect to a websocket like this.</p>
<pre><code>class MyComponent(ApplicationSession):
@inlineCallbacks
def onJoin(self, details):
print("session ready")
def oncounter(*args, **args2):
print("event received: args: {} arg... | <p>You can use a <code>ReconnectingClientFactory</code> if you're using Twisted. <a href="https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_variants/client_reconnecting.py" rel="nofollow">There's a simple example by the autobahn developer on github</a>. Unfortunately there doesn'... |
Mapping a dynamic json object field in Jackson? <p>I have json objects in the following schema:</p>
<pre><code>{
name: "foo",
timestamp: 1475840608763,
payload:
{
foo: "bar"
}
}
</code></pre>
<p>Here, the <code>payload</code> field contains an embedded json object, and the schema of this object is dyna... | <h2>Using <code>JsonNode</code></h2>
<p>You could use <a href="https://fasterxml.github.io/jackson-databind/javadoc/2.8/com/fasterxml/jackson/databind/JsonNode.html" rel="nofollow"><code>JsonNode</code></a> from the <a href="https://fasterxml.github.io/jackson-databind/javadoc/2.8/com/fasterxml/jackson/databind/packag... |
MongoDB AggregationOutput longer response time <p>I have a collection named "logTransaction". I want to get the results as you can see in the attached image.</p>
<p><a href="http://i.stack.imgur.com/u60QQ.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/u60QQ.jpg" alt="output"></a></p>
<p>logTransaction has man... | <p>What indexes you currently have?
When i look at your aggregation make sure you have a indexes on the field you are matching on:</p>
<ul>
<li>integrationIds</li>
<li>firstTimestamp</li>
<li>customer</li>
<li>environment</li>
</ul>
<p>After the first (match) stage indexes are no longer relevant.
As asked by elixir, ... |
excel calculate based on field value <p>I would like to calculate average percentage of the applications marked as in use (Yes)</p>
<p>Anyone?</p>
<pre><code> Average Percentage:
A B C
1 Name Percentage In Use
2 Hammer 65% Yes
3 Fork 77% Yes
4 Spoon 65% ... | <p>I would just use the built-in <code>AVERAGEIF()</code>. </p>
<pre><code>=AVERAGEIF($C$2:$C$6,"Yes",$B$2:$B$6)
</code></pre>
|
Jersey ClassNotFoundException when contextInitialized <p>When I connect to the selected servlet, it throw me a ClassNotFoundException. I am using eclipse neon with Tomcat8 and jersey RESTful framework. Its possible that I have the servlet conf in wrong in the web.xml? </p>
<p><strong>Error showed:</strong></p>
<pre><... | <p>Your <code>web.xml</code> content is incorrect, it matches with <code>Jersey 2.x</code> while you obviously use <code>Jersey 1.x</code>, indeed the package names start with <code>com.sun.jersey</code> in <code>Jersey 1.x</code> while in <code>Jersey 2.x</code> they start with <code>org.glassfish.jersey</code>.</p>
... |
Collapsing and displaying of divs is reverted all at once <p>I'm working with HTML, CSS, JavaScript and jQuery on a prototype for a web application which shall be used on iPad.
I have programmed a test page, which have two divs: one for input fields and the other for displaying a help file (in my case a PDF).
After the... | <p>Your problem is that you are "submitting" the form when you click the button, you need to prevent that event like this: </p>
<pre><code>e.preventDefault()
</code></pre>
<p>You can also type your button as a button to prevent submit like this:</p>
<pre><code><button type="button"></button>
</code></pre... |
second iteration of ddply changes result of first iteration <p>I am trying to run <code>ddply</code> to calculate the number of occurrences of each element in column 1 and then column 2. So I use <code>ddply</code> twice:</p>
<p>1) When I run the operation first time it creates the value I would expect</p>
<pre><code... | <ol>
<li>a few, major R IDEs will have issues with long lines like the <code>dput()</code> you did (i.e. format it more appropriately in the future like the way @nrussell did)</li>
<li>are you just looking at the modified columns or the entire row since <code>ddply</code> doesn't guarantee you get things back in the sa... |
PreventDefault on null value <p>i am using this code to select an row(id) from a table then modify it in another page in case no row(id) was selected nothing should happen.</p>
<pre><code>$('#modify').click(function (e) {
var id = $.map(table.rows('.selected').data(), function (item) {
... | <p>Try something like below</p>
<pre><code> $(document).on('click', "#modify", function(e) {
var id = $.map(table.rows('.selected').data(), function (item) {
return item[0];
});
console.log(id);
if (id === null) {
... |
gradle: Exclude all - except one file <p>In a gradle build I would like to exclude all files except one. I tried to do it like this:</p>
<pre><code>processResources {
// exclude everything
exclude '*.*'
// except this file
include 'fileA.xml'
}
</code></pre>
<p>..but it does not seem to work - all f... | <p>Remove the 'exclude' part, because when you use 'include', you don't have to use 'exclude' patterns - gradle automatically excludes all others.</p>
|
Error inflating class android.support.design.widget.FloatingActionButton in Android <p>When I'm trying to build the application it will show the <code>android.view.InflateException</code> in FloatingActionButton? I really don't know what causes the error.</p>
<p><strong>Login.xml</strong></p>
<pre><code><?xml vers... | <p>In your Case, Problem is in your styles.xml, your base theme name is AppBaseTheme. Change it to AppTheme as you can see you have used AppTheme in your Mainfest file.</p>
<p>I have listed all the reasons that may cause class android.support.design.widget.FloatingActionButton. Please read the points carefully.</p>
... |
How to use html webworkers with angularjs? <p>I am handling very hight dataset with type arry. While iterating through this arrays my application gets performance hit. I want to use webworkers which will perform manipulation operations on huge array and it will directly return the processed dataset back to application.... | <p>Take a look at <a href="https://github.com/vkiryukhin/ng-vkthread" rel="nofollow">https://github.com/vkiryukhin/ng-vkthread</a> I develop it exactly for such kind of tasks. It let you easily export function in a thread, execute it and get result in UI. Even more: you can download data directly in a thread rather tha... |
4th column is shown when specifying column-count of 3 <p>I'm trying to leverage the css 'column-count' in combination with CSS padding, and and I'm observing that if I specify a column count of 3, the browser renders part of a fourth column if content doesn't fit. as shown below</p>
<p><a href="http://i.stack.imgur.co... | <p>I think the issue here is that you've set a fixed height on your container. With the fixed height, the columns can't grow, so the rendering engine keeps making more columns to fit your content inside the container.</p>
<p>If you turn off <code>overflow: hidden</code> in your fiddle, you'll see that there actually a... |
More explanation for Java multiTab <p>Is it possible to explain multiTab in Java ?
For this example : </p>
<pre><code>int[][] multiTab = {{1,2,3,4,5,6},
{1,2,3,4},
{1,2,3,4,5,6,7,8,9}};
</code></pre>
<p>What would be the rows and the columns ?</p>
| <pre><code>int[][] multiTab = {{1,2,3,4,5,6},//[0][x]
{1,2,3,4},//[1][x]
{1,2,3,4,5,6,7,8,9}};//[2][x]
</code></pre>
<p>This type of array can also be called a multidimensional array. This is a type of array that is useful if you want to get information that hangs together. Example:</p>
<p>if [0][x] is a country, [1]... |
How to extract all href content from a page using scrapy <p>I am trying to crawl <a href="https://www.goodreads.com/list/show/19793.I_Marked_My_Calendar_For_This_Book_s_Release" rel="nofollow">https://www.goodreads.com/list/show/19793.I_Marked_My_Calendar_For_This_Book_s_Release</a>.</p>
<p>I want to get all links fro... | <p>I think your xpath is worng. Try this-</p>
<pre><code>for href in response.xpath('//div[@id="all_votes"]/table[@class="tableList js-dataTooltip"]/tr/td[2]/div[@class="js-tooltipTrigger tooltipTrigger"]/a/@href'):
full_url = response.urljoin(href.extract())
print full_url
</code></pre>... |
Open different Web page with button on single ViewController <p>I know how to implement webview in my app and now I want to use only one ViewController to open different webpages of my site, like this:</p>
<p>First viewcontroller has buttons: button1, button2 and button3.</p>
<p>Then in second viewcontroller:</p>
<u... | <p><a href="http://i.stack.imgur.com/qkqUm.png" rel="nofollow"><img src="http://i.stack.imgur.com/qkqUm.png" alt="enter image description here"></a>Yes you can open multiple links in same web view by clicking on different buttons like</p>
<pre><code> myWebView = UIWebView(frame: CGRectMake(0,0, self.view.frame.size.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.