INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
How do you size the jQuery Button?
I'm using the jQuery UI Button control but don't seem to be able to adjust the size (width and height). Here's the API documentation. I tried setting a STYLE attribute on it, but then the LABEL wasn't centered correctly. Thanks.
|
Try this in the style attribute:
width: 300px;
padding-top: 10px;
padding-bottom: 10px;
or
$(element).css({ width: '300px', 'padding-top': '10px', 'padding-bottom': '10px' });
|
stackexchange-stackoverflow
|
{
"answer_score": 31,
"question_score": 28,
"tags": "jquery, jquery ui"
}
|
Date compare in javascript not working
I have a string of date which I have converted to javascript date. I'm trying to compare it but it doesn't seem to work. Any help would be appreciated.
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var str = "06/23/2016";
var parts = str.split("/");
var dt = new Date(parseInt(parts[2], 10),
parseInt(parts[0], 10) - 1,
parseInt(parts[1], 10));
var now = Date();
if(dt > now) { alert("the date is greater than now");} else { alert ("the date is not greater than now");}
document.getElementById("demo").innerHTML = dt;
</script>
</body>
</html>
|
Calling `Date()` returns a string representation of the current date:
> Date()
'Sun May 17 2015 15:05:25 GMT+0200'
What you want to do instead is create a new Date object using the `new` operator:
> new Date()
Date 2015-05-17T13:06:42.788Z
This object can then be compared to another `Date` object.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "javascript, date, datetime"
}
|
Format(Month(Date),"MMMM") Returns wrong month
Wondering why :
? Format(Now(), « MMMM ») return october
And
? Format(Month(Now()), « MMMM ») return January
However
? Month(Now()) return 10 ...
Any Idea why ?
|
With
? Format(Month(Now()), « MMMM »)
the expected date is "transformed" to a day value only. VBA then assumes the rest as year 1 and month 1. Hence the result becomes "January".
Simple test is to display:
? Format(Month(10), « MMMM »)
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -1,
"tags": "excel, vba"
}
|
Prevent button click from activating <tr> onclick event
I have a table with a row that contains a button within one of the cells. The `<tr>` has an onclick event. I want the button to operate independently of the `<tr>` onclick yet operate within the same row.
**HTML:**
<tr onclick="$trigger();">
<td>Data A</td>
<td>Data B</td>
<td>Data C</td>
<td><button onclick="$buttonClicked();">Submit</button></td>
</tr>
Is this possible?
|
You can use **event.stopPropagation()** :
> Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
$('button').click(function(event) {
event.stopPropagation();
});
|
stackexchange-stackoverflow
|
{
"answer_score": 20,
"question_score": 5,
"tags": "javascript, jquery, css, html table"
}
|
RPM for suse linux named libatomic1
> my os info is; NAME="SLES" VERSION="15-SP3" VERSION_ID="15.3" PRETTY_NAME="SUSE Linux Enterprise Server 15 SP3" ID="sles" ID_LIKE="suse" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:suse:sles:15:sp3" when i do
$rpm -q libatomic1
> it reply package libatomic1 is not installed, and when i run
$sudo zypper install libatomic1
> it raise Loading repository data... Reading installed packages... 'libatomic1' not found in package names. Trying capabilities. No provider of 'libatomic1' found. Resolving package dependencies... Nothing to do
>
> please assist how can i install this rpm
|
Based on this SuSE page this is the procedure (executed by `root`)
zypper addrepo
zypper refresh
zypper install libatomic1
|
stackexchange-unix
|
{
"answer_score": 0,
"question_score": 0,
"tags": "linux, rpm, suse, zypper"
}
|
Display Bitmap resource in MainScreen banner for BlackBerry
Hey guys, I'm having trouble displaying my icon in the banner of my MainScreen. The Icon is located in the res/ directory. Here's my MainScreen code:
HorizontalFieldManager mngr = new HorizontalFieldManager(USE_ALL_WIDTH);
LabelField label = new LabelField("AACD");
BitmapField pic=new BitmapField(Bitmap.getBitmapResource("res/aacdIconSmall.PNG"),Field.FOCUSABLE);
mngr.add(pic);
mngr.add(label);
this.setBanner(mngr);
BrowserField browserField = new BrowserField();
add(browserField);
The AACD Label shows up above my BrowserField but my pic bitmap never shows up. Any ideas?
|
Your code is OK.
However I do suspect you did not add the image to your JDE project, so the image is not included in the resulting `.cod` file during building the project.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, blackberry, blackberry eclipse plugin"
}
|
NumPy: создание двумерного массива
Я только начал изучать `NumPy`. Хочу уточнить:
b = np.array([[1.5, 2, 3], [4, 5, 6]])
это есть создание двумерного массива, где b[0][0] = 1.5, b[1][0] = 4 и т.д.?
|
всё верно , тебе скинуть что посмотреть для изучения ML ?
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "python, массивы, матрицы, машинное обучение, numpy"
}
|
How can I convert Javadoc's output to MediaWiki and place it in SourceForge's wiki?
Background: I'm a novice to open source and SourceForge. Me and a friend of mine are running our final year computer science project from the web site. The project is Java based, and we are using the Java docs in our project.
Actual question: I wonder if there is any "good" way to convert the Java docs to the MediaWiki format and sync the pages in the Wiki web app that Source Forge has to offer?
|
I had the same idea and started developing a doclet for mediawiki-integration with help from the jwbf-library.
Examples, source and documentation is available under: < The self-documentation is available there too...
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 3,
"tags": "java, javadoc, mediawiki, sourceforge"
}
|
Calendar.add not returning expected date
I have the following code:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-dd-MM HH:mm:ss");
Date convertedDate;
String initialDate = "2011-13-05 11:00:00";
try {
Calendar cal = Calendar.getInstance();
cal.setTime(dateFormat.parse(initialDate));
cal.add(Calendar.DAY_OF_MONTH, 7);
convertedDate = cal.getTime();
String delayDate = dateFormat.format(convertedDate);
} catch (ParseException e) {
e.printStackTrace();
}
I am expecting delayDate to contain "2011-20-05 11:00:00" but instead it is returning "2012-12-01 11:00:00" and I don't know why
|
It works for me both on the desktop and on an Android device. Not sure why you're getting incorrect dates.
EDIT: what specific handset are you using, and what timezone is it in?
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, date, calendar, add"
}
|
Do I put 'const' in my UML diagram?
I'm making a UML diagram using Dia. Do I need to put `const` in the diagram when a function is `const`? If so, where?
|
Chapter 11.8.2 ("Operation") in the latest UML specification lists **isQuery** as one of the operation's attributes:
> isQuery : Boolean - Specifies whether an execution of the Operation leaves the state of the system unchanged (isQuery=true) or whether side effects may occur (isQuery=false). The default value is false.
If operation that does not change system's state is shown in a diagram, property **{query}** should be added after function's return type.
Dia supports **isQuery** attribute for class' operations: open class' _Properties_ window and in _Operations_ tab tick **_Query_** checkbox for method that does not change class' state and **const** will appear after method's return type in a diagram.
|
stackexchange-stackoverflow
|
{
"answer_score": 14,
"question_score": 8,
"tags": "c++, uml"
}
|
When extending Array in Javascript, why does this.length mismatch with this' content?
Say I want to extend Array with a to_html() method:
Array.prototype.to_html = function() {
console.log(this.length);
for(var i in this) {
console.log(this[i]);
}
};
And I have an array:
var arr = [1, 2, 3];
When calling `arr.to_html()`, the first line in console looks fine:
3
So far so good. But here are the following lines:
1
2
3
function() {
console.log(this.length);
for(var i in this) {
console.log(this[i]);
}
}
Oops, where does the fourth element come from? How can I get rid of it?
|
Try this instead to ensure you only iterate over the array items
for(var i = 0; i < this.length; i++) {
console.log(this[i]);
}
`for in` will iterate all properties on the object. It is including the property/method you defined on the prototype as well
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "javascript"
}
|
How do I remove/uninstall a corporate VPN?
I have a corporate VPN installed on one of my Windows XP systems that I'd like to completely uninstall. There are no programs listed in the add/remove programs dialog matching the corporate VPN name or similar.
I can find the VPN being launched from here:
C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Cm\<Company Name>
I can see the VPN connection under network connections:
Name Type Device Name
Connection Manager
-------------------
Connection to <Company Name> Connection Manger WAM Miniport (PPTP)
Do I just need to delete the connection from Network Connections? And delete the directory? Or?
|
It sounds like the VPN is using no special software, just the standard built in VPN function of Windows.
Deleting the connection should be all that you need to do.
|
stackexchange-superuser
|
{
"answer_score": 5,
"question_score": 2,
"tags": "vpn, uninstall"
}
|
Why my top menu dissappear when in register or reset page in joomla 2.5
I have created a custom joomla template based on blank joomla template from < Everything was fine until i clicked either forgot password?, forgot your username? or create account link that bring me to register or reset page in frontend but strangely the top menu was gone.
This is the screenshot : <
i have no idea why this could happenned.
Please help with this. I appreciate all the help. Thanks!
|
The problem is because `only on the pages selected` option for module assignment is set. If you open a page which doesn't belong to any menu, then module won't be shown on it.
You can either check menu module to be shown `on all pages`, or make a new menu item for `forgot password` functionality, and then assign that menu for both menu module, and breadcrumbs module.
I don't know which Joomla version you're using and what you use for translation, but if you use Joomfish or Falang, language translation should be much easier.
If you don't use any of those, and you really need to leave everything as it is, then you can also detect current user language in the template, and load either one or the other menu module based on it. That way you can set module to be shown on all pages, and make sure it is displayed only for the choosen language.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "joomla"
}
|
How do you affect the padding on the MuiCardActrions component
I am trying to target the "root" class for the `MuiCardActions` component with a theme custom-variables override. Here is my `JSS`:
overrides: {
MuiCardActions: {
root: {
display: 'flex',
justifyContent: 'flex-end',
padding: 0
},
}
},
I can see that the display 'flex' and 'flex-end' is affecting it. If I change it to 'space-between' it does affect the component, but padding has no affect.
Link to post I made on a closed issue - 9749
|
The override feature behaves at the JavaScript level, not the CSS level. You have to account for the media query: <
Something like this should do it:
overrides: {
MuiCardActions: {
root: {
display: 'flex',
justifyContent: 'flex-end',
[theme.breakpoints.up(0)] : {
padding: 0,
},
},
}
},
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "material ui, jss"
}
|
How to do reverse DNS lookup in Nginx
I have Nginx configuration where I want to allow a DNS name as I cant be certain on IP address.
{
satisfy any;
allow www.domain.com; // want to achieve this
}
With Nginx we cant achieve this.
* Looked at this < as a solution. This module says it does reverse lookup but it didnt work and repo is very old and well maintained.
* Another alternative is to use a shell script and do a dig or host on IP address but we dont want to use shell script with Nginx.
* Alternate solution is to use a side car to do the DNS resolution and to add allow/deny rules.
|
If this still works you'll need to compile it for the same version of nginx that is installed. If you're using nginx from a repo then dynamically compile it and see if the following helps:
Download nginx src matching installed version and extract it.
$ cd nginx-1.x.x
$ ./configure --with-compat --add-dynamic-module=/path/to/nginx_module
$ make modules
make modules should result in a nginx module that you need to copy to `/usr/lib/nginx/modules/` and load it with `load_module modules/modulename.so` in your nginx.conf.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -3,
"tags": "nginx"
}
|
Eclipse Android Graphical Layout is not giving the options on properties window
Eclipse Android Graphical Layout is not giving the options on properties window.
example: When i select any widget on my graphical layout editor to show the properties, when i click on "Text" property (value field) it shows the "..." button to select a string. When i click on the button, nothing happens and i have to fill it by myself. The same for other properties like Gravity (i have to fill it by myself instead of show me the options like "center", etc.
I've just updated to the last version available, anyway, this installation is very fresh (last weekend). I'm running on a ubuntu 11.04 also updated today. But this always happened to me, it never worked actually :( very frustrating.
|
I submitted this to android-developers mailing list and found that there is a bug (fortunately already fixed) on ADT for linux:
the solution is:
Download the ADT r14 preview available here:
many other bugs, mainly on interface design layout issues were fixed lately (and many linux-specific bugs).
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "android, android layout, android widget, eclipse adt"
}
|
swift: is there any way to Download a language pack to give offline translation feature
I'm trying to give a feature like google translate app where user can download multiple languages and see translations in those.
More specifically, I need to implement offline language translation. Like a user write some text and wants to translate it in some other language (Spanish or German) without internet.
Is there any way to do that? I'm not able to find anything about this. Please guide me through if someone knows about it.
Thanks.
|
I have not come across any solution that provides this functionality, although as google translate works, you do need to download required language pack one time. Then you can use it offline. Also language packs can be huge so you can definitely not keep all of them saved in your application at once.
In case this is your requirement, you can check out google ML Kit Translator for iOS. This is pretty neat along with the documentation. <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "ios, swift, xcode, swift3, iphone developer program"
}
|
Quotient group concerning $\mathbb Z / 24 \mathbb Z$
Let $G=\mathbb Z / 24 \mathbb Z$ and let $H$ be cyclic subgroup of $G$ generated by class $16+ 24 \mathbb Z$.
The question is whether $G/H$ is cyclic? I don't even know what elements of $G/H$ are supposed to be, classes containing classes? Maybe the fact that $\mathbb Z / 24 \mathbb Z$ is isomorphic to $\mathbb Z_{24}$ could help by simplifying things.
Also, what would be the order of $G/H$? By Lagrange's theorem, it should be $|G|/|H|=8$, is that correct? But if I identify $\mathbb Z / 24 \mathbb Z$ with $\mathbb Z_{24}$, I get more than $8$ elements in $G/H$.
Any help would be appreciated. Thanks!
|
If we view $G = \mathbb{Z}/24\mathbb{Z}$, we talk about the quotient group of the additive group $\mathbb{Z}$ and a subgroup $24\mathbb{Z}$. Hence, we "mod out" $24$ and set it equivalent to $0$. If we denote $n \mod 24$ as $\bar{n}$, $$G = \\{\bar{0}, \bar{1}, \cdots, \bar{23}\\}$$ and has order $24$. Now that we are used to this group, we again take a quotient group with the subgroup $H$, generated by $16 \mod 24$. Hence, $H$ looks like $$H = \\{\bar{0}, \bar{8}, \bar{16}\\}.$$
Indeed, $\\#G/H$ is then 8, and since $H$ is generated by one element, it is by definition cyclic, hence so is $G/H$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "group theory, quotient group"
}
|
Invalid parameter number PDO
got this:
public function Register($uname,$pass,$mail)
{
try
{
$new_password = password_hash($pass, PASSWORD_DEFAULT);
$stmt = $this->db->prepare("INSERT INTO users(username,email,password)
VALUES(:uname, :mail, :pass)");
$stmt->bindparam(":uname, $uname");
$stmt->bindparam(":mail, $mail");
$stmt->bindparam(":pass, $new_password");
$stmt->execute();
}
catch (PDOException $e)
{
echo $e->getMessage();
}
}
when I am trying to register it throws me an error:SQLSTATE[HY093]: Invalid parameter number: no parameters were bound. Was looking through the internet for the answers, but didn't find it yet, maybe you, guys , got some ideas?
|
You should use `bindparam(':name', $name)` instead of `bindparam(':name, $name')`. The first argument is a name of parameter slug, and the second argument is a variable you want to bind.
public function Register($uname,$pass,$mail)
{
try
{
$new_password = password_hash($pass, PASSWORD_DEFAULT);
$stmt = $this->db->prepare("INSERT INTO users(username,email,password)
VALUES(:uname, :mail, :pass)");
//note the quotes!
$stmt->bindParam(":uname", $uname);
$stmt->bindParam(":mail", $mail);
$stmt->bindParam(":pass", $new_password);
$stmt->execute();
}
catch (PDOException $e)
{
echo $e->getMessage();
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -2,
"tags": "php, pdo"
}
|
How to join parts of two strings together in python
I have the following two `strings`:
request= "1/1/1.3.45.3.6/3/4
reply= "1/2/3"
I want to return a new `string`, which concatenates the `1.3.45.3.6` of `request` with `2` of `reply` to return a `list` which contains the `string`.
Output should be a `list`:
result= ["1.3.45.3.6.2"]
I have the following method, that doesn't work. The inputs to the method are both strings.
def concatentatestring(request, response):
oidStatusValueList = [f"{i.split('/')[2]}.{j.split('/')[2]}" \
for i in request for j in response \
if (i.split('/')[1] == j.split('/')[1]) ]
|
Dont use a list comprehension as you are not iterating over request and response
>> request= "1/1/1.3.45.3.6/3/4"
>>> reply= "1/2/3"
>>> [f"{request.split('/')[2]}.{reply.split('/')[1]}"]
['1.3.45.3.6.2']
So your `concatentatestring` function would look like
>>> def concatentatestring(request, response):
... return [f"{request.split('/')[2]}.{response.split('/')[1]}"]
...
>>>
>>> concatentatestring(request, reply)
['1.3.45.3.6.2']
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, string"
}
|
Как лучше написать SQL запрос для получения данных из столбца
Имеем три таблицы:
1. Users (Здесь у нас есть ID).
2. Workflow (Здесь есть WorkflowID, который сопоставлен с UserID из таблицы Users).
3. Package (Здесь также есть столбец WorkflowID, который сопоставлен со столбцом ZipFileName(который как раз и необходим)).
Подскажите пожалуйста, как мне, зная UserID, получить сопоставленные данные из столбца ZipFileName, из таблицы Package с помощью SQL запроса.
Я пытался сделать следующее, но по какой-то причине SSMS показывает ошибки, и из-за них запрос не выполняется:
`SELECT ZipFileName (SELECT WorkflowID FROM Workflow w WHERE w.UserID = 23 ) FROM Package p WHERE w.WorkflowID = p.WorkflowID`
P.S. Сильно не пинайте пожалуйста
. As I am going through cleanup I have found that currently running `lsb_release -a` gets me:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8.11
Codename: jessie
Would a proper Debian Kernel upgrade change the output of lsb_release?
|
`lsb_release` doesn’t output the kernel version, so no, upgrading the kernel won’t change its output.
|
stackexchange-unix
|
{
"answer_score": 1,
"question_score": -2,
"tags": "debian, kernel, upgrade, backports"
}
|
A 13"x19" printer / archival quality ink combination?
I've been looking at the Canon® PIXMA PRO-100 which has positive reviews but it uses Canon ChromaLife100 ink which is rated for 100 years when stored in an album. Can this be considered "archival" quality? What is a good 13"x19" that uses archival quality ink. I am planning to print on cotton, acid-free, photo rag art media.
|
Epson P600 is getting very good reviews. I have a P800 which uses the same inks (in larger more cost effective cartridges, which was my reason for selecting the P800 over the P600 almost as much as print size) and I can attest to excellent color saturation and black levels which will surely produce satisfactory results.
Archival stability for the Epson UltrChromeHD inks these printers use is claimed, though of course I cannot speak to personal experience on that having gotten the printer a month ago :)
|
stackexchange-photo
|
{
"answer_score": 1,
"question_score": 3,
"tags": "printing, printer, ink jet, archival"
}
|
Check if the Health apps are installed on user's device. (Swift)
I've checked few questions on the internet and understood how to check other apps programatically. However, I'd like to check if some particular apps are installed on the user's device, take Google fit and FitBit for example. How would I check these apps on users device? I'm not able to find any URLScheme for these apps.
Thank you.
|
Add this to your Info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fitbit</string>
</array>
You can create common function to check availability of any scheme
func schemeAvailable(scheme: String) -> Bool {
if let url = URL(string: scheme) {
return UIApplication.shared.canOpenURL(url)
}
return false
}
Then, in code your can check to see if you can open FitBit
self.schemeAvailable(scheme: "fitbit://")
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "swift, url scheme"
}
|
Triple Join In SQL
How can I get the red section of the following Venn diagram in SQL 
url_for params.merge(new_params)
end
Link:
<%= link_to "JSON of this page", current_url(:format=>:json)
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 7,
"tags": "ruby on rails, ruby on rails 3.1"
}
|
What is the name for this operation?
What is the name for this operation?
 the whole interval so that its mid-point slides (or moves) to zero.
