INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
How to set the Day of Date?
Dim dt1 As Date
dt1 = Date
MsgBox dt1 ' works - 12.10.2012
Day(dt1) = 1 ' error: object required
I need 1.10.2012
So, for any date, I need to set dt1 as first day of that specific date.
|
You could use dateserial to reconstruct a date
eg
newDate = DateSerial(Year(dt1), Month(dt1), 1)
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 3,
"tags": "excel, vba"
}
|
How to apply adjustments to slices in Photoshop?
I have an image splitted into 3 parts by the slice tool. I also have a couple of adjustments that I want to apply only on the second and the third part of the image.
 ConTeXt bundle. And I have MacTeX 2018 installed.
I tried to compile something and it said that my PATH was something and that I didn't have “context” in it. So I changed the PATH variable of TextMate to:
$PATH:/opt/local/bin:/usr/local/bin:/usr/texbin:/usr/local/texlive/2018/texmf-dist/scripts/context/stubs/unix
because in that last part I think is where context is, but now when I try to compile a ConTeXt document I get
env: texlua: No such file or directory
|
I asked in the ConTeXt mailing list, and quickly Mojca answered < She has an account here, but seems he doesn't
Basically, the PATH is wrong.
* MacTeX path should be before `/opt/local/bin` (used by macports, and may be homebrew —which is the one I use);
* `/usr/texbin` is from older operating systems and is no longer useful by default in High Sierra for example; and
* the binaries are in `/Library/TeX/texbin`.
So the PATH ends up being
$PATH:/Library/TeX/texbin:/opt/local/bin:/usr/local/bin
and now it compiles.
|
stackexchange-tex
|
{
"answer_score": 1,
"question_score": 0,
"tags": "context, paths, textmate"
}
|
Swift filter and dictionaries
I'm trying to use a closure filter to filter people in my dictionary who are under 18. I know how to filter with an array, but I'm not sure how to filter a dictionary.
var namesAndAges = ["Tom": 25, "Michael": 35, "Harry": 28, "Fabien": 16]
var underAge = namesAndAges.filter { &0.namesAndAges.value < 18 }
this gives me the error "Contextual type for closure argument list expects 2 arguments, which cannot be implicitly ignored"
|
Just do it like this:
var namesAndAges = ["Tom": 25, "Michael": 35, "Harry": 28, "Fabien": 16]
var underAge = namesAndAges.filter({ $0.value < 18 }) // [(key: "Fabien", value: 16)]
What you do is that you use `$0.value` in your `filter`.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "swift, dictionary, filter, closures"
}
|
How do I make single, curved characters?
I need very often curved, latin Symbols. For example out of this document:  never include from `'rxjs'` and always use more specific for example `'rxjs/Observable'` or `'rxjs/BehaviorSubject'`.
When you include `'rxjs'` you're in fact including this file: < which includes the entire bundled RxJS library (all operators, schedulers, etc.). So you're including a lot of things you don't even use and your app grows bigger than necessary (I think tree-shaking with webpack2 doesn't help and once the code is included it'll be part of the final package, but I might be wrong).
I think it's ok to import directly from `'rxjs'` in `node` apps (eg. backend apps) where it doesn't matter that much that it contains also code you're not going to use and this way is just easier to use.
|
stackexchange-stackoverflow
|
{
"answer_score": 23,
"question_score": 15,
"tags": "rxjs, angular cli, tslint"
}
|
show that the function is in $L^r$
> Let $f$ be a measurable function and $1 \le p < r < q < \infty$. If there is a constant $C$ such that $$\mu ( \\{ x : |f(x ) | > \lambda \\} ) \le \frac { C }{ \lambda ^p + \lambda ^ q} $$ for every $ \lambda > 0$, show that $f \in L ^r $.
* * *
I know that if both $f \in L^p $ and $f \in L^q $ then $f \in L ^r$. But the condition provided seems not suffices to show that (I can only show that it's in weak $L^p$ or weak $L^q $). Any help is appreciated.
|
Hint: $$\int_X f(x)^r\,d\mu(x) = \int_0^\infty r\lambda ^{r-1} \mu(\\{x\in X:f(x)> \lambda\\})\,d\lambda.$$
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 2,
"tags": "integration, measure theory, lp spaces"
}
|
Bootstrap: как растянуть блок одним боком до края страницы?
народ! Сейчас верстаю лендинг на бутстрапе, и есть у меня такой вот блок который хочет вылазить одним боком за сетку. Вот он гад, красным цветом нарисован. ;
width: calc(50% + 550px);
}
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "html, css, вёрстка, bootstrap"
}
|
Make default value of single line of text be read-only on new/edit form
I'm using SP 2013 and have a list, within the list is a field called TrainText1 - it provides a step of the training which is being signed off, so the users know what they are signing off against. There are also 'associated' fields, which are Date1 and Tick1, which capture the date the training was completed and a tick to confirm as done.
Here is the field definition:  are changing quite frequently at this stage. Later on I will create a proper custom form. In the meantime I need to get a working form and capture some data.
 {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
"TrainText1": {
EditForm: SPField_FormDisplay_Default,
NewForm: SPField_FormDisplay_Default
}
}
}
});
})();
|
stackexchange-sharepoint
|
{
"answer_score": 1,
"question_score": 1,
"tags": "2013, form, default value, read only"
}
|
Fix iTunes exclamation?
I've moved all of my MP3s to a new location. iTunes appears to still be looking in the old location because it displays no artwork and an exclamation next to each song.
Is there a way to tell it "it's all over here now"?
|
What I would do is select all of the stuff in the library and delete them out of iTunes. Then go to where ur music is located and drag them back over.
!alt text
|
stackexchange-superuser
|
{
"answer_score": 1,
"question_score": 3,
"tags": "windows, itunes"
}
|
SharePoint 2013 - App. Mix CSOM and JSOM?
I need to write an Office365-App. I want to use a provider-hosted MVC-Application for this.
As I want to use some kind of "API" on some pages, that returns a JSON that then is used inside JS to display data: Can I just mix CSOM and JSOM?
Has this any effect on the (OAuth)-Authentication?
|
You could mix CSOM and JSOM . I would suggest you could use the SharePoint Cross Domain JavaScript library (CDL) to access SharePoint data from a remotely hosted web page without the need for OAuth tokens. Please refer to below link for code sample: <
I have tested the codes in a CSOM OAuth authentication web application ,and it works fine .
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "oauth, sharepoint 2013, csom, office365 apps, sharepoint jsom"
}
|
Unknown LCD display circuit design
I opened up the case of an old toy to take a look at what is inside.
 I have never seen before(middle image).My question is:what kind of display is this,what kind of controller&how does it all work together?Note that the LCD is attached on with the help of two rubber bands(first image) and can easily be removed or be placed back without soldering or desoldering it.Also,what's the role of the black cover placed in the middle?
