input
stringlengths
51
42.3k
output
stringlengths
18
55k
Jquery select box ignore if class present <p>I have this code for a filter button that replaces the string in the button based on what is selected:</p> <pre><code>$(document.body).on('click', '.dropdown-menu li', function (event) { // Filter Select replacement var $target = $(event.currentTarget); $target.cl...
<h2>You can use <a href="https://api.jquery.com/not-selector/" rel="nofollow"><code>:not()</code></a> or <a href="https://api.jquery.com/has-selector/" rel="nofollow"><code>:has()</code></a></h2> <h3>Using <a href="https://api.jquery.com/not-selector/" rel="nofollow"><code>:not()</code></a></h3> <p><strong>(note that...
bxSlider customPager is causing li elements to have a width of 663px? <p>I have an active bxSlider on a website I'm developing and want the theme's layout preserved (see <a href="http://www.type1wd.com/beta/moon/02_home-2.html/" rel="nofollow">here</a> under case study section).</p> <p>Basically the bxSlider would ro...
<p>Ok so using jquery I was able to edit the width of the elements being created for the bxSlider...my other issue was that the thumbnail pager images were still moving, so here's how my js is currently in order to keep the thumbnail pager in place. But the issue is that the main image is now displaying a duplicate pa...
Prestashop autocomplete input type <p>I am developing a prestashop module , i have created some custom fields ate product page . i have a field that get values by autocomplete from a json</p> <p>Here is the module tpl Field :</p> <pre><code> &lt;div class="form-group"&gt; &lt;label class="control-lab...
<p>We are not aware of the way you are using the autocomplete field but we have used it several times by using the following steps:</p> <p>Add the following code to your JS code on the page (in document.ready javascript function)</p> <pre><code>$('YOUR_FIELD_ID').autocomplete(path_fold+"/FILE_PATH_TO_HANDLE_AJAX.php"...
weird positioning of the cursor in the UITextView <p>I am writing from scratch growing <code>UITextView</code> in my <code>swift</code> app. I put a <code>textView</code> on the <code>view</code> like this:</p> <p><a href="http://i.stack.imgur.com/vJa2x.png" rel="nofollow"><img src="http://i.stack.imgur.com/vJa2x.png...
<p>Here is a bit different approach I use in the comment section of one of the apps I'm developing. This works very similar to Facebook Messenger iOS app's input field. Changed outlet names to match with the ones in your question. </p> <pre><code>//Height constraint outlet of view which contains textView. @IBOutlet w...
Removing specific part of a string in php/web scraping <pre><code>&lt;div class="description"&gt; &lt;span&gt;Product Code:&lt;/span&gt; " CODE"&lt;br&gt; &lt;span&gt;Availability:&lt;/span&gt; " In Stock" &lt;/div&gt; </code></pre> <p>I'm trying to scrape a website using simple html dom library but I ...
<p>Remove the div.description child spans and you should be good to go.</p> <p><strong>EDIT: MarcB posted this a minute before me. Good job and full credit to him.</strong></p>
Can't change color of status bar <p>I am trying to theme my app to follow the material Android look. My project is a Xamarin.Android project, which targets API 23, but the minimum API target is 16. So I have to use the AppCompat library to have the same design on all APIs.</p> <p>I have followed these guides: <a href=...
<p>Try this in your style (Resources/values-v21/styles.xml)</p> <blockquote> <pre><code>&lt;item name="android:windowDrawsSystemBarBackgrounds"&gt;true&lt;/item&gt;
&gt; &lt;item name="android:statusBarColor"&gt;@color/cobalt_light&lt;/item&gt; </code></pre> </blockquote> <p>I personaly prefer to handle it in the ...
How do i make a website that creates a html table using javascript prompts? <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; var r = prompt ("how many rows ?"); var c = prompt ("how many columns ?"); var red = prompt ("how red ?");...
<p>One issue is that you are not initializing the i variable (there is no 'var i' in your code). This variable is the index variable for your loop, set it to the row/column input variable that the user entered.</p> <p>Also, when you put a nest loops don't try to reuse the index variable (i).</p> <p>And work through ...
How do I access elements in multiple nested fragment from an activity in android <p>I am working on a "guided tour" feature for my android application and need to dim and brighten certain elements on the current screen. I am using fragments for each screen and when I try to access elements in those fragments from the a...
<p>Why not store a static reference to the variables you need global access to in the Activity, then access them like <code>MyActivity.class.myVariable</code> and use <code>getSupportFragmentManager#replace()</code> to swap out the fragments dynamically?</p>
How to Use Lagged Time-Sereis Variables in a Python Pandas Regression Model? <p>I'm creating time-series econometric regression models. The data is stored in a Pandas data frame.</p> <p><strong>How can I do lagged time-series econometric analysis using Python</strong>? I have used Eviews in the past (which is a stand...
<p>pandas allows you to shift your data without moving the index such has</p> <pre><code>df.shift(-1) </code></pre> <p>will create a 1 index lag behing</p> <p>or</p> <pre><code>df.shift(1) </code></pre> <p>will create a forward lag of 1 index</p> <p>so if you have a daily time series, you could use df.shift(1) to...
Get all the missing dates in a sequence of dates <p>I am trying to get all the missing dates in a sequence of dates which are in an ascending order. How can I do it using a simple sql without using any functions or udfs.</p> <pre><code>Input :- 2016-09-01 2016-09-02 2016-09-05 2016-09-10 </code></pre> <p>Output :-</...
<ol> <li><p>create a new table and insert 365 rows numbered 1-365 (alternately use a table that already has more than 365 rows and use rownum or similar construct to get unique integers)</p></li> <li><p>Convert your dates to integers (in Oracle use something like <code>TO_CHAR( mydate, 'ddd' )</code>)</p></li> <li><p>...
Creating Web Service Reference in Visual Studio to PayPal SOAP API <p>I am trying to update an existing system to use a WCF Web Service reference for its PayPal SOAP API proxy classes. </p> <p>According to <a href="https://developer.paypal.com/docs/classic/api/PayPalSOAPAPIArchitecture/" rel="nofollow">this API docum...
<p>There are 3 XSDs referenced by the WSDL which are available at the following URLs-</p> <ul> <li><a href="https://www.sandbox.paypal.com/wsdl/eBLBaseComponents.xsd" rel="nofollow">eBLBaseComponents.xsd</a></li> <li><a href="https://www.sandbox.paypal.com/wsdl/CoreComponentTypes.xsd" rel="nofollow">CoreComponentTypes...
Automatically find all latitude and longitude of all my locations <p>I have a long list of vendors I would like to find the latitude and longitude for. I already have the addresses.</p> <p>Is this something I can do using Python? or can I do it with another language? </p> <p>I just started learning Python.</p>
<p>The process you are describing is called "<a href="https://developers.google.com/maps/documentation/geocoding/start" rel="nofollow">geocoding</a>". </p> <p>Python can't do the conversion of addresses to coordinates itself, since it needs a large database of addresses. However online services such as google or micro...
Angular chart tooltop animation not working <p>I have an Angular Chart Bar-Line chart, and it works, but the tooltop is different of this:<a href="http://jtblin.github.io/angular-chart.js/examples/stacked-bars.html" rel="nofollow">http://jtblin.github.io/angular-chart.js/examples/stacked-bars.html</a></p> <p>My chart ...
<p>you need to change animation to true:</p> <pre><code>var bar = new Chart(canvas.getContext('2d')).Bar(barChartData, { tooltipTemplate: "&lt;%if (label){%&gt;&lt;%=label%&gt;: &lt;%}%&gt;&lt;%= value %&gt;kb", animation: true, }); </code></pre>
Type ´Any´ has no subscript members <p>I have working json parsing code for swift2.2 but when i use it for Swift 3.0 I get errors (Type ´Any´ has no subscript members), can anyone please help me convert the code.</p> <pre><code>do { let json = try JSONSerialization.jsonObject(with: data!, o...
<p>This: <code>if json is [String: AnyObject] {</code> is checking if json is a dictionary, but doesn't cast it to a dictionary, so when you try and access it as a dictionary here: <code>json["error"]</code> you're trying to access it as a dictionary.</p> <p>Instead, you just need to cast it to a new variable with th...
Bundler claims that it is installing pg but later complains that it can't install it (RHEL7) <p>Do you know why bundler would claim that it’s installing the pg gem and then afterward complain that it can’t compile it? It indicates that gems are not installed in parallel, but then goes on to attempt to install pg, ...
<p>You probably don't have PostgreSQL installed. It occurred to me as well on macOS. I simply did <code>brew install postgresql</code> and ran <code>bundle</code> again. If you're on any other OS you need to install PostgreSQL accordingly.<br> What this will do is install all the missing libraries required by the gem.<...
How can I delete selected <tr>(parent) div every time a button (child) is clicked in jQuery? <p>HTML:</p> <pre><code>&lt;tr&gt; &lt;td&gt; &lt;div class="input"&gt; &lt;p&gt;Room 1: &lt;/p&gt; &lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="revenue-input"&gt; ...
<p><strong>An ID must be unique !</strong></p> <p>Change or remove the ID attribute in your HTML</p> <pre><code>&lt;button class="btn-del"&gt;-&lt;/button&gt; </code></pre> <p>And use the .class attribute instead</p> <pre><code>$(".btn-del").click(function() { </code></pre> <p>By the way, instead of <code>.parent(...
Is it possible to find the custom scrollbar css property of a dom node in javascript? <p>If I have an element styled with scrollbar pseudoclasses (eg in chrome), is it possible to find a css property of that pseudoclass? An example:</p> <pre><code>&lt;body&gt;&lt;div #a&gt;&lt;/div&gt;&lt;/body&gt; &lt;style&gt; #a:...
<p>You can subtract the element's offset by its client size which will give the scroll bar size.</p> <pre><code>var myDiv = document.getElement... var verticalScrollBarWidth = myDiv.offsetWidth - myDiv.clientWidth; var horizontalScrollBarHeight = myDiv.offsetHeight - myDiv.clientHeight; </code></pre> <p>Here are tw...
Kafka KStream - significant startup delay <p>Im running into an issue with my <strong>KStreams</strong> based application: it will run once and when I stop/restart it gets 'stuck' and won't progress anymore until I delete the various topics it has created. This doesn't happen <em>every</em> time but more often than not...
<p>If you are running with Kafka 0.10.0.x then you may be hitting a known issue:</p> <p><a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-62%3A+Allow+consumer+to+send+heartbeats+from+a+background+thread" rel="nofollow">https://cwiki.apache.org/confluence/display/KAFKA/KIP-62%3A+Allow+consumer+to+send+hear...
Parsing floating number from ping output in text file <p>So I am writing this python program that must extract the round trip time from a text file that contains numerous pings, whats in the text file I previewed below:</p> <pre><code> 64 bytes from a104-100-153-112.deploy.static.akamaitechnologies.com (104.100.153.11...
<p>I don't know of a way to do that in RegEx, but if you add the following line before the sort, it should take care of it for you:</p> <pre><code>roundtriptimes[:] = [float(x) for x in roundtriptimes] </code></pre>
separate string if they had extensions vb net <p>I'm working in a program to download all the attachments linked to one record on database, the record on database is stored like "attach1.pdf attach2.docx".</p> <p>How could i separate in two differents strings?</p> <p>Something like this: string1=Attach1.pdf string2=a...
<pre><code>Dim fileNames As String() = String.Split({" "c}) </code></pre> <p>Space delimiting file names is incredibly dumb since most filesystems consider the space character to be a valid path character.</p>
How to change Response Header Content-Type from txt/html, Ubuntu, tomcat8 <p>I am calling API to return a <code>JSON</code> with all needed objects (notes):</p> <pre><code>$( document ).ready(function() { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest...
<p>I noticed that I had <code>&lt;script src="noteAPI.js"&gt;&lt;/script&gt;</code> declaration in BOTH index.html and notes.html. I have removed this declaration from index.html and it worked!</p>
Treemap with 3 Strings arguments java <p>I need to save 3 variables in any structure data in java, I was think in treemap because a I need sort the map alphabetically, but, the treemap only take 2 arguments.</p> <p>Any other structure when a can sort the structure in funtion of first argument? like </p> <pre><code>["...
<p>You can use a list of arrays with a custom comparator:</p> <pre><code>public static void main(String[] args) { List&lt;String[]&gt; data = new ArrayList&lt;&gt;(); data.add(new String[]{"bdc", "house2", "car2"}); data.add(new String[]{"abc", "house", "car"}); printData(data); Collections.sort...
How does the Content property work <p>Both syntaxes below works. My question is how does WPF know Content is what I specified?</p> <pre><code>&lt;Button&gt; &lt;Button.Content&gt; my button &lt;/Button.Content&gt; &lt;/Button&gt; &lt;Button&gt; my button &lt;!--how does wpf know this is the con...
<p><a href="https://msdn.microsoft.com/en-us/library/system.windows.markup.contentpropertyattribute%28v=vs.110%29.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow">ContentPropertyAttribute</a> tells xaml parser which property to use for direct content.</p> <p><code>ContentControl</code>, from which <code>Button</co...
How to read a comma position from an Array C# <p>Hi I'm Trying o make an atom simulation game where I can read my data from a txt file and use the data for the simulation/game. I have read the file but I am having trouble finding the commaposition from the string array. The txt file looks like this: 1,H,Hydrogen,1,1+ 3...
<p>Assume you have a text file <code>JUNK1.txt</code> with the lines:</p> <pre><code>1,H,Hydrogen,1,1+ 3,Li,Lithium,7,1+ </code></pre> <p>You can read this line as follows:</p> <pre><code>static void Main(string[] args) { // Path to the file you want to read in var filePath = "path/to/JUNK1.txt"; // Thi...
SVGKit: How do i render an SVG XML String that references a iOS device photo using SVGKit <p><h2>So, my basic question is:</h2> Is there a way on iOS to use SVGKit to render SVG that contains references to local images? <p></p> <h2>Gory Details</h2> <p>My application needs to generate and render SVG (XML in an NSStri...
<p>SVGKit uses Apple's own classes to parse those URL's, and does <em>no</em> additional processing on them.</p> <p>So ... if you're getting a nil image, you're <em>probably</em> breaking NSURL's own parsing capabilities - c.f. Apple's docs.</p> <p>However ... if you run the Xcode debugger, set a breakpoint on the SV...
get getEnvironment() from a service <p>In my notification service I have to send the notifications by mail, but in dev I want to send all the email to a specific adress:</p> <pre><code>if ( $this-&gt;container-&gt;get('kernel')-&gt;getEnvironment() == "dev" ) { mail( 'mymail@mail.com', $lib, $txt, $entete ); } e...
<p>There is no need to inject container. In fact, it is not a good idea to inject container because you're making your class dependent on the DI.</p> <p>You should inject environment parameter:</p> <p><strong>services.yml</strong></p> <pre><code>notification: class: NotificationService arguments: ["%kernel....
Composing Java 8 method references in stream collector <p>I would like to compose method references in a stream's collect(Collectors.toMap(..)) call. In the following example, I have code that accomplishes my task without a method reference:</p> <pre><code>class A { private String property1; private B property...
<p><code>A::getProperty2</code> is a <code>Function&lt;A, B&gt;</code> (that is a Function that takes an instance of A and returns an instance of B).</p> <p>You can cast and compose it as:</p> <pre><code>((Function&lt;A, B&gt;)A::getProperty2).andThen(B::getProperty3) </code></pre> <p>Or you can create a Function pr...
ITextPDF - Link creation with PDFAnnotation <p>I have a question about hyperlinks within pdf documents created with itext. Currently, using the following code written in java, I am able to successfully create links. However, when I hover over the link, the link text is displayed. The client does not want the link te...
<p>This is not an iText problem. It's inherent to PDF. The PDF specification (ISO-32000-1) doesn't say anything about the way viewers should present tool tips for link annotations.</p> <p>Your client (who probably should also be our client), may be confused by the following concepts:</p> <p><strong>Additional actions...
cannot import name multiarray Django Apache2 <p>I am currently running a django app on an ec2 with apache. The app works fine when I run it using djangos runserver command. However I receive a 'cannot import name multiarray' when I run it using apache. I have tried reinstalling numpy and various packages many times and...
<p>I can possibly spot three issues that may effect your setup.</p> <p>Your virutalenv is placed inside your project itself, this in my experience sometimes leads to conflicts. Virtualenvs and the project should always be separated. May I suggest a structures such as:</p> <p>/home/ubuntu/site - django project files ...
Parsing JSON in go <p>My question is about parsing JSON files in golang. </p> <p>Specifically, I am trying to parse output of a command "docker network inspect bridge", which happens to be in JSON format. The command is described here. My goal is to get a list of "IPv4Address" for the listed containers. </p> <p>I hav...
<p>Your code just needs to be modified to further unpackage the data. You're leaving it with each container object represented as an <code>interface{}</code> which makes it so you can't access the fields within it. Another assert on each to make it a <code>map[string]interface{}</code> will allow you to access the fiel...
How do I make my own object like: Set objIE = CreateObject( "InternetExplorer.Application" )? <p>How do I make a 'createobject'?</p> <p>Any useful links/tutorials (or comment) about how to make a 'creatobject' would be nice.</p>
<p>You need to create a COM object that expose IDispatch <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms221608(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/ms221608(v=vs.85).aspx</a>, and register your class in the registry to make it possible to create an ...
wrap child div text inside parent div when child div overflows <p>Codepen: <a href="http://codepen.io/anon/pen/qaVRqw" rel="nofollow">http://codepen.io/anon/pen/qaVRqw</a></p> <p>I'm trying to get the innerDiv to wrap the text before the text extends beyond the parent div. How's the best way to get all the text to sho...
<p>Lots of complex answers, but in reality it's the 150px on the left that is causing it to break out, so cancel it with a margin right...</p> <pre><code>#innerDiv { position: relative; left: 150px; margin-right: 150px; /* add this */ background: pink; } </code></pre>
Ruby-on-Rails toggleable sidebar to edit particular item of list <p>I have a table displaying a collection of cards, one card per row. When I click on a particular row, I get redirected to the page where I can edit this card. I would like to edit them in a toggleable sidebar, which would appear on the right of my table...
<p>You can make a partial that contains the usual <code>form_for</code> element, with the right text boxes and error messages and so on. But in the <code>index</code> controller action for this page (I assume it's something like <code>cards_controller#index</code>), you'll need to set up an instance variable with the e...
ngOptions storing object inside an array <p>I am trying to make a diet form. It has many days, eating types and products. I will be using the code from <a href="https://codepen.io/daniss/pen/QKOdwv" rel="nofollow">codepen</a> to explain the problem. I use ngRepeat to create multiple select forms:</p> <pre><code>&lt;se...
<p>So presumably you've got something where the user enters the number of days / diets / whatever. When you handle that input, why not just initialise your <code>diet</code> array completely</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true"> <div class="snippet-code"> ...
Excel VBA:Looping a Vlookup <p>I'm new to VBA and I'm trying to convert a vlookup formula I wrote to VBA code that will loop through each cell in a column. The vlookup is part of an if statement, which works fine on its own. The problem I'm facing is that I don't know how to tell the vlookup function what cells to look...
<p>For "Help here", look at your formula where you swap out K114 for A114. That means you need to go from current cell in column K back to column A. That can be done with an offset of the current cell by 10 columns to the left to get to column A.</p> <pre><code>Sub Ranking() Dim cell As Range, rng As Range Set rng = ...
MongoDB Group by field and show array of grouped items? <p>I have a collection of Projects in where projects are like this:</p> <pre><code>{ "_id" : ObjectId("57e3e55c638cb8b971"), "allocInvestor" : "Example Investor", "fieldFoo" : "foo bar", "name" : "GTP 3 (Roof Lease)" } </code></pre> <p>I want to ...
<p>You can use $push or $addToSet to create a list of name and _id per every group. $push allows duplicates and $addToSet does not add an element to the list again, if it is already there.</p> <pre><code>db.getCollection('projects').aggregate([ { "$group" : { _id : "$allocIn...
How to plot two histograms on the same axis scale? <p>I have two dataframes: dataf1, dataf2. They have the same structure and columns. 3 columns names are A,B,C. And they both have 50 rows. I would like to plot the histogram of column B on dataf1 and dataf2. I can plot two histograms separately but they are not of the ...
<p>As Zheyuan says, you just need to set the y limits for each plot to get them on the same scale. With <code>ggplot2</code>, one way to do this is with the <code>lims</code> command (though <code>scale_y_continuous</code> and <code>coord_cartesian</code> also work, albeit slightly differently). You also should <strong...
Nginx compare values bigger as <p>How can compare in nginx like (is bigger than):</p> <pre><code>if($a &gt; $b){ return 503 } </code></pre> <p>The problem:</p> <p><em>...unexpected ">" in condition..</em></p>
<p>There is no <code>&lt;condition&gt;</code> support for <code>&gt;</code> or <code>&lt;</code> symbols.</p> <p>See <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if" rel="nofollow">http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if</a></p> <p>But you can use lua to do this:</p> <pre...
Mongoose - Populate not filtering correctly <p>I want to only return the friend objects in the array where the status is "active". Yet, when I do the get request, I am still seeing friends with status "pending". </p> <p>Here is my index controller:</p> <pre><code>index: function(req, res) { User.findOne({ _...
<p>As the reference is at roommate in the user schema, the population should be:</p> <pre><code> .populate({path: "roommates.roommate"}) </code></pre> <p>and the result should look like:</p> <pre><code>[ { roommate: [Object], //populated object balance: 0, requests: [], status: 'pending' } ] </code></...
Cassandra - Wrong timezone being used when inserting <p>This is the date I'm trying to insert into my database: </p> <pre><code>'1970-01-18T00:00:00+00:00' </code></pre> <p>But when I look at the entry in the database it's 8 hours behind:</p> <pre><code>1970-01-17 16:00:00 </code></pre> <p>The time zone used on my ...
<p><a href="http://cassandra.apache.org/doc/latest/cql/types.html#timestamps" rel="nofollow">Cassandra timestamp</a> represents a single moment in time and does not store timezone information, the correct representation in JavaScript is <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Obje...
What is a good layout for advanced database filtering? <p>I have a RecyclerView, showing values from a database. When the page is first loaded, it shows all results, however I want the user to be able to filter by certain string inputs, true/false values, etc. My current layout has a DrawerLayout, with one of the views...
<p>For my recent projects I implemented this kind of UI for data filtering and clients enjoyed it a lot. So, I would encourage you to try something like this . <strong>Just a right nav drawer which sits under toolbar to maintain hierarchy</strong>. <em>As <strong>top level is reserved</strong> for main nav- drawer on <...
How do I place text underneath an image with CSS? <p>I want to place text underneath an image. I want to do this for 4 images that are placed in a row.</p> <p>I've tried implementing a solution, here's the code I've written: <a href="http://pastebin.com/3rgYXKFL" rel="nofollow">http://pastebin.com/3rgYXKFL</a></p> <p...
<p>Height and weight are better as CSS attributes,I would define them in a <code>style=""</code>. So <code>height="176"</code> and <code>weight="201"</code> should become <code>style="height: 176px; width:201px"</code>.</p> <p>Unless there's a specific reason for using inline styles, I'd also suggest you put all your...
Knockout master-detail add computed to detail object <p>With Knockout.js binding, is it possible to add a computed value to the detail objects of a master-detail set? </p> <p>The objective is to programmatically enable and disable a button in a Kendo grid. </p>
<p><strong>From the knockoutjs.com Mapping page:</strong></p> <p>Let’s say you have a JavaScript [master-detail] object that looks like this:</p> <pre><code>var data = { // Master name: 'Graham', // Detail children: [ { id : 1, name : 'Lisa' } ] } </code></pre> <p>// If you want to map...
The type cannot be used as type parameter TRole in the generic type or method UserStore <p>I am trying to build an Identity Server using <a href="http://docs.identityserver.io/en/dev/index.html" rel="nofollow">IdentityServer4</a> and ASP.NET Core MVC 1.0.1 in Visual Studio 2015. I already successfully setup the <code>C...
<p>You are describing the <code>IdentityUserRole</code> twice: for the <code>Role</code> and for the <code>UserRole</code>.</p> <pre><code>public class AppUserRole : IdentityUserRole&lt;int&gt; { } public class AppRole : IdentityUserRole&lt;int, AppUserRole, AppRoleClaim&gt; { } </code></pre> <p>Your AppRole shou...
c string copy fails to empty string <p>I am suppose to go trough a string and remove the letter g,with out using any built in functions, only one variable,that has to be a pointer and no brackets allowed. I have the code,but it keeps returning an empty string and not the new edited string.</p> <pre><code>#include &lt;...
<pre><code>if (*str != 'g' || *str != 'G') { </code></pre> <p>This condition is always true so it always copies the character.</p> <p>Why is it always true, you ask?</p> <p>Think about it - the character is either g, or G, or something else.</p> <p>If it's g, then <code>*str != 'g'</code> is false, and <code>*str !...
What happens when 64-bit unmanaged code calls managed code via COM <p>What happens when you use CoCreateInstance to create a managed code COM object from 64-bit unmanaged code.</p> <p>I have a dll that wraps log4net providing a COM interface. I'm calling CoCreateInstance and it is returning a class not registered err...
<p>It's a classic 32/64 mismatch problem.</p> <p>What you want to do is register your .NET DLL with the 64-bit .NET runtime. Use the "regasm /tlb /codebase" in "c:\windows\microsoft.net\framework64\vXYZ\regasm.exe" where XYZ is the version.</p> <p>If you search for the CLSID of the object in your .NET class, you wil...
How do I call a list or object defined in another instance into another instance? <pre><code>class Sieve: def __init__(self, digit): self.digit = [] numbers = [True]*digit if digit &lt;= -1: raise RuntimeError("Cannot use negative values.") numbers[0] = False numbers[1] = False def findPrim...
<p>According to your post, your functions are unindented, so they're defined outside of your class.</p> <p>Remember python relies heavily on indenting due to the lack of things like braces.</p> <p>Also, your variable are local to your functions, and aren't properties of your class. You need to add them to your class ...
Meteor State Machine <p>I've implemented Nate Strauser's State Machine (<a href="https://github.com/nate-strauser/meteor-statemachine" rel="nofollow">https://github.com/nate-strauser/meteor-statemachine</a>). I get the FSM to save it's state to the DB successfully but I'm tracking several instances. In my example, I'm ...
<p>There is a change in a fork of the original state machine, that adds a transitionTo method, allowing any state to be selected - which I think is what you want in restoring the state from the database. I have a fork which consolidates a few other peoples changes</p> <p><a href="https://github.com/mikkelking/javascri...
Update a value in sql on Insert by using a Rule; Having problems with OLD <p>When I have a table that's like</p> <pre><code>AccNum Location 76 North 87 West 92 South </code></pre> <p>And say I want to insert 76 again but I can only have it in there once so that on an insert for (76,East) I...
<p>In Postgres 95.+, you can use <code>on conflict</code>:</p> <pre><code>insert into t(AccNum, Location) select 76, 'East' on conflict do update set Location = 'East'; </code></pre> <p>Or:</p> <pre><code>insert into t(AccNum, Location) select 76, 'East' on conflict do update set Location = EXCLUDED....
Parsing Alamofire result into objects in Swift (using: Alamofire, SwiftyJSON & ObjectMapper) <p>I'm having problems parsing the incoming JSON.</p> <p>This is my function: </p> <pre><code>func postCheckUserPhonenumbers(phonenumbers:[String], completionHandler: (([AnyObject?], AnyObject?) -&gt; Void)) { let url...
<p>It was indeed my JSON variable declared above the function. I've now got this: </p> <pre><code>func postCheckUserPhonenumbers(phonenumbers:[String], completionHandler: (([AnyObject?], AnyObject?) -&gt; Void)) { let urlString = Constant.apiUrl().stringByAppendingFormat(Constant.apiPostCheckUserPhonenumbers) ...
Does VIM youCompleteMe require internet access? <blockquote> <p>YCM is that it has a client-server architecture. Vim part of YCM is just a thin client that talks to ycmd server.</p> </blockquote> <p>I think the ycmd server is ran in the local machine, not an external right? So no internet connection is needed for YC...
<p>Yes, <code>ycmd</code> is a local server process. You can easily find it when you are using YCM. E.g. on Linux host:</p> <pre><code>$ ps ax | grep ycmd 19298 ? Ssl 0:00 /usr/bin/python2 /home/sysuser/.vim/bundle/YouCompleteMe/python/ycm/../../third_party/ycmd/ycmd --port=53805 --options_file=/tmp/tmpNUlV...
how to route uri with dash in codeigniter <p>I am trying to control my routing in codeigniter. </p> <p>I have my url which is: <strong>www.domain.com/all-artists</strong>. If I am going to accept the dash controller, I need to configure the route.php below:</p> <pre><code> &lt;?php $route['all-artists'] = "all_arti...
<pre><code>RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N] RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301] </code></pre> <p>Using a htaccess rule above something like that you can replace underscores with dashes.</p>
How to return and format an array in php by using curl <p>I know this maybe an easy question but I am still stuck here.</p> <p>I am calling an API, this is my code: </p> <pre><code> $access_token = 'asdfasdfasdfasdf'; $uid = '12345678'; $url = 'https://api.asd.com/2/statuses/user_timeline/ids.json?uid='.$uid....
<p>That is <a href="http://json.org/" rel="nofollow">JSON</a> data...use <a href="http://php.net/manual/en/function.json-decode.php" rel="nofollow">json_decode()</a> to convert to array</p> <pre><code>$arr = json_decode($content, TRUE); $statuses = $arr['statuses']; </code></pre>
PyPlot and Julia can't plot x^2 <p>I want to plot a simple function, but i can't figured out how to do it.</p> <p>this code works fine</p> <pre><code>using PyPlot x = linspace(0,10,1000); y = log(x); plot(x, y, color="blue", linewidth=2.0, linestyle="-") </code></pre> <p>but the next code do not work</p> <pre><code...
<p>You need to use an elementwise exponentiation: <code>x.^2</code>.</p> <pre><code>using PyPlot x = linspace(0,10,1000); y = x.^2; plot(x, y, color="blue", linewidth=2.0, linestyle="-") </code></pre> <p>In Julia v0.5 and later, you should also use the elementwise version of <code>log</code>: <code>y = log.(x)</code...
SKMaps Error When upload play store <p>Sorry but I have a problem when upload my app android to play store. The app use skobbler maps. And I use the version of skmaps that is in the example project (3.0.0) and I get </p> <p>Vulnerability</p> <p>Libpng library The vulnerabilities were fixed in libpng v1.0.66, v.1.2.56...
<p>Please see the skobbler forums where this issue has been documented since June: <a href="http://forum.skobbler.com/showthread.php/7631-Android-Google-Play-Developer-libpng-warning" rel="nofollow">http://forum.skobbler.com/showthread.php/7631-Android-Google-Play-Developer-libpng-warning</a></p>
Triple Fibonacci using linear recursion in Java <p>I'm trying to code a linear recursive Triple Fibonacci (meaning Triple Fibonacci numbers are inspired by Fibonacci numbers but start with three predetermined values, each value afterwards being the sum of the preceding three values.)</p> <p>One of the constraints is b...
<p><strong>EDIT</strong> Based on your edit, now I think the predetermined values should all be 1.</p> <ol> <li>Your initial call to the overload passed 0, 1, 2, but it should pass 1, 1, 1.</li> <li>Your recursive call is wrong. You should be shifting each parameter to the left and passing a new one that is <code>a + ...
Callback in Firebase android <p>After create data on Firebase. I try retrieving data from Firebase. But I have problem, I think may be Log.d(TAG,list.size()) run before ref.addChildEventListener(childEventListener); complete. Who can help me ? </p> <pre><code>public class NewFirebase extends AppCompatActivity { L...
<p>You need to take a second approach to how you are structuring your code, or even take a look at the definition of callback/listener itself.</p> <p>The <code>addChildEventListener()</code> method assigns a callback and initiates a query for retrieving the result. That is, of course, done in background. </p> <p>Usin...
Command line arguments not being passed in sbatch <p>I am trying to submit a job using the SLURM job scheduler and am finding that when I use the <code>--export=VAR=VALUE</code> syntax then some of my variables are not being passed (often the variable in the first instance of <code>export</code>). My understanding is t...
<p>Yes, looks like I had the syntax incorrect. I missed in the documentation that additional variables should be comma separated and specified with a single <code>export</code> flag, e.g.</p> <pre><code>&gt; sbatch --export=build=true,param=p100_256 run.py </code></pre> <p>So previous instances of <code>export</code...
Making checkout billing address fields filling at 100% of the available width <p>I removed the shipping address on WooCommerce checkout page, and would like the billing address fields to fill all the website space.</p> <p>Like this:</p> <p><a href="http://i.stack.imgur.com/tfeV7.png" rel="nofollow"><img src="http://i...
<p>You could try to add this in the <strong><code>styles.css</code></strong> file of your active child theme or theme:</p> <pre class="lang-css prettyprint-override"><code>.woocommerce-page.woocommerce-checkout .col2-set .col-1 { float: none !important; width: 100% !important; } </code></pre> <hr> <p>Or alte...
Can I configure a twilio long number to opt a number back in <p>If a customer sends STOP to my app's twilio number, twilio will block me sending to that number until the customer texts START. Is there any way around this so that if the customer gave me consent verbally, for example, I can turn the number back on? Or ca...
<p>Twilio developer evangelist here.</p> <p>There is no way around this other than having the customer <a href="https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-STOP-BLOCK-and-CANCEL-SMS-STOP-filtering-" rel="nofollow">send an SMS saying START, YES or UNSTOP</a> to your number.</p> <p>Note, w...
command line solution to delete lines before/after pattern matches <p>There is some text I need from a web page, a page whose length changes somewhat from day to day. I am looking to download that text periodically. I do not want/need several dozen lines from both the beginning and end of the roughly 250 line page. The...
<p>If <code>sed</code> seems too difficult to debug, consider a double <code>grep</code>; for example here we list numbers 1 to 250, then <code>grep</code> for <em>70</em>, plus up to 1000 lines after that, then <code>grep</code> for <em>80</em>, plus up to 1000 lines before that:</p> <pre><code>seq 250 | grep -A 1000...
Pass object through Link in react router <p>I found this question, which describes exactly what I was looking for...</p> <blockquote> <p><a href="http://stackoverflow.com/questions/31168014/pass-object-through-link-in-react-router">Pass object through Link in react router</a></p> <p>Is it possible to pass an ob...
<p>You use it with <a href="https://github.com/gaearon/redux-thunk" rel="nofollow">redux-thunk</a> and you can make action for the router.</p> <p>I mean something like this </p> <pre><code>export const boundAllStreams = (nextState, replaceState) =&gt; reqStreams(nextState.params.game); </code></pre> <p>So you can se...
d3 v4 forces acting on dynamically added nodes <p>I'm trying to add nodes one by one to a d3 force simulation (in version 4!) but some do not seem to be being evolved by the simulation after they've been created.</p> <hr> <p><strong>Currently</strong> the simulation assigns one node, then a function, addNode is calle...
<p>The force simulations as the name implies is a simulation on particles interacting with each other. Alpha is used to help converge the system by decaying at each iteration. The forces are multiplied by alpha, so at each iteration the forces become weaker until alpha reaches a very low value when the simulation stops...
jQuery .ajax Syntax error, unrecognized expression <p>I'm trying to retrieve data through .ajax call and add the response html code to bootstrap modal body. But I kept receiving this error:</p> <p>jquery-3.1.0.min.js:2 Uncaught Error: Syntax error, unrecognized expression: <a href="http://localhost/menu/create" rel="n...
<p>I suspect it is due to bootstrap and the fact you have set <code>data-toggle="modal"</code> on the element.</p> <p>Try removing that. You are initializing the modal yourself as it is.</p> <p>What I think is happening is because you didn't use the <code>data-target</code> that is required in association with <code>...
How to include fixes to an open source pacakge in my node.js project? <p>For my node.js application after git clone other developers can currently npm install, npm start to get up and running with no other steps.</p> <p>One of our dependencies which is open source on github (and we currently install through npm) has a...
<p>One alternative to publishing your own version of the package to <code>npm</code> is to add a git URL instead of npm package version to the dependency section of <code>package.json</code>:</p> <pre><code>{ "dependencies": { "some_package": "git://github.com/user/project.git" } } </code></pre> <p>It's what ...
Uber API - requesting ride in sandbox - Receiving Error: Invalid request - validation_failed <p>I am working on Uber API and trying to request a ride in sandbox. I am following API guide from here - <a href="https://developer.uber.com/docs/rides/api/v1-requests" rel="nofollow">Uber API - POST Request</a>.</p> <p><stro...
<p>There is a whitespace character appended to the <code>start_longitude</code> field name:</p> <pre><code>"start_longitude " ^ remove this space character </code></pre>
checking if list is all numbers in lisp <p>so I have a program: </p> <pre><code>(defun add (L) (cond((endp L) nil) (t(cons(1+(first L)))(add(rest L))))) </code></pre> <p>that will add 1 to each member of the list. I want to check if the list is all numbers and return nil if not, and don't know how to go abou...
<p>You can wrap it in a <code>condition-case</code></p> <pre><code>(defun add (L) (condition-case nil (mapcar '1+ L) (error nil))) </code></pre>
JSX for...in loop <p>Given this object:</p> <pre><code>lst socials = { foo: 'http://foo' } </code></pre> <p>I want to loop through it in JSX. This works:</p> <pre><code>let socialLinks = [] let socialBar for (let social in socials) { socialLinks.push(&lt;li&gt; &lt;a alt={social} href={socia...
<p>JSX is just sugar that gets transpiled to a bunch of function calls of <code>React.createElement</code>, which you can find the docs for here: <a href="https://facebook.github.io/react/docs/top-level-api.html#react.createelement" rel="nofollow">https://facebook.github.io/react/docs/top-level-api.html#react.createele...
glyphicon-calendar Start and End Date <p>I have this piece of aspx code:</p> <pre><code>&lt;div class="col-xs-2"&gt; &lt;label for="txtDateActioned" style="cursor: pointer;"&gt;Date Actioned&lt;/label&gt; &lt;div id="sandbox-container"&gt; &lt;div class="input-group date"&gt; &lt;input type...
<p>You can try <strong>endDate</strong> instead of <strong>maxDate</strong> </p> <blockquote> <p>like:- endDate:'+0d'</p> </blockquote>
Python - Append items to a list while making https requests inside a loop <p>I am making requests to <code>SPotify API</code> inside a <code>for loop</code>, like so:</p> <pre><code>track_ids = [] #get track_ids for track in random.sample(pitchfork_tracks, 10): results = sp.search(q=track, type='track') #here I ca...
<p><code>track_ids</code> scope is inside your function. To print list you can do like this </p> <pre><code>track_ids = yourfunction() print track_ids </code></pre> <p>OR </p> <p>you can make <code>track_ids</code> list global and declare it outside of your function. </p>
Update Socrata dataset metadata through API <p>According to <a href="https://dev.socrata.com/publishers/" rel="nofollow">Socrata's "Publisher Guide"</a>:</p> <blockquote> <p>The Publisher API allows you to programatically:</p> <ul> <li><p>Add, update, and delete records within a Socrata dataset</p></li> <li...
<p>Sorry if that statement is a little misleading. Metadata update is available officially through the <a href="https://github.com/socrata/soda-java#update-dataset-metadata" rel="nofollow"><code>soda-java</code></a> library and unofficially through <a href="https://github.com/xmunoz/sodapy" rel="nofollow"><code>sodapy<...
Why is 011 + 001 giving me 011? <p>I'm building a mini binary calculator, and using this logic I am able to combine 2 digit binary numbers (0-3, in decimal) to return at most a 3 digit binary number (0-6, 7 is unreachable with what I have):</p> <p><a href="http://i.stack.imgur.com/0Wdg2.png" rel="nofollow"><img src="h...
<p>You seam to have misunderstood the purpose of <code>Cin (carry in)</code> and <code>Cout (carry out)</code>. In all its simpleness, carry represents an overflow. Which is used to overflow into the next digit of the addition.</p> <h1>1-bit Half Adder</h1> <p>You already got the half adder right. It's just an <code>...
how to have multiple arguments in a input fuction in python <p><strong>This function throws an error at the input function claiming that the arguments are invalid.. any resolutions?</strong></p> <pre><code>def assignSquareValues(): square=[[0,0,0], [0,0,0], [0,0,0]] coun...
<p><code>input()</code> expects one argument - displayed text - so you have to concatenate all arguments in to one text</p> <p>ie.</p> <pre><code>input("Enter a number(1-9) for square #" + str(count) + ":") </code></pre> <p>or</p> <pre><code>input("Enter a number(1-9) for square #{}:".format(count)) </code></pre>
HighCharts : 3D Pie Chart Not Displaying <p>Below is my code:</p> <pre><code>exec_dashboard_load_chart('exec_dashboard_gender_chart',response); /** * A function that loads a chart. */ function exec_dashboard_load_chart(id , data){ var myChart = Highcharts.chart(id, { chart: { type: 'pi...
<p>Check out this <a href="https://jsfiddle.net/6Lvj0arr/2/" rel="nofollow"><strong>Working Fiddle</strong></a></p> <pre><code>function exec_dashboard_load_chart(id , data){ var myChart = Highcharts.chart(id, { chart: { type: 'pie', options3d: { enabled: true, alpha: 45,...
How do i check null pointer exception in DATE data type <p><a href="http://i.stack.imgur.com/mZRmq.png" rel="nofollow"><img src="http://i.stack.imgur.com/mZRmq.png" alt="enter image description here"></a>We have Talend Data Integration tool which uses eclipse code while sending the info from source to target system. Ge...
<p><code>row1.DNDB==null?"null":row1.DNDB</code> can't work : you are assigning to the output value either "null" (a string, with the double quotes) or row1.DNDB , which should be a date. You will have a cast exception in compilation.</p> <p>You can try either : </p> <pre><code>Relational.ISNULL(row1.DNDB)?null:row1...
C++: How to properly print out the long long int using cout <p>I wrote a code to get the factorial of a number in C++.</p> <p>Here is the code.</p> <pre><code> #include &lt;iostream&gt; using namespace std; unsigned long long getFactorial(int); int main(int argc, char **argv) { int num = 5; un...
<p>Now I found the answer by myself.</p> <p>By using the <code>gmp</code> library, it became much easier to deal with the big integers.</p> <p>Here's the modified code.</p> <pre><code>#include &lt;iostream&gt; #include &lt;gmpxx.h&gt; using namespace std; mpz_class getFactorial(int); int main(int argc, char **arg...
C++. Doesn't seem to take input from the user <p>So I'm new to C++. The idea is that it's supposed to give the user two options, and either option reads input from the user. However, neither of them actually reads any input from the user and instead just skips to the end of the program. Any help is really appreciated! ...
<p>I think you must remove character "enter" from stdin. Try:</p> <pre><code>std::cin &gt;&gt; number; getchar(); </code></pre>
MySQL How can I select get specific status and else get last ID if not meet requirement status? <p>I have seen solutions for something similar on other posts, but I am having an issue applying it to my problem.</p> <p>I have this table for voucher last history:</p> <p><code>t_release</code>:</p> <p><code>+----------...
<pre><code>SELECT * FROM t_release t where release_id IN (SELECT DISTINCT release_id FROM t_release WHERE code_status_id = 3) UNION ALL SELECT * FROM t_release t where release_id IN (SELECT MAX(release_id) FROM t_release x WHERE NOT EXISTS (SELECT 1 FROM t_release y WHERE code_status_id = 3 and y.code_id...
Having empty string from returning in PHP <p>When I use some characters like <code>/</code> in the textbox I get returned an <code>empty string</code> in <code>response</code>. I can easily make a check for <code>empty string</code> in my html but my question is how can I avoid having that empty string from being sent ...
<p>You could change your js function and use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent" rel="nofollow">encodeURIComponent</a> to encode the value before sending the request:</p> <pre><code>$("#search").keyup(function(){ var newVal = $(this).val(); ...
how to Use CSS only to add the appropriate logo images each p <p>Use CSS only to add the appropriate logo image next to each solution. This means that you won’t be adding an tag to the page to get the image to appear. It will be added using CSS and formatted with CSS as well. Solution must be moved over to the right...
<p>homework?? try </p> <pre><code>:after </code></pre> <p>or</p> <pre><code>:before </code></pre> <p>and </p> <pre><code>background-image </code></pre>
Angular $uibmodal resolve with asynchornization <p>I have a service that gets data from a server. After retrieving data successfully, I would pass to a $uimodal in a directive. My code is described below</p> <p>Problem is when I run my app first time, console log shows consequence like </p> <ol> <li>debug sizeList ou...
<p>You slightly over complicated your codes, as <code>modal</code> resolve basically helps to resolve async (promises) before creating modal window, so change your <code>resolve</code> of <code>$modal.open</code> to</p> <pre><code>resolve: { sizeList: function(GeneralHelperService) { return GeneralHelperServ...
Facebook Restful API create reaction <p>I'm looking to create a facebook reaction (like/etc) using just the authenticated user token and a URL without using the SDK. I keep reading that the API is RESTful, however, I can't get any information on this aspect of it. From this API reference link </p> <p><a href="https:...
<p>I believe this is not currently exposed</p> <p><a href="https://developers.facebook.com/docs/graph-api/reference/post/reactions" rel="nofollow">https://developers.facebook.com/docs/graph-api/reference/post/reactions</a></p> <blockquote> <p>Creating</p> <p>You can't perform this operation on this endpoint.</...
How can I terminate the console? <p>a newbie here. I have the following:</p> <pre><code>#include&lt;iostream&gt; #include&lt;string&gt; #include&lt;iomanip&gt; #include&lt;cmath&gt; #include&lt;stdlib.h&gt; using namespace std; int main() { int choice; double radius, length, width, base, height; const do...
<p>Generally speaking calling <code>exit()</code> is a bad practice because if your application contain larger code it gives you unexpected behaviour when trying to debug and understand why your application suddenly vanished into thin air (assuming you do not remember all your code by heart).<br><br>In your sample here...
Show a UIView when a variable meets a condition <p>I have a model object called <code>PlayerStore</code> which is an array of <code>Player</code> objects. These get added to the <code>MainVC</code> view controller's <code>UITableView</code>. Here a user can add <code>Player</code> objects that are displayed in <code>UI...
<p>You can use the Delegate pattern.</p> <pre><code>protocol MainViewControllerDelegate { func playersDidChange() } class MainViewController: UIViewController, MainViewControllerDelegate { func playersDidChange() { // Check store to determine if label is to be shown } } </code></pre> <p>Then in ...
How to return multiple JTextField using JComponent? <p>I'm trying to return multiple <code>JTextField</code> using getter method but I still don't have idea have can I return them as bulk. I know how to return single <code>JTextField</code> using this.</p> <pre><code>public JTextField getJTextField() { return this....
<p>Try this:</p> <pre><code>public List&lt;JTextField&gt; getAllJTextField(JComponent input) { List&lt;JTextField&gt; list = new ArrayList&lt;JTextField&gt;(); for (Component c : input.getComponents()) { if (c.getClass().equals(JTextField.class)) { list.add((JTextField)c); } } ...
I don't know how to fix this error: reached end of file while parsing <p>When running this code, I keep getting the same error, I thought the I fixed the error with the brackets, but I was wrong.</p> <pre><code>public class INCOME { public static void main(String[] args) { int income = 4001; if (income &gt; 3000) { J...
<p>You are missing a curly brace, it should run fine after you add one.</p> <pre><code>import javax.swing.*; public class INCOME { public static void main(String[] args) { int income = 4001; if (income &gt; 3000) { JOptionPane.showMessageDialog(null, "Income is greater than 3000"); } else if (inco...
SQL Server replace NULL value with last value from previous row <p>I'd like to replace NULL value for each code group using the value before the first Null:</p> <pre><code>code amount date ------------------------------- A 1500 2013-02-03 A 1800 2013-03-05 A 1300 NULL ...
<p>How about?</p> <pre><code>UPDATE mytable SET date = date2 FROM mytable o CROSS APPLY (SELECT MAX(date) date2 FROM mytable i WHERE i.id=o.id group by id) ii where o.date is null </code></pre>
Show Div on Dynamically Created RadioButton Selection (PHP-AJAX) <p>I have created radio button is created on client side and when I click it, it should show my existing div i.e. ifPrint</p> <p>Please have a look at code I am trying:</p> <p>radio button creation:</p> <pre><code>var optiondiv = document.getElementByI...
<p>You need to use click instead of change, and also you missing quotes in your code, and it's better to use "on" than "click" function if element is created after dinamicaly</p> <pre><code>$('body').on('click','input[type=radio][name=newopt]',function () { $('#ifPrint').show(); }); </code></pre>
How can I write a C function that takes either an int or a float? <p>I want to create a function in C that extends Python that can take inputs of either float or int type. So basically, I want <code>f(5)</code> and <code>f(5.5)</code> to be acceptable inputs.</p> <p>I don't think I can use <code>if (!PyArg_ParseTuple(...
<p>If you declare a C function to accept floats, the compiler won't complain if you hand it an int. For instance, this program produces the answer 2.000000:</p> <pre><code>#include &lt;stdio.h&gt; float f(float x) { return x+1; } int main() { int i=1; printf ("%f", f(i)); } </code></pre> <p>A python module ve...
Passing session variables to other pages in cakephp <p>I'm trying to pass session variables in cakephp. This is how I tried:</p> <p>LoginController.php:-</p> <pre><code>&lt;?php namespace App\Controller; session_start (); use App\Controller\AppController; use Cake\ORM\TableRegistry; class LoginC...
<p>You're accessing an undefined index <code>memberid</code>, it is supposed to be <code>MemberID</code>.</p> <pre><code>value="&lt;?= $_SESSION["MemberID"]; ?&gt;" </code></pre>
Error in using dashing on raspbian <p>I've trying to implement dashing on a raspberry(1) witj raspbian (jessie lite). Once i've installed raspbian, i've done the following things with success : </p> <p>sudo apt-get update sudo apt-get install libssl-dev sudo apt-get install ruby-dev sudo apt-get install nodejs sudo ap...
<p>Post 'gem list json' to see whether json module is installed. If not, then try installing it with 'gem install json'.</p>
In Django, how do I order_by() when reaching across tables? <p>I'm trying to filter my Friendships objects and then order_by user.first_name, but it's not working. Can anyone tell me what I'm doing wrong?</p> <p>Here's my models:</p> <pre><code>class Friendships(models.Model): user = models.ForeignKey('Users', mo...
<p>It's not your order by that's wrong but what you do with the results. Let us digest the following, particularly line 3</p> <pre><code>ordered_friends = Friendships.objects.filter(user__id=1).order_by('user__first_name') for ordered_friend in ordered_friends: print ordered_friend.friend.first_name, ordered_frien...
NoClassDefFoundError: org/apache/poi/ss/formula/udf/UDFFinder error in java <p>hi i am writing a excel using apache poi.I am using SXSSFWorkbook for it.But when this code executes i am getting this error again and again. Caused by: java.lang.NoClassDefFoundError: org/apache/poi/ss/formula/udf/UDFFinder</p> <p>my sampl...
<p>Your poi jar version is not matching the poi-ooxml jar version </p> <p><code>poi-ooxml-3.10-FINAL</code> depends on <code>poi-3.10-FINAL</code></p> <p>You either remove dependency on poi as poi-ooxml brings needed version or add proper version for poi</p>
PHP remove duplicated result in array inside an structure <p>I making a language loop inside a structure that return the result in radio and i need to return the last select that user selected before inside this foreach ... in this code i get duplicated result the checked one and unchecked one. How can I show the resul...
<p>May this will work:</p> <pre><code>&lt;?php // to select the language that insert in table "x_language" for this user // the result is 1 in this case $usuario_id = $this-&gt;session-&gt;userdata('usuario_id'); $usuario_id = $this-&gt;cake-&gt;get_current_language_to_user($usuario_id); // to get ...
How to use panic=abort with external dependencies? <p>For single crate projects, adding these lines to <code>Cargo.toml</code> works as expected.</p> <pre><code>[profile.release] panic = "abort" </code></pre> <p>Then build the project:</p> <pre><code>cargo build --release </code></pre> <hr> <p>However, on a projec...
<p>Looks like it's because <code>c_vec</code> specifies <code>dylib</code> as one of its library types.</p> <p>I filed this as an issue on Github here: <a href="https://github.com/rust-lang/cargo/issues/2738" rel="nofollow">https://github.com/rust-lang/cargo/issues/2738</a></p> <p>And got an answer from one of the de...
problems with ascii conversion java <p>hey so I have a problem with typecasting int. I have a program here designed to print the two digits of an entered number then I am supposed to increment the first digit using the ++ operator and multiply by ten then add the second digit and print the new number (which should be t...
<pre><code>int AsciiToInt = FirstDigit - '0'; int digit2 = SecondDigit - '0'; </code></pre> <p>Unless you have a particular reason to manipulate the input character by character, you should just do:</p> <pre><code>int input = Integer.parseInt(keyboard.nextLine()); input += 10; </code></pre>
angular2 not loading the component on entering the url path <p>When trying to load a specific component by entering it's url path the app doesn't load the component. It only shows the loading message and I don't get any errors mentioned in the console.</p> <p>But if I try loading the same component by redirecting the ...
<p><strong>1)</strong> You can use <strong>HashLocationStrategy(#)</strong> for that <em>server-side routes</em> configuration is not needed.</p> <pre><code>@NgModule({ imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes, { useHash: true }) //&lt;&lt;&lt;===here ], ... }) </code></p...
Checking if string contains valid Python code <p>I am writing some sort of simple web-interpreter for vk.com . I look for messages, check if they are valid Python code, and then I want to execute that code, and return any <code>stdout</code> to code sender. I have implemented anything but code checker.</p> <pre><code>...
<p>Keep in mind, the difference between a runtime error and a parser error is significant in your case and example. The statement:</p> <pre><code>test </code></pre> <p>is <em>valid</em> code. Even though this statement will throw a <code>NameError</code> when the Python VM executes the code, the parser will not know ...
Log user back in with remember me with Laravel 5 <p>I have it setup so that onced logged in, the remember me is set to true with <code>Auth::attempt([$u, $p], true)</code>;</p> <p>But the session expires after 2 hours of no activity. So the user becomes logged out. </p> <p>The documenation was very clear, how does th...
<p>By default laravel session life time is set to 120 min you can cofigure it from config/session.php - <strong>lifetime</strong>.</p> <p>If the user checked remeber me for an application, Laravel will queue a permanent cookie that contains the encrypted copy of the user identifier. Laravel will then decrypt this lat...
Verify only Login credentials from DB <pre><code>&lt;?php session_start(); include("connection.php"); if (mysqli_connect_error()) { die("Could not connect to database"); if ($_POST['submit'] == "Login") { $query = "SELECT * FROM EmployeeTable WHERE name='" . mysqli_real_escape_string($link, $_POST...
<p>First off all: You are vulnerable to sql injections using this code. Please use parametrized queries so you don't forget to escape values you use in your queries.</p> <pre><code>$mysqli = new Mysqli($host, $username, $password, $database); $mysqli-&gt;prepare('SELECT * FROM EmployeeTable WHERE name = ? AND password...