INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Prove area under curve is between two values
The question reads:
Prove that $$0 \leq \int_\frac{\pi}{4}^\frac{\pi}{2} \frac{\sin(x)}{x} \, dx \leq \frac{\sqrt2}{2} \ .$$
I know that I should apply $$ m(b-a) \leq \int_a^b f(x) \, dx \leq M(b-a)$$ where $ m \leq f(x) \leq M $ on $[a, b]$.
If this where simply $\sin(x)$ it would easier to evaluate, but dividing by the x term is throwing me off. Any suggestions on where to start?
|
Hint 1:
$$f(x)=\dfrac{\sin{x}}{x}\le f(\dfrac{\pi}{4})$$ because $f'(x)<0,x\in (\pi/4,\pi/2)$
Hint 2 Use Cauchy-Schwarz inequality $$\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\dfrac{\sin{x}}{x}dx\le\sqrt{\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\sin^2{x}dx\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\frac{1}{x^2}dx}=\sqrt{\dfrac{\pi+2}{4\pi}}<\dfrac{\sqrt{2}}{2}$$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 2,
"tags": "calculus"
}
|
Diff which folders are missing
I have two folders each which contain a lot of subfolders. Most of the files and folders should be the same, but I want to be able to figure out which folders are missing.
For example:
Folder1/
A/
1.jpg
B/
2.jpg
C/
3.jpg
D/
4.jpg
and
Folder2/
A/
1.jpg
E/
2.jpg
C/
3.jpg
D/
4.jpg
Is there any way to know that "B" got deleted? I'm running windows, but I have cygwin installed so bash scripts, diff, or python/perl would work.
I know I can just "diff -q -r Folder1 Folder2" everything in both folders, but that takes FOREVER and spits out everything that's changed, including files in those folders, where I just need the folders themselves.
Any suggestions?
Thanks!
|
diff -u <(cd Folder1 ; find | sort) <(cd Folder2 ; find | sort)
Some notes:
* This would include files that are added/removed, but not files that are merely modified. If you don't even want to include files that are added/removed, change `find` to `find -type d`, as herby suggests.
* If a given directory is added/removed, this will also list out all the files and directories _within_ that directory. If that's a problem, you can address it by appending something like `| perl -ne 'print unless m/^\Q$previous\E\//; $previous = $_;'`.
* Barron's answer makes me realize that you didn't actually specify that you need the folders to be examined recursively. If you just need the very top level, you can change `find` to either `find -maxdepth 1` (or `find -maxdepth 1 -type d`) or `ls -d *` (or `ls -d */`), as you prefer.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "windows, linux, bash, shell, diff"
}
|
sentence index for getOpenIE method in coreNLP for R
I' using the R wrapper for Stanford's CoreNLP tools, specifically the `getOpenIE` method in order to extract relation triples. This appears to work fine but I'm a bit confused about the output. Whereas `getCoreference` returns a dataframe with a sentence column `getOpenIE` does not and `subject_start` and `subject_end` etc. seem to be in-sentence references. How can I determine the exact position of those elements in a document?
|
You want to look at the XML output. All the getOpenIE/getCoreference functions do is parse the XML anyway. I had to edit those functions as well to get sentence information.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "r, nlp, stanford nlp"
}
|
Bitset inside template declaration
I would like to know if it is possible to have bitset inside a template declaration like so:
ListData<bitset<64>>* hamming = new ListData<bitset<64>>();
ListData is class containing a T element like so:
template <typename T>
class ListData {
public:
...
private:
T number;
};
The compiler says that the template argument invalid and that hamming was not declared in this scope. Any idea?
p.s. I am unable to use C++ vector containers due to my assignment's restrictions
|
I found the answer. It turns out the compiler thought ">>" in:
ListData<bitset<64>>* hamming = new ListData<bitset<64>>();
was recognised as the overloaded operator >>.
ListData<bitset<64> >* hammingList = new ListData<bitset<64> >();
Thus the above fixes the problem.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c++, templates, std bitset"
}
|
Create new Git repo at GitHub through restful API?
Is it possible to create a new Git Repo at GitHub through restful API and not manually through their site?
|
Yes, see the Repositories API page. You do a post to `repos/create` with at least a `name` parameter.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "ruby, git, github"
}
|
How to make circuit for randomly selected gate?
I am trying to make a circuit for the randomly selected gates from a `gate_list` but I don't know how to put these selected gates in front of `qr.` statement. I don't know how to do this exactly is there any batter way to do this?
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
import random
n = 8
gate_list = ['u1', 'u2', 'u3', 'id', 'x', 'y', 'z', 'h', 's']
selected_gates= []
for i in range(0,8):
x = random.choice(gates)
a = '({})'.format(i)
k = x+a
selected_gates.append(k)
print(selected_gates)
qr = QuantumCircuit(n)
qr.selected_gates[0]
qr.selected_gates[1]
qr.selected_gates[2]
qr.selected_gates[3]
qr.selected_gates[4]
qr.selected_gates[5]
qr.selected_gates[6]
qr.selected_gates[7]
qr.draw()
|
This is very similar to an function in terra `random_circuit`: < It randomly picks gates from the list of all the standard gates in terra. For example, you can run something like:
from qiskit.circuit.random import random_circuit
qr = random_circuit(10, 10, max_operands=3, measure=True)
Which will return a 10 qubit circuit of depth 10 with measurements at the end.
What this function is missing is an option to specify the list of gates to select from, but I think if you opened an issue about this no one would be opposed to adding that functionality in the future. But, regardless the implementation of that function shows how you would implement a version with your own list of gates, just make a local copy of the function and modify the lists <
|
stackexchange-quantumcomputing
|
{
"answer_score": 4,
"question_score": 2,
"tags": "qiskit, programming, random quantum circuit"
}
|
For $m<n$ let $\vec{u_1}...\vec{u_m} \in R^n$ be an orth basis for span{$\vec{u_i}$}$^m_{i=1}$. $\vec{b} \in R^n$ closest vector to $\vec{b}$ in $U$?
For $m<n$ let $\vec{u_1}...\vec{u_m} \in R^n$ be an orthonormal basis for span{$\vec{u_i}$}$^m_{i=1}$. Let $\vec{b} \in R^n$ what is closest vector to $\vec{b}$ in $U$?
I have seen this question and I'm not entirely sure what they mean't by "what is the closest vector to b in U" and they wanted the solution in a linear combination of $\vec{u_i}$'s
|
The closest vector to $b$ in $U$ is given by
$b_U = \displaystyle \sum_{i=1}^m c_i u_i $
where $c_i = \dfrac{b \cdot u_i}{u_i \cdot u_i} $
To derive this formula, consider the error function:
$E = \displaystyle (b - \sum_{k=1}^m c_k u_k) \cdot (b - \sum_{k=1}^m c_k u_k)$
We want to minimize $E$ over all possible $\\{ c_i \\}$
Differentiating E with respect to $c_i$, we get
$\dfrac{\partial E}{\partial c_i} =\displaystyle 2 (b - \sum_{k=1}^m c_k u_k) \cdot u_i = 2 (b \cdot u_i - c_i u_i \cdot u_i )$
Setting this to zero, results in the formula for $c_i$ stated above.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": -1,
"tags": "linear algebra, matrices, matrix equations"
}
|
Sharepoint 2007 - Finding out where a view is used
I'm a MOSS 2007 newbie and am trying to find out where a view is used.
I have a larger list and i want to have two different views into that list. I've inherited the site collection, and currently there are three views, with two of them named almost identically. Now i'd like to find out if i can safely remove one of those views.
**So the question is: Is there a way to find out all references to a view?**
I'll provide additional information gladly!
|
"First part of my problem is that i'd like to find out which view this web part is using." "Second part is that i have a set of views made from a list, and i should find out if some web part is using some of those views"
A Web Part does not use a view directly. The current view of the web part is based upon a view, but if you change or delete the view, the web part still displays your list/library as before. Thus, if you delete your views, all web parts will still continue to function.
What you should probably do is compare your views (which fields are displayed, filtering, sorting, grouping, etc.) with each other and also with the view inside your web part. That way, you'll know which view was used before.
What could happen is that you break links to your view page. This is, if on some other page there is a direct link to your view.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sharepoint, sharepoint 2007"
}
|
Does a Blessed character need to be in at least the rank of a power to be able to cast it?
In the Savage Worlds Deadlands Reloaded setting, does a Blessed character (the modified version of Arcane Background Miracles that is casting without needing powerpoints) need to be at least of the same rank as a power to be able to cast it? Or: can a novice blessed character cast a seasoned power?
The rules state, that the Blessed character casts novice powers at -2, seasoned at -4 and so forth, but I believe does not explicitly state if all higher spells are available using this malus right after creation or not.
|
As a Blessed you have access to all powers at all levels from character creation, with appropriate modifiers based on their level (-2 for Novice, -4 Seasoned etc). This is explained in the section on Blessed where it states 'you can petition your lord for any power available to the Blessed'.
See here for official clarification on the subject.
|
stackexchange-rpg
|
{
"answer_score": 5,
"question_score": 2,
"tags": "savage worlds, magic, deadlands reloaded"
}
|
Google Formsで編集画面が開けない
Google spreadsheetForms ****
FormspreadsheetownerownerForm
(F)SFB
BSFadmin
\. SadminCS
FCSFF
|
stackexchange-ja_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "google spreadsheet"
}
|
Distribution of $\sqrt{X_{1}^{2} + X_{2}^{2}}$
Suppose $\mathbf{X} \sim \mathrm{unif}(B^{2})$. Then $\mathbf{X}^{2} \sim \mathrm{Dirichlet}_2 \left( \frac{1}{2}, \frac{1}{2}; 1 \right)$. I want to find the distribution of $R = \sqrt{X_{1}^{2} + X_{2}^{2}}$. I think it's supposed to be $\mathrm{beta}(2,1)$ or, equivalently, $\mathrm{Dirichlet}_1(2;1)$.
What I have worked out is that $X_{1}^{2}, X_{2}^{2} \sim \mathrm{Dirichlet}_1 \left( \frac{1}{2};1 \right)$. I'm guessing (but not sure) that their sum should be distributed as $X_{1}^{2} + X_{2}^{2} \sim \mathrm{Dirichlet}_1(1;1)$. Whether this is the case or not, I don't see how taking the square root of the sum will show this to be distributed as $\mathrm{Dirichlet}_1(2;1)$ or $\mathrm{beta}(2,1)$.
|
If $X$ is a uniformly distributed random variable on the unit circle, then the pdf of $\|X\|$ is simply $f(x)=2x\cdot\mathbb{1}_{0\leq x\leq 1}$, because the length of a circle is just proportional to its radius.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "probability, statistics, probability theory"
}
|
Gradle sync failed: Could not create parent directory for lock file
I checked out a git repository in android studio, but I'm in trouble with **`Gradle sync failed`** error.
When project wants to build, the android studio raise an error like as following:
>
> Gradle sync failed: Could not create parent directory for lock file
> C:\Users\username\.gradle\wrapper\dists \gradle-4.10.1-
> all\455itskqi2qtf0v2sja68alqd\gradle-4.10.1-all.zip.lck
>
* I saw some answers to the other almost same problems, but none of them help.
* Also I deleted cashes in .gradle directory according above path, but it does not work.
* * *
How can I solve this problem?
I appreciate you to solve this problem, thanks.
|
I found this answer:
1. In the upper-right corner of android studio click on the `Gradle` tool, then right click on the `your project name` then click on the `Refresh Gradle project` as following:
 in Liferay