|
The black blob is a custom IC called a "chip-on-board". The IC does not have a standard case like what we normally see when looking at a PCB. Instead, the die itself is glued to the PCB and has very fine wires coming out of it to connect to the board. The whole thing is encapsulated in the black resin to protect it from the elements.
In my experience, salvaging displays from this sort of thing is generally a lost cause--they are most often custom jobs and, while I'm sure you can find a way to reuse them, it will take a lot of time to determine the pinouts and how to control them.
It looks like the LCD is mounted to the PCB using a press-fit solution. Pressing it to the PCB connects the pads and the pins on the board and the display. By far not the best (can lead to intermittent connections if not done properly, or if the pads get dirty) but for a cheap toy it usually gets the job done.
This answer briefly explains the chip-on-board concept.
|
stackexchange-electronics
|
{
"answer_score": 3,
"question_score": 0,
"tags": "pcb, components, lcd"
}
|
Function initialization to retrieve stored value when called
I want to store an array in a Javscript function, to retrieve the value stored when called after initialized
I tried this:
function myFunc() {
this.myArr = [];
function init() {
if (myArr.lenght === 0) {
myArr.push(1);
myArr.push(2);
myArr.push(3);
console.log("initialized now");
} else {
console.log("initialized already. Arrlength: ", myArr.lenght);
}
}
return myArr;
}
myFunc.init()
console.log(myFunc());
Expected output:
initialized now
initialized already. Arrlength: 3
Obtained output:
TypeError: myFunc.init is not a function
|
I don't know if this is what you are trying to achieve but it's working:
function myFunc() {
myArr = [];
function init() {
if (myArr.length === 0) {
myArr.push(1);
myArr.push(2);
myArr.push(3);
console.log("initialized now");
} else {
console.log("initialized already. Arrlength: ", myArr.length);
}
}
function getArr() {
return myArr;
}
myFunc.init = init;
myFunc.getArr = getArr;
}
myFunc();
myFunc.init();
console.log(myFunc.getArr()); // output: Array(3) [ 1, 2, 3 ]
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript"
}
|
Remove JSON element
I want to remove JSON element or one whole row from JSON.
I have following JSON string:
{
"result":[
{
"FirstName": "Test1",
"LastName": "User",
},
{
"FirstName": "user",
"LastName": "user",
},
{
"FirstName": "Ropbert",
"LastName": "Jones",
},
{
"FirstName": "hitesh",
"LastName": "prajapti",
}
]
}
|
var json = { ... };
var key = "foo";
delete json[key]; // Removes json.foo from the dictionary.
You can use splice to remove elements from an array.
|
stackexchange-stackoverflow
|
{
"answer_score": 229,
"question_score": 146,
"tags": "javascript, json"
}
|
Why does QTP need to be told twice to Stop?
In QuickTest Pro 10, I've noticed that whenever I have a Stop command in a function, QTP will ignore it. However, if I have a second Stop after the first command, QTP will stop on the second command. Why is this?
For example, let's say I have this in a function:
If True Then
Stop
End If
... **won't** stop. However...
If True Then
Stop
Stop
End If
... **will** stop. Why?
|
Could it be the facts described in < are responsible for the symptom?
I don't think, however, that it is a good idea to use `Stop` in QTP scripts, since QTP is one of the few using the VBScript engine to implement its own IDE, and there are various integration issues between the debugger and the engine.
So I would not expect all VBS IDE features (and `Stop` is one of them) to be supported by QTP.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "qtp"
}
|
Poisson distribution: trucks and cars
_This is some probability problem that I conjured up. Can anyone check whether this problem makes sense and has a solution?_
* * *
Assume that the traffic on Spooner street follows a Poisson process with a rate 2/3's of a vehicle per hour. 10% of the vehicles are trucks, the other 90% are cars.
Let's say 100 vehicles passed by in Spooner street. In this case, I'm interested in the case where each truck is separated by at least 4 cars. For example:
* 'yes' event: `car truck car car car car car truck car` -> there are 5 cars between a pair of trucks
* 'no' event: `truck car car truck` only two cars between a pair of trucks
What is the probability that these 100 vehicles satisfy the property of having each pair of trucks separated by at least 4 cars?
|
No, it doesn't make sense, in the sense that the Poisson process doesn't enter into it. Once you know that there were $100$ vehicles, it becomes equivalent to $100$ unfair coin tosses that can come up trucks or cars, and you might as well not mention the Poisson process (in particular its rate) in the first place (unless you made this up to confuse your students :-).
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "probability distributions"
}
|
UITesting with xcode 7
I am setting up some ui tests with the new ui testing feature of xcode7 but am having a little difficulty figuring out how to set a textfield value to "" without pushing the delete button a whole bunch of times. How can I do this
**my testing code:**
func testLogin(){
let app = XCUIApplication()
let requiredTextField = app.textFields["required"]
requiredTextField.tap()
//here is where i want to set it to ""
requiredTextField.typeText("username1")
app.typeText("\r")
...
|
You can first do a double tap that will highlight the whole textfield, then directly input your new text.
requiredTextField.doubleTap()
requiredTextField.typeText("yourNewText")
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "ios, xcode, xctest, xcode7, xcode ui testing"
}
|
strings comparison in PHP
I feel like the biggest fool on the planet earth. But I am looping through a text file and attempting to compare each line and find the line breaks... You know... "\n". But I can't seem to compare the strings!!!! Here is what I am doing.
$filename = 'StatesCities.txt';
$file = file($filename);
$matchedLines = array();
foreach($file as $line) {
$matchesLines[] = $line;
if(strcmp($line, "La Mesa") == 0)
{
echo("Yeah");
}
echo($line);
echo("<br />");
}
|
Are you trying to remove the line breaks? If that's the case then you can explode them.
$file = file_get_contents( $file_path );
$page = explode( "\n", $file );
//Now they're gone
foreach( $page as $line )
{
if( strpos( $line, 'searchfor' ) !== false )
{
//do this
}
}
The strpos is how I usually search in a string, just make sure to use !== which checks for false not false or 0. If the string your looking for has a strpos of 0 ( first character ) it would return a false positive if you don't check for the type with !==. Good luck.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, string"
}
|
how to call my object using addevent listner
obj = {
click : function (msg ){
alert(msg);
}
}
var link = document.getElementById('link');
link.addEventListener('click',obj.click,false);
The above code is working, but i need to pass the 'msg' in parameters how can i do? in case if i pass the parameter like this :
link.addEventListener('click',obj.click('message'),false);
then, it is calling the function, event without clicking on the link. for this how can i my object to only get call on the click as well with parameter in the function?
Any one help me?
thanks
|
You need to use an anonymous function as a callback:
// Function to add event listener to t
function load() {
var el = document.getElementById("t");
el.addEventListener("click", function(){modifyText("four")}, false);
}
The example above was taken from the Mozilla developer documentation.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "javascript"
}
|
A brief explanation needed regarding newton's law in particle
So based on the topic, this is the question.
"A particle with mass $m$ is moving along x-axis with $v_0$ at $t=0$ and $x=0$. The particle is acted by an opposing force with magnitude proportional to the square of velocity. Find out the a) velocity b) position and c) acceleration of particle at any time ($t>0$)"
I have the answers and solution for this but hardly understand them (I dont understand at all actually. Plus where does β come from?)
Basically I just need a clarification on question a) as b) and c) are related to the first question.
This is a self study for final exam. Answer provided by my friend but she also copied it from a source. So without understand it we do it correctly. But it seems to be useless. So I hope you guys can help me.
This is the answer.
a) velocity !Part a
b) position !Part b
c) acceleration (t>0) !Part c
|
In the literal a), the problem say that the force is proportional to the square of velocity, i. e.
$F\propto v^2$
For that force is equal to the square of the velocity, you must put the constant of proportionality this is $\beta$, like the particle is acted by an opposing force then why the negative sign appears,
$F=-\beta v^2$
By Newton's second law $F=ma$ and $a=\dfrac{dv}{dt}$, then
$m\dfrac{dv}{dt}=-\beta v^2$
and only remains to integrate, as in the picture.
Hope that helps a little, if anything asks again :)
|
stackexchange-physics
|
{
"answer_score": 0,
"question_score": 1,
"tags": "newtonian mechanics"
}
|
How to download file from FTP
I want to download something from my FTP server, not very sure how to do it. I read many threads online but none of them seems to be working for me.
i know that
`"Client.DownloadFile(" of Legends.exe", @"C:\Users\MacBook\Desktop\League of Legends.exe");"`
will download something that is not in ftp. But im not very sure how will i download from ftp.
I know you have to put in your ftp username and password, etc.
private void btnzoom_Click(object sender, EventArgs e)
{
WebClient Client = new WebClient ();
Client.DownloadFile(" of Legends.exe", @"C:\Users\MacBook\Desktop\League of Legends.exe");
}
|
It looks like some examples on the documentation for `FtpWebRequest` make use of `WebClient`:
WebClient request = new WebClient();
request.Credentials = new NetworkCredential("anonymous", "[email protected]");
byte[] newFileData = request.DownloadData(serverUri.ToString());
The main thing to note is that `serverUri.Scheme` is `Uri.UriSchemeFtp`, so it seems that `WebClient` can make `ftp://` requests.
Another alternative I've used in the past for ease-of-use is somebody's `FtpClient` class on GitHub:
var client = new Ftp("ftp://hostname.com", "username", "password");
client.DownloadFile("remotefile.txt", "localfile.txt");
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "c#, ftp"
}
|
How to assign field of struct in a map of Go
I want to assign field of struct which is in a map like this:
package main
import (
"fmt"
)
type Task struct {
Cmd string
Desc string
}
var taskMap = map[string] Task{
"showDir": Task{
Cmd: "ls",
},
"showDisk": Task{
Cmd: "df",
},
}
var task = Task{
Cmd: "ls",
}
func main() {
// *Error*cannot assign to taskMap["showDir"].Desc
taskMap["showDir"].Desc = "show dirs"
task.Desc = "show dirs" // this is ok.
fmt.Printf("%s", taskMap)
fmt.Printf("%s", task)
}
I can assign the `Desc` field in a variable `task` but not in a wrapped map `taskMap`, what has been wrong?
|
You can use pointers:
var taskMap = map[string]*Task{
"showDir": {
Cmd: "ls",
},
"showDisk": {
Cmd: "df",
},
}
func main() {
taskMap["showDir"].Desc = "show dirs"
fmt.Printf("%+v", taskMap["showDir"])
}
playground
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "dictionary, go, assign"
}
|
Mysqli select multiple from same row
I have a question, I would like to make a query in mysqli.
I want to do this
$sql = $db->query("SELECT * FROM padges WHERE enable ='1' AND enable='0'");
But it is not working. How do I solve this ?
|
An `enable ='1' AND enable='0'` condition won't return any rows. Because database does search not the way you think it is. It will pick rows one by one, and test each against this condition. And obviously find no rows, as there couldn't be a row that's enabled and disabled at the same time. Instead you have to find rows that are either enabled _or_ disabled:
SELECT * FROM padges WHERE enable ='1' OR enable='0'
Or, if 0 and 1 are the only values, you can omit WHERE clause at all
SELECT * FROM padges
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "mysql"
}
|
Error when using an OR within an IF statement with 'contains' method
Getting an error with the following code snippet of "Save error: expecting a right parentheses, found 'OR'" . It works if I use only the first contains, but then errors when I add the OR and second contains.
if(c.Billing_Contact__c.contains('Billing') OR (c.Billing_Contact__c.contains('SO')){
Is it not possible to use the OR within the IF statement? I saw other examples where it worked, but not when I was using the contains method within. Something simple that I'm missing here?
Thanks in advance!
|
You should use the operator || and not OR. See here the various Apex operators
|
stackexchange-salesforce
|
{
"answer_score": 0,
"question_score": 1,
"tags": "apex, trigger"
}
|
JMeter WebDriver Sampler doesn't work with latest Firefox version
I use JMeter WebDriver Sampler (JMeter v4.0) for Chrome Driver (where I specify the path to chromedriver in `jp@gc - Chrome Driver Config`), and it works.
Now I want to try with latest Firefox Browser (FF Quantum v59.0), but it doesn't work. FF browser is opened but it doesn't go further, ex `WDS.browser.get(' is not executed.
It seems JMeter WebDriver Sampler doesn't catch up with geckodriver and changes of FF. I google it, but I don't find any info on this regard. Does anyone know any update on this? Is there any workaround? Thanks
|
You should look at JMeter Firefox Driver Config plugin restrictions:
> the latest Firefox version may not work with the latest WebDriver set. The table below describes the version of Firefox that is compatible with JMeterPlugins:
Current version is compatible only with version 26 of Firefox
Also firefox jmeter addon is not compatible
> This add-on is not compatible with your version of Firefox.
>
> Not compatible with Firefox Quantum
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "selenium, selenium webdriver, jmeter, performance testing"
}
|
HATEOAS and client implementation
I have read a few articles about HATEOAS and the way that API should be implemented such that you can traverse to different states by following the links. But I'm confused as to how the client should be implemented?
From this answer:
> The client knows nothing about how the server designs its URIs other than what it can find out at runtime.
* Does the client need to crawl from the root node down to a nested resource to just make a POST if it doesn't know the direct URI?
* What would be the purpose of API documentation then?
|
For implementing HATEOAS server needs to include links to responses that goes from server to client, and client uses these links in response to communicate to server.
For eg. Client request Product list, server will respond with list of products with link to Add, edit and delete the products (if user is able to do that), which will then be transformed in client into links or buttons like Edit Product, Delete Product.
This blog might help you get more understanding.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "api, rest, architecture, hateoas"
}
|
kickstart commerce 2 in openshift /admin/modules/list/confirm with no response (white dead screen)
I installed commerce kickstart on openshift. I had /admin/modules/list/confirm return white screen. Look like the execution cannot be finished. On my local system (aquria drupal desktop in PC), there is no this kind of situation. Do I need to enable some buffer or locate more resource for the app?
Thanks.
|
You need to know first what error is being thrown that causes the white dead screen. To be able to do so, you will need to add the following lines to your drupal site's `index.php` file.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Then visit the page that causes the white screen, you will see the error message.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "drupal, memory management, buffer, openshift, commerce"
}
|
SQL update table by targeting unique row one int less
What I have is a table with the following columns
All columns are nvarchar expect for the Date columns which are datetime
`CreateDateA InvIDA StorageIDA CreateDateB InvIDB StorageIDB UniID `
What I want to do is move the values on each row (based on `UniID`) into the represenative B columns where `UniID` is 1 less, so the 'A' columns where UniID = 2 should go to the B Columns where the UniID = 1.
This is the query i'm using but it's not updating any columns.
update InvSubmission
set CreateDateB = CreateDateA,
InvIDB = InvIDA ,
StorageIDB = StorageIDA
where StorageIDB = StorageIDA and UniID = (select UniID-1 from InvSubmission)
There is multiple storageid's in this table, however, each record has a match to at least one other row.
|
@PinnyM's answer is close, but in SQL Server, you have to name the updated table in the from clause also:
update toUpdate
set CreateDateB = sourceTable.CreateDateA,
InvIDB = sourceTable.InvIDA
FROM
InvSubmission toUpdate
inner Join
InvSubmission sourceTable
ON sourceTable.UniID = toUpdate.UniID + 1
AND sourceTable.StorageIDA = toUpdate.StorageIDB
Otherwise, this note becomes relevant:
> If the object being updated is the same as the object in the FROM clause and there is only one reference to the object in the FROM clause, an object alias may or may not be specified
And then you're suffering the same problem that @Yuck pointed out - you're trying to compare the `UniID` value within a single row to a value one less than itself.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "sql, sql server 2005"
}
|
Excluded minors of graphs with bounded crossing number
The case for $\operatorname{cr}(G)=0$ (planar graphs) is given by Wagner's theorem, but what about (for instance) the family of graphs with $\operatorname{cr}(G) \leq 1$?
|
Check out this link. It claims that the family of graphs with crossing number $\leq k$ is not minor-closed for general $k$, though I don't understand the example there. One can fix the definition so that it be minor-closed by "blatantly" enforcing it, see here. Of course, once we have a minor-closed family, Robertson-Seymour theory tells us that there is a finite list of forbidden minors.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 4,
"tags": "graph theory"
}
|
How to show that $\sum_{n=M}^N a_n b_n= \sum_{k=M}^{N-1}s_k(b_k-b_{k+1})s_Nb_N-s_{M-1}b_M$
> Suppose $a_n$ and $b_n$ are finite sequence of real numbers. Let $s_k = \sum_{n=1}^ka_n$ with onvention $s_0= 0$.Then show that $$\sum_{n=M}^N a_n b_n= \sum_{k=M}^{N-1}s_k(b_k-b_{k+1})+s_Nb_N-s_{M-1}b_M.$$
Trial: I know that $\sum_{n=M}^N a_n b_n= a_Mb_M+\dots+a_Nb_N$. Then stuck to break this so that I get the desired result. Please help.
|
There's a $+$ missing in the formula. You get, writing $a_n = s_n - s_{n-1}$,
$$\begin{align} \sum_{n=M}^N a_n b_n &= \sum_{n=M}^N (s_n - s_{n-1})b_n\\\ &= \sum_{n=M}^N s_n b_n - \sum_{k=M-1}^{N-1} s_kb_{k+1}\\\ &= s_Nb_N + \sum_{n=M}^{N-1} s_nb_n - \sum_{k=M}^{N-1} s_kb_{k+1} - s_{M-1}b_M\\\ &= s_Nb_N + \sum_{k=M}^{N-1}s_k(b_k - b_{k+1}) - s_{M-1}b_M. \end{align}$$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "summation"
}
|
Two fields of has many to same model
I'm trying to achieve something like this:
TransportOrder has many LoadingPlaces as loadings
TransportOrder has many LoadingPlaces as unloadings
I can not create two separate models UnloadingPlaces and LoadingPlaces because later I want to search trough LoadingPlaces for TransportOrders.
|
Try to use foreign key syntax, and specify the class_name:
has_many :loadings, foreign_key: "traport_order_id", class_name: "TransportOrder"
has_many :unloadings, foreign_key: "traport_order_id_two", class_name: "TransportOrder"
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "ruby on rails"
}
|
finding linked files with HPricot
I've been playing around with HPricot, but after a fair amount of searching, I've not been able to work this out.
I'm trying to parse a HTML page and find all tags with a href to an mp3 file. So far I've got
<ul>
<% @page.search('//a[@href*=mp3]').each do |link| %>
<li>
<%= link.inner_text %>
</li>
<% end %>
</ul>
which is working fine, and a regex, `/href\s*=\s*\"([^\"]+)(.mp3)/` which also works. I'm just not sure how to combine the two.
Is there a good example, or documentation that someone could point me to in order to work out what I can do with the .search function.
Thanks
|
found the answer. the method is attributes, (not attr) and also, the brackets need to be square. `link.attributes['href']`
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "ruby, hpricot"
}
|
Adding element if user is in role
I do something like that:
<ul id="menu">
@if (HttpContext.Current.User.IsInRole("admin")) {
<li>@Html.ActionLink("Administration", "Index", "Administration")</li>
}
</ul>
Is there a better way?
|
This is of course the shortest way. Its seems you are building a global menu with links only visible for certain users. You should have a look at `MvcContribs.UI.MenuBuilder` namespace.
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net mvc 3"
}
|
Alternate host/IP for python script
I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas?
|
Whether this works or not will depend on whether the far end site is using HTTP/1.1 named-based virtual hosting or not.
If they're not, you can simply replace the hostname part of the URL with their IP address, per @Greg's answer.
If they are, however, you have to ensure that the correct `Host:` header is sent as part of the HTTP request. Without that, a virtual hosting web server won't know which site's content to give you. Refer to your HTTP client API (Curl?) to see if you can add or change default request headers.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "python, dns, urllib, hosts"
}
|
Cast by FullTypeName
I have to cast an object to an object, where i just have the `typename` as a string.
For example:
I have the type-string `System.DateTime` and the string `2012-09-17T10:19:23.5369243+02:00`. Now I want to have an object of `DateTime` with the value of the string.
Is this possible?
|
The answer to your question can be found in all the other answers, waiting to be pieced together. :)
1. Get the Type from your Type String, like akhisp said:
Type dateTimeType = Type.GetType("System.DateTime");
2. Now, use a type converter to change the string to the DateTime:
object date = Convert.ChangeType("2012-09-17T10:19:23.5369243+02:00", dateTimeType);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "c#, casting"
}
|
HitTest property
I'm new to silverlight and trying to read a silverlight tutorial that uses HitTest method to know when the mouse is over a control. But unfortunately i cant see any method with this name.
Where is the HitTest method? is that because i'm using silverlight 4? is there any replacement method ?
|
Older versions (pre 3.0) did have a HitTest method. In Silverlight 3 and 4 you ouwl use the `VisualTreeHelper.FindElementsInHostCoordinates` method to acheive a similar goal.
For example the following code could be used in a mouse event on surface over which you might be dragging an item. It will determine if any part of the dragged item overlaps the target item. _Warning air code_
var container = (UIElement)sender;
var transform = draggedItem.TransformToVisual(container);
Rect rect = new Rect(transform.Transform(new Point(0, 0)),
new Size(draggedItem.ActualWidth, draggedItem.ActualHeight);
bool hit = VisualTreeHelper.FindElementsInHostCoordinates(rect, container)
.Any(elem => elem == targetItem);
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "c#, silverlight, silverlight 4.0"
}
|
jQuery, on hover, only show this one and not all of it's siblings
On page load, I'm hiding the class ".work-info". When the mouse is over ".work-item" I'm trying to only show that one instance of ".work-info" instead of it showing all of it's siblings as well.
I've tried
jQuery(".work-item").mouseenter(function(){
jQuery(this).$btn.show();
});
jQuery(".work-item").mouseleave(function(){
jQuery(this).$btn.hide();
});
but this is wrong.
This is what I currently have:
var $btn = jQuery('.work-info').hide();
jQuery(".work-item").mouseenter(function () {
$btn.show();
});
jQuery(".work-item").mouseleave(function () {
$btn.hide();
});
|
you probably want
// hide all
jQuery('.work-info').hide();
jQuery(".work-item").mouseenter(function () {
// use jquery find on the current selector
jQuery(this).find(".work-info").show();
});
jQuery(".work-item").mouseleave(function () {
jQuery(this).find(".work-info").hide();
});
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery"
}
|
Turn off cache for loadtests?
When measuring the throughput of a system that inherently caches (on the server side), should I turn the cache off to measure the worst-case, first load time, or is it irrelevant, as the great average is not really influenced by that one not cached call?
The actual system operates with image data (DICOM).
|
Here's what I think:
If you want to test the system as it will work in production, use the same setup as in production. If you want to test a standalone component, feel free to disable any related components to make it separated.
For a load test it might be reasonable to disable the cache, but this is purely just for measurements. It won't reflect the real characteristics of the system.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "caching, testing, performance testing, data transfer"
}
|
I cant see any text on Skype after update to ubuntu 15.10
I recently updated ubuntu to 15.10. After the update I couldn't see any text in Skype! I tried reinstalling it
> sudo apt-get purge skype
Deleted the **/home/username/.Skype** folder
and reinstalled Skype but that didn't solve the problem. $ and the absolute value of $f\left(\frac1n\right)$ is less than $\frac{1}{2^n}$ for all positive integers $n$. Show that $f$ is identically zero in the aforementioned disc.
|
from continuity, f(0)=0.Suppose f is not constant. Let N be the order of zero at z=0. Then f=gz^N for some holomorphic function g such that g(0) is not zero. We have a contradiction after we plug g in the inequality because it implies g(0) should be zero.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "complex analysis"
}
|
Determining Fluorescence Quantum Yield of C60 in Toluene
For my experiment, I am trying to determine the fluorescence quantum yield of C60-fullerene in toluene (at room temperature). In order to do that, I need to have a standard sample with a valid and known fluorescence quantum yield. I have been looking for a standard sample with a known quantum yield in toluene, however, I am not sure of what to use.
Would it be better if I used a different solvent in determining the quantum yield and if so what solvent and standard should I use.
|
Toluene instead of benzene can be a poor choice when H-atom abstraction by the excited state is possible. Here, you're safe.
Try to get a copy of Fluorescence spectra and quantum yields of buckminsterfullerene (C60) in room-temperature solutions. No excitation wavelength dependence.
The authors apparently used 9-cyanoanthracene in toluene as a standard to determine $\Phi_f$ of C60.
You might also want to have a look for review articles by _Dirk Guldi_ from the time around 2000; I remember him giving a number of talks on C60 around that time.
|
stackexchange-chemistry
|
{
"answer_score": 2,
"question_score": 3,
"tags": "organic chemistry, solubility, photochemistry, spectrophotometry"
}
|
Función asignar nombre a variables - Python
Un problema común con el que me encuentro es el de poder especificar el nombre de una variable en una función sin conocer dicho nombre a priori, por ejemplo:
Supogamos que tengo una función cuya salida es un dataframe, me gustaría poder especificar el nombre de ese dataframe en relación a otro parámetro:
Ejemplo:
data_prueba = pd.DataFrame([1,5,3,2])
def cambiar_y_guardar_nombre(data):
n = len(data) # n=4
data.to_csv("data_4.csv") # ¿Cómo puedo especificar que se guarde como "data_4"?
cambiar_y_guardar_nombre(data_prueba)
Espero haberme explicado, gracias!
|
Basta con formatear la cadena con la ruta del archivo de destino, por ejemplo:
data_prueba = pd.DataFrame([1,5,3,2])
def cambiar_y_guardar_nombre(data):
n = len(data)
data.to_csv(f"data_{n}.csv")
cambiar_y_guardar_nombre(data_prueba)
Si quieres poder modificar el nombre de base, puedes hacer algo como:
def cambiar_y_guardar_nombre(data, base_name="data"):
n = len(data)
data.to_csv(f"{base_name}_{n}.csv")
cambiar_y_guardar_nombre(data_prueba)
cambiar_y_guardar_nombre(data_prueba, base_name="foo")
|
stackexchange-es_stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "python, funciones, dataframe"
}
|
Proving $f(x,y) = |xy| + a(x^2 + y^2)$ is convex if and only if $a \ge 1/2$
I am now trying to solve the question that proving $$f(x,y) = |xy| + a(x^2 + y^2) \text{ is convex if and only if } a \ge 1/2$$ Proof of that $f(x,y) = |xy| + a(x^2 + y^2)$ is convex when $a \ge 1/2$ is provided in another question. I have tried to code some program for visualizing the convexity on some line $y=kx+b$ of function $f(x,y)$ which has the same convexity of the $f(x,y)$. But the plot I draw all seems to have the convexity so far. I am also wondering what is the usual way to prove that a function is not convex.
|
If $f(x,y)$ is convex so it must be that $$f(\lambda(1,0)+(1-\lambda)(0,1))\le\lambda f(1,0)+(1-\lambda)f(0,1)$$or$$\lambda(1-\lambda)+a(\lambda^2+(1-\lambda)^2)\le a$$which leads to $$a\ge \dfrac{1}{2}$$so this constraint is necessary. Next we prove that this is also sufficient. If $a\ge \dfrac{1}{2}$ we have$$f(x,y)=(a-\dfrac{1}{2})(x^2+y^2)+\dfrac{1}{2}(|x|+|y|)^2$$which is convex since both $(a-\dfrac{1}{2})(x^2+y^2)$ and $\dfrac{1}{2}(|x|+|y|)^2$ are convex and summation of two convex functions always is a convex function. So the condition $a\ge\dfrac{1}{2}$ is necessary and sufficient.
Here is a sketch for $a=\dfrac{1}{2}$
 sign do in python?
