input
stringlengths
51
42.3k
output
stringlengths
18
55k
UIRefreshControl not Dissapearing <p>The pull to refresh is not disappearing. There is only 3 rows visible on the screen and after using <code>print(indexPath.row)</code> I can see that it is reloading rows 0,1,2 again but the refresh control is not disappearing.</p> <pre><code>override func viewDidLoad() { super....
<p>First, this line is wrong:</p> <pre><code>tableView.addSubview(refreshControl!)...} </code></pre> <p>You do not need to add a refresh control to a table view in iOS 10 as a subview. It has a <code>refreshControl</code> <em>property</em> that you <em>set</em>:</p> <pre><code>tableView.refreshControl = refreshContr...
ActiveRecord/Sinatra: separate columns for date and time? <p>How can I get form parameters from the user for date and time separately?</p> <p>For example:</p> <pre><code>class CreatePosts &lt; ActiveRecord::Migration create_table :posts do |t| t.string :title t.text :content t.date :date t.time :tim...
<p><a href="http://stackoverflow.com/questions/17918117/rails-4-list-of-available-datatypes">Yes there is a <code>time</code> type.</a> But you're thinking about the problem wrong.</p> <p>You should select the database type based on the level of precision that you need to store the timestamp. Not by how you intend to ...
AWK: match characters inside a captured group <p>For example, I have groups of citations within the text like these</p> <pre><code>Lorem ipsum \textbf{dolor} sit amet \cite{a,b,c,d,e}, consectetur adipiscing elit. In molestie urna et dui $\mu=\text{a b c}$ venenatis pretium. Duis sit amet metus orci \cite{a,b,c,d,e}. ...
<p>Your question is unclear but is this what you want?</p> <pre><code>$ awk -F, 'match($0,/\\cite\{([^\}]+)/,a) {$0=a[1]; for (i=1; i&lt;=NF; i++) print NR, i, $i}' file 1 1 a 1 2 b 1 3 c 1 4 d 1 5 e 2 1 b 2 2 e 2 3 f </code></pre> <p>The above uses GNU awk for the 3rd arg to match(). If all you want to do is change ...
Show hidden div permanently throughout website after clicking on a specific <a> href link once <p>i found this <a href="http://stackoverflow.com/questions/31197270/show-hidden-div-permanently-throughout-website-after-clicking-on-a-a-href-link">link</a> of a question like the one i have, the thing is that the solution t...
<p>I think this might be solved using simple jQuery. I've used the example specified at: <a href="http://stackoverflow.com/questions/31197270/show-hidden-div-permanently-throughout-website-after-clicking-on-a-a-href-link">Previous Similar question</a> and changed it so it will fit your code. It currently works which is...
Mysql : show 0 and transaction type when no result found <p><strong>Table structure:</strong> <br/></p> <pre><code>reference|transaction|member|summary|amount|action_by|created_at(unix timestamp) </code></pre> <p>My current Sql is :</p> <pre><code>select COALESCE(sum(`amount`) , 0) as `amount` , `transaction` from `...
<p>you need have a separate table with each unique <code>transaction</code> value. This can be done either with a separate table or you can use a derived table as below: </p> <pre><code>SELECT COALESCE(sum(`amount`),0) as amount, der.transaction_type FROM (SELECT 'payment' as transaction_type UNION SELECT 'deposit' UN...
How to know the set for IP address from C in linux is successful or fail <p>I use this code to setup the IP address</p> <pre><code>int set_ip(const char *name, const char *ip) { struct ifreq ifr; struct sockaddr_in *addr; int fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); strncpy(ifr.ifr_name, name, IFNAMSIZ);...
<p>Thank you all, below is the solution suggested by you experts:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ifaddrs.h&gt; #include &lt;string.h&gt; #include &lt;arpa/inet.h&gt; #include &lt;net/if.h&gt; #include &lt;net/route.h&gt; // struct rtentry #include &lt;sys/ioctl.h&gt; #in...
Dynamically display "Next" or "Submit" in Gravity Forms <p>I am creating a form with conditional logic: Option 1: a user will put in just their basic information. Option 2: if they select a checkbox then they will fill in a series of questions in addition to the basic information. I would like that all the questions th...
<p>Based on the checkbox state, you can change the button's text (its value).<br> Since you showed no code, here's an minimal example.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-overri...
confused generating fibonacci sequence <p><strong>(i) When I run below code,</strong> </p> <pre><code>var fib = []; for(var i=1; i&lt;=10; i++){ if (i === 1) { fib[0] = 0; } else if (i == 2) { fib[1] = 1; } else { fib[i] = fib[i-2] + fib[i-3]; console.log(fib[i]); } } Ou...
<p>Follow the loops iterations one by one</p> <p>in the third iteration,</p> <p><code>fib[2] = fib[2-2] + fib[2-3];</code> is <code>fib[2] = fib[0] + fib[-1];</code></p> <p><code>fib[2] = 0 + undefined;</code></p> <p><code>fib[2] = undefined;</code></p> <p>in the fourth iteration,</p> <p><code>fib[3] = fib[3-2] +...
Split string every 20 characters and then print each section to console <p>Okay so, I am trying to do something for a larger project and I need to split a string every 20 characters and then print each section to console with a delay of 1 second between each input I tried to do:</p> <pre><code>if (x==true){ String[...
<p>The method split can not achieve your goal.You can read split method api. Splits this string around matches of the given regular expression. The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end ...
Node.js Http post request on aws lambda Socket Hang up <pre><code>var http = require('http'); exports.handler = function(event, context) { var headers = { 'content-type': 'application/x-www-form-urlencoded' } var options = { host: 'stage.wings.com', path:'/test-lambda', form: { 'days':'3' ...
<p>There is a timeout time for aws-lambda, it will hang up after at most 300 seconds.</p> <p>Here is little more about it. <a href="http://docs.aws.amazon.com/lambda/latest/dg/limits.html" rel="nofollow">http://docs.aws.amazon.com/lambda/latest/dg/limits.html</a></p> <p>you can use <code>context.getRemainingTimeInMi...
only able to check first element of my array <p>I am having some issues with getting my array to iterate through in my for loop. The point of this function is to check if the number has already been placed into the array somewhere else so no duplicates can appear. when I run through the function it only iterates throug...
<p>Your indentation is misleading. Here what is happening: </p> <pre><code>bool check(int wins[], int number) { for (int i = 0; i &lt;= arraySize; ++i) if (number == wins[i]) { return true; } else if (number != wins[i]) { return false; }...
Removing Odds from a LinkedList recursively using index <p>I am having a little bit of difficulties with the Recursive concept.</p> <p>Given a LinkedList with Integer values </p> <pre><code>L1 = (2-&gt;1-&gt;4-&gt;6-&gt;3) L2= (1-&gt;9-&gt;6-&gt;3) </code></pre> <p>The function should remove the Odd numbers from th...
<p>I write one may meet your requirement .<br> Save the previous node and recurse using it . </p> <pre><code>public class LinkedList{ public static void main(String[] args) { LinkedList node0 = new LinkedList(0); LinkedList node1 = new LinkedList(1); LinkedList node2 = new LinkedList(2); LinkedL...
export or download gridview with custom table schema C# <p><a href="http://i.stack.imgur.com/gmPQj.png" rel="nofollow">My Gridview Header</a> I have question ..So i have Grid where the data are binding from SQL..And i will export/download file to .XML files..its success but the header table XML files are not same with...
<p>For this purpose I always use this method and works just fine : </p> <pre><code>private void ExportGridToXML() { SaveFileDialog SaveXMLFileDialog = new SaveFileDialog(); SaveXMLFileDialog.Filter = "Xml files (*.xml)|*.xml"; SaveXMLFileDialog.FilterIndex = 2; SaveXMLFil...
UILabel has internal padding from programmatic constraints <p>So, I don't know why this is happening, but here is a pic depicting it.</p> <p><a href="http://i.stack.imgur.com/mi5lw.png" rel="nofollow"><img src="http://i.stack.imgur.com/mi5lw.png" alt="enter image description here"></a></p> <p>If you look at the UILab...
<p>Well, you're adding that padding by wrapping that body label with the <code>left</code> value.</p> <p>So instead of: <code> V:|-right-[titleLabel(20)]-left-[bodyLabel(&gt;=0@999)]-left-| </code></p> <p>Do something like: <code> V:|-right-[titleLabel(20)][bodyLabel(&gt;=0@999)]| </code></p> <p>That will remove bot...
Kivy: how to reference widgets from python code? <p>Basic Kivy question. Given this kv file:</p> <pre><code>BoxLayout: MainMenu: MyCanvasWidget: &lt;MainMenu&gt;: Button: on_press: root.do_action() </code></pre> <p>How do I call a method of MyCanvasWidget (for drawing something) from the do_actio...
<pre><code>BoxLayout: MainMenu: do_action: mycanvas.method MyCanvasWidget: id: mycanvas &lt;MainMenu&gt;: Button: on_press: root.do_action() </code></pre> <p>Got some inspiration from <a href="http://stackoverflow.com/questions/39807997/how-to-access-some-widget-attribute-from-anot...
Create a table by merging many files <p>This seemed like such an easy task, yet I am boggled.</p> <p>I have text files, each named after a type of tissue (e.g. <code>cortex.txt</code>, <code>heart.txt</code>)</p> <p>Each file contains two columns, and the column headers are <code>gene_name</code> and <code>expression...
<p>That's a <em>lot</em> of code to implement the simple idiom of using a hash to enforce uniqueness!</p> <p>It's looking like you want an array of <em>expression values</em> for each different <code>ENSMUSG</code> string in all <code>*.txt</code> files in your <code>outfiles</code> directory.</p> <p>If the files you...
how to get multiple values of drop down from a loop? <pre><code>&lt;?php // this is where selecting of number of rooms in database $sql = mysqli_query($con, 'SELECT * FROM roomtype'); $get_room1 = mysqli_query ($con, "SELECT * from room where status='Activated' and type_id=2"); $get_room2 = mysqli_query...
<p>add <code>[ ]</code> tag to name tag, so you will get your value in array.</p> <pre><code>&lt;option name='deluxe[]'&gt;$x&lt;/option&gt; </code></pre>
How to avoid re-importing modules and re-defining large object every time a script runs <p>This must have an answer but I cant find it. I am using a quite large python module called quippy. With this module one can define an intermolecular potential to use as a calculator in ASE like so: </p> <pre><code>from quippy im...
<p>You can either use raw files or modules such as <code>pickle</code> to store data easily.</p> <pre><code>import cPickle as pickle from quippy import Potential try: # try previously calculated value with open('/tmp/pot_store.pkl') as store: pot = pickle.load(store) except OSError: # fall back to calcul...
R:How to create a boxplot with different types of data? <p>I am trying to get a picture like this: <a href="http://i.stack.imgur.com/fZYso.png" rel="nofollow"><img src="http://i.stack.imgur.com/fZYso.png" alt="enter image description here"></a></p> <p>In the picture, the parameters (a, b, and c of the triangle distr...
<h1>UPDATE</h1> <p>Here's my attempt. It's sloppy but I think it does what you want to do. It would be great if other people can provide a better solution or make suggestions/comments.</p> <pre><code>x1&lt;-c(1300,541,441,35,278,167,276,159,126,170,251.3,155.84,187.01,850) x2&lt;-c(694,901,25,500,42,2.2,7.86,50) x3&l...
What is the Visual basic version of Signalr Proxy.On Method <p>What is the Visual basic equivalent of this code for a Signalr Proxy Hub?</p> <pre><code> proxy.On&lt;ChatMessage&gt;("broadcastMessage", OnMessage); </code></pre> <p>I have Tried..</p> <pre><code> proxy.On(Of ChatMessage)("broadcastMessage", OnMessage)...
<p>Need to use 'addressOf' in place of 'Sub()' for this line.</p> <pre><code>proxy.On(Of ChatMessage)("broadcastMessage", Sub() OnMessage()) </code></pre> <p>Like...</p> <pre><code>proxy.On(Of ChatMessage)("broadcastMessage", AddressOf OnMessage) </code></pre>
GitLabCE mishandles results of multiple external Jenkins jobs - a bug or not supported? <p>I wish to replicate a workflow on GitLabCE that I also use successfully with GitHub. I am using GitLabCE 8.11.5.</p> <p>I have Jenkins working with the <a href="https://github.com/jenkinsci/gitlab-plugin" rel="nofollow">GitLab-p...
<p>Answering my own question:</p> <p>I believe this behaviour is caused by the configuration of the GitLab Plugin in Jenkins. Each job has a "Publish build status to GitLab commit" post-build action. This has a field named "Build name", and if this string is not unique amongst all the builds in the pipeline, GitLab ge...
How do I mass update a field for models in an array? <p>I’m using Rails 4.2.7. How do I mass update a field of an array of my models without actually saving that information to the database? I tried</p> <pre><code>my_objcts_arr.update_all(my_object: my_object) </code></pre> <p>but this results in the error</p> <...
<p><code>update_all</code> needs to be called on a class level active record model/relation, ie User or TaxReturn. Here is one somewhat related <a href="http://stackoverflow.com/questions/4912510/rails-3-activerecord-the-best-way-to-mass-update-a-single-field-for-all-the">SO post showing some examples</a>, and here is ...
How to make OneTimeSetup failures fail tests in TeamCity <p>I have just encountered a scenario where a <code>TestFixture</code>'s <code>OneTimeSetup</code> method has failed, yet TeamCity has reported all the tests as passed.</p> <p>I can see in the log that TC is reporting 14 red lines of text, once for each of the 1...
<p>There was a bug in NUnit 3.2.1, where failures in a <code>OneTimeSetUp</code> didn't actually fail the test suite - meaning tools such as TeamCity would have no way to detect the failure.</p> <p>This was fixed in NUnit 3.4 - upgrading to the latest NUnit should solve your problem. The GitHub issue, for reference: <...
Javascript: Adding a property to an array of objects <p>I have an array of objects as follows:</p> <pre><code>var myarray=[{"name":"John","address":"home"},{"name":"Peter","address":"home"}] </code></pre> <p>and I would like to run a function to add a property to the array as follows:</p> <pre><code>[{"name":"John",...
<p>Your code is not adding the property to the contents of the array. The values of the array are given as the first parameter to the callback function (the second parameter is an index, and not the array itself—that's the third parameter). Simply assign the new property to the first parameter of the callback functio...
Does OpenCV with CUDA require SSE4.2 on Windows? <p>I can't find any good information on compiling OpenCV. I've tried nearly everything and I'm stuck. My question is, does OpenCV require SSE4.2. That is the only thing I can think of.</p>
<p>OpenCV will optionally compile for whatever level of SSE is detected by cmake. This is independent of building CUDA support</p>
Google Drive API PHP: Files.get returns null value <p>I am creating an application that integrates with Google Drive API (version 3) in order for it to find a file inside a named folder by way of user input and then to get the web content link for that file. My application is contacting a service account where my appli...
<p>Please <a href="https://developers.google.com/drive/v3/web/migration" rel="nofollow">read</a> this Drive API V3 migration documentation.</p> <blockquote> <p>Full resources are no longer returned by default. Use the fields query parameter to request specific fields to be returned. If left unspecified only a subset...
AsyncTestCompleter Browserify Angular2 HTTP Mock Test <p>I am about to get started with Angular 2 tests, I am pretty new to Angular 2 and got stuck with testing.</p> <p>I am following the testing guide: <a href="https://angular.io/docs/ts/latest/guide/testing.html" rel="nofollow">https://angular.io/docs/ts/latest/gui...
<p>I've never used the <code>AsyncTestCompleter</code>, and I've never seen it used anywhere, except in the Angular source tests. I don't know if it's something that's just meant to be used internally or not, but when I tested I got a different error, saying there is no provider for <code>AsyncTestCompleter</code>.</p>...
Unquoting argument in macro definition hangs function call <p>I've been working through an exercise on macros (Dave Thomas' excellent <a href="https://pragprog.com/book/elixir12/programming-elixir-1-2" rel="nofollow">Programming Elixir 1.2</a>, chapter 21) and I've hit a bit of a bump in my understanding of what's happ...
<blockquote> <p>When we reach the <code>unquote(args)</code> in <code>neg</code>, it is attempting to evaluate the <code>args</code> expression, which I believe is a list containing a call to <code>neg</code> and results in an infinite recursive loop. Is this correct?</p> </blockquote> <p>Yes, this is what that line...
Makefile Use Shell to create variables <p>I am using make's shell command to populate some variables, and on output it indicates that they are being set to the values I expect. However when I pass them to my make recipes they all show up empty. I suspect make is doing some odd parsing on tte results. Eg: </p> <pre><co...
<p>There are several things going on here. The first is that when you have:</p> <pre><code>MyTarget: $(MySources) LINE='$(shell cat $&lt; | grep GIMME_THE_LINE_I_WANT)' </code></pre> <p>You are setting a <em>shell</em> variable called <code>LINE</code>, not a <code>make</code> variable. The build instructions f...
Firebase and Swift 3 <p>I have searched around and have not found the particular answer that I am seeking for. I just went and updated my App to a Swift 3 Language from swift 2. It obviously threw out a host of errors which I went through and fixed to the best of my abilities and now I do not have any errors. I can run...
<p>sorry posted that about 12 hours to early. After doing a lot of research it looks like I found the answer. have not tested yet but I think I am getting the same errors in the compiler. </p> <p><strong>"We've noticed what seems to be an issue with the latest iOS 10 simulators (up to beta 6 at the time of this writin...
trouble importing components in react <p>Hi I'm having trouble importing components from one jsx into another. I'm using a <code>django framework</code> to serve my webfiles and I've downloaded all the necessary tools (npm, webpack, webpack-bundle-tracker, babel loader, django-webpack loader). <code>Webpack</code> does...
<p>Try replace this </p> <pre><code> loader: 'babel-loader', </code></pre> <p>with </p> <pre><code> loader: 'babel', </code></pre> <p>in you webpack config</p> <p>PS: this shouldve been a comment but not enough rep</p>
CSV: Change One Field Column <p>I have file named <code>test.csv</code> which has 85 fields?</p> <p>I have to read that file, change 1 column &amp; save it again.</p> <p>I have below code.</p> <pre><code>$file_name = "test.csv"; $infos = array(); if (($handle = fopen($file_name, "r")) !== FALSE) { while (($data...
<p>less looping, should a little more efficient</p> <pre><code>&lt;?php $file_name = "test.csv"; $infos = array(); if (($handle = fopen($file_name, "r")) !== FALSE) { $fp = fopen('write.csv', 'w'); while (($data = fgetcsv($handle, 0, ",")) !== FALSE) { $data[17] = cleanUrl($data[6]); fput...
python XML get text inside <p>...</p> tag <p>I guys, I have an xml structure which looks somewhat like this.</p> <pre><code>&lt;abstract&gt; &lt;p id = "p-0001" num = "0000"&gt; blah blah blah &lt;/p&gt; &lt;/abstract&gt; </code></pre> <p>I would like to extract the <code>&lt;p&gt;</code> tag inside the <cod...
<p>You can use an <em>XPath expression</em> to search for <code>p</code> elements specifically inside the <code>abstract</code>:</p> <pre><code>for p in xroot.xpath(".//abstract//p"): print(p.text.strip()) </code></pre> <p>Or, if using <code>iter()</code> you may have a nested loop:</p> <pre><code>for abstract i...
google charts api get chart without element argument? <p>I'm using a tool that creates google charts behind a facade. Works well, but now I'm adding diff charts.</p> <p>Diff charts require access to chart.computeDiff(...) but this requires a chart, which in turn as far as I can see (for some reason) requires an argume...
<p>never mind, i took computeDiff from the appropriate prototypes:</p> <pre><code>let computeDiff = google.visualization[this.wrapper.getChartType()].prototype.computeDiff let chartDiff = computeDiff(oldData,newData) return chartDiff </code></pre> <p>seems to work</p>
PHP - What is this if statement meaning? <p>I use PHP around 3 months see many syntax.<br> but cannot understand what is this mean. </p> <pre><code>if($foo = 'somevalue') //or if($foo = $somevalue) { } </code></pre> <p>I see only if($foo) this mean if($foo == TRUE). or if($foo ==,>,&lt; somevalue)<br> but in this ...
<p>You are just simultaneously <strong>assigning</strong> a value to <code>$foo</code> and evaluating it in the <code>if</code> statement. So if the value of <code>$foo</code> corresponds to <code>false</code>, then code inside the <code>if</code> statement would not execute. As an example:</p> <pre><code>if ($foo = 1...
Conditionally toggle `preventDefault` on form submissions in Elm <p>Is there a way to conditionally toggle <code>preventDefault</code> on form submissions? I've tried using <code>onWithOptions</code>, below, but it seems only the first setting is used, even though I can see it change using <code>Debug.log</code>, when ...
<p>One simple workaround suggestion until someone can show us how to solve it.</p> <p>How about create two buttons (with different options as you've shown) and depending on the condition show only one of them? You can use <code>Html.Attributes.hide</code> for that.</p>
how to fix this kind of git conflict: .merge_file_a <p>I am working on an android project but i got this kind of conflict. I never met this before any clue which one should i keep?</p> <pre><code>&lt;&lt;&lt; .merge_file_a36756 @Inject TPOmnitureReporter reporter; private TPCardAdapter adapter; ======= ...
<p>You have to resolve a merge conflict, you have to decide which one you want to keep. Once you choose you can change the file, add and commit it. </p> <p>Looks like one of you wanted to add : </p> <pre><code> @Inject TripPlannerOmnitureReporter reporter; private TripPlannerCardAdapter adapter; </code></pr...
I cannot add in my ArrayList [Android] <p>In my class I created a <code>variable</code> named <code>taskArray</code> and initialized it in my <code>onCreate</code> like this </p> <pre><code> public class ActivityOne extends Activity { ArrayList&lt;WorkTask&gt; taskArray = null; @Override protected void onCreate(Bu...
<p>I think you write more information about your code.</p> <p>It can occurred by <code>count</code> is zero that means <code>jArray</code> is empty list.</p> <p>Frist, you check your json data about <code>worktask</code>.</p>
Ruby - Array of hashes - Nested HTML menu from hash values without writing duplicates <p>I have a relatively large hash where the values for all keys within are array of hashes (see below for sample layout). I have spent the last 4.5 hours attempting to write out HTML for my Rails application and I am seriously about ...
<p>As is often the case with such problems, it becomes much easier to solve once you've put the data into a "shape" that closely resembles your desired output. Your output is a nested tree structure, so your data should be, too. Let's do that first. Here's your data:</p> <pre><code>data = { genesis: [ { id: 1, v...
Blank Page While Exporting as PDF in SSRS Matrix Report <p>I have created an SSRS Matrix report which shows 3 pages in output but when i export the report as a PDF, it shows 6 pages. One page is blank, although i selected the option ConsumeContainerWhiteSpace as True but still it is giving me a blank page as well the o...
<p>As some comments have already suggested you will need to do a bit of trial and error with your page layout, page size and report contents to ensure that there is no white space pushing onto other pages.</p> <p>The easiest way I have found to do this is to use the <code>Print Layout</code> option when previewing the...
Unable to get growl notifications during test executions <p>I am trying to explore a feature of adding growl notifications to the tests. This enables the messages to be added on the screen while test execution.</p> <p>I am trying this approach by following steps specified in : <a href="http://elementalselenium.com/tip...
<p>My best guess is that you need to sleep for a bit in-between js.executeScript() calls to give the javascript that you are calling time to load. If you look, the script you say works has a variety of sleep's between operations, likely to allow for things to load and process.</p>
Compare columns between two data frames R <p>I have two data frames:</p> <pre><code>c1 &lt;- c("chr1:981994","chr1:1025751","chr2:6614300", "chr2:6784300") c2 &lt;- c("G/A","C/T","A/T", "T/G") df1 &lt;- data.frame(c1,c2) a &lt;- c("chr1:981994","chr1:1000000","chr2:6614300", "chr2:6784300") b &lt;- c("G/G","C/C","A/...
<p>Thanks for the reproducible example. First, you can merge with <code>merge</code>. Have a look at <code>?merge</code> for other configuration options - you can specify the column to merge on using <code>by.x</code> and <code>by.y</code></p> <pre><code>df3 = merge(df1, df2, by.x='c1', by.y='a') # c1 c2 ...
What is the correct way to get Currency Symbol in Android? <p>This code is working fine but if I change my device langauge this is also show Rs so what the correct way to get currency symbol ?</p> <pre><code>public void displayTotlaPrice() { TextView totalPriceTextView = (TextView) findViewById(R.id.total_Price); ...
<p>Store below variable in <code>string.xml</code></p> <pre><code>&lt;string name="Rs"&gt;\u20B9&lt;/string&gt; </code></pre> <p>Now call it as below wherever you want to display <code>Rs</code> symbol,</p> <pre><code>textView.setText(getResources().getString(R.string.Rs) + "500"); </code></pre>
Odd behavior from canvas drawing other players using socket server <p>I'm trying how to learn how to create a multiplayer game using socket.io. I currently have a server storing all player's locations and sending every player their location, then sending the player everyone else's locations. I am getting those numbers ...
<h2>All is relative.</h2> <p>In 1D x &amp; canvas center cc = 100. </p> <p>You draw players <code>gameX + x</code> you draw self at <code>cc==100</code> So if self is 150 and player is 200 you draw player at <code>150+200=350</code> but self is drawn at cc making the player <code>350-cc = 250</code> pixels right of s...
Closing a react bootstrap modal with escape key <p>I have 6 buttons which, when clicked, activate a modal. This is written in React. </p> <pre><code>//Since I have 6 different modals, giving each of them an id would distinguish them onCloseModal(id) { this.setState({ open: false, modalShown: id ...
<p>It appears that your component state isn't properly representing the state of the modals. I wrote you <a href="http://jsbin.com/xomegeh/edit?js,output" rel="nofollow">an example</a> (which might not be best practice?) that shows how you can handle the state in a more specified way.</p> <pre><code>onCloseModal() { ...
Removing Blank Strings from a Spark Dataframe <p>Attempting to remove rows in which a Spark dataframe column contains blank strings. Originally did <code>val df2 = df1.na.drop()</code> but it turns out many of these values are being encoded as <code>""</code>.</p> <p>I'm stuck using Spark 1.3.1 and also cannot rely on...
<p>Removing things from a dataframe requires <code>filter()</code>.</p> <pre><code>newDF = oldDF.filter("colName != ''") </code></pre> <p>or am I misunderstanding your question?</p>
Angularjs How to Toggle div's in ng-repeat? <p>I am working in angularjs and I need to toggle div in <code>ng-repeat</code> but its not working fine. jQuery click is also not working on this. On click of <code>pregroupMem()</code> anchor tag I am calling this function. and data id coming from this function and I am usi...
<p>You can do it in following way:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>angular .module('app', []) .controller('MyController', function($scope) { $scop...
SQLAlchemy not finding Postgres table connected with postgres_fdw <p>Please excuse any terminology typos, don't have a lot of experience with databases other than SQLite. I'm trying to replicate what I would do in SQLite where I could ATTACH a database to a second database and query across all the tables. I wasn't us...
<p>In order to map a table <a href="http://docs.sqlalchemy.org/en/latest/faq/ormconfiguration.html#how-do-i-map-a-table-that-has-no-primary-key" rel="nofollow">SQLAlchemy needs there to be at least one column denoted as a primary key column</a>. This does not mean that the column need actually be a primary key column i...
Update fb-like-box onclick with jquery <p>I want to update the facebook like box from the form input. After a check button is clicked. The new like box will appear in the div. </p> <p><strong>HTML</strong></p> <pre><code>&lt;input type="text" class="form-control" placeholder="facebook Page URL" id="fbURL" value="cnn...
<p>This could easily be done with a frontend framework like react or so, but in jQuery I see two choices, when you click on the button <code>$.hide()</code> the first div and <code>$.append()</code> the second div or you can dispaly the second div and give the prop <code>display: none</code> . When you click the butt...
Move wanted data from json to array using <p>Hey I am trying to move wanted data fron json. So the data inside the json are booking data from a hotel, I got it from query to database. Basically, there are multiple data with same date on it. I just want to move data that I want to php array using simple else if statemen...
<p>In your data set from database, </p> <ol> <li>Some of the records doesn't have status field i.e. records 0-6</li> <li>In your condition your're checking <code>$events[$count_x_course_date - 1]['status'] == 'AVAILABLE'</code> which is wrong. Because from the data set, it's saying value is boolean i.e. true/false <co...
NLTK AssertionError when taking sentences from PlaintextCorpusReader <p>I'm using a PlaintextCorpusReader to work with some files from Project Gutenberg. It seems to handle word tokenization without issue, but chokes when I request sentences or paragraphs.</p> <p>I start by downloading <a href="http://www.gutenberg.or...
<p>That particular file has a UTF-8 Byte Order Mark (EF BB BF) at the start, which is confusing NLTK. Removing those bytes manually, or copy-pasting the entire text into a new file, fixes the problem.</p> <p>I'm not sure why NLTK can't handle BOMs, but at least there's a solution.</p>
Thread 1 EXC_bad_instruction (code=exc_1386_invop subcode=0x0) <p>I have a problem with this code. Why is it giving me an error "Thread 1 EXC_bad_instruction (code=exc_1386_invop subcode=0x0)" on "let session" line?</p> <pre><code>import Foundation protocol WeatherServiceDelegate{ func setWeather(weather:Weather)...
<p>The url Creation isn't working if you're getting "found nil while unwrapping"</p> <p>Generally you should stay away from !s as much as possible and cast them with <code>if let</code> or <code>guard let</code>. In this case I'm not sure why it would be failing, but if you isolate the url creation you might be able t...
Jquery Validation Not Working <p>I am very new to Jquery and hope you guys can help me with this jquery validation problem. Been trying to validate the form but it does not validate at all. It accepts anything that I type in the field, regardless of what restrictions I set. Jquery Validation Not Working Properly it mea...
<p>Refer this example:</p> <pre><code>$('#form_id').validate({ rules:{ uname : { required: true }, email : { required: true, email : true } }, messages:{ uname : { required: "message" ...
fetch POST from server using react and passport js <p>I have a form that I am submitting as a POST request...</p> <pre><code>&lt;form onSubmit={this.handleLogin.bind(this)} action="/" method="post"&gt; &lt;div&gt; &lt;label&gt;Username:&lt;/label&gt; &lt;input type="text" name="username"/&gt; &...
<p>I think you didn't give relevant information to the <code>passport</code></p> <p>Try to give <code>username</code> and <code>password</code> in <code>Strategy</code> </p> <pre><code>passport.use('local-signup', new LocalStrategy({ // by default, local strategy uses username and password, we will override ...
Exit modal by clicking on background content in React <p>I'm using react-bootstrap (documentation: <a href="https://react-bootstrap.github.io/components.html#modals-props" rel="nofollow">https://react-bootstrap.github.io/components.html#modals-props</a>) and am not sure how I can go about closing a modal by clicking on...
<p>It <strong>does has</strong> in the documentation in <code>props</code> section named <code>backdrop</code></p> <p>If you familiar with Bootstrap, you might know the attribute to describe show/hide the modal while clicking into the background action is called <code>static backdrop</code>.</p> <p>So to close a moda...
Weird Behavior of Scala Future and Thread.sleep <p>I'm currently writing codes to extend the Future companion object. One function I want to implement is <code>Any</code></p> <pre><code>//returns the future that computes the first value computed from the list. If the first one fails, fail. def any[T](fs: List[Future[T...
<p><code>Thread.sleep</code> is a blocking operation in your <code>Future</code> but you are not signaling to the <code>ExecutionContext</code> that you are doing so, so the behavior will vary depending on what ExecutionContext you use and how many processors your machine has. Your code works as expected with <a href="...
Kubernetes configuration step 2 CentOS 7 <p>From <a href="http://kubernetes.io/docs/getting-started-guides/kubeadm/" rel="nofollow">http://kubernetes.io/docs/getting-started-guides/kubeadm/</a></p> <p>CentOS Linux release 7.2.1511 (Core)</p> <p>(1/4) Installing kubelet and kubeadm on your hosts ..... it's ok</p> <pr...
<p>I fixed that issue with a likewise setup by declaring the private ip address as localhost in the /etc/hosts file. Example: /etc/hosts</p> <pre><code>10.0.0.2 localhost </code></pre> <p>Then I run a problem where kubectl get nodes threw: </p> <pre><code>The connection to the server localhost:8080 was refused - ...
How to check if string is part of command "python --version" in bash? <p>In bash, I wish to check whether Python 2.7 is installed. While searching SO I found this: <a href="http://stackoverflow.com/questions/12375722/how-do-i-test-in-one-line-if-command-output-contains-a-certain-string">How do I test (in one line) if c...
<p><code>python --version</code> command outputs to <code>stderr</code>. </p> <p>You can redirect <code>stderr</code> to <code>stdout</code> prior to test:</p> <pre><code>if [[ $(python --version 2&gt;&amp;1) =~ 2\.7 ]] then echo "I have 2.7" else echo "I don't have 2.7" fi </code></pre>
Could not load file or assembly when generating report <p>A first chance exception of type <code>'System.IO.FileNotFoundException'</code> occurred in <code>mscorlib.dll</code></p> <blockquote> <p>Additional information: Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Rep...
<p>You can try this solution. Add this to your config file (app.config).</p> <pre><code>&lt;startup useLegacyV2RuntimeActivationPolicy="true"&gt; &lt;supportedRuntime version="v4.0" sku=".NETFramework, Version=v4.0"/&gt; &lt;/startup&gt; </code></pre>
Use of undeclared type 'URL' in textView(_:shouldInteractWith:in:) <p>I am currently working on a simple app that retrieves some text and sets some UITextView's to the text with link autodetection enabled, and whilst attempting to allow the user to tap on the link, I have run into this issue whereby whilst attempting t...
<p>Check the documentation on that method. There is actually a fourth argument of type <code>UITextItemInteraction</code>. It is most likely declared optional and when you don't list it in your definition it just assumes you don't care about it, but it's still there. And it turns out <code>UITextItemInteraction</code> ...
What's wrong with my button. Can you help me with this? <p>Here's my php file. </p> <pre><code>&lt;?php //Getting the requested id $id = $_GET['id']; //Importing database require_once 'include/Config.php'; //Creating sql query with where clause to get an specific student $sql = "INSERT INTO bus_one (name,addres...
<pre><code>There are many ways of calling the function on a button's click. Option 1. Assign function to button's view in xmlfile: android:onClick="sendStudent" If this is the case, then replace "private void sendStudent() {" with "public void sendStudent(View view) {" Option 2. You can also set OnClickListener. ...
Union and intersection of 2 deque (unusual segmentation fault) <pre><code>5,10,15,20,25 // first deque 50,40,30,20,10 // second deque </code></pre> <p><code>v</code> is union vector while <code>intersec</code> is intersection vector. Below is the code for finding union and intersection. In case if anyone have more ea...
<p>I think that there is a mistake in set_union() :</p> <pre><code>it=set_union (first.begin(), first.end(), first.begin(), second.end(), intersec.begin()); </code></pre> <p>Correct way Should be :</p> <pre><code>it=set_union (first.begin(), first.end(), second.begin(), second.end(), intersec.begin()); </code></pre>...
compare two columns of different files and add new column if it matches <p>I would like to compare the first two columns of two files, if matched need to print yes else no.</p> <p>input.txt</p> <pre><code>123,apple,type1 123,apple,type2 456,orange,type1 6567,kiwi,type2 333,banana,type1 123,apple,type2 </code></pre> ...
<p>You can use <code>awk</code> logic for this as below. Not sure why do you mention one-liner awk command though.</p> <pre><code>awk -v FS="," -v OFS="," 'FNR==NR{map[$1]=$2;next} {if($1 in map == 0) {$0=$0FS"no"} else {$0=$0FS"yes"}}1' qualified.txt input.txt 123,apple,type1,yes 123,apple,type2,yes 456,orange,type1...
KeyModifier.SHIFT not working in Sikuli <p>I am new to Sikuli. I need to do Ctrl+Shift+Down in Sikuli. </p> <p>I have tried:</p> <p>type(Key.DOWN, KeyModifier.SHIFT + KeyModifier.CTRL) and type(Key.DOWN, KeyModifier.SHIFT|KeyModifier.CTRL)</p> <p>but none of them works.Both produce the same effect as pressing Ctrl+D...
<p>How about this: <br></p> <pre><code># Push down keys. keyDown(Key.CTRL) keyDown(Key.SHIFT) type(Key.DOWN) # Release keys. keyUp() </code></pre>
Method hiding using private access modifier <p>The code in question is: </p> <pre><code>class Student { private void study() { System.out.println("Student is studying"); } public static void main(String args[]) { Student student = new Sam(); student.study(); } } public class S...
<p>As mentioned in the comments, a private method is automatically final and hidden. You are therefore not able to override any private methods. Therefore the derrived method <code>study</code> will become a brand new method, and will not override the Student's study. </p> <p>See <a href="http://www.linuxtopia.org/o...
Aurelia js providing dynamic content to popover body <p>I am following the structure to implement tool tip from <a href="https://sean-hunter.io/2015/12/24/bootstrap-components-the-aurelia-way/" rel="nofollow">Sean Hunter Blog</a> . Now i want provide tool-tip content as a dynamic html content i.e I want to show one htm...
<p>You would need to implement the rest of bootstrap's <code>popover</code> API in your custom attribute, and add some logic to turn a selector into a template.</p> <p><strong>Here's an example: <a href="https://gist.run?id=909c7aa984477a465510abe2fd25c8a1" rel="nofollow">https://gist.run?id=909c7aa984477a465510abe2fd...
I want to trigger a response at different points in a loop <p>I have created a task on Psychopy in which beads a drawn from a jar. 50 different beads are drawn and after each bead the participant is asked to make a probability rating. The task is looped from an excel file but it takes too long to do 50 ratings. I was h...
<p>You should loop only once, but perform all checks inside that one loop:</p> <pre><code>for row_index, rows in (beads_params_pinkbluegreyratingparamters.xlsx): if (row_index &lt; 10): rows.ratingscale(0:10) elif (row_index &gt;=10 and row_index &lt;20): rows.ratingscale(12:20:2) rows....
Android intent.getStringExtra() return null <p>MainActivity </p> <pre><code>public class MainActivity extends AppCompatActivity { private static final int REQ_CODE_TO_ADD = 123; final ArrayList&lt;Contact&gt; allContact = new ArrayList(); ArrayList&lt;String&gt; name = new ArrayL...
<pre><code>if(resultCode == 0){ //Intent intent = getIntent(); String name2 = data.getStringExtra("namev"); String email2 = data.getStringExtra("emailv"); String birthday2 = data.getStringExtra("birthdayv"); Log.d("AAA","&gt;&gt;&gt;:"+name2); Contact person = new Conta...
How to edit child pages in wordpress <p>Is there any way to edit child pages like <code>mywebsite.com/page/childpage</code> in wordpress. Actually i want to edit product category page in woocommerce. I want to add a div on the top of product catogery page. I am searching for this since 2 days on google but i didn't g...
<p>If you need to add this div to all category pages (i.e. <a href="http://yourwebsite.com/product-category/category-name/" rel="nofollow">http://yourwebsite.com/product-category/category-name/</a>) then you need to edit the <code>archive-product.php</code> template. It is located at <code>\wp-content\plugins\woocommer...
Expanding a slice's size to prevent slice bounds out of range error <p>I have written the following:</p> <pre><code>func main() { //inside main fileInputBytes, err := ioutil.ReadFile("/tmp/test") byteSize2 := len(fileInputBytes) var inputFileByteSlice = fileInputBytes[0:] v...
<p>First of all, a slice is already a reference type. So you don't need to pass its pointer around if you are not going to change its capacity. So your <code>main</code> can be simplified as:</p> <pre><code>func main() { fileInputBytes, err := ioutil.ReadFile("/tmp/test") byteSize2 := len(fileInputBytes) ...
Javascript object comparision for each key and value <pre><code>var obj1 = {a:1, b:2, c:3}; var obj2 = {a:3, b:2, c:1}; </code></pre> <p>How to compare the objects are equal or not using javascript (for loop).</p> <p>I tried comparing both the objects by converting via stringify, but the comparison fails when the key...
<p>Go like this</p> <pre><code>Object.defineProperty(Object.prototype,"equals", { value: function (array) { for ( key in this ) if ( ! ( array[key] === this[key] ) ) return false; for ( key in array ) if ( ! ( array[key] === this[key] ) ) retur...
Label Put Before Center AutoLayout <p>I want to put a label just before center.</p> <p>I am unable to do this and i am unable to find any link how we do this.I am newer in iOS. I am unable to do this.</p> <p>Any help would be appreciated.</p>
<p>The best way is to do the following</p> <ul> <li>Center the UILabel Horizontally with the View Controller's view</li> <li>Open the constraint and change label.Center X to label.Trailing</li> </ul> <p><a href="http://i.stack.imgur.com/9awCu.png" rel="nofollow"><img src="http://i.stack.imgur.com/9awCu.png" alt="ente...
What difference between @load() and ${} <p>code:</p> <pre><code>&lt;zk&gt; &lt;vbox r="@ref(1)"&gt; &lt;label value="${empty r}" /&gt; &lt;label value="@load(empty r)" /&gt; &lt;/vbox&gt; &lt;/zk&gt; </code></pre> <p>returns:</p> <pre><code>true false </code></pre> <p>${} not working with @r...
<p>Short answer : no it doesn't.</p> <p>First, if you want automatic updates of values use <code>@load(...)</code> because static expressions in <code>${...}</code> are only evaluated once.</p> <p>Second, bind annotations @init/@load are being computed later in the ZK Bind lifecycle than the static EL expressions.</p...
Accessing php session while using Angular Routing <p>I am using Angular routing and want to access a php session variable in the view. </p> <pre><code>&lt;?php session_start(); //print_r($_SESSION['query']); the variable is available and will print here ?&gt; &lt;script&gt; var x = &lt;?$_SESSION['query']?&gt; ...
<p>You can start session on your page like and create hidden field for session like this</p> <pre><code>&lt;input type="hidden" name="mysession" id="mysession"&gt; </code></pre> <p>and write javascript function some thing like this</p> <pre><code>function Result(){ var marks = 55; document.getElementById("myses...
If I can't take more than one character as character variable, then what is the way to declare grade='A+'? <p>I can declare character A, B, C, D etc as grades. But couldn't declare 'A+'.</p> <p>So, if I can't take more than one character as character variable, then what is the way to declare grade='A+'? </p>
<p>You can use <a href="https://en.wikibooks.org/wiki/C_Programming/Strings" rel="nofollow"><strong>strings</strong></a> <em>(collection of characters with a null terminating character at the end, click on it to see more)</em> instead of characters. You can declare them this way</p> <pre><code>char grade[3] = "B+"; /...
Calling a REST webservice from ReactJS <p>I was trying to call a REST webservice to fetch data from the database and return a JSON object back to the ReactJS app.When I access the URL from the browser it displays the JSON object but when I try to render the data in the table no content is displayed.</p> <p>My sample c...
<p>According to <a href="http://stackoverflow.com/questions/23959912/ajax-cross-origin-request-blocked-the-same-origin-policy-disallows-reading-the">this</a> question JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a differen...
After sorting JSONArray,Custom list view not changed? <p>I am sorting JSONArray and show them in a custom list view, but after sorting the data does not changed in custom list view.</p> <p>Here is my code for fab button to select which sort is to be perform:</p> <pre><code>fab.setOnClickListener(new View.OnClickListe...
<p>Before set the data to Listview, you should sort the data using comparator class in java.</p> <p>you create one Model class with all variable what you want (name,booth_id etc)and store the each object into the ArrayList.</p> <pre><code>Collections.sort(ArrayListObject,new NameComparator()); </code></pre> <p>exam...
How come java.lang.String does not validate encoding? <p>I ran in to something that surprised me a little. When trying to build a string from bytes that are not proper utf-8, the String constructor still gives me a result. No exception is thrown. Example:</p> <pre><code>byte[] x = { (byte) 0xf0, (byte) 0xab }; new Str...
<p>The Java documentation for <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#String-byte:A-java.lang.String-" rel="nofollow">String(byte[], String)</a> says:</p> <blockquote> <p><strong>The behavior</strong> of this constructor when the given bytes are not valid in the given charset <stron...
Email is not coming in Gmail inbox using this php code <p>I am using this code for my contact form in a html website but mail is not coming in Gmail Inbox.</p> <p>Can any one help me i am trying to solve this issue but i don't have any guide.</p> <pre><code>&lt;?php session_cache_limiter( 'nocache' ); $subject = $_RE...
<p>There are some problem in setting the header. And most important is that you need to define the correct and valid Email Id in the <code>From</code> section because google generally used to validate the domain, the mail coming from. </p> <p>If it is not white-listed at google end then it wills end the mail to Spam a...
Editable dropdown in TinyMCE <p>There is a requirement, where it is asked to make the dropdown box editable in TinyMCE........</p> <p><a href="http://i.stack.imgur.com/GxXA2.png" rel="nofollow"><img src="http://i.stack.imgur.com/GxXA2.png" alt="enter image description here"></a></p> <p>Can it be converted in editable...
<p>Hopfully, i am able to achieve the result by using <code>combobox</code> as the type in my custom button.</p> <pre><code>setup: function (editor) { editor.addButton('mybutton', function() { var items= ["8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72"] ...
How to use DATEADD(SQL) in DataView Rowfilter? (C#) <p>I`m making program to display information using DataGridView and ComboBox Selection.</p> <p>In SQL, query is </p> <pre><code>SELECT ListID, ListTitle, ListLastModifyDate WHERE ListLastModifyDate &lt;= DATEADD(MM, -1, GETDATE()) </code></pre> <p>I already built ...
<p>The rules to use when applying a RowFilter are listed in the <a href="https://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.110).aspx" rel="nofollow">Expression</a> property of the DataColumn object.</p> <p>In particular when filtering on a DateTime value you should enclose your Date value...
Can clusterize.js be used with datatables.net? <p>I load a large amount of data into my tables.<br>I am using <a href="https://datatables.net/" rel="nofollow">datatables</a> to help with search, sorting, pagination, etc. With the large amount of data (and styled rows), it can often take a long time to render in the bro...
<p>Nope, long story short - it's not worth the effort</p> <p>Since you need such rich functionality as DataTable provides and infinity-scrolling feature Clusterize provides, consider switching to library that has both of these, such as SlickGrid. Despite tha fact that <a href="https://github.com/mleibman/SlickGrid" re...
File uploading issue in cakephp <p>I am new to Cakephp. I am using cakephp2.8.5 version. I am trying to upload a file from a HTML code but its not uploading any file and form is submitting.</p> <pre><code>View page add.ctp: &lt;form name="add_userform" class="form-horizontal" role="form" accept-charset="utf-8" encty...
<p>You can this plugin to upload image in Cakephp 2.x. It will handle validation errors like file type, file size etc.</p> <p>Plugin Link - <a href="https://github.com/josegonzalez/cakephp-upload/tree/2.x" rel="nofollow">https://github.com/josegonzalez/cakephp-upload/tree/2.x</a></p>
Cordova : how to deploy windows 10 apps <p>I built a <code>cordova windows 10 app</code>. The build works fine and I am able to launch my app on the simulator via <code>Visual Studio 2015</code>.</p> <p>How can i deploy this app for an entreprise? Basically I want to build an <code>appx</code> but I really don't know ...
<p>I have recently entered the dark world of deploying Cordova-based Window 10 apps for enterprise purposes.</p> <p>Firstly, it makes a big difference if you are going to deploy via Windows Store or not. My answer below assumes you are going to use the standard public-facing Windows Store, but you can also go down the...
PostgreSQL - Duplicate table in parts, empty other fields, rename table <p>I'm very new to PostgreSQL or SQL in general, so I don't know whether my question might be simple and stupid – sorry in advance.</p> <p>My situation is the following:</p> <ul> <li>I've got a table with 57 columns and 219 entries </li> <li>I ...
<p>Alternative solution to the <code>create table xxx_2018 as select * from xxx_2017;' is to use</code>create table ... like ...` construct (it creates table only, also gives option for copying constraints etc; does not copies data):</p> <pre><code>create table xxx_2018 like xxx_2017 including all; insert into xxx_201...
Error: method verifyCredentials in interface AccountService cannot be applied to given types <p>I am using the following code in my Twitter Integration App.</p> <pre><code>Twitter.getApiClient(session).getAccountService() .verifyCredentials(true, false, new Callback&lt;User&gt;() { @Overrid...
<p>Although the documentation still specifies two version for the method VerifyCredentials(), one that takes callback as an argument and one that doesn't, still I have faced the same issues.</p> <p>I tried to open the source code in Android Studio but it had only the version without the callback. </p> <p>Here is how...
Using multiple sql commands in a single method C# <p>Scope :School Project using: VS-2010, service based database Experience Level: Beginner-2 months of basic coding only</p> <p>General info: {Inventory,sales, purchases recording} windows (form) application System with service based database.</p> <p>Problem: "In the ...
<p>In your Insert-Statement, there are no quotation marks for Entry3.</p>
Determine how many days a certificate is still valid from within bash script <p>I want to check how many days the certificate of a website is valid from within a bash script which runs on a standard Ubuntu 14.04 server. openssl is available.</p> <p>I already figured out that I can use openssl to get the target date</p...
<p>With GNU <code>date</code>'s <code>%j</code> to get day of the year and arithmetic expansion for subtraction:</p> <pre><code>$ echo $(( $(date -d "$(cut -d= -f2 &lt;(echo 'notAfter=Dec 22 16:37:00 2016 GMT'))" '+%j') - $(date '+%j'))) 73 </code></pre> <ul> <li><p><code>$(date -d "$(cut -d= -f2 &lt;(echo 'notAfter=...
Can PHP command a third party CLI? <p>I want to extend the automation of the PacketETH program CLI using PHP It can be done in GUI however this still means a user has to do it</p> <p>Is it possible to have the packetETH run and a PHP deliver instructions, and then receive results back for manipulation? In a broader se...
<p>You can access the command line from php by using the Php System Program Execution functions. <a href="http://php.net/manual/en/book.exec.php" rel="nofollow">http://php.net/manual/en/book.exec.php</a>. You can try out the exec function. It lets you execute shell commands.</p> <p>To run the packeteth program from ph...
Dropup Bootstrap Toggle Menu when Fixed on Bottom <p>I have a bottom-fixed menu and want the toggle to dropup instead of down. I've tried all the solutions found in stackoverflow (like this one <a href="http://stackoverflow.com/questions/17581352/how-to-get-a-bootstrap-dropdown-submenu-to-dropup">How to get a Bootstrap...
<p>Check this link <a href="https://jsfiddle.net/edz80vw5/" rel="nofollow">https://jsfiddle.net/edz80vw5/</a></p> <pre><code>&lt;nav class="navbar navbar-default navbar-fixed-bottom"&gt; &lt;div class="container"&gt; &lt;div class="navbar-header"&gt; &lt;button type="button" class="navbar-toggle coll...
Change intellij JVM <p>I saw a comment about fixing an issue with the Intellij </p> <p>"The problem should not occur if you switch Java used by the IntelliJ IDEA from OpenJDK bundled with IDEA to Oracle JVM. At least this can work as a workaround."</p> <p>How can I change the JVM in Intellij ? </p>
<p>Set an environment variable to tell IntelliJ what JVM to use for the IDE.</p> <p>Go into Control Panel...System...Advanced System Settings. Click the "Advanced" tab, then click the "Environment Variables" button to edit.</p> <p>Add a new user variable -</p> <p>"IDEA_JDK" for a 32-bit JVM, or "IDEA_JDK_64" for a 6...
Merge records from two tables <p>I have two model <code>Part</code> and <code>DamagedPart</code>. All of them have <code>iid</code> field. </p> <p>I want to get combined ActiveRecord object with data from these two tables. </p> <p>Say, <code>parts</code> table has 10 records:</p> <pre><code>id: 1, iid: 100, d: 0 id...
<p>You need <code>LEFT JOIN</code> and <code>COALESCE</code></p> <pre><code>SELECT p.id, p.iid, COALESCE(dp.d, p.d) AS d FROM parts p LEFT JOIN damaged_parts dp ON p.id = dp.id AND p.iid = dp.iid </code></pre>
Query for column value as column alias of a survey result <p>I am facing a problem in building a query of the following scenario. I am listing tables and values for an example:</p> <h2>Responses Table</h2> <pre><code>Q_ID | Response_ID | answer_col_label | answer_value 10 | 500 | Label_a | 1 11...
<p>Use PIVOT</p> <pre><code>SELECT P.* FROM ( SELECT A.Q_ID, A.Response_ID, A.answer_col_label, B.answers FROM @ResponseTable AS A INNER JOIN @ResultsTable AS B ON A.Q_ID = B.Q_ID AND A.Response_ID = B.Response_ID ) AS S PIVOT ( MAX(answers) FOR answer_col_label IN ([Label_a], ...
TypeScript build error when assigning double dimensional array in VS2015 <p>I am getting build errors in typescript project in VS2015. The application works fine in browser, but now I cannot publish due to these build errors.</p> <p><code>export var AddedFields: Array&lt;Array&lt;Field&gt;[]&gt;[];</code></p> <p><cod...
<p>Both the <code>Array</code> and <code>[]</code> notations can indeed be used to define an array type in Typescript, but by using both at the same time, you have effectively declared a 4-dimensional array.</p> <p>If you stick to one type of notation, it should be, for the <code>Array</code> notation:</p> <pre><code...
how to pass variables from r program to mysql function <p>I am new to R Programming and MySQL. I have a requirement where I need to read the variables from R Programming and need to pass those as inputs to a function in MySQL. Can someone please help me in this regard?</p> <pre><code>options(echo=FALSE) args &lt;- c...
<p>If you want to include the <em>R variables</em> called <code>start.date</code> and <code>end.date</code>, then you can use <code>paste</code> to build the query string:</p> <pre><code>query &lt;- paste0("SELECT COMPUTE_WEEKS(", start.date, ", ", end.date, ") FROM DUAL;") mydb &lt;- dbConnect(mydb, xxxx) rs &lt;- db...
How to capture event when jar's command prompt is closed using X button? <p>I have multiple jars that communicate to single app to provide their responses. I need to handle a scenario when command prompts are closed using X button at the top. All apps are written in JAVA so java code is needed.</p> <p>I have already a...
<p>It is impossible in Java. Different OS have different solution for that.</p> <p>Ask about your OS in related site.</p>
How to echo values from a PHP string into different iterations of a loop <p>I have creted a tool in WP admin that searches the custom post type ($apartments), returns a list of $apartments with their post meta, allows the user to check a checkbox next to selected posts and finally email those selected posts to the clie...
<p>So you want to know how to automate the process ? right ?</p> <p>First, you need to store the list of apartments to an array. Assuming you know how to get the list of apartments from the DB via MySQL query, I'll skip to the next step.</p> <pre><code>&lt;?php for($i=0; $i&lt;$size_of_apartments; $i++) {?&gt; &lt;...
How to call method and return its value with UnityPlayer.UnitySendMessage <p>How can I call this C# method from Java then return the string value?</p> <pre><code>public string getTest () { return "test"; } </code></pre> <p>This is what I've tried:</p> <pre><code>String str = UnityPlayer.UnitySendMessage("ProfileSave...
<p><code>UnityPlayer.UnitySendMessage</code> is a <code>void</code> function and does not return a value. Take a look at the <code>UnitySendMessageExtension</code> function implementation below. It is similar to <a href="http://stackoverflow.com/a/39954620/3785314">turnipinindia's</a> answer but it returns a value. It ...
Return unique row identifier from an SQL query <p>I know this question may sound as a repetition. However, even though I found similar questions, I got nothing precise. I don't want to remove any duplicate values returned from my query. <strong>What I want is to get a unique identifier for example a serial number for a...
<p>If you don't care about the ordering:</p> <pre><code>Select ROW_NUMBER() over (order by (Select 1)) as SlNo ,* from table </code></pre> <p>OR</p> <p>Handle it in #temp table:</p> <pre><code>Select * into #TempTable from SourceTable ALTER TABLE tempdb.dbo.#TempTable ADD SlNo INT IDENTITY(1,1) ; Select * from #Te...
Why does TypeScipt show me error, when I change DOM-element via getElementsByClassName(), but application works anyway? <p>I have angular2 application. Due to some problems I forced to use inside method of component such code (I understand that it's over than bad, but ...):|</p> <pre><code>let confirmWindowDOM = docum...
<p><code>getElementsByClassName</code> returns collection of <code>Element</code>. You can use <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions" rel="nofollow">type assertion</a> in order to inform typescript that it is actually <code>HTMLElement</code>:</p> <pre><code>let confirm...