input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Apply a custom function to a spark dataframe group <p>I have a very big table of time series data that have these columns:</p>
<ul>
<li>Timestamp</li>
<li>LicensePlate</li>
<li>UberRide#</li>
<li>Speed</li>
</ul>
<p>Each collection of LicensePlate/UberRide data should be processed considering the whole set of data. I... | <ul>
<li><p>While Spark provides some ways to integrate with Pandas it doesn't make Pandas distributed. So whatever you do with Pandas in Spark is simply local (either to driver or executor when used inside transformations) operation.</p>
<p>If you're looking for a distributed system with Pandas-like API you should ta... |
How to pre bundle maps with skobbler maps 3.0? <p>I'm not able to make skobbler maps works with a prebundled map with SDK 3.0.</p>
<p>I uploaded a sample project <a href="https://github.com/augmentedworks/SKMaps_iOS_3" rel="nofollow">here</a> with a London map in the SKMaps.bundle. It cannot render the maps. (please u... | <p>I've create a 3.0.1 (latest version) Swift build (demo project) that has the London map prebundled.
It can be found <a href="https://www.dropbox.com/s/pd85i4304hxdvmd/SKMapsDemoSwift_3_0_1_prebundledLondon.zip?dl=0" rel="nofollow">here</a>.</p>
<p>The demo project is configured to start in offline to indicate that ... |
Alexa Node.js Skills Kit - Need to return callback data before handler is completed <p>I'm attempting to build a simple Alexa skill to return data from an API using the [Node.js ASK] (<a href="https://developer.amazon.com/public/community/post/Tx213D2XQIYH864/Announcing-the-Alexa-Skills-Kit-for-Node-js" rel="nofollow">... | <p>I think you are having a scope issue.
try ...</p>
<pre><code>response.on('end',() => {
this.emit(':tell', str, "test");
});
</code></pre>
|
Unique constraint throwing a QLSTATE[23000]: Integrity constraint violation: 1062 Duplicate because of unique constraint <p>In my mysql database I set the 'email' field as a unique constraint. I don't want two or more users to have the same email address. I created this function to check that. I only want the function ... | <p>The problem is that your function does not actually return anything, it just displays an error message after which PHP will just continue its normal execution. So your "update" query will be executed regardless of whether the email is in use or not. This is what you should do in Email_gogo</p>
<pre><code>function E... |
Configure proxy_pass for intermittent service <p>I'm using Nginx within a Doccker container to host my application</p>
<p>I'm trying to configure Nginx to proxy traffic to the /.well-known/ directory to another container that handles the letsencrypt process to setup & renew SSL certificates, but I don't need that ... | <pre><code>location ^~ /.well-known/ {
resolver 127.0.0.1;
set $upstream letsencrypt;
proxy_pass http://$upstream/.well-known/; # use variables to make nginx startable
}
</code></pre>
|
How do I assign instance of Groovy class to variable in Java class <p>I have a Groovy class like this:</p>
<pre><code>package com.hello
class MyClass {
def myMethod() { println "hello" }
}
</code></pre>
<p>And I want to use this class in a Java class:</p>
<pre><code>package com.hello
public class OtherClass {
... | <pre><code> package com.hello
public class OtherClass
{
MyClass myc=new MyClass();
public void myOtherMethod() {
myc.myMethod();
}
}
</code></pre>
<p>Where OtherClass is Java should work just fine regardless of MyClass being groovy or Java.</p>
<p>If you are stil... |
How to select a special div in jQuery <p>my HTML code looks like this. (I have a special design of radio input)</p>
<pre><code><div class="area" id="area-1">
<div class="input">
<input type="radio" class="active-radio">
<input type="radio" class="no-active-radio>
<input type="radio" c... | <p>You can't concatenate a jQuery object and a string. Use <code>.find()</code> to find the elements that match the selector. Also, the <code>active-radio</code> class isn't on the parents of the radio buttons, it's on the radio buttons themselves, so don't use <code>.parent()</code>.</p>
<pre><code>thisArea.find(".in... |
How to constraint two buttons to be equidistant from the vertical center <p>I'm fairly experienced with using constraints, but up till now everthing I've arranged has been aligned along some vertical or horizonal center.
I've spent all morning sifting through past questions and tutorials but am still unable to arrange ... | <p>Start by setting the "align horizontally in container" constraints. Once you've done that, you can modifiy the <code>constant</code> of both "Align center X" constraints to add an offset, e.g. -10 for the left and 10 for the right button.</p>
|
How to pass a ng-repeat item as a value into Angular Translate? <p>It is easier to display this than explain it. I am trying to do this... </p>
<pre><code><div ng-repeat="label in itemLists">
<input id="{{label}}" type="checkbox">
<label for="{{label}}">{{'food.items.{{label}}' | translate}}<... | <p>You can't have {{}} inside of {{}}.<br>
How about <code>'food.items.' + label</code>?</p>
|
How can I display only a particular line of the batch file output using C# <p>I am creating a C# windows form application which would automatically detect the device connected to COM ports and display the COM port number in a label or text box. For easier implementation, I have created a batch file which gives me the i... | <p>You have to "parse" the content you read from the other process to extract the required information/line.</p>
<p>One simple implementation could look like this:</p>
<pre><code>string result = reader.ReadToEnd();
string[] lines = result.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length... |
How to get process information in C++ Commandline app on Xcode <p>I'm writing a Commandline app on Xcode with C++ and am trying to replace the deprecated methods <code>KillProcess()</code>, <code>GetNextProcess()</code>, and <code>CopyProcessName()</code>. Documentation recommends using NSApplication-related methods bu... | <p>NSApplication is a Cocoa object, targeted for Objective-C or Swift development, not C++ development (though you could use Objective-C++).</p>
<p>You need to add a source file with the extension .swift or .m (or .mm for Objective-C++) to your project and #import the Cocoa headers, then write code in the appropriate... |
Check if linklist is not empty before getNode method <p>I have a sort of convoluted question. I'll try my best to explain. I am working on a Adobe CQ codebase that is JCR and Java-based.</p>
<p>I have a Java ArrayList declaration like this:</p>
<pre><code>ArrayList<Map<String,Property>> list6 = new ArrayL... | <p>You can validate if the node exists by using <a href="https://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/api/jsr283/Session.html#nodeExists(java.lang.String)" rel="nofollow">Session.nodeExists(String)</a> method.</p>
<pre><code>if (session.nodeExists(currentNode.getPath + "/linkSet6")) {
...
}
</code><... |
C++ set default arguments with #define <p>Can I set default arguments to a #defined value?</p>
<pre><code>#define WIDTH 1920
#define HEIGHT 1080
void calculate(int width = WIDTH, int height = HEIGHT) {
//do stuff
}
</code></pre>
| <p>You <em>can</em> use <code>#define</code>. But should you?</p>
<p><code>#define</code> ignores scope, and has <a href="http://stackoverflow.com/questions/4715831/why-is-define-bad-and-what-is-the-proper-substitute">other problems</a>. This code will work just as well, without making anyone gasp in horror at unnec... |
sqlMapConfig file not found <p><a href="http://i.stack.imgur.com/vmczI.png" rel="nofollow"><img src="http://i.stack.imgur.com/vmczI.png" alt="enter image description here"></a>Am facing weird issue while trying to launch my web application</p>
<pre><code>Could not find resource sqlMapConfig.xml
</code></pre>
<p>my pr... | <p>Put it back into <code>/resources</code> and do:</p>
<pre><code>String resource = "classpath:sqlMapConfig.xml"
</code></pre>
|
Scraping values from a webpage table <p>I want to create a python dictionary of color names to background color from this <a href="http://people.csail.mit.edu/jaffer/Color/M.htm" rel="nofollow">color dictionary</a>.</p>
<p>What is the best way to access the color name strings and the background color hex values? I wan... | <p>Just look for the tds with nowrap, extract the text and get the following siblings td's <em>style</em> attribute:</p>
<pre><code>import requests
from bs4 import BeautifulSoup
page = requests.get('http://people.csail.mit.edu/jaffer/Color/M.htm')
soup = BeautifulSoup(page.content)
for td in soup.select("td[nowrap]")... |
React Native on Android - ScrollView with pictures has terrible performance <p>On iOS, ScrollView (horizontal) works but when on Android the ScrollView is terribly slow and unusable.</p>
<p>I get this error many times:</p>
<pre><code>I/Choreographer: Skipped 240 frames! The application may be doing too much work on ... | <p>Reducing the image sizes worked for me.</p>
|
Rails 4.2.6 - Devise 4.2.2 - Default Auth <p>I am looking to set a secondary password by which I can authenticate a user for a login as from admin. The reason for this work around is the front end is a single page application. </p>
<p>Each user has been given a unique login_as string. now I need to configure Devise to... | <p>This <a href="https://insights.kyan.com/devise-authentication-strategies-a1a6b4e2b891#.arimvcdjy" rel="nofollow">post</a> from Duncan Robertson was very helpful in solving my issue. I essentially created an override strategy and called it in the devise.rb file. I had some concern regarding tampering with a large use... |
Arduino communication through serial monitor <p>I've taken my Arduino out of the box about an hour ago and I'm trying to get some bits of code working.
The code below is supposed to wait for an input from the Serial monitor and set the led connected at terminal 9 to the input value.
The Arduino reads the value the firs... | <p>According to the rest of code the <code>Serial.parseInt()</code> should be used instead of reading one character by <code>Serial.read()</code>.</p>
|
non-rectangular shapes with css only? <p>I would like to have logos and text in rectangle shapes with the corners cut off. Do I need to use an SVG or can I do it in pure css?</p>
<p><a href="http://i.stack.imgur.com/CreN5.jpg" rel="nofollow">funky square shape</a></p>
<p>I know its possible to make circles, triangles... | <p>example from my comment:</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>div {
/* demo purpose */
margin:0.5em;
height:100px;
width:100px;
display:inline... |
How to store a digit string into an arbitrary large integer? <p>Let <code>ib</code> be the input base and <code>ob</code> the output base. <code>str</code> is the ASCII representation of some arbitrary large integer <code>x</code>. I need to define <code>f</code> such as:</p>
<pre><code>f(str="1234567890", ib=10, ob=1... | <p>I wrote this with older specifications, so it's not valid any more, but it might be useful as a starting point.</p>
<p>The code can handle <code>long long</code> magnitudes. Going to arbitrary precision numbers in C is a big leap!</p>
<p>Note using <code>-1</code> as the ending marker instead of <code>0</code>. Ca... |
Change multiple columns with one single migration change <p>I have the following migration. Is there a way to run these changes in one change than 3?</p>
<pre><code>def change
change_column :comments, :attr_1, :string, null: true
change_column :comments, :attr_2, :string, null: true
change_column :comments, :attr_3... | <p>The short answer is no. The <code>change_column</code> method is configured to take arguments for table name, column name, and an options hash. The source code for <code>change_column</code> can be found here: <a href="https://github.com/rails/rails/blob/0fe76197d2622674e1796a9a000995a7a1f6622b/activerecord/lib/acti... |
How to pass more than one argument in component function in React <p>How to pass more than one argument in components function in React</p>
<pre><code> function Ads(product_title, description) {
return(
<div className = "row" id="user-ads">
<div className = "col-sm-6 col-md-5">
<div... | <p>In the example you provided, <code>product_title.desc</code> should have the value you're looking for. When you're calling <code><Ads title="PlayStation 4" desc="Lorem ipsum jipsum Lorem ipsum jipsum"/></code>, both <code>title</code> and <code>desc</code> will be passed to your component function as propertie... |
Using column name as a variable how to drop an entire column from a data.frame in R <p>Using column name as a variable how to drop an entire column from a data.frame in R. For example if I am given this data.frame:</p>
<pre><code>>data<-data.frame(x=1:10,y=20:30,z=30:40)
>name="x"
>data$name<-NULL
</cod... | <p>Lots of ways:</p>
<pre><code>df <- data.frame(x=1:10, y=21:30, z=31:40)
str(df)
## 'data.frame': 10 obs. of 3 variables:
## $ x: int 1 2 3 4 5 6 7 8 9 10
## $ y: int 21 22 23 24 25 26 27 28 29 30
## $ z: int 31 32 33 34 35 36 37 38 39 40
col_name <- "x"
</code></pre>
<p>This:</p>
<pre><code>df &... |
Python file.close() and with() behavior in high frequency loops <p>I am working with a Raspberry PI and outputting a value from a sound sensor using a python script. In order to display this, I use an HTML page on my PI that calls a javascript include which is simply a single line that defines a value that will be used... | <p>The <code>.close()</code> is definitely not needed. At issue is your browser reading the file <em>while it is still open anyway</em> and finding it in a truncated (so empty) state from time to time. And you can never close the file fast enough to prevent this.</p>
<p>What you should do instead is write the file to ... |
How can I execute the results of compile_file? <p>compile_file() creates some output files. None of these can be used with load() or loadfile() or batch() or can from the shell commandline. And there is no example how one can use them. </p>
| <p>Here is <a href="https://sourceforge.net/p/maxima/code/ci/master/tree/tests/rtest_translator.mac" rel="nofollow">an example from the test suite.</a></p>
<pre><code>(kill (all),
lisp_name : ssubst ("_", " ", build_info()@lisp_name),
maxima_filename : sconcat (maxima_tempdir, "/tmp-rtest_translator-compile_file-", ... |
Escape Apostrophe in Selenium <p>I am trying to escape an apostrophe in Selenium. Sample text below</p>
<pre><code><a title="My Day's Schedule"></a>
</code></pre>
<p>I am trying to search for this element using <code>//a[contains(@title , 'My Day's Schedule')]</code> , but this would not work since the ap... | <p>Why don't we use css here.?</p>
<p>Try to use the following which specify that the title of an anchor should ends with 'Schedule'</p>
<p><strong>CSS selector:</strong>
a[title$='Schedule'] </p>
<p>Even if you want to go with xpath expression then please use the following</p>
<p><strong>xpath:</strong> </... |
How to access prior rows within a multiindex Panda dataframe <p>How to reach within a Datetime indexed multilevel Dataframe such as the following: This is downloaded Fin data.
The tough part is getting inside the frame and accessing non adjacent rows of a particular inner level, without specifying explicitly the outer ... | <p>You can use:</p>
<pre><code>#add new datetime with data for better testing
print (df)
ABC DEF GHI
Date STATS
2012-07-19 NaN NaN NaN
investment 4.0 9.0 13.0
price 5.0 8.0 1.0
quantity 12.0 9.0 ... |
Excel, How to write a formula that fits these criteria <pre><code> A B C D E F G
1 Date: 9/15/2016 9/16/2016 9/17/2016 9/18/2016 9/19/2016 9/20/2016
2 Points: 0.5 1 - - 0.5 1
</code></pre>
<p... | <p>Use this array formula:</p>
<pre><code>=IFERROR(INDEX('Tab1'!$B$1:$G$1,MATCH(1,('Tab1'!$B$2:$G$2<>"")*(COUNTIF($A$1:A1,'Tab1'!$B$1:$G$1)=0),0)),"")
</code></pre>
<p>Being an array formula it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done correctly then Excel wil... |
Javascript: Looping sound with buttons. Error with boolean <h3>CSS</h3>
<pre><code>.btnMusic {
background-color: #4CAF50;
/* Green */
border: none;
color: white;
padding: 50px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
width: 130px;
height: 130px;
m... | <p>When you play a sound with looping option true what your code does is, is adds an event listener if loop condition is true. What you probably want to have is to check for the looping condition inside your listener.</p>
<p>Example of adding listener to one of the buttons.</p>
<pre><code> sound_beat.addEventListe... |
Print all variables captured by closure <p>How do I print out all variables that are captured by a closure? For example:</p>
<pre><code>func myScope() {
users := GetUsers("John")
services := GetServices("Movies")
allVariablesString := func() string {
return PrintAllCapturesWithoutSpecified()
}()
}
</code><... | <p>This is impossible in Go. You can't ask for your surrounding environment in a closure. It's there to use, but you can't view/read it. You could do something weird like have them in a struct and view your struct, but depending on what you do, that could get very messy and non-idiomatic.</p>
|
How to send additional attribute to assigned method? <p>I found in internet such solution as:</p>
<pre><code>def is_owner(self):
if self.request.user.profile_url == self.kwargs['profile_url']:
return True
else:
raise PermissionDenied
class CompanyProfileUpdateView(LoginRequiredMixin, UserPasse... | <p>You can't without making changes to <code>UserPassesTestMixin</code>. An easier solution may be to supply a <code>kwarg</code> to the view in the urls.py file or create a new subclass of the View with a different <code>profile_type</code> property on the class.</p>
<p>For example:</p>
<pre><code>class CompanyProfi... |
Unable to understand this Template parameter <p>Maybe it's flu, or I'm just plain stupid, but I can't understand a part of <a href="https://github.com/ipkn/crow/blob/master/include/http_connection.h" rel="nofollow">this</a> Crow framework code. My inner C++ parser fails. </p>
<pre><code>template <typename MW>
st... | <p><code>void (T::*)(int, typename MW::context&) const</code> is a non-type <a href="http://en.cppreference.com/w/cpp/language/template_parameters">template parameter</a>.
It is a pointer to a member function of <code>T</code>.</p>
<p>With the use of <code>= &T::before_handle</code>, its default value is set t... |
Add horizontal lines in categorical scatter plot using ggplot2 in R <p>I am trying to plot a simple scatter plot for 3 groups, with different horizontal lines (line segment) for each group: for instance a hline at 3 for group "a", a hline at 2.5 for group "b" and a hline at 6 for group "c".</p>
<pre><code>library(ggpl... | <p>Never send a line when a point can suffice:</p>
<pre><code>library(ggplot2)
df <- data.frame(tt = rep(c("a","b","c"),40),
val = round(rnorm(120, m = rep(c(4, 5, 7), each = 40))))
hline <- data.frame(tt=c("a", "b", "c"), v=c(3, 2.5, 6))
ggplot(df, aes(tt, val))+
geom_point(data=hline, aes... |
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat <p>I have updated the AppCompat libraries to 24.2.1 and the SDK to Android 7 in my Eclipse install.
Since that, I'm not capable to run any of my apps.
I appreciate if you can help a bit with that...</p>
<pre><code>E/AndroidRuntime... | <p>You are getting <strong><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html" rel="nofollow">NoClassDefFoundError</a></strong> & <strong><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/ClassNotFoundException.html" rel="nofollow">ClassNotFoundException</a></strong></... |
flexbox with multi column layout and mobile div box ordering <p>I'm trying to create attached box layout with flexbox. </p>
<p><img src="http://i.stack.imgur.com/aCP0n.png" alt="boxlayout"></p>
<p>My example code is below.
My challenge is not mobile but desktop view - box item 1 and 2 are not 1 column in this layout... | <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>.wrapper {
margin: -10px -10px -10px 180px;
}
.wrapper > * {
padding: 10px;
}
.flex{
display: -webkit-box;/* A... |
cannot resolve constructor 'class_name(java.lang.String)' <p>I'm trying to store data in database when clicking add button but an error appears when I created an object in MainActivity.java class with database class as shown <a href="http://i.stack.imgur.com/FTJt0.jpg" rel="nofollow">enter image description here</a> </... | <p>Looking at your code I suspect that value passed as course.getText().toString() is actually an empty string. Usually with Java objects the .getText() returns a String so there is no need for the toString(). </p>
<p>Try rewriting that piece of code as:</p>
<pre><code>database database1 = new database( course.getTe... |
Adding foundation to webpack <p>I have followed the official tutorial to set up react, typescript and webpack from here: <a href="https://www.typescriptlang.org/docs/handbook/react-&-webpack.html" rel="nofollow">https://www.typescriptlang.org/docs/handbook/react-&-webpack.html</a></p>
<p>Until this point it ru... | <p>At first, foundation is installed as
<code>npm install --save foundation-sites</code></p>
<p>then you need to include foundation in your root css file like </p>
<pre><code>@import 'foundation';
</code></pre>
<p>and finally you need to alias it inside webpack config. For example when you are using sass loader </p... |
Changing BroadcastReceiver to existing users <p>When we make changes to a BroadcastReceiver and update the app on the Play Store, what happens to users who already had that BroadcastReceiver scheduled from an AlarmManager? Does it get canceled?</p>
| <p>No, alarms are managed at the OS-level so reinstalling your app does not interrupt them. Otherwise, your app would be dead until it could receive some other arbitrary broadcast like boot complete.</p>
|
CakePHP: Send all variables to an element from within another element <p>Imagine I have a very complex app. I have a controller that calls <code>characters.ctp</code>. Lots of DB work is done here for all the "characters".</p>
<p>Within <code>characters.ctp</code>, I call the <code>monsters</code> element. It prints o... | <h1>Using the <code>set()</code> method inside your element</h1>
<p>With all the DB work done in the <code>characters</code> controller, you should do some controller job inside <code>monster</code> by re-setting the variables carried by <code>monster</code> using <a href="http://api.cakephp.org/2.8/class-View.html#_s... |
Parse json tags in C# <p>I have a json file that looks something like this:</p>
<pre><code>{
"versionTitle": "Title",
"sectionNames": [
"Section1",
"SubSection",
"SubSubSection"
],
"language": "he",
"title": "Title, subtitle",
"text": [
[
[
"<big><b>some text </... | <p>You need to parse them as XML because that is the what you have in the text field. You can use the built in XML parser to do that.
<a href="https://msdn.microsoft.com/en-us/library/system.xml.xmldocument(v=vs.110).aspx" rel="nofollow">XmlDocument</a>, it does get a bit more complex but you are using more then just ... |
dealing with types in kwargs in Julia <p>How can I use <code>kwargs</code> in a Julia function and declare their types for speed?</p>
<pre><code>function f(x::Float64; kwargs...)
kwargs = Dict(kwargs)
if haskey(kwargs, :c)
c::Float64 = kwargs[:c]
else
c::Float64 = 1.0
end
return x^2... | <p>As noted in another answer, this really only matters if you're going to have a type instability. If you do, the answer is to layer your functions. Have a top layer which does type checking and all sorts of setup, and then call a function which uses dispatch to be fast. For example,</p>
<pre><code>function f(x::Floa... |
Cypress utilizing Gitlab Variables <p>I am currently using Cypress as my testing tool, and have been running into a slight problem when running it on gitlab ci.</p>
<h1>The Problem</h1>
<p>Part of my Cypress test currently uses sensitive Credit Card Information, so when I uploaded it into a gitlab repository I had to... | <p><a href="https://docs.cypress.io/docs/environment-variables#section-option-3-export-as-cypress_" rel="nofollow">There are multiple ways to pass a secret variable to a Cypress test.</a> Here are a few ways you could do it:</p>
<p><strong>Environment Variables in CLI</strong></p>
<ul>
<li><p>Pass in the secret varia... |
How to define table structure for storing logic gate data? <p>I have table A with a bunch of rows and columns in sql. When accessing each row in code it is evaluated into true or false. </p>
<p>I want to make another table B which relates to rows in table A and defines a logic circuit.</p>
<p>So for example if I have... | <p>I don't know how you're thinking of coding this, but here's the structure for TableB that I would start with:</p>
<pre><code>CircuitID TableARowID Position
</code></pre>
<p><code>CircuitID</code> + <code>Position</code> would be the Primary Key. So to build each circuit, you evaluate each Table A Row as... |
Not supported by Swagger 2.0: Multiple operations with path WebApi2.0 <p>I have integrated swagger in WebApi 2 application. It works fine when application has single controller.
When I added second controller in the application. I got following error : </p>
<p><strong>500 : {"Message":"An error has occurred.","Except... | <p>How about <a href="https://github.com/domaindrivendev/Swashbuckle#working-around-swagger-20-constraints" rel="nofollow">reading the docs</a>? It says Swashbuckle does not support this kind of method signatures. You can however create an operation filter to set the id or use the <code>SwaggerOperationAttribute</code>... |
How to write an sdcard image programmatically? <p>I need to write an image (e.g. .iso, .img) to an SD card. The use shouldn't matter, but it happens to be writing a bootable image to an sdcard for a rasperry pi.</p>
<p>On Linux/Mono, I would do something along the following:</p>
<pre><code>using (var stream = File.Op... | <p>In the end, I chose to just execute RuFus:</p>
<p><a href="https://rufus.akeo.ie/" rel="nofollow">https://rufus.akeo.ie/</a></p>
<p>A fully integrated solution would be nicer, but this was an easy way to just 'maie it go'.</p>
|
Unity VR autoclick after few seconds <p>I am using the GoogleVR package and I have this reticle which works (in the sense that it makes an object I am looking at bigger). The behavior I would like, is to click by looking on object for about three seconds. The object currently has an event trigger, but how can I wait fo... | <p>When you look at the object, the trigger is activated right?
Then when you detect the trigger up just make a function that waits for 3 seconds and and then do what you want.</p>
<p>Dont forget to stop the wait if the user starts looking somewhere else.</p>
|
Blank space being produced from for loop for dates <p>I have a loop that iterates through each date between two selected dates.</p>
<p>It creates a panel for each product on that date and then moves on.</p>
<p>That works fine, but if I run the loop again, it produces a blank space between the new panels and the old p... | <p>So the end Code looks like this and the space is now non existent.
Thanx to all.</p>
<pre><code>private void AddProducts()
{
foreach (Panel p in pnlReport.Controls.OfType<Panel>())
{
if (p.Name == last)
{
globalY = p.Location.Y + 140;
}
... |
OutOfMemoryException when reading Excel .xlsx file in C# using ExcelLibrary <p>I'm trying to read an excel file (.xlsx) in Visual studio Windows application using <code>C#</code>. I am using the <code>Google Excel Library</code> from this link <a href="https://code.google.com/archive/p/excellibrary/" rel="nofollow">Exc... | <p>Since you are working with an ".xlsx" file you should use the "Microsoft.Office.Interop.Excel" and "Office" references from GAC.</p>
<p>These should be already installed on your computer assuming that you have the Microsoft Office already installed on your computer. </p>
|
Removing title of a DialogFragment <p>I have been trying for a while to remove the title of a DialogFragment, but several attempts have failed. I tried with these:</p>
<pre><code><style name="dialog" parent="@android:style/Theme.Holo.Dialog">
<item name="android:windowNoTitle">true</item>
</st... | <p>Create your dialog normally, and add a line like this before showing: </p>
<p><code>myDialog.getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);</code></p>
<p><strong>Edit:</strong>
added the <code>.getDialog()</code> call </p>
<p><strong>Edit 2: Tested with the link of your example</strong></p>
<p>I h... |
Pass by Pointer Objective C - Linked List <p>I am working on this problem to <strong>return the Kth to Last element of a singly linked list</strong></p>
<p>I am trying to implement this C solution which passes the value by reference. and do so in Objective C passing by pointer</p>
<p>Currently the code runs infinite... | <p>Just out of curiosity, why are you trying to do this in Obj-C? You can compile using C++. I am asking because you don't seem to have a grasp of pass by reference versus pointers. Additionally if you did want to do this in Obj-C, you can still do pass by reference. </p>
<p>In any case you have a few problems with yo... |
Difference between MVC 5 Layout Page (Razor) and Layout Page (Razor v3) <p>I am following a tutorial ASP.NET MVC 5 from scratch, and right now I should add a _Layout.cshtml page in the Shared folder. Right clicking the Shared folder, I noticed in the context menu that you can add a 'MVC 5 Layout Page (Razor)'. But in t... | <p>Razor version 3 is the latest stable version.</p>
<p>If you are building an <strong>MVC</strong> site then use</p>
<ul>
<li>Add -> New Item -> Visual C# -> Web -> <strong>MVC</strong> -> MVC5 Layout Page (Razor)</li>
</ul>
<p>The other option is for a <a href="http://www.asp.net/web-pages/overview/getting-started... |
Not able to set bottom Div just below the adjacent top Div <p><a href="http://i.stack.imgur.com/tp65Y.png" rel="nofollow"><img src="http://i.stack.imgur.com/tp65Y.png" alt="Image of Issues"></a> </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippe... | <p>You are trying to make a footer.<br>
To make a footer snatch to the bottom.<br>
Instead of typing inline CSS, make a CSS file and call it in the HTML page by writing: </p>
<pre><code><head>
<link rel="stylesheet" href="styles.css">
</head>
</code></pre>
<p>In the <code><head></code> secti... |
Image to Array: Plain English <p>I'm starting to use numpy and PILlow to work with image files. And, generally loosing myself when it comes to converting images to arrays, and then working with arrays.
can someone explain what is happening when I convert an image to array. Such as this:</p>
<pre><code>ab = numpy.asar... | <p><strong>What is a digital image?</strong></p>
<p>A digital image is a set of pixel values. Consider this image: <a href="http://i.imgur.com/wlDQhpL.png" rel="nofollow"><img src="http://i.imgur.com/wlDQhpL.png" alt="small smiley face"></a>. It consists of 16x16 pixels. Because most displays have 8 bits (2^8 (256) p... |
How to print Racket structs <p>Is there any way to control how a struct is printed?</p>
<p>For example if I have a transparent struct containing an image:</p>
<pre><code>(struct photo (label image-data) #:transparent)
</code></pre>
<p>But I don't want to print the <code>image-data</code> field.</p>
| <p>I want to extend Ben's answer a bit. You can also combine <a href="http://docs.racket-lang.org/reference/Printer_Extension.html?q=gen%3Acustom-write#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._gen~3acustom-write%29%29" rel="nofollow"><code>gen:custom-write</code></a> with <a href="http://docs.racket-lang.org... |
Scala: How to override implicit constructor parameters? <p>I am currently working on a little scala DSL for Android (<a href="https://github.com/bertderbecker/scalandroid" rel="nofollow">https://github.com/bertderbecker/scalandroid</a>).</p>
<pre><code>val drawerLayout = new SDrawerLayout {
openDrawerFrom = SGravi... | <p>Self types:</p>
<pre><code>val drawerLayout = new SDrawerLayout {drawer =>
openDrawerFrom = SGravity.LEFT
fitsSystemWindows = true
navigationView = new SNavigationView {
println(drawer.parent) //None
layout = SLayout.NAVI_HEADER_DEFAULT
fitsSystemWindows = true
}
}
... |
VBA ADO query on Excel workbook <p>I have the following code to retrieve data from another workbook. However I want the SQL code take into account a where clause. This where clause should be applied on one of the columns. Up till now my code works but not after adding the where clause. The column header is Cost_center.... | <p>I'm guessing you are not getting cost centers that contain "5560" but would get cost centers that are exactly "5560."</p>
<p>The problem is in this line:</p>
<pre><code>strSQL = "SELECT * from [sheet1$] WHERE [COST_CENTER] LIKE 5560"
</code></pre>
<p>The <code>LIKE</code> statement requires wildcard characters. ... |
Calling out a function, not defined error <p>I'm new to making classes and I'm trying to complete exercise 9-1 in my 'Python Crash Course' book where the last part of the question asks me to call back my method but I end up getting</p>
<blockquote>
<p>'not defined error' for <code>describe_restaurant()</code>.</p>
<... | <p>Try:</p>
<pre><code>class Restaurant():
def __init__(self, r_name, c_type):
self.r_name = r_name
self.c_type = c_type
def describe_restaurant(self):
print(self.r_name)
print(self.c_type)
def open_restaurant(self):
return "{} is now open!".format(self.r_name)
re... |
ConstraintLayout's blueprint does not match the final design <p>As I have updated to <code>Android Studio 2.2</code>, I tried new <code>ConstraintLayout</code> to create a simple Activity. Surprisingly, <code>alpha 8</code> (currently the most up-to-date) is really buggy, causing multiple resets in the blueprint stage.... | <p>If you updated from alpha7 to alpha8 (which is probably the case if you downloaded Android Studio 2.2), you may need to rebuild your project and/or do File->Invalidate Caches in Studio -- though restarting Studio should have been enough. Tell me if that works for you.</p>
<p>Also; on which environment are you runni... |
Div element to overlap wrapper div into the previous div <p>I'm trying to get the icon in the second wrapper div to cross up and dissect the previous wrapper div but the half that is supposed to appear in the div above will not appear. Even with a higher z-index. If I change the wrapper div overflow or position styles,... | <p>There is no table display necessary. What you need are actual heights for all elements - auto height won't work with no content, and 100% height only works if the parent container's height ( in this case body) is also defined. I made the body 100% and the two wrappers 50% . </p>
<p>The circle DIV has been centered ... |
write nodejs web application like php <p>How can I write <code>nodejs</code> (with and without express framework) app that do such think in <code>php</code>: </p>
<pre><code><doctype hyml>
<html>
<body>
<h1> <?php echo "Hi"; ?> </h1>
</body>
</html>
</code></pre>
<p>wi... | <p>You will have to setup your node.js project to use a template engine like jade.</p>
<p><strong>app.js</strong></p>
<p>By doing that you need to install jade with npm and require the dependency into your project.</p>
<pre><code>var express = require('express');
var jade = require('jade');
var app = express();
</co... |
Microsoft Visual Studio C# Setup <p>I've managed to get Visual Studio 2015 Community Edition working on my machine,</p>
<p>I had a specific question about settings configuration for C# prioritization.</p>
<p>Tools > Import and Export Settings > Have all been reset to the best configuration for C#. </p>
<p>Whenever I... | <p>Configuring both the menu bar and tool bar can be done via Tools->Customize.</p>
|
Custom Actions triggered by Parsed values in Python <p>I am looking to build or more preferably use a framework to implement custom Assertions in python. I am listing below potential input that will be parsed to trigger the various assertions on retrieved data </p>
<pre><code>assertValue : [ SOME STRING A ]
or
ass... | <p>Maybe you're looking for something along the lines of one of <a href="https://github.com/cucumber/cucumber/wiki/Python" rel="nofollow">Cucumber's Python ports? </a></p>
|
Python Break Inside Function <p>I am using Python 3.5, and I would like to use the <code>break</code> command inside a function, but I do not know how.
I would like to use something like this:</p>
<pre><code>def stopIfZero(a):
if int(a) == 0:
break
else:
print('Continue')
while True:
stopI... | <p>Usually, this is done by returning some value that lets you decide whether or not you want to stop the while loop (i.e. whether some condition is true or false):</p>
<pre><code>def stopIfZero(a):
if int(a) == 0:
return True
else:
print('Continue')
return False
while True:
if sto... |
How to import enum in Typescript <p>I have the following two files: bag.js</p>
<pre><code>import {BagType} from "./bagType" //this line of code gives an error message: bagtype.ts is not a modul
import {Present} from "./present";
export class Bag {
private maxWeight: number;
private bagType: BagType;
... | <p>I tried it and it worked with:</p>
<pre><code>export enum BagType{
Canvas,
Paper
}
</code></pre>
<p>and </p>
<pre><code>import {BagType} from "./bagType";
</code></pre>
|
Impala: change the column type prior to perform the aggregation function for group by <p>I have a table, my_table:</p>
<pre><code>transaction_id | money | team
--------------------------------------------
1 | 10 | A
2 | 20 | B
3 | null ... | <p>Per documentation provided by Cloudera your query should be working as-is. Both <a href="https://www.cloudera.com/documentation/enterprise/5-5-x/topics/impala_avg.html" rel="nofollow">AVG Function</a> and
<a href="https://www.cloudera.com/documentation/enterprise/5-5-x/topics/impala_sum.html" rel="nofollow">SUM Fun... |
angularjs 2.0: Can't inject anything through component constructor() <p>I am creating a sample application in angularjs 2.0. While developement I came across with a serious problem - I can't inject anything to the component through the constructor function.</p>
<p>This is the plnkr url : <a href="https://plnkr.co/edit... | <p>I see that your tsconfig.json isn't correct.</p>
<pre><code>{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true, <== it should be true
"experimentalDecorators": true,
"removeComments": fa... |
PHP echo results under single date header <p>I have a large database that I am querying. There are multiple results that share the same "Date". SO, I might have 5 results today and 8 results yesterday and so on.</p>
<p>I echo the result so that each article has the "date" below the title right now. But, I am searching... | <p>1) Do not use do..while, use only while
2) </p>
<pre><code><?php $current_date = '';
while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)){
if($current_date !== $row_Recordset2['date']){
echo '<b>' . date('M. j, Y', ($row_Recordset2['date'])) . '</b>';
$current_date = $ro... |
Directory with a number of files and subdirectories: I need to move those files into each subdirectories,as per file name in Ruby <p>I have one directory with a number of files and subdirectories. I need to move those files into each subdirectories, depending on their naming. For instance:</p>
<p>Files:</p>
<pre><cod... | <p>Don't rush, try to solve your problem step by step. I would solve your problem in the following steps:</p>
<p><strong>1. Separate files from subdirectories</strong></p>
<pre><code>subdirectories, files = Dir['/path/to/the/directory/*'].partition{|path| File.directory?(path)}
# TODO ...
</code></pre>
<p><strong>2.... |
BluetoothLeScanner null object reference <p>I have a problem regarding my Bluetooth app. When I enable Bluetooth before starting up the app everything works alright. But when I don't, my app will ask permission to enable Bluetooth via the turnOn method. But when I press my onScan button I get a error stating:</p>
<pre... | <p>Try this (taken from one of my projects):</p>
<p>Class variable:</p>
<pre><code>private BluetoothAdapter mBtAdapter = null;
</code></pre>
<p>Inside <code>onCreate</code>:</p>
<pre><code>final BluetoothManager btManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBtAdapter = btManager.g... |
Two distinct forms doing just one POST through PHP and AJAX <p>I've made two pages, each one with a <code>form</code> sending a selected image to localhost through a ajax script pointing to a save.php (containing the code to rename, realocate, and update MySQL with the destination folder/filename.</p>
<p>The first for... | <p>I solved the problem changing the script to this:</p>
<pre><code><script type="text/javascript">
$(function(){
$('form').submit(function(){
var dados = new FormData();
dados.append('fotoNumMotor', $('#f_nmotor').prop('files')[0]);
$.ajax({
url: 'salvar.php',
data: dados,
type: 'POST',
processData: false,
c... |
Excel in Mac showing '_' instead of accents when generating report through console <p>I have a huge query with a lot of relationships, joins and DB functions involved. Here an extract example of the query:</p>
<pre><code>SELECT * FROM (
SELECT DISTINCT
CASE WHEN objeto.objeto_clave IS NULL THEN objeto.obj... | <p>After a day of research and viewing some other questions in this site</p>
<p>I found its related with Mac's excel version encoding support:</p>
<blockquote>
<p>Mac does not currently support UTF-8</p>
</blockquote>
<p>then i saw some work-arounds to deal with this issue and most of them pointed to use a third p... |
When do I need android.hardware.location.gps and android.hardware.location.network? <p>Google is informing by email of changes to the Android location permissions:</p>
<blockquote>
<p>Weâre making a change on October 15th, 2016 that will affect apps
targeting API version 21 (Android 5.0, Lollipop) or higher that... | <p>The second quotation is telling you that you need either <code>android.hardware.location.network</code> or <code>android.hardware.location.gps</code>, if you specifically need one or the other location provider.</p>
<p>If you want updates via GPS, you need <code>android.hardware.location.gps</code>.
If you want upd... |
Visual Studio 2015 - Can't see Azure view and can't publish <p>I got a probleme with Visual Studio 2015 Community.</p>
<p>If I want to create a new project I get the same problem as described here (hosting in the cloud is not shown):</p>
<p><a href="http://stackoverflow.com/questions/28068135/unable-to-see-the-window... | <p>+++SOLVED+++</p>
<p>Today a new error occured. I loaded a project and got the error:</p>
<p>"The âCctSharedPackageâ package did not load correctly. Restarting Visual Studio could solve the problem."</p>
<p>A short research directed me to this link which worked immediately:</p>
<p><a href="https://blogs.msdn.... |
Select column name based on data frame content R <p>I want to build a matrix or data frame by choosing names of columns where the element in the data frame contains does not contain an NA. For example, suppose I have:</p>
<pre><code>zz <- data.frame(a = c(1, NA, 3, 5),
b = c(NA, 5, 4, NA),
... | <pre><code>library(dplyr)
library(tidyr)
zz %>%
mutate(k = row_number()) %>%
gather(column, value, a, b, c) %>%
filter(!is.na(value)) %>%
group_by(k) %>%
summarise(temp_var = paste(column, collapse = " ")) %>%
separate(temp_var, into = c("var1", "var2"))
# A tibble: 4 Ã 3
k var1 ... |
Is there a way to dynamically change the title of embedded svg object? <p>By 'embedded svg object', I mean an html <code><object></code> tag that is an svg file, such as this:</p>
<pre><code><object id="svgobject"
data="https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg"
type="image/svg+xm... | <p>With jQuery you could </p>
<pre><code>$("#svgobject").attr('title', 'Whatever you want');
</code></pre>
<p>Hope it helps!</p>
|
Create Google Calendar reminders with Google App Script <p>I am having a problem finding how to create a Google Calendar Reminder via Google Script. I am not talking about an event reminder, as in a reminder that is emailed or SMS to you before an event on your calendar. What I need, is to create reminders in the googl... | <p>Just a quick <a href="https://developers.google.com/google-apps/calendar/concepts/reminders" rel="nofollow"><em>reminder</em></a>:</p>
<blockquote>
<p>The delivery methods offered by Google Calendar are:</p>
<ul>
<li>Pop-up. These are supported on mobile platforms and on web clients.</li>
<li>Email sent ... |
Inserting a cell in excel based on cell value <p>I am working on exporting CSVs of large groups from an active directory environment. Many of these groups have extensive nesting and I need to insert cells so that the worksheet is human readable.</p>
<p>For example my worksheet looks like this:
WS Example</p>
<blockq... | <p>This will do it. The issue looks like it's within the line <code>Rows(Cells(i, 1).Column).Insert shift:=xlShiftRight</code>. If you break that down, it computes as follows:</p>
<p><code>Cells(i,1).Column</code> which equals 1, since the column of <code>.Cells(i,1)</code> is 1.
<code>Rows(1)</code> the <code>1</code... |
JQuery undefined? <p>Getting a "Microsoft JScript runtime error: 'jQuery' is undefined" (error) when running under IE8 (yes, it has to run under IE8). I reviewed (6) other posts under this title, none solved my problem. This <em>is</em> working under Chrome. This is a numeric spinner on 5 textbox controls. Error occurs... | <p>Use Jquery version > 2.0
less then 2.0 version it's mostly show Undefined problem </p>
|
SpeechSynthesisUtterance list of languages? <p>I'm using <code>SpeechSynthesisUtterance</code> in javascript and cannot find a list of the languages supported.</p>
<p>Does anybody know how to get a list of the languages containing the code and the name of the language?</p>
<p>example.
English-US en-US
Japanese j... | <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/lang" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/lang</a></p>
<p>Review this. But to make a very long story short, the language setter/getter returns a BCP-47 language tag. <a href="http:... |
Why use angular's one time binding less-than notation (i.e. `<`) introduced in 1.5? <p>Given</p>
<pre><code><my-component my-attr="parentModel">
</code></pre>
<p>and a directive definition that includes:</p>
<pre><code>scope: { localModel:'<myAttr' }
</code></pre>
<p>angular <a href="https://docs.angularjs... | <p>I made this code snippet to try to understand the question better. It seems like there are obvious differences between the two options such as how the <code>link</code> function is handled and some auto <code>$watch()ing</code>. But I'd never used an expression in this way and I think I'm missing something.</p>
<p>... |
Gradle Dsl method not found: android() android studio 2.1.3 <p>I am using android studio 2.1.3
guided from <a href="https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#2" rel="nofollow">Create Hello-JNI with Android Studio</a></p>
<p>Following is output while compile.</... | <p>Its working </p>
<p>Changed</p>
<p>proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'</p>
<p>TO </p>
<pre><code>proguardFiles.add(file('proguard-android.txt'))
proguardFiles.add(file('proguard-rules.txt'))
</code></pre>
|
Extract specific characters from a string in a loop in linux <p>This is a new and further question based on:
<a href="http://stackoverflow.com/questions/39546484/output-the-result-of-each-loop-in-different-columns">Output the result of each loop in different columns</a>. </p>
<p>But since it is a new question, you don... | <pre><code>$ cat tst.awk
NR==FNR { money[NR]=$2; next }
{
out = $0
for (i=1; i in money; i++) {
out = out OFS ( (money[i]>=$2) && (money[i]<=$3) ? substr($1,2,1) : "x" )
}
print out
}
$ awk -f tst.awk money.txt range.txt
apple 10 15 p x x
banana 7 12 x a x
orange 17 22 x x r
blueb... |
Search an array for a property value that is contained in another array <p>I am trying to pull an object from an array of objects that's property value is contained in my other array.</p>
<pre><code>const myArrayOfObjects = [
{ value: 'test1' }
{ value: 'test2' }
]
const myArray = [ 'test1', 'test5' ];
const pluck... | <p>You could just use a simple filter:</p>
<pre><code>var result = myArrayOfObjects.filter(function (el) {
return myArray.includes(el.value);
});
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre c... |
Use if first statement in a single variable is SAS <p>Hello: I have a question.
I have a sas dataset like this:</p>
<pre><code>data a;
input id $ a b ;
cards;
ddd 12 1
ddd 22 1
ddd 44 2
ddd 50 1
ddd 52 1
ddd 88 2
;run;
</code></pre>
<p>and I expect I can use if first to flag the obs lake this:</p>
<pre><code>... | <p>I'm assuming you're using <code>set by a b;</code> in combination with <code>first.b</code>. The reason <code>first.b</code> doesn't work in this case is because <code>first.b</code> will be true for the first value of b <em>inside</em> an a group, and in this case there is only one b within each a.</p>
<p>This al... |
Using Protractor to get element titles in the DOM <p>I'm setting up page objects to get some basic element data from the DOM.</p>
<p>For example, in my <code>index.page.js</code> page object I would like to access the <code>title</code> element from <code>.panel-top-two > .row > h1</code> as follows:</p>
<pre><... | <p>To answer your question right off the bat: No, you cannot use jQuery.</p>
<p>And now about <code>this.getFirstPanelText</code>:</p>
<p>It's partly a valid function, the <code>$</code> is fine but the <code>text()</code> is not. If you are asking because you have seen the <code>$</code> used in other Protractor qu... |
Error running Wordpress locally on the Google App Engine <p>I'm trying to follow the <a href="https://googlecloudplatform.github.io/appengine-php-wordpress-starter-project/" rel="nofollow">Quick Start WordPress for Google App Engine</a> guide on Ubuntu 16.04. I'm at the step where I have to run <code>dev_appserver.py</... | <p>In your screenshot, you visited port 8000. <code>8000</code> is the admin port. You want <code>8080</code> for the default module. So: <code>http://localhost:8080/wp-admin/install.php</code>. </p>
|
Jackson custom filter with full POJO data bind <p>This question extends <a href="http://stackoverflow.com/questions/38840659/conditional-field-requirement-based-on-another-field-value-in-jackson">this question</a>.</p>
<p>While the previous solution works great if you only have a couple of fields, it becomes unmaintai... | <p>Seems like <a href="http://json-schema.org/" rel="nofollow">Json Schema</a> might fit your needs. It allows for flexible (and complex) validation rules of json strings before they are deserialized. It includes mandatory fields, regex-based value check, industry-standard formats (for instance, you can define a fiel... |
How to add configuration data to gitlab on source install? <p>I need to follow certain instructions in gitlab. Those gitlab instructions are -</p>
<pre><code>Manually (re)authorising GitLab Mattermost with GitLab
Authorise GitLab Mattermost
To do this, using browser navigate to the admin area of GitLab, Application s... | <p>I entered the gitlab config at mattermost/config/config.json and updated my settings with the appropriate endpoints as well as secret and ID. The correct information needed came from the gitlab gui. I created the tokens within gitlab proper and plugged the information into mattermost. I also had to edit my /etc/host... |
Java Timer.schedule runs only once <p>I have a TiimerTask which should run based on a Timer.schedule.
The problem is it only runs once when application starts...
Maybe it's something pending, but I cannot understand what...</p>
<p>this is my class which extends TimerTask</p>
<pre><code>public class ClientScheduler ex... | <p>You schedule the timer task only once.</p>
<p>The schedule method is defined as</p>
<blockquote>
<p>schedule(TimerTask task, long delay) </p>
<p>Schedules the specified task
for execution after the specified delay.</p>
</blockquote>
<p>But you need to use this method:</p>
<blockquote>
<p>schedule(Time... |
How can I replace "is" when found only in a specific tag <p>I need to change needed inside only a specific tag. </p>
<p>for instance,</p>
<pre><code>"this is first <a>this is second</a> this is third"
</code></pre>
<p>here, I want to find only second "is". I can find whole text between by <code>/(<a)... | <p>I propose <em>not</em> using a regular expression here, as the problem is a bit too complex and while it's possible to do using a regex it will not be pretty and you can miss some edge cases.</p>
<p>So, here is how I would do it</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-... |
Detect if component has NgModel set in Angular 2 <p>I would like to know if a component has its <code>[(ngModel)]</code> set.</p>
<p>I'm creating a typeahead component and would like to know if the ngModel is set to the element.</p>
<p>Something like this:</p>
<p>my-form.component.html</p>
<pre><code>...
<my-cus... | <p>If you want to implement <code>[(ngModel)]</code> you have to implement its interface <code>ControlValueAccessor</code>.</p>
<p>This interface has the function <code>writeValue(val: any)</code>..</p>
<p>If this function is called, you received a value via <code>[(ngModel)]</code>. :)</p>
|
Is there a way to handle quoted null String in Scala? <p>I would like to have the String, <code>"null"</code> converted to an <code>Option[String] = None</code>. </p>
| <pre><code>val x = "null"
Option(x).filter(_!="null")
</code></pre>
|
Parent/Closest Div Issue <p>EDIT:
I have the following code:</p>
<pre><code><div class="specificBlock" id="thevagabond">
<a class="intro"><img src="images/blabla.png"/></a>
</br>
<div class="btn-group-xs testing">
<a type="button" class="btn btn-success in... | <p>ID should be unique, so you would do just <code>$('#thevagabond')</code>. However, you probably need to use <code>.parents(selector_here)</code> - check <a href="https://api.jquery.com/parents/" rel="nofollow">documentation</a>.</p>
<p>If you really need ID, check this:</p>
<pre><code>$('.specificBlock a').click(f... |
Does Protege upload my ontology to semanticweb.org? <p>I have created a new ontology in Protege. The IRI is something like this</p>
<pre><code>http://www.semanticweb.org/Computer1/ontologies/2016/8/untitled-ontology-10
</code></pre>
<p>Why the naming is like a URL? Does that mean my ontology is loaded to semanticweb.... | <p>No, the IRI is simply /looking/ like a URL. Your data will not be published anywhere unless you do so yourself.</p>
|
HTTP method POST is not supported by this URL in WildFly <p>I'm trying to build a Java web-app in Intellij, using Wildfly as Application server.
In my web app, i'm trying to configure a module for restful webservices (with RestEasy library) but when I try to test my restful webservice (as post method), i receive the me... | <p>I solved the issue. The context path was not correct.
I was trying to call this:</p>
<pre><code>http://localhost:8080/rest/email/myName/my@address.com/myMessage
</code></pre>
<p>The correct path was this:</p>
<pre><code>http://localhost:8080/MYAPP-SNAPSHOT-1.0/rest/email/myName/my@address.com/myMessage
</code></p... |
Xcode 8 and ui automation <p>So, it looks like UI Automation is depreciated in Xcode 8 Instruments. Is there a way to use the same javascript tests we had with Xcode 7 instruments UI Automation, in Xcode 8 (via command line for automated testing)?</p>
| <p>Looks like it's GA GA GONE! I'm pretty angry. looking for a solution.</p>
<p>Going to download 7.3.1 and see if I can install 2 copies of Xcode per computer.</p>
<p><a href="https://developer.apple.com/download/more/" rel="nofollow">https://developer.apple.com/download/more/</a></p>
|
Delete last object from the array of objects. <p>I have this array of objects and i would like to delete the last object. i.e. 2 from the list. Can someone please let me know to do this. </p>
<pre><code>Object {Results:Array[3]}
Results:Array[3]
[0-2]
0:Object
id=1
name: "Rick"
Value:... | <p>Try using the <a href="https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array/pop" rel="nofollow"><code>.pop()</code></a> method. It'll delete the last item of an array.</p>
<pre><code>obj.Results.pop();
</code></pre>
|
java.lang.Double cannot be cast to clojure.lang.IFn issue <p>I'm coding a basic exponential function for an assignment, and i can't figure out why i'm getting this error. This is my code:</p>
<pre><code>(def epsilon 0.000001)
(def exponentialing
(fn [F S T x]
(if
(<= T epsilon)
S
(recur (+ ... | <p>It looks like you were missing a space char in the <code>recur</code> line. I also simplified your functions from <code>def</code> to <code>defn</code>. Also, you failed to call <code>exp</code> in your original version:</p>
<pre><code>(ns clj.core
(:require [tupelo.core :as t] ))
(t/refer-tupelo)
(def epsilon... |
How to check if multidimensional array contains same value? <p>I have a multidimensional array. I need to check if any value in this array has contain same value. If, then execute. What is the better way to check this, or the simplest way TIA</p>
<pre><code>$array[] = array(5, 10, 15, 20, 25, 30);
$array[] = array(1, ... | <p>Just loop through the array and subarray filling $isRepeated with values and frequencies of appearance. When $isRepeated[certain_value] exists means this value was found before:</p>
<pre><code>$array[] = array(5, 10, 15, 20, 25, 30);
$array[] = array(1, 2, 3, 4, 5, 6);
$array[] = array(2, 6, 8, 10, 12, 14);
$isRep... |
Filtering JSON and comparing array values <p>I need to produce a number that is a total number of JSON objects, for instance: "<strong>6</strong> type_A programs in your country".
I have a JSON and have gotten it to filter a the type and country.</p>
<p>each object in the JSON contains a "countries" array (some with m... | <p>If <code>val.countries</code> is an array, you should be able to use something like this instead:</p>
<pre><code>return val.program_type === 'this is A type' && val.countries.indexOf(varCountry) > 0;
</code></pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.