qid
int64
1
74.7M
question
stringlengths
116
3.44k
date
stringdate
2008-08-06 00:00:00
2023-03-03 00:00:00
metadata
listlengths
3
3
response_j
stringlengths
19
76k
response_k
stringlengths
21
41.5k
63,686,068
The answer might be obvious but I didn't find out. I have this code : ```js const arr = ["Hello"]; let currentStr = arr[0]; currentStr += " world"; console.log(currentStr); // prints "Hello world" console.log(arr); // prints ["Hello"] ``` I just want to copy the string reference so when I change the `currentStr` valu...
2020/09/01
[ "https://Stackoverflow.com/questions/63686068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10458813/" ]
In Javascript strings are immutable. I.e. when you make a change to a string behind the scenes Javascript is making a new copy of that string. Arrays are slightly different. You can mutate arrays. I.e. change what they are storing. To achieve what you want you can use the splice method on the array to replace the 'Hel...
``` const arr = ["Hello"]; var currentStr=[]; let newStr= arr[0]+" World"; currentStr.push(newStr) console.log(currentStr); // console.log(arr); // ```
43,672,826
I am working with Spring Restful and Hibernate. To remove the redundancy in code I want to avoid the object creation of DTO in each and every methods and want to declare it with @Component annotation, I want to know is there any specific rules for DTOs as we have some guidelines for POJO and JavaBeans.
2017/04/28
[ "https://Stackoverflow.com/questions/43672826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831637/" ]
You can use `or` to bypass the `nil` value ``` (> 1 (or (first []) 0)) ``` Because in Clojure, `nil` is treated as a falsy value.
imho you should clearly define the functional objects in your design since you need a functionality: given a collection coll extract the first element or default to 0 then you should have a separate function for that. e.g. ```clojure (defn first-or-zero [coll] (if (seq coll) (first coll) 0)) ``` Although a b...
28,784,375
It seems possible to nest a class in a constructor which can then be instantiated from anywhere within the class, is this official? [EDIT] E.g., ``` class C { constructor() { class D { constructor() { } } } method() { var a = new D(); // works fine } } //var a ...
2015/02/28
[ "https://Stackoverflow.com/questions/28784375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1351235/" ]
No, there are no nested class scopes in ES6, and there is no such thing as private members in the class syntax anyway if you mean that. Of course you can put a second class as a static property on another class, like this: ``` class A { … } A.B = class { … }; ``` or you use an extra scope: ``` var C; { ...
You could use a getter: ``` class Huffman { constructor() { /* ... */ } static get Node() { return class Node { constructor() { var API = this; API.symbol = 0; API.weight = 0; return API; } }; } get Node() { return Huffman.Node; } encode() { /* ... */ }...
43,608,179
I us bootstrap 3.3.7 in my project. I have this html code: ``` <div id="savedQueryEditor" class="panel-group"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title">Existing queries <a class="pull-left" data-toggle="collapse" href="#collapse1"><i...
2017/04/25
[ "https://Stackoverflow.com/questions/43608179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1067943/" ]
Wrap your form controls with `.form-inline` (see <http://getbootstrap.com/css/#forms-inline>): ``` <div class="panel-body form-inline"> <label>Enter new name</label> <input class="form-control" type="text" id="savedQueryFilter" /> <input class="btn btn-default" type="button" id="saveCurrent...
It was because of the input having a `width:100%;` if you remove that like this: ``` .form-control { width:auto !important; } ``` It should work, here is an updated [fiddle](https://jsfiddle.net/DTcHh/32161/)
627,669
As far as i know particle accelerators are the main tools in particle physics for investigating fundamental physics. Is it possible to perform tabletop experiments, like in low energy physics lab, without using colliders for finding new physics beyond the Standard Model? I heard that some precise measurements can do w...
2021/04/07
[ "https://physics.stackexchange.com/questions/627669", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/292924/" ]
Both deal with theory rather than with experiments. The most striking difference is the level of rigour being put in. For example: In theoretical physics you solve differential equations, in mathematical physics you solve them as well, but you also prove that the solution exists and is unique or, if it is not unique, y...
**Mathematical physics** * In the most general sense *mathematical physics* means mathematical methods used in physics (i.e., those parts of mathematics that are actually useful in physics applications). E.g., one may be interested in developing new methods of solving sine-Gordon equation and analyzing its solutions -...
54,545
In version 10 one can define, say, ``` $PlotTheme = "Scientific" ``` Which changes the appearance of all plots. This is fantastic because on the one hand I can have nice plots very easily and globally (i.e. No need to tune every option in `Plot[...]`), and on the other hand when I exchange code with my collaborators...
2014/07/11
[ "https://mathematica.stackexchange.com/questions/54545", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7253/" ]
Basic method ============ There appears to be a mechanism for doing just that, though I have yet to map its capabilities. As a basic example for the time being: ``` Themes`AddThemeRules["wizard", DefaultPlotStyle -> Thread@Directive[{Purple, Orange, Hue[0.6]}, Thick], LabelStyle -> 18, AxesStyle -> White, T...
Illuminated by @Mr.Wizard's answer, here I provide a complete example of a self-made plot theme, called `"Academic"`. It can be used as a base theme. * The axes feature theme is based on the theme `"AxesFrame"` of `"Scientific"` with `{Black, AbsoluteThickness[1], FontSize -> 12}` axes/frames. * The color feature them...
5,492,016
I have an input form on a primefaces dialog and I have server side validation that checks the input fields when the user clicks a `<p:commandButton ajax="false" action="#{bean.validate}"/>`. At the end of my validate I return `null` as to stay on the same page but since this is a dialog it closes. Is there any way ...
2011/03/30
[ "https://Stackoverflow.com/questions/5492016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/581866/" ]
Didn't try it myself, but you could toggle the dialog's visibility depending on the existence of validation messages: ``` <p:dialog visible=”#{not empty facesContext.messages}” ...> ```
I am a Richfaces user, and their modalPanel (the equivalent of `<p:dialog>` offers a `showWhenRendered` attribute that could be helpful in your case. Unfortunately, the [`<p:dialog>`](http://primefaces.prime.com.tr/docs/tag/p/dialog.html) does not seems to have such feature. What you can do, is to play with some JavaS...
41,468,951
I added a project site to my Github project. But some photos are not displaying in the site. Img code: ``` <img src="img/screenshot2.PNG" class="img-responsive" alt=""> </div> ``` folder structure (img is a folder): ``` img Screenshot2.png index.html ``` I tried with `.png` and `.PNG` (some earlier SO answer...
2017/01/04
[ "https://Stackoverflow.com/questions/41468951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3940445/" ]
I had this problem today. I solved it by: * Double-check the `Case Sensitive` of the images (i.e. `Screenshot.png` isn't the same as `Screenshot.PNG` or even `screenshot.png`) * Double-check the `PATH` of the image. For me; It was `../img/myImg.jpg`, and I changed it to `./img/myImg.jpg` to point to the current direct...
I had a similar issue, except I used git-lfs to manage the images. GitHub Pages doesn't support LFS, which will prevent the image from being displayed.
630,516
I have a fileA.txt which looks like this: ``` title trial_exp values Version 1.0 Blank1 0.010 Blank2 0.200 Blank3 0.100 Test_field_Asia 1.500 Test_field_Europe 0.900 Test_field_America 2.0...
2021/01/23
[ "https://unix.stackexchange.com/questions/630516", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/361114/" ]
``` awk -F':?(Header|Detail)Segment:' ' { sumPos=10; for(i=3; i<=NF; i++) { split($i, tmp, ":") for(x in tmp) { sum+=tmp[sumPos]; sumPos+=5 }; gsub(/:|:SubSegment.*/, ",", $i) gsub(/:/, ",", $2) printf("%s,%s%.3d\n", $2, $i, sum) ...
you mentioned "learn" so here is a rather simple awk script which, i think, solves your problem. it is not optimized neither in speed nor in code length but it is hopefully readable. i will try to explain the parts so that you can learn from it. here is the codez: ``` BEGIN { FS=":" OFS="," } { pos=readheader()...
25,232,766
I want to put the transparent light image on background color for making a good effect i don't know why the light image didn't display its what i have done : <http://jsfiddle.net/4pbq2tx8/2/> ``` <!DOCTYPE html> <html> <head> <meta charset=utf-8> <link rel="stylesheet" href="css/styles.css" type="text/css"...
2014/08/10
[ "https://Stackoverflow.com/questions/25232766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3778154/" ]
As I stated [in the comments](https://stackoverflow.com/questions/25232766/why-image-cannot-display#comment39306512_25232766), the reason why your externally 'loaded' image is not showing up in your fiddle is because of the fact that [external resources are only for loading css or javascript files](http://doc.jsfiddle....
The external resource you included is loaded from **another website** `s4.postimg.org/590qvkilp/light.png` ![Screenshot from Chrome](https://i.stack.imgur.com/26Rzh.png) Because the image is not in the **same location** you need to include that full location. ``` background-image: url(http://s4.postimg.org/590qvkilp...
1,350,448
Please let me know how to disable Windows 10 Home in S Mode? Already I followed following steps: Microsoft Store App > In the app, search for "switch out of s mode" On the Switch out of S mode, selected Get button but it says unable to upgrade Try again. Let me know, how to disable Windows 10 Home in S Mode? Regard...
2018/08/19
[ "https://superuser.com/questions/1350448", "https://superuser.com", "https://superuser.com/users/886982/" ]
Try this procedure : 1. Go to Start -> Settings 2. Select Update & Security 3. Select Activation, and then select Go to Store. 4. Select the Get option. 5. Then hit Install when ready to proceed. The process to switch out of S mode is a few seconds. You do not need to restart the PC for it to take effect. If this do...
Make sure you install ALL the latest **Windows** & **Store** updates before trying to switch from S mode. In my case, I got the "Unable to switch out of Windows 10 S mode" error message because I haven't updated Store (it may sound a little mind-bending, **but you update MS Store app from inside Store**).
48,929,382
I have a test which goes: ``` if(variable==SOME_CONSTANT || variable==OTHER_CONSTANT) ``` In this circumstances, on a platform where branching over the second test would take more cycles than simply doing it, would the optimizer be allowed to treat the `||` as a simple `|`?
2018/02/22
[ "https://Stackoverflow.com/questions/48929382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455631/" ]
> > In this circumstances, on a platform where branching over the second test would take more cycles than simply doing it, would the optimizer be allowed to treat the || as a simple |? > > > Yes, that is permitted, and in fact the C# compiler will perform this optimization in some cases on `&&` and `||`, reducing ...
Compilers are *allowed* to optimize short-circuit comparisons into asm that isn't two separate test & branch. But sometimes it's not profitable (especially on x86 where compare-into-register takes multiple instructions), and sometimes compilers miss the optimization. Or if compilers choose to make branchless code usin...
26,665,307
I need to run a multi-line bash command over ssh, all possible attempt exhausted but no luck -- ``` echo "3. All files found, creating remote directory on the server." ssh -t $id@$host bash -c "' if [[ -d ~/_tmp ]]; then rm -rf ~/_tmp/* else mkdir...
2014/10/30
[ "https://Stackoverflow.com/questions/26665307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118211/" ]
Use an escaped heredoc to have its literal contents passed through. (Without the escaping, ie. using just `<<EOF`, shell expansions would be processed locally -- making for more interesting corner cases if you used variables inside your remotely-run code). ```sh ssh "$id@$host" bash <<'EOF' if [[ -d ~/_tmp ]]; then ...
This works for me: ``` ssh [hostname] ' if [[ -d ~/_tmp ]]; then rm -rf ~/_tmp else mkdir ~/_tmp fi ' ```
57,042,363
i'm re-building an app already done in Cordova with HTML5, using Flutter. I need a plugin or a Widget that emulate the popup menu of the notification without change routes. Is there anything? I'll provide a screenshot: [notification menu](http://www.svsoftwares.org/notification.jpg)
2019/07/15
[ "https://Stackoverflow.com/questions/57042363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2429576/" ]
This error indicates that Terraform's `template_file` implementation understood `${ASSUME_ROLE}` as being a template interpolation and so it tried to find an element named `ASSUME_ROLE` in the template `vars` map. It doesn't seem like there are any actual Terraform template sequences in this string, in which case ther...
You probably just need to export your `ASSUME_ROLE` variable. `export` makes variables available in subshells (and `$(echo ${ASSUME_ROLE}...)` is a subshell). Otherwise they are only available in the current context.
3,144,420
> > **Possible Duplicate:** > > [( POD )freeing memory : is delete[] equal to delete ?](https://stackoverflow.com/questions/1553382/pod-freeing-memory-is-delete-equal-to-delete) > > > ``` char* pChar = new char[10]; delete pChar; // this should not work but it has same effect as // delete[], WH...
2010/06/29
[ "https://Stackoverflow.com/questions/3144420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/171180/" ]
It may *appear* to have the same effect, but it does not. If your array type was an abstract data type (i.e. a class) then the destructors on the last nine elements would not have been called.
Because you got lucky. This is undefined behavior. One possibility for undefined behavior is that nothing bad seems to happen, even if something bad really did happen. You might not find out until later. You can't count on being safe with primitive types. Read this (also linked by James Roth in a comment): <https://is...
39,873,279
I want to split background image. For example original image like this [![Original 3D rotated image](https://i.stack.imgur.com/m5psc.jpg)](https://i.stack.imgur.com/m5psc.jpg) and I want an effect like this: [![slit image in 3 and give a thickness effect](https://i.stack.imgur.com/QMFQH.jpg)](https://i.stack.imgur.c...
2016/10/05
[ "https://Stackoverflow.com/questions/39873279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3148644/" ]
**This answer provides single element solutions only** A 2D solution would be to just use the pseudo elements `:before` and `:after` to imitate the gaps. You only need to [position](https://developer.mozilla.org/en-US/docs/Web/CSS/position) them and give them the proper distance to the border with [`calc()`](https://d...
Here is another solution that rely on **one element**. The idea is to use multiple background to create different layers above the intial image in order to: * Create the gap between each part of the image using white color (or same color as the main background). * Create the shadow for each part. * Create the thickne...
8,684,440
I am trying to create a panorama using images with very little overlap, but I know the angle of the camera so I know exactly how much overlap there is and I know the order of the images so I know where each one belongs in the panorama. As a first pass I simply cocantenated the images together but the result is not goo...
2011/12/30
[ "https://Stackoverflow.com/questions/8684440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/398460/" ]
The technique you're looking for is called [Image Registration](http://en.wikipedia.org/wiki/Image_registration) using an Affine Transform. This can be achieved in software by computing the matrix transform for image B that maps it on to image A. I assume you are trying to do this in software using Windows Forms & GDI+...
What you want is referred to as a matrix transformation. [Here](http://www.c-sharpcorner.com/UploadFile/mahesh/Transformations0412192005054803AM/Transformations04.aspx) are some simple examples in C#/GDI+. [MSDN](http://msdn.microsoft.com/en-us/library/cc189037%28v=vs.95%29.aspx) has some more in-depth descriptions. ...
30,780,872
I am trying to read model variable in jquery ready function. ``` var jsNotes1 =@Model.Notes1; ``` when the model.notes1 has an integer value, I was having no issues. But when the model.notes1 has a string value, say for ex: "abcd", the line is getting converted as below ``` var jsNotes1 = abcd ``` and Jquer...
2015/06/11
[ "https://Stackoverflow.com/questions/30780872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3901795/" ]
try to this ``` var jsNotes1 ='@Model.Notes1'; ```
You need to wrap it in quotes as it needs to be treated as a string, otherwise it's invalid JavaScript ``` var jsNotes = "@Model.Notes1"; ```
65,984,055
I'm trying to make some basic number incrementation but I'm getting some weird garbage values. (this works in C# but not in C). Could someone tell me why this is not working? ``` while (1) { int command = 0; printf ("Action: "); scanf ("%d", &command); int countX, countY, countZ = 0; if...
2021/01/31
[ "https://Stackoverflow.com/questions/65984055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14534414/" ]
This: ``` int countX, countY, countZ = 0; ``` Only initializes `countZ` and leaves `countX` and `countY` **uninitialized**. You want: ``` int countX = 0, countY = 0, countZ = 0; ```
If `command` is equal to `0` then you are trying to output uninitialized variables `countX` and `countY` that have indeterminate values. You should initialize them in their declarations like ``` int countX = 0, countY = 0, countZ = 0; ``` And these statements ``` countX++; ``` and ``` countY++; ``` also have ...
18,655,277
I just wanted to know if it is possible to prevent the compilation of angularjs directives ? I use the jQuery Slick Grid plugin to display some datagrids in my website, and I imagined a way to define easily the cells templates with nested directives containing HTML. The problem is that this HTML code is meant to be u...
2013/09/06
[ "https://Stackoverflow.com/questions/18655277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854026/" ]
The function is evaluated to be `celebrityName ("Michael")("Jackson");` Steps : 1. celebrityName ("Michael") returns function lastName(theLastName) 2. ("Jackson") is passed to function lastName 3. function lastName(theLastName) prints the string when executed Arguments from left to right go from outer to inner calle...
With this call ``` var mjName = celebrityName ("Michael"); ``` you create a custom function, which has the `firstName` variable bound to `"Michael"`. This function is returned to you by `celebrityName()`. When you call that returned function again, you bind `lastName` as well, which results in your output. If you ...
8,244,827
This is my code: ``` buttonName = "btn" + y.ToString() + x.ToString(); Control btn = this.Controls.Find(buttonName, true)[0] as Control; btn.BackColor = System.Drawing.Color.Blue; ``` However, I see no border color changing properties, or the like. I used this code because I have a lot of buttons on my form, and an...
2011/11/23
[ "https://Stackoverflow.com/questions/8244827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/865796/" ]
Depending on your framework there is a new property called BorderColor <http://msdn.microsoft.com/en-us/library/system.windows.forms.flatbuttonappearance.bordercolor.aspx>, Have you checked that? Also here is an example of something similar [Change border color of Windows Forms Control on focus](https://stackoverf...
You need to cast your Control as Button (or whatever type it is). Control is a base class, and will not contain properties to modify border colors. Is this a windows app?
4,152,540
I cannot find out what I am doing wrong. So far, I have tested this only in Internet Explorer, so it could be that Firefox and Chrome aren't parsing the code properly. <http://ontwikkelomgeving.wijzijnblits.nl/ginkelbemmelen/luuk/> My problem is that the bxSlider on the page will start approximately 20px to the right...
2010/11/11
[ "https://Stackoverflow.com/questions/4152540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/494779/" ]
Luuk or anyone else, Add ``` style='margin:0 0 0 0;' ``` to the tag at the start of your list of scrolling objects, completely sorted it for me
i had the same problem. for `#slider1`, use `liststyle: none;` worked for me.
64,294,218
My goal is to plot the structure of a questionnaire. For every respondent I have a value giving the question answered plus the answer time: `q1:2,q2:3,q4:4,q10:4` means that the corresponding respondent answered question `q1` first (in 2 seconds), then he answered `q2` (in 3 seconds) and so forth until question `q10`. ...
2020/10/10
[ "https://Stackoverflow.com/questions/64294218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7707288/" ]
Do you mean something like below? ``` do.call( rbind, lapply( strsplit(dat$path, ":\\d+,?"), function(v) data.frame(from = v[-length(v)], to = v[-1]) ) ) ``` which gives ``` from to 1 q1 q2 2 q2 d3 3 d3 q10 4 q10 q4 5 q1 q2 6 q2 q10 7 q10 q4 8 q1 q2 9 q2 d11 ```
Does this answer: ``` > dat %>% mutate(ID = row_number()) %>% + separate_rows(path,sep = ',') %>% + extract(col = path, into = c('ques','number'), regex = '(.*):(.*)') %>% + select(-number) %>% group_by(ID) %>% mutate(from = ques, to = lead(ques)) %>% u...
27,730,389
I am trying to add a row of NAs after each group of data in `R`. A similar question has been asked earlier. [Insert a blank row after each group of data](https://stackoverflow.com/questions/20260458/insert-a-blank-row-after-each-group-of-data). The accepted answer works fine in this case too as follows. ``` group <-...
2015/01/01
[ "https://Stackoverflow.com/questions/27730389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3223138/" ]
You could try ``` df$group <- as.character(df$group) setDT(df)[, .SD[1:(.N+1)], by=group][is.na(xvalue), group:=NA][!.N] # group xvalue yvalue #1: a 16 1 #2: NA NA NA #3: b 17 2 #4: b 18 3 #5: NA NA NA #6: c 19 4 #7: c 20 5 #8: ...
One way I could think of is to construct a vector first as follows: ``` foo <- function(x) { o = order(rep.int(seq_along(x), 2L)) c(x, rep.int(NA, length(x)))[o] } join_values = head(foo(unique(df_new$group)), -1L) # [1] "a" NA "b" NA "c" NA "d" ``` And then `setkey()` and `join`. ``` setkey(setDT(df_new...
54,383,151
I am trying to scrape 2 tables from a webpage simultaneously. BeautifulSoup finds the first table no problem, but no matter what I try it cannot find the second table, here is the webpage: [Hockey Reference: Justin Abdelkader](https://www.hockey-reference.com/players/a/abdelju01/gamelog/2014). It is the table underne...
2019/01/26
[ "https://Stackoverflow.com/questions/54383151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10972931/" ]
Because of javascript loading additional information Today [requests\_html](https://pypi.org/project/requests-html/) can load with html page also javascript content. ``` pip install requests-html from requests_html import HTMLSession session = HTMLSession() r = session.get('https://www.hockey-reference.com/players/a...
The second table seems to be inside a HTML comment tag `<--... <table class=...`. I guess that's why BeautifulSoup doesn't find it.
26,668,434
I am facing problems in rewriting my url. As of now my url is in the form of querystring with parameters passed. Now I want to change that url to a more friendly one . Let me give u an example ``` http://localhost:59423/SomeController/SomeActionMethod?Id=7 ``` to something like ``` http://localhost:59423/SomeContr...
2014/10/31
[ "https://Stackoverflow.com/questions/26668434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3824904/" ]
After many trial and errors I found what I was looking for As I have already mentioned in my question you can add a map.route in the route.config file Something like this ``` routes.MapRoute( name: "SomeName", url: "SomeController/SomeActionMethod/{Id}", defaults: new { control...
By using IIS URL Rewrite you can configure as you required. [URL Rewrite](http://i.stack.imgur.com/LqewG.jpg)
225,242
I have a live usb created from [linuxliveusb](http://www.linuxliveusb.com). I have win 7 installed and have 60 gb of unallocated space. I would like to install my ubuntu (12.04) in a primary partition (since someone instructed me to install my linux in a primary partition, but need your views on this). I have only one ...
2012/12/04
[ "https://askubuntu.com/questions/225242", "https://askubuntu.com", "https://askubuntu.com/users/85326/" ]
From the terminal, run: ``` sudo apt-get purge skype* sudo apt-get autoremove ``` Then you can remove the config files: ``` rm -fr ~/.Skype ``` That should do it.
Yo can try also this: ``` wget -O skype http://download.skype.com/linux/skype-ubuntu_4.0.0.8-1_i386.deb sudo apt-get install libxss1 sudo dpkg -i skype sudo apt-get -f install && sudo rm skype ``` This might work.
29,147,344
I have a column ("E") containing numbers in this format: ``` 879/13 879/2 879/6 ``` I want to split the numbers into two columns. I solved the left side, but the right side is giving me troubles, more specifically numbers with only a single digit after the slash, as they return /Number. How do I fix this? My formul...
2015/03/19
[ "https://Stackoverflow.com/questions/29147344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682879/" ]
change `create` to `generate` ``` mvn archetype:generate -DgroupId=com.di.maven -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false ```
`mvn archetype:create` is deprecated in Maven 3.0.5 and beyond, [as mentioned in the documentation](http://maven.apache.org/archetype/maven-archetype-plugin/create-mojo.html) Use `mvn archetype:generate` instead: > > `mvn archetype:generate -DarchetypeArtifactId=maven-archetype-archetype` > > > This is an intera...
60,400,472
I have a text, which looks like something like this `Test link [linkTest ](https://steamcommunity.com/games/362890/announcements/detail/1716372156964734244)`. And I want to show it in webView or textView like `Test link linkTest`, where linkTest will be clickable (not necessary). How I must parse it? I tried HtmlCompat...
2020/02/25
[ "https://Stackoverflow.com/questions/60400472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10490583/" ]
Try this ``` val textView = TextView(context) textView.text = "This is sample text. https://google.com" textView.autoLinkMask = Linkify.WEB_URLS textView.movementMethod = LinkMovementMethod.getInstance() ```
Does this solve your problem? Give this attribute to your text view in xml file android:autoLink="web"
2,306,756
I am considering the set of all finite and binary strings. In the following I am interested on the number $N(m,k,r)$ of strings with length $m$ and Hamming weight $r$ which do not contain $k$ consecutive zeros. The Hamming weight $r$ is defined as the number of non-zero positions in a string. **Example:** The binary...
2017/06/02
[ "https://math.stackexchange.com/questions/2306756", "https://math.stackexchange.com", "https://math.stackexchange.com/users/431095/" ]
Let $N(m,k,r)$ denote the number of binary strings with length $m$ and Hamming weight $r$ which do not contain zero-runs of length $k$. > > The following is valid for $m\geq 1, k\geq 1, 0\leq r\leq m$ > \begin{align\*} > N(m,k,r)&=\sum\_{j= 0}^{\min\left\{r,\left\lfloor \frac{m}{k}\right\rfloor\right\}}\binom{m-kj}{...
So you are looking for $N(m,k,r)=$ number of binary strings with: *length $=m$, Hamming weight $=$ number of ones$=r$, and which "do not contain $k$ consecutive zeros"*. Taking the complement of the string (exchanging the zeros and ones), that is the same as: *length $=m$, Hamming weight $=$ number of ones$=m-r$...
28,813,473
I'm still very new to Lua and I have a hard time trying to figure out the best approach when registering C functions in Lua, but from a C++ class, when it comes to retrieving the self pointer from an object that was **not** created from Lua. --- Consider the following code: ### foo.h ``` class Foo { public: sta...
2015/03/02
[ "https://Stackoverflow.com/questions/28813473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2065863/" ]
You need to pass some information in the lua state, which will help you identify the "self". For example you can store all created instances of the Foo class in map, associate an instance with some identifier (int id), or just pass the pointer of the instance cast to size\_t. Then in the lua\_DoSomething method, get t...
In member functions of type Foo, the 'this' pointer is provided for you automatically. Its type is of const Foo\*. It is not normally necessary, because in most cases you can just use the member directly. Eg: you can replace: ``` int Foo::lua_DoSomething(lua_State* pState) { this->DoSomething(); return 0; } ``` ...
815,104
> > Find the singular points and determine the type: > > > * $g(z)=\frac{z^2-3z+2}{z^2-2z+1},z\_0=1$ > * $f(z)=\frac{1}{1-\sin(z)}$ > > > For $g$, we have that $$ \frac{z^2-3z+2}{z^2-2z+1}=\frac{z-2}{z-1}=1-\frac1{z-1}=\frac1{(z-1)^0}-\frac1{z-1}$$ And according to the criteria to detrmine what type of singular ...
2014/05/30
[ "https://math.stackexchange.com/questions/815104", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80965/" ]
[Recall](http://en.wikipedia.org/wiki/Catalan_number) the formula of Catalan number $$ \small C\_n=\frac{1}{n+1}\binom{2n}{n} $$ and its generating function $$ \small \sum\_{n=1}^\infty C\_n x^n=\frac{1-\sqrt{1-4x}}{2x}-1 $$ then $$ \small \begin{align} f(x) &=\sum\_{n=1}^{\infty} \binom{2n}{n} \frac{H\_{n+1}}{n+1} x^n...
*Note:* Please note, that this question is strongly related (in fact nearly the same) as [this question](https://math.stackexchange.com/questions/730885). Both questions are (essentially) asking for a generating function of > > \begin{align\*} > A(t):=\sum\_{n\ge1}C\_{n}H\_{n+1}t^n=\sum\_{n\ge1}\binom{2n}{n}\frac{H\_...
3,991,466
The book *Introduction to Analytic Number Theory* by Apostol states in Theorem 5.10 (c): > > The $ m $ residue classes $ \hat{1}, \hat{2}, \dots, \hat{m} $ are disjoint and their union is the set of all integers. > > > The proof goes like this: > > Hence by part (b) the residue classes > $$ \hat{0}, \hat{1}, \h...
2021/01/19
[ "https://math.stackexchange.com/questions/3991466", "https://math.stackexchange.com", "https://math.stackexchange.com/users/23890/" ]
The statement is that the classes $[1], \cdots, [m]$ are disjoint, but the author actually proved that $[0], \cdots [m - 1]$ are disjoint. So to connect these two they observed that $[0] = [m]$ and so the two sets of residue classes are the same.
> > Hence by part (b) the residue classes > $$ \hat{0}, \hat{1}, \hat{2}, \dots, \widehat{m - 1} $$ > are disjoint. But every integer $x$ must be in exactly one of these classes because $ x = qm + r $ where $ 0 \le r < m $, so $ x \equiv r \pmod{m}$ and hence $ x \in \hat{r} $. Since $ \hat{0} = \hat{m} $ this proves ...
1,681,495
Let $$\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}}\int\limits\_{0}^x e^{-t^2}dt$$ be the error function. Then, I have tow questions. 1. For a positive integer $n$, is there a close-form solution of $f\_n=\int\_{0}^\infty 1- (\mathrm{erf}(x))^n dx$? 2. Is there a positive $c<\infty$ such that $\lim\limits\_{n\to\infty}\frac...
2016/03/03
[ "https://math.stackexchange.com/questions/1681495", "https://math.stackexchange.com", "https://math.stackexchange.com/users/319603/" ]
To provide motivation for what follows, let's begin with the $n=1$ case. --- $$n=1$$ ------- Here we wish to evaluate $$I\_1 = \int\_0^{\infty} dx\, \left (1-\operatorname{erf}{x} \right ) $$ where $$\operatorname{erf}{x} = \frac{2}{\sqrt{\pi}} \int\_0^x dt \, e^{-t^2} = \frac{2}{\sqrt{\pi}} x \int\_0^1 dt \, e^...
Here is a partial answer: For $n=3$ and $n=4$, closed-form solutions exist, according to Ng and Geller (A Table of Integrals of the Error Function. II. Additions and Corrections, Journal of Research of the National Bureau of Standards, Vol. 75B, 1971, pp. 149-163; see $\S3.7$, Eqs. 21 and 22, p. 158), $$f\_3={6\over\...
50,086,590
I have two js files. 1.Talker.js 2.Button.js **Talker.js** ``` import React from 'react'; import ReactDOM from 'react-dom'; import { Button } from './Button'; class Talker extends React.Component { talk() { let speech = ''; for (let i = 0; i < 10000; i++) { speech += 'blah '; } alert(spee...
2018/04/29
[ "https://Stackoverflow.com/questions/50086590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9717314/" ]
Cause Button does never call `talk`. If you would accept it as a button property, e.g.: ``` export class Button extends React.Component { render() { return <button onClick={this.props.talk} >Click me!</button>; } } ``` Then passing `talk` will fail, as `talk` is undefined and that cant be called. So ...
Are you sure `<Button talk={talk} />;` works? Because `talk` is undefined there so I'm a bit confused. It shouldn't work.
43,355,292
So I am using python in order to automate some repetitive tasks I must do in excel. One of the calculations I need to do requires the use of yearfrac(). Has this been replicated in python? I found [this](https://lists.oasis-open.org/archives/office/200804/msg00085.html) but it is incorrect for the value I tried. (Fro...
2017/04/11
[ "https://Stackoverflow.com/questions/43355292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7758051/" ]
I found [an e-mail thread from actual Office developers](https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html) providing a VBA implementation of the `YEARFRAC` algorithm. ```vb Public Function FIsLeapYear(Year As Integer) As Boolean If (Year Mod 4) > 0 Then FIsLeapYear = False Else...
``` import datetime def IsLeapYear(year): if year % 4 > 0: IsLeapYear = False elif year % 100 > 0: IsLeapYear = True elif year % 400 == 0: IsLeapYear = True else: IsLeapYear = False return IsLeapYear def IsEndOfMonth(day, month, year): if month in [1,3,5,7,8,10,...
282,603
I need to sort a list of TikZ coordinates, first by increasing X coordinate and then by increasing Y coordinate. At the moment I do this by invoking an external Python shell, but it would be nicer to be able to do it entirely in LaTeX. Below is a minimal working example to illustrate: ``` \documentclass{article} \de...
2015/12/11
[ "https://tex.stackexchange.com/questions/282603", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/2634/" ]
Update adds variant handling dimensional coordinates. This is the adaptation of "code 4" from <https://tex.stackexchange.com/a/273084/4686> I initially was going to to the Merge Sort ("code 6" from the link above), but `(` is handled especially by `\pdfescapestring`, and spaces too, and thus opted for "code 4". This ...
Package `forest` implements a quicksort algorithm that you could use. It is described in section 8.2 of the manual (the implementation part). To use the `\forest@sort` macro, one must define two macros: 1. A macro that sorts two items: below, `\sortcoordinates`. 2. A macro that copies (in the sense of `TeX`s `\let`) ...
45,531,446
I was trying sample code and some got result which I don't understand: ``` Map<Integer,Integer> map = new HashMap<>(); map.put(1, 2); System.out.println(map.get(1)); Integer k = map.get(1); k++; System.out.println(map.get(1)); ``` The result: ``` 2 2 ``` But as Integer is an object, the change should get r...
2017/08/06
[ "https://Stackoverflow.com/questions/45531446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4702388/" ]
`Integer` is immutable, and `k++` doesn't change the value of the `Integer` stored in the `Map`. It create a new `Integer` instance. You should put the new value in the `Map` in order for the `Map` to be modified: ``` Map<Integer,Integer> map = new HashMap<>(); map.put(1, 2); System.out.println(map.get...
Misconception on your end: Integer is immutable! That means that k++ creates a new Integer object. It is impossible to change the value of an existing Integer object!
47,786,024
Example: Here is binary numbers array: `a = [001, 010, 100, 011, 101, 110, 111, 1000, 1001, 1010]` I want output like below: `[ [ 001, 010, 100, 1000 ], [ 011, 101, 110, 1001, 1010 ], [ 111 ] ]` Can anybody help me how to achieve it in ruby?
2017/12/13
[ "https://Stackoverflow.com/questions/47786024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5883397/" ]
I'm going to assume you're working with strings (`"001"`) and not decimal/octal literals (`001`). If that's not the case, I strongly suggest casting to strings to make things easier on you. We can count the number of ones in a string `x` with `x.count('1')`. Then we can take a list of strings and organize it by this v...
Using `Enumerable#group_by`, as @Silvio has done, seems the most direct way to solve this problem, but here are a couple of other approaches one could use. ``` a = "001, 010, 100, 011, 101, 110, 111, 1000, 1001, 1010".split(', ') #=> ["001", "010", "100", "011", "101", "110", "111", "1000", "1001", "1010"] ``` **C...
136,161
I'm using Samsung Galaxy S4 on Android 5.1 Lollipop. I found Google Now in settings and I decided to check what is it. Now settings interface has changed and I don't know how can I replace Google Now back to TouchWiz.
2016/02/04
[ "https://android.stackexchange.com/questions/136161", "https://android.stackexchange.com", "https://android.stackexchange.com/users/77672/" ]
If you're on 5.1, it could be: System Settings --> Default Applications --> Home. Select touchwiz and press the home key. Hope this helps.
Uh, I'm not entirely sure what the question is so just tell me if I'm wrong. If you pull up Google Now launcher under the apps section of settings there should be a button titled "clear defaults." If you select this it should ask you which launcher you want to use next time you close an app. You can also install a diff...
31,482,442
I would like to extract the variance-covariance matrix from a simple `plm` fixed effects model. For example: ``` library(plm) data("Grunfeld") M1 <- plm(inv ~ lag(inv) + value + capital, index = 'firm', data = Grunfeld) ``` The usual `vcov` function gives me: ``` vcov(M1) lag(inv) ...
2015/07/17
[ "https://Stackoverflow.com/questions/31482442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1705044/" ]
I think you have it backwards: ``` UserNotifier.signup_email(user).delay.deliver ``` should be ``` UserNotifier.delay.signup_email(user) ```
When you use Delayed\_job you'll can access `.dealy` method and then you can put the action mailer method like `.deliver_later` to delay sending of emails. Simply way to add delayed\_job in your project: 1. Add in your Gemfile: `gem "delayed_job_active_record"` `gem "daemons"` Create the file "config/initializer...
39,022,305
I am trying to run a C++ app (under Linux) from another directory. The app is supposed to read some files in the directory where it is. Let's assume the executable is in ``` /opt/app/proj/ ``` All files to read by the app are in the same directory if I run the code from this directory, everything runs fine. but if ...
2016/08/18
[ "https://Stackoverflow.com/questions/39022305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6699414/" ]
Starting a new process on Linux is, roughly, a two step process: 1. The `fork()` system call. 2. The child process executes the `exec()` system call. To start the new process from a different directory, just have the child process `chdir()` to the directory, before executing the `exec()` system call. If you are usin...
Thanks very much for your input. Actually my code worked, it just that I was trying to read from the config file before doing this process above. My mistake. Though, I tried to have a look at your propositions to know better about C programming. Thanks again!
65,974,957
This is the dataframe that I'm using: <https://www.kaggle.com/spscientist/students-performance-in-exams> It contains the following columns (That I want to use): 1. Race/Ethnicity (String: GROUP A, GROUP B, GROUP C...) 2. Math Score (Numeric: 60, 70, 80...) 3. Reading Score (Numeric: 60, 70, 80...) 4. Writing Score (N...
2021/01/31
[ "https://Stackoverflow.com/questions/65974957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13561114/" ]
* Addressing *I would prefer to use seaborn*: `seaborn` is just a high-level API for `matplotlib`. * There are two easy ways to generate the desired grouped plot 1. Groupby and plot the grouped dataframe + The OP already has grouped the dataframe, but should not have reset the index 2. Stack the dataframe from a wi...
I would reform your data so it works easier with `catplot`: ``` df3 = df.groupby('race/ethnicity')[['math score', 'writing score', 'reading score']].mean().reset_index() df_scores = pd.DataFrame(columns=["Score", "Subject", "Race/Ethnicity"]) for subject in ["math", "reading", "writing"]: df_tmp1 = pd.DataFrame({...
8,276,811
I want to trigger the onkeydown event on the html page to do some actions. I have the following code: ``` document.onkeydown = function(){ alert('dd'); }; ``` Is it possible to trigger this event on whole page or is it limited to only editable html elements?
2011/11/26
[ "https://Stackoverflow.com/questions/8276811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1005025/" ]
You can just call ``` document.onkeydown(); ```
You can trigger event on body tag ``` <html> <head> <script type="text/javascript" language="JavaScript"> function changeVal() { alert('d'); } </script> </head> <body onKeyDown="changeVal();"> <form action="" method="POST" id="myForm"> ...
22,036,201
I developed a game like "towerDefence" in android using AndEngine. it's like alies are attacking on moument and we have to put weapons on different positions. it contains around 20 levels. bot now my problem is when i play 3 to 4 level continusly my game colsed automatically without giving any error message or any erro...
2014/02/26
[ "https://Stackoverflow.com/questions/22036201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3132159/" ]
You can measure the distance between your "hardcoded" location and current users location with following: ``` CLLocation *hardcoded_location = [[CLLocation alloc] initWithLatitude:latitude1 longitude:longitude1]; CLLocation *new_location = newLocation; CLLocationDistance distance = [hardcoded_location distanceFromLoc...
This code will be use full for solving your problem. ``` CLLocation *currentLocation = newLocation; if (currentLocation != nil) NSLog(@"longitude = %.8f\nlatitude = %.8f", currentLocation.coordinate.longitude,currentLocation.coordinate.latitude); // stop updating location in order to save battery power [locatio...
112
Here's an old puzzle I found in a book once. > > A box has some number of locks on it. It is guarded by a Grand Vizier and four slaves, each of which hold keys to the locks. > > > The Grand Vizier and slaves each hold a different set of keys to the locks, and each key they hold opens a different lock. > > > The k...
2014/05/15
[ "https://puzzling.stackexchange.com/questions/112", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/-1/" ]
The best solution I've found has 7 locks. The Grand Vizier has keys 1, 2, 3, 4, 5, 6. Slave 1 has keys 1, 2, 3, 7. Slave 2 has keys 1, 4, 5, 7. Slave 3 has keys 2, 4, 6, 7. Slave 4 has keys 3, 5, 6, 7. --- A couple of things simplify the deduction of this puzzle: * If the Grand Vizier has every key but one, and...
The question doesn't place any constraints on the design of the box, so we can exploit that to get a **6-lock** solution. So we can either handle the two use cases with two lids, each covering half of the top of the box, or we can have one lid with a set on locks on one side and a set of locks on the other side, such ...
10,444,859
So, I'm trying to do something REALLY simple; alter a table and add a foreign key constraint. Problem is it's throwing me an error, something about the column's collation not matching: Column blah is not of same collation as referencing column blah in foreign key blah. I don't understand this and I've looked everywhe...
2012/05/04
[ "https://Stackoverflow.com/questions/10444859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945604/" ]
When attempting to compare two strings in SQL Server, the collations must match, otherwise you get this error. Collation tells SQL Server how to compare strings (i.e. CHAR, NCHAR, VARCHAR, NVARCHAR). The collation Latin1\_General\_CI\_AS uses the Latin1\_General character set, case insensitive, accent sensitive. Some ...
It seems as if the two tables or the two fields (foreign key - primary key) have different collations. Can you give us some more information? 1. Can you confirm the collation on the database? 2. Can you confirm the collation on the foreign key field as well as the primary key on the referenced table? 3. Are you using ...
22,866,408
My app is able to successfully register for push notifications but I would like to move the pop-up alert to a different area of the app If I implement the same code from `AppDelegate.m` to a different screen, `Other.m`, of my app, it never registers: ``` -(void)buttonTapped { // Register for Push Notifications ...
2014/04/04
[ "https://Stackoverflow.com/questions/22866408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300129/" ]
Yes, of course. You can register wherever you want with using ``` [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; ``` but didRegisterForRemoteNotificationsWithDeviceToken:deviceToken is onl...
``` -(void)application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken ``` This is the protocol method of the UIApplicationDelegate protocol, so it will be triggered on [UIApplication sharedApplication].delegate. This is the AppDelegate by default.
297,216
I have inherited an environment where many things don't make sense and I am now in charge of making changes to it and for this I have to understand what the hell is going on before I modify. Long story short - there is an email server on the LAN and a firewall on the WAN. The WAN IP of the firewall ends in .89. The A ...
2011/08/03
[ "https://serverfault.com/questions/297216", "https://serverfault.com", "https://serverfault.com/users/88705/" ]
Your ISP has configured their routing so that any traffic for your assigned netblock (.89-.93) is sent to .89.
How about the MX record? Is it possible that this one points to a host that instead has an A record of .89? Then everything is fine and you can forget about the A record of the domain.
20,528,196
I am creating a bot that you can talk to. I am using if functions to check if certain words are used and therefore have a reply. I do this inside of a function and use return to print the reply. If two things are said I want it to be able to say both of them, the problem is once I've returned a reply the function doesn...
2013/12/11
[ "https://Stackoverflow.com/questions/20528196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3087684/" ]
Instead of returning immediately, collect your responses in a list, then return that list at the end: ``` def reply(x): responses = [] if any(item in x for item in thanks): responses.append("It's my pleasure\n") if any(item in x for item in greetings): responses.append("How are you?\n") ...
> > Is there a way I can return a value and then carry on? > > > Yes! Most languages can't do this, but Python can. Just `yield` instead of `return`ing. That gives up a value, but lets your function keep running. Here's an example: ``` def return_some_values(zero, one, two): if zero: yield 0 if on...
18,750,179
Is it possible? The `git update-index --assume-unchanged` is no solution, ignored files have to be tracked. Creating submodules either. E.g. *cat .customgitignore(1|2|3...)* ``` i-do-not-need-this.extension ``` *cat .gitignore* ``` basic-stuff.extension <load> .customgitignore1 <load> .customgitignore2 <load> .cu...
2013/09/11
[ "https://Stackoverflow.com/questions/18750179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843528/" ]
> > I am trying to omit conflicts in gitignore file > > > Then don't version the final .gitignore file itself: generate it on demand. Keep your .gitignore files separates, but add a [content filter driver](https://stackoverflow.com/a/2316728/6309) (a `smudge` script), which will: * [detect the content](https://s...
As Git doesn't support this out of the box, you may implement one yourself with Git hooks, for example: In any case, you will need to manage your ignores and includes in a custom file, not a `.gitignore` itself, as this one will be generated. So, let's say, you have a `.gitignoreincludes` file in a branch, and custom ...
31,947,827
I have a "`User`" class with 40+ private variables including complex objects like private/public keys (QCA library), custom QObjects etc. The idea is that the class has a function called `sign()` which encrypts, signs, serializes itself and returns a `QByteArray` which can then be stored in a SQLite blob. What's the ...
2015/08/11
[ "https://Stackoverflow.com/questions/31947827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5155862/" ]
> > Could it be casted to a char array? > > > No, because you'd be casting `QObject`'s internals that you know nothing about, pointers that are not valid the second time you run your program, etc. TL;DR: Implementing it manually is OK for explicit data elements, and leveraging metaobject system for `QObject` and ...
Binary dump serialization is a bad idea, it will include a lot of stuff you don't need like the object's v-table pointer, as well as other pointers, contained directly or from other class members, which make no sense to be serialized, since they do not persist between application sessions. If it is just a single class...
45,967,457
While the dataframe.describe() is useful for some summary descriptive statistics - specifically quartiles and range values - it apparently does not have a cardinality count option? What are the options - or alternatively *approaches* - for obtaining cardinality counts in the dataframe - potentially by supplying a list...
2017/08/30
[ "https://Stackoverflow.com/questions/45967457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1056563/" ]
You can count the distinct values of the dataframe series. This will give you the column name and the cardinality. For example for the dataframe: ``` names = pd.Categorical(['Tomba', 'Monica', 'Monica', 'Nancy', 'Neil', 'Chris']) courses = pd.Categorical(['Physics', 'Geometry', 'Physics', 'Biology', 'Algebra', 'Algebr...
Alternatively, you can use [value\_counts](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.value_counts.html). Here is an example. ``` import pandas as pd names = pd.Categorical(['Tomba', 'Monica', 'Monica', 'Nancy', 'Neil', 'Chris']) courses = pd.Categorical(['Physics', 'Geometry', 'Physics'...
28,049,610
I'm new to mongodb and trying figure out how to efficiently query on each item within a collection. I have `projects` collection & `tasks` collections ``` //projects { _id: ObjectId(), name: String } //tasks { _id: ObjectId(), projectId: ObjectId(), //reference project id completed: Bool } ``` I woul...
2015/01/20
[ "https://Stackoverflow.com/questions/28049610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/878286/" ]
Whatever way you look at this, as long as you have a normalized relationship like this then you would need two queries to get a result containing details from the "tasks" collection and filling out with details from the "projects" collection. MongoDB does not use joins in any way, and mongoose is no different. Mongoose...
When you need to group or count things in MongoDB then you often need to use the [aggregation framework](http://docs.mongodb.org/manual/aggregation/#aggregation). Here is how to count your data in the shell: ``` db.tasks.aggregate([ {$group: { _id: {projectID: "$projectID", completed: "$completed"}, count: {$sum: ...
29,929,940
I have a stored procedure which returns `maxNum`. I can see the return value in the debugger: `maxNum[0]` has the value. I saw it in the debugger. ``` IEnumerable<int?> maxNum = DB.uspGetNextTestNumber(); ``` How to read the value from it. The above code is calling a stored procedure from ADO.NET Entity model. ASP...
2015/04/28
[ "https://Stackoverflow.com/questions/29929940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4826175/" ]
Initial Response ---------------- I ask you about the data, in order to answer your Question, but you keep telling me about the process. No doubt, that is very important to you. And now you wish to ensure that the Record Filing System is correct. Personally, I never write a line of code until I have the database desi...
It all depends on the relationships (one-to-one, one-to-many, many-to-many) your data is going to have. The way you implemented your charts table indicates that: * Each chart has only/belongs to one song * A song can have many charts It is a one-to-many relationship. And if that was what you intended then everything...
74,976
There are good and bad choices available for the design of my system and MySQL seems to be the best available. I need it to run client/server and support stored procedures & triggers and a host of other features. But I also need a database that will run single-user on mobile devices when off-line, then synchronize with...
2014/06/27
[ "https://android.stackexchange.com/questions/74976", "https://android.stackexchange.com", "https://android.stackexchange.com/users/64985/" ]
A [search for "mysql"](http://www.appbrain.com/search?q=mysql) on the stores can answer this: there are several packages available, usually together with a web server and PHP. Best candidates are probably [AndroPHP](https://play.google.com/store/apps/details?id=com.ayansoft.androphp) and [Palapa](https://play.google.co...
This is a Free and very lite [Mysql Server for Android](http://solusiprogram.com/mysql-server-android/) that * support all cpus (armv6, armv7, armv8/aarch64, and x86). * no root needed * support Innodb
17,978,837
I'm trying to create a legend that will contain the color of the line it corresponds to and the label. My current code is plotting the legend but is only plotting the first letter of the label (D instead of DL11). I'm wondering how I can get my plot to stop truncating the label. I'd like to be able to add more lines an...
2013/07/31
[ "https://Stackoverflow.com/questions/17978837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2442384/" ]
You have hit an interesting un-packing issue. Either ``` plt.legend() ``` or ``` plt.legend(('DL11',)) # <- note the comma ``` will get the desired result. To understand why it does this, see the code at <https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L422> calling `plt.l...
I believe pyplot expects a list of legends. For a one-item list, like yours, just ``` pyplot.legend(['DL11']) ``` My guess is that pyplot.legend('DL11') gets the list's first item, that is 'D'. Hope it helps
44,636,470
I have this in my header file: ``` const char * keyBoard(); ``` And in one of my C files the function is this: ``` const char * keyboard() { //mycode return string; } ``` I get this error with my compiler: ```none error: conflicting types for 'keyBoard' const char * keyBoard(char hintTxt[30], in...
2017/06/19
[ "https://Stackoverflow.com/questions/44636470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7676183/" ]
Add this line to your css: ``` word-wrap:break-word; ``` I hope it works.
You need you use `overflow:hidden;` to make sure not going out.
10,651,235
I created a application with a drop down arrow, but the size of the arrow is too small. So I decided to enlarge the size of the arrow. I need to add an image instead of arrow. Is it possible to add image or resize the arrow? My current CSS is below. ``` .custom-select:after { content: "â–¼"; content...
2012/05/18
[ "https://Stackoverflow.com/questions/10651235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1324068/" ]
Try this solution, worked for me and looks very nice. It's vital to wrap your element inside the div, and then apply formatting. Also, make sure that your arrow picture has a transparent background (or at least the same background color as the dropdown you're using). The ".drop\_list select" CSS may look a bit heavy,...
Use this: ``` <label>Arrow code/image</label> ```
49,655,478
Trying to compile this sample of code: ``` var c = new CSharpCodeProvider(); var cp = new CompilerParameters(); var className = $"CodeEvaler_{Guid.NewGuid().ToString("N")}"; // doesn't work with or without netstandard reference var netstandard = Assembly.Load("netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyTo...
2018/04/04
[ "https://Stackoverflow.com/questions/49655478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3351435/" ]
I had the same problem with .NetCore 2, but with a bigger CodeDOM project. My solution I am right now building is generating the source from CodeDom and then passing it to Roslyn. (As Roslyn was mentioned in a comment, but only a .NET Framwork solution was posted) Here is a good example how to use Roslyn - just add th...
In my case I was migrating a project from `.NET Framework 4.7.2` to `.NET Standard 2.0`. In this project I have code to generate an assembly during runtime by using `CSharpCodeProvider`. Could compile the project but then during runtime my code threw an exception when generating an assembly from Dom. I got this error: ...
45,267,373
I want to read html file name from directory without any database. I have a code and its working properly, but two blank name it is giving, while I have only 4 file in directory. ``` <?php if (is_dir('dir')) { if ($dh = opendir('dir')) { while (($file = readdir($dh)) !== false) { echo "filename:".$file."...
2017/07/23
[ "https://Stackoverflow.com/questions/45267373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3526766/" ]
. is for current dir .. is for one directory up When using readdir you will get those 2 extra. I prefer using glob(). That function lets you filter for html files only too ``` <?php $files = glob('dir/*html'); foreach($files as $file) { echo "filename:".$file."<br />"; } ?> ```
Alternatively you could use [FilesystemIterator](http://php.net/FilesystemIterator "FilesystemIterator") which would skip the dot files by default: ``` $it = new FilesystemIterator('dir'); foreach ($it as $fileinfo) { echo $fileinfo->getFilename() . "<br/>"; } ``` more answers in stackoverflow: [What exactly ar...
32,436,274
I'm studying the classification based on sparse coding and dictionary learning. I've read many documents but couldn't find an easy-to-understand one. As I understand, it's based on an optimization problem: [![enter image description here](https://i.stack.imgur.com/9R5n8.jpg)](https://i.stack.imgur.com/9R5n8.jpg) What'...
2015/09/07
[ "https://Stackoverflow.com/questions/32436274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2241766/" ]
[It's just definition of Mean-Squared Error](https://rorasa.wordpress.com/2012/05/13/l0-norm-l1-norm-l2-norm-l-infinity-norm/)
The subscript 2 means it's a l2 or Euclidean norm. [See here for detailed explaination](https://en.wikipedia.org/wiki/Norm_(mathematics)). [This](https://www.cs.ubc.ca/~schmidtm/MLRG/sparseCoding.pdf) is an high-level overview of sparse coding,
49,082,920
**Problem statement**: Two input string with styling like strong,li,ol,line-through etc in HTML. In the screen, there should be two box : Original Text & Edited Text. If any text of original Text is missing in Edited Text then it should highlight that word in red colour. If he has added anything in Edited Text which is...
2018/03/03
[ "https://Stackoverflow.com/questions/49082920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8884592/" ]
``` <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <style> html, body { font: normal 14px/1.4 sans-serif; ...
It may be easier for you to manually compare the strings of HTML code by splitting the text into string arrays (split by char ' '). For example, for part 1 of your problem, you could compare words (string arrays) and add in a span with class highlightRed to make the background red. Example: <https://codepen.io/vck30...
58,814,248
I checked this [question](https://stackoverflow.com/questions/24342047/count-consecutive-occurences-of-values-varying-in-length-in-a-numpy-array) and others on SO but the trick is always summing True or False values. My case is the following array : ``` arr = [1,2,3,3,4,5,6,1,1,1,5,5,8,8,8,9,4,4,4] ``` I want to ge...
2019/11/12
[ "https://Stackoverflow.com/questions/58814248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2085438/" ]
Iterate through `resultData` and parse. ``` private void getVendorsList(JsonObject body) { JsonArray jsonArray = body.getAsJsonArray("data"); List<VendorModel> vendorModelList = new ArrayList<>(); if(jsonArray != null) { for (int i = 0; i < jsonArray.size(); i++) { JsonObject dataObject...
Complete solution using gson: ``` public class SOActivity extends AppCompatActivity { String TAG = "StackOverflow"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_so); String jsonStr = "{\"$type\":\"VerteSearch.Core.Mod...
9,631,155
I am trying to allow access to every subdomain on my site in order to allow cross subdomain AJAX calls. Is there a way to specify all subdomains of a site like `*.example.com` or alternatively, why does the following not work when I have more than one domain listed: ``` header('Access-Control-Allow-Origin: http://api....
2012/03/09
[ "https://Stackoverflow.com/questions/9631155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1046010/" ]
Here's how I did it. The `Origin` header is specified by the browser and will contain the domain that requested the script on the other domain: ``` Origin: http://www.websiteA.com ``` Therefore you can "whitelist" multiple domains in your server-side script: ``` $allowedOrigins = [ "http://www.websiteA.com", ...
``` //Function to be called first in php file. function CORS_HEADERS_HANDLER(){ if (isset($_SERVER['HTTP_ORIGIN'])){ switch($_SERVER['HTTP_ORIGIN']){ //Handle an IP address and Port case 'http://1.2.3.4:4200': header('Access-Control-Allow-Origin: http://1.2.3.4:4200'); break; ...
10,089,626
When I try to run Gestures Builder I get the following error: **Could not load/mnt/sdcard/gestures. Make sure you have storage available.** * How can I fix this problem? * When I add a gesture, where is it saved? * How can I create multiple gestures under the same name? I want to map several gestures to the same Arab...
2012/04/10
[ "https://Stackoverflow.com/questions/10089626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1287240/" ]
Just create an emulator that has an SD card, and that will solve your problem. See picture attached.![Picture](https://i.stack.imgur.com/GrgPy.png)
Do you dw gesture builder ? I think that it is coming with the emulator .. O\_o And you must create in the emulator and then you can access it from code. [Gestures](http://developer.android.com/resources/articles/gestures.html)
28,907,660
I have an `IObservable` of objects, which I want to convert to dictionary of lists asynchronously. Here is my code, where GetSource returns an `IObservable`: ``` await GetSource(...) .GroupBy(o => o.SiteId) .ToDictionary(g => g.Key, g => g.ToList()) ``` Of course, it is wrong, because the result is `IDictionary...
2015/03/06
[ "https://Stackoverflow.com/questions/28907660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/80002/" ]
Note that whatever you do, you can never complete the dictionary until after the source has completed. A simple approach would therefore be to asynchronously obtain the list like this: ``` await GetSource(...).ToList(); ``` and then proceed with the resulting `IList<T>` as you were with the `GroupBy` and `ToDictiona...
EDIT: I just learned that Task returning Select(...) + Merge() can be replaced by SelectMany(...) so better approach would be: ``` IDictionary<int, IList<Site>> result = await GetSource() .GroupBy(o => o.SiteId) .SelectMany(async group => (group.Key, List: await group.ToList())) .ToDictionary(group => group.Key, group...
2,423,360
I have gone through all the msdn stuff for getting started with the SDK for Microsoft CRM 4. I am trying to find any other basic examples / blog posts about implementing the SDK for MS CRM4. Does anyone know of some blogs that cover this?
2010/03/11
[ "https://Stackoverflow.com/questions/2423360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215546/" ]
You'd do well to check out the Microsoft CRM SDK over at [MSDN](http://msdn.microsoft.com/en-us/library/bb928215.aspx). You could also browse the [google groups](http://groups.google.com/group/microsoft.public.crm.developer/), or check out [sites](http://stunnware.com/crm2) to [well known](http://mscrm4ever.blogspot.co...
I was in your shoes a while back, and I started by thinking of a "mini project" and doing it. It will force you to find out more about CRM and you'll gain "practical experience". How about getting a book - Working with Microsoft Dynamics CRM 4.0 and working through some exercises there?
150,043
1. Current whatsapp is linked to a non-existent number. 2. I want to create a new whatsapp account for my new existing number 3. I **do not** want to migrate my old whatsapp account to the new number. 4. If I were to move the crypto backup files of the current whatsapp, will I be able to restore it on the new account? ...
2016/07/05
[ "https://android.stackexchange.com/questions/150043", "https://android.stackexchange.com", "https://android.stackexchange.com/users/170728/" ]
As WhatsApp by default does not allow to transfer from a phone number to another, there's no way without root. Root would allow you to copy the encryption key and the conversation files located at `/data/data/com.whatsapp` folder to the target device.
You can change your number in your first device i.e. Moto G2 by follwing this [link](https://faq.whatsapp.com/en/wp/28060001). After successfully doing it make a backup locally and also on google drive then install whatsapp on new device and log in with new number. You should be able to restore chat from google drive.
36,484
These days everything is digital. I came to know that, real 70MM IMAX i.e (not LieIMAX) are shown using film stock instead of digital once. What's keeping them from producing the format in digital equivalent of 70mm (not LieIMAX). Will the digitalization degrade the shots taken in IMAX technology? I'm wondering they ...
2015/07/11
[ "https://movies.stackexchange.com/questions/36484", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/22917/" ]
I read [David Breashears](https://en.wikipedia.org/wiki/David_Breashears) book *High Exposure: An Enduring Passion for Everest and Unforgiving Places* which talks quite a bit about the making of [*Everest* (1998)](https://en.wikipedia.org/wiki/Everest_%281998_film%29) and his path to learning to embrace and ultimately ...
The translation of anything (film stock, analog) involves loss. The loss may be negligible or imperceptible to most or even all people, but it is still there. However digital has its advantages, such as no quality loss from transmission distance or repeated use, therefore frequently seeming to be better. But digital is...
90,451
Attended an interesting demo on REST today, however, I couldn't think of a single reason (nor was one presented) why REST is in anyway better or simpler to use and implement than a SOAP based Services stack. What are some of the reasons Why anyone in the "real world" use REST instead of the SOAP based Services?
2008/09/18
[ "https://Stackoverflow.com/questions/90451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9382/" ]
I'll assume that when you say "web services" you mean SOAP and the WS-\* set of standards. (Otherwise, I could argue that REST services *are* "web services".) The canonical argument is that REST services are a closer match to the design of the web - that is, the design of HTTP and associated infrastructure. Thus, usin...
The overhead isn't that important as good architecture. REST isn't a protocol it is an architecture that encourage good scalable design. It is often chosen because too much freedom in RPC can easily lead to a poor design. The other reason is predictable cost of RESTful protocols over HTTP because it can leverage exis...
22,912,133
``` using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Diagnostics; namespace WindowsFormsApplication4 { static class Program { [STAThread] static void Main() { var psi = new ProcessStartInfo(); psi.UseShe...
2014/04/07
[ "https://Stackoverflow.com/questions/22912133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3506644/" ]
You can't include php files relatively to your webroot that way, cause if you use the slash as first character, the reference will go much deeper than just your document root. So, instead of using your basepath, you could do something like this : ``` <?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/yourpath/...
If your server doesn't populate the "document\_root", you may need this --- ``` require(str_repeat('../',(substr_count(getenv('SCRIPT_URL'),'/')-1))."/path/to/file.php"); ``` I use this line of code. It goes back to the "top" of the site tree, then goes to the file desired. For example, let's say i have this...
67,729,019
``` @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<StockDTO> findById(@PathVariable Long id){ List<StockDTO> list = new ArrayList<>(); StockDTO dto1= new StockDTO(); dto1.setId(1L); dto1.setNameStock("AF"); dto1.setPrice(100D); dto1.setVariation(1...
2021/05/27
[ "https://Stackoverflow.com/questions/67729019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16052590/" ]
well `id` is `long`, so you should use `==` instead of `.compareTo()` ``` StockDTO dtoSelect = list.stream().filter(x -> x.getId() == id).findFirst().get(); ``` Or "box" the `id` using `Long.valueOf(id)` ...btw, maybe you should use `.equals()` instead of `.compareTo() == 0`
The lambda is irrelevant. The message is telling you `x.getId()` returns a `long`, a [primitive type](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) you can't call methods on. Just write `x.getId() == id`.
2,501,313
The Setup: I have a LAMP server (Ubuntu 9.10) which is also hooked up to my HDTV. Upon boot, one user is automatically logged in so as to have a desktop environment on screen. What I want: I've been developing a remote, web interface in PHP for various things (play music, for example). However, I've hit a snag in that...
2010/03/23
[ "https://Stackoverflow.com/questions/2501313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300063/" ]
(update 20110905: Official [android tools](http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1) now do this better) I cloned Eric Taix's <http://code.google.com/p/andro-views/> on github <https://github.com/olibye/AndroViews> Then applied the patches from above: * JonO's ...
Eric Taix has done most of the grunt work of stripping the Workspace into a WorkspaceView that can be reused. It can be found here: <http://code.google.com/p/andro-views/> The version as of posting does what it's supposed to in the emulator, but on real hardware it sometimes gets stuck between views instead of snappin...
20
For those of you familiar with the solution to the Rubik's cube, you will know that a single-corner twist is not a valid position. It can neither be attained by scrambling, nor can it be solved if it occurs. I understand that there's some fundamental group theory at work here; the corners on a Rubik's cube can only be...
2014/05/14
[ "https://puzzling.stackexchange.com/questions/20", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/-1/" ]
Okay, I'll give a group-theoretic answer, since that was requested, which goes most of the way to a proof. I'm assuming you mean a 3x3x3 Rubik's cube. For larger cubes, the proof is just a little bit less convenient, because these cubes [don't form groups](https://math.stackexchange.com/q/144424/8473) (or more precisel...
This is not a rigorous mathematical proof, but I will try to explain it intuitively. Think of each corner having a property that is the amount that it's been rotated in 3 dimensions. The whole cube has a property that is the sum of all its corners. Initially everything is at 0. When you rotate one side of the cube, y...
75,566
Doing some homework, I'm asked to determine if the following formula is satisfiable, valid or neither. I am confused by the nesting quantifiers for the same variables. Using sequent calculus, I derive this is not valid, but I think it's valid because the variables are all bounded to the same first quantifier. $$\exi...
2011/10/24
[ "https://math.stackexchange.com/questions/75566", "https://math.stackexchange.com", "https://math.stackexchange.com/users/18180/" ]
This is really about how you evaluate the truth value. $\exists x\varphi(t)$ is true if and only if there exists some $x$ for which $\varphi(x)$ is true. Conversely it is false if and only if for all $x$ (in a given model, of course) $\varphi(x)$ is false. The inner quantification is mostly to "confuse" your intuitio...
$$\exists x\;\exists y\; \left(P (x, y) \rightarrow \forall x\;\forall y \;P (x, y)\right).$$ I wonder if the notion of an "alphabetic variant" can make this clearer: $$\exists x\;\exists y\; \left(P (x, y) \rightarrow \forall u\;\forall v \;P (u, v)\right).$$ Then you can say that $P(x,y) \rightarrow \forall u\;\fora...
115,364
The Golden Company, as we discover in the tales of Dunk & Egg, was created by exiled knight Aegor "Bittersteel" Rivers, the *legitimized bastard* of King Aegon IV Targaryen, after they tried to place Daemon I Blackfyre on the throne instead of the King Daeron II Targaryen. Their rebellion had failed. And so the Golden...
2016/01/18
[ "https://scifi.stackexchange.com/questions/115364", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/39187/" ]
**Warning:** This answer may contain serious spoilers for those who have not read ADWD. This is not the official position of GRRM but is derived from Canon evidence in favor of this very popular theory. --- **TL;DR** They did not! They did it for a Blackfyre. Aegon is a Blackfyre thus Golden Company is honor bound t...
Varys, Jon Connington, Illyrio Mopatis and Myles Toyne appear to have a plan for the Golden Company revolving around Aegon and necessitated in Jon Connington being exiled and "dying" a drunk in Lys. Varys confirmed there were plans in *A Dance with Dragons, The Lost Lord* > > We want no songs about the gallant exile...
24,620,333
I am running into an issue with the value of `ng-model`, applied to an element using AngularStrap's `bs-typeahead`, is not accessible within scope. It is however viable from a `{{ var }}` within the HTML. I have the following HTML: ``` <input type="text" placeholder="add a destination" ng-options="item as item for it...
2014/07/07
[ "https://Stackoverflow.com/questions/24620333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/411063/" ]
[Josh](https://twitter.com/dzello) from Keen IO here. There isn't currently a way to query properties of objects contained in lists via the workbench or API. There are, however, a few ways to work around this. ### Indexed Properties You can copy properties in the object list out to a set of indexed properties before...
With the ruby gem it seems like you are now able to run something like this to query the nested attribute: ``` Keen.select_unique( 'sessions', target_property: 'user.id', :timeframe => 'this_8_weeks' ) ```
730,645
You are given an array $A[0 \ldots n-1]$ of $n$ numbers. Let $d$ be the number of \emph{distinct} numbers that occur in this array. For each $i$ with $0 \leq i \leq n-1$, let $N\_i$ be the number of elements in the array that are equal to $A[i]$. Show that $d = \sum\_{i=0}^{n-1} 1/N\_i$. Consider the following ...
2014/03/28
[ "https://math.stackexchange.com/questions/730645", "https://math.stackexchange.com", "https://math.stackexchange.com/users/135665/" ]
Suppose that the number $a$ occurs $N\_a$ times. Each of the $N\_a$ occurrences of $a$ makes a contribution of $\frac{1}{N\_a}$ to the sum $\sum\_0^{n-1}\frac{1}{N\_i}$, for a total contribution of $N\_a\cdot \frac{1}{N\_a}=1$. Thus the sum $\sum\_0^{n-1}\frac{1}{N\_i}$ counts the number of distinct $a$ in the array. ...
For the second part: E[X] = E[n/Nk] = n/E[Nk] <-Property of expected value operator E[Nk] = n \* Pr(Ai = k) = n \* 1/n = 1 recall: E[X] = n/E[Nk] = n/1 = n Maybe I made some logical mistake though because andre has a really high reputation and our answers are different.
33,985,675
i have an app with multiple product flavors. im using the maven plugin and the uploadArchives task to upload my apk to nexus, using this: <https://raw.githubusercontent.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle> my problem is running uploadArchives runs the build and assemble tasks for all flavors ...
2015/11/29
[ "https://Stackoverflow.com/questions/33985675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2029019/" ]
The upload to the repository should upload all artifacts from the build, which in this case includes all flavours. This way you can guarantee that all artifacts in the repository are from the same codebase. What is your use case to upload only some?
You should be able to just build the productFlavor your interested in. For example `gradle clean assembleMyProductFlavor uploadArchives` Then the upload should only see the flavor your interested as the other `apk` files don't exist.
68,514,519
My arrays are in one class ``` private final String[] words = { "reddit", "facebook", "java", "assignment", "game", "helloWorld", "weather", "religion", "internet", "face"}; private final String[] animals = {"squirrel", "dog", "monkey", "panda", "rat", "kangaroo", "horse", "elephant", "fox...
2021/07/24
[ "https://Stackoverflow.com/questions/68514519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16519359/" ]
Just as a suggestion, perhaps rethink the way you want to do this. Instead of using a bunch of arrays have specific Classes to handle instances of Animals, Words, and whatever else you might want. For example, if you have an animal named `Dog` then then there can be an instance of `Dog` which also has an instance of a ...
first check which array has the input string, then get the its index get the element from respective clues array using that index ``` // converting array to list List<String> listOfWords = Arrays.asList(words); List<String> listOfAnimals = Arrays.asList(animals); ``` getting index of input string fro...
39,725,190
I am currently learning a little bit haskell and started to figure out how monads work. Since I normaly code C++ and I think the monad pattern would be (as fas as I understand it right now) be realy awesome to use in C++, too, for example for futures etc, I wonder if there is a way to implement an interface, or a base...
2016/09/27
[ "https://Stackoverflow.com/questions/39725190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4735801/" ]
First note that being a monad is not a property of a type, but of a type constructor. E.g. in Haskell you'd have `List a` as a type and `List` as the type constructor. In C++ we have the same functionality with templates: `std::list` is a type constructor that can construct the type `std::list<int>`. Here `List` is a ...
I fear that Haskell-style polymorphism and C++ templates are too far to pragmatically define monads in C++, in a way that it is actually usable. Technically, you might define a monad `M` to be a template class of the following form (I'll be passing everything by value to keep it simple) ``` template <typename A> stru...
22,527,206
I am developing multilingual site in wordpress, i need to translate site contents in Arabic, here i am using `qTranslate Importer` but this error is coming every time ``` "Please save the qTranslate settings to the datbase first". ``` even i am following this [Documentation](https://wpml.org/documentation/related...
2014/03/20
[ "https://Stackoverflow.com/questions/22527206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2721273/" ]
My guess: You've installed qTranslate Importer instead [qTranslate](http://wordpress.org/plugins/qtranslate/)
Take a look at [this plugin](https://wordpress.org/plugins/google-language-translator/) . I believe this is what you are looking for
423,975
Is it reasonable to include the same customer in both train and test samples? I'm working in panel data logistic regression. I'm actually trying to calculate a probability of default for each customer, so logit model is used to predict the pd of customers, I couldn't be so sure whether I need to include the same custo...
2019/08/28
[ "https://stats.stackexchange.com/questions/423975", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/257501/" ]
Consider samples of size $n=1000$ from $\mathsf{Beta}(.01,1)$ and $\mathsf{Beta}(.02,1),$ respectively. Then respective population means are $\mu\_x \approx 0.01$ and $\mu\_y \approx 0.02$, and population medians are distinct, but both near $0.$ ``` qbeta(.5, .01,1); qbeta(.5, .02,1) [1] 7.888609e-31 # pop median of ...
With 48,000 observations, even if the data is pretty highly skewed the t test might do okay. As nba2020 suggested, you could bootstrap your sample and observe the distribution of means, though this can't guarantee anything. BruceET's example uses only 1000 observations from a *very* skewed distribution--I'm not sure yo...
71,835
Let's say I have a wallet in my computer and I create an address so another person can deposit bitcoins in it. Then it is passed to miners and later added to the blockchain. But in the meantime this transaction was not verified. When does my wallet is updated so the balance in my wallet and in the other person's wal...
2018/03/06
[ "https://bitcoin.stackexchange.com/questions/71835", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/77235/" ]
your question is unclear on verification. I think you are asking for this process: You create an address, give it to your friend, he creates a tx, and sends it to you. At this point in time the transaction is not yet mined, but you anyhow get within seconds a message, saying someone sent you some funds. In the backgro...
you should wait for the confirmation time of it. if it was accepted by the blockchain then yes, it'll be confirmed and will be broadcasted shortly.
33,401,387
I'm trying to loop over an Array using Underscore, I have this: ```js var friends = [ { name: 'Jimmy', age: 21 }, { name: 'Anna', age: 19 }, { name: 'Alina', age: '22' }, { name: 'Carl', age: '22' } ]; var names = _(friends).pluck('name'); for(i = 0;...
2015/10/28
[ "https://Stackoverflow.com/questions/33401387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1289302/" ]
According to the [documentation](http://underscorejs.org/#each): > > Each invocation of iteratee is called with three arguments: (element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list) > > > Your code works no matter what you write for that first argument, because y...
this would be a reasonably typical way :- ```js var friends = [ { name: 'Jimmy', age: 21 }, { name: 'Anna', age: 19 }, { name: 'Alina', age: '22' }, { name: 'Carl', age: '22' } ]; var names = _(friends).pluck('name'); _.each(names, function(name){ ...
39,431,322
I wanted to make a code resembles the infinite monkey theorem **the theorem states that:** > > a monkey hitting keys at random on a typewriter keyboard for infinite > amount of time will almost surely type a given text such as the > complete works of Shakespeare. > > > well , suppose we replace a monkey with a...
2016/09/10
[ "https://Stackoverflow.com/questions/39431322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5720281/" ]
Forget fpdf and turn to **tfpdf** to get the solution. From latest fpdf document about font. It supports charators as below cp1250 (Central Europe) cp1251 (Cyrillic) cp1252 (Western Europe) cp1253 (Greek) cp1254 (Turkish) cp1255 (Hebrew) cp1257 (Baltic) cp1258 (Vietnamese) cp874 (Thai) IS...
This may help: ``` class PDF extends FPDF { function Cell( $w, $h = 0, $t = '', $b = 0, $l = 0, $a = '', $f = false, $y = '' ) { parent::Cell( $w, $h, iconv( 'UTF-8', 'windows-1252', $t ), $b, $l, $a, $f, $y ); } } ```
52,228
A magician (Yes, that's you) has 10 cards, say labelled 0 to 9. Now, the magician's assistant and the magician perform a magic trick: 1. The magician turns around (so he can't see the cards) 2. A volunteer from the crowd comes up and arranges the ten cards in *any order they want* 3. The assistant picks four cards and...
2017/05/30
[ "https://puzzling.stackexchange.com/questions/52228", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/32642/" ]
Here's a strategy that works 100% of the time, requires no communication with the assistant other than the selection of face-down cards, and is simple enough to memorise (if fairly complex to work out in realtime): General principles ------------------ > > The five cards are divided into five groups of two: A = {0,...
Presented without proof: > > Your assistant covers up four cards that are either an increasing or decreasing sequence. If the sum of the cards that are covered is even, then it is increasing, otherwise it is decreasing. Simply observe which 4 cards are not shown in the 6, then flip them over in order while naming th...
1,175,240
I think that I'm experiencing a database connection timeout with my SQLite connection, but I'm not sure how to bump up the connection timeout. The command timeout can be set with ConnectionString.DefaultTimeout but Connection.ConnectionTimout is read only. Any suggestions? Thanks, Brian
2009/07/24
[ "https://Stackoverflow.com/questions/1175240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2170994/" ]
Exceeding the default (30 seconds) timeout for SQLite queries is a strong indication that something is wrong in your approach. Timeouts usually occur when there are too many concurrent connections. SQLite behaves poorly when you have interleaved write/read transactions. Make sure that you chunk related SQL statement...
It is set in the connection string: [SqlConnection](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(VS.71).aspx)
34,792,138
I am currently developing an app and I wish it to be used in multiple size classes. [![enter image description here](https://i.stack.imgur.com/jnNcb.jpg)](https://i.stack.imgur.com/jnNcb.jpg) As you can see from the image attached, my trophy image does not resize itself at all. I have included 3 different sizes of ...
2016/01/14
[ "https://Stackoverflow.com/questions/34792138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you are using autolayout, you can set aspect ratio constraints for width and height of the imageView to the cell content view, that way, if the cell grows image will grow too.
You can *resize the imageView* and set height/width for different size classes. If you want to use *different* images for same image view across different size classes, i think it'll not be possible. checkout this tutorial: <http://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started>
17,395
My mac seems like it is running slower and slower. While I am thinking abut installing Lion from scratch, I figure there has to be stuff I can do now to help. I have reset PR RAM recently, I have run the verify disk utility, and fixed permissions. I have seen mixed references to running a disk defragmenter. Could that ...
2011/07/13
[ "https://apple.stackexchange.com/questions/17395", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/70/" ]
First, check that your processor is running full speed. Go to Preferences, Energy Saver, Options and look at the drop box down near the bottom called Processor Performance. If it is not set to "Highest", set it to that right away. This maximizes performance, but for notebooks, it may run down the battery faster. Note t...
Regarding installing Lion from scratch, that is not actually possible, you have to have Snow Leopard installed to be able to install Lion. EDIT: You can install Lion from scratch. When you download Lion, do not install it, instead, open the package contents, select Install ESD and from there you can burn the file as a...
41,578,348
Is there a way to get the enums in VBA? Something like this example for C#, but for VBA? ``` using System; class EnumsExampleZ { private enum SiteNames { SomeSample = 1, SomeOtherSample = 2, SomeThirdSample = 3 } static void Main() { Type enumType = typeof(SiteName...
2017/01/10
[ "https://Stackoverflow.com/questions/41578348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5448626/" ]
I think that the marvel [CPearson's](http://www.cpearson.com/excel/Enums.aspx) site has the answer with the [\_First] and [\_Last] trick. I had the need of speed up a lot of DB reading just to populate combo and list boxes with values in some Office VBA application, and I just translate them to Enums. Of course, do a...
I realized that in some cases the code was returning the "End Enum" statement if I supplied a value 1 higher than the last enumeration member, so I fixed the code for that. Here is the latest code, including making it work with Access or Excel: ``` '---------------------------------------------------------------------...
28,465,755
Having trouble when appropriately moving CSS styles to CSS page. My original page that worked just fine: ``` <span class="faq-answer" data-category="<%=category %>" data-index="<%= i %>" style="display:none;"><%= a %></span> function toggleVisible(category, index) { var select_answer = '.faq-answer[data-category="'...
2015/02/11
[ "https://Stackoverflow.com/questions/28465755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2731253/" ]
`element.style` contains the styles for inline styles, not ones from CSS stylesheets. You will need to use [jQuery("element").css](http://api.jquery.com/css/) or [getComputedStyle](https://developer.mozilla.org/en-US/docs/Web/API/Window.getComputedStyle) to get the value **JQuery css method** ```js var dispVal = jQue...
Your script is looking at `style` attribute of the element. If you are going to use classes instead of styles, create two different classes and toggle.
29,829
This one seems to be a common question in most forums and all over the web, it is asked here in many formats that typically sound like this: > > In SQL Server - > > > * What are some reasons the transaction log grows so large? > * Why is my log file so big? > * What are some ways to prevent this problem from occurr...
2012/12/05
[ "https://dba.stackexchange.com/questions/29829", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/4008/" ]
**A Shorter Answer:** You probably either have a long running transaction running (Index maintenance? Big batch delete or update?) or you are in the "default" (more below on what is meant by default) recovery model of `Full` and have not taken a *log backup* (or aren't taking them frequently enough). If it is a recov...
Since I'm not really satisfied with any of the answers [over on Stack Overflow](https://stackoverflow.com/questions/56628/how-do-you-clear-the-sql-server-transaction-log/), including the most heavily up-voted suggestion, and because there are a few things I'd like to address that Mike's answer does not, I thought I wou...
51,208
So today I lost money on a transaction. This guy I was dealing with asked for my bitcoin address. I of course copy and pasted my bitcoin address and sent it to him. He sent me a screenshot of me preparing to send me my funds, i confirmed the amount but wasn't able to confirm the address because I expected him to copy a...
2017/02/07
[ "https://bitcoin.stackexchange.com/questions/51208", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/45882/" ]
You have been scammed. The address with one symbol changed is invalid and all bitcoin cliends reject sending bitcoins to it. So, your partner lies. Tell him to give you a link for his transaction on block-explorer site like blockchain.info > > Now my question, is it possible to create an address similar to mine, but...
amaclin's answer (you are being lied to) is overwhelmingly likely to be correct. Speaking purely theoretically, I don't think the 32-bit Bitcoin address checksum *guarantees* catching all one-character errors. So there is a tiny chance (about 1 in 4 billion) that the "q" address is actually valid. You can easily check...
16,245,422
I want to add a button in my code: ``` <div class="content" data-role="content" id="content" > <div id="car"> <select name="selectCar" class="span12" id="Options" > <option value="-1">Bir istasyon seçiniz.</option> <option value="1">Mimarlık</option> <option va...
2013/04/26
[ "https://Stackoverflow.com/questions/16245422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2325384/" ]
You can use `function.call` to send the value. I am sure about the practical purpose of why yuo want to do that. You can even directly access the value of the select inside the function. `[Func.Call](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call)` **<http://jsfiddle.net/8a...
You can use jquery to get the selected option when you click your button. Try this function: ``` function callCarInfo() { alert($('#Options :selected').val()); } ``` Here's a live [example](http://jsfiddle.net/4ytTx/). Hope this helps.
584,216
I'd like to define an environment which *locally* patches the `\newcommand` and `\newenvironment` families of commands to prefix each new definition with some string, *e.g.* ```latex \begin{namespace}{hello} \newcommand{\world}{Hello, World} \end{namespace} \world % undefined \helloworld % prints "Hello, World" ...
2021/02/20
[ "https://tex.stackexchange.com/questions/584216", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/75023/" ]
This should cover `\(re)newcommand`, `\providecommand`, `\DeclareRobustCommand`, and `\(re)newenvironment`. It uses two commands, `\BeginNamespace{<namespace>}` and `\EndNamespace` (which cannot be nested), rather than the environment syntax, because commands defined in environments are lost after the environment ends....
I can offer a macro `\CsNameToCsToken` which might help accomplishing things without patching `\newcommand`/`\newenvironment`. Besides this it might be useful when using definition-commands other than `\newcommand`/`\newenvironment`: Syntax: `**\CsNameToCsToken***⟨stuff not in braces⟩***{***⟨NameOfCs⟩***}**` → ...
10,108,184
As I understand it, IDF is used to calculate how many documents have the term (sort of just the idea). You can calculate IDF (along with TF) in the training set since you have all the documents beforehand. But what if I don't have the test set beforehand and I'm getting test documents in a sequential manner (like from ...
2012/04/11
[ "https://Stackoverflow.com/questions/10108184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/601357/" ]
For this state if your dataset is big enough you could using just training set for IDF. in the test phase if the new term be in train set use the IDF of training and if the term is new use the number of train set documents for calculate IDF. For some purposes you could use smoothing methods for having better results.
If you only perform tests after indexing/crawling a whole bunch of documents you can calculate IDF after the crawling is done. You don't have to calculate IDF when you encounter a new document or a new term. You can calculate it on-the-fly when you need it to do some TD-IDF or other calculation. If that is not enough,...
25,871,825
As question says How to best write `Writes [List[(Foo, List[FoodChildren]) ] ]` where each `Foo` and `FoodChildren` itself are `case class` ? I am on Scala 2.11, play framework 2.3.1
2014/09/16
[ "https://Stackoverflow.com/questions/25871825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066049/" ]
In your project's .xcodeproj file, search for the string `developmentRegion`. Supposedly, it says "English" right now. If you change it to "Spanish", Xcode 6 should recognize Spanish as your project's default localization language in the "Info" tab as long as you add "Spanish" to the list. You can read more about this...
open your target -> info -> change **"Localization native development region"** to your language
122,205
I was wondering if there is a good way to hook into the Application\_Start of a SharePoint 2007 site when developing a feature? I know I can directly edit the Global.asax file in the site root, but is there a way to do this so that it gets deployed with the feature? Thanks!
2008/09/23
[ "https://Stackoverflow.com/questions/122205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10893/" ]
This is actually possible, but it doesn't involve the Global.asax file. Many of Microsoft's examples demonstrate wiring code in via the Global.asax, but this is not a best-practices approach when it comes to SharePoint. Ideally, your code should get packaged as a Feature and deployed via WSP (as you already know). Th...
My gut feeling on this is that it won't be possible. Application\_Start is called by the runtime as the asp.net engine is starting up, so there most likely can't be any way to hook the handler outside of modifying the Global.asax - e.g. the hook must be declarative and persistent as it has to survive the application st...