I saw a piece of code in a project where following is written:
move = Move.create({
'name': repair.name,
'product_id': repair.product_id.id,
'product_uom': repair.product_uom.id or repair.product_id.uom_id.id,
'product_uom_qty': repair.product_qty,
'partner_id': repair.address_id.id,
'location_id': repair.location_id.id,
'location_dest_id': repair.location_dest_id.id,
'restrict_lot_id': repair.lot_id.id,
})
moves |= move
moves.action_done()
What does the `|=` meaning here?
|
As @AChampion already mentioned in the first question comment, it could be "bitwise or" or "set union". While this question has Odoo as context, it is "set union" for the Odoo class `RecordSet`.
For your example: It's the same as `moves = moves | move` and means a union of `moves` and `move`.
This class was introduced with the new API on Odoo 8. For other operators look into the official doc of Odoo.
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 24,
"tags": "python, python 2.7, odoo, odoo 8, odoo 9"
}
|
Azure ADO Build Pipeline failed due to brown out of ubuntu 16.04
My pipelines refer to ubuntu-latest pool, but I'm getting this error about Ubuntu 16.04
The docs state that ubuntu-latest is an alias for ubuntu-20.04
EDIT: I changed to ubuntu-20.04 and still getting the brownout and my job canceled
Azure DevOps Pipelines is effectively down right now
|
The error is due to the default agent pool being set to an outdated version of ubuntu
Edit the build
From the menu select triggers
Select the YAML tab

