qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
16,907,272
I have several modules I want to import dynamically. The modules are named prefix\_? where ? = [0,1,2,3]. I use glob to get a list of the files/modules. ``` module = glob.glob(prefix_?.py) module.sort() ``` Now I want to import one module at a time and run some code. ``` for m in range(0,len(module),1): from mo...
2013/06/03
[ "https://Stackoverflow.com/questions/16907272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2403811/" ]
You can use [`importlib`](http://docs.python.org/2/library/importlib.html) module: ``` import glob import importlib module = glob.glob(prefix_?.py) module.sort() for m in module: #iterate over list itself, why range? mod = importlib.import_module(m[:-3]) #strip off .py ```
``` my_module = __import__("some_file") #note you leave off the .py x = my_module.x y = my_module.y .... ``` I think thats it anyway
273,245
I've written a program to convert a hex-encoded string to base64, and here is my code. My main concerns are: 1. Optimizations - Is my code sufficiently optimized and if any more optimization is possible. 2. Memory leaks - Is there any scope for memory leaks. 3. Readability ``` #include <stdio.h> #include <stdlib.h> #...
2022/01/22
[ "https://codereview.stackexchange.com/questions/273245", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/254416/" ]
Headers ======= I don't see any need for `<string.h>`. We can drop `<stdbool.h>` if we rewrite `check_not_equal`: ``` #define check_not_equal(a, b) ((a) != (b)) ``` Personally, I wouldn't use a macro for that - it just obfuscates the code. `<stdio.h>` is used only by the tests. We may compile them separately if we...
Syntax words used in functions ============================== I myself don't like the use of a syntax word in a function name like `return_base64()`. This is due to the fact that some older code highlighting editors may change color of the part `return`. Despite the fact that it is in a function definition, many older...
1,267,196
How would you find the cardinality of the basis of $\mathbb{R}$ over $\mathbb{Q}$? Is it countable or uncountable? In general, how do you find the cardinality of a basis of an infinite-dimensional vector space? Do you just search for a bijection between the basis and, say, $\mathbb{N}$ or $\mathbb{R}$? What are some ...
2015/05/04
[ "https://math.stackexchange.com/questions/1267196", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
If $V$ is a vector space over the field $F$, and $B$ is a basis for $V$ then every element in $v$ is the unique combination of finitely many elements from $B$ with coefficients from $F$. So each $v\in V$ can be represented as a finite subset of $B\times F$ which is a function. How? $v(b)=\alpha$ if $b$ is a basis elem...
The cardinality of a Hamel basis of $\mathbf R$ over $\mathbf Q$ can't be countable, since it would imply $\mathbf R$ is countable. A more general result is that if $E$ is an infinite-dimensional Banach space over a subfield $K\subset\mathbf C$, Hamel bases have all cardinality $\lvert E\rvert$.
25,135,600
Would like to calculate number of days between two dates , for the below example, No of days == $6-$4 position. Input.txt ``` Desc1,Desc2,Desc3,DATE_ACTIVE,STATEMENT_DATE,Desc4 abc,def,ghi,21-MAR-08,01-JUL-14,jkl abc,def,ghi,01-JUL-14,15-JUL-14,jkl abc,def,ghi,06-NOV-06,08-JUL-14,jkl abc,def,ghi,18-NOV-03,08-JUL-14,j...
2014/08/05
[ "https://Stackoverflow.com/questions/25135600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3350223/" ]
one way to do that: ``` kent$ awk -F, -v q='"' '{ c="date -d"q$4q" +%s";c|getline d1;close(c); c="date -d"q$5q" +%s";c|getline d2;close(c); printf "%s,%d\n", $0,(d2-d1)/3600/24}' file abc,def,ghi,21-MAR-08,01-JUL-14,jkl,2292 abc,def,ghi,01-JUL-14,15-JUL-14,jkl,14 abc,def,ghi,06-NOV-06,08-JUL-14,jkl,2800 abc,def,...
Not the `awk`, but true date/days calculation: ``` #!/bin/bash read line < input; echo -n $line; echo "No_Of_Days"; sed '1d' input| while IFS=, read a b c d e f; do let DIFF=(`date +%s -d $d`-`date +%s -d $e`)/86400; echo -n $a,$b,$c,$d,$e,$f, echo $(($DIFF *-1)); done ``` produces: ``` Desc1,Desc2,Desc3,DAT...
25,135,600
Would like to calculate number of days between two dates , for the below example, No of days == $6-$4 position. Input.txt ``` Desc1,Desc2,Desc3,DATE_ACTIVE,STATEMENT_DATE,Desc4 abc,def,ghi,21-MAR-08,01-JUL-14,jkl abc,def,ghi,01-JUL-14,15-JUL-14,jkl abc,def,ghi,06-NOV-06,08-JUL-14,jkl abc,def,ghi,18-NOV-03,08-JUL-14,j...
2014/08/05
[ "https://Stackoverflow.com/questions/25135600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3350223/" ]
one way to do that: ``` kent$ awk -F, -v q='"' '{ c="date -d"q$4q" +%s";c|getline d1;close(c); c="date -d"q$5q" +%s";c|getline d2;close(c); printf "%s,%d\n", $0,(d2-d1)/3600/24}' file abc,def,ghi,21-MAR-08,01-JUL-14,jkl,2292 abc,def,ghi,01-JUL-14,15-JUL-14,jkl,14 abc,def,ghi,06-NOV-06,08-JUL-14,jkl,2800 abc,def,...
The other examples here are script examples in unix, and not necessarily awk. It can be done natively in some awk extensions, such as nawk or gawk, as well, using the `mktime(datespec)` function. You need to convert your date to a standardized format: ``` function getDate(date) { split(date, a, "-"); return mk...
31,792,330
I would like to get the code below to wait for another script to be loaded before executing. How can I get this to wait for sp.js to load before executing? ``` $.getScript("/sites/MySite/SiteAssets/jquery.LISP.Quicklaunch.js", function(){}); jQuery(document).ready(function() { jQuery('#s4-leftpanel').quicklaunchHide(...
2015/08/03
[ "https://Stackoverflow.com/questions/31792330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2962328/" ]
Answer from comment. Please check the **[jQuery documentation](https://api.jquery.com/jquery.getscript/)**. You just need to use a callback. If you want to execute your code after that `.getScript()`, put it inside the second parameter, which is currently a callback function: ``` $.getScript('path/to/script.js', func...
Deferring execution of code is most simply done using a callback. For instance, if you have a function called `defer()` which you only want to execute after a function `dofirst()` has executed, you'd do this: ``` function dofirst(arguments, callback){ //Do something here first, then call the callback callback(...
31,792,330
I would like to get the code below to wait for another script to be loaded before executing. How can I get this to wait for sp.js to load before executing? ``` $.getScript("/sites/MySite/SiteAssets/jquery.LISP.Quicklaunch.js", function(){}); jQuery(document).ready(function() { jQuery('#s4-leftpanel').quicklaunchHide(...
2015/08/03
[ "https://Stackoverflow.com/questions/31792330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2962328/" ]
I ended up doing it this way: ``` $.getScript("/sites/MySite/SiteAssets/jquery.LISP.Quicklaunch.js", function(){}); jQuery(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(delayedExecute, "sp.js"); }); function delayedExecute(){ jQuery('#s4-leftpanel').quicklaunchHide({ collapseImage: '/_...
Deferring execution of code is most simply done using a callback. For instance, if you have a function called `defer()` which you only want to execute after a function `dofirst()` has executed, you'd do this: ``` function dofirst(arguments, callback){ //Do something here first, then call the callback callback(...
31,792,330
I would like to get the code below to wait for another script to be loaded before executing. How can I get this to wait for sp.js to load before executing? ``` $.getScript("/sites/MySite/SiteAssets/jquery.LISP.Quicklaunch.js", function(){}); jQuery(document).ready(function() { jQuery('#s4-leftpanel').quicklaunchHide(...
2015/08/03
[ "https://Stackoverflow.com/questions/31792330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2962328/" ]
Answer from comment. Please check the **[jQuery documentation](https://api.jquery.com/jquery.getscript/)**. You just need to use a callback. If you want to execute your code after that `.getScript()`, put it inside the second parameter, which is currently a callback function: ``` $.getScript('path/to/script.js', func...
I ended up doing it this way: ``` $.getScript("/sites/MySite/SiteAssets/jquery.LISP.Quicklaunch.js", function(){}); jQuery(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(delayedExecute, "sp.js"); }); function delayedExecute(){ jQuery('#s4-leftpanel').quicklaunchHide({ collapseImage: '/_...
184,163
I have set up a global search filter on a custom object that includes the Record Type field. This allows our users to filter down results by Record Type. However, when choosing one of the Record Type values, we see the error "Error: Picklist value does not exist." After doing some research I'm guessing this is being ca...
2017/07/13
[ "https://salesforce.stackexchange.com/questions/184163", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/9978/" ]
Appears to be a known issue which is currently being reviewed: ["Error: Picklist value does not exist" in Search Filter Fields for Record Type values with commas](https://success.salesforce.com/issues_view?id=a1p3A0000001DSVQA2) N.B. It might be important to point out that an error may not always be thrown for this is...
Is it a vf page? if yes, you can see if you have the same approach as below. Posting some code would help. VF: ``` <apex:page controller="UserController"> <apex:form > <apex:selectList size="1"> <apex:selectOptions value="{!UserList}"></apex:selectOptions> </apex:selectList> </apex:form> </...
526,609
![enter image description here](https://i.stack.imgur.com/TjBvZ.jpg) Consider the example shown above. Ideal fluid is flowing along the flat tube of uniform cross section area located in the horizontal plane and bent as shown. The flow is steady. My text book says following two things: 1. Pressure at point 1 will be ...
2020/01/23
[ "https://physics.stackexchange.com/questions/526609", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/185612/" ]
Laplace's equation in terms of the stream function is based on Euler's equation (which takes into account the inertial forces involved). The solution to Euler's equation will show that the streamlines are closer together at point 2 than at point 1. The pressure has to be higher at point 1 than point 2 because it is on ...
Bennoulis principle has a condition that the flow must be streamline. The curve will create Eddies and Bernoulli's principle will not apply
16,820,724
I am sorry if this is a noob question but I am new to C++ and part of the reason I am messing with openCL is to learn more C++. I installed the CUDA SDK and it put openCL header files here: ``` C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include\CL ``` I added the the following two directories to addit...
2013/05/29
[ "https://Stackoverflow.com/questions/16820724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1873073/" ]
You can also do this easily with LINQ and it's easier to read and more concise: ``` var users = from c in dt.AsEnumerable() group c by c.Field<string>("UserName") into gr select new User { Username= gr.Key , ControlNumbers = (from x in dt.AsEnumerable() ...
You could use a `Dictionary` like this: ``` public static void FillUserListClass() { Dictionary<string, User> UserList = new Dictionary<string, User>(); OleDbConnection conn = new OleDbConnection(strAccessConn); string query = "SELECT ControlNumber, UserName FROM Log WHERE Log.EndStatus in ('Needs Review',...
158,439
Moderators should be able to comment on things after normal users are unable to, such as when a post is deleted or locked. As a moderator on Programmers, I try to leave a comment (if necessary) before taking the appropriate action on the post. However, in the time it takes to write a comment (which often includes diggi...
2012/12/12
[ "https://meta.stackexchange.com/questions/158439", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/572/" ]
This would be extremely helpful. I've had the following real world cases happen: * A user defaces their own post. I lock the post, then remember I should comment letting everyone know why it's locked. I unlock the post, and write a comment, only to discover that the user has *once again* defaced the post in the meant...
*Educational* aspect of deleted content has been specifically stressed in the rationale for a recently introduced change: * [Turbocharging the Roomba: solutions for premature deletion](https://meta.stackexchange.com/q/173513/165773) > > Show users their deleted content. ...without this, it's always a trade-off betwe...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
You're doing a mistake: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The variable `newNumt` defined *inside* the loop does not affect the variable `newNumt` declared in the `for` statement. So the `for` loop prints out the *first 100 odd numbers*, not the *od...
If you want all the odd numbers between 0 and 100 you can write ``` let oddNums = (0...100).filter { $0 % 2 == 1 } ``` or ``` let oddNums = Array(stride(from: 1, to: 100, by: 2)) ```
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
If you want all the odd numbers between 0 and 100 you can write ``` let oddNums = (0...100).filter { $0 % 2 == 1 } ``` or ``` let oddNums = Array(stride(from: 1, to: 100, by: 2)) ```
For **Swift 4.2** ``` extension Collection { func everyOther(_ body: (Element) -> Void) { let start = self.startIndex let end = self.endIndex var iter = start while iter != end { body(self[iter]) let next = index(after: iter) if next == end { ...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
If you want all the odd numbers between 0 and 100 you can write ``` let oddNums = (0...100).filter { $0 % 2 == 1 } ``` or ``` let oddNums = Array(stride(from: 1, to: 100, by: 2)) ```
If you want all the odd numbers between 0 and 100 you can write ``` for i in 1...100 { if i % 2 == 1 { continue } print(i - 1) } ```
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
You're doing a mistake: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The variable `newNumt` defined *inside* the loop does not affect the variable `newNumt` declared in the `for` statement. So the `for` loop prints out the *first 100 odd numbers*, not the *od...
For **Swift 4.2** ``` extension Collection { func everyOther(_ body: (Element) -> Void) { let start = self.startIndex let end = self.endIndex var iter = start while iter != end { body(self[iter]) let next = index(after: iter) if next == end { ...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
You're doing a mistake: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The variable `newNumt` defined *inside* the loop does not affect the variable `newNumt` declared in the `for` statement. So the `for` loop prints out the *first 100 odd numbers*, not the *od...
If you want all the odd numbers between 0 and 100 you can write ``` for i in 1...100 { if i % 2 == 1 { continue } print(i - 1) } ```
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
You're doing a mistake: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The variable `newNumt` defined *inside* the loop does not affect the variable `newNumt` declared in the `for` statement. So the `for` loop prints out the *first 100 odd numbers*, not the *od...
> > Why does it print numbers above 100 although I specify the range between 0 and <100? > > > Look again at your code: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The `newNumt` used inside the loop is different from the loop variable; the `var newNum...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
If you want all the odd numbers between 0 and 100 you can write ``` for i in 1...100 { if i % 2 == 1 { continue } print(i - 1) } ```
For **Swift 4.2** ``` extension Collection { func everyOther(_ body: (Element) -> Void) { let start = self.startIndex let end = self.endIndex var iter = start while iter != end { body(self[iter]) let next = index(after: iter) if next == end { ...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
> > Why does it print numbers above 100 although I specify the range between 0 and <100? > > > Look again at your code: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The `newNumt` used inside the loop is different from the loop variable; the `var newNum...
For **Swift 4.2** ``` extension Collection { func everyOther(_ body: (Element) -> Void) { let start = self.startIndex let end = self.endIndex var iter = start while iter != end { body(self[iter]) let next = index(after: iter) if next == end { ...
41,204,123
I am trying to solve the task > > Using a standard for-in loop add all odd numbers less than or equal to 100 to the oddNumbers array > > > I tried the following: ``` var oddNumbers = [Int]() var numbt = 0 for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } print(oddNu...
2016/12/17
[ "https://Stackoverflow.com/questions/41204123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6242702/" ]
> > Why does it print numbers above 100 although I specify the range between 0 and <100? > > > Look again at your code: ``` for newNumt in 0..<100 { var newNumt = numbt + 1; numbt += 2; oddNumbers.append(newNumt) } ``` The `newNumt` used inside the loop is different from the loop variable; the `var newNum...
If you want all the odd numbers between 0 and 100 you can write ``` for i in 1...100 { if i % 2 == 1 { continue } print(i - 1) } ```
25,067,368
I have tried a number of ways yet had no luck...I must be way off here. Here is my action link: ``` @Ajax.ActionLink("Delete all", "Empty", new AjaxOptions() { HttpMethod = "POST", OnBegin = String.Format("...
2014/07/31
[ "https://Stackoverflow.com/questions/25067368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3897015/" ]
One crude way of doing accomplishing what you need is this: in the Empty function, replace `RedirectToAction` to: ``` var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "Home"); return Json(new { Url = redirectUrl }); ``` In your javascript, replace ``` OnComplete = "location.reload()", <-- ...
You get the response, but you didn't get it as you expected. You make an async call to server and your **response** is in **result** parameter of **OnSuccess** function. ``` @Ajax.ActionLink("Delete all", "Empty", new AjaxOptions() { HttpMethod = "POST", OnBegin = String.Format("if(!confirm('Are you s...
41,221,867
I need to install a self-signed CA root certificate that is used by one of our applications that uses Client Certificate Authentication with an external provider. I have uploaded the .PFX client certificate but I also need to install the CA certificate into the trusted roots. I have googled endlessly on how to do thi...
2016/12/19
[ "https://Stackoverflow.com/questions/41221867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/699426/" ]
Looking at this [blog post](https://web.archive.org/web/20150919050655/http://azure.microsoft.com/en-us/blog/intermediate-tls-certificates-for-azure-app-service-web-apps/) it's not possible. > > Do note that we will not install new Root certificates in our Trusted Authorities as a result of this, just the intermediat...
If you are happy to run your application on a web or worker role in a cloud service, you can use start-up taks. A start-up task can be either a .bat file or PowerShell script that is executed prior to starting your application. You can also run these scripts elevated if you want. See also: - <https://learn.microsoft....
35,761,839
Hey everyone i am working on a personal project with java (I am still currently learning the language) and have come here with a question or two. First Question ============== In my try block i am allowed to ask the user to input a value to be assigned to a variable and in my catch block, if the user inputs a wrong v...
2016/03/03
[ "https://Stackoverflow.com/questions/35761839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4221131/" ]
The `.+?` quantifier is reluctant (or "lazy"). It means it will match the subpattern it quantifies *one or more times, **but** as few times as necessary to return a valid match*. You have `(John) (.+?)` pattern and you try to find a match in `John writes about this`. The regex engine finds `John`, places it into Group...
Well, if you include the trailing space, you are asking the pattern to match that space as well. `John w` does not match anymore, because it does not end with a space. It has to be expanded to `John writes` (note that the match includes the space at the end).
71,858,711
For example I have a string with html code. ``` const string = ` <div> <h1>Title</h1> <h2>Subtitle</h2> <div class="find-me">text</div> </div> `; ``` Expected result with JS script: ``` <div class="find-me">text</div> ``` How it's possible to do it without jquery and other libraries/frameworks ?
2022/04/13
[ "https://Stackoverflow.com/questions/71858711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18770618/" ]
Try this ``` const string = ` <div> <h1>Title</h1> <h2>Subtitle</h2> <div class="find-me">text</div> </div> `; let arr = string.split('\n'); for(let i=0; i<arr.length; i++){ if(arr[i].search("find-me") != -1){ console.log(arr[i]); } } ```
you can create a temporary element and attach the string using innerHTML: ```js let tempElement = document.createElement("div"); tempElement.innerHTML = string; const myElement = tempElement.querySelector(".find-me"); ```
2,891,736
I have TextBlock in my main form. I set the Text property to different strings during the application run. I would like to be able to colour parts of particular strings. Pseudo code: ``` if(a < 0) txbStatus.Text = string.Format("{0} <RED>{1}</RED>", a, b); else txbStatus.Text = string.Format("{0} <BLUE>{1}</R...
2010/05/23
[ "https://Stackoverflow.com/questions/2891736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/347484/" ]
You can split your string the way u want and then using a `foreach()` loop for that split string try ``` TextBlockName.Inlines.Add(new Run("colored text") {Foreground = Brushes.Blue}); ```
The content of a `TextBox` doesn't have to be just a string, but a collection of `Inline`s: ``` txbStatus.Inlines.Clear(); txbStatus.Inlines.Add(new Run("normal color, ")); txbStatus.Inlines.Add(new Run("colored text") { Foreground = Brushes.Red }); ```
2,891,736
I have TextBlock in my main form. I set the Text property to different strings during the application run. I would like to be able to colour parts of particular strings. Pseudo code: ``` if(a < 0) txbStatus.Text = string.Format("{0} <RED>{1}</RED>", a, b); else txbStatus.Text = string.Format("{0} <BLUE>{1}</R...
2010/05/23
[ "https://Stackoverflow.com/questions/2891736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/347484/" ]
The content of a `TextBox` doesn't have to be just a string, but a collection of `Inline`s: ``` txbStatus.Inlines.Clear(); txbStatus.Inlines.Add(new Run("normal color, ")); txbStatus.Inlines.Add(new Run("colored text") { Foreground = Brushes.Red }); ```
I have created a custom TextBlock which will help you to highlight some part of text within the TextBlock's "Text" value. ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; ...
2,891,736
I have TextBlock in my main form. I set the Text property to different strings during the application run. I would like to be able to colour parts of particular strings. Pseudo code: ``` if(a < 0) txbStatus.Text = string.Format("{0} <RED>{1}</RED>", a, b); else txbStatus.Text = string.Format("{0} <BLUE>{1}</R...
2010/05/23
[ "https://Stackoverflow.com/questions/2891736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/347484/" ]
You can split your string the way u want and then using a `foreach()` loop for that split string try ``` TextBlockName.Inlines.Add(new Run("colored text") {Foreground = Brushes.Blue}); ```
I have created a custom TextBlock which will help you to highlight some part of text within the TextBlock's "Text" value. ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; ...
349,385
This seems like a typical use-case yet I can't find a way to do it- I created a layout having multiple windows. I want each window to open an SSH session to a **different** server.
2013/09/24
[ "https://askubuntu.com/questions/349385", "https://askubuntu.com", "https://askubuntu.com/users/195627/" ]
1. Go to the Layout tab in the configuration dialog, 2. Select your layout 3. In the terminal in the tree view in the middle, select your first terminal, select your profile and enter at the right the "custom command" 4. Repeat step 3 for all your terminals where you want to run a special command at startup. Use alway...
I worked with this for a while, and the ; bash advice is correct. One other piece of advice is after entering the custom commands in the Profiles area of Preferences, if you click Save, it will wipe out all of the custom commands. If you enter the custom commands and simply close the preferences window, the preferences...
1,983,330
I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code doing true TDD. I kept unit-testing in mind as ...
2009/12/31
[ "https://Stackoverflow.com/questions/1983330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191206/" ]
**Do I write the entire application, using nothing but stubbed out code?** No, not in the slightest sense - that sounds like a very wasteful approach. We must always keep in mind that the underlying reason for doing TDD is **rapid feedback**. An automated test suite can tell us if we broke anything much faster than a ...
+1 Good question I truly don't know the answer, but I would start with building blocks of classes that I could test then build into the application, not with the top-level stuff. And yes I would have a rough up-front design of the interfaces, otherwise I think you would find those interfaces changing so often as you ...
1,983,330
I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code doing true TDD. I kept unit-testing in mind as ...
2009/12/31
[ "https://Stackoverflow.com/questions/1983330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191206/" ]
* Do you do design up front? Of course you do. You've got a big application in front of you. You've got to have some idea of the structure it will have before you start writing tests and code. You don't have to have it all worked out in detail, but you should have some basic idea of the layers, components, and interfa...
+1 Good question I truly don't know the answer, but I would start with building blocks of classes that I could test then build into the application, not with the top-level stuff. And yes I would have a rough up-front design of the interfaces, otherwise I think you would find those interfaces changing so often as you ...
1,983,330
I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code doing true TDD. I kept unit-testing in mind as ...
2009/12/31
[ "https://Stackoverflow.com/questions/1983330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191206/" ]
**Do I write the entire application, using nothing but stubbed out code?** No, not in the slightest sense - that sounds like a very wasteful approach. We must always keep in mind that the underlying reason for doing TDD is **rapid feedback**. An automated test suite can tell us if we broke anything much faster than a ...
* Do you do design up front? Of course you do. You've got a big application in front of you. You've got to have some idea of the structure it will have before you start writing tests and code. You don't have to have it all worked out in detail, but you should have some basic idea of the layers, components, and interfa...
1,983,330
I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code doing true TDD. I kept unit-testing in mind as ...
2009/12/31
[ "https://Stackoverflow.com/questions/1983330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191206/" ]
**Do I write the entire application, using nothing but stubbed out code?** No, not in the slightest sense - that sounds like a very wasteful approach. We must always keep in mind that the underlying reason for doing TDD is **rapid feedback**. An automated test suite can tell us if we broke anything much faster than a ...
* **Do you write the entire application, using nothing but stubbed out code?** To test our systems we mainly do unit, integration and remote services testing. In unit tests we stub out all long running, time consuming, and external services, i.e. database operations, web services connection or any connection to extern...
1,983,330
I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code doing true TDD. I kept unit-testing in mind as ...
2009/12/31
[ "https://Stackoverflow.com/questions/1983330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191206/" ]
* Do you do design up front? Of course you do. You've got a big application in front of you. You've got to have some idea of the structure it will have before you start writing tests and code. You don't have to have it all worked out in detail, but you should have some basic idea of the layers, components, and interfa...
* **Do you write the entire application, using nothing but stubbed out code?** To test our systems we mainly do unit, integration and remote services testing. In unit tests we stub out all long running, time consuming, and external services, i.e. database operations, web services connection or any connection to extern...
5,030,905
``` <marquee style = "color: Red; font-size: 24px;"> <?php for($i = 0; $i < 50; $i++) { echo $symbol[$i]; echo "\t"; echo $chng[$i]; echo "\t\t\t"; }?> </marquee> ``` I need to change the color of text based on the value of *$chng[$i]*. i.e. if $chng[$i] > 0.. green, else red.
2011/02/17
[ "https://Stackoverflow.com/questions/5030905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/575889/" ]
'hi Jak I've tried to solve this as well but it looks like MKMapView might be using some fancy stuff between updates to predict the next position and make the movement smoother. If you look at the way they handle the compass they are doing a lot of filtering as the raw compass data is not terribly steady so they make...
You could also try this: ``` - (void)adjustRegion:(CLLocation*)location { MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, 150.0, 150.0); MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:viewRegion]; [self.mapView setRegion:adjustedRegion animated:YES]...
5,030,905
``` <marquee style = "color: Red; font-size: 24px;"> <?php for($i = 0; $i < 50; $i++) { echo $symbol[$i]; echo "\t"; echo $chng[$i]; echo "\t\t\t"; }?> </marquee> ``` I need to change the color of text based on the value of *$chng[$i]*. i.e. if $chng[$i] > 0.. green, else red.
2011/02/17
[ "https://Stackoverflow.com/questions/5030905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/575889/" ]
'hi Jak I've tried to solve this as well but it looks like MKMapView might be using some fancy stuff between updates to predict the next position and make the movement smoother. If you look at the way they handle the compass they are doing a lot of filtering as the raw compass data is not terribly steady so they make...
I used the `CLLocationManager` delegate update methods to get the current location about every second, saved the previous location and interpolated between those. It's a little more effort, but t makes the tracking a lot smoother. Here is my code: ``` #define zoomSpan MKCoordinateSpanMake(0.001f, 0.001f) @property (s...
5,030,905
``` <marquee style = "color: Red; font-size: 24px;"> <?php for($i = 0; $i < 50; $i++) { echo $symbol[$i]; echo "\t"; echo $chng[$i]; echo "\t\t\t"; }?> </marquee> ``` I need to change the color of text based on the value of *$chng[$i]*. i.e. if $chng[$i] > 0.. green, else red.
2011/02/17
[ "https://Stackoverflow.com/questions/5030905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/575889/" ]
I used the `CLLocationManager` delegate update methods to get the current location about every second, saved the previous location and interpolated between those. It's a little more effort, but t makes the tracking a lot smoother. Here is my code: ``` #define zoomSpan MKCoordinateSpanMake(0.001f, 0.001f) @property (s...
You could also try this: ``` - (void)adjustRegion:(CLLocation*)location { MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, 150.0, 150.0); MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:viewRegion]; [self.mapView setRegion:adjustedRegion animated:YES]...
53,487,622
I'm struggling to overcome this error. My function is supposed to read data from a file into an array of structures. Data file example: ``` 1234 52 70 75 2134 90 76 90 3124 90 95 98 ``` Structure definition (average is calculated later): ``` struct Student { int id, testOne, testTwo, testThree;...
2018/11/26
[ "https://Stackoverflow.com/questions/53487622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703617/" ]
`ptr` is a pointer to an array. `*ptr` dereferences the pointer, so the result is an array. `(*ptr)[i]` is an element of that array, which is a `Student` struct. `(*ptr)[i].id` is a member of that struct. Your code is wrong because it tries to dereference `ptr` with `->` (fine so far, `ptr` is a pointer so derefere...
student\_array is an array. You need to read into a given element of that array like this ``` fin >> ptr[0]->id; ``` you probably want a loop and use the loop index as the array index
48,678,568
When I tried to enter a text in the below input field I am getting the error although it displayed in the window. The following input element html code is given below. I couldn't understand the reason for the error and unable to find the solution " WebDriverError: unknown error: a.tagName.toUpperCase is not a function"...
2018/02/08
[ "https://Stackoverflow.com/questions/48678568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8831573/" ]
Hmmm sed doesnt really have concept of greedy or lazy replacement, better to use very similar but more robust perl replace command. Also your sed command is trying to replace the start of the line then first character so long as it isnt a curly brace and then everything else with blank. Try ``` perl - pi -e 's/^*?{/...
Thanks a lot! Yes, I have used similar expression to that. Output Port= SUBSTR(INPUT\_STRING, INSTR(INPUT\_STRING,'{'), LENGTH(INPUT\_STRING))
41,276,708
I am creating a web app in mvc-5 with `angularjs` here I have the following div ``` <div class="row form-clearify" style="margin-top:3px;"> <div class="col-md-6 col-sm-6 col-xs-12" style="background-color:whitesmoke;"> <label>Upload Your Photo</label> <input type="file" ng-model="mdphoto" class="for...
2016/12/22
[ "https://Stackoverflow.com/questions/41276708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is an issue with input type file in AngularJs . <https://github.com/angular/angular.js/issues/1375> Try to create your own directive for input type file : See The Solutions -- [ng-model not working with file input](https://stackoverflow.com/questions/35036658/ng-model-not-working-with-file-input)
I had this same issue and found some good answers on S.O. You'll need to use a directive to bind the file to your ng-model. Here's the link: [ng-model for <input type="file"/>](https://stackoverflow.com/questions/17063000/ng-model-for-input-type-file)
41,276,708
I am creating a web app in mvc-5 with `angularjs` here I have the following div ``` <div class="row form-clearify" style="margin-top:3px;"> <div class="col-md-6 col-sm-6 col-xs-12" style="background-color:whitesmoke;"> <label>Upload Your Photo</label> <input type="file" ng-model="mdphoto" class="for...
2016/12/22
[ "https://Stackoverflow.com/questions/41276708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is an issue with input type file in AngularJs . <https://github.com/angular/angular.js/issues/1375> Try to create your own directive for input type file : See The Solutions -- [ng-model not working with file input](https://stackoverflow.com/questions/35036658/ng-model-not-working-with-file-input)
You cannot get the physical address of the file on your machine. HTML input type file returns file object. You can create a directive for fetching name and size of the file like this, ``` app.directive('fileupload', [function () { return { link: function (scope, element, attrs) { element.on('c...
41,276,708
I am creating a web app in mvc-5 with `angularjs` here I have the following div ``` <div class="row form-clearify" style="margin-top:3px;"> <div class="col-md-6 col-sm-6 col-xs-12" style="background-color:whitesmoke;"> <label>Upload Your Photo</label> <input type="file" ng-model="mdphoto" class="for...
2016/12/22
[ "https://Stackoverflow.com/questions/41276708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is an issue with input type file in AngularJs . <https://github.com/angular/angular.js/issues/1375> Try to create your own directive for input type file : See The Solutions -- [ng-model not working with file input](https://stackoverflow.com/questions/35036658/ng-model-not-working-with-file-input)
i had tired a little with jquery hope this will helps you ```html <!DOCTYPE html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>AngularJS Plunker</title> <script>document.write('<base href="' + document.location + '" />');</script> <link rel="stylesheet" href="style.css" /> ...
689,401
My laptop is Lenovo T400, whose CPU is 64-bit and RAM is 1x2GB. When I bought it, it already had 32-bit Windows 7. Then I partition the hard drive and install 32-bit Ubuntu 12.04 alongside Windows 7. Now I am going to reintall the Ubuntu part from 32-bit 12.04 to 64-bit (possibly the latest version), while still keep...
2013/12/17
[ "https://superuser.com/questions/689401", "https://superuser.com", "https://superuser.com/users/9265/" ]
No steps required really. I would load the system with the memory and then go ahead with the Ubuntu install. Keep in mind that Win 7 and Ubuntu 32 bit will load quite happily with 8 gigs of memory but at the most will only be able to access 4 gigs tops. Consider upgrading your Win 7 to a 64 bit version too - just soun...
No Bios changes required. simply goahead. probably this is the interface you're going to work with ![enter image description here](https://i.stack.imgur.com/uUZEl.png) Just Customize the existing ubuntu partition(meaning just delete and create again) then just press next, next, next and you're there. you don't need ...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
You need to return a `bool` not an `Iterator`. And you are dereferencing the `stop` iterator on the 1st loop iteration, which will be *undefined behavior* if `stop` is the `end` iterator of a container. And there is no need to dercrement the `stop` iterator at all, even though the requirement specifies it as a bidirect...
First of all your function should return `bool` which is `true` or `false`, not iterator. Second - you cannot dereference `stop` as it does not point to an element in the sequence. Third - you either increase `start` or decrease `stop` but not both at the same time. Function could be: ``` template <class Iterator> boo...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
I would use a standard library algorithm for this. By default [`std::adjacent_find`](https://en.cppreference.com/w/cpp/algorithm/adjacent_find) will search for adjacent equal elements but it can also find non-equal elements by changing the comparison function. ``` #include <algorithm> #include <functional> template <...
First of all your function should return `bool` which is `true` or `false`, not iterator. Second - you cannot dereference `stop` as it does not point to an element in the sequence. Third - you either increase `start` or decrease `stop` but not both at the same time. Function could be: ``` template <class Iterator> boo...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
Solution with [`std::all_of`](https://en.cppreference.com/w/cpp/algorithm/all_any_none_of): ``` template <class Iterator> /*constexpr*/ // in C++20 bool all_equal(Iterator begin, Iterator end) { return std::all_of(begin, end, [begin](const auto& e){ return e == *begin(); }); } ```
First of all your function should return `bool` which is `true` or `false`, not iterator. Second - you cannot dereference `stop` as it does not point to an element in the sequence. Third - you either increase `start` or decrease `stop` but not both at the same time. Function could be: ``` template <class Iterator> boo...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
> > You can't dereference back. > > > In C++ we use a 1 past the end notation for our containers. This is reflected in your question. ``` [start, stop) ``` This is mathematical notation. The square bracket `[` means inclusive but the round bracket `')` means not inclusive. So `start` is inside the range and `st...
First of all your function should return `bool` which is `true` or `false`, not iterator. Second - you cannot dereference `stop` as it does not point to an element in the sequence. Third - you either increase `start` or decrease `stop` but not both at the same time. Function could be: ``` template <class Iterator> boo...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
You need to return a `bool` not an `Iterator`. And you are dereferencing the `stop` iterator on the 1st loop iteration, which will be *undefined behavior* if `stop` is the `end` iterator of a container. And there is no need to dercrement the `stop` iterator at all, even though the requirement specifies it as a bidirect...
I would use a standard library algorithm for this. By default [`std::adjacent_find`](https://en.cppreference.com/w/cpp/algorithm/adjacent_find) will search for adjacent equal elements but it can also find non-equal elements by changing the comparison function. ``` #include <algorithm> #include <functional> template <...
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
You need to return a `bool` not an `Iterator`. And you are dereferencing the `stop` iterator on the 1st loop iteration, which will be *undefined behavior* if `stop` is the `end` iterator of a container. And there is no need to dercrement the `stop` iterator at all, even though the requirement specifies it as a bidirect...
Solution with [`std::all_of`](https://en.cppreference.com/w/cpp/algorithm/all_any_none_of): ``` template <class Iterator> /*constexpr*/ // in C++20 bool all_equal(Iterator begin, Iterator end) { return std::all_of(begin, end, [begin](const auto& e){ return e == *begin(); }); } ```
64,973,827
This is the requirement for the code: > > Create a generic function `all_equal(start, stop)` that determines > if the elements in the range `[start,stop)` are all equal. The function returns true or false. If the range is empty, true is returned. The arguments `start` and `stop` are bidirectional iterators. > > > ...
2020/11/23
[ "https://Stackoverflow.com/questions/64973827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14694070/" ]
You need to return a `bool` not an `Iterator`. And you are dereferencing the `stop` iterator on the 1st loop iteration, which will be *undefined behavior* if `stop` is the `end` iterator of a container. And there is no need to dercrement the `stop` iterator at all, even though the requirement specifies it as a bidirect...
> > You can't dereference back. > > > In C++ we use a 1 past the end notation for our containers. This is reflected in your question. ``` [start, stop) ``` This is mathematical notation. The square bracket `[` means inclusive but the round bracket `')` means not inclusive. So `start` is inside the range and `st...
52,039,169
I am trying to plot a simple map in R using function get\_map() for a certain location. Following is my code : e.g. ``` get_map(location = "texas", zoom = 10, source = "google") ``` I've tried different parameters. The error I'm getting is following: ``` Error in aperm.default(map, c(2, 1, 3)) : perm' is of wrong...
2018/08/27
[ "https://Stackoverflow.com/questions/52039169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10087973/" ]
This error occurs due to the base url. In `CRAN version` , the base url is not secure. Use dev version of this package from {github} instead & function runs fine. Use `devtools::install_github(""dkahle/ggmap")` to install library from github
I had the same problem and updating my google api key worked out.
52,039,169
I am trying to plot a simple map in R using function get\_map() for a certain location. Following is my code : e.g. ``` get_map(location = "texas", zoom = 10, source = "google") ``` I've tried different parameters. The error I'm getting is following: ``` Error in aperm.default(map, c(2, 1, 3)) : perm' is of wrong...
2018/08/27
[ "https://Stackoverflow.com/questions/52039169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10087973/" ]
This error occurs due to the base url. In `CRAN version` , the base url is not secure. Use dev version of this package from {github} instead & function runs fine. Use `devtools::install_github(""dkahle/ggmap")` to install library from github
Navigate directly to the URL generated, and you should see a different error message that might be more informative: ``` https://maps.googleapis.com/maps/api/staticmap?center=31,-97&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&key=<INSERT_YOUR_KEY> ``` In my case, it said my API key was not valid for ...
52,039,169
I am trying to plot a simple map in R using function get\_map() for a certain location. Following is my code : e.g. ``` get_map(location = "texas", zoom = 10, source = "google") ``` I've tried different parameters. The error I'm getting is following: ``` Error in aperm.default(map, c(2, 1, 3)) : perm' is of wrong...
2018/08/27
[ "https://Stackoverflow.com/questions/52039169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10087973/" ]
I had the same problem and updating my google api key worked out.
Navigate directly to the URL generated, and you should see a different error message that might be more informative: ``` https://maps.googleapis.com/maps/api/staticmap?center=31,-97&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&key=<INSERT_YOUR_KEY> ``` In my case, it said my API key was not valid for ...
163,843
After 2.5 years working at my current job (programming), I recently came to the conclusion that I want to find a new workplace. Reason for this is solely my boss who (in general has a good heart but) is never satisfied with my work, never shows appreciation, gets angry over almost everything I do (no matter what I do) ...
2020/09/11
[ "https://workplace.stackexchange.com/questions/163843", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/71108/" ]
**No, just give your notice once you have a job.** I think organizations would gain enormously if they welcomed people telling them that they were planning to leave. The knowledge losses are enormous from it. But you have to protect yourself. Your boss might fire you if he thinks you are disloyal. And you probably co...
> > Should I tell my boss or colleagues that I will leave the company? > > > No. Do your job search interview and wait until you have an offer in hand that you are ready to sign. Make sure that factor in your legally required notice time into negotiating the start date of your new job. Maybe you also want to do a...
163,843
After 2.5 years working at my current job (programming), I recently came to the conclusion that I want to find a new workplace. Reason for this is solely my boss who (in general has a good heart but) is never satisfied with my work, never shows appreciation, gets angry over almost everything I do (no matter what I do) ...
2020/09/11
[ "https://workplace.stackexchange.com/questions/163843", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/71108/" ]
**No, just give your notice once you have a job.** I think organizations would gain enormously if they welcomed people telling them that they were planning to leave. The knowledge losses are enormous from it. But you have to protect yourself. Your boss might fire you if he thinks you are disloyal. And you probably co...
> > Since I already know that I will leave as soon as I find a suitable job, this might become a problem. It would make more sense to transfer this project to someone who stays in the company. > > > Frankly, I think you are overestimating how crucial you are to this project. Your managers never took it for granted...
160,107
I am studying spin-spin coupling theory in NMR. Below is an exercise from Mcmurry's organic chemistry. [![cyclohexanol](https://i.stack.imgur.com/zacXW.png)](https://i.stack.imgur.com/zacXW.png) The textbook says that \* stands for chiral center. But is it true? When I searched for it some said that there is no chira...
2021/12/02
[ "https://chemistry.stackexchange.com/questions/160107", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/70497/" ]
The substitution of one of the two hydrogens leads to the *cis* or the *trans* isomer of the disubstituted cyclohexane. Thus, they are certainly diastereotopic. Perhaps, what confused you, as well me in a previous answer focused on 1,3-cyclohexandiol, is that substitution with an OH group leads to two diastereoisomers...
Cyclohexanol does not have a chiral carbon but hydrogen atoms are diasteotopic because the substitution for one of the two hydrogen atoms (in alternate fashion) would give diastereomers, as the $\ce{C-1}$ carbon of cyclohexanol will now become either chiral (for C-2 and C-3 H-substitution) or will have specific cis or ...
26,732,709
I've read some articles on SFINAE, but can't find a solution for my case. Here's what I want to do: ``` #include <type_traits> struct CByteArray {}; struct HLVariant { HLVariant() {} HLVariant(const HLVariant&) {} HLVariant(const CByteArray&) {} }; template <typename T> struct Serializer { stati...
2014/11/04
[ "https://Stackoverflow.com/questions/26732709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634821/" ]
On GAE the [incoming request can not be longer](https://cloud.google.com/appengine/docs/quotas#Requests) than 32Mb. This includes the whole request size (command, path, headers), not only POST body. This is language independent.
As mentioned in Google doc > > Static data limit > In all languages except Go, no single static data file can be larger than 32MB. The limit for Go is 64MB. > > >
32,918,873
I need to change a property on a class a few minutes after it it initialized. I attempted to use `sleep` inside a function but it delayed execution of everything: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end deactivate puts active ``` What I was hoping would happen is `true...
2015/10/03
[ "https://Stackoverflow.com/questions/32918873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653693/" ]
Looks overkill for this task, but you can use [delayed\_job](https://github.com/tobi/delayed_job) to run a task at a future time asynchronously. ``` def deactivate puts 'deactivate' active = false end active = true handle_asynchronously :deactivate, :run_at => Proc.new { 2.minutes.from_now } ```
Well, it seems to me (When I try this code) the active and deactivate is out of order. So why not do this?: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end puts active deactivate ``` It works perfectly.
32,918,873
I need to change a property on a class a few minutes after it it initialized. I attempted to use `sleep` inside a function but it delayed execution of everything: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end deactivate puts active ``` What I was hoping would happen is `true...
2015/10/03
[ "https://Stackoverflow.com/questions/32918873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653693/" ]
Looks overkill for this task, but you can use [delayed\_job](https://github.com/tobi/delayed_job) to run a task at a future time asynchronously. ``` def deactivate puts 'deactivate' active = false end active = true handle_asynchronously :deactivate, :run_at => Proc.new { 2.minutes.from_now } ```
Why not just store the time until it is active? Then there is no need to block, callback or run anything async at all. When you store `active_until` in a datetime column in a database model, then it allows you keep track of changes and keep the current `active` status even over several different requests to the app: ...
32,918,873
I need to change a property on a class a few minutes after it it initialized. I attempted to use `sleep` inside a function but it delayed execution of everything: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end deactivate puts active ``` What I was hoping would happen is `true...
2015/10/03
[ "https://Stackoverflow.com/questions/32918873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653693/" ]
Using @ihaztehcodez's suggestion of a Thread I came up with the simple solution I was looking for: ``` Thread.new do sleep 120 puts 'deactivate' active = false end ``` His warning about persistence doesn't worry me in this case since I am using it for non-critical notifications. If the execution was critical t...
Well, it seems to me (When I try this code) the active and deactivate is out of order. So why not do this?: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end puts active deactivate ``` It works perfectly.
32,918,873
I need to change a property on a class a few minutes after it it initialized. I attempted to use `sleep` inside a function but it delayed execution of everything: ``` active = true def deactivate sleep 120 puts 'deactivate' active = false end deactivate puts active ``` What I was hoping would happen is `true...
2015/10/03
[ "https://Stackoverflow.com/questions/32918873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653693/" ]
Using @ihaztehcodez's suggestion of a Thread I came up with the simple solution I was looking for: ``` Thread.new do sleep 120 puts 'deactivate' active = false end ``` His warning about persistence doesn't worry me in this case since I am using it for non-critical notifications. If the execution was critical t...
Why not just store the time until it is active? Then there is no need to block, callback or run anything async at all. When you store `active_until` in a datetime column in a database model, then it allows you keep track of changes and keep the current `active` status even over several different requests to the app: ...
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
As a good practice, it is better to construct a data object and also include the extra variables. Try constructing a data object and include them ? ``` data = { 'formData': $('#myform').serialize(), 'variable': 'username' } ```
try the query below. username should be a js variable. ``` var username = "myname"; $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize(), username:username }); ```
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
Just add the extra parameter to the serialized string ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize()+'&username='+encodeURIComponent(username) }); ```
try the query below. username should be a js variable. ``` var username = "myname"; $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize(), username:username }); ```
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
As a good practice, it is better to construct a data object and also include the extra variables. Try constructing a data object and include them ? ``` data = { 'formData': $('#myform').serialize(), 'variable': 'username' } ```
Try, ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize(), username: username //you missed the key }); ```
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
Just add the extra parameter to the serialized string ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize()+'&username='+encodeURIComponent(username) }); ```
Try, ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize(), username: username //you missed the key }); ```
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
As a good practice, it is better to construct a data object and also include the extra variables. Try constructing a data object and include them ? ``` data = { 'formData': $('#myform').serialize(), 'variable': 'username' } ```
You can pass it your other variable via get like this. `$.ajax({type:'POST', url: 'submit.php?myvar='+encodeURIComponent(myvar), data:$('#myform').serialize(), username});` You could also add the value to a hidden field in your form.
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
Just add the extra parameter to the serialized string ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize()+'&username='+encodeURIComponent(username) }); ```
You can pass it your other variable via get like this. `$.ajax({type:'POST', url: 'submit.php?myvar='+encodeURIComponent(myvar), data:$('#myform').serialize(), username});` You could also add the value to a hidden field in your form.
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
Just add the extra parameter to the serialized string ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize()+'&username='+encodeURIComponent(username) }); ```
As a good practice, it is better to construct a data object and also include the extra variables. Try constructing a data object and include them ? ``` data = { 'formData': $('#myform').serialize(), 'variable': 'username' } ```
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
As a good practice, it is better to construct a data object and also include the extra variables. Try constructing a data object and include them ? ``` data = { 'formData': $('#myform').serialize(), 'variable': 'username' } ```
Try this ``` $.ajax({ type:'POST', url: 'submit.php', data: { form: $('#myform').serialize(), username: encodeURIComponent(username)} }); ``` check [ajax documentation](http://api.jquery.com/jQuery.ajax/) the part **Sending Data to the Server**
14,285,364
I'm sending data via Jquery Ajax post, I want to send the text box from my form, but also a variable called username. For example... ``` $.ajax({type:'POST', url: 'submit.php', data:$('#myform').serialize(), username}); ``` How can I do this?
2013/01/11
[ "https://Stackoverflow.com/questions/14285364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1559953/" ]
Just add the extra parameter to the serialized string ``` $.ajax({ type:'POST', url: 'submit.php', data:$('#myform').serialize()+'&username='+encodeURIComponent(username) }); ```
Try this ``` $.ajax({ type:'POST', url: 'submit.php', data: { form: $('#myform').serialize(), username: encodeURIComponent(username)} }); ``` check [ajax documentation](http://api.jquery.com/jQuery.ajax/) the part **Sending Data to the Server**
39,488,774
I`m using Bootstrap validator ([Validator plugin](http://1000hz.github.io/bootstrap-validator/#)) to validate my form but I have an input for files which I would like to have a custom validation for filetype and filesize (pdf,docx,doc..). ``` <div class="form-group"> <div class="input-group"> <label class=...
2016/09/14
[ "https://Stackoverflow.com/questions/39488774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4314699/" ]
Code from [here](http://bootstrapvalidator.votintsev.ru/validators/file/) worked for me: ``` <form id="fileForm" class="form-horizontal" enctype="multipart/form-data"> <div class="form-group"> <label class="col-sm-3 control-label">Avatar</label> <div class="col-sm-4"> <input type="file...
Example extracted from: [https://github.com/1000hz/bootstrap-validator/issues/73](https://github.com/1000hz/bootstrap-validator/issues/73#issuecomment-240320633) ```js $('form[data-toggle="validator"]').validator({ custom: { filesize: function ($el) { var maxKilobytes = $el.data('filesize') * 1024 ...
13,184,089
My question is this, I have a query I'm working on and I have some values that are 0. I want to be able to take a value from a previous month that is not zero and put it in place of the zero. See the example below. ``` SELECT item, stock, sold, level, month, year FROM agingdata ...
2012/11/01
[ "https://Stackoverflow.com/questions/13184089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426733/" ]
You can find the previous non-zero level per item (for zero level items) using this query: ``` SELECT find.item, find.month, find.year, result.level FROM AgingData result JOIN ( SELECT original.item, original.month, original.year, max(cast(cast(previous.year as varchar) + '-' + cast(previous.month as varchar) + '-1...
Something along these lines, this only works if the previous month is non-zero.... ``` SELECT cur.Item, CASE WHEN (cur.Stock<>0) THEN cur.Stock ELSE prev.Stock END as Stock, cur.Sold, cur.Level, cur.Month, cur.Year FROM AgingData cur...
57,927,367
I want to change release names like `V.1.0.00` for manual release in Continuous Delivery of Azure DevOps but i can't able to delete or change the naming without this `$(rev:r)`, how can I use a custom name? Default Name: `Release- $(rev:r)` Required Name: `V.1.0.0`
2019/09/13
[ "https://Stackoverflow.com/questions/57927367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11629998/" ]
You can change the naming scheme by editing the release name format mask. When specifying the format mask, you can use the pre-defined variables mentioned in this official [document](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/index?view=azure-devops#how-do-i-manage-the-names-for-new-releases) or ...
You can't. release name must be a **unique** name, therefore Azure DevOps requires you to put `$(rev:r)` in the name, because it's adding a incremental number for each release. Another option is to use `$(Build.BuildNumber)` or `$(Release.ReleaseId)` that are also unique but is not will solve your issue.
57,927,367
I want to change release names like `V.1.0.00` for manual release in Continuous Delivery of Azure DevOps but i can't able to delete or change the naming without this `$(rev:r)`, how can I use a custom name? Default Name: `Release- $(rev:r)` Required Name: `V.1.0.0`
2019/09/13
[ "https://Stackoverflow.com/questions/57927367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11629998/" ]
In the build Pipeline. You can customize how your pipeline runs are named/numbered. Ref : <https://learn.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml> In YAML, this property is called name. Use variables to set your major version, minor version etc and generate the patch ...
You can't. release name must be a **unique** name, therefore Azure DevOps requires you to put `$(rev:r)` in the name, because it's adding a incremental number for each release. Another option is to use `$(Build.BuildNumber)` or `$(Release.ReleaseId)` that are also unique but is not will solve your issue.
57,927,367
I want to change release names like `V.1.0.00` for manual release in Continuous Delivery of Azure DevOps but i can't able to delete or change the naming without this `$(rev:r)`, how can I use a custom name? Default Name: `Release- $(rev:r)` Required Name: `V.1.0.0`
2019/09/13
[ "https://Stackoverflow.com/questions/57927367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11629998/" ]
In the build Pipeline. You can customize how your pipeline runs are named/numbered. Ref : <https://learn.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml> In YAML, this property is called name. Use variables to set your major version, minor version etc and generate the patch ...
You can change the naming scheme by editing the release name format mask. When specifying the format mask, you can use the pre-defined variables mentioned in this official [document](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/index?view=azure-devops#how-do-i-manage-the-names-for-new-releases) or ...
51,779,037
I have read the csv file into a dataframe using Pandas, the csv format is as follows. I would like to put the rows whose “time column information” is between the interval of `6/3/2011-10/20/2011` into another dataframe. How can I do it efficiently in Pandas? [![enter image description here](https://i.stack.imgur.com/S...
2018/08/10
[ "https://Stackoverflow.com/questions/51779037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/297850/" ]
Try using the below snippet, and confirm if this is what you want. ```css .scrolling-wrapper { overflow-x: scroll; overflow-y: hidden; white-space: nowrap; } .card { display: inline-block; max-width: 200px; white-space: initial; } ``` ```html <div class="scrolling-wrapper"> <div class="card">...
You can have `float:left` instead of `display:inline-block` ``` .card { float: left; } ```
518,895
Which one is correct? Can I use both? "I am going to listen and read." "I am going to listen and to read."
2019/11/22
[ "https://english.stackexchange.com/questions/518895", "https://english.stackexchange.com", "https://english.stackexchange.com/users/357181/" ]
Depends on how distinct you want *listen* and *read* to sound. Tying both objects to one infinitive conveys the sense of a single activity, while preceding each object with *to* conveys distinct activities.
It really depends on how you group the *to* and what you intend it to mean. If you are using the phrasal verb "going to" as in: > > What are you going to do when you get there? > > I am [going to] listen and read. > > > But if you are just using the verb "go" as in: > > Why are you going to the exhibition?...
27,395,940
i am using dotnetrdf to write sparql query to get the type, id and explain attributes of an actuator saved in my ontology. im using the following select query. ``` "PREFIX AP0: <http://www.semanticweb.org/faiza/ontologies/2014/10/ActuatorProvider#> " + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-...
2014/12/10
[ "https://Stackoverflow.com/questions/27395940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1333060/" ]
Well you haven't shown a complete example so we can't tell how you display the SPARQL results so it is hard to answer for your specific problem (because you haven't stated one!). However I can attempt to provide some general pointers. The data you are seeing is the full form of the `INode` instances that occur in each...
I got the answer using the following in my query SELECT ?ind (str(?Name) as ?name) (str(?Explain)as ?explain) (str(?id) as ?actid) ``` WHERE {.....}. ```
69,561,130
How to properly save current tabIndex when navigating between pages? (In ideas to make a function that will save the current index in the sessionStorage and retrieve it when the page is mounted) Example: [![enter image description here](https://i.stack.imgur.com/G9vRo.png)](https://i.stack.imgur.com/G9vRo.png) [![e...
2021/10/13
[ "https://Stackoverflow.com/questions/69561130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14955687/" ]
a Simple solution based on the `useRouter` hook: ``` import Link from "next/link"; import { useRouter } from "next/router"; export const MyNav = () => { const router = useRouter(); return ( <ul> <li className={router.pathname == "/" ? "active" : ""}> <Link href="/">API</Link> </li> ...
You can use `withRouter()` library to figure out current URL and match it with the page URL and then add a different class with `border` or `background-color` to differentiate between them --- You can also go with a much easier method and use `:active` and `:visited` selectors of CSS with the `nav-item` class or elem...
13,187,126
I have a `UITabbar` with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using `NSFetchedResultsController`. Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating...
2012/11/01
[ "https://Stackoverflow.com/questions/13187126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/967484/" ]
Try sending `performFetch:` to the `NSFetchedResultsController` in `viewWillAppear:` after you have set its delegate back to `self`.
Instead of setting the `delegate` of the `NSFetchedResultsController` to nil in `viewWillDisappear`, try setting an object of `NSFetchedResultsController` to nil
13,187,126
I have a `UITabbar` with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using `NSFetchedResultsController`. Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating...
2012/11/01
[ "https://Stackoverflow.com/questions/13187126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/967484/" ]
I think you do not have to "suspend" the table view updates. A `UITableView` will anyway only request data from the `NSFetchedResultsController` for *visible* cells. If the the table view is not visible, no updates will be fired. Did you test if inserting events from another controller really takes longer? I doubt it...
Instead of setting the `delegate` of the `NSFetchedResultsController` to nil in `viewWillDisappear`, try setting an object of `NSFetchedResultsController` to nil
13,187,126
I have a `UITabbar` with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using `NSFetchedResultsController`. Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating...
2012/11/01
[ "https://Stackoverflow.com/questions/13187126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/967484/" ]
Try sending `performFetch:` to the `NSFetchedResultsController` in `viewWillAppear:` after you have set its delegate back to `self`.
I think you do not have to "suspend" the table view updates. A `UITableView` will anyway only request data from the `NSFetchedResultsController` for *visible* cells. If the the table view is not visible, no updates will be fired. Did you test if inserting events from another controller really takes longer? I doubt it...
13,187,126
I have a `UITabbar` with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using `NSFetchedResultsController`. Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating...
2012/11/01
[ "https://Stackoverflow.com/questions/13187126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/967484/" ]
Try sending `performFetch:` to the `NSFetchedResultsController` in `viewWillAppear:` after you have set its delegate back to `self`.
What about this crude approach? Not tested it. ``` @property (nonatomic) BOOL bruteForceReload; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.bruteForceReload = NO; } -(void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; self.bruteForceReload = YE...
13,187,126
I have a `UITabbar` with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using `NSFetchedResultsController`. Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating...
2012/11/01
[ "https://Stackoverflow.com/questions/13187126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/967484/" ]
I think you do not have to "suspend" the table view updates. A `UITableView` will anyway only request data from the `NSFetchedResultsController` for *visible* cells. If the the table view is not visible, no updates will be fired. Did you test if inserting events from another controller really takes longer? I doubt it...
What about this crude approach? Not tested it. ``` @property (nonatomic) BOOL bruteForceReload; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.bruteForceReload = NO; } -(void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; self.bruteForceReload = YE...
5,995,954
I would like to do some stuff when a user swipes to the right of a UITableViewCell, so I use ``` - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath ``` However I tried to slide to the right and this didn't get invoked, why is this? All of my UITableView delegates are i...
2011/05/13
[ "https://Stackoverflow.com/questions/5995954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95265/" ]
Do you have a tableView:commitEditingStyle:forRowAtIndexPath: method? To quote Apple: ``` Note: A swipe motion across a cell does not cause the display of a Delete button unless the table view's data source implements the tableView:commitEditingStyle:forRowAtIndexPath: method. ``` And, deleting that method in my ...
Set the property of table view ``` tableView.editing = YES; ```
5,995,954
I would like to do some stuff when a user swipes to the right of a UITableViewCell, so I use ``` - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath ``` However I tried to slide to the right and this didn't get invoked, why is this? All of my UITableView delegates are i...
2011/05/13
[ "https://Stackoverflow.com/questions/5995954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95265/" ]
``` // You missed this? - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (UITableViewCellEditingStyle)tableView:(UITableView *)theTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleDelete; } - (NSString *)...
Set the property of table view ``` tableView.editing = YES; ```
5,995,954
I would like to do some stuff when a user swipes to the right of a UITableViewCell, so I use ``` - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath ``` However I tried to slide to the right and this didn't get invoked, why is this? All of my UITableView delegates are i...
2011/05/13
[ "https://Stackoverflow.com/questions/5995954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95265/" ]
Try adding this method to your tableView delegate methods: ``` - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from t...
Set the property of table view ``` tableView.editing = YES; ```
12,310,238
I have some old mysql\_query queries in my code which i want to convert in to PDO but am struggling to get to work. my original code was: ``` mysql_query("UPDATE people SET price='$price', contact='$contact', fname='$fname', lname='$lname' WHERE id='$id' AND username='$username' ") or die(mysql_error()); ``` now i...
2012/09/07
[ "https://Stackoverflow.com/questions/12310238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644770/" ]
For more information visit this link: **[PHP PDO](http://php.net/manual/en/book.pdo.php)** based on your example, ``` <?php $query = "UPDATE people SET price=?, contact=?, fname=?, lname=? WHERE id=? AND usern...
Note that when working with the mysql driver for PDO you **always** have to [disable emulated prepared statements](https://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php): ``` $dbConnection = new PDO('mysql:dbname=dbtest;host=127.0.0.1;charset=utf8', 'user', 'pass'); $dbConnection->setAttr...
12,310,238
I have some old mysql\_query queries in my code which i want to convert in to PDO but am struggling to get to work. my original code was: ``` mysql_query("UPDATE people SET price='$price', contact='$contact', fname='$fname', lname='$lname' WHERE id='$id' AND username='$username' ") or die(mysql_error()); ``` now i...
2012/09/07
[ "https://Stackoverflow.com/questions/12310238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644770/" ]
For more information visit this link: **[PHP PDO](http://php.net/manual/en/book.pdo.php)** based on your example, ``` <?php $query = "UPDATE people SET price=?, contact=?, fname=?, lname=? WHERE id=? AND usern...
If you're going to use PDO, you need to look at [`prepare()`](http://php.net/manual/en/pdo.prepare.php) and [`execute`](http://www.php.net/manual/en/pdostatement.execute.php) otherwise you're losing the security that PDO is offering and retaining the SQL Injections. So, given your example: ``` $conn = new PDO(/*connec...
12,310,238
I have some old mysql\_query queries in my code which i want to convert in to PDO but am struggling to get to work. my original code was: ``` mysql_query("UPDATE people SET price='$price', contact='$contact', fname='$fname', lname='$lname' WHERE id='$id' AND username='$username' ") or die(mysql_error()); ``` now i...
2012/09/07
[ "https://Stackoverflow.com/questions/12310238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644770/" ]
For more information visit this link: **[PHP PDO](http://php.net/manual/en/book.pdo.php)** based on your example, ``` <?php $query = "UPDATE people SET price=?, contact=?, fname=?, lname=? WHERE id=? AND usern...
Few things you have to be clear while using PDO extension is that there are multiple ways to get things done. The way you are currently using being one of them including few more. However it is always a good idea to [bind parameters](http://www.php.net/manual/en/pdostatement.bindparam.php) separately, because this pr...
12,310,238
I have some old mysql\_query queries in my code which i want to convert in to PDO but am struggling to get to work. my original code was: ``` mysql_query("UPDATE people SET price='$price', contact='$contact', fname='$fname', lname='$lname' WHERE id='$id' AND username='$username' ") or die(mysql_error()); ``` now i...
2012/09/07
[ "https://Stackoverflow.com/questions/12310238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644770/" ]
Note that when working with the mysql driver for PDO you **always** have to [disable emulated prepared statements](https://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php): ``` $dbConnection = new PDO('mysql:dbname=dbtest;host=127.0.0.1;charset=utf8', 'user', 'pass'); $dbConnection->setAttr...
If you're going to use PDO, you need to look at [`prepare()`](http://php.net/manual/en/pdo.prepare.php) and [`execute`](http://www.php.net/manual/en/pdostatement.execute.php) otherwise you're losing the security that PDO is offering and retaining the SQL Injections. So, given your example: ``` $conn = new PDO(/*connec...
12,310,238
I have some old mysql\_query queries in my code which i want to convert in to PDO but am struggling to get to work. my original code was: ``` mysql_query("UPDATE people SET price='$price', contact='$contact', fname='$fname', lname='$lname' WHERE id='$id' AND username='$username' ") or die(mysql_error()); ``` now i...
2012/09/07
[ "https://Stackoverflow.com/questions/12310238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1644770/" ]
Note that when working with the mysql driver for PDO you **always** have to [disable emulated prepared statements](https://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php): ``` $dbConnection = new PDO('mysql:dbname=dbtest;host=127.0.0.1;charset=utf8', 'user', 'pass'); $dbConnection->setAttr...
Few things you have to be clear while using PDO extension is that there are multiple ways to get things done. The way you are currently using being one of them including few more. However it is always a good idea to [bind parameters](http://www.php.net/manual/en/pdostatement.bindparam.php) separately, because this pr...
12,387,645
I've got strange bug on heroku. To reproduce it I have to make big (over few KB) HTTPS POST with any UTF-8 characters in request body. Here is an example: ``` require "net/https" require "uri" #Accutally I've ecountered this bug while posting to another server url = URI.parse("https://api.heroku.com/myapps") #It's U...
2012/09/12
[ "https://Stackoverflow.com/questions/12387645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1083138/" ]
I had to add ruby version into **Gemfile**, as default Cedar's ruby is 1.9.2(which has bug passing UTF-8 strings over SSL) ``` source 'https://rubygems.org' ruby "1.9.3" gem 'rails', '3.2.7' gem 'pg' ... ```
I think, this should works: ``` require "net/https" require "uri" url = URI.parse("https://api.heroku.com/myapps") #It's Ukrainian letter 'soft-G' payload = "ґ"*10000 request = Net::HTTP::Post.new(url.path) request.basic_auth 'youremail', 'yourpassword' request.body = URI.encode(payload) http = Net::HTTP.new(url.host...
11,709,565
I have a class look like below: ``` <?php class theGodFather { public function do() { echo "the movie is nice"; } } $obj = new theGodFather; echo $theGodFather->do; ``` When run I got the error: syntax error, unexpected T\_DO, expecting T\_STRING in /Applications/XAMPP/xamppfiles/htdocs/test/classe...
2012/07/29
[ "https://Stackoverflow.com/questions/11709565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455340/" ]
You cannot use [*keywords*](http://php.net/manual/en/reserved.keywords.php) as names for functions/classes/methods and constants, `do` is one. You can use them as variable names, however.
`do` is a keyword, therefore the interpreter gets very very confused. :( Choose a different function name and it works!
11,709,565
I have a class look like below: ``` <?php class theGodFather { public function do() { echo "the movie is nice"; } } $obj = new theGodFather; echo $theGodFather->do; ``` When run I got the error: syntax error, unexpected T\_DO, expecting T\_STRING in /Applications/XAMPP/xamppfiles/htdocs/test/classe...
2012/07/29
[ "https://Stackoverflow.com/questions/11709565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455340/" ]
you have use do function in class "do" is a keyword of php and you cannot use keyword in function or class try this ``` class theGodFather { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo 'a default value'; } } $obj = n...
`do` is a keyword, therefore the interpreter gets very very confused. :( Choose a different function name and it works!
11,709,565
I have a class look like below: ``` <?php class theGodFather { public function do() { echo "the movie is nice"; } } $obj = new theGodFather; echo $theGodFather->do; ``` When run I got the error: syntax error, unexpected T\_DO, expecting T\_STRING in /Applications/XAMPP/xamppfiles/htdocs/test/classe...
2012/07/29
[ "https://Stackoverflow.com/questions/11709565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455340/" ]
"do" is a keyword (can be used in a do while loop). Also you're echoing a function that returns nothing, but echoes something in it. Rename the "do" function to "echoFunction" or whatever name you choose and then change this: ``` $obj = new theGodFather; echo $theGodFather->do; ``` to: ``` $obj = new theGodFather;...
`do` is a keyword, therefore the interpreter gets very very confused. :( Choose a different function name and it works!
11,709,565
I have a class look like below: ``` <?php class theGodFather { public function do() { echo "the movie is nice"; } } $obj = new theGodFather; echo $theGodFather->do; ``` When run I got the error: syntax error, unexpected T\_DO, expecting T\_STRING in /Applications/XAMPP/xamppfiles/htdocs/test/classe...
2012/07/29
[ "https://Stackoverflow.com/questions/11709565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455340/" ]
You cannot use [*keywords*](http://php.net/manual/en/reserved.keywords.php) as names for functions/classes/methods and constants, `do` is one. You can use them as variable names, however.
you have use do function in class "do" is a keyword of php and you cannot use keyword in function or class try this ``` class theGodFather { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo 'a default value'; } } $obj = n...
11,709,565
I have a class look like below: ``` <?php class theGodFather { public function do() { echo "the movie is nice"; } } $obj = new theGodFather; echo $theGodFather->do; ``` When run I got the error: syntax error, unexpected T\_DO, expecting T\_STRING in /Applications/XAMPP/xamppfiles/htdocs/test/classe...
2012/07/29
[ "https://Stackoverflow.com/questions/11709565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455340/" ]
You cannot use [*keywords*](http://php.net/manual/en/reserved.keywords.php) as names for functions/classes/methods and constants, `do` is one. You can use them as variable names, however.
"do" is a keyword (can be used in a do while loop). Also you're echoing a function that returns nothing, but echoes something in it. Rename the "do" function to "echoFunction" or whatever name you choose and then change this: ``` $obj = new theGodFather; echo $theGodFather->do; ``` to: ``` $obj = new theGodFather;...
8,328
Under Article 5, if one member country is attacked, all member countries may be required to respond with military force. But the U.S. Constitution says we aren't allowed to go to war without Congressional approval. If the United States of America assists another country with military force, would it be acting in violat...
2015/05/25
[ "https://politics.stackexchange.com/questions/8328", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/5703/" ]
Short version... * Only Congress has the Power to declare War. * The military only takes orders from the President. * The money to run the military can only come from congress. In effect, "Declaring War" is not a prerequisite to having a war. If congress doesn't like what the President is doing they can stop funding ...
The premise of the question is wrong: > > Article 5 > > The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individua...
58,925,417
I have a column of names that are in different languages and are entered in different formats. It appears that the English and Mandarin names have "," as a delimiter. The korean names have "." as a delimiter while the Japanese names have both "," and "/" as a delimiter. Am hoping to be able to obtain the New\_Name colu...
2019/11/19
[ "https://Stackoverflow.com/questions/58925417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11918314/" ]
One way is to use `np.select` with conditions base on your `Language`: ``` d = {"Name":["Phillipe, Mr Johnson","李, Mr 永","김두한.Kim Do Han","Amori, Shinji/ あもりさせる / 由紀"], "Language":["English","Mandarin","Korean","Japanese"]} df = pd.DataFrame(d) df["new"] = np.select([df["Language"].isin(["English", "Mandarin"])...
You can split your string using regular expression: ``` import re test_str = 'a,b.c/d,e,f.g/hij.k' print(re.split(r'[,\/.]', test_str)) ``` `r'[,\/.]'` means string of any of the three: `,`, `/` or `.` Output would be: ``` ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'hij', 'k'] ``` Complete example: ``` import re impo...