input
stringlengths
51
42.3k
output
stringlengths
18
55k
Gulp generating images continiously <p>I am using the below code to generate images of different sizes when the upload happens but the below script is generating images everytime irrespective of files uploaded or not to the upload folder, Am i doing anything wrong in the below code?</p> <pre><code>const gulp = require...
<p>It is because of the way gulp watch works. You can consult the following: <a href="http://stackoverflow.com/questions/23890806/how-to-run-a-task-only-on-modified-file-with-gulp-watch">use gulp-chached</a></p>
Why do I get an error when adding an integer to a floating point? <p>I started learning Rust. I tried this program:</p> <pre><code>fn main() { let a = 5; let b = 5.5; let k = a + b; println!("{}", k); } </code></pre> <p>and it is showing this error:</p> <pre class="lang-none prettyprint-override"...
<p>The <em>technically correct</em> answer is: because no one has written <code>impl Add&lt;f64&gt; for i32 {}</code>.</p> <p>The <em>cheeky</em> answer is: because Rust doesn't want you to shoot yourself in the foot.</p> <p>The longer, potentially more useful answer is...</p> <p>In computers, integers and floating ...
scrolling down RecyclerView in Android <p>I want to download pics from Flickr in android app and show them in my RecyclerView (GridLayoutManager). Here is my code to fetch it with pages (by default page = 1)</p> <pre><code>public List&lt;GalleryItem&gt; fetchItems(Integer page){ if (page==null) page=1; List&lt...
<p>I've found answer, the problew why pastVisibleItems was set to zero was because of generating of new instance of adapter in</p> <pre><code>private void setAdapter(){ if(isAdded()){ mPhotoRecyclerView.setAdapter(new PhotoAdapter(mItems)); } </code></pre> <p>}</p> <p>i changed it to</p> <pre><code>private void...
JSX Ternary Expression Behaves Differently For Map <p>Simple question:</p> <p>JSX allows you to return a map function which will be comprised of a bunch of divs or images elements or whatever <strong>without</strong> having to wrap the JSX expression in one element. However if you type out a series of DIVs explicitly...
<p>The difference is that in the first part of your ternary expression you're only returning one value, that is your array of images. However, when your <code>this.props.label.exampleImages.length &gt; 0</code> statement returns false, you're returning multiple values, which doesn't makes sense, as explained here <a hr...
Is C++ STL a C++ API? <p>We have an assignment wherein we have been forbidden to use any C++ API. So, this brings me to the following questions:</p> <ol> <li>What exactly is the difference between a library and an API? </li> <li>Is the C++ STL (<a href="http://www.sgi.com/tech/stl/table_of_contents.html" rel="nofoll...
<p><a href="https://en.wikipedia.org/wiki/Application_programming_interface" rel="nofollow">API (Application programming interface)</a> is the interface of a library. To use a library, you call functions in its API. So you are not allowed to use any library.</p> <p>Difference of library and API:</p> <ul> <li><p>An AP...
microsoft SQL - returning previous week's data <p>I have a script that I refresh every week to get the sales data of the last week with the duration starting from last week's Sunday and ending with last week's Saturday. For example if I am running the script in any day within the week from 09/18/16 to 09/24/16, I want ...
<p>You can try the following</p> <pre><code>declare @date date = getdate() select dateadd(wk,-1,dateadd(dd, -(datepart(dw, @date)-1), @date)) as [Start], dateadd(wk,-1,dateadd(dd, 7-(datepart(dw, @date)), @date)) as [End] </code></pre> <p>Here a working <a href="http://sqlfiddle.com/#!6/9eecb7db5/522" rel="nof...
Trying to display a list of posts via category <p>I am trying to create a page in which a user selects a category (the button below represents one category), and a list of posts in that category are displayed, via the while loop, however when the button is clicked nothing is happening and I can't figure out why..</p> ...
<p>Looks like the form is not being submitted because of "button" input type. Try to change it to "submit" and remove redundant <code>&lt;/button&gt;</code> tag after it.</p> <pre><code> &lt;input type="submit" name="button" value="&lt;?php echo $row["cat_name"];?&gt;"&gt; </code></pre>
Spring websocket - how to get number of sessions <p>I'm using <a href="https://spring.io/guides/gs/messaging-stomp-websocket/" rel="nofollow">this</a> tutorial and I'm trying to figure out how to get the number of current sessions.</p> <p>My WebSocketConfig looks like this (copy and paste from the tutorial) :</p> <pr...
<p>You can use <strong>ApplicationContext</strong> events. Every connection, subscription or other actions will fire special events. Such as <strong>SessionConnectEvent, SessionConnectedEvent, SessionSubscribeEvent</strong> and so on.</p> <p>Full doc is <a href="http://docs.spring.io/spring-framework/docs/4.1.0.RC1/sp...
How do I find an object nested deep in arrays in MongoDB? <p>I'm new to MongoDB and have been having a bit of difficulty setting up a particular query for a new project I'm working on. </p> <p>I have a data structure that looks like this (simplified version): </p> <pre><code>games: {_id: ..., scenes: [{_id: ..., view...
<p>If your collection is not big, and this operation is relatively rare, then it may be fine to do it with the aggregation framework. But if this operation is frequent and performance-critical then I'd say go with application-level querying. In any case, this is how you'd do it with aggregation and <code>$unwind</code>...
jQuery eq() with different class name <p>I have following html:</p> <pre><code>&lt;div class="block"&gt;&lt;/div&gt; &lt;div class="block first"&gt;&lt;/div&gt; &lt;div class="block"&gt;&lt;/div&gt; &lt;div class="block"&gt;&lt;/div&gt; &lt;div class="block"&gt;this&lt;/div&gt; // I need to target this to add another ...
<p>To achieve this you can get the index of the <code>.block.first</code> element, then select the element three after that. Try 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-js lang-js prettyprint-overri...
Node.js server listening for UDP. Tcpdump says packets are coming through, but node doesn't get them <p>Integrating with a partner. Our server has a restful interface, but their product emits a stream of UDP packets. Since we're still prototyping, I didn't want to make any commits to our API server repo to accommodate ...
<p>Probably iptables at a guess. Packets hit the BPF (which tcpdump uses to look at incoming traffic) separately from iptables, so it's possible to see them via tcpdump only to have iptables drop them before they get out of the kernel and up to your application. Look in the output of 'iptables -nvL' for either a defaul...
Jmeter Typed variable declaration : Method Invocation <p>I have an issue when using Jmeter BeanShell preprocessor. The script invoke jars which I have put them under directory "D:\Software\apache-jmeter-3.0\lib\ext". <a href="http://i.stack.imgur.com/lMNt7.png" rel="nofollow">enter image description here</a></p> <p>he...
<ol> <li><p>Don't put any jars to the <code>lib/ext</code> folder, it should be used for JMeter core components and plugins only. Put your .jar libraries to "lib" folder of somewhere else, they just need to be on the <a href="http://jmeter.apache.org/usermanual/get-started.html#classpath" rel="nofollow">JMeter's Claspa...
Ignore git sub-repositories and treat them as regular files <p>I have a huge "main" git repository with several sub-folders, which themselves are separate git repos.</p> <p>I use the main repo as a sort of incremental backup system. However, the main repo always ignores any of the sub-repos and excludes them from the ...
<p>You can declare those sub-repos as <strong><a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules" rel="nofollow">submodule</a></strong>.</p> <p>For backup purposes, that means the main rpeo will reference the url and exact sha1 of those subrepos.<br> But that would mean the subrepos would need to be pushed t...
Python Turtle game, Check not working? <pre><code>import turtle # Make the play screen wn = turtle.Screen() wn.bgcolor("red") # Make the play field mypen = turtle.Turtle() mypen.penup() mypen.setposition(-300,-300) mypen.pendown() mypen.pensize(5) for side in range(4): mypen.forward(600) mypen.left(90) mypen....
<p>The problem is that your logic to test if the player has gone out of bounds is at the top level of your code -- it doesn't belong there. You should turn control over to the turtle listener, via <code>mainloop()</code> and handle the bounds detection in one of your callback methods, namely <code>forward()</code>.</p...
The driver could not establish a secure connection to SQL Server by using SSL <p>I'm having problems connecting to SQL databases. Whenever I try to connect to a SQL server I get the following error;</p> <pre><code>Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect at org.hiber...
<p>I suspect that when your laptop is on a "different network" that it is then inside the firewall that is also protecting the database servers you are connecting to. Hence, there is no problem making the database connections for this case.</p> <p>Your "network at home" I presume is outside of the firewall protecting ...
List division between list <p>I have this code that generates two lists. One list goes from <code>1-30</code> and the other goes from <code>30-1</code>. How can divide each element of <code>some_list2</code> by each element of <code>some_list</code>. It would be something like this: <code>1/30</code>, <code>2/29</co...
<p>You can do this with a list comprehension by <code>zip</code>ing the lists together, unpacking the tuple elements and dividing:</p> <pre><code>r = [i/j for i,j in zip(some_list2, some_list)] </code></pre> <p>this essentially creates tuples of <code>(some_list2[i], some_list[i])</code> values, assigns them to <code...
Conditional Where when using Group By <p>I have a working procedure to show the report for given range of period. The below proc finds all the bookings for the given period of time and shows for each month group</p> <p><a href="http://i.stack.imgur.com/L93jP.png" rel="nofollow"><img src="http://i.stack.imgur.com/L93j...
<p>Is this the logic that you want?</p> <pre><code>(@IncludeCancelled &lt;&gt; 'Y' OR Booking ISNULL(B.IsCancelled, 0) = 0) </code></pre>
How to make array values all capital letters lazarus <p>The user inputs string values into a string array via an InputBox, once the values are stored, how do I make all the letters become capital letters only, such as the example below. These values must then basically overwrite the non-capitalized values within the ar...
<p><code>UpperCase</code> is a function that returns a new value with letters made upper case. It does not modify its argument. You assigned this new value to a local variable and immediately forgot it. </p> <p>Remove the <code>BtnCapitalStrClick</code> method that serves no purpose. When you add the strings convert t...
ORA-00904: " ": invalid identifier for identifying space in instr <p>I am using </p> <pre><code>substr( item_name, instr(item_name," ",1,1)-1 ) </code></pre> <p>to get the name of an item before space.</p> <p>What is the correct way to do it?</p>
<p>Try using single quote </p> <pre><code> substr( item_name, instr(item_name, ' ' ,1,1)-1 ) </code></pre>
View FireBase data <p>How do I display the data that signed up in Firebase in my application and make them persist in it, so they can be viewed even offline Would you like some practical examples ...</p> <p>//Classe dos usuarios</p> <pre><code>public class Usuarios { private String Nome; private String Data; private...
<p>1st of All it is not best practice to save your data, witch way you doing this, make a Java POJO object to save data Into firebase, <a href="https://www.youtube.com/watch?v=1GDpv1XvqBA" rel="nofollow">here is video Tutorial i make to save java Obj to Firebase</a> , here is Example How you Writer java obj to firebas...
Visualizing graph with OrientDB Studio <p>I'm working with OrientDB (2.2.10) and occasionaly I would like to visually inspect my dataset to make sure I'm doing things correctly. On this page of OrientDB <a href="http://orientdb.com/orientdb/" rel="nofollow">http://orientdb.com/orientdb/</a> you see a nice visualization...
<p>If you want to get all three vertices, it would be much easier start from the middle (city) and than get in and out to get bar and contry. I've tried with a similar little structure: <a href="http://i.stack.imgur.com/ygH1c.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/ygH1c.jpg" alt="OrientDB Bar Structure"...
Sort columns based on data in tuples mysql <p>Say, I have a table <br></p> <pre><code>A B C D E F 1 2 4 3 6 5 4 2 3 1 6 5 4 5 3 6 1 2 </code></pre> <p><br> How can one get an output based on rearranging based on its data. For example,<br></p> <pre><code>ABDCFE DBCAFE EFCABD </...
<p>It appears that you are asking for output where each row in the output is just a specification of the order of the data values in the columns. Then, if the values are always integers between 1 and 5, you can do it by outputting a character value of 'A' where the data value is 1, a 'B' where the data value is 2, etc....
Printing repetitions of a String <p>I have the following code:</p> <pre><code>ArrayList&lt;String&gt; processed; processed = new ArrayList&lt;String&gt;(); int biggest=0; int w=0; for (int i=0; i&lt;list.size();i++) { if(!processed.contains(list.get(i))) { System.out.println(list.get(i) + ": " + Collectio...
<p>Use a HashMap to store pairs of name and repetitions: <code>Map&lt;String, Integer&gt; frequeciesMap = new HashMap&lt;&gt;();</code></p>
Binding complex object to a component <p><strong>Introduction</strong></p> <p>My goal is to create custom element in aurelia so that I can reuse it across the application. </p> <p>In this context I've created component called <strong>operator-detail</strong> (<em>operator-detail.html</em> and <em>operator-detail.js</...
<p>Declaring a bindable property on a template is for when you have a View without a ViewModel.</p> <p>The <code>bindable="operatorvalue"</code> in your <strong>operator-detail.html</strong> doesn't work because you also have a ViewModel defined for this element. If you want to keep it this way then simply remove the ...
Add Email Body Text and Send Email from Xamarin.Android App <p>I am attempting to create and send an email (using Gmail app) from user-supplied information entered into a simple Xamarin.Android mobile app. I am new to Xamarin.Android and have not been able to find clear guidance on this issue online.</p> <p>Using the...
<p>The problem is that the body has to be a text as well. Just combine your string list to one string by changing the line to:</p> <pre class="lang-cs prettyprint-override"><code>email.PutExtra(Intent.ExtraText, string.Join("", emailBody)); </code></pre> <p>BTW: You don't need to register for the changes of the TextV...
How to exclude preg_split forward slash followed with string enclosed in single quote <p><strong>How to exclude <code>preg_split</code> forward slash followed with string enclosed in single quote ?</strong></p> <p>I've been struck with this problem quite some.</p> <p>Below is the code, followed by the output. </p> ...
<p>While capturing everything enclosed in single quotes you should pay attention to escpaed single quotes as well. Following this regex:</p> <pre><code>'[^'\\\\]*(?:\\\\.[^'\\\\]*)*' </code></pre> <ul> <li><code>'</code> A single quote (opening)</li> <li><code>[^'\\\\]*</code> All characters except <code>'</code> an...
How to restrict underscore from occuring in middle of a strings of digit <p>I want the "_" characters to occur only in the middle of a string, not at the beginning or at the end. How can I place that restriction?</p> <p>Ex : </p> <pre class="lang-none prettyprint-override"><code>_8484 (invalid) 8484_ ...
<p>try this:</p> <pre><code>^([0-9]|[0-9][0-9_]*[0-9])$ </code></pre> <p>This says:</p> <ul> <li>^ start of string/line</li> <li>[0-9] any numeric character</li> <li>or</li> <li>[0-9] any numeric character</li> <li>[_0-9]* zero or more of any numeric or underscore characters</li> <li>[0-9] any numeric character</li>...
Xamarin Forms photo Pan/Scale/Crop plugin? <p>I'm making app with using XF pcl.</p> <p>To make photo viewer/editor function, you should add Pan/Scale/Crop. Is there good plugin that somebody already have done for it?</p> <p>Of course I can make my own but It's very common behavior so I'm curious.</p> <p>Thanks.</p>
<p>You might want to try this, this library has a lot of different transformations. <a href="https://github.com/luberda-molinet/FFImageLoading" rel="nofollow">https://github.com/luberda-molinet/FFImageLoading</a></p> <p><a href="https://www.nuget.org/packages/Xamarin.FFImageLoading.Forms/" rel="nofollow">https://www.n...
Logout in action bar <p>For my application I used a bouton to logout, but now I would like to use the action bar (When user click on logout icon he goes to homepage) and I can't make them live together.</p> <p>(I'm french, its hard to code because all tuto are in english. So please be patient with me).</p> <p>Thank y...
<p>You need to do something when the user taps the menu item.</p> <pre><code>if (id == R.id.action_logout) { logout(); return true; } </code></pre> <p>Move your logout code to a method so you can call it from any place:</p> <pre><code>private void logout() { sessionManager.logout(); startActivity(new...
Xcode 8 MainStoryboard showing blue rectangles instead of objects <p>I have a problem, I have latest version of Xcode 8 official release, and Im seeing blue rectangles instead of normal objects on the main storyboard, I Drag an Image, button or anything and it just shows a blue rectangle (I don't see the object inside ...
<p>You may have accidentally switched on Layout Rectangles within Editor -> Canvas in Xcode menu.</p> <p><a href="http://i.stack.imgur.com/ofgmt.png" rel="nofollow"><img src="http://i.stack.imgur.com/ofgmt.png" alt="enter image description here"></a></p>
Having a compiling error with Python using PyCharm 4.0.5 <p>The reason for me asking the question here is that I did not find a solution elsewhere. I'm having the following error with my PyCharm 4.0.5 program while trying to run a Python script. It was working fine the one day and when I tried using it this afternoon I...
<p>You must have a python file named <code>os.py</code> which is being imported instead of the "real" os module.</p>
awk to parse field by using period and output unique digits <p>I am trying to use <code>awk</code> to parse <code>$2</code> on using the first <code>.</code> in the string and output the digits with the header row above it. The current output is close but both commands seem to taking <code>$1</code> as well. Do I need...
<p>Try this :</p> <pre><code>% awk -F'[ .]' '{print $2 ? $2 : $1}' file R_2016_09_20_12_47 16-0001 16-0002 16-0003 R_2016_09_20_12_46 16-0004 16-0005 16-0006 </code></pre> <h3>NOTE</h3> <ul> <li>i take space and <code>.</code> as separators</li> <...
angular.js:13550 Error: Could not resolve 'item1' from state 'mainpath' <p>In my default homepage, I have 1 navbar with 2 items.</p> <p>My config for the main ui-view is:</p> <pre><code>angular.module('app').config([... $urlRouterProvider.otherwise('/mainpath'); $stateProvider .state('mainpath', { ...
<p>both of your routers are separate , you are not nesting them. to use the parent routes in child , you need to configure it that way.</p> <pre><code>$stateProvider .state('contacts', { abstract: true, url: '/contacts', // Note: abstract still needs a ui-view for its children to populate. // You can ...
Why do I need "text-align: center" when the container has "justify-content: center"? <p>I've got a div with <code>display: flex</code>. Its content is centered horizontally and vertically.</p> <p>When content is too long in the div, the content wraps. But the alignment is broken in this case. See the snippet.</p> <p>...
<p><code>justify-content: center</code> aligns the flex item, which is a <a href="https://www.w3.org/TR/css-flexbox-1/#flex-items" rel="nofollow"><em>"blockified" element</em></a> in a <a href="https://www.w3.org/TR/css-flexbox-1/#flex-containers" rel="nofollow"><em>flex formatting context</em></a>. This means <code>ju...
SQL - basic SELECT statement <p>I'd like to create this structure in sql (as a result of SELECT statement):</p> <p><a href="http://i.stack.imgur.com/evF4z.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/evF4z.jpg" alt="enter image description here"></a></p> <p>I'm trying to do it by using this query:</p> <pre...
<p>That sort of <em>formatting</em> is not possible in <code>SQL</code> but this is possible </p> <pre><code>SELECT 'Name' AS School, 20 AS `Age1`, 50 AS `Age2`, 90 AS `Age3` </code></pre>
How do I add all the filenames from a specific folder to my list? <p>So basically I have a folder called "saved_images", where I have a bunch of images. I want to be able to get all the filenames from that folder and add it to a list I have. For example, if I had "picture1.jpg" and "picture2.jpg" in this folder, I want...
<p>First get all the files inside the folder inside using the <em><code>getFilesName()</code></em> pass folder path as parameter to it. and set the string[] to your <code>ListAdapter</code> </p> <pre><code>String[] fileNames = getFilesName(*FolderPath*); if(fileNames!=null) ListAdapter buckysAdapter = new ArrayAdapter...
i can consume the api through rails server but Rspec failing it please provide me the solution <p>actually i can consume the below api but when i want to test through rspec it failing all the test in the command line interface if you want some more information related to the problem please let me know i will provide </...
<p>Rspec does not support external http request. Instead you can use webmock for testing. </p>
Layout Interface Builder constraints issue since Xcode 8 <p>Since I have updated my Swift project to Swift 2.3 and Xcode 8 (release version) I can't get my Interface done anymore... </p> <p><a href="http://i.stack.imgur.com/p8xrL.png"><img src="http://i.stack.imgur.com/p8xrL.png" alt="enter image description here"></a...
<p>Quick workaround: change the desired controllers' simulated size to freeform in inspector and then update frames. Looks like freeform controllers are not affected by these new Xcode 8 IB features :)</p>
How do I locate my user path to Meteor? <p>Examples of what I'm getting in my Terminal:</p> <pre> $ cd portfolio -bash: cd: portfolio: No such file or directory $ meteor create myApp -bash: meteor: command not found $ sudo meteor create myApp Password: sudo: meteor: command not found $ meteor help -bash: meteor: co...
<p>So now you can run <code>meteor npm install --save bcrypt</code> as your terminal said and then it should work.</p>
Pseudo element: proper z-index stacking context? <p>I have two <code>DIV</code> elements on the same level: <strong>bar</strong> and <strong>nav</strong> with <code>::before</code> pseudo element. </p> <p>That <strong>nav</strong> and <strong>bar</strong> should appear under <code>::before</code> pseudo element but te...
<p>Just add the same properties to text.</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>*, *::after, *::before { box-sizing: border-box; margin: 0; } header { ...
Spring Boot multi module Maven project deployment <p>We have multi module Maven project with following modules:</p> <ul> <li>Commons</li> <li>Model</li> <li>Repository</li> <li>Service</li> <li>Web</li> </ul> <p>We've googled around and we didn't found a solution how to make one executable jar when project has this k...
<h3>Problem 1 &amp; 2</h3> <p>You should not have <code>devtools</code> as dependency in your parent pom. Move the following to the <code>web/spring-boot</code> module:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId...
JS Regex: Parse urls with conditions <p>I had a requirement of parsing a set of urls and extract specific elements from urls under special conditions. To explain it further, consider a set of urls:</p> <blockquote> <p><a href="http://www.example.com/appName1/some/extra/parts/keyword/rest/of/the/url" rel="nofollow">h...
<p>Yes, this is in fact possible. As far as I understand, you have the following cases:</p> <ul> <li><code>/appName/some/extra/parts/keyword/rest/of/the/url</code></li> <li><code>/appName/rest/of/the/url</code></li> </ul> <p>You want your regex to not match the first one at all, while in the second case you want "app...
a nodejs request within a loop <p>I am building a nodejs application.</p> <pre><code> Location.find({} ,function (err, result){ var locations = []; result.forEach(function(listItem, i){ url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + encodeURIComponent(listItem.address) + "&amp;key=A...
<p>You may like to use <a href="https://www.npmjs.com/package/asyncjs" rel="nofollow">asyncjs</a> <code>eachSeries</code> function but you need to install(<code>npm install asyncjs --save</code>) and then use like </p> <pre><code>var async = require('asyncjs'); Location.find({} ,function (err, result){ var loca...
How to deal with a 50GB large csv file in r language? <p>I am relatively new in the "large data process" in r here, hope to look for some advise about how to deal with 50 GB csv file. The current problem is following:</p> <p>Table is looked like:</p> <pre><code>ID,Address,City,States,... (50 more fields of characteri...
<p>You can use R with SQLite behind the curtains with the sqldf package. You'd use the <code>read.csv.sql</code> function in the <code>sqldf</code> package and then you can query the data however you want to obtain the smaller data frame.</p> <p>The example from the docs:</p> <pre><code>library(sqldf) iris2 &lt;- r...
Grails setting metaclass properties on object reference <p>Using Grails domain objects, I've stumbled across a problem trying to set certain properties.</p> <pre><code>var stepchild=parent.children.find{ it.id==xInt }; stepchild.metaClass.birthMom=biologicalMothersName; parent.children.each{child-&gt; //when it g...
<p>For the way you are trying to set a property/attribute on the stepChild object, you should use the <code>MetaClass.setAttribute()</code> method:</p> <pre><code>stepchild.metaClass.setAttribute(stepChild,'birthMom', biologicalMothersName) </code></pre>
How to send query from js code using ajax to server <p>I have an event, When I clicking right button on the marker <code>google.maps.event.addListener(marker, 'rightclick', (function (marker) {</code> <strong>it returns function:</strong> <code>return function () { marker.setMap(null); delete markerBusyBrID[this.marker...
<p>I don't really understand but if what you want is ajax request to be made after certain functions are done you can try something like this</p> <p>the request will only be sent if all functions are triggered of course you can add parameters and modify <code>sendTheRequest()</code> as you wish</p> <p>, hope it help...
Pass variable from function in Typescript <p>I want to pass a value from the function to outside in Typescript.</p> <p>I have tried many method, e.g. thing to declare global variables, return function value, etc, but it doesn’t work. </p> <p>I think maybe my syntax is wrong. Could you please have a help? Code as be...
<p>What about define an external var?</p> <p>Like this:</p> <pre><code> this.platform.ready().then(() =&gt; { var myToken; FCMPlugin.getToken( function (token) { console.log(token); myToken= token; }, function (err) { ...
Python Django Rest Post API without storage <p>I would like to create a web api with Python and the Django Rest framework. The tutorials that I have read so far incorporate models and serializers to process and store data. I was wondering if there's a simpler way to process data that is post-ed to my api and then retur...
<p>You can use their generic <a href="http://www.django-rest-framework.org/api-guide/views/" rel="nofollow">APIView</a> class (which doesn't have any attachment to Models or Serializers) and then handle the request yourself based on the HTTP request type. For example:</p> <pre><code>class RetrieveMessages(APIView): ...
Why does the Eq class exist? <p>Suppose I want to define the type <code>Mod4</code> of integers modulo 4. After all, Int is <code>Mod2^64</code>. One obvious way I could go is</p> <pre><code>data Mod4 = ZeroMod4 | OneMod4 | TwoMod4 | ThreeMod4 </code></pre> <p>However I could also do this</p> <pre><code>data Mod4 =...
<blockquote> <p>Why didn't Haskell just took the representation in memory as the definition of equality ? This way all types become trivially equatable.</p> </blockquote> <p>Nope. You can't compare values of type <code>Integer -&gt; Bool</code>. Functions can not be compared, in general.</p> <p>Back to the blackboa...
some error of Wordpress with my IE <p>When I use Chrome and Firefox with this website <a href="http://hyojung.vn/network" rel="nofollow">http://hyojung.vn/network</a> and it's work perfectly, but I move to IE all of my products is showed in 1 column as some small divices. How can I fix this?</p> <p>Thanks a lot.</p>
<p>You need to provide folks with more info.</p> <p>What version of IE are we talking about.</p> <p>From a quick look, you are using flexbox which is not fully supported below IE11.</p>
MySQL stored procedure no values retrieve <p>I had migrated a stored procedure from Sql Server to Mysql, and I´ve created with <em>phpmyadmin routines</em>, the syntax is ok, but when I execute stored procedure, doesn't return any value.</p> <pre><code>DROP PROCEDURE `sp_buscar`; CREATE DEFINER=`root`@`localhost` PRO...
<p>Try removing the space after <code>concat</code>:</p> <pre><code>SELECT idColono AS Folio, nombreColono as Nombre, CONCAT(apellidoP ,' ', apellidoM) as Apellido, CONCAT(domicilio,' ', numero) as Dirección, numeroTel AS Telefono FROM cColonos WHERE domicilio LIKE CONCAT(@buscar, '%'); </code...
Kotlin call java method with Class<T> argument <p>I want to use Spring <code>RestTemplate</code> in Kotlin like this:</p> <pre><code>//import org.springframework.web.client.RestTemplate fun findAllUsers(): List&lt;User&gt; { val restTemplate = RestTemplate() //has error val ret = List&lt;User&...
<p>I think you need to actually use the <code>RestTemplate.exechange</code> method that has a signature that accepts a <code>ParameterizedTypeReference&lt;T&gt;</code> where <code>T</code> can be the generic type of your response (in your case a <code>List&lt;User&gt;</code>)</p> <p>Suppose I have an endpoint that ret...
What does the iterative version of randomized select do? <p>I found the code for iterative version of randomized-select online: </p> <pre><code>RANDOMIZED-SELECT(A,p,r,i) while p &lt; r do q ← RANDOMIZED-PARTITION(A,p,r) k ← q – p +1 if i ≤ k then r ← q else ...
<p><code>p</code> and <code>r</code> are the left and right indices of the range of <code>A</code> within which you are searching for the <code>i</code>th element. After the first partitioning, you check how many elements are in each of the two partitions. If there are <code>i</code> elements or more in the left partit...
dispatchqueue in swift 3 appears as unresolved identifier <p>I am trying to take/record video asynchronously on the main thread. However, when I call <code>dispatch.main.async</code>, I always get the error:</p> <pre><code>use of unresolved identifier DispatchQueue </code></pre> <p>I've looked everywhere from WWDC to...
<p>I do think that you don't have one of these in your frameworks list. Try to import one of these and try putting DispatchQueue's in your file.</p> <pre><code>import Foundation import UIKit // Any System Framework </code></pre> <p>This can happen if your file is not a Swift file, or your file is a Swift file but you...
Does Rust box the individual items that are added to a vector? <p>According to the Rust documentation:</p> <blockquote> <p>Vectors always allocate their data on the heap.</p> </blockquote> <p>As I understand this, it means that:</p> <ul> <li>Rust will allocate enough memory on the heap to store the type <code>T</c...
<p><strong>Yes</strong>, <code>Vec&lt;T&gt;</code> will store all items in a contiguous buffer rather than boxing them individually. <a href="https://doc.rust-lang.org/std/vec/struct.Vec.html">The documentation</a> states:</p> <blockquote> <p>A <em>contiguous</em> growable array type, written <code>Vec&lt;T&gt;</cod...
UIActivityController share sheet is blank <p>I referred to a lot of SO questions regarding this and most seem to be resolved because the OP was trying on simulator and not a real device. </p> <p>I've been trying on both, but all I see is the image below. I've used the same code with success earlier in a different proj...
<p>I just overcome this issue, I made sure that everything added to activityItems are unwrapped/not optional</p> <pre><code>var activityItems: [Any] = [] if let shareURL = URL(string: shareLink) { activityItems.append(shareURL) } if let shareImage = getShareScreenShot() { activityItems.append(shareImage) } ...
Elastic search Bulk Index Java API not working <p>I am developing bulk insert with Elastic search Java API 2.4 Here is the code</p> <pre><code> Client client = null; try { Settings settings = Settings.settingsBuilder().put("cluster.name", CLUSTER_NAME) .put("path.home", ELASTICSEARCH...
<p>Try to exclude the <code>&lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt; &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;</code> from your elasticsearch dependency. And then add the jackson-core dependency separately with version 2.7.8</p> <p>My pom.xml looks:</p> <pre><code> &lt;dependency&gt; ...
Gson & SharedPreferences lead to a NullPointerException <p>I'm trying to put an ArrayList of self-created objects in SharedPreferences. While the saving seems to work, I get the following error when getSharedPreferences() is called: </p> <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual m...
<p>Seems like you've not initialized variable <code>gson</code> before its usage in this method. Just add <code>Gson gson = new GsonBuilder().create();</code> before the first usage, or in this method you're calling and that should fix it.</p>
AngularJS JSON load from file with ng-click <p>Currently I want to show HTML table by parsing JSON data from file using Angular JS, And It's not working can someone please help me?</p> <p>And Also As a Enhancement How Can I get the 2 Divs for 2 different JSON file</p> <p><strong>HTML Code</strong></p> <pre><code>&lt...
<p>Should be a GET request, also the you need to access the data from the response object which contains the Employee array. Code should be,</p> <pre><code>$http.get('test.json').then(function (response){ $scope.post = response.data; $scope.personDetails = response.data.Employee; }); </code></pre> <p>if you want ...
Google Firebase Notifications for Android - when app is not running <p>I am trying to implement a functionality wherein users get notification messages even when the app is not running (neither in foreground nor in background). Companies like Amazon do send notifications and they show up in the notification tray - when...
<p>I you have to see the implementation of FCM for android from <a href="https://firebase.google.com/docs/cloud-messaging/" rel="nofollow">https://firebase.google.com/docs/cloud-messaging/</a></p> <p>I shows complete understanding of instant notification.</p>
Intent in android error <p>Everyone i'm getting error while using Intent in android. I have a MainActivity from where i call another class called BackgroundWorker so after doing some functions of login i want to go to user page if it is a sucesss.enter code here im attaching my code here Please help</p> <pre><code>pa...
<pre><code>Intent i =Intent(context,User.class); </code></pre> <p>This should fix the error, intent should be called using current context.</p>
Lua - generate sequence of numbers <p>How do I generate a sequence of integer numbers based on first and last number for <code>for</code> to loop over?</p> <p>The following pseudocode</p> <pre><code>for i in sequence(4,9) do print(i) end </code></pre> <p>should produce the following output</p> <pre><code>4 5 6 7 ...
<p>You can use <a href="https://www.lua.org/pil/4.3.4.html" rel="nofollow">numeric for loop</a> to do that. You will find details in Programming in Lua section I referenced or the Lua manual section on <a href="http://www.lua.org/manual/5.3/manual.html#3.3.5" rel="nofollow">For statement</a>.</p>
Output channel routing <p>I am trying to rewrite Spring Integration flow from XML to Java. I would like to route data sent over a channel:</p> <pre><code>@Bean(name = "sendData") public MessageChannel getSendData() { return MessageChannels.direct() .get(); } </code></pre> <p>into two oth...
<p>Okay, I got it to work. I'm not sure which change fixed my problem, but here's correct router implementation:</p> <pre><code>@Bean public IntegrationFlow routeRoundRobin() { return IntegrationFlows.from(getSendData()) .route(roundRobinRouter, "route", ...
Apache Ignite default CacheStore configuration <p>Is there a way to set the default CacheStore in ApacheIgnite?</p> <p>in Hazelcast, if you use the keyword <code>default</code> as the xml-configuration map name, that configuration becomes the default for all new maps</p> <p>in this example <a href="https://apacheigni...
<p>If you are using Spring XML configuration, just declare a separate bean and reuse it in several caches (this will work for any type of beans, data sources for example). Also you can declare that bean as abstract and override some properties that are specific for some cache.</p>
Javascript: Promise to wait for condition or abort after number of tries <p>How do I code this algorithm as a promise in JavaScript?</p> <pre><code>// condition: some situation that is not true // interval: period to wait before trying again // retriesAllowed: maximum number of retries to make before aborting // retri...
<blockquote> <p>This doesn't work, since it doesn't actually wait for the check to resolve to true or false before moving on.</p> </blockquote> <p>One part of that may be that the fail/exit condition seems to be inversed, so it will probably always exit after the 1st round of checking the <code>condition</code>:</p>...
Group values from a parameter list in a loop according to the prefix of the parameter <p>I am fetching a param list from my jsp which I need to identify according to the prefix so that I can set the values in my entity class.</p> <p>The parameter names looks like the below:</p> <pre><code> List&lt;String&gt; reqParam...
<p>I managed to figure out the problems and fix it. There are multiple problems in that code sample. For eg. the loops are incorrect, the approach to match with the main loop was horribly wrong. </p> <p>I had to get the prefix and suffix for each item, loop correctly[i.e. first get the suffix and prefix of the table a...
Can't stack robocopy and ren in batch <p>I am trying to carry out three commands in batch at once in Windows: <code>robocopy</code>, <code>cd</code> and <code>ren</code>. An example is that I'd like to copy files to another directory and then add <code>.bak</code> after their names. I use <code>&amp;&amp;</code> to sta...
<p><code>&amp;&amp;</code> means to performs the next command only if the previous command was <strong>successful</strong> (or returned an errorlevel of <code>0</code>). Similarly, <code>||</code> only performs the next command if the previous command <strong>failed</strong> (or returns an errorlevel greater than <cod...
C++ template specialization not working when comparing sizeof(type) == constant <pre><code>#include &lt;cstdint&gt; #include &lt;iostream&gt; uint32_t ReadInt() { return 0; } uint64_t ReadLong() { return 0; } template&lt;class SizeType&gt; class MyType { public: SizeType Field; MyType() { Field ...
<blockquote> <pre><code>warning C4244: '=': conversion from 'int64_t' to 'uint32_t', possible loss of data for the int specialization </code></pre> <p>I get a compiler warning because it looks like the the condition sizeof(MyType) == 4 is not being evaluated at compile time.</p> </blockquote> <p>No, it doesn't l...
Julia triangular matrix vector BLAS wrapper BLAS.trmv <p>I am trying to use the BLAS function dtrmv for triangular matrix vector multiply. According to the docs:</p> <blockquote> <p>trmv!(ul, tA, dA, A, b) Returns op(A)*b, where op is determined by tA (N for identity, T for transpose A, and C for conjugate transpo...
<p>You can use <code>Mchol=chol(M)'</code> but you'll have to extract the buffer first, i.e. <code>BLAS.trmv('L','N','N',Mchol.data,Z)</code>. However, I'd recommend that you don't call <code>trmv</code> directly. Most often you should use the <code>Ax_mul_Bx!</code> family of functions. In this case, the most efficien...
Android Studio: Issues using spinner in one activity to change background color in another <p>I am very new to Android. The lab for my course on this requires that I be able to select a color from a spinner in activity A (PaletteActivity) and it launch activity B (CanvasActivity) with that color as the background.</p> ...
<p>You need to pass the right intent for starting the activity. Change your code as following:</p> <pre><code> // startActivity(new Intent(PaletteActivity.this, CanvasActivity.class)); // String strName = null; String color = parent.getItemAtPosition(position).toString(); i.putExtra("color", color); startActivity(...
How can i put a message like: "Do you want to proceed?" (yes or no) vba <p>I have a code to add several rows on excel. I would like make a code (vba) before that, in order to ask if it is to proceed in case we click in the button. It is to prevention. How can I do that? Someone can help me?</p>
<p>I placed an Activex Button control from the tool box on the form then added the following code:</p> <p>Private Sub CommandButton1_Click() Dim vbanswer As String vbanswer = MsgBox("OK TO PROCEED?", vbOKCancel, "ASK FOR USER RESPONSE") End Sub</p> <p>I dimensioned a string variable to place the response in. The mess...
Need Help implementing swipe tab view with navigation drawer <p>I have implemented swipe tab view in one of the fragments of navigation drawer activity. </p> <p>Problem is - when I open that fragment for the first time, everything works fine. But when I switch to another fragment and then return back, some of the tabs...
<p>You are using ViewPager inside Fragment. Use <strong>getChildFragmentManager()</strong> instead of <strong>new SectionsPagerAdapter(myContext.getSupportFragmentManager());</strong></p> <p>Your code must be looks like this:</p> <pre><code>View view = inflater.inflate(R.layout.fragment_hourly, container, false); mSe...
Cordova-plugin-googlemaps blank screen on Play store <p>My Ionic app is using the <strong>cordova-plugin-googlemaps 1.3.9</strong> plugin, and everything had been working on iOS and Android until yesterday.</p> <p><strong>Cordova android</strong>: 5.1.1</p> <p><strong>Cordova iOS</strong>: 4.1.1</p> <p><strong>Cordo...
<p>I found the solution.</p> <p>To build my production APK I use <strong>Ionic CLI</strong>.</p> <p>I don't know why but the command did not add the cordova-plugin-googlemaps plugin to the signed APK. To solve that, I installed the plugin with the <strong>--save</strong> option : </p> <p>cordova plugin add <a href="...
How to crop an image with a transparent hole into a circle without losing transparency? <p>I have an image which has a transparent hole in the middle. I want to first resize the image and then rotate it. I already achieved this. </p> <p>Now, I want to crop this image into a circle. I am unable to do this, without losi...
<p>I found a solution. I created an overlay and merged it with my orginal image. Then I made the corners transparent with imagefill.</p>
rdivison by logical array in Matlab - Not sure about behaviour <p>In Matlab I have this</p> <pre><code>X = double(1./(1+exp(-P)) &gt; rand(size(P))) </code></pre> <p>Where P is a 100x100 matrix. I seem to be unable to understand what is going on after the operation is complete. The values stored in X are 0's and 1's....
<p>The issue is that the division is evaluated <em>before</em> the <code>&gt;</code> comparison (more on operator precedence <a href="https://www.mathworks.com/help/matlab/matlab_prog/operator-precedence.html" rel="nofollow">here</a>). The way that you have it written, it compares <code>1 ./ (1 + exp(-P))</code> to <co...
Picking primes to use for Halton Sequences in R <p>I'm trying to generate some two-dimensional Halton Sequences in R, and am using the <code>randtoolsbox</code> package. It seems as if this function defaults to choosing 2 and 3 as the prime bases, but I'd like to generate sequences using others. The documentation does ...
<p>So, I ended up just programming my own function for this. It's probably not going to be fast for super large <code>n</code>, but it allows you to pick your own prime bases, anyway:</p> <pre><code>gHalton &lt;- function(n, prime) { # define function which generates value of halton # sequence at given n h...
Too many Alamofire logs after upgrading to Alamofire 4.0 <p>Upgraded from Alamofire 3.4 to 4.0, Swift 2.3 to Swift 3 and XCode 7.3 to XCode 8.0, and the update has added way too many logs to my debug log stream; so much so that finding my own logs has become diffcult. How do I stop Alamofire from logging everything exc...
<p>So this is a known issue in XCode 8 (beta1 to GM release). I saw this only for the Alamofire (HTTP Networking framework for Swift), after upgrading XCode and my pod files to Swift 3. So I thought this was specific to Alamofire. </p> <p>Apparently it happens for all system frameworks. There are some workarounds lis...
php: array_unique missing a duplicate <p>I have been struggling with a minor issue with the array_unique for a couple of days now. </p> <p>Somehow the output always leaves the last duplicate in the array.</p> <p>I am getting the text from a text box in an html form</p> <pre><code>$IDs = trim($_POST['IDs']); $IDs = e...
<p>You should use <a href="http://php.net/manual/en/function.array-map.php" rel="nofollow"><code>array_map</code></a> instead of <code>array_filter</code>.</p> <p>Like: </p> <pre><code>$IDs = trim($_POST['IDs']); $IDs = explode("\n", $IDs); $IDs = array_map('trim', $IDs); $ID = array_unique($IDs,0); print_r($ID); </c...
Compare two lists and print the next element using loops <p>I have two lists:</p> <pre><code>list1=['lo0','lo1','te123','te234'] list2=['lo0','first','lo1','second','lo2','third','te123','fourth'] </code></pre> <p>I want to write a python code to print the next element of list2 where item of list1 is present in list2...
<pre><code>list1=['lo0','lo1','te123','te234'] list2=['lo0','first','l01','second','lo2','third','te123','fourth'] for i in list1: if i not in list2: print('no-match') else: print(list2[list2.index(i)+1]) </code></pre> <p>alternatively you could include a try, except to include a routine if th...
What is the Point of "Import" in ES 6? <p>In other words, what is the difference between:</p> <pre><code>&lt;!--index.html--&gt; &lt;script src="./fooFolder/lib.js"&gt;&lt;/script&gt; </code></pre> <p>and</p> <pre><code>/*--app.js --*/ import * as lib from 'fooFolder/lib'; </code></pre> <p>The file being accessed:...
<ol> <li><p>Scoping and namespaces <a href="https://en.wikipedia.org/wiki/Scope_(computer_science)" rel="nofollow">https://en.wikipedia.org/wiki/Scope_(computer_science)</a></p></li> <li><p>Code seperation and Testing, imports allow errors to be localised, less complex to test due to limited scope</p></li> <li><p>Compr...
New Activity from FloatingActionButton <p>i would launch an activity with a click in a floating action button, but when i click this, I get "Unfortunately, ... has stopped.". please help me!</p> <p>questo è il codice del bottone di default, and this works</p> <pre><code>FloatingActionButton fab = (FloatingActionBut...
<p>you should try this.</p> <pre><code>Intent launchactivity = new Intent(MainActivity.this, add.class); startActivity(launchactivity); </code></pre>
Issue after the first animation execution <p>I have a button that triggers an animation. When I click the button again, it toggles the class but the opacity is still in my code after the animation. </p> <p>This happens for all the consequent clicks. How can I fix this? </p> <pre><code>$( "#menu-button" ).click(functi...
<p>You should try <code>bind</code> instead of <code>click</code></p> <pre><code>$( "#menu-button" ).bind("click", function() { $("#right-sidebar").toggleClass("display"); if($("#right-sidebar").hasClass("display") == false){ $("#right-sidebar").css("opacity","0"); } else { $("#right...
Printing/Debugging libc++ STL with XCode/LLDB <p>I'm trying to use LLDB within Xcode 8 to debug very basic STL. I used to be able to print a vector like this:</p> <pre><code>p myvector[0] </code></pre> <p>to see whatever was in the first vector index. Now when I do that, I get this error:</p> <pre><code>error: Could...
<p>[] is an operator method on std::vector, so to print the expression you want, lldb would have to be able to call the [] method. The problem here is that the STL on OS X is aggressive about inlining everything it can, and not wasting space producing out of line copies of the same functions. That's great for optimiz...
Why http-auth does not work with express.static middleware? <p>I'm trying to setup a simple auth using <a href="https://github.com/http-auth/http-auth" rel="nofollow">http-auth</a> module.</p> <p>I've created this setup but it's not working properly. The dialog prompting the user/pass show up but if I close the dialog...
<p>Your example works perfectly if you browse <code>http://localhost:4000/</code>, after hitting cancel you see 401 message instead of content that you could add to <code>/</code> route (now you don't have route handler for it).</p> <p>To make it work for static files you just need to enable authentication for static ...
How to authenticate Microsoft Speech to Text <p>I am trying to follow the <code>Curl</code> example to get the security token This is not my actual subscription key. </p> <pre><code>curl -v -X POST "https://oxford-speech.cloudapp.net/token/issueToken" -H "Content-type: application/x-www-form-urlencoded" -H "Content-Le...
<p>I found the solution. I had to look at the JavaScript, a C#, and the Curl examples to put this together. </p> <p>First call should look like this: curl -v -X POST "<a href="https://api.cognitive.microsoft.com/sts/v1.0/issueToken" rel="nofollow">https://api.cognitive.microsoft.com/sts/v1.0/issueToken</a>" -H "Ocp-Ap...
php explode is not working well <p>Please help me out with my code. <strong><a href="http://php.net/manual/en/function.explode.php" rel="nofollow">explode()</a></strong> didnt work for me.</p> <p>What I need is to insert all those seperated words into an array "<code>$traceData</code>" so I can access them by the arra...
<p>You have one too many for loops there, your $row will contain what you want.</p> <pre><code>$string = "Quality|good|bad|reason\nQuality2|good2|bad2|reason2\nQuality3|good3|bad3|reason3\n"; $allTrace = explode("\n",$string); foreach ($allTrace as $value) { $row = explode("|", $value); print_r($row); } </code><...
Including a script src into js file <p>Im trying to integrate a firebase config into my <code>js</code> file rather than directly into html file. Given:</p> <pre><code>&lt;script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"&gt;&lt;/script&gt; &lt;script&gt; // Initialize Firebase var config = { ......
<p>You can create a tag script and append to body of document.</p> <pre><code>var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://www.gstatic.com/firebasejs/3.4.0/firebase.js'; document.body.appendChild(script); </code></pre>
NodeJS watcher printing undefined after logging function to console <p>I am playing around with NodeJS watchers and have written something like this in <code>debugger.js</code>:</p> <pre><code>setTimeout(() =&gt; { debugger; var z = () =&gt; {console.log('today');} console.log(z()); }, 1000); console.log('hello'...
<p>You're logging the result of the function <code>z()</code>, which equals <code>console.log('today')</code>. <code>console.log</code> is a void function and thus returns null, which is <code>undefined</code> as a string.</p>
CSS Height:100% not working when HTML is displayed by PHP <p>I have a container to center my web page using css:</p> <pre><code>#container{ width: 1000px; height: 100%; margin: 0 auto; border-left: 1px solid black; border-right: 1px solid black; } </code></pre> <p>This perfectly displays the left...
<p>Fixed it, changed height:100% to min-height:100% in the CSS.</p> <p>Its amazing how you spend hours searching then as soon as you post a question you find the solution. Nvm its here for others to see should they need it :)</p>
How can I add a node to an existing network? <p>I created a network with 4 peers using docker-compose and docker for Mac. I deploy my blockchain on this network successfully.</p> <p>Now I'm launching a 5th peer using another yml file using the details of one of the previous peer as discovery node. It appears in the li...
<p>This is limitation in Fabric’s versions 0.5 and 0.6 Network configuration cannot be changed in realtime. In case If you use PBFT consensus, network configuration is hardcoded in: “fabric/consensus/pbft/config.yaml"</p> <pre><code># Maximum number of validators/replicas we expect in the network # Keep the "N" i...
julia, why does memory allocation happen for a loop inside a function? <p>In the memory allocation report of <code>julia --track-allocation=user</code> the maximum of allocation is in this function:</p> <pre><code> - function fuzzy_dot_square( v::Array{Int64, 1} ) - dot_prod = zero(Int64) 7063056168...
<p>This is a limitation of <code>--track-allocation=user</code>. There's no type instability and there are no allocations.</p> <pre><code>julia&gt; function fuzzy_dot_square(v) dot_prod = zero(eltype(v)) for i in 2:28 dot_prod += v[i]*(v[i] + v[i-1] + v[i+1] + v[i+28])# / 4 # no "t...
mongoose schema is broken into several files, how to require? <p>doing mongoose db in nodejs. i got an error: "schema is not defined".</p> <p>in my model i have 2 files for different schemas: user and product, they look smth like:</p> <pre><code>'use strict'; var mongoose = require('mongoose'), bcrypt = require("...
<p>To resolve the "schema is not defined" issue, import the Mongoose schema:</p> <pre><code>var mongoose = require('mongoose'); var Schema = mongoose.Schema; </code></pre> <p>For the exports, I would suggest the following. No reason to nest this additionally, when you're defining one model per file:</p> <pre><code>v...
performance anomaly in identity matrix creation <p>Firstly, sorry for my terrible English.</p> <p>I wrote an program for finding best way to create an identity matrix dynamically in a function. I have three function for creating an identity matrix. First function and second function almost same. Only difference betwee...
<p>If you compile this with optimizations turned on, the compiler will likely notice that you never read from your matrix and as such it is valid to just remove your identityMatrix functions.</p> <p>If you're not compiling with optimizations turned off the compiler won't optimize your functions away so you'll get timi...
Nonmonotonic SQL queries (Finding names who only like something) <p>I am trying to learn SQL. I have a table (called <code>likes</code>) that looks like this:</p> <pre><code>|---------|---------------| | name | color | |---------|---------------| | Jane | Red | | Talia | Red | | Jan...
<p>I would do this with <code>group by</code> and <code>having</code>:</p> <pre><code>select name from likes group by name having max(color) = min(color) and max(color) = 'Black'; </code></pre> <p>You can use your method as well. You need a color in the subquery:</p> <pre><code>SELECT L1.name FROM likes L1 WHERE L1...
What's the difference between a maxheap and a linked list storing the max at head? <p>I am learning about heaps right now in my algorithms class and can't understand how, in practice, a max heap is better than a linked list that just stores the max value at the head pointer. </p> <p>What is the point of having a node ...
<p>Max binary heap can be built in <code>O(n)</code> time and then each extract-max is going to take <code>O(lg n)</code> time. If you build a singularly linked list, it means that you need to sort the data, which takes <code>O(n * lg n)</code> time, but then extract-max is going to be <code>O(1)</code> for constant ti...
How to add a JButton to JFrame from other class <p>am trying to add a button to Jframe from other class but it does not work</p> <pre><code>public class ShowMain { public static void main(String[] args) throws Throwable { //My JFrame JFrame frame = new JFrame(); frame.setVisible(true); frame.setS...
<p>You've got all your code within two static main methods, meaning that the two classes can hardly interact at all. I suggest that you create true OOP-compliant classes, with instance fields ("state"), instance methods ("behavior"), and that you have one class call the method of another if you wish to change its state...
retrofit2 and rxjava - how to combine two dependent network calls in android <p>I am having some trouble understanding how i can chain two network calls together. I am using retrofit2 and rxJava. i am using the Yelp API and already have a gson Pojo for the businesses i want to capture. But the api call for business d...
<p>I'm not sure if I understand correctly but from first call you receive list of Business and than for each of those Business you need to get review. If so, than you can use following code:</p> <pre><code>ApiService service = Retrofit.create(ApiService.class); service.getBusinessesRx("delis", "37.786882", "-122.39997...
Unable to configure https on amazon ec2 (centos) tomcat <p>I am configuring ssl self signed certificate on tomcat server using centos on amazon ec2 platform and facing some issues. I step by step follow the following tutorial.</p> <p><a href="http://tecadmin.net/configure-ssl-certificate-in-tomcat/#" rel="nofollow">ht...
<p>Ideally its perfect to access without port (443) for HTTPS. But still if you want access the URL with port number, you can make your URL re-direct from 443 to 8443, you can make use of IPTABLES and make it work it.</p> <p>sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443</p> <p...
Creating a Service Fabric cluster using resource manager template <p><a href="http://i.stack.imgur.com/HTg6E.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/HTg6E.jpg" alt="Capture"></a></p> <p>No luck today, I'm receiving an InvalidTempalteDeployment error, I'm using the deploy and parameter json file:</p> <p...
<p>This is because you have to fill all the details in before you can get the custom ARM template. I noticed you missed some information in your screenshot such as node type count.</p>
Redirect error when trying to request a url with requests/urllib only in python <p>im trying to post data to a url in my server ... but im stuck in sending any request to that url (any url on that server ) here is one for example </p> <pre><code>http://apimy.in/page/test </code></pre> <p>the website is written in py...
<p>Since you are using the <a href="http://docs.python-requests.org/en/master/" rel="nofollow"><code>requests</code></a> module did you try to tell the requests module to ignore redirects?</p> <pre><code>import requests response = requests.get('your_url_here', allow_redirects=False) </code></pre> <p>Maybe this work. ...