|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "azure devops, azure pipelines, build pipeline"
}
|
Where is the Location of Microsoft.Sharepoint.dll
I just installed the SharePoint SDK on my machine, but I can't seem to find the location of Microsoft.Sharepoint.dll so I can add a reference to it.
It's not in the GAC or C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\ and a search comes up with nothing.
Any suggestions?
|
The dll is on the server where you installed SharePoint. You should not develop on a desktop machine, create a virtual machine with SharePointserver installed and work there. See:
|
stackexchange-stackoverflow
|
{
"answer_score": 21,
"question_score": 43,
"tags": "sharepoint"
}
|
How do I get the Midnight Launch achievement?
The description for the achievement **Midnight Launch** is
> In mission 2, get significant air in the warthog at midnight.
Is "midnight" supposed to refer to a location in the level, or do I actually have to do it at real life midnight local time? What exactly do I have to do to get it?
|
The requirement is in fact "real life midnight", although lucky for you your XBox doesn't really know what time it is. To do so, the steps are:
1. Disconnect from Xbox live and go to your system setting to manually adjust time. Set it around 5-7 min before midnight.
2. Go to Rally point Alpha on Requiem (Mission 2).
3. **Update** : As Slenderman points out, the fastest/most reliable way to "jump" is simply to **go off the cliff right next to where the Warthog spawns** \- unless of course you've got something against respawning... :).
Check your time by pressing the XBox button as you progress, to keep track. You need to hit that jump in air at exactly midnight to get the achievement. Naturally this may prompt some trial and error, but its pretty easy to drive off a cliff - so hopefully you get it on the first try.
If you want to go the conventional route, you can head for the big jump a little later in the level.
This video shows all the details:
|
stackexchange-gaming
|
{
"answer_score": 7,
"question_score": 7,
"tags": "achievements, halo 4"
}
|
Фильтрация при двойном агрегировании elasticsearch
Я делаю вот такую агригацию:
{
"aggs": {
"characteristics": {
"terms": {
"field": "product_char.char_id"
},
"aggs": {
"value": {
"terms": {
"field": "product_char.value.keyword"
}
}
}
}
}
}
И хочу получить уникальное значение конкретной характеристики, но вместо этого в `value` я получаю все возможные значения всех характеристик вместе взятых. Как сделать так, что бы в каждой уникальной `characteristics` был свой набор уникальных `value`
|
Крч если кому надо)) делаете маппинг, ставите у `product_char` тип `nested` (это если у вас как у меня массив объектов внутри product_char, если один объект то и так должно всё работать). Код аггригации для nested такой:
{
"aggs": {
"characteristics": {
"nested": {
"path": "product_char"
},
"aggs": {
"char_ids": {
"terms": {
"field": "product_char.id",
"size": 1000000
},
"aggs": {
"values": {
"terms": {
"field": "product_char.value.keyword",
"size": 1000000
}
}
}
}
}
}
}
}
p/s Спасибо комьюнити, ELASTIC СДЕЛАЙ НОРМ ДОКУМЕНТАЦИЮ!!
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, elasticsearch, aggregation framework"
}
|
Making library from cpp and hh file
I have an xx.cpp and xx.hh file and want to link xx.obj file with a library which is made by others cpp and hh file...how to do that? can i made a library of xx.obj?
|
The answer depends on the kind of access you have to the different sources and which development tools you use. 2 solutions come into my mind:
1. If you have direct access to the sources of the second library you can simply add the xx-sources directly to that library, recompile and relink.
2. If you don't have direct access to the xx-sources and you've got only the xx-object file you can add that object file directly into your project (as if they were regular source files). I know that this works with visual studio, but the xx-object-file has to be compiled with the same compiler version and settings (do not mix debug/release, static/dynamic runtimelibrary)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "c++, visual studio 2010, visual c++, linker"
}
|
jekyll debug or print all variables
I want to peak into Jekyll's brain and see what's going on, in php you have get_defined_vars, so I tried to do something akin to that with:
{% for local_variable in local_variables %}
<p> {{ local_variable }} </p><br>
{% endfor %}
Which output nothing. Am I trying too hard? Is there some method in ruby or jekyll for this? I'd just like to poke around and make sure everything is set correctly and possibly to find out about variables I don't know about.
|
With Jekyll 2.x, you can use this plugin.
It allows you to do something like `{{ site | debug }}`.
Since Jekyll 3, you have `{{ variable | inspect }}`.
|
stackexchange-stackoverflow
|
{
"answer_score": 53,
"question_score": 48,
"tags": "ruby, debugging, jekyll"
}
|
Computing $\lim_{x\to0} \frac 8 {x^8} \left[ 1 - \cos\frac{x^2} 2 - \cos\frac{x^2}4 + \cos\frac{x^2}2\cos\frac{x^2}4 \right]$ without using L'Hospital
We have to find the following limit.
$$\lim_{x\to0} \frac 8 {x^8} \left[ 1 - \cos\frac{x^2} 2 - \cos\frac{x^2}4 + \cos\frac{x^2}2\cos\frac{x^2}4 \right]$$
In this I thought to use Lhopital . But using that it will become too long . Is there ny short method .
|
HINT:
$$1-a-b+ab=(1-a)(1-b)$$
$$\lim_{h\to0}\frac{1-\cos2h}{h^2}=2\lim_{h\to0}\left(\frac{\sin h}h\right)^2 = \text{?}$$
|
stackexchange-math
|
{
"answer_score": 15,
"question_score": 3,
"tags": "calculus, limits, limits without lhopital"
}
|
Delete unused groups in Laravel 8
I have a group model and I want to delete groups that don't have any member.
How can I get empty groups with eloquent or SQL query ?
class Group extends Model
{
use HasFactory;
protected $fillable = [
'group_name',
'description'
];
public function users(){
return $this->hasMany(User::class);
}
}
And this is the `User` model code:
class User extends Model implements AuthenticatableContract, AuthorizableContract
{
use SoftDeletes, Authenticatable, Authorizable, HasFactory, Notifiable;
public function getNameAttribute()
{
return $this->last_name.' '.$this->first_name;
}
public function group(){
return $this->belongsTo(Group::class);
}
}
|
I think `whereDoesntHave` work in you situation.
Group::query()->whereDoesntHave('users')->delete();
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, laravel, eloquent"
}
|
Equality in Ocaml hashtables
Are there hashtables in Ocaml that use `==` instead of `=` when testing for equality of keys? For example:
# type foo = A of int;;
# let a = A(1);;
# let b = A(1);;
# a == b;;
- : bool = false
# a = b;;
- : bool = true
# let h = Hashtbl.create 8;;
# Hashtbl.add h a 1;;
# Hashtbl.add h b 2;;
# Hashtbl.find h a;;
- : int = 2
# Hashtbl.find h b;;
- : int = 2
I'd like a hashtable that can distinguish between `a` and `b`. Is that possible?
|
You can use custom hashtables:
module H = Hashtbl.Make(struct
type t = foo
let equal = (==)
let hash = Hashtbl.hash
end)
And then use `H` instead of `Hashtbl` in your code.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 7,
"tags": "hashtable, ocaml, equality"
}
|
How to do styling in react native which makes app UI consistent over all types of mobile phone sizes
I have built an app in react native ,I have used dimensions in react native to get the screen size of phone for styling purpose still its not working properly for some handsets.My UI looks shabby on some phones.Did i missed out something other than dimensions property and also can anyone tell me how to place components which looks consistent over all size of phones
|
This is precisely what flexbox is for: <
It allows your components to be positioned and sized proportionally to the amount of space available on the device.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "react native, styling"
}
|
Reputation inaccuracy between SO profile and actual SE site (TeX.SE)
Pretty simple - My profile page on SO is off by 5 reputation when compared to the actual value on the TeX.SE site:
!Profile Page Summary \(left\) is different from actual value \(right\)
Obviously it's an insignificant amount, but perhaps it's not so insignificant for another user?
|
Long live the caching - as stated just wait a few minutes.
|
stackexchange-meta
|
{
"answer_score": 1,
"question_score": 2,
"tags": "support, status bydesign, reputation, profile page"
}
|
How to select the data where value in column A is the same, while certain value does not exist in column B?
I have a PostgreSQL database. In Column A, I have the names of the work orders. In Column B, I have the current/past status of the work order. I would like to Select only those work orders from Column A, where certain status of the work order is not present.
This is the query that I am trying:
SELECT work_order FROM table WHERE status IN ('B10') AND NOT EXISTS (SELECT work_order FROM _2221_002 WHERE status IN ('V40'))
work_order | status
123456 | B10
123456 | B40
123456 | V40
234567 | B10
234567 | B40
345678 | B10
345678 | B40
345678 | V40
I am getting empty selection. However, I would like to see the work_order output of 234567, because that is the only work_order that is missing the 'V40' status.
|
Try something along the lines of
SELECT work_order FROM table WHERE status='B10'
MINUS
SELECT work_order FROM table WHERE status = 'V40'
The minus operator is explicitly defined exactly for cases like this where you want to have elements that are part of one set, but not of another set of data from your table. < <
As mentioned by OP, Postgre calls this operator EXCEPT.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "postgresql"
}
|
Fire event when inner html in div changed
I have `div` for some informations, which are filled into with `.innerHTML` by clicking on the button. The goal is I want to `.slideDown` the div when the text in div is added. Is it possible to do it with jQuery ?
Example:
<div id="calcInfo"></div>
Adding text into div -
document.getElementById("calcInfo").innerHTML = 'someText';
I want to use this function after it :)
if ($('#calcInfo').text().trim().length > 0) {
$('#calcInfo').slideDown('slow', function() {});
};
I was trying `.change()` function, but it only works for `input` and `textarea` elements. Many thanks for answer !
Ondrej
|
You can do it by extending the $.html function. Like this:
(function($)
{
var oldHtml = $.fn.html;
$.fn.html = function()
{
var ret = oldHtml.apply(this, arguments);
//trigger your event.
this.trigger("change");
return ret;
};
})(jQuery);
Attach event handler:
$("#calcInfo").on("change",function(){
if ($(this).text().trim().length > 0) {
$(this).slideDown('slow', function() {});
};
});
When you need to change your html. Do it like this:
$("#calcInfo").html('someText');
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 3,
"tags": "javascript, jquery, html"
}
|
Which way is good to define font-family?
I'm working on project where I have to define font-family for the whole project and then I got a question in my mind that Which way is good to define **`font-family`** in my **stylesheet**?
**Like this**
*{
font-family: sans-serif,Verdana, "Trebuchet MS";
}
or
**Like this**
body{
font-family: sans-serif,Verdana, "Trebuchet MS";
}
|
`body` is better.
I would actually use:
html{
font-family: sans-serif, Verdana, "Trebuchet MS";
}
Whether you use `html` or `body`, it does not really matter, but I have seen `html` more often
The universal selector (`*`) is extremely slow. It would be like finding every possible type of html tag and giving each of those the rule **seperately**
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "css, fonts"
}
|
Is it true that for a lattice $L$, $\mathbb{R}L = \mathbb{R}^{n}$?
I have as a definition
> A lattice $L \subseteq \mathbb{R}^{n}$ is a subgroup that is free of rank $n$ such that $\mathbb{R}L = \mathbb{R}^{n}$.
I don't know if I am misinterpreting the statement, but taking $\mathbb{Z}^{2} \subseteq \mathbb{R}^{2}$, it doesn't seem to hold that $\mathbb{R}\mathbb{Z}^{2} = \mathbb{R}^{2}$. Wouldn't this imply that any point in $\mathbb{R}^{2}$ lies on a line through the origin with rational slope (so every ratio of real numbers gives a rational number)?
|
In you example, since $(0,1), (1,0) \in \Bbb{Z}^2$ you have $\Bbb{R}\Bbb{Z}^2 \supset \operatorname{span} \\{ (0,1), (1,0) \\} =\Bbb{R}^2$.
The symbol $\Bbb{R}L$ denotes the linear subspace spanned by $L$, so the condition $\Bbb{R}L = \Bbb{R}^n$ means that $L$ has $n$ $\Bbb{R}$-linearly independent vectors.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "integer lattices"
}
|
Setting up lan and also SVN server
I have to set up a LAN connection between 5 laptops, 2 using windows 7 and other 2 using windows xp and 1 using Ubuntu. I have installed VisualSVN. Now How do other people update their code to my laptop which is the central svn repository. They are using eclipse and dreamweaver IDE for development.
|
Grab TortoiseSVN and set it up in 5 min per machine.
|
stackexchange-serverfault
|
{
"answer_score": 3,
"question_score": 2,
"tags": "svn, local area network"
}
|
What snake is this?
 long but exceptionally reaching 130 cm (50 ins). The head is fairly distinct from the body and has prominent eyes with round pupils. The head and front of the body are olive-grey or yellowish-brown with dark spots separated by paler areas which may form irregular bars. There are often small white specks on some of the scales. Further back the dark spots are usually arranged in longitudinal lines giving a striped effect.
