INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
opendir() in C Programming
I'm a beginner and I am making a code about getting the directory of a file, but I have something that I don't understand.
What's the meaning of "./" in `DS = opendir ("./");`
I have searched a lot of sites about C programming, but nothing gave me a good explanation. I have to present my code soon, forcing me to explain every single line of my code. Please help me. Thanks!
|
`./` is a relative path which is relative to the current working directory of your process.
> In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with each process. When the process refers to a file using a simple file name or relative path (as opposed to a file designated by a full path from a root directory), the reference is interpreted relative to the current working directory of the process.
So suppose the working directory of your process is `/foo`, when you open `./` with `opendir`, you are actually opening `/foo/./` which is equal to `/foo`.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "c, directory, opendir, dirent.h"
}
|
Very simple but working drush extension?
I want to implement my own Drush command, and struggle because while the "Make me a sandwich" example is very good, it's also quite complex, and for someone that has never made such an extension it's easy to loose track of what is mandatory, and what is optional.
I would like to see a basic Drush extension implementation.
|
This is valid for Drush >= 4
<?php
/**
* @file EXAMPLE.drush.inc
* Provides a simple drush extension example
*/
function EXAMPLE_drush_command() {
return array('COMMANDNAME' =>
array(
'description' => 'My example command',
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
),
);
}
function drush_COMMANDNAME_validate() {
// Return
// drush_set_error('MACHINE_NAME_OF_FAIL', dt('Command failed because [reason]'));
// on error.
}
function drush_COMMANDNAME() {
echo 'Extension working!';
}
|
stackexchange-drupal
|
{
"answer_score": 5,
"question_score": 3,
"tags": "drush"
}
|
Referring to dates other than \today
Is there a package that allows one to work with dates in the following way: just as `\date` shows today's date, I would like to have a command that dates the document 7 days from today.
Also, since I would like to use this as a template, I do not want to manually enter the dates myself. Is this possible?
|
See the datenumber and advdate packages (and the datetime package for formatting options).
**Edit:** Added small example, essentially stolen from the datenumber documentation.
\documentclass{article}
\usepackage{datenumber}
\begin{document}
\setdatetoday
\addtocounter{datenumber}{7}
\setdatebynumber{\thedatenumber}
Today is \today, 7 days from now it's \datedate.
\end{document}
|
stackexchange-tex
|
{
"answer_score": 28,
"question_score": 26,
"tags": "datetime"
}
|
How to merge multiple files in order and append filename at the end in bash
I have multiple files like this:
BOB_1.brother_bob12.txt
BOB_2.brother_bob12.txt
..
BOB_35.brother_bob12.txt
How to join these files in order from `{1..36}` and append filename at the end of each row? I have tried:
for i in *.txt; do sed 's/$/ '"$i"'/' $i; done > outfile #joins but not in order
cat $(for((i=1;i<38;i++)); do echo -n "BOB_${i}.brother_bob12.txt "; done) # joins in order but no filename at the end
file sample:
1 345 378 1 3 4 5 C T
1 456 789 -1 2 3 4 A T
|
Do not do `cat $(....)`. You may just:
for ((i=1;i<38;i++)); do
f="BOB_${i}.brother_bob12.txt"
sed "s/$/ $f/" "$f"
done
You may also do:
printf "%s\n" bob.txt BOB_{1..38}.brother_bob12.txt |
xargs -d'\n' -i sed 's/$/ {}/' '{}'
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "bash, sed"
}
|
How do I stop .focusout() from firing multiple times?
Here's a simple recreation of what Im trying to do:
<
$('body').on('focusout', 'input', function(){
alert('test');
});
<input type="text" name="textbox1" />
<input type="text" name="textbox2" />
When you focus out of the `<input>`, it runs fine, however, if you focus out of an `<input>` directly into another `<input>`, it creates a loop. What am I doing wrong? Thanks!
|
Hope this helps... I used JQuery....
$("<input />", {
type: "number",
min: "0"
}).addClass("someclass").appendTo($("#someid"));
$(document).on("focusout", ".someclass", function() {
console.log("alert");
});
<script src="
<input type="text" class="someclass" />
<div id='someid'>
</div>
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "javascript, jquery, html"
}
|
Helvetica Neue Bold Identifier
What is the identifier for `Helvetica Neue Bold` to be used in `UIFont`? I know that `@"Helvetica Neue"` is the correct identifier for `Helvetica Neue`, but that is it for `Helvetica Neue Bold`?
This is where such a font identifier would be implemented. If you try an identifier that does not find any reference, it will set the cell font to the default font and font size.
UIFont *cellFont = [UIFont fontWithName:@"Helvetica Neue" size:12.5];
|
_HelveticaNeue-Bold_ is the identifier. Here is a snippet of code you can use to list all the available fonts:
NSArray *familyNames = [[NSArray alloc]initWithArray:[UIFont familyNames]];
for (NSString *familyName in familyNames) {
NSLog(@"%@", familyName);
NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
for (NSString *fontName in fontNames) {
NSLog(@"\t%@", fontName);
}
}
*Edit: Swift 3.0
for familyName in UIFont.familyNames {
for fontName in UIFont.fontNames(forFamilyName: familyName) {
print("\(familyName) \(fontName)")
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "uifont"
}
|
Flex Box Behavior
I cannot understand WHY I am not getting this:
.container {
width: 600px;
height: 400px;
border: 3px solid green;
}
.cg-panel {
display: flex;
flex-flow: column;
align-items: stretch;
justify-content: center;
}
.cg-panel .content {
flex: 1;
background-color: tomato;
}
<div class="container">
<div class="cg-panel">
<div class="content"></div>
</div>
</div>
I, for the life of me, cannot understand why the `content` panel does not vertically stretch the entire container. What is the purpose of "flex:1" if it isn't going to work? Am I not reading the documentation correctly?
|
There's nothing in your CSS that is expanding the height of `.cg-panel` to fit its parent `.container`.
Adding `height: 100%;` to `.cg-panel` fixes this:
.container {
width: 600px;
height: 400px;
border: 3px solid green;
}
.cg-panel {
display: flex;
flex-flow: column;
align-items: stretch;
justify-content: center;
height: 100%; /* add this */
}
.cg-panel .content {
flex: 1;
background-color: tomato;
}
<div class="container">
<div class="cg-panel">
<div class="content"></div>
</div>
</div>
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "html, css"
}
|
Azure DevOps restrict access only with in the organization
I have a requirement of restricting access to Azure DevOps only inside the organization network. How does it possible to do? Can I restrict for a range of IP addresses or is there any other method?
|
Azure DevOps is a cloud service, so you can't directly restrict it to your IP address range, however there are a couple of options:
1) Azure DevOps is authenticated through Azure Active Directory. You can use Azure AD's conditional access to prevent logins from certain geographies and address ranges. See here for an example. This will stop any unauthorised attempts from other addresses or outside of your organization.
2) If you are more concerned about where your CI/CD pipelines are running, you can set up local agents to keep your build and releases on-prem.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "azure, azure devops"
}
|
What is the name of this part of a function?
I'm working out an exercise for a generalized programming course. This specific problem is in Java, which I am not familiar with. I can infer most of it but there's one part I don't know the name of to research. Here's the code (and yes, it's intentionally very obtuse for learning purposes):
class Reuse {
Reuse Reuse(Reuse Reuse) {
Reuse:
for (;;) {
if (Reuse.Reuse(Reuse) == Reuse)
break Reuse;
}
return Reuse;
}
}
The third line ( **Reuse:** ) is what I don't understand. What's the name of that part of the function?
|
That's a label.
Labels are used with `break` and `continue` statements to make code execution jump to a specific line.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "java"
}
|
Different Mounts per User
Is there a way that I could create a Linux-based system where each user has different mount points?
For example you could have the "real" filesystem like this that root uses:
/dev/sda1 mounted to /
/bin
/home/uuid1
/home/uuid2
/home/uuid3
Then user1 with the uuid1 could see something this:
/home/uuid1 mounted to /
/bin mounted to /bin
Then user2 could be the same but with uuid2, etc..
I think having a system setup like this could be used to manage dependencies and sandbox user data completely, preventing users from even seeing that there are directories they can not access.
|
Have a look at mount namespaces, configure your system so that every user is given a particular mount namespace when he/she logs in.
So you don't need a full-blown container for that (though if you find a container easier to use, by all means use a container). A container will basically make use of mount namespaces and the other namespaces.
|
stackexchange-superuser
|
{
"answer_score": 0,
"question_score": 1,
"tags": "linux, mount"
}
|
Hyperbolicity of a semidirect product
Let F be a finitely generated free group and let $\gamma : F \rightarrow F$ be an automorphism. Is the semidirect product $F \rtimes \mathbb{Z}$ an hyperbolic group? where $\mathbb{Z}$ acts in F via $\gamma$.
|
The Bestvina-Feighn combination theorem says that this is true if and only if $\gamma$ has no nontrivial periodic conjugacy classes. See
MR1152226 (93d:53053) Bestvina, M.(1-UCLA); Feighn, M.(1-RTG2) A combination theorem for negatively curved groups. J. Differential Geom. 35 (1992), no. 1, 85–101.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 10,
"question_score": 4,
"tags": "gr.group theory, geometric group theory"
}
|
How do I use guilayout toggle event to check if true or false?
OnGUI()
{
for (int i = 0; i < scenes; i++)
{
GUILayout.Toggle(false, SceneManager.GetSceneAt(i).name);
}
if (GUILayout.Toggle(true, "New Scene"))
{
Debug.Log("True now !");
}
}
First in the loop I'm adding some toggles. Then I want to do that if specific toggle is checked(true) do something and if unchecked(false) do something else.
But the way I did it it's just changing the toggle to true automatic.
|
The idiom with most of these GUI controls is to store a member variable representing the current state / value held inside the control. When you draw the control, you pass that variable so that it's drawn in the correct state. The function then returns the new value of the variable based on user input.
bool isToggleChecked;
void OnGUI() {
isToggleChecked = GUILayout.Toggle(isToggleChecked, "Toggle Name");
if(isToggleChecked) {
// What to do if the toggle is in the checked state
} else {
// What to do if the toggle is in the unchecked state
}
}
|
stackexchange-gamedev
|
{
"answer_score": 0,
"question_score": 0,
"tags": "unity, c#"
}
|
Where should I ask a question about a program that wants to connect to the Internet
I have a program that is limiting other programs to access the Internet, and I want to ask about some programs that want to connect, what purpose this connection is for. e.g. Chrome tool wants to connect to port 443 somewhere - what is this for?
I thought this kind of suits Super User but the faq says it's not about web-services so I'm having trouble deciding.
|
I think the question would fit perfectly on Super User.
The Super User FAQ **does** say that it's not about web services, but in this case, your question is about programs that connect to the internet, which falls in one of the two on topic categories: software.
Examples:
* Why can't I log into my GMail account is a question for Web Apps, since the problem is related to GMail (a web app).
* Why does my browser crash when trying to log into GMail is a question for Super User, since it's related to your browser (computer software).
|
stackexchange-meta
|
{
"answer_score": 3,
"question_score": 2,
"tags": "support, asking questions"
}
|
Can I have a inner shadow on both sides?
-moz-box-shadow: inset 3px 0px #BDD4DE;
-webkit-box-shadow: inset 3px 0px #BDD4DE;
box-shadow: inset 3px 0px #BDD4DE;
That puts an inner shadow on the left side. Is it possible to have an inner shadow on both sides?
|
`box-shadow` accepts multiple values, so simply repeat your values with a `-3px` offset:
-moz-box-shadow: inset 3px 0px #BDD4DE, inset -3px 0px #BDD4DE;
-webkit-box-shadow: inset 3px 0px #BDD4DE, inset -3px 0px #BDD4DE;
box-shadow: inset 3px 0px #BDD4DE, inset -3px 0px #BDD4DE;
But those look more like borders than shadows. Perhaps you should use borders instead, and maybe with `box-sizing: border-box` in case you can't subtract from width or padding:
border-left: 3px solid #BDD4DE;
border-right: 3px solid #BDD4DE;
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "css"
}
|
Batch file to call all other batch files
How can I create a "do everything" batch file that simply calls **all** other batch files in its directory and executes them one after the other?
My attempts using
for /r %%i in (*.bat) do call %%i
Fail miserably, because obviously the file will sooner or later call itself and end up in an endless loop of calling itself time and time again.
How can I manage this better?
|
You have 2 solutions :
rename your starting bat file as `.CMD`
or
@echo off
for %%i in (*.bat) do if not "%%~nxi"=="%~nx0" call %%i
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "windows, batch file"
}
|
Why am I getting a Identifier expected error
import java.util.*;
public class Students
{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
Student s1=new Student();//creates object of class aircraft
Student s2=new Student();
//or
//Student s1,s2
//s1=new Student();
//s2=new Student();
String str;
int i;
//str=s1.getname();
}
}
class Student{ //extends Students{
String name;
int 1; ?<Identifier> expected?
int 2; ?<Identifier> expected?
int 3;
}
}
in the last three lines i get identifier expected. why? The student class is supposed to store the name, and three test scores.
|
In java, variables are not allowed to start with numbers - `1` is an invalid variable name (though `num1` is valid). See the naming requirements.
To fix your code, I would rename them `int var1`, `int var2`, `int var3`. (Though better names would be better - try something more descriptive)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "java, identifier"
}
|
function_clause error in Couchdb 1.1.0 after updating from 1.0.1
I have errors when updating document in Couchdb 1.1.0 after updating it from 1.0.1 Response looks like this:
stdClass Object
(
[error] => unknown_error
[reason] => function_clause
)
When i was using 1.0.1 everything was ok. There's something in "breaking changes" section regarding update from 1.0.0 to 1.1.0
> Document id's are now validated during PUT. This means that some PUT requests will fail that previously succeeded.
But i cant figure it out what that means in my case.
|
Well, the answer is pretty strange. <
So if you get the same error after updating your CouchDB server to 1.1.0, you have to remove your *.beam files from $INSTALL_DIR/bin. In my case, i had to manually remove files from /opt/couchdb/bin
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, erlang, couchdb, mochiweb"
}
|
How do I play a video on tvOS for Apple TV?
I started a blank tvOS project and created the following code:
- (void)viewDidLoad
{
[super viewDidLoad];
AVPlayer *avPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:@"
AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];
avPlayerLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view.layer addSublayer:avPlayerLayer];
[avPlayer play];
}
Nothing happens in the simulator though once the app loads. No video, nothing, just a blank translucent screen in my Apple TV simulator.
What's the proper way to play a sample video on app launch for an Apple TV app from an HTTP source?
|
I just pasted your code in my tvOS sample project, replaced the URL and ran it.
Nothing happened. Well, except for the fact that there's a log entry telling me that App Transport Security has blocked my URL request.
So I headed to the Info.plist, disabled ATS and upon next launch the video showed up just fine.
So if you're also using a non-HTTPS URL you're very likely running into this issue which is easily fixed by either using an HTTPS URL, disabling ATS completely or allowing specific non-HTTPs URLs in your Info.plist.
P.S.: I used this video for testing.
|
stackexchange-stackoverflow
|
{
"answer_score": 19,
"question_score": 24,
"tags": "xcode, apple tv, tvos"
}
|
rails get address from google map using longtitude and latitude
I am trying write an application that receives lat/lng and return appropriate location. (i.e I send the data lat/lng = 40.343545334/32.235308039 it returns for example New York) What should I use here? Is there any way to do this?
|
You can use the Geocoder gem for that. See this screencast.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ruby on rails, ruby, google maps"
}
|
Lagrangian submanifolds
Let $\Lambda_{n}$ be the set of all Lagrangian subspaces of $C^{n}$, and $P\in\Lambda_{n}$. Put $U_{P}= ( Q\in\Lambda_{n} : Q\cap (iP)=0 )$. There is an assertion that the set $U_{P}$ is homeomorphic to the real vector space of all symmetric endomorphisms of $P$. And then in the proof of it there is a fact that the subspaces $Q$ that intersect $iP$ only at $0$ are the graphs of the linear maps $\phi : P\to iP$. This is what I don't understand, any explanation or reference where I can find it would be helpful.
|
It is very elementary; the graph representation refers to the cartesian product $P\times iP$ coming from the real vector space direct sum decomposition $\mathbb{C}^n = P\oplus iP\sim P\times iP$.
Here the direct sum decomposition is possible because $\dim _ \mathbb{R}(P)=n $ and $P\cap iP=0$, from the definition of Lagrangian subspace (thus any $z$ writes uniquely as $z=x+iy$ with $x$ and $y$ in $P$).
The second projection $\pi_2: P\times iP \to iP$, restricted to a subspace $Q$, has kernel $Q\cap iP$, so it is injective exactly for $Q\in U_P$, in which case $Q=\operatorname{graph}\\\ \pi_1({\pi_2}{|Q})^{-1}$.
For other details check e.g. the introductory pages of Hofer-Zehnder's book, _Symplectic Invariants and Halmiltonian Dynamics_.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 2,
"question_score": 0,
"tags": "dg.differential geometry, sg.symplectic geometry"
}
|
How to get the tail of a std::string?
How to retrieve the tail of a `std::string`?
If wishes could come true, it would work like that:
string tailString = sourceString.right(6);
But this seems to be too easy, and doesn't work...
Any nice solution available?
Optional question: How to do it with the Boost string algorithm library?
**ADDED:**
The method should be save even if the original string is smaller than 6 chars.
|
There is one caveat to be aware of: if substr is called with a position past the end of the array (superior to the size), then an `out_of_range` exception is thrown.
Therefore:
std::string tail(std::string const& source, size_t const length) {
if (length >= source.size()) { return source; }
return source.substr(source.size() - length);
} // tail
You can use it as:
std::string t = tail(source, 6);
|
stackexchange-stackoverflow
|
{
"answer_score": 45,
"question_score": 32,
"tags": "c++"
}
|
Data preprocessing
How would you preprocess 2 dimensional data to have 0 mean? Say you have a matrix $M $ that is $p \times q $. Would you calculate the mean of each row, get a vector of length $q $ and subtract each element of the vector from the corresponding column?
|
If your data are 2-dimensional, then the matrix $M$ would have the size $p \times 2$ or $2 \times p$. In either case, you need to take the mean along the $p$ dimension. This will give you a 2-element mean vector $m$. Then you have to subtract it from every row (or column) of $M$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "matrices, signal processing, image processing"
}
|
Spring Roo + Vaadin Plugin: Running on Tomcat server
Using this tutorial < i was able to get a Spring Roo project started and configured with Vaadin add-on. I am having trouble running this application on a tomcat server in a container. I have tomcat already installed in my eclipse environment and configured but dont know what the command is in Spring ROO shell that allows me to run this project?
How do you set up tomcat with a Spring Roo project using the vaadin add-on?
|
To deploy your application in a Web container during project development you have several options available:
Deploy from your shell / command line (without the need to assemble a war archive):
run 'mvn tomcat:run' in the root of your project (not inside the Roo shell) to deploy to a Tomcat container
run 'mvn jetty:run' in the root of your project (not inside the Roo shell) to deploy to a Jetty container
Beginning With Roo character **2.9. Step 6: Loading the Web Server**
**EDIT 1**
If you have not installed maven, read this article
If you want run your project using jetty, read this article
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "tomcat, spring roo, vaadin"
}
|
Image does not horizontally line up with the text above and below it with 960 grid
Any idea why my image does not horizontally line up with the text above and below it please? <
|
You're using a different class for the image element than for the text elements you want on the right column. Set the image's class to grid_13 (same as the text) and add push_3, so it moves 3 columns to the right. It'd be better to rearrange your elements into divs though; otherwise you'll have to give each element specific properties, and that beats the purpose of using a grid system.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "css, 960.gs"
}
|
Conceptual problem with surfaces of revolution
 ds$$ by approximating the surface by a set conical loops (for lack of a better term). Then we take the limit as the width of those loops goes to zero and get the surface area. That makes perfect sense.
