input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
What is the behavior of observeChanges when the internet connection is temporarily lost? <p>Say my client code is observing document additions using the <a href="https://docs.meteor.com/api/collections.html#Mongo-Cursor-observeChanges" rel="nofollow">added callback mechanism</a>. By design and in perfect conditions, i... | <p>Excellent question! I was experimenting with this extensively recently as I was writing the <a href="https://atmospherejs.com/chfritz/serversync" rel="nofollow">serversync package</a>. What I found is this:</p>
<p>If the timeout of the DDP ping is not reached, i.e., the disconnection is only very brief:</p>
<p>&nb... |
Open source typescript language server <p>Is there an open source typescript language server (uses language server protocol)? And if not currently, I've heard that Microsoft has one in development; will that be open sourced? I see <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server" rel="nofollow">h... | <p>Source of <a href="https://github.com/Microsoft/TypeScript/tree/master/src/server" rel="nofollow">https://github.com/Microsoft/TypeScript/tree/master/src/server</a> is about tsserver.</p>
<p>tsserver is a readline node server but it doesn't use the language server protocol 2.0.</p>
<p>There is a an issue at <a hre... |
Python program using class programs to simulate the roll of two dice <p>My program is supposed to simulate to both simulate the role of a single dice and the role of two dices but I am having issues. Here is what my code looks like: </p>
<pre><code>import random
#Dice class simulates both a single and two dice being ... | <p>You have two <strong>init</strong> methods. The second replaces the first, which negates your definition of sideup.</p>
<p>change to:</p>
<pre><code>def __init__(self):
self.sideup='one'
self.twosides='one and two'
</code></pre>
|
Does JavaScript have clases or not? <p>In one place on the Mozilla Developer Network, I read that JavaScript does not have support for classes. In another, I read that JavaScript has a <code>class</code> statement. Which is it? What is going on here? Is it somehow different from the classes in other programming languag... | <p>JavaScript has classes introduced in ES6. </p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes</a></p>
<p>Previous to this JavaScript has what to is referred to as Constructor Functions. ... |
MapReduce One-to-one processing of multiple input files <p>Please clarify</p>
<p>I have set of input files (say 10) with specific names. I run word count job on all files at once (input path is folder). I am expecting 10 output files with same names as input files. I.e. File1 input should be counted and should be sto... | <p>There are 2 approaches you can take to achieve multiple outputs </p>
<ol>
<li><p>Use MultipleOutputs class - refer this document for information about multipleclassoutput (<a href="https://hadoop.apache.org/docs/r2.6.3/api/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.html" rel="nofollow">https://hadoop.ap... |
What is the logic of jquery window.width? <p>I have created a signup form and whenever I click my input field, a modal has to open responsively. It's okey here on mobile it work's the way I want but if I resize my window nothing happens so I want to give you some example</p>
<p><a href="http://i.stack.imgur.com/Gx24k.... | <p>As I've mentioned in my comment. Currently, your code is executed only once probably when the page loads. In order to run your code again when the window is resized, you can do something like this:</p>
<pre><code>function setModal(){
var $window = $(window),
$nogonder = $('.add-modal');
if ($window.width() &... |
How can I set up a d3 chart inside a custom directive in Angular? <p>I'v been following a few walkthroughs on how to implement d3 charts in an angular application. Basically, Im trying to implement the following <a href="https://bl.ocks.org/mbostock/4339083" rel="nofollow">d3 chart</a> into my custom angular directive ... | <p>There are couple of errors in your code:</p>
<ol>
<li>you template is not good: you make an svg, but you insert standard html tags inside. It can't possibly work. In this case you should make a template with a div tag as a root node.</li>
<li>if you want to provide an initial template like you do, you should then m... |
Elastic Beanstalk can't connect DynamoDB <p>I'm really newbie with aws, then sorry if it's a silly question.</p>
<p>I did a website which connects with an online DynamoDB table and it is fully working on my local, but when I deploy the website code in my Elastic Beanstalk environment, it doesn't connect to the DynamoD... | <p>This was solved by adding the correct permission of the role automatically created by Elastic Beanstalk to the EC2 instance.</p>
<p><a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html" rel="nofollow">http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_us... |
Python numpy scientific notation limit decimals <p>I'm trying to reduce the number of decimals that I'm getting after some calculations. The <code>print()</code> where my problem arises looks like this:</p>
<pre><code>print("Mean resistivity: {res} Ohm m".format(res=np.mean(resistivity)))
</code></pre>
<p>And it outp... | <p>It's python3? If so this should work: <code>{res:.3E}</code></p>
<p>@edit
It should work also with python2 - <a href="https://docs.python.org/2.7/library/string.html#formatspec" rel="nofollow">spec</a></p>
|
CSV file doesn't upload - C# , Sqlbulkcopy <p>I have an issue where I am unable to upload a CSV file using C# sqlbulkcopy. C# code is correct, files are getting uploaded when in correct format. Tested it.</p>
<p><strong>Reason:</strong> These csv files, may be, are not in valid format. Please see pic below, here you c... | <p>Looks that notepad is not able display that character, you can replace it with <a href="https://msdn.microsoft.com/en-us/library/fk49wtc1(v=vs.110).aspx" rel="nofollow">String.Replace</a> Read all file into variable, replace those characters with Environment.NewLine save with new name this file and upload a new file... |
Logo jumping around when I resize screen <p>I´m still new to html and css but I created a website and everything works just fine <a href="http://i.stack.imgur.com/H7qAK.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/H7qAK.jpg" alt="working website"></a> but when I resize the screen to a smaller width, the logo... | <p>My recommendation is that you remove any css that sets a background image and place it into the navigation menu within your html with an img tag.</p>
<p>Done this a million times with bootstrap.</p>
|
Execution order of code in Spark Streaming <p>In Spark Streaming
<strong>val lines = ssc.socketTextStream("localhost",1234)</strong>
line will create a DStream(collections of Rdd's) but I am confused that as there is always a sequential execution of code that is line by line,then how the above line of code will keep o... | <p>Spark's transformations are lazy. It means that nothing will be invoked before ana action will be called.</p>
<p>What it means for you?</p>
<ol>
<li><p><code>val lines = ssc.socketTextStream("localhost",1234)</code> creates one DStream. Nothing is now read, just DStream is created with configuration from what sour... |
How to dynamically create javascript file in Browser <p>I recently started exploring <a href="http://browserify.org/" rel="nofollow">Browserify</a> for bundling Node modules and using them in the browser. It's neat and works great, however I want an improvement in the work flow. In my use case, I have a <code>script.js... | <p>All the .js files should be specified in the <a href="https://developer.chrome.com/extensions/manifest#overview" rel="nofollow">Apps manifest.json</a>. I don't think you can edit items from the app's folder (even when accessing it thru file storage)</p>
|
Splitting up a list into a 2D list using tabs and spaces <p>I am trying to split up a python list into a 2D list starting with the following</p>
<pre><code>testList = ["Color Blue»Temperature Warm»Gender Male",
"Color Green»Temperature Warm»Gender Female"]
</code></pre>
<p>Where » is a tab character ... | <p>If the attribute names and values are always single-worded, you can get every odd (indexing starts from 0) word in the string:</p>
<pre><code>>>> testList = ["Color Blue Temperature Warm Gender Male", "Color Green Temperature Warm Gender Female"]
>>> print([item.split()[1::2] for item in te... |
ASP.NET Client-side vs Server-side Validation <p>I am constantly getting incorrect info from the "Instructor" at school on this.</p>
<p>For ASP.NET Web Applications, the Validators from the Toolbox like CompareValidator, RangeValidator, RequiredFieldValidator, etc, are those considered Server-Side Validation?</p>
<p>... | <p>You are mixing <strong>ASP.NET Validation Control</strong> and difference between Client side and Server Side validation.</p>
<p>When ASP.NET page renders then the Validation Controls <strong>RequiredFieldValidator</strong> and <strong>RangeValidator</strong>, will create JavaScript function to perform validation ... |
Comments not showing in post_detail view <p>I am doing a project in django 1.9.9/python 3.5, for exercise reasons I have a blog app, an articles app and a comments app. Comments app has to be genericly related to blog and articles. My problem is that the templates are not showing my comments. Comments are being created... | <p>You've explicitly set the related name of comments on your post to <code>post_comments</code>. So you would have to access them like:</p>
<pre><code>{% for comment in post.post_comments.all %}
</code></pre>
<p>This is assuming <code>post</code> in your template refers to an instance of the <code>Entry</code> model... |
Haskell 'Either' data type and readability? <p>I'm learning 'Either' data structures in Haskell and have written the following:</p>
<pre><code>type PhoneBook = [(String, String)]
createPhoneBook :: PhoneBook --Use function to generate instance of type
createPhoneBook = [("betty","1212-232"),
("bill... | <p>I would write it like that:</p>
<pre><code>import Data.Maybe (isJust)
checkPhoneBook :: String -> PhoneBook -> PresentInPhoneBook
checkPhoneBook name pb = isJust (lookup name pb)
</code></pre>
<p>There is not reason for use to have <code>checkPhoneBook</code> return <code>Either IsPresent IsNotPresent</code... |
Error 0x80131047 loading MySQL Connector DLL <blockquote>
<p>PowerShell has just been opened sourced (v6.0.0-alpha.10), and I'm
trying to get it to connect to a MySQL instance from OS X.</p>
<p>Oracle seems to suggest (if I'm reading it correctly) that they have a
.Net Core connector
<a href="https://blogs... | <p>That is not a .NET Core library - the word "Core" here indicates functionality shared between the EF6 and Web packages, and pre-dates the introduction of .NET Core.</p>
<p>Entity Framework Core has MySql libraries under development at the time of writing.</p>
|
Onsen UI - handling the hardware back button <p>I have a small Phonegap app that has 2 HTML pages (index.html & error.html). When error.html is active I want the back button (hardware button on Android device) to actually go back to index.html instead of exiting the app. I have tried the following (just to trigger ... | <p><code>document.addEventListener("backbutton")</code> will not work for Onsen UI.</p>
<p>It looks that in order to handle the hardware back button with Onsen-UI you should do one of the following:</p>
<pre><code>ons.ready(function() {
// To disable a navigator back button handler
navigator.getDeviceBackButtonHandle... |
Get nested document based on array index <p>I have a mongodb collection and each document in that collection contains an array of a different document type.</p>
<p>EX:</p>
<pre><code>{
_Id: SomeObjectID,
AnArray:[
{ value:"SomeValue1", Id:1},
{ value:"SomeValue2", Id:2},
... | <p>You can use mongo aggregation pipeline to get your results.</p>
<p><code>$arrayElemAt</code> can be use to get the nth element from an array.</p>
<p>Aggregation query:</p>
<pre><code>db.sample.aggregate([
{$project : {arr_0_value : {$arrayElemAt : ['$AnArray',0]}}},
{$project : {arr_value:'$arr_0_value.va... |
I downloaded and installed linux bash profile and it completely changed my terminal. How do I switch back to the profile I had before? <p>I am taking an online class, and as a part of the instructions, I downloaded and installed a bash profile in my linux command line:</p>
<pre><code>curl https://raw.githubusercontent... | <p>I restored by renaming the one of the original bash profiles backup files that were in my home directory and re-run it:</p>
<pre><code>source ~/.bash_profile
</code></pre>
<p>It is working now. </p>
|
Qt5.5 32bit connection to MySQL database - limited User account <p>I'm trying to establish a connection to my MySQL Server (currently running on localhost) via Qt5.5 (mingw4.92 32bit). I have found the qsqlmysql.dll and qsqlmysqld.dll in the mingw plugin directory, Qt gives the appropriate output that the drivers are a... | <p>I agree with you guys that uac and having a laptop that doesn't allow me to delete desktop icons is pretty moronic.</p>
<p>However, back to topic. I solved my problem by simply downloading the 32bit version of mySQL connector and put the container libmysql.lib and the debug version into my program folder and voilà ... |
Issue when moving process from background to foreground in Ubuntu Terminal <p>I started a couple of processes in the background from the terminal.</p>
<pre><code>lars@UbuntuVM:~$ xeyes &
[1] 8553
lars@UbuntuVM:~$ xclock -update 1 &
[2] 8554
lars@UbuntuVM:~$ jobs
[1]- Running xeyes &
[2]+ ... | <p>The correct key combination to be used for sending a foreground process to the background is <code>^Z</code>, not <code>^C</code>. For more details, please check this link: <a class='doc-link' href="http://stackoverflow.com/documentation/bash/5193/job-control/18386/stop-a-foreground-process#t=20160918171245686435">S... |
Convert a 1-dimensional Array of objects (compound type) to a 2-dimensional Array <p>I have defined a compound type like</p>
<pre><code>type Position
Date::DateTime
x::AbstractFloat
y::AbstractFloat
z::AbstractFloat
end
</code></pre>
<p>and a array 1-dimensional Array of object (compound type) is defined like... | <p>Array</p>
<pre><code>new_array = map(rec->[rec.x, rec.y, rec.z], arr)
</code></pre>
<p><strong>additionally</strong></p>
<pre><code>new_array = vcat(new_array)
new_array = reshape(new_array,convert(Int64, length(new_array)/3),3)
</code></pre>
<p>or </p>
<pre><code>new_array = reshape(new_array,length(arr),3)... |
Creating an Array that takes user input <p>I am creating an array where the user is entering boolean values, and the array will count how many <code>true</code>s and <code>false</code>s there are will output the number. </p>
<p>For example, if <code>TorF[] = {true, false, true, true, false}</code> then it would output... | <p>It's <code>true</code> and <code>false</code> (you can't use <code>False</code> in Java). Also, you just need to count the <code>true</code>(s) (because the number of falses is the total count minus the number of trues). And I would use a <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html"... |
Why View Fragment is null in AsyncTask? <p>This is my Fragment class:</p>
<p>public class StanzeFragment extends Fragment {</p>
<pre><code>public StanzeFragment(){}
Button vis_stanze;
public TextView testo;
View rootView;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
... | <p><code>Fragments</code> are supposed to be instantiated by the system (as they are defined in the layout XML) or from the code by using the <a href="https://developer.android.com/reference/android/app/FragmentManager.html" rel="nofollow">FragmentManager</a> methods. </p>
<p>If you just instantiate a <code>StanzeFrag... |
elasticsearch TERM query not returning the document that contains the exact term <p>I have in my documents a state with value "OK".</p>
<p>The following match query returns me this document:</p>
<pre><code>POST /bank/_search
{
"query": {
"bool" : {
"must" : {
"match" : { "state" : "O... | <p><strong>Match</strong> query always perform analysis on the search text before doing its matching, but <strong>Term</strong> query looks for the exact match. Means</p>
<p>When you insert a text "OK", by default ES does analysis(Standard Analyzer) and stores the text as "ok" (lowercased) in Inverted Index.</p>
<p>s... |
How to print QString containing line breaks using qDebug <p>This code:</p>
<pre><code>QString output("test1\ntest2");
qDebug() << output;
</code></pre>
<p>leads to this output:</p>
<pre><code>"test1\ntest2"
</code></pre>
<p>What I want is:</p>
<pre><code>"test1
test2"
</code></pre>
<p>So how can I use qDebu... | <p><a href="https://doc.qt.io/qt-5/qdebug.html#details" rel="nofollow"><code>qDebug()</code></a> is meant for debugging purposes, so it escapes non-printable characters and adds quotes when printing <code>QString</code>, <code>QByteArray</code>, <code>QChar</code> arguments.</p>
<p>Try using <a href="https://doc.qt.io... |
React Native run-ios build fail after xcode update to 8.0. <p>Okay so I've been working on this React Native project for a few weeks now without any issue. I recently updated to xCode 8.0 and RN build is failing. When I do "react-native run-ios", it returns a "BUILD FAILED" error. I tried it through xCode and it return... | <p>Step 1: </p>
<ul>
<li>go into your RN project folder and open ios > .xcodeproj</li>
<li>this will open the project in xcode. </li>
</ul>
<p>Step 2: </p>
<ul>
<li>Run the file and once the build fails, it'll show errors on the left side. Double click "RCTWebSocket" and it'll open up a new window/tab with more sett... |
Strange results of evaluating in statement for list and set by means of timeit module <p>Trying to evaluate performance of <code>in</code> statement for both: <code>set</code> and <code>list</code>. I know that I can do it with module <code>time</code>, but I want to try <code>timeit</code> module.
So my code is next:... | <p>Your setup statement imports <code>func_to_test</code>, but it doesn't do anything else. Therefore, the actual timing tests are timing not only the time it takes for a membership test, but also the time it takes to create a list (for the list test) or a list <em>and</em> a set (for the set test). Create the iterable... |
YouTubePlayerView is obscured by com.google.android.youtube.player.YouTubePlayerView <p>I have been trying to add a youtube player in a fragment.
had some overlay errors. tried different things and resolved them, now the error is quite awkward.
I don't know what is wrong here.</p>
<p>the error is <em>YouTubePlayerVie... | <p>You may want to check if this is a device specific issue, based from this <a href="http://stackoverflow.com/a/29765413/5995040">SO question</a> this issue may be due to a transparent view is overlapping YouTubeAndroidPlayer view. Also check your code if there is any overlays when the player is playing. </p>
<p><a h... |
array not initialising properly. BasicDBObject not able to create array of BasicDBObject type <pre><code>case 3:
BasicDBObject []document= new BasicDBObject(); // error
DBCollection table1 = db.getCollection("user");
document[0].put("name", "mkyong");
document[0].put("age", 30);
table1.... | <p>you would get compile time error because the array initialization is not correct.</p>
<pre><code>BasicDBObject []document= new BasicDBObject(); //error
</code></pre>
<p>Basic Array Initialization in java is as below</p>
<pre><code>Object objectArr[] = new Object[10];
</code></pre>
<p>So you have to initialize th... |
Log4j2 could not find a logging implementation with Sprint Boot <p>I'm getting this error trying to use log4j2 with spring boot.</p>
<pre><code>ERROR StatusLogger Log4j2 could not find a logging implementation.
Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
</code></pre>
<p>I'm h... | <p>It looks your dependencies are correct. This is the pom of working spring-boot application with log4j2 as logging framework:</p>
<pre><code> <!-- Spring logging -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artif... |
C# Breakpoint hit the debugger <p>Soo ive justed completed one of my first projects in c# but then i run upp on this
"Live Event: Breakpoint Hit: Timer1_tick, Forn A breakpoint or a tracepoint was hit by the debugger". i cant realy find anything wrong whit my codes soo i dont realy know how to solve this here is the co... | <p>So your sole question is why the breakpoint is hitting? If yes, then it's cause you have set the breakpoint at some time for debugging purpose. if you don't want them any more then you may consider deleting the breakpoint by choosing <code>debug</code> menu option and select <code>delete all breakpoint</code> or <co... |
How do I refer to a data frame element with strings in R? <pre><code>n <- 1
sn <- "n"
get (sn)
</code></pre>
<p>This will work. However, the following won't work:</p>
<pre><code>n <- as.data.frame(matrix(1,2,2))
sn <- "n$V1"
get (sn)
</code></pre>
<p>How should I make this work?</p>
<pre><code>eval(pars... | <p>You almost certainly want to pass just the name of the column within the data frame, then use <code>[[</code>-indexing to retrieve the vector you want:</p>
<pre><code>n <- as.data.frame(matrix(1,2,2))
sn <- "V1"
n[[sn]]
## [1] 1 1
</code></pre>
|
HighCharts Line xas datetime <p>I am having trouble with the data for type: datetime in the x-as. I have a range of dates from 01/07/2016 (dd/MM/yyyy) and 01/10/2016 but I can't get the graph correctly shown. The dates arent shown correct and I get error 15.</p>
<p>I get the data (chartInfo.DataSetTime) as a dictiona... | <p>Found my answer in this post: <a href="http://www.dotnet-geek.co.uk/index.php/displaying-dynamic-javascript-charts-using-mvc-and-web-api-entity-controllers/" rel="nofollow">http://www.dotnet-geek.co.uk/index.php/displaying-dynamic-javascript-charts-using-mvc-and-web-api-entity-controllers/</a></p>
|
UIView, CMDeviceMotionHandler : unowned may only be applied to class and class-bound protocol types <p>I'm creating a UIView that listens to <code>CMDeviceMotion</code> Events:</p>
<pre><code>class MyView: UIView{
private var motionManager = CMMotionManager()
let motionQueue = NSOperationQueue()
overri... | <p>The line of code you're on is actually run during the <code>init</code> function. <code>self</code> is not available until <em>after</em> all stored properties are initialized. You're in the middle of the process.</p>
<p>The error message is quite confusing and useless, because <code>self</code> in the context of p... |
Is there any way to expose mongodb database as rest api <p>Is there any way to expose mongodb database as rest api.</p>
<p>I would like to expose my mongo DB database as a rest API. </p>
| <p><a href="https://spring.io/guides/gs/accessing-mongodb-data-rest/" rel="nofollow">This tutorial</a> might help you out. Your question is a very general question. A google search would probably be more helpful than asking on SO.</p>
|
Mbstring extension installation on godaddy server <blockquote>
<p>Call to undefined function mb_convert_encoding(). How to install
mbstring extension installation on godaddy server?</p>
</blockquote>
| <pre><code>I have found the solution. We need to complete the following steps:
1.Login to your server WHM as root
2.Search EasyApache or go to Software menu after that EasyApache
3. you can see there are some profile. click on customize profile default profile.
4. click on continue to second step
5. On âStep 2,â... |
Regex select text inside quotation marks into groups <p>I have a lot of lines in this format. I need to capture the quoted text blocks (including quotes), but the last block may be <code>null</code> (without quotes).</p>
<pre><code>"1" "Melbourne is the capital of Australia." "0" "Canberra is the capital of Austral... | <p>Since you know there are exactly 4 terms:</p>
<pre><code>.*?(".*?").*?(".*?").*?(".*?").*?(null|(".*?").*
</code></pre>
<p>See <a href="http://rubular.com/r/9bfsSzbCLm" rel="nofollow">demo</a></p>
<p>It's important to use <em>reluctant</em> quantifiers, which capture as little as possible.</p>
|
Python Class instance variables printing out as tuples instead of string <p>I am creating the following <code>class</code> within python. But when I create an instance of the <code>class</code> and print out the <code>imdb_id</code> value. It prints it as a <em>tuple</em>. </p>
<p>What am I doing wrong? I would like i... | <p>Why are you adding a comma at the end of most statements? That creates a tuple. Remove the trailing comma.</p>
<p>Really, why are you doing that?</p>
|
Rewrite with Nginx then replace cars in results <p>I want /search/i-love-bacon to become /results?search_query=I+love+bacon.</p>
<p>actually I can get approxymative results with:</p>
<pre><code>rewrite "^/search/(\w*)\-(\w*)" "/results?search_query=$1+$2" permanent;
</code></pre>
<p>But I don't know how many terms I... | <p>You could recursively rewrite <code>-</code> to <code>+</code> before rewriting <code>/search</code> to <code>/results</code>. The recursive rewrite could be internal. </p>
<pre><code>location / {
rewrite ^/search/(.*)-(.*)$ /search/$1+$2 last;
rewrite ^/search/(.*)$ /results?search_query=$1 permanent;
... |
Executing a command in Java <p>I'm trying to write a <code>Java</code> class that can execute <code>vagrant</code> from the command line:</p>
<pre><code>import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWrite... | <p>According to ProcessBuilder comment you should separate command and it's arguments:</p>
<pre><code>/**
* Constructs a process builder with the specified operating
* system program and arguments. This is a convenience
* constructor that sets the process builder's command to a string
* list containing the same s... |
c# logging framework - logfiles with explicit names <p>I´m searching for a logging framework for c# where I can set the logfile name easy from code.</p>
<p>My program starts several background workers which all should log into their own log files.
They use the same classes for their work and sometimes in different t... | <p>Stay away from Log4Net. It's not an actively developed project. Last release was almost 1 yr ago (12/2015). NLog is much better supported.</p>
<p>With that being said, all the logging frameworks let you do everything template driven with a bunch of different "macros"... you might base the filename on threadId or so... |
Object showing as undefined in html even though it has data in the service <p>I am pretty new to Angular, I managed to follow the Tour of Heroes tutorial pretty easily and got the entire application working. I have now started a new project, which is just getting data from the Strava API to display it. </p>
<p>So far ... | <p>Use </p>
<pre><code>{{athlete?.id}}
</code></pre>
<p>to make the code <code>null</code>-safe for async loaded data.</p>
|
manipulating a .dat file and plotting cumulative data <p>I want to plot a quantity from a tedious-to-look-at <code>.dat</code> file, the #time column in the file extends from 0s to 70s, but I need to take a closer look at data (Nuclear Energy, in this case) from 25s to 35s.</p>
<p>I was wondering if there is a way I c... | <p><strong>UPDATE:</strong> plot cumulative nuclear energy:</p>
<pre><code>x = df.query('25 <= time <= 35').set_index('time')
x['cum_nucl_energy'] = x.Nuclear_Energy.cumsum()
x.cum_nucl_energy.plot(figsize=(12,10))
</code></pre>
<p><a href="http://i.stack.imgur.com/mhF6z.png" rel="nofollow"><img src="http://i.s... |
Go: How is two dimensional array's memory representation <p>In Java, as we known, two dimensional array is multi one-dimensional array. That means those one-dimensional arrays not consecutive on memory.</p>
<p>In contrast, in C, two dimensional array in fact is one-dimensional array with size is <strong>total_row * to... | <p>In Go, <a href="https://golang.org/ref/spec#Slice_types" rel="nofollow">slices</a> are often mistaken for <a href="https://golang.org/ref/spec#Array_types" rel="nofollow">arrays</a>, so I answer regarding both.</p>
<h3>Arrays</h3>
<p>Quoting from the <a href="https://golang.org/ref/spec#Array_types" rel="nofollow"... |
Guards in else statement won't compile: parse error on input '|' <p>I'm trying to write a program in Haskell that takes a list of numbers and returns the value of the largest consecutive subsequence.</p>
<p>I'm getting a compilation error for line 7, the line with the first guard.</p>
<pre><code>maxsubseq list = maxs... | <p>Roughly put, guards are used at the left of <code>=</code>, as in</p>
<pre><code>f x y
| cond1 x y = ...
| cond2 x y = ...
| otherwise = ...
</code></pre>
<p>In your code, simply remove the <code>|</code> -- you do not need guards. <code>if</code> suffices.</p>
<p>Also, using <code>if null, head, tail</c... |
Increase Varchar in a SQL Server 2005 column and connected erp <p>I don't know if you can help me in this problem. I have an ERP connected to a SQL Server 2005 database. I need to increase the characters permitted in the description of my articles... If I increase the column to <code>varchar(80)</code> that I have in t... | <p>Changing the size in the database in your example shouldn't be the problem. The problem, if there is one, would be from your ERP application. I have worked with some where they assume the table/field sizes are fixed and not changeable so that application would fail on the size change. Other ERP systems do not care a... |
I'm trying to make the perfect docker build file, do i need to build it from scratch each time? <p>For an assignment the marker requires of me to create a dockerfile to build my project's container, however I have a fairly complex set of tasks I need to have work in the right way together for my dockerfile to be of any... | <p>The <a href="https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/add-or-copy" rel="nofollow">Dockerfile best practices</a>, or an earlier question might help: <a href="http://stackoverflow.com/questions/26956796/creating-a-dockerfile-docker-starts-from-scratch-on-each-new-build?rq=1">Creat... |
Fixed header behaving differently in Firefox <p>I have two slide menus on my website, one on the left and one on the right. I also have a fixed header, that is pushed left or right alongside the rest of the content, depending on which menu is opened.</p>
<p>This is causing some issues in Firefox â when the right-han... | <p>Ok so after a bit of messing around I pinpointed it to the <code>left</code> and <code>position:relative</code> of the <code>html</code> element. </p>
<p>So now I've used <code>transform:translate3d</code> to move the elements around, as I've read that this doesn't rely on css positioning to work (absolute, relati... |
Two RFID RC522 Raspberry PI 2 Windows IOT <p>What should I change in a class from topic <a href="https://stackoverflow.com/questions/34284498/rfid-rc522-raspberry-pi-2-windows-iot?answertab=oldest#tab-top">RFID RC522 Raspberry PI 2 Windows IOT</a> if I want to connect second rfid reader via SPI?</p>
<p>I connected the... | <p>The first time initialization</p>
<pre><code>public async Task InitIO()
{
...
...
try
{
settings = new SpiConnectionSettings(SPI_CHIP_SELECT_LINE);
settings.ClockFrequency = 1000000;
settings.Mode = SpiMode.Mode0;
String spiDeviceSelector = SpiDevice.GetDeviceSelect... |
PhpStorm 10 Download to Library issues (JS yes, CSS no) <p>I'm just wondering how I can customize the part where PhpStorm allows only to d/l jQuery or other related scripts into library, yet no CSS option to d/l into library.</p>
<p><a href="http://i.stack.imgur.com/tGU1C.jpg" rel="nofollow"><img src="http://i.stack.i... | <p>This functionality is not yet implemented (latest stable is v2016.2).</p>
<p><a href="https://youtrack.jetbrains.com/issue/WEB-10023" rel="nofollow">https://youtrack.jetbrains.com/issue/WEB-10023</a> -- watch this ticket (star/vote/comment) to get notified on any progress.</p>
|
Casting UnsafeMutablePointers to UnsafeMutableRawPointers <p>I have a couple of issues updating to swift 3.0. I have the following code:</p>
<pre><code> // Retrieve the Device GUID
let device = UIDevice.current
let uuid = device.identifierForVendor
let mutableData = NSMutableData(length: 16)
... | <p>Your first issue, you can write something like this:</p>
<pre><code> (uuid! as NSUUID).getBytes(mutableData!.mutableBytes.assumingMemoryBound(to: UInt8.self))
</code></pre>
<p>But if you can accept <code>Data</code> having the same raw UUID bytes, you can write it as:</p>
<pre><code> var uuidBytes = uuid!.u... |
Generating list of lists with custom value limitations with Hypothesis <p><strong>The Story:</strong></p>
<p>Currently, I have a function-under-test that expects a <em>list of lists of integers</em> with the following rules:</p>
<ol>
<li>number of sublists (let's call it <code>N</code>) can be from 1 to 50</li>
<li>n... | <p>There's a good general technique that is often useful when trying to solve tricky constraints like this: try to build something that looks a bit like what you want but doesn't satisfy all the constraints and then compose it with a function that modifies it (e.g. by throwing away the bad bits or patching up bits that... |
How do I force close a process run as admin, when program sending command is not admin? <p>For testing and security purposes, I am trying to make a Java program that force closes certain processes. I am testing it with the "taskmgr.exe" process and the "cmd.exe" process.</p>
<p>It works fine with taskmgr.exe no matter... | <p>Long story short, you are asking whether a non-admin process can kill an admin process. </p>
<p>That's not possible. </p>
<p>So, no amount of changes in your code can accomplish it.</p>
<p>(At least not without some m4d h4x0r ski11z, which we are not allowed to talk about here.)</p>
|
Where is the Azure Media Service Region property? <p>The most simplest thing I thought... but no where to be found... When I'm creating throuh the portal a new media service I can choose a region for the new service, a storage account (with a different region (..question for another day)) and the rest for the propertie... | <p>So there are two things going on here:</p>
<ol>
<li><strong>Control Plane</strong>: Control plane deals with the management of service. It includes things like creation of service, fetching service details, key regeneration etc.</li>
<li><strong>Data Plane</strong>: Data plane deals with the data in the service. So... |
I might've overdosed innerHTML and get undefined <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code> function promptuj() {
this.x = prompt("How big should be your multiplication... | <p>You get undefined because in <code>promptuj</code> you set the <code>innerHTML</code> to the value returned by <code>tabliczka</code>. But <code>tabliczka</code> doesn't explicitly return anything, so it's like it returned <code>undefined</code>.</p>
<p>Instead, <code>tabliczka</code> should return the HTML string ... |
How can I have access in membership tables in mvc4? <p>I am trying to use register and login form in MVC4 . I have used Entity Framework from DB to create the model and now I want to generate the membership tables, but I have tried many things and I still can't access them. </p>
<p>I have 2 connection strings :</p>
<... | <p>AFAIK, SimpleMembershipProvider user profile management only works with SQL Server database connection string, not an EF connection string.</p>
<p>First, try setting your DB connection string instead of EF-generated connection string as stated <a href="http://forums.asp.net/t/1939734.aspx?ASP+NET+Simple+Membership+... |
What is the workflow when including scripts in web pages with npm? <p>There are many JS libraries and frameworks (e.g. jquery) that suggest doing this:</p>
<pre><code>npm install foo
</code></pre>
<p>This gives you a <code>node_modules</code> directory in which there would be a <code>foo</code> directory. For most JS... | <p>Well, do use NPM installed scripts in a web you have to use some bundler/builder which adds additional layer package management in your application. This would allow using modules like in server side. After bundling your modules into single or multiple chunks include these in your web like any other JavaScript files... |
how to send a properly formatted html mail using mail function php <p>hello i am trying to send an email using mail function in php, from my search iv read that to send html enabld emails we need to pass an argument to the headers stateing the presence of html tags is to be passed, which i am doing using this</p>
<pre... | <p>From PHP <a href="http://php.net/manual/en/function.mail.php" rel="nofollow">Manual</a>:</p>
<pre><code>$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' .Â... |
Looping vector in C++ causes invalid iterations <p>I have written a small program that takes inputs as string which is stored in a vector. </p>
<p>Looping through the vector causes many empty strings being printed before actual output.
I have copied the sample lines below.</p>
<pre><code>int main(){
int totalStrings... | <pre><code>vector<string> testCases(totalStrings);
</code></pre>
<p>This line of code has two issues:</p>
<ol>
<li>totalStrings is uninitialized and thus garbage,</li>
<li><code>vector(N)</code> creates a <code>vector</code> of <em>size</em> N default-initialized elements, as though you had called <code>resize<... |
Change turn in tic-tac-toe not working <p>Just stuck in my code, was looking for others source, but there's other implementation, I must be blind or ... but it looks like functions are referring still to one variable, when in my beginning understanding if I call function which return 'change', and function return back ... | <p>Youâre returning <code>turn</code> in <code>next_player()</code>:</p>
<pre><code>def next_player(turn):
if turn == 'X':
turn = 'O'
if turn == 'O':
turn = 'X'
return turn # <<< Here.
</code></pre>
<p>If you want to assign the new turn, try doing this:</p>
<pre><code>turn = ne... |
Cannot get PubNub EON chart to work <p>I have run into a dead end trying to get the following HTML to work. I am trying to use the real time gauge chart to display a value coming from a photon. This is the snippet code from the pubnub site. </p>
<p>(I have proven that the published value is arriving in the Javascript ... | <p>There is a missing line of code in the PubNub EON JavaScript embed code for the Gauge Chart. </p>
<p>You must add <code>pubnub: pubnub,</code> to bind the graph instance to the PubNub stream. </p>
|
how to move all the Layouts up when scrolling more in the list view in android <p>i have a fragment which has a stationary Image View at the top , some linear layouts to display the texts and List View at the Bottom. i want the entire screen to go up(that stationary Image View and middle part) when i scroll down in the... | <p>Try using CoordinatorLayout and scrolling behaviour from the design library.You can find a great tutorial <a href="https://inthecheesefactory.com/blog/android-design-support-library-codelab/en" rel="nofollow">here</a></p>
|
Usefullness of one-line statements in Python <p>Is using one line loops, even nested loops always a good practice in Python? I see a lot of people just love "one-liners", but to me they're hard to read sometimes, especially if we're talking about nested loops.</p>
<p>Moreover most of nested loops I've seen so far exc... | <p>Yes, they may be easily faster, since more code may be run in C (in explicit loop all of immediate steps has to be available to interpreter, in one-liner list comprehension it does not have to). There is also overhead of <code>.append</code> method call, method look-up etc. In list comprehension all of that is avoid... |
Convert to JSON object in laravel framework <p>I get this</p>
<pre><code>{"obj":"{\"name\":\"john welson\",\"age\":\"28\"}"}
</code></pre>
<p>how can convert it to JSON format to work with it easily?</p>
<p>When I use <code>json_decode($json)</code>, I get this error:</p>
<blockquote>
<p>"json_decode() expects p... | <p>Your escapes were a bit off, try this.</p>
<pre><code>json_decode("{\"obj\":{\"name\":\"john welson\",\"age\":\"28\"}}");
</code></pre>
|
Can't access nested dictionaries/arrays from json with swift <p>I am trying to access ["upper category"]["first category"][0][0] of local json file </p>
<pre><code>{
"upper category": {
"first category": [
[
"this is a question",
"this is an answer",
... | <p>It's a bit overkill but you can cast the json to <code>[String:[String:[[String]]]]</code></p>
<pre><code>let json = try? JSONSerialization.jsonObject(...) as? [String:[String:[[String]]]]
</code></pre>
|
Haml / Rails 4: Conditions - repeating code inside <p>How can I make something like this work with haml/rails:</p>
<pre><code>- if current_user.is_seeking_job == true && current_user.is_seeking_contract == true
- @jobsforyou.where.not(user_id: current_user, is_finished: true, is_active: false).where("sort &l... | <p>You could do something like the following:</p>
<pre><code>- if current_user.is_seeking_job && current_user.is_seeking_contract
- sort_order = "sort < ?"
- sort_param = 2
- else
- sort_order = "sort > ?"
- sort_param = 1
- @jobsforyou.where.not(user_id: current_user, is_finished: true, is_activ... |
Can VBScript add properties to objects like JScript? <p>I am playing with Windows Script Host VBScript and I am curious if VBScript is capable of adding/removing properties like JScript can.</p>
<p>For example:</p>
<pre class="lang-javascript prettyprint-override"><code>var global = this;
var test = function() {
... | <p>Your specific example could be emulated with something like this:</p>
<pre class="lang-vb prettyprint-override"><code>Set global = CreateObject("Scripting.Dictionary")
Sub test
If global.Exists("greeting") Then
WScript.Echo "global has property named greeting with value: " & _
global(... |
Add extra info to Android ImageView in GridView so it can be identified <p>I have a GridView where the items are ImageViews (inside a LinearLayout). The adapter that creates the item gets a parameter position, which specifies which item in the list of items that is now being created. How can I pass that information on ... | <p>Use method setTag of view to pass information and getTag to get information in Listener.</p>
|
Asking for A User Input for Time using JOptionPane <p>my teacher has asked us to ask a user for both a start time and stop time of a racer by asking the them to input a time (HH, mm, s.s) using the JOptionPane. I am not sure how to do this. I have tried doing integer.parseint(joptionpane....) but I keep getting error m... | <p>Here is the issue</p>
<pre><code>startTime1 = new Time();
stopTime1 = new Time();
</code></pre>
<p>you are initializing start & stop time using default constructor where default constructor which returns start and stop time as zero hence you get output also zero.</p>
<p>So you need to use parameterized constr... |
Python: is 'int' a type or a function? <p>I did this in Python 3.4:</p>
<pre><code>>>> type(int)
<class 'type'>
>>> int(0)
0
</code></pre>
<p>Now I am wondering what int actually is. Is it a type, or is it a function? Is it both? If it is both, is it also true that all types can be called like... | <p><code>int</code> is a <strong><a href="https://docs.python.org/3.5/tutorial/classes.html">class</a></strong>. The type of a class is usually <code>type</code>.</p>
<p>And yes, <em>almost</em> all classes can be called like functions. You create what's called an <strong>instance</strong> which is an object that beha... |
Generic map not compiling with nested structure <p>I want to implement a map wrapper that use genericity to enforce a type relation between the key and the value.
The following code does not compile :</p>
<pre><code>Map<Class<? extends Serializable>, List<List<? extends Serializable>>> collecti... | <p>Generics are <em>invariant</em>, the second type parameter of your map is <code>List<List<? extends Serializable>></code>, that means that the second argument of <code>put</code> must match this <em>exactly</em>.</p>
<p>i.e. You can only add a <code>List</code> to the map if it has the exact parameter <... |
NetworkStream.Write data seems not to arrive at receiving socket <p>C# System.Net,Sockets</p>
<p>I'm having a problem where I cannot figure out what I might be doing wrong.</p>
<p>The story is, I send byte[] application data from TcpClient socket to another TcpClient socket. It all works great, until I add a custom p... | <p>So as I suspected, the problem was in the Authenticate method on the client side.
I was sending an int instead of a single byte. The offending line of code was.</p>
<pre><code>byte[] snd = BitConverter.GetBytes(result);
</code></pre>
<p>Which should have been.</p>
<pre><code>byte[] snd = new byte[1] { (byte)resul... |
Getting BLOB image and display in html using php <p>I am facing an issue getting an image from mysql database and displaying on the web page.
I have a user_image table with userid, image (blob datatype), caption, imagename(name of the image, example, 0101.jpg), time(timestamp of the image upload).
Users can upload ima... | <p>i use this for my own site <code>echo '<img src="data:image/jpeg;base64,'.base64_encode($customer->GetCustomer($user)["Customer_image"]).'">'</code></p>
<p>where <code>Customer_image</code> is blob
the function GetCustomer($user) is for all information of customer </p>
<p>for my upload i use this </p>
... |
Making sure Serializable object always with latest data - c# <p>I am writing a program that works all the time in the background of windows,
the data is collected all the time and saved in an serializable object in a file.</p>
<p>When starting the program I get all the data that has been collected and saved in a file ... | <p>If you rely only on events (mouse move, key pressed, program closing) - this is pretty much all you can do. You can't guarantee that everything will be alright if power turn off for example. Your app forcebly closed - you lose everything in memory.</p>
<p>Other way around, you can serialize it once in a while (ever... |
MVC update multiple records from post <p>I am trying to update multiple records at once but my model is always null.</p>
<p>This works to update a single record. Post=AttendeeId=79&ArrivedAttendees=3</p>
<pre><code> public async Task<ActionResult> UpdateArrivalNumbers(ArrivedAttendeesVM vm)
{
... | <p>The problem is not in your action, probably it is in your view. As you stated your posted data is as following:</p>
<pre><code>AttendeeId[0]=79
ArrivedAttendees[0]=3
AttendeeId[1]=80
ArrivedAttendees[1]=5
</code></pre>
<p>For MVC framework to be able to correctly bind your model, posted data should be as followin... |
Elixir: Nested If Statements <p>I have this simple piece of code that would be very straightforward in most languages. I'm really struggling to see how to do this. How would I convert this into Elixir without getting the dreaded variable unsafe warning?</p>
<pre><code>dc = 1
sd = 5
sdi = 6
calc = 1
bc = 1
dd = 10
if ... | <p>You can use tuples and pattern matching:</p>
<pre><code>dc = 1
sd = 5
sdi = 6
calc = 1
bc = 1
dd = 10
{csd, bd, p, count} = if dc == 1 do
{sd, sd, sdi, if(calc == 1 && bc != 1, do: 1, else: 20)}
else
{dd, dd, dd, 1}
end
IO.inspect {csd, bd, p, count}
</code></pre>
<p>Output:</p>
<pre><code>{5, 5, 6,... |
php code for urls shortner not working, page not redirecting <p>I am using this code to create a urlshortner, that if a user from US visit the link he will be redirected to some page and if a user from any other country visit the link he will be redirected to some other page. It is not giving me any errors but not work... | <pre><code>"$de"
</code></pre>
<p>will not resolve correctly as it's also within single quotes; and they take precedence. Swap single and double quotes and that issue is fixed.</p>
<p>For example</p>
<pre><code>$urlid = mysqli_query($con,"SELECT id FROM short_urls
WHERE shorturl='$de'"... |
Use UIViewController as TableView cell <p>I have a segmented control wich switch between two UIViewControllers. A info view, and a list view (TableView).
I want to use the first UIViewController as the first cell of my TableView (that is on the other segment).
There's a way to convert a UIViewController to a cell or so... | <p>Use this code with your own way. Here we are adding the controllers view as subview of cell and using auto layout to manage properly. You just need to use the code by understanding.</p>
<pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let ce... |
Searching string from every position with regex so it finds overlapping matches <p>My regex doesn't find overlapping matches, is there a way to do find them?</p>
<p>Example regex that illustrates the problem: <code>/(\d\*x\^(\d))\+(\d\*x\^(\d))/g</code></p>
<p>String to perform this regex on: <code>3*x^2+2*x^3+6*x^2<... | <p>The snippet below just uses split, reverse, join.<br>
It orders the pieces between the '+' based on the reversed pieces.<br>
Thus sorts them by the exponent.</p>
<p>For example <code>3*x^2+2*x^3+6*x^2</code> becomes <code>3*x^2+6*x^2+2*x^3</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-co... |
How to add promise/event when data change is reflected on page? <p>Consider such scenario -- I have two repeaters A and B on the web page, and a button which calls a function "load_data" when clicked.</p>
<p>That function will load data and on success (promise) it will set two scope variables A and B.</p>
<p>The rest... | <p>As soon as the scope is updated (and if you're within Angular digest cycle, otherwise you may need to <code>$apply</code> the scope), Angular will update the DOM in the same synchronous stack.</p>
<p>This means that any code executed asynchronously will be executed after Angular is done digesting. So you can use <c... |
Ruby on Rails - SLIM - SCSS - inject ruby variable <p>How do I set a SCSS variable based on ruby variable value?</p>
<p>Following code is working for CSS but not for SCSS:</p>
<pre><code>- primaryColor = app.theme_variables['primary-color'];
= content_for(:after_head_script) do
css:
.primaryColor {
color: #... | <p>Add a .slim extension to your .scss file and your variable expansions should work (i.e., ".scss.slim").</p>
<p>See <a href="http://guides.rubyonrails.org/asset_pipeline.html#preprocessing" rel="nofollow">Asset Pipeline Preprocessing</a> for details.</p>
|
Eliminating non duplicate rows from recordset <p>The below T-SQL displays the results shown in table diagram below it. I want to write the T-SQL in a way that it excludes the rows with UserIDs 1, 95 and 161. These rows only appear once and I don't want to include them in the result set. What I want is to display rows w... | <p>Just add the condition to the <code>where</code> clause:</p>
<pre><code>select top(100) UserID, PhotoLabel
from dbo.Photos
where left(PhotoLabel, 8) in (select distinct top(10) left(PhotoLabel, 8) as date
from dbo.Photos
order by left(PhotoLabel, 8) desc
... |
how do I make the bullet move Actionscript 3.0 <p>I am making a very simpel flash game to understand AS3. I have made a cirkel with controls. When I press the space I want to fire a bullet. I have tried for, while loops and different tutorials but I just can't figure out how to do this.
This is m code:</p>
<pre><code>... | <p>To make it move you need to use some event that happens repeatedly with some interval.<br>
A <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html" rel="nofollow"><code>Timer</code></a>:</p>
<pre><code>var myTimer:Timer = new Timer(25);//interval, milliseconds
myTimer.ad... |
Cordova Ionic - changes not taking effect <p>Like the title said. I'm making change in my app (I'm really new in this) but when I refresh the page (after make ionic serve start), the change has not taking effect.</p>
<p>If I change a .html view I can change the effect but, when I change a .json that the app use, not w... | <p><a href="http://ionicframework.com/docs/cli/test.html" rel="nofollow">Look at the Ionic Docs</a> for information on their CLI app. </p>
<p>Is your <code>json</code> file inside the watched directories?
If not - the ionic CLI won't be watching it for changes.
Try explicitly watching your <code>json</code> file with... |
How to print error in Swift code? <p>I have the following code:</p>
<pre><code> func marseJSON(Person: String)
{
let jsonData1 = NSData(contentsOfURL: NSURL(string: "\(label2)")!) as NSData!
var error : NSError?
let ReadableJSON1 = JSON ( data:jsonData1, options: NSJSONReadingOptions.MutableContaine... | <p>you can try UIAlertController:</p>
<pre><code> if (error != nil){
let myAlert = UIAlertController(title: "Alert", message: error?.localizedDescription, preferredStyle: .Alert) //you can change message to whatever you want.
let okAction = UIAlertAction(title: "Ok", style: .Default, handler:... |
Text box / select advanced option <p>I want users to be able to type text into the text box I set up.
If they do not know their options, I want them to be able to click <strong>expand</strong> and select from a drop-down menu, such as on <a href="http://www.tigerair.com/sg/en/" rel="nofollow">this</a> page.</p>
<p>How... | <ul>
<li>For HTML only solution use <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element/datalist" rel="nofollow"><code><datalist></code></a>:</li>
</ul>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-co... |
I want use different kernels on jupyter, but how can I install different libraries on different kernel? <p>I have two kernels on my jupyter, one is py2.7 and the other is py3.5, but how can I install different libraries like pandas or numpy for py2.7?</p>
| <p>You ought to use a <a href="https://virtualenv.pypa.io/en/stable/" rel="nofollow">virtualenv</a>: this create a local copy of the Python of your choice. </p>
<p>Then you can use <a href="https://pypi.python.org/pypi/pip" rel="nofollow">pip</a> to install libraries like Pandasâ¦</p>
<p>But, before, install Jupyter... |
PHP Register not sending data to MySQL PDO <p>I've tested this registration form on my localhost and my VPS. I cannot get it to send data to MySQL at all. The register class does acknowledge errors in the form and it says an account was created successfully, but it never inserts it into the database.</p>
<pre><code>&l... | <p>Quite a simple fix!</p>
<p>On line 103, you were trying to execute a statement without binding all of the values (you forgot to bind values to ':Credits' and ':Active'), so I've added 2 new lines on lines 100 and 101 to do that for you. To get those lines to work, i had to add extra elements ('credits' and 'active'... |
Understanding an illegal nested `lambda` call <p>If I call the following lambda in the REPL, everything works as I'd expect:</p>
<pre><code>CL-USER> (funcall (lambda (x) x) 3)
3
CL-USER> ((lambda (x) x) 3)
3
</code></pre>
<p>Now, if I nest the lambda into another lambda, I can't call it without funcall anymore.... | <p>The first position in a function call is not evaluated normally. It can either be a symbol, and its function binding will be used, or it can be a lambda expression, and that anonymous function will be called.</p>
<p>You can't put other expressions there. So you can't put an expression that returns a function. That'... |
This is a homework assignment in a beginning Java class <p>I am attempting to write a program that takes an input from the user and uses that to decide the 'difficulty' of the game by setting variables for health. After this is decided, I need to use those new values in another loop for the fight sequence. The second... | <p>Many closing brackets are missing. Go through the code by hand and keep a track of each pair of brackets. You will figure out where to close them.</p>
|
Fileevent executed befor proc finishes <p>i have the following code ...</p>
<pre><code>lassign [ chan pipe ] chan chanW
fileevent $chan readable [ list echo $chan ]
proc echo { chan } {
...
}
proc exec { var1 var2 } {
....
puts $chanW "Some output"
....
}
</code></pre>
<p>Now according to man ... | <p>Tcl never executes an event handler at âunexpectedâ points; it only runs them at points where it is asked to do so explicitly or, in some configurations (such as inside <code>wish</code>) when it is doing nothing else. You can introduce an explicit wait for events via two commands:</p>
<ul>
<li><p><code>update<... |
What do I need in my package.json file in Meteor? <p>I think I'm confused as to what to have in my package.json file for my Meteor app. My app was originally built with v1.2 and recently updated Meteor to 1.4.1.1 (bypassing 1.3). I have no npm packages installed; all my packages were installed through atmosphere. Do I ... | <p>These aren't a list of dependencies but a list of Meta information for your applications.</p>
<p>It's better to keep this just incase in the future you do decide 'npm' packages later in the future with 'meteor npm install {package name}.</p>
<p>I hope this helps.</p>
|
asp.net mv 5, DropDownListFor with ViewModel not working <p>I have an MVC 5 site, I would like to use a strongly typed DropDownListFor with a ViewModel - not with ViewBag.</p>
<p>I have found various articles on this - but they all seem to have huge holes - for example this one doesnt cover editing, and I do not under... | <p>I solved this - I had stupidly forgotten the { get; set; } accessors on the ViewModel, doh!</p>
|
Java equivalent to python array initialization <p>What is the equivalent in Java to this in Python?</p>
<pre><code>array_name = [0 for i in range(5)]
</code></pre>
<p>Specifically, I want to create a 2 dimensional Java ArrayList and initialize each value as 0. This is what I was thinking, in semi-psuedocode, followin... | <p>To initialize a <code>ArrayList</code> with zeros could make use of the method <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#nCopies%28int,%20T%29" rel="nofollow">nCopies</a></p>
<pre><code> int ROWS =3;
int COLUMNS=3;
List<List<Integer>> twoDimArray = new Array... |
Capistrano deployment error - "config/database.yml: No such file or directory" <p>Not sure what Capistrano is trying to do or what's wrong. I have already set the file and folder permission on my server with user "deploy4" and all the necessary things as mention in here: </p>
<p><a href="https://www.phusionpassenger.c... | <p>I've usually seen this in one of two situations:</p>
<ol>
<li>Does <code>/var/www/web/group4/shared/config/database.yml</code> exist on your server?</li>
<li>Is <code>/var/www/web/group4/shared/config/database.yml</code> a symlink to a file which doesn't exist (or a relative symlink)?</li>
</ol>
|
Relative div overlapping Fixed Divs <p>I'm developing a mobile app, and I'm having an issue with relative divs going above the top and bottom header that are fixed with a z-index. I did some research and tried to put a z-index in the relative div, but it did not fix anything. </p>
<p>Here's the Relative Div: </p>
<pr... | <p>Since your relative elements are using z-indexes, your fixed position elements will need to have a greater index to appear on top.</p>
<p>In your example JSFiddle, if I add <code>z-index: 3;</code> or greater to <code>.StatsBar</code> and <code>.TabsBar</code> it seems to fix it.</p>
|
C# method for finding Book in list, and removing a Book from the list <p>I have to make a Library class that has a list of Books with a Title, Author, and ID#. I have to make methods to add books, find books by title, display all books, and remove books.</p>
<p>Is my addBook() method correct?</p>
<p>I have an error w... | <p>The method is not correct. It has some flaws:
1. It calls I/O methods to get information from the user. But that's not what this function ought to be doing. Its job is to add a book to a library. It should be given information about the book via parameters, and then use that information to construct a new book and a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.