This snake is not endangered ("Least Concern") but there was no need to kill it, since it is non-venomous; you were certainly not "lucky" to kill this harmless animal.
|
stackexchange-biology
|
{
"answer_score": 2,
"question_score": 1,
"tags": "species identification, snake"
}
|
Default file for Apache localhost
I have apache2 installed. When i type < it goes to a file < . How do i change it to say < or any other page? Which file will I find the setting to do this? Thanks!
|
Apache will not trigger HTTP redirections unless you instruct it to do so.
My advice is that you open your favourite text editor and search for the `class` string in the following locations:
* `*.conf` files inside the Apache installation directory.
* `.htaccess` files inside your HTML directores.
If that fails to find anything, you could also search for `header()` calls in your `*.php` code.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 4,
"tags": "php, html, apache2, lamp"
}
|
IPHONE: CGLayer using 17 times more memory as expected
I have created a 800x1200 context using this line:
CGSize sizeX = CGSizeMake(800, 1200);
CGLayerRef objectLayer = CGLayerCreateWithContext (context, sizeX, NULL);
over this context I have a CGLayer that is 2250x2250 pixels.
This layer (objectLayer) is drawn using something like
CGRect LayerRect = CGRectMake(0,0, layerW, layerH);
CGContextDrawImage(objectContext, LayerRect, myImage.image.CGImage);
CGRect superRect = CGRectMake(0,0, sizeW, sizeH);
CGContextDrawLayerInRect(context, superRect, objectLayer);
according to my math, a 800x1200 context at 24 bpp, should be using 2.8 Mb and a 2250x2250 layer at 32 bpp should be using 20 Mb. So, in total both should be using about 23 Mb.
The problem is that instruments report just the layer to be using 38.62 Mb !!!!
How can that be? Is that some I am missing?
thanks for any help.
|
apparently there's no solution for that. It appears to be a problem on the API.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "iphone, quartz graphics"
}
|
How can I mount a folder from an ubuntu virtual machine on ubuntu?
I tried `sshfs`, but the local directory where I want to mount a folder from the VM does not open after running the command.
|
1. Install the `Guest Additions` on the virtual machine. These can be dowloaded from within the virtual machine from the _Devices > Install Guest Additions_ menu.
2. Add the folder you wish to share to the _Shared Folders_ , this option can also be found in the _Devices_ menu.
3. The folder can now be mounted with
`sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) folder ~/host`
For more info, or troubleshooting, check out this Ubuntu Help article.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ubuntu 14.04, virtualbox, sshfs"
}
|
Search and replace string under specific line
How can I do a search AND REPLACE a string. To be more specific.
I have a text file with
SAMPLE
AB
CD
..
TYPES
AB
QP
PO
..
RUNS
AB
DE
ZY
I want to replace `AB` with `XX`, only under lines `SAMPLE` and `RUNS`. I've already tried multiple ways of using `replace()`. I tried something like
if 'SAMPLE' in line:
f1.write(line.replace('testsample', 'XX'))
if 'RUNS' in line:
f1.write(line.replace('testsample', 'XX'))
and that didn't work.
|
A file is an iterator over lines in Python:
for line in file:
output.write(line) # save as is
if 'SAMPLE' in line or 'RUNS' in line:
line = next(file, "") # move to the next line
output.write(line.replace('AB', 'XX')) # save replacing AB with XX
To support SAMPLE/RUNS lines that follows another SAMPLE/RUNS line e.g.:
SAMPLE
SAMPLE
AB
you could:
for line in file:
output.write(line) # save as is
while 'SAMPLE' in line or 'RUNS' in line:
line = next(file, "") # move to the next line
output.write(line.replace('AB', 'XX')) # save replacing AB with XX
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "python, replace, find"
}
|
Org-superstar-mode not enabled from config file
I'm just getting started with emacs, and I'm trying to enable org-superstar-mode automatically upon launching an org file. I've installed org-superstar, and I can run M-x org-superstar-mode when in an org file to set it manually. However, I have the following in my .emacs:
(use-package org-superstar
:config
(setq org-superstar-special-todo-items t)
(add-hook 'org-mode-hook (lambda ()
(org-superstar-mode 1))))
and my org files still do not load org-superstar-mode by default, need to do it manually. Am I misunderstanding the purpose of 'org-superstar-mode 1'? Or have I made an error?
EDIT: I'm not sure what exactly was going wrong, but I ended up just cleaning out my .emacs file and starting from scratch. Cheers.
|
I ended up just cleaning out my .emacs folder, undownloading everything from melpa, and starting from scratch. Kept a close eye on git documentation instructions, and proceeded with care. Good luck everyone.
|
stackexchange-emacs
|
{
"answer_score": 0,
"question_score": 0,
"tags": "org mode, package"
}
|
Is there any undergraduate mathematics learning website like edx or coursera?
I want to take courses in mathematics of undergraduate level. But in edx or coursera they have only few undergrad math courses( only calculus or a little bit of algebra). There are no hardcore maths courses like group theory, ring theory etc. Is there any site where I can get these?
Thanks!
|
Take a look at MIT open courseware <
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "soft question, online resources"
}
|
htaccess setting the mimetype for a single file
In an .htaccess file one might set the mimetype for a given extension like:
AddType application/javascript .js
How would one set the mimetype for a single file instead of an extension? I have one Javascript that needs a different mimetype than other Javascript files in the same folder.
AddType application/javascript .js
AddType application/ecmascript specialfile.js
The second line does not work.
|
You can use the `<files>` container to match the file's name before adding a type for it:
<Files specialfile.js>
AddType application/ecmascript .js
</Files>
|
stackexchange-stackoverflow
|
{
"answer_score": 16,
"question_score": 11,
"tags": "apache, .htaccess"
}
|
Number system conversions
I am an Electrical Engineering student but my question is related to number systems, more specificaly to conversions between octal, hexadecimal and binary systems. I know the rules of conversions but I don't get one thing: why is it possible to convert hexadecimal or octal to binary by just substituting sequences of 3 or 4 digits to corresponding digit in the given system? I know that with a string of length three you can uniquely represent one member of a set with eight members. But after this kind of substitution this two representations must also have one important additional property: the sum of individual digits multiplied with the radix to the power of the digits weigth must be equal for both representations.
p.s. I apologize in advance for not using mathematical formulas as I don't know how :) Thanks.
|
$ \qquad\ \ \ n = d_0 + d_1 b + d_2 + (d_3 + d_4 b + d_5 b^2) b^3 + \cdots,\ 0\le d_i < b\ $ is a radix $b^{\large 3}$ expansion
$\iff n = d_0 + d_1 b + d_2 + d_3 b^3 + d_4 b^4 + d_5 b^5 + \cdots,\ \ 0\le d_i < b\ $ is a radix $b$ expansion
Indeed, both are valid radix expansions, so equality follows by the _uniqueness_ of such expansion.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "number systems"
}
|
Qt <winInet.h> outputs many C4430 & C2146 Errors on build
List of Errors
I think I have included the library for winInet.h in the QT Project file here:
project.pro
QT += qml quick network
CONFIG += c++11
SOURCES += main.cpp \
xmap.cpp
RESOURCES += qml.qrc
LIBS += -lwininet
Everytime I try qmake and build the header file shows many syntax errors and I'm curious if its because I'm wrong in my qt project file syntax.
xmap.h
#ifndef XMAP_H
#define XMAP_H
#include <iostream>
#include <WinInet.h> // <--- ISSUE
#include <Windows.h>
#include <time.h>
class xmap
{
public:
xmap();
// test connection to websites for data
int CheckConnection(int connection = 0);
// pull data from online sources to be evaluated by the model
void RequestAndSaveData(std::string filename);
};
#endif // XMAP_H
|
Essentially the same as C++ 307 Errors when trying to include winhttp.h in visual studio 2010, except that was using WinHttp instead of WinInet.
Still, same solution: include `<Windows.h>` _before_ `<WinInet.h>`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "c++, windows, qt, header files"
}
|
escaping the backslash inside \immediate\write18 with del command
I pasted the following line into the DOS PROMPT/DOS Command Line:
del D:\myTempFolder\myTempFile.txt
It worked well -- I was able to delete the file `myTempFile.txt'' inside the folder`myTempFolder''. I did not use the forward slash since it has a different meaning (switches) when associated with the del command.
I was wondering if I can implement the preceding routine inside a LaTeX file, so i tried the following:
\documentclass{article}%
\newcommand*{\myFolderName}{myTempFolder}
\newcommand*{\myFileName}{myTempFile.txt}
\begin{document}
\immediate\write18{del D:\textbackslash\myFolderName\textbackslash\myFileName}%
\end{document}
The file ``myTempFile.txt'' was not deleted. May I know where my mistake is? I think the problem here is escaping the backslash inside \immediate\write18 with the del command.
Thank you for any help.
|
you can use
`\@backslashchar` as in
\makeatletter
\immediate\write18{del D:\@backslashchar myFolderName\@backslashchar myFileName}%
\makeatother
or more simply avoid expanding the undefined tokens `\myFolderName` by using `\string`.
\immediate\write18{del D:\string\myFolderName\string\myFileName}%
|
stackexchange-tex
|
{
"answer_score": 2,
"question_score": 0,
"tags": "shell escape"
}
|
TeamCity: how to attach dotcover to Rake build configuration?
I'm using Rake for my build process. I wanted to take advantage of included dotcover in TeamCity 6. I read tutorial from Hadi Hariri ( but it shows how to do this with MSBuild, not Rake.
When you choose RunnerType: MSbuild, you have the ".net coverage tool" option available at the bottom. However, when you choose Rake, you don't have this at all.
Do I need to create a custom msbuild file to run coverage ? Or are there any tricks that would allow me to just keep additional task in my single rake file ? thanks
|
You can find dotCover executable on `$(teamcity.agent.home.dir)\plugins\dotCover\bin`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "teamcity, code coverage, dotcover"
}
|
Did prophet Muhammad do this
I saw a hadith about prophet Muhammad being intimate with his concubine, Maria, in his wife Hafsa’s bed. When she saw this he told her not to tell Aisha about it and that he wouldn’t go near Maria again. Is this true and why would he not want Aisha to know about it if it was permissible for him to be with Maria? Also, why would he choose do this on Hafsa’s day and on her bed? Can someone please shed some light on this
|
It is simply not authentic. How can we justify what is not authentic?
|
stackexchange-islam
|
{
"answer_score": 0,
"question_score": 0,
"tags": "hadith, prophet muhammad"
}
|
Process safe logging library for c++
Is there any process safe logging library which can write same file from multiple process for C++?
I tried log4cxx. Some advices to use SocketConnector to write same file. But i did not find any real working sample.But any way i do not want my logger api open a tcp connection.
|
Have you looked at logging using ETW points? It facilitates logging text strings as well. Downside is that your logs won't be human readable unless run through some other tools.
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "c++, visual c++, logging, log4cxx"
}
|
Finding the value of $\int{F \cdot dr}$
Find the value of $\int{F \cdot \mathrm{d}r}$, where $$F(x,y) = \langle 5e^y+ye^x,e^x+5xe^y \rangle$$ and $$C: r(t) = \left\langle\sin\left(\frac{\pi t}{2}\right),\ln(t)\right\rangle; 1\le t\le2$$ So far, I've tried substituting in using the parametriziation suggested by the $r(t)$ function into the $F(x,y)$ vector field but that produced such a big integral there's no way of evaluating it. Any help would be welcome, thank you in advance!
|
As seen in the comments (and corrected on one key point), we can parametrize and set up the integral $$\int_C F\cdot d\mathbf{r} = \int_1^2 [5t+\ln(t)e^{\sin(at)}]a\cos at + \frac{e^{\sin(at)}+5\sin(at)e^{\ln t}}{t}\,dt$$ where $a=\frac{\pi}{2}$, abbreviated to simplify the typography.
This works, but it's messy.
Instead, note that we can write $F$ as a gradient $F=\nabla G$, where $G(x,y)=5xe^y+ye^x$. Then $G$ acts as an antiderivative; we can apply the line integral version of the FTC to get $$\int_C F\cdot d\mathbf{r} = G(r(2))-G(r(1)) = G(0,\ln 2) - G(1,0) = \ln 2 - 5$$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "calculus, multivariable calculus, line integrals"
}
|
Do "I ate many noodles today" and "you should eat many vegetables" sound wrong?
According to dictionary " **noodle** " is a countable noun and often in plural form
I learned that we can use " **many** " before countable nouns.
Does " **I ate many noodles today** " sound wrong?
In addition, "vegetable" is also a countable noun
Does " **you should eat many vegetables** " sound wrong?
|
The noun "noodle" is countable, and this expression is grammatical:
> I ate many noodles today.
However, it is unidiomatic. People don't count the number of noodles they are eating. (Unless they are fanatical dieters!)
The idiomatic expression is
> I ate a lot of noodles today.
The situation with "vegetables" is a little different, because "many vegetables" can mean a wide variety of different kinds of vegetables.
> You should eat many vegetables.
probably means that you should eat many different vegetables.
If you are saying that someone should increase the amount of vegetables in their diet, then you would say
> You should eat a lot of vegetables.
|
stackexchange-ell
|
{
"answer_score": 1,
"question_score": 0,
"tags": "word usage, word choice, uncountable nouns, countable nouns"
}
|
Is it "D.J., "DJ" or "deejay"?
This is in the context of a person who plays recorded music at a party or club. Referring to such a person as a "disk jockey" or "jock" seems hopelessly old fashioned. Three variants are in vogue and all are heavily used. Wikipedia redirects _deejay_ to disc jockey and states it is "also known as _DJ_." From the NYT in 2011: "a not-so-green affair with 50 to 80 people at a hot club with an open bar and a hip-hop deejay." The same source a couple of days ago: "after having spent 30 years as an entertainment industry functionary — as a D.J., promoter and record label exec."
The Washington Post earlier this month wrote: "Martin Solveig will serve as the house _deejay_ at the Gibson Amphitheatre show." Also, many stage names in the music business favor one form, as in DJ Spooky, DJ Jazzy Jeff, DJ Skribble, etc.
Is there a preferred version of the term?
|
I imagine that the all-lower-case **deejay** is favoured by publications that try to avoid acronyms and initialisms. Where they are permitted, whether to include or omit the abbreviation marks is a matter of style.
In British English, **deejay** is not used. (Neither is the similar **emcee**.)
Note also that **DJ** is occasionally used informally as an abbreviation for **dinner jacket**!
|
stackexchange-english
|
{
"answer_score": 3,
"question_score": 4,
"tags": "slang, abbreviations"
}
|
L'hospitals Rule applications
let $f(x)=x^2sin\frac{1}{x}$ and $g(x)=sinx$
The book says that $\lim\limits_{x\to 0}\frac{f(x)}{g(x)}$ exists. How come?
$$\frac{f(x)}{g(x)}=\frac{x^2sin\frac{1}{x}}{sinx}$$
as $x\to 0$ $\frac{f(x)}{g(x)}\to\frac{0}{0}$ Or is this discontinuity removable? If so , I couldn't remove it.
I'm not using l'hospitals rule since limit of $\frac{f'(x)}{g'(x)}$ does not exist.
|
L’Hôpital’s theorem says that, under certain initial hypotheses (look at your textbook for them), if $$ \lim_{x\to c}\frac{f'(x)}{g'(x)}\tag{*} $$ exists (finite or infinite) and is $l$, then also $$ \lim_{x\to c}\frac{f(x)}{g(x)}=l $$
However it says nothing if the limit (*) doesn't exist, which is precisely the case at hand.
> L’Hôpital’s theorem **_doesn't say_** that $$ \lim_{x\to c}\frac{f(x)}{g(x)}=\lim_{x\to c}\frac{f'(x)}{g'(x)} $$ when the initial hypotheses are satisfied.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "calculus"
}
|
"that's why" in formal essays
"I'm", "it's" are forbidden in formal essays.
Can I use "that's why" in the opening of my Statement of Purpose?
> Fancy flights used to fill me with euphoria, that's why I named myself Joseph, but now ...
It sounds a little awkward to use "that is why," though I'm not a native English speaker.
|
I see no problem with the phrase _that's why_ in informal speech, or the word _that's_ in an essay. However, in “Fancy flights used to fill me with euphoria, that's why I named myself Joseph...” you have a run-on sentence structure. To avoid it, replace _that's why_ with conjunction _so_ :
> Flights of fancy used to fill me with euphoria, so I named myself Joseph...
(I replaced “fancy flights” with “flights of fancy”. “Fancy flights” might refer to elaborate airplane trips or getaways, even perhaps Joseph in his coat of many colors fleeing to Egypt. “Flights of fancy” refers to imaginings, to thinking of desired things, of castles in the air.)
|
stackexchange-english
|
{
"answer_score": 6,
"question_score": -1,
"tags": "writing, contractions"
}
|
How can I configure the Windows 7 firewall to prompt me on outbound traffic?
Can I configure the built-in firewall in Windows 7 to ask me if I want to let a program open an outbound connection?
I can disable all outgoing traffic and manually create rules for programs, but I can't find a way of letting the firewall prompt me when a program wants to initiate an outgoing connection.
|
Try Windows 7 Firewall Control (the free version is good enough). This program is small, works with the Windows Firewall core - but is independent from the Windows Firewall application itself - and will ask you what to do. There is an annoying sound but this can be disabled.
I found that if you turn off the application, all new programs without firewall rules are blocked without notification.
|
stackexchange-superuser
|
{
"answer_score": 29,
"question_score": 44,
"tags": "windows 7, firewall"
}
|
In TDD, should tests be written by the person who implemented the feature under test?
We run a project in which we want to solve with test driven development. I thought about some questions that came up when initiating the project. One question was: Who should write the unit-test for a feature? Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer, who defines what a method should do and the feature-implementing programmer implements the method until the tests runs?
If I understand the concept of TDD in the right way, the feature-implementing programmer has to write the test by himself, because TDD is procedure with mini-iterations. So it would be too complex to have the tests written by another programmer?
What would you say? Should the tests in TDD be written by the programmer himself or should another programmer write the tests that describes what a method can do?
|
In TDD the developer first writes the unit tests that fail and then fixes the production code to make the test pass. The idea is that the changes are made in really small steps - so you write a test that calls a method that doesn't exist, then you fix the test by adding an empty method, then you add some assertion to the test about the method so it fails again, then you implement the first cut of the method, etc. Because these steps are so small it is not practical to have a separate person write the tests. On the other hand I would recommend pairing, so that you gain some additional eyeballs making sure the code makes sense.
I think it would be possible to have another person/team/or even client (when you use tools like Fitness) to write acceptance tests, that test the whole functionality on a higher level.
|
stackexchange-stackoverflow
|
{
"answer_score": 14,
"question_score": 12,
"tags": "unit testing, tdd"
}
|
Is there any way for adding non-form elements to GET URL?
I need to pass some data over GET URL which is not in form, is there any way to include non-form data into GET method?
which is ok for form elements like visitorName and visitorPhone, but i need to pass some other info also with this, like some fixed non-form data.
And i have to use only html, in form submitting page, no php.., target is php.
|
You can use input `type=hidden` for this purpose.
For e.g.
<input type="hidden" name="fixedData" value="some data" />
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "php, html, forms, web"
}
|
Which component is anchor when aligning in KiCad layout?
I simply can not figure out the logic behind which component moves and which one is used as the anchor when using the align functions in the KiCad layout. Is there something I'm missing?
What about when aligning multiple components at the same time?
|
If you have your mouse over an item when aligning, that is your anchor. Otherwise, it is the left most/right most/top most/bottom most element
|
stackexchange-electronics
|
{
"answer_score": 2,
"question_score": 0,
"tags": "kicad"
}
|
How to upload api to App Store from command line with Xcode 11?
I want to upload my api (using Adobe Animate to make api) to apple store, how can I do that, please help me.
I am using command line to upload and Xcode 11 my code :
int main(int argc, const char * argv[]) {
@autoreleasepool {
xcrun altool --upload-app -f Pass.ipa -u Myname -p Mypassword
}
return 0;
}
error in (xcrun altool)
I Tried to use application loader but it give me errors in icons, how can me upload my api to my apple store account.
Is there another way to upload the app? thanks for all.
|
**الحمد لله رب العالمين**
I solved my problem by using Application loader in uploading the IPA, And solved my problem of losing icons in asset catalog by This way :
1- choosing Generic iOS Device before building form Xcode. 2- go to product in Xcode and choose build.
> > > > > > > Look At Attachment Pic.
Solve the problem of losing icons in Xcode
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "ios"
}
|
graphite: Display Sum of Data Since Midnight
I have a grafana dashboard display today's registered users. I want a "singlestat" board start calculate from midnight of last night, regardless of the time range I chose.
I tried `summarize()` or `timeStack()` but didn't work. Any tips?
|
Sovled.
Graph -> Edit -> Time Range
use
now/d
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "time series, graphite, grafana"
}
|
How to “one-click” delete a file that is currently playing on Media Player Classic
Is there a way to do it straight from MPC or could I create a separate program that would detect the file that is currently playing and delete it (I know it is possible to delete files while they are currently playing in MPC).
|
I'm not sure when it was added, but version 1.7.13 (MPC-HC) from 2017 has a **Move to Recycle Bin** command which works on the currently playing file.
You can change the default hotkey in the settings screen. When clicked it will move to the next item in the current playlist and show a confirmation prompt. It's not 'one-click' but pretty close.
 looks like.
