qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
7,373,572
My site configures CherryPy by way of a configuration file. In the configuration file I am trying to setup basic authentication. I have specified the fully qualified path to a "checkpassword" function. But I'm getting an error about the tools.auth\_basic.checkpassword line. [Most of the samples online](http://docs.ch...
2011/09/10
[ "https://Stackoverflow.com/questions/7373572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451007/" ]
Writing XML using JAXB (Java Architecture for XML Binding): <http://www.mkyong.com/java/jaxb-hello-world-example/> ``` package com.mkyong.core; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Cu...
Ok, already having DOM, JaxB and XStream in the list of answers, there is still a complete different way to read and write XML: [Data projection](http://xmlbeam.org) You can decouple the XML structure and the Java structure by using a library that provides read and writeable views to the XML Data as Java interfaces. Fr...
7,373,572
My site configures CherryPy by way of a configuration file. In the configuration file I am trying to setup basic authentication. I have specified the fully qualified path to a "checkpassword" function. But I'm getting an error about the tools.auth\_basic.checkpassword line. [Most of the samples online](http://docs.ch...
2011/09/10
[ "https://Stackoverflow.com/questions/7373572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451007/" ]
The above answer only deal with DOM parser (that normally reads the entire file in memory and parse it, what for a big file is a problem), you could use a SAX parser that uses less memory and is faster (anyway that depends on your code). SAX parser callback some functions when it find a start of element, end of elemen...
The answers only cover DOM / SAX and a copy paste implementation of a JAXB example. However, one big area of when you are using XML is missing. In many projects / programs there is a need to store / retrieve some basic data structures. Your program has already a classes for your nice and shiny business objects / data ...
250,525
On page 63 of [Volume 1 of Stanley’s *Enumerative Combinatorics*](http://www-math.mit.edu/~rstan/ec/ec1.pdf) there is a statement, > > Clearly $w$ is uniquely determined by $w'$ and $w''$, > and $\operatorname{inv}(w) = \operatorname{inv}(w') + \operatorname{inv}(w'')$. > > > Can someone explain why this is tru...
2012/12/04
[ "https://math.stackexchange.com/questions/250525", "https://math.stackexchange.com", "https://math.stackexchange.com/users/51688/" ]
Every pair $(i,j)$ of indices of $w$ with $i<j$ (a potential inversion) is of exactly one of the following two types: 1. neither $w\_i$ nor $w\_j$ equals $1$; 2. $w\_i=1$ or $w\_j=1$ In case 1. the positions $i,j$ in $w$ will have corresponding positions $i',j'$ in $w'$, with $i'<j'$ where the letters $w\_i$ and $w\_...
$\newcommand{\inv}{\operatorname{inv}}$The permutation $w''$ of $\{1^{a\_1},2^{n-a\_1}\}$ tells you in which positions of $w$ the $1$’s are, and $w'$ tells you the order of the non-$1$’s in $w$; put the pieces together, and you have $w$. As an example, suppose that $M=\big\{1^3,2^2,3^2\big\}$ and $w=\langle2,1,1,3,2,1...
255,688
Short version: Netstat works fine except when I redirect output to a file in NFS. doesn't work: `netstat -c > /nfs/mount/file` works: `netstat > /nfs/mount/file` works: `netstat -c` works: `netstat -c > /tmp/file` Symptoms: empty file, no error messages. This is using bash on Ubuntu 10.10 Longer version: I'm wo...
2011/04/04
[ "https://serverfault.com/questions/255688", "https://serverfault.com", "https://serverfault.com/users/77150/" ]
strace shows my netstat -c spending a large amount of time resolving hostnames before outputting its result - maybe try `netstat -nc > /nfs/foo` or wait longer before killing it. I don't think this has anything to do with NFS - I get the same long delay when redirecting to `/tmp/foo`
For particular configurations of NFS the delay to sync may be quite large, and it appears that `netstat` is not flushing its output after `SIGKILL`. Killing the process after 15 seconds or so resulted in an empty file as you described. I waited for an extended period of time (I went to get coffee), and when I came bac...
255,688
Short version: Netstat works fine except when I redirect output to a file in NFS. doesn't work: `netstat -c > /nfs/mount/file` works: `netstat > /nfs/mount/file` works: `netstat -c` works: `netstat -c > /tmp/file` Symptoms: empty file, no error messages. This is using bash on Ubuntu 10.10 Longer version: I'm wo...
2011/04/04
[ "https://serverfault.com/questions/255688", "https://serverfault.com", "https://serverfault.com/users/77150/" ]
What about this? ``` script -f -c "netstat -c" /nfs/mount/file > /dev/null ``` I think it may work, though I haven't got a NFS server handy to test it.
For particular configurations of NFS the delay to sync may be quite large, and it appears that `netstat` is not flushing its output after `SIGKILL`. Killing the process after 15 seconds or so resulted in an empty file as you described. I waited for an extended period of time (I went to get coffee), and when I came bac...
65,493,730
I have a list in Excel like the following: ``` 1 / 6 / 45 123 1546 123 456 1247 /% 456 / ``` I want to create a new column with all sequences of consecutive non digits replaced by a character. In Google Sheets, this is easy using `=REGEXREPLACE(A1&"/","\D+",",")`, resulting in: ``` 1,6,45, 123, 1546, 123,456 1247...
2020/12/29
[ "https://Stackoverflow.com/questions/65493730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2489805/" ]
If you have Excel 365: [![enter image description here](https://i.stack.imgur.com/xX8jC.png)](https://i.stack.imgur.com/xX8jC.png) In `B1`: ``` =LET(X,MID(A1,SEQUENCE(LEN(A1)),1),SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--X),X," ")))," ",",")) ``` Or if streaks of digits are always delimited by at least a space: ``` =T...
This is another variation if you have `TEXTJOIN` function available. `=SUBSTITUTE(TRIM(TEXTJOIN("",TRUE,IFERROR(MID(A2,ROW($A$1:INDEX(A:A,LEN(A2))),1)+0," ")))," ",",")`
65,493,730
I have a list in Excel like the following: ``` 1 / 6 / 45 123 1546 123 456 1247 /% 456 / ``` I want to create a new column with all sequences of consecutive non digits replaced by a character. In Google Sheets, this is easy using `=REGEXREPLACE(A1&"/","\D+",",")`, resulting in: ``` 1,6,45, 123, 1546, 123,456 1247...
2020/12/29
[ "https://Stackoverflow.com/questions/65493730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2489805/" ]
If you have Excel 365: [![enter image description here](https://i.stack.imgur.com/xX8jC.png)](https://i.stack.imgur.com/xX8jC.png) In `B1`: ``` =LET(X,MID(A1,SEQUENCE(LEN(A1)),1),SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--X),X," ")))," ",",")) ``` Or if streaks of digits are always delimited by at least a space: ``` =T...
Here is a Power Query solution. It makes use of the `List.Accumulate` function to determine whether to add a digit, or a comma, to the string: Note that the code replicates what you show for results. If you prefer to avoid trailing (and/or leading) commas, it can be easily modified. ``` let Source = Excel.Current...
65,493,730
I have a list in Excel like the following: ``` 1 / 6 / 45 123 1546 123 456 1247 /% 456 / ``` I want to create a new column with all sequences of consecutive non digits replaced by a character. In Google Sheets, this is easy using `=REGEXREPLACE(A1&"/","\D+",",")`, resulting in: ``` 1,6,45, 123, 1546, 123,456 1247...
2020/12/29
[ "https://Stackoverflow.com/questions/65493730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2489805/" ]
If you have Excel 365: [![enter image description here](https://i.stack.imgur.com/xX8jC.png)](https://i.stack.imgur.com/xX8jC.png) In `B1`: ``` =LET(X,MID(A1,SEQUENCE(LEN(A1)),1),SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--X),X," ")))," ",",")) ``` Or if streaks of digits are always delimited by at least a space: ``` =T...
And another option in Power Query. ``` let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTQVzADYhNTpVgdINfIGEKbmpjBBIByZgpQjom5gr4qWEBfKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t...
65,493,730
I have a list in Excel like the following: ``` 1 / 6 / 45 123 1546 123 456 1247 /% 456 / ``` I want to create a new column with all sequences of consecutive non digits replaced by a character. In Google Sheets, this is easy using `=REGEXREPLACE(A1&"/","\D+",",")`, resulting in: ``` 1,6,45, 123, 1546, 123,456 1247...
2020/12/29
[ "https://Stackoverflow.com/questions/65493730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2489805/" ]
Here is a Power Query solution. It makes use of the `List.Accumulate` function to determine whether to add a digit, or a comma, to the string: Note that the code replicates what you show for results. If you prefer to avoid trailing (and/or leading) commas, it can be easily modified. ``` let Source = Excel.Current...
This is another variation if you have `TEXTJOIN` function available. `=SUBSTITUTE(TRIM(TEXTJOIN("",TRUE,IFERROR(MID(A2,ROW($A$1:INDEX(A:A,LEN(A2))),1)+0," ")))," ",",")`
65,493,730
I have a list in Excel like the following: ``` 1 / 6 / 45 123 1546 123 456 1247 /% 456 / ``` I want to create a new column with all sequences of consecutive non digits replaced by a character. In Google Sheets, this is easy using `=REGEXREPLACE(A1&"/","\D+",",")`, resulting in: ``` 1,6,45, 123, 1546, 123,456 1247...
2020/12/29
[ "https://Stackoverflow.com/questions/65493730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2489805/" ]
Here is a Power Query solution. It makes use of the `List.Accumulate` function to determine whether to add a digit, or a comma, to the string: Note that the code replicates what you show for results. If you prefer to avoid trailing (and/or leading) commas, it can be easily modified. ``` let Source = Excel.Current...
And another option in Power Query. ``` let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTQVzADYhNTpVgdINfIGEKbmpjBBIByZgpQjom5gr4qWEBfKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t...
61,797,438
I am quite new to R and have a df, in which I am creating some criteria (a1, b1, c1, d1.. and so on) by using sqldf (In this example I am only showing a1 to c1) ``` df <- data.frame('var1' = c('x','1', 'X', '', 'X'), "var2" = c('y','3', '', 'X', ''), "var3" = c('y','7', '', 'X', 'X')) library(sqldf) testcases_sql <-...
2020/05/14
[ "https://Stackoverflow.com/questions/61797438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12148688/" ]
You can give a try to [build-helper-maven-plugin](https://www.mojohaus.org/build-helper-maven-plugin/usage.html) and add more source directories to your project explicitly: ``` <project> ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plu...
Try adding `generated-sources` folder to git ignore file. Git ignore file if not already exists can be added in intelli idea like: [![enter image description here](https://i.stack.imgur.com/bOoGR.png)](https://i.stack.imgur.com/bOoGR.png) Then add `generated-sources` folder relative path like `generated-sources/`in gi...
28,145,231
Here is my code, it works for any input. I'm trying to make it so that when you type in a number, it will print out "Hello World!", but if you enter anything other then a single positive number, for example: 1 2, abc, 1 abc, You will get the invalid input prompt. It works for everything except when I input something li...
2015/01/26
[ "https://Stackoverflow.com/questions/28145231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The simplest way to check if you have spaces in the given string is to do ``` if ( inputString.find(' ') != std::string::npos ) ... ``` If you want to search for space or tab, then you can: ``` if ( inputString.find_first_of(" \t") != std::string::npos ) ... ``` The best "portable" way though would be to check ev...
You didn't initialize r! ``` int r=0; ```
34,724,482
Now i have to insert data in `AAAA-MM-DD` format, if i want insert `%m/%d/%Y`, `%m/%d/%y` format, what i can do? Thanks i'm new on Django. I have template where i insert Data: **TEMPLATE** ``` <tr> <td>N_Prova</td> <td><input type="text" name="nprova"/></td> </tr> <tr> <td>Date Analysis</td> <td><in...
2016/01/11
[ "https://Stackoverflow.com/questions/34724482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4769394/" ]
You should create `ModelForm` based on your `Model`. The form will [automatically convert](https://docs.djangoproject.com/en/1.9/ref/forms/api/#accessing-clean-data) the date into a Python `datetime.date` object. forms.py: ``` from .models import Analysis class AnalysisForm(forms.ModelForm): date_analysis = for...
What you are looking for is [this](https://docs.python.org/2/library/time.html#time.strptime) function. So in your view, you want to have: ``` date = time.strptime(request.POST['date_analysis'], "%m/%d/%Y") newanal = analysis(nprova=request.POST['nprova'],data_analysis=date) newanal.save() ```
56,949,788
I'm using Rxjs and Angular 7. I have a parent component and a child component. I have a method to invoke a `Subject` on my child component: ``` updateSubject(text: string) { this.subject$.next(text); } ``` And I'm calling this from my parent component in `ngOnInit` using `ViewChild`: ``` ngOnInit() { this.child...
2019/07/09
[ "https://Stackoverflow.com/questions/56949788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300608/" ]
The `subscribe()` in the child is being called **after** the parent is initialized. Angular initializes components in the same order as the DOM so the parent component is initialized first, and then the child is initialized. A `Subject()` throws away emitted values if nothing is subscribed, and since the child is subs...
You need to use the `AfterViewInit` lifecycle hook. Your child component hasn't been rendered yet when `OnInit` is called. So this will work: ``` ngAfterViewInit() { this.childComponent.updateSubject('View initialized'); } ```
56,949,788
I'm using Rxjs and Angular 7. I have a parent component and a child component. I have a method to invoke a `Subject` on my child component: ``` updateSubject(text: string) { this.subject$.next(text); } ``` And I'm calling this from my parent component in `ngOnInit` using `ViewChild`: ``` ngOnInit() { this.child...
2019/07/09
[ "https://Stackoverflow.com/questions/56949788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300608/" ]
The `subscribe()` in the child is being called **after** the parent is initialized. Angular initializes components in the same order as the DOM so the parent component is initialized first, and then the child is initialized. A `Subject()` throws away emitted values if nothing is subscribed, and since the child is subs...
Use BehaviorSubject instead of Subject ``` subject$: BehaviorSubject<string> = new BehaviorSubject<string>(null); ``` Follow this question to understand difference between Subject and BehaviorSubject [Difference between Subject and BehaviorSubject](https://stackoverflow.com/questions/43348463/what-is-the-difference...
56,949,788
I'm using Rxjs and Angular 7. I have a parent component and a child component. I have a method to invoke a `Subject` on my child component: ``` updateSubject(text: string) { this.subject$.next(text); } ``` And I'm calling this from my parent component in `ngOnInit` using `ViewChild`: ``` ngOnInit() { this.child...
2019/07/09
[ "https://Stackoverflow.com/questions/56949788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300608/" ]
You need to use the `AfterViewInit` lifecycle hook. Your child component hasn't been rendered yet when `OnInit` is called. So this will work: ``` ngAfterViewInit() { this.childComponent.updateSubject('View initialized'); } ```
Use BehaviorSubject instead of Subject ``` subject$: BehaviorSubject<string> = new BehaviorSubject<string>(null); ``` Follow this question to understand difference between Subject and BehaviorSubject [Difference between Subject and BehaviorSubject](https://stackoverflow.com/questions/43348463/what-is-the-difference...
49,361,354
I'm attempting to build a simple app in Objective C, utilizing an attributes Dictionary in my `AppDelegate` module to allow me to customize the look of various navigation items of my story layout. The code builds fine with no errors but as it deploys onto my test device I get a SIGABRT. I'm using latest version Xcode...
2018/03/19
[ "https://Stackoverflow.com/questions/49361354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9247690/" ]
Once you have the output of crontab, make the required change in the variable and then write it to a file: ``` $output = shell_exec('crontab -l'); $find="' https"; $replace="'https"; $output =str_replace($find, $replace,$output); $file="/path_to_a_file_which_is_writable/crontab.txt"; file_put_contents($file, $output);...
Try something like: ``` # new crontab EDIT THIS $crontab = '''MAILTO="admin@example.com" */2 * * * * /usr/bin/php5 /var/www/vhosts/example.com/streaming.example.com/index.php admin cron > /dev/null MAILTO="" */1 * * * * /opt/psa/admin/sbin/fetch_url 'https://www.example.com/referral/send_referral_emai...
49,361,354
I'm attempting to build a simple app in Objective C, utilizing an attributes Dictionary in my `AppDelegate` module to allow me to customize the look of various navigation items of my story layout. The code builds fine with no errors but as it deploys onto my test device I get a SIGABRT. I'm using latest version Xcode...
2018/03/19
[ "https://Stackoverflow.com/questions/49361354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9247690/" ]
Once you have the output of crontab, make the required change in the variable and then write it to a file: ``` $output = shell_exec('crontab -l'); $find="' https"; $replace="'https"; $output =str_replace($find, $replace,$output); $file="/path_to_a_file_which_is_writable/crontab.txt"; file_put_contents($file, $output);...
Found out how to do it. ``` $url = " https://www.example.com"; $new_url = "https://www.example.com"; $output = shell_exec('crontab -l'); $output = str_replace($url,$new_url,$output); file_put_contents('/tmp/crontab.txt', $output.PHP_EOL); echo exec('crontab /tmp/crontab.txt'); ```
37,759,971
Is there a way to hide the AES URL ? from fiddler and softwares alike? It's fine if they see the FINAL url when they scan it, I just dont want them to see the Encryption. Because with this script, using view-source, you can't view its source...But when scanning with fiddler. It shows its content from the Header(Locatio...
2016/06/11
[ "https://Stackoverflow.com/questions/37759971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5884217/" ]
From the basic premise: **[Encrypting URL parameters is a bad idea](https://paragonie.com/blog/2015/09/comprehensive-guide-url-parameter-encryption-in-php)**. Your URL scheme is almost certainly vulnerable to chosen-ciphertext attacks. However, the point of *encryption* is that the ciphertext can be made public withou...
The only way to **make some info unavailable** on the client side is to **not send it**.
53,111,657
When I try to run all my test in laravel with `/vendor/bin/phpunit`, I’m getting the following error: ``` There was 1 error: 1) Tests\Unit\Services\PropertyServiceTest::testCreateProperty Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'omega-testing.properties' doesn't e...
2018/11/02
[ "https://Stackoverflow.com/questions/53111657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9422114/" ]
This is an EE feature that requires an ElasticSearch instance: > > <https://docs.gitlab.com/ee/user/search/advanced_global_search.html> > > >
Try again with [GitLab 13.4](https://about.gitlab.com/releases/2020/09/22/gitlab-13-4-released/#quick-navigation-using-the-search-bar) (September 2020) > > Quick navigation using the Search bar > ------------------------------------- > > > When navigating through GitLab, sometimes you just want to go to > a specifi...
27,777,666
I have a copy book like : ``` 01 MY-STRUCTURE. 05 STRUCTURE-NAME PIC X(20). 05 STRUCTURE-DATE PIC X(8). 05 STRUCTURE-LIB PIC 9(3). ``` How can I get the name of my fields? I want to have a program that can get any copybook and write dynamically its fields and values. I want to write it to an outpu...
2015/01/05
[ "https://Stackoverflow.com/questions/27777666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4419598/" ]
In the z/OS world, depending upon your compiler level, you can use the debugging information generated by the compiler to do introspection on your names. To do this, you will need to save your ADATA at compile time.
I have a two possible solutions: 1. You save the names of the fields of the copy in a internal table. And secuential reads the table for your write your output. 2. Dynamical allocation, is more complicated but it's possible. You allocate the copy in your program using bpxwdyn (subroutine IBM). You create a subprogram...
12,866,944
I have a simple application: ``` <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*"> <mx:ViewStack width="100%" creationPolicy="all"> <s:NavigatorContent width="100%"> ...
2012/10/12
[ "https://Stackoverflow.com/questions/12866944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1390373/" ]
Unfortunately datepicker does not offer a public API that handles relative dates, just internal methods that do that. Consider calculating the minDate server side - that is what I ended up doing. If you still absolutely need it: ```js // DO NOT USE THIS IN PRODUCTION CODE!! var minDate = $.datepicker._getMinMaxDa...
You should do ``` var date = $mydatepicker.datepicker({ dateFormat: 'dd-mm-yy' }).val(); ``` Alternatively, you can also do: ``` var date = $mydatepicker.datepicker('getDate'); $.datepicker.formatDate('dd-mm-yy', date); ``` If you want it as an object, you can remove the `.val()` More Info available at <http://d...
265,196
I've just started a new game, and am exploring the various options. I've run into the planetary details screen. Each tile can support one building, and one population. Thing is, I noticed these little + arrows next to some buildings, and hovering over them gives me adjacency bonuses. [![Adjacency bonus example](https...
2016/05/09
[ "https://gaming.stackexchange.com/questions/265196", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/20456/" ]
According to [this dev article](https://forum.paradoxplaza.com/forum/index.php?threads/stellaris-dev-diary-9-planets-resources.891510/), > > Buildings can also be constructed in tiles, and they often have adjacency bonuses for the resource they are producing. Therefore it will be advantageous to construct your power...
Its because that tile (the tile that is providing the adjacency bonus) is where you first sent down your calony ship to colonize the planet, or in this case as it is your capital planet it is actually the planetary administration, or capital of the planet. The capital of the planet is what provides the adjacency bonus....
265,196
I've just started a new game, and am exploring the various options. I've run into the planetary details screen. Each tile can support one building, and one population. Thing is, I noticed these little + arrows next to some buildings, and hovering over them gives me adjacency bonuses. [![Adjacency bonus example](https...
2016/05/09
[ "https://gaming.stackexchange.com/questions/265196", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/20456/" ]
As far as I'm aware, the only buildings with adjacency bonuses are the Planetary Capital line of buildings (and their upgrades) starting from the Planetary Administration (after upgrading the Reassembled Ship Shelter). In this case, as per their descriptions, they provide +1/+2/+3 to production of adjacent Minerals, E...
According to [this dev article](https://forum.paradoxplaza.com/forum/index.php?threads/stellaris-dev-diary-9-planets-resources.891510/), > > Buildings can also be constructed in tiles, and they often have adjacency bonuses for the resource they are producing. Therefore it will be advantageous to construct your power...
265,196
I've just started a new game, and am exploring the various options. I've run into the planetary details screen. Each tile can support one building, and one population. Thing is, I noticed these little + arrows next to some buildings, and hovering over them gives me adjacency bonuses. [![Adjacency bonus example](https...
2016/05/09
[ "https://gaming.stackexchange.com/questions/265196", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/20456/" ]
As far as I'm aware, the only buildings with adjacency bonuses are the Planetary Capital line of buildings (and their upgrades) starting from the Planetary Administration (after upgrading the Reassembled Ship Shelter). In this case, as per their descriptions, they provide +1/+2/+3 to production of adjacent Minerals, E...
Its because that tile (the tile that is providing the adjacency bonus) is where you first sent down your calony ship to colonize the planet, or in this case as it is your capital planet it is actually the planetary administration, or capital of the planet. The capital of the planet is what provides the adjacency bonus....
47,726,568
disclaimer: Sorry if I used the terms incorrectly. It would be great if you could provide the correct terms (if I used them incorrectly!) This is my class with the field and constructor: ``` double[] studentMathScores = {81.5,89.0,45.5,99.0,55.0,34.5,56.0,78.0,76.0,80.0}; public StudentDashboard(double[] studentMa...
2017/12/09
[ "https://Stackoverflow.com/questions/47726568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7007072/" ]
you have to check if \_scrollView not null ``` if(this._scrollView != null){ scrollValue = scrollValue + width; this._scrollView.scrollTo({x: scrollValue}) } render() { // ... return ( <ScrollView ref={scrollView => this._scrollView = scrollView} horizontal={true} pagingEnabled={true} ...
You should save the reference on `this`. Even so it might work if the reference is in some other scope you will run into problems when multiple ScrollViews are mounted. ``` componentDidMount() { let scrollValue = 0; setInterval(() => { scrollValue = scrollValue + width; this._scrollView.scrollTo({x: sc...
27,724
I have had a credit card with Bank of America for many years. I also have a long-standing card with another bank, a Sears card, and a newer card (< 2 years old), for a total of 4 credit card accounts. On January 13 I paid off the full balance on my Sears card (~$600) and on my Bank of America card (~$1300). On Januar...
2014/01/28
[ "https://money.stackexchange.com/questions/27724", "https://money.stackexchange.com", "https://money.stackexchange.com/users/3960/" ]
Yes, it is possible that they wanted to get rid of you and waited for you to pay off your balance. I have heard of this pattern before. If you're a flaky customer with late payments and carrying large balance - it is a sign that you may end up defaulting and going into bankruptcy. So once they had a chance to cut you ...
I've worked in a bank's collection department for 3 years and from my experience, these things do happen. Not all the time of course, but it does. Banks usually have a way of **scoring** the financial behaviour of their customer i.e: debits, credits, payments for any form of borrowing etc. When a customer pose a futu...
27,724
I have had a credit card with Bank of America for many years. I also have a long-standing card with another bank, a Sears card, and a newer card (< 2 years old), for a total of 4 credit card accounts. On January 13 I paid off the full balance on my Sears card (~$600) and on my Bank of America card (~$1300). On Januar...
2014/01/28
[ "https://money.stackexchange.com/questions/27724", "https://money.stackexchange.com", "https://money.stackexchange.com/users/3960/" ]
Yes, it is possible that they wanted to get rid of you and waited for you to pay off your balance. I have heard of this pattern before. If you're a flaky customer with late payments and carrying large balance - it is a sign that you may end up defaulting and going into bankruptcy. So once they had a chance to cut you ...
As a former banker, it depends on the institution or the card-issuer. For instance, the bank I worked at assessed a person's banking relationship in total. If a person missed one or two payments on a credit card, but held a large balance in their checking and savings accounts with no overdraft fees (ever), the bank wou...
27,724
I have had a credit card with Bank of America for many years. I also have a long-standing card with another bank, a Sears card, and a newer card (< 2 years old), for a total of 4 credit card accounts. On January 13 I paid off the full balance on my Sears card (~$600) and on my Bank of America card (~$1300). On Januar...
2014/01/28
[ "https://money.stackexchange.com/questions/27724", "https://money.stackexchange.com", "https://money.stackexchange.com/users/3960/" ]
I've worked in a bank's collection department for 3 years and from my experience, these things do happen. Not all the time of course, but it does. Banks usually have a way of **scoring** the financial behaviour of their customer i.e: debits, credits, payments for any form of borrowing etc. When a customer pose a futu...
As a former banker, it depends on the institution or the card-issuer. For instance, the bank I worked at assessed a person's banking relationship in total. If a person missed one or two payments on a credit card, but held a large balance in their checking and savings accounts with no overdraft fees (ever), the bank wou...
17,925,364
VB.net access update query is giving a Syntax Error in Update Query Error. My query is as follows: ``` query = "UPDATE users SET username='" & newUsername & "', password='" & newPassword & "', department='" & newDepartment & "', display_name='" & newDisplayName & "', email='" & newEmail & "', extension='" & newExtensi...
2013/07/29
[ "https://Stackoverflow.com/questions/17925364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2630464/" ]
The error is caused by the usage of the reserved keyword PASSWORD without enclosing it in square brackets. Said that, you never use string concatenation to build sql commands, but always a parameterized query to avoid Sql Injection problems but also syntax error in parsing text values (containing single quotes) or dec...
``` ConStr() Qry="UPDATE users SET username=@uname, [password]=@pass, department=@dept, " & _ "display_name=@dnam, email=@email, extension=@ext, access_level=@acslvl" & _ " WHERE id=@id" cmd = new oledbcommand(Qry,Conn) cmd.Parameters.AddWithValue("@uname",newUsername) cmd.Par...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
I've been struck by the same problem while developing Zend\_Ldap for the Zend Framework. I'll try to explain what the real problem is, but to make it short: **until PHP 5.4, it wasn't possible to use paged results from an Active Directory with an unpatched PHP (`ext/ldap`) version due to limitations in exactly this ext...
This isn't a full answer, but [this guy](http://us3.php.net/manual/en/function.ldap-search.php#73636) was able to do it. I don't understand what he did, though. By the way, a partial answer is that you CAN get "pages" of results. From the [documentation](http://us3.php.net/manual/en/function.ldap-search.php): > > ...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
Support for paged results was added in PHP 5.4. See [ldap\_control\_paged\_result](http://us3.php.net/manual/en/function.ldap-control-paged-result.php) for more details.
This isn't a full answer, but [this guy](http://us3.php.net/manual/en/function.ldap-search.php#73636) was able to do it. I don't understand what he did, though. By the way, a partial answer is that you CAN get "pages" of results. From the [documentation](http://us3.php.net/manual/en/function.ldap-search.php): > > ...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
This isn't a full answer, but [this guy](http://us3.php.net/manual/en/function.ldap-search.php#73636) was able to do it. I don't understand what he did, though. By the way, a partial answer is that you CAN get "pages" of results. From the [documentation](http://us3.php.net/manual/en/function.ldap-search.php): > > ...
Here's an alternative (which works pre PHP 5.4). If you have 10,000 records you need to get but your AD server only returns 5,000 per page: ``` $ldapSearch = ldap_search($ldapResource, $basedn, $filter, array('member;range=0-4999')); $ldapResults = ldap_get_entries($dn, $ldapSearch); $members = $ldapResults[0]['membe...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
This isn't a full answer, but [this guy](http://us3.php.net/manual/en/function.ldap-search.php#73636) was able to do it. I don't understand what he did, though. By the way, a partial answer is that you CAN get "pages" of results. From the [documentation](http://us3.php.net/manual/en/function.ldap-search.php): > > ...
I was able to get around the size limitation using [ldap\_control\_paged\_result](http://php.net/manual/en/function.ldap-control-paged-result.php) ldap\_control\_paged\_result is used to Enable LDAP pagination by sending the pagination control. The below function worked perfectly in my case. ``` function retrieves_us...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
I've been struck by the same problem while developing Zend\_Ldap for the Zend Framework. I'll try to explain what the real problem is, but to make it short: **until PHP 5.4, it wasn't possible to use paged results from an Active Directory with an unpatched PHP (`ext/ldap`) version due to limitations in exactly this ext...
Support for paged results was added in PHP 5.4. See [ldap\_control\_paged\_result](http://us3.php.net/manual/en/function.ldap-control-paged-result.php) for more details.
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
I've been struck by the same problem while developing Zend\_Ldap for the Zend Framework. I'll try to explain what the real problem is, but to make it short: **until PHP 5.4, it wasn't possible to use paged results from an Active Directory with an unpatched PHP (`ext/ldap`) version due to limitations in exactly this ext...
Here's an alternative (which works pre PHP 5.4). If you have 10,000 records you need to get but your AD server only returns 5,000 per page: ``` $ldapSearch = ldap_search($ldapResource, $basedn, $filter, array('member;range=0-4999')); $ldapResults = ldap_get_entries($dn, $ldapSearch); $members = $ldapResults[0]['membe...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
I've been struck by the same problem while developing Zend\_Ldap for the Zend Framework. I'll try to explain what the real problem is, but to make it short: **until PHP 5.4, it wasn't possible to use paged results from an Active Directory with an unpatched PHP (`ext/ldap`) version due to limitations in exactly this ext...
I was able to get around the size limitation using [ldap\_control\_paged\_result](http://php.net/manual/en/function.ldap-control-paged-result.php) ldap\_control\_paged\_result is used to Enable LDAP pagination by sending the pagination control. The below function worked perfectly in my case. ``` function retrieves_us...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
Support for paged results was added in PHP 5.4. See [ldap\_control\_paged\_result](http://us3.php.net/manual/en/function.ldap-control-paged-result.php) for more details.
Here's an alternative (which works pre PHP 5.4). If you have 10,000 records you need to get but your AD server only returns 5,000 per page: ``` $ldapSearch = ldap_search($ldapResource, $basedn, $filter, array('member;range=0-4999')); $ldapResults = ldap_get_entries($dn, $ldapSearch); $members = $ldapResults[0]['membe...
1,473,087
I have a database full of reviews of various products. My task is to perform various calculation and "create" another "database/xml-export" with aggregated data. I am thinking of writing command line programs in python to do that. But I know someone have done this before and I know that there is some open source python...
2009/09/24
[ "https://Stackoverflow.com/questions/1473087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163300/" ]
Support for paged results was added in PHP 5.4. See [ldap\_control\_paged\_result](http://us3.php.net/manual/en/function.ldap-control-paged-result.php) for more details.
I was able to get around the size limitation using [ldap\_control\_paged\_result](http://php.net/manual/en/function.ldap-control-paged-result.php) ldap\_control\_paged\_result is used to Enable LDAP pagination by sending the pagination control. The below function worked perfectly in my case. ``` function retrieves_us...
460,430
The goal is to find the Jordan Canonical Form of the matrix $$A=\begin{bmatrix}2&1&1&2\\0&2&0&1\\0&0&2&-1\\0&0&0&1\end{bmatrix}$$ Since the matrix is already upper-triangular, it's obvious that the eigenvalues are 2 and 1, where 1 has geometric and algebraic multiplicity 1, so that I could easily find the JCF by com...
2013/08/05
[ "https://math.stackexchange.com/questions/460430", "https://math.stackexchange.com", "https://math.stackexchange.com/users/86245/" ]
I'll answer your second question first. Let $$P(x) = \begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&(x-2)^2&0\\0&0&0&(x-1)(x-2)\end{bmatrix}.$$ We need to fix the bottom right $2 \times 2$ principal submatrix. I have explained how to do that [here](https://math.stackexchange.com/questions/222833/), so I'll just present the re...
Nice answer. There is no need of course to go to all this work to see what the answer is, since the result obtained is already enough to get the elementary divisors, namely, (x-1), (x-2), (x-2)^2. Then there is only one way to arrange these so the relatively prime products successively divide each other. Oh I see, thi...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
> > You can update your constraint with a smooth animation if you want, see the chunk of code below: > > > ``` heightOrWidthConstraint.constant = 100 UIView.animate(withDuration: animateTime, animations:{ self.view.layoutIfNeeded() }) ```
``` Create an IBOutlet of NSLayoutConstraint of yourView and update the constant value accordingly the condition specifies. //Connect them from Interface @IBOutlet viewHeight: NSLayoutConstraint! @IBOutlet view: UIView! private func updateViewHeight(height:Int){ guard let aView = view, aViewHeight = viewHeight e...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
Select the height constraint from the Interface builder and take an outlet of it. So, when you want to change the height of the view you can use the below code. ``` yourHeightConstraintOutlet.constant = someValue yourView.layoutIfNeeded() ``` Method `updateConstraints()` is an instance method of `UIView`. It is help...
If the above method does not work then make sure you update it in Dispatch.main.async{} block. You do not need to call layoutIfNeeded() method then.
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
If you have a view with multiple constrains, a much easier way without having to create multiple outlets would be: In interface builder, give each constraint you wish to modify an identifier: [![enter image description here](https://i.stack.imgur.com/Y2GcJ.png)](https://i.stack.imgur.com/Y2GcJ.png) Then in code you ...
First connect the Height constraint in to our viewcontroller for creating IBOutlet like the below code shown ``` @IBOutlet weak var select_dateHeight: NSLayoutConstraint! ``` then put the below code in view did load or inside any actions ``` self.select_dateHeight.constant = 0 // we can change the height value ```...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
> > You can update your constraint with a smooth animation if you want, see the chunk of code below: > > > ``` heightOrWidthConstraint.constant = 100 UIView.animate(withDuration: animateTime, animations:{ self.view.layoutIfNeeded() }) ```
**If you update your constraints with animation then add layout subview in UIView.animate... for example,** ``` @IBOutlet viewHeight: NSLayoutConstraint! @IBOutlet view: UIView! private func updateViewHeight(height:Int){ guard let aView = view, aViewHeight = viewHeight else{ return } aViewHeight.cons...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
First connect the Height constraint in to our viewcontroller for creating IBOutlet like the below code shown ``` @IBOutlet weak var select_dateHeight: NSLayoutConstraint! ``` then put the below code in view did load or inside any actions ``` self.select_dateHeight.constant = 0 // we can change the height value ```...
``` Create an IBOutlet of NSLayoutConstraint of yourView and update the constant value accordingly the condition specifies. //Connect them from Interface @IBOutlet viewHeight: NSLayoutConstraint! @IBOutlet view: UIView! private func updateViewHeight(height:Int){ guard let aView = view, aViewHeight = viewHeight e...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
Select the height constraint from the Interface builder and take an outlet of it. So, when you want to change the height of the view you can use the below code. ``` yourHeightConstraintOutlet.constant = someValue yourView.layoutIfNeeded() ``` Method `updateConstraints()` is an instance method of `UIView`. It is help...
If you have a view with multiple constrains, a much easier way without having to create multiple outlets would be: In interface builder, give each constraint you wish to modify an identifier: [![enter image description here](https://i.stack.imgur.com/Y2GcJ.png)](https://i.stack.imgur.com/Y2GcJ.png) Then in code you ...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
**Change `HeightConstraint` and `WidthConstraint` Without creating `IBOutlet`.** ***Note:*** Assign height or width constraint in Storyboard or XIB file. after fetching this Constraint using this extension. You can use this extension to fetch a height and width Constraint: ``` extension UIView { var heightConstrain...
If the above method does not work then make sure you update it in Dispatch.main.async{} block. You do not need to call layoutIfNeeded() method then.
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
**Change `HeightConstraint` and `WidthConstraint` Without creating `IBOutlet`.** ***Note:*** Assign height or width constraint in Storyboard or XIB file. after fetching this Constraint using this extension. You can use this extension to fetch a height and width Constraint: ``` extension UIView { var heightConstrain...
To update a layout constraint you only need to update the constant property and call layoutIfNeeded after. ``` myConstraint.constant = newValue myView.layoutIfNeeded() ```
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
**Change `HeightConstraint` and `WidthConstraint` Without creating `IBOutlet`.** ***Note:*** Assign height or width constraint in Storyboard or XIB file. after fetching this Constraint using this extension. You can use this extension to fetch a height and width Constraint: ``` extension UIView { var heightConstrain...
First connect the Height constraint in to our viewcontroller for creating IBOutlet like the below code shown ``` @IBOutlet weak var select_dateHeight: NSLayoutConstraint! ``` then put the below code in view did load or inside any actions ``` self.select_dateHeight.constant = 0 // we can change the height value ```...
42,669,560
I have NullPointerException during downloading data from my API using retrofit2. I extricated inner callback in my `DataService` class and I call it in fragment `ListFragment` to download the data. `ListFragment` has implemented `RecyclerView` and will be displaying that data. For now, I want to display only two textVi...
2017/03/08
[ "https://Stackoverflow.com/questions/42669560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649603/" ]
Drag the constraint into your VC as an IBOutlet. Then you can change its associated value (and other properties; check the documentation): ``` @IBOutlet myConstraint : NSLayoutConstraint! @IBOutlet myView : UIView! func updateConstraints() { // You should handle UI updates on the main queue, whenever possible ...
To update a layout constraint you only need to update the constant property and call layoutIfNeeded after. ``` myConstraint.constant = newValue myView.layoutIfNeeded() ```
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You can do this with just the browser. 1. Right click on the "<https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg>" link 2. Select "Save link as" 3. Navigate to c:\cygwin\bin (or wherever your Cygwin binaries live) 4. Remove the .txt extension so that it's just apt-cyg 5. Click "Save" 6. Run `chm...
It seems like there is not problem with the extension but with the line endings in the script (see the part ^M). Similar things happen when you use git on several platforms and change unix ending lf to windows ending clrf and so. Consider change clrf to lf (removing cr) by the command: ``` sed -i 's/\r//g' apt-cyg `...
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
Install Net packages with setup.exe, then use `wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg` and `install apt-cyg /bin` as it was mentioned above.
Remember that the `setup-x86.exe` or `setup-x86_64.exe` downloaded from <https://www.cygwin.com/> is the official method for installing cygwin. If you install using some other method and have problems, you may get little or no official support. Just use the official gui installer to install and update packages.
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You install it like this: 1 - Make sure `lynx` is installed 2 - Run `lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg` 3 - Run `install apt-cyg /bin` That's it!
Note to self: **I am lazy** and I prefer to be able to type `apt-get`... Here is a copy and paste shell command to automate this. ``` $ wget 'https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg' -O \ /usr/bin/apt-cyg && chmod 755 /usr/bin/apt-get; \ test -f /usr/bin/apt-get || ( ...
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You install it like this: 1 - Make sure `lynx` is installed 2 - Run `lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg` 3 - Run `install apt-cyg /bin` That's it!
Remember that the `setup-x86.exe` or `setup-x86_64.exe` downloaded from <https://www.cygwin.com/> is the official method for installing cygwin. If you install using some other method and have problems, you may get little or no official support. Just use the official gui installer to install and update packages.
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You install it like this: 1 - Make sure `lynx` is installed 2 - Run `lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg` 3 - Run `install apt-cyg /bin` That's it!
Install Net packages with setup.exe, then use `wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg` and `install apt-cyg /bin` as it was mentioned above.
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
Install Net packages with setup.exe, then use `wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg` and `install apt-cyg /bin` as it was mentioned above.
Note to self: **I am lazy** and I prefer to be able to type `apt-get`... Here is a copy and paste shell command to automate this. ``` $ wget 'https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg' -O \ /usr/bin/apt-cyg && chmod 755 /usr/bin/apt-get; \ test -f /usr/bin/apt-get || ( ...
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You install it like this: 1 - Make sure `lynx` is installed 2 - Run `lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg` 3 - Run `install apt-cyg /bin` That's it!
It seems like there is not problem with the extension but with the line endings in the script (see the part ^M). Similar things happen when you use git on several platforms and change unix ending lf to windows ending clrf and so. Consider change clrf to lf (removing cr) by the command: ``` sed -i 's/\r//g' apt-cyg `...
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
The [github repo of apt-cyg](https://github.com/transcode-open/apt-cyg) asks to install `apt-cyg` as follows: ``` lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg install apt-cyg /bin ``` (This requires `lynx` to be already installed in your cygwin. If you have not selected `lynx` package duri...
Note to self: **I am lazy** and I prefer to be able to type `apt-get`... Here is a copy and paste shell command to automate this. ``` $ wget 'https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg' -O \ /usr/bin/apt-cyg && chmod 755 /usr/bin/apt-get; \ test -f /usr/bin/apt-get || ( ...
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
You can do this with just the browser. 1. Right click on the "<https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg>" link 2. Select "Save link as" 3. Navigate to c:\cygwin\bin (or wherever your Cygwin binaries live) 4. Remove the .txt extension so that it's just apt-cyg 5. Click "Save" 6. Run `chm...
Install Net packages with setup.exe, then use `wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg` and `install apt-cyg /bin` as it was mentioned above.
45,286,337
taken form [here](http://www.contrib.andrew.cmu.edu/~adbenson/setup.html) - explaining how to install `apt-cyg` > > Install apt-cyg > > > You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg. > > > Inst...
2017/07/24
[ "https://Stackoverflow.com/questions/45286337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904566/" ]
It seems like there is not problem with the extension but with the line endings in the script (see the part ^M). Similar things happen when you use git on several platforms and change unix ending lf to windows ending clrf and so. Consider change clrf to lf (removing cr) by the command: ``` sed -i 's/\r//g' apt-cyg `...
Install Net packages with setup.exe, then use `wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg` and `install apt-cyg /bin` as it was mentioned above.
17,702,875
I've just accidentally typed the following in Octave: ``` sqrt 25 ``` and got back: ``` ans = 7.0711 7.2801 ``` With parentheses, `sqrt(25)` returns the correct result. What is happening without the parentheses? Does MATLAB share the same behaviour or is specific only to Octave? I don't have MATLAB so I can...
2013/07/17
[ "https://Stackoverflow.com/questions/17702875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/233928/" ]
Octave is interpreting it as a length-2 char array, and converting these to their ASCII representation (50 and 53), then getting the square root. This can be done in MATLAB by using: ``` sqrt(double('25')) ``` MATLAB produces an error that `sqrt` isn't defined for char inputs when used without parentheses.
This is due to the dual way that functions can be called in matlab. For example, load, save, etc, all these tools can be called as a function or as a command. Thus, ``` load('foo.bar') load foo.bar ``` Both are valid ways to use load. When a function is used as a command, it assumes the input is a string. So ``` s...
109,282
How to skip weekends in DateListPlot, ie, drawing 20 something data points for a month and not leaving 2 days gap between weeks? Currently DateListPlot occupied the actual number of days for a month and drawing a direct line between Friday and next Monday (where no weekend data available). I want to draw something lik...
2016/03/07
[ "https://mathematica.stackexchange.com/questions/109282", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/13597/" ]
I don't think this is logic to be done using `DateListPlot` because that will contradict the main idea of `DateListPlot` (as far as I understand `DateListPlot`). In my opinion the easy way is to use the normal `ListLinePlot`. ``` data2 = MapAt[ DateString[#, {"Day", " ", "DayNameShort", " ", "MonthNameShort", ...
``` ListLinePlot[d1[[All, 2]], PlotRange -> All, Ticks -> {Transpose[{Range@Length@d1, Rotate[#, -Pi/2] & /@ (DateString[#, "DateShort"] & /@ d1[[All, 1]])}], Automatic}] ``` ![Mathematica graphics](https://i.stack.imgur.com/UrDdc.png) if your list contains "holes", you'll need to fill them up for the ...
257,284
I'm trying to remember something that a math teacher told me many years ago about fractions. If I remember correctly he said that, in a fraction between integers, when the denominator is a multiple of $3$ or $7$, the result is a periodic number. Is this true? Are $3$ and $7$ the only numbers that produce periodic resul...
2012/12/12
[ "https://math.stackexchange.com/questions/257284", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3764/" ]
All rational numbers are periodic, but you seem to be interested in particular in those which cannot be written as terminating decimals like 0.25. Terminating decimals are rational numbers with denominators (in simplest form) which are a power of 2 times a power of 5. So $$\frac71 = \frac{7}{2^0\cdot5^0}$$ is a termina...
Periodic is correct. Some decimals eventually become periodic: $\frac 16=0.16666\overline6$ There are leading non-periodic places if there are factors of $2$ or $5$ in the denominator. To prove it is periodic, we concentrate on primes greater than $5$. Note that $p$ divides $10^{p-1}-1$, so we can represent $\frac ap=\...
257,284
I'm trying to remember something that a math teacher told me many years ago about fractions. If I remember correctly he said that, in a fraction between integers, when the denominator is a multiple of $3$ or $7$, the result is a periodic number. Is this true? Are $3$ and $7$ the only numbers that produce periodic resul...
2012/12/12
[ "https://math.stackexchange.com/questions/257284", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3764/" ]
Assume your number base is $b>1$ and that you are given a rational number $r={p\over q}>0$ with $(p,q)=1$, meaning that $p$ and $q$ have no common divisors. When long division $p:q$ performed in base $b$ finally ends with zero remainder this means that there is an $n\geq0$ and a certain natural number $k$ such that $$...
All rational numbers are periodic, but you seem to be interested in particular in those which cannot be written as terminating decimals like 0.25. Terminating decimals are rational numbers with denominators (in simplest form) which are a power of 2 times a power of 5. So $$\frac71 = \frac{7}{2^0\cdot5^0}$$ is a termina...
257,284
I'm trying to remember something that a math teacher told me many years ago about fractions. If I remember correctly he said that, in a fraction between integers, when the denominator is a multiple of $3$ or $7$, the result is a periodic number. Is this true? Are $3$ and $7$ the only numbers that produce periodic resul...
2012/12/12
[ "https://math.stackexchange.com/questions/257284", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3764/" ]
Assume your number base is $b>1$ and that you are given a rational number $r={p\over q}>0$ with $(p,q)=1$, meaning that $p$ and $q$ have no common divisors. When long division $p:q$ performed in base $b$ finally ends with zero remainder this means that there is an $n\geq0$ and a certain natural number $k$ such that $$...
Periodic is correct. Some decimals eventually become periodic: $\frac 16=0.16666\overline6$ There are leading non-periodic places if there are factors of $2$ or $5$ in the denominator. To prove it is periodic, we concentrate on primes greater than $5$. Note that $p$ divides $10^{p-1}-1$, so we can represent $\frac ap=\...
64,460,955
I followed the first step in this post [Generate SHA-1 for Flutter app](https://stackoverflow.com/questions/51845559/generate-sha-1-for-flutter-app) Now when I open even another project in android studio I have this error. [build.gradle error](https://i.stack.imgur.com/yqwwm.png)
2020/10/21
[ "https://Stackoverflow.com/questions/64460955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9036996/" ]
whenever i got this error i close the build.gradle file and reopen the andriod studio ide , you can try same like this hope it will useful for you
It doen't mean anything. Simply ignore this error you will be able to create, build and deploy apps as usual
64,460,955
I followed the first step in this post [Generate SHA-1 for Flutter app](https://stackoverflow.com/questions/51845559/generate-sha-1-for-flutter-app) Now when I open even another project in android studio I have this error. [build.gradle error](https://i.stack.imgur.com/yqwwm.png)
2020/10/21
[ "https://Stackoverflow.com/questions/64460955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9036996/" ]
whenever i got this error i close the build.gradle file and reopen the andriod studio ide , you can try same like this hope it will useful for you
Yeah, try to close the file and reopen Android Studio. It happened to me as well when I tried to open the build.gradle file on Android Studio. It was behaving well until I tried to open it then I got the red line. But, don’t worry about it it won’t affect your app from running.
66,062,561
How can I change numeric class x = 5 to a character class.
2021/02/05
[ "https://Stackoverflow.com/questions/66062561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15151796/" ]
Slight change of approach. Collect all links first, then process them as you wish. ``` url = 'http://www.mosquedirectory.co.uk/browse/uk/england/london' browser = webdriver.Chrome() browser.get(url) listings = WebDriverWait(browser, 30).until(EC.presence_of_all_elements_located((By.XPATH, "//div[@id='directory_listi...
Instead of storing the [WebElement](https://stackoverflow.com/questions/52782684/what-is-the-difference-between-webdriver-and-webelement-in-selenium/52805139#52805139)s you can store the *textContents*. Ideally you need to induce [WebDriverWait](https://stackoverflow.com/questions/49775502/webdriverwait-not-working-as-...
69,182,875
I'm making a Parse.Cloud.httpRequest using the POST method to retrieve a token from an API in a Back4App Cloud Code Function called 'retrieveToken'. ``` Parse.Cloud.define("retrieveToken", async(request) => { Parse.Cloud.httpRequest({ method: 'POST', url: 'https://.......', headers: { 'Content-Type...
2021/09/14
[ "https://Stackoverflow.com/questions/69182875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16899037/" ]
This worked for me ``` try: from PIL import Image except ImportError: import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = "/usr/local/bin/tesseract" print(pytesseract.image_to_string(Image.open("./test.jpg"))) ``` I have installed tesseract with `brew install tesseract` and pytesseract ...
This is probably occurs because `tessdata` is not executable. In the README they say as follows: ```py import pytesseract # If you don't have tesseract executable in your PATH, include the following: pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>' # Example tesseract_cmd = r'C:\Pro...
69,182,875
I'm making a Parse.Cloud.httpRequest using the POST method to retrieve a token from an API in a Back4App Cloud Code Function called 'retrieveToken'. ``` Parse.Cloud.define("retrieveToken", async(request) => { Parse.Cloud.httpRequest({ method: 'POST', url: 'https://.......', headers: { 'Content-Type...
2021/09/14
[ "https://Stackoverflow.com/questions/69182875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16899037/" ]
This worked for me ``` try: from PIL import Image except ImportError: import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = "/usr/local/bin/tesseract" print(pytesseract.image_to_string(Image.open("./test.jpg"))) ``` I have installed tesseract with `brew install tesseract` and pytesseract ...
I solved this by doing these: * Install `tesseract` by homebrew like this: `brew install tesseract` * Create a new venv: `python -m venv yourVenvName` * Inside the venv, run `pip install pytesseract` You don't need to use `tesseract_cmd`, if you are using mac. And try if you can use `tesseract` inside the venv.
69,182,875
I'm making a Parse.Cloud.httpRequest using the POST method to retrieve a token from an API in a Back4App Cloud Code Function called 'retrieveToken'. ``` Parse.Cloud.define("retrieveToken", async(request) => { Parse.Cloud.httpRequest({ method: 'POST', url: 'https://.......', headers: { 'Content-Type...
2021/09/14
[ "https://Stackoverflow.com/questions/69182875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16899037/" ]
I solved this by doing these: * Install `tesseract` by homebrew like this: `brew install tesseract` * Create a new venv: `python -m venv yourVenvName` * Inside the venv, run `pip install pytesseract` You don't need to use `tesseract_cmd`, if you are using mac. And try if you can use `tesseract` inside the venv.
This is probably occurs because `tessdata` is not executable. In the README they say as follows: ```py import pytesseract # If you don't have tesseract executable in your PATH, include the following: pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>' # Example tesseract_cmd = r'C:\Pro...
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
If your map is static, then instead of a map, use a vector to store your key/value pairs in key order, binary search to look up values in log(n) time, and the vector index to get random pairs in constant time. You can wrap the vector/binary search to look like a map with a random access feature.
Has anyone tried this? <https://github.com/mabdelazim/Random-Access-Map> "C++ template class for random access map. This is like the std::map but you can access items random by index with syntax my\_map.key(i) and my\_map.data(i)"
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
Continuing ryan\_s theme of preconstructed maps and fast random lookup: instead of vector we can use a parallel map of iterators, which should speed up random lookup a bit. ``` map<K, V> const original; ... // construct index-keyed lookup map map<unsigned, map<K, V>::const_iterator> fast_random_lookup; map<K, V>::...
If your map is static, then instead of a map, use a vector to store your key/value pairs in key order, binary search to look up values in log(n) time, and the vector index to get random pairs in constant time. You can wrap the vector/binary search to look like a map with a random access feature.
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
I like James' answer if the map is small or if you don't need a random value very often. If it is large and you do this often enough to make speed important you might be able to keep a separate vector of key values to select a random value from. ``` map<...> MyMap; vector<...> MyVecOfKeys; // <-- add keys to this when...
``` std::random_device dev; std::mt19937_64 rng(dev()); std::uniform_int_distribution<size_t> idDist(0, elements.size() - 1); auto elementId= elements.begin(); std::advance(elementId, idDist(rng)); ``` Now elementId is random :)
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
If your map is static, then instead of a map, use a vector to store your key/value pairs in key order, binary search to look up values in log(n) time, and the vector index to get random pairs in constant time. You can wrap the vector/binary search to look like a map with a random access feature.
Maybe you should consider [Boost.MultiIndex](http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/index.html), although note that it's a little too heavy-weighted.
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
``` map<...> MyMap; iterator item = MyMap.begin(); std::advance( item, random_0_to_n(MyMap.size()) ); ```
Maybe you should consider [Boost.MultiIndex](http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/index.html), although note that it's a little too heavy-weighted.
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
Maybe draw up a random key, then use [lower\_bound](http://www.cplusplus.com/reference/stl/map/lower_bound.html) to find the closest key actually contained.
Has anyone tried this? <https://github.com/mabdelazim/Random-Access-Map> "C++ template class for random access map. This is like the std::map but you can access items random by index with syntax my\_map.key(i) and my\_map.data(i)"
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
I like James' answer if the map is small or if you don't need a random value very often. If it is large and you do this often enough to make speed important you might be able to keep a separate vector of key values to select a random value from. ``` map<...> MyMap; vector<...> MyVecOfKeys; // <-- add keys to this when...
Maybe you should consider [Boost.MultiIndex](http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/index.html), although note that it's a little too heavy-weighted.
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
I like James' answer if the map is small or if you don't need a random value very often. If it is large and you do this often enough to make speed important you might be able to keep a separate vector of key values to select a random value from. ``` map<...> MyMap; vector<...> MyVecOfKeys; // <-- add keys to this when...
Has anyone tried this? <https://github.com/mabdelazim/Random-Access-Map> "C++ template class for random access map. This is like the std::map but you can access items random by index with syntax my\_map.key(i) and my\_map.data(i)"
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
Maybe draw up a random key, then use [lower\_bound](http://www.cplusplus.com/reference/stl/map/lower_bound.html) to find the closest key actually contained.
If your map is static, then instead of a map, use a vector to store your key/value pairs in key order, binary search to look up values in log(n) time, and the vector index to get random pairs in constant time. You can wrap the vector/binary search to look like a map with a random access feature.
158,836
what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated.
2008/10/01
[ "https://Stackoverflow.com/questions/158836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8264/" ]
If your map is static, then instead of a map, use a vector to store your key/value pairs in key order, binary search to look up values in log(n) time, and the vector index to get random pairs in constant time. You can wrap the vector/binary search to look like a map with a random access feature.
``` std::random_device dev; std::mt19937_64 rng(dev()); std::uniform_int_distribution<size_t> idDist(0, elements.size() - 1); auto elementId= elements.begin(); std::advance(elementId, idDist(rng)); ``` Now elementId is random :)
490,235
`getaddrinfo()` does not translate a hostname into an IP address and consequently does not `connect()` to the server. Is something wrong with my implementation - compiles with no warning messages? Is this function call to `connect` correct? ``` connect(client, result->ai_addr, result->ai_addrlen) ``` Full implement...
2009/01/29
[ "https://Stackoverflow.com/questions/490235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
`getaddrinfo` may be giving you an IPv6 address, or perhaps the machine has more than one IP address and you're trying to connect to the wrong one. Also, if your server is listening on 127.0.0.1 and you try to connect to the real IP address, the connection will fail. Similarly, if the server is listening on the real I...
Try setting the `hint.ai_family` to `AF_UNSPEC` instead of `AF_INET`, I believe that when `AF_INET` is specfied the getaddrinfo functions excepts IPv4-like address.
376,854
[This question](https://stackoverflow.com/questions/30991992/how-to-get-difference-of-time-in-human-readable-with-laravel-5) was closed as being too broad and I was going to vote to reopen it, but I wanted to see what the community consensus was before I pushed it into the queue and also, I want to see if my thinking i...
2018/11/20
[ "https://meta.stackoverflow.com/questions/376854", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2263631/" ]
Doesn't seem to be all that broad to me. The scope is well defined and clear and it's apparent that the question and answer have had a positive effect on the community. I've cast a reopen vote on it.
If you have a look at the **original state** of the question before it was closed as too broad: > > How to get difference of time in human readable with Laravel 5 > > > I want to put the difference of time between my updated\_at column (in database using timestamp) and now. I want it to be human-friendly like so : ...
376,854
[This question](https://stackoverflow.com/questions/30991992/how-to-get-difference-of-time-in-human-readable-with-laravel-5) was closed as being too broad and I was going to vote to reopen it, but I wanted to see what the community consensus was before I pushed it into the queue and also, I want to see if my thinking i...
2018/11/20
[ "https://meta.stackoverflow.com/questions/376854", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2263631/" ]
Doesn't seem to be all that broad to me. The scope is well defined and clear and it's apparent that the question and answer have had a positive effect on the community. I've cast a reopen vote on it.
Although I agree that the question probably isn't too broad, it has characteristics that could nevertheless tend to attract too-broad close votes. In particular, you are always better off, IMO, stating the appropriate scope and context for a question in the question text. The title and tags can convey that information ...
376,854
[This question](https://stackoverflow.com/questions/30991992/how-to-get-difference-of-time-in-human-readable-with-laravel-5) was closed as being too broad and I was going to vote to reopen it, but I wanted to see what the community consensus was before I pushed it into the queue and also, I want to see if my thinking i...
2018/11/20
[ "https://meta.stackoverflow.com/questions/376854", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2263631/" ]
Doesn't seem to be all that broad to me. The scope is well defined and clear and it's apparent that the question and answer have had a positive effect on the community. I've cast a reopen vote on it.
I personally think it's clear that this question isn't too broad. * The question asks 'Is there any function out there that I could use to make it easier?' (to achieve a specified result using a specific framework). * There is one answer, that answers this specific question and provides that specific functionality. * ...
376,854
[This question](https://stackoverflow.com/questions/30991992/how-to-get-difference-of-time-in-human-readable-with-laravel-5) was closed as being too broad and I was going to vote to reopen it, but I wanted to see what the community consensus was before I pushed it into the queue and also, I want to see if my thinking i...
2018/11/20
[ "https://meta.stackoverflow.com/questions/376854", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2263631/" ]
Although I agree that the question probably isn't too broad, it has characteristics that could nevertheless tend to attract too-broad close votes. In particular, you are always better off, IMO, stating the appropriate scope and context for a question in the question text. The title and tags can convey that information ...
If you have a look at the **original state** of the question before it was closed as too broad: > > How to get difference of time in human readable with Laravel 5 > > > I want to put the difference of time between my updated\_at column (in database using timestamp) and now. I want it to be human-friendly like so : ...
376,854
[This question](https://stackoverflow.com/questions/30991992/how-to-get-difference-of-time-in-human-readable-with-laravel-5) was closed as being too broad and I was going to vote to reopen it, but I wanted to see what the community consensus was before I pushed it into the queue and also, I want to see if my thinking i...
2018/11/20
[ "https://meta.stackoverflow.com/questions/376854", "https://meta.stackoverflow.com", "https://meta.stackoverflow.com/users/2263631/" ]
Although I agree that the question probably isn't too broad, it has characteristics that could nevertheless tend to attract too-broad close votes. In particular, you are always better off, IMO, stating the appropriate scope and context for a question in the question text. The title and tags can convey that information ...
I personally think it's clear that this question isn't too broad. * The question asks 'Is there any function out there that I could use to make it easier?' (to achieve a specified result using a specific framework). * There is one answer, that answers this specific question and provides that specific functionality. * ...
19,565,392
I am getting the following error from my pom.xml file. ***Multiple annotations found at this line: - ArtifactTransferException: Failure to transfer opensymphony:ognl:jar:2.6.11 from <http://repository.primefaces.org> was cached in the local repository, resolution will not be reattempted until the update interval of...
2013/10/24
[ "https://Stackoverflow.com/questions/19565392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2357566/" ]
Firstly, check whether the jar file opensymphony:ognl:jar:2.6.11 exists in your repository. If yes, remove the opensymphony:ognl folder in your local repository and run maven install again to see what happens.
Try to add this repo : ``` <repository> <id>opensymphony</id> <name>opensymphony</name> <url>http://mirrors.ibiblio.org/maven2</url> </repository> ```
19,565,392
I am getting the following error from my pom.xml file. ***Multiple annotations found at this line: - ArtifactTransferException: Failure to transfer opensymphony:ognl:jar:2.6.11 from <http://repository.primefaces.org> was cached in the local repository, resolution will not be reattempted until the update interval of...
2013/10/24
[ "https://Stackoverflow.com/questions/19565392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2357566/" ]
Firstly, check whether the jar file opensymphony:ognl:jar:2.6.11 exists in your repository. If yes, remove the opensymphony:ognl folder in your local repository and run maven install again to see what happens.
As opensymphony:ognl is now a dead project and 2.6.11 is quite old You can try one the updated project ``` <dependency> <groupId>ognl</groupId> <artifactId>ognl</artifactId> <version>3.0.8</version> </dependency> ``` just a suggestion..
19,565,392
I am getting the following error from my pom.xml file. ***Multiple annotations found at this line: - ArtifactTransferException: Failure to transfer opensymphony:ognl:jar:2.6.11 from <http://repository.primefaces.org> was cached in the local repository, resolution will not be reattempted until the update interval of...
2013/10/24
[ "https://Stackoverflow.com/questions/19565392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2357566/" ]
Firstly, check whether the jar file opensymphony:ognl:jar:2.6.11 exists in your repository. If yes, remove the opensymphony:ognl folder in your local repository and run maven install again to see what happens.
Delete the entire .m2 repo and build again. it worked for me.
22,935,520
If I want to return a pointer from a member-function I first thought the syntax should look like the following: ``` char SecondClass:: *getName() { return this->name; } ``` But I got an error-message in Eclipse that it couldn't solve the field "name". Somehow it becomes hidden in this case. The correct soluti...
2014/04/08
[ "https://Stackoverflow.com/questions/22935520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2991252/" ]
This has nothing to do with pointers. The method is called `SecondClass::getName()` and it returns a char\*. So you can write ``` char* SecondClass::getName() ``` or ``` char *SecondClass::getName() ``` but you can't put the \* between the class name and the method name.
In c++, the signature of a member function is [returnType] [ClassName]::functionName{} the star is part of the return type, which is char\*, or pointer to a char. Your first way of declaring a function is just not valid c++.
22,935,520
If I want to return a pointer from a member-function I first thought the syntax should look like the following: ``` char SecondClass:: *getName() { return this->name; } ``` But I got an error-message in Eclipse that it couldn't solve the field "name". Somehow it becomes hidden in this case. The correct soluti...
2014/04/08
[ "https://Stackoverflow.com/questions/22935520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2991252/" ]
This has nothing to do with pointers. The method is called `SecondClass::getName()` and it returns a char\*. So you can write ``` char* SecondClass::getName() ``` or ``` char *SecondClass::getName() ``` but you can't put the \* between the class name and the method name.
`char SecondClass:: *getName()` is a very different function from `char *SecondClass:: getName()`. The first one not a member function of `SecondClass` or any other class, thus you cannot refer to `this` inside it. It happens to return a special kind of pointer called *pointer-to-member*. Its type is spelled `char Se...
22,935,520
If I want to return a pointer from a member-function I first thought the syntax should look like the following: ``` char SecondClass:: *getName() { return this->name; } ``` But I got an error-message in Eclipse that it couldn't solve the field "name". Somehow it becomes hidden in this case. The correct soluti...
2014/04/08
[ "https://Stackoverflow.com/questions/22935520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2991252/" ]
`char SecondClass:: *getName()` is a very different function from `char *SecondClass:: getName()`. The first one not a member function of `SecondClass` or any other class, thus you cannot refer to `this` inside it. It happens to return a special kind of pointer called *pointer-to-member*. Its type is spelled `char Se...
In c++, the signature of a member function is [returnType] [ClassName]::functionName{} the star is part of the return type, which is char\*, or pointer to a char. Your first way of declaring a function is just not valid c++.
13,785,364
I am trying to read parameters from a YAML file into Javascript. Is there any good library to do this? I've tried these libraries: <https://github.com/nodeca/js-yaml> and <http://code.google.com/p/javascript-yaml-parser/> but both libraries only have functions that parse YAML when it is given as a string, instead of ...
2012/12/09
[ "https://Stackoverflow.com/questions/13785364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1669641/" ]
[js-yaml](https://github.com/nodeca/js-yaml) does. I found this by Googling "node js yaml" because reading from files in JavaScript is done server side with node.js (or something like it), not from a browser. The README for js-yaml begins > > usage: js-yaml [-h] [-v] [-c] [-j] [-t] file > > > Positional arguments:...
If you want to parse it in web browser, you can load the yaml file you want to parse in `script` tag and read it's content using js code, which will provide you string result. And if you want to parse yaml in nodejs environment, you can read file directly and also got string. I don't think this is a problem from direct...
13,785,364
I am trying to read parameters from a YAML file into Javascript. Is there any good library to do this? I've tried these libraries: <https://github.com/nodeca/js-yaml> and <http://code.google.com/p/javascript-yaml-parser/> but both libraries only have functions that parse YAML when it is given as a string, instead of ...
2012/12/09
[ "https://Stackoverflow.com/questions/13785364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1669641/" ]
[js-yaml](https://github.com/nodeca/js-yaml) does. I found this by Googling "node js yaml" because reading from files in JavaScript is done server side with node.js (or something like it), not from a browser. The README for js-yaml begins > > usage: js-yaml [-h] [-v] [-c] [-j] [-t] file > > > Positional arguments:...
It seemed to be hard to find a good example of using js-yaml from a browser. Probably because they emphasize the use of the parser in node.js. The parser is at <https://github.com/nodeca/js-yaml>. Use NPM to install it ``` npm install js-yaml ``` and grab the js-yaml.js file from the node\_modules/js-yaml/bin dir...
13,785,364
I am trying to read parameters from a YAML file into Javascript. Is there any good library to do this? I've tried these libraries: <https://github.com/nodeca/js-yaml> and <http://code.google.com/p/javascript-yaml-parser/> but both libraries only have functions that parse YAML when it is given as a string, instead of ...
2012/12/09
[ "https://Stackoverflow.com/questions/13785364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1669641/" ]
It seemed to be hard to find a good example of using js-yaml from a browser. Probably because they emphasize the use of the parser in node.js. The parser is at <https://github.com/nodeca/js-yaml>. Use NPM to install it ``` npm install js-yaml ``` and grab the js-yaml.js file from the node\_modules/js-yaml/bin dir...
If you want to parse it in web browser, you can load the yaml file you want to parse in `script` tag and read it's content using js code, which will provide you string result. And if you want to parse yaml in nodejs environment, you can read file directly and also got string. I don't think this is a problem from direct...
23,346,304
I'm learning regex. I'm trying to get the most correct regex for the following : Input is: ``` class:first,class:second,subject:math,subject:bio,room:nine ``` Expected output: ``` first,second,math,bio,nine ``` Want to store the above output in a string . var s = ""; Here's what I tried: ``` (:)(.*)(,) ``` H...
2014/04/28
[ "https://Stackoverflow.com/questions/23346304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3561824/" ]
If I were you, I would separate the tasks of dividing your file into tractable chunks and the compute-intensive manipulation part. If that is not possible (for example, if lines are not independent for some reason), then you might have to do a purely serial implementation anyway. Once you have N chunks in separate fil...
You're describing a task queue. Celery is a task queue: <http://www.celeryproject.org/>
18,373
**Background**: my parents have been running a small restaurant which opens everyday with another employee for a couple of years now; things went okay so far, I don't hear much complaints. I've been helping them whenever I can, back then when I was still in college until I graduated recently and got a job. And here c...
2018/09/11
[ "https://interpersonal.stackexchange.com/questions/18373", "https://interpersonal.stackexchange.com", "https://interpersonal.stackexchange.com/users/20459/" ]
It seems to me that your issue is not if the restaurant is open or not but that they take up your weekends when you need to rest so my answer would be more or less to "how can you convince them to let you rest on the weekends". First thing first, they are your parents and they have provided for you and taken care of y...
Tell them all, including the employee, that after October 1, 2018, you will never again step in to help. You are taking responsibility for your parents' problem, and their employee's problem. As long as you take responsibility for the problem, they can treat it as not their problem, and they can delay solving it. Whe...
44,806,332
There are three different tables (OPTIONS, FIELDS and DATA) in import parameter "QUERY\_TABLE" = "LTAP". I created a java program to display column FIELDNAME from the table FIELDS with helping function RFC\_READ\_TABLE. It always appears Error **com.sap.conn.jco.AbapException: (126) TABLE\_NOT\_AVAILABLE: TABLE\_NOT\_...
2017/06/28
[ "https://Stackoverflow.com/questions/44806332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8226809/" ]
There is nothing wrong with your JCo code. The error message comes from the SAP system. So you need to check in the SAP system, what that error code means. This can be done in transaction SE91. You enter message class = "DA" and message number = "300" and click display. I did this for you, and the result is: "No activ...
I see you are connecting to an ABAP system using JCoDestinationManager. It means your are using the properties from mySAPSystem destination. Please check if the mySAPSystem connects to a proper ABAP system. What are these lines are needed for ``` Properties connectProperties = new Properties(); connectProperties.set...
51,548,255
I am running caret's neural network on the Bike Sharing dataset and I get the following error message: > > In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, > : There were missing values in resampled performance measures. > > > I am not sure what the problem is. Can anyone help please? The...
2018/07/26
[ "https://Stackoverflow.com/questions/51548255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6769382/" ]
phivers comment is spot on, however I would still like to provide a more verbose answer on this concrete example. In order to investigate what is going on in more detail one should add the argument `savePredictions = "all"` to `trainControl`: ``` control = trainControl(method = 'repeatedcv', nu...
The answer by @missuse is already very insightful to understand why this error happens. So I just want to add some straightforward ways how to get rid of this error. If in some cross-validation folds the predictions get zero variance, the model didn't converge. In such cases, you can try the neuralnet package which o...