INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
$d_1, d_2$ are metrics on $X$; $(X,d_1)$ is complete. Let $i:(X,d_1)\to(X,d_2)$ be continuous and $i^{-1}$ unif. cont. Show $(X,d_2)$ is complete. This is a problem on an old preliminary exam in Analysis I'm working through. The problem initially looked easy to me; my plan is to show that for any $\\{x_n\\}$ Cauchy in $(X,d_2)$, we have that $\\{i^{-1}(x_n)\\}$ is Cauchy in $(X,d_1)$, therefore convergent to some $x\in X$, and therefore by the continuity of $i$ we have that $x_n\xrightarrow{d_2}x$. The problem I run into is that I can't quite see how to show that $\\{x_n\\}$ is Cauchy in $(X,d_1)$. I don't see how the uniform continuity of $i^{-1}$ comes into play, either. Any help would be appreciated.
Assume $(x_n)$ is Cauchy in $d_2$. For any $\delta > 0$ : $d_2(x_n,x_m) < \delta$ for $n,m$ large enough. By uniform continuity of $i^{-1}$ it follows that $(x_n)$ is Cauchy in $d_1$, hence convergent. To be very precise: Let $\epsilon > 0$ and $\delta > 0$ such that $d_2(x,y) < \delta$ implies that $d_1(i^{-1}(x),i^{-1}(y)) = d_1(x,y) < \epsilon$ . Then, there exists an $N$ with $n,m \geq N$ implies $d_2(x_n,x_m) < \delta$ and hence $d_1(x_n,x_m) < \epsilon$ for $n,m \geq N$. Since this can be done for every $\epsilon > 0$ it follows that $(x_n)$ is Cauchy in $d_1$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis, analysis, metric spaces" }
Why did Mavis lend Fairy Glitter magic to Cana? Cana got Fairy Glitter from Mavis's tomb in Tenrou Island. Mavis also said in Daimatou Enbu that she lent this magic to Cana. But I'm still not sure why Mavis lent Fairy Glitter to Cana? Is there any explanation for this?
Explaining further from my comment, Mavis gave Fairy Glitter to Cana twice, on Tenrou Island and on Daimatou Enbu, and both for different reason. ## Tenrou Island Arc. Chapter 232 The One Thing I Couldn't Say This is the first time Mavis gave Fairy Glitter for Cana, Cana first intention is to show her father, Gildart that she can become an S-Class Mage. She tricked Lucy and left her alone. At first, when she reached Mavis's grave, it was sealed and she couldn't touch the grave. But at the end she realized that she only want to protect her friends. So Mavis gave her Fairy Glitter because of her pure heart to protect her friends and the guild. ![enter image description here]( ## Grand Magic Tournament Arc. Chapter 285 MPF This is the second time Mavis gave Fairy Glitter for Cana. As for the reason, it's less complicated than the first time, she did it so Fairy Tail could win the tournament, and show that Fairy Tail is back. ![enter image description here](
stackexchange-anime
{ "answer_score": 4, "question_score": 1, "tags": "fairy tail" }
Where might the given name Xelefon originate? I was recently reading some historical records wherein a lady was mentioned, Olga Malar (née Cuch), born in "Napodiwka," Poland, in 1922. She was said to be the daughter of **Xelefon** Cuch and Jewdokia Romaniuk. Every individual name on the record can be cross-referenced elsewhere, apart from the birthplace, and father's given name ( **Xelefon** ). Both are possibly misspellings, but of what? Online, there are barely any concrete results for a search of _Xelefon_ , or even possible permutations like _Kselefon_ , _Helefon_ or _Chelefon_. It seems particularly unusual for the letter _x_ to appear in Polish. It is not part of the standard alphabet, though it may appear in calques. However, even then, _x_ is often substituted for _ks_ , for example. EDIT: No official answers by 2020.
Google suggests a possible Turkish origin. Otherwise, the name may be a variant of Xenofon/Ksenofon, suggesting a Greek connection.
stackexchange-linguistics
{ "answer_score": 0, "question_score": 0, "tags": "historical linguistics, orthography, written language, history, names" }
Is the linear dual of a cyclic $K[G]$-module $K[G]$-cyclic Let $G$ be a finite group and let $K$ be a field of characteristic $0$. Let $M$ be a free, finitely generated $K$-module and assume in addition that $M$ is cyclic as a (left) $K[G]$-module. Consider the dual $M^{\ast}:=Hom_{K}(M, K)$ of $M$. I know that there is a non-canonical isomorphism of $K$-modules $M \cong M^{\ast}$ and that $M^{\ast}$ can be made into a $K[G]$-module. Can we prove something about the structure of $M^{\ast}$ as a $K[G]$-module, for example can we prove that it is cyclic, since $M$ is cyclic?
Yes, it’s cyclic. A cyclic module $M$ is just one that is a quotient of $K[G]$, the regular $K[G]$-module. But by Maschke’s theorem, a quotient of $K[G]$ is a direct summand, so $M^*$ is a direct summand of $K[G]^*$, which is isomorphic to $K[G]$, so $M^*$ is also cyclic. But in positive characteristic, where Maschke’s theorem doesn’t apply, it’s not always true that the dual of a cyclic module is cyclic.
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "representation theory, dual spaces, free modules" }
Security holes in XAMPP for Windows? I need to install a MySql server on my Windows machine to run a local database. does anyone know if this thing poses a vulnerability?
"...XAMPP is not meant for production use but only for developers in a development environment. XAMPP is configured is to be as open as possible and to allow the web developer anything he/she wants. For development environments this is great but in a production environment it could be fatal. " Here a list of missing security in XAMPP: * The MySQL administrator (root) has no password. * The MySQL daemon is accessible via network. * phpMyAdmin is accessible via network. * The XAMPP demopage is accessible via network. * The default users of Mercury and FileZilla are known. Read this for more: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql, apache, xampp" }
Where does JVM store information of abstract classes implemented at runtime? I am using ASM library in Java to extract information of a class from compiled .class file. Now I am not able to get information of abstract classes implemented at runtime. Where does JVM store information of abstract classes instantiated at runtime? Like below example. public MockAbstractClass testForAbstract(){ return new MockAbstractClass() { @Override void abstractMethod() { mockMethod(); } }; } static abstract class MockAbstractClass{ abstract void abstractMethod(); } Here object of MockAbstractClass is created at runtime in testForAbstract() Method, also class is implemented at runtime.
Lambdas are an example where classes are generated at runtime. The only way to access dynamically generated class is to store them via Instrumentation. There is a component which is called for every class defined by any means. You then need to store a reference to the byte code for those classes. You could optimise this to not store classes there the byte code can be retrieved from the classloader. NOTE: For lambdas you don't get the class name or class loader but you can read the byte code to get the class name.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java, jvm, abstract class, java bytecode asm" }
What push notifications can I expect from the Stack Exchange iOS app? I have recently started using the official iOS Stack Exchange app. So far I have received push notifications about comments in my answers or comments that mention me directly, but I am not getting any notifications about reputation changes or badges. Should I expect these notifications or they are not a feature of this app?
You get push notifications from the iOS app for almost anything that adds an item to your _notifications_ inbox. Your notifications exclude rep and badge changes (those are in the "achievements" inbox, next to it on the desktop interface). That means you'll get notifications for: * answers to your question * comments on your posts * comments that mention you * chat mentions * moderator messages etc. You _won't_ get notifications for: * rep changes * new badges * edits made to your posts * bounty expirations
stackexchange-meta
{ "answer_score": 4, "question_score": 3, "tags": "support, notifications, ios app" }
Problem with universal cloth size (S,M,L) regex Having issue with my regex. My goal is detect cloth size and cut other data. Here is some examples of size: 2XS M XXL Long XL Short Here is my regex ^(\d*[SMLX]+)\s*.*# This regex works for most cases, but it works wrong, if my size contain chars out from the range of allowed. For `XXL` Long or `2XL` it returns correct data (`XXL` and `2XL`), but if my size looks like `2AXL`, it returns `2XL`, but in this case it must return an empty result, because "A" char is out of allowed chars range.
The regex `[SMLX]` matches `S`, `M`, `L` **or** `X`. What you describe can be achieved with the following regex: ^(\d*(?:M|X{0,2}[SL]))(?:$|\s+.*$) Which matches either plain `M`, or optional `X`s that are followed by <`S` or `L`> preceded. I've also modified the suffix of your regex, to match strings that has no suffix after the size and prevent from `\s` matching a newline operator - which results in matching multi-lined strings.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "regex" }
Encrypt and sign with specific secret key I have an OpenPGP smart card key (YubiKey NEO) as well as a local secret key installed in my GnuPG keyring. I'd like to encrypt and sign a file with my card's key, not the key in my keyring. How can I specify what key I'd like to sign with? If my filesystem secret key id is `DEADBEEF` and my smartcard key is `DEADBEE5`, how do I sign with that key?
You should specify `--default-key`: gpg -s --default-key DEADBEE5 input > output and check afterwards with gpg -d < output | head -1 From the `gpg man` page( `--sign` section): > The key to be used for signing is chosen by default or can be set with the --local-user and \--default-key options.
stackexchange-unix
{ "answer_score": 19, "question_score": 33, "tags": "gpg" }
Should a parent function call be calling the parent's parent if the parent has no such method? For academic purposes, I am wondering if a parent method call should lead to a parent's parent method call in case when the parent has no such method? For example (pseudo-code): class A { function doSomething() { } } class B extends A {} class C extends B { function doSomething() { parent::doSomething(); } } i = new C(); i->doSomething(); Does parent calling in object oriented languages mean that if the parent is missing the method, its parent will have its method called instead?
In OOP this question is usually answered by the function `doSomething`'s visibility. If it was protected or public in class `A`, then _yes_ , it will be called if it is not overridden in `B` (I assume here also that the `extends` keyword is public inheritance. See < for more information.)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "oop, class, object" }
Optimal substructure and dynamic programming for a variant of the rod cutting problem The rod-cutting problem described in Section 15.1 of CLRS, 3rd edition is the following. > Given a rod of length $n$ inches and a table of prices $p_i$ for $i = 1, 2, \ldots, n$, determine the maximum revenue $r_n$ obtainable by cutting up the rod and selling the pieces. This can be solved by dynamic programming with the recursion (consider the leftmost piece of length $j$): $$R(i) = \max_{1 \le j \le i} \Big(p_j + R(i-j)\Big),\; R(0) = 0,$$ where $R(i)$ denotes the maximum revenue obtainable by cutting up a rod of length $i$. In exercise $15.3$-$5$, a variant is considered: > we also have limit $l_i$ on the number of pieces of length $i$ that we are allowed to produce, for $i = 1, 2, \ldots, n$. **_Problem:_** Is this variant of the rod cutting problem solvable using dynamic programming?
**_Answer My Own Question:_** Let $L$ be the length limit array. Define $R(i, L)$ to be the maximum revenue obtainable by cutting up a rod of length $i$ with the length limit array $L$. The recursion is (consider the leftmost piece of length $j$; the base cases are not included): $$R(i, L) = \max_{1 \le j \le i \land L_j \ge 1} \Big(p_j + R\big(i-j, L[j \mapsto L_j-1]\big)\Big),$$ where $L[j \mapsto L_j - 1]$ leaves other length limit than $L_j$ unchanged.
stackexchange-cs
{ "answer_score": 1, "question_score": 2, "tags": "algorithms, optimization, dynamic programming, recurrence relation" }
Performance of passing object as argument in javascript Theoretical question, if for e.g. I have a big object called `Order` and it has a tons on props: strings, numbers, arrays, nested objects. I have a function: function removeShipment(order) { order.shipment.forEach( // remove shipment action ); } Which mean I access only one prop (`shipment`), but send a big object. From perspective of garbage collection and performance is there a difference, between pass `Order` and pass `Order.shipment`? Because object passed by **reference** , and don't actually copy `Order` into variable.
Created a simple test here < Test results: * in Chrome passing object is ~7% slower that passing raw value * in Firefox passing object is ~15% slower that passing raw value * in IE11 passing object is ~10% slower that passing raw value This is syntetic test for passing only one variable, so in other cases results may differ
stackexchange-stackoverflow
{ "answer_score": -2, "question_score": 3, "tags": "javascript, performance, function, object, garbage collection" }
Regular Expression For Currency I have numbers like this 12,555,666.0000 [valid] 125,636.0000 [valid] 1,256.0000 [valid] 12,56..0000[invalid] 12*565.54.00 Now I need a regex for this where I have to make sure 1. This number does not contain a special character except(,) and just one decimal point (.) I tried something like this `^[\d,]*\.{0,1}\d{0,4}$` but it doesn't work.
You can try like this: ^\d+(\,\d{3})*(\.\d{1,4})?$ 1. Start with one or more digits `^\d+` 2. Followed by (comma and three digits) zero or more times `(\,\d{3})*` 3. Followed by (point and 1 to four digits) zero or one time `(\.\d{1,4})?` 4. End `$` Example: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "regex" }
Defaults not set in Rails multiple-select form In my application, one article can have multiple tags. When creating an article, I am able to add multiple tags to an article using a multiple-select dropdown and the Rails Select2 gem. The problem is that when I edit the article, none of the tags are selected, and a user has to select them all over again. <%= form_for(@article) do |f| %> <%= f.select :tags, options_for_select(@tags.collect {|t| [ t.id, t.title] }),{:selected=>@article.tags}, :multiple => true, :id => "article_tags", :class => "form-control" %><br> <%= f.submit 'Update', :class => "btn" %><br> <% end %> <script> $(document).ready(function() { $("#article_tags").select2({multiple:true}); }); </script> Any suggestions?
This ended up working when I put it at the bottom of the page: <script> $(document).ready(function() { $("#tags").select2({multiple:true}); $('select').select2().select2('val', 'tag one, tag two, tag three'); $('select').select2(); }); </script>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails, jquery select2" }
VMware - 64bit guest on Windows Home Premium I have a CPU supporting Intel VT-x, but VMware is refusing to run a 64bit guest operating system ("This host is VT-capable, but VT is disabled."). I think VT is enabled in the BIOS, so I'm wondering if my problem is related to Windows 7 Home Premium 64bit. Do I need Win7 Professional, or should this be working?
Well, as so often, the solution was "Have you tried turning it off and on again?". I took the following steps to fix the problem: * Disabled VT in the BIOS (Advanced BIOS features -> CPU feature -> Virtualization) * Boot, shutdown (cold restart) * Re-enabled VT * Boot, shutdown (cold restart) Now VMware works as expected. So my problem definitely was not related to having Home Premium.
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "vmware, virtualization" }
How do I earn the student badge? I do not understand this explanation of how to get to be a student. > First question with a score of 1 or more Is there an online manual with this info?
I just upvoted your question. Now you should have a question with "a score of 1 or more". While you are on this site, you will begin learning about how it works and things you can do. When you ask a question and someone gives it an upvote, you get the badge "student". When you answer a question and someone likes it enough to upvote it, you get a badge "teacher". To the right of the box you enter questions, you'll see 4 numbers separated by dots. Left click on those numbers and you will find some information about badges.
stackexchange-meta_askubuntu
{ "answer_score": 10, "question_score": 5, "tags": "support, reputation, badges" }
Access to Snowflake Internal Stage for Non Owner Role I am putting data into Internal Table Stage and then use Copy command to load into Actual Table. It is working fine with my ID since I am table owner ( my role). Now, I am trying to run this process with a different user who has read and write access on table. I get below error: Insufficient privileges to operate on table stage "stagename". **is there a way to grant PUT access to other roles for internal table stage?** I see this is possible for Names Stage but I do not see any documentation for Internal Table Stage.
You'll have to use a named stage if you want to grant privileges: > Note that a table stage is not a separate database object; rather, it is an implicit stage tied to the table itself. A table stage has no grantable privileges of its own. To stage files to a table stage, list the files, query them on the stage, or drop them, you must be the table owner (have the role with the OWNERSHIP privilege on the table). <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "snowflake cloud data platform, put, file transfer, snowflake pipe, movefile" }
Context free Grammar for x1#x2#...#xn Design a Context-free grammar **(CFG)** for this language ![enter image description here](
To understand the idea behind the grammar first consider the **Pushdown Automata** for this langugage: Non-deterministically choose either the beginning or any $\\#$, push the string between the chosen position and the next $\\#$ symbol. Again non-deterministically choose another $\\#$ and start popping out the symbols in the stack if they match with the current symbol being read. If we reach the next $\\#$ and the stack becomes empty, then we have found two positions $\exists i,j : x_i = x_j^R$, and hence the word is in the language. _(I'll suggest you now to stop reading the answer and try writing the grammar on your own)_ **Grammar** (let $\Sigma = \\{a,b\\}$: \begin{equation} S \rightarrow A\\#B|A\\#B\\#A\\\ A \rightarrow aA | bA|\\#A|\epsilon\\\ B \rightarrow \\#\\#|aB'a|bB'b\\\ B' \rightarrow aB'a|bB'b|\\#A\\#|\\# \end{equation} *It might be written more succinctly perhaps. You can try that.
stackexchange-cs
{ "answer_score": 0, "question_score": -1, "tags": "context free" }
best WYSIWYG editor from the UX side? There are a bunch of WYSIWYG edirtors available. I've tried CKEditor so far (and tinyMCE with wordpress). CKEditor is a very fancy one but fairly complex and weights 6Mb including source files. What is in your experience the most buggless and stable? It needs to have a support for IMCE bridge module to be able to get images from disk.
I personally use tinyMCE on my sites, it's not heavy, and you can use the IMCEbridge. This module will install the **WYSIWYG API** , then follow **these instructions** for adding TinyMCE or any other you want. The IMCE Bridge module can be found **here** and is compatible with _CKEditor_ , _FCKeditor_ and _TinyMCE_.
stackexchange-drupal
{ "answer_score": 1, "question_score": 1, "tags": "wysiwyg, files" }
Prevent webpack from rebuilding unless sources have changed I use webpack as a bundler AND task runner. I don't want it to rebuild bundles if sources haven't changed: * when run in watch mode, it caches to memory, and won't rebuild unless necessary * BUT as a pure task runner (no watch mode), it **rebuilds on every run** How do I prevent it from rebuilding every time? It takes longer, and thrashes my SSD drive.
I found the answer: cache: { type: 'filesystem', }, But sometimes I use webpack in watch mode, so I want to use `memory` instead. So I did this: module.exports = (env, argv) { // ... cache: function () { return argv.env.WEBPACK_WATCH ? { type: 'memory' } : { type: 'filesystem' }; }(), } So when in watch mode it will use memory, and when used as a pure task runner (not watching) it will cache to disk. And in both cases webpack will avoid rebuilding if source files haven't changed.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "webpack, webpack 5" }
best way of processing large number of images for flash gallery? wondering what the most ideal way would be for loading a large number of images into Flash dynamically? I was originally thinking of a simple serverside script to pass a comma delimitered list of images via sendAndLoad - however I could be dealing with 100+ images of vary file name length so assume I could hit the sendAndLoad limit &images=photo.jpg,photo.jpg,photo.jpg,photo.jpg,photo.jpg,photo.jpg The second thought was to use sendAnLoad to call a serverside script to generate a serise of XML files to then in turn load when a "next page" button was pressed in Flash &pagedata=page1.xml Any thoughts?
My vote for **xml**. This will give you ability not only pass more pictures url to the app, but also include additional configuration/information, like picture name, author, date, comments...etc.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "flash, actionscript 3" }
Prevent Wrapping to next row, when moving past last unlocked cell in row I want to prevent the behavior where going past the last or first unlocked cell in a row wraps the selection to the next/previous row. This is the same behavior as described in this post. The main difference between the post and my question is that I also want to limit which cells a user can select and I don't want to unlock all cells. My reason: The only way I can restrict a user from pasting over my formulas is by preventing them from selecting the cell. I know I can use VBA to accomplish this but the excel document I have is a macro free workbook and needs to remain as such.
Format the cells to "locked" and protect the sheet. Unlock all the cells that you want to be editable. Leave the other cells at the default setting, which is "locked". Then protect the sheet. When you protect the sheet you can set an option that only unlocked cells can be selected. In the animated screenshot, the yellow cells are unlocked. The arrow key cycles through the unlocked cells. ![enter image description here]( Edit after discussion in chat: lock cells with formulas, unlock data entry cells. Teach your users not to paste into data validation cells. Protect with allowing locked cells to be selected, then use Ctrl+arrow to navigate, but only press it after you know where you've ended up.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "microsoft excel, lock" }
merge two rows and search in I've used this MySQL query to get data: SELECT DISTINCT A.*, B.username FROM posts A, members B WHERE B.status=1 AND (A.USERID=B.USERID AND A.title LIKE '%myquery%' AND B.public='1' AND A.type = 'update' ) order by A.ID desc limit 0, 10 this works to search title row, but i need to search into title and msg row, how to "merge" (?) these two rows into one and make my query? this is my basic schema. ---------------------------- ID | title | msg ... | ---------------------------- 1 | example | hello there | example data. PS. sorry for my english.
if i understand your question you can use the **OR** ... AND (A.title LIKE '%myquery%' OR A.msg LIKE '%myquery%') ...
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, merge, concatenation" }
Query em sql server com valor diferente consoante algumas variáveis Boa tarde eu tenho a seguinte query: select distinct(T.Grupo) 'Grupo', MAX(G.Descricao) 'Grupo', sum(E.QtdCat*S.FactConvEst) 'M2 cativos' from EncLin as E INNER JOIN Stock as s on s.CodProd=e.CodProd inner join terceiros as t on t.terceiro=e.Terceiro inner join grupo as g on g.Grupo=t.grupo where E.QtdCat>0 and E.Estado in ('P','N','C') and E.Arm not in ('03P','05G') and E.TpDoc not in ('ENI','ENS') Group by T.Grupo order by 3 desc, 2 Precisava de adicionar mais duas colunas, uma que devolva o valor de sum(E.QtdCat _S.FactConvEst) quando E.Estado='N' e outra que devolva o valor de sum(E.QtdCat_ S.FactConvEst) quando E.Estado='C'. Penso que isso se faz com case... Mas não tenho a certeza até porque já tentei e está a dar valores errados.
Com um CASE se pode condicionar uma soma select T.Grupo Grupo , MAX(G.Descricao) "Grupo", sum(E.QtdCat*S.FactConvEst) "M2 cativos", sum(case when E.Estado='N' then E.QtdCatS.FactConvEst else 0 end) estado_n, sum(case when E.Estado='C' then E.QtdCatS.FactConvEst else 0 end) estado_c from EncLin as E INNER JOIN Stock as s on s.CodProd=e.CodProd inner join terceiros as t on t.terceiro=e.Terceiro inner join grupo as g on g.Grupo=t.grupo where E.QtdCat>0 and E.Estado in ('P','N','C') and E.Arm not in ('03P','05G') and E.TpDoc not in ('ENI','ENS') Group by T.Grupo order by 3 desc, 2
stackexchange-pt_stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "sql, case" }
Get Parent div on button click I have the following html: <div id = "CompOne"> <div id="btns"> <input type="button" value="Add" class="cartbtn" onclick="SetSubmitBundleValue(this)"> </div> </div> <div id = "CompTwo"> <div id="btns"> <input type="button" value="Add" class="cartbtn" onclick="SetSubmitBundleValue(this)"> </div> </div> And I want to get value of the parent div `CompTwo`/ `CompOne` on their button click. Is it possible to retrieve this value from the object passed through the 'this' keyword? Kindly help function SetSubmitBundleValue(obj) { //Get Parent div }
You can use `parent()` method: $('.cartbtn').on('click', function(){ var parent_id = $(this).parent().parent().attr('id'); console.log(parent_id); }) <script src=" <div id = "CompOne"> <div id="btns"> <input type="button" value="Add" class="cartbtn"> </div> </div> <div id = "CompTwo"> <div id="btns"> <input type="button" value="Add" class="cartbtn"> </div> </div>
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 7, "tags": "jquery, jquery selectors" }
How to tell if an integer is a multiple of 10 (Xcode)? How can I tell whether an integer is a multiple of 10 ( _i.e. 10, 20, 30, 40, etc_ ) in Objective-C? Thanks.
BOOL isMultipleOfTen = !(someInt % 10);
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 3, "tags": "iphone, objective c, ios" }
What determines what shows in the "Target framework" dropdown in Visual Studio? I have two Visual Studio projects in separate solutions, and they're displaying different options for the target framework in the Application properties. This was difficult to screenshot since it was an open menu, so I apologize for the less-than-optimal resolution. In one project, I had these options: ![.Net Framework]( And in another project (in another solution), I have these options: ![.NetStandard]( What is causing the change in available options? Both of these projects are running in Visual Studio 2017 RC, and both are on the same computer.
Well, that was easy... I realized the projects I was comparing weren't apples to apples, which led me to the solution. One project was a console application, and the other was a class library, but that wasn't what was causing issues. However, I went to create a new dummy project just to test if that was the issue when I realized I must have accidentally clicked on: > Class Library (.NET Standard) - A project for creating a class library that targets .NET Standard. instead of: > Class Library (.NET Framework) - A project for creating a C# class library (.dll) when I created the project. Frankly, I'm surprised I haven't made that mistake before now.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#, projects and solutions, visual studio 2017, target framework" }
fixing jumbled css to show checkboxes next to the label I can't seem to fix a css issue in my app that maybe has too much jumbled up css. To isolate the problem I've put partial of the problem on jsbin: < It includes all the CSS that my app uses. Problem is that the checkboxes are showing as a group on the right side of the page rather than being next to each label. I tried using firebug but can't seem to isolate this issue.
I added this to your page in firebug and it seemed to work... <style type="text/css">span {width:20%; float:left;}</style>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, css, simple form" }
CSS if else conditions, mobile portrait or landscape How to use a with-height conditions. Without javascript. @media (calc(window-width > window-height)) { background-color: lightblue; } @media (calc(window-width <= window-height)) { background-color: lightgray; } I want to page for mobile defices for detecting if mobile is rotated to portrait or landscape.
You can use the orientation constraint: @media handheld and (orientation: landscape) { /* applies to mobiles in landscape mode */ } @media handheld and (orientation: portrait) { /* applies to mobiles in portrait mode */ } Multiple rules are comma separated (`OR`), otherwise use `AND`. See MDN.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "css, media queries, orientation" }
What is the value of this sum involving q-binomials? Let $n\ge 2r$ be positive integers. Is there a closed form for following finite summation involving in q-binomial coefficients $$\sum_{s=0}^r(-1)^sq^{\frac{s(s+1)}{2}}{n-2r+s\brack n-2r}_q{n\brack r-s}_q\,\,\,\,\,\, ?$$ I found this while studying q-Fibonacci/ Lucas polynomials. What is the general approach for evaluating this type of series? Any suggestion would be appreciated.
Doron Zeilberger has written a Maple code for checking and proving ordinary binomial identities and their $q$-analogues. What you need in the present case is the package called qEKHAD. I just tested your sum and it leads to a quadratic recurrence in $r$, so you may not expect a closed form as an answer. The lucky cases are linear recurrences in the "external" parameter (here, it is $r$). The latter situation fits the so-called Wilf-Zeilberger pair. I also sought for other factors $q^{\mu(s)}$ instead of $q^{\binom{s+1}2}$, none of the usual suspects lead to a closed form. Sorry.
stackexchange-mathoverflow_net_7z
{ "answer_score": 6, "question_score": 3, "tags": "co.combinatorics, qa.quantum algebra, binomial coefficients, enumerative combinatorics, q analogs" }
Convert a NSDictionary value to a NSString i want to convert the value of my dictionary into string. My code : NSArray *keys=[services allKeys]; yourLabel = [[UILabel alloc] initWithFrame:CGRectMake(146, (i*height_between_cells)+44, 40, 25)]; NSString *nomber = (NSString *)[[services objectForKey:[keys objectAtIndex: i]] objectForKey:@"Nomber"]; //NSString *nomberService=[[services objectForKey:[keys objectAtIndex: i]] objectForKey:@"Nomber"]; [yourLabel setText:nomber]; [recapView addSubview:yourLabel]; like you see i want to set the text of the label with my dictionnary value. When i do that i have an error : [__NSCFNumber length]: unrecognized selector sent to instance 0x14d57fd0 Have you an idea ?
The error is because you are assuming that the result of `[[services objectForKey:[keys objectAtIndex: i]] objectForKey:@"Nomber"];` is giving you an `NSString` but it is in fact giving you an `NSNumber`. Using a cast only makes the compiler happy. It doesn't actually convert anything. Try something like this: NSNumber *nomber = [[services objectForKey:[keys objectAtIndex: i]] objectForKey:@"Nomber"]; [yourLabel setText:[nomber stringValue]]; Or using modern syntax you can do: NSNumber *nomber = services[keys[i]][@"Number"]; yourLabel.text = [nomber stringValue];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ios, nsdictionary" }
Implementing Workflow async using Core service I came across following method and trying to use in my application where I am trying to execute a complete workflow using code ` _CoreServiceClient.StartWorkflowAsync("repositoryId", instruction, _ReadOptions);` I have to put the breakpoint so that my main thread should not complete before async service call but it seems the method is not starting workflow for the bundle as I am unable to see any new activity in CME in Workflow Managment. Am I missing any point?
If you put a breakpoint - all of your threads are put on hold, not only the main one. Other than that, your code might exit before the method actually get anywhere. See here for correct usage of the async methods: < You need to make sure that callback is called before you code exit.
stackexchange-tridion
{ "answer_score": 4, "question_score": 2, "tags": "core service, workflow" }
Запуск метода main() класса без компиляции всего проекта в Android Studio Возможно ли в Android Studio запустить метод `main()` простого java-класса, содержащего в себе только ссылки на стандартные классы java, не компилируя весь Android-проект.
Да, можно. Для этого нужно указать в IDE, а точней дать новые настройки для вашего дебагера, чтоб он понимал какую часть компилить. В действительности все намного проще. ## Создаем java класс: ![введите сюда описание изображения]( ## Пишем метод main Все как обычно, IDE сразу распознает точку старта. public class HelloFromMainJava { public static void main(String... args){ System.out.println("HelloFromAndroidStudio !"); } } Запустить можно с панели, или right-click мышки, или просто сочетанием клавиш как на скрине. ![введите сюда описание изображения]( ## Итог: ![введите сюда описание изображения]( Не забывайте на панели, сверху, переключать обратно на ваш проект. Удачи.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "java, android, android studio" }
.scrollTop - keep scrolling down each time a button is pressed using jQuery and the scrollTo function, is it possible to scroll a certain amount of pixels each time you press a button? I can already scroll a set amount from the top each time the button is pressed, however I want to keep scrolling everytime the button is pressed.
$('#theButton').on('click', function() { $('html, body').animate({ scrollTop: Math.abs( $('html').offset().top ) + 20 }, 500); }); **Note:** If you're using jQuery < 1.7, use `.bind` instead of `.on`. You should also cache those selectors...
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, jquery, html" }
Mouse not working correctly on Mac login screen For some reason when my mac is at the login screen, moving my external USB mouse will cause the cursor to only move up and down. Once I am logged in, the mouse functions normally. Does anyone know the reason/fix? Steps I have taken: * Reset SMC/NVRAM * Reinstalled OS * Tried another USB Port Late 2013 15" MacBook Pro running Yosemite 10.10.3 with iHome wireless USB mouse. I tested it and mouse works fine without problems on my Windows PC.
I'm assuming this is a USB mouse with a cord? I have seen issues with those not recognizing properly until login when connected through the USB ports on a keyboard, or on laptops. I've always accounted it to the mouse needing more voltage than the USB port is delivering until the user is logged in. This seems to be the case with older mice more often than newer ones.
stackexchange-apple
{ "answer_score": 1, "question_score": 3, "tags": "macos, usb, mouse, login" }
FlipView: HowTo bind a Collection<string> as ItemsSource Is there a smart way to bind a `Collection<string>` that contains the URLs of images to be shown in a `FlipView`? Or do I have to provide the images in a `Collection<Image>`?
You can use URLs binding those to `Source` attribute of an `Image` inside an `ItemTemplate`: <FlipView.ItemTemplate> <DataTemplate> <Image Source="{Binding}" /> </DataTemplate> </FlipView.ItemTemplate> flipView.ItemsSource = imageUrls; An example of displaying images from Bing in a FlipView.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "c#, xaml, windows store apps" }
How to copy the contents of an FTP directory to a shared network path? I have the need to copy the entire contents of a directory on a FTP location onto a shared networked location. FTP Task has you specify the exact file name (not a directory) and File System Task does not allow accessing a FTP location. **EDIT** : I ended up writing a script task.
I've had some similar issues with the FTP task before. In my case, the file names changed based on the date and some other criteria. I ended up using a Script Task to perform the FTP operation. It looks like this is what you ended up doing as well. I'd be curious if anyone else can come up with a better way to use the FTP task. It's nice to have...but VERY limited.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "ssis, ftp, business intelligence" }
Can a function know from where it is exectuted? `$MyInvocation` can be used to identify where the source of a script is located. How can a function do the same? function whereami { Write-Host $MyInvocation.MyCommand.Path # produces nothing } Write-Host $MyInvocation.MyCommand.Path whereami The C programmer would use `__FILE__`.
There is `$PSCommandPath` which returns the full path to the script being executed. Note that the script must be saved as a file before this will work in the ISE. function whereami { $PSCommandPath } Write-Host $MyInvocation.MyCommand.Path whereami Returns: PS C:\Users\> C:\Users\somescript.ps1 C:\Users\somescript.ps1 C:\Users\somescript.ps1
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "powershell" }
Storing 2-dimensional string array into the SQLite database I wish to store the values in a string array i.e. values of arr[16][16]. If I put this using a 2 for loop, as per my understanding 256 rows would be added to the database which is not my requirement. I want all the 256 values in one column of a single row in database. I am new to android. Please suggest.
Could you do something like: > > StringBuilder one_big_row = new StringBuilder(); > for(String[] array : arr) > for(String string : array) > one_big_row.append(string); > String row = one_big_row.toString(); > Seems kinda silly to me. Edit: should use StringBuilder for performance reasons. Also, if you don't need this data to persist (after user closes the app), then you probably shouldn't use the SQLite DB. If you do need it to persist, try to rethink how it should be stored, because it will be tedious and slow when you have retrieve this data via substrings of a very large String consisting of 256 other strings.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, android, sqlite" }
Finding all ordered pairs $(x,y)$ for $\frac{3x-4y}{xy}=-8$ and $\frac{2x+7y}{xy}=43$ I have to find all $x,y$ pairs for the following: $\frac{3x-4y}{xy}=-8$, $\frac{2x+7y}{xy}=43$ The hint states that I should rewrite the left-sides of the equations. There are two routes I can see being taken here. First one would involve removing the denominators, the second one would be writing these fractions in their reciprocal form like $\frac{3}{y}+\frac{4}{x}$. For the sake of simplicity, I'll just remove the denominator by multiplying both sides. This gives me the following: $3x-4y = -8xy$, $2x+7y = 43xy$ At this point it seems that I can't substitute any variable nicely without fractions. That means that I should go for the elimination of $x$. $6x + 21y = 138xy$ $-$ $6x - 8y = -16xy$ * * * $29y = 154xy \therefore 29 = 154x \therefore \frac{29}{154}=x$ Now that does not look right. I get the same result by just splitting up the fractions...
The hint means that for $x,y\neq 0$ $$\frac{3x-4y}{xy}=-8 \iff \frac 3 y-\frac 4 x=-8$$ $$\frac{2x+7y}{xy}=43 \iff \frac 2 y+\frac 7 x=43$$ and then set $u=\frac1x$, $v=\frac1y$.
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "algebra precalculus" }
live/quick mysql query builder/viewer Is there such a thing that will allow you to create a mysql query and view its results live? Almost like an ajax sort of live search results kind of thing, so each character i type in will affect my result?
Here is a list of all the **MySQL AJAX clients** I know: * SQL Buddy (Screens) * MonoQL (Demo) * TurboDBAdmin (Offline?) I'm not sure if they provide real-time response, but they are a faster alternative to phpMyAdmin.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "php, mysql" }
Why doesn't isEqualToString work the way I think it should? I'm loading a UTF-8 encoded text file into an array. At several places in the text file there are blank lines, with no spaces. In this conditional: tempstring = [array objectAtIndex:index]; if( [tempstring isEqualToString:@""] == NO ) { // do something } The result is always NO. I NSLog the strings, but I don't see any character in the console on the blank lines. The NSLog also shows the blank lines having the length of 1. How can I correct this conditional to work?
Try removing the whitespace from the NSString from the NSArray before comparing it. See here: Collapse sequences of white space into a single character and trim string
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "iphone, objective c, ipad" }
Homebrew installed libraries, how do I use them? I'm a bit confused. I've installed a bunch of libraries (e.g. `vtk`, `gsl`,...) that I need for a c++ project for school. I used homebrew to install them (luckily there were formulas available). My question is, does Homebrew link these into `/usr/include` or something comparable? Or is this something I would need to do manually? Homebrew usually does this kind of stuff for executables, yet I can't seem the find the libraries anywhere other than in the `/usr/local/Cellar/...` directories. I have a bunch of libraries installed so I can't simply use -L/... for each of them.
They are usually linked in `/usr/local/lib` (Intel Macs) or `/opt/homebrew/lib/` (M1 Macs). If they are not there, try `brew link <library-you-are-installing>`; that should solve it.
stackexchange-apple
{ "answer_score": 17, "question_score": 25, "tags": "homebrew, unix, open source, development" }
Add elements of two array with each other I have 2 Array of type Int like this let arrayFirst = [1,2,7,9] let arraySecond = [4,5,17,20] I want to add the elements of each array, like arrayFirst[0] + arraySecond[0], arrayFirst[1] + arraySecond[1] an so on and assign it to another array, so the result of the array would be like > [5, 7, 24, 29] What would be the best practice to achieve this using `swift3`
You can add both the arrays like this let arrayFirst = [1,2,7,9] let arraySecond = [4,5,17,20] let result = zip(arrayFirst, arraySecond).map(+) print(result)
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 7, "tags": "ios, swift, swift3" }
Image picker in selfie mode I'm trying to find a way to open the image picker view direcly in "selfie" mode. (To take have the camera showing the user's face) Does someone has a trick to do that ?
You can simply do this by setting two properties of `UIImagePickerController` like this - UIImagePickerController *picker = [[UIImagePickerController alloc] init]; [picker setSourceType:UIImagePickerControllerSourceTypeCamera]; [picker setCameraDevice:UIImagePickerControllerCameraDeviceFront]; You need to set `Camera Device` to `Front` and need to set `Source Type` to `Camera`.
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 1, "tags": "ios, iphone, objective c" }
How can I format a SD card from my phone? I've formatted my microSD 32 GB Sandisk SDHC 3, Class 10 with SDFormatter which I was using on my raspi3 apparently with no issues. But now I can't read it on my pc (Win7) or any other one. I've tried with a SD adapter and with USB adapter with the same results: it plugs and unplugs constantly. When I put it on my phone (Aquaris BQ M5) I format the card correctly, I keep getting the same issues when connecting the card "directly" to the pc BUT if I keep the card on the phone and connect the phone on MTP I can copy and delete and open files without problems... but I don't know how to give it format since there or use DISkPART or something similar. How could I properly format my SD to install Raspbian on it?
You don't need to format your mSD for installing Raspbian; instead, you simply "flash" the Raspbian image file: that simply writes the image file to the mSD from start to end. I highly recommend using Etcher which is available for Linux, OS X, and Windows. It can be run without installing, is easy to use, and checks that the image was flashed correctly.
stackexchange-raspberrypi
{ "answer_score": 3, "question_score": 1, "tags": "sd card" }
How to see that $PSU(2)$ is same as $SO(3)$? Some background: We have an action of $SU(2)$ on the space of traceless Hermitian matrices, $\mathcal{H}$, via conjugation: $$SU(2)\times \mathcal{H}\to \mathcal{H}, \ (U,H)\mapsto UHU^{-1}.$$ The ineffectivity, $I$ , of this action is $I=\\{+Id, -Id\\}$. We define $PSU(2)$ as the quotient of $SU(2)$ over this ineffectivity i.e. $$PSU(2):= SU(2)/\\{+Id, -Id\\}$$ We thus have an effective action $$PSU(2)\times \mathcal{H} \to \mathcal{H}, \ (UI, H)\mapsto UHU^{-1}.$$ Now, I want to show that $PSU(2)=SO(3).$ I am reading a file that says above effective action implies that we have $PSU(2)$ naturally as a subgroup of $SO(3)$. I don't understand this. Any help is appreciated.
You constructed an action $PSU(2) \to GL(H)$. Using the fact that $H$ is $3$-dimensional, it's easy to show that your map actually defines an action $\rho:PSU(2) \to SO(3)$. The fact that it's effective means that for any $g\not = g'$ in $PSU(2)$, there exists some $x\in H$ such that $\rho(g)x \not = \rho(g')x$; that is, the maps $\rho(g), \rho(g')\in SO(3)$ differ. That just means that the map $\rho:PSU(2)\to SO(3)$ is injective and thus gives an embedding of $PSU(2)$ as a subgroup of $SO(3)$. (To complete the proof and show that that subgroup is actually $SO(3)$, there are a couple of ways to proceed: show explicitly that suitable generators of $SO(3)$ lie in the image, use some Lie group machinery, etc.)
stackexchange-math
{ "answer_score": 0, "question_score": 2, "tags": "linear algebra, abstract algebra, group theory" }
How to limit the amount of characters returned in Oracle query I have a value in my query pulling too many characters so when i try to put the report into an Excel i am hitting 32767 characters error for excel, i am using SSRS to generate the report and it must be in excel format so that can't change. I need to be able to some how set return 32760 characters only to the select I tried Trim but that didn't solve my issue.
If I understood what you are saying, `SUBSTR` returns only a portion of some string, so that would be select substr(your_string, 1, 32760) from ...
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "oracle" }
Exercise 2.7 in Baby Rudin > **Exercise 2.7** Let $A_1,A_2,A_3,...$ be subsets of a metric space. > > (a). If $B=\cup_{i=1}^n{A_i}$, prove that $\overline{B}=\cup_{i=1}^n{\overline{A_i}}$ for $n=1,2,3,..$ > > (b). If $B=\cup_{i=1}^\infty{A_i}$, prove that $\overline{B}\supset\cup_{i=1}^\infty{\overline{A_i}}$ for $n=1,2,3,..$ > > Note. $\overline{B}$ is the closure of $B$. **Question 1.** I know how to prove (a). We got $\overline{E\cup{F}}=\overline{E}\cup\overline{F}$ first, and (a) is proved immediately. But why we can't prove $\overline{B}=\cup_{i=1}^\infty{\overline{A_i}}$ with the same reason? **Question 2.** Starting from (b). Suppose $A_i=\\{r_i\\}$, $r_i$ is a rational number. Then $B=\cup_{n=1}^\infty{A_i}$ is set of all the rational numbers, and $A_i=\overline{A_i}$. So, what is the $\overline{B}$?
The example you give in Question 2 answers Question 1. Things that work for finite situations often don't work in infinite situations. A smaller example for part b) would be to let $A_n = \\{1/n\\}$ for $n = 1, 2, \ldots.$ Then the closure of $B$ contains $0$, while $\cup \overline{A}_n$ does not.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "real analysis, general topology, analysis" }
Как разместить изображения полукругом вокруг кнопки? Ранее я задавал вопрос про то, как разместить изображения вокруг кнопки. А можно ли их разместить полукругом? Уже всяко пробовал формулу поменять, не получается, или это как-то вообще по другому прописывается? let numberOfImages = 10 //количество звезд let center: CGPoint = CGPointMake(160, 200) // точка, относительно которой рисуются звезды let distanceFromCenter:Double = 100 //расстояние от точки центра до звезды for var i = 0; i < numberOfImages; i++ { let angle = M_PI*2/Double(numberOfImages)*Double(i) let view = UIImageView(image: UIImage(named: "star")) view.frame = CGRectMake(0, 0, 40, 40) view.center = CGPointMake(center.x+CGFloat(distanceFromCenter*cos(angle)), center.y+CGFloat(distanceFromCenter*sin(angle))) self.view .addSubview(view) } ![Вот так получается]( ![А вот так хочу]( Хочу как на второй картинки
вот так дополнить: let numberOfImages = 4 let distanceFromCenter:Double = 100 let center: CGPoint = CGPointMake(160, 200) let startAngle: Double = 50 // угол начала let endAngle: Double = 150 // угол конца let startAngleRad: Double = startAngle*M_PI/180 let endAngleRad: Double = endAngle*M_PI/180 for var i = 0; i < numberOfImages; i++ { let angle = ((endAngleRad-startAngleRad)/Double(numberOfImages)*Double(i))+startAngleRad let view = UIImageView(image: UIImage(named: "star")) view.frame = CGRectMake(0, 0, 40, 40) view.center = CGPointMake(center.x+CGFloat(distanceFromCenter*cos(angle)), center.y+CGFloat(distanceFromCenter*sin(angle))) self.view .addSubview(view) } * Угол окончания должен быть больше, чем угол начала. * 0 градусов справа на окружности, и увеличивается по часовой.
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "swift" }
Remove certain polygon from SpatialPolygonDataFrame I am using R _maptools_ library to parse the shapefile into a list of polygons. The function readShapeSpatial shp <- readShapeSpatial("<path to my shapefile>") gives me a SpatailPolygonDataFrame object. In my example, my SpatialPolygonsDataFrame has the following columns: > names(shp) [1] "AREA" "PERIMETER" "COMAREA_" "COMAREA_ID" "AREA_NUMBE" [6] "COMMUNITY" "AREA_NUM_1" "SHAPE_AREA" "SHAPE_LEN I know that I can remove certain polygons by their `row.id`, e.g. shp.dropI <- shp[-i, ] shp.subset <- shp[i %in% c(1,2,3),] Now I want to drop certain polygon(s) with a condition, say `AREA > 10`. How do I implement this elegantly? The only method I have now is to iterate through all rows and find corresponding `row.id`.
First, I would highly recommend using readOGR, from the rgdal library, to read your shapefile. It will retain the projection information (proj4string) and save numerous headaches, when string matching, using other functions. Two quick ways to accomplish what your are after are using an index or using subset. This will retain polygons with an area < 10 (dropping those > 10). shp.sub <- shp[shp$AREA < 10,] shp.sub <- subset(shp, AREA < 10)
stackexchange-gis
{ "answer_score": 9, "question_score": 10, "tags": "shapefile, r, sp" }
i am Trying more Flags to prevent the Activity to be opened more than one time at the Same time i tried Flags like intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_CLEAR_TASK); i Login to my application and open the home page > when i receive a notification and preessed on it to see details at home page it opened well But the previous
You can achieve this with the help of launch mode go to manifest where your activity is declared. And add following attribute to your activity declaration. **android:launchMode="singleTask"** And in your activity class ovveride following method public void onNewIntent(Intent intent) { setIntent(intent); //do other stuff with new intent } I will also suggest you to read more about activity launch mode <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, android intent, android activity, android pendingintent, mobile development" }
Auth0 with .Net Core ASP MVC to WebAPI Authentication I have a .net core ASP MVC app that authenticates with Auth0 and properly returns an access token and id token. I would like to use the access token for authentication as described in the docs here. However, passing in an access token results in a 401 with "invalid audience".
This was tricky as the docs are woefully inadequate. In order to get the correct token for the API, you must get a token with the same audience at login (or otherwise). The end part of this example on github was key. Events = new OpenIdConnectEvents { OnRedirectToIdentityProvider = context => { // add any custom parameters here context.ProtocolMessage.SetParameter("audience", "myapiaudience"); return Task.CompletedTask; } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "asp.net core mvc, auth0, asp.net core webapi" }
Is it possible to believe (incorrectly) that one is on the path? Can one work one's way through the whole path as it is described in the Mahayana literature, and then realize: Even though you were being sincere, and the "right" experiences in the literature describe your work, you were actually not on the Buddhist path at all, but merely on an intellectual path without genuine actualization; without "direct seeing". Can this nevertheless be preparation for the true Mahayana path?
Isn't there a story in the commentaries about a monk who had very advanced intellectual understanding of the Buddhist path, and was even a very good teacher of others, and brought many of them to enlightenment, but was not himself enlightened. The story goes that eventually something happened to make that problem clear to him, then he did some stuff -- lived in a cave and meditated or something -- and finally was enlightened. Maybe someone can remember who the guy was; IIRC it's a pretty mainline Buddhist story. The suggestion is that, yes, it's absolutely possible to seem to be very advanced on the path but to be far less so than one thinks. And the second suggestion I take from the story is that if the intention is good, then even if one isn't as advanced as one might think, one may still be better off than having ignored the path completely.
stackexchange-buddhism
{ "answer_score": 4, "question_score": 4, "tags": "mahayana, stages of the path, reality, faith" }
Drawing on the delphi form without OnPaint event I have an problem, this is my code: procedure TForm1.Button1Click(Sender: TObject); begin Form1.Canvas.MoveTo(0, 0); Form1.Canvas.LineTo(100, 100); end; This code work fine, there is a line on the form. But when i click minimize button and then show form normal, the line disappear. I want draw without OnPaint and OnResize event. Please help me
What you are attempting to do is not possible. Windows don't have persistent canvases. When they are hidden, minimised, moved under other windows, etc. the previous contents are lost. You must repaint them. That is the very essence of how Windows is designed. Either paint the form in response to paint messages or events, or use a control like `TImage` to hold a persistent image.
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 0, "tags": "delphi, delphi xe7" }
How to substract one day from a date string in Mule using DataWeave I want to substract one day from a `date` `string` in Mule using `DataWeave` : `Exemple:` Input date : 18/03/2017 09:20:55 Output date : 17/03/2017 09:20:55
As another alternative, we can follow the example from Date Time Operations documentation for _Subtracting a Period of Time_. In that example we can defining the period between '|' characters. For example: `|P1D|`. Therefore, we can do the following steps to subtract one day from a date **String** : 1. Transform the date **String** to a **Date** : `"18/03/2017 09:20:55" as :localdatetime {format: "dd/MM/yyyy HH:mm:ss"}` 2. Subtract one day: `[the Date on step #1] - |P1D|` 3. Transform the **Date** back to **String** : `[the subtracted Date on step #2] as :string {format: "dd/MM/yyyy HH:mm:ss"}`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "string, date, mule, dataweave" }
Pandas groupby aggregate apply multiple functions to multiple columns Have a dataframe, need to apply same calculations for many columns, currently I'm doing it manually. Any good and elegant way to do this? tt = pd.DataFrame(data={'Status' : ['green','green','red','blue','red','yellow','black'], 'Group' : ['A','A','B','C','A','B','C'], 'City' : ['Toronto','Montreal','Vancouver','Toronto','Edmonton','Winnipeg','Windsor'], 'Sales' : [13,6,16,8,4,3,1], 'Counts' : [100,200,50,30,20,10,300]}) ss = tt.groupby('Group').agg({'Sales':['count','mean',np.median],\ 'Counts':['count','mean',np.median]}) ss.columns = ['_'.join(col).strip() for col in ss.columns.values] So the result is ![enter image description here]( How could I do this for many columns with same calculations, count, mean, median for each column if I have a very large dataframe?
In pandas, the agg operation takes single or multiple individual methods to be applied to relevant columns and returns a summary of the outputs. In python, lists hold and parse multiple entities. In this case, I pass a list of functions into the aggregator. In your case, you were parsing a dictionary, which means you had to handle each column individually making it very manual. Happy to explain further if not clear ss=tt.groupby('Group').agg(['count','mean','median']) ss.columns = ['_'.join(col).strip() for col in ss.columns.values] ss
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "pandas, group by" }
Algolia Auto Complete Search in an Angular Dart Component I am trying to implement the Algolia Search Autocomplete function into an Angular Dart Project. I am able to get it to work if I put the input search box on the Index page, but if I put the search box in a component, it does not work. Please see the attached GitHub Project outlining my issues. Link to GitHub Repo When it loads, you'll see two search boxes labeled appropriately. One of them works, the other does not. What do I need to do to get that search box working in a component? Thank you!!!
I don't know anything about Algolia but I'm guessing this is a timing issue. The script to initialize the search box is run before the angular app has started and so Algolia can't find the input. There is a couple of things you could do: * Not run the JS script, or initialization until the component is fully loaded. Using ngOnInit and package:js to call the initializing script * Or reparent the input box in the component itself. Load it in the main page with the JS script, and then in the component using dart:html find the element and put it in the right place in your app.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angular, dart, angular dart, algolia, dart js interop" }
Where should I put my question about Amazon affiliation? I've been wanting to post a question regarding the Amazon Associates program, but I'm not sure what Stack Exchange site it would be most appropriate on. So, well, I guess that's my question. On what Stack Exchange site, if any, can I ask a question related to the Amazon affiliation program?
Based on your update in the comments > I'm thinking about using it on my blog, so not really programming-related (hence my question here). The question itself is if I should use the .com or .co.uk amazon site (as I'm located in Europe but most of my visitors are US-based) I'd say < \-- webapps is end user focused, not really focused on people who manage a website and make decisions like this about content that is being posted to the website. It wouldn't be _terrible_ on webapps, it could work there, but the "webmaster" vs. "end user" distinction is what matters here. So I suspect you'll get much, much better answers from "people who run websites" than "people who use GMail and Facebook". And in the future, you can always check < to see what sites we have, and what the audience is for each one.
stackexchange-meta
{ "answer_score": 8, "question_score": 0, "tags": "support, site recommendation" }
Calculate frequencies I have a data frame like this: Expt Replicate A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 2 C 3 C 4 I want to return the number of replicates for each experiment. Like this: Expt #Reps A 3 B 3 C 4 This has got to be super simple, but I have tried some things like ddply(df, Expt, .fun=max(Replicate)) with no luck. Please help.
another simple way: summary(df[,1]) #where df is your data frame and you want the 1st column counts ("Expt") Note: the 1st column is a `factor` and this applies to any columns which are `factor`
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 1, "tags": "r, dataframe" }
How can design using pure css? ![enter image description here]( This is the image I want to design using pure css without background image, can use background color. Any suggestion me to do design for above mentioned image.
I don't have many reputations to comment on, i.e. I'm replying to you in the answer. I'm a newbie. You have to research more on this content, you should search "Pure Css Posters" on youtube for reference. For now, I would suggest you some ideas. 1\. You can use 2 sections to create those white blocks, and For Shape Just use the "clip-path" Property and for the card container, put a gradient on the background using linear-gradient. 2\. In those white sections, use before or after selectors to mark that greyish part. 3\. Make sure you're using Flex properties to keep it aligned.
stackexchange-stackoverflow
{ "answer_score": -2, "question_score": -4, "tags": "html, css, responsive design, css float, css transitions" }
Width and height different in CSS and HTML Say I have a `div`. If I give it a height and width of 500*500px in HTML code, like this: `<div width="500px" height="500px">test</div>` it will not have dimensions of 500*500px unless it's filled with enough code/text to push it to those dimensions. However, if I set the exact same width and height with CSS (either inline CSS or external document) like this: `<div style="width:500px; height:500px;">test</div>` the dimensions are always what I set. Why is there a difference?
Doing this isn't valid syntax. You cant add width & height attributes to a DIV the same as you can to a table or an image tag. <div width="500px" height="500px">test</div> This is valid syntax: <div style="width:500px; height:500px;">test</div>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "css, layout, html" }
"/r/n" added between paragraphs in every editor field when uploading website I currently develop my websites on a synology nas web station, but when I upload my website online, all editor fields (articles, modules and also my custom components) are modified with an added `<p>/r/n</p>` between paragraphs. It happens only if there is more than 1 paragraph. I've first noticed this strange behavior on 10th January, websites uploaded in December were correct.
I ran into the same issue with a couple of Joomla instances. Did you export the local database and import in on your remote server using phpMyAdmin? There's a bug in phpmyadminversion 4.6.5.1 that places /n/r incorrect in the data when doing an export/import. Try updating to phpMyAdmin to at least 4.6.5.2 where this issue was fixed. Answer thanks to Isaan Bennetch: <
stackexchange-joomla
{ "answer_score": 3, "question_score": 2, "tags": "joomla 3.5, editor, tinymce" }
Where are the documents from the Documents tab in Lightning? Our org has switched to Lightning recently and, as expected, there is no Documents tab. From what I've read the equivalent to Documents in LEX is Files. I would like to know where are the actual documents (not the tab, but the .pdf, etc) that were previously on the Documents tab, since I don't see them on the Files tab.Are they kept somewhere?
Documents are not available in Lightning Experience. You need to switch back to Classic to access them. There is an idea you can upvote here: <
stackexchange-salesforce
{ "answer_score": 7, "question_score": 4, "tags": "lightning, document, files" }
Online calculator for $ p $-adic valuations and absolute values. Does anyone know a website where I can enter a prime base and a rational and then get the $ p $-adic valuation and the $ p $-adic absolute value? For sure I know how to do it by hand, but I want to check my results and rule out computational mistakes.
WolframAlpha can do it. It understood my request `2-adic valuation of 42` as `IntegerExponent[42,2]`, which seems to be the appropriate function for this. For the $p$-adic absolute value, there is the slight problem that there are several equivalent (as in: defining the same topology, not the same norm) choices. But replacing $n$ by $p^{-n}$ should not be too hard. (Plus, the valuation is more useful in practice).
stackexchange-math
{ "answer_score": 6, "question_score": 3, "tags": "reference request, absolute value, p adic number theory" }
Would using thick glass wall be better than electric fence for my dino theme park? My company has perfected its gene modifying technique.We can create life-sized hybrids of dinosaurs, with the exact appetite and behaviour as the original species (at least according to our advice from many self-proclaimed experts). However, I would like my dinosaur theme park to look like the natural environment of several hundreds of millions of years ago, without electric fences. My concern is, would glass capable of keeping livestock as mighty as spinosaurus and T-rex, be a good replacement for high powered electric fences? Your safety is our number one priority (second to our work). Is there anything better than thick glass which I can use? As I am currently experiencing an astronomically high turnover rate of both security officers and shepherds right now, please expedite, thanks.
Let's consider an entirely different approach from the tried and tested "zoo" model. Unfortunately it seems that when confronted by actual dinosaurs, this model has consistently been shown to be inadequate. What I would advise instead is construction of aerial road and walkways. Elevated concrete platforms from where the visitors to your theme park can observe the activities of the dinosaurs below from a safe location. This allows your visitors to remain safe from escaped raptors even when the power inevitably fails. It also allows the dinosaurs to roam free in their constructed "natural" habitats without confinement. While ideally separate habitats should be maintained on individual islands, should it be be necessary to confine certain creatures away from others, high concrete walls combined with moats should be used. The moat adding an extra barrier to prevent climbing plants from allowing creatures to gain a foothold and climb the walls.
stackexchange-worldbuilding
{ "answer_score": 55, "question_score": 31, "tags": "technology, dinosaurs" }
PactNet - How can I run multiple Pact json in the same test run? I started learning Pact via a tutorial that used a single .json file that tested a basic API interaction. Now I want to start organising my PACTs by splitting them into multiple JSON files. When setting up the Pact Verifier is there a way to specify the PactUri as a folder path rather than a path to a JSON? This is what my verifier looked like originally: IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier.ProviderState($"{_pactServiceUri}/provider-states") .ServiceProvider("Provider", _providerUri) .HonoursPactWith("Consumer") .PactUri(@"..\..\..\..\pacts\my-single-pact.json") .Verify(); I understand that the following cannot work as the PactUri() expects a file uri. .PactUri(@"..\..\..\..\pacts") .PactUri(@"..\..\..\..\pacts\*.json")
I asked the same question at the Pact forum in Github. This feature is supported by the underlying CLI but it's not offered in PactNet.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, pact, pact net" }
Mysql select rows with limit to different column The structure of table goes as bellow Posts ( id int, category_id int, popularity int, ) I wanna select 5 categories each having 5 rows. Like Select * from posts where category_id in ("1" , "2" , "3" , "4" , "5") limit 5 -- limit each category_id by selection of 5
Use UNION to connect multiple select statements to show one combined result. It is probably the easiest way to solve your problem. Like this: SELECT * FROM posts where category_id=1 limit 5 UNION SELECT * FROM posts where category_id=2 limit 5 UNION SELECT * FROM posts where category_id=3 limit 5 UNION SELECT * FROM posts where category_id=4 limit 5 UNION SELECT * FROM posts where category_id=5 limit 5 The same question has already been asked: MySQL: Limiting number of results received based on a column value | Combining queries It provides a more sophisticated solution.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql" }
How to organize and distribute a Python Application with C extensions? I'm working on a Python application that is distributed as source (zipped) and via py2exe (majority). Now I want to speed up some modules by replacing them with C extensions. Which works quite well for the development part. But the distribution and organization gives me a headache... My current structure looks like this: . |-- py_submodule_a/ |-- py_submodule_b/ | |-- c_extension_ba/ |-- c_extension_x/ |-- setup.py |-- main.py My question is, where should I place the setup calls/files for my C extensions? I want to make sure that I can always run my application via `main.py` (so I'd rather not wait until distribution to compile the C extensions) but I also want to make sure that the distribution always has the latest C extensions. Thanks in advance for any help!
If you're just trying to optimize out hot-loops with C-code snippets you could always try something like scipy.weave. It is extremely convenient to have the C-code nicely wrapped up in the python package that calls it, and to be able to perform efficient C operations on memory in place.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "python, packaging, project organization, python c extension" }
The Art of creating Subplots What are the ways of creating Subplots in fantasy genre that really catch the reader's attention? Should there be a conflict in the subplots? Please explain.
As you introduce the main character to the world, you will also introduce all kinds of other characters that interact with this MC. You introduce your setting, your world, your universe. And sometimes the universe you create is so large that all kinds of things happen even while the MC is not around. Some of those things might eventually even become relevant to the MC at some time in your story. You have to build up to those relevant things. And this build up will be your subplot until eventually it becomes part of the main story line. * * * To answer the question. Is there conflict? I sure hope so, otherwise the subplot will be tedious and boring for the reader. And how do you keep the readers attention to the subplot? Make it relevant to the main plot line.
stackexchange-writers
{ "answer_score": 4, "question_score": 4, "tags": "creative writing" }
cannot connect to Oracle database server; error regarding SQL Server When I want to connect my Oracle database server in Visual Studio 2010, 1 hour ago there is no error but now I'm getting this error. !enter image description here My web.config has a connection string: <add name="ora" connectionString="Data Source=SCN;User id=********;Password=**********" providerName="System.Data.OracleClient" /> My **TNSNAMES.ORA** ; SCN= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=10.10.10.18) (PORT=1521) ) (CONNECT_DATA= (SID=SCN) ) ) I'm getting this strange error. !enter image description here How can i solve this problem?
Your Oracle connection string and .ora file aren't related to the connection error to SQL Server. Your error is : > ...establishing a connection to SQL Server.... Ensure your `myConnection` has the correct connection string as you'd expect. Something like this: myConnection.ConnectionString = ConfigurationManager.ConnectionStrings["ora"].ConnectionString;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": ".net, oracle, visual studio 2010, connection string" }
Como inverte as variáveis? Escrever um programa em Java com o que é pedido abaixo. A - Declare as variáveis X, Y e Z do tipo int. B - Atribuir 10 à variável X. C - Atribuir 2 à variável Y. D - Com a ajuda da variável Z inverter os valores de X e Y. E - Imprimir os valores das variáveis X, Y e Z respectivamente. Obs. Estou começando o curso de Java agora e não estou conseguindo fazer essa questão, alguém pode mim ajudar?
Tenta desta forma: public int X,Y,Z; X = 10; Y = 2; //Inversão Z = Y; //Z = 2 Y = X; //Y = 10 X = Z; //X = 2 //Assim inverteu-se os valores de X e Y
stackexchange-pt_stackoverflow
{ "answer_score": -2, "question_score": -8, "tags": "java" }
Explain how the proof is done A solution of matrix problem appears to be as follows !enter image description here some one explain the following in the solution why is A cube is eliminated and fourth power of A is obtained? In the seventh line !enter image description here In the third term why the power of A is not expressed in variable but in a constant? Why it is again multiplied by square of A and fourth power of A is eliminated? someone help me please
following from what @bob.sacamento wrote you will notice that: $$ \begin{align} A^2(A^2-abI) &= A^4-abA^2 \\\ &= abA^2+A^3-abA -abA^2\\\ &= abA+A^2-abI-abA \\\ &=A^2 -abI \end{align} $$ with the help of this identity the inductive step follows easily. thus if $$ A^p-A^{p-2}-A^2+abI =0 $$ we may write this as: $$ A^{p-2}(A^2-I) = A^2 - abI $$ multiplying by $A^2$ and using the result above gives: $$ A^p(A^2-I) = A^2 - abI $$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "matrices, induction" }
Binding a ListView to an array of objects I have an array of `Password` objects, each containing a `tag`, a `username` and a `password` (all of three `String`s). I'd like to display the `tag`s contained in each `Password` in a `ListView`. I thought about using an `ArrayAdapter` linked to a `String` array containing only the `tag`s, but I'm almost sure this would be a bad option as I plan to update frequently the `Password` array's contents. Is there any other option to bind my `Password` array to a `ListView` and making it display only its `tag` attribute?
The simplest solution: Step #1: Implement `toString()` on `Password` to return `tag` Step #2: Put your `Password` objects in an `ArrayList<Password>` Step #3: Put your `ArrayList<Password>` into an `ArrayAdapter<Password>` Step #4: Put your `ArrayAdapter<Password>` into your `ListView`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android, listview" }
How to copy files or sql database tables from a linux machine to Adls gen2 using azure data factory How to copy files or sql database tables from a linux machine to Adls gen2 using azure data factory. Kindly please help me with the steps
Data sources in a physical or virtual network can be scanned using a self-hosted integration runtime (SHIR). but we can't install Integration Runtime (self-hosted) on Linux server it is currently only available on windows (see here). To work around this, to transfer files to or from a storage account, you can use the command-line tool **`AzCopy`**. _**Syntax**_ azcopy copy '<local-file-path>' ' Refer - <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure data factory" }
What does agent.maxSockets really mean? The official doc on agent.maxSockets says that it indicates the limit on how many concurrent sockets my http(s) server can have. So I did some tests with `http.globalAgent.maxSockets set to 5` and I expected that I can have only 5 open websockets. But turns out I can have more than 50 open websockets. Can anybody explain what does agent.maxSockets really mean?
`http.Agent` instances are used with _outbound_ http clients (e.g. via `http.request()`), _not inbound_ clients into an `http.Server`. So if you were to use an `http.Agent` with `maxSockets` set to 5 with `http.request()`, then there would only be at most 5 connected sockets to a particular server at any given time.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, node.js, sockets, http, websocket" }
Removing button in swift This is an iOS app. In the PostDetailViewController.swift there is Share Button. How can I remove or make the following shareButton invisible? Would it be a healthy way to turn them into comment lines with "//" ? Thanks in advance. let shareButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.action, target: self, action: #selector(PostDetailViewController.shareButtonTapped)) var rightItems = [shareButton] if (self.params.count > 2) { let commentButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.reply, target: self, action: #selector(PostDetailViewController.showDisqusComments)) rightItems += [commentButton] } navigationItem.rightBarButtonItems = rightItems nameLabel.text = String(htmlEncodedString: post.title!)
Change let shareButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.action, target: self, action: #selector(PostDetailViewController.shareButtonTapped)) var rightItems = [shareButton] To var rightItems = [UIBarButtonItem]()
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -3, "tags": "swift" }
How does C# manage uninitialized classes? I am using C# in Unity and I need to know how does C# manages classes in order to know if I need to set all of the values during or after the `new` to avoid invalid reads or if I can leave them as they are. With this example I get the following output : class Test { public int test; } Test buffer = new Test; Debug.Log(buffer.test); > 0 > UnityEngine.Debug:Log(Object) Does this mean the variable types all have a default value or should I be more careful when instantiating a Class ?
The .Net framework initializes all fields to their default values (`0` or `null`).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c#, unity3d" }
I want to know how to make custom objects for iPhone? I would like to know how to create a custom UI object for iPhone in Xcode 4 . How to make an object which can be reused in any other iPhone applications ? The listing of objects comes like this !enter image description here
its unavailable in iPhone only for Mac
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "iphone, xcode4" }
GORM One to Many relationship across multiple datasources I see there is a strategy for a one to one mapping for domain objects across different databases. But I am trying to associate two Domain objects that are in different datasources and have a one to many relationship. class DomainA { // default data source } class DomainB { static hasmany = [domainA: DomainA] static mapping = { datasource 'ds2' } } Any suggestions on how to make this work? Or a workaround?
Found a solution to this and it works pretty well. Solution is to create a join table in the schema you own. E.g. class DomainA { // default data source } class DomainB { List<DomainA> domainAList static transients = ['domainAList'] static hasmany = [domainAIds: Integer] static mapping = { datasource 'ds2' domainAIds joinTable: [name: 'DOMAINB_DOMAINA', key: 'DOMAINB_ID', column: 'DOMAINA_ID'] } List<DomainA> getDomainAList(){ domainAList = domainAIds.collect { DomainA.get(it) } domainAList } }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "grails, grails orm" }
React-Native: Open mobile app from website Can that be possible? I have a web app and a mobile app as well. The user goes to website and there is a button "Download App for Mobile". When the user clicks on the button, if the app is already installed, the app should be opened otherwise the user must be redirected to the respective store with the link to download the app from store. Any help in the form of Articles, Videos or suggestions would be highly appreciated.
read about ` getInstalledRelatedApps()` see here for more information < chromeStatusNewFeature
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "react native, google play, app store" }
Python - List of lists, Get the list with the biggest number as the first value I got a list of lists like the one below l = [ [1, ....], [2, ....], [3, ....], ] And I want as a result the list with the bigger number as the first element. So the result of the above list should be: [3, ....], If we get multiple times the highest number, just get one of them in random Any ideas on how to achieve that? Thanks a ton!
Try this. new_l = sorted(l,key=lambda x : x[0],reverse=True) If you want only first sorted list new_l[0]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, list, sorting" }
Can WSARecv() return data immediately? When calling `WSARecv()`, is it possible that the data will be returned immediately without going through the completion port phase. In the `WSARecv()` documentation, it says for the `lpNumberOfBytesRecvd` parameter: > A pointer to the number, in bytes, of data received by this call if the receive operation completes immediately.
Yes, and this is not unusual. Remember that data arrives in IP packets whose boundaries in general do not align with your reads. If your `WSARecv` call requests data from packets that the OS already holds, there's no point to delay and Windows probably will return it immediately.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c++, sockets, winapi, network programming, iocp" }
Is there "If exists" parameter in htaccess? I can have urls of three types, which should rewrite to: -> -> -> Also, .php should be added to ALL the .php files in the project. I have this rules right now: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)/$ $1.php RewriteRule ^admin/(\d+)/(\d+)$ admin.php?cat=$1&page=$2 And I don't know how to make this work properly. I need to make the second rule about page parameter to be situational, only when it exists, because otherwise .htaccess tries to rewrite only the whole line with page number in it. Any help? Thanks for attention.
You can use: Options -MultiViews RewriteEngine on RewriteBase / RewriteRule ^admin/(\d+)/?$ admin.php?cat=$1 [L] RewriteRule ^admin/(\d+)/(\d+)$ admin.php?cat=$1&page=$2 [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)/?$ $1.php [L]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".htaccess" }
Flutter is it possible to get my app published on iOS App Store without using Cupertino widgets? I didn't find anything regarding to my question, so Im happy about any advice. **(There is no way to show any code which would make sense)** I just finished my app which I want to release now in android and iOS app store. I made the app with the `Material Widgets` but it's also of course running on my iOS device. im wondering **what exactly do I have to do now to get my app on iOS app store**. Do I need to change everything to `Cupertino Widgets` or can I also get it published without changing everything? Is there any guide or something execept the iOS guidelines? Thank you for your help!
> what exactly do I have to do now to get my app on iOS app store. Relax! And publish your app without any fear. It doesn't matter if you use `Cupertino` Widgets or `Material`, the thing that matters is your app should follow Apple guidelines (which doesn't mention anything about these widgets)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "flutter" }
Relay PostgreSQL connection over another server I'm using a PostgreSQL database on a remote server with a very restrictive firewall that only allows connections from our webserver. This makes developing stuff on my own workstation pretty difficult, as I cannot connect to this server directly to test my code. What I'd like to do is set up some sort of proxy on our webserver that simply sends all queries to the firewalled server. Then I can use our server from my workstation to test my code. Any ideas how to do this or other ways that solve my problem?
use ssh and create a local tunnel, something like this (only works if you have an ssh daemon running on web server) ssh [email protected] -CNL localhost:5432:192.168.1.128:5432 The above will listen on 5432 (postgres port) on localhost and forward all traffic to remote machine via the web server. As mentioned below by Ricky Han, you need to change the address **192.168.1.128** to that of your PostgreSQL server. Obviously you will need to change the name of webserver.com as well! :-)
stackexchange-stackoverflow
{ "answer_score": 31, "question_score": 21, "tags": "postgresql, proxy" }
Terraform script for getting IP addresses for all GCP projects in my organisation I want to scan all the IP addresses on my organization's GCP account and feed it to a file every week or so. How do I write a Terraform) script/code to pull those data from GCP and then send it to the Qualys API for scanning?
AFAIK, there is no simple way to achieve that. You can find similar question and partial solutions here. But if you want a complete list of all IPs in organization, I would suggest starting with a method to list all resources in organization or to use Cloud Asset Inventory. If you feel like this is a feature that should be available, you can file a feature request.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "google cloud platform, terraform provider gcp, spring cloud gcp, qualys" }
python combine array item by item if i have three arrays the first one is **A,B,C,D** and the second one is **E,F,G,H** and the last one is **I,J,K,L** i want to use this three array and make an output like this : AEI BFJ CGK DHL i try this code import re array1 = 'A','B','C','D' array2 = 'E','F','G','H' array3 = 'I','J','K','L' arys = [array1,array2,array3] for a,b,c,d in arys: print a+b+c+d it didnt work how to make this work
Try this: array1 = 'A','B','C','D' array2 = 'E','F','G','H' array3 = 'I','J','K','L' for elems in zip(array1, array2, array3): print ''.join(elems) It prints AEI BFJ CGK DHL _Edit_ : you could also just zip the 3 strings together instead of creating tuples and get the same output: for elems in zip("ABCD", "EFGH", "IJKL"): print(''.join(elems))
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "python, arrays" }
Valgrind complains while working with threads I have created 20 threads to read/write a shared file.I have synchronized threads. Now My program works fine but when I run it with valgrind it gives me Errors like this: LEAK SUMMARY: **definitely lost: 0 bytes in 0 blocks. \ **possibly lost: 624 bytes in 5 blocks.** **still reachable: 1,424 bytes in 5 blocks.**** suppressed: 0 bytes in 0 blocks. Reachable blocks (those to which a pointer was found) are not shown. Also When I press Ctrl + c , it gives the same errors. I have not even malloced anything but still valgrind complains. Any suggestion would be appreciated .
You can run valgrind --leak-check=full ./prog_name to make sure these reachable blocks are not something you can destroy in your program. Many times initializing a library such as libcurl without closing or destroying it will cause leaks. If it's not something you have control over, you can write a suppression file. < section 4.4 has some info and a link to some examples
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c, multithreading, valgrind" }
folding indented lines before open a document I want to make an extension for vscode that folds the regions and indentation before the user opens a document. there are extensions now that doing this **after** opening a document, that makes a small delay before folding the indentation which is unpleasant. I already read the vscode API, I am almost sure there is no preprocess before opening the document, can I do this by any trick or vscode have any plan to add this to their API?
look like vscode don't have any plan to add this feature: > It's unfortunately not that simple. Just that fact that an extension is listening/intercepting the opening of a document, means that we need to roundtrip to the extension host. And that enables any extension to delay opening, e.g one that's totally unrelated to this request but blocking the extension host atm. While that's undesirable too, it's often unnoticed because we don't wait for the extension host before opening files (and other "vital" things) <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "visual studio code, vscode extensions" }
What are the basic implementations that make a network secure from the inside\outside? Would you consider the following to be "basic hardening items" for network equipment and servers? * VLANs * Access Control (such as NTFS permissions) * Patch Management System * Host Firewall * Anti-Virus What is the minimal protection needed to segment my internal network from the DMZ and the outside? Is having a WAF, assuming you're dealing with web applications, and default denies, with tightly confined rules, on the firewalls sufficient?
The most basic principles for making a network secure are 'defence in depth' - that is, you want to put as many things between your 'crown jewels' and potential attackers as you can - and 'minimal surface area' - that is, you expose as little as possible to attack. To get there; your list of basics is pretty good at addressing 'defence in depth', though you may want the ability to blacklist/whitelist applications. You should have a look at minimal surface areas - turn off admin privileges, unused services, blacklist any application running outside of c:\windows, c:\program files, etc., block executables on USB, turn off web access on machines that don't need it, etc. Finally, the Australian DSD guide at < is a very good 'checklist' for this sort of thing - start at the top and work down.
stackexchange-security
{ "answer_score": 2, "question_score": 1, "tags": "network, firewalls, access control, hardening" }
IDataReader.GetOrdinal or IDataReader[ColumnName] I have two cases to extract information from the IDataReader object ## Case - 1 - Length, calculates ordinal and then parse string public static string GetString(IDataReader rdr, string columnName) { int ordinal = rdr.GetOrdinal(columnName); if (rdr.IsDBNull(ordinal)) { return string.Empty; } return (string)rdr[ordinal]; } * * * ## Case - 2, short way, getting data without calculating ordinal public static string GetString(IDataReader rdr, string columnName) { return (string)rdr[columnName]; } Which technique should be preferred and why and if any specific context ?
**SqlDataReader's** `this[string name]` looks like: public override object this[string name] { get { return this.GetValue(this.GetOrdinal(name)); } } so it calculates ordinal internaly, and there is no difference what way to use. **UPDATE** Yo can rewrite your code as: public static string GetString(IDataReader rdr, string columnName) { return (rdr[columnName] as String)??String.Empty; }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "c#, vb.net, c# 4.0, idatareader" }
Add Days in format d/m/Y I want how to add days, I try this $start = '06/07/2017' echo $start; echo "<br>"; echo date('d/m/Y', strtotime(' + 1 days', strtotime($start))); But return this 06/07/2017 08/06/2017 What is the problem?
Try this, <?php $start = '06/07/2017'; echo $start; $start = str_replace("/","-",$start); echo "<br>"; echo date("d/m/y", strtotime(date('d-m-Y', strtotime(' + 1 days', strtotime($start))))); **Note: Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. If, however, the year is given in a two digit format and the separator is a dash (-, the date string is parsed as y-m-d.** Source link.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 1, "tags": "php, date, days" }
Hive Query - Get max and sum of multiple fields from each group I have a table as follows: id | most_recent_run | flag1 | flag2 ---+------------------+-------+------ 1 | 2017-01-01 10:40 | 0 | 1 1 | 2017-01-01 18:30 | 1 | 1 2 | 2017-02-28 04:30 | 1 | 0 I want to query this table such that for every `id`, I get the `max(most_recent_run)`, `sum(flag1)` and `sum(flag2)`. This should be the query result: id | max_most_recent_run | flag1_count | flag2_count ---+---------------------+-------------+------------ 1 | 2017-01-01 18:30 | 1 | 2 2 | 2017-02-28 04:30 | 1 | 0 I have tried writing this query using a combination of collect and rank functions but I am not getting the intended results. Any explanation or direction in this regard would be greatly appreciated. Thanks!
You should use the SQL `group by` statement, then use the `max` and `sum` functions, _i.e._ : select id, max(most_recent_run) as max_most_recent_run, sum(flag1) as flag1_count, sum(flag2) as flag2_count from my_table group by id
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, hadoop, hiveql" }
Usage of .map with defaultdict I have a pandas dataframe and I have to fill a new column based on the values of an existing column, associating the values of a dictionary. mydict={'key1':'val1', 'key2':'val2'} df['new_col']=df['keys'].map(mydict) Now I have a similar problem, but the dictionary is now a `defaultdict(list)` my_defdict=defaultdict(list) my_defdict={'key1':['val1','item1'], 'key2':['val2','item2']} and I need a new column with the second element of the list, something like df['new_col2']=df['keys'].map(my_defdict()[1]) which is of course wrong. How can I perform this operation without creating another normal dictionary?
Assuming all your values have at least two items per list, add an `str[1]` at the end: df['new_col2'] = df['keys'].map(my_defdict).str[1] Or, df['new_col2'] = df['keys'].map(my_defdict).str.get(1)
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "python, pandas, dictionary, defaultdict, map function" }
Tool to make homepage using MarkDown files of a GitHub repo I have several repos at github which are about software, but mostly containm mark-down text. The pages get rendered to nice HTML at github, but the look/layout is not very nice. Is there a tool to make a simple homepage from mark-down files in a github repo. I would like to avoid to run a own webserver. Here are some examples of the pages: * < * < * <
I've been using forestry.io with gatsby and Hugo (static site generators). You can import your git repo ![enter image description here]( Any changes you make into your .md files via forestry's wysiwyg editor are automatically committed to the origin and if you have integrated CI/CD, they are automatically deployed. To make your page look fancy, I suggest you look into GitHub pages: < Depending on your preference, you could also try a few alternatives like: < < If you decide to go with forestry, you can fork gitlab's starter pages: <
stackexchange-softwarerecs
{ "answer_score": 1, "question_score": 0, "tags": "web, markdown, github" }
Dynamically loading iframes when a button is pressed I am creating a webpage where I have to load iframes inside a div. <div class="sketchfab"> <iframe class="myframe" src=""></iframe> </div> And below it I have links that should provide the **source** for iframe. <div class="container"> <a href=#>A</a> <a href=#>B</a> <a href=#>C</a> <a href=#>D</a> And so on till Z </div> How can I do it? The iframes display 3D animations of the sign gestures. So basically when I press hyperlink of A, the gesture of A appears... and so on..
HTML <div class=""> <a href="#" data-url="hMxGhHNOkCU">A</a> <a href="#" data-url="BWXggB-T1jQ">B</a> <a href="#" data-url="gqOEoUR5RHg">C</a> <a href="#" data-url="5GcQtLDGXy8">D</a> And so on till Z </div> And Javascript: $(function() { $('a').click(function() { var _this = $(this), iframe = $('iframe'); iframe.attr('src',' + _this.attr('data-url')); }); }); You can check this Fiddle.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, jquery, html, iframe" }
Load background.image sequence from folder with Javascript i'm tring to make a javascript source that load all images in a folder as backgroundImage of my div <script type="text/javascript"> $(document).ready(function() { $('body').css('background-image', 'url(/web/images/001.png)'); }); </script> How i can load all images (.png) in my folder (web/images) as background-image of a div? Thanks for support, M.
If you want to change the background using a interval you should try this $(document).ready(function() { // Function to add leading zeroes function pad(num, size) { var s = num + ""; while (s.length < size) s = "0" + s; return s; } // Variable to store the current image index var currentIdx = 1; var max = 200; // Qtd of images in the folder setInterval(function() { // Reset the index when overflow if(currentIdx > max) currentIdx = 1; // Change the background $('body').css('background-image', 'url(/web/images/' + pad(currentIdx,4) + '.png)'); currentIdx ++; }, 5000); // 5000ms == 5 seconds }); Here is a Working Sample
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, css" }
Что положить в Post запрос? Имеем сайт с формами для заполнения и кнопками, как узнать тип параметра, название и какие значения может принимать? Для отправки post запроса. Например берем этот сайт < как будет выглядеть post-запрос, передающий заполненные поля и нажатие на кнопку.
Если используется `<form action="xxx">`, то вероятнее всего, ключи POST-запроса будут равны свойству "name" полей формы. Данный пример это хорошо показывает: < Я надеюсь, я правильно понял вас.
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "веб программирование, http, post, httpclient" }
Question about derivative I need to check whether I've done it correctly 1. To find whether a point is maximum of function $f(x)$, we have to checked whether $f''(x)>0, f''(x)=0$ or $f''(x)<0?$ 2. To find the inflection point of the function, we have to find, $f''(x)=0, f'(x)=0,$ $f(x)=0.$ 3. When choose the value of $\sqrt{(64,3)},$ $X_o$ has the value: $64, 0,3$ or $X_o>64.$ My answers are the following. $1. f''(x)<0$ $2. f''(x)=0$ $3. X_o = 64.$
Your first two answers are correct. If you mean by $\sqrt{(64, 3)}$ that you need to find the value of $x_0$ in order to determine the distance of the point $(64, 3)$ from the origin, then you'd want $x_0 = 0$, the $x$-coordinate of the origin: Distance = $\sqrt{(64 - 0)^2 + (3 - 0)^2}$. But it will work equally well if we reverse the positions: Distance = $\sqrt{(0 - 64)^2 + (0 - 3)^2}$. So $x_0 = 64$ works just as well. But the value of the distance between $(64, 3)$ and $(0, 0)$ is $\sqrt{73}$. So the answer for $(3)$ depends on what is meant by $x_0$.
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "derivatives" }