input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Why I get Error code 404? <p>After I run the test as:</p>
<pre><code>tsung -f test.xml start
</code></pre>
<p>I get this:</p>
<pre><code>$ cd /Users/samir/.tsung/log/20160910-1035
Apple-Mac-mini:20160910-1035 samir$ /usr/local/Cellar/tsung/1.6.0/lib/tsung/bin/tsung_stats.pl
creating subdirectory data
creating subdi... | <p>This is right , the tsung_stats.pl script generate report.html file , in the browser, visit <a href="http://localhost:8080/report.html" rel="nofollow">http://localhost:8080/report.html</a>, the index.html be created in tsung runtime by ts_controller_sup.beam , the ts_controller_sup.beam listen 8091 port, you need to... |
Deleting duplicate adjacent td elements using jquery <p>I've the html code as shown below.</p>
<pre class="lang-html prettyprint-override"><code><div class="serverSet">
<h2>JH Storefront servers</h2>
<table border="1" class="CSSTableGenerator" class="myTable">
<tr>
<th>... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var dups = $('.comps + .comps')
dups.remove()</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&... |
Please Help me finding the string given below using regular expression in javascript <p>This is the string from which i need to do searching - </p>
<pre><code><bpmn:process id="Process_1" isExecutable="false">
<bpmn:task id="Task_15xgmrn" name="Select1Select5" extratask:entity="Select1" extratask:action="Sele... | <p>Am I correct that what you actually want to do is collect all the <code>bpmn:task</code> XML tags, because this can actually be as small as:</p>
<pre><code>str.match(/<bpmn:task.+?>/g)
</code></pre>
<p>Or as the person in the comment pointed out</p>
<pre><code>str.match(/<bpmn:task id=".*"\s*name=".*"\s*... |
Geronimo Server started but console not started <p>I've an Apache Geronimo server which is started properly and I can see that there's no exception logged in geronimo.out or geronimo.log file.</p>
<p>But, when I try to access admin console. It gives HTTP 404 error.</p>
<p>Any pointer on what modules are missing durin... | <p>I don't know about you (your environment) but I have been running geronoimo on java 8 in Ubuntu 15.10 and 16.04 for a wile (adding a jre-8 section to config.properties) this has worked well for some time (including accessing console on <a href="http://localhost:8080/console/" rel="nofollow">http://localhost:8080/con... |
Unable to find activity,have you declared in manifest <p>I am trying to implement pdf viewer in my app.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ttech"
android:versionCode="1"
android:versionName="1.0" >
... | <p>You declared the activity as</p>
<pre><code><activity android:name=".PdfViewerActivity"
android:label="@string/title_activity_pdf_viewer" />
</code></pre>
<p>Since you defined <code>package="com.example.ttech"</code>, the activity points to the class <code>com.example.ttech.PdfViewerActivity</code>, but ... |
Magento 2: Override/Rewrite Block, Model, Controller, Helper using Plugin & Preference <p>Magento 2: Override/Rewrite Block, Model, Controller, Helper using Plugin & Preference.</p>
<p>How to override helper, block, model view?</p>
| <p>This can be done by two ways:</p>
<p>1) using Preference
2) using Plugin</p>
<p>Preference is similar to class rewrite in Magento 1. There is always possibility of conflict when two or more custom modules try to rewrite/override same core class.</p>
<p>There is Plugin to address the limitation of Preference. With... |
onNavigationItemSelected not working in NavigationView <p>Please can someone help me with fragments from the navigation drawer, for some reason I can't get them to work and all the code looks right.</p>
<p><a href="https://github.com/Matt-Hutchings/The-Midlands-Meander" rel="nofollow">Here</a> is the link to the sourc... | <p>Have a look at your <code>MainActivity.java</code>.</p>
<p>You have implemented the callbacks for <code>NavigationView.OnNavigationItemSelectedListener</code> in <code>MainActivity</code> as below,</p>
<pre><code>@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
// blah blah
}
</code></pre... |
Writing a Regex for Kuwait Mobile number in international format <p>I need a regex to match following:</p>
<ul>
<li>total string length 12 </li>
<li>first four characters must be +965</li>
<li>fifth character either 5, 6 or 9</li>
<li>followed by 7 digits [0-9]</li>
<li>nothing else allowed</li>
</ul>
<p>Any help reg... | <p>Based on help extended by Pranav and Tim, the regex for kuwait mobile is +965[569]\d{7}$</p>
<p>working fine with simfatic forms. Thanx for the help. </p>
|
Include jQuery in Angular2 with webpack and access it from component <p>I want to include jQuery and SignalR in my Angular2-Application and wire everything up with webpack.</p>
<p>I therefore installed jQuery via npm.</p>
<p>package.json</p>
<pre><code>"dependencies": {
// ...
"jquery": "2.1.4",
// ...
... | <p>I investigated your problem and found the following solutions:</p>
<p>1) Use</p>
<pre><code>window.jQuery = require("jquery");
</code></pre>
<p>to import jQuery in your entry file</p>
<p>2) Change your <strong>webpack.config.js</strong></p>
<pre><code> new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jqu... |
unclear to parameters pass in promise model <p>I am new to angularjs. I confuse to How promise model work in AngularJS. The example below is the tutorial code that I find from github. I can confuse where the parameter "response" in then() comes from and how it works? Can anyone explain to me,please!</p>
<pre><code>(fu... | <p>It called Promise - which replace the good old callback style for async methods. instead of passing a callback to UserService.Create, UserService.Create returns a promise which you can decide what comes after it (once it has been resolved or rejected). promise have the method then() which accepts 2 arguments:</p>
<... |
Android: Adding libraries through gradle with external repositories <p>This is going to be a basic question and I am sure I am just reading it wrong. I couldn't find a clear answer for this else where.</p>
<p>I am trying to import this library:</p>
<pre><code>https://android-arsenal.com/details/1/2822
</code></pre>
... | <p>Try with removing repository from top level all projects gradle file like below...</p>
<pre><code>buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
</code></pre>
<... |
SQL Server if condition based on date <p>I need help with, giving the if exists and if not exists condition.</p>
<p>I want to write an if condition, based on date, such that, if any row exists in table1 on current date <code>TARGET_DT</code> for a particular job, then do some action
else do other action. </p>
<pre><c... | <pre><code> IF EXISTS(SELECT 1 FROM COD_BLU_OPENING_VOLUME WHERE ((TARGET_DT=CONVERT(DATETIME,GETDATE(),101) OR TARGET_DT>CONVERT(DATETIME,GETDATE(),101)) AND JOBID=@OPENJOB))
BEGIN
IF(SELECT COUNT(1) FROM COD_BLU_INVENTORY WITH(NOLOCK) WHERE (JOBID=@JOB AND STATUS='A' AND (TARGET_DT=C... |
Concat multi-dimensional array into one-dimensional array <p>I have an array with objects</p>
<pre><code>const nodes = [ { children: [1, 2, 3] }, { children: [1, 2, 3] } ];
</code></pre>
<p>I want a new array <code>[ 1, 2, 3, 1, 2, 3 ]</code>.</p>
<p>I have tried</p>
<pre><code>nodes.map(node => node.children);
... | <p>You can do this with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce" rel="nofollow"><code>Array#reduce</code></a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snip... |
angular2 google map marker mouse enter and leave event <p>I am using angular2 google map.I want to open a Info window on mouseenter and need to close on mouseleave of marker.
<a href="http://embed.plnkr.co/YX7W20/" rel="nofollow">http://embed.plnkr.co/YX7W20/</a></p>
<p><div class="snippet" data-lang="js" data-hide="f... | <p>I guess it should work for you:</p>
<pre><code>const baseAddEventListeners = (<any>SebmGoogleMapMarker.prototype)._addEventListeners;
(<any>SebmGoogleMapMarker.prototype)._addEventListeners = function() {
this._markerManager.createEventObservable('mouseover', this)
.subscribe(() => { this._inf... |
DeepLearning4J: Shapes do not match on FeedForward Auto Encoder <p>I'm implementing an auto-encoder for anomaly detection of IoT sensor data. My data set comes from a simulation, but basically it is accelerometer data - three dimensions, one for each axis.</p>
<p>I'm reading it from a CSV file, column 2-4 contain the ... | <p>Thanks to <a href="https://github.com/AlexDBlack" rel="nofollow">Alex Black</a> of <a href="https://skymind.io/" rel="nofollow">Skymind</a>, this is the solution (got the shape wrong)</p>
<pre><code> INDArray ixNd = Nd4j.create(ix, new int[]{3000,1});
INDArray iyNd = Nd4j.create(iy, new int[]{3000,1}... |
System.UriFormatException' occurred in System.dll error <p>i use this code for ftp upload <a href="http://www.aspsnippets.com/Articles/Uploading-Files-to-FTP-Server-programmatically-in-ASPNet-using-C-and-VBNet.aspx" rel="nofollow">from this link.</a></p>
<p>and when i use that, show me that error , what am i doing?</p... | <p>You are missing ehe <code>ftp://</code> prefix, and a slash between the hostname/IP address and the folder name, in your URL.</p>
<p>Your would-be URL is:</p>
<pre><code>92.222.117.211Uploads/filename
</code></pre>
<p>While a real URL is like:</p>
<pre><code>ftp://92.222.117.211/Uploads/filename
</code></pre>
|
Application.Quit - application not starting when debugging <p>When I add Application.Quit(), or Form.Close(), and try running the program with Debugging, the debugging starts, but the Application doesn't. I asked this question yesterday. <a href="http://stackoverflow.com/questions/39383158/visual-studio-debugging-start... | <p>In FormClosing Event if you set <code>e.Cancel = true</code> the application will not be closed anyway.</p>
<p>You should use some conditions for <code>e.Cancel = true</code>.</p>
<p>Declare a flag parameter and set it before <code>Application.Quit()</code> and in FormClosing Event check if the flag is true, then ... |
Error in eval(expr, envir, enclos) : object 'Tribe' not found <p>I am following some online examples for getting to grips with ggplot2 in R. As part of this I am trying to add in the automatic coloring of series using pre-defined color schemes.</p>
<p>The following code will work:</p>
<pre><code>ggplot(subset(homes, ... | <p>You want the colour of your points to vary by the variable <code>state</code>, so it should be inside the <code>aes</code>:</p>
<pre><code> geom_point(aes(colour = State))
</code></pre>
<p>Anything outside of the <code>aes</code> is constant, so, <code>colour=red</code> or <code>size=2</code>.</p>
|
Making export default work with Babel, webpack and Node.js <p>I can't figure out why my code doesn't work. </p>
<p>I am building a ES6 style class and want to export it to be able to use it somewhere else in the server side. I put the code into a file called <code>PlayerManager.js</code>in the <code>server</code> fold... | <p>Webpack is a bundler for producing packages that run on the client (in the browser), it is not aware of or concerned with code on the server. (Unless you are doing universal application stuff.)</p>
<p>You will notice too that your npm <code>dev</code> script is simply asking node to load the <code>server.js</code> ... |
Access User's Browser (preferably Chrome) cache in Android <p>I'm working on something where I provide content to users based on the things they view over the internet, or by the kind of applications they use. Is there a way to get a user's search history, bookmarks or cache from various browsers (preferably Chrome). A... | <p>Unfortunately you can't because every android application in a sand box for more information go to this link:<a href="https://developer.android.com/training/articles/security-tips.html" rel="nofollow">Sand Box</a></p>
<p>and if you want to do sort if thing you must implement rooted application and the database fil... |
set the variables that go inside array_merge_recursive <p>I need to tell array_merge_recursive what variables it needs to merge</p>
<p>I have the variable names that I need to use as strings, for example I have the following</p>
<pre><code>$array1 = array('color'=>'blue', 'taste'=> 'sour', 'size'=>'big');
$a... | <p>Two elements to handling this the way you want to:</p>
<p>Variable variables to build the to be merged array</p>
<pre><code>$arraysThatINeedToAddToTheMerge = array('array2', 'array4');
$toBeMerged = [];
foreach ($arraysThatINeedToAddToTheMerge as $data){
$toBeMerged[] = $$data;
}
</code></pre>
<p>This will b... |
RecyclerView part of ScrollView <p>I have a RecyclerView as the bottom view, along with some other views on top:</p>
<p><a href="http://i.stack.imgur.com/NL7j7.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/NL7j7.jpg" alt="Screenshot"></a></p>
<p>I want to scroll the entire view (1), not just the RecyclerView... | <p>I have tried with your example </p>
<blockquote>
<p>Scrolling in the <code>recyclerview</code> isn't smooth, in the sense that when I
lift up my finger, the scrolling stops. No accelerated scroll, or
whatever you call it.</p>
</blockquote>
<p>Even I noticed that. I think there are some restrictions when you ... |
CSS: container with max-height, after that, a child div should start to scroll <p>I have a modal window that should be a small as possible, extend to 70% of the height. After that, the content of the modal (but not the modal itself) should start to scroll. I can't make this work.</p>
<p>My HTML looks like this:</p>
<... | <p>It is expected that the <code>max-height</code> is ignored here because it is applied to <code>dialog</code> and it does not affect its child element which is a <code>flexbox</code> (which should have a specific height).</p>
<blockquote>
<p>If the height of a <code>flexbox</code> is not specified, then you won't ... |
Sharding in orientdb distributed database <p>I am creating a distributed database in orientDB 2.2.6 with 3 nodes, namely master1, master2 and master3. I modified the hazelcast.xml and orientdb.server.config.xml files on each of the nodes. I used a common default-distributed-db-config.json on all 3 nodes which looks lik... | <p>In current OrientDB releases, write operations (create/update/delete) are not forwarded. only the reads are. For this reason, the client should be connected to the server that handles the cluster you want your data written to.</p>
<p>Usually, this isn't a problem, because a local cluster is selected, but if you wan... |
bash elif does not work as I expected <p>Here is my script:</p>
<pre><code>age=119
if [[$age -gt 99 ]]; then
age_3digits=$age
elif [[$age -gt 9]]; then
age_3digits=0$age
else
age_3digits=00$age
fi
z_grid=${age_3digits}Ma.grd
echo $z_grip
output: 00119Ma.grd
</code></pre>
<p>how come?? I am new to b... | <p>You need a space after <code>[[</code> and before <code>]]</code>. Change to:</p>
<pre><code>if [[ $age -gt 99 ]]; then
age_3digits=$age
elif [[ $age -gt 9 ]]; then
age_3digits=0$age
else
age_3digits=00$age
fi
</code></pre>
<p>It's also better to use arithmetic expressions because it makes your code m... |
How to change thirdparty select tag value using JavaScript <p>I have some third party gadget on my wordpress website and getting below code but it's giving me default currency for example JPY Japanese but I want to switch using Javascript and select USD from the list how I can implement some script which can select val... | <blockquote>
<p>using this you can change the value of select box when page loads</p>
</blockquote>
<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>jQuery(document).ready(func... |
SQL Server Count rows having specific Values & Also count child rows with same specific field <p>Table is look like this</p>
<pre><code>CREATE TABLE [CONTENTS].[ID]
(
[ID] NVARCHAR (20) NOT NULL,
[NAME] NVARCHAR (MAX) NOT NULL,
[CONTENT] NVARCHAR (MAX) NULL,
[PARENT_ID] NVARC... | <p>This is not the complete solution but may give you an idea</p>
<pre><code>//It will return 1 or 0 if id is unique
select count(*) from tablex where type = 2 and id = x;
//To get count of child rows with parent id
select tablex.id, tablexb.child_count from tablex INNER JOIN (select parent_id, count(*) as child_coun... |
UIScrollView won't scroll with content view inside <p>having issues with UIScrollView. I have a setup like so:</p>
<p><a href="http://i.stack.imgur.com/Pe8FA.png" rel="nofollow"><img src="http://i.stack.imgur.com/Pe8FA.png" alt="enter image description here"></a></p>
<p><a href="http://i.stack.imgur.com/RY8pf.png" re... | <p>Hope this will help you,Many facing this problem i hope my solution will provide relief to Devs.</p>
<p>your view Hierarchy should be like this :-</p>
<pre><code>View (main view of my UIViewController) â with
-ContainerScrl
--Scroll View (UIScrollView)
---ViewInsideScrl
----Content1
----Content2 (etc)
</code>... |
Dynamic Datagrid Columns based on collection <p>I am having a wrapper for example.</p>
<pre><code>public class Student{
public string Name{get;set}
public int IDNumber{get;set;}
public ObservableCollection<SubjectWrapper> Subjects{get;set;}
}
public class SubjectWrapper{
public strin... | <p><a href="http://i.stack.imgur.com/h7hDI.png" rel="nofollow"><img src="http://i.stack.imgur.com/h7hDI.png" alt="enter image description here"></a></p>
<p>XAML</p>
<pre><code> public partial class MainWindow : Window {
public MainWindow()
{
InitializeComponent();
var stude... |
Spring XD transform and route message in one module <p>How to transform and route a message in 1 module.<br>
I created a module like this: </p>
<p>xd-ta-core.xml</p>
<pre><code><int:channel id="input"/>
<int:channel id="output"/>
<beans:bean id="taCore" class="com.company.threatanalyzer.xd.plugin.XdTa... | <p>There are two subscribers to channel <code>output</code> - the message bus and your router. In that scenario, messages will be alternately sent to each.</p>
<p>You need to use a third, intermediate, channel between your transformer and router (e.g. <code>toRouter</code>)...</p>
<pre><code><int:transformer input... |
Loop thru XML nodes c# WPF <p>XML:</p>
<pre><code><?xml version="1.0" encoding="utf-32"?>
<MailTo>
<To Name="Boss">
<name>Name1</name>
<mail>Name1@Mail.com</mail>
</To>
<Cc Name="Trainee">
<name>Name2</name>
<mail>Name2@Mail.... | <p>Ok my silly mistake.
Just had to remove the "break;"</p>
|
Node.js User Authentication <p>I'm new with nodeJs and i'm actually following a tutorial about it.
In the tutorial, a code was used:
In a verify.js file the following function was written:</p>
<pre><code>exports.verifyOrdinaryUser = function (req, res, next) {
// check header or url parameters or post parameters... | <blockquote>
<p>1- I don't understand why the function verify.verifyOrdinaryUser is
not called so : verify.verifyOrdinaryUser(req, res, next)</p>
</blockquote>
<p>In simplest terms, That's because <code>Express</code> takes care of sending those parameters to the specified middleware instead of you specifying it h... |
SceneKit SCNNode init(mdlObject:) missing? <p>I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init <code>init(MDLObject mdlObject: MDLObject)</code> in <a href="https://developer.apple.com/library/ios/documentation/SceneKit/Reference/SCNNode_Class/#//apple_ref/occ/clm/SCNNode/nodeWithMDLObje... | <p>the following should do</p>
<pre><code>import SceneKit.ModelIO
</code></pre>
|
Adding values to a multidimensional associative array in php <p>Im trying to build a site messaging system for all of my information messages using an array i can loop through. I am trying to do it so i can separate the messages in the array (Also so they can be added appropriately)</p>
<p>The test code i have is </p>... | <p>In your loop, please change your variable name <code>$test_messasge</code> to <code>$test_message</code></p>
<pre><code>foreach ($test_message['message'] as $message){
echo $message . "<br />";
}
</code></pre>
|
React cannot read property of undefined <p>Moving some code from react.createclass to extending Component i have run into a problem. Whilst mapping a component i have a function being passed through as a property so it could be accessed from that component. It worked find the 'previous way' but now it is throwing this ... | <pre><code>all(value, index) {
return <Comment author={value.author} key={index} removeComment={this.removeComment.bind(this)} >{value.comment}</Comment>
}
render() {
return(
<div>
{this.state.items.map(this.all.bind(this))}
<CommentForm getNewComment = {... |
Populate TextBox's in VBA <p>I am using a form to show outstanding work. the code creates a number of textboxes based on the number of rows used on a sheet call "Jobcardslive" </p>
<p>I can get it to create the right number of textboxes on the form but i would also like to populate the textboxes with a value stored in... | <p>you could go like follows:</p>
<pre><code> Dim txtB1 As MSForms.TextBox '<--| declare it as a TextBox instead of Control, to have Intellisense show you real `Textbox` object specific members
Dim i As Long
With ThisWorkbook.Sheets("Jobcardslive")
For i = 1 To .Range("A" & .Rows.Count).End(... |
how to set logging in groovy project (logs from all classes) to a single file <p>I'm able to set logging in a single groovy class. But I want to send all the logs from different groovy classes to a single file. Is it possible ? Please find below my log code in my groovy class.</p>
<pre><code>import groovy.sql.Sql
impo... | <p>As Groovy runs above Java you can use one of the Java Libraries.
Personally I would prefer using slf4j than using log4j. The difference from log4j is explained <a href="http://programmers.stackexchange.com/questions/108683/slf4j-vs-log4j-which-one-to-prefer">here</a>.
If you are using Grails MVC framework than it wo... |
Use of Apache Ignite in Eclipse IDE <p>What do I need to do to use Apache Ignite in an Eclipse project? </p>
<p>I don't want to use Maven; I have Apache Luna; and I just want to use the in-memory data grid.</p>
| <p>There are no steps specific with Apache Ignite. You will have to determine the whole set of required JARs including transitive dependencies and manually add them to your project. I would strongly recommend to use Maven or other dependency management tool. What is the reason for not using it?</p>
|
Retreiving Date value through constructor and storing it in variable of type Date <p>It throws exception while trying to parse String to Date after getting Date value as a string from the user.
What should be done in order to store the Date value (or) is there any any specific method to retrieve date.</p>
<p>Medicine... | <p>Your example says </p>
<blockquote>
<p>Enter Tablet's expiry date in yyyy-dd-mm format</p>
</blockquote>
<p>But your format is <code>new SimpleDateFormat("dd-mm-yyyy");</code>.</p>
<p>First decide which one is the format you really want, and then change the <code>mm</code> (minutes) to <code>MM</code> (months).... |
How can I update or delete a record from the JSON output using Laravel and Predis <p>I started a few months ago with Laravel and I want to implement Redis.</p>
<p>How and what is the best way to update or delete 1 or more records from <code>$test</code>.</p>
<pre><code> $allarticles = Article::all();
$client =... | <p>Instead of storing the whole json as a string, store them in a hashmap using hmset command, id is the member and rest of the json is the value.</p>
<p><a href="http://redis.io/commands#hash" rel="nofollow">http://redis.io/commands#hash</a></p>
<p>To set the json:</p>
<pre><code>hmset articles 1 {"title":"xQeMKGef... |
Get condition operator by EL <p>I'm using the following code to get condition object by rest api,this object have operator and response fields ,I need to use them in if condition statement like </p>
<pre><code>if(response condition.operator condition.response)
</code></pre>
<p>condition.operator should be < , ... | <p>Try this:</p>
<pre><code>var result;
if(condition.operator == '<') {
result = result < condition.result;
} else if(condition.operator == '>')
result = result > condition.result;
} else {
result = result || condition.result;
}
if(result) {
console.log("");
}
</code></pre>
|
What does 'yield resource' in the Devise controllers do? <p>I was looking through the Devise code and noticed that most of the controllers yield the resource being created.</p>
<pre><code>class Devise::RegistrationsController < DeviseController
# ...
def create
build_resource(sign_up_params)
resource.s... | <p>It's to allow subclasses to reuse the <code>create</code> implementation provided by devise, but being able to hook into the process. </p>
<p>For example you might have something like</p>
<pre><code>class MyRegistrations < Devise::RegistrationsController
def create
super { |resource| ... }
end
end
</co... |
How would this testcase ( written in Java using Selenium WebDriver ) look like if the Conductor framework was used? <p>The following MWE ( described in "Selenium Testing Tools Cookbook, 2nd ed." by Unmesh Gundecha published by Packt publishers ) is a website test using the Selenium Test Framework.</p>
<pre><code>packa... | <p>Through trial and error I found that using the Conductor framework the following class works as expected.</p>
<pre><code>import io.ddavison.conductor.Browser;
import io.ddavison.conductor.Config;
import io.ddavison.conductor.Locomotive;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.seleniu... |
How to fork a python script in different terminal <p>I want to fork a new process in a script, but how to interactive with the subprocess in a new terminal?
For example:</p>
<pre><code>#python
a='a'
b='b'
if os.fork():
print a
a = input('a?')
print 'a:',a
else:
print b
b = input('b?')
print 'b:... | <p>Its probably bad practice to open a new terminal like that from a command line application, but <code>gnome-terminal</code> has an <code>-e</code> flag. E.g. <code>gnome-terminal -e python</code> will open a python interpreter.</p>
|
nifi 1.0.0 - extend the behaviour of a standard processor <p>I have a custom processor that extends the MergeContent proc and when NiFi starts I have this error in logs:</p>
<pre><code>2016-09-09 18:17:00,607 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.util.ServiceConfigurationError: org.apach... | <p>If you are extending or using components from another NAR in your NAR, there needs to be a NAR dependency between them. </p>
<p>This page demonstrates how to setup the proper linking between a processor and a controller service in separate NARs:</p>
<p><a href="https://cwiki.apache.org/confluence/display/NIFI/Mave... |
Tornado multiple processes: create multiple MySQL connections <p>I'm running a Tornado HTTPS server across multiple processes using the first method described here <a href="http://www.tornadoweb.org/en/stable/guide/running.html" rel="nofollow">http://www.tornadoweb.org/en/stable/guide/running.html</a> (server.start(n))... | <p>Each child process gets a copy of the variables that existed in the parent process when <code>start(n)</code> was called. For things like connections, this will usually cause problems. When using multi-process mode, it's important to do as little as possible before starting the child processes, so don't create the m... |
C++ Multilevel Inheritance, Polymorphism <p>Suppose i have three classes A, B and C. class B inherits from class A and the inheritance is private whereas class C inherits from B and the inheritance is public. Now class A has a protected function which class C wants to access. So, what must be done in class B to make th... | <p>The "using" keyword makes a member of an inherited class visible, and resolvable, in the scope of its subclass. So, to make the privately-inherited member available to <code>B</code>'s subclasses:</p>
<pre><code>class A {
protected:
void foo() {}
};
class B : private A {
protected:
using A::foo;
};
cl... |
How to return an object from angular service to controllers <p>I have the following service,</p>
<pre><code> .service('indexDBService', function ($indexedDB, firebaseService) {
var objects = [];
var addToVideos = [];
var _this = this;
firebaseService.getvideosApi().then(function(response){
_th... | <p>Since this is an angular service you should be working with promises. Promises allow you to access asynchronous data, you are using them with firebase and inddxdb services. Im going to assume you are using _this.vobject to cache the data in the service so you don't need to make the request each time. I would inject ... |
Change layer of UI object UWP <p>I have some pics on the Page that I can move and I need change layer on the selected image(e.g. double tap or long press)</p>
<pre><code><Image x:Name="CollageImg1" Margin="1076,464,959,805" Source="{Binding CollageImg1}" ManipulationDelta="CollageImgage1_Manipulation">
<I... | <p>I resolved. </p>
<p>I need change
'ZIndex'. Example: 'Canvas.SetZIndex(xamlImage,(int)layerNumber);'</p>
|
Codeigniter pressing logout button and disable the back browser button <p>Hello guys i am using CodeIgniter Framework, i have a problem within after logout, the session is already destroyed and redirect to login form, and after redirecting to login form, the browser back button can be backed to dashboard but there are ... | <p>You are trying to solve the wrong problem: If going back after logout leads to a page full of errors, going to that page directly would cause the same problem.</p>
<p>This should never occur, instead when someone tries to open a page that should not be opened when not logged-in, the visitor should be directed to th... |
Activity Stack is getting empty <p>I am opening a new intent above another. I am able to go back from second activity to first when I minimise the app by pressing the home button, the activity stack is getting empty. When I re-open the app and try to go back, it minimise the app.
How can I stop the activity stack from ... | <p>Something same was happened with me last month, the reason I found is that I was not calling <code>super.onCreate(savedInstanceState);</code> on my <code>onCreate();</code> method. Track the logcat response.</p>
|
Convert variable string value to expression in JavaScript <p>i am trying to convert a string value to expression so that i can use it in if condition like:</p>
<pre><code>var StringVal = '20 > 18 && "yes" == "yes"';
if(StringVal){
....
}
</code></pre>
<p>is it possible to do this, please suggest me.<... | <p>It's not generally safe to take input from a user source and evaluate it, but you could use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions" rel="nofollow"><code>Function</code></a> evaluation, or <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Obje... |
ios-sending notification with firebase <p>I'm trying to create app with notification. Notification must be sended from php file to firebase and then to device. At first i have tried to send with firebase console and it works perfect. But when i try to send notificaion using php then i have problems. It says successfull... | <p>Hej everybody, i found solution. if someone search hope it will help:</p>
<pre><code>// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR_FIREBASE_API_KEY' );
$registrationIds = array( "devices firebasetoken here." );
// prep the bundle
$msg = array(
'body' => "message text",
... |
How to sort RecyclerView elements with different types? <p>I have a problem with sorting <code>RecyclerView</code> items with different types. For example i have such <code>RecyclerView.Adapter</code>:</p>
<pre><code>public class StudyRVadapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List... | <p>You could make <code>Item0</code> and <code>Item1</code> subclasses of <code>Item</code> (if they are not already).</p>
<p><code>getText()</code> should be a method of <code>Item</code> (which <code>Item1</code> and <code>Item2</code> will inherit).</p>
<p>After that, you can compare them properly, since they are ... |
Generating R Bar plots based on X-axis data ranges <p>I have a data set as below.</p>
<pre><code>Time
1
1
2
2.6
2
2
8.81
3.01
3
5.56
1.6
6.6
</code></pre>
<p>I need to generate a bar plot based on data ranges (Eg. 0-2,2-4,4-6,6-8 etc).</p>
<p>For an example, bar plot will have data as follows. </p>
<p>X axis - Time... | <p>We can create the groups with <code>cut</code>, get the frequency using <code>table</code> and generate the bars with <code>barplot</code></p>
<pre><code>barplot(table(cut(df1$Time, breaks = seq(0, 10, by = 2))))
</code></pre>
<hr>
<p>If we need the custom labels, use the <code>labels</code> argument in <code>cut... |
Avoid hard coding the mysql container ip in my apache container script <p>I have a <code>mysql</code> container which runs fine. I can start it and see it up and running in the docker ps list.</p>
<p>I then try to run another <code>learnitouch</code> container in which an <code>engine-db-seed.sh</code> shell script tr... | <p>Just use the service name and make sure that both services are running on the same network (bridge0 by default).</p>
<p>So if you create your mysql service like this</p>
<pre><code>docker run -d --name foo mysql-image
</code></pre>
<p>your <code>engine-db-seed.sh</code> could then be</p>
<pre><code>/usr/bin/mysq... |
How to display dropdown menu slider effect from bottom to top after hover? <p>I have display drop down menu slider effect from bottom to top after hover with linearly and all drop down text should be display left align.
I tried some code but when i hovered first menu my second menu displaying on right side.would yo... | <p>I thought your problem is stop the second menu slide to right when hover the 1st menu. so adding the position:absolute property to dropdown menu to avoid the second menu sliding. </p>
<p>Now I am adding sideDown() and slideUp() to show or hide the dropdown on menu hover Try below code.</p>
<p><div class="snippet" ... |
Seeding asp.net core Identity Role <p>I'm trying to seed the AspNetRole table with initial system roles. </p>
<p>Seeding Extension:</p>
<pre><code>public static void EnsureRolesAreCreated(this IApplicationBuilder app) {
Dictionary<string, string> roles = new Dictionary<string, string>
{
... | <p>I found the issue. I was missing: </p>
<pre><code>base.OnModelCreating(modelBuilder);
</code></pre>
<p>at the beginning of the ModelCreating function</p>
<pre><code> protected override void OnModelCreating(ModelBuilder modelBuilder){
base.OnModelCreating(modelBuilder);
}
</code></pre>
<p>after making th... |
Get the same SHA-224 sum in Factor as coreutils sha224sum <pre><code>$ echo *
a b c
$ cat *
file 1
file 2
file 3
$ factor -e=" \
> USING: globs io sequences sorting io.files io.encodings.utf8 ; \
> \"*\" glob natural-sort [ utf8 file-lines ] map concat [ print ] each "
file 1
file 2
file 3
</code></pre>
<p>The... | <p>This odd behaviour is due to a bug in checksum-lines. <a href="https://github.com/factor/factor/issues/1708" rel="nofollow">factor/factor#1708</a></p>
<p>Thanks to <a href="https://github.com/jonenst" rel="nofollow">jonenst</a> for finding the problem, and <a href="https://github.com/calsioro" rel="nofollow">calsio... |
Sending an integer array over tcp in c# <p>This may be a stupid question, i apologise if it is. But I'm rewriting some c code into c# to use as part of a GUI, the original c programs transmit data buffers backwards and forwards to a microcontroller via:</p>
<pre><code>n = write(sockfd, buf, sizeof(buf));
</code></pre>... | <p>You can use <code>NetworkStream.Read/Write</code> to read and write byte arrays to a socket. <code>BinaryReader/Writer</code> are abstractions on top of that that make it easier to write in certain formats.</p>
|
Parsing List of image From Json data to Piccaso image loader <p>i have this <a href="https://itunes.apple.com/jo/rss/topfreeapplications/limit=50/json" rel="nofollow">Json Data</a></p>
<p>and i prasing the data in in this json to this ,,</p>
<p><a href="http://i.stack.imgur.com/JlQon.jpg" rel="nofollow">enter image d... | <p>You are trying to load complete <code>list</code> string by doing <code>appShowModule.getAllimage()</code> which is wrong. try to do following.</p>
<pre><code>Picasso.with(context).load(appShowModule.getAllimage().get(position)).into(holder.appImage);
</code></pre>
|
How can I implement x[i][j] = y[i+j] efficiently in numpy? <p>Let <strong>x</strong> be a matrix with a shape of (A,B) and <strong>y</strong> be an array with a size of A+B-1.</p>
<pre><code>for i in range(A):
for j in range(B):
x[i][j] = y[i+j]
</code></pre>
<p>How can I implement equivalent code efficie... | <p><strong>Approach #1</strong> Using <a href="http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.linalg.hankel.html" rel="nofollow"><code>Scipy's hankel</code></a> -</p>
<pre><code>from scipy.linalg import hankel
x = hankel(y[:A],y[A-1:]
</code></pre>
<p><strong>Approach #2</strong> Using <a href="htt... |
omniauth-facebook+devise callback does not get executed <p>I have implemented devise and omniauth-facebook following the instructions below:</p>
<p><a href="https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview" rel="nofollow">https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview</a></p>
<p><stron... | <p>I used the callbacks in a little bit different way:
you should declared the callback in the omniauth.rb file:</p>
<pre><code>Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, "app_id", "password",
scope: 'public_profile', info_fields: 'id,name,link', display: 'popup', call... |
C# Nhibernate query doesn't work <p>I just started learning C# and Nhibernate. I'm trying to solve following problem for hours.</p>
<p>Can anyone see the problem?</p>
<p>Table <strong>Line</strong>:</p>
<pre><code>CREATE TABLE [dbo].[Line]
(
[ID] UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
[Name] ... | <p>There are 2 problems in your code:</p>
<ul>
<li>An entity is named <code>Color</code> and the corresponding table <code>Line_Color</code>;</li>
<li>A property is named <code>ColorS</code> and the corresponding column <code>Color</code>.</li>
</ul>
<p>They must correspond, or you have to tell NHibernate the DB name... |
Qt Quick parent, not the same as the id of the parent <p>I'm playing a bit with <code>Qt Quick</code> and I wanted to create a title bar for my application. So I inherited <code>QQuickPaintedItem</code>, painted a bit on it and wanted to use it as a title bar for my <code>Window</code>. I'm using <code>Qt 5.7</code>. T... | <p>Because <code>titleBar.parent</code> is not <code>wnd</code>, but <code>wnd.contentItem</code> instead. That's why you find its <code>parent</code> is not <code>wnd</code>.</p>
<p><strong>Why <code>wnd.contentItem</code> instead of <code>wnd</code> ?</strong></p>
<p>Generally, any item will become the <code>parent... |
starting BroadcastReceiver from Service when app destroy? <p>i have a probleme with BroadcastReceiver & Service in my application
.......
i have an
* activity ( MainActivity )
* service ( NotifyService )
* Receiver ( NotifyBroadcast )</p>
<h2>service start from activity and then the receiver start from service<... | <p>To prevent service kill use it as foreground service. To perform it as foreground use this (inside Service class):</p>
<pre><code>@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
fg();
}
private void fg() {
Intent intent = launchIntent(... |
AngularJs radio buttons not working <p>Should be simple - what am I doing incorrectly?</p>
<p>In my controller: </p>
<pre><code>$scope.eventShow = {tab: 'stations'};
</code></pre>
<p>and, in a view: </p>
<pre><code>Show:
<span>
<label>Stations</label>
<input type="radio" ng-model="eventSh... | <p>Your code is working correctly for me. what version of angular are you using? I am using this:
<a href="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js" rel="nofollow">https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js</a></p>
<p>or is it possible you do not have ng-controller... |
Row-wise frequency of every word in URL in R <p>I am very new to programming and need some help in R programming for my University project. I want to create a table with frequency of each word. Input file has around 70000 rows of data such as IDs and webURLs visited by that ID user separated by comma in a csv file:For ... | <p>I think there are 2 points to mention here:</p>
<p>1) Reading in your data:</p>
<pre><code>text <- readLines("sample.csv")
</code></pre>
<p>gives you a vector with <code>text[1]</code> being the <strong>full</strong> first line of your data, <code>text[2]</code> being the <strong>full</strong> second line of y... |
Can't remove non-empty folder when using nodejs ftp plugin <p>I'm trying to remove folder with its contents using rmdir method (from <a href="https://www.npmjs.com/package/ftp" rel="nofollow">this</a> npm package) with recursive parameter that is set to true.</p>
<p>Documentation says:</p>
<blockquote>
<p>If recurs... | <p>It is stated: <code>this call will delete the contents of the directory</code>. Not a directory itself.</p>
|
Can I implement a custom security implementation in Hazelcast Opensource? <p>Question is simple: can I implement a concept of security policies or encryption of traffic <em>without</em> having to go with the enterprise license? I ask because I remember this being possible in the earlier versions of hazelcast of 2-3 ye... | <p>I think it's fair to say not easily as this is one of the key features of Enterprise edition that keeps Hazelcast in business. All of the documented entry points seem to be only available with the JAAS based enterprise option.</p>
<p>Comments like the one in this thread</p>
<pre><code> https://github.com/hazelcas... |
Changing JSON Structure in Javascript/Jquery <p>I have an object coming from the server via JSON which is in the below format. I want to rearrange it to another format.</p>
<pre><code>{
visits: [{
week: 1,
count: 3
}, {
week: 2,
count: 3
}, {
week: 3,
count: ... | <p>try this:</p>
<pre><code>var newObj = {}
$.each(a.visits, function(key,obj){ newObj['week'+obj.week] ={visits: obj.count} });
$.each(a.visitors, function(key,obj){ newObj['week'+obj.week].visitors = obj.count});
</code></pre>
|
How to get global variables from jbpm-process within WorkItem <p>I can successfully retrieve global variables (such as NodeInstance, ProcessInstance and so on) from within the process with help of Script-Task and kcontext-instance; But what if I need retrieve those global variables within WorkItem? I could of course pu... | <p>You need to either extend <a href="https://github.com/droolsjbpm/jbpm/blob/6.4.x/jbpm-workitems/src/main/java/org/jbpm/process/workitem/AbstractWorkItemHandler.java" rel="nofollow">AbstractWorkItemHandler</a> or implement your work item handler in a similar way. Then just pass <code>ksession</code> instance as a par... |
Using htaccess to block banned IPs from site but allow them to access one particular file <p>Haven't managed to find any answers to this at StackOverflow, so here goes:</p>
<p>I have a long list of banned IPs that I would like to block from my website entirely, but I would like to redirect them all to a special custom... | <p>Try it like this,</p>
<pre><code>RewriteEngine On
#ip addresses to block
RewriteCond %{REMOTE_ADDR} ^111\.11\.111\.111$
RewriteRule ^ file.html [R=301,L]
</code></pre>
|
Fatal error: Uncaught phpmailerException <p>I'm using <strong>woocommerce</strong>, and other plugins to allow users to add products. When a user adds a new product, the server fails in sending notification, giving this error:</p>
<pre><code>Fatal error: Uncaught phpmailerException:
Invalid address: in /srv/users/ser... | <p>The answer is available in the Exception. The email address of the recepient of the notification or the senders address are somehow invalid.</p>
|
How to control audio file in an inactive tab from a new tab? <p>How to control audio file in an inactive tab from a new tab using JavaScript or any possible way?</p>
| <p>And other styling you can do it by your own,and here is the prototype
<a href="http://jsbin.com/putupu/edit?js,output" rel="nofollow">http://jsbin.com/putupu/edit?js,output</a> </p>
|
Error: Module version mismatch. Expected 47, got 48 <p>I'm writing a Visual Studio Code extension which uses a native node.js module. When I try to debug this extension in vscode I get the error message from above, when loading the native module (when commenting out the <code>require()</code> call no error comes up). I... | <p>Once you know what those numbers in the error message mean it's easy to solve the issue. Simply install the node.js version that is expected. In my case it's <a href="https://nodejs.org/download/release/v5.12.0/" rel="nofollow">node.js 5.12.0</a>.</p>
|
Accessor parameter is giving me null in Laravel 5.3 <p>I am working on one to many relationship between tasks and Projects, i.e. a task can only belong to a single project, and I have used laravel's Accessor to get the selected project in my view in drop down:</p>
<p>my code is as follow:</p>
<pre><code>public functi... | <p>finally I solved the issue by myself I have edit the Accessor as follow:</p>
<pre><code>public function getAssignUserAttribute()
{
return [0 => $this->attributes['assign_user'] ];
}
</code></pre>
<p>Since I required an array so I assigned the current user to the array index 0 and return, in that ... |
How to accept clients in a generic way (tcp / pipe ) with libuv? <p>I would like to have a generic <code>on_connection</code> callback that works with any type of server stream (pipe or tcp), but to accept the connection, you should provide an initialized client...</p>
<p>However <code>uv_stream_t</code> is an abstrac... | <p>You can use uv_handle_t.type, it's not "private". I just realized we haven't documented it, so I created <a href="https://github.com/libuv/libuv/issues/1044" rel="nofollow">an issue</a>.</p>
|
Drupal 8 Headless - Group fields in view <p>I am trying to create a REST export in Drupal 8 from a node. At this moment the JSON response is like this:</p>
<pre><code>[{
"title": "test 2",
"body": "<p>tets<\/p>",
"created": "10-09-2016 15:57",
"field_first_name": "John",
"field_last_name": "Doe"
}, {
"titl... | <p>The default style for a REST view is the <em>Serializer</em> which ships with the <em>rest module</em> as a plugin (in Drupal core at <code>/core/modules/rest</code>). </p>
<p>You can alter the JSON output of your REST view by creating a views style plugin in a custom module, extending the plugin from the rest modu... |
Making image map editable <p>I Am using an image map to identify faces in a group photo using the title attribute:
etc</p>
<p>Can I store the coords and title data in a database and reconstruct the image map?
I've tried (and failed) with this code:</p>
<pre><code> <p><img src="1963.jpg" width="5344" hei... | <p>At first glance (and without seeing the interpreted source) the biggest problem is that some of your area attribute values are not quoted. Your interpreted source would not have quotes around <code>coords</code> or <code>title</code> attributes for each <code>area</code>. Also you can simplify how you're constructi... |
Swift 3.0: Data to JSON [String : Any] <p>Evening, I'm trying to creating an APIClient, but I'm having a problem with a <strong>warning</strong>:
<code>APIClient.swift:53:81: Cast from 'Data' to unrelated type '[String : Any]' always fails</code></p>
<p>In this code I'm trying to convert <strong>Data</strong> into <s... | <p>The right method is:</p>
<pre><code>let json = try JSONSerialization.jsonObject(with: data!, options: []) as? [String : Any]
</code></pre>
<p>Thanks to <a href="http://stackoverflow.com/users/2227743/eric-aya">Eric Aya</a></p>
|
How to get the value of href attribute <p>From source code: </p>
<pre><code><a class="nextinst" data-dismiss="modal" data-toggle="modal" href="#401">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</code></pre>
<p>I want to get <code>#401</code></p>
<p>I have unsuccessfully ... | <p>you can add an ID for that element and call the <code>attr()</code> to get the attribute of href use the this:</p>
<pre><code> function clickIt(){
var val = $("#linkHref").attr("href");
alert(val);
}
</code></pre>
<p><a href="http://i.stack.imgur.com/Jt0OJ.png" rel="nofollow"><img src="http://i.stack.im... |
CSS: How to create special shape <p><a href="http://i.stack.imgur.com/9Hc6n.png" rel="nofollow"><img src="http://i.stack.imgur.com/9Hc6n.png" alt="enter image description here"></a></p>
<p>I would like to create a div as shown above.<br />
I tried to reach my goal like this, but I do not know how to lift the border bo... | <p>Use CSS <code>::before</code> and <code>::after</code> pseudo-elements:</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-css lang-css prettyprint-override"><code>html{
background-color: #fff;
}
div{
w... |
I receive an error when trying to pass a component/prop into a parent component <p>I'm new to react, so this is likely a beginner's error.</p>
<p>Here's my code that I'm working on: <a href="https://github.com/tylerehc/hrs/" rel="nofollow">https://github.com/tylerehc/hrs/</a></p>
<p>It runs fine in that version--that... | <p>You have to rename <code>this.prop</code> to <code>this.props</code> </p>
<pre><code>class ProfileHeader extends React.Component{
render() {
return (<div>{this.props.body}</div>);
}
}
class Profile extends React.Component {
render() {
return(
<div>
hello cow
&l... |
Swift3 optionals chaining in IF conditions bug? <p>This code worked just fine in Swift 2.3 and I don't understand why I have to unwrap <code>TestClass</code> to check if number is bigger than 4. This is whole point of chaining optionals, to save additional call. </p>
<p>Now to make this work, I have to check if <code>... | <p>It's not a bug. It is, alas, intentional. Implicit unwrapping of optionals in comparisons (<code>></code>) has been removed from the language.</p>
<p>So, the problem now is that what's on the left side of the <code>></code> is an Optional, and you can no longer compare that directly to <code>4</code>. You hav... |
How to recursively get properties of a type using reflection? <p>I need to recursively get all <code>DateTime</code> properties of an object. </p>
<p>Currently I'm doing:</p>
<pre><code>public static void GetDates(this object value)
{
var properties = value.GetType().GetProperties();
foreach (var property in... | <p>You are on the right track, but I think your logic is a little reversed. You should be changing date times, and running the same method on everything else:</p>
<pre><code>public static void GetDates(this object value)
{
if(value == null) //if this object is null, you need to stop
{
return;
}
... |
Running another .cs file within the main program.cs file <p>I'm very new to programming in general so I'm sure this question is naive.</p>
<p>So, I wrote a simple magic eight ball program and I wanted to move onto an adventure game, but I thought it would be neat to include the eight ball program in the game, like mak... | <p>Get a look at <a href="http://msdn.microsoft.com/en-us/library/x9afc042.aspx" rel="nofollow">classes</a>.</p>
<p>You will probably want to create a new <strong>class file</strong> and then add your code something like this:</p>
<pre><code>namespace MyApplication
{
class EightBall
{
public static vo... |
Randomly Generated Unique Number <p>I am writing a program for a 1d and 2d array that generates 4096 random and unique integers. I am stuck on my method for determining whether or not an integer has already been used, and if it has, to throw it and get a new integer. Currently, I am getting an out of bounds exception e... | <p>The best way is to use a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Set.html" rel="nofollow"><code>Set<Integer></code></a> to store your already generated numbers in order to easily know if they have already been added/generated or not as next:</p>
<pre><code>Random random = new Random();
in... |
If I knew what was going on here, I wouldn't ask. Error given is: InvalidKeySpecException: Password is not ASCII <p>Ok, so basically, if I am in the console (Intellij) and I type FileScramble.getRandomPW, I get an ASCII password. But if I run the command in the code, I don't. Instead, I get "org.jasypt.exceptions.Encry... | <p>You have only one small, elusive mistake - when you're trying to add the numeric characters 0 - 9, you should add <code>union('0' to '9')</code>, instead of <code>union(0 to 9)</code> - otherwise you're adding non-ASCII characters (unicode values 0 - 9...) and thus getting the (justifiable) exception.</p>
|
Medium Hadoop / Spark Cluster Administration <p>Please let me know if this question is more appropriate for a different channel but I was wondering what the recommended tools are for being able to install, configure and deploy hadoop/spark across a large number of remote servers. I'm already familiar with how to setup ... | <p>If you have some experience in scripting language then you can go for chef. The recipes are already available for deployment and configuration of cluster and it's very easy to start with.</p>
<p>And if wants to do it by your own then you can use sshxcute java API which runs the script on remote server. You can bui... |
Updating help on Powershell on Mac <p>I'm new to Powershell, And i know on Powershell on windows you need to run as administrator to update the help files, but how do you update help files on Powershell on Mac?</p>
| <p>At this time, it does not look like the Update-Help Cmdlet is supported for Mac or Linux. For the time being I would suggest going to the technet website for each help file. </p>
<p>You can get there from the Command Line with the -Online parameter:</p>
<pre><code>Get-Help Write-Output -Online
</code></pre>
<p>o... |
php mysql query not being sent to database <p>Hi i have written this function to register users on my site. it was all working fine until recently the only change i have done is added extra columns into the table could this have an effect on the way i need to write this function?</p>
<pre><code>function register($link... | <p>It will have an effect if the columns are set-up to be NON NULL. If you aren't sure, you can check the table definition with <code>describe</code> in a mysql console.</p>
|
Is there a way to manually install modules for python? <p>I keep running into problems with installing modules for python. Either because the modules themselves aren't able to be downloaded via pip or because of some error or another. </p>
<p>Is it possible to simply download the module as a .zip or tar.gz file (as I ... | <p>As you noticed, you can download a module's source (usually in the form of a <code>.tar.gz</code> archive) from <a href="https://pypi.python.org" rel="nofollow">PyPI</a>. First, unpack the archive, then enter the folder that is created. Assuming that your Python binary is on your path, simply run</p>
<pre><code>pyt... |
Working with OpenXML <p>I am passing XML to SQL Server stored procedure and trying it to store in <code>#temp</code> table.</p>
<p>The stored procedure is given below:</p>
<pre><code>EXEC sp_xml_preparedocument @i OUTPUT
,@XMLDOC
SELECT Id
,UserId
,ModifiedOn
,ModifiedBy
,ModifiedIp
,DetailId
INT... | <p>Totally rewrite answer:</p>
<pre><code>DECLARE @i int,
@XMLDOC VARCHAR(max)= "INPUT XML"
EXEC sp_xml_preparedocument @i OUTPUT
,@XMLDOC
SELECT *
INTO #temp
FROM (
SELECT m.Id,
m.UserId,
m.ModifiedOn,
m.ModifiedBy,
m.ModifiedIp,
COALESCE(det.DetailId, -1) as... |
Protect my video-Save as enabeled <p>I am selling my lessons over my website using woocommerce. I want to protect my video lessons the maximum I can. </p>
<p>First, I tried to use youtube. I have unlisted my videos, embed them to my website but there is a youtube logo that popups at the right bottom corner of the vid... | <p>The best way to protect your video content is using vimeo pro (I am not affiliated anyway to them I just did lots of research on this). The example you gave also use vimeo. Make sure you copyright your videos because anything on the web can be copied by someone with the right knowledge and tools, even if you disable... |
Compaing a method with True <p>I have a question about this code.</p>
<pre><code>$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', 'john@example.com')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . ... | <p>From query command documentation:</p>
<blockquote>
<p>Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or
EXPLAIN queries mysqli_query() will return a mysqli_result object. For
other successful queries mysqli_query() will return TRUE.</p>
</blockquote>
<p>In other words it will return <code>TR... |
Understanding Gossip protocol <p>I'm reading akka cluster documentation and now I'm at the <a href="http://doc.akka.io/docs/akka/2.4/common/cluster.html#Gossip" rel="nofollow"><strong><em>Gossip</em></strong></a> section. I did not understand the following statement:</p>
<blockquote>
<p>Cluster membership is communi... | <p>In the next paragraph the article talks about using vector clocks. It says</p>
<blockquote>
<p>Convergence is implemented by passing a set of nodes that have seen current state version during gossip.</p>
</blockquote>
<p>Note that I have never seen this before in a gossip protocol because it typically converges ... |
Relative jump out of range by <p>I get the message <strong>"(76)Relative jump out of range by 000Eh bytes"</strong> and <strong>(79)Relative jump out of range by 0007h bytes"</strong> whenever I input CMP octal, '3'. I'm supposed to do up until the 7th octal number but it always gives me an error when I try to do the 3... | <p>Add a <code>.386</code> directive to your file to be able to use relative jump instructions with larger offsets introduced with the 80386. Alternatively, find the offending jump and replace it with something like this:</p>
<pre><code> jnz foo ; this jump is too long
</code></pre>
<p>replace with</p>
<pre><code>... |
controller alias for index.html page <p>I have a controller class named "BaseCtrl". This controller class takes care of global functions for the default/root HTML page "index.html". As my understanding of TypeScript (I am a TypeScript newbie), to use a controller for some HTML view, there are 3 things to do:</p>
<p>1)... | <p>There is two ways to link controller with partial:</p>
<ol>
<li>Using route, and you can define <code>controllerAs</code> property in the route object.</li>
<li>By defining <code>ng-controller</code> directive on some element. In this case you still can define alias. Example : <code><div ng-controller="BaseCtrl ... |
Initializing an int variable as in between 2 values in Java <p>I'm totally new to Java, and I'm facing a little problem. Sometimes I need to declare a numerical variable in between two values like <code>int x>=2 && x<=20;</code> but I can't find a way to do that.</p>
<p>For example I have this problem to... | <p>It makes no sense to "initialize a variable between 2 values", as a variable can have only 1 value at a time.</p>
<p>You should give the different possible values to the variable one by one :</p>
<pre><code>int i=1;
while(i<=10){
System.out.println("N x " + i + " = " + (N*i));
i++;
}
</code></pre>
<p><br... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.