input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Xamarin.Forms bug fix? CAN'T SEE "iOS Build" in project properties of Visual Studio 2015 <p><a href="http://i.stack.imgur.com/DapEC.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/DapEC.jpg" alt="Screenshot"></a>I CAN'T SEE the iOS project properties in any new Visual Studio 2015 Xamarin.Forms project I create o... | <p>As Kowalski said, once you are able to connect to the Mac Build Host successfully that error will disappear and everything will work just fine again.</p>
|
Why does my Python XML parser break after the first file? <p>I am working on a Python (3) XML parser that should extract the text content of specific nodes from every xml file within a folder. Then, the script should write the collected data into a tab-separated text file. So far, all the functions seem to be working. ... | <p>You are overwriting your function calls with the values they returned. changing the function names should fix it.</p>
<pre><code>import xml.etree.ElementTree as ET
import re
import glob
import csv
import sys
content_file = open('WWP Project/WWP_texts.txt','wt')
quotes_file = open('WWP Project/WWP_quotes.txt', 'wt... |
Azure ActiveDirectoryClient inside of MVC application never returns <p>Iâm writing an MVC application that needs to create users in Azure Active Directory. Iâve wrapped the code that creates the user in its own library and it works fine inside of a unit test. However, when the same code is called inside my MVC Co... | <p>Instead of return the AADUser directly we should use the Task< AADUser>. Here is the code works well for me:</p>
<pre><code>public async Task<AADUser> GetUserByPrincipalName(string userName)
{
var user = await GetUserByUserName(activeDirectoryClient, userName);
return new AADUser()
... |
Get a class method that implements an interface defined in a different DLL <p>My case is a little complicated, so I am explaining it with an example.</p>
<p>Here is my case:</p>
<p><code>fileA.cs</code>:</p>
<pre><code>namespace companyA.testA
{
public interface ITest
{
int Add(int a, int b);
}
}... | <p>Well, seeing as you already have the assembly available right there as <code>asm</code>:</p>
<pre><code> var typesWithAddMethod =
from type in asm.GetTypes()
from method in type.GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly)
where method.Name == "Add"
... |
How can I find the path in rust-fuse? <p>I am trying to write a FUSE interface for a REST API in Rust. I am using the <a href="https://github.com/zargony/rust-fuse" rel="nofollow">rust-fuse</a> library. I need the dir path in the <code>readdir</code> callback function when implementing the <code>Filesystem</code> trait... | <p>It appears the library doesn't provide this yet:</p>
<p><a href="https://github.com/zargony/rust-fuse/blob/a582267d0ac2aad600283e665c538125bd6bc70a/README.md" rel="nofollow">From the README</a> (emphasis mine):</p>
<blockquote>
<h1>To Do</h1>
<p>There's still a lot of stuff to be done. Feel free to contribu... |
Error CS1705: Assembly uses 'System.Web.Mvc, Version=5.2.3.0' which has a higher version than referenced assembly <p>I recently updated my project MVC 5.2.3 (using Nuget). Everything builds fine locally, but when I deploy to AppHarbor, I get the following precompilation error:</p>
<p><strong>An error occurred while co... | <p>It turns out that the issue was my App_Code folder. I had a global helper defined in a .cshtml file in App_Code, and while this didn't cause any problems building locally, it caused an error when building on AppHarbor. When I removed App_Code everything built just fine.</p>
|
Can't add media on Orchard v.1.10.1.0 <p>I did a setup of an Orchard v.1.10.1.0 with the default recipe and can't add media. The Javascript console shows this error: </p>
<pre><code>GET https://website.azurewebsites.net/Media/Default/_Profiles/1338a03e/abbfa561/header.png?v=636100967487424883 404 (Not Found)
Uncaugh... | <p>This is a known bug in Orchard 1.10. You should be able to fix it by changing line 385 in <code>Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library.js</code>
to <code>var separator = deepestChildPath.indexOf('/') > -1 ? '/' : '\\';</code>
as shown in <a href="https://github.com/OrchardCMS/Orchard/comm... |
How can I manage my projects versions using Visual Studio 2012 Professional <p>I am working on developing an asp.net mvc web application , using visual studio 2012 professional. now when I want to update my project, for example by adding new features, I do the following steps:-</p>
<ul>
<li>I copy the project folder.<... | <p>You'll want to use a version control system like Team Foundation Server (TFS), Git, Mercurial, Subversion, etc. I personally recommend Git. Many of them have a means of integration with Visual Studio 2012 (for example, see <a href="http://stackoverflow.com/questions/19892232/how-to-connect-visual-studio-2012-with-gi... |
Calling JS "link" attribute using "onclick" event <p>Code has been updated.</p>
<p>I'm trying to change all my hard coded links into a one attribute using <strong>Onclick</strong> event, so it would easy to me to change them all by changing just the attribute at the Head. The link is opened in an iframe.</p>
<p>This ... | <p>You would want to do something like that </p>
<pre><code><a href="http://www.example.com" onClick="window.open(this.href)" target="iframe_test">Test</a>
<iframe id="iframeid" name="iframe_test" frameborder="0" scrolling="no" width="300px" height="300px"></iframe>
</code></pre>
|
Name a positional parameter "from" <p>I'm writing a script to translate ColdFusion CFML code to CFScript code. In many places, it will take a dictionary of attributes, look through a list of functions, and invoke the first one whose parameters match the given attributes with the dictionary as keyword args:</p>
<pre><c... | <p>This is likely too simplistic for your use case (or you might even consider this "bloating the syntax at the point of use"); but could you rely on Python's <a href="https://docs.python.org/3/glossary.html#term-eafp" rel="nofollow">EAFP</a> principle: try calling the functions, and just ignoring any exceptions? Som... |
How do I hide a div behind a video element? <p>I've placed a video above a div background, The video has black background and for the video background to not be visible, I've used mix-blend-mode: screen.</p>
<p>Everything is working fine till now. The problem is when another elements gets behind the video (onclick ani... | <p><strong>Example #1</strong></p>
<p>Set Square class position to the absolute and parent (background) position to the relative.</p>
<pre><code>.square{background-color: red;width: 100px;height: 100px;position: absolute; top: 50%; left: 50%;}
.background{position: relative;}
</code></pre>
<p>and your video is insid... |
What is wrong with this if else statement? <p>I'm working with Ada, and the lack of braces on the control statements have been getting me a bit mixed up. I have written the following if-else statement:</p>
<pre><code>if i = 1 then
largest := nextInteger;
else if i = 2 then
if nextInteger > largest then
... | <p>try like this</p>
<pre><code>if i = 1 then
largest := nextInteger;
elsif i = 2 then
if nextInteger > largest then
secondLargest := largest;
largest := nextInteger;
else
secondLargest := nextInteger;
end if;
else
if nextInteger > largest then
secondLargest :=... |
jQuery dragable / sortable with nested list <p>I have a page that contains a source list and three possible drop zones for the user to move an item to. Due to the source list growing in length, I want to break down the <code><li></code>'s into categories to make it more readable.</p>
<p>When doing so, my code is... | <p>I make a simple example for let you understand the solution.</p>
<p>In Jquery UI sortable you can use a class for exclude that item from the sortable.</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-j... |
Range input on Canvas <p>I'm trying to create a range slider on a canvas element that gives me back a value that I can then use to manipulate the canvas elements. It needs to be inside the canvas as it's for an html5 banner ad. I understand I can't insert DOM elements into the canvas so I'm wondering if there is a libr... | <p>Your Range Control is easy enough to create natively -- especially if your range control is horizontally or vertically aligned.</p>
<p><strong>To create a very simple horizontal range control</strong></p>
<p>Given these values for the range control:</p>
<ul>
<li>The starting position of the bar: <code>x,y</code>,... |
Knight's tour, count steps that takes to go from A to B <p>A knight is located in position (a,b) and needs to take the king located in (c,d). How can I:</p>
<p>A: Visualize the tour</p>
<p>B: Calculate the min steps needed to go from (a,b) to (c,d)</p>
<p>The implementation I've found are basically a sequence of mo... | <p>You could use BFS algorithm for achieving the above. Just cache the position visited so that you don't visit a position multiple times. Now whenever you visit the destination that would be the minimum number of steps taken as at every complete iteration you are exploring just 1 degree of separation.</p>
<p>Assuming... |
Modify parent component state from child <p>I am very new to React (so this may be very trivial) and while trying it out on a simple app I am stuck when trying to change a state in a parent component from within a child.</p>
<p>For the app to work, the parent component has to keep the state as it is then passed on to ... | <p>You can open the console to see the errors. </p>
<blockquote>
<p>One error was about not binding your addItem with .bind(this).</p>
</blockquote>
<p>You should bind this to your passed methods. They might be called on dom, or in other components, so the context of this changes. However if you bind this while you... |
plotting median of the points in R ggplot <p>I have a question (I am new to R and already spend couple hours looking for the code) in plotting median for the following. I hope someone can help me! </p>
<pre><code>TYPE(time) DV
0 1
1 2
2 4
5 6
7... | <p>You can calculate the median of <code>DV</code> for each type firstly, and then use <code>geom_segment</code> to draw the line in the plot:</p>
<pre><code>library(dplyr)
library(ggplot)
df1 <- df %>% group_by(TYPE) %>% mutate(med = median(DV))
gg1 <- ggplot(df1) +
geom_point(aes(x=TYPE, y=DV)) +... |
How to maintain multiple machines, multiple users for git revision control <p>I have n computers, and each computer has the same administer user name and password, but different computer name. </p>
<p>Now I have a project in gitlab server, it requires ssh key pair(computer and server). How do I pair all the computers ... | <p>You will have to generate a new ssh key for each computer that will try to access your github account. </p>
<p><a href="https://code.tutsplus.com/tutorials/quick-tip-how-to-work-with-github-and-multiple-accounts--net-22574" rel="nofollow">This Tutorial</a> on tutsplus is fairly easy to follow and explains it very w... |
xml syntax highlighting vim colorscheme fix <p>I started using the distinguished colorscheme (<a href="https://github.com/Lokaltog/vim-distinguished/blob/develop/colors/distinguished.vim" rel="nofollow">https://github.com/Lokaltog/vim-distinguished/blob/develop/colors/distinguished.vim</a>) and while the html syntax hi... | <p>You can "link" the <code>xmlEndTag</code> highlight group to the <code>xmlTag</code> highlight group:</p>
<pre><code>hi link xmlEndTag xmlTag
</code></pre>
|
Sml folding a tree <p>I am trying to get the product of a tree by using the fold function so far this is what I have. I am confused on how to use the fold method while transversing the tree </p>
<pre><code>datatype 'a bin_tree = Leaf of 'a
| Node of 'a bin_tree * 'a bin_tree
fun treefold g z Empty = z
| treefold g ... | <p>First, some pointers about what isn't quite in order in your attempt.</p>
<ol>
<li>The base case of your <code>treefold</code> function matches against the value constructor <code>Empty</code>, but you don't define the <code>bin_tree</code> datatype to include an <code>Empty</code> value constructor.</li>
<li>As Jo... |
Manual Reference - ObjectId() <p>I am looking for some help with _id in Mongo. I want to manually set an ObjectId() reference but I cannot do it. I checked out the code in the official mongo documentation and inserted it in my app but fails. If someone can provide some insight I would def appreciate it. The original_id... | <p>Instead of <code>ObjectId()</code>, you may need to use <code>Meteor.Collection.ObjectID()</code> instead.</p>
<p>See <a href="http://stackoverflow.com/questions/15318184/meteor-collection-objectid-vs-mongodb-objectid">Meteor.Collection.ObjectID() vs MongoDB ObjectId()</a> for more details into this.</p>
|
JS Function Parameter Resets Itself <p>I am trying to create a simple question-answer "flash card" program. The user types what the word means in the opposite language. Everything is working fine, except for one thing:</p>
<p>When you click the button to go to the next level, it works fine. However, when you enter a c... | <p>The problem is failing to declare variables and creating a closure by accident.</p>
<p><code>question=</code> and <code>answer=</code> are creating window properties of the same name because they have not been declared.</p>
<p><code>level</code> is a formal parameter of function <code>next</code> and is first set ... |
MuleSoft Debugger not working <p>I am trying to debug in my anypoint studio and debugger does not seems to be working.
I performed following steps PROJECT_NAME --> Right Click --> Debug As --> Mule Application.</p>
<p>Application has successfully deployed however debugging is not working. I see a message as "Mule Debu... | <p>Try closing Anypoint Studio and clean all metadata. Start debugging the flow again.</p>
|
AWS API Gateway - CORS "access-control-allow-origin" - multiple entries <p>I have a AWS Lambda instance that connects to a defined AWS API Gateway. If I enable CORS and give the <code>access-control-allow-origin</code> a definition of <code>http://example.com</code>, then I am able to access the Lambda instance from <... | <p>Unfortunately this is not possible today. The CORS spec does not allow for partial wild cards and currently API Gateway only allows a single static value for the header.</p>
<p>You may be able to overload your OPTIONS method to return this value dynamically based on the incoming host header.</p>
|
Generate random shape along a point on circumference of circle <p>I am new to webgl ,i created a circle from vertices generated in a loop and i want a random shape(small circle) to be generated on some point along the circumference of the big circle.Can anyone provide me some info on how i can acheive this
Here is my c... | <p>It's hard to answer your question because WebGL is just a rasterization library so there's literally 1000s of ways to draw something somewhere.</p>
<p>So, you can</p>
<ul>
<li><p>add more points</p>
<p>You generated the circle points. Generate some more for whatever else you want to draw.</p></li>
<li><p>draw the... |
C segfault when looping over a list <p>Here is my list struct:</p>
<pre><code>typedef struct Header {
struct Header* next;
char empty;
int storageSize;
} Header;
</code></pre>
<p>And I am looping over a list to check how many elements its has:</p>
<pre><code>int listSize(Header* _header) {
int count = 0;
w... | <p>Change this:</p>
<pre><code>while(_header->next) {
</code></pre>
<p>to this:</p>
<pre><code>while(_header) {
</code></pre>
<p>since you want to loop over your list, as long as the <em>current</em> node is not <code>NULL</code>.</p>
<p>You were facing a segmentation fault, because you were trying to get the <... |
How can i get the last lines of string in JAVA <pre><code>$GPGGA,013810.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69
$GPRMC,013810.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A
$GPGGA,013811.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69
$GPRMC,013811.000,A,1437.9098,N,12100.229... | <p>If you have the following:</p>
<pre><code>String a = "$GPGGA,013812.000,1437.9098,N,12100.2297,E,1,10,1.0,26.4,M,39.1,M,,0000*69";
String b = "$GPRMC,013812.000,A,1437.9098,N,12100.2297,E,0.00,122.34,200916,,,A*6A";
</code></pre>
<p>Then split each at the "," symbol:</p>
<pre><code>String[] aAry = a.split(",");
S... |
copy one letter from a string into another <p>So I need to create a function that copies the characters from the even position of one string into a dynamically create new string and then return the new string. If I send the function "ABCDEFG" it returns "ACEG". How do you copy one character of a string into a new one i... | <p>Use <a href="https://www.tutorialspoint.com/c_standard_library/c_function_strcat.htm" rel="nofollow">strcat()</a> function available in C. You don't need to copy char from s1 to s2 instead append the required characters as string from s1 to string s2. This is enough hint to solve your issue.</p>
|
Angular2 Hero Tutorial - hero class <p>In the section where the hero class is temporarily stored on app.component.ts, I'm not sure where to paste the script below where it says we have to refactor.</p>
<p>hero: Hero = {
id: 1,
name: 'Windstorm'
};</p>
<p>Putting this in the app.component.ts file brings up an erro... | <p>Your error here is that you declared <code>Hero</code> as a class and you can't create a class on the fly.</p>
<p><code>Hero</code> is an interface in the tutorial, to be able to create it on the fly.</p>
<p>simply replace </p>
<pre><code>export class Hero {
id: number;
name: string;
}
</code></pre>
<p>by </... |
Dynamic height collection/tag view inside a UITableViewCell <p>I have an already existing table view in my app which I'm trying to add a new cell to. The new cell will display a variable amount of buttons, each of which has a title (and thus a dynamic width). The new cell is supposed to look like this:</p>
<pre><code>... | <p>Write this in table cellforRowAtIndexPath method.</p>
<pre><code> y=20;
x=20;
for (int i=0; i<[arrAssignUsers count]; i++) {
CGRect screenRect=[[UIScreen mainScreen]bounds];
CGFloat screenWidth=screenRect.size.width;
[arrBtnStatus addObject:[NSNumber ... |
export gridview to excel using closed xml with 1 column apart <p>I'm exporting gridview to excel using ClosedXML, I want my output to have a one column apart. Like this.
<a href="http://i.stack.imgur.com/dbZRH.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/dbZRH.jpg" alt="enter image description here"></a></p>
... | <p>Try this:</p>
<pre><code>for (col = 0; col < headerCount; col++)
{
worksheet.Cell(3, current * 2 + 1).Value = GridView1.HeaderRow.Cells[col].Text;
}
</code></pre>
|
Attempt to use non-existent memory MIPS <p>So I'm having trouble with some code. I am practicing and for the life of me I can't seem to figure out what is wrong with my code. I keep getting
"Attempt to use non-existent memory" error and it seems to happen when returning to the function/label on line 88 after calling is... | <p>There are several problems with your code.</p>
<ul>
<li><p>In a couple of places you're using <code>J</code> when you should be using <code>JAL</code>. (<code>j is_prime</code> and <code>j print_number</code>).</p></li>
<li><p><code>print_number</code> needs to save and restore <code>$a0</code>, but doesn't.</p></l... |
Why do I always get Whitelabel Error Page with status "404" while running a simple Spring Boot Application <p><strong>My Controller</strong></p>
<pre><code>@Controller
//@RequestMapping("/")
//@ComponentScan("com.spring")
//@EnableAutoConfiguration
public class HomeController {
@Value("${framework.welcomeMessage}... | <p>Figured it out myself.</p>
<p>When I converted my dynamic webproject into maven project it did not create the folder structure this way</p>
<p><code>src/main/java</code></p>
<p>and </p>
<p><code>src/main/resources</code></p>
<p>and</p>
<p><code>src/main/webapp</code></p>
<p>I manually created myself and moved... |
html email signature not displaying inline css in gmail <p>So, for my email signature, I'm using custom html with inline css, as recommended for email usage.</p>
<p>This is what the signature is supposed to look like,</p>
<p><strong>red lines are just used to cover my personal details.</strong></p>
<p><a href="http:... | <p>Gmail doesn't support css inside <code><style></code> elements, you need to inline the css using style attributes. See: <a href="https://www.campaignmonitor.com/css/" rel="nofollow">https://www.campaignmonitor.com/css/</a></p>
<p>This tool might help you: <a href="https://templates.mailchimp.com/resources/inl... |
rearranging dataframe in r <p>I am trying to work with some existing stock data I have. Ultimately I want to generate weighted returns on the data but I need to change it's structure first.</p>
<p>Existing Code:</p>
<pre><code>library(reshape2)
library(xts)
data <- read.csv(file="mini_r_weights.csv",head=TRUE,sep... | <p>This would be done using reshape2 <code>dcast</code> function. This question has been answered here before, and you can read more about the cast function <a href="http://seananderson.ca/2013/10/19/reshape.html" rel="nofollow">here</a> and <a href="https://cran.r-project.org/web/packages/reshape2/reshape2.pdf" rel="n... |
Scala counter not updating when Akka message is received <p>I'm trying to make a small Akka example work using the following code:</p>
<pre><code>class Sender extends Actor {
@volatile var numEchoes = 0
def receive = {
case Echo => {
numEchoes += 1
println(numEchoes)
if(numEchoes < Mai... | <p><a href="http://stackoverflow.com/users/178060/wheaties">@wheaties</a> was correct. The error was in the Main object, due to some late and careless copy pasting... When I was creating 1 <code>Sender</code> and 10 <code>Receiver</code> actors, this is the code I was using:</p>
<pre><code>// Create the actor that wil... |
stripe bank to bank direct transfers <p>OK, I am a little confused on the best way to setup Stripe for customer to customer direct bank transfer. Here's what I want to do.</p>
<p>I am building a rental platform where a tenant and landlord can enter their bank information (routing and account) and then on a monthly bas... | <p>You need to use <a href="https://stripe.com/docs/connect" rel="nofollow">Stripe Connect</a> to accept payments on behalf of others. In your scenario, you'd create <a href="https://stripe.com/docs/api#create_customer" rel="nofollow">customers</a> for the tenants and <a href="https://stripe.com/docs/api#create_account... |
Nativescript : get page object outside loaded function <p>javascript:</p>
<pre><code>...
//I want use page object outside the loded function
var page
exports.loaded =function (args) {
page = args.object;
page.bindingContext = viewModel;
//there is already a 'grid9' element in XML file
var gridLayout... | <p>First problem with your if is that it will execute before loaded function because its outside of functions so its executte immediately at loading of file so either you put that <code>if</code> somewhere to function or try use this to get current page outside of loaded function</p>
<pre><code>var frameModule=require... |
passing dynamic array object to friend function doesn't accumulate counter <p>I passed a dynamic array object in the 'summary' function, but i was unable to get it to accumulate the counter for a, b & c. </p>
<p>sample output : </p>
<p>Grade A : *</p>
<p>Grade B :</p>
<p>Grade C : </p>
<p>(only the last one is... | <p>Your problem is in these two lines in <code>int main()</code>:</p>
<pre><code>(Stud1+1)->mark_entry();
(Stud1+1)->average();
</code></pre>
<p>At each loop iteration, you're accessing the same element: the second one (index <code>1</code>). To access the <code>i</code>th element, just index into the array wit... |
Insert row without overwritting data <p>I end up here a lot from google and since I started trying to make an android app for myself I'm stumped since the v4 API isn't very helpful. I've search on here but I haven't seen an answer that answer my question.</p>
<p>I have a budget spreadsheet. My app is going to grab the... | <p>I figured it out after some mind numbing throw things against the wall and see what sticks. I had to do it in two steps. The first step will insert a row into your sheet at row 32 so you'll get a blank row 33. Then the second area will insert values into that blank row. I hope this helps someone in the future. </p>
... |
Elasticsearch ~2.0 php - cannot establish connection -array to string conversion error <p>Following the elasticsearch documentation I installed the current php library ie 2.0 and I did this </p>
<pre><code>$hosts = [
// This is effectively equal to: "https://username:password!#$?*abc@foo.com:9200/"
[
'host' =&... | <p><strong>The solution</strong></p>
<p>The "password" key in the host options should be replaced with "pass".</p>
<p>The <strong>ClientBuilder.php</strong> file in the library needs to be modified. The below code is not there in elasticsearch-php 2.0 ClientBuilder.php file but is in its master branch.</p>
<p>I repl... |
phone number RegEx not working for some strings <p>I want to recognize phone number as 9 consecutive figures which can be separated by white spaces, non-breaking spaces etc. with regEx "(\s*\d\s*){9}"</p>
<p>I run VBA macro (JS RegEx) and here are example strings which work fine with above RegEx:</p>
<p>ul. 27 Grudni... | <p>It came out that VBA changed some strings to look in - replaced a whitespace - chr(32) with a non breaking chr(160).</p>
<p>Removing chr(160) from string to look in solves the problem.
Also I will try to find RegEx which will let non-breaking spaces, because \s* doesn't do so, at least in VBA.</p>
|
SoftLayer Api: How to get the currently consume of bandwidth packet traffic data? <p>I have a sl-vm which pay mode is monthly. I have buy it a bandwidth packet 250G. The sl website shows this vm's bandwidth usage is 34.18MB, as shown in flowing Fig:
<a href="http://i.stack.imgur.com/p43t3.png" rel="nofollow"><img src=... | <p>Please use the âIEEE notation: kilobyte = 1000 bytesâ, it means that you need to do the following: <code>45500302/1000/1000 =45.5</code>. There are some variations between UI and API values.</p>
<p>You can use this online tool:</p>
<p><a href="http://www.matisse.net/bitcalc/?input_amount=45500302&input_un... |
Countdown conflict when using multiple instances <p>I have a countdown woking nicely, however I'm at the stage where I need multiple instances of it on the same page. The script I'm using I found online and is just straight JavaScript but my JavaScript isn't very good so I'm not sure how to modify it to make each count... | <p>The key is to bring everything into a local scope. Everything you have there is in the global scope so it only allows for one instance. You should wrap everything in a function and make an object instead. I also used <code>setInterval</code> instead of <code>setTimeOut</code>. Finally, you want to act on existing HT... |
Why get the connection that has been closed, resulting in "holder is null" error <p>This is the nesting problem, please help to analyze the reasons</p>
<p>Overall code structure descriptionï¼</p>
<p>TransactionA in some of the DB operation, and then open the transactionB. TransactionA commit time to trigger a custom... | <p>If you do not use the PROPAGATION_REQUIRES_NEW will be before the connection can not be released, just be closed, resulting in the problem</p>
<pre><code>/**
* Invoked after transaction commit. Can perform further operations right
* <i>after</i> the main transaction has <i>successfully&l... |
Appveyor not calling Nuget Pack <p>On my Appveyor project <a href="https://ci.appveyor.com/project/jayhilden/elmah-io-elasticsearch" rel="nofollow">here</a> I have it configured in the build with <code>Package NuGet projects</code> checked. And in my source code I have a <code>.csproj</code> with a matching <code>.nusp... | <p>The problem was that I had an incorrect configuration in my <code>appveyor.yml</code> file. I updated the file to be <em>only</em> this and it started working.</p>
<p><code>
version: '2.0.0.{build}-prerelease'
build:
publish_nuget: true
</code></p>
|
Full page alvarotrigo : Scroll <p>I am using alvarotrigo full page js for wordpress. It works very fine, but there is only an issue for scroll.<br>
As you may know, the basic structure is like this.</p>
<pre><code><div id="fullpage">
<div class="section">One</div>
<div class="section">
<... | <p>You shouldn't have anything between sections. fullPage.js <a href="https://github.com/alvarotrigo/fullPage.js#required-html-structure" rel="nofollow">requires a specific structure</a> and you are not following it.</p>
<pre><code><div id="fullpage">
<div class="section">Some section</div>
&... |
RabbitMQ shovels badmatch for anything other than default uri <p>I am on RMQ version 3.6.0.</p>
<p>Creating a shovel using the default 'amqp://' uri for source and target, and the default '/' v-host works fine. </p>
<p>However whenever I use a different vhost, or a different user it doesn't work. This includes statin... | <p>So, just for anyone else who comes across this problem. </p>
<p>It actually ended up being the old %2F problem. </p>
<p>the vhost was named '/dev'</p>
<p>The source and target URI of </p>
<p><code>amqp:///%2Fdev</code></p>
<p>For vhosts without the slash, it was just eg</p>
<p><code>amqp:///dev</code></p>
<p>... |
Rails the alternative plan of rescue <p>I read some of article said rails <code>rescue</code> will lead performance problem.
For example</p>
<pre><code>a = Course.where(id: 20).first #better
a = Course.find(20) rescue nil #worse
</code></pre>
<p>Then how do I rewrite the following code in best way </p>
<pre><code>p... | <p>If this is just an Active Record association, then it shouldn't raise any exception when you call <code>section</code> on your <code>parent_section</code>. It will just return nil naturally if there isn't a section present, so you won't need the <code>rescue</code> at all. You should be able to replace your code wit... |
How can I convert a short[] to double[]? <p>Now, I'm working one audio signal processing, and I want to do a real time display audio sound wave which I recorded by my phone. </p>
<p>Here is a problem that my audio format is "ENCODING_PCM_16BIT". So how can I change 16bit short data to double format ?</p>
<p>here is m... | <p>Just like int array to double array, you need a loop to do this work:</p>
<pre><code> short[] shorts = {1,2,3,4,5};
double[] doubles = new double[shorts.length];
for (int i = 0; i < shorts.length; i ++) {
doubles[i] = shorts[i];
System.out.println(doubles[i]);
}
</code></pre>
<p>... |
Select all items that do not have a match in another column <p>I have this table</p>
<pre><code>type item yield section
-----------------------------------
CT1 | A | 25 | M-2
CT1 | A | 35 | M-1
CT2 | A | 70 | M-1
CT2 | A | 30 | M-2
CT2 | A | 20 ... | <pre><code>with
inputs ( type, item, yield, section ) as (
select 'CT1', 'A', 25, 'M-2' from dual union all
select 'CT1', 'A', 35, 'M-1' from dual union all
select 'CT2', 'A', 70, 'M-1' from dual union all
select 'CT2', 'A', 30, 'M-2' from dual union all
select 'CT2', 'A', 20, 'M... |
Inline quote in html 5 and accessibility <p>What is the recommended way to quote someone else in an HTML text?
Especially if I'd like to make sure screen-readers will handle it properly?</p>
<ul>
<li>Should I use double-quotes like this: <code>"</code></li>
<li>Should I write <code>&quot;</code> that will look lik... | <p>For short inline quotations, use the <code><q></q></code> tag. Most browsers will insert quotation marks around the quotation, however if you are using a css reset the following may be required:</p>
<pre><code>q:before, q:after {
content: "&quot;"
}
</code></pre>
<p>For any longer quotations I ... |
How to retrieve the entire state of a component as a single object? <p>I currently have my getInitialState set up such that the keys and values match up exactly for an AJAX POST call. The state gets completed as the form gets filled, and when the user clicks submit, I'd like for it to just grab the entire state, JSON.s... | <p>If you do indeed have all your data serialized in your component's state, you don't need to do much to access it. It's available to any method via this.state. If you're using es6 classes it'd look something like:</p>
<pre><code>class MyForm extends React.Component {
constructor() {
super();
/... |
Two Sum with duplicates <p>I've been looking at the Two Sum problem:</p>
<blockquote>
<p>Given an array of integers, return indices of the two numbers such that they add up to a specific target.</p>
</blockquote>
<p>and am confused about the variation where duplicates are allowed. Why is it if there are duplicates ... | <p>To clarify for others, the "duplicate variation" is simply what you'd expect: numbers may be repeated within the array.</p>
<p>This doesn't matter if you write a brute force algorithm.</p>
<p>But the usual non-brute-force algorithm involves hashing the numbers to their indices (<em>i.e.</em> creating a reverse arr... |
What is the difference between the Page Size and Page Table Entry size <p>I am not able to understand the difference between Page Size and Page Table Entry size.</p>
<p>From my understanding, Page size is used to divide the Page table in equal no. of blocks called Pages and the same size is used to divide the main mem... | <p>"Page Size = Frame Size"
This is correct.
Physical memory divided into chunks called "page-frames".
Virtual memory divided into chunks called "pages".
PTE contains the base address of a page-frame and based on the offset we decide the actual address.
Refer to Understanding the Linux kernel Ch. 2 memory addressing.... |
Instagram redirect URI only handled as Android intent when using custom scheme <p>I'm trying to authenticate with Instagram in my Android app. As others have <a href="http://stackoverflow.com/questions/39082088">noticed</a>, when I assign a redirect URI in the Instagram dashboard, I can <strong><em>only</em></strong> u... | <p>Well, for anyone in the same boat, here's what I ended up doing: I set up my intent filter using my custom scheme and URI (i.e. myapp://oauth2redirect or whatever unique URI you want). Then for the redirect URI, I set it to my personal webpage. In the body of the page, I included the following script:</p>
<pre><cod... |
C# Serial Port Hangs after received data <p>this is my code </p>
<pre><code> public void ClosePort()
{
if (comPort.IsOpen == true)
{
Thread CloseDown = new Thread(() => CloseSerialOnExit(comPort)); //close port in new thread to avoid hang
CloseDown.Start(); //close po... | <p>Why do you call <code>CloseSerialOnExit</code> in a separate thread? Wouldn't it be easier to call it synchronously? Does it really take to much time? </p>
<p>Anyway, if you need it to be like that, you should make sure that the <code>Thread</code> object is not GC'ed before the thread is finished. You should make ... |
How to make loading/spinner bar active on lazy router loading in angular2 <p>I use the angular2.0 release version.
When I load a lazy router,If the router has a lot of code,It's almost 1MBï¼The browser needs to wait for some time,It's unfriendly,so I want create a loading animation.
Whether angular2 provided the event... | <p>My suggestion is this:</p>
<ul>
<li><p>Set up a service that exposes a public flag through a BehaviorSubject/Observable. Let's call it <code>isLoading$</code></p></li>
<li><p>Use CanActivate to detect when lazy-loading starts: emit <code>true</code> on <code>isLoading$</code></p></li>
<li><p>When the module has loa... |
Binary vs Ternary relationship in databases <p>I am having a really hard time trying to understand why whenever possible a binary relationship is better choice than a ternary relationship. I'm at a beginner level in databases and I would really appreciate it if you could explain it with a simple example </p>
| <p>Use what is appropriate to model the situation. I see no reason to avoid ternary relationships.</p>
<p>An example of a binary relationship:</p>
<p>Suppliers supply products. Each supplier can supply multiple products. Different suppliers can supply the same product.</p>
<p><a href="http://i.stack.imgur.com/4bwdK.... |
Why sometimes I am getting a bad hostname? <p>This is something really bizarre. We have a Shell script, that is to do server configuration on every Linux box. and it contains this line of command: </p>
<pre><code> #!/bin/bash
...
hostname=`hostname -f 2>/dev/null`
</code></pre>
<p>Most of time, this li... | <p>Check <code>/etc/hosts</code>.</p>
<p>My understanding is that <code>hostname -f</code> can retrieve the hostname from DHCP (?) or <code>/etc/hosts</code>âbased on what condition(s), I don't know.</p>
<p>But you may have a</p>
<pre><code>123.45.67.89 xyz.companyname.com xyz.companyname.COM
</code></pre>
<p>or ... |
Spark 2.0 deprecates 'DirectParquetOutputCommitter', how to live without it? <p>Recently we migrated from "EMR on HDFS" --> "EMR on S3" (EMRFS with consistent view enabled) and we realized the Spark 'SaveAsTable' (parquet format) writes to S3 were ~4x slower as compared to HDFS but we found a workaround of using the Di... | <p>You can use: <code>sparkContext.hadoopConfiguration.set("mapreduce.fileoutputcommitter.algorithm.version", "2")</code></p>
<p>since you are on EMR just use s3 (no need for s3a)</p>
<p>We are using Spark 2.0 and writing Parquet to S3 pretty fast (about as fast as HDFS)</p>
<p>if you want to read more check out thi... |
when reading an html (pandas.read_html), how to select dataframe and set_ index in one line <p>I'm reading an html which brings back a list of dataframes. I want to be able to choose the dataframe from the list and set my index (index_col) in the least amount of lines.</p>
<p>Here is what I have right now:</p>
<pre><... | <p>Anyway:</p>
<pre><code>import pandas as pd
df = pd.read_html('http://finviz.com/insidertrading.ashx?or=-10&tv=100000&tc=1&o=-transactionvalue', header = 0)[4].set_index('Date')
</code></pre>
|
Catchable fatal error - Joomla Compoent - FOF <p>I Newly Create Joomla Component using Framework on Framework. Administrator Section Working Fine. In Site Section Display Following Error. How to Resolve this <strong>Error</strong>.</p>
<blockquote>
<p>Catchable fatal error: Argument 1 passed to FOFTable::setInput() ... | <p>change F0F to FOF in your Controller or Other Area</p>
|
Simplify python code- iterative compare in if <p>I want to simplify this statement in python.</p>
<pre><code>if string=='M' or string=='m' or string=='Male':
print "OK"
</code></pre>
| <p>Try this:</p>
<pre><code>if string in ["M", "m", "Male"]:
print "OK"
</code></pre>
|
NSFetchedResultsController and to-many relationship not working <p>Ok, I was searching and trying in that case for the last 1-2 weeks and I didn't get it work. I would be able to achieve what I want without NSFRC but for performance reasons and convienience I would like to do it with the NSFRC.
So, I have a DataModel ... | <p>I would do the opposite, I mean using the FRC to fetch all the changes for an account with a certain Id, and use the following predicate:</p>
<pre><code>let predicate = NSPredicate(format: "accounts.aId = %@", ACCOUNTID)
</code></pre>
<p>or</p>
<pre><code>let predicate = NSPredicate(format: "accounts = %@", accou... |
Position app-drawer underneath app-header <p>Using the template from starter kit 2, is it possible to have the app drawer below the <code>app-header</code>? Right now the app drawer starts from the top of viewport and is columnized next to <code>app-header</code>. </p>
<p>I would like my app to be like google keep and... | <p>Basically you need to use an <code>app-drawer-layout</code> inside an <code>app-header-layout</code>.</p>
<p>Here is a <a href="http://jsbin.com/baqumi/edit?html,output" rel="nofollow">JSBin</a> with the desired layout.</p>
<p>And the code itself:</p>
<pre><code><dom-module id="test-app">
<template>... |
read a file from different package in web application <p>I have a file in package '\src\main\resources\'. I want to read that file in a .java file which is located at 'src\main\java\com\xxxx\xxxx\services\'.When I run the following code,</p>
<pre><code>File USER_DIRECTORY = new File( System.getProperty("user.dir") );
... | <p>In Maven/Gradle by default the resources which are in <code>src\main\resources</code> will be in the CLASSPATH.</p>
<p>So if you have a file named <code>input.docx</code> in <code>src\main\resources</code> you can read the file as follows</p>
<pre><code>File documentFile = new File(SomeClass.class.getResource("/in... |
I need a javascript code that will check the valid values are entered in month and days depending on the type of year <p>I want some extra piece of code in this so that it will check for leap year and if it is it will allow 29 days in February month otherwise it should check for 28 days and if greater it should show an... | <p>check for leap year with this </p>
<pre><code>if(((dats[2] % 4 == 0) && (dats[2] % 100 != 0)) || (dats[2] % 400 == 0))
</code></pre>
<p>then check for month within the above if condition and have you logic... easy :)</p>
|
Difference between sql * plus and sql loader <p>I am Oracle Data base Bigginner. I am Confusing with this two words sql * plus and sql loader,Any one Tell me the difference between SQL loader and SQL * PLUS?</p>
| <p><strong>SQL* Plus</strong> is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL<em>Plus web-based user interface.
<strong>SQL</em> Loader</strong> loads data from external files into tables of an Oracle data... |
Python v3 using idle with Tkinter and Gui, repeating code <p>I am having some trouble with my code and was wondering if anyone could help me?</p>
<p>I have made a program with two classes that ae designed to act as a phone ordering system. This is based on the company Subway.
You can see the gui this code produces he... | <p>Firstly, you should directly post the relevant code, not links.</p>
<p>Just based on what you wrote, you can have the button add data to a list instead of an arbitrary number of distinct variables. That way, the list can hold any number of sandwich orders.</p>
<pre><code>mylist = []
mylist.append('chicken sub')
my... |
DispatchGroup returning multiple times <p>Below code which I am using to make <code>concurrent</code> API call. somehow this method returning multiple times. I have tested without <code>DispatchGroup</code>, It is working as expected. Help me to find why it is calling multiple times.</p>
<p><strong>My Code Snippet :</... | <p>You need to <code>enter()</code> all dispatched tasks before any task in the group will <code>leave()</code>.</p>
<p>Move your <code>fetchGroup.enter()</code> before <code>DispatchQueue.concurrentPerform(...</code></p>
<pre><code> let endPoints = [.email, .others ]
endPoints.forEach {_ in fetchGroup.enter()... |
mongodump with query on slave db <p>I'm trying to dump from my secondary so I don't hurt the live traffic.</p>
<p>I can dump from it successfully. but if I add a query I get 0 documents.</p>
<p>What do I need to add to query succesfully to my slave?</p>
<pre><code>0 Documents:
mongodump --host xxxx --port 27017 --us... | <p>Try it like that, i.e. swap the usages of double and single quotes to avoid any evaluation by the shell as noted in the <a href="https://docs.mongodb.com/manual/reference/program/mongodump/#cmdoption--query" rel="nofollow">docs</a></p>
<blockquote>
<p>--query , -q </p>
<p>Provides a JSON document as a quer... |
How to know the size and file extension? <p>On the page have a link to the file:</p>
<pre><code><a href="file.doc">File</a>
</code></pre>
<p>Next to the link should automatically show the extension and file size. Example: <a href="http://file.doc" rel="nofollow">File</a> (DOC, 15 KB)</p>
<p>How to do it?... | <p>If you can determine that information ahead of time, you can use data attributes to tag the link and then display the extra content via CSS :after selector and <code>content: attr(data-size)</code>, etc. </p>
<p>If you can't, I think the links would need to be absolute file system links and you could do an Ajax HEA... |
How do I type a function with parameters as `any` or `void` in typescript? <p>I want to type a function that takes in something OR nothing in typescript. How do I do that?</p>
<p>I've tried:</p>
<pre><code>interface TestFn {
(props: any | void): string
}
const thing: TestFn = (props) => 'whoo';
thing('somethi... | <p>You can use optional parameters:</p>
<pre><code>interface TestFn {
(props?: any): string // <- parameters is marked as optional
}
const thing: TestFn = (props) => 'whoo';
thing('something'); // this line is fine
thing(); // this line is fine as well
</code></pre>
<p>Parameter <code>props</code> is... |
How to animate the JavaScript counter <p>I am counting values from 0 to 100 in JavaScript, but the whole count should take 3 seconds to reach 0 to 100.but right now its happening withing milliseconds.</p>
<p>how can i do that?</p>
<pre><code><span><span id="counter"> </span> of 100 files</span>... | <p>I'm guessing you mean to go from 1 - 100 in 3 seconds, here's an example:</p>
<pre><code>var i = 0;
var inv = setInterval(function() {
if(i < 100)
document.getElementById("counter").innerHTML = ++i;
else
clearInterval(inv);
}, 3000 / 100);
</code></pre>
<p>This makes the whole incr... |
Sequelize: Calling .get({plain: true })) returns .get is not a function <p>I'm not sure why this would happen as Im returning only the values of an instance in other locations just fine. See anything wrong with my code?</p>
<pre><code>app.get('/profile', checkAuth, function(req, res) {
var useObj = req.user;
... | <p>The problem is you're trying to call <code>get</code> function of array, not instance, so, <code>findAll()</code> always returns an array of instances. Use <code>findOne()</code> instead or loop result</p>
|
React-Intl How to use FormattedMessage in input placeholder <p>I'm unsure how to get the values from </p>
<pre><code><FormattedMessage {...messages.placeholderIntlText} />
</code></pre>
<p>into a placeholder format like input:</p>
<pre><code><input placeholder={<FormattedMessage {...messages.placeholderI... | <p>The <code><Formatted... /></code> React components in <code>react-intl</code> are meant to be used in rendering scenarios and are not meant to be used in placeholders, alternate text, etc. They render HTML, not plain text, which is not useful in your scenario.</p>
<p>Instead, <code>react-intl</code> provides ... |
CTRL + Function Key not detected in Linux terminal <p>I run <code>cat -v</code> then press <code>CTRL-F2</code>. I see nothing. Is this expected behavior? Why or why not?</p>
<p>Also, how can I figure out <em>why</em> this keypress is not showing up in a plain linux login terminal? Some guesses:</p>
<ul>
<li>Is the k... | <p>The <kbd>control</kbd>, <kbd>shift</kbd> <em>modifiers</em> effect on special keys (such as function- and cursor-keys) is terminal-dependent. Without special configuration, the Linux console terminal does not do anything special with the <kbd>control</kbd> modifier (and in a quick test, it simply ignores the combin... |
GCC compiled code: why integer declaration needs several statements? <p>I'm learning AT&T assemblyï¼I know arrays/variables can be declared using .int/.long, or using .equ to declare a symbol, that's to be replaced by assembly.</p>
<p>They're declared insided either .data section(initialzed)ï¼or .bss section(uni... | <p><sup>(I am guessing you are using some Linux system)</sup></p>
<blockquote>
<p>They're declared insided either .data section(initialzed)ï¼or .bss section(uninitialzed). </p>
</blockquote>
<p>No, you have many other sections, notably <code>.comm</code> (for the "common" section, with initialized data <em>common<... |
Why does a backslash in my include_path get mangled? <p>I'm using the following code to be able to easily test my page on my dev machine and the shared host:</p>
<pre><code>$include_path_afrihost = "../php/Services/facebook/php-graph-sdk-5.0.0/src/Facebook";
$include_path_dev = __DIR__."\sdk\facebook\php-graph-sdk-5.0... | <p><code>\f</code> is being read as an escape character, similar to how <code>\n</code> is newline.</p>
<p>Using a second backslash escapes the backslash: <code>\\f</code> becomes <code>\f</code>. In general, you should always escape backslashes to avoid this problem.</p>
|
Cross orgin error in google chrome for the api call <p>in the nodejs backend i have added this code to the server.js</p>
<pre><code>app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
... | <p><strong>UPDATED:</strong></p>
<p>For your new error message: Angular2 is lower-casing the headers.
Please update your backend to accept <code>content-type</code> too.</p>
<pre><code>res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, content-type, Accept");
</code></pre>
<p>You can... |
Internet Explorer Displays Time with Milliseconds as Nan <p>Sorry if this is a duplicate question, I could not find any solutions in web, so I am posting this</p>
<p><strong>My Problem :</strong></p>
<p>I am displaying <strong>Date</strong> and <strong>Time</strong> from database, it is being displayed correctly in <... | <p>how are you invoking your function? Even if you are invoking it with with</p>
<pre><code>ParseTime(new Date('2016-09-22T08:43:23'))
</code></pre>
<p>toString will convert it to something else. </p>
<p>So check what t contains after </p>
<pre><code>var t = date.toString();
</code></pre>
<p>if it contains, for ex... |
Extract multiple Substrings from XML stored in a table with datatype CLOB (Oracle 9i) <p><code><!DOCTYPE PODesc SYSTEM "PODesc.dtd"><PODesc><doc_type>P</doc_type><order_no>62249675</order_no><order_type>N/B</order_type><order_type_desc>N/B</order_type_desc><... | <p>Figure out what the <code>XPath</code> of the values are in your XML, then use ExtractValue</p>
<p><a href="http://docs.oracle.com/cd/B10501_01/appdev.920/a96620/xdb04cre.htm#1024805" rel="nofollow">http://docs.oracle.com/cd/B10501_01/appdev.920/a96620/xdb04cre.htm#1024805</a></p>
<p>e.g.</p>
<pre><code>select &l... |
How do I verify a Google idToken in PHP? <p>I have been working on this for far too long. I am looking for a working example as of September 2016 for verifying a Google idToken such as</p>
<pre>eyJhbGciOiJSUzI1NiIsImtpZCI6IjZjNzgxOTQyZDg0OWJhMmVjZGE4Y2VkYjcyZDM0MzU3ZmM5NWIzMjcifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb... | <p>So for anyone coming here from search engines:</p>
<p>I was trying to use a Google ID Token to verify that my login credentials were:<br/>
Accurate<br/>
Not spoofed<br/>
Able to be checked by a back-end server<br/>
Computed using math so I don't have to query Google each time (adding latency and the if-anything-can... |
Regexp parse string <p>I have string that can look like:</p>
<pre><code>2d
1m
5h
</code></pre>
<p>I want to parse it and get array: </p>
<pre><code>[2, 'd']
[1, 'm']
[5, 'h']
</code></pre>
<p>I wrote the regexp:</p>
<pre><code>var r = /^(\d)([mhd])$/;
var res = r.exec("2m");
console.log(res);
</code></pre>
<p>It... | <p>js regex.exec will give the whole match as the first item of result array.You can use index to get the catch group.</p>
|
Can't install PHPREDIS on PHP7 with Ubuntu 14.04 <p>I'm using PHP7 on ubuntu 14.04. Here is my PHP version information from terminal(using command PHP -v).</p>
<pre><code>PHP 7.0.11-1+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies... | <p>please try this way. </p>
<p>1.<strong>Delete the existing PHP-Redis extension and clean</strong> </p>
<p>2.<strong>Install required package</strong> (skip if you already installed php7)</p>
<pre><code>apt-get install php7.0-dev
</code></pre>
<p>3.<strong>Download PhpRedis</strong></p>
<pre><code>cd /tmp
wget h... |
Why is my program reading more than just the first line of my txt file? <p>I'm having trouble grabbing the first line of txtfile.txt. I've tried changing the number in the second parameter and completely removing it. Nothing has worked and for some reason I cannot grab the 1 alone. </p>
<pre><code>int main() {
ifstrea... | <p>If you want just the first line, break from the while loop after getting the first line:</p>
<pre><code>while (fin.peek() != EOF){
fin.getline(ex1, 100, '\n');
cout << ex1 << endl;
break;
}
}
</code></pre>
|
How to fetch the result of ngxtop command in a file <p>I need to ferch the result of ngxtop command in a file. But when i m trying to run it from a shell script file it goes to a running state untill I manually kill or stop it...</p>
| <p>I do this proccess with the next cli command group:</p>
<pre><code>touch file.log && echo "please press CTRL+C to stop process and save ngxtop file.log" && ngxtop print request status http_referer >> file.log
</code></pre>
<blockquote>
<p>When you run this code will save the output in file.... |
a query to count all records of the same tablename but different schemas <p>I need a query or a script that will do the generate the following: </p>
<pre><code>select count(*) from events_abc;
select count(*) from events_def;
select count(*) from events_123;
</code></pre>
<p>Ideally i would like to do a sum of all th... | <p>From <a href="http://docs.aws.amazon.com/redshift/latest/dg/c_join_PG_examples.html" rel="nofollow">Amazon RedShift Dev Guides - Examples of Catalog Queries</a></p>
<blockquote>
<h2>List the Schemas and Tables in a Database</h2>
<p>The following query joins STV_TBL_PERM to some PG tables to return a
list ... |
What is Integration Testing and How It is Performed? <p>We have studied about various Software developments lifecycle models. All the SDLC models have Integration testing as one of the layers. In my opinion, Integration testing is actually a âlevelâ of testing rather than a âTypeâ of testing. i am right ?</p>
| <p>When individual software modules are merged and tested as a group than it is known as integration testing. Integration testing is sets between Unit Testing and System Testing.</p>
<p>Integration Testing Example</p>
<p>For example you have to test the keyboard of a computer than it is a unit testing but when you ha... |
should streets be represented as LineString or Polygon <p>What I'm trying to do is to find places which are inside or with 10 meters distance of a street.<br>
My streets table has a <code>geometry</code> column which coordinates are saved from.<br>
A sample coordinate looks like </p>
<pre><code>{ "type": "Feature", "... | <p>Either of the two of geometry types, linestrings and polygon would work for you in your case. But i think it is quite straightforward to convert the linestrings to polygon and just use ST_Buffer the polygon with 20m... </p>
|
query multiple tables with knex.js <p>I want to render with <code>Expres.js</code> and <code>knex.js</code> two tables using for that only one get function in order to use the data from both tables in one HTML template. It works when I query only one table (schools or students) but I don't know how to do with two table... | <p>You need to use <code>join</code> to use multiple tables on the basis of some <code>reference key</code>
Here is <code>example</code> of join two tables at with reference key </p>
<p>table 1:<strong>users</strong> And table2: <strong>accounts</strong></p>
<p>And reference key is <code>user's primary key</code> </p... |
How to execute server returned javascript on client <p>I make an ajax call to a server and the server returns javascript and jquery code such as</p>
<pre><code>$('someclass').html('<form id='billform'>......</>');
$('#billform').submit();
</code></pre>
<p>How do I execute this on the client side?</p>
| <p>You could put that code inside a script tag and append it to the body
This procedure is described best here: <a href="http://stackoverflow.com/a/611016/4202031">http://stackoverflow.com/a/611016/4202031</a></p>
<p><strong>However</strong>, it is not recommendet to simply execute some javascript which is loaded via ... |
how to extract a string to get latitute, longitute <p>Here is my regex </p>
<pre><code>^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$
</code></pre>
<p>i cant extract lat, longitude if my string is like this</p>
<blockquote>
<p>My location is 3.156831, 101.711125. Or you can directly Search
"KLCC".</p>
</blockquote>
<p>... | <p>Regex should be - <code>(\d+\.\d+)</code></p>
<p><a href="http://regexstorm.net/tester?p=(%5Cd%2B%5C.%5Cd%2B)&i=My%20location%20is%203.156831%2C%20101.711125.%20Or%20you%20can%20directly%20Search%20%22KLCC%22." rel="nofollow">For Demo - Click here !!!</a></p>
|
How to check the JSON format in objective c? <p>I will get the JSON Data like this. But I want to check whether key has an <code>Array</code> data or not. If It has 0 then skip. How can I check?</p>
<pre><code>code = 200;
data = {
UserstoreReviewDetails = 0;
storeReviewDetails = 0;
}
</code></pre>
<p>or</... | <p>// try like this</p>
<pre><code>if([[[self.jsonValue[@"data"] objectForKey:@"storeReviewDetails"] isKindOfClass:[NSArray class]]) {
// data is array type
} else {
//data is not an array type
}
</code></pre>
|
How to connect a socket to another computer's socket through Internet <p>I recently have some difficulties to connect a socket to another computer's socket through Internet, an image is worth a thousand words:</p>
<p><a href="http://i.stack.imgur.com/9CseJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/9CseJ.p... | <p>Computer B can't directly connect to computer A since it has an IP address which is not reachable from the outside. You need to set up a port forwarding rule in the 101.81.83.169 router that redirects incoming connection requests for port 50007 to IP address 192.168.0.4.</p>
<p>However, since you say that you are ... |
angular 2 validation unique name from interface <p>I have two entities in angular app. Let name them "user" and "client". Both has name field, wchich i want to be unique.
I've wrote function checkIfClientNameIsUnique(clientname : string, clients) which return Promise whether name is unique or not. </p>
<p>I would lik... | <p>Don't copy same code into multiple classes.. You could create a shared service for it.</p>
<p>And there is no need to have 2 different functions, you can prototype your check function like this:</p>
<pre><code>public checkForUniqueName(name: string, modelList: Client[] | User[])
</code></pre>
<p>or </p>
<pre><co... |
Persistent Mysql Connections between AJAX Calls? <p><strong>My Scenario:</strong></p>
<p>My Web Page send two <code>AJAX</code> Calls. Second <code>AJAX</code> call is sent as a callback for the first <code>AJAX</code> call in its <code>success</code> function.</p>
<p>1) In First <code>AJAX</code> call, I am updating... | <p>The only thing that you can do, is use a cache layer on the server side for the image. Then, after the second step has completed, actually save everything in the database. The cache layer can be something as simple as storing the picture in a temp folder. (Arguably images should be saved on disk instead of in the da... |
Calling a function in Bash script <p>I have done enough searching to find this out, but with no luck. I am trying to write a Bash script that has to call a function which is defined somewhere else. </p>
<p>For example, I have a shell test.sh</p>
<pre><code>#!/bin/bash
# Shell - test.sh
function1() {
echo "Insid... | <p>Continuing from the comment, you <code>source</code> <code>file2</code> in <code>file1</code>, e.g.</p>
<pre><code>#!/bin/bash
# Shell - test.sh
function1() {
echo "Inside function 1"
}
if [ -r "file2" ] ## make sure file2 is readable by file1
then
. "file2" ## source file2 in file1.
... |
Upgrade testing for iOS - application-identifier entitlement does not match <p>Previously with Xcode 7.3.1 I was able to build directly over my app store app on my iPad and test the upgrade scenario, which worked perfectly fine. This week I upgraded to Xcode 8 and when I try the exact same approach, I keep getting this... | <p>To fix this just enable "Automatic manage signing" from general tab of project settings.</p>
<p>I had also problem for running app on my device directly from xcode 8. Deleting and generation profile and certificate did not worked for me. But enabling "Automatic manage signing" worked for me.</p>
<p>Hope this helps... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.