input
stringlengths
51
42.3k
output
stringlengths
18
55k
apply, mapply? I`m trying to calculate weighted moving average in R <p>I have two columns/vectors and I´d like to get the weighted average. I found this but I cannot chanche lamda to a colum/vector.</p> <pre><code>wma.func = function(rets, lambda) { sig.p = rets[1] sig.s = vapply(rets, function(r) sig.p &lt;&lt;-...
<p>Here's a <code>data.table</code> way to do that:</p> <pre><code>library("data.table") set.seed(4444) df &lt;- data.frame(value = round(runif(10, 1 , 1000), 0), weight = round(runif(10, 0.1, 0.99), 2)) setDT(df) df[, new := shift(x = value, n = 1, type = "lag") * weight + value * (1 - weight)] </co...
Preventing X numbers from select <p>I have a script running to show a number in the select list options when the user check one specific value it will display a number refering to how much times he can pay his bill.</p> <h1>Note this code:</h1> <pre><code>var tabelaParcelas = [2,3,4,6,8,10,12]; $(document).ready(fun...
<pre><code>var tabelaParcelas = [2,3,4,6,8,10,12]; $(document).ready(function(){ update(); }); $('input[type=checkbox]').click(function(){ update(); }) function update(){ var list = $('#instNum2'); // use selector only once whenever possible for better performance // clear any existing options from the ...
is there a parameter accelerates Sybase insertion <p>I am using Sybase ASE, and for a table, in which I will save results calculated by Java. This table has 10 columns, one column type is <code>INT</code> value (but not an ID column), and other 9 columns are all <code>VARCHAR(50)</code> type. </p> <p>There's no index ...
<p>Whether the DB server is local or not may indeed make a significant difference. Until you cut out this factor, comparison with a local DB makes little sense. </p> <p>But that aside, there are many aspects that affect insert performance in ASE. First off, make sure the overall memory configuration (e.g. data cache ...
Github logged in user's public activities <p>The Github UI/UX has changed entirely just recently. In the old UI of github, you can view your public activities when logged in but in the new UI, I don't seem to find a link where I can click to view my public activities.<br> But when I am following someone, I can view the...
<p>You only have the Overview section now, with dates.<br> For instance:</p> <p><a href="https://github.com/VonC?tab=overview&amp;from=2015-12-01&amp;to=2015-12-31" rel="nofollow">https://github.com/VonC?tab=overview&amp;from=2015-12-01&amp;to=2015-12-31</a></p> <p>(replace <code>VonC</code> by your GitHub account)</...
Google Tango Point Cloud with No Data <p>After downloading the latest C examples from the <a href="https://github.com/googlesamples/tango-examples-c" rel="nofollow">gitrepo</a>, I compiled the point cloud example. </p> <p>Upon build error, I needed to update the code using the (supposedly) supported TangoPointCloud ob...
<p>I just update the tango-examples-c and the example compile and run without problems. Is the example project or some modified version of it?</p> <p>If you are going from <code>TangoXYZijk</code> to <code>TangoPointCloud</code>, you need to replace TangoSupport but also the TangoService callback <code>TangoService_co...
Deploy multiple war files under the same root path on tomcat <p>I'm trying to deploy multiple spring war files with tomcat maven plugin each with a shared root path between them. </p> <p>For example when I deploy now each app can be accessed by:</p> <ul> <li>localhost:8080/app1</li> <li>localhost:8080/app2</li> </ul>...
<p>You can add <code>/apps</code> to each application's context path.</p>
JAVA Intellij Coding <pre><code>String marital = (String) JOptionPane.showInputDialog("Are you a single or married joint filer?"); while ((marital.length() &gt;= 6) &amp;&amp; (marital.length() &lt;= 7)) { System.out.println("You are " + marital + " thank you."); if (marital.length() &gt; 7) { break; ...
<p>Just put <code>break;</code> after print, just like that, no <code>if</code> or anything. Right now you have your <code>break</code> inside <code>if</code>, that checks condition that will for sure fail, because if there was a possiblity that <code>marital.length &gt; 7</code> then it wouldn't even enter this while ...
What exactly is SQL Server stuck on? <p>I have a long running query in SQL Server 2014. It's a stored procedure invocation. In Activity Monitor, it shows up. The details view provides the currently running SQL, which is the EXEC statement. The command column says it's an <code>UPDATE</code>.</p> <p>The stored procedur...
<p>Too long to comment and thought it doesn't answer you question, it may give you some places to start.</p> <ol> <li>Kill the proc, then use SQL Profiler to trace the proc while you execute it. <strong>This is resource intensive though</strong> and option 2 is better IMHO.</li> <li>Use Adam <a href="http://sqlblog.co...
Can upcasting a shared_ptr<T> to a shared_ptr<void> lead to undefined behaviour? <p>Shared pointers are quite smart. They remember the type they where first constructed with in order to delete them correctly. Take that for example:</p> <pre><code>struct A { virtual void test() = 0; }; struct B : A { void test() overri...
<p>The code is correct.</p> <p><code>std::shared_ptr</code> internally saves the real pointer and the real deleter as they are in the constructor, so no matter how you downcast it, as long as the downcast is valid the deleter will be right.</p> <p>The <code>shared_ptr</code> actually does not hold a pointer to the ob...
Android Fragments Communication <p>I am trying to implement a simple communication between 2 Fragments in an Activity. The first fragment has a button that when pressed is supposed to send the current time in milliseconds to the second fragment. The second fragment displays this at a Textview. Well I just don't what I ...
<p>I think the problem is you are using the wrong onAttach method so listener is null. See this answer <a href="http://stackoverflow.com/a/32678989/2478736">http://stackoverflow.com/a/32678989/2478736</a></p>
trigger on scroll past DOM element <p>I am trying to trigger actions when the user scrolls into various DOM elements (I need this to be responsive for various screen sizes). I first get the locations of the respective elements with <code>offset().top</code> then I calculate the location of the scroll with <code>scrollT...
<p>On scroll (load and resize) calculate the <code>.top</code> position of every <code>data-fadein</code> elements.<br> <code>filter()</code> then returning the elements which top position is less than the window height - and add on that elements the desired class.</p> <p><div class="snippet" data-lang="js" data-hide=...
Linked List Type Error <p>I am a beginner and I started learning python programming and I am stuck with an error. I get a type error</p> <pre><code>class Node: def __init__(self): self.data = None self.next = Node def setData(self,data) self.data = data def getData(self): ...
<p>Looks like you've got a typo right here:</p> <pre><code>class Node: def __init__(self): self.data = None self.next = Node </code></pre> <p>That should be <code>self.next = None</code>.</p> <p>The reason you're getting <code>getNext() missing 1 required positional argument</code> is because ev...
TableView and and Button (Crash) <p>I'm having a table view that contains this prepareForSegue function:</p> <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let upcoming: CategoryDeviceViewController = segue.destination as! CategoryDeviceViewController let myindexpath = self.Main...
<p>As per your segues and crash logs, here is you are missing i guess. Try to identify the destination with your segue identifiers:</p> <pre><code>func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "ShowCategoryDevice" { let upcoming: CategoryDeviceViewController = segue.dest...
Multiple SSIS package Execution in a single package <p>Hi I'm creating a single package to load all the packages using execute package task in my project which are encrypted with the password, but package has been failed and I have given the password to all packages in execute package task. Is there any solution to run...
<p>Few things to note:</p> <ol> <li>The ProjectLevel protection level should same with the all the packages available under the project.</li> </ol> <p>Ex: If Project X has packages xx and yy. All should have the same protection level for example EncryptAllWithPassword.</p> <ol start="2"> <li>While referencing the ch...
Python: Json Data into Class Instance varaibles <p>I am trying to create a class called Movie. I have declared the instance variables. I am calling the OMDB API and I would like to store assign the variables to that. But that doesn't seem to be working. Even when I print json_Data, it doesn't print anything. Can anyone...
<pre><code>class Movie(object): """ Class provides a structure to store Movie information """ def __init__(self, imdb_id, title = None, release_year = None, rating = None, run_time = None, genre = None, director = None, actors = None, plot = None, awards = None, poster_image = None, imdb_votes = None, youtube_traile...
How to detect number dialing events in broadcastreceiver in android <p>How to detect number dialing events in Broad Cast Receiver in android?</p>
<p>Create below step in code.</p> <p>Create service. Implement View.OnKeyListener interface in service</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { // Do Code here } else if(keyCode == KeyEvent.KEYCODE_0) {} else if(keyCode ==...
use same table id in different databases <p>Let's say I have two databases, one for dev, one for maintenance for example, both databases have same tables, someone add a record on Table1 (which is a dictionary table) in database dev but he forgot to insert it on Table1 in maintenance so ids becomes not sincronizad and w...
<p>The best solution would be to avoid using the identity as the primary key. Identities make good clustering keys, but not necessarily a primary key.</p> <p>Otherwise you could schedule a database refresh from Prod to Dev but you'd be wiping out all the work in Dev so I'd only do that once a month.</p> <p>Or an SSIS...
Issue with forwarding runtime QML output to the UI <p>I'm working on <a href="https://github.com/qCring/QuickVtk" rel="nofollow">this open source project</a>, which basically is a live QML interpreter. Since a user's main activity would be to write QML code, I'd like to embed all logs and warnings and such in the appli...
<p>You let the message handler re-enter. You should not:</p> <pre><code>class Instance { QThreadStorage&lt;bool&gt; handlerEntered; ... }; QThreadStorage&lt;bool&gt; Instance::handlerEntered; void Instance::HandleMessage( QtMsgType type, const QMessageLogContext&amp; context, const QString&amp; msg) { if...
Need 2 clicks to activate button <p>I'm trying to earn Javascript, specifically how to add onclick events, and manipulate the DOM.</p> <p>I set up a real world example on <a href="http://codepen.io/Jpburns/full/jrrdpE/" rel="nofollow">Codepen</a>.</p> <p>Squish your browser down and you get the classic "hamburger" me...
<p>The initial height of the menu is <em>computed</em> as zero, but the initial value of the inline style's height property is an empty string (because you haven't set it).</p> <p>So when you test:</p> <blockquote> <pre><code>if (menu.style.height==="0px"){ </code></pre> </blockquote> <p>the first time, you hit <cod...
Parse String array into Int Matrix <pre><code> string[] words; numOfMatrix = int.Parse(fileIn.ReadLine()); nameOfMatrix1 = fileIn.ReadLine(); words = fileIn.ReadLine().Split(' '); matrix1H = int.Parse(words[0]); matrix1W = int.Parse(words[1]); matrix1 = new int[matrix1H + 1, matrix1W + 1]; for (int i = ...
<p>The issue is reading the next line from inside of your inner loop. You need to read the line on a row instead of per cell.</p> <pre><code>var numOfMatrix = int.Parse(fileIn.ReadLine().Trim()); var matrices = new int[numOfMatrix][,]; for (var matrixNumber = 0; matrixNumber &lt; numOfMatrix; matrixNumber++) { va...
Parse json array using perl <p>I have written a test script to perform certain functions. Script works as expected. Currently,The arguments required to run the script are passed from the command line using <code>Getopt::Long</code>.I would like to move the command line arguments to a json file. The Endpoint ip will s...
<p>The first question is about a suitable design for the JSON file. Hashes can serve well here while the arrayref doesn't seem needed at all. The endpoint values can be the keys, with their values being hashrefs with key-related information. Keep the endpoint value in its hashref as well, if you wish.</p> <p>The key <...
Removed Framework crashing app <p>I removed a framework from my app, removed references to it yet when I try to boot my app it succeeds but crashes immiediately stating: </p> <pre><code>Library not loaded: @rpath/PaperOnboarding.framework/PaperOnboarding Referenced from: /Users/Evan/Library/Developer/CoreSimulator/D...
<p>Clear the data in <code>~/Library/Developer/Xcode/DerivedData</code> and then run the application again.</p>
How to return intersecting array in ruby and preserve up/lowercase? <p>I want to create a function that returns a list of array contained in another list of array. This is what I came up with:</p> <pre><code>def coffee(arr) acceptable_coffee = ["dark", "blend", "handsome"] good_coffee = acceptable_coffee &amp; arr...
<p>This'll get the intersection, but id doesn't exactly use the funky <code>&amp;</code> operator or sets.</p> <pre><code>def coffee(rest) acceptable_coffee = ["dark", "blend", "handsome"] rest.select { |name| acceptable_coffee.include? name.downcase } end </code></pre>
SQL WHERE Field1 >= 1 OR Field2 >= 1 Allowing (null) Values <p>I'm trying to query a database table and have the following WHERE clause on my query:</p> <pre><code>WHERE (QTY_ON_HAND &gt;= 1 OR QTY_ON_ORDER &gt;= 1); </code></pre> <p>I am wanting to return all results who have either quantity on hand OR quantity on o...
<p><code>AND</code> operator has precedence over <code>OR</code>, so you need to use parenthesis:</p> <pre><code>WHERE ( CHARGE_CODE = 'RETAIL' OR CHARGE_CODE = 'RETAILSN' ) AND LOCATION = 100 AND SPA_ITEM_ID LIKE '1%' AND ( QTY_ON_HAND &gt;= 1 OR QTY_ON_ORDER &gt;= 1 ) </code></pre> <p>Better yet:</p> ...
Generate a filtered subset of repeated permutations of an array of objects (with given length k) <p>I'm new to Ruby. I need to generate all combinations of objects based on a length. </p> <p>For example, <code>array = [obj1, obj2, obj3]</code>, <code>length = 2</code>, then combinations are:</p> <pre><code>[ [obj1,...
<p>If all you need is to remove any pairs that are the same obj, you can simply use the <a href="http://ruby-doc.org/core-2.3.0/Array.html#method-i-permutation" rel="nofollow"><code>permutation</code></a> method.</p> <pre><code>arr = [1,2,3] arr.permutation(2).to_a #=&gt; [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3,...
MS Excel User forms vba <p>Hi "im kind of new with excel VBA. I'm trying to do something simple as creating a USERFORM1 in VBA and showing it when workbook opens. I've looked it up online but for some reason something is not working.</p> <p>I open excel, go to developer, create a userform1, add some stuff to it. </p> ...
<p>In trust center I didn't have macros enabled. I did that and everything seems to work perfectly. </p>
Xcode - Bind textfield to element of a Swift dictionary <p>I did bind a textfield to a Swift dictionary value via interface builder. In the textfield the correct value is pulled from the dictionary and displayed in the textfield.</p> <p>When I change the value of the element in the dict via </p> <pre><code>myDict["Te...
<p>So basically, it won't work. Bindings work by using the KVO/KVN system, which sends out notifications when Obj-C objects change their value. It's very clever, but they didn't port it to Swift. To add to that, dictionaries in Swift are value types.</p> <p>The "solution" is to make sure the thing you bind to has KVO....
Powershell to get private IP of specific VM <p>I am trying to get private IP of specific VM's. I have this code which is working</p> <pre><code>$vms = get-azurermvm -ResourceGroupName abc $nics = get-azurermnetworkinterface -ResourceGroupName abc| where VirtualMachine -NE $null #skip Nics with no VM foreach($nic in ...
<p>For getting private IP using powershell you can use this command-</p> <pre><code>$IP = (Get-AzureRmNetworkInterface -Name $VMName -ResourceGroupName $RGName).IpConfigurations.PrivateIpAddress </code></pre> <p>I hope this fits in what you are trying to achieve.</p>
How to measure percentage greater than an aggregation in tableau <p>Let's consider this :</p> <pre><code>Student | Score S1 87 S2 75 S3 52 </code></pre> <p>I want to create a pie chart or horizontal chart showing what percentage of students scored more than the average score.</p> <p>Acc...
<p>This can be achieved using a <strong>window calculation</strong>. </p> <p>Create a calculated field called 'Above Average' with the calculation </p> <pre><code>IF AVG([Score]) &gt; WINDOW_AVG(AVG([Score])) THEN 1 ELSE 0 END </code></pre> <p>Now you can filter out your dataset to only use values where 'Above Avera...
How to Transfer/synchronize content between windows and linux remote server? <p>How can I recursively copy a folder from Windows to remote linux server using jsch sftp?</p> <p>I have already tried using sftpchannel.put(src,dest) but it transfers only files. I also tried iterating over the file list to look for a direc...
<p>Jsch doesn't have an SFTP operation to recursively transfer a directory from local to remote (or from remote to local either). To recursively transfer a directory using Jsch, you will need to write code to construct the list of files and directories to be transferred, then issue <a href="http://epaul.github.io/jsch-...
Using a form control as a field selector in SQL query <p>I am attempting to build a form ,called UI, that users will select a dimension parameter from a combobox "cmbFilter" and then add a +/- tolerance in a text box "txtTolerance". After selection a part number from a list this should return results for similar part n...
<p>Try this, using a dlookup instead of SELECT to return the values you want in the BETWEEN statement. I believe the dlookup should return the value for whatever field you select in the combo box. Also, I've simplified to remove the forms!UI statement with a "me" assuming you are running code from the same form. Let...
Web API 2 Service - how to return error message when model object expected? <p>So I have created a <code>GetValues</code> function in my controller to return the instance of a <code>demoModel</code> which is a complex model class. </p> <p>This works fine when returning a successful data set. However if something doesn...
<p>Just return a Badrequest:</p> <pre><code>.. If Not dm.dataisvalid then return BadRequest("Your error message") End If Return Ok(dm) 'need to wrap this with Ok </code></pre>
Unity - Collider2D not considered in collision check anymore after disabling and enabling <p>I've got a player, and a shield around him. When a shield is present, it blocks gun projectiles. My CollisionEnter code is </p> <pre><code>if ((col.collider.gameObject.tag == "hurt") &amp;&amp; (col.collider.IsTouching(shield...
<p>I tried it a few more times and it really seems to be fixed - So, for some reason, the object that I was asking about in IsTouching needed a RIGIDBODY. I still don't understand it, because if I start the game with the shield on, it works flawlessly! Nonetheless, this fixed it!</p> <p>Thanks everyone!</p>
Hide iOS datepicker on mobile browser <p>I have a webpage where I am showing the jQuery datepicker on desktop browsers. However on iOS, the native iOS datepicker shows along with the jQuery datepicker</p> <p>For consistency's sake we want to go with the jQuery datepicker throughout, but that means we'll have to hide t...
<p>Change the input to</p> <pre><code>type="text" </code></pre> <p>To prevent default OS behaviour and validate the input on server side.</p> <p>Another solution might be adding to the input</p> <pre><code>readonly="true" </code></pre>
Warning: mysqli_stmt_bind_param: Number of elements in type definition string doesn't match number of bind variables <p>I am getting the message “</p> <blockquote> <p>Warning: mysqli_stmt_bind_param: Number of elements in type definition string doesn't match number of bind variables in…</p> </blockquote> <p>in ...
<p>Because this:</p> <pre><code>mysqli_stmt_bind_param($stmt1, "ss", $whereVtest1); ^^ </code></pre> <p>MySQLi will <strong>NOT</strong> take your CSV data in <code>$whereVtest1</code> and split it up for you. You have to EXPLICITLY provide a <em>SINGLE</em> value for EVERY ...
How to make a custom relational operator in Swift <p>I am working with Doubles that have a range of <code>0..&lt;360</code>. I want to create a switch statement that will have 8 cases. A case for 0, 90, 180 and 270, and a case for the values in between. It seems that the half-open operator will not satisfy what I'm try...
<p>Your switch is unnecessarily complicated. See if this works for you:</p> <pre><code>let value: Double = 180 switch value { case 0: print("exactly 0") case 0..&lt;90: print("less than 90") case 90: print("exactly 90") case 90..&lt;180: print("less than 180") case ...
Validate XML with multiple namespace in Java <p>I am trying to validate a XML document that uses multiple namespaces. I want to embed tags of the secondary namespace within a document of the primary namespace. The main/primary namespace does not "know" of the extension/secondary namespace.</p> <p><strong>test.xml</str...
<p>Your <code>main.xsd</code> is explicit in what is allowed in the <code>book</code> element. If you want to allow any additional element, you'll need to state that in the <code>main.xsd</code>. After which you can add any extension XSDs you want. see <a href="https://www.w3.org/TR/xmlschema-0/#any" rel="nofollow">...
The proper way to delete rows from UITableView and update array from NSUserDefaults in Swift / iOS <p>What is the proper way to delete rows from <code>UITableView</code> and update array from NSUserDefaults?</p> <p>In the following example I'm reading an array from <code>NSUserDefaults</code>and feeding a <code>UITabl...
<p>Basically it's correct, but you should only save in user defaults if something has been deleted.</p> <pre><code>if editingStyle == UITableViewCellEditingStyle.Delete { array.removeAtIndex(indexPath.row) tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) let userDefaults = NSUser...
Perl + Possibility of mutiple ALRM signals <p><strong>Scenario :</strong> Parent process shall spawn N worker children to load data to stage tables , and Parent frequently (every 15mins) invokes a stored procedure to move date from stage -> core</p> <p><strong>Idea :</strong> planning to setup an <strong>'$SIG{ALRM}'<...
<p>You're asking what happens if you have</p> <pre><code>$SIG{ALRM} = sub { alarm(15*60); call_stored_proc(); }; alarm(15*60); </code></pre> <p>and <code>call_stored_proc</code> takes longer than 15 minutes. Why didn't you just try it?</p> <pre><code>perl -e' use feature qw( say ); my $slow = 2; my ...
How to configure/add additional locale to JasperReports Server 6.3.0? <p>I have added additional locale according to the Server Administration Guide, i.e. <a href="http://i.stack.imgur.com/J8Z2r.png" rel="nofollow"><img src="http://i.stack.imgur.com/J8Z2r.png" alt="applicationContext-security.xml"></a></p> <p>I've res...
<p>You missed probably the chapters before this settings description, called <strong>Creating a locale</strong>.</p> <p>First you need to create </p> <ul> <li>language properties files for several parts of JasperServer and translate all JasperServer texts</li> <li>create a resource bundle out of those properties</li>...
How to query JSON objects <p>I'm working with a json file that has the following data structure.</p> <pre><code>{"students":[ {"Name":"Wale", "state":"Lagos", "age":20, "hobby":"dancing"}, {"Name":"Ebere", "state":"Enugu", "age":18, "hobby":"eating"}, {"Name":"Musa", "state":"Kano", "age":24, "hobby":"swim...
<p>If you are looking for a special purpose language of its own, take a look at <a href="http://jsoniq.org/" rel="nofollow">JSONiq</a>, a query language specifically designed for JSON data model. Here's a simple example taken from <a href="https://en.wikipedia.org/wiki/JSONiq#Examples" rel="nofollow">Wikipedia</a>:</p>...
How can I prevent error in order to complete the loop? <p>I am trying to fit the best distribution for three variables which are gathered via .csv file. I tried to evaluate with provided distributions in r. Then I will select the smallest one as a best fitted distribution. However, I cannot complete the loop because so...
<p>If you just want to skip some code when the error occurs you can use the <code>try()</code> function. Everything that is inside the function won't break the code when an error occurs.</p> <p>In your example, just substitute:</p> <p><code>aa &lt;- fitdistr(xx1[,k], distributions[i])$loglik</code></p> <p>for</p> <...
div inside echo function <p>i have this</p> <pre><code>&lt;?php } // if ( $coupons ) do_action('st_after_coupon_listings'); echo wpcoupon_store()-&gt;get_extra_info(); wp_reset_postdata(); ?&gt; </code></pre> <p>and i want to <code>get_extra_info()</code> inside of <...
<p>Yes, there is a syntax error, you missed a quote<code>"</code> replace the bottom code with</p> <pre><code>echo '&lt;div class="mydiv"&gt;'; echo wpcoupon_store()-&gt;get_extra_info(); echo '&lt;/div&gt;'; </code></pre> <p>or if you wish to keep the outer quotes constant you could use</p> <pre><code>echo "&lt;div...
MATLAB: Extracting elements periodically <p>I'd like to extract elements from a vector using the <code>:</code>-operator, but periodically. As an example, say <code>a={1,2,3, ..., 10}</code> and that I would like to extract elements in steps of 2, changing the reference. Then I would like to get</p> <pre><code>ref 1: ...
<p>You can build the index using a modulo operation: <code>mod(...-1, numel(a))+1</code>. Those <code>-1</code> and <code>+1</code> are needed so the resulting index is 1-based (not 0-based).</p> <pre><code>a = [1 2 3 4 5 6 7 8 9 10]; % vector to be indexed ref = 3; % first value for index step = 2; % step for index i...
How to convert message body to pojo in AggregationStrategy <p>I've got a route (camel 2.17.3) that uses the enrich DSL to call into a rest service and aggregate results into the message body. I'm running into problems with serialization, though. Here is what I'm trying. My route looks like this:</p> <pre><code>rest("m...
<p>Ok I ended up working through this when I realized that I could just enrich a sub-route that did the unmarshall call, and then aggregate that ...</p> <pre><code>from("direct:StepA") .removeHeader("CamelHttpQuery") .removeHeader("CamelHttpRawQuery") .enrich("direct:StepAEnricher", new MyAggre...
Oracle MapViewer installation errors <p>Today I installed Oracle EE 11g for Spatial and MapViewer use. I downloaded <a href="http://www.oracle.com/technetwork/middleware/mapviewer/downloads/mv-downloads-archive-2173414.html" rel="nofollow">http://www.oracle.com/technetwork/middleware/mapviewer/downloads/mv-downloads-ar...
<p>I guess the problem is that you have installed Java 8 but the Glassfish3 included in the package only runs properly with Java 7.</p> <p>You should install Java 7 and I guess you have to update your JAVA_HOME setting, but I can't say exactly where because I'm not sure which operating system you are using.</p>
Change color of href links based on their domain names in css <p>I would like to give different color to different external links using just CSS.</p> <p>For example, we have few external links:</p> <pre><code>&lt;a href="http://stackoverflow.com"&gt;StackOverflow&lt;/a&gt; &lt;a href="http://example.edu"&gt;home page...
<p>You can use an <code>attr</code> selector like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>a[href$=".com"] { color: red; } a[href$=".edu"] { color: pu...
VBA issue - loop through every worksheet <p>I have a macro with a loop logic that I copied off of another stackoverflow/ms support page, but it doesn't seem to work.</p> <p>I am not experienced with VBA so I am having trouble figuring out why the 'loop through all worksheets' part isn't working.</p> <p>Can anyone ple...
<p>As per my comment:</p> <p>You have not assigned any of the range objects to a parent sheet so it only works on the active sheet. Just because you are looping does not automatically assign the sheet to those ranges. You will need to put <code>Current.</code> in front of ALL Range Objects.</p> <p>The outer loop was ...
String from backend should contain emoji but is rendered as accented letters <p>I have an issue receiving a string from a PHP backend into my iOS app. The string I receive looks like this:</p> <blockquote> <p>Test ððððð</p> </blockquote> <p>Those special characters should be smileys. Now I checked with this en...
<p>There's probably nothing wrong with your Foundation app (which, by the way, natively supports UTF-8 &amp; UTF-16 very, very well).</p> <hr> <h3>To answer your last question:</h3> <blockquote> <p>I'm kind of baffled what the source string is encoded like.</p> </blockquote> <p>If you crack open that string and t...
MongoDB Nested RunCommand <p>I have a collection called "stops" that stores some coordinate info. I used MongoDB 2dsphere index for searching places. For example, I want to query all the stops around a certain position using <code>db.runCommand</code>:</p> <p><code>db.runCommand({ geoNear: "stops", near: { typ...
<p>Use <code>aggregate</code> instead of <code>runCommand</code>. It would be like:</p> <pre><code>db.stops.aggregate([{ $geoNear: { near: { type: "Point", coordinates: [-123.115115, 49.209659] }, spherical: true, minDistance: 0, maxDistance: 200, distanceField: 'someDistanc...
jQuery - getting incorrect ID from click event <p>See example: <a href="https://jsfiddle.net/DTcHh/25321/" rel="nofollow">https://jsfiddle.net/DTcHh/25321/</a></p> <p>You can see 3 buttons, each button has <code>data-entry-id</code> attribute.</p> <pre><code> &lt;button data-toggle="modal" data-target="#edit" data-e...
<p>Do not use <code>data-*</code> with <code>.data()</code> and <code>jQuery.attr</code> together, use either of them, both are different.</p> <p><code>jQuery.data()</code> does not manipulate <code>attribute</code> and vice-versa</p> <pre class="lang-js prettyprint-override"><code> $(function() { $('#edit').on...
R Plotly Deselect trace by default <p>I am ussing R Plotly and have a line of the form:</p> <pre><code>add_trace(y = meanRank, x = DateOnly, data = timeSeriesDF, name = "Daily Value", text = hoverText, hoverinfo = "text", showlegend = TRUE) </code></pre> <p>It works fine. However, I want this trace to be "unselected...
<p>You could add <code>visible = "legendonly"</code>: </p> <pre><code>library(plotly) economics %&gt;% transform(rate = unemploy / pop) %&gt;% plot_ly(x = date, y = rate) %&gt;% loess(rate ~ as.numeric(date), data = .) %&gt;% broom::augment() %&gt;% add_trace(y = .fitted, name = "foo", visible = "legendonly") </c...
Simplify ResourceHandlerRegistry.addResourceHandler(..)? <p>Every time I want to use ResourceHandlerRegistry.addResourceHandler(..) to tell Spring a certain directory is resource, I need to specify a path for the handler and a path for resource location, for instance.</p> <pre><code>registry.addResourceHandler("/javas...
<p>Every directory is a directory in spring. To exclusively specify resource folder you have to have this configuration. Otherwise for all resource requests spring will start finding out controller mapping.</p>
Finding the most common strings in SQLite <p>I want to find the most commonly occurring string from two relations in sqlite. However, I can't use a natural join operator as the strings have the same field name in the schema for two relations I need to operate on. </p> <p>Let's say I have tables with the following valu...
<p>You can prefix a field with the table name or you can add an alias to a specific field to disambiguate it -- but I don't think you need to do anything like that to solve this problem. I would do something like this:</p> <pre><code>SELECT names, count(*) FROM (SELECT names FROM x UNION ALL SELECT nam...
How do I use node's mysql library over ssh (on Mac)? After googling, I'm still getting "channel 3: open failed: connect failed: Connection refused" <p>Starting from scratch, I googled how to connect to a mysql database over ssh using node.js and the mysql library, and I came across this:</p> <p><a href="http://stackov...
<p>FWIW tunneling mysql over ssh can be accomplished in-process with the <a href="https://github.com/sidorares/node-mysql2" rel="nofollow"><code>mysql2</code></a> and <a href="https://github.com/mscdex/ssh2" rel="nofollow"><code>ssh2</code></a> modules. For example:</p> <pre><code>var mysql = require('mysql2'); var Cl...
Arduino Mega2560 can't be programmed repeatedly using avrdude <p>I have a sketch for a mega2560 board that I can upload successfully using the Arduino IDE using the upload button but I would prefer to use a script using avrdude. The only problem is if I try to run avrdude more than once to flash the board it get's a st...
<p>Verbose compilation and upload can be enabled in Arduino IDE Settings:</p> <pre><code>File-&gt;Preferences-&gt;Show verbose output during: [] compilation [x] upload. </code></pre> <p>It will show complete commands used for upload and the <code>avrdude</code> should be same or you can use the same <code>avrdude.e...
How can I route Observable values to different Subscribers? <p>This is all just pseudo code...</p> <p>Ok here is my scenario, I have an incoming data stream that gets parsed into packets.</p> <p>I have an <code>IObservable&lt;Packets&gt; Packets</code></p> <p>Each packet has a Packet ID, i.e. 1, 2, 3, 4</p> <p>I wa...
<p>I would suggest looking at <code>GroupBy</code> and then checking if there is a performance pay off. I assume there is, but is it significant? </p> <pre><code>Packets.GroupBy(p=&gt;p.Id) </code></pre> <p>Example code with tests on how to use <code>GroupBy</code> as a type of router</p> <pre><code>var scheduler = ...
pyFFTW doesn't find libfftw3l.so while import <p>In my Raspbian system I have succesfully installed pyFFTW, but there is a problem while import package.</p> <pre><code> import pyfftw File "/usr/local/lib/python3.4/dist-packages/pyfftw/__init__.py", line 16, in &lt;module&gt; from .pyfftw import ( ImportError: ...
<p>The problem was with PYTHONPATH.</p> <p>To check if the file is somewhere at the disk:</p> <pre><code>$ sudo file / -name libfftw3l.so.3 /home/pi/bin/fftw-3.3.5/.libs/libfftw3.so.3 /usr/lib/arm-linux-gnueabihf/libfftw3.so.3 /usr/local/lib/libfftw3.so.3 </code></pre> <p>And add a line before import pyfftw (see <a ...
Best way to split in Javascript <p>I have a name in this format <code>Doe, John</code>. What is the <strong>BEST</strong> way to change that into <code>John Doe</code> using javascript? would it be using the split function?</p>
<p>Fast coding:</p> <pre><code>"Doe, John".split(", ").reverse().join(" ") </code></pre>
Call an office 365 authenticaed web api from a sharepoint page javascript <p>I have a scenario that I think should be fairly simple, yet I'm not finding a solution and wondering if someone can point me in the right direction.</p> <p><strong>The setup:</strong></p> <p>1) SharePoint online website (user must be authent...
<p>Normally, if we call the resource which protected by Azure AD, we need to authorize the app via OAuth 2.0. </p> <p>Were you able to put a hidden iframe in the SharePoint online page? If it is possible, then we can use the Azure AD implicit flow get the token through iframe, and we can call the REST which protected ...
Angular sorting and ng-repeat <p>I'm working on reverse-engineering an Angular app that read data from a google sheet.</p> <p>What I'm trying to do is create an array of "keys" using the unique values in the last column of the sheet that all contain rows of the source table. I then want to display on the page the key ...
<p>Declare all your usable variables as a $scope attributes, to make it visible for the controller in <code>ng-repeat='key in keyAry'</code> and in <code>row in keySort.key</code></p> <pre><code> ... // get the keys $scope.keyAry = Object.keys(keySort); $scope.keySort = keySort; } </code></pre>
F# syntax for async controller methods in ASP.NET Core <p>I'm new to F# and trying to translate some C# ASP.NET Core code into F#</p> <p>There is a C# controller <a href="https://github.com/joeaudette/playground/blob/master/spa-stack/src/CSharp.WebLib/Controllers/ToDoController.cs" rel="nofollow">here</a>, and a worki...
<p>UPDATED 2016-09-28</p> <p>Thanks to Ruben Bartelink this is what my controller looks like now correctly implemented as async and handling the nuances that differ between C# and F# async patterns:</p> <pre><code>namespace FSharp.WebLib open System open Microsoft.AspNetCore.Mvc open Microsoft.AspNetCore.Routing ope...
Define a scope for certain iOS SDK versions in Swift <p>is there a way to define a block scope (where I can define structs or classes) which is valid only for certain iOS sdk versions? Suppose I want to provide a custom implementation for a class which is defined only for iOS 10; my implementation should work only for ...
<p>You should be using @available instead of #available. </p> <pre><code>@available(iOS 10, *) </code></pre>
PDFJS and promise reducing <p>So, it appears my understanding of js promises is quite lacking. I am working with PDFJS to display all pages of a pdf as a scrollable list of canvases (which is currently working). When i resize the window, i call a function like this (i have a <code>pages</code> array which has stored al...
<p>Part B does not work because</p> <pre><code>let promise = Promise.resolve; </code></pre> <p>should be</p> <pre><code>let promise = Promise.resolve(); </code></pre> <p>(but just use Part A which works and is cleaner).</p> <hr> <p>Part D does not work because </p> <pre><code> return Promise.resovle(); ...
Java Euro Coin Change Denomination <p>I believe I am having a logical issue with how to develop the section of code responsible for taking the remainder and checking if I can extract change from displayed change categories. It's designed to take a value of how much change you owe back to someone and make the most effic...
<p>As is common when dealing with money¹, you need to deal with integers only.</p> <p>Changing all your variables to <code>int</code> will give you the proper values, as integer division will make sure that <code>238 / 200 = 1</code>. Instead of double division which will result in <code>238.0 / 200.0 = 1.19</code>.<...
I need to find an excel formula that I can use to create a unique list of Item numbers from an array <p>I need to find an excel formula that I can use to create a unique list of Item numbers from an array. I do not want to count them I just want to make a list of the Item Numbers. These part numbers are actually Alpha ...
<p>With values in column <strong>A</strong>, in <strong>C1</strong> enter:</p> <pre><code>=MAX(A1:A10) </code></pre> <p>in <strong>C2</strong> enter the array formula:</p> <pre><code>=MAX(IF(A$1:A$10&lt;C1,A$1:A$10,"")) </code></pre> <p>and copy down:</p> <p><a href="http://i.stack.imgur.com/Ivna2.png" rel="nofoll...
C# - Error With Getting Data From mySQL Database <p>I am currently getting an error when trying to get data from mySQL:</p> <pre><code>Additional information: Could not find specified column in results: admin </code></pre> <p>My code is:</p> <pre><code>public int getLevel() { string sqlCommand = "Select ...
<p>Try:</p> <pre><code> public int getLevel() { int value = 0; using(MySqlConnection con = new MySqlConnection("host=45.37.80.181;user=MYUSERNAME;password=MYPASSWORD;database=tcg;")) { con.Open(); using(MySqlCommand cmd = con.CreateCommand()) { cmd.CommandText = ...
Barcode scan in java <p>I use barcode scanner to scan a product barcode. 12 digit number will display in JTextfield. <code>getText()</code> will take that 12 digit number to find its corresponding item, and increment item quantity. My problem is how to erase the text in the JTextfield before new item been scanned. So <...
<p>My problem is solved by using DocumentFilter. Thanks!</p>
Angular Array Remove Based on Expiration Date <p>I have a form that needs to have certain validation required to it. I have two drop downs that show the same data (in this case promotional codes with expiration date).. </p> <p>So my first dropdown is which is Promotional Code: </p> <pre><code>&lt;div class="input-gro...
<p>You will definitely want to bind to the <code>ng-change</code> function, but probably only in your <em>first</em> dropdown (b/c selecting from the first dropdown is the trigger for filtering the promos for the second dropdown).</p> <p><strong><a href="http://embed.plnkr.co/kqEqD8Vl8bevj2z3hjMo/" rel="nofollow">Here...
How to convert ArrayList of Objects into separate JSON objects <p>I am writing a JSP webapp and right now I'm kind of stuck. I have been using an ArrayList of Java Objects, each with a list of properties. They are Order objects with properties like firstName, lastName, etc. At this point in my development I need to sto...
<p>Try iterating through the array list, creating a JSON object for each of the objects instead of converting the array list as a whole.</p>
Switch statement using a union in C, got me into problems, what's wrong with my code? <p>I'm almost done with my assignment where I was supposed to build a program where the user interacts with a warehouseprogram, where you can delete, add, edit... However in my <code>event_loop</code> function, no matter what input I ...
<p>When <code>convert</code> points to <code>toupper()</code>, this line ...</p> <pre><code>answer_t result = convert(buffer); </code></pre> <p>... definitely produces undefined behavior, because <code>toupper()</code> takes a parameter of type <code>int</code> and returns an <code>int</code>, but you are passing a <...
Why is Node cluster.fork() forking the parent scope when implemented as a module <p>I'm attempting to implement a Node module which uses <code>cluster</code>. The problem is that the entire parent scope is forked alongside the intended cluster code. I discovered it while writing tests in Mocha for the module: the test ...
<p>I assume that you want the startCluster = require('./cluster-bug.js') to eval only once? Well, thats because your whole script runs clustered. What you do specify inside startCluster is only to make it vary between master and slave clusters. Cluster spawns fork of file in which it is initialised.</p>
Scrapy Pipeline not starting <p>I'm having problems with Scrapy pipelines. EnricherPipeline is never starting. I put a debugger in the fist line of process_item and it never gets control. JsonPipeline does start, but the first argument it receives is of type <code>generator object process_item</code> and not the MatchI...
<p>Ok, so the problem was that EnricherPipeline was yielding and not returning a result. After that it worked as expected, although I still don't understand why a debugger is not working in that first pipeline.</p>
find the CSS path (ancestor tags) in HTML using python <p>I want to get all the ancestor div tags where I match a text. So for example if the html looks like <a href="http://i.stack.imgur.com/aePNZ.png" rel="nofollow">HTML snippet</a></p> <p>And i'm searching for "Earl E. Byrd". I wanna get a list which contains {"buy...
<p>A solution using an <a href="/questions/tagged/xpath" class="post-tag" title="show questions tagged &#39;xpath&#39;" rel="tag">xpath</a> expression :</p> <pre><code>//div[@title="buyer-info"]/div[text() = "Carlson Busses"]/ancestor::div </code></pre>
Get a list of Azure Servers in C# <p>I need to fill a combobox with the servers of SQL available in the Azure portal. For example: I need to display the following list of servers in a combobox..</p> <p><a href="http://i.stack.imgur.com/5tCPN.png" rel="nofollow"><img src="http://i.stack.imgur.com/5tCPN.png" alt="enter ...
<p>You can list all servers from your Azure Subscriptions by using the Windows Azure Management Librairies (for ASM, Azure Service Management). Those librairies are wrappers around Azure Api and let you easily manage your ressources. </p> <p>By using <a href="https://www.nuget.org/packages/Microsoft.WindowsAzure.Manag...
Triggering asynchronous event in gui thread <p><strong>TL;DR I'm looking for a way to have one thread raise an event in another</strong></p> <p><strong>EDIT:</strong> I say the word "immediate", which is, as some commenters have pointed out, impossible. What I mean is that it should happen reasonably quickly, in the l...
<p>Really all it sounds like you need here is to invoke the update to the UI on the FX Application Thread via <code>Platform.runLater(...)</code>. This will schedule an update which will be executed as soon as the FX Application Thread has time, which will be pretty quick as long as you are not flooding it with too man...
Loop Through Table <p>I am attempting to loop through a table by column and transform it to individual divs. Id like to have tr[1]/td[1], tr[2]/td[1], tr[3]/td[1] ... all be part of one div. Then I'd like to move on to tr[1]/td[2], tr[2]/td[2], tr[3]/td[2].</p> <p>I am able to transform my table when I use simpler cod...
<p>Using the resources @michael.hor257k submitted, I was able to figure out my code. Here is what I came up with:</p> <pre><code>&lt;xsl:when test="tfoot/tr/td = 'column'"&gt; &lt;div class="grid "&gt; &lt;xsl:variable name="row" select="tbody/tr"/&gt; &lt;xsl:variable name="col" select="tbody/tr[1]/td"/&gt;...
why do my constraint not work properly in swift/storyboard? <p>I'm using <code>player-swift</code> (that one: <a href="https://github.com/piemonte/Player" rel="nofollow">https://github.com/piemonte/Player</a> ) to display video content in my app. I created a <code>UIViewController</code>, added there a <code>view</code...
<p>the constraint to the side margins must be -20 so the video can appear full screen, 0 leaves the extra space, you can see this if you drag the view to the edge of the margin, i would recommend to ctrl drag to the main view and asign equal width to his superview</p>
Why would the naive definition of moving average cause unnecessary locking in TensorFlow? <p>The TensorFlow <a href="https://www.tensorflow.org/versions/r0.10/api_docs/python/train.html#moving-averages" rel="nofollow">docs for tf.train.ExponentialMovingAverage</a> say,</p> <blockquote> <p>When you run the ops to mai...
<p>Suppose you start <code>shadow_variable=</code> update in multiple threads in parallel at the same time. After threads finish, <code>shadow_variable</code> will get the value computed by the slowest thread, so computation by other threads is wasted. To prevent this, you could introduce some kind of locking mechanism...
Spring Boot - Custom JSON Serialization <p>I generally use mixins to perform custom serialization and deserialization when using Jackson Library. My RestController in Spring Boot app has methods similar to one listed below. I guess Spring Boot uses Jackson to serialize the VerifyAccountResponse into string. However thi...
<p>You can customize the Jackson serializer in a spring boot application in a lot of ways. Please consider checking the documentation regarding jackson in the spring boot reference guide:</p> <p><a href="http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-customize-the-jackson-objectmap...
EF6 Code First, multiple cascade paths, and strange FK behaviour <p>I'm going to try to put only the relevant parts of the model here, because there are quite a lot of classes. Hopefully it's enough to capture the problem:</p> <pre><code>public class Solve { public int SolveID { get; set; } public int Locatio...
<p>Firstly <code>Location</code> is being referred in <code>Solve</code> object, so location is the principal and solve is dependent, I think in that case this mapping is wrong - </p> <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity&lt;Solve&gt;() .HasRe...
as400 CL script arithmetic gives 0 <p>I'm trying to calculate the remainder of a division with the algorithm:</p> <pre><code>remainder = dividend - (dividend / divisor) * divisor </code></pre> <p>All calculated in integers.</p> <p>Example: Get the remainder of 15 / 6.</p> <pre><code>1. (15 / 6) = 2 2. (2) * 6 = 12 ...
<p>This is quite interesting system behaviour. It would seem that the engine doesn't apply the integer trunking on the values in the brackets before multiplying it. So in other words the following is happening:</p> <pre><code>&amp;dividend - (&amp;dividend / &amp;divisor) * &amp;divisor = 15 - (15 / 6) * 6 = 15 - 2.5 ...
How to query DBPedia from JavaScript by resource URI? <p>I try to make this query from JavaScript</p> <pre><code> var subject = document.getElementById("inputUri").value; var property = "?p"; var object = "?o"; var query = "\ PREFIX dbpedia2: &lt;http://dbpedia.org/property/&gt;\...
<p>There is no variable called <code>?s</code> in your query, so it makes sense you can't retrieve its value.</p> <p>Depending on the structure of your code, you should be able to use the <code>subject</code> variable directly:</p> <pre><code>var subjectResult = subject; var objectResult = results[i].o.value; var pro...
Process hangs if web browser crashes in selenium <p>I am using selenium + python, been using implicit waits and try/except code on python to catch errors. However I have been noticing that if the browser crashes (let's say the user closes the browser during the program's executing), my python program will hang, and the...
<p>The code you have provided will always hang in the event that there is an exception getting the google home page. What is probably happening is that attempting to get the google home page is resulting in an exception which would normally halt the program, but you are masking that out with the except clause.</p> <p>...
Move element with mouse starts to snap up and down <p>I am trying to make a drag on y axis functionality using <code>mousedown, mousemove</code> events. The formula is as follows:</p> <pre><code>var position = e.clientY - getOrigin(myDiv).top; myDiv.style.transform = 'translate3d(0px, ' + position + 'px, 0px)'; funct...
<p>Because I couldn't exactly figure out what was causing the problem in OPs question (for an unknown reason <code>box.top</code> was returning 2 different values alternately on each pixel movement in OPs script), I've written a different script that works perfectly fine:</p> <p><div class="snippet" data-lang="js" dat...
Frequent Updating of GUI WxPYTHON <p>I have a piece of code which has to get executed every 100ms and update the GUI. When I am updating the GUI - I am pressing a button, which calls a thread and in turn it calls a target function. The target function gives back the message to the GUI thread using pub sub as follows. <...
<p>Some suggestions:</p> <ol> <li><p>How long does <code>SortAndDecode</code> take? What about the <code>str()</code> of the result? Those may be good candidates for keeping that processing in the worker thread instead of the UI thread, and passing the values to the UI thread pre-sorted-and-decoded.</p></li> <li><p>Y...
Observing UITextField.editing with RxSwift <p>I want to observe the property <code>UITextfield.editing</code>. I'm using this code:</p> <pre><code>self.money.rx_observe(Bool.self, "editing").subscribeNext { (value) in print("") }.addDisposableTo(disposeBag) </code></pre> <p>But in the process of running, it's onl...
<p>Don't observe the <code>editing</code> property, because it's not just a stored property. It's defined as: </p> <pre><code>public var editing: Bool { get } </code></pre> <p>So you don't know how UIKit is actually getting that value.</p> <p>Instead, use <code>rx_controlEvent</code> and specify the control events ...
How to wrap XML in SOAP envelope with Informatica? <p>I have created a Mapping which generates an XML target. Now I need to wrap the XML into a SOAP envelope. What is best way to approach this? I am new to Informatica. Thank you.</p>
<p><br> To have SOAP request and response strategy you can use <strong>Web Service Consumer Transformation</strong><br><br> Web Service Consumer Transformation is created to access web service from informatica. It can access either customised web services or external provider services. Transformation cab be created usi...
How to add `colorbar` to `networkx` using a `seaborn` color palette? (Python 3) <p>I'm trying to add a <code>colorbar</code> to my <code>networkx</code> drawn <code>matplotlib ax</code> from the range of <code>1</code> (being the lightest) and <code>3</code> (being the darkest) [check out the line w/ <code>cmap</code> ...
<p>I think the best thing to do here is to fake it following <a href="http://stackoverflow.com/a/11558629/5285918">this answer</a> since you don't have a "ScalarMappable" to work with.</p> <p>For a discrete colormap</p> <pre><code>from matplotlib.colors import ListedColormap sm = plt.cm.ScalarMappable(cmap=ListedColo...
Xamarin - Using an image in a custom list view ViewCell <p>I'm tying to create a custom ViewCell to use in a ListView like I've done many times before. However, this is the first time I've ever needed to use an image in a custom ViewCell and I'm not able to get it to work.</p> <p>So I’ve got my model:</p> <pre><cod...
<p>Your problem is that you are trying to bind the complete Image object directly (is that intended?) when a string is expected, try this in stead:</p> <pre><code>new AttendedMeeting[] { new AttendedMeeting { Title = "Meeting 1", Date = "Monday - May 16th 2016", Status = "Verified", ...
What are opaque dependencies? <p>I was reading about design patterns and I noticed that the term <strong>"opaque dependencies"</strong> was quite used. Some sources state that:</p> <blockquote> <p>Opaque dependencies are the bad kind of dependencies</p> <p>Opaque dependencies are the kind that you can’t assig...
<p>For example:</p> <pre><code>public class MyService { private IRepository repo = new Repository(); public MyService() { repo = new Repository(); } } </code></pre> <p><code>repo</code> would be classed as an <strong>Opaque Dependency</strong> because there is no (easy) way to alter it, for ...
Adding Selection Property to ListboxVBA <p>I'm trying to populate a Listbox from a Worksheet, and would like to predetermine which list items already have a Check Box. I've found ways to determine which items in a listbox are checked, but no the other way around. I have the code to run through my list and insert each i...
<p><code>Set</code> is used to assign objects. When you want to assign a non-object value like a Boolean or an Integer, you don't use <code>Set</code></p> <p>Try changing:</p> <pre><code>Set FRM_StorageOptions.StorageList.Selected(i - 1) = True </code></pre> <p>to:</p> <pre><code>FRM_StorageOptions.StorageList.Sele...
Append multiple array values into single value <p>I have two PHP arrays, and would like to append the value of the first array to the second array to create a new array which reiterates the original order but combines both values. I have tried the PHP array_merge but this just appends the new array but not merge into s...
<p>Just use a <code>foreach</code> loop.</p> <pre><code>$result = array(); foreach ($array1 as $i =&gt; $element) { $title = $element['title']; $count = $array2[$i]['count']; $result[] = array('title_count' =&gt; "$title ($count)"); } </code></pre>
Deferred is not resolving <p>I have a chain of deferreds in a javascript submit handler that make series of AJAX calls to an API until the desired result is returned. It worked well, but I made a tweak and now I am unable to figure out where I went wrong, because the new code seems to have a broken chain of promises.</...
<p>You misidentified the problem area. In that <code>if</code> branch, the deferred is resolved fine. The problem is the <code>else</code> branch:</p> <pre><code>… else { return $.promiseDelay(1000).then(function() { return waitForJobStatus(jobID, timeStarted); }); } </code></pre> <p>Here, <code>def</code> ...
Conditional Panel in Shiny doesn't update variables <p>I am trying to use a conditional panel in R Shiny but am running into issues with values not being assigned. Here is a snippet of my code: </p> <pre><code> conditionalPanel(condition="input['input.type']=='Use Example Data'", textInput("Label", "Enter the l...
<p>Is this what you want?</p> <pre><code>rm(list = ls()) library(shiny) library(shinydashboard) ui &lt;- dashboardPage( dashboardHeader(), dashboardSidebar( selectInput("type", "Type:",c("Use Example Data","Upload Data"))), dashboardBody( uiOutput("myui") ) ) server &lt;- function(input, output) {...
Eclipse PDT does not propose all php functions <p>Eclipse PDT Neon doesn't offer all of PHP functions. for example if i type "is", it just offering me isset:</p> <p><a href="http://i.stack.imgur.com/AmHyH.png" rel="nofollow"><img src="http://i.stack.imgur.com/AmHyH.png" alt="Eclipse PDT PHP default proposals"></a></p>...
<p>Can you make a test and create new/empty workspace with simple PHP project to check if its a problem with Eclipse instance or your workspace metadata. Also it would be helpful if you can check logs for anything that looks related (/.metadata/*.log).</p>
How to import sqlite from plain text dump? <p><a href="https://blog.xkcd.com/2010/05/03/color-survey-results" rel="nofollow">This excellent XKCD article</a> about color-poll data at the very end mentions:</p> <blockquote> <p>If you have ideas and want to analyze these results further, I’ve posted the raw data as a...
<p>sqlite comes with a command line tool to manage databases that is called <code>sqlite3</code>. You can use it to create a new database and import a dump in it. The following command will do both of these things:</p> <pre><code>sqlite3 /path/to/database.sqlite &lt; /path/to/mainsurvey_sqldump.txt </code></pre> <p>A...
sprintf to copy int into string in C <p>I'm trying to convert an integer to string using <code>sprintf</code> but it's not working as expected.</p> <p>When I input a number it works fine, I can show the number on screen. But if I input a string it always shows <code>"2"</code> on screen.</p> <p>I was planning to get ...
<p>I recommend looking at the return value from <code>scanf</code>. It is likely returning zero. It is failing and not storing a value in <code>num</code>. The <code>2</code> is likely the indeterminate value that was on the stack when the program started.</p> <p>If you want to read the value that was input, then u...
I am getting "Uncaught TypeError: $(...).draggable is not a function" <p>I am Javascript/UI newbie....i keep getting Uncaught TypeError</p> <pre><code>i.)Uncaught TypeError: $(...).draggable is not a function ii.)Uncaught TypeError: $(...).datepicker is not a function </code></pre> <p>Could anyone please advise,i ...
<p>You need to download and add jquery UI, Here a link for latest version: <a href="http://jqueryui.com/resources/download/jquery-ui-1.12.1.zip" rel="nofollow">http://jqueryui.com/resources/download/jquery-ui-1.12.1.zip</a></p>
Adding odd numbers in an array not providing the correct output <p>one of my ruby programs that detects odd numbers in an array and adds them together does not provide the correct output. Given that I am learning ruby and this is a logic mistake, I can't easily deduct where I make a mistake. Here is the Code:</p> <pre...
<p><code>return result</code> will cause the code to exit right then and there... it will only ever add up the first number, then exit the whole method forever... it will never look at the other elements of the array.</p> <p>Having now indented your code properly you can see that this line is inside the while loop... ...