But why couldn't we approximate the surface by _cylindrical_ loops (I hope you guys understand what I mean by that)? To me this seems like the more Riemann style way to do it -- where the usual method looks a lot like the trapezoidal method for evaluating integrals. But in the limit as $\Delta x \to 0$, shouldn't the error of either way also go to zero?
> Why would $\int_a^b 2\pi f(x) dx$ get you the wrong answer?
|
This is a lot like trying to approximate the length of a hypotenuse of a right triangle by just adding up only the horizontal legs of small right triangles which fit together to make the larger right triangle. One clearly needs to add up the hypotenuses of the small right triangles in this case, not just the horizontal legs.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "calculus, integration, multivariable calculus, area, surface integrals"
}
|
Powershell Path-could-not-be-found error inside of a script function
I'm writing a simple backup script in Powershell, my first powershell script actually, so I could be missing something obvious.
In command line I run this:
PS C:\tmp> $source="C:\tmp\source"
PS C:\tmp> $dest="C:\tmp\dest"
PS C:\tmp> cp "$source\*.txt" "$dest\"
and all works fine, behaves as expected: copeies all .txt files from source to dest.
when I'm in script.ps1 file, have
copyBackupFiles ("C:\tmp\source", "C:\tmp\dest")
function copyBackupFiles($Source, $Dest)
{
Copy-Item "$Source\name.*" -Destination "$Dest\"
}
I get an error Copy-Item : Cannot find path 'C:\tmp\source C:\tmp\dest' because it does not exist.
Any pointers on this problem? already spent a good couple of hours online with no luck...
|
Change the line from
copyBackupFiles ("C:\tmp\source", "C:\tmp\dest")
to
copyBackupFiles "C:\tmp\source" "C:\tmp\dest"
It's becase you pass to parameter `$source` array with 2 items, but no value to $dest.
Unfortunatelly this is one of potential traps for people that know languages like C#, Java etc. Arguments are not delimitted by commas, but by space, much like in e.g. F#.
You can see wha happens with Trace-Command:
function test($a, $b) { write-host $a / $b }
Trace-Command -name parameterbinding { test (1, 2) } -PSHost
Trace-Command -name parameterbinding { test 1 2 } -PSHost
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "powershell"
}
|
Leibniz integral rule for triple indefinite integral
While trying to solve a problem involving vector potentials I ran into this type of function: $$ f(x,y,z) = g(x,y,z) + \int \frac\partial{\partial z} \left( \int \frac\partial{\partial y} \left( \int \frac{\partial f}{\partial x}dz \right)dx \right)dy $$
My primary question is if there's a way to simplify/evaluate the triple integral. Secondly, I was wondering if there's a name or theorem or any better way to describe this type of integral.
Thanks to anyone that's able to help.
Edit: Changed title to something that may be more relevant to the question.
|
Yes, this can be simplified, by interchanging the order of differentiation and integration. For the innermost integral, $$ \frac{\partial}{\partial y}\int \frac{\partial f}{\partial x}\ dz=\int \frac{\partial^2 f}{\partial y\ \partial x}\ dz, $$ and doing the same once more yields that $$ \int \frac{\partial}{\partial z}\int \frac{\partial}{\partial y}\int \frac{\partial f}{\partial x}\ dz\ dx\ dy=\int\int\int \frac{\partial^3 f}{\partial z\partial y\partial x}\ dz\ dx\ dy. $$ Note also that $x,y,z$ can be reordered in any of the $3!$ desired orderings, in both the derivatives and in the integrals, each independently of the other, without affecting the value of the expression. (All this follows from Leibniz' integral rule and equality of mixed partials, which require some technical analytical assumptions about the function $f(x,y,z)$ that are usually satisfied in practice.)
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "multivariable calculus, partial derivative, indefinite integrals"
}
|
Where is the Checksum for Ubuntu 18.04?
Where is the checksum for the Ubuntu 18.04 Desktop ISO image (ubuntu-18.04-desktop-amd64.iso)?
I don't see it anywhere on the download page or on the release notes page.
The Checksums on the cd image page are for server and arm versions, but do not include a checksum for the desktop iso: <
|
You find the checksums for Ubuntu 18.04 at releases.ubuntu.com/bionic (alongside the iso files).
* * *
Generally, you find the current released versions of Ubuntu and the Ubuntu community flavours via the link
releases.ubuntu.com
|
stackexchange-askubuntu
|
{
"answer_score": 7,
"question_score": 9,
"tags": "18.04, checksums"
}
|
Why do I have access to a variable outside of a function but not within?
I have a bunch of HTML and PHP code and in the template file it works fine but I'm trying to put it in a PHP function and now when I run the page I get the error `Undefined variable: variableName`
Here's some code:
function testFunction()
{
foreach ($variableName as $variable):
echo 'tasf';
endforeach;
}
Inside that function `$variableName` cannot be found but if I move it outside the function it can be found just fine. I'm doing this within a symfony php template file if it matters.
|
Simple issue of **variable scope**. If that variable is defined outside the function then either you need to pass it there or declare it global
See Manual Here
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "php"
}
|
`Reset` not working in CoqIDE
Neither `Reset <sectionname>.` nor `Reset <globalconstant>.` nor `Reset Initial.` works in my CoqIDE interactive sessions. The message is
Error: Use CoqIDE navigation instead
The only `Reset`s I've seen to work are `Reset Extraction Blacklist.` and `Reset Extraction Inline.`. Below's a copy of some info from Help > About. Thanks in advance for any ideas
**Version information**
The Coq Proof Assistant, version 8.4pl3 (January 2014)
Architecture Linux running Unix operating system
Gtk version is 2.24.23
This is coqide.opt (opt is the best one for this architecture and OS)
|
If you are willing to upgrade to Coq 8.5, CoqIDE now supports Reset, Undo, Abort, Restart... It will just print a warning advising you to use navigation commands instead when you use them.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "coq, coqide"
}
|
check whether a date falls in between date range concat with TO operator
I have following format `2016-06-06` TO `2016-06-12`
I want to know that whether my date i.e `2016-06-11` lies in between or not. How can I do this?
|
You can use PHP if condition for checking date range:
$compareDate = "2016-06-06 TO 2016-06-12";
$dateArr = explode(" TO ",$compareDate);
$starting_date = $dateArr[0];
$final_date = $dateArr[1];
$date = "2016-06-11";
if($date >= $starting_date && $date <= $final_date) {
...
}
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "php"
}
|
How to create find the freq of a column in aggregate function in pandas
I have a dataframe and I'd like to do a groupby two columns and then create a dictionary which has the value and their frequencies as the aggregate function. This is how my data looks lik
A, B, C
-------
1, 2, V
1, 2, V
1, 2, B
1, 3, V
1, 3, B
1, 3, B
I want to groupby `A` and `B` and create a dictionary which shows the frequency of column `C`. This is how my final dataframe should look like:
A, B, C
-------
1, 2, {V:2, B:1}
1, 3, {V:1, B:2}
How can I do that?
|
Using `groupby` \+ `value_counts` \+ `to_dict`
df=df.groupby(['A','B']).C.apply(lambda x : [x.value_counts().to_dict()]).str[0].reset_index()
df
Out[73]:
A B C
0 1 2 {'V': 2, 'B': 1}
1 1 3 {'B': 2, 'V': 1}
df.C.str.len()
Out[75]:
0 2
1 2
Name: C, dtype: int64
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "pandas, pandas groupby"
}
|
Carbon relay to aggregrator and shared cache configuration
Is it possible to setup carbon relay to forward to a cache and an aggregator and then have the aggregator send to the same cache?
I am trying to store aggregate data for long term storage and machine specific data for short term storage. From what I can tell documentation wise it is possible to do this with two different caches, but from an administration standpoint using a single cache would simplify things.
|
It is indeed possible to do this.
Setup the carbon relay to send to both the carbon cache and the carbon aggregator. Setup the aggregator to send to the same cache the relay is. The aggregated stats will appear in the cache if properly setup. I have all these services setup to run on different ports with statsd as a proxy. So I was able to make all of these changes, start up the relay and aggregation daemons, and then change the port statsd was sending to all with only minimal impact.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "graphite"
}
|
What is the meaning of `jenkins ALL=(ALL) NOPASSWD: ALL` and does it create a security issue?
I saw this is a way to resolve jenkins build script upload to aws instance issue with authentication, bu what exactly this mean? how should I execute it? I can't execute it in terminal as jenkins is a command not found, but I do have Jenkins running in local.
|
This:
jenkins ALL=(ALL) NOPASSWD: ALL
Means to run `ALL` commands without a password for a user named `jenkins`.
And is a syntax/configuration for the program sudo which basically allows users to run programs with the security privileges of another user, by default the superuser.
It definitely creates a security issue but you need to find a way to deal with it since it is giving "root" privileges to the user.
You can read more about `sudo` (sudoers) here: <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "authentication, jenkins, terminal"
}
|
UISearchController search bar cannot be activated
The `UISearchBar` object and its `UISearchBarTextField` subview both return `NO` for `canBecomeFirstResponder`. Under what conditions would `UISearchController` prevent searching?
|
It was because the view controller containing the search bar had not been considered “appeared.”
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ios, cocoa touch, uikit, uisearchbar, uisearchcontroller"
}
|
How to adjust values in Xcode to depend on device played (iPhone vs. iPad)
I am currently making a classic snake game app.
The app fits and works on all iPhones however when I test on any iPad the lettering is off the screen and so is the game screen.
Is there anyway to adjust the proportion or have it depend on what device you are using?
I was unable to find much help online when looking for this question. (first image is an iPhone 7, and the second is an iPad Air 2.
. I would recheck your `portlet.xml` settings and how you set/get the parameters against the details listed in _PLT.11.1.2 Public Render Parameters_ of the spec.
_(I'm not sure why you would want to pass around your session ID, but that is another matter.)_
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "java, portlet, portal"
}
|
How to sample data to classify sales performance data?
I have data about sales in a year, call and appointment records, and background of salesmen. I want to apply machine learning and data mining to predict which kind of person would bring highest sales each month. My problem is I am not sure how to sample the data. Should I treat sales of a salesman in different months as individual records? or should I only pick one record for each salesman?
|
If the month-to-month variation is known not to be significant then, for each salesman, compute the average monthly sales and let that be the record for the salesman. If there is some kind of seasonal effect this would not be a good approach as you would really prefer to have January's average sales February's etc. In fact, you can look for seasonality by computing for each month the average across salespersons.
|
stackexchange-stats
|
{
"answer_score": 0,
"question_score": 0,
"tags": "machine learning, statistical significance, data mining, sample"
}
|
Why use parameters in function?
I have been reading a lot of parameters in function but did not figure out why using parameters in swift is useful?
Code without parameter:
var name = "John"
func sayHello() -> String {
let greeting = "Hello, " + name + "!"
return greeting
}
print(sayHello()) // Hello, John!
Code with parameter:
func sayHello(name: String) -> String {
let greeting = "Hello, " + name + "!"
return greeting
}
print(sayHello("John")) //Hello, John!
Result is same.
|
Parameters make your code more reusable. Without them, you would have to retype (copy) the code over and over everything you wanted to use it. In your example, you would have to recopy the code every time you wanted to say hello to another name. With parameters, you can simply recall the function with a different parameter. For a very simple program, you may not need them, but as your program grow more complex, however; you will need them or at least should consider using them.You also mentioned scope. Scope is, essentially, where a variable can be used. The two terms you should know dealing with scope are local and global. If you declare a variable at the start of the class it is said to be global. Global variables take up more space in memory because they take longer to become deallocated. If you declare it within a function or loop, it is said to be local to that structure. Hope this helps.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "swift, parameters"
}
|
How can I inject my own response stream in to browser Internet Explorer
Problem:
How to inject my own response stream to currently running iexplore.exe window..
Explation:
While user typing "www.google.com" in address bar of Ie.., Instead of showing response from Google Webserver...I want to show my own stream which contains text like "
"The site blocked."
The important thing is I need all stuffs in Client Machine - **C# Windows Service.**
So how can I dynamically inject my own response to web client..?
|
Either control each explorer instance via COM interfaces (works for Internet Explorer only). _Maybe_ there is a way to do so with other browsers using DDE.
or to set up a local proxy and implement filtering there. In this case each browser should be configured to use the proxy.
For the simple reason of blocking sites you can edit %WINNT%\system32\drivers\etc\hosts file and set the site's url to point to 127.0.0.1 (localhost) In this case local machine just won't resolve, e.g. www.google.com correctly.
Or, ...
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "c#"
}
|
Is it possible to use == twice in R mathematical notation?
I am trying to use R mathematical notation of `plotmath` in a plot label. In the label, I am trying to use to equality signs, e.g.
ggplot(data=NULL) +
geom_point(aes(x=0.5, y=0)) +
geom_text(aes(x=0.5, y=-0.1),
label = paste("x == frac(3,2) == 1.5"), parse=TRUE) +
xlim(-1,1) +
ylim(-1, 1)
However, I obtain the following error:
Error in parse(text = text[[i]]) : <text>:1:16: Unexpected '=='
1: x == frac(3,2) ==
^
Is it possible to use two equality signs within a label?
(This is a follow up question to this question.)
|
ggplot(NULL) +
geom_point(aes(x = 0.5, y = 0)) +
annotate("text", x = 0.5, y = -0.2, label = expression(paste("x = ", frac(3, 2), " = 1.5"))) +
annotate("text", x = 0.5, y = 0.2, label = "~x == ~frac(3, 2) == ~1.5", parse = T) +
annotate("text", x = 0.5, y = -0.4, label = expression({x == frac(3, 2)} == 1.5)) +
xlim(-1, 1) +
ylim(-1, 1)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "r, plotmath, mathematical notation"
}
|
How to justify this orthogonality?
I am trying to justify the orthogonality of two vectors but I am stuck. First here is the figure : !enter image description here
I want to justify the orthogonality of vector CQ and vector PR. We know that :
* ABCD is a square.
* DR = AP
* P is on AB
* R is on AD
Here is a dot product : CQ.(AR-AP) (these are all vectors).
I develop it with : CQ.AR - CQ.AP.
I can say that CQ.AR = DR.AR and that CQ.AP = BP.AP.
It's here that I am stuck, I just don't know at all what to do ! _BTW sorry, I don't know how to create the arrows for the vectors._
|
Let's take the side of the square to be equal $1$, and $|AP|=x$.
Then $P=(x,0), R=(0,1-x), Q=(x,1-x), C=(1,1)$, and the vectors are $$\overrightarrow{CQ} = (x-1,-x)$$ $$\overrightarrow{PR} = (-x,1-x)$$
Meaning $$\overrightarrow{CQ} \cdot \overrightarrow{PR} = (-x^2+x)+(-x+x^2) = 0$$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "vectors"
}
|
Prove $(A^TA + \gamma I)x = b$ is unique
The goal is to prove or disprove the following:
The solution to $(A^TA+\gamma I)x = b$ is unique for any $\gamma > 0$
Any hints for helping me solve this would be much appreciated.
|
Hint 1: It suffices to show that $A^\top A + \gamma I$ is invertible.
Hint 2: What are the eigenvalues of $A^\top A + \gamma I$? What do eigenvalues have to do with invertibility?
Hint 3: It may be helpful to remember that $A^\top A$ is positive semidefinite.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "linear algebra"
}
|
Are shopping cart and paypal 2 different things?
Are shopping cart and paypal 2 different things ? And how to implement them in ASP.NET
|
Yes, Shopping cart and paypal are two different things. Paypal is an online payment service which you can use to pay online on a website. Shopping cart is a general term which is used to store items you want to purchase. If you want to build a shopping website in asp.net, Have a look at <
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "c#, .net, asp.net"
}
|
trigger option select and get value
I have a select menu which has a list of number options.
Rooms is an array which can contain multiple room objects. Each room object contains a number for adults and children.
When a user clicks on a dropdown menu for children or adults how do I do I get the users selected option and parse that to scope function so I can update the rooms.children for that particular room property?
I'm currently using ng-click but that function doesn't even get called.
Plunkr example here
|
Use ng-model to bind the selected value to a scope property: <
You can also use ng-options instead of ng-repeat on the options, see: <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "angularjs, angularjs scope"
}
|
How to show translation text in angularjs controller alert from json file?
I have a JSON file with translations, like this one:
"ALERT_MESSAGE" : "Select a row"
Now, I want to show an alert from my controller when the user try to access to a link without select a row.
$scope.goToNext = function () {
if($scope.isSelected === false){
alert("What should I put here?");
}
else{
Navigator.goTo("/next", {
back: "/previus",
asd: $scope.asd
});
}
};
How can I use my translations file on the controller?
|
Finally adding $filter to the controller and using it like here:
alert($filter('translate')('ALERT_MSG'));
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "json, angularjs, angular translate"
}
|
how to place nested actionscript function in an actionsript project into separate actionscript file?
I'm using Flash Builder 4.5. In an .mxml file, if you want to use an actionscript function residing in an external .as file, one simply adds to the .mxml file:
<fx:Script source="filename.as"/>
where filename.as contains the actionscript function(s).
Is there a way to do a similar thing from an .as project file? That is, I have an actionscript project created in Flash Builder 4.5 (e.g. no .mxml files anywhere), and I have a nested actionscript function. How can I place that nested actionscript function in an external file, then call it from the original file? My goal is to have that nested actionscript function be called from multiple other files, so I don't have to nest it multiple times.
|
The easiest way to do this is with a static function. Create an AS class file and remove the constructor. Now place your function in it and set the type to "public static", here is an example of a simple "stirng utility" class.
package some.place.inyourapp
{
public class StringUtils
{
public static function contains( string:String, searchStr:String ):Boolean
{
var regExp:RegExp = new RegExp( searchStr, "i" );
return regExp.test( string );
}
}
}
Now you can call that function without instantiating the class anywhere in your app by saying:
`StringUtils.contains("this is cool","cool")`
Of course, StringUtils must be imported
`import some.place.inyourapp.StringUtils`
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "apache flex, actionscript"
}
|
Display contents of a hash if value exists
I have a hash:
req = {
"count" => 50100,
"results" => [
{"listing_id" => 615929315, "state" => "active", "user_id" => 140604756, "category_id" => 69150367},
{"listing_id" => 615929311, "state" => "active", "user_id" => 152528025, "category_id" => 69150367}
]
}
I want to find and display the entire internal hash if a particular `user_id` exists. I can find it:
req["results"][0].select{|key, value| value == 152528025}
# => {"user_id" => 152528025}
How do I then display this entire (nested) hash?
{"listing_id" => 615929311, "state" => "active", "user_id" => 152528025, "category_id" => 69150367}
|
req["results"].select{|x| x["user_id"] == 152528025}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "ruby, hash"
}
|
Como actualizo un input si el checkbox es clickeado con javascript?
Lo que necesito hacer(y que aun no me resulta) es que si el cliente clickea el checkbox OrigenAeropuerto en el input DireccionOrigen tome el value del checkbox o en su defecto pueda definirle un valor a ese input que es obligatorio.
<label><i class="fa fa-map-marker"></i> Origen</label>
<input type="checkbox" name="OrigenAeropuerto" value="Aeropuerto SCL">
<i class='fa fa-plane'></i> Aeropuerto?
<input type="text" name="DireccionOrigen" id="geocomplete_origen" class="form-control input-sm" required/>
|
Con esto haces que al pulsar el checkbox o el input se ponga el valor de este en el input
function ponValor(){
valor = document.getElementById("chk").value;
document.getElementById("geocomplete_origen").value = valor
}
<label><i class="fa fa-map-marker"></i> Origen</label>
<input type="checkbox" name="OrigenAeropuerto" value="Aeropuerto SCL" id="chk" onclick="ponValor()">
<i class='fa fa-plane'></i> Aeropuerto?
<input type="text" name="DireccionOrigen" id="geocomplete_origen" class="form-control input-sm" onclick="ponValor()" required/>
Aunque como dices que es un valor obligatorio lo suyo es que cuando envies el formulario valides que el valor tenga datos con un if y que luego llames al metodo que envia los datos si se ha validado correctamente:
if(document.getElementById("chk").value == "" || document.getElementById("chk").value == null){validado = false};
|
stackexchange-es_stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "javascript, html, formularios"
}
|
cp or rsync, is cp really worth it?
I hope this does not count as a question without a real answer, as I can't seem to find a good reason to use `cp(1)` over `rsync(1)` in virtually all circumstances. Should one typically favour `rsync` over `cp`? Is there any good guideline for their use?
* `rsync`: Transfers the diffs, it can use compression, it can be used remotely (and securely), it can be restarted despite an interruption, even during the transfer of a single large file. '
* `cp` : Perhaps it's just simpler to use? Is it faster than rsync?
|
`cp` is a part of coreutils, therefore it is present everywhere. Furthermore, it primarily was designed to copy files inside one computer.
`rsync` isn't a part of coreutils, it isn't present even on the default environment. Moreover it was primarily designed to transfer files over network. Also `rsync` has more dependencies comparing to coreutils, however this difference doesn't make a big sense.
PS: By the way, the CPU usage is still matters on the embedded systems.
|
stackexchange-unix
|
{
"answer_score": 9,
"question_score": 9,
"tags": "bash, shell, rsync, utilities, cp"
}
|
Pointing to a directory in Wordpress
I am attempting to integrate a Wordpress blog page into my (php) website. So far I have been successful in creating an installing it into a subdirectory. I can see that this works.
The issue I am facing is that images are not showing (the alt text is). The issue is that Wordpress uses a incorrect path to the flies:
Wrong Path: ` Correct: `
It should not have `/wordpress/blog/`in it.
How do I go about resolving this to point at the correct directory without duplicating the files. Note that in the code the path is is written as: `/images/brand/logo.png`
|
If your image folder lays inside theme directory, then you can use
<img src="<?php bloginfo('template_url'); ?>/images/brand/logo.png" />
If your image folder lays outside the theme directory, then you may use
<img src="<?php echo home_url(); ?>/images/brand/logo.png" />
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "php, wordpress"
}
|
Sending HTML email but delivered as plain text, why?
I am using sendgrid, and this is my java code:
public void sendEmail(String templateID){
SendGrid sendgrid = new SendGrid("username", "password");
Email email = new Email();
email.addTo("...");
email.addToName("...");
email.setFrom("...");
email.setSubject("...");
email.setText("...");
email.setTemplateId(templateID);
try {
sendgrid.send(email);
} catch (SendGridException ex) {
Logger.getLogger(FXMLEditNewsLetterController.class.getName()).log(Level.SEVERE, null, ex);
}
}
The mails are being sent(I don't know why they are received as junk!!) but they are being delivered as plain text. Can someone help me, and if you need any additional information, please let me know.
|
The emails are being sent as plain text because you are using email.setText(). Try using email.setHtml() instead if the content of the message is HTML.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "java, smtp, sendgrid"
}
|
Вызов функции при вызове иной фунции
Есть код:
public interface IMain
{
public void Any ();
}
public class Extra
{
public void Extra ()
{
//code
}
}
public class Child : IMain
{
void Any ()
{
}
}
Можно ли сделать так, чтобы после вызова Any в классе Child вызывался метод Extra? При этом, чтобы это работало на все классы которые наследуются от IMain и это не нужно было менять в каждом дочернем объекте.
|
Вот вариант через интерфейс, только для версии C# 8.0
public interface IMain
{
public virtual void Any()
{
new Extra().ExtraCall();
}
}
public class Extra
{
public void ExtraCall()
{
//code
}
}
public class Child : IMain
{
}
Но, я вижу это немного по другому, через базовый класс. В дочерних классах вы можете переопределить базовый метод и если нужно внутри вызвать его же.
public class Main
{
public virtual void Any()
{
new Extra().ExtraCall();
}
}
public class Extra
{
public void ExtraCall()
{
//code
}
}
public class Child: Main
{
public override void Any()
{
base.Any();
//код дополняющий метод
}
}
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "c#"
}
|
What optimization technique does ghci use to speed up recursive map?
Say I have the following function:
minc = map (+1)
natural = 1:minc natural
It seems like it unfolds like this:
1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc...
1:2:minc(minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc(1:minc...
1:2:minc(2:minc(2:minc(2:minc(2:minc(2:minc(2:minc(2:minc(2:minc(minc...
1:2:3:minc(3:minc(3:minc(3:minc(3:minc(3:minc(3:minc(3:minc(minc(minc...
...
Although it's lazily evaluated, to build each new number `n` in the list is has to unfold an expression `n` times which gives us `O(N^2)` complexity. But by the execution time I can see that the real complexity is still linear!
Which optimization does Haskell use in this case and how does it unfold this expression?
|
The list of naturals is being shared between each recursive step. The graph is evaluated like this.
1:map (+1) _
^ |
`---------'
1: (2 : map (+1) _)
^ |
`----------'
1: (2 : (3 : map (+1) _)
^ |
`----------'
This sharing means that the code uses O(n) time rather than the expected O(N^2).
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 4,
"tags": "haskell, optimization, expression"
}
|
Word 2016- How to hide the 'Allow users to add and remove sections' feature in the Repeating Sections Properties' menu- VBA?
While the document is protected, how can I hide the '+' button at the bottom right hand corner of each repeating section so the user uses my code below to insert/add a repeating section?
My goal is for the user to use a macro to both add and delete repeating sections. Because there is no easy way to delete a selected repeating section when the document is protected, I don't want the user to be confused by having to click the '+' to add a section but then have use a macro located somewhere else to delete it.
Dim anchor_CC As ContentControl
Set anchor_CC = ActiveDocument.SelectContentControlsByTitle("General").Item(1)
With anchor_CC
.AllowInsertDeleteSection = True
.RepeatingSectionItems(1).InsertItemAfter
.AllowInsertDeleteSection = False
End With
'
End Sub
|
You cannot simply hide the Add button. You would need to disable adding and removing sections.
. Even if this don't give me a direct location, it could give me a radius of the device to the phone or the other way around. So far i've been able to gather the device name and RSSI "strenght" however, its a dynamic data i'm getting. I would like an continuously update of how good the strenght is. So the part I'm stuck on is getting the correct values(ive got -72dbm and -342654dbm form the tests) and i need updates every 3 second.
|
What you should really do is use the Android Beacon Library, it will work the distance out for you.
The actual calculation is very complex and this Library has been used by a lot of people since Radius Networks created it. The link is for the website downloads, but you can use gradle too.
It's easy to use and probably exactly what you're looking for
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, bluetooth, bluetooth lowenergy, rssi"
}
|
I can't send a button's id to another page in PHP
I'm creating a website like anyone can ask a question, and anyone can answer it. The site index is full of questions and answers.
I succeed asking a question part to mysql. I keep answers of all questions in different txt documents as answer_$id.txt.
My question is when i click answer button how can I $_REQUEST the id of the button so that I can add the answer to that id's txt document.
|
You can simple achieve this by using the hidden input type.
use the `<input type="hidden" value="<?php echo $id;?> name="question_id"/>`
and you can take the id of question on submit the answer by `$_REQUEST`. No need to add the question id in button's id.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "php, button, request, send"
}
|
Ansible args content, porting a module from 1.9 to 2.x
I'm porting a module from ansible 1.9 to 2.x, and the args file content seems.. odd? After the shlex simple strings are fine but lists and dictionaries look like over-escaped garbage. An example:
my call:
> test: "packages={{test.var}}"
and test.var is a list of packages, ['one', 'two', 'three', 'foo']
ansible 1.9 args content:
> packages=['one', 'two', 'three', 'foo']
ansible 2.3 args content:
> packages='[u'"'"'one'"'"', u'"'"'two'"'"', u'"'"'three'"'"', u'"'"'foo'"'"']'"'"]'"'"]'"'"]'
My question: "is there a way to unserialize this args data elegantly or simply?" I can strip out the offending escapes and quotes but that's gross and brittle. I didn't find anything in the porting guide that seemed relevant.
|
Alright, I didn't find an answer, but I came up with a decent way to get what I want. I'll put my answer here, in case anyone stumbles on the question with a need.
First off, the unbalanced brackets disappeared based on how you called the module:
test: "blip={{testpackages}}"
would result in the unbalanced brackets, but
test: blip="{{testpackages}}"
resulted in balanced brackets.
Secondly, the entire thing becomes moot if you just ask ansible to pass the variable through a 'to_json' filter and then read that. Playbook example:
- name: run test module (ansible 2.x)
test: packages='{{ testpackages| to_json }}'
when: ansible_version.major|int > 1
In-module example:
packages_to_test = [x.encode('utf-8') for x in json.loads(packages)]
Anyway, good luck to you, Random Person Who Did The Same Thing We Did.
|
stackexchange-serverfault
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python, ansible"
}
|
Returning random key and word from array in mongoDB
I have a collection with one document. It looks like this:
words: {
wordOne: ["Cat", "Dog","Fish"],
wordTwo: ["Red", "Blue", "Green"],
wordThree: ["Square","Cirecle","Triangle"]
}
I would like to **query the DB to select a random key** (`wordOne`, `wordTwo` or `wordThree`) **and then return a random word from the array on that key**.
So far I've written a query that returns the entire document and then I use JS to select a random key and then a random word. That does work of course but I've read that if you can have the DB do the work, it's better to do it that way. Plus I'm really curious how it would be accomplished.
I'm using Node and mongoose
|
Alternative solution:
db.collection.aggregate([
{
$project: {
words: {
$reduce: {
input: {
$objectToArray: "$words"
},
initialValue: [],
in: {
$concatArrays: [
"$$value",
{
$map: {
input: "$$this.v",
as: "w",
in: {
key: "$$this.k",
word: "$$w"
}
}
}
]
}
}
}
}
},
{
$unwind: "$words"
},
{
$replaceWith: "$words" // For MongoDB v3.4 $replaceRoot:{newRoot:"$words"}
},
{
$sample: {
size: 1
}
}
])
MongoPlayground
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "node.js, mongodb, mongoose"
}
|
jquery validator.methods.number and comma instead of dot in number
I found this nice tutorial for checking numbers if instead of dot comma's are used
<
$.validator.methods.number = function (value, element) {
return this.optional(element) || /^-?(?:d+|d{1,3}(?:[s.,]d{3})+)(?:[.,]d+)?$/.test(value);
};
but this regex
/^-?(?:d+|d{1,3}(?:[s.,]d{3})+)(?:[.,]d+)?$/.test(value)
always return `false`.
For example value `5` is `false`
what is wrong?
|
Use this regex:
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:[\.,]\d+)?$/.test(value);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "regex, validation"
}
|
trying to rotate a div element with jQuery controlling css3 transform command
Basically, what I've got going is a timer that counts every half second and on that it should update the degree and the div should be rotated to the new degree. The end result of this should (theoretically) be a somewhat smooth constantly rotating div.
Sadly, it goes as far as rotating it 1 degree and then the degree is not updated again even though according to the console log the number is still counting up.
Any suggestions?
setInterval(function()
{
var i = 0;
i++;
$('#nav').css({'-webkit-transform' : 'rotate(' + i + 'deg)'});
console.log(i);
}
, 1000);
Thanks!
|
Every time that function is called you are setting the variable `i` back to zero:
var i = 0;
...then adding one.
i++;
So it will always be "1". You need to store that value somewhere else, OR parse it from the css attribute each time, then add one. Here is the former solution as an example:
var rotate_degrees = 0;
setInterval(function()
{
rotate_degrees++;
$('#nav').css({'-webkit-transform' : 'rotate(' + rotate_degrees + 'deg)'});
console.log(rotate_degrees);
}
, 1000);
What makes the difference is declaring the varialbe _outside_ the scope of the function as opposed to inside.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 0,
"tags": "jquery, css, transform, rotation"
}
|
Can't get value of Map<BigDecimal, String> by key
I have a map like
Map<BigDecimal, String> functions = new HashMap<BigDecimal, String>();
When I try to access the value of map from a JSF page, it displays nothing. I checked the size of map and it returns a number, it seems not empty. Here is the JSF page code
<p:dataTable value="#{bean.permissions}" var="permission">
<p:column>
#{bean.functions[permission.functionId]}
</p:column>
</p:dataTable>
How is this caused and how can I solve it?
|
`BigDecimal` is a bad key for `HashMap`, it uses the BigDecimals memory address as the key, so even if you have 2 equal values, its a different key, try using the `toString()` of the BigDecimal as the key
|
stackexchange-stackoverflow
|
{
"answer_score": -6,
"question_score": 1,
"tags": "java, jsf, hashmap, bigdecimal"
}
|
Is the volatile mark necessary for a queue with one thread adding and another reading?
in response to some comments in this thread, I am wondering if making a queue that will have one thread adding to it and another thread reading from it requires the 'volatile' mark?
I suppose most cases would be alright, but in the case of reading and writing in a queue of size 1 could cause issues without it?
Goal:
* a thread safe queue where I can post messages to be sent over a TCP socket connection. The out stream will be managed by another class who will check if the queue is empty at the beginning of each loop
My Ideas/Thoughts:
* Maybe there is a built-in Queue for TCP sockets that I have not found in my research?
* Is volatile good to use in this circumstance, or should I use a blocking or locking call?
Thanks in advance.
|
Use lock objects if you want synchronized access like you've mentioned.
Volatile is not really used in this context. Declaring your `List myList` object as volatile would mean that if you ever tried to instantiate a new Object and set it to the myList variable, then the thread would be guaranteed to know that there is a new object assigned to it (roughly). It doesn't block or synchronize anything to do with the actual object.
Basically, like you said, you need to be sure that when you are reading or writing to the list, that nothing will mess the list up and cause an unexpected error. For stopping two things from happening at the same time, use lock objects and the Java synchronized keyword ~~, or use a List type that already synchronizes read/writes for you.~~
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, tcp, queue, volatile"
}
|
How can I put a hover on this Button Style?
These are my codes for the Button. Somehow, background color only works if I do declare the style in the Button itself. Stating the background color in the const useStyles does not work, hence, I only did this. How can I code this where the background color changes when it hover on it?
<Button
variant="contained"
{...otherProps}
className={classes.margin}
style={{ backgroundColor: " #e31837" }}
>
{children}
</Button>
|
you can use the root property to change your button style (docs), and also change its background on hover:
const useStyles = makeStyles((theme) => ({
root: {
backgroundColor: 'red',
'&:hover': {
backgroundColor: 'blue'
}
}
}));
<Button
variant="contained"
{...otherProps}
className={classes.root}
style={{ backgroundColor: " #e31837" }}
>
{children}
</Button>
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "reactjs, material ui"
}
|
Reading from file at eof
When reading from a file using the following command, and get iostat value to be eof, is the data from s valid or should I discard it?
Read (u, "(a)", iostat=st) s
|
Upon an end of file condition for a READ statement, all variables in the input list become undefined. See F2008 9.11.3 item (3).
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -1,
"tags": "fortran"
}
|
Add hidden data in ExpandableListView childs
Is it possible to add hidden data to the items of an ExpandableListView?
For example, in HTML I would do something like create a new attribute and than, get it from the selected item using JavaScript.
<select>
<option hidden-data="298">Submenu 1</option>
</select>
For now, I can only get the text from the child and I need to pass an ID for each child to search the database for the right information.
Something like:
listDataHeader.add("Menu 1");
List<String> menu1 = new ArrayList<String>();
menu1.add("Submenu 1").addExtraData("ID = 23");
menu1.add("Submenu 2").addExtraData("ID = 24");
|
i don't know about the hidden values but you can add values related to list using HashMap. Code is given below. You can do something like that
HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
...
...
menu1.add("SubMenu1");
hashMap.put("Submenu1",23);
..
You can retrieve the Id of "SubMenu1" using-
int id=hashMap.get("Submenu1");
After that use that id.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "android"
}
|
Dynamics CRM - Change Lookup (Autocomplete) View of Customer Entity
i'm new on microsoft dynamics crm. I need to customize a view of customer search field (what i understand as a autocomplete), in order to add some fields and allow users to search through these fields.
I found some links on internet and i found some authors that says that is necessary to change the views of the entities, however, i couldn't find any that could represent these specific view.
I'm attaching an image of the view that i want to customize.I want to know if it is possible to change it through the crm. If yes, where and what i should customize.
 to adjust to the new screen size.
**Update for clarity:**
Before iPhone 6 and 6 Plus, my images were named like this:
Icon-40.png
[email protected]
In order to get the wanted `optimized for iPhone 6 and iPhone 6 Plus` text, you need to add a third resolution of each image and name them with a `@3x` where the `@2x` was before. So you end up having these three images - **per image** you want to show in the app-.
Icon-40.png
[email protected]
[email protected]
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 13,
"tags": "xcode5, app store, ios8"
}
|
<command-line>:0:11: warning: extra tokens at end of #undef directive [enabled by default]
Problem with compiling.
gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)
c89
cmake version 2.8.7
Not sure how to start with this one. I have googled it but couldn't come up with anything.
This is the warning I am getting:
<command-line>:0:11: warning: extra tokens at end of #undef directive [enabled by default]
I am using cmake as the build system that creates the Makefile that I will compile. However, I am not sure why I am getting this warning. I have never had that before.
Can any one point me in the right direction. I am not sure what information I should provide to help solve this problem.
Many thanks for any suggestions,
|
I would expect a warning like this if you had a line like the following in one of your source files:
#undef FOO BAR BAZ
The `BAR` and `BAZ` are ignored by the compiler, hence the warning. What's at character 11 of your command-line? Can you post the command line?
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "c, gcc, cmake"
}
|
Error when creating table with more than 9 columns using {*} shortcut
I can't imagine that this hasn't been asked before, but googling doesn't help me find the answer.
Creating a table with 9 columns using the shortcut `{*9{l}}` works fine:
\documentclass{article}
\begin{document}
\begin{tabular}{*9{l}}
\end{tabular}
\end{document}
But when I get into double digits, I get an error:
\documentclass{article}
\begin{document}
\begin{tabular}{*10{l}}
\end{tabular}
\end{document}
> ! LaTeX Error: Illegal character in array arg.
How can I use the shortcut `{*}` with >9 columns?
|
You will have to wrap the relevant number into curly braces if it is not single digit.
So
\documentclass{article}
\begin{document}
\begin{tabular}{*{12}{l}}
1&2&3&4&5&6&7&8&9&10&11&12\\
\end{tabular}
\end{document}
should cut it.
|
stackexchange-tex
|
{
"answer_score": 4,
"question_score": 2,
"tags": "tables, errors, columns"
}
|
Why is my Neovim not in English and how do I force it to be?
I'm using Neovim 0.2.2 on macOS High Sierra (10.13.1), installed via `brew install neovim`.
I removed `.config/nvim/init.vim`.
Neovim starts up using German for interface labels, as shown here:

2. Add a line `language en_US`
3. Save it and reload Neovim
I would like to give all the credits to @anothernode. I've just convert his comment into the regular answer.
|
stackexchange-vi
|
{
"answer_score": 10,
"question_score": 8,
"tags": "neovim"
}
|
CSS PX to Percentage
Ok so this question seems to have been asked a fair few times but still haven't managed to get the plain simple answer I'm after from looking at others questions so will ask this my own way. I'm wanting to create a site with a container in CSS as follows:
.container {
height: 100%;
margin: 0 auto;
width: 980px;
}
However for the width I'm wanting to use a percentage but for the life of me I cannot find one simple answer or even a site that converts PX to % or even just to get an answer to what percentage is used in place of 980px or 960px ? Is it 62.5% or 70% ?
Could someone please help me out with this and answer this simple question or at least give me a site that I can look at with conversions and just before anyone answers with PX to EM site, I've already looked at it and it's not clear as that site is more for font sizes.
Thank you to anyone who can answer this!
|
I hate to break it to you, but you're likely to have a few people rolling their eyes at you here.
A percentage is relative to whatever the parent container's size is. `50%` means "half of the width of the parent". There _is_ no "px-%" conversion, because one is a fixed value and the other is a flexible ratio. That's... kinda why you can't find any such thing.
|
stackexchange-stackoverflow
|
{
"answer_score": 29,
"question_score": 10,
"tags": "html, css, percentage"
}
|
FragmentManager Showing Error in android studio.what i did wrong here?
public class MainActivity extends AppCompatActivity implements Communicator{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void respond(String data) {
FragmentManager manager=getFragmentManager();
FragmentB f2=manager.findFragmentById(R.id.fragment2);
f2.changetext(data);
}
}
|
When your `Activity` extends `AppCompatActivity`, which in turn extends `FragmentActivity`, you have to use `getSupportFragmentManager()` instead of `getFragmentManager()` as stated here.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -3,
"tags": "android"
}
|
Is $C_1 + C_2$ closed?
Two questions jump into my mind when I was working with cone, I feel they are very related to each other. one I asked here "Is $T(C) \subseteq R^m$ closed?"
Second one is: If $C_1$ and $C_2$ are two closed, convex cone in $R^n$ then is $$C_1 + C_2 = \\{c_1 + c_2 \; | \; c_1 \in C_1 , ~ c_2 \in C_2\\} $$
a closed set?
The answer for my first question is No, I feel the answer of my second question is No as well but I dont have an explicit example to confirm that.
|
OK, a counter-example.
Let $C_1$ be the closed convex cone $x^2+y^2\leq z^2$, $z\geq 0$ in $\mathbb{R}^3$, and $C_2$ be the half-line $t(1,0,-1)$, $t\geq 0$.
Then $C_1+C_2=\operatorname{conv}(C_1\cup C_2)$ does not contain $(0,1,0)$, but it contains $$ \overbrace{(-t,1+t^{-1},t + \frac{t^{-1} + 2t^{-2} + t^{-3}}2)}^{\in C_1}+\overbrace{(t,0,-t)}^{\in C_2}=(0,1+t^{-1},\frac{t^{-1} + 2t^{-2} + t^{-3}}2) $$ for all $t\gg 1$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 3,
"tags": "general topology, functional analysis, convex analysis"
}
|
IntelliJ adds a 'generated' folder/package to artifact
When I build a .jar artifact using IntelliJ, it adds an empty folder/package named 'generated' to my jar file. Why is that?
My artifact 'Output Layout':
name.jar
- file.yml
- '%module name%' compile output

val bF : Future[Either[X, Y]] = getFuture(...)
val cF = Future[List[Long]] = getFuture2(...)
val combinedFuture = Cartesian.tuple3(aF, bF, cF)
combinedFuture match {case (a, b, c) =>
...
}
But I get an error
Error:(36, 44) could not find implicit value for parameter cartesian: cats.Cartesian[scala.concurrent.Future]
val combinedFuture = Cartesian.tuple3(aF, bF, cF)
But as you can see I have imported all the implicits, intances.future._ and syntax.
I am using Cats 0.9.0 on Scala 2.11.8
|
You're missing the implicit `ExecutionContext`:
import scala.concurrent.ExecutionContext.Implicits.global
I've had this happen many times when using the type class pattern on `Future[T]`, it is always the execution context which is easily forgettable, but makes the type class not resolve the implicits properly.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "scala, scala cats"
}
|
Format an iterator in LabVIEW
I am writing out a series of files in a while loop, they are named
`1.dat, 2.dat, 3.dat...`
but I need the numbers to be formatted to -
00001.dat, 00002.dat, 00003.dat...
so that the file order is maintained when reading them back in. Is there a way to change the format of the while loop iterator?
|
Use the "format into string" node, it allows to pad integer with zeros:
!enter image description here
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 0,
"tags": "iterator, while loop, format, labview"
}
|
my form doesen't work right
I made a form but it doesn't send to my email; instead, it opens Windows Live Mail.
Here is my code:
`<form name="name" action="mailto:[email protected]" method="post">`
What can I do to make the form send to my email instead of opening Windows Live Mail?
|
Your code IS good. Your code does exactly what it is supposed to do. When you submit a form with `action` attribute involving a `mailto:`, it opens up your email program to send an email to the `[email protected]` address.
If you want the form to not send the email using the system's default mail program, you need to use something server-side. I don't know of any client side solutions, but who knows. There might be something out there...
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "html, forms"
}
|
How to check if txt file exists inside template folder?
I have a folder inside my theme where I hold some txt files which I am including in a theme. The problem is that before including txt file I need to check if it does exist. I fail checking it the following way and have no idea why it wont work, always returns false.
$themeLocation = get_bloginfo('template_url');
$fileName1 = $themeLocation.'/txtfolder/file1.txt';
if(is_file($fileName1)){
echo 'It does exist';
} else {
echo 'Error';
}
|
You are trying to check it by URL, which makes no sense to `is_file()` which expects local path. By the way I'd use `file_exists()` instead.
Try:
$fileName1 = TEMPLATEPATH . '/txtfolder/file1.txt';
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "include, filesystem, wp filesystem, template include"
}
|
$\lim_{n\to\infty}\int_{X}\lvert f_n -f \rvert \, d\mu=0$. Why does this imply that $\lim_{n\to\infty}\int_{X}f_n \, d\mu=\int_{X}f \, d\mu$?
If $f \in L^1(\mu$), then the Lebesgue integral $$\left\lvert \int_{X}f \, d\mu \right\rvert \leq \int_{X}\lvert f \rvert \, d\mu.$$
Also, for a sequence of complex measurable functions on $X$ such that $$f(x) = \lim_{n\to\infty}f_n(x)$$ exists for every $x\in X$, $$\lim_{n\to\infty}\int_{X} \lvert f_n -f \rvert \, d\mu=0.$$
Why, exactly, does this imply that $$\lim_{n\to\infty}\int_{X}f_n \, d\mu=\int_{X}f \, d\mu ?$$
It should be something like one step and a a trivial conclusion but I want the exact steps written out.
|
Remark that $\lim \limits_{n \rightarrow \infty} a_n = a$ if and only if $\lim \limits_{n \rightarrow \infty} |a_n - a| = 0$. Then simply use:
$$ 0 \leq \lim \limits_{n \rightarrow \infty} \left|\int_X f_n d\mu - \int_X f d\mu \right| \leq \lim \limits_{n \rightarrow \infty} \int_X |f_n - f| d\mu =0 $$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 2,
"tags": "limits, absolute value"
}
|
Высота таблицы на все оставшееся место
В следующем каркасе:
<div id="menu"></div>
<table style="height:100%;>
<!-- content -->
</table>
<div id="prompt"></div>
Нужно сделать так, чтобы menu и prompt имели фиксированную высоту и были расположены относительно таблицы сверху и снизу соответственно. А таблица занимала по высоте все оставшееся место. В данном случае высота равна высоте родительского блока.
Как осуществить определение высоты по оставшемся месту?
Пока, как вариант, сделал в таблице padding'и сверху и снизу, и соответствующие им отрицательные margin'ы. С виду - не костыль, но может есть другие способы?
|
Можно сделать без отрицательных **margin** 'ов, если есть возможно добавить для родительского контейнера **position** отличный от **static**. Тогда для **#menu** и **#prompt** добавляем **postion: absolute** , а для таблицы добавляем **padding** 'и нужной высоты.
Пример <
Но вариант лучше - это сделать **#menu** и **#prompt** частью таблицы, например: < Здесь не будет зависимости от высоты контента #menu и #prompt, плюсом еще вертикальное позиционирование.
Вариант лучше предыдущего - это переписать на блочную верстку ( **display: table\table-row\table-cell** ) или flex.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "html, css, вёрстка"
}
|
Ionic app works with both "ionic serve" and in ionic view, but not with "ionic build ios"
My ionic app uses google api geolocation service and works fine when I run it using "ionic serve" and with Ionic View app. However, when I run "ionic build ios" and run the app on my ios device, the geolocation service does not work. I thought it was because location service was not on. I went to setting > Privacy > Location Service to allow location service however, I realized that the app I am working on is not listed there. (But there is ionic view app icon and the location service is allowed. I think that's why it works with ionic view app). Also I realized that the app is not even listed on setting.
How can I list ionic app ("ionic build ios") on setting in ios so that I can change permission for location service?
Any suggestions will be appreciated. Thanks in advance.
|
May be you need the GeoLocation plugin to get access of location services in your phone. Try adding it by
cordova plugin add cordova-plugin-geolocation
and then allow access to it when it start using its services in your phone. This way your app will be listed in the location service settings too.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "ios, ionic framework, google api, geolocation"
}
|
How to set score google play game services as time format?
I have tested to submit a score in a time format not integer but when I open the leaderboard I got my score show like this format 0.03 whereas when I created the leaderboard in gpgs it shows the format should be 00:00:00 ?any idea why I am seeing the time like that..
when I send 75 seconds which suppose to be in this format 00:01:15 --> I got 0.08 in gpgs leaderboard.
note: I am using corona sdk + lua
|
For others who come across this, Google expects the time to be in milliseconds. Simply multiply the score by 1000 and it will work as expected.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 0,
"tags": "lua, coronasdk, google play games"
}
|
The direct object of attendre
I'm curious about the choice in wording in the following sentence:
> L'installation terminée, la ville attendit son évêque à l'œuvre.
**First** , could it also be expressed by changing the direct object to _l'œuvre_? As follows:
> L'installation terminée, la ville attendit l'œuvre de l'évêque.
**Second** , the idea is that they were waiting to see how he would conduct his work, but that idea gets condensed with the prepositional phrase: _attendit ... à l'œuvre_.
Is it common to express it this way — that is, by making the person the object of _attendit_ while expressing the anticipated activity, deeds or behavior with the prepositional phrase: _à_ [activity]?
|
The expression _attendre à l'œuvre_ is perfectly correct and still used nowadays, in particular in the sentence _**on l'attend à l'œuvre**_.
It means to be in the expectation, waiting for someone to act.
_Attendre l'œuvre_ is a possible expression but has a different meaning. Here we expect a masterpiece to be produced.
|
stackexchange-french
|
{
"answer_score": 3,
"question_score": 1,
"tags": "syntaxe"
}
|
JBoss 5.1 jsp dev mode: Always recompile jsps?
Is there a setting somewhere in JBossAS 5.1GA that forces a recompile of JSPs on each http request?
I guess I could delete the work dir each time but there must be a better way.
|
Look in this file: JBoss_install_directory/server/default/deploy/jboss-web.deployer/conf/web.xml.
There is an entry named "development". Set this to true.
Sorry to not have an example of this file. I no longer use JBoss 5, so my notes only contained the path the the file.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "jsp, jboss, compilation"
}
|
Groups of prime order are cyclic
A result in Group Theory says that every group of prime order is cyclic. I understand the proof on: < but i dont understand why the order of the element must exist. example:Consider G={e,a,b}, $a\cdot b=e$ ,$b \cdot a=e$,$a \cdot a=a$,$b \cdot b=b$,where e is the identity element.clearly G is of prime order( 3) but i dont see how the group is cyclic
|
To see that the order of an element in a finite group exists, let $ G $ be a finite group and $ a $ an arbitrary non-identity element in that group. Since $ G $ is finite, the sequence $ a, a^2, a^3, \dots $ must have repeats. Let $ m $ be minimal such that $ a^m = a^n $ for some $ n < m $. Then $ m - n > 0 $ and $ a^{m - n} = 1 $. (In particular, you have $ a = 1 $ in your example, hence why it doesn't work).
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "abstract algebra, group theory"
}
|
Throttle a file share in Windows Server (2008 R2)
We are in the process of moving our central storage to SharePoint and people are complaining about slowness because our former file share is so blazingly fast. Does anyone know a way for me to slow down or throttle access speed to a windows server file share to gradually make the perceived difference negligible, or even make SharePoint seem faster?
|
## Technical Answer
Simply use one of a myriad of third party software tools to throttle bandwidth to and from the server, or put it behind a managed port on a firewall that can do the same.
## Correct Answer
This is a personnel issue. Get business leaders to throw their weight behind one decision or the other. Technical solutions will always fail to _truly_ solve personnel issues, especially when the technical "solution" is based on deception.
|
stackexchange-serverfault
|
{
"answer_score": 3,
"question_score": -1,
"tags": "windows server 2008 r2, network share"
}
|
Tool that allows one user to record his desktop activity and send to other user in real-time
I need a free tool for online teaching. It has to record my desktop activity and transmit it over the Internet in real time to other person to watch.
|
VLC can do this, if you want to stream live.
For just recording, check out either gtkRecordMyDesktop (Linux) or Jing (free, but time limited on recordings) or Camtasia.
For even more functionality, a web conference tool like Big Blue Button may do the trick. Document sharing, desktop sharing, audio/video/chat, etc
You may want to look at using a course management system that has these types of tools built in - in which case, I use and for the most part love Canvas. Canvas has Big Blue Button built into it along with all sorts of other useful things for teaching both face to face and online.
|
stackexchange-softwarerecs
|
{
"answer_score": 0,
"question_score": 0,
"tags": "screen recording, streaming, real time"
}
|
getting the date out of a string in an array then sorting those strings by the date
I need help getting the date out of strings in an array then sorting those strings by the date. This is the array with each strings index number.
array = [
[0] "Bonk Radek S Male Green 6/3/1978",
[1] "Bouillon Francis G Male Blue 6/3/1975",
[2] "Smith Steve D Male Red 3/3/1985"
]
I want to re-arange and sort each string by the date in ascending order. Anyone have a clean and simple way of doing this in ruby?
|
You can do
require 'date'
array = [
"Bonk Radek S Male Green 6/3/1978",
"Bouillon Francis G Male Blue 6/3/1975",
"Smith Steve D Male Red 3/3/1985"
]
array.map { |str| str[/\d+\/\d+\/\d+/] }
# => ["6/3/1978", "6/3/1975", "3/3/1985"]
array.map { |str| Date.strptime(str[/\d+\/\d+\/\d+/], "%d/%m/%Y") }
# => [#<Date: 1978-03-06 ((2443574j,0s,0n),+0s,2299161j)>,
# #<Date: 1975-03-06 ((2442478j,0s,0n),+0s,2299161j)>,
# #<Date: 1985-03-03 ((2446128j,0s,0n),+0s,2299161j)>]
# to sort
array.sort_by { |str| Date.strptime(str[/\d+\/\d+\/\d+/], "%d/%m/%Y") }
# => ["Bouillon Francis G Male Blue 6/3/1975",
# "Bonk Radek S Male Green 6/3/1978",
# "Smith Steve D Male Red 3/3/1985"]
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "ruby, arrays, string, sorting, date"
}
|
How do I download the b1.7.3 server file?
I really want to play b1.7.3 with my friends (it was the first version of Minecraft I ever played!) but I cannot find where/how to download it. I've tried mcversions.net but server files are not included for beta versions.
|
This Youtube video has the downloads to a variety of old server jars in its description. After downloading the jar and setting up the server, I can confirm that it is functional.
Here is a direct link to download the b1.7.3 server jar.
|
stackexchange-gaming
|
{
"answer_score": 2,
"question_score": 4,
"tags": "minecraft java edition"
}
|
Buy with Address instead of integrated address - monero wallet GUI
I ve used my address instead of an integrated address to buy monero coins via an online plateform and now the balance of my wallet is not updating. Does anyone know what I should do in this case?
When verifying with `xmrchain.net`, I get this:
.
The fact that you are attempting to connect to a remote node (based on your comments about connecting to the moneroworld node) seems to indicate that you have not synced your own node yet. If your node is stuck, please try this
Alternatively you CAN connect to a remote node (until you have the time to sync your own node). Follow the instructions on this page again. A list of available nodes is available here
|
stackexchange-monero
|
{
"answer_score": 2,
"question_score": 2,
"tags": "monero wallet gui, integrated address, address"
}
|
Side element fixes to top of page once scrolled to
I'm not even sure I'm describing this properly, but basically I want to display a leaderboard ad the way www.okcupid.com has setup.
I found this question helpful ( but it stays fixed. I would prefer it to scroll with the page until it reaches the top and then be fixed. Any ideas?
|
You would use JavaScript.
The element will have normal flow on your page, and when the `document.body.scrollTop` is larger than the element's `y` position, give it `position: fixed`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "css, element, fixed"
}
|
Proper disposal of old kippot
Is there a proper and respectful means of disposal of old kippot? I have lots lying around. I set aside many of them that are dingy and aren't ever going to be worn again by anyone. What can I do with them?
|
Kippot do not have any inherent holiness to them and may be disposed in your regular trash. Sources: shaimos.org, Star-K
|
stackexchange-judaism
|
{
"answer_score": 11,
"question_score": 7,
"tags": "halacha, kippa yarmulka"
}
|
laravel - get all belonging of specific user (filter with related model)
can someone tell get how to get all the fixtures of competitions user joined.
fixtures belong to a competition
public function competition()
{
return $this->belongsTo(Competition::class);
}
competition has many users
public function users()
{
return $this->belongsToMany(User::class);;
}
this is my code (which is returning all fixtures (even user is not joined to competitions)
$f = Fixture::where('status','NS')
-> (['competition'=>function ($q)
{
$q->has('users', function($q) {
}])
->orderBy('fixtures.kickoff','asc')->get();
|
Try this query:
Fixture::where('status','NS')
->whereHas("competition.users")
->get();
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, laravel"
}
|
Sound Problem in ubuntu 12.10
I upgraded Ubuntu 12.04 to 12.10 the day before yesterday and am using it till now.The weird thing is that only the startup sound comes when I log in,then comes silence.
I tested both Digital Output (S/PDIF) and the speakers in the sound settings but can hear nothing. I also tried
Any help?
|
It depends of the system. Begin with this, and if it is not solved, I tried this and it worked for me.
|
stackexchange-askubuntu
|
{
"answer_score": 2,
"question_score": 1,
"tags": "sound, 12.10"
}
|
If $\sum\limits_{n=1}^\infty a_n $converges does it imply that $\sum\limits_{n=1}^\infty \dfrac {a_n^{1/4}}{n^{4/5}}$ is convergent?
> Let $\sum_{n=1}^\infty a_n$ be a convergent series of positive terms, then is it true that $$\sum_{n=1}^\infty \dfrac {a_n^{1/4}}{n^{4/5}}$$ is convergent ?
I tried comparing with $\sum a_n$ , but without any progress.
Please help with any hint.
|
> By Holder inequality: Proving Holder's inequality for sums with $ \frac14+ \frac{1}{\frac43}= 1$ we have, $$\sum_{n=1}^\infty \dfrac {a_n^{1/4}}{n^{4/5}} \le \left(\sum_{n=1}^\infty a_n\right)^{1/4}\left(\sum_{n=1}^\infty \dfrac {1}{n^{\frac{16}{15}}}\right)^{3/4}<\infty$$
Given that by Riemann series we have, $$\sum_{n=1}^\infty \dfrac {1}{n^{\frac{16}{15}}} =\sum_{n=1}^\infty \dfrac {1}{n^{1+\frac{1}{15}}}<\infty.$$
|
stackexchange-math
|
{
"answer_score": 12,
"question_score": 6,
"tags": "calculus, real analysis, sequences and series, analysis, convergence divergence"
}
|
Get Parent Category Name
I have category pages and within those are sub-category pages. Those sub-category pages have a sidebar displaying the filterable options within that subcategory. I want to echo out the name of the parent category at the top of that sidebar. I'll need to do this for each parent category.
|
Try below
$allCategoryIds = ALL_YOUR_CATEGORIES_AS_ARRAY;
foreach($allCategoryIds as $categoryId){
$_category = Mage::getModel('catalog/category')->load($categoryId);
echo $categoryName = $_category->getName()."<br />";
}
|
stackexchange-magento
|
{
"answer_score": 1,
"question_score": -1,
"tags": "category, name"
}
|
Can I preserve local ivy repository in Bluemix BUILD & DEPLOY?
Bluemix BUILD & DEPLOY seems to provide a new virtual machine for every build. Ivy local repository (~/.ivy2) is cleared and dependency jar download runs during every build. That takes too long. Is there any way to avoid this?
|
You're right--the pipeline spins up a new virtual machine for each build. Your only other option is likely to include those dependencies in the build input.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ibm cloud, devops"
}
|
What is the problem with 'react-native-elements'?
When I try to use 'react-native-elements' package in my code, I face this error :
> bundling failed: Error: Unable to resolve module `react-native-vector-icons/FontAwesome` from `node_modules\react-native-elements\src\social\SocialIcon.js`: react-native-vector-icons/FontAwesome could not be found within the project.
I have done many things to fix it. I installed the 'react-native-vector-icons' again, I used 'rm ./node_modules/react-native/local-cli/core/fixtures/files/package.json' but non of them worked. what should I do to overcome this problem? I really appreciate your help guys.
|
make sure that you've installed the package with **npm install react-native-vector-icons** and link it through
**react-native link react-native-vector-icons**
then for ios you need to install pod (goto your project ios folder on terminal and enter command **pod install** )
and then reset packager cache with react-native start --reset-cache
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 1,
"tags": "react native, react native elements"
}
|
Identify and label the largest number in each group
Hi I want to identify and label the largest number for each group, can someone tell me how to get this done in r (or maybe excel would be easier)? The following is an example data, the original data contains only the left 2 columns and I want to generate the third one. In the 3rd column, I want to label the largest value in the group as 1, e.g., in group 1, the largest is .02874 so it's marked as 1, otherwise 0. Thank you!
x <- read.table(header=T, text="group value largest
1 0.02827 0
1 0.02703 0
1 0.02874 1
2 0.03255 0
2 0.10394 1
2 0.03417 0
3 0.13858 0
3 0.16084 0
3 0.99830 1
3 0.24563 0")
UPDATE: Thank you all for your help! They all are great solutions!
|
Finally, the base (no package required) approach:
is.largest <- function(x) as.integer(seq_along(x) == which.max(x))
x <- transform(x, largest = ave(value, group, FUN = is.largest))
Note that if I were you, I would remove the `as.integer` and just store a logical (`TRUE`/`FALSE`) vector.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "r, excel, sorting, max"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.