INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
How do I get untranslated data when the user views a page in Google Translate?
My extension use content-scripts to grab data from some pages. But, sometimes users use _Google Translate_ on the page and I need original data.
How can I get it? The content-script grabs translated data.
|
To get the original (untranslated) version:
1. Get its address from the translate-address input: !Address bar
2. Load that address in a hidden iframe.
3. Grab the data you want from your new hidden iframe using the usual methods for dealing with iframes in Google-Chrome extensions.
If the translated page has been modified by AJAX, the AJAX additions aren't available in the "Original" version, but Google-translate doesn't translate these either (for now) -- so just grab the AJAXed changes directly, from the translated-page iframe.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, google chrome extension, google translate, content script"
}
|
self executing anonymous click function in for loop
I need a click function in a for loop, so every id element is clickable. But I also need the i in the click function, that's why I thought a self executing anonymous function would be the best way to do so. But for some reason this is not working, maybe because the click function doesn't allow me to forward a parameter? What have I done wrong?
for (var i = 0; i < countItems; i++) {
$("#item-" + i).click(function(idx) {
alert(idx);
})(i)
}
|
The self executing function must return a `function`:
for (var i = 0; i < countItems; i++) {
$("#item-" + i).click(function(indx){
return function(){ //must return a function
alert(indx);
}
}(i));
}
**JS Fiddle:** <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, jquery, html, css, self executing function"
}
|
Using Colab GPU for PULP Python
So I am trying to solve a linear programming problem with around 10,000 binary variables using the PULP python library. It's taking me a lot of time to solve the problem. I was wondering if there is anyway for the code to use GPUs available in Colab to solve these linear programming issues.
|
GPUs have little or no advantage for general large, sparse LP and MIP models. Apart from some academic exercises on highly structured problems, there are few or no solvers available that use GPUs. The underlying problem is that GPUs are really good for data-parallel problems (SIMD architecture). Large, sparse LPs are different.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, gpu, google colaboratory, pulp"
}
|
Elasticsearch - Subqueries and reusing the queries
How we can achieve subqueries ( from SQL ) with elasticsearch? And also, how we can reuse the queries or build the queries based on the results of the other queries ?
I didn't seem to find an references with respect to this in documentation,
One option is query template but it assumes to supply a query template and parameterize the values based on the need which might not be suitable for subqueries or reusing the queries in different places
|
Ok, it seems this is the closest answer I see so far for this question.
**NO SUPPORT**
Hopefully, it is true with current version too ( 7.8.x)
What is the ElasticSearch equivalent for an SQL subquery?
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "elasticsearch"
}
|
OCZ Vertex 2 (SSD) vs Caviar Black (HDD)
I just bought a new pc with ASUS P8P67-M PRO motherboard with OCZ Vertex 2 60GB and Caviar Black 1TB 64MB Cache, both on AHCI.
I tested them using CrystalDiskMark. The strange thing is that the HDD gives me rate of 450mb/s read, 120mb/s write, and the SSD gives me only 200mb/s read, 70mb/s write.
* Is it possible for the HDD to have such big read values?
* Are those normal values for the Vertex 2
* If both are normal, what should I use for OS drive
|
1. Yes, if you use really bad setting for CrystalDiskMark when benchmarking. You probably changed to the smallest test, which means that with a little read ahead you just end up reading from the cache. This is much faster on the Caviar Black than the Vertex 2 because the the Caviar Black has a 6 Gbps SATA port while the the Vertex 2 only has a 3Gbps SATA port. Change back to default setting and you will get better results. Use default setting for CrystalDiskMark instead.
2. Pretty normal, yes. The write is so low because the Vertex 2 has run out of clean blocks and has to run garbage collection while writing. Avoid benchmarking it for a while and the speed should pick back up.
3. Definitely the Vertex 2. It is much faster. You shouldn't be looking at the sequential numbers, you should be looking at the 4k numbers. They are much more representative of what using a desktop computer is like.
|
stackexchange-superuser
|
{
"answer_score": 4,
"question_score": 1,
"tags": "windows 7, hard drive, ssd"
}
|
How to monitor a Windows process and send an alert when it crashes or closes?
I'm looking for a program/utility to monitor a process running in Windows 7 (actually it's a Java process ran from .jnlp). and that can send an e-mail alert or trigger any kind of script so I can be aware that it has crashed ?
From what i've seen there's nothing like that.
Any ideas ?
|
:begin
tasklist | find "java.exe"
IF %ERRORLEVEL% EQU 1 blat.exe ---
sleep 10
goto :begin
you'll need blat.exe which is the most used tool for sending mails via batch scripts sleep should be built-in windows 7. But this will work only if you have only one java.exe running... You can use some external tools to start a process and its PID for maximum usability
|
stackexchange-superuser
|
{
"answer_score": 4,
"question_score": 4,
"tags": "windows, process, monitoring"
}
|
Sorting Unanswered Questions by Vote does not work
(This problem appears nondeterministically, but frequently. So you might not see what I am seeing when you read this question!)
I often observe that the list appearing under
<
is ordered in a strange way. For instance, at the moment of writing this the highest-voted question is on page 4.
Usually, this goes away after a few minutes, but at this moment, it seems to be like this at least for 12 hours.
Is there a problem with index generation, or is this to be expected, or can I do something to "refresh" the ordering?
**Edit:** Things seem to have been shuffled a bit. Now the highest-voted question is on page ~~6~~ 9 when I open the link.
|
Marc Gravell kicked the tag engine that powers the list, so it should be properly ordered now.
|
stackexchange-meta
|
{
"answer_score": 2,
"question_score": 6,
"tags": "bug, status completed, unanswered questions, sorting, votes tab"
}
|
when matched then insert in merge
i tried this sql
merge into params t
using (
select '9158075153713931109' ATTR_ID, '9158310272413033579' OBJECT_ID,
'9158075157713931109' LIST_VALUE_ID
from dual
where exists (select * from attributes where attr_id = 9158075153713931109)
) v
on (t.object_id = v.object_id)
when matched then insert (attr_id, object_id, list_value_id, show_order) values(v.attr_id,v.object_id, v.LIST_VALUE_ID,1);
here i need to insert the value into params only when attr_id (9158075153713931109) exists . i understood only update and delete to be used with "when matched" please help me how can i do this with merge .
|
> I need to insert the value into params only when attr_id (9158075153713931109) exists
I don't see the point for a `merge` statement here. As I understand your question, your requirement translates as:
insert int params (attr_id, object_id, list_value_id, show_order)
select s.*, 1
from (select '9158075153713931109' attr_id, '9158310272413033579' object_id, '9158075157713931109' list_value_id from dual) s
where exists (select 1 from attributes a where a.attr_id = s.attr_id)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "sql, oracle, sql update, subquery, sql insert"
}
|
C# terminology help needed
Recently I ran into this code but I don't know the terminology so I couldn't search on Google to learn more about this coding style.
Here's the code:
SomeObject someObject = new SomeObject()
{
Name = "name",
Value = 10
};
Does anyone know what is this called in C#?
|
I believe what you are looking for is called an Object Initializer
From the MSDN:
> You can use object initializers to initialize type objects in a declarative manner without explicitly invoking a constructor for the type.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c#"
}
|
If someone hospitalized on erev Shabbat is then asked/required to sign a release form during Shabbat, what is to be done?
If someone is hospitalized on erev Shabbos, and asked/required to sign a release form upon the conclusion of his time there, should this be signed with a shinui?
|
Signing one's name with ink is generally a biblical prohibition which is only waived in cases of _safek pikuach nefashoth_ (risk of loss of life). Where it does not at all increase this risk, a shinui (abnormal implementation) is employed to avoid the biblical prohibition. However, signing with even a halachically valid _shinui_ ("abnormal" has to be legally defined) is still rabbincally prohibited and is not allowed just because of inconveniences. Nonetheless, there are often specific leniencies to avoid major inconveniences ( _shaat hadechak_ ; e.g., at times, _shvut d'shvut_ [a type of double Rabbinic level of prohibition]) which generally require consulting a halachik authority.
|
stackexchange-judaism
|
{
"answer_score": 3,
"question_score": 0,
"tags": "halacha, shabbat"
}
|
Extending Hallojs in Django Wagtail With Edit Source Button
I've been abel to add an an 'Edit Html' source button to my editor with the following hook:
@hooks.register('insert_editor_js')
def enable_source():
return format_html(
"""
<script>
registerHalloPlugin('hallohtml');
</script>
"""
)
It adds a button, but I can't figure out how to add an icon - see screenshot below with no icon.