http.Handle("/", http.FileServer(http.Dir("/static/")))
http.ListenAndServe(":8989", nil)
It works but i dont understand what does static mean! Someone please explain.
|
This means that whenever you handle requests that serves HTTP requests with the contents of the file system rooted at root, it try to server files declared in `http.Dir` which uses the operating system's file system implementation.
This means that whenever you access your web server index url it will try to serve files under the operating system `/static/` directory.
To serve a directory on disk under an alternate URL path you can use `StripPrefix` to modify the request URL's path before the `FileServer` sees it.
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("/your/directory/to/static/files"))))
http.ListenAndServe(":8989", nil)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "go, static"
}
|
Rearranging a Staircase Grid into a Square
!enter image description here
Is there any way to rearrange the above "staircase" grid into **three** pieces that can be rearranged into the 6x6 square grid below it? I have tried this problem for over six hours and have not arrived at any solution. There _has_ to be some general strategy in approaching this problem other than brute force, right??
I would appreciate any and all help--hints, suggestions, anything... I've gone mad trying to solve it
:(
|
$$\def\r{\color{red}{1}}\def\b{\color{blue}{2}}\def\g{\color{green}{3}} \matrix{\r\cr \r&\r\cr \r&\r&\r\cr \r&\r&\r&\r\cr \r&\r&\r&\g&\g\cr \r&\r&\r&\g&\g&\g\cr \b&\b&\b&\g&\g&\g&\g\cr \b&\b&\b&\g&\g&\g&\g&\g\cr}$$ can be rearranged as $$\matrix{\g&\g&\g&\g&\b&\b\cr \g&\g&\g&\g&\b&\b\cr \g&\g&\g&\r&\b&\b\cr \g&\g&\r&\r&\r&\r\cr \g&\r&\r&\r&\r&\r\cr \r&\r&\r&\r&\r&\r\cr}$$
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 4,
"tags": "geometry, puzzle"
}
|
Do I need to use jQuery Map?
I'm including jQuery via this Google CDN:
//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
The only reason I'm using jQuery is because of Bootstrap, which I'm loading from this CDN:
//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js
The problem is that whenever my page loads, the slowest file to come is `jquery.min.map`. which returns a 304 GET and takes over 50ms to load. I understand Javascript maps are to debug obfuscated/minified code? Not sure why I'd need this in a production application.
Thanks!
|
The file is being loaded by your debug tools in the browser. You can disable it in the options.
!enter image description here
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "javascript, jquery, twitter bootstrap"
}
|
Unexpected C code output
This is my c code:
#include <stdio.h>
int main(){
int x[] = {6,1,2,3,4,5};
int *p=0;
p =&x[0];
while(*p!='\0'){
printf("%d",*p);
p++;
}
return 0;
}
When run the output is 612345-448304448336
What are the digits after the minus sign and why is my code giving this?
|
The condition `*p != '\0'`, which is the same as `*p != 0`, is never met because your array doesn't contain an element of value `0`, and thus you overrun the array bounds and step into _undefined behaviour_.
Instead, you should control the array range directly:
for (int const * p = x; p != x + sizeof(x)/sizeof(x[0]); ++p) // or "p != x + 6"
{
printf("%d", *p);
}
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "c, pointers"
}
|
Extrude bone from extruded bone
I'm making a model for a person, and I need to do the upper/lower arm. I already extruded a bone from the spine for the upper arm, but when I extrude a bone from the upper arm, It also extrudes a bone from the spine. Can someone help?
|
The bone which head is selected will be extruded. While selecting the already extruded bone, the bone from which you have extruded remained selected.
How to:
In Edit Mode:
Deselect everything
Select bone head, which you want to extrude.
Extrude
Deselect everything
and so forth...
|
stackexchange-blender
|
{
"answer_score": 0,
"question_score": 0,
"tags": "modeling, bones"
}
|
Should I add the .NET framework directories to my PATH?
I sometimes need to run gacutil.exe or installutil.exe, etc. from the command line. Is it OK to add the .NET framework directories to my system PATH? If so, which ones should I add and in which order?
|
I always add the following to my path:
1. C:\Windows\Microsoft.NET\Framework\v3.5
2. C:\Windows\Microsoft.NET\Framework\v2.0.50727
I sometimes need to compile on the command line when I write simple stuff and also to use gacutil and regasm.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 10,
"tags": ".net, command line"
}
|
Generate extra column in a dataframe by concating all the columns whose headers matches with strings in a list using python
I have a dataframe named :- `df_explode` inputdataframe
I have a list of strings "`myList_groupby`".
myList_groupby = ["domain","tag_name","tag_hierarchy","html_attributes","extension","xyz"]
I want to generate a new column named "combined" in `df_explode`,whose elements will be a string concatenation for all the columns whose header matches with strings in `myList_groupby` list.(is in `myList_groupby`)
Output dataframe :-
outputdataframe
|
I think need filter columns by subset and call `join` per rows:
df['new'] = df[myList_groupby].apply('_'.join, axis=1)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, pandas, dataframe"
}
|
Magento not upgrading from 1.9.2.4 to 1.9.3.1
I created a copy of my site on xammp as a Development version to test the upgrade from 1.9.2.4 to 1.9.3.1 . But when I went forth and carried out the upgrade, I got no errors although going to magento connect my version shows 1.9.2.4. Looking at core_resources table the data_version numbers match 1.9.2.4. So looks like a failed upgrade.
I used the method of replacing the app > core folder with the new one. And the frontend base default folder, Then mage.php file with new one. From here I deleted local.xml and went through installation. Could you guys help with what is the best way to upgrade and where did I go wrong?
|
select all file from fresh 1.9.3.1 magento and paste it to your site.
clear cashe ans session from var.
your site is upgrade to 1.9.3.1
|
stackexchange-magento
|
{
"answer_score": 0,
"question_score": 0,
"tags": "magento 1.9, upgrade"
}
|
Oracle SQL: Splitting a group by based on multiple rows criteria
I have data where a single address can have multiple journeys, something like this:
 and aggregate the costs, so each address can have multiple rows based on the number of journeys, something like this:

