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: Counting the number of letters in a variable using a dictionary in python<p>I want to write code that will take a input of letters and return an output of sa...
<p>Your code currently just returns the associated number (e.g. its position in the alphabet) with each letter in in <code>number_counts</code> rather than actually trying to count anything. </p> <p>Instead, lets create a blank dictionary of letters (e.g. they're all initially zero) and add one to each when we encount...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to store environment variables in a Python Flask app?<p>I have a Python Flask app that accesses the Github API. For this I need to store an access token....
<p>The simpliest way is to place it into configuration module (regular python <code>.py</code> file) and then <code>import</code> and use it in your code as suggested by <a href="http://flask.pocoo.org/snippets/2/" rel="nofollow">this snippet</a> on Flask site.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SAS Calculate percentiles and save to macro variable<p>I have the following code to calculate percentiles. </p> <pre><code>proc univariate data=sashelp.cars...
<p>What does "smart way to do this" mean? What will you do with the macros as you call them?</p> <pre><code>proc univariate data=sashelp.cars noprint; var Horsepower; output pctlpre=P_ pctlpts= 50, 75 to 100 by 5; run; proc print; run; data _null_; set; array P_ P_:; do over p_; call symput...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R: Processing data within a loop<p>Below, I run a loop using the sample data provided, appending necessary items to <code>geneexptest</code>, and processing ...
<p>Your code, as it is, is working fine. You just have unexpected output because of some data management you're doing. I broke your code out a bit to help with readability. I made two new functions, fun1 and fun2 - fun2 is your inner function and fun1 is the outer function. fun2 takes colName as an argument to pass...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: neo4j cypher convert array/list to string<p>One type of edges in my graph has a property called <strong><em>roles</em></strong>. It is an array/list of strin...
<pre><code>WITH REDUCE(mergedString = "",word IN ["Bill Smoke", "Haskell Moore", "Tadeusz Kesselring", "Nurse Noakes", "Boardman Mephi", "Old Georgie"] | mergedString+word+',') as joinedString RETURN LEFT(joinedString,SIZE(joinedString)-1) </code></pre> <p>REDUCE is the function you are basically looking for . <a hre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bigger request to server vs. more javascript on client<p>What is the better solution, when performance/UX is important: Send a bigger (more data) HTTP PUT re...
<p>In most cases the time over the wire is going to be more costly than local processing time, so if you are worried about performance you should probably spend the time locally to delete the extra data and then not have to upload that unnecessary data to the server.</p> <p>I would recommend doing some performance tes...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Windows says 64-bit executable is "Unsupported 16-Bit Application"<p>I have a C++ program that links Google's WebRTC library that compiles and runs successfu...
<p>I moved on and tried to start building my project with clang-cl and lld-link which provided a little more diagnostic output. I started getting warnings about linking different versions of the run time library. MSVC_RUNTIME_LIBRARY was correctly set and I had the /MTd flag in CMAKE_CXX_FLAGS and CMAKE_LINKER_FLAGS ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use AJAX to create/update radio buttons?<p>I currently have a setup where I use a PHP script to create a list of radio buttons by loading the required...
<pre><code>&lt;?php $username = $_GET['username']; include_once('includes/conn.inc.php'); $query = ("SELECT comicID, comicName FROM comic WHERE username = '$username'"); $result = mysqli_query($conn, $query); while ($row = $result-&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to assign color to pixel according to its mean value<p>image_copy is an RGB image.</p> <p>If the average value of the three components, (R, G, B), is le...
<p>IIUC you want to take the mean along the last axis, and rather than using <code>np.where</code> for both cases the following should suffice:</p> <pre><code>(images.mean(-1) &lt;= 58.0) * 255 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get Meteor Method Return Value Inside Helper Function<p>I have the following in <strong>server</strong>/functions.js file:</p> <pre><code>Meteor.methods({ ...
<p>On the client, <code>Meteor.call</code> is asynchronous - it returns <code>undefined</code> and its return value can only be accesses via a callback. Helpers, on the other hand, execute synchronously. See the answers to <a href="https://stackoverflow.com/questions/22147813/how-to-use-meteor-methods-inside-of-a-templ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to get the first non-matching character's position after regexec call<p>In the following oversimplified code sample:</p> <pre><code>reg = "^[...
<p>Looks like it is really not possible.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: UITableViewCell doesn't exist when scrolling?<p>Hi everyone !</p> <p>I'm facing a problem with UITableView... I've got a registration form which doesn't fit...
<p>You shouldn't get the data directly from the cell. Store the values in properties or a model object using UITextfieldDelegate for example so your are not dependant of the cell still existing or not.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to get a numpy array from frequency and indices<p>I have a numpy array like this:</p> <pre><code>nparr = np.asarray([[u'fals', u'nazi', u'increas', u'te...
<p>You need to use <code>return_inverse</code> rather than <code>return_index</code>:</p> <pre><code>_, i, c = np.unique(nparr, return_inverse=True, return_counts=True) </code></pre> <p><code>_</code> is a convention to denote discarded return values. You don't need the unique values to know where the counts go.</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python - why does my short code not work?<p>why does the following code not work? I have a list of words and want to detect these words in an example sentenc...
<p>Your "any" term above looks incorrectly formed. Try this:</p> <pre><code>Sentence = 'This could be a sentence' with open('Badwords_conjunctive.txt') as file: for word in file.readlines(): if word.strip() in Sentence.split(): print('Conjunctive should rather be avoided') </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL query using date with python returns always the same ID<p>I'm trying to query a MySQL DB with a date and return an id. My table is as follows:</p> <pr...
<p>After executing the cursor.execute you have to fetch the records</p> <p>Try adding fetchall() at the end and check</p> <p>For more information check below link</p> <p><a href="https://thepythonguru.com/fetching-records-using-fetchone-and-fetchmany/" rel="nofollow noreferrer">https://thepythonguru.com/fetching-rec...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Meteor upgrade to 1.0.3.1 now I get ReferenceError: moment is not defined<p>After upgrading to Meteor 1.0.3.1 I now get this error</p> <pre><code>ReferenceE...
<p>I think the moment package on Atmosphere is actually up to 2.9.0. Try either running a meteor update, or manually remove the moment package (meteor remove momentjs:moment) and re-adding it. </p> <p>Also, you shouldn't need to use new moment(), just moment(), like this:</p> <pre><code>var today = moment().format('M...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i use annotate to group the child models by the parent models?<p>I have 3 models. PeerReview Answer and Statement. A Peer review has many answers, Eac...
<p>If I understand what you want, you need to use the reverse foreign key relationship.</p> <pre><code>statements = Statement.objects.prefetch_related('answer_set__peer_review') </code></pre> <p>If you need a dictionary, then this would do it:</p> <pre><code>mapping = {s: list(s.answer_set.all()) for s in statements...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Accessing AWS APIs from within a lambda function?<p>I'm writing my first lambda function (in Python), and I'm a little confused about how credentials are sup...
<p>You do not need to give explicit credentials, the lambda will get the credentials from the role you assigned to it. What is the secret you are asking for, because the <code>AmazonRDSDataFullAccess</code> only has access to secrets at <code>rds-db-credentials/*</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: yii2 formwizard checkbox field value set to 1 even if not selected<p>I am using <code>yii2-formwizard</code> and I want to insert a <code>checkbox</code> as ...
<p>Yes, you are correct about it. It incorrectly shows the value even if the check box is not checked i have updated the section and added a <a href="https://github.com/buttflattery/yii2-formwizard/commit/f002666e7cebc2ce348b979fdac80e391dc6922e" rel="nofollow noreferrer">fix</a>. </p> <pre><code>//check if single che...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does System.Security.Cryptography.RandomNumberGenerator use the TPM's RNG?<p>Does System.Security.Cryptography.RandomNumberGenerator use the TPM's RNG if a T...
<p>The <a href="https://msdn.microsoft.com/en-us/library/system.security.cryptography.randomnumbergenerator(v=vs.110).aspx" rel="nofollow">RandomNumberGenerator</a> class is just an abstract class creating a standard way of interacting with (i.e. programming against) a random number generator. If you want to use a part...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why isn't GCC giving me an error<p>GCC isn't giving me an error on an example I've made where I was hoping it would:</p> <pre><code>class CannotBeCopied { p...
<p>It's not just a matter of GCC being lazy; it is affirmatively prohibited from doing what you want it to do by the standard. [temp.inst]/p1, 2, 11:</p> <blockquote> <p>1 Unless a class template specialization has been explicitly instantiated (14.7.2) or explicitly specialized (14.7.3), the class template speci...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change the color of selected menu item using css<p>I want to highlight currently opening page using css styles.here is my html code</p> <pre class="lang-htm...
<p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function(){ $('li a').click(function(){ $('li a').each(function(a){ $( this ).removeClass('selectedclass') }); $( this ).addClass('selectedclass...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure DevOps NuGet feed only caching first version from upstream feed<p>In Azure DevOps, I currently have two NuGet feeds set up: a Primary feed and a Prerel...
<p>With LeoLiu-MSFT's help, the problem seems to be related to having both the upstream source (Prerelease) and main source (Primary) available in Visual Studio. I removed the Prerelease feed from VS and it worked.</p> <p>I had Visual Studio set up this way because of a workaround suggestion found at the end of this S...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Keeping HTML text from changing size upon changing browser width with ONLY HTML?<p>Sorry for the oddly specific never-use-in-real-life question, but I'm stum...
<p>You can use a width attribute, in case you don't care about what version of html you need to use. For example, you can create a container from a table:</p> <pre><code>&lt;table width="1000"&gt; &lt;tr&gt; &lt;td&gt; &lt;!-- this will have a width of 1000 pixels --&gt; &lt;/td&gt; &lt;/tr&gt; &lt;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Slide in and slide out a button on page scroll<pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;meta name="view...
<p>you should add animation for btn</p> <p><strong>css</strong></p> <pre><code>.btn{ position:fixed; top:50%; right:-50%; transition:all 600ms ease-out; animation: 600ms ease-out 0s slideOut; animation-fill-mode: forwards; } </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 create a recursive one-to-many relationship using core data?<p>I have used core data before, but this database I have to construct has a particulari...
<p>First create your entities and attributes. Then create your relationships. The relationships for "animals" and "children" shout be set to "to many". Leave "cage" and "parent" set to "to one" relationship. Finally, set the destination and inverse for each relation.</p> <p>Relations "animals" and "cage" should be inv...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Send mail from localhost<p>I want to know if it is possible to send emails from localhost. If yes, how? I want to send emails from my localhost using my gmai...
<p>You can use PHP mailer and not configure SMTP on your machine or you can follow this instructions to configure sendmail with <strong>GMAIL</strong>. I like option 2 :) (Just for fun). Of course the first option is easier.</p> <ol> <li>First go to the path that you installed Xampp application. By default it is <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to call a directive in Chart.Js?<p>In angular JS and chart.js, its possible to display a tooltip on hover, and even call functions when you cl...
<p>From what I've looked into and made, it seems that this scenario was impossible. There are three type of directives, namely structural, component and property directive.</p> <p>What I wanted was a property directive, but a property directive doesn't really have html code inside and it simply modifies/adds a behavio...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to limit uploaded filesize in tomcat servlet<p>I need to set max filesize for uploaded files in my servlet running on tomcat. I tried multipart config wh...
<p>Set value of max file size, use annotation before servlet class or <code>web.xml</code> config. See <code>maxFileSize</code> in annotation or <code>&lt;max-file-size&gt;&lt;/max-file-size&gt;</code> in xml config.</p> <pre><code>@MultipartConfig( location="/tmp", fileSizeThreshold=1024*1024, // 1 MB ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get looping data from one data<p>I am using codeigniter. </p> <p>I have two function in the model. </p> <p>In the first function, I get all specific rows f...
<p>Since that <code>$row-&gt;id</code> is solely depending on the first fetching method, currently, its out of scope. In order to use that ID from the first method, just add an argument on the second method and use that to the second query. More like this:</p> <pre><code>function getImage($id) </code></pre> <p>Then y...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to assign a class to a variable with JavascriptCore<p>I'm trying to use JavascriptCore framework for iOS but I'm facing a problem.</p> <p>My simple java...
<p>Should you not be assigning the context entry as an instance of your logger? As in:</p> <pre><code>context[@"log"]=[[JsLogFacade alloc] init]; </code></pre> <p>or returning an instance rather than a class in your require code?</p> <p>And should the function test not be an instance method as opposed to a class met...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mousewheel scroll inconsistent with two tablelayoutpanels<p>I have two tablelayoutpanels side by side. The scroll events of both panels are linked so the use...
<p>Found it!</p> <p><a href="https://stackoverflow.com/a/5565804/3953342">https://stackoverflow.com/a/5565804/3953342</a></p> <p>I need to include .PerformLayout</p> <pre><code>Layout_SidePanel.VerticalScroll.Value = Layout_Calendar.VerticalScroll.Value Layout_SidePanel.PerformLayout() </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to read data file in a class in Python?<p>I want to read the data from two different files. In my code I have two polymer objects and I want to read thei...
<p>I dont know the format of the file, but lets say it is comma separated with a 3D coordinate on each line:</p> <pre><code>class monomer: @classmethod def from_file(cls, filename): instances = [] with open(filename, ‘r’) as file: for line in file: pos = list(map(flo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to trim a list of urls to first folder<p>I would like to trim a list of urls to first folder </p> <pre><code>for example: url.com/folder1/xxx/index.html...
<p><strong>Find what:</strong></p> <pre><code>^([^/]*/[^/]*/).* </code></pre> <p><strong>OR</strong></p> <p>Escape the forward slashes if necessary.</p> <pre><code>^([^\/]*\/[^\/]*\/).* </code></pre> <p><strong>Replace with:</strong></p> <pre><code>\1 </code></pre> <p><a href="https://regex101.com/r/aS7zX3/1" re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query PHP variable against multiple MYSQL columns<p>I have a php variable called industry, what i want to do is query that variable against the mysql databas...
<p>I take your line "industry 1 industry 2 industry 3 industry 4 industry 5" means that there are five columns, named "industry1" through "industry5".</p> <p>In this case you can combine the checks with an <code>or</code> operator.</p> <pre><code>SELECT * FROM data where listing = 'rec' and (industry1='$industry' or ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inno Setup: How to automatically run program after /verysilent install?<p>How to automatically run my program after performing a <code>/verysilent</code> ins...
<p>Apparently it's working fine now. I just removed <code>skipifsilent</code> flag from the <code>Run</code> section!</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PDF: How starting Position is Calculated through TM and TD<p>I reading PDF Specification and unable to calculate the starting offset of x axis the visible te...
<p>You are missing that <code>Tm</code> sets a <em>matrix</em>, not just the font size:</p> <pre><code>10 0 0 10 144.857 475.09 Tm &lt;-New settings Fontsize=7.5 and x and Y axis </code></pre> <p>In addition to the font scale, this also sets the origin at <code>137.289 475.09</code>. Next, the instruction</p> <pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reference `AWS::CodeDeploy::DeploymentGroup::LoadBalancerInfo?`<p>I'm trying to link my LoadBalancer and TargetGroup with DeploymentGroup, when I run ...
<p>Unfortunately, at the moment CodeDeploy in CloudFormation only supports Blue/Green deployments on the Lambda platform however the deployment config "CodeDeployDefault.AllAtOnce" in your template is for the EC2 platform.</p> <p>The reason the EC2 platform is not yet supported in CloudFormation is because Blue/Green ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: httpclient Displays a negative answer<p>First , a function that creates the token. Then, calls <strong>GetClient</strong>(real token)</p> <pre><code>public ...
<p>There are two main parts of HTTP request that you have to understand to make this work:</p> <ul> <li>Headers</li> <li>Content</li> </ul> <p>Headers is the first part of HTTP request which contains information about request like authorization, content length, content format, etc.</p> <p>Second part is content. Thi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel models to return null relation?<p>I am writing a website for photo posts and I have these functions relating likes (they determine if the user is lik...
<p>Since you probably always want to fetch the relation (except if there's no user logged in) I suggest you do something like this in your model:<br> (I also renamed the relationship to <code>liked</code>, you'll see later why)</p> <pre><code>public function newQuery(){ $query = parent::newQuery(); if(Auth::ch...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I add an object inside another object (NodeJS, Axion, Cheerio, jQuery, JSON)<p>I'm trying to learn Axion &amp; Cheerio using NodeJS for Web Scraping....
<p>See the example below. Loop through the inner children, and push the found object episodes into to the array index of <code>data.animes.details[i]</code> in the object <code>episodes</code>. I don't think it is the most neat solution. But if the key of the children is correct it should work.</p> <pre class="lang-js...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: array of marker layers is not being deleted from leaflet map<p>I am using the following code to delete circles from the map before adding new circles dependi...
<p>Old markers are getting redrawn because you're not emptying the marker array after you clear the layers on the map. After your first <code>if</code> statement you need to empty markers variable by setting <code>markers = []</code>. This way, when <code>marker.push</code> gets called in your forEach loop, their getti...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I erase a login session in PHP from my website?<p>I'm currently working on a side project website and attempting to create basic login sessions in PHP...
<p><strong>You need to resume the session before unsetting it</strong></p> <p>I've posted a quote below from <a href="https://www.php.net/manual/en/function.session-start.php" rel="nofollow noreferrer">session_start</a> on PHP.Net:</p> <blockquote> <p>session_start() creates a session <strong>or resumes the current...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Kubernetes object from a file located in Github<p>I want to create a deployment with GitHub URL using<br> <code>kubectl create -f github.com/deploymen...
<p>You could simply:</p> <ul> <li><a href="https://gist.github.com/Integralist/9482061" rel="nofollow noreferrer">curl the file from the private repo</a></li> <li><a href="https://unix.stackexchange.com/a/505831/7490">pass its content to kubectl create -f</a></li> </ul> <p>That is, from <a href="https://gist.github.c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to mapping a folder name using PowerShell?<p>I want to mapping an a folder to download and extract the folder. This is the way I need to download the fol...
<p>This is what I tested with what I gather you are looking for,</p> <p><strong>Sample result.txt</strong></p> <pre><code>A00X-F1Z A00X-F1Y A00X-F1X A00X-F1W A00X-F1V A00X-F1U A00X-F1T A00X-F1S A00X-F1R A00X-F1Q </code></pre> <p><strong>Code to work with</strong></p> <pre><code>$Version = "A00X-F1" $List_Ver = 90.....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to setText() crashes Android app<p>When I try to populate the 'lightName' TextView in the code below this works fine, but when I try to do the same wi...
<p>Hanging my head in shame here. I had changed the minimum SDK to 14, which in turn had generated an additional <code>activity_sensor_data.xml(v14)</code> file. As soon as I edited this file, the <code>pressureName</code> TextView populates as expected.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: unable to parse jsonarray of jsonarray inside object using retrofit?<p>I am trying to parse the <code>JSON array</code> <code>payment_details</code> inside t...
<p>you can Access the values like </p> <pre><code> @Override public void onBindViewHolder(@NonNull InProgressViewHolder holder, int i) { holder.location1.setText(modelRecyclerArrayList.get(i).getLocaion()); holder.date1.setText(modelRecyclerArrayList.get(i).getDate()); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to abstract the execution of a function before and after another<p>Basically I have the following design:</p> <pre class="lang-cs prettyprint-override">...
<p>Like most people suggested, I did it with a helper function:</p> <pre class="lang-cs prettyprint-override"><code>private T RunWithinSession&lt;T&gt;(Func&lt;T&gt; func) { BeginSession(); var result = func(); CloseSession(); return result; } public Invoice CreateInvoices(Order order) { return R...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to include authorization header in GET request to secured endpoint in Spring with JWT token<p>Im using Spring-Security and JWT library to generate token....
<p>Once the user is authenticated, you want to store the returned token on the client side using either local storage or session storage. Next, you will protect any route/endpoint which requires said token (protected route) . There should be an authorization guard in place which checks to see if token is present in the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate Random Data for Cassandra DB<p>I have a big data project for school that requires us to build and query a 8 node Cassandra system. The system must c...
<p>As you are performing a lot of concatenation in loops, I highly recommend you check out <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html" rel="nofollow">StringBuilder</a>. It will dramatically increase the speed of your loops. For example,</p> <pre><code>public String gen(){ String...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change font size of drl (drool) file in Eclipse?<p>How to change font size of drl (drool) file in Eclipse?</p> <p><img src="https://i.stack.imgur.com...
<p>Unfortunately there doesn't seem to be a direct way to do this just for .drl files (even with the drools plugin installed).</p> <p>By default eclipse will use the general text editor for drools files. You can change the font size for this in <code>Preferences/General/Appearance/colors and Fonts... Basic/Text Font<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parsing JSON in Oracle APEX 19.2<p>I'm trying to parse a json, and get data from it and put it in apex collection.</p> <pre><code>DECLARE s ...
<p>I solved that problem with apex_json.does_exist function with parameter p_values, p_path, p0. First we must check if there is a array with name 'TEST' with 1 attribute. Then just make a if-then-else statement. Solution below</p> <pre><code>DECLARE s varchar2(32767) := APEX_APPLICATION.g_x01; j...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Delphi. filewrite, error - E2036 Variable required<p>I didn't use filewrite a lot of time.</p> <p>I made this procedure and received the next error: <strong...
<p>The second parameter of <code>FileWrite()</code> is an untyped <code>const</code>. Whatever you pass to it gets passed by reference, and as such you have to give it a real variable to refer to. In this case, you can simply dereference the <code>PChar</code> pointer, that will let the parameter reference the 1st <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to insert string into Oracle DB if it has carriage return/new line characters<p>I have a Java program which reads from the body of an email and insert...
<p>It turns out the INSERT statement was also inserting the entire body of the email into another column (also VARCHAR2(4000)) of the database, without cutting down its size. So the error I was getting was nothing to do with parameter 10 in the SQL statement. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error importing Crypto - Tried to update a few modules in React Native and now getting error of crypto<p>I was trying to update <code>react-navigation</code>...
<blockquote> <p><strong>DO NOT USE THIS VERSION! Please, go for a newer version!</strong> It says in the official document.</p> </blockquote> <p>Please go with the newer version <code>4.0.0</code></p> <p><code>crypto-js</code> (<a href="https://github.com/brix/crypto-js" rel="nofollow noreferrer">npm package</a>)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to save and reuse semantic segmentation results?<p>I use <strong>detectron2</strong> to run semantic segmentation on images. Detectron2 has a prebuilt fu...
<p>To understand the problem, you will need to know that there are two different formats of storing masks in the COCO protocol. One is using polygons, such as your second example, another is to use a binary data compression format called <a href="https://en.wikipedia.org/wiki/Run-length_encoding" rel="nofollow noreferr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Implementing FileTable<p>I've got a quick question which I hope I can get some help with. I need to create a database and then implement <code>File Tables</c...
<p>Generally, you can choose one of the following techniques:</p> <ul> <li>Upload the file in specific folder in your server and store in your database only the <code>URL</code> to the file. Latter, use the <code>URL</code> for displaying the content or downloading the file</li> <li>Upload the file and store in the da...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Function for changing size of points in geom_point based on sum of presence absence data<p>I'm working with a species data in presence/absence format set whe...
<p>Make an additional count by group. Then plot this data frame as an extra layer using <code>geom_point</code></p> <p>I am adding breaks to <code>scale_size</code> in order to show only the exiting sizes</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) count_dum &lt;- dummy %&gt;% group_by(Day,...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java Concert Hall OOP design<p>I want to make a <code>Booking</code> class to book concert tickets. A <code>ConcertHall</code> class has 2 different seats, n...
<p>Factor out the identical array checking code into a method of its own and then pass it the correct lookup array. Something like</p> <pre><code>public Seat findSeat(String serviceClass, String preference) { if(serviceClass.equals("VIP")) { return findSeatIn(VIP, preference); } else if(service...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to write a generic non-member wrapper around arbitrary member functions?<h1>Problem</h1> <p>Have a template that generates a wrapper for an arbitrary me...
<p>I found a solution I can accept by passing the member function pointer as template argument, which -- unfortunately -- requires the type to be explicitly mentioned in C++14 (a helper macro can help here). The signature of the function pointer is then broken down by a helper function in order to create the wrapper.</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Automatically check child categories/terms when parent category is checked<p>I have this Continent -> Country category setup for a custom post type.</p> <pr...
<h1>EDIT:</h1> <p>I had a relatively lengthy answer that works well for checking child terms, but not so well for unchecking them when a parent was unchecked. I've backed up that answer here: <a href="https://xhynk.com/content-mask/wpse-answer/stack-overflow-answer-60079535/" rel="nofollow noreferrer">Original Answer: ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Performing recursive function on input javascript<p>I'm trying to run a recursive function that calculates the factorial of a number on an HTML input. I alre...
<p>You are having endless recursion issues because you are retrieving the value from input in recursive function and that's why the <code>getInputValue</code> variable gets fresh value every time. It's the wrong implementation you did. Try the example given below.</p> <h3>The HTML</h3> <pre class="lang-html prettypri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VHDL: Trouble combining entities (components)<p>Me again!</p> <p>I wrote something SUPER simple in order to demonstrate how entities come together. However,...
<p>First, you have assigned the output of your AND gate to wire2, but wire2 is floating. You should either assign it to your ouput like this</p> <pre><code>out_d &lt;= wire2; </code></pre> <p>OR remove wire2 from your internal signals and assign your output directly.</p> <pre><code>and1 : AND_LOGIC port map(in_c, wi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting the CPU load in a scale from 0 to 100%<p>I am trying to obtain the CPU load at run time. I am trying <a href="https://stackoverflow.com/a/6795612/316...
<p>If you read the code you provided, you can see <code>(@"Core: %u Usage: %f",i,inUse / total)</code> which can be converted to percent easily with a simple <code>inUse / total*100</code>.</p> <p>And by the way: <img src="https://i.stack.imgur.com/GkPQ9.png" alt="enter image description here"></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: S3 download not working from crontab script<p>I've posted about this question before, and I thought I had it solved, but unfortunately I still can't figure o...
<p>There are many reasons why an AWS CLI command may fail (in this case, aws s3 cp)... you (or the script that is running that command, e.g. crontab ) need to have appropriate credentials to interact with your aws resources (see: <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html" rel="n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cross Field Validation in MVC with Entity Framework<p>I'm trying to accomplish some cross field validation in MVC 5. Specifically, if a check box is checked ...
<p>I used RequiredIf attribute from <a href="http://forums.asp.net/t/1924941.aspx?Conditional%20Validation%20using%20DataAnnotation" rel="nofollow">here</a> before. Works pretty well. It has server-side and client code, and the usage is exactly the same as yours:</p> <pre><code>public class Category { [Requi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How would I display the maximum value of a variable that has been given multiple values? (C programming)<p>I'm working on a homework assignment for my C prog...
<p>You can just make a temporary variable, in the first iteration you save there the value of <code>taxamount</code> and in successive iterations you check if the new value is greater and update it accordingly.</p> <p>From there I think you can guess how to do the rest of the calculations.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Symfony YAML include file<p>How can I split my security.yml into multiple files?</p> <p>I know about the imports statement, but I need to import the role_hi...
<p>You could create the roles as config parameters:</p> <pre><code>// user_roles.yml parameters: seller_roles: [ROLE_A, ROLE_B, ROLE_C] </code></pre> <p>And use them in the security config:</p> <pre><code>// security.yml imports: - { resource: user_roles.yml } security: role_hierarchy: ROLE_SELL...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OpenSSL: Specify packet size of application data<p>When I do something like this, <code>apps/openssl s_client -connect 10.102.113.3:443 -ssl3</code>, client-...
<p>Okay, I figured out that I needed to change the number of bytes I'm writing using the <code>SSL_write</code>.</p> <p>This is a code snippet, starting at line <code>1662</code> of <code>s_client.c</code>:</p> <pre><code>if (!ssl_pending &amp;&amp; FD_ISSET(SSL_get_fd(con),&amp;writefds)) { k=SSL_write(con,&am...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to pass parameters to layout in thymeleaf layout-dialect?<p>I have a common layout which, by default, should display a (basic) search form on ...
<p>Yes, it's entirely possible, even though Thymeleaf's documentation doesn't clearly state it. </p> <p>All you have to do is pass your param using the <strong>th:with</strong> attribute. There may be other methods, but this seems to be the most straight-forward.</p> <p>Here's a stripped down version of my implementa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap Styling Cart within Navbar<p>I'm trying to style my Cart within the Navbar like below.</p> <p><a href="https://i.stack.imgur.com/KirVM.jpg" rel="n...
<p>I just had to implement the same thing on a website and I kind of like it, need a little bit of tuning on appearance but it works. It uses bootstraps popover. Stuff is written in portuguese but you should understand it. Also the total value of the cart is blade templated.</p> <p>Navbar code:</p> <pre><code>&lt;ul ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fortran: Counter inside DO-loop<p>I have an array, from which I want to have some information.</p> <p>I wrote a small DO-loop, but I don't know why it alway...
<p>The problem is your conditional: </p> <pre><code>da1(i).gt.1.00 .and. da1(i).lt.999.9999 .and. da1(i).lt.-1.000 </code></pre> <p>How can a number (here: <code>da1(i)</code>) be <code>&gt; 1</code> and <code>&lt; -1</code> at the same time? That conditional is always false, and <code>inn</code> is never incremented...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why Hamcrest `matches` method uses Object as input type and does not use generic type as input<p>I'm new to Java, learning Hamcrest framework.</p> <p>I've r...
<p>Q:</p> <blockquote> <p>I don't understand why.</p> </blockquote> <p>A: (from JavaDocs)</p> <blockquote> <p>This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type.</p> </bloc...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I get a an extra and diffrent character when using printf for character array<p>When I run this program and give laks as input I get laks as output plus one ...
<p>You are not null terminating your string</p> <p>So have </p> <pre><code>person[i] = '\0'; </code></pre> <p>after the for loop.</p> <p>I would have </p> <pre><code>char person[6] = ""; </code></pre> <p>and later do a scan </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iron-Router checking document existence before route runs<p>I have a basic chat room App where you can create a room from the main page which calls this meth...
<blockquote> <p>I am trying to avoid users going to some random ID like localhost:3000/rooms/asdasd if a room with that ID doesn't already exist.</p> </blockquote> <p>If you want to do this you can follow the next.</p> <p>on the Layout configure add this.</p> <pre><code>Router.configure({ layoutTemplate: 'la...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Coldfusion 9 DSN less Connection MSSQL 2008 Windows Authentication<p><strong>Update:</strong></p> <p>Though the original question asked about windows authen...
<p>Found an example <a href="http://www.neiland.net/blog/article/how-to-create-a-dsn-less-database-connection-in-coldfusion/page/3/" rel="nofollow">here</a> that shows the username and password in the URL.</p> <pre><code>&lt;cfset connection = driverManager .getConnection("jdbc:mysql://localhost:3306/demodb?user=demou...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Performing a transaction with Rails ar-octopus gem<p>I couldn't find in ar-octopus (<a href="https://github.com/tchandy/octopus" rel="nofollow">https://githu...
<p>Instead of passing <em>&amp;block</em> you can do the following :</p> <pre><code>Octopus.using(:shard) do ActiveRecord::Base.connection.transaction do block.call end end </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: application not responding using ProcessBuilder<p>I'm currently doing an Eclipse plugin mainly calling various scripts and interact with the return values.</...
<p>Here's a simple example of execution of the process asynchronously in another thread. I've used the single thread executor because there's only one task executed:</p> <pre><code>java.util.concurrent.Executors.newSingleThreadExecutor().execute(new Runnable() { public void run() { ProcessBuilder pb = new Proces...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If/Else Statement on character strings from SPIM system calls<p>I'm writing a program in MIPS using Spim and I want to convert temperatures to/from fahrenhei...
<p>Unlike reading integers, reading strings does not read the user input into register <code>$v0</code>. A register in MIPS is only 4 bytes, so it doesn't make sense to store a string in a single register. Instead, MIPS will read it into memory starting at a specified address.</p> <p>The read string syscall in MIPS wo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django for loop list with jquery and javascript<p>Problem: I want to display only the result for one <code>&lt;li&gt;</code> element, not for all of them.</p...
<p>You have to use unique <code>id</code>s in your HTML but you don't need to bind your event to a specific id in this case. Try this:</p> <p>HTML:</p> <pre><code>&lt;li&gt; &lt;div&gt; &lt;span&gt;{{ song.name }}-{{ song.artist }}&lt;/span&gt; &lt;div class="showOrNo" style='display:none'&gt; {% if song.attr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get/set the iOS "preferred language" from a RN app?<p>We are developing a React Native app supporting three languages. For various reasons, we must ha...
<p>The preferred language setting cannot be explicitly fetched or set. Changing the preferred language appears to the app just like the whole system language is changed to the selected language.</p> <p>We implemented in-app language selection so that the app uses the system language until the user explicitly changes t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React ref anti-pattern for Popups<p>Recently I've found myself implementing a ref based pattern that seems to go against <a href="https://reactjs.org/docs/re...
<p>I approve the second, more "React-y", solution because:</p> <ul> <li>It makes sense that your parent holds the shown state. In later uses, you might be really happy to have more flexibility over popup control flow.</li> <li>Your original pattern is much more complex to read and to maintain as you expose an imperati...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R statistics, panel data and NAs: replacing NA value in vector with a specific row in another vector using panel data<p>My apologies for a poorly formulated ...
<p>Here is one possibility based on something else I had been working on this past week.</p> <pre><code>library(tidyverse) df_wide &lt;- df %&gt;% pivot_wider(id_cols = id, names_from = cat, values_from = d.stake) %&gt;% as.data.frame(.) data.frame(id = df_wide$id, combn(df_wide[-1], 2, function(x) x[,1]-x[,2]))...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Lambda function to perform some operation on different CSV files depending on file names<p>I have to open and perform some logic on three different CS...
<p>Solved by this code:</p> <p>def lambda_handler(event, context) </p> <pre><code>if event: file_object=event["Records"][0] file_name=str(file_object['s3']['object']['key']) print(file_name) if(file_name == key): #To do logic </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select a specific record from xml record using Postgresql<p>I have a column in my table called data_xml that has records presented like this- </p> <pre><cod...
<p>You can use <a href="https://www.postgresql.org/docs/current/functions-xml.html#FUNCTIONS-XML-PROCESSING-XPATH" rel="nofollow noreferrer"><code>xpath()</code></a> for that:</p> <pre><code>select (xpath('/data/@user_id_type', data_xml::xml))[1] from the_table; </code></pre> <p><code>xpath()</code> returns a array o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Link to anchor in frame<p>I'm building a portfolio website for a comics label and would like to integrate the store within the site. The site is built in Ind...
<p>I don't think you can do this without using a script.</p> <p>Add the following in <a href="http://clubedoinferno.tictail.com/" rel="nofollow">your page in iframe</a></p> <pre><code>&lt;script&gt; window.scrollTo(0,document.getElementById(parent.window.location.hash.substring(1)).offsetTop); &lt;/script&gt; </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django's maximum verbosity useless: "ImportError: No module named apps"<p>I checked out some code and am trying to get it running, but whenever I <code>runse...
<p>In addition to whatever program you're running, you can also tell Python to be more verbose directly:</p> <pre><code>python -v manage.py runserver --verbosity=3 </code></pre> <p>...or more with <code>-vvv</code> if you really need to see the value, reference count, and memory location of each individual integer an...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: iOS 8 + Swift - Looking to define multiple lanes, but draw them based on events<p>I have 3 buttons in one of my app storyboards. Based on the button pressed ...
<p>I think what you want is to animate a line being drawn - if so, see this questions:</p> <p><a href="https://stackoverflow.com/questions/1880035/how-to-draw-line-with-animation">how to draw line with animation?</a></p> <p>In particular one of the answers has this link:</p> <p><a href="http://tumbljack.com/post/179...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Comparing Generics in Java<p>If I have a class that uses a template <code>&lt;T&gt;</code> how do I compare two variables of type T? One of my friends told m...
<p>Your <code>T</code> implements <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html" rel="nofollow"><code>Comparable</code></a>, so you should use its <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#compareTo(T)" rel="nofollow"><code>compareTo()</code></a> method.</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to decrypt files using CipherInputStream or why the following methods don't work<p>I have the following function to encrypt files. I printed the result o...
<p>There are many things to be fixed</p> <blockquote> <p>c.init(Cipher.ENCRYPT_MODE, key, iv);</p> </blockquote> <p>Where is IV defined? If it's static, using cbc mode you break the security almost completely.</p> <p>Next - you are using CBC mode without any authentication (hmac), try to search for "malleable ciph...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Access Postgres database container but get error<p>I use docker to run a Postgres database container. My command to start it is:</p> <pre><code>docker run -...
<p>You need to provide username as well. Try this : <code>psql -U &lt;username&gt;</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 Folder Permissions in Elastic Beanstalk Using YAML File?<p>I have a C# Web API Elastic Beanstalk app which needs a folder outside the deployment d...
<p>In the end I switched to using Json instead of YAML as, despite my YAML being validated by several online YAML testers, AWS still wouldn't accept it. It always had issues with the parameters passed to icacls. I also changed to a folder within the application App_Data folder as setting permissions on any directory ex...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Studio No LogCat<p>Android Studio is just killing me. I'm migrating over from Eclipse and am unable to produce LogCat output. I just created a simple...
<p>1) Don't use System.out.println. Import android.util.Log and then use </p> <pre><code>Log.e("Randall", "Hello World"); </code></pre> <p>Additionally, adb should be found in your</p> <pre><code>sdk/platform-tools/adb </code></pre> <p>folder</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sorting hash table (of hash tables)<p>I have hit a wall trying to get a hash table of hash tables to sort. It seems like the act of sorting is turning the ha...
<p>What you're currently doing is splitting the hashtable into a list of separate entries (via <code>.GetEnumerator()</code>) and then sorting <em>that</em> - so you end up with <code>$sortedHashTable</code> being just an array of <code>key</code>/<code>value</code> pair objects, sorted by key, not an actual <code>[has...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why are floating point infinities, unlike NaNs, equal?<p>Why doesn't infinity comparison follow the logic applied to NaNs? This code prints out <code>false</...
<p>Your reasoning is that <code>Double.POSITIVE_INFINITY</code> should not be equal to itself because it is “likely” to have been obtained as the result of a loss of accuracy.</p> <p>This line of reasoning applies to all of floating-point. Any finite value can be obtained as the result of an inaccurate operation. That...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Accessing items in a list using R, combining after split and apply<p>I'm just getting started in the process of cleaning up strings with R and have learned a...
<p>You were almost there:</p> <pre><code>lapply(x, function(z) z[! (z %in% bad.words)]) </code></pre> <p>Alternatively, you could do</p> <pre><code>lapply(x, function(z) setdiff(z,bad.words)) </code></pre> <p>which seems more elegant to me.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get PATCH parameters of REST API in Yii 1.1?<p>Yii 1.1.16 brought <code>getPatch($paramName, $defaultValue=null)</code> and <code>getIsPatchRequest()<...
<p>I've solved it by using</p> <pre><code>CJSON::decode(file_get_contents('php://input')); </code></pre> <p>Is this safe, should this be used? Are there other ways of going about this?</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Select length(col) to get BLOB content size in jOOQ<p>The following SQL works</p> <pre><code>CREATE TABLE stored_file ( id INT AUTO_INCREMENT NOT NULL, ...
<p>Whenever you hit jOOQ's limits, resort to <a href="http://www.jooq.org/doc/latest/manual/sql-building/plain-sql/" rel="noreferrer">plain SQL</a>. You can write your own length function like this:</p> <pre><code>class MyDSL { public static Field&lt;Long&gt; length(Field&lt;byte[]&gt; field) { return DSL....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing Nginx Log File Location<p>I can't get any changes in the /etc/nginx/nginx.conf http block to be used. I'm starting with the simplest thing - I want ...
<p>Isn't your access_log also defined in a server block ? Have a look at the default config in nginx/sites-enabled/. In this case the value in http block is overwritten by the one in the lower block. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loading relationships from CSV data into neo4j db<p>Neo4j 2.1.7</p> <p>Attempting to mass-connect a bunch of nodes via information I've received in a CSV, w...
<p>I don't think it is possible with LOAD CSV. You need to do a little trickery with the input data and collections. If the relationship in the input csv contains <code>OWNS</code> create a collection with a one in it otherwise create an empty collection. Do the same for the <code>BORROWS</code> relationship value. It...