As have already been mentioned, the technical term is translation, which children might associate with translating between languages. They are absolutely right to make the association, since a word in one language is coupled to a word in another language, just as a point in the interval [-28,72] is coupled to a point in the interval [-50,50].
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "terminology, absolute value"
}
|
Are nodes outside the markov blanket unconditionally independent?
Apologies if my question is deeply flawed, I've been working through a lot of material in the past few weeks and have a few blind spots here and there.
On one level my question is this - given a bayesian network with all directed edges, what is the set of nodes X and Y such that P(Y) = P(Y|X)
My intuition says that this is all Y,X such that Y not in the markov blanket of X. My rationale is that when performing marginalization, for any given term in the marginalization sum, values have been chosen for every node in the markov blanket, rendering the terms chosen for nodes outside the markov blanket irrelevant.
Am I mistaken?
Much thanks.
|
Consider the bayesian network: `X -> Y -> Z`
$X$ is out of the Markov blanket of $Z$ (which is $\\{Y,Z\\}$), yet $Z$ (unconditionally) depends on $X$.
On the other hand, d-separation is what you are looking for. From Pearl's Causality book, you can read:
> d-separation is a criterion for deciding, from a given a causal graph, whether a set X of variables is independent of another set Y, given a third set Z.
You can use an empty conditionning set to check whether two variables are (unconditionally) independent. The Bayes-Ball algorithm is a practical algorithm based on this criterion for deciding whether or not two variables are independent.
|
stackexchange-stats
|
{
"answer_score": 0,
"question_score": 0,
"tags": "graphical model, bayesian network, probabilistic programming"
}
|
Gatsby Algolia tag based search
In Gatsby, using Algolia, I can get the text search to work properly with search results linking properly to their blog posts.
Each blog post has a footer. In this footer there are keywords. Is it possible to click on a keyword, then be routed to a results page with all the matching blog posts that have the same keyword?
|
You could include the tag or key word as a part of your `frontmatter` instead like is described here. Then in your algolia query include that field from your `frontmatter` in GraphQL query and it will be able to search based on those tags.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "gatsby, algolia"
}
|
Can I say Family affairs to mention as reason for leave?
My question is very similar to this where I want to communicate the reason why I won't be able to join the call/party or come to office but without giving any impression to my colleges that there are some issues.
Often I have to take leave for the family reasons and not necessary is family issue like someone fell ill or met with accident similar serious reasons but I take leave for attending Parnet-teacher meets or I have a party at home etc.
Can I just mention. "Family affairs" as a very broad reason?
|
In America, it's common to say "family commitments", "family matters", or "personal reasons".
I think the phrase "family affairs" is out-dated -- I've encountered it in older books and TV shows (there was a TV show when I was a kid about a widower raising two children called "Family Affair"), but I don't recall hearing anyone use it lately.
Just by the way, something I often struggle with is how specific to be. Suppose most of the time you give a specific reason, "I have to take my son to the dentist" or whatever. Then one time you have a reason that you don't want to share, like if you're taking a day off work to go on a job interview, or you can't attend a party because you're going to some other party that you think will be more fun. If you give a specific reason in most cases but a vague, general reason in the "maybe somebody will be insulted" case, then people may guess that you're giving a vague reason because you don't want to tell them the details. :-)
|
stackexchange-ell
|
{
"answer_score": 1,
"question_score": 0,
"tags": "phrase request"
}
|
ExpressJs 4.0 new Router - How to handle paramters
**Unless I am mistaken, this is the proper approach to using the new ExpressJs 4.0 router:**
'use strict';
var express = require('express'),
fooCtrl = require ('./controllers/fooCtrl'),
router = express.Router();
module.exports = function(app){
router.route('/foo')
.get(fooCtrl.getAll),
.post(fooCtrl.post);
.....
app.use('/foo', router);
}
But how do you handle **_.put, .get(by id) and .delete where an id is needed_**?
If I did not use router.route above, it would be:
.get('/foo/:id, fooCtrl.getById),
.put('/foo/:id, fooCtrl.update),
.delete('/foo/:id, fooCtrl.delete);
So would I handle .get(by id), .put and .delete when I use router.route?
|
Found answer on expressjs
>
> router.route('/users/:user_id')
> .all(...),
> .get(...),
> .put(...),
> .post(...),
> .delete(...)
>
Apparently you put '/:id' in the route parameter for all.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "express"
}
|
How Get width of a view using getWidth()?
How i can get Width or Height of a View in Android ? when using getWidth() getHeight() methods they are returning 0
and another sub question is getWidth() return value in dp or px ..
|
Your view has not rendered yet. You have to wait it!
Use post method.
yourView.post(new Runnable() {
@Override
public void run() {
int height = yourView.getHeight();
int width = yourView.getWidth();
}
});
**height and width value will be in pixel format**
If you get this exception:
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
put your .post() code in a runOnUiThread method.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "java, android"
}
|
how to get all select option values using jquery
I have select list
<select name="select-choice-min" id="mainMenu" data-mini="true">
<option value="10">10</option>
<option value="11">11</option>
...
</select>
I tried with
var arr = new Array();
var sval = $("#mainMenu option").val();
arr.push(sval);
but on alerting arr variable I'm getting only first value 10, 10, 10, ...
so, how to get all select option values?
|
Try this
Loop through `#mainMenu option` using `.each()` then get appropraite values using `$(this).val()` then push using `arr.push($(this).val());`
var arr = new Array();
$('#mainMenu option').each(function(){
arr.push($(this).val());
});
console.log(arr)
Working DEMO
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 0,
"tags": "javascript, jquery"
}
|
Other factors of the equation $2x^4 + 4x^3\sin A\sin B -\cdots$
If $x^2+x\cos(A + B) + 1$ is a factor of the expression, $$2x^4 + 4x^3\sin A\sin B -x^2(\cos 2A +\cos 2B) + 4x\cos A\cos B -2$$ Then we have to find the other factor (s).
I am not getting start
Can anybody provide me a hint .
|
**Prerequisites** : Recall the identities: $$2\sin A\sin B = \cos (A-B) -\cos (A+B) \tag {1} $$ $$2\cos A \cos B = \cos (A+B) + \cos (A-B) \tag {2} $$
Using these, our expression simplifies to $$2x^4 +2x^3\cos (A-B) -2x^3\cos (A+B) -2x^2\cos (A+B)\cos (A-B) +2x\cos(A+B)+ 2x\cos (A-B)-2$$
Hope you can take it from here.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "quadratics"
}
|
Is there a way to combine multiple takes in a TF2 Replay?
I had an awesome double kill when I was playing as Pyro tonight;
I wanted to set it up so that first you had the first-person-view, (of me) and then you had a 3rd person view of the area the fight was taking place in.
I got two separate "takes", one from each perspective, but I can't seem to figure out how to append the one to the other. Is this possible to do within TF2 itself?
Otherwise, it looks like I might have to create a movie from both takes and then use some video editing software to stitch them together outside of the game itself (which would be hard for me, as I lack video editing software).
Is there a way to combine multiple takes in a TF2 Replay?
|
Currently the TF2 editor is not able to do this, maybe in the future but for now you'll need an external editor.
If you are using windows, you should have the _Windows Movie Maker_ installed already, though it is not a very good editor.
If you just want to stitch together 2 videos, you can do that with the _YouTube Video Editor_ : <
|
stackexchange-gaming
|
{
"answer_score": 5,
"question_score": 6,
"tags": "team fortress 2"
}
|
Decimal rounding errors upon division (C#)
I have basically four numbers (say 100, 200, 300, 400), and I need to calculate the probability as 100/(100+200+300+400), 200/(100+200+300+400), and so on.
When I use the decimal data type to store these probabilities, they don't up to one due to round issues. What's the best way to past this without making the probabilities too inaccurate? Basically I do this calculation many many times, so I don't want to have to change all the divisions into Math.Round stuff. :|
|
The solution is straightforward: **if it hurts when you do that then don't do that**.
If you have _rational_ probabilities, that is, probabilities that are ratios of whole numbers, and you want them to add to exactly one, then _don't convert them to decimal or double in the first place_. Use an arbitrary-precision rational type to represent your arbitrary precision rationals.
There's an arbitrary-precision rational type included with Microsoft Solver Foundation; you could download and use that. Or, it is easy to write your own by simply making an immutable struct that has two BigIntegers for the numerator and denominator, and then write implementations of the operators you need.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 5,
"tags": "c#, decimal, rounding, floating accuracy"
}
|
Objective-C Is there a way to tell if an object is set to autorelease?
I am looking at a leak report from instruments. Several of my leaks are pointing to the methods SBJSON. I have trouble believing the returned values are not autoreleased, but in tracing through the code, it becomes very tedious, including returning values using call-by-reference. I don't think code tracing is the right way to look at this.
Is there a way to tell if any object is retained within the autorelease pool? (I am not using ARC.)
UPDATE
Here is some code that Instruments is pointing me to:
- (NSString *) processResults:(NSString *) resultsGeoCodeString {
NSDictionary *resultsGeoCode = [resultsGeoCodeString JSONValue]; // <--- 100%
...
I assume that the "100%" means that all of the leaks reported for this case originate in this line.
I don't release the object `resultsGeoCode` because I am assuming it is autoreleased.
The SBJSON kit I am using is not using ARC.
|
Generally speaking, knowing if an object is in the autorelease pool is not helpful. You may get an autoreleased object back from a method or you may get a constant object or a singleton or an object that the framework has retained internally for its own purposes.
Start with the assumption that it is your code and not SBJSON that is causing the leak. (SBJSON is a very popular and well used library and so probably doesn't have any serious leaks anymore.) Then examine what you do with the leaking object. For instance, do you put it in an array that is never deallocated for whatever reason. Do you autorelease it on a thread with no autorelease pool in effect and so on. Try posting you code here. Others may be able to spot the leak.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "objective c, memory management, autorelease"
}
|
Invoke minor mode upon visiting an org file (on a per-file basis)
I have certain org files (scientific manuscripts) that I want to automatically show in Olivetti mode with a specified width upon opening. Is it possible to enable Olivetti (or generally, any minor mode) with something like this? `#+STARTUP: indent linum`
Here's what I'm currently using at the top of the file, but of course I have to evaluate it with C-c C-c...
#+BEGIN_SRC elisp :exports none :results none
(olivetti-mode)
(olivetti-set-width 110)
#+END_SRC
Thanks.
|
As @Lorem Ipsum suggested, you can use file variables to customize things when a particular file is opened. There are a few ways to store file variables (see Specifying File Variables in the Emacs manual for details), but you can let Emacs insert them for you so you don't have to worry about the exact syntax.
The command `add-file-local-variable-prop-line` will add a variable to a property line at the top of the file that Emacs will process when the file is opened.
I was able to get your specific case working with the following at the top of an org file:
# -*- olivetti-body-width: 110; eval: (turn-on-olivetti-mode); -*-
|
stackexchange-emacs
|
{
"answer_score": 0,
"question_score": 0,
"tags": "org mode, minor mode"
}
|
Get index of object inserted into a vector
How can I get the position where my object was actually inserted?
#include <vector>
using namespace std;
vector<SomeClass> list;
SomeClass object;
list.push_back(object);
list[...].method(); // I do not have the key
Unfortunately `push_back` does not return anything since its return type is `void`.
|
If `v` is your vector, the following will give you the position (that is, the index):
v.push_back(object);
size_t pos = v.size() - 1;
Or you can look at the `size()` before calling `push_back()`. Then you won't need to subtract one.
|
stackexchange-stackoverflow
|
{
"answer_score": 29,
"question_score": 20,
"tags": "c++, stl, vector, std"
}
|
Is there any significance in N355 FWU?
This was always a question for me, and I never found out anything about it.
Is there any significance to N355 FWU? This appears in Season 2 Episode 6 _The Age of Steel_ (it's the number plate of the van that Mickey and Jake drove away).
Please let me know if there is some significance to it or not so we can end this mystery.
|
There is an entry in the Internet Movie Cars Database. In real life, N355 FWU is the license plate of a Ldv 400 Series D 3.1t (Panel Van) which was registered in Leeds in 1995. This is consistent with the vehicle depicted in the series (screenshot below courtesy of IMCDb). So license plate is the real one of the van used for filming. In all likelihood, the van was not chosen for its license plate. The number holds no significance.
!N355 FWU
|
stackexchange-scifi
|
{
"answer_score": 22,
"question_score": 7,
"tags": "doctor who"
}
|
Jquery disable button until ready
I am in the middle of this site here <
the booking section on the right hand side, I need to be able to disable the book now button until the date,duration and adult and children numbers are set..
I can't work out how to do it..
Any ideas ??
Thanks Lee
|
You can bind to the `change` handler on all your form elements... for example:
$(':input').change(function() {
var complete;
// check if your form is complete here
// assumes the id of the button is 'bookNowButton'
if (!complete) $('#bookNowButton').attr('disabled', true);
else $('#bookNowButton').removeAttr('disabled');
});
To simplify the enable/disable functionality I'd also perhaps suggest changing your "Book Now" button to an `<input type="image" />` instead.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, jquery"
}
|
Hide app widget depending on API level
I've created three app widgets with different sizes for pre Honecomb versions of Android and one resizable scrollable listview widget for Honeycomb and later.
Since the widgets offer the same functionality and the one targeted for Honeycomb and later is resizable I would like to remove the other versions of the widget on API level 12 or later. Is this possible somehow?
As far as I can tell there doesn't seem to be any way to disable a widget from getting registered by the AppWidgetService if it can find the AppWidgetProviderInfo resource file. So it seems that I can only include widgets on later versions but not exclude versions defined in xml folders that targets earlier API versions.
|
If it were a single app widget that had pre-HC or HC implementations, you could combine them into one `AppWidgetProvider` and use `res/xml-v11/` and `res/xml/` to have different metadata.
The only way I can think of to handle your scenario, though, is to mark some of the `AppWidgetProviders` as disabled in the manifest (`android:enabled="false"`), then enable and disable your providers on the first run of your app based on `android.os.Build.VERSION` using `PackageManager` and `setComponentEnabledSetting()`, to give you the right set. Since on Android 3.1+, the user will need to launch one of your activities to be able to add the app widget, anyway, you at least have the entry point in which to apply this logic.
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 14,
"tags": "android, android widget"
}
|
Scheme # void error
I tried running the following scheme code:
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(display
(cond ((> g1 g2) j1)
((< g1 g2) j2)
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. "))))))))
But I get the following output:
Le gagnant est : personne. Alper et Ezgi sont exaequos. #<void>
Where did the `#void` come from? How do I get rid of it?
|
Oops, wrong answer. You have an extra display:
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(cond ((> g1 g2) (display j1))
((< g1 g2) (display j2))
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. ")))))))
Should work.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "scheme, void"
}
|
Will 'at' command be executed after the reboot?
If I schedule something with 'at` like,
$ at noon
warning: commands will be executed using /bin/sh
at> echo "Will I be created?" > /tmp/at_test
at> <EOT>
job 12 at Fri Jun 30 12:00:00 2017
And if I reboot the machine before execution time, will my command be executed?
Unlike regular `cron` which schedules tasks from file, does `at` store this 'info' somewhere?
|
Jobs are stored in `/var/spool/cron/atjobs` in Ubuntu for instance.
Jobs are a file with some environment variable set (like `$PATH`, current working directory). The host can be rebooted, if the host is up, jobs will start.
`man at` should tell you more about it.
Note that some Unices have special `cron` entry like `@reboot`.
|
stackexchange-unix
|
{
"answer_score": 6,
"question_score": 6,
"tags": "cron, reboot, at"
}
|
Is there a way to create a website without learning to web-program?
I can create an XML document without knowing XML. I use a word processor. Is there a way to do that for websites?
|
There are a number of different ways to build a site without writing any HTML.
* Buy hosting space from a company that has a built in sitebuilder tool
* Use a drag and drop (WYSIWG) HTML editor such as Adobe's Dreamweaver or other freely available programs
* Use a free service such as google sites or wordpress.com
All such tools have their limitations from a technical and visual point of view and most have some limitations on the type and nature of content or advertising you can add.
**Read the Terms of Service carefully** and above all make sure you **can export the content** and move it to another platform in the future when your site grows or your needs change.
|
stackexchange-webmasters
|
{
"answer_score": 2,
"question_score": 3,
"tags": "website design"
}
|
Capital letter after a semi colon?
I've just learned today that one should use a capital letter after a colon in German if the second part of the sentence could be separated to make a sentence alone.
z. B.
> Ich habe Hunger: Ich habe heute noch nichts gegessen
(I'm guessing if I added _nämlich_ to the second part, using a capital letter would be more controversial.)
Does this rule apply to semicolons too?
> Ich habe nichts gegessen; **ich** habe Hunger.
or
> Ich habe nichts gegessen; **Ich** habe Hunger.
I remember a literature teacher who would tell us that the partial disappearance of the semi-colon in writing was a shame, as it was a good balance between a comma which would bring a too weak separation and a full stop (period) which would be too much.
|
Even if the phrase following a semicolon is a full sentence, the first (next) word is only capitalized if it would be on its own (because it's a name or a noun, say).
To answer your question, #1 is correct. Duden gives the following examples:
> Man kann nicht jede Frage nur mit Ja oder Nein beantworten; oft muss man etwas weiter ausholen. (Hier könnte statt des Semikolons auch ein Punkt oder ein Komma stehen.)
>
> Unser Proviant bestand aus gedörrtem Fleisch, Speck und Rauchschinken; Ei- und Milchpulver; Reis, Nudeln und Grieß. (Hier könnten statt der Semikolons auch Kommas stehen.)
|
stackexchange-german
|
{
"answer_score": 10,
"question_score": 5,
"tags": "punctuation, capitalization, typography"
}
|
How to memorize words including gender with flashcards?
Learning German I'd write flashcards with _summer_ on the front and _der Sommer_ on the back. However, learning Italian, the back would say _l'estate_ , with no way to tell whether the word is masculine or feminine. Is there a good way of solving this problem that I haven't thought of?
Of course I could write _estate (f)_ , but it adds a step in the thought process and feels unnatural. I could also write _la estate_ but maybe that would even be detrimental to my Italian.
|
You might add to every flashcard an example of the word in use (which is useful independently of the gender determination) – a proverb, or a poetic line, or a quotation including it, say, perhaps from Wikiquote – taking care, for a noun, that in the sentence an unambiguous article or an adjective is apposed to it.
|
stackexchange-italian
|
{
"answer_score": 3,
"question_score": 2,
"tags": "nouns, gender"
}
|
Get range in multiplication of 5
I have a number. For instance, my number is `19` . Then I want to populate my drop down with range in multiplication of 5. So my dropdownlist will consist of items of: `1-5` `6-10` `11-15` `16-19`
I tried modulus and division, however, I can't seems to get the range. Is there a fixed method?
Sample code
List<string> range = new List<string>();
int number = 19;
int numOfOccur = (19/5);
for (int i = 1; i < numOfOccur ; i++)
{
range.Add(i + " - " + (i * 5))
}
|
Sometime I think that old school code, without fancy linq is a bit more clear
int maximum = 19;
int multiple = 5;
int init = 1;
while (init + multiple <= maximum )
{
string addToDDL = init.ToString() + "-" + (init + multiple - 1).ToString();
Console.WriteLine(addToDDL);
init += multiple;
}
if(init <= maximum)
{
string last = init.ToString() + "-" + maximum.ToString();
Console.WriteLine(last);
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "c#"
}
|
How to check the current url in php, then compare it to see if it has an sepecific word/phrase
Basically i created an function that redirects a user if they try to access < directly.
The function below works.
The problem is that i have changed the url for wp-login.php from < to <
function access_granted(){
global $pagenow;
if(!isset($_GET['action']) && 'wp-login.php' == $pagenow ) {
wp_redirect('
exit();
}
}
My question is, is there a way to check the url only when it contains "here" and make sure it contains "action" or else be redirected back home using php?
the reason that makes this difficult, is that i have this in the functions.php file as i do not want to edit core wp files.
|
You can check `$_SERVER['REQUEST_URI']` to determine the current URI.
Note: Don't rely on entries in `$_SERVER` being there if your script should be runnable from the command line.
Source: <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "php, wordpress, redirect"
}
|
Replicate Log10 Scaling with Matplotlib
I'm trying to recreate a plot that has the y-axis styled as so:
, label=key)
# plot points
exp_group = exp_data.groupby('Experiment')
for key, group in exp_group:
plt.plot(group.x, np.log10(group.y), label=key, marker='o')
plt.yticks(np.arange(-3, 3), label=10.0**np.arange(-3,3))
plt.show()

y = np.exp(x) - x**3 + x**2 - x**(1/2)
plt.figure()
plt.semilogy(x, y)
locs, labels = plt.yticks()
print(locs)
print(labels)
lst_10 = [1, 10, 100, 1000, 10000]
plt.yticks(lst_10, lst_10)
plt.title('Different label on y-axis')
plt.figure()
plt.semilogy(x, y)
plt.title('Default label')
plt.show()
The function `plt.yticks` takes two arguments, the locations and the labels. I want the labels in the locations 1, 10, 100, 1000, 10000; I want the label (in location 1) to have a label `1`, the label (in localtion 10) to have a label `10`, and so on. I have also used `plt.semilogy` to get that semi-log axis.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "python, matplotlib"
}
|
Accessible way of hiding an element until jQuery's $(document).ready()?
I have a large survey that I have made more usable with jQuery by arranging it into sections and using an accordian menu to flip through each section.
The trouble is, there is a noticable snap when `$(document).ready()` fires and condenses everything into an accordian menu. That is to say that before `$(document).ready()`, you can see the whole survey.
I did consider setting `#surveyForm` to `display: none;` in css and `#surveyForm.active` to `display: block;` but that creates a new problem:
Browsers without javascript enabled will never get to see #surveyForm.active and so they won't be able to use the survey.
Any ideas?
Cheers
-Iain
|
This is the progressive enhancement solution I use for situations like this.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 5,
"tags": "javascript, jquery, css, usability, accessibility"
}
|
How to properly add IO to attoparsec Parser?
I want to do some tracing/debugging in my attoparsec parser. Here's minimal [not] working example:
import Data.Text as T
import Data.Attoparsec.Text
import Data.Attoparsec.Combinator
import Control.Applicative ((<*), (*>))
parseSentences :: Parser [T.Text]
parseSentences = many1 $ takeWhile1 (/= '.') <* char '.' <* skipSpace
parser :: Parser [T.Text]
parser = do
stuff <- parseSentences
-- putStrLn $ "Got stuff: " ++ show stuff
tail <- takeText
-- putStrLn $ "Got tail: " ++ show tail
return $ stuff ++ [tail, T.pack "more stuff"]
main = do
let input = T.pack "sample. example. bang"
print $ parseOnly parser input
What i have to do in order to use IO actions in my parser?
|
If you had used the Parsec library, you would have had the possibility of using the Parsec monad transformer for mixing IO and parser commands in your code.
Attoparsec, however, is a pure parser, so you will have to use the `Debug.Trace.trace` function to output messages to the terminal for debugging purposes.
parser = do
stuff <- parseSentences
tail <- takeText
return .
trace ("Got stuff: " + show stuff) .
trace ("Got tail: " + show tail) $
stuff ++ [tail, T.pack "more stuff"]
The messages will be printed when the associated value (here the result of the expression `stuff ++ ...`) is evaluated.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "haskell, io, monads, monad transformers, attoparsec"
}
|
what is static method why use this in Display class in java
i am always use static keyword but don't know clearly what is main purpose of static keyword. can any define , this is use in java Display method in oop
|
Static methods are those methods can be called without creating its object. It can be invoked using its class name.
Eg. Math.sqrt(25);
Where Math is the class name, not an object and static methods can access only static properties of the class.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -6,
"tags": "java"
}
|
Unable to see .NET Users in IIS in .NET 4
I have converted my web from 3.5 to 4.0 and now in the IIS - my membership management is gone (.NET USERS), where can I Manage them?
Thanks!
|
It might be same problem as described here. Basically IIS does not (yet) support management of users and roles if you set the application pool to .NET 4. You have to switch to a .NET 2.0 application pool and disable the targetframework 4.0 attribute in your web.config to manage users. After you are done with user management in IIS you can return to 4.0 pool and target framework settings.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 7,
"tags": "c#, .net, asp.net, iis, asp.net membership"
}
|
How to draw parallel lines using an arc
Does anybody know how to draw the right vertical line parallel to the left vertical line?
**CODE:**
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[step=1ex,black!10,thin] (-4ex,-20ex) grid (15ex,50ex);
\draw (0ex,0ex) arc [start angle=135, end angle=405, radius=6ex] -- (7ex,50ex) -- (0ex,50ex) -- (0ex,0ex);
\end{tikzpicture}
\end{document}
**OUTPUT:**
 grid ++ (16ex,64ex);
