INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How to append object field value as string in textarea on clicking particular object field using angular js i want to append object value to textarea on clicking on particular object field of ng-repeat. < <div ng-repeat="list in listing"> <a href="">{{list.name}}</a> </div> <br> var myApp = angular.module('myApp', []); myApp.controller('Main', function($scope){ $scope.listing = [{id :"1", name:"one"},{id :"2", name:"two"},{id :"3", name:"three"}]; $scope.complaint = ""; });
Create a function to do the adding in your controller, for example: $scope.addToTextArea = function(item) { var newline = String.fromCharCode(13, 10); $scope.complaint += item.name + newline; } and hook into this using the ng-click directive: <a href="" ng-click="addToTextArea(list)">{{list.name}}</a>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, angularjs" }
True Bypass Looper and Effects Loop I am thinking of getting myself a looper to control my effect pedals. Right now some of my pedals are connected via the effects looper and some of them are in the amp front. My question is, if I buy a looper and connect all pedals through the looper, will I only have to put all pedals through the front of the amp?
If you want all the effects to be loopable, then they will all be either in the amp input or the effects loop. I would tend to put them all in the effects loop. To split them out you would need two loopers. The only exception to this would be if there was a multi-track looper that let you route tracks from different inputs to different outputs. I haven't seen such a thing outside of a full featured DAW.
stackexchange-music
{ "answer_score": 1, "question_score": 1, "tags": "electric guitar, amplifiers, guitar effects" }
Is there a nodecomment equivalent/replacement for D7? When I build help ticket systems for folks on D6, I use one content type for the ticket and a second content type with Nodecomment for replies. This lets me ensure that only the ticket owner and the internal helpdesk can see ticket history, and keep internal-only notes unpublished (vs no ability for internal notes with a comment). Is there an equivalent for this in D7, or a better approach to take with contrib, or do I need to write a custom module to handle this?
@Chris You started me down the right path, thanks so much! I've tested and can implement it this way without writing any custom code: * Create 3 content types: Helpdesk Ticket, Ticket Internal Note, Ticket External Note. * Create a role called Helpdesk Volunteer. * Put a node reference field on Ticket Internal Note and Ticket External Note using the node reference URL widget. * Use the Content Access module (currently still in dev) to restrict view/edit/delete of the Ticket Internal Note content type to users in the Helpdesk Volunteer role. * Create a view with EVA that attaches to the Helpdesk Ticket content type, set to display both internal and external notes. Afterwards, it's just a touch of prettification and theming as needed. Add a file attachment upload field and a ticket category. Maybe implement messaging/notifications to have email notifications and reply-by-email. Fully functional helpdesk on D7!
stackexchange-drupal
{ "answer_score": 1, "question_score": 0, "tags": "7, nodes" }
Add class if HTML tag is empty I need to add a hidden class in my JS if the span is empty, but if it isnt show the content. **HTML** <div id="uploadControls"> <br><span id="uploadsError" class="validErrors smarterr"></span> </div> **JavaScript** $(document).ready(function () { $('#uploadControls').find('span').each(function () { if ($(this).is(':empty')) $(this).addClass('.hidden'); });
A simple typo! $(this).addClass('.hidden'); ^ The class name string has a `.`. addClass is not a selector, just the name[s] to be added. It should be $(this).addClass('hidden'); and you can just do it with the selector, no each/find is needed. $("#uploadControls span:empty").addClass("hidden");
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "javascript, html" }
Clutters with no maximum-size matchings A _clutter_ is a pair $C=(V,E)$ where $V\neq\emptyset$ is a set, and $E\subseteq {\cal P}(V)$ such that no member of $E$ is included in another member of $E$. A _matching_ in $C$ is a collection of pairwise disjoint members of $E$. Zorn's Lemma implies that every matching is contained in a maximal matching (with respect to $\subseteq$). Is it possible to find a clutter $C=(V,E)$ with $E\neq\emptyset$ and for every matching $M\subseteq E$ there is a matching $M'\subseteq E$ with $|M|<|M'|$?
Yes, this is possible. For each prime $p$ and $c \in \\{0,1, \dots, p-1\\}$ let $A_{c,p}=\\{c+kp \mid k \in \mathbb{Z}\\}$. Clearly, the set of all $A_{c,p}$ is a clutter $\mathcal C$ with ground set $\mathbb{Z}$. If we fix $p$, then the set of $A_{c,p}$ is a matching of size $p$. Since there are infinitely many primes, $\mathcal C$ has arbitrarily large finite matchings. On the other hand, no matching of $\mathcal C$ is infinite. To see this, it suffices to prove that if $A_{c_1,p_1}$ and $A_{c_2,p_2}$ are disjoint, then $p_1=p_2$. Suppose $p_1 \neq p_2$. By shifting both sequences by $c_1$, we may assume that $c_1=0$. Choosing $k \equiv -c_2 p_2^{-1} \pmod{p_1}$, we have $c_2+kp_2 \equiv 0 \pmod{p_1}$, and so $A_{c_1,p_1} \cap A_{c_2,p_2}$ is non-empty.
stackexchange-mathoverflow_net_7z
{ "answer_score": 5, "question_score": 1, "tags": "co.combinatorics, set theory, infinite combinatorics, hypergraph, matching theory" }
Is there a way to fullscreen python cmd window without using os lines and columns I would like to make an application where if you run it, the cmd goes fullscreen is there a way to do that without using columns and rows with `import os`. Or will that be my only bet? I would like to have it setup like this import example full.screen() application here <- can be whatever. Does anyone know how to do this? Other solution are accepted as well. Thanks in advance
import time import ctypes kernel32 = ctypes.WinDLL('kernel32') user32 = ctypes.WinDLL('user32') SW_MAXIMIZE = 3 hWnd = kernel32.GetConsoleWindow() user32.ShowWindow(hWnd, SW_MAXIMIZE) time.sleep(20) This worked for me.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python" }
How can I search the contents of .module files? I'm working with Drupal at the moment and I'm having a real hard time searching the contents of various .module files. For example I want to search for something like "`div style="border: 1px solid red;`" and find out which file it's in. All my code editors ignore the .module files in their search because it is a strange extension. Windows won't do it because it's on a networked location. Any ideas?
Install Cygwin, open a shell in your Drupal site's directory, and use `grep` \--- a commandline utility to search files using regular expressions. Something like this: grep -r 'div style="border: 1px solid red;"' * would recursively search every file for that string. Or: find . -name '*.module' -exec grep -H 'div style="border: 1px solid red;"' {} \; would search only the `.module` files.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "php, search, drupal, ide, dreamweaver" }
Is this a hyperplane or a half-space in $\mathbb{F}_2^n$? Simple terminological question: the equation $x_1+\dots+x_n = 0$ over $\mathbb{F}_2^n$ is called a subspace. I'm wondering if we could also call it a hyperplane, a half-space or neither? The equality sign seems to suggest it's a hyperplane, but the fact that it always cuts the space exactly in half seems to suggest it's a half-space. Just curious!
It's certainly a hyperplane - to my mind "hyperplane" is just another word for affine subspace, usually exactly one dimension lower than the enclosing space, as in this case. It's also half a space, but I would find calling it a "half-space" confusing. It doesn't fall under Wikipedia's definition of a half-space, which matches my use of the term: A half of a space separated from the other half by a plane in a symmetric way, either including (closed) or not including (open) that plane, but not _being_ that plane.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "linear algebra, vector spaces, terminology, finite fields" }
Run with interval until condition or a certain time elapsed I need to write a piece of code that is: 1. Run on every configured interval 2. Stops after a certain amount of time OR after a condition is met. I found that I can use a `Task` with `CancellationToken` but I can't see any option to run a it again and again within an interval. Another option I saw is to use `System.Threading.Timer` \- but then I can't cancel the process if a condition is met. Can someone suggest an elegant solution ?
You can do this easily using Reactive Extensions: int maxDurationInseconds = 5; bool condition = true; var timer = Observable.Interval(TimeSpan.FromSeconds(1)) .TakeWhile(i => i <= maxDurationInseconds) .TakeWhile(i => condition) .Subscribe(i => { Console.WriteLine(i); }); Console.ReadLine(); timer.Dispose(); The above code will show the elapsed seconds until the threshold is reached or the condition becomes false. `i` represent the amount of seconds passed. A good reference for Rx can be found here. Or take a look at the GitHub repo.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "c#, multithreading" }
how add an array to another array that exist in an object in mongodb here is my schema const CustomerSchema = mongoose.Schema( { name: { type: String, trim: true, }, purchased: { modelsId: [{ type: mongoose.Schema.ObjectId , trim: true, }], collectionsId: [{ type: mongoose.Schema.ObjectId, trim: true, }] } }, { timestamps: true } ); and i want to add an array to modelsId array in purchased object with mongoose Customer.findOneAndUpdate({ _id: customer._id }, { $addToSet: { 'purcased.modelsId': { $each: modelsId } } }, { new: true }).then(res => { console.log('response', res) }).catch(e => { console.log('error', e) }) and it's not working! thank you for your help!
Looks like you may just have a simple spelling error? Try changing `'purcased.modelsId'` to `'purchased.modelsId'`. You're just missing an 'h' I think!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "node.js, mongodb, mongoose" }
Set app-background as homescreen/springboard background I know that pre-ios7 one could only get few things from outside of the sandbox, however... one thing that seems more common when using Apple's apps (!) is that they use a background which is the same as the springboard background. One example is the "Reminders" app, which uses a translucent background of the springboards background. I have search here and on Google, but can't find an answer to my question. Is there anyway I can do this as well in my own app? With default iOS background: !Out of the box Onces the springboard background is changed: !enter image description here Related post: Use user's Background Image as "theme"
I'm pretty sure Apple uses a private API to do this. I don't think they provide a way for developers to get to it - which is unfortunate, because it's a nice effect.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, objective c, cocoa touch, springboard" }
Isn't an oblique rotation against the whole spirit of principal component analysis? I am studying principal component analysis (PCA) as a method to deal with multicollinearity. And when studying the rotation method -- which, if my understanding is correct, is the center of the PCA -- I read that two different rotations can be applied : either an orthogonal rotation using the varimax procedure or an oblique rotation using the promax procedure. Now my question is a conceptual question : the orthogonal varimax procedure creates independent components based on a cluster of several variables ... while the oblique promax procedure creates several components that are potentially all linked to the all of the original variables ... isn't that last procedure against the whole spirit of the PCA procedure whose aim is to create totally independent principal components ?! PS. If the question shows too little studying, I of course welcome a simple link to any source you think is reliable.
From "Methods of Multivariate Analysis; Second Edition" by Alvin Rencher (p. 403): > However, the new rotated components are correlated, and they do not successively account for maximum variance. They are, therefore, no longer principal components in the usual sense, and their routine use is questionable. So I would say that your thinking is on the right track, though that does not stop some people from rotating anyways. Dr. Rencher was my teacher for multivariate stats and in person he was even more adamant about the problems of rotating principle components and still calling them principle components.
stackexchange-stats
{ "answer_score": 3, "question_score": 0, "tags": "regression, pca, rotation" }
Graphs to download > **Possible Duplicate:** > Data for testing graph algorithms I recently developed a parallel algorithm to solve the vertex cover problem. now i need some graphs so i can test the speed of my algorithm vs the sequential code. where can i find graphs? i am looking for something similar to this text file: 3 3 1 0 1 2 0 2 the first 2 numbers (3 and 3) states that there are 3 vertices and 3 edges in the graph. following this line is 3 edges.
If you want _challenging_ instances for the vertex cover problem: <
stackexchange-cstheory
{ "answer_score": 8, "question_score": 2, "tags": "graph theory, co.combinatorics, graph algorithms, data sets" }
Better way to check multiple variables equal a single value in Python In Python I want to check the following: if x is None and y is None and z is None and ... I'd rather say something like: if x, y, z is None: But that's not valid syntax. Is there a better way to do this?
You want to make sure all expressions satisfy a condition. The Python builtin `all` is made precisely for that. Since we have no need to introduce a new variable name, here I'll use the name `_`, which is a valid Python name and is the convention for a "throw-away" variable. all(_ is None for _ in (x,y,z))
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python, syntax" }
How to manipulate TEXT, NTEXT data from sql server trigger i hard that TEXT, NTEXT data can not be manipulated from sql server trigger. is it true. if not then please explain how could i manipulate TEXT, NTEXT data from sql server trigger. thanks
Don't use text or ntext. Use nvarchar(max) or varchar(max) Harsh, but they have been deprecated for a reason... Edit, just remembered. You may be able to use INSTEAD OF triggers
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "sql server 2005" }
Why should I trust the "System program problem detected" dialog? This always shows up a few minutes after I log in: !screenshot I have no idea what it is. If I click _Report problem_ , it asks for my password: !screenshot This is exactly what I would do if I wanted to steal someone's password. Why should I trust it, and what is it going to do next if I comply?
You're absolutely right, there is a possibility that this is some other software masquerading as Apport (the bug reporting software). I wouldn't worry about it though, as this is the expected behaviour of Apport. If you have it enabled and a program crashes, a window similar to this will appear. Sometimes Apport needs to run as root to gather system information and send it to Launchpad. If you don't want to run this risk, just disable Apport. If you do decide to trust this prompt, you'll be able to inspect the report and find out which program is crashing on login. To disable Apport: 1. Press `Alt` \+ `F2` 2. Type `gksu gedit /etc/default/apport` and press `Enter`. 3. Replace the line `enabled=1` with `enabled=0`. 4. Save and exit. You might have to reboot for the setting to come into effect.
stackexchange-askubuntu
{ "answer_score": 12, "question_score": 23, "tags": "security, password" }
gnuplot with errorbars plotting The data in my "file.txt" file are as in the following (sample row shown) 31 1772911000 6789494.2537881 Note that the second column is the mean and the third is the standard deviation of my input sample. So, for the error bar, I would need the bar at the x axis value 31, with the error bar start at (second column value)-(third column value), and end at (second column value)+(third column value). I tried the following: plot "file.txt" using ($1-$2):1:($2+$1) with errorbars but the result is inappropriate. Any help?
You need x:y:err, so try plot "file.txt" using 1:2:3 with yerrorbars ![yerrorbars]( You may instead want candlesticks. These are generally a box with error bars extending out of the top and bottom, but setting the mins and maxes the same should give you boxes of the required size: plot "file.txt" using 1:($2-$3):($2-$3):($2+$3):($2+$3) with candlesticks ![candlesticks](
stackexchange-stackoverflow
{ "answer_score": 27, "question_score": 17, "tags": "plot, gnuplot" }
Isolate Facebook URL user ID from the URL with python regex okay i found this regex from Stack overflow, which can isolate the URL and ID, but when ever i tried to use it in app engine (py) an error popup saying "nothing to repeat, i know theres a bug in Python regarding this regex repeating, can anyone fix this? tx File "C:\Program Files\Python27\lib\re.py", line 244, in _compile raise error, v # invalid expression error: nothing to repeat sample code # patt = '(?:http:\/\/)?(?:www.)?facebook.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[?\w\-]*\/)?(?:profile.php\?id=(?=\d.*))?([\w\-]*)?' # tst = self.request.get("form_fbURL") # m=re.match(patt,tst) im not a good python programmer anyway :)
There is a `urlparse` module to parse url. The `urlparse` module is renamed to `urllib.parse` in `Python 3.0`. $ python >>> from urlparse import urlparse >>> urlparse(' ParseResult(scheme='http', netloc='www.facebook.com', path='/hello/world.php', params='', query='id=789', fragment='')
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "python, regex, google app engine" }
validation control not working I am using sharepoint validation control to validate only numbers but whatever i enter it says "please enter valid number". What is wrong with my validation expression? <SharePoint:InputFormRegularExpressionValidator ID="NumberValidator" runat="server" Display="Dynamic" SetFocusOnError="true" ControlToValidate="txtMobile" BreakBefore="true" ErrorMessage="Please nter valid number" ValidationExpression="^[0-9]$"/>
Hi actualy your validation express is correct same working for me but it was allowing spaces so i tried bellow mentioned validation express. try this and let me know whether it was helpfull or not. \d+ If you want more details about the validation regular expression you can visit bellow mentioned link Regular expression for validation controls
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 0, "tags": "2013, validation" }
include/import separate AS3 file I am trying to just include a .as file in my flash application. I'm sure it's not that difficult and I'm just getting something slightly wrong, but at the top of my code I always put: include {"Le Bot src/Skill.as";} OR import {"Le Bot src/Skill.as";} to try and include a separate .as file. But, when I use `include` it comes up with the error: expecting stringliteral before left brace and when I use 'import' it comes up with the errors: expecting identifier before left brace expecting semicolon before left brace I am just a beginner to AS3, is there any way to fix this problem? Btw, if I remove the two braces on either side, then it comes up with another error
import locationOfASFile.Skill; e.g. if your Skill.as file was located inside a directory named 'LeBotsrc' which was inside a directory named 'com' import com.LeBotsrc.Skill; Also your as package needs to reflect it's location. So inside Skill.as you would have package com.LeBotsrc {
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "actionscript 3, import, include, string literals, braces" }
Printing one character at a time from a string, using the while loop Im reading "Core Python Programming 2nd Edition", They ask me to print a string, one character at a time using a "while" loop. I know how the while loop works, but for some reason i can not come up with an idea how to do this. I've been looking around, and only see examples using for loops. So what i have to do: user gives input: text = raw_input("Give some input: ") I know how to read out each piece of data from an array, but i can't remember anything how to do it to a string. Now all i need is working while-loop, that prints every character of the string, one at a time. i guess i've to use len(text), but i'm not 100% sure how to use it in this problem. Some help would be awsome! I'm sure this is a very simple issue, but for some reason i cannot come up with it! Thx in advance! :)
I'm quite sure, that the internet is full of python while-loops, but one example: i=0 while i < len(text): print text[i] i += 1
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 9, "tags": "python, while loop" }
run ar core sample on avd I'm trying to run ar core sample on avd, but face this message: "The application requires the latest version of ARCore". I'm trying to run on Google Pixel2 emulator with API 27, everything is up to date. The android docs say it is possible, but what am I doing wrong?
You need to install the ARCore x86 for emulator apk from the ARCore GitHub repository. You can then drag the downloaded apk onto the running emulator, or you can run: `adb install -r ARCore_1_2_x86_for_emulator.apk` <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "android, augmented reality, arcore" }
Got a compilation problem with dart null safety I am new to flutter null safety and I can't manage how to have no compilation error. This is the (incomplete) code GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); Scaffold( key: _scaffoldKey ); ... showDialog(context: _scaffold.currentContext) showdialog is waiting for a non null BuildContext so I got the error: The argument type 'BuildContext?' can't be assigned to the parameter type 'BuildContext' Help please!
If you sure that `_scaffold.currentContext` can never be null: GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); Scaffold( key: _scaffoldKey ); ... showDialog(context: _scaffold.currentContext!) //Add "!" here and the problem is solved
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "flutter, dart null safety" }
Using a homomorphism to draw conclusions about subgroup indices I've been thinking about this problem: Let $H$ and $K$ be subgroups of $G$. Assume that $K$ has index two in $G$. prove that either $H \cap K$ has index two in $H$, or $H \subseteq K$. The suggestion was given to use a homomorphism to prove this fact. I'm unclear on what homomorphism to use, the domain and codomain of the homomorphism, and most of all how a homomorphism would even help me prove this fact about the index of $H \cap K$. So far, I see that $K$ must be a normal subgroup because it has an index of 2, and that $H \cap K$ is a subgroup since it is the intersection of two subgroups of G. Beyond that, I'm kind of stuck on the how to utilize a homomorphism here. Any help finding a path to a solution (not necessarily the solution itself) and understanding how homomorphisms are useful in these situations would be much appreciated.
$\renewcommand{\phi}{\varphi}$Consider the quotient group $G/K$, and the homomorphism $\phi : H \to G/K$ given by $h \mapsto h K$. **Spoiler 1** > Since $G/K$ has order $2$, there are two possibilities. **Spoiler 2** > Either the image of $\phi$ has order $1$, which means $H \le K$. **Spoiler 3** > Or the image of $\phi$ is the whole of $G/ K$. By the first isomorphism theorem, $G/\ker(\phi)$ is isomorphic to $G/K$, so that it has order $2$. But it is immediate to show that $\ker(\phi) = H \cap K$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "abstract algebra, group theory" }
Why does a parabola have a single point at infinity? Consider the parabola $V(zy-x^2) \subset \mathbb P^2$. This parabola has only one point at infinity which is $[0:1:0]$. On the other hand we sketch the parabola, we see that there are two asympotes, so probably it should have two points at infinity? So, why does the parabola has only one point at infinity?
The two “arms” of a parabola become increasingly more parallel the farther you proceed along them. In the limit, at infinity, they _are_ parallel, and are parallel to the axis of the parabola as well. And since parallel lines pass through a common point at infinity, that's the point at infinity for both of them, and it's a point on the parabola itself as well. Algebraically, that point is a double point: if you intersect the line at infinity with the parabola, you get two identical solutions. This means that the line at infinity is in fact tangent to the parabola. You can use this as a classification: Hyperbolas are conics which intersect the line at infinity in two distinct real points. Parabolas are conics which touch the line at infinity in a single point. And ellipses are conics which intersect the line at infinity in two complex conjugate points. For circles these are the ideal circle points $[1:\pm i:0]$.
stackexchange-math
{ "answer_score": 8, "question_score": 1, "tags": "conic sections, projective geometry, projective space" }
Sharing uwp application What is the proper way to share the UWP project for a job interview without revealing the code? The easiest solution might be putting the application on windows10 store, but I would like not to do that. Are there any other ways?
(As an interviewer): Your interviewer is probably more interested in the code than in the product. Test tasks usually are useless in production anyway. To answer your question: Create a sideloadable appx package. Right click on the project -> Store -> Create App Packages -> Don't publish to store. Follow the wizard and it will build and create the app package folder inside your project folder. It will contain .appx package, your custom certificate, powershell script and dependencies folder. Send this entire folder to the interviewer. Interviewer will need to run ps script to install your application.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "uwp, windows dev center" }
R vs sed regex greediness I don't quite understand why this doesn't result in `"test"` and would appreciate an explanation: a = "blah test" sub('^.*(test|$)', '\\1', a) # [1] "" Compare it to the `sed` expression: echo 'blah test' | sed -r 's/^.*(test|$)/\1/' # test echo 'blah blah' | sed -r 's/^.*(test|$)/\1/' # Fwiw, the following achieves what I want in R (and is equivalent to the above `sed` results): sub('^.*(test)|^.*', '\\1', a)
The start of the `regex engine` matchs all the characters right upto the end of the string i.e **greedy** `.*`, then it tries to match `(test|$)`, i.e either the string literal 'test' or the end of the string. Since the first **greedy** match of `.*` matched all the characters, it `back-references` a character and then again tries to match `(test|$)`, here `$` matches the end of the string. Causing your match result to be a `end of line character` I think `sed` uses **POSIX NFA** which tries to find the longest match in a Alternation, which differs from `R`, which seems to use a **Traditional NFA**
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "regex, r, sed" }
Should there be a separate site for questions related to mobile phone development? The volume of questions on Stack Overflow is large. I think we should have a separate website for asking questions related to mobile phone related development.
SO is about programming on ALL platforms, mac, windows, linux, all on one site. The reason superuser and serverfault were made is because they're a different subject, computers in general and server administration, respectively. :D
stackexchange-meta
{ "answer_score": 3, "question_score": 0, "tags": "discussion" }
What is the meaning of this symbol ? $a)$ $C_b^0(\mathbb{R})$ $b)$ $C_c^{\infty}(\mathbb{R})$. What is the meaning of this symbol ? $a)$ $C_b^0(\mathbb{R})$ $b)$ $C_c^{\infty}(\mathbb{R})$. actually im asking this question because i found the answer Which of the following subsets are dense in the given spaces? i didn't understand the option $b)$ Notes: i have seen the user those who have been answer have not active since for 20 days ,, so i decide to upload a new post thanks u
According to the question, 1. space of bounded [the foot $b$] continuous functions [$\mathcal C^0$] defined on $\Bbb R$. 2. space of infinitely differentiable functions [$\mathcal C^\infty$] with compact support [the foot $c$] defined on $\mathbb R$. support: the closure of the set $\\{x \in \mathbb R\colon f(x) \neq 0\\}$.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "general topology" }
Are visa application forms for Morocco available online? I live in Germany but I am not a German citizen, therefore, I need to have a visa (tourist visa) to travel to Morocco. I have been searching the **_Visa form_** on their website (Consulate Morocco, Frankfurt) for 2 days but I could not find it out. I found a travel visa form at this link but it is not official. Does anybody know where can I download the form OR if the form on the unofficial website is the correct form?
If you go through the french pages, the form is linked on the respective site: \- there is a PDF-Symbol at the top of the page that allows you to download the application form in RTF-format. The form is bilingual french/english.
stackexchange-travel
{ "answer_score": 3, "question_score": 2, "tags": "visas, germany, morocco, frankfurt" }
How to reference .cpp files without including them into the solution in Visual Studio? I'm trying to compile this code: extern "C" { #include <lua.h> #include <lualib.h> #include <lauxlib.h> } #include <luabind/luabind.hpp> #include<iostream> int main(){ lua_State*pL=lua_open(); luabind::open(pL); lua_close(pL); return 0; } But I don't have a .lib of `luabind`, so I use the source with the .h/.cpp files. The way I do it is by adding the directories to include, but I get a link error. The only way I can compile is by adding the .cpp files as existing elements, but the solution tree gets messy with the additional files. Can somebody tell me if there's a way to add the directory of the additional .cpp files in the solution's properties? Thanks
Compile the lua cpp files into a static library. Add the directory where you put those under "linker | input | additional library directories".
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "visual studio, lua, luabind, c++" }
Is <non-object> kind of memory link or abandoned memory? I'm using instruments to tracking memory usage. Heapshot Analysis is awesome, but I also found some "non-object". what's this? kind of abandoned memory or something else ? How to solve this ? !Heap shot image Another Question may relate, I used to use [myObj release], myObj = nil; myObj = [[MyObj alloc] init]; to release object and create a new one. (myObj = nil, just for avoid crash) Some guy said, It may waste memory performance. Is he right? I want to know some details. Very appreciate for your help.
Your question has an answer here: What does <non-object> in Allocation "heapshots" mean? For the memory management there's absolutely nothing wrong in your code. myObj = nil is pointless because you're allocating a new object in the line after it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, ios, memory, instruments" }
Mangled and flickering graphics on Yoga 910 with 1920x1080 resolution I've just installed Ubuntu 16.10 on a Lenovo Yoga 910 and have found that when I set the resolution to its native 1920x1080, the display immediately starts flickering and becoming mangled/visually corrupted. Moving the mouse around appears to sometimes make it less horrible, but it's essentially unusable. The same thing happens at the login screen and also when I switch to a different tty. I'm running the latest Intel i915, updated with the Intel Graphics Update Tool for Linux, and I've tried running with the `AccelMethod` as both `SNA` and `UXA`. IS there anything I can do to isolate the cause of the problem? The output of `lspci -nnk | grep -iA2 VGA` gives me this: 00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:5916] (rev 02) Subsystem: Lenovo Device [17aa:3801] Kernel driver in use: i915
As per this bug, the problem seems to be associated with a power saving feature of the GPU. Disabling this feature through the kernel parameter `i915.enable_rc6=0` completely fixed the problem for me. In my travels, I also found another kernel parameter people have also used to fix screen flickering issues (`i915.enable_psr=0`), however I didn't need this one.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 1, "tags": "graphics, intel graphics, hd video" }
EBS IOPS First Use Penalty with snapshot volumes When creating a Provisioned IOPS EBS volume (or any EBS volumes for that matter) from a snapshot, are the "First Use Penalty” effects avoided? Are they only partially avoided (for the blocks that are written) from the snapshot, or are they completely avoided? If the former, is there a way to pre-warm only the blocks that are not written from the snapshot?
Yes same applies to volumes created from the snapshot. The EBS will get attached to the instance and mounted but it will be still pulling data from S3. For me it was a problem and I did something like this before spinning the app to the fullest to see if all data was copied from S3 snapshot: sudo dd if=/dev/sdX of=/dev/null bs=10M By the time this command is done you can be sure all the data has been copied.
stackexchange-serverfault
{ "answer_score": 2, "question_score": 1, "tags": "amazon ec2, amazon ebs" }
PHP Substracting 1 day from date string php doesnt work i am trying to substract 1 day from date string, if condition is met. If condition (if time between 12-16) works fine, but outcome of yesterday's date is wrong. This is what i tried with research from stackoverflow: <?php #trying to remove 1 day from date $date = date("d/m/y"); if (date('H') < 16 && date('H') > 12) { $date2 = strtotime(date('d/m/y') . ' -1 day'); $date2 = date('d/m/y', $date2); } echo "Todays date is {$date} and yesterday was {$date2}"; ?> Outcome from phpfiddle: > Todays date is 23/10/16 and yesterday was 31/12/69 Can someone share some light on it, how it should be done ?
instead $date2 = strtotime(date('d/m/y') . ' -1 day'); use $date2 = strtotime('-1 day');
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, date" }
how to move wordpress short code button to the center of the page, please? this is how short code looks like [stripe name="My Store" description="My Product" amount="1999" billing="true" shipping="true"] enter image description here
you can use a div tag: <div id="button>"[stripe name="My Store" description="My Product" amount="1999" billing="true" shipping="true"]</div> <style> #button { text-align: center; margin: auto; } </style>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "wordpress, shortcode" }
Obtain property name within anonymous function in Javascript Is it possible to get the name of the property that called the anonymous function in javascript? ## Example var obj = { WhoAmI: function() { //Obtain the name WhoAmI } }
The function has no _(direct)_ idea what the name of the property or variable is that references it. Though depending on the means of invocation, it could be discovered. var obj = { WhoAmI: function func() { for (var p in this) if (this[p] === func) alert(p); } } obj.WhoAmI(); _**DEMO:_** < This only works if the function is invoked with its `this` set as the object referencing it. You could use `arguments.callee` instead of giving the function a name, though that's not permitted in _strict mode_.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "javascript, methods, anonymous function" }
Retorno incorreto Boa noite, estou com um problema na hora de puxar as informações do banco e exibir no show. ![A imagem abaixo esta o erro]( meu código está assim: <%= @question.answers.each do |answer| %> <div class="media"> <div class="media-left"> <a href="#"> <img class="media-object" src="<%= answer.gravatar %>"> </a> </div> <div class="media-body"> <h4 class="media-heading"><%= answer.email %> answered:</h4> <%= answer.body %> </div> </div> </div> <% end %> Valeu galera.
O sinal de igual `<%=` serve para validar e printar uma informação, que, neste caso, é o objeto que você está iterando (answer). Tente apenas validar a expressão, alterando de <%= @question.answers.each do |answer| %> para <% @question.answers.each do |answer| %>
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "ruby on rails" }
How do I set up persistent authentication in a mobile app? All sorts of mobile apps - Gmail, Facebook, Pandora - have some persistent mechanism of authentication that enables a user to set up credentials once and then use them to automatically authenticate with their remote service in the future. I'm probably blind, but I can't seem to find a tutorial anywhere out there that explains in simple terms how to properly do this on a mobile app. How do I build this functionality? A link to a simple tutorial would be great.
As Deva said, SharedPreferences is a perfect quick and easy solution for creating this feature. Usually when I want to implement this I follow this simple flow: Logging In: When the user logs in save the user id (it can really be any unique identifier) into Shared Preferences. This information should now be available so that your app can recall it later Rebooting: When the app reboots it should check to see if any user id is saved in Shared Preferences. If not, then there is no one to automatically log in. If there is, then reload the user information using the user id from the server or whatever. Logging Out: When the user logs out make sure you delete the key/value pair from Shared Preferences.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android, ios, authentication" }
Google CoLab: how to use opencv to read data from my Google drive? After authorizing Google Drive, installing opencv and uploading the data in my Google Drive, I still can't read the image that I want using OpenCV ![enter image description here]( ![enter image description here]( Where goes wrong? Any help will be appreciated!
Since you have mounted your google drive into the drive folder your file path should be something like: drive/<path_to_file_in_drive>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "python, opencv, gpu, google colaboratory" }
How to read all the files in a folder using R and create objects with the same file names? I need to create a function in R that reads all the files in a folder (let's assume that all files are tables in tab delimited format) and create objects with same names in global environment. I did something similar to this (see code below); I was able to write a function that reads all the files in the folder, makes some changes in the first column of each file and writes it back in to the folder. But the I couldn't find how to assign the read files in to an object that will stay in the global environment. changeCol1 <- function () { filesInfolder <- list.files() for (i in 1:length(filesInfolder)){ wrkngFile <- read.table(filesInfolder[i]) wrkngFile[,1] <- gsub(0,1,wrkngFile[,1]) write.table(wrkngFile, file = filesInfolder[i], quote = F, sep = "\t") } }
add this to your loop after making the changes: assign(filesInfolder[i], wrkngFile, envir=globalenv()) If you want to put them into a list, one way would be, outside your loop, declare a list: mylist = list() Then, within your loop, do like so: mylist[[filesInfolder[i] = wrkngFile]] And then you can access each object by looking at: mylist[[filename]] from the global env.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "r, function, object, assign, read.table" }
Does this game approach a zero chance of winning as the game gets longer? There is a series of tiles, either solid or not (50 50 chance). I consider it a success if you can make it to the last tile. There is L tiles. You start on the first tile. If you ‘run’ along n solid tiles, you can make it across a chasm n tiles wide or less. If you were running across A tiles and jumped across B tiles, it would still be as if you had run across A-B tiles. As L approach’s infinity, does the chance you can succeed on a random series of tiles approach 0?
If at any point you have encountered more blank tiles than solid tiles, then you have lost, regardless of the order of the tiles. You can model the difference between the number of blank and solid tiles as a 1-dimensional random walk. An infinite 1D random walk will cross every value an infinite number of times - one of those values will be 0, where there are an equal number of blank and solid tiles. You will cross that point almost surely (with probability 1) as the walk length increases to infinity, meaning that at some point, you will have encountered more blank tiles than solid ones. As the length of the run increases to infinity, the probability of success approaches 0.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability" }
How can I implement a multi-line drop down select list with jQuery I have a select list where some items in the list of choices are multi-line. I heard that there are some jQuery plugins that can help me out. If there's anyone out there with some experience of these I'd much appreciate some suggestions. thanks,
I would create a simulation of a dropdown box using jQuery, instead of actually using a `<select/>` element. This is done all the time for Dropdown's in web navigation menus, so doing something similar in this instance would solve your issue. Here are some references to get you started: * Drop Down on Link Hover (see Demo #1) * 38 jQuery Dropdown Menus
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery" }
Request.Querystring(variablevalue) possible? I'm creating an application which uses request.querystring to transfer variables between pages. However at the moment I am setting variable names in the URL dynamically in accordance with an array and I want to retrieve these values on another page using (essentially) the same array. So I came up with what I thought would be the simple solution: For Each x In AnswerIDs response.write(x) ctest = Request.Querystring(x) response.write(ctest) Next However this doesn't seem to work as it looks like you can't use `Request.Querystring()` with a variable as it's parameter. Has anyone got any idea how I could do this? This is the query string: > QuizMark.asp?11=1&12=1 In this case AnswerIDs consists of "11" & "12" so in my loop I want it to write "1" & "1".
You can loop through the querystring like this: For Each Item in Request.QueryString Response.Write Item & ": " & Request.QueryString(Item) & "<br/>" Next Item contains the name of the querystring parameter, with Request.Querystring(Item) you retrieve the value of the parameter.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 3, "tags": "asp classic, request.querystring" }
How to have a listener PhP script respond to GET requests I'm trying to accomplish remote php call and return as described in this question: PHP: Remote Function Call and returning the result? However, I don't know how to make the listener script that responds to the GET request. How do I create the script, allow it to be called remotely, and have it process the request appropriately? Is there an example somewhere? I understand this is probably a very low-level question, but I'm very new to PhP.
You don't need to implement a listener, the web server is doing that for you. Just create a script and put it in your web directory. When the web server receives a GET request to that script, it will execute the PHP script. In the script, you can just echo the values that you want to send back in a format that your calling function understands. (Of course you could also set some headers, if you feel that this is necessary).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "php, curl, remote access" }
Count or select in Excel from 1 column based on another column I've got following example in Excel ![enter image description here]( I want to know or indicate in an extra Excel column, if there are different TypeEvents in a period block. For period 1 there is only 1 type event -> so no different TypeEvents For period 4 there are 2 type events but they are the same -> so no different TypeEvents For period 8 there are 2 type events and they are not the same -> this one is different and count as one. It's also possible that for example for period 20 there are 6 type events (3times WNS and 3 times WGV) -> this one is different and count as one! Not as many but as one. Is this possible with a pivot or with a sql statement on the table or with some VBA script or ...? Thanks a lot.
You can do this using `COUNTIFS` The formula that I am using is based on the data starting (headers) in cell`a1`. I put the following into cell `c2`. `COUNTIFS` is a dynamic array function so will autofill down: =IF(COUNTIFS(A2:A13,A2:A13,B2:B13,"<>"&B2:B13)<>0,"Multi", "") The first `countif` criteria selects rows with the same period and the second identifies a row with a different type event ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "excel, vba, pivot" }
Why didn't Psi Corps repeat their experimental efforts to create another Jason Ironheart who is arguably as powerful as a Vorlon? The Psi Corps successfully created a being as powerful as a Vorlon in Jason Ironheart. While the research staff who successfully did it was killed, it should not be too difficult to re-create what was successfully created before. If it has been done before, it should not be difficult to do it again. If it has been done before, it means the present state of technology is not too far off. Why didn't Psi Corps do it again, given that success would mean the human race would make a huge leap in technological power that can help them beat the Minbari and match even the Vorlons and Shadows?
**Jason Ironheart was an accident.** The goal of the Psi Corps project that produced him was not to create a Vorlon-like creature. The goal was to create a telekinetic assassin, one that was stable and had enough fine control to kill an individual by pinching their carotid shut. Any success or continuation of such a project would have to be speculation, because not a one of them would ever admit such a weapon was in development. Not to mention, the only eyewitness to this supposed "success" case was Bester. All the black labs folks thought they succeeded in was they created a more effective crazy person.
stackexchange-scifi
{ "answer_score": 12, "question_score": 6, "tags": "babylon 5" }
Looping Master or Scene and restoring original position of elements I try to loop a complete header animation endlessly, but I just cannot get it to work: < I tried to loop the master like this: var master = new TimelineMax({repeat:-1}); Then I tried the same solution on the single scene I'm using: function sceneOne() { var tl = new TimelineMax({repeat:-1}); I also tried several solutions with **oncomplete callbacks**. I finally had some experiments with timeline.seek(0).pause(); timeline.pause(0); //shortcut for the line above timeline.progress(0).pause(); timeline.totalProgress(0).pause(); timeline.restart(0).pause(); inside my scene. Didn't help. Can somebody point me in the right direction? I cannot find any error in my code.
It is the `entry_heroes` section that is causing the problem as it has itself a `repeat: -1` that means that the section never ends and so the whole timeline never finishes and thus does not repeat.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "gsap" }
classNames library - returning a classname as interpoalted variable Trying to setup a conditional for setting the className for a div. The conditional works and I can see the className being assigned to the correct variable in the dev console, but I can not get it to return as an interpolated variable. Any suggestions? I have tried setting the styles in the function without wrapping them in '' also. Here is my code.. const Testingtwo = ({ percent, percenttest }) => { let nameChange = classNames({ "styles.BoostMeterStep": percent === true, "styles.filledtwo": percenttest === true }); return <div className={`${nameChange}`}>HERE</div>; };
You have a variable there and you don't need to use `${}` in your JS expression again. Use it like that: return <div className={nameChange}>HERE</div>;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, reactjs" }
Could we invent a new number with $|p|=-1$? We know that how a single definition $i^2=-1$ revolutionized our mathematics and solved many many problems. I wonder whether the definition $|p|=-1$ could have the potential of creating a new generation of numbers and help us in other areas like complex numbers do(from geometry to calculus). Has anyone researched on it? Please add appropriate tags.
There is a difference here. The value $i$ is defined as the number that solves the equation $x^2+1=0$. The reason that this equation does not have a solution in $\mathbb R$ is that for every $x\in\mathbb R$, $x^2>0,$ which is a consequence of the properties of the real numbers. There is nothing inherit in the equation that would demand it to have no solution. On the other hand, the value $|x|$ is _defined_ to always be positive, thus it will by definition never equal to $-1$. The difference then: * $x^2>0$ is a consequence of the properties of real numbers. Looking at numbers with different properties may change this fact. * $|x|>0$ is inherit in the definition of $|\cdot|$. It is a property that must hold for all numbers, even if we expand our set.
stackexchange-math
{ "answer_score": 17, "question_score": 9, "tags": "absolute value, research" }
Was the development of Greek mythology dynamic or static? Did Greek mythology develop dynamically or statically? Let me explain a little more what I mean by "dynamic" and "static". **Static:** Given the religious element of the stories, I could imagine that they were very "official", implying that they were created in a relatively short time and by a relatively small group off people. Without many extensions or modifications afterwards. **Dynamic:** I could also imagine that the stories were more naturally developed, like an on-going ad hoc collection of stories. A scenario where anyone could just make up a myth/god and where the popular ones got picked up and written down? (Is it be clear that the last two pieces of text are merely meaningful as an attempt to further clarify my answer, and are by no means attempts to provide actual answers to the question?)
Definitely dynamic. In Burkert's "Graechische Religion..." (Intro/2: sources), we can find the following reasons: \- as there were no holy scriptures there was no "canon" whatsoever to tell apart "canonical" myths from "non-canonical" \- myths were continuously being rewritten, as poets were composing new hymns to the gods for celebrations or contests. In "Elliniki Mythologia" (edited by Ekdotiki Athinon) there is a description of the process of myth creation (pg.24-26) and, while to big to transcript here, its main points is that, at first, myths were created by the people from fairy-tale-like stories that they were telling the children and, then, it passed on to the poets. Plus, it definitely says on pg.26:"so, greek myths were processed and reprocessed for approximately 1,500 years".
stackexchange-mythology
{ "answer_score": 9, "question_score": 9, "tags": "greek, history" }
change screen resolution without clicking resolution on desktop or using graphics card settings How can I change screen resolution without using Explorer.exe or my graphics card settings. Both crash every time I try.
More than likely, you have a bad/incorrect driver installed. However, here is a program that will let you change resolutions quickly.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "graphics card, windows explorer, resolution" }
Start Mongodb server in two modes parallely I have installed **mongo db** in my local system, i am aware that at any point in time we can start the mongo using mongod service. * in **normal mode** which will run on port 27017 * in **rest API mode** where we can query to collections and db's which normally runs on mongo port + 1000 i want to start both mode together, any help would be appreciated. Thanks Amit
You should add modify your mongod config file to enable http. add following config line, see < net: http: enabled: true or add parameter in the command line `mongod --httpinterface`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "mongodb" }
SVG images are not showing in reactjs i want to create svg shapes dynamically and append it to dom using react here is the jsfiddle link Svg shapes are not displaying in react
If the goal is to draw a cat then the problem is that your `d:` properties is full of new lines thus making it not being a valid SVG path. Check your console and you'll see the error `Uncaught SyntaxError: embedded: Unterminated string constant`. Fiddle Demo
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript, reactjs" }
How am I supposed to know if my smartphone is ARM or 86x? I have a Sony Xperia M and installed CyanogenMod a couple of times. When ever I want to download GAPPS, I wonder, if my Smartphone is ARM or x86, and when ever I google it and don't find an answer, I have a deja vú and I just go with ARM since it is most common and my phone is probably ARM. But shouldn't there be a way to find out?
* `adb shell getprop ro.product.cpu.abi` gives you the hardware answer (e.g. "arm64-v8a" for my Wileyfox Swift). * `adb shell uname -m` tells you what the kernel is running (e.g. "aarch64" for the same device) If you do not have ADB setup (and don't plan to), you can run the same commands in a terminal app. Just skip the preceding `adb shell` then: $ getprop ro.product.cpu.abi arm64-v8a $ uname -m aarch64 $
stackexchange-android
{ "answer_score": 2, "question_score": -2, "tags": "cyanogenmod" }
What is the cardinality of $A=\{(x,y)\in \mathbb R\times \mathbb R|(x-y=\sqrt 2) \land (x+y\in \mathbb N)\}$? > What is the cardinality of $A=\\{(x,y)\in \mathbb R\times \mathbb R|(x-y=\sqrt 2) \land (x+y\in \mathbb N)\\}$? I wonder if this is possible that $x-y$ is an irrational number while $x+y$ is a natural number. Could it be that $A$ is an empty set and of cardinality $0$?
You have $x+y=n\in\Bbb N$ and $x-y=\sqrt2$. Adding gives $2x=n+\sqrt2$: so $x=\frac12(n+\sqrt2)$. Likewise $y=\frac12(n-\sqrt2)$. So, there's a solution for each $n\in\Bbb N$.
stackexchange-math
{ "answer_score": 5, "question_score": 0, "tags": "cardinals" }
Computing the Lebesgue Integral of $\int_0^1 \frac{1}{\sqrt{x}}\; d\mu$ I am trying to compute the Lebesgue integral of $\int_0^1 \frac{1}{\sqrt{x}}\; d\mu$. I know that if a function $f$ is bounded on some set $X$ and is continuous almost everywhere on $X$, then the Lebesgue integral is equivalent to the Riemann integral. Since $\frac{1}{\sqrt{x}}$ is continuous almost everywhere on $X$ and is unbounded at $x=0$, I am not sure if the Lebesgue integral is equivalent to the Riemann integral here. However, I know that $\frac{1}{\sqrt{x}}$ is bounded _almost_ _everywhere_ on $[0, 1]$. Does this mean that I can use the Riemaan integral to compute the Lebesgue integral? If not, how else can I compute the Lebesgue integral of $\frac{1}{\sqrt{x}}$ on $[0, 1]$?
\begin{align*} (L)\int_{0}^{1}\dfrac{1}{\sqrt{x}}dx&=\lim_{n\rightarrow\infty}(L)\int_{1/n}^{1}\dfrac{1}{\sqrt{x}}dx\\\ &=\lim_{n\rightarrow\infty}(R)\int_{1/n}^{1}\dfrac{1}{\sqrt{x}}dx\\\ &=\cdots, \end{align*} here $(L)$ and $(R)$ denote the Lebesgue and Riemann integrals repsectively, the first equality comes from Monotone Convergence Theorem.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "real analysis, measure theory, proof writing, solution verification" }
Rails/Capistrano: check if sidekiq is running on an EC2 instance I'm using an EC2 instance for hosting a rails application. I'm deploying with capistrano and I had already included sidekiq and it's working fine. However, sometimes on deploy, and sometimes sporadically, sidekiq stops running and I don't notice until some tasks that use sidekiq doesn't run. I could do something on deploy to check that, but if it stops to work eventually after deploy, that would still be a problem. I would like to know what is the best way, in that scenario, to check periodically if sidekiq is running, and if not to, run it. I thought of doing a bash script for that, but apparently, when I run sidekiq from command line, it creates another process with a different pid of the one launched by sidekiq... so I think it could get messy. Any help is appreciated. Thanks!
Learn and use systemd to manage the service. <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, capistrano, sidekiq" }
Get sum of a database field with where condition from multiple tables in PHP Mysql I am having problem with fetching "sum" of a field from a table with multiple where conditions from multiple table in php MySQL. For Example: Table1:"Participant" part_id | name | total_part | work_id 1 | Ravi | 2 | 102 2 | Sam | 1 | 102 3 | Mike | 3 | 101 Table2: "Workshop" work_id | Month | Year 101 | March | 2 102 | April | 1 103 | May | 3 Form the above two table I want to select the sum of "total_part" from Participant with where condition of "work_id" and "Month" from workshop in single php mysql query. Thanks in advance
Without having any context, it sounds like you're just looking for `SELECT SUM(column) FROM table WHERE [clause 1] AND [clause 2]`. Hope that helps.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "php, mysql" }
Get audio from microphone and write it to socket on iOS this is what I would like to do: * Get audio from the microphone * Encode it in AAC, G.711 or G.726 * Write the encoded frames to a socket. I found many examples but they all write to file. Can you link me to any tutorial/documentation/example/library that has an output buffer or a callback instead?
I solved my problem by modifying the AQRecorder class from the SpeakHere example by Apple. The project is available here <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "ios, audio" }
Rails Routing INSIDE CSS Is there any way I can route assets inside of my css to where the rest of the views are pulling them? I mean, inside the CSS can I call url_for or css_for or something like that in order to have the images go through the assets router? Thank you in advance!
You can use a controller action to render your CSS (with an erb template) and set the content type to `text/css`. Take a look at this blog post from Josh Susser on dynamically generated stylesheets. It is from 2006 but the technique described is still applicable.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, css, routes, assets" }
Solving a "expression must have pointer to class type" error class testClass { public: int B, C; }; testClass u; testClass * k = &u; testClass ** m = &k; *m->B = 1;//Error appears here I think I've followed the rules of pointer referencing correctly. I still have no idea why this is happening. Could someone help me?
`operator->` has higher precedence than `operator*`, so `*m->B` is equivalent as `*(m->B)`; while `m->B` is not valid here. You should change it to `(*m)->B`.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "c++, pointers, operator precedence" }
c# named iterators and yield I've found this example which returns custom type Car objects in reverse order. Can someone explain me this code. thanks public IEnumerable GetTheCars(bool returnReversed) { if(returnReversed) { for(int i=cars.Length; i!=0; i--) { yield return cars[i-1]; //this line makes me confused } } else {...} }
You indicated in your comments that you need an explanation of how the reverse ordering works. for(int i=cars.Length; i!=0; i--) { yield return cars[i-1]; //this line makes me confused } Let's say you have 4 cars in your list. Your `for` loop starts at a value of `cars.Length`, which will be 4. For each iteration it decrements by 1. It will continue doing this while the `i!=0` condition is met. So, the loop will iterate with the following values of `i`: 4, 3, 2, 1. If `i` is used as the element index for your array/list, then you will receive cars[4], cars[3], cars[2], cars[1] (reverse order!). But because arrays in C# start at 0 (and not 1), you need to subtract 1 when accessing the elements: `cars[i-1]`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "c#, yield" }
How to get layer variables using QGIS Python APIs? How can I access the layer variables defined by the user from QGIS Python APIs? ![QGIS Layer Variable](
You may use the QgsExpressionContextUtils() class. More in detail, you may set a new layer variable in this way: layer = iface.activeLayer() # or similar way for loading a layer QgsExpressionContextUtils.setLayerVariable(layer,'your_variable', 'John') where `layer` is the layer object, `your_variable` is the name of the variable and `John` is the value of the variable. For retrieving the value of the layer variable, you can use the following line: QgsExpressionContextUtils.layerScope(layer).variable('your_variable') In fact, if you run: test = QgsExpressionContextUtils.layerScope(layer).variable('your_variable') print test you will get: John as desired.
stackexchange-gis
{ "answer_score": 7, "question_score": 7, "tags": "qgis, python, pyqgis, api, qgis variable" }
Get rid of DLLs with source code? I'd like to use LibSndFile in my project. It provides a set of dlls for x32 and x64 but I'd like to get rid of dlls. Is it possible to build .lib files from the source codes and then get rid of the dll? I don't want .dlls because you have to copy them into the Windows folder for your program to work and I would prefer to have only one big file with everything in it (and yes I tried ILMerger or IlRepack, etc without success)
You can read this thread: How to convert a dynamic dll to static lib? And then you can try Enigma Virtual Box: < The last one allows you to package all your files (dlls and resources) into a single executable.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "dll, libsndfile" }
Call a sub from a function in Access 2010 My MS Access application has a subroutine which fires after I update one control on a form. Public Sub cboCrew_AfterUpdate() ...do some work... End Sub I would like to call this same sub from a function I have defined in Module1 Function my_function() Call cboCrew_AfterUpdate End Function This code throws the error: "Compile Error Sub or Function not defined" I suspect that the problem is that I am not being specific enough, in my call to the sub. Do I need to reference the sub with `"some_modulte_name.sub_name"` ? Can anyone tell me what I am missing?
Set this up the other way around... Public Sub cboCrew_AfterUpdate() My_Function End Sub Function my_function(frm As Form) ''Do stuff End Function Re comment Public Sub cboCrew_AfterUpdate() My_Function Me End Sub Function my_function(frm As Form) MsgBox frm.Name End Function Sub AnotherSub() My_Function Forms!AFormName End Sub
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "vba, ms access, ms access 2010" }
File type support in Spring framework Is it possible to instantiate a property of type `java.io.File` directly in the config? Something like: <property><file path="..." /></property> A possible workaround may be to use a String property and while setting it, create the File instance. Is there a more direct way of achieving this? Thanks!
Yes, you can do this. Simply pass the name of the file as the value of the property: <bean> <property name="myFile" value="path-to-file"/> </bean> Spring will automatically create an instance of java.io.File for you and inject it into your bean.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "spring, properties" }
How to loop and subset through a list of list I have a list where each element is a list. I want to create a sample for each element (train set) and return a new list. For example, sim = [list1, list2, list3] I am able to do it this way without a loop, but how would you optimize this? trainID =sample(1:1000,700) train1 <- sim[[1]][trainID,] #first list train2 <- sim[[2]][trainID,] train3 <- sim[[3]][trainID,] bigtrain <- list(train1, train2, train3)
Use `lapply` : bigtrain <- lapply(sim, function(x) x[trainID, ])
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "r, loops, simulation" }
Keep post's draft date after publishing? I let users add posts in draft status. After I check and see that everything is ok, I publish them. I noticed that drafts created two days ago change date after being published. Is there any way of keeping that original date?
you need to manually set the publish date.
stackexchange-wordpress
{ "answer_score": 0, "question_score": 1, "tags": "draft" }
delphi xe disable RTTI i have use delphi xe recently but exe size is very big because of rtti(i think) howto remove rtti , and can i make my application size as small as delphi 2009 application(490 kb) without comprssion; and what is the use of rtti
In short (full story provided by links in the splash's answer): {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} Note that as of XE6 and newer, this needs to be in each individual unit for which you want to disable RTTI. Before that (XE5 and below) it could be in the DPR file and would apply to all units in the project.
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 10, "tags": "delphi, rtti, delphi xe, application size" }
Поиск по необязательным полям У меня есть поля в бд: one,two,three,four,five,six Обязательные для заполнения: two,three,four Вопрос, как мне проверять, заполнено ли поле one, five и six? и искать потом если заполнено one с $model->one и т.д. Пытался делать так, но так не работает, если поле не заполнено one например, то ничего не ищет: $v = Feedauto::find() ->andWhere(['two' => $model->two]) ->andWhere(['three' => $model->three]) ->andWhere(['four' => $model->four]) ->andFilterWhere(['or',['region'=>null],['region' => $model->region_id]]) ->andFilterWhere(['or',['one'=>null],['one' => $model->one]]) ->andFilterWhere(['or',['five'=> null],['five' => $model->five]]) ->andFilterWhere(['or',['six'=> null], ['six' => $model->six]]) ->all(); Надеюсь меня поняли)) т.е. проверка, если поле пустое, не искать по нему, если заполнено, то искать по нему...
Если для необязательных полей по умолчанию записывается пустая строка ка значение, то запрос должен быть таким: $v = Feedauto::find() ->andWhere(['two' => $model->two]) ->andWhere(['three' => $model->three]) ->andWhere(['four' => $model->four]) ->andFilterWhere(['or',['region' => ''],['region' => $model->region_id]]) ->andFilterWhere(['or',['one' => ''],['one' => $model->one]]) ->andFilterWhere(['or',['five' => ''],['five' => $model->five]]) ->andFilterWhere(['or',['six' => ''], ['six' => $model->six]]) ->all();
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, sql, yii2" }
Assembly offset calculation rule So... the rule of offset calculation states in my course book that: offset = [bp] + [bx] + [di|si] + CONST (any part is optional, but atleast one is required) But reading on the internet i found the rule as : offset = [bp|bx] + [di|si] + CONST **Which one is it? And why?** (In my opinion the first should be also valid since bx could contain an arbitrary value like (1..F), but i tend to belive I am wrong and there must be a BX or BP)
The "internet rule" is correct. You can have 1 base register (`bp` or `bx`) and 1 index register (`si` or `di`). You can't have `bp + bx` or `si + di` at the same time. See _Table 2-1. 16-Bit Addressing Forms with the ModR/M Byte_ in the Intel Instruction Set Reference Your course book is however correct that any part is optional but at least one is required, so you don't need a base or an index or an offset. These are all valid: `[const]`, `[bx]`, `[si]`, `[bx + si]`, `[bp + di + const]`. The full list is in the manual I linked above.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "assembly, x86, offset, x86 16" }
Writing content of HTML table into PDF doc using iTextSharp in asp.net I have an HTML table stored in a string. I want to write that string into a PDF document using iTextSharp library. Please suggest the approach. Below is the table I want to write in a PDF file <table> <tr> <th>test</th><td>&nbsp;&nbsp;</td><td>ABCD</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td> </tr><tr> <th>test 2</th><td>&nbsp;&nbsp;</td><td>XYZ</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td> </tr> </table>
Its is possible. try this. //HTMLString = Pass your Html , fileLocation = File Store Location public void converttopdf(string HTMLString, string fileLocation) { Document document = new Document(); PdfWriter.GetInstance(document, new FileStream(fileLocation, FileMode.Create)); document.Open(); List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(HTMLString), null); for (int k = 0; k < htmlarraylist.Count; k++) { document.Add((IElement)htmlarraylist[k]); } document.Close(); }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "asp.net, c# 4.0, pdf generation, itext" }
Handling user driven resizing, position changes in Java Swing I'm currently building a Java Swing GUI and I was wondering how user (mouse, say) driven resizing is handled. My problem is that when I try and resize my main window, or when some other window opens over my application, then my application's window gets distorted - all it's parts don't change well in response to the resizing or the other window. Does anyone have a diagnostic on where to start looking at this? Follow-ups questions, resources are also appreciated. Cheers.
While Rob is correct that a ComponentListener will give you a callback for when the panel is resized, you should not have to use that in order to make sure your GUI looks correct. Instead you should ensure that you have configured your LayoutManager appropriately to handle being resized. It can be a real pain in the neck to get resizing to work appropriately with the standard Layouts; I would highly recommend you check out MigLayout.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, user interface, swing, resize, refresh" }
Can't insert line break in Ajax outputString I have an Ajax script that outputs both the title and description of certain jobs based on user input. While I can get these displaying without issue, I can't seem to insert a line break between the title and description. I have the following: outputString = savedData[i].firstName + ". Description: " + savedData[i].cardNumber; var paragraph = $("<p />", { text: outputString }); $("#data").append(paragraph); I have tried inserting a traditional br line break, as well as, \n and \r\n both in the quotation marks before description which just displays the text of the line break rather than breaking the line, and also outside of the quotation marks which breaks any output. How can I successfully implement a linebreak? Cheers.
As you are providing the outputString string as text, the html `<br/>` is being displayed as text in the string. You should specify it in as html and use `<br/>` for line break: outputString = dataJobs[i].title + ". <br/>Description: " + dataJobs[i].description; var paragraph = $("<p />", { html: outputString }); $("#data").append(paragraph);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, php, ajax" }
Primefaces Clock component is not working as per the timezone attribute value I have been using `primefaces` 6.2.RC2 and in one of my pages I need to show a clock with seconds ticking every second for the set timezone. For this I have been trying to use `p:clock` as shown below. The problem I am seeing is that when my timezone is set to EST, it still shows CST time. Looks like the timezone attribute is not working with whatever values set: <p:clock pattern="HH:mm:ss" mode="server" timeZone="#{loginBean.timezone}"/> Even I have tried using `f.convertDateTime` and that is also not working for the `<p:clock/>`. Is there any solution to fix this issue?
Did you try America/New_York as the timezone? EST is UTC - 5 hours. America/New_York is EST in the winter and E _D_ T in the summer, so right now New York is UTC - 4 hours. * CST = GMT-5 * EST = GMT-5 * EDT = GMT-4 * America/New_York = -4 in summer and -5 in winter and switched on daylight savings.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "primefaces, timezone, clock" }
How to write completeness of wavefunctions without bra ket notation? In the quantum textbook I'm currently working from, the completeness relation is written as: $$ \sum_i |\psi_i \rangle \langle \psi_i| = \mathbb{1}. $$ But this seems to specifically require knowledge of individual bra and ket vectors. I know wavefunctions are supposed to satisfy both orthogonal and completeness relations, but I thought wavefunctions were written as coefficients of vectors $ \langle x | p \rangle = \psi(x) $ rather than the vectors themselves. Is there a way of writing the completeness relations if we're only given wavefunctions rather than bra or ket vectors? For example, the orthgonal relation for normalized wavefunction $ \psi_i $ and $ \psi_j $ is: $$ \int_{-\infty}^\infty \psi^*_i(x) \psi_j(x) dx = \delta_{ij}. $$ But I'm unsure of the equivalent for the completeness relation. Any insight would be greatly appreciated!
One way you can show the completeness relation without bra-ket notation is just $$\sum_{i} \langle \psi_i , v \rangle \psi_i = v \qquad \forall v\in\mathcal{H},$$ where $\mathcal{H}$ is the Hilbert space in question, and $\langle \cdot,\cdot\rangle$ is the corresponding inner product. Or you can say that the linear operator $$\begin{cases} T:\mathcal{H} \rightarrow \mathcal{H}\\\\[7pt] v \mapsto T(v)=\sum_{i} \langle \psi_i , v \rangle \psi_i\end{cases} $$ is the identity operator $T = 1\\!\\!1$.
stackexchange-physics
{ "answer_score": 11, "question_score": 4, "tags": "quantum mechanics, hilbert space, wavefunction, notation" }
Stateless EJB threading issue Consider the following two EJBs: @Stateless public class MyBean1 { pulic void method1() { //method implementation comes here } pulic void method2() { //method implementation comes here } } @Stateless public class MyBean2 { @EJB MyBean1 myBean1; public void businessMethod() { myBean1.method1(); myBean1.method2(); } } Will the container gurantee that the two methods are called on the **same instance** of MyBean1 (and no other methods are called in between the two method calls on that instance)?
You can't tell if you get access to the same instance or not. The container decides about that. Even if you "think" it's the same instance (e.g. one `@EJB MyBean1` in your code) those calls might hit different `MyBean` instances. Other business methods of your EJB might be called between your `myBean1.method1()` and `myBean1.method2()` invocations. This might be e.g. a call to the EJB made from different component. This should, however, not interest you so much because you're using stateless EJB's - i.e. you shouldn't store any state in your EJB. Therefore, either you get the same or different EJB instance or some other component will invoke a business method on the EJB of the same type between your calls should not be a concern.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "jakarta ee, thread safety, ejb, pool" }
Are incoming connections required for mining? I am setting up a RPi3 Mining node for fun. I know that it will have less than 8 connections that are outgoing. I know that if I was able to configure my network and router to allow incoming connections on port 8333 it would make my node work better. My question is whether the incoming connections is required in order for the node to mine at all. Will the outgoing connections that I make allow those peers to send my node transactions as those nodes get them, or is incoming connections the only way to get transactions that can then allow my node to mine blocks?
Incoming connections are not required for mining. You only need some connectivity with the rest of the network. It does not matter how that connectivity is established. You would need to use the `getblocktemplate` based mining interface, with dedicated mining software, as Bitcoin Core no longer has any built-in miner support since v0.13.
stackexchange-bitcoin
{ "answer_score": 1, "question_score": 0, "tags": "miner configuration, connection, peers" }
Why I got value 0 when using intval() to this statement (PHP) <?php $sample01 = "3 hours with Mustang"; echo intval($sample01)."<br/>"; $sample02 = "Grand Total: $2,802.60"; echo intval($sample02)."<br/>"; ?> When I echo `intval($sample01)` , it prints 3 as a result which is right, just like what my book says. But when I echo `intval($sample02)`, it prints 0 !!! I am so confused. Shouldn't it print 2,802 ? Please advise.
> ### String conversion to numbers: > >> If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, int, echo" }
C++ accessing nested type using alias (using vs typedef) Today we have found a confusing C++11 alias-declaration behavior. Here is the example: template<typename T> struct Q { typedef T t; }; template<typename T> void foo(Q<T> q) { using q_t = Q<T>; //typedef Q<T> q_t; // if we uncomment this and comment 'using' the example compiles typename q_t::t qwe; // <<<<<<<<<< Error: no type named ‘t’ in ‘using q_t = struct Q<T>’ } int main(int argc, char *argv[]) { Q<int> q; foo(q); return 0; } The ISO 14882 (C++11) says that these two declarations must have the same semantics (page 145). However if we have q_t declared with 'using' the example does not compile using GCC 4.7.2 (Debian Wheezy) and GCC 4.7.3 (Ubuntu 13.04) but the replacement of 'using' statement with 'typedef' statement makes it compiled. Is it a bug in GCC or we just misunderstood the standards?
This seems to be a GCC 4.7 bug. Here is my test to compile your code, and it works using gcc 4.8.1 So as the spec says this: using q_t = Q<T>; // is equivalent to this typedef Q<T> q_t;
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "c++, gcc, c++11, alias, using" }
Insert jQuery Variable into php function I need help in this. I want to encrypt password before assigning it to jquery variable then send to php controller via ajax. Unfortunately I cant insert the password(which is jquery variable) into php hash function. Any help will be appreciated.I want the 'password' inside hash function to be the value I received in the var password. This is the code snippet: $(document).ready(function() { $("#login").click(function() { var username = $("#username").val(); var password = $("#password").val(); var encPass = '<?php echo hash("SHA512", "password"); ?>' }); });
You can't do this, because firstly, php script work on the server. After php script has been done, javascript will work on the client side. You need to use only javascript code to make hash if you don't want to send password publicly. For example: <script src=" <script> var hash = CryptoJS.SHA512("Message"); </script> For your case: $(document).ready(function(){ $("#login").click(function(){ var username = $("#username").val(); var password = $("#password").val(); var encPass = CryptoJS.SHA512(password); }); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, jquery" }
Arduino / C++ - IF INT value = X Then i have an INT in my arduino code that i constantly update it's value and i want to check the value and compare it to static values and run IF statments out of it. Something like this INT = 3 If (int = 1) { run1() } If (int = 2) { run2() } If (int = 3) { run3() } the above example just overwrites the original INT value
In C++ `=` is the assignment operator. Please use `==` to compare: int i = 3; if (i == 1) { run1(); } if (i == 2) { run2(); } if (i == 3) { run3(); } Also note the lowercase `if` and that `int` is a keyword which you can't use as variable name. You might want to check out The Definitive C++ Book Guide and List \- it has some useful resources for beginners.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, arduino" }
Inequality for conditional probabilities does somebody have an idea how to prove this proposition: $A$ arbitrary, $B\subset C$ and $P(B)>0$ => $P(A|C)\ge P(A|B)$. It should be simple but somehow I cannot get it. Thanks in advance.
This is not true. Let $B = A, C = \Omega$, then $$ \mathbb{P}(A|C) = \mathbb{P}(A|\Omega) = \mathbb{P}(A) \leq 1 = \mathbb{P}(A|A) = \mathbb{P}(A|B). $$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability, inequality" }
How is styling of the UI for an IOS Apps done? So with websites on the web we use HTML, CSS and Javascript. 1. What do we actually use to build the UI for an IOS App? 2. Is there a CSS/HTML/JS equivalent use for building IOS Apps? 3. What is the most common way use to design, style the UI of an IOS App? The reason I ask is because I'm spending longer than expected learning core graphics and would like to move on with the book I'm studying from. I was under the impression core graphics was used for styling of apps and it was like an IOS equivalent of CSS. Hoping someone could help clear things up thanks. Regards
In many cases, images are used for styling in iOS. For simple things like just changing background and text colors, UIView and its subclasses have direct accessors. For most things, you won't need core graphics just for styling purposes. It would be easier to help you if we knew more concretely what you want to achieve, though. The closest thing to a CSS equivalent is appearance proxies, which allow you to specify things like "all instances of UITextField should look have this font, colors and shadow when contained inside a NavigationController". You can override this for specific instances by just setting the desired values on the instance.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, cocoa touch, user interface, uiview, ios7" }
How to integrate $\int \frac{1}{\sin^4 x \cos^4 x}\,dx$? The integral in question is: $$\int \dfrac{1}{\sin^4 x \cos^4 x} dx$$ I tried using $1 = \sin^2 x + \cos^2 x$, but it takes me nowhere. Another try was converting it into $\sec$ and $\csc$, but some factors of cosec always remained when I substituted $\sec x$ as t. Please give a pointer to where I should proceed. Thank you!
By using the substitution $x=\arctan t$ we have $dx=\frac{dt}{1+t^2}$ and $\sin^2(x)=\frac{t^2}{1+t^2}$, $\cos^2(x)=\frac{1}{1+t^2}$, hence $$ \int \frac{dx}{\sin^4(x)\cos^4(x)} = \int\frac{(1+t^2)^3}{t^4 }\,dt $$ and the last integral is straightforward to compute through the binomial formula. It equals: $$ C-\frac{1}{3 t^3}-\frac{3}{t}+3 t+\frac{t^3}{3}.$$
stackexchange-math
{ "answer_score": 6, "question_score": 2, "tags": "integration, trigonometry, trigonometric integrals" }
Ограничение на количество просмотра материала по IP Необходимо реализовать ограничение на просмотр материалов по количеству просмотров с одного IP адреса. После того как пользователь зайдёт определённое количество раз в текущий день он уже не сможет зайти на любую страницу принадлежащую к данному типу материала. Вместо этого у него появится другая страница с информацией. С помощью каких модулей можно реализовать подобный функционал? Возможно готовые примеры реализации, или предложения по реализации будут полезными.
Как правильно писали в комментариях к вопросу - задача достаточно редкая из-за того, что так никто не делает, поэтому найти готовый модуль не получится. **Drupal 6** * < \- можно взять и конвертировать на 7ку. Как конвертировать модуль можно загулить или начать с < **Drupal 7** * < \- не совсем то, что нужно, но наверняка реализованы основные "блоки".
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "drupal" }
Else statement after multiple if statements Quick theory question if x: y if a: b if 1: 2 else: 3 Bottom "else" only affects last if?
From the grammar: if_stmt ::= "if" assignment_expression ":" suite ("elif" assignment_expression ":" suite)* ["else" ":" suite] A `suite` is, roughly speaking, a series of indented statements. So `x` is an assignment expression, and `y` is the suite associated with the first `if`. Because the next token is `if`, it starts a new `if` statement rather than continuing the first `if` statement in any way. Thus, you have three separate `if` statements. The first two have no associated `elif` or `else` clauses; the third one has an `else` clause.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -3, "tags": "python, python 3.x" }
JavaScript replace all ignoring case sensitivity I am trying to replace all the occurences of a value in a string and with another value what I have so far is var result = "Cooker Works" var searchterm = "cooker wor"; searchterm.split(" ").forEach(function (item) { result = result.replace(new RegExp(item, 'g'), "<strong>" + item + "</strong>"); }); console.log(result) The result I am after should look like result = "<strong>Cooker</strong> <strong>Wor</strong>s"; I am having problems handling the case, Is there any way I can ignore this and still get the result I am after
You will get the result you want using capture groups and the `i` (ignoreCase) modifier. You can reference the capture group with `$1`. var result = "Cooker Works"; var searchterm = "cooker wor"; searchterm.split(" ").forEach(function(item) { result = result.replace(new RegExp(`(${item})`, 'ig'), "<strong>$1</strong>"); }); console.log(result) See MDN for more details: <
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 8, "tags": "javascript, regex" }
Does owning BP ADR from US stock market required to pay custody fees Helo, I am a Malaysia investor. Recently, I invest in BP ADR from US market, through my local broking firm. I was wondering, whether owning BP ADR, requires me to pay custody fee. What my understanding is, bank which issues the ADR, will charge a custody fee, by deducting it from the received dividend. I cannot find a specified of such information from regarding BP ADR.
New SEC rules also now allow brokers to collect fees on non-dividend bearing accounts as an "ADR Pass-Through Fee". Since BP (and BP ADR) is not currently paying dividends, this is probably going to be the case here. According to the Schwab brokerage firm, the fee is usually 1-3 cents per share. I did an EDGAR search for BP's documents and came up with too many to read through (due to the oil spill and all of it's related SEC filings) but you can start here: <
stackexchange-money
{ "answer_score": 6, "question_score": 3, "tags": "stocks, adr" }
stringWithFormat Bad Access error Can anyone explain why this code works perfectly: int thumbnailPrefix = trunc([newGraph.dateCreated timeIntervalSinceReferenceDate]); newGraph.thumbnailImageName = [NSString stringWithFormat:@"%d.%@",thumbnailPrefix,@"png"]; But this code causes a Bad Access error? newGraph.thumbnailImageName = [NSString stringWithFormat:@"%d.%@",trunc([newGraph.dateCreated timeIntervalSinceReferenceDate]),@"png"];
`trunc` returns a `double`, not an `int`. double trunc(double x); So in the first code block you are converting it to an `int`, and correctly using the `%d` format specifier. In the second, it should be an `%f`, or have `(int)` in front of it. newGraph.thumbnailImageName = [NSString stringWithFormat:@"%d.%@",(int)trunc([newGraph.dateCreated timeIntervalSinceReferenceDate]),@"png"];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "objective c, ios, exc bad access, stringwithformat" }
C++ valarray vs array size allocation I am allocating a multidimensional valarray of size 2000x2000 and it is working smoothly. valarray<valarray<int>> D(valarray<int>(-2,2000), 2000); D[1999][1999] = 2000; However, if I try to allocate a normal array and access an element, I get segmentation fault. int A[2000][2000]; A[1999][1999] = 2000; Both are on the stack, why this difference ?
Like `std::vector`, the underlying storage of `std::valarray` is dynamic, and the size of the object that manages this storage does not depend on the number of elements. This program: #include <iostream> #include<valarray> int main() { std::cout << "sizeof(std::valarray<std::valarray<int>>): " << sizeof(std::valarray<std::valarray<int>>) << std::endl; std::cout << "sizeof(int[2000][2000]): " << sizeof(int[2000][2000]) << std::endl; } produces this output for me: sizeof(std::valarray<std::valarray<int>>): 16 sizeof(int[2000][2000]): 16000000 If you were to use `std::array` instead, you would have problems, though.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c++, multidimensional array, segmentation fault, valarray" }
Let $p(z) = z^6 + 9 z^4 + z^3 + 2z + 4$ show that the two zeros of $p(z)$ lying outside the unit circle satisfy $\{ |z \pm 3i| < 1/10$ Let $p(z) = z^6 + 9 z^4 + z^3 + 2z + 4$, I want to show that the two zeros of $p(z)$ lying outside the unit circle satisfy $ |z \pm 3i| < 1/10$. By the Rouche's theorem, $p(z)$ has four zeros contained in the unit circle. Therefore, the other two zeros must lie outside of the unit circle. Here is my attempt: let $f(z) = z^6 + 9z^4$ and $g(z) = z^3 + 2z + 4$. Now $f(z)$ clearly has two zeros at $z = 3i$ and $z = - 3i$ in the domain $D = \\{ |z + 3i| < 1/10\\}$. If I can show the $|g(z)| < |f(z)|$ on $\partial D$, then I can apply the Rouche's theorem. So that $p(z) = z^6 + 9 z^4 + z^3 + 2z + 4$ has same number of zeros with $f(z) = z^6 + 9z^4$ on the domain $D = \\{ |z + 3i| < 1/10\\}$. However, seems like I can't prove the inequality $|h(z)| < |f(z)|$ required by the Rouche's theorem. Can anyone provide me some help please?
If $|z+3i|=0.1$ then $$|f(z)| =|z|^4 |z-3i ||z+3i| =0.1 |z-3i| |z|^4 \geq 0.1\cdot 5.9 \cdot (2.9)^4 >41$$ and $$|h(z)|=|z^3 +2z +4|\geq |z|^3 +2|z| +4 =(3,1)^3 +6.2 +4 <40$$ So $$|f(z)|> |h(z)|$$ on $|z+3i|=0.1 $
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "complex analysis" }
git repository in single system user environment in SVN it was possible to work in several people on one working copy of a repository. SVN prompted for a username and password and commits were attributed to the user which logged in even though they accessed the server with one system user. However, in git, I cannot find a way to acomplish this easily. I know the preffered workflow is to have a repository clone for each developer, but that is not possible in some cases. Any ideas how to solve this?
Git or any DVCS doesn't support a "centralized" authentication due to its distributed nature. I.e. you can sign each commit with any string you want. The way I managed that in a common working tree was by defining an **alias for git** : The alias was referring to a **wrapper** , which: * asks for a username and email, and then set `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL`. * call the actual `git` executable with all the parameters initially passed to the wrapper. From there, all git commands are done with the right credentials.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "git, svn, dvcs" }
Parked domain not being redirected I own a domain, **pricipal.com**. When I try to access it the redirect link gets stuck. I see in Chrome Developer tools that URL has status code 400. What causes this failure and how can I trouble shoot it?
Reason of the failure: A 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow the rules "redirect link gets stuck" .. There are two type of solution one is simply removing cache and cookie of your browser. Another is little bit difficult. Try to set up your dns properly. If you are using CPANEL, sometimes ROOT User or admin of the server change addon/parked domain default directory which usually create redirecting loop.In short Servers Wrong configuration may cause this trouble. Try to park another domain and see what happen if that domain show you the same error contact with your server administrator
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "http, redirect, dns" }
Find $\lambda^* ( \bigcup _{n \geq1} [n-2^{-n}, n+2^{-n}])$ Can someone show me a detailed working of this please. Apparently it is equal to $2$. The set evaluated would be $[0.5, 1.5] \cup [0.75, 1.25] \cup ...$ I do know that $$0 \le \lambda^* ( \bigcup _{n \geq1} [n-2^{-n}, n+2^{-n}]) \le \sum_{n=1}^{\infty}\lambda^* ( [n-2^{-n}, n+2^{-n}])=2$$ This is because the RHS would be $2/2^1+2/2^2+2/2^3+...=2$ Can't see how the actual question would be equal to $2$ as well. This is my guess: The definition of outer Lebesgue measure is $$\lambda^*(E)=\inf \\{\sum_{i \ge 1} |I_j| : I_j \, \, \text{are open intervals and} \, \, E \subseteq \bigcup_{j \ge 1} I_j \\}$$ We can make our $I_j$ such as $I_1=(0.5- \varepsilon , 1.5 +\varepsilon)$, $I_2=(0.75- \varepsilon , 1.25 +\varepsilon)$ and then so on. It would be clear that $$\bigcup _{n \geq1} [n-2^{-n}, n+2^{-n}] \subseteq \bigcup_{j \ge 1} I_j $$ Then the sum of the lengths of these open intervals will be $2$ right?
**Hint** : the measure of a disjoint union of measurable sets is the sum of the measures of the sets. Have you seen a proof of this? Edit: I noticed you forgot to shift your intervals by $n$. That could cause some trouble.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "measure theory, lebesgue measure, outer measure" }
Calculating Percentages In my Java textbook, they have the following question: Write an if statement that increases pay by 3% if score is greater than 90, otherwise increases pay by 1%. And they use the following example: if (score > 90) pay *= 1.03; else pay *= 1.01; I am unsure as to where they are getting "1.03" rather than "0.03". I am pretty sure to convert to decimal to percent, you move the decimal 2 places to the left? Am I missing something here?
This is nothing but basic math, the distributive law in action. They are simply adding a percent to the original value. If you want 10% of a number, multiply by 0.1. If you want to **add** 10% to a number, multiply by 1.1. This is the same as # The distributive law in action: `number * (1 + 0.1)` is the same as `(number * 1) + (number * 0.1)`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "java, percentage" }
Prove or disprove that $\lim_{n→∞}\sup_{x∈R}⁡f_n (x) =\sup_{x∈R}⁡f(x)$ > Let $\\{f_n\\}$ be a sequence of function defined and bounded on $\mathbb R$, and suppose that $\\{f_n\\} $converges uniformly to $f$ on every finite interval $[a,b]$. Prove or disprove that $$\lim_{n→∞}\sup_{x∈R}⁡f_n (x) =\sup_{x∈R}⁡f(x).$$ I know that $\\{f_n\\} $converges uniformly to $f$ that mean $\lim_{n\to \infty}\sup |f_n -f| \to0$. But it's not necessary that $\lim_{n→∞}⁡\sup_{x∈R}⁡f_n (x) =\sup_{x∈R}⁡f(x)$. I don't think this is true, But I can't find counter example either.
Let $$ f_n = \left\\{ \begin{array}{cc} 1 & \text{ if } x \ge n \\\ 0 & \text{ if } x < n \\\ \end{array} \right. $$ Given any finite interval $[a,b]$ and any $\epsilon > 0$, just pick $N > b$ and we have that $f_n = 0$ on $[a,b]$ for $n > N$. Thus $f_n \to {\textbf{0}}$ uniformly on $[a,b]$.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "calculus, real analysis, sequences and series, uniform convergence" }
"ORA-01438: value larger than specified precision allowed for this column" when inserting 3 I'm running into that error when trying to insert any number except 0 into a field with format NUMBER (2,2). UPDATE PROG_OWN.PROG_TPORCENTAJE_MERMA SET PCT_MERMA = 3 WHERE IDN_PORCENTAJE_MERMA = 1 [Error Code: 1438, SQL State: 22003] ORA-01438: value larger than specified precision allowed for this column COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS PCT_MERMA 3 NUMBER 2 0 2 It also happens if I try with decimal numbers. Any idea why?
You can't update with a number greater than 1 for datatype `number(2,2)` is because, the first parameter is the total number of digits in the number and the second one (.i.e 2 here) is the number of digits in decimal part. I guess you can insert or update data `< 1`. i.e. 0.12, 0.95 etc. Please check NUMBER DATATYPE in NUMBER Datatype.
stackexchange-stackoverflow
{ "answer_score": 39, "question_score": 23, "tags": "sql, oracle" }
How to change the server port from 3000? I just ended the tutorial of Angular 2 and I can't find a way to change the localhost port from 3000 to 8000. In my `package.json` file there's the line `"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "` that I believe is related but I'm not sure.
You can change it inside `bs-config.json` file as mentioned in the docs < For example, { "port": 8000, "files": ["./src/**/*.{html,htm,css,js}"], "server": { "baseDir": "./src" } }
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 23, "tags": "npm, angular" }