def editor_css():
return format_html(
'<link rel="stylesheet" href="{}">',
static('demo/css/editor-overrides.css')
)
In your hallohtml plugin JS, assign `icon-hallohtml` to the button and use the following CSS to style it with an H character:
.hallotoolbar .halloformat .ui-button-text .icon-hallohtml:before {
content:'H';
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "django, django models, django templates, wagtail, wagtail snippet"
}
|
Fourier coefficients for an infinitely differentiable function
I hope I have understood this coreectly: A Fourier series has coefficients of order $O(n^{d+1})$ for a $d$ times differentiable function. But what if the function is infinitely differentiable? Do the coefficients tend to have order 0? That is, is the series finite? Am I right? Thanks in advance!
|
The result
> A periodic function which has Fourier coefficients of order $O\left(1/n^{d+1}\right)$ is $d$ times differentiable.
becomes for infinitely differentiable function
> A periodic function which has Fourier coefficients of order $O\left(1/n^{d+1}\right)$ for all integer $d$ is infinitely differentiable.
And the converse is true: if $\displaystyle f(x)=\sum_{n=-\infty}^{+\infty}c_ne^{inx}$ with $c_n=O\left(1/n^{d+1}\right)$ then for all $d$ the series $\displaystyle\sum_{n=-\infty}^{+\infty}c_n(in)^de^{inx}$ is normally convergent, and therefore we can take the derivative under the sum. Note that we may have that the coefficients $c_n$ are all different from $0$, for example taking $c_n=e^{-n^2}$, or $a^{-n^2}$ where $|a|\gt 1$.
|
stackexchange-math
|
{
"answer_score": 6,
"question_score": 6,
"tags": "fourier analysis, fourier series"
}
|
Whitespace denominator in fraction [title changable]
MWE
\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[svgnames]{xcolor}
\usepackage{empheq}
\definecolor{formula}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formula}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\denklem}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\begin{document}
\denklem{\frac{V}{\left(\dfrac{20}{9}\right)}=\frac{140-V}{20}}
\end{document}
$}}=\frac{140-V}{20}}
|
I would like to suggest that you (a) change `\left(` and `\right)` to `\Bigl(` and `Bigr`, respectively, and (b) add a `^{\mathstrut}` directive in the numerator of the `\dfrac` expression. (The "strut" will push the entire `\dfrac` term down a bit.)
}
=\frac{140-V}{20}
\]
\end{document}
|
stackexchange-tex
|
{
"answer_score": 1,
"question_score": 2,
"tags": "math mode, horizontal alignment, delimiters, fractions, empheq"
}
|
Sharepoint Onenote Permissions Management
Is there a way to apply audience targeting in sharepoint to a OneNote Notebook? I also cannot find where the manage permissions feature is.
|
If you do have the audience groups all set up you should just be able to enable audiences in the library where your OneNote notebook is. "Library settings" > "Enable Audience Targeting" > "Enable audience targeting" to get the column used for audience trimming.
|
stackexchange-sharepoint
|
{
"answer_score": 1,
"question_score": 0,
"tags": "permissions"
}
|
rewriting URL to all lowercase
I have this rewrite rule in my .htaccess
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)/?(.*)$ /$1.php/$2 [QSA,L]
RewriteRule ^api/([a-z]+)/([a-z]+) /api/$1_$2.php
How can I modify this to change everything in my URL to lowercase?
i.e. This:
www.mysite.com/ThisURL/SHOULD/be_all_lowercse
Should be
www.mysite.com/thisurl/should/be_all_lowercase
|
Define a RewriteMap of type `int` (internal) referencing the `tolower` function, and call it where you want to do the lowercasing:
RewriteMap lc int:tolower
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)/?(.*)$ /${lc:$1}.php/${lc:$2} [QSA,L]
RewriteRule ^api/([a-z]+)/([a-z]+) /api/${lc:$1}_${lc:$2}.php}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "php, regex, .htaccess"
}
|
symfony form label from required widget with stars
I'm searching the best way to output a label of a widget with a star (*) if this widget is required. It should be automatic.
I didn't find any way to do it :(
|
One way to do this is to use a custom form formatter.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "forms, symfony1, label, required"
}
|
configure phpmyadmin for php4
i am new to linux and i am using ubuntu(11.01) and through google i installed php5.3, mysql apache2 and phpmyadmin each were working smooth, but i needed php4.4.9
i google and download the php4.4.9 and with following steps : <
and now php4 is working but when i am going to start phpmyadmin i got message :
> PHP 5.2+ is required
it means the phpmyadmin not working for php4.4.9 but now i don't know what to do, means how and from where i installed phpmyadmin for php4.4.9 Please help me to solve out this problem.
|
You shouldn't use php4. It's not supported anymore, so no security updates will be provided. Not a good thing on a public web server.
Anyway the instruction you linked say "php4 in parallel with php5". So you should be able to configure a second virtual host for apache running php5 for phpmysql.
|
stackexchange-askubuntu
|
{
"answer_score": 0,
"question_score": 1,
"tags": "apache2, php, phpmyadmin"
}
|
Is $M = \{ f \in L_2[1,\infty) : \int_1^{\infty}\frac{f(t)}{t}dt = 0 \}$ a closed subspace in $L_2[1,\infty)$?
My attempt was rather too easy:
We can denote $g(t) = \frac{1}{t}$ and rewrite $M = \\{ f \in L_2[1,\infty) : \langle f, \bar{g} \rangle = 0 \\}$
Let $(f_n)_n \subset M$ such that $f_n \rightarrow f$ then by continuity of inner product we get $0 = \langle f_n,\bar{g} \rangle \rightarrow \langle f, \bar{g} \rangle \in M$
I feel like this is too easy to be true, mainly because the proof isn't dependent of $g$, though not sure where I am wrong. How should we prove\disprove it?
|
Your proof is fine: your proved that if $g$ is in $L_2[1,\infty)$, then $M_g = \\{ f \in L_2[1,\infty) : \langle f, \bar{g} \rangle = 0 \\}$ is a closed subspace of $L_2[1,\infty)$. Alternatively, this is also the kernel of a linear continuous functional, namely, $f\mapsto \langle f, \bar{g} \rangle$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "functional analysis, lp spaces"
}
|
How to force fail a java regex?
In java, you can text a regex by doing
"mystring".matches("myregex")
But is there a certain regex you can use, that will make `matches` function evaluate to a `false`? It needs to work for all cases (i.e. no matter what string you test it with).
Thanks.
|
I don't know why you would need this, but this should do the trick
"mystring".matches("(?!)")
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "java, regex"
}
|
how to instantiate an object of class from string in Objective-C?
I've a String who's value is the name of the Class[MyClass] which has to be instantiated, and MyClass has a method called
-(void)FunctionInClass;
i'm using the method called NSClassFromString to instantiate MyClass.I want to know
1) what does NSClassFromString return??
2) what is id?
3) How to call method -(void)FunctioninClass which is in MyClass using the instance.
how should i proceed , i'm doing it in Objective-C for iPhone app?
|
`1) what does NSClassFromString return??`
It returns a Class, which means you can do `[[NSClassFromString(@"MyClass") alloc] init];` see Mac Dev Center Docs for more info.
`2) what is id?`
See <
`3) How to call method -(void)FunctioninClass which is in MyClass using the instance.`
id myclass = [[NSClassFromString(@"MyClass") alloc] init];
[myclass FunctioninClass];
|
stackexchange-stackoverflow
|
{
"answer_score": 57,
"question_score": 27,
"tags": "objective c, instantiation"
}
|
Non negative eigenvalues of a 10 by 10 matrix.
I am trying the following question from a competitive exam : Let A be 10 by 10 matrix with complex entries such that all its eigenvalues are non negative real numbers and at least one eigenvalue is positive. I need to find the statement which is always false from :
A. $\exists$ a matrix B such that AB-BA=B
B. $\exists$ a matrix B such that AB-BA=A
C. $\exists$ a matrix B such that AB+BA=A
D. $\exists$ a matrix B such that AB+BA=B
I have no idea where to start from. I don't even know how the given data will be needed to find the false statement. Any help is appreciated. Thanks. :)
|
**Hint** What can you say about the traces of the given matrices? (Alternatively, for three of the choices, one can find a suitable matrix $B$ for which the equation holds for all $A$.)
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "linear algebra, matrices, eigenvalues eigenvectors"
}
|
Select multiple elements
So I'm able to get multiple select elements and iterate thru them with the following:
$('select[name=sel1], select[name=sel2]').each(function(){
Well, I thought I could do something like below but doesn't work:
var sel1 = $('select[name=sel1]');
var sel2 = $('select[name=sel2]');
//Doesn't work
$('sel1, sel2').each(function () {
////Doesn't work either
$(sel1, sel2).each(function () {
|
This is an option too:
$.each([sel1, sel2, sel3, ...], function(key, val){
/* val.on("event", ... */
});
* * *
I did an example here.
You can search more about $.each() and arrays here.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery"
}
|
Java microservices (Spring Boot) push data to WSO2 DAS 3.0.1
There are many Spring Boot based Microservices in my organization, and most of them are Restful web services. To analyse and monitor them, the Microservices should be able to publish data to WSO2 DAS 3.0.1. Can anyone tell me where are step-by-step tutorials and documents available?
Cheers, Sean
|
The support provided by WSO2 MSF4J for WSO2 DAS analytics can be used here with a few changes.
1. DAS Setup -
WSO2 contain an analytics dashboard and SparkSQL scripts to analyze microservices data. (The jaggery app)
These were written with WSO2 MSF4J framework in mind, but the DAS setup guide can be extracted without much changes. You can use das-setup/setup.sh for this.
`sh das-setup.sh -d /path/to/das/home`
2. Write a Spring Boot interceptor that captures the requests and publish the events to DAS.
Your interceptor would look pretty similar to this HTTPMonitoringInterceptor.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "wso2, wso2 das"
}
|
How do you do signal averaging on a realtime data?
Smoothing algorithms implemented by me
1. Exponential smoothing - <
2. Moving Mean - <
For example - a1+a2+a3+a4+... aN = A/N ..... is an average of all the a's which isn't same as ---> (((a/1+a2)/2 + a3)/3 +a4)/2 .... so on...
can anyone explain me how wrong I am or explain me signal averaging correctly?
|
@Greyfrog. Here are the descriptions of four different kinds of averaging operations:
. We are getting errors when it’s attempting read app.config when it’s on the web side. Is there a way for the class to tell if it needs to read web.config or app.config? My first thought was to put it in a try catch block but I am wondering if there is a more elegant way Thanks
|
You can create the web.config and the app.config. The settings manager will get the right one for your each scenario.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net, vb.net, winforms"
}
|
Get Path and Query from URI::Generic object
I'm trying to understand the `URI::Generic` object. But I can't find how to pull out the path and the query into one united string in the API.
If I have this object:
#<URI::Generic /api/trading/model/123456789?api_key=12345>
How can I return this:
"/api/trading/model/123456789?api_key=12345"
Seems like I should be able to call some instance method on but I can't seem to find anything on the `URI` api. Can anyone help with this?
* * *
**Usage:**
def get(path, params)
uri = URI(path)
if params.any?
uri.query = URI.encode_www_form(params)
end
# PASS SRTRING INTO REQUEST
request = Net::HTTP::Get.new(uri)
execute_request(request)
end
|
You're looking for the `#to_s` method:
(irb)> uri
#<URI::Generic /api/trading/model/123456789?api_key=12345>
(irb)> uri.to_s
"/api/trading/model/123456789?api_key=12345"
* * *
Remember, everything is an Object in ruby and you can always call `#methods` on everything to get a list of all the exported functions of that object.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "ruby, uri"
}
|
Remove enclosing double brackets from CSV when importing to postgres
I have a CSV with 3 columns ; text, integer, text. When i import these all the data is enclosed in double brackets. I'm not sure why. Is there away to remove these on import using COPY? Or should i import as text and then remove them using `select replace` ?
Edit; Code for copy
`copy tavle from 'file.csv' with delimiter ',' CSV encoding 'windows-1251'`
Sample of raw csv data;
"TY373543","4510069420","A"
"ND4368","4510093370","A"
"TY152401","4510093370","A"
"TY384054","4510069421","A"
|
If your target table and csv file have the same structure, I fail to see how it is possible. Follow this example:
Considering the following CSV file ...
x, y, z
"TY373543","4510069420","A"
"ND4368","4510093370","A"
"TY152401","4510093370","A"
"TY384054","4510069421","A"
and the following table structure ...
CREATE TABLE t (a text, b bigint, c text);
Just execute this command:
COPY t FROM '/tmp/file.csv' CSV HEADER;
And here is your data:
SELECT * FROM t;
a | b | c
----------+------------+---
TY373543 | 4510069420 | A
ND4368 | 4510093370 | A
TY152401 | 4510093370 | A
TY384054 | 4510069421 | A
(4 Zeilen)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "postgresql, csv"
}
|
A question about Gauss Bonnet theorem
If $S$ is a surface which is the complement of finitely many points in a compact surface, and the metric in $S$ is complete, then is Gauss-Bonnet theorem still valid for $S$?
|
Sort of.
<
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 2,
"tags": "differential geometry"
}
|
Can a supine verb have arguments?
Consider the following line from the _Aeneid_ , Book VI:
> nec credere quivi hunc tantum tibi me discessu ferre dolorem.
Context: Aeneas has traveled into the underworld, and bumps into Dido, who he infers has committed suicide because of his departure.
My best literal translation is: "I couldn't believe this, my leaving, to bring unto you such pain," because I think that **me discessu** (for me to leave) stands in apposition with **hunc**. But I'm not sure whether supine verbs can have a subject argument.
So, generally, can an ablative clause formed from a supine verb have nouns corresponding to the base verb's subject or object?
|
Looking at it, I don't think _me_ is ablative; it's more likely an accusative as the subject of an indirect statement with _credere_. _Discessu_ here is not a supine, but a fourth-declension noun, _discessus_.
The translated line should actually be:
> Nor did I believe that I in my departure would ever have caused you so much pain.
(Apologies for the tenses.)
All the grammars are clear that the ablative supine does not take an object of any kind. The _hunc_ then probably goes with _tantum dolorem_ in a way that can't be literally translated into English without extra words.
Addendum:
I checked two nineteenth-century interlinears to see if they could shed light on it. Hart/Osborn's is very nearly the same as mine, while Dewey's differs only in the translation of _hunc_.
|
stackexchange-latin
|
{
"answer_score": 8,
"question_score": 11,
"tags": "classical latin, verbs, vergilius, aeneis, supinum"
}
|
Making a JS formula from slider outputs
I'm sure this is possible with JavaScript, but I couldn't find exactly what I'm looking for by searching and my scripting skills are very poor.
I have 3 sliders on a page, which output their value to 3 separate divs (with ids cost, length, income). I would like to have a formula that takes the content of each div and gives a final result, e.g. `result = (income-cost)*length` in a separate div. Ideally, the result would update as each individual slider moved, but maybe a 'calculate' button would be easier?
Here is a link to the page in question
|
consider you have three divs as such as below. Check the code
<div id="cost"></div>
<div id="income"></div>
<div id="length"></div>
<div id="total"></div>
<script>
var cost=document.getElementById('cost').innerHTML;
var income=document.getElementById('income').innerHTML;
var length=document.getElementById('length').innerHTML;
var total=(Number(income)-Number(cost))*(Number(length));
//This would give you the total value
document.getElementById('total').innerText=total;//To insert the element into div
</sctipt>
Please check the fiddle link <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, slider, formula"
}
|
What to name the table in which I list ways to login?
I need to audit in the database how the user logged in. I'm going to create a lookup table (which will be referenced from the audit table). For example:
ID Description
---------------
1 Password
2 Smartcard
3 Biotrickery
I was going to name this table "LoginTypes", but that seems muddy, because I'm dependent on the object's assumed use when naming it?
Next came "CredentialTypes", but I'm thinking there's a better term?
Admittedly, "Login" (as a noun) certainly seems synonymous with "Credential" in this context, so maybe my original name idea is good enough?
What should I name this table?
|
I would call it `AuthenticationMethod` (put an s at the end if you like tables with plural names).
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "database design, naming conventions"
}
|
Where should I put a overview option in a feed control
I have a newsfeed that is filtered by the current page it is placed in. This newsfeed needs an navigation option to access the overview page.
Here's the basic control: , but from a ux view the first is superior since it's
* faster accessible
* always at the same position
* can not be mistaken for the "LOAD MORE" functionality
I'm currently deciding if I should try to convince the client or just leave it be (in the end the client always gets what he wants (or deserves..).
Can you think of better solutions or some minor or major disadvantages I am overlooking?
|
In general, I would suggest you avoid the color red for the "load more" button, because thanks to common design patterns, the users have learned to understand red buttons with destructive actions like deleting, uninstalling, etc.
If you must go with your second approach, please keep in mind that buttons are meant for actions. So it makes sense for "load more", but not for "feedoverview". Maybe you'd rename it into "show overview". You can also add different colors and/or icons to both buttons to provide the users a better possibility to distinguish them.
But I would highly suggest you to work on your first approach. Rename it into "show overview", make it a button and play with the position. Maybe align it to the right edge of the headline, like WordPress is doing it into their backend. Maybe you'd implement a "auto-load-more" function in the future, so the overview button on the bottom would never be visible.
|
stackexchange-ux
|
{
"answer_score": 0,
"question_score": 0,
"tags": "gui design, buttons, design patterns, accessibility"
}
|
In clustering, sequence number such as customer ID and dates such as purchase date should be dropped?
I am learning K-means clustering and found that in most datasets, there are sequence number such as customer ID and dates such as purchase date. I don't see any use in them for clustering. Should I include them for clustering or can simply ignore them? Let's say other attributes are like purchase amount and number of purchases and etc.
|
I think you should drop the customer ID since it's a unique identifier and won't give you any additional value. Instead, I would be rather cautious with the date. The date can be split into year, month and day. Depending on the analysis you are doing, it might be interesting to have K-means running also with those features. For instance, suppose that you want to check whether you have some blobs of data in a specific period of the year, you should use the month feature.
|
stackexchange-datascience
|
{
"answer_score": 0,
"question_score": 0,
"tags": "clustering, k means"
}
|
Why aren't public IP addresses always displayed with their subnet mask?
I've been told that a public ip address without its corresponding subnet mask is meaningless, because one couldn't know how to split the network id from the host id, which makes total sense to me.
However, most of the time I see ip addresses (DNS, findmyip.com etc.) it's only about ip without the cidr number. For example, I just fed a website just an ip address and it gave me back the right domain name.
What am I missing ? I'm guessing there are some other protocols that can only work with ip addresses but I haven't heard of those yet.
If my question reveals a lack of basic understanding of how networks work, ressources are much appreciates. I'm a developper teaching myself all of this stuff, and except 5-min-long tutorials or 1000+ obscure books (Hi TCP Illustrated), I can't find the material i'm looking for.
|
Both the above answers are correct - here is a more detailed non technical one-
A computer only needs to know if an IP address belongs to a computer which connects directly to it - and computers going through a hub/switch/wifi in the same "lan") are considered directly connected.
For anything else, the computer only needs to know where to send the packet to next - ie the address of the router (which in turn knows where to send packets next). When you do a traceroute you are seeing this path.
The subnet mask is used to group machines which are directly connected - so for machines which are not directly connected a subnet mask is not required to reach them.
Notably a subnet mask can also be used by a firewall or other software to specify a group of IP addresses to be treated the same way - which is why they are sometimes relevant outside a LAN - but not necessary for generally communicating on the Internet.
|
stackexchange-superuser
|
{
"answer_score": 3,
"question_score": 3,
"tags": "networking, ip, ip address, subnet, netmask"
}
|
Bootstrap modal - close modal when "call to action" button is clicked
I have a external link inside my modal, and I want the modal to hide after the user has clicked on the link. How do I do that?
Here is my code:
<div class="modal hide fade" id="modalwindow">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Title</h3>
</div>
<div class="modal-body">
<p>You need to do a search on google.com for that.</p>
</div>
<div class="modal-footer">
<a id="closemodal" href=" class="btn btn-primary" target="_blank">Launch google.com</a>
</div>
</div>
<script type="text/javascript">
$('#closemodal').modal('hide');
</script>
|
You need to bind the modal hide call to the `onclick` event.
Assuming you are using jQuery you can do that with:
$('#closemodal').click(function() {
$('#modalwindow').modal('hide');
});
Also make sure the click event is bound after the document has finished loading:
$(function() {
// Place the above code inside this block
});
enter code here
|
stackexchange-stackoverflow
|
{
"answer_score": 127,
"question_score": 63,
"tags": "javascript, twitter bootstrap"
}
|
open exe in hidden mode in vc++
I want to run an .exe file in hidden mode using vc++ in VS2010.
I have tried this code
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Process^ p = Process::Start("Ai.exe");
IntPtr calculatorWindowHandle = p->MainWindowHandle;
void *calculatorWindowHandle1 = calculatorWindowHandle.ToPointer();
HWND pHandle = reinterpret_cast<HWND>(calculatorWindowHandle1);
ShowWindow(pHandle, SW_HIDE);
}
But it is opening the EXE but not in hidden mode.
Can anybody please tell me how it can be done.
Thanks in Advance
|
Yes I found the solution.
I just require to use
Sleep(60);
After
Process^ p = Process::Start("Ai.exe");
because starting a process takes some milliseconds.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "winforms, visual studio 2010, visual c++, exe"
}
|
jQuery validate number that does NOT begins with 0 or 1
A quick one.
I use jQuery validate, and need to validate a phonenumber that can't begin with 0 or 1.
A similar question has been posted in jQuery custom validation: phone number starting with 6, but where it SHOULD start with 6. I've tried to modify it to fit my needs - but without any luck.
phone_nr: {
maxlength: 8,
minlength: 8,
number: true
}
Thank you in advance
|
Using a custom function like the answers to the other question, but with a regular expression matching every digit apart from 0 or 1, e.g.:
phone_number.match(/^[2-9]\d+$/
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "jquery, jquery validate"
}
|
Delete an ObjectId from an Array - MongoDB, Mongoose
I am trying to delete a 'category' document and it's ObjectId that is in an array inside the 'menu' Schema. The 'menu' Schema looks like this :
categories: [
{
type: ObjectId,
ref: "Category",
},
it holds the ObjectId i am trying to delete
This is the nodejs code from the controller I try to run :
const deletedCat = await Category.findByIdAndRemove(catId, function (err) {
if (err) console.error(err)
})
const updateMenu = await Menu.findOneAndUpdate(
{ _id: menuId },
{ $pull: { categories: { _id: new ObjectId(catId) } } },
{ new: true }
)
the $pull doesn't change the DB and the ObjectId is still in the Array.
I also tried without the " new ObjectId "
What am I doing wrong ?
|
Ok, so i just got it to work. The answer is simple, just use the ObjectId as a value of the key in the Array (name of the array)
const updateMenu = await Menu.findOneAndUpdate(
{ _id: menuId },
{ $pull: { categories: ObjectId(catId) } },
{ new: true }
)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "javascript, node.js, mongodb, mongoose, mongodb query"
}
|
Text suggestion, word flow not working
Neither text suggestion nor Word Flow is working on my Nokia Lumia 920. I just got my phone updated with Lumia Cyan.
How can I get those features to work?
|
Word Flow and text suggestions aren't available with all languages. To see if your current language is supported, see Windows Phone feature and service availability.
If your language is in the list, go to Settings -> Keyboard, tap on your language and make sure that the "Suggest text" and "Type as I flick through letters" options are enabled.
For more information on using the on-screen keyboard, see Windows Phone typing shortcuts.
|
stackexchange-windowsphone
|
{
"answer_score": 7,
"question_score": 5,
"tags": "8.1, nokia lumia 920, keyboard, wordflow, lumia cyan update"
}
|
PL/SQL select into - if data exists
I need to select into a local variable only if there exists data.
SELECT column1 INTO local_variable FROM table1 where column2 = <condition>;
Here if there is no data matching the condition I get a no data found error.
I need to select into the local variable only if there is some data matching the condition. Is there a simple query that will solve my problem.
|
Probably the best way is to handle no_data_found
begin
SELECT column1 INTO local_variable
FROM table1 where column2 = p_val;
exception
when no_data_found then
local_variable := null;
end;
Also, if you are selecting with primary key /unique key (that is column2 is unique) then there is a trick you can do
SELECT max(column1) INTO local_variable
FROM table1 where column2 = p_val;
|
stackexchange-stackoverflow
|
{
"answer_score": 15,
"question_score": 9,
"tags": "plsql"
}
|
Real-time clock and Crystal precision
I want to use a crystal as the base clock for a watch. Most reference designs I could find use a 32.768 kHz crystal at 20 ppm (parts per million) precision. According to my calculations, this leads to an error of max 52 seconds in a month. After 6 months, that 5 minutes. I would like something better!
There are some solutions I could think of (better crystal, or compensate in SW), but I am surprised not to find any reference online.
Surely I am not the first person to try and address this problem. Do you have any suggestion as to how to deal with this, and possibly reference design?
|
A better crystal is one way to solve it, but it's going to cost. And even then you get maybe 10ppm, good (or bad) for 5 minutes after 1 year.
**Temperature compensated crystals** are good to get a predictable stability, but they don't solve the tolerance problem; if you have a 20ppm deviation from nominal frequency, you're sure you'll always have this deviation. BTW, this is also more expensive, and I haven't seen it for 32kHz crystals.
**Software compensation** is a cheap solution, and I've used it a few times. For production runs you'll have to measure the frequency and program the compensation value on a test jig.
You can also use a **trimmer capacitor** for the oscillator's load capacitor.
What I find the nicest solution, however, is to add an **atomic clock receiver** module (WWVB for North-America, DCF77 for Europe), and resync once a day or so. The picture shows an miniature DCF77 module from Conrad.
!enter image description here
|
stackexchange-electronics
|
{
"answer_score": 11,
"question_score": 6,
"tags": "clock, crystal"
}
|
Is my .img file corrupted?
I downloaded the firmware (.img) of my Android device (Boyue T62D) just to have a backup of it. I'm in the Indian countryside with an extremely limited internet connection, so this is a huge file for me. The reasons I'm unsure are:
1. I can't extract the file (just to look at the contents) in any way on my computer (OS X 10.10.1). Is this to be expected with an Android image? I tried to unpack it using a variety of methods (like converting it to iso first). (none too fancy though).
2. I was out of the house when the file was downloading, and when I came back it looked like the file was done, but the Internet connection was broken. But the file seems to have the same size as it is supposed to have. So what got me wondering was the fact that I can't unpack it. If you guys could just tell me that this is standard, and that .img files are very hard/impossible to extract on OS X, that would be great.
|
Usually when downloading files (very likely for software) you have a checksum provided by the supplier. The checksum is nothing else but the hash value of the file you're going to download. Quite often this is MD5, but due to the collision potential in MD5 it starts to drift towards SHA (SHA1 mostly, somtimes SHA2).
After your download has finished, you compute the hash on the file yourself and compare the value with the one presented by the download page (or other source). If the two values match, this means that your download equals the file supplied on the website.
I started my VM for accessing such sites and had a look if there is a MD5 hash present. Right next to the download link, it was and that's the value I have copied to my comment. Therefore, if you follow the procedure I have written down above and look for such a hash value (check for MD5 or MD5SUM, SHA1 or SHA1SUM) you don't need any third-party assistance.
|
stackexchange-android
|
{
"answer_score": 0,
"question_score": 0,
"tags": "device firmware"
}
|
Why am I getting this bundler error in an existing project that uses Heroku?
This error happens during just about any rake task:
project/Gemfile:4:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x007f8274ba6ac8> (NoMethodError)
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/dsl.rb:7:in `instance_eval'
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/dsl.rb:7:in `evaluate'
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/definition.rb:18:in `build'
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler.rb:135:in `definition'
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/cli.rb:220:in `install'
~/.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/vendor/thor/task.rb:22:in `run'
.rvm/gems/ruby-1.9.3-p0-perf/gems/bundler-1.1.4/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
**Gemfile:4**
ruby '1.9.3'
|
This line is required for running multiple versions of ruby on Heroku, but currently requires a prerelease version of bundler to work locally.
gem install bundler --pre
See <
|
stackexchange-stackoverflow
|
{
"answer_score": 15,
"question_score": 7,
"tags": "ruby on rails, heroku, bundler"
}
|
Eyes keep going outside of head
I can't figure this out for the life of me. I can't. The bones are parented correctly, the weight paint is correct. So why does this keep happening!?
Everytime I move the head , the eyes start going outside of it. I don't know why.
>0$ and $g''(x)>0$ for all $x$. I can't think of an example where the composition of 2 such functions doesn't give a concave upward function. What am I missing?
|
Observe that $$(f\circ g)''(x)=f''(g(x))(g'(x))^2+f'(g(x))g''(x).$$ Thus, if $f'(x)>0$ for all $x$, then $(g\circ f)''(x)>0$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 2,
"tags": "calculus"
}
|
Comparator sorting on a double attribute fails to satisfy its general contract
My class implements `Comparator<ClassName>` .
My requirement is to sort the `ArrayList<Hw4b> myList;` in the descending order of a double type field called `rNumber`. I am Invoking `Collections.sort(myList,this);`
I always get
> Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(TimSort.java:899)
Here is my code.
@Override
public int compare(Hw4b o1, Hw4b o2) {
double r1 = o1.rNumber;
double r2 = o2.rNumber;
if(r2 > r1)
return 1;
else if(r2 < r1)
return -1;
else
return 0;
}
I am using Java 8
|
one solution to accomplishing your task using some of the java-8 features.
ArrayList <Hw4b> myList = new ArrayList<>();
Collections.sort(myList, Comparator.comparingDouble(Hw4b::getrNumber).reversed());
this should sort it in descending order by the `rNumber`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "java, sorting, arraylist, collections, comparator"
}
|
mysql how to get the last inserted row values in a trigger
I am writing a trigger after insert event on a table. This is the table
CREATE TABLE `orderitem` (
`orderItemId` INT(11) NOT NULL AUTO_INCREMENT,
`orderItemQuantity` INT(11) NULL DEFAULT NULL,
`stockId` INT(11) NULL DEFAULT NULL,
`rate` DOUBLE NULL DEFAULT NULL,
`orderId` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`orderItemId`)
)
Inside the trigger I need the values inserted for the current row(not only the id) inside the trigger. In T-SQL we can use the inserted table but in MySQL I could not find anything like that. How can I get those values? Thanks in advance.
|
You could use OLD. or NEW. since this trigger is fired after the insert both values are the same. You can access all properties of the interred row (if it is a row level trigger) by using:
NEW.orderItemID
NEW.rate
etc.
|
stackexchange-stackoverflow
|
{
"answer_score": 13,
"question_score": 5,
"tags": "mysql, sql, triggers"
}
|
changing specific area from character to numeric in R programming
I use Rstudio and imported a csv file from online.
data <- read.csv(" stringsAsFactors = FALSE)
In the file, column X.3 is of type character.
I want to convert row (5 to 202) from character to numeric so that I can calculate mean of it.
So, when I use this line below. It still remains as character
data[c(5:202),"X.3"] <- as.numeric(gsub(",","",data[c(5:202),"X.3"]))
when i type `class(data[10,"X.3"])` it shows the output as `character`
I am able to convert the whole column to numeric using
data[,"X.3"] <- as.numeric(gsub(",","",data[,"X.3"]))
but i want to convert only specific row's ie from 5 to 202 beacause the other rows of the column becomes `N/A`. i am not sure how to do it.
|
Following changes to your code can help you make it numeric:
data <- read.csv(" header = T, stringsAsFactors = FALSE, skip = 3)
# skipping first 3 rows which is just empty space/junk and defining the one as header
data <- data[-1,]
#removing the first line after the header
data$US.dollars. <- as.numeric(gsub(',','',data$US.dollars.))
#replacing scientific comma with blank to convert the character to numeric
hist(data$US.dollars.) #sample plot
As mentioned in the comment, you cannot keep part of your column as character and part numeric because R doesn't allow that and it forces type conversion to a higher order in this case numeric to character. You can read here more about Implicit Coercion of R
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "r, dataframe, rstudio"
}
|
How do I build an incinerator that doesn't burn down my house?
Usually I have trouble acquiring items, but in 1.11 with a mending fishing rod I'm starting to have a problem I've never had before... too much junk.
So I built a simple incinerator, consisting of a single lava block hidden in my stone floor, with a dropper immediately above it to hide it. This was inset in the wall, and had a button to activate. A little tedious collecting all 80 saddles and 2000 boots (I exaggerate only slightly), put them in, and soon things are back to normal.
That is, until the spontaneous fires occurred. I don't use very many flammable blocks, so it was more shocking than harming, but I wasn't aware that air blocks above lava can catch fire spontaneously even if covered.
How deep do I have to put the lava so that the stone floor doesn't burst into flames? I've got at least 5 or 6 depth that I can use for this.
|
According to the Minecraft Wiki:
> A fire block can turn any air block that is adjacent to a flammable block into a fire block. This can happen at a distance of up to one block downwards, one block sideways (including diagonals), and four blocks upwards of the original fire block.
So anything 4 blocks underground should be fine.
Also, from plenty of experience in the game, I can assure you that only blocks marked as flammable will ignite. To check this, search for the block on the Minecraft Wiki and look for the flammable tag in the block info.
|
stackexchange-gaming
|
{
"answer_score": 2,
"question_score": 1,
"tags": "minecraft java edition"
}
|
Can I use javascript to change the language?
I have a textbox that I want to the user to write something in it. I want that the default language there would be english. so if he pressed alt-shift before he came to my page and he is now on other language - when he'll come to my textbox it would change his language to english. Is it possible with javascript? how?
|
I'm not sure what you mean by "pressing Alt-Shift". Are you referring to the keyboard layout switching hotkey in recent versions of MS Windows?
If yes, then the answer is "no". The layout switching is performed by the operating system and not accessible from Javascript. Which is a good thing, BTW. You would not want a webpage (or even a local application) to switch around your keyboard layout.
Incidentally, I do not understand why you would want to change the layout. If the user is comfortable with, say, a German or French layout, how does it help to change the layout?
Maybe you could elaborate on your problem. What are you trying to solve?
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "javascript, html"
}
|
saving tables (e.g. latex) from Bayesian estimation functions in R
I would like to save the results of a Bayesian estimation function (e.g. `brm`) to file (e.g. in Latex format), for sharing results and preparing publications. It appears that existing packages (e.g. `xtable`, `stargazer`) are designed with non-Bayesian statistics in mind and cannot handle these model objects. Are there any existing packages or available code to handle this task (before I begin to recreate the wheel)? I have found tools for making tables from models estimated using JAGS/BUGS here but brm uses stan to estimate models.
|
If you call `launch_shinystan` on the object and go to the `Estimate` tab, there is a link to `Generate LaTeX table` that gives you a bunch of options to check on the left and it outputs the syntax on the right.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "r, bayesian, stan"
}
|
Use of Nullable Type in method gives error
I have created a property within a class that is a nullable integer:
private int? submittedAge {get; set;}
I am doing this as the user may or may not enter an age. Later in the application I do a check before making use of this property, and if it is NOT null, I pass it along to a method that requires an integer.
if (this.submittedAge != null)
{
result = utilityClass.GetPeopleWithMatchingAge(this.submittedAge);
}
Intellisense gives me an error saying the method call has some invalid arguments.
If I change the `submittedAge` property back to a non-Nullable integer then all is well.
Perhaps I am not understanding the proper use of a nullable type.
|
It seems your method takes an `int` not `int?`, you need to change your parameter type or add an overload.
Or you can just pass the value using `.Value` property:
result = utilityClass.GetPeopleWithMatchingAge(this.submittedAge.Value);
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 2,
"tags": "c#, nullable"
}
|
Facebook Graph Request Limit
Is there any limit on Facebook graph queries done without access token from server side?
My webapp triggers a graph call like this `graph.facebook.com/userId` that doesn't require any access token. This call is triggered any time a user vote an image on my FB app.
On Facebook website they declare a maximum of (>5M MAU) or (>100M API calls per day) or (>50M impressions per day) which it is quite a lot, unless someone is trying to hack the voting mechanism.
Marco
|
Although the access to end point like `graph.facebook.com/userid` doesn't requires any access token as of now but may require the same in future as Facebook APIs are changing constantly.
So it is best advised to access these end points with valid access token, also sometimes you may also face problems in retrieving data from same `graph.facebook.com/userid` end point for some different `userid`. So use some type of access token to retrieve data from these end points.
As such there is no defined limit on the data retrieved without access token on the end points, and for data retrieved from end point with access token it is maximum of (>5M MAU) or (>100M API calls per day) or (>50M impressions per day).
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "facebook, facebook graph api"
}
|
I can't authenticate to remote host with password using 2FA
I have a Ubuntu 20.04 VM running as a jump box for the rest of my servers. I have connected it with a DDNS service to access it remotely. If I use ssh keys I can log in to the server normally, but if I use password authentication with 2FA (Google's pam 2fa module) I get "Authentication failed",
What can I do in order to fix that problem?
I have tried from different computers and OSes but the problem is from the machine itself. Google doesn't seem to help.
Thanks in advance.
|
I found the problem, at the /etc/pam.d.sshd i had set the `auth required pam_google_authenticator.so` with the extra option `nullok`, after removing this I was able to ssh to the machine using the password and the 2fa generated codes.
|
stackexchange-askubuntu
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ssh, 20.04"
}
|
I uninstalled GnuPG. Can I delete the ~/.gpg folder?
I uninstalled GnuPG to re-instal it without Mail. I had to delete it rather than work out if there is a way to stop it from trying to sign my email as I had to send the email quickly! I now am going to install GPG Suit again and customise the email out of it but I want to know what happens with the current ~/.gpg folder. Do I delete it myself and a new one will be built when the program is installed or do things just get mashed on top without any adverse affect? Thank you.
|
Be sure you don't have keys stored in the .gpg folder that aren't saved elsewhere, and you will be fine deleting the folder.
|
stackexchange-security
|
{
"answer_score": 0,
"question_score": 3,
"tags": "gnupg"
}
|
iOS 7 style calendar library for the whole year view feature
I like iOS 7's new Calendar app, especially its "bird view" of every day in a whole year. I would like to include this feature in my app. Is there a library that already has implemented this calendar year view feature, or it's something I need to implement myself?
|
I think that this is the closest to your needs: <
But you can browse for more here:
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "ios, iphone"
}
|
How do I show an open file in eclipse Package Explorer?
When a file (.java for example) is open in Eclipse, how do I get the Package Explorer to show the file that I am working on?
|
There is a button in the Package Explorer view that looks like two yellow arrows pointed at left and right. The tooltip is "Link with Editor". Click that.
|
stackexchange-stackoverflow
|
{
"answer_score": 446,
"question_score": 196,
"tags": "eclipse"
}
|
Groupby one column and forward replace values in multiple columns based on condition using Pandas
Given a dataframe as follows:
id city district year price
0 1 bj cy 2018 8
1 1 bj cy 2019 6
2 1 xd dt 2020 7
3 2 sh hp 2018 4
4 2 sh hp 2019 3
5 2 sh pd 2020 5
Say there are typo errors in columns `city` and `district` for rows in the `year` columns which is `2020`, so I want groupby `id` and `ffill` those columns with previous values.
How could I do that in Pandas? Thanks a lot.
The desired output will like this:
id city district year price
0 1 bj cy 2018 8
1 1 bj cy 2019 6
2 1 bj cy 2020 7
3 2 sh hp 2018 4
4 2 sh hp 2019 3
5 2 sh hp 2020 5
|
The following code works, but I'm not sure if it's the best solutions.
If you have others, welcome to share. Thanks.
df.loc[df['year'].isin(['2020']), ['city', 'district']] = np.nan
df[['city', 'district']] = df[['city', 'district']].fillna(df.groupby('id')[['city', 'district']].ffill())
Out:
id city district year price
0 1 bj cy 2018 8
1 1 bj cy 2019 6
2 1 bj cy 2020 7
3 2 sh hp 2018 4
4 2 sh hp 2019 3
5 2 sh hp 2020 5
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "python 3.x, pandas, dataframe"
}
|
Redux - how to keep the reducer state during hot reload
I use _React_ \+ _Redux_ \+ _Webpack_ \+ _WebpackDevserver_. Once the hot loader is launched all my reducers are reseted to the initial state.
Can I keep somehow my reducers in the actual state?
My Webpack config contains:
entry: [
"./index.jsx"
],
output: {
filename: "./bundle.js"
},
module: {
loaders: [
{
test: /\.js|\.jsx$/,
exclude: /node_modules/,
loaders: ["react-hot","babel-loader"],
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
My reducers stats with:
const initialState = {
...
}
export default function config(state = initialState, action) { ...
I start my Webpack Dev-Server just by:
"start": "webpack-dev-server",
|
Assuming Babel 6, you need to do something along this:
import {createStore} from 'redux';
import rootReducer from '../reducers';
export default function configureStore(initialState) {
const store = createStore(rootReducer, initialState);
if(module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers/index').default;
store.replaceReducer(nextReducer);
});
}
return store;
}
You can see the approach in action at my redux demo.
|
stackexchange-stackoverflow
|
{
"answer_score": 21,
"question_score": 25,
"tags": "webpack, redux, webpack dev server, react hot loader"
}
|
Want to set cursor position in Spark textinput control in Flex
I use Flex 4.5. I want to set cursor position based on integer variable. For example if my variable value is 5 then cursor in textbox will point to position 5. So there is any way to achieve this??
Thanks in Advance.
|
textInput.setFocus();
textInput.selectRange(caretPosition, caretPosition);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "actionscript 3, apache flex, actionscript, flex4"
}
|
Multivariable Calculus Integration
I'm refreshing myself with multivariate calculus and I came across this problem:
Calculate the area of the region bounded by $\sqrt x + \sqrt y = \sqrt a$ and $\ x + \ y = \ a$.
I was just wondering how to find the limits of integration given this information.
|
Set the equations up to each other to find their points of contact.
$\sqrt x + \sqrt y = \sqrt a$
Squaring both sides...
$x+2\sqrt{xy}+y=a$
$x+2\sqrt{xy}+y=x^2+y^2$
Set the integrals up from the two equations' $x$ (coordinate)point(s) of contact.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "integration, multivariable calculus"
}
|
Viber won't start in Ubuntu 15.10 due to missing shared libraries libgstreamer-0.10.so.0 How to fix this?
Viber won't start anymore. This is the message I get:
error while loading shared libraries: libgstreamer-0.10.so.0: cannot open shared object file: No such file or directory
How to fix this? Thanks
|
Install the missing library:
sudo apt-get install libgstreamer0.10-0
That should install the libgstreamer-0.10.so.0 library.
|
stackexchange-askubuntu
|
{
"answer_score": 1,
"question_score": 3,
"tags": "software installation, 15.10, viber"
}
|
C# Windows Form App get sales data/transaction details from Paypal using C# SDK?
I currently have a Windows Form App (C#) used to generate tickets for an charity exhibition, currently I have to enter the transaction details in manually (e.g name, number of each ticket sold) and I'm looking for a way to get the transaction data out of paypal pragmatically.
I'm not really a developer (IT technician would be a more apt description), I've got as far as downloading the c# SDK and I think the trasnsactionsearch method may be what I'm looking for, but reading the documentation I really don't understand or have a clue how to get this to work. All I'm really looking to do is connect to paypal and grab the number of each ticket sold and the name of the purchaser so I Can put them in my MySQL database, any help or examples of how to do this would be great!
|
An intermediate solution would be to go to the History tab and download a date range or full transaction history in CSV format and then import that through your program. (or even from a generic MySQL console or client if you structure your tables appropriately). This is probably more the "IT technician" way of doing things, vis a vis implementing the TransactionSearch method.
A going-forward solution might be to implement an Instant Payment Notification (IPN) listener that loads transactions into your database one-by-one the moment they come in. IPN scripts aren't hard to do and there's plenty of resources out there.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c#, winforms, paypal"
}
|
Trailhead : Build an IOT integration with Electric Imp
Trying to complete this project but can't seem to access the link to buy the electric imp developer kit.
This is the link provided on the trail:
<
It returns a 404 error.
Does anyone have a work around or any other resource where we can purchase this from?
|
Here is the correct link: <
Here is the latest Trailhead Project for Salesforce that works with Salesforce EMP (Platform Events): <
|
stackexchange-salesforce
|
{
"answer_score": 1,
"question_score": 0,
"tags": "trailhead, iot"
}
|
how can i mantain a specific proportion while resizing a window?
I made a game on python with a fullscreen button, how can I allow window resize when not fullscreen without changing the width/height proportions? Also how can I set the proportions to avoid problems if someone put fullscreen in a monitor with proportions different from 16/9?
|
You can't. The screen resolution depends on the hardware. Not every hardware supports every resolution. You have to write an application that can handle different display resolutions. e.g.: Scale Everything On Pygame Display Surface.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "python, pygame"
}
|
Simple python and need explanation
m = 0
for x in range (4,6):
for y in range (2,4):
m = m + x + y
print (m)
ANSWER: 28
not sure how this is? Excluding the last number in the range, I thought it should be 14. I add it up on paper and cannot understand what I am doing wrong.
|
That loop is equivalent to:
m = 4+2 + 4+3 + 5+2 + 5+3
And, that sum is 28.
(In the outer loop, `x` takes on the values `4` and `5`. In the inner loop, `y` takes on values `2` and `3`.)
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "python 3.x"
}
|
Add comma in all rows of a column in DF except last row in pandas python
I have a csv file which contains a column 'Account'. I want to add ',' in the end of each row in the column 'Account' except the last column. My desired output looks something like this:
AccountId AccountId
123456 123456,
436358 436358,
747379 747379,
654697 654697,
649470 649470
In the output the comma is not added in the last row. The code which I have written applies comma in all the row including the last one. My code look like this:
temp = pd.read_csv('E:\2021-01-31.csv' , usecols=['AccountId'])
temp['AccountId'] = temp['AccountId'].apply(lambda x: "{:},".format(x))
|
You can apply the format to a slice of the dataframe
temp['AccountId'][:-1] = temp['AccountId'][:-1].apply(lambda x: "{:},".format(x))
print(temp['AccountId'])
Output
0 123456,
1 436358,
2 747379,
3 654697,
4 649470
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "python, pandas"
}
|
CGPointMake in swift or CGPoint
I want to move an UIImageView, I already did this in Objective-C and it completely worked. This was the code:
tank.center = CGPointMake(tank.center.x + TankX, tank.center.y + TankY);
`TankX` is set in viewDidLoad to 2 and `TankY` is set to 0. So the tank moves to the right. But when i want to do this in Swift it doesn't work. Swift code:
tank.center = CGPointMake(tank.center.x + TankX, tank.center.y + TankY)
I also tried CGPoint but I also can't get it working. I already saw this question: CGPointMake in Swift but I couldn't manage to use it.
Does anyone have an idea how to do this?
Edit: Error: Could not find an overload for '+' that accepts the supplied arguments
|
I'd try this:
tank.center = CGPoint(x: tank.center.x + CGFloat(TankX), y: tank.center.y + CGFloat(TankY))
It converts TankX and TankY to CGFloats so they can be added to other CGFloats.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "swift"
}
|
Find all continuous functions that satisfy the Jensen inequality(?) $f(\frac{x+y}{2})=\frac{f(x)+f(y)}{2}$
Find all continuous functions that satisfy the Jensen inequality(I don't know why the problems states ''inequality'') $$f(\frac{x+y}{2})=\frac{f(x)+f(y)}{2}$$
I've checked around stackexchange and google a bit, but none of the questions related to this problem gave me any hints on what I should do. The expression ''find all continuous functions'' confuses me. Am I supposed to determine some kind of a property that applies to all continuous functions that satisfy the property above or? Likewise there is a problem asking to find all continuous functions that satisfy$$f(x+y)=f(x)+f(y)$$ I'm sorry if this is a duplicate question, but even after reading all of those answers I've failed to find an adequate one. Also, another problem is that I'm not allowed to use derivations, and hence anything more complex than that.
|
The first question is actually similar to the second question $$f\left(\frac{x+y}{2} \right)=\frac{f(x)+f(y)}{2}$$ Then we set $f(x)-f(0)=g(x)$. Note that $g(x)$ is also a solution to the functional equation. Now, let $x=2a, y=0$. Then notice $$2g(a)=g(2a) \implies g(a)=2g\left(\frac{a}{2}\right)$$ So $$g(x)+g(y)=2g\left(\frac{x+y}{2} \right)=g(x+y)$$ So the solutions to the first question are functions that satisfy the second question, plus some arbitrary constant $c$.
The second question is called the Cauchy Functional Equation, answered here.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 2,
"tags": "continuity, functional equations"
}
|
Changing values to NaN pandas
I have a IMDB data frame that looks like that : IMDB data frame
I want to change all ratings and metascore with below 100,000 votes to `NaN`. Here is my attempt :
df[(df['votes']<100000)].loc[:, ['rating', 'metascore']] = np.nan
I'll be happy to get some help here. Thanks!!
|
Your code seems OK. You might check though if you have missing values in columns `votes`, `metascore` and `ratings`. I see all these columns are `float`. If you have mising values in `votes` you might have a problem so you should try to make :
df['votes'] = df['votes'].fillna(0.0)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, pandas"
}
|
Commit changes to new repository
I cloned one open source project. Now, since I would like to backup that and show it to some people, I would like it to push it to my github account. The issue is that the original repo is now changed, it has a lot of commits added after I originally pulled it, and I don't really want those as I haven't tested them with my modifications.
I tried forking that repo from github to my account, but couldn't merge this one due to many changes present there. (I see the files with git status command) Also, I tried creating a new empty repo and tried to commit changes from that code to that new repo (I edited some of the config files to point to that one, (similar to git remote), but still I didn't manage to succeed.
Can anyone provide me with a method which will allow me to push this code I have to my github account, creating a new repo (or inserting it into the new one), without losing the changes or pulling the new commits from the original repo?
Thanks!
|
So, I did these steps do fix the issue:
1. I created a new repo online
2. Ran the `git init` command
3. Ran the `git add *` command
4. Ran the `git remote add origin path/to/.git/online`
5. Authenticated
6. Ran the `git commit -m 'blabla'` to make the initial commit
7. Ran the `git push origin master` to push it to the repo
This solved my issue!
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "git, github, commit"
}
|
AKTubularBells() and AKRhodesPiano() together cause error on the second
I'm using AKRhodesPiano() and AkTubularBells(). Both work alone. When I try to initialize both, I get the following error.
AKRhodesPiano.swift:init(frequency:amplitude:):88:Parameter Tree Failed
Notably, if I change the order of initialization, the error occurs for the last one of the two instantiated.
Adding the following line to the AKTubularBells playground right under the initialization of AKTubularBells is enough to trigger the error.
let tubularBells = AKTubularBells()
let temp = AKRhodesPiano() /// <- Add this line.
I saw in another post AKRhodesPiano error (crush) on AudioKit v4.2 that there was a recent error in the STK Physical models, so perhaps this is part of that. Any insight appreciated as always.
|
Thanks for noticing this, it only occurred when using those two nodes simultaneously, but it was basically just a cut-and-paste job gone bad. I fixed it on develop, so if you can rebuild the framework you'll be fine or else wait for the next release which should be soon.
Here's the fix: <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "audiokit"
}
|
Unwanted lines are being added after pulling from github
after pulling from github some unwanted lines are being added in many file those are not actually written. Indeed,those are not part of the code.
I am doing pull by this command =>
git pull master
lines are being added like this =>
<<<<<<< HEAD
=======
>>>>>>> 8dcbf52aea6c16a5743dae0b5840c2888102dee0
|
Seems that you have conflicts when pulling. This happens because you and other person have modified the same files, and Git is not smart enough to determine what to do.
You need to resolve the conflicts; this link can help.
One practice you can adopt to diagnose this kind of things early, is to perform a _git fetch_ before pulling.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "git, github"
}
|
SQLite sort by price doesn't work
I have a column called price and all the values are TEXT so like this: "$26.71". I want to sort this column in descending order but i can't because the column is not defined as INTEGER and it has a "$" character in front of all the values. What should i do in order to make this work?? Thanks.
|
You can combine `ltrim` and `cast` to get an actual numeric from which to sort by:
select * from table order by cast(ltrim(price, '$') as numeric) desc
Note, `ltrim` also works if you have multiple currencies. Just line them all up, like `'$€'`. `ltrim` removes any and all characters from the left side until it hits a character that's not in that string.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "sqlite, text, sorting, character"
}
|
How to lock a backpack?
In a response to a question in an India forum somebody answered that all items you leave in the Mumbai CTS cloak room must be "locked":
> The cloak room charges something like Rs15 per item, and **all items must be locked** , you'll need your train ticket and passport
We have a couple of backpacks, what does it mean "locked" when applied to a backpack?
!enter image description here
|
Locked means there is a lock on it. For a backpack, if you lock the main compartment and perhaps the secondary one, it should effectively be considered locked. This of course does little to ensure contents of the pack remain in the pack but if you have to do it according to _some_ rules, it should do.
To lock it _more_ effectively, place it in a wire metal mesh and lock that. The ones I use are from Pacsafe also allow attachment to a fixture which makes getting away with the bag harder. In some places you can easily find something suitable but not always.
|
stackexchange-travel
|
{
"answer_score": 22,
"question_score": 16,
"tags": "india, tips and tricks, security, train stations, backpacks"
}
|
Get current stream position on a timer
I am trying to update a UISlider to match the time of the currently Casting stream. Every second I call:
mediaControlChannel.mediaStatus.streamPosition
But it always returns whatever the last time I scrubbed to.
How can I find the current streamPosition from a Cast device?
|
Use `approximateStreamPosition` to get the current stream position; SDK manages that.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "ios, google cast"
}
|
Dynamically accessing globals through string interpolation
You can call variables through a loop in Python like this:
var1 = 1
var2 = 2
var3 = 3
for i in range(1,4):
print(globals()[f"var{i}"])
This results in:
1
2
3
Now I'm looking for the equivalent way to call variables using interpolated strings in Julia! Is there any way?
PS: I didn't ask "How to get a list of all the global variables in Julia's active session". I asked for a way to call a local variable using an interpolation in a string.
|
PS: this is dangerous.
Code:
var1 = 1
var2 = 2
var3 = 3
for i in 1:3
varname = Symbol("var$i")
println(getfield(Main, varname))
end
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "julia"
}
|
Indent Hyperlinks that are Same Line
I have three hyperlinks that are displayed on the same line and I would like to shift all three links to the right by a specified number of pixels. Below is my code, I have tried text-indent and it is not working...
nav a {
background-color: #ccff99;
color: #333333;
border-style: solid;
border-color: #333333;
border-width: 1px;
text-decoration: none;
font-weight: bold;
text-indent: 20px;
}
<nav>
<a href="#">Home</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</nav>
|
Try something like this:
nav a {
background-color: #ccff99;
color: #333333;
border-style: solid;
border-color: #333333;
border-width: 1px;
text-decoration: none;
font-weight: bold;
text-indent: 20px;
}
nav a:first-child {
margin-left: 20px;
}
<nav>
<a href="#">Home</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</nav>
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "html, css"
}
|
:select with find_in_batches in rails
How can I include a :select clause with find_in_batches. The following throws an error " Mysql::Error: Unknown column 'users.id' in 'field list': .
Post.find_in_batches(:batch_size => 100, :select => "users.id, users.name, categories.name, posts.id", :include => [:user, :category]) do |group|
#stuff with group
end
|
Your life with Rails will be much easier if you just retrieve all of the fields for each model queried, like so:
Post.find_in_batches(:batch_size => 100, :include => [:user, :category]) do |post|
u = post.user
c = post.category
# do stuff
end
A trimmed select list, as in your question, provides a limited DB performance improvement, but in most cases not enough to be worth the clunkier code.
|
stackexchange-stackoverflow
|
{
"answer_score": -30,
"question_score": 8,
"tags": "ruby on rails"
}
|
sharepoint 2013 workflow send e-mail when new task is created
I'm creating a workflow in Sharepoint Designer 2013 and I want to send an e-mail when a new task is created in a task list. Any help?
|
Create a workflow for that task list and check the "Creating a new item will start this workflow" checkbox.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sharepoint 2013, sharepoint designer, sharepoint workflow"
}
|
.ssh directory not being created
To generate the `.ssh` dir I use this command:
ssh-keygen
taken from this tutorial: <
But the `.ssh` directory is not created so when I use `cd ~/.ssh` I get this error:
"no such file or directory"
Is there a step missing ? Should the `.ssh` dir be created when I use the `ssh-keygen` command?
|
I am assuming that you have enough permissions to create this directory.
To fix your problem, you can either ssh to some other location:
ssh [email protected]
and accept new key - it will create directory `~/.ssh` and `known_hosts` underneath, or simply create it manually using
mkdir ~/.ssh
chmod 700 ~/.ssh
Note that `chmod 700` is an important step!
After that, ssh-keygen should work without complaints.
|
stackexchange-stackoverflow
|
{
"answer_score": 97,
"question_score": 69,
"tags": "unix, ssh, cygwin"
}
|
Pause and resume a CSS3 background animation with a button?
I want to add a button that can pause/resume the animation preferably using `JS`.
Here is what I've got so far.
I just need a button that can pause/resume the animation. I've looked all over the stackoverflow forums but I am not able to find appropriate solution for this.
EDIT: Preferably JavaScript
|
Just create a class to pause it and use jQuery toggleClass like this
$('.btn').click(function(e){
$('body').toggleClass('paused');
});
<
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "css, animation"
}
|
How can I count paragraphs in text file using Perl?
I need to create Perl code which allows counting paragraphs in text files. I tried this and doesn't work:
open(READFILE, "<$filename")
or die "could not open file \"$filename\":$!";
$paragraphs = 0;
my($c);
while($c = getc(READFILE))
{
if($C ne"\n")
{
$paragraphs++;
}
}
close(READFILE);
print("Paragraphs: $paragraphs\n");
|
If you're determining paragraphs by a double-newline ("\n\n") then this will do it:
open READFILE, "<$filename"
or die "cannot open file `$filename' for reading: $!";
my @paragraphs;
{local $/; @paragraphs = split "\n\n", <READFILE>} # slurp-split
my $num_paragraphs = scalar @paragraphs;
__END__
Otherwise, just change the "\n\n" in the code to use your own paragraph separator. It may even be a good idea to use the pattern `\n{2,}`, just in case someone went crazy on the enter key.
If you are worried about memory consumption, then you may want to do something like this (sorry for the hard-to-read code):
my $num_paragraphs;
{local $/; $num_paragraphs = @{[ <READFILE> =~ /\n\n/g ]} + 1}
Although, if you want to keep using your own code, you can change `if($C ne"\n")` to `if($c eq "\n")`.
|
stackexchange-stackoverflow
|
{
"answer_score": -1,
"question_score": 0,
"tags": "perl, file, paragraphs"
}
|
Eclipse Oxygen: 'Download additional server adapters' link missing
I have Eclipse Java EE IDE for Web Developers, version: Oxygen Release (4.7.0) and 'Download additional server adapters' link missing from 'Define a New Server' wizard. I'd like to use Glassfish, but it's not in the server type list. How can I add a ServerType to eclipse?
|
Click on `Help` -> `Eclipse Marketplace`
Search for "glassfish" and install the "Glassfish Tools", restart Eclipse and then you can add your Glassfish server.
More details/alternative solution:
How to add glassfish tools to eclipse oxygen 3a
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 3,
"tags": "eclipse, glassfish, eclipse oxygen"
}
|
"If you end your turn on this tile gain X stat." Power farming?
So i was playing Betrayal at house on the hill, and there's several tiles that say: "If you end your turn on this tile gain X stat."
I couldn't find any rule preventing the players from just standing on that tile and ending their turn as soon as their turn begins. Is this a legal move?
I had a game where we were 4 people playing and 3 of them were just standing in the gymnasium while i was walking around finding items and such. Then i ended up being the traitor and i got madman, so my character an all my items was lost. While all of the others had max Knowledge, Speed and almost max Sanity to fight me with.
Is this legal moves? I tried reading through the Rule book but couldn't find a rule that was against this. And it's no fun being the only one exploring the house.
|
The FAQ/Errata, found here, clarifies that these rooms can each only be used once per player per game.
> Chapel, Gymnasium, Larder, Library -- Can you stay in one of these rooms turn after turn to increase an attribute?
>
>> No. Each character can receive the benefit from each room just once per game (one boost for each trait for each player, if all four rooms are in play). Most players find this easy to remember, but if someone gets argumentative, keep a simple, written record.
|
stackexchange-boardgames
|
{
"answer_score": 20,
"question_score": 8,
"tags": "betrayal at house on the hill"
}
|
Divisibility Property
I am trying to justify the following result:
Let $p,q$ be integers such that $GCD(p,q) = 1$. Then for all $n \in \mathbb{N}$ exists an integer $j_n$ such that $q^{j_n}t = t \ (mod \ p^{2n+1}), \ \forall 0 \leq t < p^{2n+1}$.
Any ideas on how to prove this result in a simple way?
Thanks in advance
|
**Hint:** It is sufficient that $q^{j_n} \equiv 1 \mod p^{2n+1}$. Consider the sequence of powers $q$, $q^2$, $q^3$, $\ldots$ modulo $p^{2n+1}$. What happens if $1$ does not occur in this sequence?
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 2,
"tags": "number theory, elementary number theory, divisibility"
}
|
How to make two objects equal in contains method of Hashset
I have created a Pair Class which has 3 variables mentioned below and overrides the equals method as well assuming this is used in contains method of hashset. But it is not. Can someone explain what to implement in Pair class to make sure it equats the values of x and y only.
Class Pair extends Object {
int x;
int y;
int dis;
public Pair(int x, int y, int d) {
this.x = x;
this.y = y;
this.dis = d;
}
@override
public boolean equals(Pair p) {
return this.x == p.x && this.y == p.y
}
}
|
Whenever you overide `equals`, you should also override `hashCode`:
@Override
public int hashCode() {
return Objects.hash(x,y);
}
See the general contract of `equals` and `hashCode`: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "java, contains, hashset"
}
|
how does rails server serve pages even when app server puma is down?
I noticed that when puma server was shutdown and when the site was visited the following rails error page was displayed.
;
const date2 = new Date('2019-06-14T10:30:00Z');
const diffTime = Math.abs(date2.getTime() - date1.getTime());
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
console.log(diffDays);
I get the difference as 2 days which is not what I want, as day is calculated from 12am. The actual answer should be 3 days. What needs to be changed in the code to get the output 3 days? i.e.
1) First Day : 12 June 10:30am - 13 June 12:00am
2) Second Day : 13 June 12:00am - 14 June 12:00am
3) Third Day : 14 June 12:00am - 14 June 10.30am
Any help would be appreciated.. Thanks!
|
If the day start and day end time are both the same time, then the last day won't be counted.
What you really want is the day end time to be 12:00am on the next day (as you've stated in your question).
function countDays(dateA, dateB)
{
// Day start time is 12:00am
// 12:00am is represented as 0 hours
dateA.setHours(0);
dateA.setMinutes(0);
dateB.setSeconds(0);
// Day end time is 12:00am on NEXT day
// Adding 1 to the date gives the next day
dateB.setHours(0);
dateA.setMinutes(0);
dateB.setSeconds(0);
dateB.setDate(dateB.getDate() + 1);
// Compute difference
const diffTime = dateB.getTime() - dateA.getTime();
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return diffDays;
}
JSFiddle: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, date, datetime"
}
|
Can I copy archlinux installation to another computer?
I want to get an archlinux system with the same packages, settings, etc. on another computer. Can I do it by creating partitions on another computer, mounting them, copying the whole filesystem, editing fstab, crypttab, grub config, installing grub, generating new kernel? Is there anything else I will need to do?
|
I don't know about crypttab, never encrypted the system myself, but otherwise it should work, mind the network settings and hostname too if they're going to be on the same LAN.
|
stackexchange-unix
|
{
"answer_score": 1,
"question_score": 3,
"tags": "arch linux, cloning"
}
|
Find the range of values that $x$ can take if $9 \log_x5 = \log_5x$
I'm stuck on a homework question about logarithms. I can't work out how to do it, and all I've managed to do is turn $9 \log_x5$ into $ \log_x5^9$. Can anyone guide me onto the right path to solve this?
|
If you prefer to use powers rather than logs you can proceed in this way:
Let $L=\log_5 x$ so that $x=5^L$ and $5=x^{\frac 1L}$ so that $\log_x5=\frac 1L$
We then have $9\cdot \frac 1L = L$ so that $9=L^2$ and $L=\pm 3$ so that $x=5^3$ or $x=5^{-3}$
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "logarithms"
}
|
Putting $10$ distinct objects into $2$ identical boxes
I asked someone the number of ways to put $10$ distinct to $2$ identical boxes and the reply was : just take one object and put it into one box and compare. So, that's just $\frac{2^{10}}{2}$.
I didn't understand that "take one object" and "compare" portions.
|
One way to approach the question is to pick some subset of the objects to put in one box. There are $2^{10}$ ways to do this. You then put the rest of the objects in the other box. As the boxes are identical, you have counted each configuration twice, so divide by $2$.
Another approach is to pick one object and put it in a box. That makes the boxes different. Now pick some subset of the remaining items to put with the first one, which you can do in $2^{(10-1)}$ ways. Put the rest in the other box and you are done.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": -1,
"tags": "combinatorics"
}
|
If I run ./configure, then make again, then will it ruin things if I want to run make a 2nd time?
<
is what I'm trying to install. Anyways, I ran ./configure and make but then I ran make without "make check install". So I'm thinking of running make with "make check install". Is the possibility of this ruined now?
|
Run `make help` and you will see, what does each target effectively do. Or read the `Makefile`.
In general, you should run `make clean` before recompilation to ensure you build the program the way you have configured it. Depending on the `Makefile`, targets may not be re-compiled if the products of compilation/linking is already found. A sane `Makefile` should include checks which determine if recompilation is needed. But if you want to be on the safe side, just run `make clean`.
|
stackexchange-unix
|
{
"answer_score": 7,
"question_score": 3,
"tags": "make"
}
|
Why 'No math function In Where Clause' in MS SQL?
Most of SQL queries have no math operation on where clause.
What is wrong having them on 'where clause'? Is there any performance issue?
Eg:
SELECT * FROM Employee WHERE Salary*3 = 5000
|
If a where clause can utilise an index, it is often (but not always) faster. Using a math operation on a field will stop the index from being utilised.
For example, if you had a table with a million rows, and a date column that was indexed, query 1 here would by far outperform query 2 (they both retrieve all rows where the date is in the last 7 days):
query 1:
select date from table where date > dateadd(d, -7, getdate())
query 2:
select date from table where dateadd(d, 7, date) > getdate()
* * *
In your example, the query would be far better as:
select * from employee where salary = (5000 / 3)
|
stackexchange-stackoverflow
|
{
"answer_score": 15,
"question_score": 2,
"tags": "sql server, performance"
}
|
How to insert large CSV into a CLOB column with DB2/Rails
Problem: I have a large CSV that i want to insert into DB2 table with Rails
Description: The CSV is about 2k lines/8K characters. The CLOB column is set up to handle over 10K characters. I can insert the CSV just fine though RubyMine database console. However my app crashes.
ActiveRecord produces one huge insert query. Code:
Logger.create(csv: csv_data.to_s)
DB2 returns an error:
ActiveRecord::JDBCError: [SQL0102] String constant beginning with 'foobar' too long.
I can insert huge PDF files into BLOB columns just fine using similar code. I tried creating the record first and then updating it with data, no difference.
This problem is the same as this. Except I need a Rails solution, rather than general one
|
Found a hack around this by splitting the `csv_data` into chunks and appending them to the column
update_attribute(:csv, '') if self.csv.nil? # Can't CONCAT to nil
# Split csv_data into chunks, concatenate each one to the field
csv_data.scan(/.{1,6144}/m).each do |part|
parm = ActiveRecord::Base.connection.quote(part)
ActiveRecord::Base.connection.execute("update #{Logger.table_name} set csv = CONCAT(csv, #{parm}) where id = #{self.id}")
end
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "ruby on rails, db2, clob"
}
|
Обращение к элементу по id без getElementById.
Разбирал вот такой вод код: timelessname.com/sandbox/matrix.html
s=window.screen;
w=q.width=s.width;
h=q.height=s.height;
m=Math.random;
p=[];
<body style=margin:0 onload=""><canvas id=q>
Описано ли где ни будь в документации по JS, вот такое обращение к элементу по id:
w=q.width
Если кто знает дайте ссылку.
|
вот тут описано , впрочем лучше все-таки getElementById в силу того, что разные браузеры по-разному задают это свойство.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, html, dom"
}
|
Intellij autocompletion distinct declared and inherited methods
In autocompletion is there a way to distinguish declared and inherited methods?
For example, I declare `ArrayList list = new ArrayList();`
In autocompletion how can I see, which methods belongs to ArrayList, which to AbstractList, which to Object etc.?
|
If you invoke completion in `list.<caret>` position, the methods declared in `ArrayList` class should be shown in bold. ![enter image description here](
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "intellij idea, autocomplete"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.