%
\draw (0,0) arc [start angle=135, end angle=405, radius=6ex] -- ++ (0,50ex) -| cycle;
\end{tikzpicture}
\end{document}
,g(x) be complex polynomials, if f(x) | g(x) and g(x) | f(x) then..
Let $f(x), g(x)$ be complex polynomials. If $f(x) | g(x)$ and $g(x) | f(x)$ then there exists a non-zero complex number $a$ such that $f(x) = ag(x)$.
Im not sure if what I did is correct;
I said if $f(x) | g(x)$ and $g(x) | f(x)$, then both $f(x)$ and $g(x)$ are non-zero polynomials
So by the division algorithm for polynomials, $f(x) = q1(x)g(x)$ where polynomial $q_1(x)$ does not equal zero.
And also, $g(x) = q_2(x)f(x)$ where $q_2(x)$ does not equal zero.
This means, $f(x) = q_2(x)q_1(x)g(x)$, so $q_2(x)q_1(x) = a$ (complex)
I don't think this is sufficient...
|
Be careful: I think you meant to write $f(x) = q_2(x)q_1(x)\underline{\underline{f(x)}}$. Now consider the degree of both of these polynomials; what is $\deg q_1$? Why is $q_1(x)$ non-zero?
(There is also a stupid case to deal with when $f(x) = g(x) = 0$, and you have a choice of $q_1$ and $q_2$. Choose wisely.)
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "polynomials"
}
|
Does speculation hurt bitcoin?
> **Related Question** : Does hoarding really hurt Bitcoin
Does speculation hurt bitcoin? I often hear people complain that speculation is destroying Bitcoin, or that Bitcoin will fail because of speculation. Is there any merit to this criticism of Bitcoin? And in particular, is the idea that speculation is hurting Bitcoin any different then the idea that hoarding is hurting Bitcoin?
|
It's worth noting that bitcoins would have no value if it weren't for speculation. When Satoshi first released the client, those who put their electricity and computing resources towards mining bitcoins were speculating that the value would rise from zero, and that the coins would be accepted as payment by someone else. Those who first accepted bitcoin payments, likewise, were speculating that the value would remain above zero, and continue to be accepted by others, and so on.
It's also worth noting that Bitcoin would likely not have received the amount of attention that it has if not for people speculating that the value would rise tremendously and buying coins in large quantities. This attention has brought in more users, developers, and businesses, thus increasing the health of Bitcoin.
If speculation does hurt Bitcoin in some ways, it's at the very worst a necessary evil.
|
stackexchange-bitcoin
|
{
"answer_score": 12,
"question_score": 13,
"tags": "economic theory, speculation"
}
|
How to express the range $y=(-\infty,-1)\cup(0,\infty)$ with set builder notation?
I am trying to express the range and domain of a function with set builder notation. The domain is easy to express because it's just $\\{x:x\in\mathbb{R}\backslash\\{-1\\}\\}$, but the range is $y=(-\infty,-1)\cup(0,\infty)$ and I'm not sure how to express that $y$ is all real numbers outside of $[-1,0]$.
|
Use inequalities or the "different" sign. For instance the domain could be $\\{x\in \mathbb R : x\neq 1\\}$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "notation"
}
|
arduino's pin number 7, isn't it dangerous without resistor?
I am reading a book called _Getting started with Arduino._ In that book, I don't understand why there is no resistor between pin number 7 and the switch (see diagram:)
!Arduino-breadboard diagram
If there is no resistor between power source and ground, wouldn't it be prone to short-circuit and cause damage? Does pin 7 contain a built-in resistor or something?
|
Your hypothesis is correct: in input mode, the pins have very high impedance, somewhere along the range of 10s of mega ohms. So there will be little current flowing into pin 7, and it is OK to use it as is. Note that pin 7 is NOT ground so there is no short circuit between power source and ground.
When you press the switch, current will flow primarily through the resistor. The voltage will rise and will be seen by pin 7 as a digital high.
|
stackexchange-electronics
|
{
"answer_score": 8,
"question_score": 4,
"tags": "arduino, ground, short circuit"
}
|
Error in macro expansion
I have been trying to understand macro expansion and found out that the second printf gives out an error. I am expecting the second print statement to generate the same output as the first one. I know there are functions to do string concatenation. I am finding it difficult to understand why first print statement works and the second doesn't.
#define CAT(str1, str2) str1 str2
void main()
{
char *string_1 = "s1", *string_2 = "s2";
printf(CAT("s1", "s2"));
printf(CAT(string_1, string_2));
}
|
Try to do the preprocessing "by hand":
`CAT` is supposed to take 2 input variables, and print them one after the other, with a space between. So... if we preprocess your code, it becomes:
void main()
{
char *string_1 = "s1", *string_2 = "s2";
printf("s1" "s2");
printf(string_1 string_2);
}
While `"s1" "s2"` is automatically concatenated to `"s1s2"` by the **compiler** , `string_1 string_2` is invalid syntax.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 4,
"tags": "c, c preprocessor"
}
|
Can someone tell me what is wrong with my code here?
strSql = "Select columnname from tbl where ID = '" & ViewState("v_INID") & "'"
v_ObjDs = v_ObjBREngine.FetchSqlDS(strSql)
name = v_ObjDs.Tables(0).Rows(0).Item(0)
ImageFrame.Attributes.Add("src", "..Drawings/folder/Drawings" + name)
DrawingName = Server.MapPath("~/Drawings/folder/Drawings/" & name)
If Not File.Exists(DrawingName) Then
name = "NoImageFound.jpg"
ImageFrame.Attributes.Add("src", "Images/" + name)
End If
Tell me what is wrong with my code. When I debug this piece of code, then `DrawingName` has an address. I just want to know that `imageFrame` syntax is correct or not.
|
System.IO.Path.GetFileName(DrawingName);
or
System.IO.Path.GetFileName(DrawingName);
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "asp.net, vb.net"
}
|
how to change the Dojo GlossyCircularGauge text indicator position?
I want to move the **text indicator to little down** , am able to change the color and change the size of it but not the position. Below is my code.
require(['dojox/gauges/GlossyCircularGauge','dojo/aspect', 'drawGreenYellowRedCurves', 'dojo/domReady!'], function (GlossyCircularGauge, aspect, drawGreenYellowRedCurves) {
var gauge = new GlossyCircularGauge({
background: [255, 255, 255, 0],
title: 'Value',
id: "glossyGauge",
width: 300,
height: 300
}, dojo.byId("CircularGauge"));
gauge.set('textIndicatorFont','normal small-caps bold 22pt Arial');
gauge.set('textIndicatorColor','#FFFFF');
aspect.after(gauge, "drawRange", drawGreenYellowRedCurves, true);
gauge.startup();
});
for reference <
|
you can change the value of the internal attribute _designTextIndicatorY to update the text indicator position. Default value is 267.81589, but you can use a greater value to lower down the position of the text indicator.
Example:
require(['dojox/gauges/GlossyCircularGauge','dojo/aspect', 'drawGreenYellowRedCurves', 'dojo/domReady!'], function (GlossyCircularGauge, aspect, drawGreenYellowRedCurves) {
var gauge = new GlossyCircularGauge({
background: [255, 255, 255, 0],
title: 'Value',
id: "glossyGauge",
width: 300,
height: 300,
_designTextIndicatorY: 317.81589
}, dojo.byId("CircularGauge"));
gauge.set('textIndicatorFont','normal small-caps bold 22pt Arial');
gauge.set('textIndicatorColor','#FFFFF');
aspect.after(gauge, "drawRange", drawGreenYellowRedCurves, true);
gauge.startup();
});
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, charts, dojo, gauge"
}
|
Use XML Literals in C#?
Is it possible to add literal XML data within a C# code file? I'm currently using a multiline string literal but it gets messy as you can see. Any better way of doing this?
string XML = @"<?xml version=""1.0"" encoding=""utf-8""?>
<customUI xmlns=""
<toolbar id=""save"">
</toolbar>
</customUI>";
|
XML literals are a feature of VB.NET, not C#.
What you have posted is as close as you can get in C#.
You may want to consider replacing the embedded double quotes with single quotes though (as both types are valid XML).
For larger amounts of XML you may want to consider the answer from Marc - using an XML file (loaded once and stored in memory), so you can take advantage of the XML editor.
|
stackexchange-stackoverflow
|
{
"answer_score": 38,
"question_score": 35,
"tags": "c#, xml, literals"
}
|
Rigorous numerical integration
I need to evaluate some (one-variable) integrals that neither SAGE nor Mathematica can do symbolically. As far as I can tell, I have two options:
(a) Use GSL (via SAGE), Maxima or Mathematica to do numerical integration. This is really a non-option, since, if I understand correctly, the "error bound" they give is not really a guarantee.
(b) Cobble together my own programs using the trapezoidal rule, Simpson's rule, etc., and get rigorous error bounds using bounds I have for the second (or fourth, or what have you) derivative of the function I am integrating. This is what I have been doing.
Is there a third option? Is there standard software that does (b) for me?
|
Interval arithmetic methods will permit rigorous bounds. You might try INTLAB. There are various books on rigorous numerics, e.g., Warwick Tucker's _Validated Numerics_, and the journal _Reliable Computing_ is dedicated to such things.
|
stackexchange-mathoverflow_net_7z
|
{
"answer_score": 8,
"question_score": 13,
"tags": "na.numerical analysis"
}
|
'firstyearpop' for `pop.sim` in `demography` package
I'm using R `demography` package to study Mauritian population. However, I'm having some problem with `pop.sim` function as I can't figure out how the mid year population must be entered? Can anyone give me an example please?
|
The help file is rather brief (sorry about that). The first year population should be part of a `demogdata` object. The example at the end of the help page on `pop.sim` should help. It requires the `addb` package which is available from <
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "r, simulation, population"
}
|
shuffling images in a table
I am trying to shuffle the table of image and I also want to store the co ordinates for those images how can i do that? Is there any other way to do that? The one that I have done is this
local alpha = {{"alpha_a"} , {"alpha_b"} , {"alpha_c"} , {"alpha_d"} ,
{"alpha_e"} , {"alpha_f"} , {"alpha_g"} , {"alpha_h"}}
local coordinates ={{x=092, y=470}, {x=197, y=470}, {x=302, y=470},
{x=407, y=470}, {x=512, y=470}, {x=617, y=470} }
for i=1, #alpha do
local selection = table.remove(coordinates, math.random(#coordinates))
print(selection.x,selection.y, #coordinates)
images = display.newImage(alpha[i][1]..".png")
images.x = selection.x
images.y = selection.y
images:addEventListener("touch",swapping)
end
|
It's not entirely clear what you are trying to achieve, but I guess it might be keeping the image together with its own coordinates.
I think the logical approach to accomplishing this is reconsidering your data structure, and putting the coordinates and names into the same table like
local alpha = {{"alpha_a",x=092, y=470} , {"alpha_b",x=197, y=470} , {"alpha_c",x=302, y=470} , {"alpha_d",x=407, y=470} , {"alpha_e",x=512, y=470}} --...
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "lua, coronasdk"
}
|
NodeJS spawn stdout string format
I'm spawning a process in node and tracking the output of the command like this:
proc.stdout.on("data", function (data) {
console.log(data.toString());
});
It works well, however, the output seems to be splitting the lines:
npm http
304
The above is just one line out of the response from an `npm install`. Typically this is all in one line, it's also adding line breaks before and after the response. Is there a way to get the data output to look like the standard run, i.e. line-by-line?
|
Streams are buffered and emit `data` events whenever they please (so to speak), not on strict boundaries like lines of text.
But you can use the `readline` module to parse the buffers into lines for you:
var child_process = require('child_process');
var readline = require('readline');
var proc = child_process.spawn(...);
readline.createInterface({
input : proc.stdout,
terminal : false
}).on('line', function(line) {
console.log(line);
});
|
stackexchange-stackoverflow
|
{
"answer_score": 27,
"question_score": 17,
"tags": "node.js, stdout, spawn"
}
|
C# in vedio game industry?
Other than Indie game development, C# is also used for in house tool development at large studios.
I have two questions -:
1) Is microsoft planning to release a native C# compiler sharing the backend code generator with the C++ compiler? <
2) If microsoft IS planning a native C# compiler, then can C# replace C++ as the industry standard in AAA vedio games?
|
1) Who knows?
2) Even if they do release such a thing (unlikely), it still would generate far less efficient code than pure C++, because it includes many safeguards, generalizations, etc. you can't just optimize out, because code might depend on them. Also you most likely wouldn't gain any significant performance boost, because what you describe is essentially what is done at runtime anyway (to some extend).
|
stackexchange-gamedev
|
{
"answer_score": 0,
"question_score": -5,
"tags": "c++, c#"
}
|
add roles to user (Windows authentication)
I have two folders in my web application, the first one is for normal_user and the second one is for administrator, to secure them I created two roles in asp.net configuration , everything is okay, but the problem is that I wanna authenticate my user with Windows authentication not Forms authentication, What i'm supposed to do ?
|
Listing 1: Denying all users through the web.config file.. Declaring your mode to windows:
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="*" />
</authorization>
</system.web>
In the link below scroll down too : "Authenticating and Authorizing a Group:
Based off of my book, explains all 4 kinds:
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "c#, asp.net, iis, iis 7"
}
|
How do I make this code case-insensitive?
How do I make this code case.insensitive? Suggestions?
def not3(string2, string1):
if len(string2) < 3: return True
if string2[:3] in string1: return False
return not3(string2[1:], string1)
|
Lowercase the `in` operands:
if string2[:3].lower() in string1.lower(): return False
The `len()` test is not influenced by case.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -3,
"tags": "python, string, case insensitive"
}
|
Clojure namespacing converting - to _
The error as shown on the Noir error page: `java.io.FileNotFoundException: Could not locate boundaries/lat_long__init.class or boundaries/lat_long.clj on class path`
The code that requires it:
(ns boundaries.views.boundary
(:use noir.core
hiccup.core
hiccup.page-helpers)
(:require
[boundaries.lat-long :as lat-long]
[noir.response :as resp]))
Why is it looking for `lat_long` instead of the specified `lat-long`? boundaries/lat-long.clj exists as well as the corresponding boundaries.lat-long namespace.
|
the JVM does not allow `-`s in class names so the Clojure compiler converts them to `_`s
the problem is most likely with the project.clj dependencies.
When diagnosing this sort of issue:
* is the namespace available from the REPL?
* does the .class file appear in the lib directory for the project?
* re-run `lein deps`
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "clojure, noir"
}
|
Make feature layer managment
I have a feature class that includes 49 points (records). I want to select specified FID that I've mentioned before for example `my_fid = (0,1,3,4,5,6,7,8,12,45)`. so I want to select this fid with ArcPy and using the Make Feature Class. How can I define a variable to use IN operator for where clause.
|
I usually use AddFieldDelimiters and format:
import arcpy
arcpy.env.workspace = r'C:\GIS\ArcMap_default_folder\Default.gdb'
feature_class = 'ak_riks'
field_to_select_by = 'OBJECTID'
sql = "{0} IN (132, 254)".format(arcpy.AddFieldDelimiters(datasource=feature_class, field=field_to_select_by))
arcpy.MakeFeatureLayer_management(in_features=feature_class, out_layer='selected', where_clause=sql)
#If you want to create a new feature class
arcpy.SelectData_management(in_dataelement=feature_class, out_dataelement='ak_riks_subset')
|
stackexchange-gis
|
{
"answer_score": 1,
"question_score": 1,
"tags": "arcpy, sql, select by attribute"
}
|
I have a csv file whose contents is like as the following. How I can convert it to collection of List<string> dynamically?
This csv file has lots of rows but all the rows doesn't have the equal number of values.
|
I would use the string split method. <
Suppose you read your csv file into a string, you can split the string on line breaks into multiple strings. You'll create a new list for each new line string. You'll split each line on whatever you have for your delimiter, then add those values to your list.
Edit: here is a similar question How to split() a delimited string to a List<String>
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "c#, asp.net, csv, webforms"
}
|
extracting hashtags from tweets
I am trying to perform sentiment analysis and facing a small problem. I am using a dictionary which has hashtags and some other junk value(shown below). It also has associated weight of the hashtag. I want to extract only the hashtags and its corresponding weight into a new data frame. Is there any easy way to do it? I have tried using regmatches, but some how its giving output in list format and is messing things up. Input:
V1 V2
1 #fabulous 7.526
2 #excellent 7.247
3 superb 7.199
4 #perfection 7.099
5 #terrific 6.922
6 #magnificent 6.672
Output:
V1 V2
1 #fabulous 7.526
2 #excellent 7.247
3 #perfection 7.099
4 #terrific 6.922
5 #magnificent 6.672
|
This code should work and will give you desired output as data.frame
Input<- data.frame(V1 = c("#fabulous","#excellent","superb","#perfection","#terrific","#magnificent"), V2 = c("7.526", "7.247" , "7.199", "7.099", "6.922", "6.672"))
extractHashtags <- Input[which(substr(Input$V1,1,1) == "#"),]
View(extractHashtags)
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 3,
"tags": "r, statistics, analytics, hashtag, sentiment analysis"
}
|
Mnesia deletion error
I am using mnesia table.This table has two attributes(primary key and its value). Now i am trying delete a tuple from mnesia table.I am using delete/1 function of mnesia for deletion purpose.This function takes table name and key corresponding to tuple fro which deletion has to be made.My problem is how can i handle the scenrio when tuple corresponding to passed key is not present.This delete function gives {atomic,ok} every time?
|
For your case you have to read the record first and delete it only after that. To prevent an access to the record from other transactions between 'read' and 'delete' operations use 'write' lock kind when you are reading the record. It gives your transaction an exclusive access to it:
delete_record(Table, Key) ->
F = fun () ->
case mnesia:read(Table, Key, write) of
[Record] ->
mnesia:delete({Table, Key}),
{ok, Record};
[] ->
mnesia:abort(not_exist)
end
end,
mnesia:transaction(F).
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "erlang, ejabberd, mnesia"
}
|
Combining spatial input with a label as input for CNN using Keras
I also asked this question on Stack Overflow. However, it has not yet been answered and I think this is a more suitable platform to place it.
I'm trying to implement a network set-up similar to this Google Deepmind paper. Their network set-up is as follows:
 and corresponding frame ($f_i$) are not concatenated. $v_i$ is simply an index of $f_i$. As mentioned in their section 3.1, $v_i$ is the timestamp and $f_i$ is the actual frame (image). The convolution network $M_\theta$ is applied on $f_i$, not $v_i$.
