input
stringlengths
51
42.3k
output
stringlengths
18
55k
numpy - return index If value inside one of 3d array <p>How to do this in Numpy : Thank you!</p> <p><strong>Input :</strong> </p> <pre><code>A = np.array([0, 1, 2, 3]) B = np.array([[3, 2, 0], [0, 2, 1], [2, 3, 1], [3, 0, 1]]) </code></pre> <hr> <p><strong>Output :</strong></p> <pre><code>result = [[0, 1, 3], [...
<p><strong>Approach #1</strong></p> <p>Here's a NumPy vectorized approach using <a href="http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html" rel="nofollow"><code>broadcasting</code></a> -</p> <pre><code>R,C = np.where((A[:,None,None] == B).any(-1)) out = np.split(C,np.flatnonzero(R[1:]&gt;R[:-1])+1) </code...
Correct configuration for REST endpoints in Shiro <p>My original post is <a href="http://stackoverflow.com/questions/39381112/shiro-stormpath-via-rest">here</a></p> <p>I am trying to protect a set of REST endpoints with Shiro. My theory is that if I pass a JWT with my REST request, that I can use Shiro (via annotation...
<p>I'm guessing the annotations are not being processed by anything at runtime. You will need to tell your JAX-RS app to process them.</p> <p>I've done this with this lib in the past: <a href="https://github.com/silb/shiro-jersey/" rel="nofollow">https://github.com/silb/shiro-jersey/</a></p> <p>Specifically something...
How to take the Dynamic-table cell value in JavaScript <p>This is a table of one of my jsp page. I want to take the selected value of the column empId for a javascript method.</p> <pre><code>&lt;table class="table table-bordered"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Employee ID&lt;/th&gt; ...
<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;dev class="correct" name="empId" onclick="selectempId(this)"&gt; ${leavebalances.empId}&lt;/dev&gt;</code></pre> </div> ...
Conditional Formatting using dates and weekends <p>I have data in a spreadsheet like this</p> <pre><code>Name | 9/1/2016 | 9/2/2016 | .... | 6/8/2017 Abe | | | | Jonas | | | | </code></pre> <p>I want to highlight every column where the date is either a weekend or a us...
<p>With <strong>Name</strong> in A1, select B2 to the extents of your data and use the following to create a conditional formatting rule.</p> <pre><code>=WORKDAY(B$1-1, 1, $L$2:$L$4)&lt;&gt;B$1 </code></pre> <p><a href="http://i.stack.imgur.com/TKRcn.png" rel="nofollow"><img src="http://i.stack.imgur.com/TKRcn.png" a...
Any way to apply Objective-C category only to current class (or equivalent effect)? <p>Let's say I have a custom subclass of UIView called <code>MyCustomView</code>. Let's also say that I have a category on UIView called <code>UIView+Dictionary</code> that adds an NSDictionary property called <code>dictionary</code> to...
<blockquote> <p>However, if I wanted UIView+Dictionary applied only to MyCustomView itself [...] is there a way to do so [...]?</p> </blockquote> <p>Only by changing the category to be on MyCustomView and not UIView.</p> <p>The header has nothing to do with whether the category's methods are <em>present</em> on any...
SQL NEWBIE, LIKE CLAUSE <p>I'm new to SQL could someone correct me this query ?!</p> <pre><code>CREATE TABLE AVION ( AV int IDENTITY(100, 1) PRIMARY KEY, AVMARQUE varchar(30) NOT NULL, AVTYPE varchar(30) NOT NULL, CAP int CHECK (CAP BETWEEN 100 AND 600), LOC varchar(30) ) CREATE TABLE PILOTE ( ...
<p>It might be as simple as moving the quotes. Try:</p> <pre><code>LIKE 'IT[1,9][0,9][0,9]' </code></pre>
conditional logic for time of day in sql server query <p>I've got a query that is pulling back data based on time of day.</p> <p>In the database, I have each "Channel" with a StartTime and and EndTime, done in military as a varchar. So, 12:00am = 0000, 3:00am = 0300, 4:00pm = 1600, 10:00pm = 2200, etc.</p> <p>The que...
<p>Try changing your condition to something like</p> <pre><code>WHERE (CONVERT(INT,FeaturedStartTime) &lt; CONVERT(INT,@TimeOfDay) AND CONVERT(INT,FeaturedEndTime) &gt; CONVERT(INT,@TimeOfDay) ) OR (CONVERT(INT,FeaturedStartTime) &gt; CONVERT(INT,FeaturedEndTime) AND (CONVERT(INT,@TimeOfD...
D3 Programmatic rotation of radial Graph <p>I have a graph that uses <code>d3.radialLine</code> that can be seen in this <a href="https://jsfiddle.net/w83z4gqv/" rel="nofollow">fiddle</a>. My data points on the line are visualized by plotting the circle on the proper axis value. I need to have a line down the middle of...
<p>For rotating you just need to increase your initial angle offset over time.</p> <p>Here's an example:</p> <p><a href="https://bl.ocks.org/tezzutezzu/c9d8706587e8f5b5d72084b083b502f8" rel="nofollow">https://bl.ocks.org/tezzutezzu/c9d8706587e8f5b5d72084b083b502f8</a></p> <p>As we know the angle is dependent to the ...
How to filter array with array condition <pre><code>var students = ["Malcom", "Jayne"]; var persons = [ {firstname : "Malcom", lastname: "Reynolds"}, {firstname : "Kaylee", lastname: "Frye"}, {firstname : "Jayne", lastname: "Cobb"} ]; </code></pre> <p>I want to filter(or map, forEach whatever) persons arra...
<p>It can be done with <code>filter</code> along with <code>some</code>.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var students = ["Malcom", "Jayne"]; var persons =...
WSO2 api manager vs ESB analytics <p>Both the new version of api manager (2.0 and ESB (5.0) come with analytics component. </p> <p>Does anyone know if a shared instance of analytics server can be used for both products (esb and api mgr)? or do you think analytics is a platform specific component and needs to be instal...
<p>AFAIK its not possible. In the latest APIM and ESB it's recommended to use the analytics components packed with each product. The reason is latest versions of these two products has product specific analytic components.</p> <p>However in the older versions of APIM(<a href="https://docs.wso2.com/display/AM191/Publis...
What does copy-reference-file in find ... -exec bash -c ". jenkins-support; copy_reference_file '{}'" \; do? <p>Can someone explain what the following command does?</p> <pre><code>find /usr/share/jenkins/ref/ -type f -exec bash -c ". /usr/local/bin/jenkins-support; copy_reference_file '{}'" \; </code></pre> <p>In the...
<p>This recursive find does:</p> <ul> <li>starting in <code>/usr/share/jenkins/ref/</code> and in all of its subdirectories:</li> <li>for every regular file (that is, files that are not symlinks, directories, devices, etc) found:</li> <li>after sourcing the file <code>/usr/local/bin/jenkins-support</code> (to set envi...
Subtotal cells in wpf datagrid row <p>I'm attempting to subtotal several rows dynamically when <code>CellEditEnding</code> if fired. Right now, I'm looping through the entire collection to get a total and placing it in the total cell. See code below:</p> <pre><code>private void CalculateTotals() { foreac...
<p>Sorry if I misunderstood. You need to update <code>Total</code> right after you've edited values in any other valuable cell, right? <code>DataGridCellEditEndingEventArgs</code> stores number of row which you edited. Using this you can calculate and update Total value only for current row. I've created a simple examp...
subset of array C of set length <p>Suppose I have a double array <code>double myArray[16]</code> with 16 elements. I want to perform a function on each subset of four elements, i.e. the first subset is <code>myArray[0], myArray[1], myArray[2], myArray[3]</code>, the second is <code>myArray[4], myArray[5], myArray[6], m...
<p>In C (and in all languages that I can think of) you cannot pass a subset of an array to a method and have it look like the method received an entire array. At least not without allocating a new array long enough to hold the subset and copying the items to it.</p> <p>So, you have to make the method accept a referenc...
Integration of Google Calendar into MVC <p>I don't normally ask for help on stack overflow, but when I do, it's usually after pulling out my hair for at least a few days!</p> <p>That said, I'm having a heck of a time integrating Google Calendar in my MVC app. I need to be able to ask my users for their authorization a...
<p>It seems that there's not going to be a lot of help in this area. I finally managed to figure things out for myself from what ever materials I was able to find. I suggest to start by creating a mock-up project to test things out. Once you have that working, you can port what you have over to an existing project. Be ...
How to add a custom block as a usual "product" to shop page / archive-product.php <p>I'm looking for a possibility to add a custom html block/post to the woocommerce "shop page" inside the products grid, as a product. </p> <p>What I mean.. I have a grid of products on the "shop" page (archive-product) and I want to cr...
<p>Thanks for help, guys! I've implemented the functionality I was looking for. I've found the corresponding loop in archive-product.php and as was suggested by JapanGuy, I've added a simple "if i equal let's say 5 then echo &lt; li>[Custom block]&lt; /li>" . </p> <p>The original snippet from archive-product.php:</p> ...
FOR loop does not work due to spaces in filenames <p>In a batch file I have this code for copying files:</p> <pre><code>FOR /F "tokens=*" %%f IN ('DIR /S /B *.png,*.jpg,*.pneg,*.jpeg') DO ( XCOPY /H /S /Y /EXCLUDE:%EXFdestination%\EXF.txt %%~f "%destination%\" ) </code></pre> <p>Problem is it doesn't copy files ...
<p>Simple enough: use <code>"%%~f"</code> instead of <code>%%~f</code></p>
Explain Analyze - Postgres - Increase Speed on View <p>I've got a lengthly view that is built using WITH conditions. I found that the WITH condition was the best (only) way that I can get the desired results needed for the application. Below is my query for the view.</p> <pre><code> WITH lv_materials AS ( ...
<p>It seems to me like most of the time is spent performing nested loop joins that were chosen because the row count for some of the CTEs were wildly underestimated.</p> <p>I won't try and got through that massive query in detail, but there are three things that you could try:</p> <ol> <li><p>Don't write the query wi...
Dropdown menu option for Spanish <p>I have a option dropdown menu with spanish for the selection:</p> <pre><code>&lt;select style="width: 280px" id="Mobility" name="Mobility"&gt; &lt;option selected=""&gt; Please Select&lt;/option&gt; &lt;option value=AI&gt; Adl#$*&amp;she - Camboyan&lt;/option&gt; &lt;option va...
<p>I think you need to use Unicode with codepoint values.</p> <p>try replacing your select.options... code with this,</p> <pre><code>select.options[i].text = "Isle\u00F1o Pac\u00EDfico, Guame\u00F1o"; </code></pre> <p>Also a quick search on google returned this link which may help with other characters.</p> <p><a h...
WKWebView doesn't interact anymore with Javascript in iOS10 <p>I have a native app which has to interact with a website. It has been working normally up to iOS 9, but with iOS 10, the Javascript code inside the web app is no longer valid. </p> <p>Here is an example of the JS code I use on the onClick event of a button...
<p>Using a code close to yours (I pass a stringified json in the src), I also got an embarassing 'about;blank' in the request.</p> <p>It seems iOs10 has some new restrictions on what you pass to iframe 'src'. I found it requires a valid url to trigger properly the request.</p> <p>Try to use :</p> <pre><code>var url=...
How do I make my custom theme apply to my site only, NOT the admin? <p>I'm creating 100% custom theme for a DNN website. Whenever I apply it, the admin pages also get the theme. I don't want that nor need it. The admin should stay with the default theme it came with.</p> <p>I'm on Admin > Themes and when I select my t...
<p>Go to the "ADMIN" page (click on Admin). Go to the PAGE SETTINGS on that page.</p> <p>Choose the skin for that page. Choose the apply to children option as well so that it propagates to all the "child" pages of the Admin page.</p> <p>You likely will want to do the same on the HOST page.</p> <p>Chris</p>
Querying multiple nested objects on multiple paths <p>Is it possible to <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-query.html#nested-query" rel="nofollow">query</a> multiple nested objects <strong>on different paths</strong> in Elasticsearch? I can query one nested object on one path bu...
<p>It works, I missed curly brackets around <code>nested</code> query. The correct way:</p> <pre><code>{'query': { 'bool': { 'must': [ {'nested': { 'path': 'Diagnosis', 'query': { 'bool': { 'must': [{'match_phrase': {'Diagnosi...
Remove duplicates from multi-dimensional array. Numbers and number strings are equal <p>I have it almost down, but cant figure out how to compare the number and number strings.</p> <pre><code>flattenAndUnique([["hello", "abc"], [true], ["abc"], [123, "123"]]) // should return // ["hello", "abc", true, 123] </code></pr...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>let input = [["hello", "abc"], [true], ["abc"], [123, "123"]] // you're trying to do a horrible thing // so you get a horrible...
proper async/await code node js <p>Im learning nodejs through building an API, this the registration part.</p> <p>After trying all existing methods to write async code, i've come to this result. Is this the proper way to do it?</p> <p>I first thought await/async replace Promise... Do they?</p> <p>Do I really need to...
<blockquote> <p>I first thought await/async replace Promise... Do they?</p> </blockquote> <p>No, they supplement them. They only replace <code>then</code> calls.</p> <blockquote> <p>Do I really need to return Promises that way on my 2 functions?</p> </blockquote> <p>No, in your second function you should not cre...
Appending to the end of a pattern with a word in the middle using vim <p>I have a file that is out-of-date and needs to be updated. The names have changed somewhat and I would like to clean them all up using a single substitution.</p> <p>Here's what I'm trying to accomplish:</p> <pre><code>foo.foo_[single word] -&gt;...
<p>I would first change:</p> <pre><code>foo_[word] -&gt; foo_[word]_bar </code></pre> <p>and then</p> <pre><code>foo. -&gt; foo_bar. </code></pre> <p>i.e.:</p> <pre><code>%s,\(foo_\w\+\),\1_bar,g|%s,foo\.,foo_bar\.,g </code></pre>
Undefined reference to SDL functions using Code::Blocks <p>There are quite a few similar topics on SO regarding this but I have exhausted all the suggestions on 15 similar threads.</p> <p>Upon running tutorial code utilizing the SDL library, the IDE is complaining of "undefined reference" to all functions pertaining t...
<p>There is no <code>SDL_WM_SetCaption</code> in SDL2. Your code is likely to be using older SDL 1.2. Either use correct library or modify your code e.g following <a href="https://wiki.libsdl.org/MigrationGuide" rel="nofollow">https://wiki.libsdl.org/MigrationGuide</a></p>
How can I manually set an ID for an AUTOINCREMENT column using a designer-generated DataTable? <p>I'm creating a database system in C# for a library system (using an Access database), and I've hit a brick wall. I've got a table called "BSUser" which has an auto-increment column for the primary key, "UserID"; I want thi...
<p>For those using Access 2010 or later, the desired result can be achieved by using a Before Change data macro. For a sample table named [BSUser]:</p> <p>[UserID] &ndash; Long Integer, Primary Key<br> [ExistingID] &ndash; Long Integer<br> [Forename] &ndash; Text(100)<br> [Surname] &ndash; Text(100) </p> <p>and the ...
java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.Picasso" <p>Its neither giving any error message at <code>Gradle build</code> nor at <code>Compile time</code>, but when i run the app it crashes and gives me following error message.</p> <blockquote> <p>Caused by: java.lang.ClassNotFoundExc...
<p>You most definitely forgot to add a custom application for your multidex.</p> <pre><code>public class CustomApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } } </code></pre> <p>In Androi...
Why are @@, @!, @, etc. not interpolated in strings? <p>First, please note that I ask this question out of curiosity, and I'm aware that using variable names like <code>@@</code> is probably not a good idea.</p> <p>When using doubles quotes (or <code>qq</code> operator), scalars and arrays are interpolated : </p> <p...
<p>Unfortunately I can't tell you why, but this restriction comes from code in <code>toke.c</code> that goes back to perl 5.000 (1994!). My best guess is that it's because Perl doesn't use any built-in array punctuation variables (except for <code>@-</code> and <code>@+</code>, added in 5.6 (2000)).</p> <p>The code in...
Hadoop MapReduce not running 0%Map and Reduce <p>I am trying to run a Hadoop Map Reduce example on my machine and on running the job, I see the following message in my terminal. I have no idea what it means.</p> <p>O/P</p> <pre><code>hadoop@anuvrattiku-Inspiron-13-7368:/usr/local/lib/hadoop-2.7.0/bin$ ./hadoop jar /h...
<p>I suspect the way you submitted the mapreduce job. If you have submitted the job by using <code>job.submit()</code>, it will obviously submit the job and returns the control back. I think this is what is happening in your case. </p> <p>If you have submitted the job using <code>job.waitForCompletion</code>, it will ...
Image Grid not Loading Images (Ionic + AngularJS) <p>I am following <a href="https://www.thepolyglotdeveloper.com/2015/03/make-a-gallery-like-image-grid-using-ionic-framework/" rel="nofollow">this tutorial</a> to load some images in a grid with ionic framework and angularjs. When I use the code below the images are dis...
<p>It looks like you're trying to inject a "src" property into the src attribute of the img elements. </p> <p>But none of the objects in Album have a "src" property. They have a "FILE" property. Shouldn't they look like this:</p> <pre><code>&lt;img ng-src="http://localhost/dashboard/{{images[$index].FILE}}" width="10...
What is the benefit of Redis clustering on different hosts? <p>Let's say I have 3 instances of web app A running behind a load balancer (all on different machines).</p> <p>Is there a benefit of running Redis on more than one instance? If so, how do you achieve parity between more than one Redis instance?</p> <p>I gu...
<blockquote> <p>Is there a benefit of running Redis on more than one instance?</p> </blockquote> <p>Yes. There're at least three benefits.</p> <ol> <li>Redis is single-threaded (in fact, it has more than one thread, but the most work is done in a single thread). With more than one instance, you can achieve better p...
Move elastic IP between servers on AWS <p>Can someone provide some CLI commands to move an Elastic IP between servers in AWS? I have the AWS EC2 CLI command for associate/disassociate and it requires an association ID. How do I get that? As well, I have 2 NIC's in each server (instance)...how do I tell AWS to associ...
<p>To allocate EIP to the ENI you will have to use <code>--network-interface-id</code> check this link for details </p> <p><a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/create-network-interface.html" rel="nofollow">https://docs.aws.amazon.com/cli/latest/reference/ec2/create-network-interface.html</a>.<...
How should an abstract class be written to override method with additional parameters <p>I am wondering how I <em>should</em> have written the following code? I wanted to have a base class, and have one of the derived classes override one of the methods in the base class. But I need a different signature for the method...
<p>There are a number of options. Here's one: use generics.</p> <pre><code>abstract class ClassBase&lt;T&gt; { public abstract void DoSomething(T args); } public class Class1 : ClassBase&lt;Class1Args&gt; { public void DoSomething(Class1Args args); } public class Class1Args { public int x; } public clas...
How to get User Input to Populate Jira Fields <p>I am new to Java and using the JIRA MISC Custom Fields add-on and require some logic assistance to solve math functions between two drop down fields.</p> <p>Field one is "User Cost" This field contains four string selections with the user price posted at the end of the ...
<p>If I understand correctly, you first need to initialize <code>issue</code> to something. (It looks red in your images like that variable doesn't exist)</p> <p>Then, you can do something like this </p> <pre><code>double costSam = 0.21; String userSam = issue.get("customfield_10620"); </code></pre> <p>Then, if you ...
How to install a CA in Minikube so image pulls are trusted <p>I want to use Minikube for local development. It needs to access my companies internal docker registry which is signed w/ a 3rd party certificate. </p> <p>Locally, I would copy the cert and run <code>update-ca-trust extract</code> or <code>update-ca-certifi...
<p>Have you checked <a href="http://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod" rel="nofollow"><code>ImagePullSecrets</code></a>.</p> <p>You can create a secret with your cert and let your pod use it.</p>
React-Native - Can't find variable: title <p>New React-Native installation. I am trying to set it up. In index.ios.js, I have:</p> <pre><code>class thingy extends Component { render() { return ( &lt;NavigatorIOS style={styles.container} initialRoute={( title: 'Thingy', ...
<p>Ah, it looks like <code>initialRoute</code> should be an object, but you have it wrapped in parenthesis:</p> <p><strong>How it is now:</strong></p> <pre><code>initialRoute={( title: 'Thingy', component: Main )} </code></pre> <p><strong>Should actually be:</strong></p> <pre><code>initialRoute={{ title: 'Thi...
Auto calculation grocery crud <p>I want to ask about function that can make auto calculation in grocery crud.</p> <p>For example: I have some column a, b, and total_a_b. I have used function callback_column but its now work perfectly, callback_column just show the result on the view page and it can't auto save to data...
<ol> <li><blockquote> <p>it cant auto save to database. What the function that can refer it?</p> </blockquote> <ul> <li>First you need to make sure that, the this field is column in your table, then tell GroceryCrud that this field is available, but invisible in form. </li> </ul> <p>$crud->change_field_type('your_f...
if/else conditional logic vs exception handling <p>If I have to run a PL/SQL code based on the release version of a product, is it better to add an if/else conditional logic or handle it via exceptional handling? </p> <pre><code>IF release_version &gt; 5 THEN execute some SQL query only for release &gt; 5 because ...
<p>Best practice would be to use "On Conditional Compilation"</p> <p><a href="https://oracle-base.com/articles/10g/conditional-compilation-10gr2" rel="nofollow">Conditional Compilation in Oracle</a></p> <p>That way only the code needed for your version is compiled.</p> <pre><code>create or replace package product as...
sql select statement inside case <p>let say i wanna create something like this</p> <pre><code>select t.*, (case when (select name from table2 where idtable2 = t.idtable1)= NULL then '0' end) as result from table1 t </code></pre> <p>how can i do it? thank you</p> <p>sorry my mistakes,yes that statement...
<p>I think you want <code>exists</code>:</p> <pre><code>select t.*, (case when not exists (select 1 from table2 t2 where t2.idtable2 = t.idtable1 ) then '0' end) as result from table1 t; </code></pre> ...
JSONSerialization Invalid type in JSON write (_SwiftValue) <p>Why does the following code give me the error: Invalid type in JSON write (_SwiftValue). The error is thrown on this line:</p> <p>urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters)</p> <pre><code>let parameters:Parameters = ["res...
<p>I had this problem and it was because one of my strings was Optional. It was trying to serialize a value like: "Optional(\"string value\")"</p> <p>Instead of "string value"</p>
Hibernate search - handling null in boolean query <p>Is there a best practice for handling optional sub-queries? So say my search service has</p> <pre><code>query = builder.bool().must(createQuery(field1, term1)).must(createQuery(field2, term2)).createQuery(); createQuery(field, term) { if(term != null) { ...
<p>what about this</p> <pre><code> org.json.JSONObject json = new org.json.JSONObject(); json.put(field1, term1); json.put(field2, term2); ... bool = builder.bool(); for (Iterator keys = json.keys(); keys.hasNext();) { String field = (String) keys.next(); String term = (String)...
Error when adding a new SSIS package <p>I have Visual Studio 2013 installed on machine in addition to MS SQL Server 2012. I used to use all the Business Intelligence projects in MS VS 2013 in a very normal way. However, recently when I created a new SSIS project and then clicked on the SSIS packages in order to create ...
<p>I simply reinstalled the SSDT (SQL Server Data Tools), repaired my installed packages and the problem was solved.</p>
How to get actual width of UILabel text when set to word wrap <p>I have the following code to set up a UILabel:</p> <pre><code>let label = UILabel() label.numberOfLines = 0 label.textAlignment = .center label.lineBreakMode = .byWordWrapping label.preferredMaxLayoutWidth = maxWidth label.text = "String that is long en...
<p>Ok, I just figured it out. @rmaddy was correct in the question's comments above. I had seen <code>boundingRectWithSize:options:attributes:context:</code> before asking the question, but had issues figuring it out in swift. But now I've got it. Here is my updated code:</p> <p>let label = UILabel()</p> <pre><code> ...
ggplot2 : Color One Category Separately <p>I'm generating a scatterplot in which one of my categories is an "Other" category. I would like the other categories in my factor variable to be whatever color they are, but the "Other" category to be in gray. When I try to use the scale_color_manual() function, it gives me th...
<p>based on <a href="http://stackoverflow.com/questions/8197559/emulate-ggplot2-default-color-palette">this post</a> you can get <code>ggplot</code> colors with this function:</p> <pre><code>gg_color_hue &lt;- function(n) { hues = seq(15, 375, length = n + 1) hcl(h = hues, l = 65, c = 100)[1:n] } </code></pre> <p...
QueryString not Deserializing to Parameters (ASP.NET MVC) <p>I have this function in my Controller </p> <pre><code>public ActionResult postcomment(string gCaptcha,string txtName, string txtEmail, string txtMessage) </code></pre> <p>And I'm passing a JQuery Ajax Querystring (PlainText) as </p> <pre><code>gCaptcha=A&a...
<p>I've also had issues with the values being null on a post. What I would do is create an object and make that object a parameter on the action method. So you would do something like:</p> <pre><code>public class CommentViewModel { public string gCaptcha { get; set; } public string txtName { get; set; } public s...
Django: How to do reverse foreign key lookup of another class without an instance of this class? <p>I have the following two Django Classes <code>MyClassA</code> and <code>MyClassB</code>.</p> <p><code>MyClassB</code> has a foreign key reference to an instance of <code>MyClassA</code>.</p> <pre><code>from django.db i...
<p>Since it is a <code>staticmethod</code>, you don't need an instance. </p> <p>You can call <code>MyClassB.my_method_b()</code> directly.</p>
CGAL: Read vertices and triangles from mesh <p>I just spend few hours with CGAL in Visual Studio C++ trying to understand how meshes work. What I want to get is an access to list of vertices and triangles (vertices in form of double[3], triangles in form of int[3]). Here is the script I am working on:</p> <p><a href="...
<p>Okay, I found the answer in <code>Complex_2_in_triangulation_3_file_writer.h</code> file. Apparently CGAL library is creating whole map of vertices and looking for facet vertices in this map. The code part:</p> <pre><code>using CGAL::Surface_mesher::number_of_facets_on_surface; typedef typename C2t3::Triangulation...
ARM Cortex-M4 Interrupt priorities <p>I'm using an ARM Cortex M4 MCU. If I have an interrupt handler for a GPIO at priority 2 and an SPI driver at priority 3 (i.e., lower priority than the GPIO's), and I call a (blocking) SPI read from within the GPIO's interrupt handler, will the SPI function work?</p>
<p>The answer to your question depends on how it is blocking to handle the transfer, as @Notlikethat said.</p> <p>If your SPI driver is a polling driver, then it will most likely work. In this case, your GPIO interrupt would spin on flags within the SPI peripheral, waiting for each part of the transfer to complete.</p...
Progress bar update during a network call <p>I am trying to implement horizontal Progress bar update during a network call. The API which I am using to do the network call only has to callback onSuccess and onFailure. It takes somewhere around 0.5 - 3 seconds to finish. </p> <p>My issue is, how do I quantify the progr...
<blockquote> <p>It doesn't have to be the accurate representation of the progress. Only if i can fill it to give a UI feedback to the user that something is happening, that should be enough for me.</p> </blockquote> <p>Personally, I'd still use an indefinite progress indicator. Users are pretty savvy about detecting...
wpf animation to hide and collapse panel on buton click <p>I am learning animations is WPF. I have a StackPanel and a button. Initallty the button content should be &lt;&lt; When the button is clicked the StackPanel content should collapse and the button text should become >> where collapse is happening correctly. Agai...
<p>I would suggest to keep a variable in code behind (something like <code>isCollaped</code>) and then in code behind hookup to the click event of the button. Inside the click method of the button place some logic to hide or show the stack panel. For example:</p> <p><strong>XAML</strong></p> <pre><code>&lt;StackPanel...
How to set scope variable empty in angularjs <p>This is my code.</p> <pre><code>$scope.sendFeedback = function () { var mobile1 = $scope.mobile; var feedback1 = $scope.feedback; var userfeedback = { mobile: mobile1, feedback: feedback1 }; var feedbackRef = firebase.database().re...
<p>Do you have ng-app and ng-controller set? I tested your code on my machine, and it works as long as you have the app and controller set up. Can you make a JSFiddle?</p>
Packaging a java project with Apache derby database <p>I have a java Database project using Apache Derby. It works fine on Eclipse IDE. But after Packaging the project into a runnable JAR, the software is unable to load and save database.</p> <pre><code>// JDBC CONNECTION METHOD public void connect() throws Exception{...
<p>@Asaana You say it works fine in eclipse so that leads me to believe that now you're running outside of IDE, the derby.jar file is not in your classpath. </p> <p>Try this if you haven't already done so...</p> <p>When you create your jar file, (assuming you import manifest information) , put derby.jar in the Class-...
can't get data from ng-model using signalr <p>here is my .html :</p> <pre><code> &lt;ul class="messages list-unstyled" ng-repeat="newMessage in messages"&gt; &lt;li&gt; &lt;p&gt; &lt;span class="username"&gt;{{newMessage.username}}&lt;/span&gt;&lt...
<p>You are breaking the golden rule of always having a dot in <code>ng-model</code> .. or in other words using an object</p> <p><code>ng-repeat</code> creates a child scope and your primitive assigned to <code>ng-model</code> therefore only exists in the child scope since primitives have no inheritance.</p> <p>Create...
Administrator Policy not working on Authorize attribute <p>My backend Admin area I want restricted to people in the Admin role. I read an article saying Policies are the way to go. However whenever I add the attribute I just get redirected to AccessDenied pages.</p> <p>I clearly have the role </p> <p><strong>Here's...
<p>Okay, must have been an old article, or the Role check just outright doesn't work. Policy syntax in the docs seems to work like a champ though.</p> <p>Startup</p> <pre><code> services.AddMvc(); services.AddAuthorization(options =&gt; { options.AddPolicy("RequireAdministratorRole...
Mac open a new terminal and run a script with parameter in JAVA <p>So I want to use ProcessBuilder in java to launch a script on a VM. That script launch an appium server and i want it to stay open even after the java program end. So i have something like this :</p> <pre><code>String[] command = {"/bin/sh", currentDir...
<p>Try adding <code>; bash</code> to the end of your script. This basically tells the terminal to open a new bash shell at the end, which will stay open until you close it manually.</p>
getPointAtLength with SVG not working correctly <p>I have a huge SVG file and all of its data is in one single element. It's something like this:</p> <pre><code>&lt;path d="M724 1541c133,-400 36,-222 334,-520 76,-75 440,-37 557,-37 145,291 111, -32 111,445 0,344 -3,260 483,260 457,0 177,-111 409,-111 0,-62 0,-124...
<p>There are two possible approaches I can think of to solve your problem.</p> <p><strong>1. Quick and dirty</strong></p> <p>As you loop through the path, calculate the distance from the last path point. If that distance exceeds some limit, you can consider that you have stepped into a new subpath. So begin a new po...
How to delete text after it's printed <p>I'm working on a poker program, and to keep each player's hand private, I want to incorporate passwords, for example something like:</p> <pre><code> p1name = input("What would player 1 like to be called? ") p1pass = input("Please enter a password to be used to play: ") ...
<p>For the specific case of receiving input without echoing it to the screen, you usually use <a href="https://docs.python.org/3/library/getpass.html#getpass.getpass" rel="nofollow"><code>getpass.getpass</code></a> instead of <code>input</code>, so the user's input isn't echoed in the first place.</p> <p>Otherwise, yo...
ASP.NET 'FindByNameAsync' returns null? <p>I'm having an issue with the <code>ForgotPassword</code> method for the base asp.net identity. When stepping through the code, the line <code>var user = await UserManager.FindByNameAsync(model.Email);</code> returns <code>null</code>, even though I have confirmed that the emai...
<p>You are trying to find an user by an email address.</p> <p>You should use <a href="https://msdn.microsoft.com/en-us/library/mt151641(v=vs.108).aspx#M:Microsoft.AspNet.Identity.UserManager%602.FindByEmailAsync(System.String)" rel="nofollow">UserManager.FindByEmailAsync</a></p>
Is there any way to use TCP/IP communication between a BBB and PC connected only by USB cable? <p>Is there anyway to use TCP/IP communication between a Beaglebone Black and PC connected only by USB cable?</p> <p>I'm try to create an oscilloscope using a Beaglebone Black ADC connected to a computer using a USB cable.</...
<p>You can send an outgoing ping so you know that a TCP/IP connection can be established. However that is an <em>outgoing</em> connection and you are wanting to accept and <em>incoming</em> connection.</p> <p>Check your firewall settings on your development machine, if the incoming connection is denied there you will ...
Creating html table php <p>Hi guys I'm quite new in php. I want to create a string of html table to later use it mpdf but in the course of constructing my table the code seems ok but no html table with data generated just the header.</p> <p>Below is my code:</p> <pre><code> $html ='&lt;div class="row"&gt; ...
<p>You are using <code>echo</code> instead of appending property value to <code>$html</code> variable.</p> <p>Try something like:</p> <pre><code>&lt;td class="text-left"&gt;' . $item-&gt;customer_name . '&lt;/td&gt; </code></pre>
Gitlab behind HAProxy with ssl termination <p>I'm trying to setup gitlab behind haproxy. I use the official gitlab docker container and the dockercloud/haproxy container. If i try to connect from my browser to gitlab i get the following error in gitlab:</p> <pre><code>==&gt; /var/log/gitlab/sshd/current &lt;== 2016-09...
<p>You're not really terminating SSL with HAProxy here - your GitLab container is publishing port 80 so it's listening publicly for HTTP traffic, but you're also using <code>FORCE_SSL</code> so I don't think it will answer on HTTP.</p> <p>To do SSL at the proxy layer, you can remove the <code>FORCE_SSL</code> from Git...
Decrease vertical space between align environment and text content in RMarkdown <p>I am writing rmarkdown pdf documents with equations (using mac, knitr, pdf-latex). The problem I have is that rmarkdown is automatically creating a large blank gap of 2-3 lines between the preceding text and the equation. How do I get ri...
<p>There are two options here. The <strong>first</strong> is just to use <code>\vspace</code> as I pointed out in my comment. The <strong>second one</strong> is to use <code>\abovedisplayskip</code>. For details on how this (and the sibling commands) works, I can refer you to <a href="http://tex.stackexchange.com/quest...
Silverstripe HTML Block "Form Action" <p>Been searching around trying to find away to achieve a "HTMLBlock":</p> <pre><code>/** * @see \HTMLBlock */ $fields = array( TextField::create('myTextfield', 'My Text Field Label'), HTMLBlock::create('&lt;div&gt;Hey I put a HTML block between real fields'), TextFi...
<p>We can use <a href="//api.silverstripe.org/3.3/class-LiteralField.html" rel="nofollow"><code>LiteralField</code></a> to insert html into a form like so:</p> <pre><code>$fields = array( TextField::create('myTextfield', 'My Text Field Label'), LiteralField::create('myLiteralField1', '&lt;b&gt;some bold text&l...
C# for-loop declaring variables <p>In my WPF program, I have an area of C# code that is quite repetitive, and it looks like this:</p> <pre><code>labelFirst = EnglishPicker.SelectedColorText.Substring(0, 1); labelLast = EnglishPicker.SelectedColorText.Substring(3, 6); label = labelFirst + labelLast; UpdateSetting("Engl...
<p>I think you almost nailed the simplest approach to this in your question, but using strings to refer to the pickers can break at run-time.</p> <p>Try this instead:</p> <pre><code>Picker[] pickers = { EnglishPicker, PhotographyPicker}; foreach (Picker picker in pickers) { labelFirst = picker.SelectedColorText.S...
fprintf give me a blank file in c <p>I'm trying to store some data from a GPS to a txt file. The problem is that first the .txt file was empty after y stop the program, but know, when I run the code is like it enter to an infinite bucle and doesn't print me data on screen or in .txt file. </p> <pre><code>char add_aux_...
<p>Seems pretty straight forward to me - you have an infinite <code>while (1)</code> loop, so it will never end.</p> <p>If you abort the program, all the buffered writes are <em>discarded</em>, as the <code>fclose</code> was never reached.</p> <p>You can add a <code>fflush()</code> inside the loop, to get it written ...
Common gradle config in project-level or global build.gradle <p>I have a project that has multiple modules in it, and each of those modules has a signingConfig that is the same to all modules. I want to move that singingConfig to the global gradle which is located at the root of the project to get rid of the redundancy...
<p>You may use the "apply" command in Gradle tool, like below :</p> <pre><code>apply from: "${rootDir}/config/common.gradle" </code></pre> <p>In the common.gradle file, you may write the common setting, like</p> <pre><code>android{ Properties configs = new Properties() .... defaultConfig { ... ...
How to debug (GLSL) shaders using Nsight? <p>How can I debug glsl shaders using Nsight?</p> <p>I am using Nsight Visual Studio Edition 5.2. I've tried using Nsight Visual Studio Edition 5.1. These both don't work. What I mean is that I've tried using this method and it doesn't work:</p> <ol> <li>Open Visual Studio P...
<p>Unfortunately: </p> <blockquote> <p>from: 06/22/2016</p> <p>Maxwell[GTX9xx] doesn’t support shader debugger, only Kepler and Fermi GPU support shader debug.</p> </blockquote> <p><a href="https://devtalk.nvidia.com/default/topic/945730/graphics-card-for-shader-debugging-hlsl-directx11/" rel="nofollow">http...
Trouble with swap method <p>I've got an issue with a swap method I'm trying to write. I'm convinced it's this section of code as it only throws an exception when the program terminates if these lines are uncommented. Comment them out and the file terminates properly. My classes and the function I'm having problems with...
<p>From examination of the code, the <code>size_</code> member specifies the size of the dynamically-allocated <code>wordArray_</code>.</p> <pre><code>for (int j = size_; j &gt; i; --j) { if (wordArray_[j].getNum() &lt; wordArray_[j - 1].getNum()) { </code></pre> <p>This is going to run off past the end of the ar...
Why does Retrieve and Rank ignore my indexes when querying a collection? <p>We have a Solr collection in Retrieve and Rank which contains, among others, a field called <em>document_sub_type</em>. This field is indexed in the Solr schema, but does not have a <em>field type</em> value (I understand that fields intended ...
<p>The /fcselect endpoint does not support combining terms with boolean operators in the query parameter itself. For this type of operation you should be able to use filter queries to get the expected results. See the documentation here for details: <a href="https://www.ibm.com/watson/developercloud/doc/retrieve-rank/p...
body not goes to left in responsive mode <p>I have the following example code:</p> <p><a href="https://jsfiddle.net/8g49jhqa/6/" rel="nofollow">JS Fiddle</a></p> <p>For <code>viewport &lt; 763px:</code></p> <ul> <li>the menu is changed its style to vertical mode and hidden</li> <li>the bar icon (id="bars") will show...
<p>Because you are setting the <code>left</code> properties with jquery, you can't override it cleanly with CSS. I would suggest doing something like:</p> <p><a href="https://jsfiddle.net/8g49jhqa/8/" rel="nofollow">JS Fiddle</a></p> <pre><code>// Run on page load or window resize $(window).on('load resize', functio...
Custom Responsive grid column sizes not sizing properly <p>Ok. Long time reader first time poster. So I have been trying to create a custom grid system so I don't have to rely on frameworks such as <code>bootstrap</code> or boilerplate all the time. I have got the grid working but, When a <code>col-12x</code> is above ...
<p>because <code>col-12*</code> it is your max # of columns (like bootstrap), so you can only have one for each <code>.row</code> (given your current CSS) where you state:</p> <pre class="lang-css prettyprint-override"><code>/* Floats last ".col-" to the right */ [class*='col-']:last-of-type { padding-right: 0; } </co...
Input string with format into a bash command <p>I would like to hard code some inputs to my bash script command. For example, I have a bash script like this:</p> <pre><code>#! /bin/bash apt-get install python </code></pre> <p>and I would like to hard code <code>y</code> and <code>enter</code> as the input for the <co...
<p>All herestrings automatically are terminated by a newline, so this may not do what you want. (Many programs look at whether their input is coming from a TTY, and change whether and how they prompt based on the result; others read prompts intended to come from a user <em>directly</em> from a TTY, and so bypass piped ...
Cloudant / couch db Two way replication - what prevents recursiveness? <p>We have two cloudant databases say A and B on two separate clusters. We have setup two way replication between these databases, so A->B and B->A.</p> <p>1) If a document X is updated on A , it gets replicated to B. But this change on B is not re...
<ol> <li><p>The <a href="http://docs.couchdb.org/en/stable/replication/protocol.html" rel="nofollow">CouchDB replication protocol</a> is well defined and makes sure that the replication is done in a reliable manner.</p></li> <li><p>CouchDB has no concept of a master. Once synced, all CouchDB instances are identical so ...
How to display blade.php files using firebase <p>I am new to firebase. When I am trying to display the hosted blade.php files through firebase that files will be directly get downloaded. But I need to display them as web pages. So how can I achieve this goal?</p>
<p>Firebase Hosting is for serving static assets only. It will not interpret your PHP code/Blade template and will instead serve them uninterpreted.</p> <p>If you want to serve PHP, you will need to find a PHP hosting service.</p> <p>If you want to use Firebase Hosting, you'll have to serve static HTML, such as for a...
Move files into separate subfolders <p>I've been trying to write a shell script for a while and am just stumped. I'm on a mac and have some knowledge of using UNIX but I'm stumped. I have a list of files:</p> <pre><code>folder1_123 folder1_abc folder2_654 folder2_zxy </code></pre> <p>and I want them to be like this:<...
<p>You can split file/dir name with 'cut':</p> <pre><code>for file in *_*; do DIRNAME=$(echo $file | cut -d"_" -f1) if [[ ! -d ${DIRNAME} ]]; then mkdir ${DIRNAME} fi FILENAME=$(echo $file | cut -d"_" -f2) mv $file ${DIRNAME}/${FILENAME} done </code></pre>
Is there any way to dedicate cpu cores exclusively for a process in Windows 10? <p>I want to dedicate some cpu cores exclusively for my real-time data streaming application because I want to ensure that this process is always running without context-switching. (Ensuring no application except my process running on that ...
<p>You can use the WIN32 API SetProcessAffinityMask() to set process affinity.</p>
fatal error in stack <p>I use codeblocks to compile my code in C language.but I faced fatal error. my code is:</p> <pre><code>#include&lt;stdio.h&gt; #include&lt;stack.h&gt; </code></pre> <p>the fatal erroe is:</p> <pre><code>stack.h:No such a file or directory </code></pre> <p>What is my problem?</p>
<pre><code>#include &lt;filename.h&gt; </code></pre> <p>is for standard/system headers that come with the language/compiler/operating system, for example:</p> <pre><code>#include &lt;stdio.h&gt; </code></pre> <p>includes a well-defined header file that is part of the C standard library for IO routines.</p> <p>The C...
Trigger to Update row with information <p>Hello to everyone i'm trying to do a trigger to update the information in a table, but this table has information, and this information comes from this procedure storage </p> <pre><code>create or replace procedure insertar (new_bod int, new_arti int, cant int) BEGIN INSERT ...
<p>In oracle PLSQL, see how you can achieve this below:</p> <pre><code>CREATE OR REPLACE PROCEDURE insertar (new_bod INT, new_arti INT, new_cant INT) AS BEGIN INSERT INTO bod_arti (bod_id, arti_id, cant) VALUES (new_bod, new_...
Concatenating variables and strings in React <p>Is there a way to incorporate React's curly brace notation and an <code>href</code> tag? Say we have the following value in the state:</p> <pre><code>{this.state.id} </code></pre> <p>and the following HTML attributes on a tag:</p> <pre><code>href="#demo1" id="demo1" </...
<p>You're almost correct, just misplaced a few quotes. You can do:</p> <pre><code>href={'#demo' + this.state.id} </code></pre> <p>This will use the string <code>#demo</code> and concatenate it to <code>this.state.id</code>. This can then be applied to all strings. Consider this:</p> <pre><code>var text = "world"; </...
Remove a single x-axis tick mark in gglot2 in R? <p>I'm making a bargraph in ggplot2, and for presentation reasons I need spaces between some of my bars. I'm using limits in <code>scale_x_discrete</code> to insert empty bars, which give me the spacing I need.</p> <p>The gap between groups <code>b</code> and <code>c</c...
<p>You <em>can</em> do what you're asking through a hack: If you replace your blank <code>limits</code> with the first value <code>"a"</code>, ggplot will place the bar at the first occurrence and leave the next ones blank:</p> <pre class="lang-r prettyprint-override"><code>my.data &lt;-data.frame (x=rep(c("a", "b", "...
UTF-8 Encoding using Dropwizard, Hibernate, and MySQL <p>I have a MySQL database with a Dropwizard Java application sitting on top of it. I have set up my YAML configuration file according to the <a href="http://www.dropwizard.io/0.9.0/docs/manual/hibernate.html" rel="nofollow">Dropwizard Hibernate</a> documentation, b...
<p>In the YAML configuration you must be sure to include a <code>characterEncoding</code> and <code>useUnicode</code> property in addition to the <code>charSet</code> property. An example configuration could look like this (note the <code>properties</code> section):</p> <pre class="lang-yaml prettyprint-override"><cod...
How i can best deploy an application from git to forge that requires an entry in the .env file? <p>I have a Laravel app that uses a socialite custom provider to connect an oAuth2.0 API. </p> <p>I would like to use Forge to deploy this simply, on the regular.I cannot however, figure out how to do it, as there is a requ...
<p>Ok after much deliberation, I tried without installing composer dependencies and forge just created the entries in the ENV file automatically....err I feel outsmarted, but in a nice way. Thanks forge! :)</p>
Android app cannot be installed providing a 505 error code <p>We recently upgraded our app Cachicha Videos Por Un Tubo v4.22, but some users not able to install app from Play Store. It says app cannot be installed providing a 505 error code. They can't even install an apk file directly on their phone.</p> <p>It happen...
<p><a href="http://android.stackexchange.com/questions/88214/how-do-i-deal-with-unknown-installation-error-code-505">unknown installation error code -505</a> Try this hope the solutions mentioned here helps you. Did you try increasing the target sdk?</p>
AWS API Gateway - Remove Stage Name From URI <p>The stage name is added to the url when I deploy the API. Let's say the stage name is "test", then the generated URL for the resource includes the stage name. Something like: <a href="https://abcabc.execute-api.us-east-1.amazonaws.com/test/my/path" rel="nofollow">https://...
<p>You can do this with API Gateway <a href="http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html" rel="nofollow">Custom Domains</a>. This allows you to optionally omit the stage name in the custom domain name mapping.</p>
Trying to enhance a custom textbox in angular <p>I'm using a custom textbox directive. The directive has a input element inside.</p> <p>I'm trying to make attribute directives to enhance it via:</p> <p>1) not allow a user to type over 'n' number of characters at which point, I'll probably call a callback function to ...
<blockquote> <p>You can use parsers and formatters to custom validate the input data fields<br/> Pls refer : <a href="https://www.nadeau.tv/using-ngmodelcontroller-with-custom-directives/" rel="nofollow">https://www.nadeau.tv/using-ngmodelcontroller-with-custom-directives/</a> for deep insights.</p> </blockquot...
How much overhead does python numpy tolist() add? <p>I am using a python program that uses numpy array as standard data type for arrays. For the heavy computation I pass the arrays to a C++ library. In order to do so, I use <a href="https://github.com/pybind/pybind11" rel="nofollow">pybind</a>. However, I am required t...
<p>A lot. For simple built-in types, you can use <code>sys.getsizeof</code> on an object to determine the memory overhead associated with that object (for containers, this does not include the values stored in it, only the pointers used to store them).</p> <p>So for example, a <code>list</code> of 100 smallish <code>i...
Different thread affinities in Parallel.For Iterations <p>I need an iteration of a parallel for loop to use 7 cores(or stay away from 1 core) but another iteration to use 8(all) cores and tried below code:</p> <pre><code>Parallel.For(0,2,i=&gt;{ if(i=0) Process.GetCurrentProcess().ProcessorAffinity = (System.In...
<blockquote> <p>Different thread affinities in Parallel.For Iterations</p> </blockquote> <p>Question is misleading, as it is based on assumption that <code>Parallel</code> API means multiple threads. <code>Parallel</code> API does refer to Data Parallel processing, but doesn't provide any guarantee for invoking <cod...
Call Controller Method Which Return View With Ajax Call From Asp.net View Page <p>I have button. I want to route new view when i clicked the button. The button is like below:</p> <pre><code>&lt;button type="button" id="btnSearch" class="btn btn-warning" style="height:35px;width:120px"&gt; &lt;i class="fa fa-search" ar...
<p><strong>If you wants to refresh page:</strong></p> <p><strong>Controller:</strong></p> <pre><code>public ActionResult Index() { return View(); } public ViewResult Test() { ViewBag.Name = Request["txtName"]; return View(); } </code></pre> <p><strong>Index.cshtml:</strong></p> <pre><code>@...
Spring Integration Conditional SpEL using Properties <p>Is there a way to use spring properties in a ternary expression on the <code>expression</code> field of a Spring <code>header-enricher</code>? Something that looks like this:</p> <pre><code>&lt;int:header-enricher&gt; &lt;int:header name="DESTINATION" express...
<p>try </p> <pre><code>&lt;int:header-enricher&gt; &lt;int:header name="DESTINATION" expression="headers['DATA'].routingKey == 'ROUTE1' ? '${route1.db}' : '${route2.db}'"/&gt; &lt;/int:header-enricher&gt; </code></pre> <p>or </p> <pre><code>&lt;int:header-enricher&gt; &lt;int:header name="DESTINATION" expres...
Get node count from XML test case using XSLT <p>I am having following XML for test cases. </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;TestResultArray xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;TestResult&gt; &lt;Name&gt;Test1...
<p>Here's one possible solution:</p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:output method="text" /&gt; &lt;xsl:template match="/*"&gt; &lt;xsl:text&gt;Total Testcase = &lt;/xsl:text&gt; &lt;xsl:value-of select="count(*)"/&gt; &lt;xs...
welcome file list page not loading by default <p>I have deployed an application on <strong>Websphere Liberty</strong>. </p> <p>When I visit my homepage: <code>localhost:8080/myapp</code> it shows a blank page. </p> <p>However when I go to <code>localhost:8080/myapp/jsp/status.jsp</code> it displays the page I need.</...
<p>Which Jeresy version you're using? Better you use jersey version 2.0</p> <p>There is a known issue on jersey 1.8 checkout <a href="https://java.net/jira/browse/JERSEY-880" rel="nofollow">here</a></p> <p>can you add below under <code>ServletContainer</code> Filter and give a try?</p> <pre><code>&lt;init-param&gt;...
how to convert mysqli_set_charset($conn,"utf8") into PDO format in MYSQL? <p>I trying to solve the UTF8 problem. So far i manage to test out and it works in mysqli connection. </p> <pre><code>$servername = "localhost"; $username = "root"; $password = ""; $dbname = "tesddddt"; $conn = mysqli_connect($servername, $user...
<p>You try to connect via PDO and then change the charset via mysqli, without having a mysqli connection, that is what's causing the warning.</p> <p>In PDO the charset usually is being specified within the connection string, like this:</p> <pre><code>$conn = new PDO("mysql:host=yourhost;dbname=yourdbname;charset=utf8...
Run multiple *.sql query files log to file <p>My goal is to have a PowerShell script run several Sqlquery.sql files against a specific SQL server and then log the output to a log file.</p> <p>I can't get the logging to work and I don't know what I'm missing. My log file is always empty and I'm at a loss for that I am ...
<p>The main reason you got nothing in log file is that <code>Output-File</code> rewrite whole data in it on each run. Try to use <code>-Verbose</code> as mentioned in answer by TechSpud to collect print/server statements, or write output to temp file and <code>Add-Content</code> to main log file:</p> <pre><code>$DBSer...
How do I prevent from downloading embedded html file in iframe? <p>I want to link an html file to iframe. Linked html file is not showing in iframe but it is downloaded by the browser(Chrome). My code is below....</p> <pre><code>&lt;iframe class='frame' src="http://download1980.mediafire.com/ idthx0y02fsg/17c22v6x...
<p>I dont know what is on that link, and i dont know how is mediafire is working but i think you need to change your file version at mediafire, this works on to much other networks the frame looks good, hope this helps!</p>
Select from multiple tables - One to Many relation <p>I have such tables:</p> <p><strong>Table Product</strong></p> <p>[ Id | Name ]</p> <p><strong>Table Images</strong></p> <p>[ Product_Id | Url | Ordernumber]</p> <p><strong>Table Prices</strong></p> <p>[ Product_Id | Combination | Currency | Price]</p> <p><str...
<p>This query will do the trick for you:</p> <pre><code>SELECT product.id, product.name, (SELECT group_concat(CONCAT('["',images.url, '",', images.order_number,']')) FROM images WHERE images.product_id = product.id GROUP BY (product.id)) AS IMAGES_LIST, (SELECT GROUP_CONCAT(CONCAT('["',prices.combination, '","', pri...
Missing class in beautifulsoup <p>I am attempting to grab a div on the MTA info page. When I grab the html and parse it with BeautifulSoup it seems to be missing some data.</p> <p>Here is my code so far</p> <pre><code>from bs4 import BeautifulSoup import urllib # access the web # SUBWAY STATUS PROJECT userURL = "htt...
<p>In the subchart variable look for the elements with the class subwayCategory and store the values of the attribute id. For ex: from this part of the data</p> <pre><code>&lt;div style="float: left; width: 220px; border-bottom: 1px solid #7B7B98; padding: 4px 0;"&gt; &lt;div class="span-11"&gt;&lt;img alt="1 2 3 Sub...
Jmeter testing integration with IBM dtapower <p>Need your help in setting the SSL manager in Jmeter for performance testing with IBM datapower.</p> <p>I tried the below steps to Add cert.</p> <p>• Added (* .jks /*.p12 ) file in the jmeter GUI > Options > SSL Manager. • I tried the setting the jks file in sys...
<ol> <li>Change "Implementation" of your HTTP Request sampler(s) to Java. The fastest and the easiest way of doing this is using <a href="http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request_Defaults" rel="nofollow">HTTP Request Defaults</a>. </li> <li><p>If you're using .p12 keystores you will nee...
encrypting appSettings in a external file using aspnet_regiis -pef <p>I am trying to encrypting appSettings in a external file using aspnet_regiis -pef. Does anyone how how to do this. </p> <p>My main web config file :</p> <pre><code> &lt;appSettings file="ExternalAppSettings.config"&gt; &lt;add key="test1" value...
<p>I have done this type of work. I just encrypt the string and than put encrypted string in the values. when i retrieve the values i will again decrypt it into original values.</p>
Convert Jquery to angular directive <p>Ia m new in Angular, but i know to work in Jquery, i have problem with converting some function into Angular directive. Can someone help me about that, this is my jquery function</p> <pre><code>$('.spinner .btn:first-of-type').on('click', function() { $(this).closest('.spinner'...
<pre><code>angular.module("yourmodulname").directive("spinnerDirective", spinnerDirective); function spinnerDirective(){ return { //Edit -1 restrict:"A", //restrict the directive to the attribute link: "spinnerDirectiveLink" }//Edit-1 } function spinnerDirectiveLink(scope, element, attribute){ $('.spinner...
Google Maps JavaScript API - Toggle Route Visibility Instead of Clearing It <p>I am using the Google Maps JavaScript API to display driving routes on a map.</p> <p>I have this code that will clear the route from the map entirely:</p> <pre><code>directionsDisplayD.setDirections({routes: []}); </code></pre> <p>Is ther...
<p>Set the <code>map</code> property of the <a href="https://developers.google.com/maps/documentation/javascript/reference#DirectionsRenderer" rel="nofollow">DirectionsRenderer</a> object to <code>null</code> to hide the directions. Set it back to your <code>map</code> object to re-display the directions.</p> <p><div ...