input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "limit" column in Hibernate JPA H2 problem<p>I have a small SpringBoot JPA REST service.</p> <p>I'm using H2 for a development environment.</p> <p>I'm usin...
<p>As Alan Hey mentioned, 'limit' is a reserved keyword. So you need to escape it like:</p> <pre><code>@Column(name = "`limit`") </code></pre> <p>There are a few more methods. See <a href="https://vladmihalcea.com/escape-sql-reserved-keywords-jpa-hibernate/" rel="nofollow noreferrer">https://vladmihalcea.com/escape-s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Upload comfortable mexican sofa cms image's to heroku from s3 bucket<p>I had successfully integrated comfortable mexican sofa CMS into an existing rails 4.1....
<pre><code>config.upload_file_options = { :whiny =&gt; false, :storage =&gt; :s3, :s3_credentials =&gt; {"access_key_id" =&gt; ENV["S3_ACCESS_KEY_ID"], "secret_access_key" =&gt; ENV["S3_SECRET_ACCESS_KEY"]}, :bucket =&gt; ENV["S3_BUCKET_NAME"], :s3_host_name =&gt; 's3 HOST NAME', :path =&gt; "uploaded_file...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: webpack: How to inject the JS chunks in the a YAML file<p>I'm using webpack to modernize a legacy MVC application (symfony 1.4)</p> <p>I would like to injec...
<p><code>html-webpack-plugin</code> is the way to go, you can provide your "base" yaml file as a template, and provide a <code>templateContent</code> function that will generate your yaml content.</p> <p>Something like this:</p> <pre><code>new HtmlWebpackPlugin({ templateContent: function(params) { return ` def...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP: Where is this variance in json encoding coming from?<p>I have two arrays, that before I <code>json_encode</code>, look EXACTLY the same to me in terms o...
<p>The first string is the value returned by <code>json_encode(array_values($array))</code>, the second one is returned by <code>json_encode($array)</code>.</p> <p><code>array_values()</code> returns an array that have numeric sequential keys starting with <code>0</code>. <code>json_encode()</code> produces a represen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing C# Inline Variable to Javascript Function in ASP.Net Application<p>I have a very simple button click event in an ASP.Net application that calls a ver...
<blockquote> <p>it is filled with a simple string of text</p> </blockquote> <p>Strings require quotes, whether in C# or in JavaScript. Your hard-coded example has them:</p> <pre><code>&lt;button onclick="download_csv('TEST')"&gt;Download CSV&lt;/button&gt; </code></pre> <p>But your dynamic example doesn't:</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Raspberry + socket.io works on local network but not from outside<p>I have a Raspberry Pi serving an html page through a server.js file. The main lines (not ...
<p><code>192.168.1.6</code> is a local network address. You can't access that address from outside your local network. The mobile network is outside your local network. When you use WiFi from your phone, you are connecting to the access point inside your local network and you can then route to <code>192.168.1.6</cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Component not reload in browser after save the changes in localhost<p>I created a new react project using Create-React-App. In the old projects, Whenev...
<p>I had a similar (or event the same) problem and I changed starting command in the package.json file by adding following flags: --watch --watch-poll to the webpack-dev-server:</p> <pre><code>{ //... "scripts": { "start": "webpack-dev-server --env.ENVIRONMENT=development --content-base src/ --mode development --w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modify .htaccess for Codeigniter | Subdomain | Many sub folders<p>My query is as following:</p> <p>On my server, I have multiple codeigniter apps in one fol...
<p>I also have many app in one folder in my server and for all .htaccess file I use the following code which works fine for me. Try replacing the following code in your .htaccess:</p> <pre><code>RewriteEngine on RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|fevicon.png) RewriteCond %(REQUEST_FILENAME) !-f ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add string + select text to input<p>Scenario:User selects a city from the dropdown. From that selection, the input text input field then populates a string +...
<p>You need to change the jQuery code like this:</p> <pre><code>$(document).ready(function(){ var eventChoice = $('#test'), prodInterest = $('#productInterest'); eventChoice.change(function(){ var str = ""; $('#test option:selected').each(function(){ str += "Channel &amp; TR Event Reg - " + $(thi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to setup a PrologScript<p>I setup the following rules to find if there is a relationship between two elements:</p> <pre><code>directReference(A,B) :- pr...
<p>Here is a very crude example of a PrologScript program that will read its arguments as a single goal (which may be compound), call it, and then terminate. It should work on *nix systems, and has been tested on OS X. It is just a slight variation of the <a href="http://www.swi-prolog.org/pldoc/man?section=plscript" r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I test the amazon api?<p>I have the following code. </p> <p>How can I test the function <code>create_items_by_parent_asin</code>?</p> <pre><code>de...
<p>You don't test the API, you mock the interactions with amazon away with a different implementation of AmazonAPI.</p> <p>In python this can be done using unittest.mock: <a href="https://docs.python.org/3/library/unittest.mock.html" rel="nofollow noreferrer">https://docs.python.org/3/library/unittest.mock.html</a></p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can i replace my table-arranged dummy values with actual data froma database?<p>[So as you can see in the picture, i'm a newbie in android programming and i ...
<p>There are many ways to approach this, depending on the requirements of your program. If you need to share data between multiple people or devices, you probably want a database that lives on a web server, and you would write an API (application programming interface) which you would call from your app, and it would ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query insert fail, codeigniter oracle<p>I have this query, thrown by the debug codeigniter</p> <p><div class="snippet" data-lang="js" data-hide="false"> <di...
<p>Your dates are not formated correctly</p> <p>Convert them in US format :</p> <pre><code>$timestamp = '20/02/2015'; $timestamp = date_create_from_format('d/m/Y', $timestamp); $gooddate = date_format($timestamp, 'Y-m-d'); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PIVOT does not recognise column enclosed in quotes<p>Sample SQL below - basically if we run this query with "category" instead defined as category (no quotes...
<p>You can make your code work if you execute this in your session:</p> <pre><code>alter session set quoted_identifiers_ignore_case = true; </code></pre> <p><a href="https://docs.snowflake.net/manuals/sql-reference/parameters.html#quoted-identifiers-ignore-case" rel="noreferrer">https://docs.snowflake.net/manuals/sql...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert matrix with negative values into a raster<p>I have a matrix '<code>m</code>' containing minimum temperature values. Some of these values are negative...
<p>I think it's because when you are converting <code>m</code> from text to numeric, you are losing its dimensions attribute, so it becomes a vector rather than a matrix. This is simple enough to reverse:</p> <pre><code>dims &lt;- dim(m) m &lt;- as.numeric(gsub(" ", "", m)) dim(m) &lt;- dims raster(m) #&gt; cl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you take values within certain groups and put them each in a new column in R?<p>I would like to create multiple new columns for each value of one column,...
<p>We can use <code>pivot_wider</code> from <code>tidyr</code> to convert from 'long' to 'wide' format</p> <pre><code>library(dplyr) library(tidyr) df1 %&gt;% group_by(session) %&gt;% mutate(rn = str_c('side_effect_', row_number())) %&gt;% pivot_wider(names_from = rn, values_from = side_effect) # A ti...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using an array list of arrays in java<p>I am trying to create a hash table that is an array list (length 100) of ArrayList. Each worker has an ID number, nam...
<h3> The problem </h3> <p>So looking at this section of the code:</p> <pre><code>ArrayList&lt;Worker&gt; sublist = new ArrayList&lt;Worker&gt;(); for (int j=0; j&lt;100; j++) list.add(sublist); </code></pre> <p>If you think about what that is doing, essentially you have created <em><strong>one</strong></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Login: SignIn API Exception 10 only in the Play Store<p>First of all, I already try this solution:<a href="https://stackoverflow.com/a/49450870/684448...
<p>I found the problem, when I generate the signed app, the play store generates a new SHA1 and MD5 key for the app. So the solution to the problem was simply to copy the Play Store key to Firebase.</p> <p>Step-by-step solution:</p> <ol> <li>open the app on the Google Play Console.</li> <li>go to Version Management -...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apache Camel CXF set Transport Properties<p>Im struggling with the Camel SXF Component. I need it to <strong>not</strong> use chunked encoding, but I do not ...
<p>Try using CxfEndpointConfigurer like this:</p> <pre><code> cxfEndpoint.setCxfEndpointConfigurer(new CxfEndpointConfigurer() { @Override public void configure(final AbstractWSDLBasedEndpointFactory abstractWSDLBasedEndpointFactory) { } @Override public void configureClient(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get status code from result in Elixir<p>I'm using elixir and the httpc erlang module to ping a website. I can hit the website just fine but when I try...
<p>:httpc.request returns tuple which contains various information. The status code can be retrieved as follows.</p> <pre><code>:inets.start {:ok, result} = :httpc.request(:get, {'http://www.erlang.org', []}, [], []) {status_line, headers, body} = result {http_version, status_code, reason_phrase} = status_line </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java 9.0.1 OpenJdk crashed the JVM with problem with AdaptiveWeightedAverage<p>My application failed for a customer crashing the JVM</p> <p>I have these det...
<p>The way out of this was to switch to Java 11 build, this no longer crashes with this error.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nested Element binding in Angular<p>I'm running into an issue where I want to display a title label such that there is (i) A primary title which appears as a...
<p>This is because </p> <pre><code>&lt;h1 ng-bind="rootLabel"&gt; &lt;span&gt;&lt;small ng-bind="rootSubLabel"&gt;&lt;/small&gt;&lt;/span&gt; &lt;/h1&gt; </code></pre> <p>will replace everything inside the h1 with {{rootLabel}}</p> <p>The correct way to use ng-bind in this case should be</p> <pre><code>&lt;h1&g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bash script for creating default user in docker MySQL<p>I am developing a "one file script" for run MySQL database inside Docker and many useful thinks. The ...
<p>So, after a few hours of searching, I found a solution. Added <strong><em>bash -c</em></strong> parameter and in <em>quotes</em> connection to MySQL and query.</p> <pre><code>docker exec $mysqlContainerName bash -c "mysql -h172.21.0.1 -P 3306 --protocol=tcp -u$mysqlRootUsername -p$mysqlRootPassword -e \"CREATE USER...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Starting service with Alarm Manager on Android?<p>Hi a read other question retated to this but the responses never resolve my issue.</p> <p>I want to start ...
<p>To start a service with a PendingIntent, you need to use the static method <code>PendingIntent.getService()</code> to retrieve the appropriate PendingIntent.</p> <p>Your code seems to be using <code>PendingIntet.getBroadcast()</code> for whatever reason. If you intend to have the AlarmManager indeed send a broadcas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rabbitmq: channel.start_consuming() wont consume<p>I am working with rabbitmq. Code is stuck at channel.start_consuming(). There are messages in queue.</p> ...
<p>The only issue that I see with your code is the indent on <code>basic_qos</code> and <code>basic_consume</code>. If the code you posted is correct, those two functions would never called.</p> <pre><code>connection = \ pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.chan...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AngularJs Unit Testing isolated scope Directive<p>I want to test the following directive "spinInput" which requires ngModel, but I can't access the directive...
<p>The way you are constructing your test seems to be causing issues.</p> <p>I have been able to successfully test the isolated scope as per below.</p> <p>You can view the test running on this <a href="http://jsfiddle.net/Nicholas_Murray/zjbLsLhy/3/">jsfiddle</a> (with templates code commented out).</p> <pre><code>d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I moved a wordpress website to my server and the home page shows up but why not any other pages?<p>I am re-designing someone's Wordpress website and moslty n...
<p>We dont know about your setup but there are 3 things that can cause this. </p> <ol> <li>Goto settings> permalink and click on "Save Settings"</li> <li><p>If the above doesn't work goto wp-config and add</p> <pre><code>define('WP_HOME', 'http://example.com'); define('WP_SITEURL', 'http://example.com'); </code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I use Oracle Data Access Components 11.2.0 with Visual Studio 2013<p>I am having a problem similar to <a href="https://stackoverflow.com/questions/21...
<p>The solution that I found is to install Oracle Developer Tools for Visual Studio v. 12c.</p> <p>--Jacob</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gradle/Spock/Geb org.openqa.selenium.firefox.NotConnectedException on Linux but works on Windows<p>I have a gradle script which sets the geb.build.baseUrl to...
<blockquote> <p>When run a blank browser window is opened and the URL is not entered</p> </blockquote> <p>From my experience, this is usually a symptom of using a Firefox version that is newer than what the used WebDriver version supports. I would suggest using <a href="http://search.maven.org/#artifactdetails%7Corg...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Factor level/color present in data but missing from plot using scale_color_manual<p>Here is some dummy data:</p> <pre><code>dummy &lt;- c(rep("castor", 20),...
<p>I believe this should provide what you are looking for. It is typically much easier if you just pass the list of colors to <code>ggplot</code>. I took the liberty of showing you a way to index the colors so that the <code>dummy</code> level you choose will be the one that is colored blue.</p> <pre><code>library(g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can several C# Projects use an unmanaged DLL, without tedious manual copying?<p>We wrote an unmanaged DLL with a simple C-style API last month. It works...
<p>For your program to run it needs all its dependencies to be available, so the dll has to be included in the set of files you ship. For managed assemblies the build process copies these files automatically, but for unmanaged dlls you need to tell the build system what to do.</p> <p>The usual way is to either</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disable buttons when clicked in AngularJS app<p>I have several buttons in a page of an AngularJS app. When a button is clicked, an array is populated and I n...
<p>You can write a helper function:</p> <pre><code>$scope.isReserved = function(value) { return $scope.reserved.indexOf(value) &gt; -1; }; </code></pre> <p>and use it like this:</p> <pre><code>&lt;button ng-click="click(1)" ng-disabled="isReserved(1)"&gt;1&lt;/button&gt; &lt;button ng-click="click(2)" ng-disable...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL Query WHERE combination of AND and OR<p>I am trying to get all entries in a table which belong to "parent_id" (7 OR 8 OR 9 OR 10) AND 3 AND 14.</p> <p...
<pre><code>SELECT news_id FROM news_categories GROUP BY news_id HAVING sum(category_id IN (7,8,9,10)) &gt; 0 and sum(category_id = 3) &gt; 0 and sum(category_id = 14) &gt; 0 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I fix issue on overlapping components in Android Studio?<p>On my main xml file, I have these four components arranged this way:</p> <pre><code>&lt;fr...
<p>For clickable content and on top drawer you must move ConstraintLayout into DrawerLayout like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android - Add a custom view to a component in a xml layout<p>I have an abstract class extended from the class View, and 4 subclasses to perform a series of v...
<p>You can't expect to instantiate an abstract class by referencing it in your xml layout. </p> <p>You'll need to specify a concrete implementation in order for it to work properly.</p> <p>So, instead, you might provide a ViewGroup of some sort in your layout to serve as the parent for whatever concrete DrawFiguresW...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring-Kafka Integration 1.0.0.RELEASE Issue with Producer<p>I am not able to publish message using Spring Kafka Integration, though my Kafka Java Client is ...
<p>Actually when we introduced <code>KafkaHeaders</code> we did appropriate documentation changes: <a href="https://github.com/spring-projects/spring-integration-kafka/blob/master/README.md" rel="nofollow">https://github.com/spring-projects/spring-integration-kafka/blob/master/README.md</a>. See Important note:</p> <b...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to group with sequence conditions in MySQL or Google Data Studio?<p>I have an attendance database where Employee records are stored as below</p> <p><a h...
<p>Test also the next variant, it is faster:</p> <pre><code>SELECT EmpID, name, TeamName, startdate, MAX(enddate) enddate FROM ( SELECT name, CASE WHEN EmpId = @id AND TeamName = @team THEN @startdate ELSE @startdate := `Date` END startdate, `Date` enddate, @i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pushing files into private registry in Docker<p>I have setup the private registry using <code>docker run -t -i -p 5000:5000 registry</code> and it is accessi...
<p>To use the <code>--insecure-registry</code> option, add it to the file <code>/var/lib/boot2docker/profile</code> inside the boot2docker VM. You can get into the VM with <code>boot2docker ssh</code>. The file contents should look like:</p> <pre><code>EXTRA_ARGS="--insecure-registry REGISTRY_IP:PORT" </code></pre> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I cause my Ant build to fail if my Groovy task fails?<p>I expected that if the script in the <code>&lt;groovy&gt;</code> tags returned false or non-z...
<p>Throw an exception will cause ANT to fail. A cleaner way to do it would be to set a property within the script as follows:</p> <pre><code> &lt;target name="build"&gt; &lt;taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/&gt; &lt;groovy&gt; properties["groovy.error"] = true &lt;/g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move method code to Neo4j Cypher query<p>I have a Spring Neo4j repository method <code>getAvgVotesWeightForCriterion</code></p> <pre><code>@Query("MATCH (d:...
<p>This should do what you want to do.</p> <p>You group the avg - aggregation per criterion and then just sum the weights.</p> <pre><code>MATCH (d:Decision)&lt;-[:VOTED_FOR]-(v:Vote)-[:VOTED_ON]-&gt;(c:Criterion) WHERE id(d) = {0} AND id(c) IN {1} WITH c, avg(v.weight) as weight RETURN sum(weight) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: changing sprite frame depending on random value<p>I have a list of buttons(currently images) and i want to change the image color depending on the value that...
<p>You're code is treating strings and variable names as if they are interchangeable. The first line:</p> <pre><code>buttons = {"btn1","btn2","btn3","btn4"} </code></pre> <p>creates a table of strings, so the line:</p> <pre><code>x = buttons[math.random(#buttons)] </code></pre> <p>will set <code>x</code> to be a ra...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unspecified error while selecting a date from calendar in UFT<p>I am new to UFT and automating a desktop application, I am facing challenge while setting a d...
<p>Got the solution, actually I was not selecting all required UFT add ins, my application's window type is swfwindow but since I haven't selected add ins, UFT recorded it as window. after selecting add ins my issue is resolved.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to close two windows of the same application using python?<p>I'm working on an automation program in python, I've two windows of cmd open on my screen. I...
<p>If you use Windows OS, you can use the pywin32 and win32gui libraries which contain the modules win32gui and win32con which will help search through windows matching a certain name and getting the window handle number (hwnd). Given a hwnd, you can then close the first window that was opened.</p> <p>You will first n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Import Data from Excel to Mysql Python<p>This code work well for String but the float column is not the same in Database, I don't understand how it is workin...
<p>The issue is occurring while reading data from Excel. If you know its float data then you can clean it before inserting it into MySQL.</p> <pre><code>import re prix=sheet.cell(r,3).value prix = str(prix) prix = re.sub('[^0-9.]+', '', prix ) print float(prix) </code></pre> <p>This way only numbers and . will be kep...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jquery mousemove missed some cells if hovered very fast<p>I am moving my mouse from left to right very quickly and in the event some td miss getting color.</...
<p>If all you want to do is get movements over these elements, I would do the below. If you need to listen for more stuff it could be worked in from there.</p> <pre><code>$(document).on({ mouseenter: function(){ $(this).addClass("highlighted"); }, mouseleave: function(){ // other stuff if you...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get http tag text by id using lua<p>There is a webpage parser, which takes a page contains several tags, in a certain structure, where divs are badly ...
<p>The ease of extraction of data is going to largely depend on the page itself. If the page uses the exact same tag information throughout its entirety, it'll be much more difficult to extract than it would if it has named tags. </p> <p>If you're able to find a version of the page that returns json format, then you'r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse nested JSON with variable length<p>Here is my JSON.Tell me a way to parse this using JSON.org.I'm able to parse till photpath.How to proceed further an...
<p>So the <em>complaints</em> key has an array of objects. Each object has item e.g. <em>complaintID</em>, <em>userName</em>, <em>Title</em>, etc. You can get the value of <em>complaints</em> in a <a href="http://developer.android.com/reference/org/json/JSONArray.html" rel="nofollow">JSONArray</a>. Then loop through th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using a Dependency Property in a Data Trigger<p>I have the following custom control:</p> <pre><code>public class AnimatedButton : Button { publi...
<p>The Bindings in the DataTriggers (correctly) expect the State property to be in the DataContext of the control. But you want to trigger on the value of a property of the control itself.</p> <p>You should therefore use Triggers instead of DataTriggers:</p> <pre><code>&lt;ControlTemplate.Triggers&gt; &lt;Trigger...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error while instantiating an object without inheritance<p>So far I was using classes inheriting from other classes, now I had the need to creating a class in...
<p>Method declarations need to also have the name of the class when you're declaring them outside of the class definition.</p> <pre><code>float MathHelp::addPerc(float whole, float perc) { return 0; } float MathHelp::subPerc(float whole, float perc) { return 0; } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get only a specific button's click<p>I have 2 buttons on the MainActivity. I want the first button to send me to TestPage1.class(Which it already does...
<p>use <code>v.getId()</code> to check which Button in clicked inside onClick method:</p> <pre><code>@Override public void onClick(View v) { if(v.getId()==R.id.button1) startActivity(new Intent(MainActivity.this, TestPage1.class)); } </code></pre> <p>or use <code>switch-case</code> for handing multiple Butto...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Prevent double submission with prevent window event issue<p>I'm using the following function to prevent double submissions:</p> <pre><code>$("#form").submit...
<h3>The button problem</h3> <p>You want to disable and enable the submit button so you know you going to touch the same kind of function and object twice, it is better to make advantage out of this in a function</p> <pre><code>function disableSubmit(form, enabled){ var submit = form.find("input[type=submit]"), ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Eclipse method header error<p>I'm having trouble creating the most simple of methods in eclipse, I keep getting an error on the line that the method header i...
<p>You cannot declare methods within other methods. Just move your method out of the <code>main()</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set Ceph chunk size?<p>I've read in <a href="http://www.networkcomputing.com/storage/gluster-vs-ceph-open-source-storage-goes-head-to-head/a/d-id/1113...
<p>Ceph, at its core, doesn't have a "chunk size" (term used in the article, but not on the docs). The RADOS layer stores objects as a whole, without any splitting or striping.</p> <p>It's the other layers that do striping of their data into several RADOS objects.</p> <p>If you're using RGW (for S3/Swift compatibili...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Pre-populate An Android Database Backed by ContentProvider<p>I am loving the flexibility offered by ContentProvider, obviously ContentProvider is the ...
<blockquote> <p>obviously ContentProvider is the favored route to go for an Android database</p> </blockquote> <p>You are welcome to your opinion.</p> <blockquote> <p>how does one efficiently populate the resulting database?</p> </blockquote> <p>In terms of pre-population, you would do it the same way that you w...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pandas.DataFrame.round() not truncating decimal values after desired number of places<p>pandas.DataFrame.round() gives somewhat unpredictable output on the b...
<p>Floating points are not precise, not every number can be represented exactly. The same way <code>1/3</code> can't be represented precisely with a finite decimal number, there are many numbers which can't represented exactly in an IEEE floating point format (which might be however representable in a decimal system). ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to move columns without compressed text in Bootstrap<p>I'm trying to move the margin of column, but after that my text is compressed.on this paragraph <c...
<p>It looks like what you want to do is shift the entire row the left by <code>5em</code>. That's not precisely what <code>margin-right: 5em;</code> does. Margin-right will reduce the entire size of the <code>.row</code>. The columns will then take up 50% of a smaller available area.</p> <p>To do what you're trying ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How create file input at form, which upload file and write link in database<p>I'm trying to learn Yii2 by writing my own cms. </p> <p>I want realize attachm...
<p>See documentation - <a href="http://www.yiiframework.com/doc-2.0/guide-input-file-upload.html#uploading-multiple-files" rel="nofollow">http://www.yiiframework.com/doc-2.0/guide-input-file-upload.html#uploading-multiple-files</a></p> <p>In <code>controller</code>:</p> <pre><code>if ($model-&gt;file &amp;&amp; $mode...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Modern OpenGL, drawing filled circle with GL_TRIANGLE weird z-axis behaviour<p>I am trying to draw filled circle in modern opengl using GL_TRIANGLE. I am ...
<blockquote> <p>I am using vec4(homogeneous coordinates)</p> </blockquote> <p>You need to properly initialize the <code>w</code> component of your <code>vec4</code> values to <code>1.0</code>.</p> <p>Note that you do not need to store homogenous coordinates in your input vertex arrays in most scenarios. You can kee...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++/ How to instantiate an object based off user input<p>For example if the user inputs a string "modem", is there a way to instantiate an object of class Mo...
<pre><code>std::string strText = "modem"; CBase *pBase = nullptr; if(strText == "modem") pBase = new CDervied1; else pBase = new CDervied2; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What kind of object am I creating here?<p>I see many sites trying to prevent scope pollution by creating and populating a single object. For example:</p> <p...
<p>In JavaScript all values, except primitives, are objects.</p> <p>Ran my own version of your code to help demonstrate:</p> <p><a href="https://i.stack.imgur.com/VaSTk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VaSTk.png" alt="enter image description here"></a></p> <p>Also note the types of ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get icon of a Desktop?<p>I want to get icons from some system directories, like "Desktop". However instead I am getting an icon for "default file".</p...
<p>This attribute needs to be removed:</p> <pre><code>SHGFI_USEFILEATTRIBUTES </code></pre> <p>then it works just fine.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error when using sqlite3 with python<pre><code>import sqlite3 conn = sqlite3.connect('test.db') cur=conn.cursor() cur.execute("DROP TABLE IF EXISTS studen...
<p>It looks like <a href="https://docs.python.org/2/library/sqlite3.html" rel="nofollow">sqlite3</a>'s <code>cursor.execute</code> takes an <code>iterable</code> for its parameters. You need to call it like:</p> <pre><code>cur.execute("SELECT name FROM students WHERE age =?", (ageofstudent,)) </code></pre> <p>Becaus...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL query: multiplication from 2 tables<p>Let's say there are 2 tables in a SQL Server database:</p> <p><code>table1</code>, where prices of products are st...
<p>I assume you want to pick up the most recent price on or before the sale. When designing such data structures, it is usually better to have an effective and end date on each record, rather than just the effective date. Alas, that is not what you have.</p> <p>You can get the price using a correlated subquery or <c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a new table or store in an array<p>I'll try to simplify this as much as possible I'm in the process of developing an application which serves a series...
<p>If you store your resources in a string you'll have trouble querying them afterwards. There's no problem in storing 200 characters long strings, but inserting or deleting resources may be troublesome, as well as querying (how do you count the number of users that chose a particular resource for instance ?).</p> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to load a text file in Matlab when the number of values in every line are different<p>I have a none rectangular text file like A which has 10 values in f...
<p>As @Jens suggested, you should use a cell array. Assuming your file contains only numeric values separated by whitespaces, for instance:</p> <pre><code>1 3 6 7 8 9 12 15 1 2 0 3 7 </code></pre> <p>You can parse it into cell array like this:</p> <pre><code>% Read full file str = fileread('A.txt'); % Convert text...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Static Directed Graph in Julia<p>How can I create a Static Directed Graph from an array of tuples in Julia without having to create a Simple Directed ...
<p>There's a way to do this but it requires you to have the edges <em>and their reverses</em> already sorted into two vectors. Assume you have a directed path graph 1 -> 2 -> 3 -> 4:</p> <pre><code>fwd = [(1, 2), (2, 3), (3, 4)] # these are your forward edges, sorted rev = [(2, 1), (3, 2), (4, 3)] # these are the re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Encoding of umlauts with the android pdf writer lib<p>I'm using the <a href="http://sourceforge.net/projects/apwlibrary/" rel="nofollow">Android PDF Writer</...
<p>You have the answer before your very nose: Your PDF doesn't use UTF-8, so the PDF viewer tries to decode your UTF-8 encoded file as MacRoman.</p> <p>For a quick fix you can use <code>StandardEncodings.WIN_ANSI_ENCODING</code> on one side and <code>"WINDOWS-1252"</code> or <code>"ISO-8859-1"</code> on the other.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ABP Cannot connect redis cache<p>I have problem when switch cache from in memory to redis cache, in CoreModule I write code like this :</p> <p><a href="http...
<p>Can you please check whether your module depends on <code>AbpRedisCacheModule</code>.</p> <pre class="lang-cs prettyprint-override"><code> [DependsOn( //...other module dependencies typeof(AbpRedisCacheModule))] public class MyProjectWebModule : AbpModule </code></pre> <hr> <p>Also you can che...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Paypal IPN sending 'pending' with 'multi-currency' as reason?<p>I am using the Paypal IPN to take payments from my website. The website is only in developmen...
<p>Right I've finally worked out what the issue was and managed to resolve this so thought I would post an answer to my own question in order that it may help people in future.</p> <p>Firstly log in to your Sandbox Developer Site (where you set up all your fake accounts etc). <a href="https://developer.paypal.com/deve...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to verify whether a super class method was called in Spock?<p>Imagine I had the following class structure:</p> <pre class="lang-java prettyprint-overrid...
<p><em>tim_yates</em> commented:</p> <blockquote> <p>Why do you want to test this? Can't you tell as the super class calculations were performed?</p> </blockquote> <p>I completely agree. I would not test this because as <code>@Override</code> implies, the contract is an override, delegation to the super class metho...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cython "Cannot assign default value to fields in cdef classes, structs or unions"<p>I am making my first attempt at porting Python code to Cython. I only hav...
<p>The problem is as stated in the error message: you cannot set a default value for a cdef class's C-level properties. You can get around this by setting the value in the <code>__cinit__</code> constructor as follows:</p> <pre><code>cdef class Data: cdef _Data *thisptr cdef np.ndarray[np.int64_t, ndim=1] time...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling a jar with different ways produce big memory Difference<p><em>I made a java program and packaged it into a Folder(named <strong>Folder</strong>) and ...
<p>The memory difference is entirely because of the difference in JVM, although probably because the 32-bit is the "client" mode. HotSpot always runs 64-bit in "server" mode, which is tuned for long-running and high-GC programs like Web servers. </p> <p>You definitely aren't using the same JVM for both runs; the "x86"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is anyone else integrating Spring Actuator endpoints with New Relic? Or is this redundant?<p>I think New Relic does not have the httptrace/info/metrics that ...
<p>You don't really integrate an actuator with new relic, but rather <strong>micrometer</strong> which is an under-the-hood implementation of the metrics in spring boot 2 applications.</p> <p>Spring boot actuator's <code>metrics</code> endpoint indeed can show the data (that is relevant for the current time snapshot) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why python showing can't assign to literal in dictionary?<p>This was my program:</p> <pre><code>dict1={'R':'Rainy','S':'Summer','W':'Winter','A':'Autumn'} d...
<p>The first <code>=</code> in the second line is wrong. This should work:</p> <pre><code>dict1['W'] = ['Spring'] </code></pre> <p>Note however that this way, you are setting <code>dict1['W']</code> to a list containing <code>'Spring'</code>, not to the string "Spring" itself.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bluetooth: how to send large files<p>I need to make an Android application that sends large files (100-500 KB) over Bluetooth.</p> <p>It is very important t...
<p>This depends on the profiles that are implemented. OPP - Object Push Profile can send files, but this is often limited to V-cards and in some case images. FTP - File Transfer Profile can send larger files.</p> <p>There is no specific application needed, you should be able to do it from native android as long as bot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rotating a captured video<p>My app takes a video capture from the front camera and saves it to SD. Although the preview is just fine (after being rotated 90 ...
<p>What is being user for the recording? In case is it MediaRecorder take a look at the method <a href="http://developer.android.com/reference/android/media/MediaRecorder.html#setOrientationHint%28int%29" rel="nofollow"><code>setOrientationHint()</code></a> and set it accordingly.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rewriting Arbitrary Double in QuickCheck2<p>Sorry for a newbie question, but how can I redefine <code>Arbitrary Double</code> to produce +/- infinity and NaN...
<p>You don't need to make a new <code>Arbitrary</code> instance just to make a custom <code>Gen</code>erator for a type. You can just create it as a free-standing definition:</p> <pre><code>evilDouble :: Gen Double evilDouble = oneOf [ weirdDouble, arbitrary ] where weirdDouble = error "This is where you generat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript addEventListener for checkbox?<p>How can I do a <code>addEventListener</code> to my project for a checkbox? I need to be able to have it update (r...
<p>Assuming your HTML is:</p> <pre><code>&lt;input type="checkbox" id="checkBoxField" name="checkBoxField"/&gt; </code></pre> <p>Add the listener like this:</p> <pre><code>document.addEventListener('DOMContentLoaded', function () { document.querySelector('#checkBoxField').addEventListener('change', changeHandler);...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initialize map without code duplication?<p>I have a struct type named as game as follows:</p> <pre><code>type game struct { commands map[string]*...
<p>If you are worried that repeating <code>map[string]*command</code> two times is duplication, you can define a new type from it.</p> <pre><code>type commandsMap map[string]*command type game struct { commands commandsMap // ... } func (game *game) init() { game.commands = make(commandsMap) // ... ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there an elegant way of determining if two dates are separated by a week of year in Swift?<p>If I have two dates, and I want to know if one of them falls ...
<p>Here's a way I found:</p> <p>You <em>do</em> need to get the year, but <code>Calendar</code> can still do the calculation for you. You just need to call a different overload of the method from the one in Rob Napier's answer. You need the overload that accepts <code>DateComponents</code>:</p> <pre><code>let calenda...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to position infinite loops for tkinter and paho-mqtt-client?<p>This is my code</p> <pre><code>import paho.mqtt.client as mqtt import json from tkinter i...
<p>If an event loop already exists then <code>loop_forever()</code> should not be used but <code>loop_start()</code>:</p> <pre><code># ... root = Tk() client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message client.connect("test.mosquitto.org", 1883, 60) <b>client.loop_start()</b> app =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get Laravel 5 working with xampp for OSX<p>I have installed Laravel 5 following <a href="http://code.tutsplus.com/tutorials/how-to-setup-laravel-4--net-28614...
<p>I found <a href="https://stackoverflow.com/a/26953387/4572608">this answer</a> elsewhere on Stack Overflow that fixed the issue for me. All I had to do was add the <code>unix_socket</code> line to the mysql section of my <code>database.php</code> file....</p> <pre><code>'mysql' =&gt; [ 'driver' =&gt; 'my...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: read OS files into numpy array in the order that is in the computer<p>I have a folder with several files, and I want to upload them to spyder, as a numpy arr...
<p>You may use the glob function:</p> <pre><code>from glob import glob files = glob(folder + '*.txt') files ['10dobs.txt', '11dobs.txt', '12dobs.txt', '13dobs.txt', '1dobs.txt', '2dobs.txt', '3dobs.txt', '4dobs.txt', '5dobs.txt', '6dobs.txt', '7dobs.txt', '8dobs.txt', '9dobs.txt'] </code></pre> <p>The fi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JDK 7: Existing file gets empty on new File("path/to/file.html");<p>I'm using JDK 7. I've got a class with a method that creates a html-file using PrintStrea...
<p>I doubt there's an error in <code>File.createNewFile()</code>. I don't yet fully grasp in which order you run your code, but are you aware that this sets the file size to zero?</p> <pre><code>out = new PrintStream("/mnt/testfs.pdf", "UTF-8"); </code></pre> <p>From the <code>PrintStream(File file)</code> Javadoc:</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: populate a list of list in python<p>I'm trying to create a list of list in python:</p> <pre><code>[[0, 1, 2], [4, 5, 6], [8, 9, 10], [11, 12]] </code></pre>...
<pre><code># You don't need `a` to be a list here, just iterate the `range` object for num in range(13): if len(b) &lt; 3: b.append(num) else: # Add `b` to `final_list` here itself, so that you don't have # to check if `b` has 3 elements in it, later in the loop. final_list.appen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Optimising SQL to concatenate random words<p>I have a table ("j_un2") with 6,318 random words in, the total count there will never change. The IDs in the tab...
<p>An SQL-only solution is found here: <a href="http://mysql.rjweb.org/doc.php/random#case_consecutive_auto_increment" rel="nofollow">http://mysql.rjweb.org/doc.php/random#case_consecutive_auto_increment</a> . In summary it fetches one row at random based, assuming there are no gaps in the id. Do that twice to get t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GIT: change commit date to author date<p>Is it possible to change the commit date from my commit to the author date?</p> <p>I adapted some commits and now t...
<p>Since git 1.6.3 <code>git rebase</code> has <code>--committer-date-is-author-date</code> for this purpose.</p> <pre><code>git rebase --committer-date-is-author-date </code></pre> <p><em>Original answer:</em><br> There's no easy way to set the <em>committer</em> dates (edit: but see "edit 2" below). The <em>author...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Writing multiple values in JSON on the same level through Jackson<p>Right now I'm attempting to write out words and their scores in JSON, however actually wr...
<p>You can keep adding <code>ValuedWord</code> objects to a map with keys as <code>word</code> and after creation of all <code>ValuedWord</code> objects, serialize to JSON.</p> <p>Sample code:</p> <pre class="lang-java prettyprint-override"><code>ValuedWord valuedWord1 = new ValuedWord(0,0,0,0,0,0,0,0); ValuedWord va...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting django localization working with es-xl (Latin America Spanish)<p>iOS 8 has two language choices for Spanish. Español and Español (Mexico).</p> <p>If...
<p>So the issue ended up being that neither django or python supports the language code es-xl. The language code that iOS sends when setting the system language to Español (Mexico). So my solution was to create middleware that when es-xl is present I activate es-mx as the current language. </p> <pre><code>class Langua...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Singleton design pattern and asynchrounous method with EF<p>I have a wpf application, in which I used EF as an ORM.</p> <p>I have many methods which called ...
<p>The Singleton Pattern is used to deny more than one instance to be created. <em>As a tolerated disadvantage</em> of this pattern, it creates a global variable. That's the price you pay for it's use.</p> <p>You seem to be one of those people who want a global variable, have read that global variables are "bad" (tm) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP scandir failing in Laravel<p>So I'm trying to pass a directory to a model function in my Laravel application that uses PHP's <code>scandir</code>, and it...
<p>If I change your code a little, changing <code>public static function directoryToArray</code> to <code>function dirToArray</code>, to match the call to <code>dirToArray</code> seen inside the function, the function works as I would expect.</p> <p>The problem is either that inconsistency or what you are passing to i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring JPA can't pass parameter into quotes<p>I'm trying to do request to PostgreSQL, that looks like this:</p> <pre><code>@Query(value = "SELECT t FROM Tas...
<p>The query is not working without quotes because you're trying to get the data with something like this:</p> <p><em>get tasks</em> <strong>WHERE</strong> <em>date > 2015</em> <strong>AND</strong> <em>date > 2014</em> </p> <p>Basically, if you're trying to get a task from 1st June 2014 it will work fine, but then th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to overload muti-Generic class in C#?<p><a href="https://stackoverflow.com/questions/28513193/how-to-define-generic-class-for-mapping-muti-class">How to ...
<p>Answer to this question is you can't.</p> <p>You need to define n no of classes for that even Microsoft has defined Func delegates 15 or 16 times. You can refer to msdn documentation for confirmation.</p> <p>If you don't want write those classes manually you may opt for t4 templates as code generator.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cloud code returns null value in finding average ratings<p>I'm having a class 'Ratings' in Parse.com for my iOS app. Ratings class has a 'placeName','rating'...
<p>I found the mistake. It was the key with which the cloud function is called.In cloud function it is written as request.params.place and it is called from the program with the key 'placeName'. I'm new to JSON. Thanks to Mr. Dheeraj Singh. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ASP.NET MVC table row including link on text from model<p>I'm trying to display a table from a model. But the problem is that my model class has a string tha...
<p>If you are sure about the sanitation of your output, you can use <code>Html.Raw</code>:</p> <pre><code>@Html.Raw(Html.DisplayFor(modelItem =&gt; item.message)) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP form is sending blank email<p>I looked at other SO answers and I'm not getting an answer. I'm making a simple HTML form with an PHP script that sends an ...
<p>Your problem is you are not sent any data to server via ajax yet.</p> <p>try with this:</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $("#contactform").submit(function(){ jQuery.ajax({ type: "POST", url: "contact...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Database table from model with enum using Umbraco.Core.Persistence<p>Want to create this table on application start if it does not exist.</p> <p>Code...
<p>Working on the answer that @Ryios gave, I think that something like this is good:</p> <pre><code>/// &lt;summary&gt; /// Don't use this to get or set. /// This must however be kept as public or db.CreateTable() /// will not insert this field into the database. /// &lt;/summary&gt; [NullSetting(NullSetting = NullSet...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mongo find where var is found in array field<p>I have mongo data that looks like:</p> <pre><code>{ "name": "test1", "source": ["source1"] }, { ...
<p>Use the below syntax when you want to search for <strong>simple</strong> elements and <strong>not</strong> sub-documents.</p> <pre><code>db.mycollection.find({"source":"source1"}}) </code></pre> <p>This works because the elements in the array are not documents, but literals. The query condition is applied on each ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: why are there 3 different names for an Ember initializer<p>When you generate a service with Ember CLI you get something like this:</p> <pre><code>export fun...
<pre><code>export function initialize(container, application) { /* service:geo is the factory name for a GeoService object the container keeps track of all the factories using this format. */ // inject to every route the GeoService and // make it available through the property geoService application.inj...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing driver settings for printing a PDF<p>How can I change settings in my printer (driver), before printing out a PDF?</p> <p>To be more specific - I wa...
<p>Eventually I used TCP connection to the printer and printed it out this way. Here is a code sample:</p> <pre><code> Dim PrintString As String Dim ipAddress As String Dim port As Integer '123123 is sample integer, "TESTstring" is sample string, Space(2) is sample of adding (two) spaces PrintStrin...