input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
MT4 Trade Panel - Issues <p>My English so limited, so I can't write a lot details. But I am trying to get "Hover" mouse hover effect. So which Object Functions help me for that.
You can see that effect below image.</p>
<p><a href="http://i.stack.imgur.com/Ai8rw.png" rel="nofollow"><img src="http://i.stack.imgur.com/Ai... | <h2><sub>a short version:</sub> None</h2>
<hr>
<h2><a href="http://stackoverflow.com/a/39918282/3666197">The Full Story:</a></h2>
<p>In spite of a minimalistic composition of the initial Question text, one may realise that any automation, intended to work on top of the MetaTrader Terminal 4 MMI-Add-On elements, that... |
Uploading Android library to Bintray - userOrg parameter is ignored <p>I am trying to upload an Android library to Bintray using this guide:
<a href="https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en" rel="nofollow">https://inthecheesefactory.com/blog/how-to-upload-libr... | <p>When uploading context to a Repository that is owned by an Organization, you have to comply with the Bintray REST API convention by using the following path: <strong>OrganizationName/RepoName</strong> and not <strong>UserName/RepoName</strong>.</p>
<p>I do not know what is the using of the 'maven' word in the path... |
Support for user certificate authentification in Azure AD <p>I'am searching for public/private key-based authentication for users with Azure-ActiveDirectory but can't find any hints in <a href="https://azure.microsoft.com/en-us/documentation/articles/active-directory-authentication-scenarios/" rel="nofollow">Azure AD A... | <p>Azure AD supports OAuth 2.0 to authorize the third-party apps and the OAuth 2.0 support to acquire the token using the appâs client credential. </p>
<p>There are two ways to acquire the token for the client credential flow.
First is that using the keys which generated by the Azure portal like figure below:
<a hre... |
Mercurial and BitBucket, "abort: repository default-push not found!" error message <p>I've some code on my laptop I would like to upload through Mercurial on my BitBucket repository.
I'm using a Linux CentOS 6 machine.</p>
<p>The problem is that if I type <code>$hg push</code>, I get the following error message:</p>
... | <p>Mercurial doesn't know where you want to push to. Mercurial first looks for the destination in the push command (which could be either a repo on the filesystem, or a remote hg server):</p>
<p><code>hg push remoterepo</code></p>
<p>If it doesn't find a destination in the command, it will fall back on the defaults.<... |
setOnclickListener(this) ERROR <p>When I try to call setOnClickListener(this); 'this' gets an error. I have tried to declare it as other things but that didn't work. I am only trying to make multiple onClick events. </p>
<pre><code>import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import an... | <p>Instead of <code>this</code>, reference your already created <code>onClickListener</code> class member. Also you have a bug in your 2nd and 3rd imagebutton where it is not getting any clicklistener or targeting the wrong resource id, here is all the fixes</p>
<pre><code>@Override
public void onCreate(Bundle savedI... |
Simple example of using FeaturesDlg in WIX <p>The only documentation for the FeaturesDlg I can find on the WIX site is a brief two-line description. I'm finding lots of esoteric, advanced samples of how to attempt to do difficult things, customizations, etc. I just want to know how to use it in the most simple, basic, ... | <p>Use the <code>WixUI_FeatureTree</code> dialog set. See <a href="http://wixtoolset.org/documentation/manual/v3/wixui/wixui_dialog_library.html" rel="nofollow">Using Built-in WixUI Dialog Sets</a>.</p>
|
Unable to start apache <p>I've trying to start httpd 2.4 on OSX with SSL installed from</p>
<pre><code>brew install httpd24 --with-privileged-ports
</code></pre>
<p>and I'm trying to start it with an SSL certificate generated from letsencrypt. However, it's not starting. I've upped the log levels to see if they help.... | <p>I got it to restart in the end.</p>
<p>Somehow I had commented out the</p>
<pre><code>Listen 443
</code></pre>
<p>so it wasn't listening on 443, which I guess was what it was trying to tell me with</p>
<pre><code>Thu Oct 06 21:33:18.256482 2016] [ssl:error] [pid 39588] AH02566: Unable to retrieve certificate www... |
How to concat two javascript variables and regex expression <p>I want to be able to concat two variables with a regular expression in the middle.</p>
<p>e.g.</p>
<pre><code>var t1 = "Test1"
var t2 = "Test2"
var re = new RegEx(t1 + "/.*/" + t2);
</code></pre>
<p>So the result I want is an expression that matches this... | <p>Try this (I use <a href="/questions/tagged/nodejs" class="post-tag" title="show questions tagged 'nodejs'" rel="tag">nodejs</a>):</p>
<pre><code>> var t1 = "Test1"
> var t2 = "Test2"
> var re = new RegExp('^' + t1 + '.*' + t2 + '$')
> re
/^Test1.*Test2$/
> re.test("Test1 this works Test2")... |
How to add a Angular 2 component to an Angular 1 directive written in Coffeescript? (with webpack) <p>I have a case where I am am working in an Angular application written in coffee-script. I am trying to embed a new component in an existing ng1 directive written in coffee. According to the <a href="https://angular.io/... | <p>There were a few things wrong with my code but the real problem was the way coffee script requires imports. I changed it to something like this...</p>
<pre><code>{ NgSpinnerComponent } = require '../../../ng2/upgrade.adapter';
...
module.directive("ngSpinner", NgSpinnerComponent)
</code></pre>
<p>Where update adap... |
Reference a public static class in the global namespace in another assembly <p>In C#, is there a way to access a public static class in the global namespace in assembly A from assembly B (assuming assembly B references assembly A), <strong>when assembly B has public static class in the global namespace that has the sam... | <p>Thanks to @Jon Skeet for this direction - extern alias is what can make this work. On the properties for the reference to the assembly, add an alias (for example <code>assemblyA</code>, or in the screen shot taken from <a href="https://blogs.msdn.microsoft.com/ansonh/2006/09/27/extern-alias-walkthrough/" rel="nofol... |
How to one-hot-encode factor variables with data.table? <p>For those unfamiliar, one-hot encoding simply refers to converting a column of categories (i.e. a factor) into multiple columns of binary indicator variables where each new column corresponds to one of the classes of the original column. This example will exp... | <p>Using <code>model.matrix</code>:</p>
<pre><code>> cbind(dt[, .(ID)], model.matrix(~ Color + Shape, dt))
ID (Intercept) Colorgreen Colorred Colorpurple Shapesquare Shapetriangle
1: 1 1 1 0 0 1 0
2: 2 1 0 1 0 ... |
touch up inside (@IBAction) does not work with UIButton subclass <p>I created a subclass of <code>UIButton</code>:</p>
<pre><code>import UIKit
@IBDesignable
class CheckboxButton: UIButton {
@IBInspectable var checkboxBackgroundColor: UIColor = Project.Color.baseGray
@IBInspectable var textColor: UIColor = Project.Co... | <p>You broke <code>UIButton</code> by overriding <code>beginTracking()</code> and always returning false. This brainwashes the button into thinking it's never being clicked.</p>
<p>What was your intent there? In any case, return <code>true</code> there and your code will fire the <code>@IBAction</code>.</p>
<p>EDIT: ... |
I am writing a program in C which searches the number stored in a txt file through a BST but there is mistake which I can't find <p>First portion of code is storing the integers in ans.txt
file through Binary Search Trees.</p>
<pre><code>/*code for storin the numbers in a particulr txt file */
#include<stdio.h>... | <p>You have a few problem.<br>
1. <code>while((y=getchar())!=EOF){</code> : Discarded one character.<br>
2. <code>fwrite(r,sizeof(struct root),1,fp);</code> : Only nodes of the root is stored. Pointer can not be reproduced at the time of reading.<br>
3. <code>struct root *srch(struct root *r, int a){
if(r->val>... |
Is there a List<T> like dynamic array that allows access to the internal array data in .NET? <p>Looking over the source of <code>List<T></code>, it seems that there's no good way to access the private <code>_items</code> array of items.</p>
<p>What I need is basically a dynamic <em>list</em> of <code>struct</cod... | <blockquote>
<p>Is there another data structure in .NET that allows this, or do I have to implement my own dynamic array?</p>
</blockquote>
<p>Neither.</p>
<p>There isn't, and <em>can't be</em>, a data structure in .NET that avoids the structure copy, because deep integration with the C# language is needed to get a... |
Writing JSON to file gives? <p>I have a JSON file with different names of countries and languages etc. I want to strip it down to just the information I need/want for what I am doing. For example I would like to turn</p>
<pre><code>[{
"name": {
"common": "Afghanistan",
"official": "Islamic Republic... | <p>\u0627 is unicode not ascii and you cannot represent the arabic characters in ascii - hence the ?. For differences between utf formats see <a href="http://stackoverflow.com/questions/4655250/difference-between-utf-8-and-utf-16">Difference between UTF-8 and UTF-16?</a> </p>
<p>when you write it UTF-8 you need to rea... |
RegEx to match a single digit followed by a "." followed by another single digit <p>I am trying to find the RegEx in use with the preg_match function for a single digit followed by a "." followed by a single digit.</p>
<p>Example:</p>
<p>3.3 valid
44.4 invalid but would capture 4.4
4.664 invalid but would capture 4.6... | <p>this regex should help you:</p>
<p><code>\d{1,1}[\.]{1}\d{1,1}</code></p>
<p>you can try other regex at <a href="http://www.regextester.com/?fam=95922" rel="nofollow">this site</a></p>
|
Add a checkbox to a dynamically added table row <p>I have a table which I add cells to dynamically. I want to add a checkbox as one of the cell elements. Specifically to element cell_0 of row0.
I tried <code>cell_0.innerHTML = <input type = "checkbox />;</code>but that didn't work.</p>
<pre><code>var row0 = docu... | <p>You have to quote the html. <code>cell_0.innerHTML = '<input type="checkbox"/>';</code></p>
|
c# - using file.encrypt to save some persistent info locally? <p>I have a program that needs to save some user-unique information on each user's machine (I query the user for it upon first use). In my first draft of the program I simply saved that info in a text file (in a sub-folder of the program folder). But it is... | <p>Ok, first think about your methdology here.</p>
<pre><code>If (the file exists) {
Decrypt the file
Read the contents
Encrypt it again
} else {
Enter text
Save as a different file name than above
Encrypt the file
}
</code></pre>
<p>When you decrypting the file, you are trying to decrypt the ... |
Paypal Sandbox Testing Error <p>i am in PAYPAL SANDBOX mode [as a developer] trying to integrate paypal into my client website. [Simple case of putting a BUY button onto the page - which I have done successfully] --- and then testing the payment process works]. </p>
<p>Problem.......
When I test the BUY button it take... | <p>Check to make sure both the buyer and seller sandbox accounts you are using are showing as "Verified". </p>
<p>If not, verify them and see if the error goes away.</p>
<p>If so, try testing a checkout in Incognito mode (or equivalent with your browser.) This will eliminate the use of any caching / cookies which c... |
Inserting html tags on image at specific positions in html and css <p>I have this image Map.png. i want to write text these location boxes using html.
so that i can change it dynamically.
I just do not know how to that.. please give me a direction.
<a href="http://i.stack.imgur.com/rrFzo.png" rel="nofollow"><img src="h... | <p>Couple of ways to do this.</p>
<ol>
<li><p>Simplistic way would be using just css absolute property and top/left properties to position the location icons on top of the map.png. Add the map.png to a div and make the div css position relative. Add each location icon at top/left property and make sure location icon c... |
NSTextField margin and padding? (Swift) <p>I am wondering if thereâs a possibility to set a margin or padding for <code>NSTextField</code>? </p>
<p>I achieved a more or less custom looking textField (the first one in this screenshot)...</p>
<p><a href="http://i.stack.imgur.com/1NGV6.png" rel="nofollow"><img src="ht... | <p>I usually do this just by putting the textField in a container view. You can give the view any corner radius, border, etc you want, and then just constrain the textField to the inside with whatever padding you want. Just make sure you change the textField's border style to 'none' or you'll be able to see it inside... |
Extract JSON array in Redshift when the object name is a variable value <p>Apologies up front if I use incorrect terminology, I'm relatively new to JSON. I'm querying data from Amazon Redshift.</p>
<p>The following is an example of the JSON data I'm seeing:</p>
<p>{"id":{"names":["name1", "name2", "name3"]</p>
<p>I... | <p>You could try Redshift User Defined Functions(UDFS). Easy, Simple to test & manage for such requirement. UDFs could be refined to support different params & details.</p>
<pre><code> CREATE FUNCTION dynamic_json_extract_path_text (txt VARCHAR(20000) ) RETURNS VARCHAR(20000) IMMUTABLE AS $$
import json... |
Consistent Cluster Order with Kmeans in R <p>This might not be possible, but Google has failed me so far so I'm hoping someone else might have some insight. Sorry if this has been asked before.</p>
<p>The background is, I have a database of information on different cities, so like name, population, pollution, crime, e... | <p>Usually k-means are initialized randomly few times to avoid local minimums. If you want to have resulting clusters ordered, you have to order them manually after k-means algorithm stops to work.</p>
|
syncing two mysql db table <p>So, I have two mysql db tables: "table_original" and "table_copy"</p>
<p>Here is my current setup:</p>
<p>Every night, <code>table_original</code> gets updated from another server with information. It either removes the old db row or adds a new line it with unique post_id (there won't be... | <p>To delete the rows in table_copy that are not present in table_original:</p>
<pre><code>DELETE t1.* FROM table_copy AS t1
LEFT OUTER JOIN table_original AS t2 USING (post_id)
WHERE t2.post_id IS NULL;
</code></pre>
<p>I recommend you create a dummy table with a few rows so you can experiment with this kind of que... |
Entity Framework: The 'ComplexType.Field' property does not exist or is not mapped to type 'Entity' <p>I have a problem with mapping properties on value objects/complex types to entities. I have a user entity which has a complex type property called Credential, which in turn has properties: Email, UserName, Password an... | <p>Not been able to reproduce this:</p>
<p><strong>I've got this after add-migration with the same setup you have:</strong></p>
<pre><code>public override void Up()
{
CreateTable(
"dbo.Users",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
... |
3-level hierarchy with bootstrap scrollspy? <p>I want to add another hierarchy level to my <a href="http://codepen.io/staypuftman/pen/PGYJKB" rel="nofollow">existing 2-level scrollspy</a>. I've tried nesting it by adding more levels but that didn't work at all.</p>
<pre><code> <ul class="nav nav-stacked"... | <p>Well, it's not very hard to nested to 3rd level just easily follow what you have done for 2nd level and do it for 3rd level. </p>
<p>For instance, I have a demo here <a href="http://codepen.io/mhadaily/pen/dpdvwp" rel="nofollow">http://codepen.io/mhadaily/pen/dpdvwp</a> which I have forked your work and nested to 3... |
Use the transition-delay option (css) and JS to make a div move <p>I want to create a function that moves a block smoothly. I prefer to use the CSS option 'transition-duration' for this, but it doesn't seem to work for the position. I checked, and it does work for background-color...</p>
<p>CSS file</p>
<pre><code> #... | <p>Use transition: left 0.5s linear; as you haven't said what property you're transitioning. </p>
<p>Also, put the styles you want to change to in a class and apply the class with js instead. </p>
<p>Also, you probably want to transition an absolute item inside a relative container, not apply 'left' to a relative ele... |
Kubenetes doesn't recover service after minion failure <p>I am testing Kubernetes redundancy features with a testbed made of one master and three minions. </p>
<p><strong>Case:</strong> I am running a service with 3 replicas on minions 1 and 2 and minion3 stopped</p>
<p>[root@centos-master ajn]# <code>kubectl get no... | <p>It looks like you're always trying to read the same pods that are referenced in <code>$MYPODS</code>. Pod names are created dynamically by the ReplicationController, so instead of <code>kubectl describe pods $MYPODS</code> try this instead:</p>
<p><code>kubectl get pods -l app=nginx -o wide</code></p>
<p>This will... |
Getting from cart content the post ID <p>I am trying to grab the post id from WooCommerce cart content so I can access an advanced custom field number I have set. I am not able to find a post ID value only a product ID value which will not work.</p>
<p>This is my code:</p>
<pre><code>add_action('woocommerce_cart_calc... | <p>I have changed a little bit your code, and now you will get correctly the item ID to use with ACF plugin <strong><code>get_field(</code></strong>) function.</p>
<p>This is the code:</p>
<pre><code>add_action('woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge()... |
php replace complete numbers <p>Hi hope somebody can help me, I have the following code but I send $data = 11, it sends me a 1010 instead of 100, is replacing the '1' two times, does anybody know how to fix this? thanks</p>
<pre><code>$search = ['1','2','3','11','12','13'];
$replace = ['10','25','50','100','250','500'... | <p>Try to make the reverse order and use a foreach with a $count check like the following:</p>
<pre><code>$search = ['13','12','11','3','2','1'];
$replace = ['500', '250', '100','50','25','10'];
for($i=0, $count=0; $i<count($search); $i++) {
$data = str_replace($search[$i], $replace[$i], $data, $count);
if ... |
how do I insert data to an arbitrary location in a binary file without overwriting existing file data? <p>I've tried to do this using the 'r+b', 'w+b', and 'a+b' modes for <code>open()</code>. I'm using with <code>seek()</code> and <code>write()</code> to move to and write to an arbitrary location in the file, but all... | <p>What you're doing wrong is assuming that it can be done. :-)</p>
<p>You don't get to insert and shove the existing data over; it's already in that position on disk, and overwrite is all you get.</p>
<p>What you need to do is to mark the insert position, read the remainder of the file, write your insertion, and th... |
How to avoid .pyc files using selenium webdriver/python while running test suites? <p>There's no relevant answer to this question. When I run my test cases inside a test suite using selenium webdriver with python the directory gets trashed with .pyc files. They do not appear if I run test cases separately, only when I ... | <p><code>pyc</code> files are created any time you <code>import</code> a module, but not when you run a module directly as a script. That's why you're seeing them when you import the modules with the test code but don't see them created when you run the modules separately.</p>
<p>If you're invoking Python from the com... |
PHP form not inserting into mySQL database <p>hi guys thanks if you can tell me what error i need help guys thanks for help me </p>
<pre><code><?php
$servername = "localhost"; $username = "root"; $password = "";
$dbname = "kurd";
mysql_connect("localhost","root","","kurd") or die ("not connect data ... | <p>In your code add an <code>else</code> to,</p>
<pre><code>if(mysql_query($query)){
echo "<h3>THANKS FOR INSERT DATA GOOD LUCK</h3>";
}
</code></pre>
<p>resulting in,</p>
<pre><code>if(mysql_query($query)){
echo "<h3>THANKS FOR INSERT DATA GOOD LUCK</h3>";
}
else {
echo 'MYSQL Error... |
Node.js spawn ENOENT error <p>So I followed <a href="http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js/27688805#27688805">this answer</a> and made it to the last step, correctly I think. But then what? I'm trying to run a node file, but it doesn't appear to be in the file listed a... | <p>In your spawn method, you should have:</p>
<pre><code>app.get("/go", function(req, res, next) {
var stream = child_process.spawn("node", ["file.js"]).on("error", function(error) {
console.log("Error!!! : " + error);
throw error;
});
});
</code></pre>
|
Can't deserialize Asana User data into C# class <p>I'm trying to deserialize the data I'm getting from the users/me call in the Asana API as per below, but the object is returning null for all properties in the jsonResponse var. The data is there - I can see it if I read it as pure text. I've also tried using [JsonPr... | <ol>
<li><code>data</code> is not an array. In your sample it is a single object. </li>
<li>You want to be deserializing at the root, <code>AsanaObjects</code> class, not one level down at the <code>data</code> class. </li>
<li>I also had to throw a <code>[DataContract]</code> on the root <code>AsanaObjects</code> clas... |
syntax error in mysql php code <p>I am stuck in using MySQL insert statement. When i run this statement it does display output but somehow not inserting the data into table. Not able to establish where am I going wrong.</p>
<pre><code>if($app_siblingno=='0'){
$query2 = "INSERT INTO tbl_stu_siblings( fk_... | <p>Try this query;</p>
<pre><code>$query2 = "INSERT INTO tbl_stu_siblings ( fk_stu_id,sib_count,name,dt_dob,class,gender,scl_name) VALUES ('".$stuid."','0','', '','','','')";
</code></pre>
<p>And check your table structure and field type and not null statements.</p>
<p>You should check and try your sql query. If it ... |
D3.js: Force-layout - Nodes not rendering with images <p>Currently I am working one of <a href="https://www.freecodecamp.com/challenges/show-national-contiguity-with-a-force-directed-graph" rel="nofollow">FCC' Project</a> and
I am trying to have node render with images from these flag sprites (<a href="https://www.flag... | <p>The <code><div></code> elements are added to the HTML document and the links are added to <code><svg></code> element. They do not share the same coordinate system. Unfortunately you cannot add a <code><div></code> to an <code><svg></code>. It is probably easier to use another method for the ... |
ASP.Net Core solution publishing wrong project <p>I created a new ASP.Net core project and set it up in source control which publishes to Azure when I do a check-in. I was able to get everything setup correctly and it was working fine. </p>
<p>However, I then added a class library project to the solution and now inste... | <p>I was able to solve this by doing it in two steps. </p>
<p>First remove the deployOnBuild=True and the publishUrl=[snip] from the msbuild command. This means this step will build the project but doesn't do any publishing. </p>
<p>Next add a new step that does the publish. </p>
<p>To do this I first created a new ... |
How to debug cython in and IDE <p>I am trying to debug a Cython code, that wraps a c++ class, and the error I am hunting is somewhere in the C++ code.</p>
<p>It would be awfully convenient if I could somehow debug as if it were written in one language, i.e. if there's an error in the C++ part, it show me the source co... | <p>It's been a while for me and I forgot how I exactly did it, but when I was writing my own C/C++ library and interfaced it with swig into python, I was able to debug the C code with <a href="https://www.gnu.org/software/ddd/" rel="nofollow">DDD</a>. It was important to compile with debug options. It wasn't great, but... |
r scientific notation limit mantissa decimal points <p>In r, is it possible to limit the number after decimal points of mantissa/significand. E.g 1.43566334245e-9, I want to ignore/round to 1.44e-9.</p>
<p>I do not want to simply say keep N numbers after decimal. Cause if there is another number in the dataset is 5.23... | <p>If I understood you correctly:</p>
<pre><code>signif(1.43566334245e-9,3)
[1] 1.44e-09
signif(5.2340972e-5,3)
[1] 5.23e-05
</code></pre>
|
How to run a 2-layer perceptron to solve XOR <p>XOR is not solvable by using a single perceptron with standard scalar product and unit step function.</p>
<p>This article suggests using 3 perceptron to make a network:
<a href="http://toritris.weebly.com/perceptron-5-xor-how--why-neurons-work-together.html" rel="nofollo... | <p>If you want to build a neural network with logical connectives (and, or, not), you have to consider the following equivalences regarding xor:</p>
<blockquote>
<p>A xor B ⡠(A ⨠B) ⧠¬(A ⧠B) ⡠(A ⨠B) ⧠(¬A ⨠¬B) ⡠(A ⧠¬B) ⨠(¬A ⧠B)</p>
</blockquote>
<p>So you would need at least t... |
Shortcut keys for un/comment block of code doesn't work in xcode 8 (suddenly) <p>something weird just happen and can't solve it, the command "Command + /" which I used to un/comment block of codes doesn't work any more. when I hit the command the cursers just disappear for a second and than comeback but doesn't comment... | <p>ok, after install the latest ios update the problem just solved by itself.</p>
|
Getting access to the metaclass in Ruby <p>I'm trying to better understand the rules of Ruby and how to get access to the metaclass. I'm reading Yehuda Katz's article on metaprogramming and I came across this:</p>
<pre><code>matz = Object.new
def matz.speak
"Place your burden to machine's shoulders"
end
matz.cl... | <blockquote>
<p>What is going on on this line:</p>
<pre><code>metaclass = class << matz; self; end
</code></pre>
</blockquote>
<pre><code>class << foo
</code></pre>
<p>opens the singleton class of <code>foo</code>. Inside a class definition body, <code>self</code> is the class. The return value of a ... |
RestTemplate's postForObject Terminating Immediately After Sending Request <p>I'm trying to send a POST request with the following method, and return the HTTP response code upon sending the request. </p>
<p>Code in question:</p>
<pre><code>private ClientHttpRequestFactory getClientHttpRequestFactory() {
HttpCompo... | <p>The issue at hand was that postForObject() was returning null. I had an exception catcher later on that was hiding the issue.</p>
<p>I instead used postForEntity, which did not return null, and I was able to get a HTTP Status code using the following block:</p>
<pre><code>ResponseEntity<String> re = request... |
Grep search certain characters any order any capitalization <p>I need to grep search for the characters "james". The problem is they can be in any order and any of them can be capitalized. For example the following would need to be found..</p>
<ul>
<li><em>Aemjs</em></li>
<li><em>emaJS</em></li>
<li><em>SeMaJ</em></... | <p>Here's a fun regex for you:</p>
<pre><code>/ (?=.{0,4}j)(?=.{0,4}a)(?=.{0,4}m)(?=.{0,4}e)(?=.{0,4}s).{5} /i
</code></pre>
<p>What this'll do is look ahead to ensure that each character in the string "james" is matched within the next 5 characters, and the <code>i</code> modifier makes it case-insensitive.</p>
<p>... |
Django : form validation in client side? <p>I have two questions.</p>
<ol>
<li>I made certain <code>view</code> accept <code>POST</code> request only through <code>ajax</code>(Not general <code>POST</code> request)</li>
</ol>
<p>I'm using <code>Form</code> and realized that If I used <code>ajax</code>, I could not us... | <p>Generate the form HTML in a separate template. When you submit with ajax, if the form is invalid, i.e. form.is_invalid() then instantiate the form with request.POST and render the template again. Then, return this rendered HTML back to your Ajax function and replace the existing form. </p>
<p>This will prevent havi... |
Unity Errors after Update <p>I updated Unity today and i get 2 errors from times to times. I am pretty sure there are not from my scripts. How can i fix them?</p>
<pre><code>SUCCEEDED(hr)
rc.right == m_GfxWindow->GetWidth() && rc.bottom == m_GfxWindow->GetHeight()
</code></pre>
| <p>This is a known bug from Unity. </p>
<p>Re-Import the Project from the Editor.</p>
<p><strong>Assets</strong> -> <strong>Reimport All</strong>.</p>
<p>Then from MonoDevelop go to <strong>Build</strong>-><strong>Clean All</strong> and then <strong>Build</strong> -> <strong>Rebuild All</strong>. </p>
<p>Close and ... |
Unexpected result while sorting using if loops - Bad Algorithm <p>The objective of my program is to read randomized data of runners and their speeds from a text file and organize it into First, Second and Third. It has their names, bib, age, gender and m:s. However, in this program I cannot use STL/Arrays etc and am li... | <p>I'll point out the logical problem with this part of your existing code:</p>
<pre><code> if (pace < pace_f)
{
name_f = name;
pace_f = pace;
}
</code></pre>
<p>Your other <code>if</code> statements have the same problem, but it's easier to explain the problem here, and then you can... |
Finding asymptotic upper and lower bound? <p>If we assume T(n) is constant for small n, how can we find the solution of this function?</p>
<pre><code>T(n) = T(nâ2) + 2logn
</code></pre>
<p>So far, I am unable to find a way to represent the whole function. Can you please help me? I really want to understand. </p>
| <p>Assuming n is even, and that <code>T(1) = T(0) = 0</code>.</p>
<pre><code>T(n)/2 = log(n) + log(n-2) + ... + log(2)
= log((n/2)! * 2^n)
= n log(2) + log((n/2)!)
= n log(2) + n log(n) - n + O(log(n)) (Stirling's approximation)
</code></pre>
<p>So for <code>n</code> even, <code>T(n) = Theta(n lo... |
jQuery .find() using parent id <p>I am trying to find the value of an input statement that does not have an id.</p>
<p>The html is: </p>
<pre><code><td id="LastName">
<input type="text" value="Abner">
</td>
</code></pre>
<p>The jQuery code I am trying to use is:</p>
<pre><code>var name = $('#L... | <p>As DelightedD0D commented, <code>.val()</code> is the correct way to retrieve a value from a text input.</p>
<p>Here's a working snippet: <a href="https://jsfiddle.net/tuywqucb/3/" rel="nofollow">https://jsfiddle.net/tuywqucb/3/</a></p>
<p>One other thing to look out for.. if the <code>td</code> isn't correctly wr... |
PHP array detect if it contains unique value <p>I have some PHP arrays that looks like this...</p>
<pre><code>$cars1 = array("Volvo", "Volvo", "Volvo");
$cars2 = array("Volvo", "BMW", "Toyota");
$cars3 = array("Volvo");
$cars4 = array("Volvo", "BMW", "Volvo");
$cars5 = array("BMW", "Toyota");
</code></pre>
<p>I need ... | <p>you're proably looking for something like <a href="https://repl.it/DqW7" rel="nofollow">this</a></p>
<pre><code>function arrayEq($array,$val)
{
foreach($array as $item)
{
if($item != $val)
{
return false;
}
}
return true;
}
$cars1 = array("Volvo", "Volvo", "Volvo... |
Custom unwind segue animation display issue <p>I'm doing my first custom segue animations. What I want is to have a list view that when I select on a row, instead of sliding in from the side, it expands in place from the row selected. Something like:</p>
<p><a href="http://i.stack.imgur.com/gCcME.png" rel="nofollow"><... | <p>Try having the view controller that does the presentation also do the dismiss.</p>
<p>So in your unwind segue:</p>
<pre><code>UIView.animateWithDuration(4000.milliseconds, delay: 0.seconds, options: .curveEaseInOut, animations: {
fromView.frame = targetFrame
}) { (finished) in
self.destination.... |
Spring Boot + Jetty + Jersey won't start up: `Creation of FactoryDescriptors must have Factory as a contract of the first argument` <p>Unable to start a Spring Boot app using the embedded Jetty servlet container and Jersey. I'm using Spring Boot version 1.4.1.</p>
<p>Here is the error message:</p>
<p><code>Creation o... | <p>I solved this by upgrading HK2 to version <code>2.5.0-b22</code>.</p>
|
MVC5 return status 500 custom page, tried normal solutions <p>I want to be able to control a redirect to a different page or return a different view on certain handled errors. I can create custom pages with status 404, 403, 418, and it displays the page fine, but when I try to return 500 it overrides it with a default... | <p>Turns out it was a weird fluke with Razor. The RenderBody() adds <code><body></code> tags if none are in the document, apparently unless you return 500 in your status header. Then it doesn't add the <code><body></code> tags, and the HTML returns malformed which was causing my problem.</p>
|
Excel VBA address of FIRST INSTANCE instead of address of each location of value <p>I have a few employee numbers listed in Sheet1 of a workbook. There are a few other sheets (lets call these sheets A, B, C, D, etc) in the workbook that contain the employee number with some info (maybe dates worked). If an employee n... | <p>This method will stop on the first find (via the <code>Exit For</code>)</p>
<p>It also shows a more efficient method rather than looping all the cells on each sheet</p>
<pre><code>Sub makeMySearch()
Dim cell As Range, cell2 As Range
Dim ws As Worksheet, lastrow As Long, recFound As Long
Dim rw As Vari... |
New string list shuffles order of list elements on initialization in LINQ <p>After running into some frustrations with my ASP.NET 5 API project I decided to rebuild it as an older WebApi 2 project. I'm trying to generate a list of collections of 2 strings (originally a list of a 2 element string array, now a list of l... | <p>I'd be curious to see what SQL is generated for those queries and whether or not it changes when your result changes. Selecting a List to me seems like a pretty rare situation, so it's possible you have run into an edge-case (or at least into undefined behavior territory).</p>
<p>Since you're still essentially just... |
WPF DataGridComboBoxColumn Edit on Key press <p>I have a datagrid with a <code>DataGridComboBoxColumn</code> in it.</p>
<p>I want my users to be able to enter edit mode by just typing.<br>
This is the default behavior for <code>DataGridTextColumn</code> and I don't like that they have to press F2 in order to enable ed... | <p>You can try to use <code>SelectedCellsChanged</code> event. It works on focus changing. </p>
<p>If you don't want that behaviour on other columns you can check <code>e.AddedCells[0].Column</code> property (if your <code>SelectionUnit="Cell"</code> of <code>DataGrid</code>).</p>
<pre><code>private void dgTest_Selec... |
Pattern Is Matching Every Other Line Of Input <p>Here is the pattern I have:</p>
<pre><code>\s+\d+:\s+(?<local>\d+)[-][>]\s+?(?<remote>\d+)\s+(?<wwn>..:..:..:..:..:..:..:..)\s+\d+\s+(?<name>\w+)\s+[s][p]:\s+\w+.\w+\s+\w+[:]\s+\d.\w+\s+(?<trunk>TRUNK)?
</code></pre>
<p>Here is the inpu... | <p>That's because of this part: <code>\d.\w+</code></p>
<p>The corresponding part for the other number is <code>\w+.\w+</code></p>
<p><code>24</code> (from the <code>24.000G</code> substring) does not fit the <code>\d</code>, so you either should use <code>\d+</code> or <code>\w+</code>.</p>
<p>Another note, in this... |
Getting DHCP Scope Options using Powershell 2.0 <p>I need to get the DHCP scope option values using Powershell 2.0 on Windows Server 2003 R2 SP2.
I don't have access to the Get-DhcpServerv4OptionValue commandlet since that's only available on Windows Server 2012 R2.</p>
<p>How can I get the DHCP scope option values wi... | <p>You may do this <a href="https://social.technet.microsoft.com/Forums/en-US/66210404-e80c-4077-987f-84f8fc92eac8/monitor-dhcp-server-statistics-via-wmi?forum=winserverpowershell" rel="nofollow">via WMI</a> or use <code>net.exe</code> and then parse the text in PowerShell where needed</p>
|
Condition inside a count -SQL <p>I am trying to write a condition inside a count statement where it should only count the entries which do not have an ENDDATE. i am looking for writing the condition inside the count as this is a very small part of a large SQl Query</p>
| <p>sample query,</p>
<p>select product, count(*) as quantity</p>
<p>from table</p>
<p>where end_date is null</p>
<p>group by age</p>
<p>This query lists quantity for each product which do not have an end date</p>
|
Where to place .erl & .hrl files in phoenix project? <p>I have phoenix project and am going to use soap request. for that purpose I've generated stubs from wsdl as described <a href="https://medium.com/@larryweya/soap-in-elixir-with-soap-64400c585f69#.9uqcwrb9f" rel="nofollow">here</a>.
The question is where to put aut... | <p><code>erl</code> files should go in any directory present in the <code>erlc_paths</code> config, and <code>hrl</code> in the one in specified by <code>erlc_include_path</code> config. <a href="https://github.com/elixir-lang/elixir/blob/c16f54c6adc147a4bc84922097852b2062eedd96/lib/mix/lib/mix/project.ex#L552-L553" re... |
Redefinition of class constructor error <p>I am trying to compile my code and I keep getting the error: </p>
<blockquote>
<p>redefinition of 'SimpleDate::SimpleDate(int, int, int)</p>
</blockquote>
<p>I think the error is usually because of not adding <code>#ifndef</code>, <code>#define</code>, and <code>#endif</co... | <p>You defined the constructor in the header file, here:</p>
<pre><code>SimpleDate(int year, int month, int day) {};
</code></pre>
<p>Those innocent-looking braces turned this declaration into a definition. And then compiler got very upset when it later encountered the real definition of this constructor. Just remove... |
Putting result of foreach loop into a variable <p>i have a foreach loop that will convert each letter of a word to a number, then converting it into a binary.</p>
<p>for example:</p>
<ul>
<li>word= abc,</li>
<li>equivalent number: 0 1 3,</li>
<li>then convert it into binary: 00000 00001 00010</li>
</ul>
<p>im having... | <p>Use following modified program:</p>
<pre><code>public static void Main(string[] args)
{
Console.Write("INSERT TEXT:");
string a = Console.ReadLine();
char[] array = a.ToCharArray();
string[] aa = new string[array.Length];
int forIndex = 0;
foreach (char let in array)
{
int index... |
Pandas: How to do analysis on array-like field? <p>I'm doing analysis on movies, and each movie have a <code>genre</code> attribute, it might be several specific genre, like <code>drama</code>, <code>comedy</code>, the data looks like this:</p>
<pre><code>movie_list = [
{'name': 'Movie 1',
'genre' :'Action, Fa... | <p>If your data isn't too huge, I would do some pre-processing and get 1 record per genre. That is, I would structure your data frame like this:</p>
<pre><code> Name Genre
Movie 1 Action
Movie 1 Fantasy
Movie 1 Horor
...
</code></pre>
<p>Note the names should be repeated. While this may make your data set much... |
Minimum Spanning Tree with Boost <p>I have the following code that generates an undirected graph:</p>
<pre><code>// --- Header File ---
class Node { ... };
struct Edge { float weight; };
typedef adjacency_list<vecS, vecS, undirectedS, Node, Edge> Grafo;
class MST
{
public:
MST(std::vector<Node>... | <p><strong>TLDR</strong>: use </p>
<pre><code>kruskal_minimum_spanning_tree(g, std::back_inserter(mst),
weight_map( get(&Edge::weight, g) );
</code></pre>
<p><strong>Original answer</strong>:</p>
<p>The problem you are facing is that the algorithm needs to access a graph's weight map and... |
subprocess.Popen execution of a script stuck <p>I am trying to execute a command as follows but it is STUCK in <code>try</code> block as below until the timeout kicks in,the python script executes fine by itself independently,can anyone suggest why is it so and how to debug this?</p>
<pre><code>cmd = "python complete.... | <p><code>proc.stdout</code> isn't available to be read <em>after the process exits</em>. Instead, you need to read it <em>while the process is running</em>. <code>communicate()</code> will do that for you, but since you're not using it, you get to do it yourself.</p>
<p>Right now, your process is almost certainly hang... |
Supporting Angular 2's PathLocationHandler with Jetty (using a 404 error page) <p>I'm trying to work out how to support Angular 2's PathLocationHandler with an embedded Jetty server. To do that, as I understand it, I need to redirect any 404 request to the top-level index.html file (<a href="http://stackoverflow.com/a/... | <p>Some amount of banging my head against things brought me to the following, which does do what I want, though I'd still certainly accept an answer which explained why ResourceHandler isn't appropriate for what I want...</p>
<pre><code>import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.DefaultSe... |
Python Scripting in TIBCO Spotfire to show custom Messages <p>I am loading a data table on demand and have linked it to markings in a previous tab. The Data table look like:</p>
<pre><code> ID Values
1 365
2 65
3 32
3 125
4 74
5 98
6 107
</c... | <p>One work-around would be use of a small Text Area on the page (perhaps as a header). You can <code>Insert Dynamic Item</code> -> Calculated Value or Icon and have it perform a count or unique count based on marking (selection). For example, once the Count(ID) is > 1000, the text can change to red, or the icon can ... |
Int template in an array/vector/whatever <p>I need to know how to create an array/vector containing a class defined somewhat like:</p>
<pre><code>template<unsigned int rows, unsigned int columns>
class Matrix
{
......
};
</code></pre>
<p>Where <code>rows</code> and <code>columns</code> may vary from item ... | <p>you might can try something like this</p>
<pre><code>class MatrixBase
{
public:
virtual ~MatrixBase() {}
virtual int getrow() = 0;
virtual int getcol() = 0;
};
template<unsigned int row, unsigned int column>
class Matrix : public MatrixBase
{
public:
virtual int getrow()
{
retu... |
expect regular expression matches everything or nothing <p>From the following output</p>
<pre><code>user@machine ~]$ myScript
Warning: Permanently added '2.2.2.2' (RSA) to the list of known hosts.
Cookie: 65251-403 EventID: 8900000000
Answer:
</code></pre>
<p>How may I capture only the line "Cookie: 652... | <p>Capture this <code>Cookie: 65251-403 EventID: 8900000000</code> with <code>^Cookie.*?$</code></p>
<p><strong>[EDIT] after your comment</strong></p>
<p>You need to add the multiline flag - see it working here: <a href="https://regex101.com/r/7XBeOF/1" rel="nofollow">https://regex101.com/r/7XBeOF/1</a></p>
<p>If yo... |
External User for JFrog Artifactory Pro sees "Build Browser" <p>I want to share few of our libraries with our customers using JFrog Artifactory Pro. I have added a User for the customer and set permission to only show those packages which we want to share. However, when I login into JFrog Artifactory using the newly cr... | <p>In Artifactory you can block the access to the builds tab only for users that are not signed in. In case that a user is logged in and has read permissions on a repository then he will be able to see the builds tab. There is an open feature request for adding permissions to the builds tab. You can vote and watch this... |
How can I use Linq to XML to parse an XML string and locate all nodes with a value that starts with a specified letter? <p>Given a string of XML text like</p>
<pre><code> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<directory dirname=\"c\">" +
"<directory dirname=\"documents... | <p>Change the function as below...</p>
<ol>
<li><p>In the calling method, change the type as </p>
<pre><code>foreach (XAttribute name in Folders)
</code></pre></li>
<li><p>Change the ParseXmlString as below. </p>
<pre><code>private static List<XAttribute> ParseXmlString(string xmlStr, string searchValue)
{... |
Output list of files from slideshow <p>I have adapted a python script to display a slideshow of images. The original script can be found at <a href="https://github.com/cgoldberg/py-slideshow" rel="nofollow">https://github.com/cgoldberg/py-slideshow</a></p>
<p>I want to be able to record the filename of each of the im... | <p>System don't have to write to file at once but it can keep text in buffer and saves when you close file. So probably you have to close file.</p>
<p>Or you can use <code>thefile.flush()</code> after every <code>thefile.write()</code> to send new text from buffer to file at once.</p>
|
Extract the year and the month from a line in a file and use a map to print every time its found to add 1 to the value <pre><code>def Stats():
file = open('mbox.txt')
d = dict()
for line in file:
if line.startswith('From'):
words = line.split()
for words in file:
... | <p>Not the direct answer to the question, but a possible alternative solution - use the <a href="https://labix.org/python-dateutil" rel="nofollow"><code>dateutil</code></a> datetime parser in a "fuzzy" mode and simply format the extracted <code>datetime</code> object via <a href="https://docs.python.org/2/library/datet... |
How to show array from show table schema query in php <p>i have a query</p>
<pre><code>$qdrop=mysqli_query($connect,"select TABLE_NAME,create_time
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = 'purbalingga'
AND CREATE_TIME <='2016-10-07' and TABLE_NAME LIKE '2016%'");
</code></pre>
<p>and... | <p>Replace:</p>
<pre><code>while ($datadrop=mysqli_fetch_array($qdrop)) {
echo $qdrop['TABLE_NAME'];
echo"<br/>";
}
</code></pre>
<p>With:</p>
<pre><code>while ($datadrop=mysqli_fetch_array($qdrop)) {
echo $datadrop['TABLE_NAME'];
echo"<br/>";
}
</code></pre>
<p><code>$qdrop</code> only holds th... |
Angular 2 two-way binding propagation through components <p>I'm trying to make two-way binding in a component and propagate it through other components that contain the child component:</p>
<p>I have a child component, with two-way binding and it's working. The binding is pointing to a variable called <code>child_valu... | <p><strong>1. The easiest way to fix your code:</strong></p>
<p>If you check the console log that you've written into, you can see that <code>AppComponent</code> and <code>ParentComponent</code> are notified by the <code>valueChanged</code> event, all you need to do is to update the value of the variables accordingly:... |
How can I simulate a basic drop shadow using border-image and linear-gradient? <p>I'd like to simulate a drop shadow effect using border-image and linear-gradient (for scroll performance reasons, I am not using the native box-shadow effect).</p>
<p>As can be seen in the example below and in the <a href="https://jsfidd... | <p>For the short border to work you need to change the </p>
<pre><code>100 repeat;
</code></pre>
<p>to</p>
<pre><code>0 0 100 0 repeat;
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-c... |
How to select a match and split a string in ruby? <p>I need to select and prune an array of strings in Ruby and I have it partially working.</p>
<p>I have array of strings that looks like this:</p>
<pre><code>321 com.apple.storeaccountd.daemon
- com.apple.cmio.AVCAssistant
- com.apple.diskmanagementd
150 com.apple.Co... | <p>The Array#select method will not modify each entry in the list, its used only to select which one to keep based on what the block returns.</p>
<p>What you want to use is Array#map! like this:</p>
<pre><code>launchctl_list.map!{|f| f.split(' ').last }
</code></pre>
|
How can I disable a button until image is taken in swift 3? <p>So, I want the button to be disable if no photo is taken, if the photo is taken and shows on the imageview then I want the button to be enabled? </p>
| <p><strong>step-1</strong></p>
<blockquote>
<p>check the image is nil or not in view is loaded</p>
</blockquote>
<pre><code>@IBOutlet weak var photoImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// call the method
setHiddenImage()
}
</code></pre>
<blockquote>
<p>create the... |
How to tie different data in sql with same post_id <p>Below is How this Table data look a like</p>
<pre><code>Post_id | P_key | P_value
10 | F_name | Amar
10 | l_name | Arya
10 | country | India
11 | F_name | Karan
11 | l_name | Roy
11 | country | Nepal
</code></pre>
<p>And ... | <p>Here's one option using <code>conditional aggregation</code>:</p>
<pre><code>select max(case when p_key = 'f_name' then p_value end) as f_name,
max(case when p_key = 'l_name' then p_value end) as l_name,
max(case when p_key = 'country' then p_value end) as country,
post_id
from yourtable
group ... |
What is the iOS URL schema for Facebook profiles? <pre><code>class func openFacebook(id: String){ //id is a username in this case
let name = id.replace(" ", withString: "")
let hook = "fb://profile/" + name
let hookURL = NSURL(string: hook)
if UIApplication.sharedApplication().canOpenURL(hookURL!){
... | <p>If you have an error: 'LSApplicationQueriesSchemes'
so you have to register url scheme in LSApplicationQueriesSchemes under plist.</p>
<p>please check below link for process of adding url scheme to LSApplicationQueriesSchemes.</p>
<p><a href="http://stackoverflow.com/questions/21893447/facebook-sdk-app-not-registe... |
Mock standard input - multi line in python 3 <p>I am new to python and have been using python 3 for my learning. I am using python's unit test framework to test my code.</p>
<p>Problem :-</p>
<p>The function that I need to unit test takes inputs in the following manner:-</p>
<pre><code>def compare():
a, b, c = in... | <p>You can't patch it twice like that. You'll have to patch it once, with an object that returns different values on subsequent calls. Here's an example:</p>
<pre><code>fake_input = iter(['1 2 3', '4 5 6']).__next__
@patch("builtins.input", fake_input)
def test_compare(self):
...
</code></pre>
|
accessing specific columns from another table in the has_many/belongs_to relationship <p>I have an <code>Rsvp</code> table which forms a join between a <code>User</code> and an <code>Event</code>. <code>Rsvp</code> table has information for an rsvp <code>status</code>. I need for <code>Event</code> to be able to access... | <blockquote>
<p>here error I get: <code>undefined method 'status=' for #<Rsvp::ActiveRecord_AssociationRelation:0x007fabb403b8f0></code>. it works if you do it directly like <code>Rsvp.find(:id).status</code></p>
</blockquote>
<p>Odd. <code>status=</code> means you're trying to set a value on the status... but... |
Convert JAVA code KeyStore.getInstance to c# <p>I'm trying to convert this following <code>JAVA</code> code to <code>C#</code> for getting <code>ECPrivateKey</code>.</p>
<pre><code>private static ECPrivateKey loadPrivateKey(String pkcs12Filename) throws KeyStoreException, NoSuchProviderException, IOException, NoSuchAl... | <p>Here is the code, I got the output with this.</p>
<pre><code>private void GetPrivateKeyFromP12(string path, string passWord)
{
//this.mKeyStoreEntities = PKCSUtils.extractEntities(privateKeyFilePath, privateKeyPassword);
/**
* Java has a minimum requirement for keystore ... |
What is the most secure way to Create a Process with Admin Rights? <p>I have a server that uses the CreateProcess function to launch a client program which requires administrative rights. I am hesitant to do this because all a hacker would have to is replace their program <code>hacker.exe</code> in the same location a... | <p>After some additional research, using <a href="https://support.microsoft.com/en-us/kb/307020#bookmark-3" rel="nofollow">System.Security.Cryptography</a> is a very poor choice because Windows already has a builtin mechanism involving RSA encryption called <a href="https://msdn.microsoft.com/en-us/library/ms537361(v=v... |
Identify the latest file through specific patterns in a directory <pre><code>var directory = new DirectoryInfo("C:\example");
string pattern = "LOG" + "_" + "NA" + "_" + "3465";
var validFiles = directory.GetFiles("*.xml");
List<string> list = new List<string>();
foreach (var item in validFiles)
{
stri... | <p>Use the pattern when you call <code>GetFiles</code>, then order by creation date or whatever field you're interested in. The <code>OrderByDescending</code> ensures the oldest file is on top.</p>
<pre><code>list = directory.GetFiles("*LOG_NA_3465*.xml")
.OrderByDescending(fi => fi.CreationTime)
... |
How do I properly pass data from a component to another in angular 2 <p>I have these codes:</p>
<p>moduleOne.component.ts:</p>
<pre><code>@Component({
selector: 'one',
templateUrl: './moduleOne.component.html'
})
export class ModuleOneComponent {
private ag: AgGridModel;
private columnDefs = [
{he... | <p>In <code>AgGridCommonComponent.ngOnInit()</code> you query the DOM but the DOM is probably not available yet. This code should be moved to <code>ngAfterViewInit()</code></p>
|
r - look up values in a table based on other variables representing row and column number <p>In R I have a table of people's responses to a multiple choice questionnaire e.g. table1:</p>
<pre><code>subject question1 question2 question3
person1 1 2 1
person2 2 1 3
person3 4... | <p>I <em>think</em> your question is "How do I look up the (question1, question2)th (row, col) of <code>table2</code> and save the result for each person", where <code>table2</code> is given. (As opposed to "how do I generate <code>table2</code>").</p>
<p>if so, you can use matrix indexing into your table. Ie make a 2... |
My Word VBA UserForm is not populating my template as expected, but does not produce an error message. Why? <p>The expected behavior when I click the OK button is populating the form with the information entered by the user. Instead, nothing happens. The document remains unchanged, but I don't receive an error message.... | <p>You must add PopulateTemplate before hiding the userform</p>
<pre><code>Private Sub cmdOK_Click()
If ValidateData = False Then
Exit Sub
End If
PopulateTemplate
'Closes the form after information is entered
frmEmploymentOffer.Hide
End Sub
</code></pre>
|
SQL SELECT query between 2 unknown dates <p>I was trying to find symptoms between 2 dates. The date is obtained from a table and is not current date. The range is date +1 day to date+ 5 days. I wrote this code but it does not seem to work. </p>
<p>Where am I going wrong?</p>
<pre><code>SELECT answer
FROM column
WHERE... | <p>--maybe like this :)
--dateadd to +5 days</p>
<p>SELECT x
FROM date a
WHERE a.yourDate BETWEEN a.yourDate and DateAdd(day, 5, a.yourDate)</p>
<p>--using GateDate();</p>
<p>SELECT x
FROM date a
WHERE a.yourDate BETWEEN getdate() and DateAdd(day, 5, getdate())</p>
|
Are two doubles of equal value guaranteed to have the same bit pattern? <p>In C, is there a guarantee that two doubles whose values are equal (<code>double1 == double2</code>) will have identical bit patterns?</p>
| <p>There is no such guarantee.</p>
<p>For example, in <a href="https://en.wikipedia.org/wiki/IEEE_floating_point" rel="nofollow">IEEE floating point format</a>, there exists the concept of negative 0. It compares equal to positive 0 but has a different representation.</p>
<p>Here's an example of that:</p>
<pre><cod... |
CSS: Fixed-first-column Table? (CSS only!) <p>I've been trying to figure out a way to take a standard table and create a fixed-column table where the first column is fixed while the rest scrolls. There's a couple ways that I think make sense, so I'll start with that.</p>
<p>The first way that makes sense to me is to s... | <p>One way you could make it is by using two tables with the same style, but it's a little hard to maintain. You have to make sure both tables are on the same line and that there's no space between them. When you just wrap the table with the actual content in a div that scrolls. Honestly, I wouldn't go there unless you... |
How to fix âSystems.Collections.Generic.IEnumerables<>â An explicate conversion exists. Are you missing a cast? <p>Iâm creating a web API in MVC. The database is (thus far) simple, only three tables. I am unable to join them, though. Iâve tried three different methods for joining tables in the controller, an... | <p>i think table Samples or table users not a data in database. besause linq can't accommodate table with no data.</p>
|
OAuth2 auth on postman when token at hand <p>How to configure postman when you already have a token/bearer key at hand?</p>
<p>Was hoping it would be somewhat similar with seting up an OAuth2.0 authentication with SoapUI that you can just input the bearer/token key.</p>
| <p>If you have an access token, you can configure POSTman by setting up a custom Authorization header. Setup:</p>
<pre><code>Authorization: Bearer <accessToken>
</code></pre>
<p>And if the API you are accessing supports bearer tokens, and you are providing a valid access token, then it should work.</p>
|
JavaScript element does not display on mouseover <p>I have two elements. One is "menu1" and is designed to unhide "atlas_menu1" on mouseover, and hide it on mouseout. My issue is that I also want "atlas_menu1" to stay unhidden when the mouse is over itself as well, but it isn't working. Here is the code I have:</p>
<p... | <pre><code>#hiddenpanel{
width: 150px;
height:150px;
background: green;
display: inline-block;
display: none;
}
</code></pre>
<p>here is a working sample: <a href="https://jsfiddle.net/huspg48w/2/" rel="nofollow">https://jsfiddle.net/huspg48w/2/</a></p>
|
How can I include response data in Rails logs? <p>I noticed that Rails logs show the request-response duration, which means Rails first waits for the response before logging the request parameters, and other request info.</p>
<p>This means the response has already been generated upon the point of logging. Is there a w... | <p>You can write to the rails log with anything you like at any time you like within your own code. Details here:
<a href="http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger" rel="nofollow">http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger</a></p>
<p>eg you could put in... |
Notification alerts not working <p>I need to setup notification alerts for my website. I'm using this simple <a href="https://github.com/msroot/Notify.js/" rel="nofollow">notification script</a>. I have test it on my website like this. </p>
<pre><code><div id="notifications">
<div class="alert alert-danger" ... | <p>Your requirements are a bit difficult to understand. You refer to the "notification" appearing correctly, but the only thing I see appearing is <code>x Thanks</code> in the bottom-right corner. However, that's not a notification, it's coming from your markup. It has no event associated with it, so nothing will happe... |
Get img src within html file in Laravel <p>How can i get the image if I was given a URL with lots of img <code>src</code>? I am using Laravel 5.2.</p>
<p>This takes too long to load given that I have 6,000 links. Thanks in advance.</p>
<pre><code>$url="$products->product_url";
$html = file_get_contents($url);
$doc... | <p>Firstable you need to find some kind of <code>class</code> of <code>id</code> of parent element that contain image that you need for example:</p>
<pre><code><body>
// bla-bla-bla
<div class="content">
<img src="img.png" />
</div>
</body>
</code></pre>
<p>You can d... |
Count even numbers from function output in R <p>I am working through the <a href="https://projecteuler.net/" rel="nofollow">Euler Problems</a>, and the problem is to sum the even terms in a Fibonacci sequence up to the length where the last term is < 4e6. I got it eventually but the following method of counting the... | <p>It is because you are using elements of <code>numbers</code> as your index into <code>total</code>.</p>
<p>See how you have <code>for (i in numbers)</code>. So (for example) when considering the Fibbonaci number 2584 in <code>numbers</code>, you are setting <code>total[2584] <- 1</code>.</p>
<p>Your eventual <c... |
MaterializeCSS NavBar and SideNav <p>I'm creating a sb admin 2 like page where it has 2 navigations that looks like this:</p>
<p><a href="http://i.stack.imgur.com/pY9CK.png" rel="nofollow"><img src="http://i.stack.imgur.com/pY9CK.png" alt="enter image description here"></a></p>
<p>And what I've done so far is this:</... | <p><a href="http://materializecss.com/side-nav.html" rel="nofollow">As the Side Nav documentations says:</a></p>
<p>You have to offset your content by the width of the side menu.
so do like this</p>
<pre><code><style type="text/css">
.wrapper {
padding-left: 300px;
}
</style>
</code></pre>
<p>and wra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.