I added a custom user field in Liferay, and set a value on a specific user.
How can I access this value programmatically?
If I try this, I always get null:
String customAttr = (String)user.getExpandoBridge().getAttribute("customAttr");
`user.getExpandoBridge().getAttribute("customAttr")` returns a value of Type `java.IO.Serializable`.
Maybe the cast here is wrong?
But the Custom Attribute does exist (following code prints out the attribute key):
for (Enumeration<String> attrs = user.getExpandoBridge().getAttributeNames(); attrs.hasMoreElements();)
_log.info("elem: '" + attrs.nextElement() + "'");
Somehow I miss the point here....
|
It was a security problem...
In `com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.getData(String className, String tableName, String columnName, long classPK)`:
if (ExpandoColumnPermission.contains(
getPermissionChecker(), column, ActionKeys.VIEW)) {
return expandoValueLocalService.getData(
className, tableName, columnName, classPK);
}
else {
return null;
}
I only had to set the view permisson on the custom expando value, and everything worked fine.
|
stackexchange-stackoverflow
|
{
"answer_score": 8,
"question_score": 6,
"tags": "java, liferay, expando"
}
|
Change background image REACTJS
I have an img tag in react. I'm using that for style background. But that code is throwing an error.
<img className="user-avatar" style={{ background:"url("+{obj.producer_info.avatar_url}+")" }} id="first-user" src="img/fillavt.png" />
|
Firs of all, take advantage of the new string concatenation syntax:
<img className="user-avatar" style={{ background:`url(${obj.producer_info.avatar_url})`}} id="first-user" src="img/fillavt.png" />
So in first place you reduce complexity on opening/closing quotes.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "html, css, reactjs"
}
|
Weglassen eines Artikels nach einem "und"
Ist bei einem Satz nach Schema (hier Nominalstil)
> Konflikt als Folge der Expansionspolitik und _der_ Aufrüstung Chinas
das zweite _"der"_ unwichtig oder grammatikalisch notwendig?
|
Das zweite »der« wird von der Grammatik nicht gefordert und ist (als Wortwiederholung auf engem Raum) auch stilistisch ungünstig. Ich würde es daher weglassen.
> Konflikt als Folge der Expansionspolitik und Aufrüstung Chinas
Sollte sich die Expansionspolitik wider Erwarten nicht auf China beziehen, müsste man den Text umformulieren, um vom Leser nicht missverstanden zu werden.
|
stackexchange-german
|
{
"answer_score": 3,
"question_score": 1,
"tags": "article"
}
|
Print out the value of a Java Method
I have the following code:
public class GCD {
public static int GCD(int m, int n){
if (n==0) return m;
callCount(1);
return GCD(n,m%n);
}
public static int callCount(int n){
int s = 0;
s+=n;
return s;
}
public static void main(String[] args) {
callCount(0);
System.out.println(GCD(10, 15));
System.out.println(callCount());
}
}
Once GCD has finished I would like to print out how many times GCD was invoked with the method callCount. I think I am going about callcount completely wrong.
|
How about something like this?
public class GCD {
private static int callCount = 0;
public static int GCD(int m, int n){
if (n==0) return m;
callCount++;
return GCD(n,m%n);
}
public static void main(String[] args) {
System.out.println(GCD(10, 15));
System.out.println(callCount);
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "java"
}
|
how to correctly assert struct type in elixir
I know you can assert a type struct like this (althought its more a module assert):
assert foo.__struct__ == Foo
But is there a more elegant way to do this? something like:
assert type(foo) == %Foo{}
|
You can use `=` and pattern matching:
assert %Foo{} = foo
|
stackexchange-stackoverflow
|
{
"answer_score": 27,
"question_score": 13,
"tags": "testing, elixir, assert"
}
|
.htaccess to allow only pdf files in a subdirectory
I am trying to write an `.htaccess` file to only allow access to pdf files in a subdirectory. I'm going to deploy the file on a host that I don't control, so I can't make changes to the apache configuration.
I want to only allow access to .pdf files in the `Foo` directory. I have attempted:
Deny From All
<FilesMatch ".+\/Foo\/.+\.pdf$">
Allow From All
</FilesMatch>
However, when I attempt to access `example.com/bar/Foo/baz.pdf`, I am given an HTTP 403 Forbidden response.
How can I deny access to everything, except for pdf files in one particular directory?
Thanks
|
Create a this inside root .htaccess as your very first rule:
RewriteEngine On
# prohibit everything except .pdf files
RewriteRule ^foo/(?!.*\.pdf$) - [F,NC]
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "apache, .htaccess"
}
|
(open + write) vs. (fopen + fwrite) to kernel /proc/
I have a very strange bug. If I do:
int fd = open("/proc/...", O_WRONLY);
write(fd, argv[1], strlen(argv[1]));
close(fd);
everything is working including for a very long string which length > 1024.
If I do:
FILE *fd = fopen("/proc/...", "wb");
fwrite(argv[1], 1, strlen(argv[1]), fd);
fclose(fd);
the string is cut around 1024 characters.
I'm running an ARM embedded device with a 3.4 kernel. I have debugged in the kernel and I see that the string is already cut when I reach the very early function vfs_write (I spotted this function with a WARN_ON instruction to get the stack).
The problem is the same with fputs vs. puts.
I can use fwrite for a very long string (>1024) if I write to a standard rootfs file. So the problem is really linked how the kernel handles /proc.
Any idea what's going on?
|
Probably the problem is with buffers.
The issue is that special files, such as those at `/proc` are, well..., special, they are not always simple stream of bytes, and have to be written to (or read from) with specific sizes and or offsets. You do not say what file you are writing to, so it is impossible to be sure.
Then, the call to `fwrite()` assumes that the output fd is a simple stream of bytes, so it does smart fancy things, such as buffering and splicing and copying the given data. In a regular file it will just work, but in a special file, funny things may happen.
Just to be sure, try to run `strace` with both versions of your program and compare the outputs. If you wish, post them for additional comments.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "linux, linux kernel, kernel, fwrite"
}
|
Concatenate pwd and basename
I want to assign the path and file name to a variable:
/path/to/myfile/file.txt
For example
MYFILE=$(pwd)$(basename)
How can i do it ?
|
To answer the question as it is stated: This is a simple string concatenation.
somedirpath='/some/path' # for example $PWD or $(pwd)
somefilepath='/the/path/to/file.txt'
newfilepath="$somedirpath"/"$( basename "$somefilepath" )"
You most likely would want to include a `/` between the two path elements when concatenating the strings, and `basename` takes an argument which is a path (this was missing in the question).
* * *
Reading your other answer, it looks like you are looking for the `bash` script path and name. This is available in `BASH_SOURCE`, which is an array. It's only element (unless you are in a function) will be what you want. In the general case, it's the _last_ element in the array that you want to look at.
In `bash` 4.4, this is `${BASH_SOURCE[-1]}`.
|
stackexchange-unix
|
{
"answer_score": 5,
"question_score": 2,
"tags": "linux, bash, pwd, basename"
}
|
How to define the nl_sock in the libnl?
I download libnl3 source code, but did not found out where define the struct nl_sock.Can any one help?
|
Look in the netlink include files that came with the library. Start in netlink/socket.h, netlink/netlink.h, etc.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "c"
}
|
How to identify the same image in a faster way
I have a lot pictures some of are totally identical except the file name, currently I group them by calculating each pic's MD5, but it looks very slow to hash each of them. Is there any alternative way to make it faster? Will it help if I resize the image before hash?
|
You could group files by `[filesize, partial hashcode]`, "partial hashcode" being a hash for (say) some block of `[N, filesize].min` bytes in the file (e.g., at the beginning or end of the file). Naturally, the choice of `N` affects the probability of two different files being grouped together, but that might be acceptable if the probability and/or cost of creating an erroneous grouping are sufficiently small.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ruby, image, hash, md5, digest"
}
|
How to pass time_t or simply its date information over COM
I have a Visual C++ ATL project which exposes a COM interface.
From my interface, I am calling into FlexNet Publisher libraries. I need to return back a date from these libraries, which expose a `time_t` object I can fetch (yes, I know their libraries are susceptible to the 2038 bug on 32-bit systems).
My IDL file has a method on it which needs to return this date.
Given that I can fetch `time_t`, how do I pass its date information across the COM interface boundary to a client application consuming my COM object? Should I just cast `time_t` as `__int64` and define it as `__int64` in my IDL? What's correct here? What's the standard way?
|
I'd recommend using the oleautomation compliant `DATE` type.
To convert your existing `time_t` type, use the COleDateTime class, which is provided by ATL. One of its constructors accepts a `time_t` value and parses it to its equivalent `DATE` value.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "date, visual c++, com, atl, idl"
}
|
Issue with max_execution_time during file import in php 5.4.22
PHP Version: PHP Version 5.4.22 JS :ExtJs
I'm facing to the problem below:
I've an CSV import in PHP and after about 30 to 30.5 seconds the XHR process canceled, then the browser (Chrome, Firefox) hang on and finished the process.
All the data are imported into the database. Ok, that's good but: At the beginning and at the end of the import function i've a log-function ( Start ) and at the end ( End: XX imported files. )
The problem is, that in the database are two start and two end log entries.
I looks, that during the second start of the function these entries will be generated.
I've tried:
ini_set('max_execution_time', 0);
ini_set('memory_limit', '128M');
ini_set('upload_max_filesize', '12M');
But without an result.
|
I've change following setttings
remoteApi.maxRetries = 0;
remoteApi.timeout = 300000;
now it work perfekt!!
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, ini set"
}
|
E: Unable to locate package redis-server
I am using Ubuntu machine (14.04.1). I have installed docker daemon (1.12.3 and go version: 1.6.3). I have written a dockerfile which will download redis DB. But it is throwing me following error:
E: Unable to locate package redis-server
I tried redis also when redis-server did not work. It again throws the same error.
E: Unable to locate package redis
Contents of Dockerfile:
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y redis-server
EXPOSE 6379
I am able to run apt-get update but not able to install redis-server or redis. Docker's registry is docker hub. I am able to download redis in local (`sudo apt-get install -y redis-server`), outside docker but with docker I am not able to.
|
I am able to install redis-server as well as python. I added _RUN apt-get update_ in Dockerfile. It updated and got redis installed. And there was one more thing in my case. I had already run 'apt-get update' which created an image before. All the time it was referring to the image and was not updating. Hence I used --no-cache=True and made it.
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y install redis-server
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 5,
"tags": "ubuntu, docker, dockerfile"
}
|
Get physical map location of object based off user input
I am getting user input into a python application of a local landmark. With this data I am trying to get the longitude and latitude of their object using Google maps. I am trying to work with the Google gdata api for the maps but I did not find a way to get long and lat data from a search query when working in python.
I am ok using any system that will solve my problem in python.
|
Are you trying to geocode a street or POI (point of interest)? In that case, geopy is perfect:
In [1]: from geopy import geocoders
In [2]: g = geocoders.Google(GOOGLE_MAPS_API_KEY)
In [3]: (place, point) = g.geocode('Eiffel Tower, Paris')
Fetching
In [4]: print point
------> print(point)
(48.858204999999998, 2.294359)
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "python, google maps, gdata api"
}
|
Exclude multiple page templates
I need to exclude a child theme function from certain page templates.
I can exclude one template like this
if (!(is_page_template( 'templates/my_page_template.php' )))
{ // the child theme function here
....
}
How do I add more page templates to exclude statement?
|
if (
!(
(is_page_template( 'templates/my_page_template.php' )) or
(is_page_template( 'templates/my_page_template1.php' )) or
(is_page_template( 'templates/my_page_template2.php' )) or
(is_page_template( 'templates/my_page_template3.php' )) or
)
)
{ // the child theme function here
....
}
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "php, wordpress, if statement, wordpress theming"
}
|
Considering Brownian bridge as conditioned Brownian motion
Let $B$ be a standard Brownian motion. Define a Brownian bridge $b$ by $b_t=B_t-tB_1$. Let $\mathbb{W'}$ be the law of this process.
According to Wikipedia,
> A Brownian bridge is a continuous-time stochastic process B(t) whose probability distribution is the conditional probability distribution of a Wiener process W(t) (a mathematical model of Brownian motion) given the condition that B(0) = B(1) = 0.
Surely it makes no sense to condition on a probability 0 event? So I'm trying to show that $\mathbb{W'}$ is the weak limit as $\epsilon\to 0$ of Brownian motion conditioned upon the event $\\{|B_1|\leq \epsilon\\}$. How do we prove this?
Thank you.
|
Brownian motion $B_t$ over the interval $[0,1]$ can be decomposed into two independent terms. That is, the process $X_t=B_t-tB_1$ and the random variable $Y=B_1$. As these are joint normal, to prove that they are independent, it is enough to show that the covariance ${\rm Cov}(X_t,Y)={\rm Cov}(B_t,B_1)-t{\rm Var}(B_1)=t-t$ vanishes.
The distribution of $B$ conditional on $\vert B_1\vert < \epsilon$ is just the same as that of $X$ plus the independent process $tY$ (conditioned on $\vert Y\vert < \epsilon$). As $\epsilon$ goes to zero, this converges to the distribution of $X$, which is a Brownian bridge.
|
stackexchange-math
|
{
"answer_score": 16,
"question_score": 18,
"tags": "stochastic processes"
}
|
Sed -i replace string with anti-slash
I want to replace American time to French time in PHP files from command line.
From `date('m/d/Y \a\t h:i:s A'` to `date('Le d/m/Y à G:i:s'`
I tried the following sed command :
sed -i "date('m/d/Y \a\t h:i:s A'&date('Le d/m/Y à G:i:s'&g" /path/file.php
It doesn't work. I think the problem comes from the antislashs in the source string `\a\t`
I already checked this question : sed command to replace string with slashes
I already tried to change the delimiters or escpae the anti-slashs with `\\`.
But nothing works. Any help is welcome.
|
Escape antislash like this :
sed -i "date('m/d/Y \\\\a\\\\t h:i:s A'&date('Le d/m/Y à G:i:s'&g" /path/file.php
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sed, backslash"
}
|
Find the area of $A = \{ \langle x,y\rangle \in \mathbb{R}^2 \mathrel| (x+y)^4<a x^2 y,\ x>0 \}$?
I can't really think of how to set the limits
|
there are two ways to find the area
1. use wolframalpha,you can see the picture at once.
2. let $x=rcos(\theta), y=rsin(\theta)$, then you get $r \le \dfrac{a*cos^2(\theta)sin(\theta)}{(cos(\theta)+sin(\theta))^4}$
since $x>0 \to -\dfrac{\pi}{2} < \theta < \dfrac{\pi}{2}$,I think you can go further this way.
Edit:$ay>0$, if $a>0 \to y>0 \to 0< \theta < \dfrac{\pi}{2}$
the shape is here
EDIT: I add the process also for reference:
$S=\dfrac{1}{2} \int_{0}^ {\frac{\pi}{2}} r^2 (\theta)d \theta$ and
$ \int r^2 (\theta)d \theta=\int \left[\dfrac{a*cos^2(\theta)sin(\theta)}{(cos(\theta)+sin(\theta))^4} \right]^2 d \theta=a^2*\dfrac{-280 sin(\theta)-210 sin(3\theta)+14 sin(5\theta)-385 cos(\theta)+147 cos(3 \theta)+105 cos(5 \theta)+13 cos(7 \theta)}{6720 (sin(\theta)+cos(\theta))^7}+C$
$S=a^2*\dfrac{-280+210+14-(-385+147+105+13 )}{2*6720}=\dfrac{a^2}{210}$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "multivariable calculus, integration"
}
|
Is it 2 cycle attracting?
Let $c$ be a constant and let $f(x) = x^3-3x+c$, $c>0$. Determine the values of c for which ${0,c}$ is a 2-cycle. Is the 2-cycle attracting for the value of $c$? Explain.
I am having trouble seeing why the solution is $c = ±√2$, and that in fact the {0,c} is 2-cycle repelling.
|
You can read here that
> for a function $f$ where $f^n(z_0)=z_0$ that $z_0$ is
>
> repelling when $|(f^n)'(z_0)|>1$ and
>
> attracting when $|(f^n)'(z_0)|<1$.
$$f(x)=x^3-3x+c \implies f'(x)=3x^2-3$$
Take $c =\pm\sqrt2$; this means $f(c)=0, f'(c)=3$
$$\bigg(f(f(x)) \bigg)' =f'(f(x))f'(x)\implies f'(f(c))f'(c)=f'(0)f'(c)=-3\times 3=-9. $$
So then we have $f^2(c)=c \,$ and $| (f^2)'(c)|>1$ and therefore $\\{0, c \\}$ is a repelling cycle.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "calculus, recursion"
}
|
WPF: Binding RichTextBox to Logger Output
I'm using NLog to log errors in my WPF application. The logger currently writes to a file. I've now created a `RichTextBox` and want to simultaneously write all session logs to the `RichTextBox`. I've created a wrapper over the NLog logger so I can include commands to write into some other variable in the wrapper. But how do I do the binding?
Any help is appreciated
|
I would try something like this:
Create some LogReader class to deal with the read of log error, it should use a StringReader or any reader you like. The LogReader basically will give you a string with the contents of the file. Depending your needs, and specially if the file is too big, maybe you will need to split this into chuncks, but I think you will get the idea. Then you will have a ViewModel Class that basically presents the the data to the RichTextBox
Now comes the tricky part, but with the help of this gem you will be able to do databinding of strings to the RichTextBox.
`<RichTextBox attached:RichTextboxAssistant.BoundDocument="{Binding LogMessages}"/>`
HTH
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "wpf"
}
|
Why does lpstat not show my print job?
After printing a document via _cups_ , `/var/log/cups/access_log` contains the following log entry (and the printer _did_ print):
"POST /printers/Brother HTTP/1.1" 200 70947 Print-Job successful-ok
However, the print job is not listed when querying via _lpstat_ :
# lpstat -W all -u user
# lpstat -v
device for Brother: ipp://printer.test.:631/ipp/port
Why is _lpstat_ not showing me the successfully executed print job?
|
Without the user filter, the output does list all print jobs, including completed ones:
# lpstat -W all -u
Brother-1 unknown 70606 2020-10-26T11:46:15 UTC
_cups_ does not publish the print jobs owners name, hence filtering by the name does not work.
|
stackexchange-askubuntu
|
{
"answer_score": 0,
"question_score": 0,
"tags": "20.04, printing"
}
|
about Windows registry, HKU, .DEFAULT and S-1-5-18
Does someone know what is (or was) the point to have the HKCU/.DEFAULT alias for HKCU/S-1-5-18 (SYSTEM) in the Windows registry? Is it a legacy thing?
|
This comes from Windows 9x series, which **didn't have SIDs** or the 'SYSTEM' account, because it didn't have any local security enforcement in the first place. All processes always had full privileges.
However, Windows 9x did have the ability to load different _user profiles_ (per-user settings) and used the HKEY_USERS registry tree in a similar way.
* By default, the "per-user settings" feature was disabled and HKCU was mapped to HKU\\.Default, which was the _only_ subtree that existed under HKU. (The login screen, if enabled at all, only asked for _network_ credentials.)
* And if you had per-user settings enabled, the system still booted with HKCU mapped to HKU\\.Default at first (and you could simply click "Cancel" at the login screen and continue using the default profile instead of a user-specific one).
|
stackexchange-superuser
|
{
"answer_score": 3,
"question_score": 0,
"tags": "windows, windows registry"
}
|
Creating basic navigation in File Maker
I'm new to File Maker and looking to do what I assume is a relatively straightforward task. I have a table of `Users` and a table of `Tasks`. Each user can have multiple tasks associated with him/her but every task can have only one user.
From the list view of `Users` I want to be able to click on any given person and then see a list of all their assigned `tasks`. What is best practice for creating this kind of filtered list view?
My current best guess is to have a script that navigates a user from the `Users` layout to the `Tasks` layout. This script would also set a global field (`selected User ID`) based on which record the script was executed from (i.e. if i clicked on “Paul” it would set the `selected meeting ID` to his ID). I would then filter the `tasks` layout by the global `selected User ID` field.
|
FileMaker has a specific script step for just this kind of thing. It's "Go to Related Record". It does exactly what you need, including going to the relevant layout in an optional new window and filtering records. No need for any additional logic.
As a side note, a portal to this relationship on the form view layout will display the user's related records in the portal as a list. You can attach a button on a portal row to go to this specific record, using the same script step I mentioned above.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "filemaker"
}
|
search and replace multiple numbers in a file
I am trying to do inline search and replace in a file using Perl 5.10.1
When i search for say a number like 73.10 and replace it with 73.20. It finds 73100.25 and replaces it with 73.200.25 and 73.10 with 73.20.
the file has 6 columns that appear like the below:
text text text 73100.25 25.12 text
text text text 365.8 96.25 text
text text text 23189.73 73.10 text
how do i ensure that it does not replace the wrong number?
`/usr/bin/perl -p -i -e "s/$num1/$num3/g" new_info.txt`;
`/usr/bin/perl -p -i -e "s/$num2/$num4/g" new_info.txt`;
|
perl -i -pe 's/\Q$num1\E/$num3/g' new_info.txt
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "perl"
}
|
Using With Statement inside function in BigQuery
Is it possible to have a with statement inside a function in BigQuery?
I know there are several questions about this, but those are about SQL Server not a about BigQuery.
Here is what I am trying to do:
CREATE TEMP FUNCTION MyFunc(my_var INT)
RETURN INT64 AS
(
WITH ABC AS (select * from t where t.col = var),
DEF AS (select * from t where t1.col = var),
GHI AS (select * from t where t2.col = var)
SELECT * FROM ABC JOIN DEF USING (...) JOIN GHI USING (...)
);
SELECT MY_FUNC(5)
However here, I get an error saying unexpected keyword `WITH`. I have looked at other similar questions but they are about SQL Server, which is different from my requirement in bigquery.
|
Try below:
1. You have a typo : `RETURN` -> `RETURNS`
2. Add one more parenthesis pair around a select statement. It will make a statement as an expression.
3. Be sure not to return one more rows or have one more columns in your select query. Just return single `INT64` value same as a return type.
Hope this is helpful.
CREATE TEMP FUNCTION MyFunc(my_var INT)
RETURNS INT64 AS
((
WITH ABC AS (select * from t where t.col = var),
DEF AS (select * from t where t1.col = var),
GHI AS (select * from t where t2.col = var)
SELECT * FROM ABC JOIN DEF USING (...) JOIN GHI USING (...)
));
SELECT MY_FUNC(5);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, function, google bigquery, bigquery udf"
}
|
How to calculate the 21! (21 factorial) in swift?
I am making fuction that calculate factorial in swift. like this
func factorial(factorialNumber: UInt64) -> UInt64 {
if factorialNumber == 0 {
return 1
} else {
return factorialNumber * factorial(factorialNumber - 1)
}
}
let x = factorial(20)
this fuction can calculate untill 20.
I think factorial(21) value bigger than UINT64_MAX.
then How to calculate the 21! (21 factorial) in swift?
|
Unsigned 64 bit integer has a maximum value of 18,446,744,073,709,551,615. While 21! = 51,090,942,171,709,440,000. For this kind of case, you need a Big Integer type. I found a question about Big Integer in Swift. There's a library for Big Integer in that link.
BigInteger equivalent in Swift?
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 18,
"tags": "swift, math"
}
|
for what input is this method going to crash
looking for possible inputs to make this method compile but crash at runtime.
Any suggestions?
public static void method1(Integer n)
{
System.out.println(n.byteValue());
}
|
n == null will crash the method.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": -6,
"tags": "java, testing"
}
|
MFA Support for Azure AD DS joined virtual machines
My current setup is a cloud-only Azure AD and Intune managed small organization. We use Azure AD DS services for remote LDAPS sessions for some local authentication needs. We recently set up our first virtual machine Azure. This machine is joined to the Azure AD DS-manged domain. Login is done with the Microsoft account.
Is it a supported functionality to use Azure MFA to secure the login to the virtual machine? The desired functionality would be to have the AD DS authentication to be compatible with the 'normal' azure AD login.
|
You can technically use Azure MFA for RDP Login. The real question is - do you really want to do that given the complexity of the solution?
I would suggest that you stay to MFA only for the real Azure AD Login, and implement Azure Securty Center JIT Admin for securing the DRP access. You would have much better user experience and much better protected VMs.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "azure, azure active directory, multi factor authentication"
}
|
Undo apt-get install with many dependencies
I tried "apt-get install sagemath" and it started downloading a lot of dependencies. I quickly ran out of disk-space and I interrupted the process. I am now at 300mb of root space left and need to somehow undo the installation. When i try to apt-get purge sagemath I get the following error "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
Now when I try to run that, my remaining disk space gets depleted. I don't know how to undo my mistake at this point, can anyone help me with this?
|
Open the terminal and type:
sudo apt autoremove
sudo apt remove texlive-latex-base
sudo apt remove maxima-sage maxima-sage-doc maxima-sage-share
sudo apt remove octave
sudo apt remove r-base-core
sudo apt remove python-sympy python-scipy
sudo apt remove python-flask python-flask-autoindex python-flask-babel python-flask-oldsessions python-flask-openid python-flask-silk
sudo apt remove sagemath-database-conway-polynomials sagemath-database-elliptic-curves sagemath-database-graphs sagemath-database-mutually-combinatorial-designs sagemath-database-polytopes sagemath-doc-en sagemath-jupyter sagetex
sudo apt remove sagemath # maybe you'll also have to run 'sudo dpkg --configure -a' to correct the problem
sudo apt autoremove
|
stackexchange-askubuntu
|
{
"answer_score": 1,
"question_score": 1,
"tags": "apt, package management, dpkg, dependencies"
}
|
Install Mountain Lion now that Mavericks has been released
I foolishly installed Mavericks upon release and my Mac doesn't like it, so I used Internet recovery to downgrade to Lion. I am trying to get back to Mountain Lion but it does not seem possible anymore.
I know I could buy it again from here, but I don't want to pay for it again. I have checked the Purchases tab in the AppStore but it only lists Mavericks.
The only option I have left that I can think of is just torrenting it. This question may look like a duplicate. However, many of the questions are similar, and don't seem to address this issue.
Thanks for any help.
|
It seems that you bought Mountain Lion but now it has disappeared.
You can unhide purchases (some get hidden or you hid them, does not matter really) by opening Mac App Store.
Then go to: Store->View My Account->Enter AppleID and Password
There should be a "Manage"-Button for Hidden Purchases
!manage button for hidden purchases
Find OS X Mountain Lion and click "Unhide"
Afterwards Mountain Lion should show up in your Purchases Tab and you can reinstall.
|
stackexchange-apple
|
{
"answer_score": 2,
"question_score": 1,
"tags": "macos, upgrade"
}
|
Multithreading using functions in the windows.h library
I'm thinking about using the windows.h library for multithreading. I was exploring the web for some examples, but the only one I got here was very complex. Are there any simple examples that I can see?
If you use Qt, using the QThread library is a good way to multithread.
|
Are you using VC++? If so what version of it? The VC++11 Beta adds std::thread. Since VC++10 there has been the PPL (Parallel Patterns Library). The CRT also has some threading functions (_beginthread etc).
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -4,
"tags": "c++, multithreading"
}
|
Conflicting events in javascript
Here is my code:
<div class="MediaPreview" style="left: 10px; bottom: 10px;">
<span>Image or video, required</span>
<div class="x">x</div>
</div>
Now I have a hover over effect which displays the X. What I'm looking for now is to attach an `onclick event` to the div with a class of `x` so that when they click it handles the action. **Currently it does this but when it finishes it performs the onclick event for the MediaPreview class subsequently**
Not quite sure what to do hear. I'm looking for help/answers. **A solution would be to isolate the onclick to the X text and then not have a subsequent event loaded**
|
You need to use `e.stopPropagation()` to stop the event from bubbling up to the parent.
If you show us your actual code, we can show you where to plug in `e.stopPropagation()` in your click handler. Please remember that questions about code should always include the relevant code.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, html"
}
|
How do I run Tomboy in the notification area at startup?
I tried adding `tomboy` in System -> Preferences -> Startup Applications, but this causes the "Search All Notes" window to appear every time I log in. I just want it to run in the notification area so that I can use it later via hotkeys or its notification area icon popup menu.
|
There is an undocumented option `--icon` that makes tomboy start without showing a window. It HAD a bug (bug #566421), which has now been resolved.
Also, you can use the **tomboy applet** : Right click on the panel, choose “Add to Panel” and select “Tomboy Notes“. The panel applet looks similar to the notification area icon and provides the same functionality (hotkeys and popup menu).
|
stackexchange-askubuntu
|
{
"answer_score": 15,
"question_score": 12,
"tags": "indicator, startup, tomboy"
}
|
Get Regex content and other data back at the same time
This is how I get the real data from my GetHomeData and it is as expected. But it is so that my ContentText there is some text in it that should Regex with something that I have in the database.
I therefore want to hear how I can get it done and at the same time send the data that I have in my result with over the same to get the Regex content.
So what I want is the result and homeViewModel is thrown into Ok at the same time.
[HttpGet("/api/Home")]
public ActionResult GetHome()
{
var result = _homeService.GetHomeData();
var homeViewModel = _regMatcheText.GetRegMatcheText(result.ContentText);
return Ok(homeViewModel);
}
**The problem is right now** : That I only get hold of the content, I also want to get hold of the other things that are there.
_So my question goes_ : How can I fix it so that the content that is Regex that it is sent back.
|
You might be looking for something like a `Tuple`. You can use a `Tuple` to return multiple values and access multiple values returned.
Example based on the limited information discerned from the OP.
public Tuple<ActionResult, string> GetHome()
{
var result = _homeService.GetHomeData();
var homeViewModel = _regMatcheText.GetRegMatcheText(result.ContentText);
var okResult = Ok(homeViewModel);
return new Tuple<ActionResult, string>(okResult, homeViewModel);
}
static void DoGetHome()
{
var stuff = GetHome();
var firstStuff = stuff.Item1;
var secondStuff = stuff.Item2;
}
This is just a rough example. In order to access the values simple access `stuff.Item1`.
If "homeViewModel" is not of Type `string`, then you will need to substitute the correct Type in the method signature.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "c#, asp.net, regex, asp.net web api"
}
|
How can I extract the result string in BeautifulSoap?
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re
start_url = '
downloaded_html = requests.get(start_url)
soup = BeautifulSoup(downloaded_html.text, "lxml")
full_header = soup.select('div.reference-image')
full_header
The Output of the above code is;
[<div class="reference-image"><img src="Content/image/all/reference/c101.jpg"/></div>,
<div class="reference-image"><img src="Content/image/all/reference/c102.jpg"/></div>,
<div class="reference-image"><img src="Content/image/all/reference/c102.jpg"/></div>]
I would like to extract the `img src` content as below;
["Content/image/all/reference/c101.jpg",
"Content/image/all/reference/c102.jpg",
"Content/image/all/reference/c102.jpg"]
How can I extract it?
|
To get that, just iterate through the result:
img_srcs = []
for i in full_header:
img_srcs.append(i.find('img')['src'])
This gives:
['Content/image/all/reference/c101.jpg', 'Content/image/all/reference/c102.jpg', 'Content/image/all/reference/c102.jpg']
Here is a one-liner for this:
img_srcs = [i.find('img')['src'] for i in full_header]
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "python, beautifulsoup"
}
|
How to use onSaveInstanceState with a lot of data and objects
When my application became sophisticated and main activity started holding in memory a lot of data (loaded and parsed from files in response to user actions) I have (mistakenly) switched from `onSaveInstanceState` to `onRetainNonConfigurationInstance` without noticing that `onRetainNonConfigurationInstance` is not called when application is killed to save device memory. So as now I has to switch back to `onSaveInstanceState` I want to as what is the proper way to handle a huge amount of data distributed by tens of objects? Do I have to implement serialization for all these objects (`Parcelable`?) or may be put all the data into `Service` thread hoping it would not be killed? What is the best practice?
|
I've ended with an ugly but the only acceptable solution:
1. I've moved all the data into `Application` object.
2. I've created a foreground `Service` so that application object will not be killed even if all activities are killed.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "android"
}
|
SP 2013 Discussion board list, how to set item limit?
Version 2013 I need to set item limit for a normal discussion list.
The 'subject' view is not editable (grayed out) as well as the flat view.
By going into the list settings and edit views from there I do not see the typical list of features that I can change (filtering, sorting, item limit etc)
Is there something I am missing or it is simply not possible to set item limit in the subject view of a discussion board?
!I do not have edit view
|
I had this same problem. My discussion board is on a publishing site, not team or community. The views are not editable.
The only solution I found is to edit the list in SharePoint Designer. Go to the discussion board and on the ribbon click to edit the list in SharePoint Designer. When it opens, click the view you are using (like subject) then you get a page full of code.
Do a find in page on the word row and you'll find a `rowcount`. The default is 20. Just type in the number you want and save (ctrl + s). If you're displaying your discussion board in a web part edit the web part and "reapply" the view.
|
stackexchange-sharepoint
|
{
"answer_score": 4,
"question_score": 2,
"tags": "2013, list, discussion board"
}
|
How to prevent Evince from automatically opening PDF files?
I am not sure what is wrong with my computer but it automatically opens PDF files using Evince whenever I download them from Chrome. How could I prevent that?
|
# Explanation:
AFAIK, Google chrome remembers the downloading preference for each file type (exe, pdf, zip... etc) that a user inputs. This has nothing to do with a specific program (in your case **evince** ) because, Ubuntu itself uses necessary programs which are set as default to open file types. Such like, if the option seen in below image is selected for each file type, it will inherit the same preference to that selected types individually & opens/executes with a default assigned program.
* * *
I'd say this is quiet simple yet an unnoticeable option. Below should fix your problem as it took me a while to figure out why.. :)
* Just right click or hit on a **PDF** file to download from any link
* While the process shows downloading; simply click on the arrow shows next the file; `un-tick` **" Always Open Files of This Type"** if its select (`ticked`).
!enter image description here
Just tested on my pc which sorted the issue. Hope it helps! :)
|
stackexchange-askubuntu
|
{
"answer_score": 1,
"question_score": 5,
"tags": "evince"
}
|
NSTableView view based 'Image & Text Table Cell View' not recognizing my custom NSImageView subclass
1. First i changed my `NSTableView` to view based and created an `IBOutlet` of my `NSTableView`.
2. Then i dragged the `Image & Text Table Cell View` to it.
3. After that i changed the `NSImageView` that's inside that cell view to my custom `NSImageView` subclass: 'PVAsyncImageView'.
4. I imported it on my .h.
And i have this code:
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSTableCellView *result = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
[[result imageView] downloadImageFromURL:@"lol"];
return result;
}
But it's not recognizing `downloadImageFromURL` (a method from my `NSImageView` subclass). Xcode gives me an error.
Any thoughts?
|
1. Either your subclass isn't really overriding -init:, or you aren't properly loading your subclass..
2. Be sure there's no typo in the method name on the subclass: if you have, for instance, -init: in the subclass, the superclass's -init: will still be called.
3. Are you overriding -allocWithZone: or something somehow?
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "objective c, macos, cocoa, nstableview, nstableviewcell"
}
|
Magic Keyboard Home and End keys acts as Page Up and Page down
I'm using a Magic Keyboard with both my windows laptop and my Macbook Pro. When on MacOS, the Home and End keys default to Page Up and Page Down.
How do I remap the Home key to act as the Home button (moving the cursor to the beginning of a line) and similarly with the end key, moving the cursor to the end of the line?
|
Home doesn't move to the beginning of the line in macOS; that's a Windows thing.
On Mac Home is 'scroll to the top', End is 'scroll to the bottom', the cursor doesn't move.
Cmd/left or right arrow moves to the beginning & end of line.
As noted in comments, Microsoft have chosen to change the default behaviour for Word, to be more Windows-like, but this is not Mac-standard.
|
stackexchange-apple
|
{
"answer_score": 2,
"question_score": 4,
"tags": "macos, keybindings"
}
|
use column of "super" table in postgres
SELECT value,(SELECT value2 FROM test AS x WHERE x.id = SUPER.id) FROM test
I want to get the column of the table of the main query. Is this possible without giving it a name? Is there a replacement for the SUPER keyword I invented?
|
I don't understand much where the `SUPER` is coming from, but if you're referring to the main `test` table, then you can proceed as below;
SELECT value,
(SELECT value2
FROM TEST as Test1
WHERE x.id = Test1.id)
FROM TEST
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, postgresql"
}
|
Java verbose class loading
I am trying to list the order in which the Java class loader is loading my classes. if I use `-verbose` parameter it will list every single interface/class it loads, including tons of interfaces such as Serializable, exceptions etc. Is there a way to tweak this output so it only shows which classes are loaded in the class my main method is defined?
|
I guess your best bet is to do the following:
* Output some fixed text once your `main` method starts and right before it ends.
* Pipe the _verbose_ output into a file
* Use things like _less_ or _grep_ to find the classes loaded between the two tags from the main method.
There's a similar question and some answers here: Is there a way to get which classes a ClassLoader has loaded?
Did you try `-verbose:class`?
|
stackexchange-stackoverflow
|
{
"answer_score": 78,
"question_score": 75,
"tags": "java, jvm, classloader"
}
|
OpenGL: perspective view centered not in the middle of the view?
I have a main scene centered on the center of the viewport
in addition to that I want another small object to be displayed on the corner of the viewport. The trouble is that when I draw the small object, it is transformed by the main projection transformation and appears slanted. I want the small object to have its own vanishing point centered in its center.
Is this possible which just transformations?
|
You want your main scene to be projected in one way and your corner object to be projected in another way. This directly leads you to the solution:
void render() {
glMatrixMode(GL_PROJECTION);
setUpMainProjection();
glMatrixMode(GL_MODELVIEW);
drawMainObject();
glMatrixMode(GL_PROJECTION);
setUpCornerProjection();
glMatrixMode(GL_MODELVIEW);
drawCornerObject();
}
Perhaps you're wondering how to implement setUpCornerProjection. It would look something like this:
// let's say r is a rect, which, in eye space, contains the corner object and is
// centered on it
glFrustum(r.left, r.right, r.bottom, r.top, nearVal, farVal);
// let's say p is the rect in screen-space where you want to
// place the corner object
glViewport(p.x, p.y, p.width, p.height);
And then in setUpMainProjection() you'd need to also call glFrustum and glViewport.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "opengl, transformation, perspective, vanishing point"
}
|
Reformat Markdown files to a specific code style
I'm working on a book which had a couple of people writing and editing the text. Everything is Markdown. Unfortunately, there is a mix of different styles and lines widths. Technically this isn't a problem but it's not nice in terms of aesthetics.
What is the best way to reformat those files in e.g. GitHub markdown style? Is there a shell script for this job?
|
You might want to look at Pandoc; it understands several flavors of Markdown.
pandoc -f markdown -t gfm foobar.md
Having written a markup converter years ago in Perl, I would not want to approach such a task without a decent lexical analyzer, which is a bit beyond shell scripting.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "shell, markdown, github flavored markdown, reformatting"
}
|
How to count missing data in a matrix?
I have a character matrix
B = matrix(
c("foo", "--", "bam", "pop", "--", "foo","--","fizz"),
nrow=2,
ncol=4)
Missing data is represented by "--". I'm trying to write a for loop that get the fraction of "--"'s in each column. If the fraction of "--" in that column is >= .5 then I want to store that column index in a separate vector called `bad_columns`. In this matrix the first column has a "--" fraction of .5, the second column has a "--" fraction of 0.
Similarly for the rows of the matrix, I'm trying to get the fraction of "--" in each row. If the fraction of "--" in the row is >= .5 then I want to store that row index in a separate vector called `bad_rows`.
|
The colSums function is very fast:
colSum(B=="--")/nrow(B)
> badcols <- which( colSums(B=="--")/nrow(B) >= 0.5 )
> badcols
[1] 1 3 4
There is, of course, also a `rowSums` function.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -1,
"tags": "r, matrix"
}
|
Ассемблерный код и многопоточность
Всем добрых суток!
Дан бинарник библиотеки неких вычислительных функций, написанных на асемблере, исходников нет, как следствие, глубокого понимания внутренностей данных функций тоже нет. Есть следующий теоретический вопрос : есть ли возможность безопасного использования данных функций в многопоточном приложении? Понимаю, что можно "ограничить" все вызовы из данной библиотеки мьютексами, однако нет уверенности, что они не станут конфликтовать с другими функциями приложения, например с malloc(). Разрешите мои сомнения плиз.
|
В общем случае, такая библиотека может Вам стоить бессонных ночей, потраченных на отладку. Не рекомендую к использованию. Если я вообще что-либо пониманию, то тут даже критические секции толком не помогут. Зависит от того создается ли отдельная копия библиотеки на каждый поток. Я лично уверен, что нет. А раз так, то какая-нибудь хитрая ф-ция, модифицирующая внутренние переменные библиотеки и завязанная на их значения, вызванная несколько раз из разных потоков, полностью нарушит логику работы библиотеки.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 1,
"question_score": 5,
"tags": "ассемблер, c, многопоточность, unix"
}
|
How to share USB drive via NFS on FreeBSD
I'm trying to share USB hard drive with msdosfs connected like this:
`mount_msdosfs -o large /dev/da1s1 /mnt/usb`
I can see mounted drive: `/dev/da1s1 on /mnt/usb (msdosfs, local)`
but when I'm trying to share drive via NFS my exports file:
`/mnt/usb -network 192.168.1.0 -mask 255.255.255.0`
I'm getting error
`freebsd mountd[871]: can't export /mnt/usb MSDOSFS_LARGEFS flag set, cannot export`
`freebsd mountd[871]: bad exports list line /mnt/usb -network 192.168.1.0 -mask 255.255.255.0`
Any clue how to resolve this issue besides changing msdosfs on drive for something else?
|
Large `MSDOS` filesystems are not supported as NFS exports on FreeBSD due to some implementation limitations. You could try if you can successfully mount the FS without the `-o large` option, but if that fails, you will be out of luck with NFS (but maybe you could try Samba instead).
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 1,
"tags": "filesystems, freebsd, usb, nfs"
}
|
Workflow to copy document from list to list in a different site collection by using GUID?
I am trying to copy a single document from one document library to a document library in another site collection.
Here is an existing workflow that uses a GUID as a destination. The GUID shown here is another document library.
 is modified in one location, the administrator receives an email asking them to copy the modified file to the other location.