After the convolution network $M_\theta$, the output of different frames $r_i$ are added together (notice the "+" in the figure, as well as the equation $r=r_1+...+r_m$ in section 3.2.
|
stackexchange-datascience
|
{
"answer_score": 4,
"question_score": 5,
"tags": "cnn"
}
|
Connecting to secure WebDAV makes Nautilus hang up
I just received a box.com account from my school and, since Box Sync does not exist for Linux, I instead tried using the WebDAV service box.com offers.
I tried the Nautilus:`File`->`Connect to Server...` way. The connection works; I can access the files on the Box server.
However, from the moment I connect to the server, Nautilus takes ages to process any user input, both in and out of the WebDAV connection. As soon as I disconnect from the WebDAV server, it's working again.
Any ideas on how to fix this?
|
I now use the davfs2 aproach, as shown here. Now I have to mount/unmount the WebDAV folder via a terminal, but everything works.
|
stackexchange-askubuntu
|
{
"answer_score": 2,
"question_score": 2,
"tags": "nautilus, webdav"
}
|
base64 decoded image from captureVisibleTab. How to save it via GD library to jpg ot png?
I have this code which send an image to test.php:
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.captureVisibleTab(null, function(img) {
$.ajax({
type: "POST",
url: "
data: "img=" + img,
success: function(e){
alert(e);
}});
});
});
The img is base64 (data:image/jpeg;base64,/9j/4AAQSkZ...). I have this script in test.php
<?php
if (isset($_POST['img'])) {
$img = $_POST['img'];
$data = base64_decode($img);
$im = imagecreatefromstring($data);
imagejpeg($im, 'simpletext.jpg');
imagedestroy($im);
}
?>
And as the result I get this message
> the data is not in a recognised format
What's wrong?
|
As you stated the image looks like this: `data:image/jpeg;base64,…`
So you should strip the first part of this Data-URL, then write it directly to a file:
$comma = strpos($img, ',');
$data = base64_decode(substr($img, $comma+1));
file_put_contents("simpletext.jpg", $data);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "php, gd"
}
|
Why `--array.length` delete the last element of the array?
In javascript, chrome console:
var test = [0, 1, 2, 3, 4]
> undefined
var lastIdx = --test.length
> undefined
lastIdx
> 4
test
> [0, 1, 2, 3]
var lastIdx = --(test.length)
> undefined
lastIdx
> 3
test
> [0, 1, 2]
As you already saw, I just want to get the last index of the array through the `--array.length`, but unfortunately the last element of the array get removed unexpectedly, really cannot understand how come this can/should happen, can someone explain?
|
`--x` decrements `x` and returns the new value. (`x--` decrements `x` and returns the old value.) So `--test.length` reduces the length by 1.
If you just want to get last index without modifying the length, that would be `test.length - 1`.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "javascript"
}
|
Include additional Packages
> **Possible Duplicate:**
> Where do I place my own .sty files, to make them available to all my .tex files?
How to include additional packages like for glossary, font, etc… in LaTeX?
I am using XeLaTeX.
How to install additional packages and how to include them (after we got installed) in you document?
|
I am wondering if what you are looking for is `\usepackage`? If you read any LaTeX tutorial, you will find it.
|
stackexchange-tex
|
{
"answer_score": 6,
"question_score": -1,
"tags": "xetex, packages, installing"
}
|
funções estão a dar conflito e não estão a funcionar
Tenho que ordenar 4 palavras por ordem alfabética e por ordem reversa.
As minhas funções estão da dar conflito mas quando retiro uma a outra já funciona e vice versa.
const name = document.querySelector(".name");
function ordena() {
var alf = ['Ana', 'Aida', 'Mário' , 'Daniela'];
alf.sort();
console.log(alf);
alert(alf);
}
const name = document.querySelector(".name");
function reverse() {
var alf = ['Ana', 'Aida', 'Mário' , 'Daniela'];
alf.reverse();
console.log(alf);
alert(alf);
}
<button onclick="ordena()">Ordem alfabética</button>
<button onclick="reverse()">Reversa Ordem alfabética </button>
|
O problema é que o JavaScript está detectando a declaração das variáveis **const name** e **var alf** duas vezes.
Você poderia simplificar o código:
1. Retirando os pontos e vírgula.
2. Declarando o array **alf** com escopo global.
3. Retirando a const name pois não está sendo utilizada nas funções.
Ex:
//const name = document.querySelector(".name")
var alf = ['Ana', 'Aida', 'Mário', 'Daniela']
function ordena() {
alf.sort()
console.log(alf)
alert(alf)
}
function reverse() {
alf.reverse()
console.log(alf)
alert(alf)
}
<button onclick="ordena()">Ordem alfabética</button>
<button onclick="reverse()">Ordem alfabética Reversa</button>
|
stackexchange-pt_stackoverflow
|
{
"answer_score": 0,
"question_score": -3,
"tags": "javascript, html"
}
|
Complex COUTIF?
:
01/07/2017 - 02/07/2017; 03/07/2017 - 09/07/2017; 10/07/2017 - 16/07/2017;
I am thinking of using COUNIF(a range, "N"). But I don't know how to set the range so that it can look up the value in column B based on the above user input so that the formula can search the value in column B within the range and count the number of N in column H
|
Start date and end date of the time frame need to go in separate cells. If you put them all in one cell it makes the matter unnecessarily complicated.
=SUMPRODUCT(--($B$2:$B$17>=StartDate),--($B$2:$B$17<=EndDate),--($H$2:$H$17="N"))

