input
stringlengths
51
42.3k
output
stringlengths
18
55k
How do I ask the user if they want to play again and repeat the while loop? <p>Running on Python, this is an example of my code: </p> <pre><code>import random comp = random.choice([1,2,3]) while True: user = input("Please enter 1, 2, or 3: ") if user == comp print("Tie game!") elif (user...
<p>Points for your code:</p> <ol> <li>Code you have pasted don't have <code>':'</code> after <code>if,elif</code> and <code>else.</code></li> <li>Whatever you want can be achived using Control Flow Statements like <code>continue and break</code>. <a href="https://docs.python.org/2/tutorial/controlflow.html" rel="nofol...
Laravel Eloquent and 3 table relationship <p>I'm looking for some help in working out how to setup the Eloquent relationships for my application.</p> <p>I have created migrations for three tables.</p> <pre><code>| users | | items | | user_items | +-----------+ +-----------+ +------------+ | id ...
<p>What are you doing here is actually a M:M relationships, and Laravel Eloquent already have support for that o<a href="https://laravel.com/docs/5.3/eloquent-relationships#many-to-many" rel="nofollow">ut of the box.</a> The user_item table you have is referred to as the pivot table.</p> <p>Here's how to setup your re...
How can i upload text and image data in a single request to server Objective c <p>I am using this dictionary but not able to upload.</p> <p><code>dictionary = @{ kRequest: sign_in_owner, o_first_name: s_fname, o_middle_name: s_mname, o_last_name: s_lname, o_email_id: s_email, o_primary_no: s_pn...
<p>You can use <a href="https://github.com/AFNetworking/AFNetworking" rel="nofollow">AFNetworking Framework</a></p> <p>It provides methods to upload text and image at a time (in one service call).</p> <pre><code>NSData *imageData = UIImageJPEGRepresentation(imgAttachment, 0.5); NSMutableURLRequest *request = [[AFJSON...
How to cancel single volley request in android? <p>I have a <code>MainActivity</code> which adds a <code>Fragment</code> which send server request and contained a <code>ListView</code> with swipe to refresh ,Problem is that when I swipe down to refresh it is sending server request at the same time if I press device bac...
<p>you can set a tag to your request. It will be an identification for every request. After that, your request queue has a cancelAll method, it is require a tag. </p> <p>//Before you add your request to the queue, set the tag, the tag can be a string, or sth like that. </p> <pre><code>yourRequest.setTag(tag); </code>...
read cell value preserve precision <p>I am Reading Excel using C# with<br> string cellvalue= worksheet.Cells[2, 2].Text; and the exact value in that cell is 0.0833333333333333 but the above code could only read value 0.083333333 which is the visible value in the excel sheet as well. this is cause of data loss/preci...
<p>Thanks Charles, Value2 worked for me. Initially i was not able to find value2 on Cell. Then I used object rangeObject = sheet.Cells[row, column]; Range range = (Range)rangeObject; string cellValue; cellValue = rangeValue != null ? rangeValue.ToString() : 0.ToString() </p>
How to auto attach the file to input file type field from DB <p>I am using php file attachment to upload file. In DB i am getting the file name with the extension of the file and storing it into DB. There is the modify button which will fetch all the entries from the DB and display on the screen. There is one text fiel...
<p>since you havent provided any code sample, it hard to pinpoint what issue your having , but my guess is your looking for something like this</p> <pre><code>&lt;input type="file" id="file" name="file"/&gt; &lt;button ng-click="add()"&gt;Add&lt;/button&gt; </code></pre> <p>and the to get file content use the below ...
python+pyspark: error on inner join with multiple column comparison in pyspark <p>Hi I have 2 dataframes to join</p> <pre><code>#df1 name genre count satya drama 1 satya action 3 abc drame 2 abc comedy 2 def romance 1 #df2 name max_count satya 3 abc 2 def 1 </code></pr...
<p>Update: It seems like your code was failing also due to the use of "count" as column name. count seems to be protected keyword in DataFrame API. renaming count to "mycount" solved the problem. The below working code was modify to support spark version 1.5.2 which I used to test your issue.</p> <pre><code>df = sqlCo...
make custom action when try to remove row MSSQL <p>I'm using 3-rd side library 'datatables' in my project to manage products table. When user click delete button on client, I want selected product recieve delete flag (bit column in the products table), but this library just delete row. Can I prevent delete action and s...
<p>You can try something with "DataTables" library. Change the TYPE of Remove attribute of datatable Editor to "PUT" instead of "DELETE". There in PUT action you can update delete flag.</p>
removing 0.0 from second column in file <p>I have a file log.txt that has the format shown below.</p> <h1>log.txt</h1> <pre><code>280,249.999441 140,0.0 140,0.0 84917,182.59465 140,0.0 72161,185.615882 304,249.998589 280,240.184619 </code></pre> <p>I want to remove all the entries that has 0.0 in the second column.<...
<p>You can use awk:</p> <pre><code>awk -F, '$2 != "0.0"' log.txt 280,249.999441 84917,182.59465 72161,185.615882 304,249.998589 280,240.184619 </code></pre> <p><code>-F,</code> sets input field separator as comma and <code>$2 != "0.0"</code> checks if 2nd column is not <code>0.0</code>.</p>
How to access js files from components folder in React Native ios project <p>I am unable to access components folder in React Native Project IOS.</p> <p><strong>I am getting following error:</strong></p> <blockquote> <p>Unable to resolve module ./Login from ....../ReactNative/ReactNativeProject/components/App.js:...
<p>I have tried this so far and got the solution for this.</p> <p>One mistake I did in <strong>App.js</strong>:</p> <p>I have replaced <code>var Login = require('./Login');</code> </p> <p>by </p> <pre><code>import Login from './Login'; </code></pre> <p>The js files under components folder also changed as follows, ...
How to use sqlite in angularjs application <p>I have to used below code for using sqlite inside angulajs.but i got error like, Module name "sqlite3" has not been loaded yet for context: _. Use require([]) please help me</p> <pre><code> var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.Database('mydb.sql...
<p>You cannot use sqlite3 in angularjs web application directly, because angularjs is client-side frontend framework, and sqlite is a database and a part of the backend. </p> <p>So you can only use sqlite in your application via backend services implemented on the server side (nodejs, java, ...). And if you need brows...
How do I make a local variable increase consistently in a recursive function having more than one calls? <p>In this code, I've used a global variable to increase the value of p whenever control touches the base case. But I want to do it without using a global variable. Is that possible?</p> <pre><code>public class sta...
<p>Your problem is that you're throwing away a major communication resource: the return value. You recur in three places, but ignore the value. Harness that, and you'll solve your problem.</p> <p>Consider something like this:</p> <pre><code>if (n &lt; c) return 0 // Jumping too far gives no solution else if...
How to connect angular 2 with back-end server? <p>I am running my angular 2 app with node And back-end with Wildfly server. Both are running on different servers( On same machine). I need to make a call to API from front-end for retrieving data. Will it work?</p>
<p>In development environment; you can proxy your angular2 app router to your api port and path;</p> <p>for example:</p> <p>you can use webpack-server proxy config:</p> <pre><code>devServer: { changeOrigin: true, historyApiFallback: true, proxy: { '/api/v1/*': { target: ...
check availability of google street view using google map sdk for ios <p>I am using <code>Google Maps SDK</code> for <code>iOS v 2.0.1.</code> Using <code>GMSPanoramaView class,</code> i am able to show street view for points where street view is available, but at the coordinates where street view isn't available, noth...
<p>To check if a Streetview panorama <strong>exists</strong> for a certain location or not ? you have to use the <a href="https://developers.google.com/maps/documentation/ios-sdk/reference/protocol_g_m_s_panorama_view_delegate-p#a13f31eac13f4e3d4febde8a0d3eba9fa" rel="nofollow">GMSPanoramaViewDelegate</a></p> <pre><c...
Java Annotations javaArgs and LiteralArguments are deprecated <p>I have problem with Java Annotations because some functions are deprecated and I don't know how to write it with "Annotation.tree" which is suggested.</p> <p>here is deprecated code:</p> <pre><code>lazy val lengthOfAnnotation = p.annotations.find(_.tpe ...
<p>I found a solution and it is working now. </p> <pre><code> import scala.reflect.runtime._ import scala.reflect.runtime.universe._ lazy val lengthOfAnnotation = p.annotations.find(_.tree.tpe == ru.typeOf[Len]) val result = lengthOfAnnotation.flatMap { a =&gt; a.tree.children.tail.head.collect({ ...
How can I jump to system wifi list in ios10? <p>in older version, we use <code>[NSURL URLWithString:@"prefs:root=WIFI"]</code>, but in iOS10, it doesn't function.</p>
<p>Its not working in ios 10 any more,</p> <p><a href="https://forums.developer.apple.com/thread/49730" rel="nofollow">https://forums.developer.apple.com/thread/49730</a></p> <p>Refer this link.</p>
Can I chain commands together with gm for node.js? <p>Can I chain two or more commands together when using <code>gm</code>, the GraphicsMagick library for node?</p> <p>Specifically, I've got an image that I'd like to add text to, then put a watermark on it, but nothing I try seems to work.</p> <p>I've tried using <co...
<p>Yes, you can, but not in this situation. You can make some workaround calling <code>gm</code> twice and piping result of first call to another:</p> <pre><code>const stream = require('stream'); const passThrough = new stream.PassThrough(); gm(image).drawText(0, 0, 'Text').stream().pipe(passThrough); gm(passThrough)...
rpm reinstall does not reinstall config files? <p>I have an rpm with a file marked as config file in the %files section:</p> <pre><code>%files %config /path/to/file.conf </code></pre> <p>now suppose I edit this file on-disk. I wish to repair this and redo a clean install of the package; thus restoring the config file...
<p>Yes zypper would need to add --replacefiles in order to overwrite %config files. The harder issue (for zypper) is the scope of --replacefiles: the option applies to a transaction, not a single package in the transaction.</p> <p>Easiest solution by far (imho) is to install the package manually using --replacefiles o...
Handling Checkbox in angular js <pre><code> div class ="col-lg-5 stylethistitle"&gt; &lt;input type=" checkbox" ng-model = "checkedStatus"&gt;Show Deactivated Account&lt;/div&gt; </code></pre> <p>I need to pass $scope.checkedStatus in my json request as false when it is selected and true when it is unselected. </p>...
<p>Assign a default value for $scope.checkedStatus in the controller. Set it to true or initial value.</p> <p>Check doc <a href="https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D" rel="nofollow">here</a></p>
Need help understanding what's going on in my while loop <p>My program executes just fine, but I have questions about how my <code>while</code> loop is set up.</p> <p>I know the Boolean values for true and false are 1 and 0, respectively, but I'm not understanding why my output displays the even and odd numbers backwa...
<p><code>number % 2</code> is <code>0</code> if <code>number</code> divides <code>2</code> (i.e. is <em>even</em>), <code>1</code> if <code>number</code> is <em>positive</em> and does not divide <code>2</code> (i.e. is <em>odd</em>), and <code>-1</code> if <code>number</code> is <em>negative</em> and does not divide <c...
z-index Not Working with Absolute Position <p>If you take a look at my test website <a href="http://www.hosting-mate.com/marinebuoysaustralia/" rel="nofollow">here</a> you will see that the "Scroll Down" button is overlapping all my content, no matter what z-index I input. Is there a way to fix this issue? I realize th...
<p><code>z-index</code> becomes effective only for elements that have attribute <code>position</code> with value <code>absolute</code> or <code>fixed</code> or <code>relative</code>. Elements with <code>position: static</code> (which is the default for all elements) will not be affected by the <code>z-index</code>.</p>...
ms SQL update column value <p>The question is, how do you update a field value in a MS Query by 1 ? I am trying to add 1 (+1) to an column in my SQL Server, and I only want the update to alter values between 200 to 500.</p>
<p>That's a basic <code>UPDATE</code>. Use the <code>SET</code> clause to modify columns. Use <code>WHERE</code> clause to decide which rows to update:</p> <pre><code>update tablename set col = col + 1 where col &gt;= 200 and col &lt;= 500 </code></pre>
An item with the same key has already been added. error due to multiple time call to embedded DLL <p>I have add one dll as embedded resource in my windows forms application. I got code how to use embedded dll in my windows forms application.</p> <p>This code used:</p> <pre><code> public PanContext() : base("Connect...
<p>AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);</p> <p>static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { return EmbeddedAssembly.Get(args.Name); }</p> <p>User this in you main startup poin...
how virtual memory increases context switching overhead? <p>What is the difference between context switching approaches used in a system having virtual memory and without virtual memory ?</p>
<p>If your system has no virtual memory, you don't need to flush your translation look-aside buffer (TLB) which keeps track of virtual -> physical memory translations during a context switch. The reason you have to do this in a system with virtual memory is because the mappings held in the TLB will most likely be inval...
Create combinations from elements in an array <p>I have an array reference like below:</p> <pre><code>my $strings = [qw(a b c d)]; </code></pre> <p>I want to form all possible combination and create an array of array as:</p> <pre><code>my $output = [qw(qw([a],[b],[c],[d],[a,b],[a,c],[a,d],[b,c],[b,d],[c,d], [a,b,c...
<p>There's <a href="http://search.cpan.org/~allenday/Math-Combinatorics-0.09/lib/Math/Combinatorics.pm" rel="nofollow">Math::Combinatorics</a>.</p> <pre><code>#!/usr/bin/perl use strict; use warnings; use Math::Combinatorics qw(combine); use Data::Dumper; my @n = qw(a b c d); my @res; push @res, combine($_, @n) forea...
Xamarin forms - Error when toggling entry view's IsPassword (only on uwp) <p>I have the following sample app code:</p> <p>App.cs (Entry Point)</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using Xamarin.Forms; namespace App1 { public class ListItem { ...
<p>Looks like this is actually a bug in Forms. I've submitted a bug report for it <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=44954" rel="nofollow">here</a>.</p> <p>The issue seems to be related to setting the native TextBox control InputScope property. I created a <a href="https://github.com/xamarin/Xamarin...
Receiving as Argument Functions with Constrained Existentials in Haskell <p>I've been playing with some GHC extensions to define a function that can do the following:</p> <pre><code>let a = A :: A -- Show A b = B :: B -- Show B in myFunc show a b -- This should return (String, String) </code></pre> <p><co...
<p>The problem is that just passing the function <code>(forall c . k c =&gt; c -&gt; d)</code> as an argument is not enough for the type-checker to unambiguously determine what <code>k</code> really is. Passing the constraint explicitly works and you don't even need the outer <code>forall</code> or explicit kinds:</p> ...
Configure ECS to use Reserved Instances <p>ECS (EC2 Container Service) works with Auto Scaling Groups. But is it possible to use ECS with Reserved Instances? I ask this because Reserved Instances are cheaper.</p>
<p>When you reserve an instance, you get billed for all possible hours of use for the reservation period at the beginning of the period, whether you use the hours or not. At the end of the billing period, AWS will reconcile your usage hours vs. reserved hours. </p> <p>This means that regardless of whether you stopped ...
Run a sql select query in a loop <p>I am monitoring a table in real-time, let's say the table name is user_stats, which keeps a record of users logging into my website and I am monitoring as to how many users have logged in, the query I am using is simple <code>SELECT * FROM user_stats</code> Now, since the project is...
<p>If you want to run a Query,Stored Procedure in a Specific date and time without executing by a user you can do it by using:</p> <pre><code> Event </code></pre> <p>Mysql Event is a very powerful tool to execute a query or any, "Automatically" by setting up the execution date and time.</p>
i want to send parameters to function in an array <p>i am trying to use this code:</p> <pre><code>$arr = [ function ($a) { return $a + $a; }, function ($b) { return $b * $b; }, function ($c,$cc) { return $c % $cc - $c; }, function ($d) { return $d + 4 / $d; } ]; </code></pre> <p>how can i pas...
<p>You can do the following:</p> <p>Your array:</p> <pre><code>$arr = [ function ($a) { return $a + $a; }, function ($b) { return $b * $b; }, function ($c,$cc) { return $c % $cc - $c; }, function ($d) { return $d + 4 / $d; } ]; </code></pre> <p>Your ran...
factory is undefined when using ng-file-upload <p>I have a form in which I save some details and upload a file. I have a factory from which I get some data. When I use <code>ng-file-upload</code> the factory is undefined. Here is the code:</p> <pre><code> angular.module('tollApp') .controller('mstrEmployeeCt...
<p>It's an injection problem. You have to put the <code>userDetailsFactory</code> in the array :</p> <pre><code>angular.module('tollApp') .controller('mstrEmployeeCtrl',['Upload','$window','$scope', '$http','$timeout','$filter','$mdToast','userDetailsFactory' function(Upload,$window,$scope,$http,$timeout,$...
trying to validate text input with bash <p>I'm tryong to validate a simple text input. I need to validate the the input is Either Yes or NO. I'm using the following code:</p> <pre><code>#!/bin/bash IsSSL=$1 if [$IsSSL = "Yes"] || [$IsSSL = "No"]; then echo "correct input" else echo "incorrect input" ...
<p>try this;</p> <pre><code>#!/bin/bash IsSSL=$1 if [ $IsSSL = "Yes" ] || [ $IsSSL = "No" ]; then echo "correct input" else echo "incorrect input" fi </code></pre> <p>In bash, you need spaces around [ and ] in if conditions</p>
How to get a Python 2.7 package (Spynner) to work with Python 3? <p>The Spynner docs says it supports Python >=26, but during installation I get the following error:</p> <pre><code>(spynner) spynner$ pip3 install spynner Requirement already satisfied (use --upgrade to upgrade): spynner in /Users/spynner/Envs/spynner/l...
<p>You will need to correct the offending code. There are automated tools that help you do that, such as <a href="https://docs.python.org/2/library/2to3.html" rel="nofollow">2to3</a>:</p> <blockquote> <p>2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into va...
SDL Web-8, Topology Installation <p>I am installing sdlweb8 on virtual machine as a standlone.</p> <p>I am trying to run </p> <p>Add-TtmWebsite -Id visitorsweb -CdEnvironmentId LocalCD -BaseUrls <a href="http://localhost:82" rel="nofollow">http://localhost:82</a></p> <p>Getting error</p> <p>Add-TtmWebsite : Unable ...
<p>In the Discovery Service Storage Config, at the bottom where the services are listed, please try to access each of the service URLs. If you are not using OAuth, you can simply do this in the browser. If you are using OAuth, then follow Peter's tips here, <a href="http://tridion.stackexchange.com/questions/13736/wh...
Request header field is not allowed by Access-Control-Allow-Headers in preflight response <p>I am using <strong>angularjs2</strong> in frontend &amp; <strong>Java Spring</strong> as backend rest api &amp; getting the error.</p> <pre><code>XMLHttpRequest cannot load 'Some url'. Request header field appkey is not allowe...
<p><strong>Angular2 is lower-casing the headers!</strong></p> <p>So <code>Content-Type</code> will be <code>content-type</code>, check that your backend will allow it! :)</p> <p>See also this question: <a href="http://stackoverflow.com/questions/39630790/cross-orgin-error-in-google-chrome-for-the-api-call">Cross orgi...
What is the best way to make animation from 100 image frame in Unity? <p>In Unity i want to make an animation Map. I have created a animation map with 100 frame image.</p> <p>The animation image size total is too large for android games. And if i using animation in unity it will take a time to sort the image record on...
<p>try "Texture Sheet Animation Module" of Particle System to cast one particle with texture sheet animations: <a href="https://docs.unity3d.com/Manual/PartSysTexSheetAnimModule.html" rel="nofollow">https://docs.unity3d.com/Manual/PartSysTexSheetAnimModule.html</a></p>
How to make an id element mandatory and in sequence? <p>I am having an xml request for which I am trying to make tags mandatory. but positioning the tags at respective position confuses me as I am new to xml. I am using in java with SAX parsing validation.</p> <p>The xml is </p> <pre><code>&lt;empRequest&gt;&lt;id&gt...
<p>You are missing the <code>xs:sequence</code> tag. Additionally you are trying to allow an attribute <code>id</code> inside the element <code>id</code>. This seems not to be what you want. So assuming that the element <code>id</code> is mandatory and <code>fname</code> is not, this would be the XML schema:</p> <pre>...
How to use apply instead of for-loop to check every column in every row <p>I'm trying to check for every row in my data.table if there are certain elements ( which i declare as 1 if there is). If there are, i would want to output a new column that shows the value (a probability of the element happening) referenced from...
<p>Here is a solution that will be faster but may require more ram as it will create some very long data frames, I created a different Pyxixj dataframe as my solution doesn't require the other table.</p> <p>The key to this solution is changing your cnts2 data frame into a form where the probabilities can be left joine...
Android how to handle multiple switches <p>So I'm rather new to the android development and quickly ran into a problem, I have a view where I want to enable / disable both the bluetooth and wifi of the device, though both controlled over a seperate switch.</p> <p>So here is what my view is like:</p> <pre><code>&lt;?x...
<pre><code> public void wifiStatus() { Switch s = (Switch) findViewById(R.id.wifi_switch); s.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // do ...
JasperReports runtime exception - SAXParseException <p>Good day! I am working with Jasper Reports 6.2, JSF 2.2, NetBeans 8.1 and WildFly 8.2, and after one build an exception appeared:</p> <blockquote> <p>SAXParseException; lineNumber: 1; columnNumber: 27; The reference to entity "SOFT" must end with the ';' delimit...
<p>Is it possible that you have some direct URL or HTML characters provided unescaped in the report? You provided only the first line but I suspect something to be wrong within the source code.</p> <p>For example, if you call somewhere</p> <pre><code>/my/url?param1=2&amp;param2=4 </code></pre> <p>this will confuse t...
Retrieving information and image from database in grails <p>I have a domain class called Product. I have saved the information and image in database. But while retrieving information, I retrieved the all the information but could not retrieve image. </p> <p><code>Domain Class</code></p> <pre><code>class Product { ...
<p>Try using plugin for that. <br> <strong><a href="https://grails.org/wiki/Simple%20Avatar%20Uploader" rel="nofollow">Avatar uploader</a></strong> is a good one.</p> <blockquote> <p>Simple avatar uploader - Grails makes the upload and display of these images almost trivial.</p> </blockquote>
Swift 3 code hides my UIImageView <p>I am trying to create a circle UIImageView. Before swift 3 I had been using this code:</p> <pre><code> profilePictureView.layer.cornerRadius = profilePictureView.frame.size.width / 2 profilePictureView.layer.borderColor = UIColor.darkGray.cgColor profilePictureView.clips...
<p>Until <code>viewDidAppear</code> is called, layout isn't finished and the frame size isn't valid. Most likely, your code is called too early in the life-cycle.</p> <p>So move your code to <code>viewDidAppear</code> and you should be fine.</p> <p>BTW: As far as I can tell, it's a iOS 10 issue (ant not a Swift 3 iss...
Google API Endpoints using Javascript client library as an Angular 2 Service <p>I am using Google API Javascript library in my Angular 2 application. I have created a service which is injected in components. Here is the code:</p> <pre><code>import { Injectable } from '@angular/core'; const url = 'https://apis.google.c...
<p>Services are singletons by default. You should <code>provide</code> it in your AppModule, and then it will be available to all of your components. Just make sure to include it in your component constructors.</p> <pre><code>import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browse...
Load functions on specifc days and time <p>I've got some functions to run on different days, starting always at a certain time. To make it more clear:</p> <p>function a, function b, function c</p> <p>monday: function a; <br/> tuesday: function a; <br/> thursday: function b; <br/> wednesday: function c; <br/> ... and ...
<p>If you can use javascript then you can do this.</p> <pre><code>function myFunction() { var d = new Date(); var weekday = new Array(7); weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; ...
Detech symbols writte on a whiteboard using OpenCV <p>I'm trying to detect shapes written on a whiteboard with a black/blue/red/green marker. The shapes can be circles, rectangles or triangles. The image can be found at the bottom of this post.</p> <p>I'm using OpenCV as the framework for the image recognition.</p> <...
<p>I think that the first option should work. You can use fourier descriptors in order to classify the segmented shapes. </p> <p><a href="http://www.isy.liu.se/cvl/edu/TSBB08/lectures/DBgrkX1.pdf" rel="nofollow">http://www.isy.liu.se/cvl/edu/TSBB08/lectures/DBgrkX1.pdf</a></p> <p>Also, maybe you can find something us...
How to iterate through XML file <p>How do I iterate over all the elements of the XML tree, and access to them? What I mean is that the input gets unknown xml file, and the code itself it iterates not knowing the number of elements and branches. </p> <p>I know that was a lot of answers on such topics and the solution w...
<p>As @strongbutgood mentioned, this is very generic. May be below generic code helps </p> <pre><code>Dim xdoc As New XDocument(); xdoc = XDocument.Parse(myXML); // Adding new element xdoc.Element(&lt;Your_Parent_Node_Name&gt;).Add(new XElement("&lt;New_Element_Name&gt;", "&lt;New_Element_Value&gt;")); // Deleting e...
In Latest Flash Player Ctrl + C & Ctrl + V not working in Chrome When Caps lock on? <p>Its happen only in latest version of flash player (version 23).Ctrl + C &amp; Ctrl + V not working in Chrome When Caps lock on. Its happening in Flex based web application. But same working fine in IE. How to solve this?</p>
<p>OP asked question in Adobe forums here: <a href="https://forums.adobe.com/thread/2212890" rel="nofollow">https://forums.adobe.com/thread/2212890</a></p> <p>From staff, this is a <strong>confirmed bug</strong> that "<em>is fixed</em>" and "<em>should be available in the next release build.</em>"</p>
Pass parameters from driver to executors in spark <p>I am using spark 2.0.0. Is there a way to pass parameters from spark driver to executors? I tried the following.</p> <pre><code>class SparkDriver { public static void main(String argv[]){ SparkConf conf = new SparkConf().setAppName("test").setMaster(...
<p>my bad i was using private static Integer variableThatHastobePassed = null;</p> <p>the variable should not be declared as static.</p>
required init?(coder aDecoder: NSCoder) not called <p>I wrote my own Button,Textfield, ..., classes. In the storyboard in "Custom Class" I set the class to the UIElement. This works very well.</p> <p>Now I needed a toolbar that is added programatically. When I add the Toolbar in my ViewController everything is fine. B...
<p>It is depending how do you create you're <code>MyOwnToolbar</code> if you add this in interface builder and connect class to the UI element use method <code>initWithCoder</code></p> <p>If you're creating your <code>MyOwnToolbar</code> programmatically, you should use <code>init</code> or <code>initWithFrame</code>....
Output all the elements grouped by in sql <p>I have created a table in phpmyadmin which has 2 columns one named marca and the other named categoria. I want to group these by marca. I create this sql query to do this but the problem is that it outputs only one category for marca. </p> <pre><code>$sql0="SELECT marca , c...
<p>You can use <a href="http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html" rel="nofollow">GROUP_CONCAT</a> for your needs,</p> <pre><code>$sql0="SELECT marca , GROUP_CONCAT(categoria) as category_group FROM marche GROUP BY marca "; </code></pre> <p>By default you should get a comma-separated list of elem...
Access PHP protected properties <p>Hi there I have a class : AbstractEntityType with a protected property :</p> <pre><code>abstract class AbstractEntityType extends AbstractType { protected static $lists = null; public function __construct($lists = array()) { AbstractEntityType::$lists = $lists; } public...
<p>The property is protected, so you can never do this:</p> <pre><code>public function __construct($lists = array()) { AbstractEntityType::$lists = $lists; ^^^^^^^^^^^^^^^^^^^^^^^^^^ Not allowed for a protected property, regardless where you are } </code></pre> <p>However, when you are inside your class, you ...
XSLT Parent select based on current node name <p>I have the following xml:</p> <pre><code>&lt;field_x_position&gt; &lt;en is_array="true"&gt; &lt;value&gt;60&lt;/value&gt; &lt;/en&gt; &lt;de is_array="true"&gt; &lt;value&gt;70&lt;/value&gt; &lt;/de&gt; &lt;/field_x_position&gt; &lt;field_background_im...
<p>The expression you are looking for is this (Note that there is no <code>item</code> element in your XML, so I have also removed this from the expression)</p> <pre><code>&lt;xsl:value-of select="../../field_x_position/*[name() = current()/name()]/value"/&gt; </code></pre> <p>Alternatively make use of a variable to ...
I need to generate a table dynamically using jquery which will show the form data entered by user <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt; &lt;h...
<p>Your code works: <a href="https://jsfiddle.net/2krdupvc/" rel="nofollow">https://jsfiddle.net/2krdupvc/</a></p> <p>You could also change <code>$(document).ready(function () {}</code> to <code>.load</code> just to make sure everything is loaded (not only the DOM) before launching your actions.</p> <p>Make sure that...
Can I build a JAR that depends on another library without calling that library? <p>I want to create a Java library that depends on a JAR but I want the JAR to be loaded by projects using my library/JAR rather than provided through as a dependency in my library. </p> <p>The reason I need to do this is that the JAR in q...
<p>You can include all your dependencies into a single jar and include that uber-jar into third party project.</p>
How to avoid repetition constructing fixed sized arrays from existing arrays? <p>When creating a fixed size arrays from existing arrays, it can be tedious to read and write, eg:</p> <pre><code>let foo: [i32; 8] = [ bar[1], bar[2], bar[3], bar[4], taz[1], taz[2], taz[3], taz[4], ]; </code></pre> <p>Besides usi...
<p>For curiosity, here's an array concatenation macro that supports unpacking (limited to a finite number of sizes, this macro is small and can be expanded).</p> <p>I have nothing to claim about the performance or zero-costiness of this compared to any other solution (profile to know). If you use fixed size arrays all...
how to test an attribute's attribute of an object type prop in enzyme? <p>This is what my jsx file contains, <code>{' '+this.props.file.attached.name}</code> How can I write test for this <code>name</code> ?</p>
<pre><code>expect(wrapper.containsMatchingElement([&lt;div class="attachedFile"&gt;&lt;i class="fa fa-file-image-o"&gt;&lt;/i&gt; apple&lt;/div&gt;])).to.equal(true); </code></pre> <p>This works perfect,ensure that you surround the elements with []</p>
How to align this text in center on vertically? <p>I have this sample:</p> <p><a href="http://codepen.io/anon/pen/VKPKPk" rel="nofollow">link</a></p> <p><strong>CODE HTML:</strong></p> <pre><code>&lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div class="col-sm-6"&gt; &lt;img class="featurette-im...
<p>Reading the height of the div, then apply the height fixed and add the line-height with the same value. This works for your purposes?</p> <p> </p> <pre><code>your text here to align it vertically &lt;/div&gt; &lt;script&gt; $(document).ready(function(e) { var vaheight = $('#sample').height(); $('#sam...
Jquery submit select form when option is selected <p>I have a select, with a long list, in which i can search it, with select2 jquery pluing.</p> <p>my select:</p> <pre><code> @using (Html.BeginForm("ProjectList", "Client", FormMethod.Get, new { id = "clientform", name = "clientoverviewform"})) { ...
<p>If you want to submit the form after you change the select option do:</p> <pre><code>$('.selectpicker').on('change', function () { $(this).closest('form').submit(); }); </code></pre>
IBM Mobile First: user management and authentication <p>The documentation of the IBM mobile first has hardcoded samples on users are authenticated, the sample does not fetch users from some database or service. In practise where are the users and passwords expected to be stored? In IBM database and then accessed by SQL...
<p>Usernames and passwords can be stored in various systems from various vendors, such as LDAP or Active Directory and alike.</p> <p>See here for an example of LDAP: <a href="https://mobilefirstplatform.ibmcloud.com/blog/2016/07/17/connecting-to-LDAP-with-ibm-mobilefirst-foundation/" rel="nofollow">https://mobilefirst...
php array_key_exists, !empty and isset fails for no reason? <p>php 7.0.8 on ubuntu 16.0.4 LTS could somebody give me a hint why an array key check would fail when the key clearly exists, program execution just stops, with no explanation even with all error reporting enabled.</p> <p>The data type held in the array elem...
<p><strong>SUMMARY</strong> <em>array_key_exists</em> will definitely tell you if a key exists in an array, whereas <em>isset</em> will only return true if the key/variable exists and is not null and <em>empty</em> return true if the variable is an empty string, false, array(), NULL, “0?, 0, and an unset variable </p...
Zooms in obscure the whole screen <p>My website has a header and when a user zooms in on my website, its header will also zoom in and potentially obscure the whole screen. All other things are working well. My css code is:</p> <pre><code>#header { position: fixed; height: auto; width: 100%; z-index: 10...
<p>You can do with this:</p> <pre><code>#header { position: fixed } @media screen and (max-width: 500px) { /* applies only if the screen is narrower than 500px */ #header { position: static } } </code></pre>
Facebook login API javascript for mobile apps <p>I want to intergrate facebook login for my app using Javascript. I have been successful following <a href="https://www.youtube.com/watch?v=x_gLILTRD_k" rel="nofollow">this youtube guide</a> and I can login through the browser. However, on my android emulator, there was a...
<p>Inside the login() function, <code>document.getElementById('login').style.visibility = 'hidden';</code> is not recognised. Error disappears after the line is removed.</p>
How to add a search box inside select element generated by angular-formly <p>I am trying to add a search box inside select elements. I am using angular-formly library along with angular-formly-material for material design. I am trying to achieve something similar to angular-material select box as shown in <a href="http...
<p>I found the solution. I was trying to add a controller to fix this but that was not working. To make this work, I used the <code>link</code> option in formly. Here is the working code.</p> <pre><code> formlyConfig.setType({ name: 'select', template: '&lt;md-input-container&gt;' +'&lt;label for="...
sub totals in a group by <p>I have a query which groups by place name and yyyy-mm. What I would like is to have a combined total of the 3 place names for each month. For example looking at the below the total of the 3 'places' for 'total1' in march would be 14, 4 + 5 + 5 </p> <pre><code> place yyyy-mm ...
<p>You could also use union all,but rollup is better in terms of readability and performance(not accessing table twice)</p> <pre><code>SELECT CASE WHEN PLACE IS NULL THEN 'ALL' ELSE PLACE END as place, YYYYMM, SUM(TOTAL1) AS TOTAL1,SUM(TOTAL2) AS TOTAL2,SUM(TOTAL3) AS TOTAL3 FROM #TEMP GROUP BY YYYYMM,PLACE WITH RO...
Multi Dimensional NSArray to NSArray? <p>Firstly refer to the graphic show below:</p> <p><a href="http://i.stack.imgur.com/vAznr.png" rel="nofollow"><img src="http://i.stack.imgur.com/vAznr.png" alt="enter image description here"></a></p> <p>I have an NSArray that contains 9 Elements. Each of these 9 elements contain...
<pre><code>NSMutableArray * results = [@[] mutableCopy]; for (NSArray *details in self.fuelDetailsForSelectedBike){ [result addObject:details[1]]; } </code></pre>
Specify height and width of ggplot graph in Rmarkdown knitr output <p>I have created a plot with ggplot2 where the x-axis labels are not readable unless the plot is larger than default. When viewing in Rstudio I am able to resize dynamically. When saving with ggsave() I am able to specify height and width. How would I ...
<p>You can specify height and width in the code chunks</p> <pre><code>```{r, fig.width=10,fig.height=11} df %&gt;% ggplot(aes(x = x, y = y)) + geom_point() ``` </code></pre>
Search on HTM Files and add at first line <p>I can't find the good way to search which HTM* files doesnt have DOCTYPE and add this DOCTYPE to this specific file</p> <p>I got the list of file with this : </p> <pre><code>for i in ` find . -name "*.htm*" -print`; do grep -L "DOCTYPE" $i;done; </code></pre> <p>But I can...
<p>You should do this using the <code>-exec</code> option to <code>find</code>, rather than writing your own loop:</p> <pre><code>find . -name '*.htm?' -exec sed -i .bak '1 { /DOCTYPE/ ! i\ &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; }' {} + </code></pre...
the difference between using Vertx "IAsyncResult" and "EventBus consumer" <p>please can someone explain to me what is the difference between this methods:</p> <pre><code>vertx.evenbus().consumer("test", message -&gt; { .......... }); vertx.evenbus().send("test", res-&gt;{ ........... }); </code></pre> <p>and:</p> ...
<p>In vert.x the eventbus is what allows you to quickly build a distributed application without the trouble of knowing where the other services are running, and also allows you to scale by adding more verticles listening on a common address.</p> <p>When you use the first piece of code you're in fact asking vert.x to l...
"didSelectRowAtIndexPath" method never called on iOS 10 devices <p>My current app is available on the store for several months now. This app contains several <code>UIListView</code>, using custom cells (each cell in its own <code>NIB</code>) and touching a cell was always functional.</p> <p>Now, without any update of ...
<p>Finally found it. It seems to be a DFP lib behavior "incompatibility" issue. The DFP view I use to contain all cell's elements, cause sometimes it's displaying custom ad content. This view get user interactions, which is obvious in order to track ad clicks and get analytics, but in iOS 10 this prevent the cell to ge...
save session in mongodb golang <p>I m using golang in the back end and mongodb is my database. I wanted to store the user session(betwen login and logout )of my web application in the mongodb for the persistence.Since there is provider available only for mysql not for mongodb,I edited it to support mongodb.But when i t...
<p>Not sure about your code, here is a sample of a package file that create a session to mongodb in go and used it.</p> <pre><code>package mydb import ( "fmt" "os" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) var Db *mgo.Session type DbLink struct { DbName string } func NewDbSession(url string) { ...
Can't find Class with Class.forName() but it exists <p>I have a program in which I am generating classes at runtime (included only variable and associated getters and setters methods). Later I want to fill the classes.</p> <p>To get the class - I know its Name, but its not in the classpath - I tried .forName() but I a...
<p>The method <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#forName-java.lang.String-" rel="nofollow"><code>Class.forName(String)</code></a> uses the <code>ClassLoader</code> of the caller class, if you want to use a specific <code>ClassLoader</code> to load your class you need to use <a href=...
animation for the red box with jquery <p>Can any one make this red box smooth animated with jQuery?</p> <pre><code>$(document).ready(function() { $(".trapezoid-two").hover(function() { $(this).find('path').attr('d','M0,0 L100,0 L100,100 L0,100z'); }, function() { $(this).find('path').attr('d','...
<p>You don't need to use any JS code for this; you can use two <code>&lt;animate&gt;</code> tags, one for <code>mouseenter</code> and the other for <code>mouseleave</code>. Try this:</p> <pre><code>&lt;path d="M0,0 L100,23 L100,77 L0,100z" fill="red"&gt; &lt;animate begin="mouseenter" attributeName="d" attributeTy...
How to select a leaf from one Jtree and display its matching results in another JTree <p>I have two Jtree's, In First JTree I display my directory structure which contains zip files as node child and .xlsx files as leaf. I want to add a selection event on first JTree such that when I select a leaf it should show only t...
<p>It's not possible to display a Node in more than one tree, since the method <code>add(MutableTreeNode newChild)</code> removes the given node from it's current parent node and so from its current tree, before it adds it to the new parent and so to the new tree. Create a new node on leaf selection, give it the value ...
SQL: Finding closest neighbor based on lat/lon <p>I have a table containing the lat/lon of cafés. I would like to make an SQL query that gives me the closest café to each café. Can someone help with advice on how to do this?</p> <p>The table basically looks like this:</p> <p>Cafe ID</p> <pre><code>+--------------...
<p>Try this one:</p> <pre><code>SELECT zip, primary_city, latitude, longitude, 111.045* DEGREES(ACOS(COS(RADIANS(latpoint)) * COS(RADIANS(latitude)) * COS(RADIANS(longpoint) - RADIANS(longitude)) + SIN(RADIANS(latpoint)) * SIN(RADIANS(latitude))...
node.js refactoring: How to pass object-pointer (here: a socket)? <h1>Goal</h1> <p>Avoiding "callback hell" in node.js.</p> <h1>Problem</h1> <p>The socket-object is not available anymore after refactoring. How can it be passed to the function?</p> <h1>Before refactoring</h1> <h2>server.js</h2> <pre><code>var Act...
<p>You could pass the socket to the logout function.</p> <p>auth.js</p> <pre><code>var ActiveSession = require('./session-model'); function logout(message, socket) { ActiveSession.remove({ sessionid: message.sessionid } , function(err, activeSession) { socket.emit("s2c_logout_success"); // NO PROBLEM ...
Oozie Shell Action params with single quotes getting dropped <p>I am trying to run a <strong>Oozie Shell Action</strong> Job, via means of some sub-workflow configuration.</p> <p>While writing the configuration file (<code>workflow.xml</code>), I wrap some variables (coming from a <code>job.properties</code> file), wi...
<p>Try without quotes. myVar ${myVar} </p>
how to get private key from exponent , modulus and private exponent in PHP? <p>im new in <strong>PHP Crypto</strong> and im using openssl to do crypto operations. Openssl Rsa is need PEM format , but i have hexadecimal modulus(n) , private exponent(d) and public exponent (e). How can i generate Private key from this c...
<p>RSA private keys usually also have a bunch of other parameters too. The primes that were used to create the modulus (p and q) and other parameters to facilitate the use of the Chinese remainder theorem to speed up decryption. If you don't have that then I'd just create a public key. You might be able to replace PUBL...
Performance of sub-query in IN clause with large tables in delete query <p>I am wondering, why queries with IN-Operator are much slower than a simple <code>SELECT</code>.</p> <p>Let me demonstrate my oberservations on an example:</p> <pre><code>Query1: SELECT VIDEO_ID FROM videos (about 8000 rows with 1 column) Quer...
<p>For large data-set table <code>IN</code> clause performance is very slow in this case you can use <code>INNER JOIN</code> with delete query</p> <pre><code>DELETE video_snapshot FROM video_snapshot INNER JOIN videos ON video_snapshot.VIDEO_ID=videos.VIDEO_ID; </code></pre> <blockquote> <p>In my experience IN is a...
Django Twitter-bootstrap : collapse not working <p>I am trying to include a very simple collapse in my Django project. I tried to reduce it to the minimum and it still didn't work. </p> <p>FYI, I tried installing jquery with <code>pip install django-static-jquery==2.1.4</code> and in the end, included jquery script in...
<p>I think you're missing the wrapping <code>class="panel"</code> div and the <code>id="accordion"</code> container div. Also like @JRodDynamite said, you should be using an a tag.</p> <p>I pulled those two missing divs from the <a href="http://getbootstrap.com/javascript/#collapse" rel="nofollow">bootstrap docs</a>.<...
android clickable image carousel <p>I want to implement an image carousel that opens up an activity whenever a particular image is clicked. Also the carousel should be dynamic in the sense that when a user clicks a particular marker in google maps, an image pertaining to that marker is displayed. Kindly assist.</p>
<p>You can use a thread wich communicates with the UI main thread using the function RunOnUiThread(), so that this thread can change image and parameters of the Button/ImageButton/Image which is clicked.</p> <p>Besides, if you want to let the map interact with it, just modify some global parameter of the Activity whil...
How to use a java class as a entity and also as a model <p>I have a entity class "classA" and a model class "ClassA1". ClassA is used to store the values in mysql database from server side and ClassA1 is used to convert a API response string into object which is client side.</p> <p>Now I am having two java classes wit...
<p>You can simply try to use same class in both situation. It should work. That's the way I tried in the beginning of one of my earlier project. As long as you can carefully deal with JPA merging of the <code>ClassA</code> you received from client-side by treating that as a detached entity.</p> <p>However, when you...
Gradle output is missing in Android Studio 2.2 (latest version) <p>I updated my Android Studio to latest version 2.2. Then i can't able to see any gradle task output logs.</p> <p>Below picture is i'm trying to get SHA-1 finger print key from gradle task <strong>singingReport</strong> .</p> <p>Note : Previous Android ...
<p>I found out there has some changes on gradle version 2.14 (Android studio release note).</p> <blockquote> <p>Improves build performance by adopting a new default packaging pipeline which handles zipping, signing, and zipaligning in one task. You can revert to using the older packaging tools by adding androi...
How to draw circle in unity by shader and anti-aliasing <p>I have draw a circle by shader, but it is not anti-aliasing. </p> <p>I try to find some answer like this <a href="http://answers.unity3d.com/questions/521984/how-do-you-draw-2d-circles-and-primitives.html" rel="nofollow">http://answers.unity3d.com/questions/52...
<p>Try this:</p> <pre><code>Shader "Unlit/CircleSeletor" { Properties { _BoundColor("Bound Color", Color) = (1,1,1,1) _BgColor("Background Color", Color) = (1,1,1,1) _MainTex("Albedo (RGB)", 2D) = "white" {} _BoundWidth("BoundWidth", float) = 10 _ComponentWidth("Componen...
Append to 'IT' description name in jasmine <p>I've been trying to alter my 'IT' descriptions on runtime, knowing protractor is Async, I still feel I'm missing something. </p> <pre><code>describe('Describe something', function() { var testParams = [1,2,3,4,5,6,7,8,9,10]; var testVar; beforeEach( function() ...
<p>That was a great question. Had to brainstorm a lot!</p> <p>You are spot on reg the root cause the error. It behaves async And the solution I see to dynamically construct description of <code>"IT"</code> blocks is to the assign the name not through <code>BeforeEach()</code> but calling a custom function to do so</p>...
Initiate an email from JIRA Service Desk to new customer <p>Is there any way to initiate an email from JIRA Service Desk to new customer? I searched all the documentation but there's no clue about it. Is there any workarounds?</p> <p>Thank You.</p>
<p>What kind of email do you mean?</p> <p>You can configure your Service Desk portals to automatically send email notifications to customers whenever comments are added, or the issue is transitioned to another status. Documentation is available <a href="https://confluence.atlassian.com/servicedeskcloud/managing-servic...
How to select vector values based on the conditions of another vector <p>In my data let say I have two vectors:</p> <pre><code>column1 column2 40.0000 1.2000 41.0000 1.2000 42.0000 1.2000 43.0000 1.2000 44.0000 1.2000 45.0000 1.2000 46.0000 1.2000 47.0000 1.2000 48.0000 1.2000 49.0000 ...
<pre><code>sum(columns2(column1&gt;45)) </code></pre> <p>use <a href="http://stackoverflow.com/questions/32379805/linear-indexing-logical-indexing-and-all-that">logical indexing</a>! What this does, is that <code>column1&gt;45</code> creates a logical matrix which is <code>true</code> for values of <code>column1</code...
Updating already existing json file python <p>I have a json file and I want to update 'filename' field with the filenames I scp from a remote server. I am pretty new to python but learning as I go. </p> <p>JSON file:</p> <pre><code>{"path":"/home/Document/Python", "md5s":[{"filename":"", "md5":"", "timestamp...
<p>This is as close as I can come to sorting the code for you. I don't know why you get <code>KeyError</code> but you didn't implement a counter as suggested in the comments. Since I don't have access to <code>config['servers']</code>, the counter might be in the wrong place, in which case put it in the inner <code>for...
Slow UI rendering in C# Winforms <p>I'm making a relatively rudimentary <code>WinForms</code> user control with a number of buttons, each representing a table from a database.</p> <p>The data from each table is loaded into a corresponding <code>DataGridView</code> after the <code>InitializeComponent</code> method is c...
<p>I have discovered the solution to my problem. Though I had tried setting <code>DoubleBuffered</code> to true for the user control before, it did not help. The problem was that <code>DataGridViews</code> have it turned off by default and since it is a protected property it cannot be set to true.</p> <p>Upon further ...
Displaying a video using laravel 5.2 <p>I am working on Laravel 5.2. I have to display a video on my view page.I am able to store the video in my database table but, not able to fetch it and display it.I have the column in my table having the filepath of the videos which i am using to fetch it from the database. </p> ...
<pre><code>@foreach($talents as $talent) &lt;video width="320" height="240" controls&gt; &lt;source src="{{ $talent-&gt;file_path }}" type="video/mp4"&gt; &lt;source src="{{ $talent-&gt;file_path }}" type="video/ogg"&gt; Your browser does not support the video tag. &lt;/video&gt; @endforeach ...
Issues with my jQuery plugin <p>I have created a basic plugin for accordion. My code is in my accordion.js file, which I have included right after including jQuery library. There is no problem with the accordion with this code in accordion.js file.</p> <pre><code>(function($) { $.fn.accordion = function(options) { ...
<p>In your accordion.js file you have <code>$(".accordion-toggle").accordion();</code> can you remove that and try. </p>
visual studio 2015 xsl debugging transformation failed WebException SocketException <p>When debugging an xslt in VS 2015 I get the following error message</p> <p>"xsl transformation failed see output window for details WebException Unable to connect to the remote server SocketException No connection could be made beca...
<p>In my web project I fixed this by clicking 'debug->start without debugging'. I could then do visual studio xsl debugging in the normal way.</p> <p>I'm not sure why this fixed the issue. But I think the xsl debugger was fetching an xml schema from localhost and, since 127.0.0.1:1234 wasn't started it wouldn't be a...
Error: Connection Entity Framework with MySQL C # <p>I have configured all necessary to connect with MySQL with Entity Framwork in Visual Studio 2012</p> <p>And all this is going well,</p> <p>I get the mapping of my table in my code,</p> <p>here is my code:</p> <pre><code> using (testuserEntities context = new test...
<p>I find the solution: We must update the DLL:</p> <p>1) Right click on the Solution (top level in the solution explorer)</p> <p>2) Manage Nuget packages for solution</p> <p>3) Go to update ( locate in the left)</p> <p>4) Update the packages :MySql.Data, MySql.Data.Entities, Entity.Framwork </p> <p>we have chang...
How to inject object with args in it's constructor with Dagger2 <p><strong>update</strong></p> <p>Now I modified my code like this, and it works, but I don't know is this the proper way.</p> <p><strong>the class</strong> <a href="http://pastebin.com/srhu4eB7" rel="nofollow">http://pastebin.com/srhu4eB7</a></p> <p><s...
<p>If you don't have any other dependency in this class, then maybe it's not really a <em>dependency</em> of your activity and you could just use a <code>new</code>. But to answer your question, you'd want to have a subcomponent for your activity (or activities of this kind) with a module like this:</p> <pre><code>@Mo...
How to prevent concurrent effect execution <p>I have an expensive calculation that is called by an effect. I now want to ensure, that this calculation is never called concurrently, i.e. if it is called a second time while the first call is still running, the second call should be ignored.</p> <p>My approach to this pr...
<p>You might see the <code>LOADING false</code> twice because the <code>Action.setLoading</code> have not been executed yet. This is very possible depending on the synchrony/asynchrony of dispatching and actions. Best is to not make hypothesis about that.</p> <p>Generally speaking, if you want to limit a number of ope...
Camera (AVFoundation new APIs) classes for iOS 10 does not found <p>I am facing the error: No known method for selector </p> <blockquote> <p>defaultDeviceWithDeviceType:mediaType:position:</p> </blockquote> <p>While documentation for this method is given at: <a href="https://developer.apple.com/reference/avfoundati...
<blockquote> <p>The <code>AVCaptureDevice</code> methods <code>devices</code> and <code>devicesWithMediaType:</code> are deprecated in <code>iOS 10</code>, and do not provide access to the dual camera or telephoto camera.</p> <p>When you use the AVCaptureDevice class for video or photo capture, you can choose ...
PAM authentication + pgAdmin fails remotely, but locally works <p>I've been trying to configure postgresql with PAM on a Red hat server so that I can get remote access to the server via pgAdmin and use local (server) authentication with PAM.</p> <p>I have edited the pg_hba.conf file and changed the appropriate line:</...
<p>Do <code>systemctl | grep unix_chkpwd</code> and if you see lines like these</p> <pre><code>unix_chkpwd[13081]: check pass; user unknown unix_chkpwd[13081]: password check failed for user (&lt;username&gt;) </code></pre> <p>then you've encountered the same problem I did.</p> <p>To solve it you need to give <code>...
What is a good way to open configs or files during unit test in python? <p>I am wondering what is a good way to read config or local file during the unit testing.</p> <p>I think it could be either to write the test config file during time. For example:</p> <pre><code>def setUp(self): self.config = ConfigParser.Ra...
<p>A good way is to not have to open them at all.</p> <p>For your functions relying on a config file, you could create a fake object that implements the required methods that your particular function relies on. It might just be a <code>get</code> method, that supports getting a "section".</p> <p>This is exploiting <...
IOs Swift : How does completion closure work <p>Can anybody explain me, how does this code work</p> <pre><code>private func viewWillTransition(completion:(() -&gt; Void)?) { if completion != nil { completion!() } } </code></pre>
<p>This is a basic scheme of implementing <em>callbacks</em> in Swift.</p> <p>The function takes parameter <code>completion</code> of type <code>() -&gt; Void)?</code>, meaning "an optional closure taking no parameters and not returning a value."</p> <p>The code inside tests the optional value of <code>closure</code>...
How to set time limit in real time video capturing? <p>I have code that capture video from camera.The frames captured are append to a list.But how to set time limit to this capture?.I only want to capture the first two minutes after that the recording must stop.My code is</p> <pre><code>import cv2 import numpy #creat...
<p>Use time package</p> <pre><code>import cv2 import numpy import time capture=cv2.VideoCapture(0) capture.set(3,640) capture.set(4,480) frame_set=[] start_time=time.time() while(True): ret, frame = capture.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame_set.append(gray) cv2.imshow('frame',...
Google places AutoComplete limit types & hide key <p>I have a simple grails application which has an autocomplete input field which uses the google places api. The code is as follows</p> <pre><code>&lt;label for="city"&gt; &lt;input id="city" name="city"&gt; &lt;/label&gt; &lt;script src="https://maps.googleapis.co...
<p>Well you can filter your <code>google-map search</code> results to particular country pretty easily.</p> <p>Just pass an <code>option</code> to your Autocomplete function like below</p> <pre><code> //options for restricting the search result to "US" var options = { types: ['(cities)'], componentRestrictions: ...