(BTW - in my opinion it is not best practise to save the same file in two locations anyway, but the reality is the folks want it done this way....)
|
stackexchange-sharepoint
|
{
"answer_score": 0,
"question_score": 0,
"tags": "workflow, designer workflow, guid, copy item"
}
|
Lipschitz continuity of singular values
How smooth are the singular values of a matrix $F$ in terms of entries of $F$? I am hoping for Lipschitz continuity, but was not able to find it.
|
The singular values of $F$ are the (square roots of ) eigenvalues of $F F^t,$ and the regularity of the latter have been studied half-to-death. See either T. Kato (perturbation theory of linear operators, ch. 1) or Golub-van Loan (Matrix Computations -- they almost certainly talk about singular values directly, without going through eigenvalues, but at worst talk about eigenvalues).
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 7,
"question_score": 6,
"tags": "linear algebra, real analysis, ca.classical analysis and odes, continuity"
}
|
Where is RESTful API parameter URL-decoded?
I have a Spring-based RESTful API which is deployed to a Tomcat server. When I call this API like below (value of "para" has been URL-encoded) and debug it, value of "para" in controller method is "aaa bbb" which has already been URL-decoded.
* GET <
However, when I run a SpringBoot-based local Test Automation case (not deployed anywhere) to test the same API, the value of "para" in controller method hasn't been URL-decoded.
Question is, what is the difference between the two scenarios and where is "para" URL-decoded in the first scenario?
|
Hopefully I can give you a hint for the first part of your question:
The Apache Tomcat `server.xml` contains an tag `Connector`, this tag can have an optional attribute `URIEncoding`. Example:
<Connector connectionTimeout="20000"
port="8080"
protocol="HTTP/1.1"
redirectPort="8443"
URIEncoding="UTF-8" />
So I think that Tomcat is responsible for the URI encoding. But I do not know how this is activated in an Embedded-Spring-Boot-Tomcat.
* @See: How does URIEncoding = 'UTF-8' work?
* @See: Apache Tomcat 8 Configuration Reference / The HTTP Connector
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "spring, rest, urldecode"
}
|
Postfix master.cf versus main.cf
I see a lot of the time that the same settings can be specified in both main.cf, and also in master.cf using the -o prefix.
My question is, does one override the other, and if so, which file is given priority if the same setting (with a different value) is found in both?
For instance, if
smtpd_tls_auth_only=yes
was specified in main.cf, but
-o smtpd_tls_auth_only=no
was specified in master.cf, which one would postfix pay attention to?
|
**As documented**,
-o name=value
Override the named main.cf configuration
parameter.
`main.cf` sets the default values used by all services defined in master.cf; -o options in master.cf can override these on a per-service basis.
|
stackexchange-serverfault
|
{
"answer_score": 16,
"question_score": 17,
"tags": "postfix, ubuntu 12.04"
}
|
Grammatical terms for different verbs in a multi-verb structure
e.g. We want to leave. I like to sleep. She tries to help. They go running.
In these sentences what grammatical term would you use for want/like/try/go, and what would you call to leave/sleep/help/run? How do you differentiate between the two verb-roles?
I’m not looking for „infinitive” as an answer. Is the 1st group called primary verbs of the sentence? Auxiliary verbs? Helping verbs? Linking-verbs? Is the 2nd group called secondary verbs? Main verbs? Verb-objects? Linked verbs?
And while at it: what would be the grammatical term for this whole structure? I used the word multi-verb structure, but maybe there’s a better way to describe it.
|
> _We want to leave. I like to sleep. She tries to help. They go running._
"Want", "like", "try" and "go" are all catenative verbs, and these are all catenative constructions, where the subordinate clauses (three infinitivals and a gerund-participial) are catenative complements of those verbs.
In constructions like this, the first (or main) verb, i.e. the one in the upper clause, is referred to as the 'matrix verb', while that in the complement clause is the subordinate verb functioning as head of its clause.
The term 'catenative' comes from the Latin word for "chain", which is appropriate here since each sentence contains a chain of verbs.
|
stackexchange-ell
|
{
"answer_score": 3,
"question_score": 2,
"tags": "verbs, terminology"
}
|
¿por qué no se puede acceder a las propiedades de una clase desde una función estática?
Teniendo de referencia el siguiente ejemplo, ¿por qué no se puede acceder a las propiedades de la Clase desde la función cuando esta es estática? Gracias de antemano.
class Clase {
public $valor = 'Hola Publico';
public static function mostrarValor(){
echo self::$valor;
}
}
Clase::mostrarValor();
|
debes definir valor como una variable estática
class Clase {
public static $valor = 'Hola Publico';
public static function mostrarValor(){
echo self::$valor;
}
}
Clase::mostrarValor();
|
stackexchange-es_stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php, poo, funciones, objeto, class"
}
|
Creating layout dynamically from template
Is it possible to load a layout XML at runtime and load into activity?
In my app, I have various types of data like Person, Company, City, etc; The requirement is to dynamically load the layout, find views by tags (property names like Person.name, Person.address) and then fill in data. For example, if user has selected an object of type Company, we want to load a company.xml layout, inflate it and then associate various properties (company name, company slogan, city, address, revenue) to tagged views. One possibility I see here is - each view in the layout will be associated with property-name as `tag` and then appropriate data will be loaded in appropriate views.
What should be the best design you would recommend?
|
> Is it possible to load a layout XML at runtime and load into activity?
Not using standard Android layout XML files. Those have to be precompiled into your APK. The API does not support inflating layouts from anything but layout resources.
You could create your own interpreter of Android layout XML files, or roll something else similar.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "android, xml, layout, android inflate"
}
|
Link Aggregation (Etherchannel) between 2 cisco switches ( fibre link, and with an intermediate switch)
I have 3 switches soon to be setup in topology as shown below  at switch1 for the 3 ports (2 directly connecting to switch3 and one through intermediate switch2) for getting higher bandwidth and failover redundancy for switch3.
Q1- Is it possible to have LAG with the indirect connection through switch2 as shown in the figure?
Q2- How would I configure LAG for ports @ switch1? (If you point me to exact commands or any resources links, it would be helpful)
Q3- Do I need to configure LAG @ switch3 also for corresponding ports?
Q4- What modes(active/passive/on) should I use for LACP @ switch1 and @switch3?
|
Q1: This requires MLAG (multichassis LACP) to work. You can't split and splice a simple static or LACP trunk.
Q2: As far as I know, SG500X and SG300 don't support MLAG. You can configure a LAG trunk for the two lines between S1 and S3 though and use STP(Spanning Tree Protocol) to take care of the looping links to S2.
Q3: LAG trunks need to be configured on both terminating switches.
Q4: Use LACP whenever possible; static trunking should only be used when LACP isn't possible.
|
stackexchange-networkengineering
|
{
"answer_score": 2,
"question_score": 2,
"tags": "cisco, switch, etherchannel"
}
|
Search multiple rows by space
I am making a search that searches a SQL table by multiple rows. For example:
| FirstName | LastName |
|----------------------|
| John | Doe |
|----------------------|
`SELECT FirstName,LastName FROM Users WHERE FirstName LIKE '%inputhere%' OR LastName LIKE '%inputhere%' LIMIT 10`
When I search a full name (e.g. `John Doe`) no results appear because no one row has that value.
I there a way to separate the search query by spaces in order to avoid this?
|
Similar to what Gordon said, the best solution is to use Full Text indexes. However, You can do it like this:
Select * from Users where concat(FirstName, " ", LastName) like "John Doe"
You can feel free to turn `"John Doe"` to `"%John Doe%"` or `"John Doe%"`.
Try it here: <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "mysql, sql"
}
|
This binary takes much more space than its dynamic counterpart located in e2fsprogs, though
This is from Synaptic.
statically-linked version of the ext2/ext3/ext4 filesystem checker
This may be of some help to you if your filesystem gets corrupted enough
to break the shared libraries used by the dynamically linked checker.
This binary takes much more space than its dynamic counterpart located
in e2fsprogs, though.
You may want to install a statically-linked shell as well, to be able
to run this program if something like your C library gets corrupted.
What does this mean?
This binary takes much more space than its **dynamic counterpart** located
in e2fsprogs, though.
|
This means that this software is built static, so all its components are included into single deb-package. There are no dependencies for such package. This is because of the fact that binary is linked as static \- it includes all possibly libraries in one file.
You can check package dependencies on < to confirm that it does not have any must-installed dependencies.
|
stackexchange-askubuntu
|
{
"answer_score": 1,
"question_score": 0,
"tags": "software installation"
}
|
Make URL Request from Servlet and retain Header information
I need to make a request from a servlet but I also need to retain all the header information. That is in the request object.
For example, I if I do something like the following from the doGet method, is there a simple way to just pass that information to the URL Connection object?
URL url = new URL();
URLConnection uc = url.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-type",
"application/x-www-form-urlencoded");
DataOutputStream dos = new DataOutputStream(uc.getOutputStream());
dos.writeBytes(strInEnc);
dos.flush();
dos.close();
InputStreamReader in = new InputStreamReader(uc.getInputStream());
int chr = in.read();
while (chr != -1) {
taResults.append(String.valueOf((char) chr));
chr = in.read();
|
Use the `addRequestProperty`) method of `URLConnection`.
Enumeration<?> names = req.getHeaderNames();
while (names.hasMoreElements()) {
String key = (String) names.nextElement();
Enumeration<?> values = req.getHeaders(key);
while (values.hasMoreElements()) {
uc.addRequestProperty(key, (String) values.nextElement());
}
}
You'll have a similar set of loops if you use HttpClient, unless it has built-in support for pass-through of a `ServletRequest`. (And if it doesn't, why bother with a huge set of additional dependencies, and non-standard API?)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, servlets, jakarta ee, urlconnection"
}
|
What does 'related tags' really mean?
I'm confused when I use the api "< I find that tag A is in the related-tags list of tag B while tag B is not in the A's. What's more, for every tag, the "has_more" field is false when requesting with "page=2" and so it indicates there is no more related tags. As a result, only up to 60 tags is "related" to one tag.
|
IIRC, the related tags are determined by the tags most often seen together. For example, I would guess that javascript is a related tag of jquery because most jquery questions have the javascript tag on them.
This is a one-way relationship: although a lot of jquery questions are tagged javascript, a _far_ smaller proportion of javascript questions are tagged jquery.
To get some numbers:
* there are 1,086,048 javascript questions
* 370,448 of those are also tagged jquery (34.11%)
whereas
* there are 720,375 jquery questions
* 370,448 of those are also tagged javascript (51.42%)
|
stackexchange-meta
|
{
"answer_score": 4,
"question_score": 3,
"tags": "support, api, related tags"
}
|
CSS element consuming entire width in IE7
I have an IE7 CSS issue. I have setup a demo in jsfiddle, but basically I have a tabbed menu setup with rounded corners on the tabs (no rounded corners shown in jsfiddle). The rounded corners are floated left and right.
Everything works great in FF and Chrome, but in IE7 the floated elements are causing the tabs to consume the entire width. I have tried numerous things, overflow: hidden, position, display, etc... but I just can't work it out!
Any help appreciated.
<
|
I would just set the corner elements to `display: absolute;` and the containers to `position: relative` if needed. That should work.
Simple demo on jsFiddle: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "css, internet explorer 7"
}
|
How do I run multiple background commands in bash in a single line?
I normally run multiple commands with something like this:
sleep 2 && sleep 3
or
sleep 2 ; sleep 3
but what if I want to run them both in the background from one command line command?
sleep 2 & && sleep 3 &
doesn't work. And neither does replacing `&&` with `;`
Is there a way to do it?
|
Exactly how do you want them to run? If you want them to be started in the _background_ and run **sequentially** , you would do something like this:
{ sleep 2; sleep 3; } &
If you want `sleep 3` to run only if `sleep 2` succeeds, then:
sleep 2 && sleep 3 &
If, on the other hand, you would like them to run in **parallel** in the _background_ , you can instead do this:
sleep 2 & sleep 3 &
And the two techniques could be combined, such as:
{ sleep 2; echo first finished; } & { sleep 3; echo second finished; } &
Bash being bash, there's often a multitude of different techniques to accomplish the same task, although sometimes with subtle differences between them.
|
stackexchange-stackoverflow
|
{
"answer_score": 506,
"question_score": 280,
"tags": "linux, bash, shell"
}
|
LIKE condition : why '%,x,' doesn't work but '%,x,%' works
i have table called image
there is column called `category` in that table which varchar and stores all the categories of an image sperated with comma .
i one row i have :
category : ,26,25,
this query works fine
SELECT *
FROM `images`
WHERE `confirm` =1
AND `category` LIKE '%,25,%' AND `category` LIKE '%,26,%'
LIMIT 0 , 20
and i get all the rows with `,25,26,` as their category
but
why this doesn't work ?
SELECT *
FROM `images`
WHERE `confirm` =1
AND `category` LIKE '%,25,' AND `category` LIKE '%,26,'
LIMIT 0 , 20
|
`LIKE` matches the entire string. `LIKE '%,26,'` matches strings that _end_ in `,26,`, not strings that _contain_ it. You need `%` on both ends if you want to search for a substring anywhere.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "mysql, sql"
}
|
How to define a variable that is a function pointer that can assign other functions in c?
So if I was given a the following 2 functions:
void printhex(int x, char y, char z)
{
printf("%x%x%x,x,y,z);
}
void printdecimal( int x, char y ,char z)
{
printf("%i%i%i,x,y,z);
}
How would i define a variable, that is a function pointer, that can be assigned either of the 2 given functions?
Also within the main function how would i determine if any command line arguments were entered after the program name when the program was executed. If anything was entered, how would I be able to assign the function pointer to the function printhex, but otherwise would assign the function to printdecimal?
|
A1) This is how the function pointer will look like:
void (*myFuncPtr)(int, char, char);
You then assign a function to it like this:
myFuncPtr = &printhex;
And call it like this:
(*myFuncPtr )(1, 'a', 'b');
A2) The `argc` variable of the `main()` will tell if any command line arguments were entered other than the program name itself. If `argc > 1`, then `argc - 1` other strings were passed when calling the program. This is because `argc` also counts the program name as one of the parameters. So something like this should work for you:
if (1 < argc)
{
myFuncPtr = &printhex;
}
else
{
myFuncPtr = &printdecimal;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "c"
}
|
Label multiline weird behavior for iOS 6 (iOS 6 have more vertical space)
I am trying to write 4 lines in UILabel so I put 0 for numberoflines in editor.
Below is what I have in ViewController
!enter image description here
## When I run in iOS6
!enter image description here
## When I run in iOS7
!enter image description here
If you see, for iOS 6, I get three lines only. Any idea why this is happening?
**How can I have 4 lines in iOS 6?**
|
This is weird...
`[introText sizeToFit];` did the trick
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "objective c, ios6, ios7, uilabel, multiline"
}
|
Making a radial (only) seal inside a small tube
I'm trying to make a adaptor to fit a nozzle about 5mm wide which only applies pressure _radially_ during insertion. Pushing in a standard O Ring would apply some force _axially_ up or down the inlet due to friction.
The adaptor should seal in the inlet, before injecting gas to the object, see sketch. I can't change the object in any way, only the adaptor. Considering the size, can anyone suggest something off the shelf I can use for this? Or how I might make it at all?  flaring out underneath the O ring, and the opposing taper being either pushed down by hand or driven by a standard nut (black) depending on the sealing forces required.
The key difference is that instead of relying on the squashing of the seal to make it oval so it reaches the walls, you are stretching the seal onto a larger diameter.
:
Color color1 = something;
Color color2 = something;
Color color3 = something;
for (int i = 1; i < 4; i++) {
int r = color(i).getRed();
int g = color(i).getGreen();
int b = color(i).getBlue();
}
|
You can store the three colors in an array and access that array inside your loop.
// take these three colors for example
Color[] colors = {Color.BLACK, Color.WHITE, Color.YELLOW};
for (int i=0; i<3; i++) {
int r = colors[i].getRed();
int g = colors[i].getGreen();
int b = colors[i].getBlue();
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "java, colors, integer"
}
|
Angular: Passing parameter from Controller to Factory
Sorry if duplicate, but really couldn't find the answer at similar issues here at StackOverflow.
Here's the code:
<
What I want is in `line 19`, I want the program to alert the number I pass, while currently it alerts me a function. The number should be either `0`, `1`, or `2`, depending on which one entry removed `(Remove Student)`.
|
Your factory method accepts two parameters, `index` and `callback`. In that order.
When calling it, you're only passing it a function. This function accepts `index` and `callback`.
Instead, you need to pass it an `index` and a `callback` which accepts `data`.
$scope.removeStudent = function(index) {
console.log(index);
studentFactory.removeStudent(index, function(data){ // this is what's different
console.log(data);
});
};
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "angularjs"
}
|
converting a calendar date to a string?
I am trying to get the program to call up the current date, add 30 days to it, and then out put that date as a string.
// Set calendar for due date on invoice gui
Calendar cal = Calendar.getInstance();
// Add 30 days to the calendar for the due date
cal.add(Calendar.DATE, 30);
Date dueDate = cal.getTime();
dueDatestr = Calendar.toString(dueDate);
|
And the question is?
If you want to format your date, I suggest looking at `java.text.SimpleDateFormat` instead of using `toString()`. You can do something like:
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
dueDateStr = dateFormat.format(dueDate); // renders as 11/29/2009
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "java, date, calendar"
}
|
Can I manualy add modules in Drupal 7 just by pasting them in the modules folder?
I am unable to install modules in Drupal 7. I'm working on localhost so I don't have FTP, but it seems that they made it impossible to install them otherwise.
In Drupal 6 I would of just paste a module, refresh and there it was. Here I have to specify the FTP.
|
**If you have a single site setup:**
Contrib modules go in /sites/all/modules/contrib/
Custom modules go in /sites/all/modules/custom/
Custom themes go in /sites/all/themes/
**If you have a multi site setup:**
contrib modules go in /sites/site_name/modules/contrib/
custom modules go in /sites/site_name/modules/custom/
custom themes go in /sites/site_name/themes/
I think some of the language in this post is dangerous, remember, do NOT put modules in the root modules directory, that is DRUPAL CORE. Everything you code and download should go in the directories I've mentioned above.
|
stackexchange-drupal
|
{
"answer_score": 1,
"question_score": 1,
"tags": "7, installation"
}
|
Change print dialogue box
My form, which is called "Production Info", has a button on it that prints only the current record when clicked. I have added to its Onclick macro so that as well as printing when clicked, it also opens a second form and prints that as well. However, I am still getting two separate print dialogue boxes. Is there a way to print them both from the same print dialogue box so that the reports print together (duplex print) on the same paper instead of printing separately on different pages?
Also, I know it is not common practice to print forms, but making the "Production Info" form into a report isn't an option because it has a combo box that is essential to its' functionality. I tried making it a report before, but reports don't support interactive controls as far as I understand.
|
No, there is no such option.
You could print to two PDF files, then use a PDF tool to merge these into one PDF-file, and finally print this.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ms access 2010"
}
|
how to check if string start with {SOME_STRING}
I would like to return true if string starts with "{SOME_STRING}". examples of true returned:
{A}
{AB}
{}
{ABC}
otherwise, return false.
I tried:
return str.matches("{%s}")
but it doesn't work I tried:
return str.matches("{//s}")
return str.matches("^{.*}")
nothing worked.
|
you can try this:
public void matchingContext(String myWord)
{
String input="{SOME STRING} some other string";
String regex = "^("+myWord+").*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
System.out.println(matcher.find());
}
and when you want to call the method with {SOME STRING}, you have to escape the characters `{` and `}` first, so this would look like `matchingContext("\\{SOME STRING\\}")`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, string, matcher"
}
|
Prove convergence in $\Bbb R^m$
**My attempt:** First, I have this information:
First, for any $\epsilon_{1}>0$, $\exists N_{1}∈\mathbb{N}$ such that $\left \| x_{n}-a \right \|<\epsilon_{1}, \quad\forall n\geq N_{1}$.
|
It’s basically correct, but it could be organized a bit better. In particular, you don’t need different $\epsilon$s and $N$s. Here’s one possibility:
> By hypothesis there is a $c>0$ such that $|\lambda_n|<c$ for each $n\in\Bbb N$. Let $\epsilon>0$. Since $\lim_{n\to\infty}x_n=0$, there is an $N\in\Bbb N$ such that $\|x_n\|=\|x_n-0\|<\frac{\epsilon}c$ whenever $n\ge N$. But then $\|\lambda_nx_n\|=|\lambda_n|\|x_n\|<c\cdot\frac{\epsilon}c=\epsilon$ whenever $n\ge N$, so $\lim_{n\to\infty}\lambda_nx_n=0$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "sequences and series, convergence divergence"
}
|
Passing TFIDF Feature Vector to a SGDClassifier from sklearn
import numpy as np
from sklearn import linear_model
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
Y = np.array(['C++', 'C#', 'java','python'])
clf = linear_model.SGDClassifier()
clf.fit(X, Y)
print (clf.predict([[1.7, 0.7]]))
#python
I am trying to predict the values from arrays Y by giving a test case and training it on a training data which is **X** , Now my problem is that, I want to change the training set **X** to **TF-IDF Feature Vectors** , so how can that be possible? Vaguely, I want to do something like this
import numpy as np
from sklearn import linear_model
X = np.array_str([['abcd', 'efgh'], ['qwert', 'yuiop'], ['xyz','abc'],['opi', 'iop']])
Y = np.array(['C++', 'C#', 'java','python'])
clf = linear_model.SGDClassifier()
clf.fit(X, Y)
|
You should look into the TfidfVectorizer in `scikit-learn`. I'll presume that **X** is a list of texts to be classified.
from sklearn.feature_extraction.text import TfidfVectorizer
vectorizer = TfidfVectorizer()
X_train = vectorizer.fit_transform(X)
And then use the `X_train` as the new **X** to train you classifier on.
clf = linear_model.SGDClassifier()
clf.fit(X_train, Y)
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 2,
"tags": "python, scikit learn, tf idf"
}
|
Highlight external element on ChartJS hover
I want to be able to generate a chart and when parts of the chart are hovered (i.e. the point on a line graph), I want corresponding elements to have a class added to it on hover. Presumably by passing an array of elements to the hovered data point.
Is this possible in ChartJS? If not, can you recommend a chart software that is capable of this?
|
I achieved what I wanted with this answer:
<
Here is my prototype: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "chart.js"
}
|
how to check up/down status of oracle reports server?
To check the status of database servers, I use tnsping utility. Is there any similar utility for checking reports server? Thanks.
|
Without access to the ReportServer admin console, that can be tough. But a call to /reports/rwservlet/showjobs?server= might do the trick for you. If you get a response, it confirms the server is up and running, and it'll show you any jobs that are running.
I've also implemented a procedure in the past that periodically runs a minimal report using utl_http and looks for a reasonable response. Then emails if it timesout or gets an HTTP error or report server error.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "oracle, status, oraclereports"
}
|
How to style Google maps info windows?
If you use the info windows in the iOS maps, they're sleek and small and aesthetically pleasing.
The google maps info windows, on the other hand, are huge white blocks with obnoxious shadows. Is there any way to style them-- to give them an _entirely_ different appearance?
|
I _think_ you're talking about InfoWindows, not info boxes (the distinction is important).
This is a Google Maps Version 3 InfoWindow:
!Google Maps image showing InfoWindow
There is an external utility library called **InfoBox** which allows things like these:
!Google Maps image showing sample InfoBox !Google Maps image showing sample InfoBox
so it is possible to show different styles of information callout, and it's almost certainly possible to do something like iOS does (image from Macworld):
!Sample iOS map and info box
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "google maps api 3, styling"
}
|
JQuery - how do i detect how many divs of a given class exist within a given div?
I have a div like this:
<div id="x" name="x" class="x" style=""></div>
and contained within this div I have several divs like this:
<div id="y_1" name="y_1" class="y" style=""></div>
<div id="y_2" name="y_2" class="y" style=""></div>
<div id="y_3" name="y_3" class="y" style=""></div>
etc.
QUESTION 1: How do I detect how many of these divs (class="y") are contained within the container div (class="x")? - (just an alert("") with the number, for example).
QUESTION 2: How do I do something to each of these y-divs (class="y") such as a function that might place the letter "Y" into all of the y-divs using $('.y').html("Y"); , for example??
Any help appreciated guys....
|
You need to find the elements within the ancestor element.
$('#x div.y').length; // number of class y elements under element x
$('#x div.y').html('Y'); // run a jQuery method on the y elements
See the API:
* descendant selector
* `length` property
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 3,
"tags": "jquery, html, detect"
}
|
Exponential function to logarithmic function
i'm stuck on completing this equations. Is this correct?
$$z=a e^{-bt}$$
$$\ln(z)=\ln(a)+\ln(e^{-bt})$$
$$\ln(z)=\ln(a)+(1)(-bt)$$
$$\ln(z)=\ln(a)-bt$$
|
It is correct!!!
If you want to solve for $t$, it is as followed:
$$\ln{(z)}=\ln{(a)}-bt \Rightarrow bt=\ln{(a)}-\ln{(z)}=\ln{(\frac{a}{z})} \Rightarrow t=\frac{1}{b} \ln{(\frac{a}{z})}, \ \text{ where } z,a>0$$
Like @Alex R. says in the comment, from the relation $$z=a e^{-bt}$$ if $\displaystyle{z=0 \Rightarrow a=0 \text{ and } b,t \text{ are arbitrary }.}$
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 2,
"tags": "algebra precalculus, logarithms, exponential function"
}
|
Matrix Relative to Canonical Basis
let $f:\mathbb{R}^{2}\to\mathbb{R}^{3}$ the linear map who's matrix
(relative to the bases $$ \begin{matrix} 2\\\1\end{matrix}, \begin{matrix} 5\\\3\end{matrix}$$ and $$ \begin{matrix} 1\\\0\\\1\end{matrix}, \begin{matrix}1\\\1\\\0\end{matrix},\begin{matrix} 1\\\1\\\1\end{matrix}$$)
Is
$$ \begin{matrix}7 & -3\\\2 & 1\\\8 & 0\end{matrix} $$
**Find the matrix f relative to the canonical basis of $\mathbb{R}^{2}$ and $\mathbb{R}^{3}$**
|
Use the change of basis matrix: let $X$ the column vector of an element $u\in\mathbf R^2$, $X'$ the column vector of the same element in the new basis, $P$ the change of basis matrix from the canonical basis to the new one in $\mathbf R^2$.
Similarly let $Y$, $Y'$ be the column vectors of $f(u)$ in the canonical basis and the new basis of $\mathbf R^3$ respectively, $Q$ the change of basis matrix from the canonical basis to the new one in $\mathbf R^3$.
Finally let $A$ be the matrix of $f$ in the canonical bases, $A'$ its matrix in the new bases. We have $$X=PX',\quad Y=QY', \quad Y=AX$$
whence $QY'=APX'$, so $A'=Q^{-1}AP$, whence $$A=QAP^{-1}.$$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "linear algebra, matrices"
}
|
What to do to a gnawing laptop
My laptop model no. is HP-630 .The battery of my laptop is not working at all. Even if I fully charge it, after 30-45 minutes a message gets displayed that the battery has been exhausted.
The specifications of my laptop are
* 2.14 GHz Processor ,500 GB Hard Disk,2 GB RAM,Intel Core I-3 Processor; Ubuntu 12.04 installed in it running for 4 years.
The laptop is giving a gnawing sound when running and the laptop is getting very hot.I don't know why?
**Question 1** :Is it wise to exchange my laptop and go for a new one or is it okay to buy a new battery instead? I am in a fix.
**Question 2** :I would be happy if someone could give me some advice and even give some tips on what configurations should a new laptop contain.I only use it for running C-programs and searching questions.
Do tell me if this question is suitable for this site or not?If not where should I ask it?
|
First of all you don't have to buy a new laptop if you will use it only for writing C programs and searching.
> I would suggest buying a new battery and if it doesn't work for you then get it checked from a service center.Since 4 years is a lot of time it may happen that your battery may be damaged and it isn't working to it's full capacity.
If the new battery thing doesn't work come again and ask about the specifications.
> P.S. As you asked, this question is not suitable for this site because it's a site related to Ubuntu specific problems.But since you are a Ubuntu user the Ubuntu community will always be there to help you.
|
stackexchange-askubuntu
|
{
"answer_score": 0,
"question_score": 0,
"tags": "12.04, sound, maintenance"
}
|
How can I define some arguments of a C macro as another macro?
Consider the macro
#define IP4_ADDR(ipaddr, a,b,c,d) (ipaddr)->addr = PP_HTONL(LWIP_MAKEU32(a,b,c,d))
I would like to define the arguments a,b,c,d in another macro. So I have done this:
#define DEBUG_HOST_IP4 192, 168, 0, 123
IP4_ADDR(&debug_host, 192, 168, 0, 123 );
IP4_ADDR(&debug_host, DEBUG_HOST_IP4 );
The first call to IP4_ADDR compiles succesfully, while the second one fails with
> error: macro "IP4_ADDR" requires 5 arguments, but only 2 given
> IP4_ADDR(&debug_host, DEBUG_HOST_IP4 );
Is there a way to make `DEBUG_HOST_IP4` expand properly, so the `IP4_ADDR` macro can work as intended?
EDIT: The IP4_ADDR macro comes from a third-party library, which I would rather not touch, and risk breaking somebody else's code. Of course, implementing my own version is an option.
|
If you can't alter IP4_ADDR, this is still pretty easy; just wrap it:
#define MY_IP4_ADDR(...) IP4_ADDR(__VA_ARGS__)
During the translation (which just moves all of the arguments over, whatever they are), any macros will expand. Then just use your wrapped version in the code.
MY_IP4_ADDR(&debug_host, 192, 168, 0, 123 );
MY_IP4_ADDR(&debug_host, DEBUG_HOST_IP4 );
And you should be good to go.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 5,
"tags": "c, c preprocessor, preprocessor"
}
|
How to store a 2D array with values from 0-20 to a grayscale image in python
I am working on an image segmentation project and I have a 2D array of size (224,224) with the values from 0-20 with each number representing a category of the dataset. I want to store this 2D array to a grayscale image and read it back with the same 0-20 values. I couldn't find a proper way to do this. I tried as below but although it's storing as a grayscale image, I couldn't read back the actual 2D array when reading the array from the image.
#arr is the 2D array of size (224,224) with values from 0-20
rescaled = (255.0 / arr.max() * (arr - arr.min())).astype(np.uint8)
img = PIL.Image.fromarray(rescaled)
img.save(filename)
But when I read it back `I = np.asarray(PIL.Image.open('filename.png'))` I could only see 0's and 255. I need the values with 0-20. How can I do this? I tried to do it with `cv2.imwrite(filename,arr)` but all it gave is a blank image.
|
You can try the below code
#arr is the 2D array of size (224,224) with values from 0-20
min_value = arr.min()
max_Value = arr.max()
rescaled = (255.0 // (max_Value-min_value) * (arr - min_value)).astype(np.uint8)
img = Image.fromarray(rescaled)
img.save(img_name, "BMP")
import_array = np.asarray(Image.open(img_name), dtype="int32")
rescaled_import_img = min_value + import_array*(max_Value- min_value)//255
print (rescaled_import_img)
There is a problem with approximation. When you divide integer value, the result would be float and be rounded. When you load values there would be difference. We'd better to not scale values but keep 0-20 values in the gray image and load them later.
# Update 1
Without rescale
img = Image.fromarray(np.uint8(arr))
img.save(img_name, "BMP")
print (img)
import_array = np.array(Image.open(img_name), dtype="uint8")
print (import_array)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python 3.x, opencv, png, python imaging library, cv2"
}
|
Comic Book Identification - Sci-fi/Fantasy - Lost Soul Earthworm
When I was a kid(early 1990s), I read a graphic novel from the local library that I have been unable to find or identify.
Here are the clues:
* It's from the 1970s or 1980s, from what I remember of the art style.
* It felt like one of those strange sci-fi / fantasy mixes that were common in the 70s.
* It was black and white.
* The main character's soul becomes detached from his body and takes the form of a giant(human-sized) earthworm.
* The earthworm goes off and does its own thing. Our hero sometimes sees the earthworm in the distance, and at some point goes hunting for the thing, through forests and wastelands.
* The earthworm-soul thing was only ONE part of the comic's storyline. There was other stuff, but for the life of me, I can't remember what.
|
I had asked this same question almost five years ago, and just discovered that almost 9 months ago, someone (currently unregistered, so basically anonymous) was able to find the answer. In case you also haven't been keeping up with this and need an update: the book is "The Midnight Son", by Steven Miller. There are copies (in the US, anyway) available `on Amazon`.
|
stackexchange-scifi
|
{
"answer_score": 5,
"question_score": 4,
"tags": "story identification, comics"
}
|
Split PDF into documents with several pages each
There are several resources on the web explaining how one can split a PDF into many files with on page per file.
But how can you split them into chunks of, say, five pages each? I have looked into the standard tools such as `pdftk` but could not find an option doing what I want.
|
`pdftk` is able to cut out a fixed set of pages efficiently. With a bit of scripting glue, this does what I want:
number=$(pdfinfo -- "$file" 2> /dev/null | awk '$1 == "Pages:" {print $2}')
count=$((number / pagesper))
filename=${file%.pdf}
counter=0
while [ "$count" -gt "$counter" ]; do
start=$((counter*pagesper + 1));
end=$((start + pagesper - 1));
counterstring=$(printf %04d "$counter")
pdftk "$file" cat "${start}-${end}" output "${filename}_${counterstring}.pdf"
counter=$((counter + 1))
done
This assumes that you have the number of pages per chunk in `$pagesper` and the filename of the source PDF in `$file`.
If you have `acroread` installed, you can also use
acroread -size a4 -start "$start" -end "$end" -pairs "$file" "${filename}_${counterstring}.ps"
`acroread` offers the option `-toPostScript` which may be useful.
|
stackexchange-unix
|
{
"answer_score": 12,
"question_score": 7,
"tags": "scripting, pdf, split"
}
|
Symfony 2: Way to store app configuration for templates and controller
I am new to symfony and looking for a way store (and read) some informations, which I want to use in controller and templates.
Basically I want to access this sample structure:
project:
name: "My cool Project"
cdn: "
paths:
"images": "/images",
"pdf": "/pdf"
...
**I have already tried to add this to my parameters.yml. But is it the correct place and how to access it in template AND controller?**
In controller, I can do:
$this->getParameter("project")
Is there a way to directly access project.name? Something like:
$this->getParameter("project.name")
How to access it in template?
|
Just pass the parameter from the controller to the view:
In the controller class:
return [
'variable' => $this->getContainer()->getParameter('variable');
];
In the twig template, to print it:
{{ variable }}
If you want to pass a parameter to the templates without passing it in every controller, use the `twig.globals` configuration:
twig:
globals:
variable: %variable%
Then print it the same way as above.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "symfony"
}
|
Microsoft Sql ReportBuilder
I had downloaded the **Microsoft SQL Report Builder** and installed in my system. I designed the simple report with the help of Report Builder which contains one text box and saved it in D drive. Then I created the asp.net application and added the aspx page with Report Viewer. I had assigned the report to report viewer when I try to execute report is not loaded. I got the following error.
**The report definition is not valid. Details: The report definition has an invalid target namespace '< which cannot be upgraded.**. I hope I make it clear. Please do mail me if any one have Idea about this. MailId:[email protected]
|
i think its is possible. There are a lot of websites that help out with this problem. You can refer SSRS 2016. here are some of the links i found useful.:
< The report definition is not valid
hope this helps.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ssrs 2008"
}
|
Find exact solution for $x_{n+1}$ = $4x_n(1-x_n)$ by setting $x_n =\sin^{2}\theta_n$ and then simplify
I am trying to solve the following problem however I am stuck. I tried to apply trigonometric identity but I am not finding anything useful.
|
Rewrite the equation $x_{n+1}$ = $4x_n(1-x_n)$ as
$$(2x_n-1)^2=1-x_{n+1}\tag 1$$
and substitute $x_n = \sin^2\theta_n$ into (1) to get
$$(2\sin^2\theta_n-1)^2= 1-\sin^2\theta_{n+1}$$
Simplify to obtain
$$\cos^2 2\theta_n =\cos^2\theta_{n+1}\tag 2$$
which leads to one simple solution,
$$2\theta_n=\theta_{n+1}\implies \theta_n=2^n\alpha$$
Thus, $x_n=\sin^2(2^n\alpha)$.
Edit: As commented by @Andrei, the general solutions to (2) is quite involved, which can be obtained by factorizing (2)
$$\sin(\theta_{n+1}-2\theta_n)\sin(\theta_{n+1}+2\theta_n)=0$$
Then, $\sin(\theta_{n+1}-2\theta_n)=0$ leads to $\theta_{n+1}=2\theta_n+k\pi$ and $\sin(\theta_{n+1}+2\theta_n)=0$ leads to $\theta_{n+1}=-2\theta_n+k\pi$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "dynamical systems"
}
|
Виды библиографического описания
Есть задание. Надо изучить пример (какой именно пример — не важно) библиографического описания и указать его название:
а) в зависимости от структуры описания;
б) в зависимости от вида ресурса;
в) в зависимости от наличия заголовка.
Все понятно, кроме последнего пункта.
Что значит "в зависимости от наличия заголовка"? Какие бывают библиографические описания в зависимости от заголовка?
**P.S. Не знаю, соответствует ли мой вопрос рамкам сайта, если нет — удалю.**
|
В ряде случаев библиографическому описанию может предшествовать заголовок. Это может быть имя автора, наименование организации, обозначение документа (характерно для технико-экономических, нормативных, патентных и т.п. документов) и др.
Составление заголовка регламентируется отдельным ГОСТом - ГОСТ 7.80—2000 «Библиографическая запись. Заголовок. Основные требования и правила составления».
...Во всех остальных случаях заголовок не используется, библиографическое описание начинается с заглавия. А именно:
• если у описываемого документа (публикации, ресурса) четыре автора или больше
• если у описываемого документа (публикации, ресурса) вообще нет автора (например, сборник статей, материалы конференции и т.п.)
Это документ с сайта eusp.org
|
stackexchange-rus
|
{
"answer_score": 1,
"question_score": 0,
"tags": "общие вопросы, названия"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.