=COUNTIFS($B$2:$B$17,">="&StartDate,$B$2:$B$17,"<="&EndDate,$H$2:$H$17,"N")
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "excel, excel formula"
}
|
Why do ANOVA contrast tests use N - k degrees of freedom?
I would have thought that the degrees of freedom would be the same as a regular t-test, i.e. N - 1, since in a contrast we are either comparing two groups, or two sets of groups. Why do we instead use the within SS degrees of freedom (N - k)?
Here are some example SPSS tables from <
!enter image description here !enter image description here
|
Degrees of freedom in these situations are based off the number of degrees of freedom in the error term (to estimate the standard error of the noise term). These are based on residuals, for which $N$ observations have been used to estimate $k$ means, each one costing one degree of freedom.
That means that there are $N-k$ d.f. in the error term which is used for the comparisons in the contrasts.
|
stackexchange-stats
|
{
"answer_score": 3,
"question_score": 1,
"tags": "anova, degrees of freedom"
}
|
Use the same cell for table view and collection view
So I have a few collection views that use the same cell (which basically looks like table view but for my purposes, I need to use the collection view). In the newest feature I am using tableView and cell for it looks the same, so is there a way to use the same cell for that view too?
|
Simply, no. A TableViewCell is of type `UITableViewCell` which is very different from `UICollectionViewCell`.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "swift, uitableview, uicollectionview, uikit"
}
|
cephes math library build error
I'm using 64-bit Ubuntu 14.04. I tried to install cephes library, but I'm consistently getting an error. It says:
`sqrtelf.387:8: Error: invalid instruction suffix for push
I have looked around the web and also checked this forum and figured out, it has probably something to do with wrong compiling settings. I edited make file and it looks like this now:
CC = gcc
CFLAGS = -g -m32 -O2 -Wall -fno-builtin
LDFLAGS = -m32
AR = ar
RANLIB = ranlib
INCS = mconf.h
AS = as
It still does not work. I also checked mconf.h, but I don't even know what should I change. Thanks for help.
I got the source file here (double.zip)
|
Error says problematic instruction is in file `sqrtelf.387` at line 8. That is
pushl %ebp
Most likely you have 64bit toolchain; `pushl` isn't available in 64bit mode. However if you're not and you want 32 bit version, you could add `--32` to `as` flags.
To work this around you should comment out this target in makefile; in theory you could uncomment `sqrtelf.amd64` target instead, but benefits are questionable. Look for comment in makefile:
# Assembly language utilities.
# If the following are all commented out, the C versions
# will be used by default.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "gcc, makefile, flags"
}
|
Variance of $X^2$ if $X \sim \mathcal{N}(0,1)$?
I'm trying to find the variance of $X^2$, considering that $X$ is distributed as a standard normal $(X \sim \mathcal{N}(0,1))$.
I can find that $E(X^2)=1$, by using that $\sigma^2(X)=E(X^2)-(E(X))^2=1$, but I'm stuck trying to find the variance.
|
The comment posted by angryavian is the way to go. I'll give you a few more details. We know that $\sigma^2(X)=E(X^2)-E(X)^2$, so by extension, $\sigma^2(X^2)=E(X^4)-E(X^2)^2$. Now for a standard normal distribution, we know that $E(X^2)=\sigma^2(X)=1$, so we must just find the value of $E(X^4)$. By definition,
$$E(X^4)=\left(\int_{-\infty}^{\infty} x^4e^{-x^2/2} dx \right)/\sqrt{2 \pi}$$
(The $\sqrt{2 \pi}$ in the denominator comes from the function for the standard normal distribution.) Using $u=x^3$ and $dv=xe^{\frac{-x^2}{2}} dx$, we just have to integrate a couple times and use the well-known fact:
$$\sqrt{\pi}=\int_{-\infty}^{\infty} e^{-x^2} dx$$
Carrying this out, we will see that $E(X^4)=3$ and therefore $\sigma^2(X^2)=E(X^4)-E(X^2)^2=2$. You can further show that $E(X^{2n})=(2n-1)!!$, where the double factorial function is the product of the integers less than or equal to a number of the same parity. For example, $5!!=(5)(3)(1)=15$ and $6!!=(6)(4)(2)=48$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "random variables, variance"
}
|
Confusion with Closure in javascript
I have this code.
<body>
<p>Counting with a local variable.</p>
<button type="button" onclick="myFunction()">Count!</button>
<p id="demo">0</p>
<script>
var add = (function () {
var counter = 0;
return function () {return counter += 1;}
})();
function myFunction(){
document.getElementById("demo").innerHTML = add();
}
</script>
</body>
> The variable add is assigned the return value of a self invoking function.
Does this mean, every time add is called,only return of function is invoked not the whole function ?
If not,Can anyone please explain it?
|
Yes, only the returned function inside the IIFE is called when the `add()` function is called.
The IIFE is called on pageload ~~when the parser encounters it~~ during the execution phase, and returns the other function as a reference to be called later.
The only thing the outer IIFE is doing is keeping the `counter` variable inside it's own scope.
IIFE == Immediately-invoked function expression
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "javascript"
}
|
How to replace value of wysiwyg textarea with jQuery?
I use a textarea with a wysiwyg class used from Simpla Admin from Themeforest (I don't know if this last is relevant).
<textarea name="message" id="targetText" class="wysiwyg">Hello</textarea>
I want to change "Hello" with "Test" with jQuery using:
$("#message").html("Test")
But now the whole wysiwyg object completely disappears and I see only "Test".
What can I do to keep the wysiwyg editor and get inside this editor the value "Test"?
|
Since I don't have the WYSIWYG tool you are using so I cannot tell exactly, but I can tell you how to find !
You are probably using a javascript plugin that transform a textarea with the `.wysiwyg` class and transform it so it appends the widget in it.
To find the real element that has your HTML content (that you want to change with your wysiwyg), use the Google Chrome Dev Tool by pressing F12 (or any dev Tool) and explore the HTML document to find what element is "really" containing the HTML content. And then, you can change the HTML directly like you did in your example, but with the right selector !
Hope it helped !
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery, textarea, wysiwyg"
}
|
how to sort number to desired in c#?
for each element that their difference with former is less than three, order them in descending
numbers = {1,2,3,4,5,6,13,18,25,30,31,32,33}
desired = {6,5,4,3,2,1,13,18,25,33,32,31,30}
for example in numbers list ,Because difference between 6 and 5 is less than 3 sort them in descending
|
You can use LINQ:
var numbers = new int[] { 1, 2, 3, 4, 5, 6, 13, 18, 25, 30, 31, 32, 33 };
var result = numbers.GroupAdjacent((x, y) => y - x < 3)
.SelectMany(g => g.OrderByDescending(x => x))
.ToArray();
// result == { 6, 5, 4, 3, 2, 1, 13, 18, 25, 33, 32, 31, 30 }
with
static IEnumerable<IEnumerable<T>> GroupAdjacent<T>(
this IEnumerable<T> source, Func<T, T, bool> adjacent)
{
var g = new List<T>();
foreach (var x in source)
{
if (g.Count != 0 && !adjacent(g.Last(), x))
{
yield return g;
g = new List<T>();
}
g.Add(x);
}
yield return g;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "c#, sorting"
}
|
wpf how do I ensure that a line i draw isn't aliased away?
Correct me if I'm wrong, but I believe that if I draw a line in WPF and it is small enough, then the line will be aliased out. Also if a line is not drawn on a pixel then it may become dimmer. I assume that if a line is < 1 pixel wide it will also be dimmed by averaging the colors that are in that spot.
My goal is to draw a graph of a bunch of signals without having the lines I draw disappear or become dimmed to the point the user might not notice them.
Questions: if I draw a line with a width of 1 device independent pixels, is it guaranteed to be at least one pixel wide? if not, is there any way to ensure that a line is at least one pixel wide?
|
You have to speficy
> SnapsToDevicePixels="True"
in the header of your XAML
ex:
<Window
xmlns="
xmlns:x="
xmlns:d="
xmlns:mc="
SnapsToDevicePixels="True">
You can see the way it changes the line in this link
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "c#, wpf"
}
|
Regular Expression for finding numbers of this format num:num:num:num
I know this is basic, but I am not sure, where I am going wrong and never wrote regular expression before..
I need to grep some output out of a command
cmd | grep '[0-9]+:[0-9]+:[0-9]+:[0-9]+'
I need to grep some information of the format
dummy dummy 4:9:93:022 dummy
How do I do that? Please let me know where I am going wrong.....
Output will be of format
`-+- policy='round-robin 0' prio=2 status=active
|- 6:0:0:136 sdip 135:144 active ready running
`- 5:0:0:136 sdle 67:448 active ready running
I need to remove it only based on that 6:0:0:136....
|
The plus modifier is part of the "extended regular expression" syntax. This:
a+
means "one or more 'a' characters" and is shorthand for this basic expression:
aa*
Traditionally `grep` supports basic regular expressions and `egrep` supports the extended syntax. So do this:
cmd | egrep '[0-9]+:[0-9]+:[0-9]+:[0-9]+'
or this (which is the same thing):
cmd | grep -E '[0-9]+:[0-9]+:[0-9]+:[0-9]+'
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "regex, linux, bash, shell"
}
|
Open email app programmatically in android for new update
How can I open a device `email` to send an `email` on the new update of android? it's showing a list of applications with support `text/message/html/plain` with the following code?
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{context.getString("email_to")});
intent.putExtra(Intent.EXTRA_SUBJECT, context.getString("email_subject"));
context.startActivity(Intent.createChooser(intent, context.getString("email_body")));
|
I have found the following code to open the email app programmatically use the following code. I hope this may solve your problem.
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("mailto:"+"email_to"));
intent.putExtra(Intent.EXTRA_SUBJECT, "email_subject");
intent.putExtra(Intent.EXTRA_TEXT, "email_body");
startActivity(intent);
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "android, email"
}
|
What's a weapon mount?
I just found a plasma cannon, and in its description there's a "mount" entry:
!plasma cannon with "mount" circled
What does it mean?
|
The Brawler PBA is an armor suit. You need the Brawler PBA to actually use the plasma cannon.
|
stackexchange-gaming
|
{
"answer_score": 7,
"question_score": 8,
"tags": "sword of the stars the pit"
}
|
A normal subgroup of the commutator subgroup (G,G) is normal in G
I know from here that any normal subgroup $K$ of a normal subgroup $H$ in a group $G$ is not necessarily normal in $G$. But I was wondering if this is true in the following case:
Let $G$ be a group. Let $H$ be a normal subgroup of the commutator subgroup $(G,G)$. Is $H$ a normal subgroup of $G$ ?
Thanks in advance for your enlightenment?
K. Y.
|
Consider $G=A_4$, the alternating group of order $12$. Its derived subgroup is $V_4$, the unique Sylow $2$-subgroup of $A_4$. As $V_4$ is Abelian, any of its $2$-element subgroups $H$ is normal in $V_4$, say $H=\left<(1\,2)(3\,4)\right>$. But $H$ is not normal in $A_4$.
|
stackexchange-math
|
{
"answer_score": 5,
"question_score": 2,
"tags": "group theory, normal subgroups"
}
|
How to return value from a screen to previous screen on ios?
I have experience with android but really new on ios. on Android, I can use startActivityForResult() to navigate from screen A to screen B. And then, when B is closed, the system will notify the screen A at a callback method to do something (e.g. get returned values, refresh data,...)
What I want to ask here is that: is there any way to register a call back function that will be call when the screen B is closed? How to return the data from screen B to screen A?
I know that I can declare a public property then set value to it from screen B. But, I think this way may make my source code complicated and less security. (i.e. I don't want to open property to other screen for assessing).
Thanks.
|
You can use the delegate pattern for this.
(Take a look at UITextField, UITableView, etc... they all use this pattern).
You set up a delegate property on the second view called something like...
SecondViewDelegate
And in the protocol you give it a method like...
- (void)secondViewDidSelectValue:(NSString*)selectedValue;
Then in the first view you make it the delegate of the second view.
There are many resources about this pattern.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "objective c, ios, return value"
}
|
Resetting Collatz Counter on Each New Recursion
I made a code that measure number of steps it takes to return to 1 in a Collatz Conjecture. Here Is my code
counter = 0
def collatz(n):
global counter
counter += 1
if n <= 0 :
return "Invalid Number"
elif n == 1 :
return counter
elif n % 2 == 1 :
n = 3*n + 1
return collatz(n)
elif n % 2 == 0 :
n = n/2
return collatz(n)
print(collatz(9921615699))
print(collatz(9921615699))
I expect the Last two print commands to print 311 and 311. Instead, they print 311 and 622. I guess that was easy enough to see in the code what is wrong. How can i fix that? how can counter reset each time a command is completed and not when the function is run.
|
Instead of using global variable you could make the counter a parameter with default value:
def collatz(n, counter=0):
counter += 1
if n <= 0 :
return "Invalid Number"
elif n == 1 :
return counter
elif n % 2 == 1 :
n = 3*n + 1
return collatz(n, counter)
elif n % 2 == 0 :
n = n/2
return collatz(n, counter)
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "python, python 3.x"
}
|
TFS Build definitions copy repository to UNC
I want to make a build definitios in TFS 2015 that copies all files in a repository to a given UNC.
This is not a VS project, but a set of web files that all are compiled.
Any ideas how this can be solved?
|
I ended up writing a PowerShell for the job.
#
# Deploy.ps1
#
param (
[Parameter(Mandatory=$true)][string]$targetPath
)
Function Deploy-Package() {
Copy-Item "$Env:BUILD_SOURCESDIRECTORY\*" $targetPath -Recurse
}
Deploy-Package
Write-Host -ForegroundColor Green "Deployment successful"
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "tfs"
}
|
The rough average of searches needed, to find key out of n keys
I've a question that has been bothering me regarding combinatorial searches, such as brute force of a key for an encryption.
Lets say I have 2^32 keys in a key space that would need to all be calculated to get a 1:1 probability of guessing the correct key. Would on average 2^32/2+1 random key searches be required to find the correct key?
My memory is leaving me about the above and what is required.
|
The mean rank of a given element of an ordered set of n to which one applied a uniformly distributed permutation is (n+1)/2. In your case you need to examine 2^(31)+.5 keys on average.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "probability, statistics"
}
|
visual studio c# Web services Soap Comment
I want to write some comment at the top of the every Method in Web Services that when Clients see they know what should they enter in the fields.
For example in the link below: <
They said for US dollar you should write USD and .....
* AFA-Afghanistan Afghani
* ALL-Albanian Lek
* DZD-Algerian Dinar
* ARS-Argentine Peso
* AWG-Aruba Florin
* AUD-Australian Dollar
* BSD-Bahamian Dollar
* BHD-Bahraini Dinar
* BDT-Bangladesh Taka
* .....
* .....
How can i do the same?
thanks.
|
The clients shouldn't have to look at a description to know what parameters are required, but here is how to put a description to a method in an `asp.net` web service:
[WebMethod(Description = "Put your description here")]
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -3,
"tags": "c#"
}
|
Python write to file causing new line after second variable insertation
I am using Python 3 and the following is causing a new line at the second parameter:
file.write("'../../our-api-{0}-{1}.jar'".format(version, buildnum))
writes the following:
'../../our-api-2-1020
.jar'
If I take off the second parameter it writes correctly e.g.:
'../../our-api-2.jar'
How do I get the double variable to write correctly on one line?
|
You probably have a trailing `\n` at the end of your variables.
There are two easy ways to debug this, simply do:
print( rep(buildnum) )
# or
print( [buildnum] )
And to solve it, you can do:
.format(version, buildnum.strip())
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, python 3.x"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.