from (select t.*
--Replace OrderCol with a column that specifies row order
,sum(case when journey='Start of Journey' then 1 else 0 end) over(partition by address order by OrderCol) as grp
from tbl
) t
group by address,grp
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "sql, oracle12c"
}
|
Batch Script Removing characters from a variable inside a FOR loop
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%A IN (*.*) DO (
SET var=%%A
ECHO !var:~0,-4!
)
Since we're iterating the variable within the FOR loop, you have to use `!` around the variable, however, in conjunction with the method `:~#,-#` to remove characters from the end of the variable, it doesn't take.
In my example, we are just removing the extension from the filename. I understand that you can use `%%~nA` to just get the filename, but this is just an example of usage.
Is there a way to do this inside of the FOR loop? Maybe a different method than what I am using?
|
It could fail if there are hidden spaces behind `set var=%%A`.
Then you only remove the spaces, therefore it's better to use
`set "var=%%A"`
It's independent of hidden spaces, even characers are ignored behind the last quote.
But perhaps your problem is of a completly different type?
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "variables, for loop, expand, batch file"
}
|
sentence with まだ近所迷惑程度で済んだ - how to translate
Chapter 1 of has the following sentence.
> __ (my italics)
Two things stood out when I was trying to make a translation. One is . What sort of crying is this exactly? Or would we just say crying with the sound "peepee"?
As for the italics part, I attempted this overall translation.
> However, while I cried with a waah waah from inside the house, I still ended up being a nuisance to the neighbourhood.
(I realise means 'during', not 'inside'). I'm not entirely sure about why is included, although before the text does mention the protagonist crying before as well as a result of his separation from his mother. Another thing that confused me is the construction. I thought this was generally used in the positive sense of "get by without ~ing", but here it appears to be negative. Please enlighten me.
|
> crying with the sound "peepee"
Theoretically so. But it's actually an onomatopoeia that diminutively and figuratively hints crying of a small animal like a bird chirping.
>
>
> I still ended up being a nuisance to the neighbourhood.
This means something like "only being." He is saying that he was still "just being a nuisance to the neighbourhood" at that stage or time but this hints he would be a bigger problem later.
|
stackexchange-japanese
|
{
"answer_score": 2,
"question_score": 1,
"tags": "translation"
}
|
"FF" error code on a MSI 890FXA GD70 motherboard
I think I've lost 1/3 of the hair on my head...
My motherboard has stopped working completely and all LEDs light up blue. I've disconnected everything except for:
* AMD Phenom II X6 1055T Thuban 2.8GHz Socket AM3 125W
* Antec BP550 Plus RT PSU (550W)
* 1 x BFG Tech BFGE981024GTGE GeForce 9800 GT 1GB
* 1 x Corsair XMS 4GB 240-Pin (DDR3 1333)
I push the power button and _all_ of the LEDs light up. I tried re-seating the CPU and moving the RAM to the first and last RAM slots, but that didn't change anything.
I don't get any video output and the error LED shows **FF** and reboots every 1/2 of a second.
Does anybody know what I can do to fix this?
|
On person "knocked the shunt off the jbat1 prongs" on the motherboard which caused this FF error.
. !enter image description here
I would assume any sort of improper assembly can cause this FF error , CPU or memory not properly seated, wrong memory or PSU, etc.
|
stackexchange-superuser
|
{
"answer_score": 3,
"question_score": 0,
"tags": "boot, motherboard"
}
|
Firestore fetching all documents on a node.js server. Scalability
Every night at 12pm I am fetching all of the users from my firestore database with this code.
const usersRef = db.collection('users');
const snapshot = await usersRef.get();
snapshot.forEach(doc => {
let docData = doc.data()
// some code and evaluations
})
I just want to know if this is a reliable way to read through all of the data each night without overloading the system. For instance if I have 50k users and I want to update their info each night on the server, will this require a lot of memory server-side to do? Also, is there a better way to handle what I am attempting to do, with the generic premise of updating the users data each night.
|
Your code is loading all documents in a collection in one go. Even on a server, that will at some point run out of memory.
You'll want to instead read a limited number of documents, process those documents, then read/process a next batch of documents, until you're done. This is known as paginating through data with queries and ensures you can handle any number of documents, instead of only the number that can fit into memory.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "node.js, google cloud firestore"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.